|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mindfusion.diagramming.DiagramItem com.mindfusion.diagramming.DiagramNode
public abstract class DiagramNode
DiagramNode
is an abstract base class from which the ShapeNode
,
TableNode
and ContainerNode
classes derive. DiagramNode instances can
represent graph vertices, nodes in organizational or flow diagrams, entities in
ER diagrams, and so on.
Use the setBounds(java.awt.geom.Rectangle2D)
method to set the location and size of a node. To
move a node without changing its size, call the moveTo(float, float)
method. To
change only the size of a node, invoke the resize(float, float)
method.
Constraints upon how users are allowed to modify a node can be set via the
setConstraints(com.mindfusion.diagramming.NodeConstraints)
and setEnabledHandles(long)
methods. The former
specifies constraints on the allowed move direction and node size. The latter
enables or disables specific manipulation handles of a node.
Relations between nodes are indicated by linking the nodes with DiagramLink
objects. Links are directional links, so each node has two collections
referring to links, which can be accessed via getIncomingLinks()
and
getOutgoingLinks()
. setAnchorPattern(com.mindfusion.diagramming.AnchorPattern)
lets you define to which
points of a node incoming or outgoing links can be connected. You can specify
whether a node accepts incoming links via the setAllowIncomingLinks(boolean)
method, and outgoing links via the setAllowOutgoingLinks(boolean)
method.
A user is allowed to expand or collapse the tree branch that starts from a
node if setExpandable(boolean)
is called for that node. Use getExpanded()
to find out whether the branch starting from a node is expanded or not.
Nodes can be attached to other items, and be used as simple labels,
image-holders or other kinds of UI elements. The attachTo(com.mindfusion.diagramming.DiagramLink, int, int)
method
creates a Group
instance if necessary, and calls the group's
appropriate attachTo* method.
Field Summary | |
---|---|
protected boolean |
allowIncomingLinks
|
protected boolean |
allowOutgoingLinks
|
protected AnchorPattern |
anchorPattern
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_Cancel
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_EndModIncoming
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_EndModOutgoing
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_StartModIncoming
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_StartModOutgoing
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_UpdateIncoming
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_UpdateOutgoing
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_UpdIntscIncoming
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_UpdIntscOutgoing
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_UpdPosIncoming
|
protected com.mindfusion.diagramming.VisitorMethod |
AV_UpdPosOutgoing
|
protected java.awt.geom.Rectangle2D |
bounds
|
protected long |
enabledHandles
|
protected int |
handlesStyle
|
protected DiagramLinkList |
incomingLinks
|
protected Group |
masterGroup
|
protected boolean |
obstacle
|
protected DiagramLinkList |
outgoingLinks
|
protected java.awt.geom.Rectangle2D |
savedBounds
|
Fields inherited from class com.mindfusion.diagramming.DiagramItem |
---|
brush, cycleDetected, cycleProtect, font, hyperLink, ignoreLayout, locked, modifyDX, modifyDY, modifyHandle, modifying, pen, printable, ptEnd, ptMdfLast, ptOrg, ptSavedEnd, ptSavedOrg, selected, shadowColor, shadowOffsetX, shadowOffsetY, subordinateGroup, tag, toolTip, visible, zIndex |
Constructor Summary | |
---|---|
DiagramNode()
Initializes a new instance of the DiagramNode class. |
|
DiagramNode(Diagram parent)
Initializes a new DiagramNode instance by setting its properties to the default values defined in the specified Diagram. |
|
DiagramNode(DiagramNode prototype)
Initializes a new DiagramNode instance by copying its properties from the specified prototype node. |
Method Summary | |
---|---|
protected 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 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. |
void |
attachTo(DiagramLink link,
int attType,
int index)
Attaches a node to a segment or point of the specified link. |
void |
attachTo(DiagramNode node,
float percentX1,
float percentY1,
float percentX2,
float percentY2)
Attaches a node to another node, so that the attached node will always cover a proportional part of the master node, specified in percents. |
void |
attachTo(DiagramNode node,
int attType)
Attaches a node to a corner or side of another node. |
protected void |
cancelModify(InteractionState ist)
|
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. |
protected boolean |
constraintsInfringed()
|
boolean |
containsPoint(java.awt.geom.Point2D point)
DiagramItem.containsPoint override. |
boolean |
containsPoint(java.awt.geom.Point2D point,
float threshold)
Tests whether the specified point is inside this node or within the specified distance from its outlines. |
protected com.mindfusion.diagramming.ConnectionPoint |
createConnectionPoint(DiagramLink link,
java.awt.geom.Point2D pt,
boolean incoming)
|
protected DiagramItemProperties |
createProperties()
DiagramItem.createProperties() override. |
protected DiagramItemState |
createState()
DiagramItem.createState() override. |
void |
detach()
Detaches a node from its master group. |
boolean |
getAllowIncomingLinks()
Gets a value indicating whether users are allowed to draw links to this node. |
boolean |
getAllowOutgoingLinks()
Gets a value indicating whether users are allowed to draw links from this node. |
AnchorPattern |
getAnchorPattern()
Gets the anchor points to which link end points are aligned when links connect to this node. |
java.awt.geom.Rectangle2D.Float |
getBounds()
Gets the node location and size. |
NodeConstraints |
getConstraints()
Gets the movement and size constraints applied to a node. |
long |
getEnabledHandles()
Gets a bit mask specifying which manipulation handles are enabled for a node. |
boolean |
getExpandable()
Gets a value indicating whether users are allowed to expand or collapse the tree branch that starts from this node. |
boolean |
getExpanded()
Gets a value indicating whether the tree branch that starts from a node is expanded or collapsed. |
int |
getHandlesStyle()
Gets the style of the box selection handles. |
DiagramLinkList |
getIncomingLinks()
Gets the links coming into a node. |
Group |
getMasterGroup()
Gets the hierarchical group in which this node is a subordinate item. |
boolean |
getObstacle()
Gets a value indicating whether the link routing algorithm should consider this node an obstacle. |
DiagramLinkList |
getOutgoingLinks()
Gets the links going out from a node. |
protected boolean |
groupContains(DiagramNode node)
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Loads the item content from an XML element. |
protected void |
move(double x,
double y)
|
void |
moveTo(float x,
float y)
Moves a node to the specified location. |
static boolean |
nodesIntersect(DiagramNode node1,
DiagramNode node2)
Determines whether two nodes intersect. |
void |
onDragOut(DiagramItem item)
Invoked when a diagram item is being dragged out of this node. |
boolean |
onDragOver(DiagramItem item)
Invoked when a diagram item is being dragged over this node. |
boolean |
onDropOver(DiagramItem item)
Invoked when a diagram item is dropped over this node. |
protected void |
onRemove()
Called when an item is removed from a Diagram, either by the user, programmatically or via undo / redo. |
protected void |
onUpdateBounds()
Invoked when the bounding rectangle of the node has changed. |
protected void |
putExpandable(boolean exp)
|
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable. |
protected void |
rectFromPoints()
|
void |
resize(float width,
float height)
Sets the size of a node. |
protected void |
resizeToFitImage(java.awt.Image image)
|
protected void |
restoreProperties(DiagramItemProperties props)
DiagramItem.restoreProperties(com.mindfusion.diagramming.DiagramItemProperties) override. |
protected void |
restoreState(DiagramItemState state)
DiagramItem.restoreState(com.mindfusion.diagramming.DiagramItemState) override. |
protected void |
saveProperties(DiagramItemProperties props)
DiagramItem.saveProperties(com.mindfusion.diagramming.DiagramItemProperties) override. |
protected void |
saveState(DiagramItemState state)
DiagramItem.saveState(com.mindfusion.diagramming.DiagramItemState) override. |
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Saves the item content into an XML element. |
void |
setAllowIncomingLinks(boolean value)
Sets a value indicating whether users are allowed to draw links to this node. |
void |
setAllowOutgoingLinks(boolean value)
Sets a value indicating whether users are allowed to draw links from this node. |
void |
setAnchorPattern(AnchorPattern value)
Sets the anchor points to which link end points are aligned when links connect to this node. |
void |
setBounds(float x,
float y,
float w,
float h)
Sets the node location and size. |
void |
setBounds(java.awt.geom.Rectangle2D value)
Sets the node location and size. |
void |
setConstraints(NodeConstraints value)
Sets constraints to the node size and movement direction. |
void |
setEnabledHandles(long value)
Sets a bit mask specifying which manipulation handles are enabled for a node. |
void |
setExpandable(boolean value)
Sets a value indicating whether users are allowed to expand or collapse the tree branch that starts from this node. |
void |
setExpanded(boolean value)
Expands or collapses the tree branch that starts from a node. |
void |
setExpandedFlag(boolean expanded)
Changes the "expanded" flag without actually expanding or collapsing the tree branch that starts from a node. |
void |
setHandlesStyle(int value)
Sets the style of the box selection handles. |
void |
setObstacle(boolean value)
Sets a value indicating whether the link routing algorithm should consider this node an obstacle. |
protected void |
setReflexive(DiagramLink link)
Invoked to let a node set the shape of a reflexive link connected to it. |
protected boolean |
shouldRenderAnchors(RenderOptions options)
Determines whether the node should render its anchor points. |
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 |
updateLinkPositions()
|
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. |
Methods inherited from class com.mindfusion.diagramming.DiagramItem |
---|
clone, draw, drawShadow, getBrush, getFont, getHyperLink, getIgnoreLayout, getLayoutTraits, getLocked, getMeasureUnit, getParent, getPen, getPrintable, getSelected, getShadowColor, getShadowOffsetX, getShadowOffsetY, getSubordinateGroup, getTag, getToolTip, getVisible, getWeight, getZIndex, hasSubordinates, onAdd, onChangeFont, onChildModified, onClick, onDoubleClick, onModify, putSelected, repaint, repaint, repaint, setBrush, setDiagramDirty, setFont, setHyperLink, setIgnoreLayout, setLocked, setPen, setPrintable, setSelected, setShadowColor, setShadowOffsetX, setShadowOffsetY, setTag, setToolTip, setVisible, setWeight, setZIndex, shouldRender, zBottom, zLevelDown, zLevelUp, zTop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.mindfusion.diagramming.InplaceEditable |
---|
getEditRect, getTextToEdit, setEditedText |
Field Detail |
---|
protected com.mindfusion.diagramming.VisitorMethod AV_UpdateOutgoing
protected com.mindfusion.diagramming.VisitorMethod AV_UpdateIncoming
protected com.mindfusion.diagramming.VisitorMethod AV_UpdPosOutgoing
protected com.mindfusion.diagramming.VisitorMethod AV_UpdPosIncoming
protected com.mindfusion.diagramming.VisitorMethod AV_UpdIntscOutgoing
protected com.mindfusion.diagramming.VisitorMethod AV_UpdIntscIncoming
protected com.mindfusion.diagramming.VisitorMethod AV_StartModOutgoing
protected com.mindfusion.diagramming.VisitorMethod AV_StartModIncoming
protected com.mindfusion.diagramming.VisitorMethod AV_EndModOutgoing
protected com.mindfusion.diagramming.VisitorMethod AV_EndModIncoming
protected com.mindfusion.diagramming.VisitorMethod AV_Cancel
protected DiagramLinkList incomingLinks
protected DiagramLinkList outgoingLinks
protected Group masterGroup
protected boolean obstacle
protected boolean allowIncomingLinks
protected boolean allowOutgoingLinks
protected java.awt.geom.Rectangle2D bounds
protected java.awt.geom.Rectangle2D savedBounds
protected AnchorPattern anchorPattern
protected long enabledHandles
protected int handlesStyle
Constructor Detail |
---|
public DiagramNode()
public DiagramNode(Diagram parent)
parent
- A Diagram
instance whose default node
attributes are copied to this node.public DiagramNode(DiagramNode prototype)
prototype
- A DiagramNode
instance whose attributes are
copied to this node.Method Detail |
---|
protected void onRemove()
onRemove
in class DiagramItem
protected com.mindfusion.diagramming.ConnectionPoint createConnectionPoint(DiagramLink link, java.awt.geom.Point2D pt, boolean incoming)
public NodeConstraints getConstraints()
NodeConstraints
object.public void setConstraints(NodeConstraints value)
value
- A NodeConstraints
object.protected void updateLinkPositions()
public DiagramLinkList getIncomingLinks()
DiagramLinkList
containing the incoming links.public DiagramLinkList getOutgoingLinks()
DiagramLinkList
containing the outgoing links.protected void setReflexive(DiagramLink link)
link
- Reference to the link.protected boolean groupContains(DiagramNode node)
public Group getMasterGroup()
getMasterGroup
in class DiagramItem
Group
to which this node is attached.public void attachTo(DiagramLink link, int attType, int index)
link
- An DiagramLink
to which to attach this node.attType
- One of the AttachToLink
constants.index
- Index of a point or segment to which to attach the node.public void attachTo(DiagramNode node, int attType)
node
- A DiagramNode
to which to attach this node.attType
- One of the AttachToNode
constants.public void attachTo(DiagramNode node, float percentX1, float percentY1, float percentX2, float percentY2)
node
- A DiagramNode
to which to attach this node.percentX1
- A float percent value specifying to what X position in the
master node to attach the left side of this node.percentY1
- A float percent value specifying to what Y position in the
master node to attach the top side of this node.percentX2
- A float percent value specifying to what X position in the
master node to attach the right side of this node.percentY2
- A float percent value specifying to what Y position in the
master node to attach the bottom side of this node.public void detach()
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class DiagramItem
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class DiagramItem
java.io.IOException
java.lang.ClassNotFoundException
protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
DiagramItem
saveToXml
in class DiagramItem
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.protected void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context) throws javax.xml.transform.TransformerException, XmlException
DiagramItem
loadFromXml
in class DiagramItem
xmlElement
- An XmlElement containing the item's data.context
- An XmlPersistContext
object providing contextual
information about the serialization process and some helper serialization methods
javax.xml.transform.TransformerException
XmlException
public boolean getObstacle()
true
if auto-routed links should go around
this node, otherwise false
.public void setObstacle(boolean value)
value
- true
if auto-routed links should go around
this node, otherwise false
.public java.awt.geom.Rectangle2D.Float getBounds()
getBounds
in class DiagramItem
Rectangle2D.Float
object
representing the node bounds.public void setBounds(java.awt.geom.Rectangle2D value)
value
- A Rectangle2D.Float
object
representing the node bounds.public void setBounds(float x, float y, float w, float h)
x
- The new horizontal position of the node.y
- The new vertical position of the node.w
- The new width of the node.h
- The new height of the node.public void moveTo(float x, float y)
x
- The new horizontal position of the node.y
- The new vertical position of the node.protected void move(double x, double y)
public void resize(float width, float height)
width
- The new width of this node.height
- The new height of this node.public boolean containsPoint(java.awt.geom.Point2D point)
containsPoint
in class DiagramItem
point
- The point to check.
public boolean containsPoint(java.awt.geom.Point2D point, float threshold)
point
- The point to check.threshold
- Specifies the size of the area around the node
outlines where the point is still considered inside the node.
protected void rectFromPoints()
protected boolean shouldRenderAnchors(RenderOptions options)
protected void startCreate(java.awt.geom.Point2D org)
DiagramItem
startCreate
in class DiagramItem
org
- Position of the mouse pointer.protected void updateCreate(java.awt.geom.Point2D current)
DiagramItem
updateCreate
in class DiagramItem
current
- Position of the mouse pointer.protected boolean allowCreate(java.awt.geom.Point2D current, InteractionState ist)
DiagramItem
allowCreate
in class DiagramItem
current
- The current mouse pointer position.ist
- An InteractionState
object containing more information about the current state of the operation.
protected void completeCreate(java.awt.geom.Point2D end)
DiagramItem
completeCreate
in class DiagramItem
end
- The mouse pointer position.protected void startModify(java.awt.geom.Point2D org, int handle, InteractionState ist)
DiagramItem
startModify
in class DiagramItem
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.protected boolean constraintsInfringed()
protected void updateModify(java.awt.geom.Point2D current, InteractionState ist)
DiagramItem
updateModify
in class DiagramItem
current
- Position of the mouse pointer.ist
- An InteractionState
object containing more information about the current state of the operation.protected boolean allowModify(java.awt.geom.Point2D current, InteractionState ist)
DiagramItem
allowModify
in class DiagramItem
current
- The current mouse pointer position.ist
- An InteractionState object containing more information about the current state of the operation.
protected void completeModify(java.awt.geom.Point2D end, InteractionState ist)
DiagramItem
completeModify
in class DiagramItem
end
- The mouse pointer position.ist
- An InteractionState
object containing more information about the current state of the operation.protected void cancelModify(InteractionState ist)
cancelModify
in class DiagramItem
protected void onUpdateBounds()
public long getEnabledHandles()
AdjustmentHandles
constants.public void setEnabledHandles(long value)
value
- A bitwise combination of the AdjustmentHandles
constants.public AnchorPattern getAnchorPattern()
AnchorPattern
object that defines
the anchor points for this node.public void setAnchorPattern(AnchorPattern value)
value
- An AnchorPattern
object that defines
the anchor points for this node.public static boolean nodesIntersect(DiagramNode node1, DiagramNode node2)
node1
- The first node.node2
- The second node.
true
if the nodes intersect, otherwise false
.public boolean onDragOver(DiagramItem item)
item
- The DiagramItem that is dragged over the node.
public void onDragOut(DiagramItem item)
item
- The DiagramItem that is dragged out of the node.public boolean onDropOver(DiagramItem item)
item
- The DiagramItem that is dropped over the node.
protected void resizeToFitImage(java.awt.Image image)
public void setExpandedFlag(boolean expanded)
expanded
- The new value of the flag.protected void putExpandable(boolean exp)
public boolean getExpandable()
true
if the tree branch that starts from this node
can be expanded or collapsed by users, otherwise false
.public void setExpandable(boolean value)
value
- true
if the tree branch that starts from this node
can be expanded or collapsed by users, otherwise false
.public boolean getExpanded()
true
if the tree branch that starts from this node
is currently expanded, otherwise false
.public void setExpanded(boolean value)
value
- true
if the tree branch that starts from
this node should be expanded, otherwise false
.public boolean getAllowIncomingLinks()
true
if incoming links can be drawn to this node,
otherwise false
.public void setAllowIncomingLinks(boolean value)
value
- true
if incoming links can be drawn to this node,
otherwise false
.public boolean getAllowOutgoingLinks()
true
if outgoing links can be drawn from this node,
otherwise false
.public void setAllowOutgoingLinks(boolean value)
value
- true
if outgoing links can be drawn from
this node, otherwise false
.public int getHandlesStyle()
HandlesStyle
constants.public void setHandlesStyle(int value)
value
- One of the HandlesStyle
constants.protected DiagramItemState createState()
DiagramItem.createState()
override.
createState
in class DiagramItem
protected void saveState(DiagramItemState state)
DiagramItem.saveState(com.mindfusion.diagramming.DiagramItemState)
override.
saveState
in class DiagramItem
protected void restoreState(DiagramItemState state)
DiagramItem.restoreState(com.mindfusion.diagramming.DiagramItemState)
override.
restoreState
in class DiagramItem
protected DiagramItemProperties createProperties()
DiagramItem.createProperties()
override.
createProperties
in class DiagramItem
protected void saveProperties(DiagramItemProperties props)
DiagramItem.saveProperties(com.mindfusion.diagramming.DiagramItemProperties)
override.
saveProperties
in class DiagramItem
props
- A DiagramItemProperties-derived object where
the item's properties should be saved.protected void restoreProperties(DiagramItemProperties props)
DiagramItem.restoreProperties(com.mindfusion.diagramming.DiagramItemProperties)
override.
restoreProperties
in class DiagramItem
props
- A DiagramItemProperties -derived object containing a
snapshot of the item's properties.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |