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 StringEncode an object as an HTML string.getText()Get the current text of the HTML.static booleanWhether top-level HTML elements are allowed or not.booleanisEmpty()Check if the content is empty or not.booleanCheck if the last add was a new line or not.newLine()Adds a new line.newLine(boolean force) Adds a new line.static voidIf this method is invoked ever, top-leve HTML elements will be allowed while building the HTML content.voidSet text.space(int count) Add spaces.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:StyledBuilderAdds a new line.- Specified by:
newLinein 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:StyledBuilderAdds a new line. (Default implementation doesn't force a new line).- Specified by:
newLinein interfaceStyledBuilder- Returns:
- Self-reference is returned.
-
drawLine
-
append
Description copied from interface:StyledBuilderAppend an object with the given color.- Specified by:
appendin 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:StyledBuilderAppend an object with the given style.- Specified by:
appendin 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:StyledBuilderAppend an object with the given style. Default implementation ignores styles.- Specified by:
appendin interfaceStyledBuilder- Parameters:
object- Object to append.styles- Styles to be set.- Returns:
- Self-reference is returned.
-
appendHTML
-
clearContent
Description copied from interface:StyledBuilderClear the content.- Specified by:
clearContentin interfaceStyledBuilder- Returns:
- Self-reference is returned.
-
clear
-
isEmpty
public boolean isEmpty()Description copied from interface:StyledBuilderCheck if the content is empty or not.- Specified by:
isEmptyin interfaceStyledBuilder- Returns:
- True or false.
-
isNewLine
public boolean isNewLine()Description copied from interface:StyledBuilderCheck if the last add was a new line or not.- Specified by:
isNewLinein 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:StyledBuilderAppend an object.- Specified by:
appendin 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.
-