com.mindfusion.diagramming
Class TreeViewItem

java.lang.Object
  extended by com.mindfusion.diagramming.TreeViewItem
All Implemented Interfaces:
InplaceEditable, java.io.Externalizable, java.io.Serializable

public class TreeViewItem
extends java.lang.Object
implements InplaceEditable, java.io.Externalizable

Represents a constituent item of the hierarchy displayed inside a TreeViewNode.

See Also:
Serialized Form

Constructor Summary
TreeViewItem()
          Initializes a new instance of the TreeViewItem class.
TreeViewItem(java.lang.String label)
          Initializes a new instance of the TreeViewItem class.
TreeViewItem(TreeViewItem prototype)
          Initializes a new instance of the TreeViewItem class using the specified item as a prototype.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of this item.
 TreeItemList getChildren()
          Gets a list of this item's children in the hierarchy.
 java.awt.geom.Rectangle2D getEditRect(java.awt.geom.Point2D mousePosition)
           
 boolean getExpanded()
          Gets whether this item is expanded to show its children.
 float getHeight()
          Gets the height of this item.
 DiagramLinkList getIncomingLinks()
          Gets a collection of all links that point to this item.
 java.lang.String getLabel()
          Gets the label of this item.
 Brush getLabelBrush()
          Gets the brush used to draw this item's label text.
 java.awt.Font getLabelFont()
          Gets the label font of this item.
 DiagramLinkList getOutgoingLinks()
          Gets a collection of all links that go out of this item.
 TreeViewItem getParent()
          Gets the parent item of this item.
 java.lang.Object getTag()
          Gets custom data associated with this item.
 java.lang.String getTextToEdit()
           
 void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
          Loads the item content from an XML element.
 void readExternal(java.io.ObjectInput in)
          Implements Externalizable.
 void renderText(java.lang.String text, java.awt.geom.Rectangle2D dest, com.mindfusion.diagramming.DrawTextHint hint)
           
protected  void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
          Saves the item content into an XML element.
 void setEditedText(java.lang.String newText)
           
 void setExpanded(boolean value)
          Sets whether this item is expanded to show its children.
 void setHeight(float value)
          Sets the height of this item.
 void setImage(java.awt.Image image)
          Sets the image that is displayed in this treeview item.
 void setLabel(java.lang.String text)
          Sets the label of this item.
 void setLabelBrush(Brush value)
          Sets the brush used to draw this item's label text.
 void setLabelFont(java.awt.Font value)
          Sets the label font of this item.
 void setTag(java.lang.Object object)
          Sets custom data associated with this item.
 void writeExternal(java.io.ObjectOutput out)
          Implements Externalizable.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeViewItem

public TreeViewItem()
Initializes a new instance of the TreeViewItem class.


TreeViewItem

public TreeViewItem(java.lang.String label)
Initializes a new instance of the TreeViewItem class.

Parameters:
label - The text initially displayed by the item.

TreeViewItem

public TreeViewItem(TreeViewItem prototype)
Initializes a new instance of the TreeViewItem class using the specified item as a prototype.

This constructor copies the TreeViewItem property values from the specified prototype item.

Parameters:
prototype - The treeview item to use as a prototype. The properties of the new treeview are initialized from the property values of prototype.
Method Detail

getHeight

public float getHeight()
Gets the height of this item.

Returns:
A float value specifying the item's height. The default value is 5.

setHeight

public void setHeight(float value)
Sets the height of this item.

Parameters:
value - A float value specifying the item's height. The default value is 5.

getChildren

public TreeItemList getChildren()
Gets a list of this item's children in the hierarchy.

Returns:
A list of child TreeViewItem objects.

setImage

public void setImage(java.awt.Image image)
Sets the image that is displayed in this treeview item.

Parameters:
image - An instance of the java.awt.Image class.

getExpanded

public boolean getExpanded()
Gets whether this item is expanded to show its children.

Returns:
true to show the children of this item, otherwise false; the default value is true.

setExpanded

public void setExpanded(boolean value)
Sets whether this item is expanded to show its children.

Parameters:
value - true to show the children of this item, otherwise false; the default value is true.

getTag

public java.lang.Object getTag()
Gets custom data associated with this item.

Returns:
An instance of any class derived from java.lang.Object. The default value is null.

setTag

public void setTag(java.lang.Object object)
Sets custom data associated with this item.

Parameters:
object - An instance of any class derived from java.lang.Object. The default value is null.

loadFromXml

public void loadFromXml(org.w3c.dom.Element xmlElement,
                        XmlPersistContext context)
                 throws javax.xml.transform.TransformerException,
                        XmlException
Loads the item content from an XML element.

Parameters:
xmlElement - An XmlElement containing the link's data.
context - An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.
Throws:
javax.xml.transform.TransformerException
XmlException

getIncomingLinks

public DiagramLinkList getIncomingLinks()
Gets a collection of all links that point to this item.

Returns:
This method returns a collection of all links that point to this item. Use it to access the links or get their number.

getOutgoingLinks

public DiagramLinkList getOutgoingLinks()
Gets a collection of all links that go out of this item.

Returns:
The property returns a collection of all links that start from this item. Use it to access the links or get their number.

setLabelBrush

public void setLabelBrush(Brush value)
Sets the brush used to draw this item's label text.

Parameters:
value - An instance of the Brush class.

getLabelBrush

public Brush getLabelBrush()
Gets the brush used to draw this item's label text.

Returns:
A Brush instance.

renderText

public void renderText(java.lang.String text,
                       java.awt.geom.Rectangle2D dest,
                       com.mindfusion.diagramming.DrawTextHint hint)

setLabel

public void setLabel(java.lang.String text)
Sets the label of this item.

Parameters:
text - A string specifying the item's label.

getLabel

public java.lang.String getLabel()
Gets the label of this item.

Returns:
A string specifying the item's label.

getEditRect

public java.awt.geom.Rectangle2D getEditRect(java.awt.geom.Point2D mousePosition)
Specified by:
getEditRect in interface InplaceEditable

getTextToEdit

public java.lang.String getTextToEdit()
Specified by:
getTextToEdit in interface InplaceEditable

setEditedText

public void setEditedText(java.lang.String newText)
Specified by:
setEditedText in interface InplaceEditable

getParent

public TreeViewItem getParent()
Gets the parent item of this item.

Returns:
A TreeViewItem instance.

getLabelFont

public java.awt.Font getLabelFont()
Gets the label font of this item.

Returns:
An instance of the Font class. The default value is null.

setLabelFont

public void setLabelFont(java.awt.Font value)
Sets the label font of this item.

Parameters:
value - An instance of the Font class. The default value is null.

clone

public java.lang.Object clone()
Creates a copy of this item.

Overrides:
clone in class java.lang.Object
Returns:
An instance of the TreeViewItem class.

saveToXml

protected void saveToXml(org.w3c.dom.Element xmlElement,
                         XmlPersistContext context)
Saves the item content into an XML element.

Parameters:
xmlElement - An XmlElement the item's data should be stored into.
context - An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Implements Externalizable.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Implements Externalizable.

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException