com.mindfusion.diagramming
Class DiagramItem

java.lang.Object
  extended by com.mindfusion.diagramming.DiagramItem
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
DiagramLink, DiagramNode, Selection

public abstract class DiagramItem
extends java.lang.Object
implements java.io.Externalizable

The DiagramItem class represents an element in a diagram. It defines the basic drawing, interaction, undo/redo and serialization functionality for all the types of elements that can be contained in JDiagram documents.

The interior and borders of the diagram items are painted using the brush and pen specified via setBrush(com.mindfusion.diagramming.Brush) and setPen(com.mindfusion.diagramming.Pen). The font of items text is set via the setFont(java.awt.Font) method.

The order in which items are painted from bottom to top is called the Zorder. Moving items up or down the Zorder can be done by means of the zBottom(boolean), zTop(boolean), zLevelUp(boolean) and zLevelDown(boolean) methods. Accessing and setting the index of an item in the Z-order can be done using setZIndex(int) and getZIndex().

A hierarchy of items can be built, such that when an item higher in the hierarchy is moved, all subordinated items move too. The immediate subordinates of an item are represented by a Group instance. The group of items attached to another item can be accessed via the getSubordinateGroup() method of the latter. DiagramNode.getMasterGroup() gets the group in which an object is subordinate.

Every item can cast a shadow, whose offset from the object is specified via the setShadowOffsetX(float) and setShadowOffsetY(float) methods. The shadow is painted using the brush specified via setShadowBrush(com.mindfusion.diagramming.Brush).

An application can associate custom data with an item by means of the getTag() and setTag(java.lang.Object) methods. The tags are only meant to hold data related to the entities represented by the chart items. They are not used or modified by JDiagram in any way. The tags are saved and loaded together with the diagram elements when serializing the document to a disk file or a stream.

Items can be locked for interactive modification via the setLocked(boolean) method. Locked items can still be modified programmatically. Items can also be marked as locked for automatic layout methods via the setIgnoreLayout(boolean) method.

See Also:
Serialized Form

Field Summary
protected  Brush brush
           
protected  boolean cycleDetected
           
protected  boolean cycleProtect
           
protected  double modifyDX
           
protected  double modifyDY
           
protected  int modifyHandle
           
protected  boolean modifying
           
protected  Pen pen
           
protected  java.awt.geom.Point2D ptEnd
           
protected  java.awt.geom.Point2D ptMdfLast
           
protected  java.awt.geom.Point2D ptOrg
           
protected  java.awt.geom.Point2D ptSavedEnd
           
protected  java.awt.geom.Point2D ptSavedOrg
           
protected  Group subordinateGroup
           
 
Constructor Summary
DiagramItem()
          Initializes a new instance of the DiagramItem class.
DiagramItem(Diagram parent)
          Initializes a new DiagramItem instance by copying property values from a Diagram's default-value instance members.
DiagramItem(DiagramItem prototype)
          Initializes a new DiagramItem instance by copying property values from another DiagramItem's instance members.
 
Method Summary
protected abstract  boolean allowCreate(java.awt.geom.Point2D current, InteractionState ist)
          Invoked during interactive creation of items to test whether the operation can be completed in the current context.
protected abstract  boolean allowModify(java.awt.geom.Point2D current, InteractionState ist)
          Invoked during interactive modification of items to test whether the operation can be completed in the current context.
protected  void cancelModify(InteractionState ist)
          Invoked when the interactive modification of this object has been canceled.
 DiagramItem clone(boolean clipboard)
           
protected  void completeCreate(java.awt.geom.Point2D end)
          Invoked when the item creation has been completed.
protected  void completeModify(java.awt.geom.Point2D end, InteractionState ist)
          Invoked when the item modification has been completed.
abstract  boolean containsPoint(java.awt.geom.Point2D point)
          Determines whether this item contains the specified point.
protected  DiagramItemProperties createProperties()
          Creates an item property set corresponding to the type of this diagram item.
protected  DiagramItemState createState()
          Creates an item state corresponding to the type of this diagram item.
protected abstract  void draw(java.awt.Graphics2D g, RenderOptions options)
           
protected abstract  void drawShadow(java.awt.Graphics2D g, RenderOptions options)
           
abstract  java.awt.geom.Rectangle2D.Float getBounds()
          Gets the item bounds in logical document coordinates.
 Brush getBrush()
          Gets the brush used to fill the item's interior.
 Brush getEffectiveBrush()
          Gets the effective brush of the item.
 java.awt.Font getEffectiveFont()
          Gets the currently effective font of the item.
 Pen getEffectivePen()
          Gets the effective pen of the item.
 Brush getEffectiveShadowBrush()
          Creates a Brush object representing the currently effective shadow brush of the item.
 Brush getEffectiveTextBrush()
          Gets the effective text brush of the item.
 java.awt.Font getFont()
          Gets the font used to draw the text of an item.
 java.lang.String getHyperLink()
          Gets the hyperlink associated with an item.
 java.lang.Object getId()
          Gets user-defined identifier associated with this item.
 boolean getIgnoreLayout()
          Gets a value indicating whether an item should be ignored by the automatic layout algorithms.
 int getLayerIndex()
          Gets the zero-based index of the layer this item is associated with, or -1, if the item is not associated with any layer.
 java.util.Hashtable<java.lang.Object,java.lang.Object> getLayoutTraits()
          Gets properties specific to each layout algorithm.
 boolean getLocked()
          Gets a value indicating whether users are allowed to modify an item.
 Group getMasterGroup()
          Gets the hierarchical group in which this item is a subordinate.
protected  int getMeasureUnit()
           
 Diagram getParent()
          Gets the diagram that contains this item.
 Pen getPen()
          Gets the pen used to draw the item frame lines.
 boolean getPrintable()
          Gets a value indicating whether an item will be printed.
protected  java.awt.geom.Rectangle2D getRepaintRect(boolean includeConnected)
          Gets the repaint region for this item, taking into account factors such as pen, selection handles and shadow.
 int getRuntimeIndex()
           
 boolean getSelected()
          Gets a value indicating whether this item is selected.
 Brush getShadowBrush()
          Gets the brush of the item's shadow.
 float getShadowOffsetX()
          Gets the horizontal distance between a shadow and the item that casts it.
 float getShadowOffsetY()
          Gets the vertical distance between a shadow and the item that casts it.
 DiagramItemStyle getStyle()
          Gets the style associated with the item.
 Group getSubordinateGroup()
          Gets the group of subordinated items attached to this one.
 java.lang.Object getTag()
          Gets user-defined data assigned to an item.
 Brush getTextBrush()
          Gets the brush used to paint texts inside the item.
 Thickness getTextPadding()
          Gets the spacing between the item boundaries and its text.
 java.lang.String getToolTip()
          Gets the tooltip text displayed when the mouse pointer rests over an item.
protected  java.lang.Object getValue(java.lang.String name)
          Gets the effective value of the style property with the specified name.
 boolean getVisible()
          Gets a value indicating whether an item is visible.
 float getWeight()
          Gets a weight value used in layout and path-finding algorithms.
 int getZIndex()
          Gets the position of an item within the diagram's Z order.
 boolean hasSubordinates()
          Checks whether there are any nodes attached to this item.
protected  void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
          Loads the item content from an XML element.
protected  void onAdd()
          Called when an item is added to a Diagram, either by the user, programmatically or via undo / redo.
protected  void onChangeFont()
           
protected  void onChangeTextPadding()
           
protected  void onChildModified(DiagramNode node, int handle)
          Called when a group child node has been modified.
protected  void onClick(int mouseButton, java.awt.geom.Point2D mousePosition)
          Invoked when the user clicks this item.
protected  void onDoubleClick(int mouseButton, java.awt.geom.Point2D mousePosition)
          Invoked when the user double-clicks this item.
protected  void onLoad(Diagram diagram)
           
protected  void onModify(java.awt.geom.Point2D mousePosition, int adjustmentHandle)
          Called when an item is modified
protected  void onRemove()
          Called when an item is removed from a Diagram, either by the user, programmatically or via undo / redo.
protected  void onStyleChanged()
          Invoked when the associated style or theme have changed.
protected  void putSelected(boolean newVal)
           
 DiagramItemList query(java.lang.String query)
          Returns the items that can be reached from this item by following the path specified in the given query expression.
 void readExternal(java.io.ObjectInput in)
          Implements Externalizable.
protected  void repaint()
          Repaints the region of the diagram where this item is located.
protected  void repaint(boolean includeConnected)
          Repaints the specified region of the diagram.
protected  void repaint(java.awt.geom.Rectangle2D invalidRect)
          Repaints the specified region of the diagram.
protected  void restoreProperties(DiagramItemProperties props)
          Restores the properties of this diagram item.
protected  void restoreState(DiagramItemState state)
          Restores the state of this diagram item.
protected  void saveProperties(DiagramItemProperties props)
          Saves the properties of this diagram item.
protected  void saveState(DiagramItemState state)
          Saves the state of this diagram item.
protected  void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
          Saves the item content into an XML element.
 void setBrush(Brush value)
          Sets the brush used to fill the item's interior.
protected  void setDiagramDirty()
          Marks the diagram as changed.
 void setFont(java.awt.Font value)
          Sets the font used to draw the text of an item.
 void setHyperLink(java.lang.String value)
          Sets the hyperlink associated with an item.
 void setId(java.lang.Object value)
          Assigns user-defined identifier to this item.
 void setIgnoreLayout(boolean value)
          Sets a value indicating whether an item should be ignored by the automatic layout algorithms.
 void setLayerIndex(int value)
          Sets the zero-based index of the layer this item is associated with, or -1, if the item is not associated with any layer.
 void setLocked(boolean value)
          Sets a value indicating whether users are allowed to modify an item.
 void setPen(Pen value)
          Sets the pen used to draw the item frame lines.
 void setPrintable(boolean value)
          Sets a value indicating whether an item will be printed.
 void setSelected(boolean value)
          Selects or deselects an item.
 void setShadowBrush(Brush value)
          Sets the color of the item's shadow.
 void setShadowOffsetX(float value)
          Sets the horizontal distance between a shadow and the item that casts it.
 void setShadowOffsetY(float value)
          Sets the vertical distance between a shadow and the item that casts it.
 void setStyle(DiagramItemStyle value)
          Sets the style associated with the item.
 void setTag(java.lang.Object value)
          Assigns user-defined data to an item.
 void setTextBrush(Brush value)
          Sets the brush used to paint texts inside the item.
 void setTextPadding(Thickness value)
          Sets the spacing between the item boundaries and its text.
 void setToolTip(java.lang.String value)
          Sets the tooltip text that should be displayed when the mouse pointer rests over an item.
 void setVisible(boolean value)
          Sets a value indicating whether an item is visible.
 void setWeight(float value)
          Sets a weight value used in layout and path-finding algorithms.
 void setZIndex(int value)
          Sets the position of an item within the diagram's Z order.
protected  boolean shouldRender()
          Determines whether the item should be rendered in the current context
protected  void startCreate(java.awt.geom.Point2D org)
          Invoked once when the user starts creating a new item interactively.
protected  void startModify(java.awt.geom.Point2D org, int handle, InteractionState ist)
          Invoked when the user starts modifying this item interactively.
protected  void updateCreate(java.awt.geom.Point2D current)
          Invoked during interactive creation of this item.
protected  void updateModify(java.awt.geom.Point2D current, InteractionState ist)
          Invoked during interactive modification of this item.
 void writeExternal(java.io.ObjectOutput out)
          Implements Externalizable.
 void zBottom(boolean keepInLayer)
          Moves an item to the bottom of the Z order.
 void zLevelDown(boolean keepInLayer)
          Moves an item down in the Z order.
 void zLevelUp(boolean keepInLayer)
          Moves an item up in the Z order.
 void zTop(boolean keepInLayer)
          Moves an item to the top of the Z order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subordinateGroup

protected Group subordinateGroup

cycleProtect

protected boolean cycleProtect

cycleDetected

protected boolean cycleDetected

ptOrg

protected java.awt.geom.Point2D ptOrg

ptEnd

protected java.awt.geom.Point2D ptEnd

ptSavedOrg

protected java.awt.geom.Point2D ptSavedOrg

ptSavedEnd

protected java.awt.geom.Point2D ptSavedEnd

