JGraph
v5.13.0.4


com.jgraph.components.labels
Class RichTextValue

java.lang.Object
  extended by com.jgraph.components.labels.RichTextValue
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class RichTextValue
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Rich text replacement for string values in RichTextBusinessObject. This requirs the MultiLineVertexView to provide a rich text editor and renderer.

See Also:
RichTextGraphModel, VertexRenderer, RTFEditorKit, Serialized Form

Field Summary
static javax.swing.text.rtf.RTFEditorKit editorKit
          Holds the shared editor kit for creating new documents.
protected  java.lang.String plainText
          A plain-text representation of the rich text is always keps along with the rich text value to speedup the toString() method.
protected  java.lang.String richText
          Holds the rich text as an RTF encoded text.
 
Constructor Summary
RichTextValue()
          Constructs a new empty rich text value.
RichTextValue(javax.swing.text.Document document)
          Constructs a new rich text value using the specified document.
RichTextValue(java.lang.String stringValue)
          Constructs a new rich text document using the string text.
 
Method Summary
protected static javax.swing.text.Document createDefaultDocument()
          Hook for subclassers to create a default document.
static javax.swing.text.Document createDefaultDocument(java.lang.String value)
          Hook for subclassers to create a default document.
static java.lang.String getPlainText(RichTextValue richText)
          Returns a plain text representation of the specified rich text value.
 java.lang.String getRichText()
          Returns the richt text value as an RTF encoded string.
static java.lang.String getRichText(javax.swing.text.Document document)
          Returns the rich text encoded RTF string from the specified document.
 void insertInto(javax.swing.text.Document document)
          Inserts this rich text into the specified component.
 void setRichText(java.lang.String richText)
          Sets the richt text value as an RTF encoded string and updates plainText.
 java.lang.String toString()
          Returns the plain text representation of this rich text value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

editorKit

public static javax.swing.text.rtf.RTFEditorKit editorKit
Holds the shared editor kit for creating new documents.


richText

protected java.lang.String richText
Holds the rich text as an RTF encoded text.


plainText

protected java.lang.String plainText
A plain-text representation of the rich text is always keps along with the rich text value to speedup the toString() method.

Constructor Detail

RichTextValue

public RichTextValue()
Constructs a new empty rich text value.


RichTextValue

public RichTextValue(javax.swing.text.Document document)
Constructs a new rich text value using the specified document.

Parameters:
document - The document to obtain the rich text from.

RichTextValue

public RichTextValue(java.lang.String stringValue)
Constructs a new rich text document using the string text.

Parameters:
stringValue - The string to use as the initial value.
Method Detail

insertInto

public void insertInto(javax.swing.text.Document document)
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

public java.lang.String getRichText()
Returns the richt text value as an RTF encoded string.

Returns:
Returns the rich text.

setRichText

public void setRichText(java.lang.String richText)
Sets the richt text value as an RTF encoded string and updates plainText.

Parameters:
richText - The rich text to set.

toString

public java.lang.String toString()
Returns the plain text representation of this rich text value.

Overrides:
toString in class java.lang.Object
Returns:
Returns plainText.

getRichText

public static java.lang.String getRichText(javax.swing.text.Document document)
Returns the rich text encoded RTF string from the specified document.

Parameters:
document - The document to be converted.
Returns:
Returns the RTF encoded document.

getPlainText

public static java.lang.String getPlainText(RichTextValue richText)
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

protected static javax.swing.text.Document createDefaultDocument()
Hook for subclassers to create a default document. This implementation uses createDefaultDocument(String) with a value of null.

Returns:
Returns a new empty default document.

createDefaultDocument

public static javax.swing.text.Document createDefaultDocument(java.lang.String value)
Hook for subclassers to create a default document. This implementation uses editorKit to create the document and sets its value.

Returns:
Returns a new empty default document.

JGraph
v5.13.0.4


Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.