Class HTMLContent
java.lang.Object
com.amalgamasimulation.desktop.html.HTMLContent
- All Implemented Interfaces:
HTMLConvertable
The HTMLContent class represents a piece of content that can be converted to HTML.
It implements the
HTMLConvertable interface, providing a method to convert
the content to an HTML string.- Author:
- Alexey Glazyrin
-
Constructor Summary
ConstructorsConstructorDescriptionHTMLContent(String content) Constructs a new HTMLContent instance with the specified content. -
Method Summary
Modifier and TypeMethodDescriptioncontent()Retrieves the current content of this HTMLContent instance.Sets the content of this HTMLContent instance and returns the modified instance to allow method chaining.Creates a deep copy of this HTMLConvertable element, preserving the element's structure while substituting text content using the provided translation mapping.Converts the content to an HTML string.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.amalgamasimulation.desktop.html.HTMLConvertable
copy, toHTML
-
Constructor Details
-
HTMLContent
Constructs a new HTMLContent instance with the specified content.- Parameters:
content- the content to be converted to HTML
-
-
Method Details
-
content
Sets the content of this HTMLContent instance and returns the modified instance to allow method chaining.- Parameters:
content- the new content to set- Returns:
- this instance after modification
-
content
Retrieves the current content of this HTMLContent instance.- Returns:
- the current content string
-
toHTML
Converts the content to an HTML string. If the content is null, an empty string is returned.- Specified by:
toHTMLin interfaceHTMLConvertable- Parameters:
outStringsMap- set of unique strings of text content- Returns:
- the HTML representation of the content
-
copy
Description copied from interface:HTMLConvertableCreates a deep copy of this HTMLConvertable element, preserving the element's structure while substituting text content using the provided translation mapping.- Specified by:
copyin interfaceHTMLConvertable- Parameters:
stringsSubstitutionMap- a map where keys are original text strings (as collected byHTMLConvertable.toHTML(Set)) and values are their translations. During copying, any encountered text content present in this map will be replaced with its translated version.- Returns:
- a new independent copy of this HTMLConvertable instance with translated content
-