brush

protected Brush brush

pen

protected Pen pen

modifying

protected boolean modifying

modifyDX

protected double modifyDX

modifyDY

protected double modifyDY

modifyHandle

protected int modifyHandle

ptMdfLast

protected java.awt.geom.Point2D ptMdfLast
Constructor Detail

DiagramItem

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


DiagramItem

public DiagramItem(Diagram parent)
Initializes a new DiagramItem instance by copying property values from a Diagram's default-value instance members.

Parameters:
parent - A Diagram instance whose default item attributes are copied to this item.

DiagramItem

public DiagramItem(DiagramItem prototype)
Initializes a new DiagramItem instance by copying property values from another DiagramItem's instance members.

Parameters:
prototype - An DiagramItem instance whose attributes are copied to this item.
Method Detail

clone

public DiagramItem clone(boolean clipboard)

query

public DiagramItemList query(java.lang.String query)
Returns the items that can be reached from this item by following the path specified in the given query expression.

Parameters:
query - A query expression consisting of selectors and boolean predicates.
Returns:
A collection of the found items.

getParent

public Diagram getParent()
Gets the diagram that contains this item.

Returns:
A reference to the Diagram that contains this item.

onAdd

protected void onAdd()
Called when an item is added to a Diagram, either by the user, programmatically or via undo / redo.


onRemove

protected void onRemove()
Called when an item is removed from a Diagram, either by the user, programmatically or via undo / redo.


hasSubordinates

public boolean hasSubordinates()
Checks whether there are any nodes attached to this item.

Returns:
true if there are some nodes attached to this item, otherwise .

getSubordinateGroup

public Group getSubordinateGroup()
Gets the group of subordinated items attached to this one.

Returns:
A reference to a Group for which this item is the master item.

onChildModified

protected void onChildModified(DiagramNode node,
                               int handle)
Called when a group child node has been modified. Override this method if you need to know when a node from the SubordinateGroup is modified.

Parameters:
node - The node that has been modified.
handle - The adjustment handle used to modify the node.

getMasterGroup

public Group getMasterGroup()
Gets the hierarchical group in which this item is a subordinate.

Returns:
A Group to which this item is attached.

getTag

public java.lang.Object getTag()
Gets user-defined data assigned to an item.

Returns:
A custom data Object.

setTag

public void setTag(java.lang.Object value)
Assigns user-defined data to an item. If the tag object is serializable, it will be automatically saved when serializing the diagram into binary format. When serializing to XML, you can save the tag by handling the DiagramListener.serializeTag(com.mindfusion.diagramming.SerializeTagEvent) event.

Parameters:
value - An Object containing custom data.

getId

public java.lang.Object getId()
Gets user-defined identifier associated with this item.

Returns:
A custom id Object.

setId

public void setId(java.lang.Object value)
Assigns user-defined identifier to this item. If the id object is serializable, it will be automatically saved when serializing the diagram into binary format. When serializing to XML, you can save the tag by handling the DiagramListener.serializeTag(com.mindfusion.diagramming.SerializeTagEvent) event.

Parameters:
value - An Object containing custom data.

getToolTip

public java.lang.String getToolTip()
Gets the tooltip text displayed when the mouse pointer rests over an item.

Returns:
A String that contains the tooltip text.

setToolTip

public void setToolTip(java.lang.String value)
Sets the tooltip text that should be displayed when the mouse pointer rests over an item.

Parameters:
value - A String that contains the tooltip text.

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

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

onLoad

protected void onLoad(Diagram diagram)

saveToXml

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

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

loadFromXml

protected 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 item's data.
context - An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods
Throws:
javax.xml.transform.TransformerException
XmlException

getLocked

public boolean getLocked()
Gets a value indicating whether users are allowed to modify an item.

Returns:
true if the item cannot be modified, otherwise false.

setLocked

public void setLocked(boolean value)
Sets a value indicating whether users are allowed to modify an item.

Parameters:
value - true if the item should not be modified, otherwise false.

getIgnoreLayout

public boolean getIgnoreLayout()
Gets a value indicating whether an item should be ignored by the automatic layout algorithms.

Returns:
true if the item is ignored by layout algorithms, otherwise false.

