com.jgraph.components.labels

Class RichTextBusinessObject

public class RichTextBusinessObject extends Object implements Cloneable, Serializable

User object with a dynamic set of properties in a hashtable. The property under valueKey is used in toString to represent the object as a string. This object supports values of type JGraphpadRichTextValue.

See Also: RichTextGraphModel

Field Summary
protected Mapproperties
Holds the properties as (key, value) pairs.
static StringvalueKey
Key to use for converting this object to a string.
Constructor Summary
RichTextBusinessObject()
Constructs a business object with an empty string as its value.
RichTextBusinessObject(Object value)
Constructs a business object with the specified value.
Method Summary
protected StringchopString(String s, int max)
A helper method that crops string to the specified length, adding 3 dots if there were more characters.
Objectclone()
Returns a clone of the object.
MapgetProperties()
Returns the properties.
ObjectgetProperty(Object key)
Returns the property under the specified key.
StringgetTooltip()
Hook for subclassers to create a custom tooltip for this user object.
ObjectgetValue()
Returns the value for valueKey.
booleanisComponent()
Returns true if the value is a component.
booleanisRichText()
Returns true if the value is a rich text value.
ObjectputProperty(Object key, Object value)
Sets the property under the specified key.
voidsetProperties(Map properties)
Sets the properties.
voidsetValue(Object value)
Sets the value for valueKey.
StringtoString()
Returns the string representation of the value or an empty string if no value exists.

Field Detail

properties

protected Map properties
Holds the properties as (key, value) pairs.

valueKey

public static String valueKey
Key to use for converting this object to a string.

Constructor Detail

RichTextBusinessObject

public RichTextBusinessObject()
Constructs a business object with an empty string as its value.

RichTextBusinessObject

public RichTextBusinessObject(Object value)
Constructs a business object with the specified value.

Parameters: value The value of the new object.

Method Detail

chopString

protected String chopString(String s, int max)
A helper method that crops string to the specified length, adding 3 dots if there were more characters.

Returns: The chopped string.

clone

public Object clone()
Returns a clone of the object. Note: The properties are not cloned, only a clone of the containing map is used. As a special case, if the user object is a JSlider or a JTree then a new instance will be put in place of the old instance.

Returns: Returns a clone of this object.

getProperties

public Map getProperties()
Returns the properties.

Returns: Returns the properties.

getProperty

public Object getProperty(Object key)
Returns the property under the specified key.

Parameters: key The key of the property.

Returns: Returns the specified property.

getTooltip

public String getTooltip()
Hook for subclassers to create a custom tooltip for this user object. This is used in JGraphpadGraph#getToolTipForCell(Object).

Returns: Returns a tooltip for the user object.

getValue

public Object getValue()
Returns the value for valueKey.

Returns: Returns the value.

isComponent

public boolean isComponent()
Returns true if the value is a component.

Returns: Returns true if value is a component.

isRichText

public boolean isRichText()
Returns true if the value is a rich text value.

Returns: Returns true if value is rich text.

putProperty

public Object putProperty(Object key, Object value)
Sets the property under the specified key.

Parameters: key They key of the property. value The value of the property.

Returns: Returns the previous value.

setProperties

public void setProperties(Map properties)
Sets the properties.

Parameters: properties The properties to set.

setValue

public void setValue(Object value)
Sets the value for valueKey.

Parameters: value The value to set.

toString

public String toString()
Returns the string representation of the value or an empty string if no value exists.

Returns: Returns the value as a string.

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