Package com.storedobject.common
Class HTMLText
java.lang.Object
com.storedobject.common.HTMLText
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.storedobject.common.StyledBuilder
StyledBuilder.Style
-
Field Summary
FieldsFields inherited from interface com.storedobject.common.StyledBuilder
EMPTY_STRINGS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppend an object.append
(Object object, StyledBuilder.Style... styles) Append an object with the given style.Append an object with the given color.Append an object with the given style.appendHTML
(String html) Append valid HTML text.clear()
Clear the content.Clear the content.drawLine()
Append a line using the tag.static String
Encode an object as an HTML string.getText()
Get the current text of the HTML.static boolean
Whether top-level HTML elements are allowed or not.boolean
isEmpty()
Check if the content is empty or not.boolean
Check if the last add was a new line or not.newLine()
Adds a new line.newLine
(boolean force) Adds a new line.static void
If this method is invoked ever, top-leve HTML elements will be allowed while building the HTML content.void
Set text.space
(int count) Add spaces.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.storedobject.common.StyledBuilder
setValue, setValue, setValue, update
-
Field Details
-
ALLOW_TOP_LEVEL
public static boolean ALLOW_TOP_LEVEL -
value
-
-
Constructor Details
-
HTMLText
public HTMLText()Constructor. -
HTMLText
-
HTMLText
Constructor.- Parameters:
object
- Object to be added.style
- Styles to be set.
-
HTMLText
-
-
Method Details
-
toString
-
getText
-
setText
-
encode
-
newLine
Description copied from interface:StyledBuilder
Adds a new line.- Specified by:
newLine
in interfaceStyledBuilder
- Parameters:
force
- If true, a new line is added anyway. Otherwise, no new line should be added ifStyledBuilder.isNewLine()
returns false.- Returns:
- Self-reference is returned.
-
newLine
Description copied from interface:StyledBuilder
Adds a new line. (Default implementation doesn't force a new line).- Specified by:
newLine
in interfaceStyledBuilder
- Returns:
- Self-reference is returned.
-
drawLine
-
append
Description copied from interface:StyledBuilder
Append an object with the given color.- Specified by:
append
in interfaceStyledBuilder
- Parameters:
object
- Object to append.color
- Color to be set. (Default implementation ignores this).- Returns:
- Self-reference is returned.
-
append
Description copied from interface:StyledBuilder
Append an object with the given style.- Specified by:
append
in interfaceStyledBuilder
- Parameters:
object
- Object to append.style
- Styles to be set. (Default implementation ignores this).- Returns:
- Self-reference is returned.
-
append
Description copied from interface:StyledBuilder
Append an object with the given style. Default implementation ignores styles.- Specified by:
append
in interfaceStyledBuilder
- Parameters:
object
- Object to append.styles
- Styles to be set.- Returns:
- Self-reference is returned.
-
appendHTML
-
clearContent
Description copied from interface:StyledBuilder
Clear the content.- Specified by:
clearContent
in interfaceStyledBuilder
- Returns:
- Self-reference is returned.
-
clear
-
isEmpty
public boolean isEmpty()Description copied from interface:StyledBuilder
Check if the content is empty or not.- Specified by:
isEmpty
in interfaceStyledBuilder
- Returns:
- True or false.
-
isNewLine
public boolean isNewLine()Description copied from interface:StyledBuilder
Check if the last add was a new line or not.- Specified by:
isNewLine
in interfaceStyledBuilder
- Returns:
- True/false
-
space
Add spaces.- Parameters:
count
- Number of spaces to be added.- Returns:
- Self-reference is returned.
-
append
Description copied from interface:StyledBuilder
Append an object.- Specified by:
append
in interfaceStyledBuilder
- Parameters:
object
- Object to append.- Returns:
- Self-reference is returned.
-
setAllowTopLevelHTML
public static void setAllowTopLevelHTML()If this method is invoked ever, top-leve HTML elements will be allowed while building the HTML content. This could cause unexpected changes to the existing HTML on the page. -
isAllowTopLevelHTML
public static boolean isAllowTopLevelHTML()Whether top-level HTML elements are allowed or not.- Returns:
- True/false.
-