setIgnoreLayout

public void setIgnoreLayout(boolean value)
Sets a value indicating whether an item should be ignored by the automatic layout algorithms.

Parameters:
value - true if the item should be ignored by automatic layout algorithms, otherwise false.

getBounds

public abstract java.awt.geom.Rectangle2D.Float getBounds()
Gets the item bounds in logical document coordinates.

Returns:
A Rectangle2D object representing the item's bounds.

zLevelUp

public void zLevelUp(boolean keepInLayer)
Moves an item up in the Z order.


zLevelDown

public void zLevelDown(boolean keepInLayer)
Moves an item down in the Z order.


zBottom

public void zBottom(boolean keepInLayer)
Moves an item to the bottom of the Z order.


zTop

public void zTop(boolean keepInLayer)
Moves an item to the top of the Z order.


getZIndex

public int getZIndex()
Gets the position of an item within the diagram's Z order.

Returns:
An integer value specifying the position of the item within the diagram Z order.

setZIndex

public void setZIndex(int value)
Sets the position of an item within the diagram's Z order.

Parameters:
value - An integer value specifying the position of the item within the diagram Z order.

getLayerIndex

public int getLayerIndex()
Gets the zero-based index of the layer this item is associated with, or -1, if the item is not associated with any layer.

Returns:
An integer value specifying the layer index.

setLayerIndex

public void setLayerIndex(int value)
Sets the zero-based index of the layer this item is associated with, or -1, if the item is not associated with any layer.

Parameters:
value - An integer value specifying the layer index.

getRuntimeIndex

public int getRuntimeIndex()

draw

protected abstract void draw(java.awt.Graphics2D g,
                             RenderOptions options)

drawShadow

protected abstract void drawShadow(java.awt.Graphics2D g,
                                   RenderOptions options)

shouldRender

protected boolean shouldRender()
Determines whether the item should be rendered in the current context

Returns:
true to draw the item; otherwise, false.

getRepaintRect

protected java.awt.geom.Rectangle2D getRepaintRect(boolean includeConnected)
Gets the repaint region for this item, taking into account factors such as pen, selection handles and shadow.

Parameters:
includeConnected - true if related items should be considered too; otherwise, false.
Returns:
A rectangular region that should be repainted when this item is modified.

getMeasureUnit

protected int getMeasureUnit()

setDiagramDirty

protected void setDiagramDirty()
Marks the diagram as changed.


repaint

protected void repaint()
Repaints the region of the diagram where this item is located. Call this method to repaint the diagram after changing appearance attributes of this item.


repaint

protected void repaint(boolean includeConnected)
Repaints the specified region of the diagram.


repaint

protected void repaint(java.awt.geom.Rectangle2D invalidRect)
Repaints the specified region of the diagram.


getVisible

public boolean getVisible()
Gets a value indicating whether an item is visible.

Returns:
true if the item is visible, otherwise false.

setVisible

public void setVisible(boolean value)
Sets a value indicating whether an item is visible.

Parameters:
value - true if the item should be visible, otherwise false.

getPrintable

public boolean getPrintable()
Gets a value indicating whether an item will be printed.

Returns:
true if the item will be drawn when printing the diagram, otherwise false.

setPrintable

public void setPrintable(boolean value)
Sets a value indicating whether an item will be printed.

Parameters:
value - true if the item should be drawn when printing the diagram, otherwise false.

getFont

public java.awt.Font getFont()
Gets the font used to draw the text of an item.

Returns:
A Font object representing the font used to draw this item's text.

setFont

public void setFont(java.awt.Font value)
Sets the font used to draw the text of an item.

Parameters:
value - A Font object representing the font used to draw this item's text.

getEffectiveFont

public java.awt.Font getEffectiveFont()
Gets the currently effective font of the item. This property returns Font if it is not null, or a font with the FontFamily, FontSize, and FontStyle properties of the item's style.


onChangeFont

protected void onChangeFont()

getTextPadding

public Thickness getTextPadding()
Gets the spacing between the item boundaries and its text.

Returns:
A Thickness instance specifying the size of the padding space left around the text.

setTextPadding

public void setTextPadding(Thickness value)
Sets the spacing between the item boundaries and its text.

