Class RichTextValue
java.lang.Object
com.jgraph.components.labels.RichTextValue
- All Implemented Interfaces:
Serializable, Cloneable
Rich text replacement for string values in
RichTextBusinessObject.
This requirs the MultiLineVertexView to provide a rich text editor
and renderer.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic RTFEditorKitHolds the shared editor kit for creating new documents.protected StringA plain-text representation of the rich text is always keps along with the rich text value to speedup thetoString()method.protected StringHolds the rich text as an RTF encoded text. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new empty rich text value.RichTextValue(String stringValue) Constructs a new rich text document using the string text.RichTextValue(Document document) Constructs a new rich text value using the specified document. -
Method Summary
Modifier and TypeMethodDescriptionprotected static DocumentHook for subclassers to create a default document.static DocumentcreateDefaultDocument(String value) Hook for subclassers to create a default document.static StringgetPlainText(RichTextValue richText) Returns a plain text representation of the specified rich text value.Returns the richt text value as an RTF encoded string.static StringgetRichText(Document document) Returns the rich text encoded RTF string from the specified document.voidinsertInto(Document document) Inserts this rich text into the specified component.voidsetRichText(String richText) Sets the richt text value as an RTF encoded string and updatesplainText.toString()Returns the plain text representation of this rich text value.
-
Field Details
-
editorKit
Holds the shared editor kit for creating new documents. -
richText
Holds the rich text as an RTF encoded text. -
plainText
A plain-text representation of the rich text is always keps along with the rich text value to speedup thetoString()method.
-
-
Constructor Details
-
RichTextValue
public RichTextValue()Constructs a new empty rich text value. -
RichTextValue
Constructs a new rich text value using the specified document.- Parameters:
document- The document to obtain the rich text from.
-
RichTextValue
Constructs a new rich text document using the string text.- Parameters:
stringValue- The string to use as the initial value.
-
-
Method Details
-
insertInto
Inserts this rich text into the specified component. This implementation silently ignores all exceptions.- Parameters:
document- The document to insert the rich text into.
-
getRichText
Returns the richt text value as an RTF encoded string.- Returns:
- Returns the rich text.
-
setRichText
-
toString
-
getRichText
-
getPlainText
Returns a plain text representation of the specified rich text value. If an exception occurs during conversion then the RTF encoded string is returned instead.- Parameters:
richText- The rich text value to be converted.- Returns:
- Returns the plain text representation.
-
createDefaultDocument
Hook for subclassers to create a default document. This implementation usescreateDefaultDocument(String)with a value of null.- Returns:
- Returns a new empty default document.
-
createDefaultDocument
-