Parameters:
value - A Thickness instance specifying the size of the padding space left around the text.

onChangeTextPadding

protected void onChangeTextPadding()

getTextBrush

public Brush getTextBrush()
Gets the brush used to paint texts inside the item.


setTextBrush

public void setTextBrush(Brush value)
Sets the brush used to paint texts inside the item.


getEffectiveTextBrush

public Brush getEffectiveTextBrush()
Gets the effective text brush of the item.


getPen

public Pen getPen()
Gets the pen used to draw the item frame lines.

Returns:
A Pen object representing the item's pen.

setPen

public void setPen(Pen value)
Sets the pen used to draw the item frame lines.

Parameters:
value - A Pen object representing the item's pen.

getEffectivePen

public Pen getEffectivePen()
Gets the effective pen of the item.


getBrush

public Brush getBrush()
Gets the brush used to fill the item's interior.

Returns:
A Brush -derived object representing the item's brush.

setBrush

public void setBrush(Brush value)
Sets the brush used to fill the item's interior.

Parameters:
value - A Brush -derived object representing the item's brush.

getEffectiveBrush

public Brush getEffectiveBrush()
Gets the effective brush of the item.


getShadowBrush

public Brush getShadowBrush()
Gets the brush of the item's shadow.

Returns:
A Brush object representing the brush of the item's shadow.

setShadowBrush

public void setShadowBrush(Brush value)
Sets the color of the item's shadow.

Parameters:
value - A Brush object representing the brush of the item's shadow.

getEffectiveShadowBrush

public Brush getEffectiveShadowBrush()
Creates a Brush object representing the currently effective shadow brush of the item. This method returns a system brush corresponding to the item's ShadowBrush if the item's ShadowBrush is not null, or a system brush corresponding to the ShadowBrush property of the item's style.


getShadowOffsetX

public float getShadowOffsetX()
Gets the horizontal distance between a shadow and the item that casts it.

Returns:
A float value representing the horizontal offset of the item's shadow.

setShadowOffsetX

public void setShadowOffsetX(float value)
Sets the horizontal distance between a shadow and the item that casts it.

Parameters:
value - A float value representing the horizontal offset of the item's shadow.

getShadowOffsetY

public float getShadowOffsetY()
Gets the vertical distance between a shadow and the item that casts it.

Returns:
A float value representing the vertical offset of the item's shadow.

setShadowOffsetY

public void setShadowOffsetY(float value)
Sets the vertical distance between a shadow and the item that casts it.

Parameters:
value - A float value representing the vertical offset of the item's shadow.

startCreate

protected void startCreate(java.awt.geom.Point2D org)
Invoked once when the user starts creating a new item interactively.

Parameters:
org - Position of the mouse pointer.

updateCreate

protected void updateCreate(java.awt.geom.Point2D current)
Invoked during interactive creation of this item.

Parameters:
current - Position of the mouse pointer.

completeCreate

protected void completeCreate(java.awt.geom.Point2D end)
Invoked when the item creation has been completed.

Parameters:
end - The mouse pointer position.

allowCreate

protected abstract boolean allowCreate(java.awt.geom.Point2D current,
                                       InteractionState ist)
Invoked during interactive creation of items to test whether the operation can be completed in the current context.

Parameters:
current - The current mouse pointer position.
ist - An InteractionState object containing more information about the current state of the operation.
Returns:
true to allow the creation of this item; otherwise, false.

startModify

protected void startModify(java.awt.geom.Point2D org,
                           int handle,
                           InteractionState ist)
Invoked when the user starts modifying this item interactively.

Parameters:
org - Position of the mouse pointer.
handle - Index of the adjustment handle used to modify the item.
ist - An InteractionState object containing more information about the current state of the operation.

updateModify

protected void updateModify(java.awt.geom.Point2D current,
                            InteractionState ist)
Invoked during interactive modification of this item.

Parameters:
current - Position of the mouse pointer.
ist - An InteractionState object containing more information about the current state of the operation.

completeModify

protected void completeModify(java.awt.geom.Point2D end,
                              InteractionState ist)
Invoked when the item modification has been completed.

Parameters:
end - The mouse pointer position.
ist - An InteractionState object containing more information about the current state of the operation.

allowModify

protected abstract boolean allowModify(java.awt.geom.Point2D current,
                                       InteractionState ist)
Invoked during interactive modification of items to test whether the operation can be completed in the current context.

Parameters:
current - The current mouse pointer position.
ist - An InteractionState object containing more information about the current state of the operation.
Returns:
true to allow the modification of this item; otherwise, false.

cancelModify

protected void cancelModify(InteractionState ist)
Invoked when the interactive modification of this object has been canceled.

Parameters:
ist - An InteractionState object containing more information about the current state of the operation.

onClick

protected void onClick(int mouseButton,
                       java.awt.geom.Point2D mousePosition)
Invoked when the user clicks this item.

Parameters:
mouseButton - Specifies the mouse button used to click the item.
mousePosition - Specifies the mouse position.

onDoubleClick

protected void onDoubleClick(int mouseButton,
                             java.awt.geom.Point2D mousePosition)
Invoked when the user double-clicks this item.

Parameters:
mouseButton - Specifies the mouse button used to click the item.
mousePosition - Specifies the mouse position

onModify

protected void onModify(java.awt.geom.Point2D mousePosition,
                        int adjustmentHandle)
Called when an item is modified

Parameters:
mousePosition - Specifies the mouse position.
adjustmentHandle - The adjustment handle used to modify the node.

containsPoint

public abstract boolean containsPoint(java.awt.geom.Point2D point)
Determines whether this item contains the specified point. This method is used during hit-testing to determine if the mouse is inside the item.

Parameters:
point - The point to check.
Returns:
true it this item contains the specified point; otherwise, false.

getSelected

public boolean getSelected()
Gets a value indicating whether this item is selected.

Returns:
true if the item is selected, otherwise false.

setSelected

public void setSelected(boolean value)
Selects or deselects an item.

Parameters:
value - true if the item should be selected, otherwise false.

putSelected

protected void putSelected(boolean newVal)

createState

protected DiagramItemState createState()
Creates an item state corresponding to the type of this diagram item.


saveState

protected void saveState(DiagramItemState state)
Saves the state of this diagram item.


restoreState

protected void restoreState(DiagramItemState state)
Restores the state of this diagram item.


createProperties

protected DiagramItemProperties createProperties()
Creates an item property set corresponding to the type of this diagram item. This method is invoked by the undo/redo subsystem when creating a ChangeItemCmd instance.

Returns:
A DiagramItemProperties-derived object containing a snapshot of the item's properties.

saveProperties

protected void saveProperties(DiagramItemProperties props)
Saves the properties of this diagram item. This method is invoked by the undo/redo subsystem when saving a ChangeItemCmd instance.

Parameters:
props - A DiagramItemProperties-derived object where the item's properties should be saved.

restoreProperties

protected void restoreProperties(DiagramItemProperties props)
Restores the properties of this diagram item. This method is invoked by the undo/redo subsystem when undoing or redoing a ChangeItemCmd instance.

Parameters:
props - A DiagramItemProperties -derived object containing a snapshot of the item's properties.

getHyperLink

public java.lang.String getHyperLink()
Gets the hyperlink associated with an item.

Returns:
A String containing the hyperlink.

setHyperLink

public void setHyperLink(java.lang.String value)
Sets the hyperlink associated with an item.

Parameters:
value - A String containing the hyperlink.

getLayoutTraits

public java.util.Hashtable<java.lang.Object,java.lang.Object> getLayoutTraits()
Gets properties specific to each layout algorithm.


getWeight

public float getWeight()
Gets a weight value used in layout and path-finding algorithms.

Returns:
A float value representing the item's weight.

setWeight

public void setWeight(float value)
Sets a weight value used in layout and path-finding algorithms.

Parameters:
value - A float value representing the item's weight.

getValue

protected java.lang.Object getValue(java.lang.String name)
Gets the effective value of the style property with the specified name.


onStyleChanged

protected void onStyleChanged()
Invoked when the associated style or theme have changed.


getStyle

public DiagramItemStyle getStyle()
Gets the style associated with the item.


setStyle

public void setStyle(DiagramItemStyle value)
Sets the style associated with the item.