public class FreeFormNode extends DiagramNode implements InplaceEditable
allowIncomingLinks, allowOutgoingLinks, anchorPattern, AV_Cancel, AV_EndModIncoming, AV_EndModOutgoing, AV_StartModIncoming, AV_StartModOutgoing, AV_UpdateIncoming, AV_UpdateOutgoing, AV_UpdIntscIncoming, AV_UpdIntscOutgoing, AV_UpdPosIncoming, AV_UpdPosOutgoing, bounds, enabledHandles, handlesStyle, incomingLinks, masterGroup, obstacle, outgoingLinks, savedBounds
brush, cycleDetected, cycleProtect, modifyDX, modifyDY, modifyHandle, modifying, pen, ptEnd, ptMdfLast, ptOrg, ptSavedEnd, ptSavedOrg, subordinateGroup
Constructor and Description |
---|
FreeFormNode()
Initializes a new instance of the
FreeFormNode class. |
FreeFormNode(Diagram parent)
Initializes a new instance of the
FreeFormNode class. |
FreeFormNode(FreeFormNode prototype)
Initializes a new instance of the FreeFormNode class using the specified node as a prototype.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowCreate(java.awt.geom.Point2D current,
InteractionState ist)
|
protected void |
cancelModify(InteractionState ist)
|
protected void |
completeCreate(java.awt.geom.Point2D end)
|
boolean |
containsPoint(java.awt.geom.Point2D point)
DiagramNode.containsPoint(Point2D) override. |
boolean |
containsPoint(java.awt.geom.Point2D point,
float threshold)
|
protected DiagramItemProperties |
createProperties()
DiagramNode.createProperties override.
|
protected DiagramItemState |
createState()
DiagramNode.createState override.
|
protected void |
draw(java.awt.Graphics2D g,
RenderOptions options)
|
protected void |
drawShadow(java.awt.Graphics2D g,
RenderOptions options)
|
boolean |
getClosed()
Gets if the node's shape is closed.
|
java.awt.geom.Rectangle2D |
getEditRect(DiagramItem item,
java.awt.geom.Point2D mousePosition)
Implements InplaceEditable.getEditRect.
|
java.util.ArrayList<java.awt.geom.Point2D.Float> |
getPoints()
Gets the node's outline points.
|
java.lang.String |
getText()
Gets the text displayed inside this node.
|
java.lang.String |
getTextToEdit()
Implements InplaceEditable.getTextToEdit.
|
AdjustmentHandle |
hitTestHandle(java.awt.geom.Point2D point)
|
FreeFormNodeBuilder |
init()
Returns a FreeFormNodeBuilder object used to configure this FreeFormNode instance.
|
protected void |
loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Loads the node from a JSON object.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Loads the item content from an XML element.
|
protected void |
onUpdateBounds()
DiagramNode.onUpdateBounds() override. |
void |
readExternal(java.io.ObjectInput in)
DiagramNode.readExternal override.
|
protected void |
restoreProperties(DiagramItemProperties props)
DiagramNode.restoreProperties override.
|
protected void |
restoreState(DiagramItemState state)
DiagramNode.restoreState override.
|
protected void |
saveProperties(DiagramItemProperties props)
DiagramNode.saveProperties override.
|
protected void |
saveState(DiagramItemState state)
DiagramNode.saveState override.
|
protected void |
saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Saves the node as a JSON object.
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Saves the item content into an XML element.
|
void |
setClosed(boolean value)
Sets if the node's shape is closed.
|
void |
setEditedText(java.lang.String newText)
Implements InplaceEditable.setEditedText.
|
void |
setPoints(java.util.ArrayList<java.awt.geom.Point2D.Float> value)
Sets the node's outline points.
|
void |
setText(java.lang.String value)
Sets the text label displayed inside this node.
|
protected void |
startCreate(java.awt.geom.Point2D org)
|
protected void |
startModify(java.awt.geom.Point2D org,
AdjustmentHandle handle,
InteractionState ist)
|
protected void |
updateCreate(java.awt.geom.Point2D current)
|
void |
updateFromPoints()
Updates the node's internal state after its points have changed.
|
protected void |
updateModify(java.awt.geom.Point2D current,
InteractionState ist)
|
static FreeFormNodeBuilder |
with()
Returns a FreeFormNodeBuilder object used to configure and create new FreeFormNode instances.
|
void |
writeExternal(java.io.ObjectOutput out)
DiagramNode.writeExternal override.
|
addLabel, addLabel, allowModify, allowModifyImpl, attachTo, attachTo, attachTo, completeModify, constraintsInfringed, createConnectionPoint, detach, drawLocal, drawShadowLocal, getAllIncomingLinks, getAllLinks, getAllOutgoingLinks, getAllowIncomingLinks, getAllowOutgoingLinks, getAnchorPattern, getBounds, getCenter, getConstraints, getContainer, getEffects, getEnabledHandles, getExpandable, getExpanded, getHandlesStyle, getIncomingLinks, getLabels, getLocalBounds, getLocalBoundsD, getLocalCenter, getMasterGroup, getMasterItem, getNearestBorderPoint, getObstacle, getOutgoingLinks, getRepaintRect, getRotatedBounds, getRotationAngle, groupContains, labelFromPoint, move, moveTo, nodesIntersect, onDragOut, onDragOver, onDropOver, onModify, onRemove, onRotationAngleChanged, parentConstraintsInfringed, putExpandable, rectFromPoints, removeLabel, resize, resizeToFitImage, scaleElements, setAllowIncomingLinks, setAllowOutgoingLinks, setAnchorPattern, setBounds, setBounds, setBounds, setBoundsDirect, setConstraints, setEnabledHandles, setExpandable, setExpanded, setExpandedFlag, setHandlesStyle, setObstacle, setReflexive, setRotationAngle, shouldRenderAnchors, updateLinkPositions
as, clone, getBrush, getEffectiveBrush, getEffectiveFont, getEffectivePen, getEffectiveShadowBrush, getEffectiveTextBrush, getFont, getHyperLink, getId, getIgnoreLayout, getLayerIndex, getLayoutTraits, getLocked, getMeasureUnit, getOpacity, getParent, getPen, getPrintable, getRuntimeIndex, getSelected, getShadowBrush, getShadowOffsetX, getShadowOffsetY, getStyle, getSubordinateGroup, getTag, getTextBrush, getTextPadding, getToolTip, getValue, getVisible, getWeight, getZIndex, hasSubordinates, hitTest, onAdd, onChangeFont, onChangeTextPadding, onChildModified, onClick, onDoubleClick, onLoad, onMeasureUnitChanged, onStyleChanged, onStyleFontChanged, putSelected, query, repaint, repaint, repaint, setBrush, setDiagramDirty, setFont, setHyperLink, setId, setIgnoreLayout, setLayerIndex, setLocked, setOpacity, setPen, setPrintable, setSelected, setShadowBrush, setShadowOffsetX, setShadowOffsetY, setStyle, setTag, setTextBrush, setTextPadding, setToolTip, setVisible, setWeight, setZIndex, shouldRender, zBottom, zLevelDown, zLevelUp, zTop
public FreeFormNode()
FreeFormNode
class.public FreeFormNode(Diagram parent)
FreeFormNode
class.parent
- The Diagram
from which to obtain default values for the node properties.public FreeFormNode(FreeFormNode prototype)
prototype
- The node to use as a prototype. The properties of the new node
are initialized from the property values of this node.public static FreeFormNodeBuilder with()
FreeFormNodeBuilder
instance.public FreeFormNodeBuilder init()
FreeFormNodeBuilder
instance.public java.util.ArrayList<java.awt.geom.Point2D.Float> getPoints()
public void setPoints(java.util.ArrayList<java.awt.geom.Point2D.Float> value)
value
- An ArrayListpublic boolean getClosed()
public void setClosed(boolean value)
value
- true if the node should be drawn as a closed polygon and filled, or false otherwise.protected void startCreate(java.awt.geom.Point2D org)
startCreate
in class DiagramNode
org
- The initial position of the mouse pointer.protected void updateCreate(java.awt.geom.Point2D current)
updateCreate
in class DiagramNode
current
- The current position of the mouse pointer.protected void completeCreate(java.awt.geom.Point2D end)
completeCreate
in class DiagramNode
end
- The mouse pointer position.protected boolean allowCreate(java.awt.geom.Point2D current, InteractionState ist)
DiagramNode.allowCreate(java.awt.geom.Point2D, com.mindfusion.diagramming.InteractionState)
override.allowCreate
in class DiagramNode
current
- The current mouse pointer position.ist
- An InteractionState
object containing more information about the current state of the operation.protected void startModify(java.awt.geom.Point2D org, AdjustmentHandle handle, InteractionState ist)
DiagramNode.startModify(java.awt.geom.Point2D, com.mindfusion.diagramming.AdjustmentHandle, com.mindfusion.diagramming.InteractionState)
override. Invoked when the user starts modifying this node interactively.startModify
in class DiagramNode
org
- The initial position of the mouse pointer.handle
- The adjustment handle used to modify this item.ist
- An InteractionState
object containing more information about the current state of the operation.protected void updateModify(java.awt.geom.Point2D current, InteractionState ist)
DiagramNode.updateModify(java.awt.geom.Point2D, com.mindfusion.diagramming.InteractionState)
override. Invoked during interactive modification of this node.updateModify
in class DiagramNode
current
- The current position of the mouse pointer.ist
- An InteractionState
object containing more information about the current state of the operation.protected void cancelModify(InteractionState ist)
DiagramItem.cancelModify(com.mindfusion.diagramming.InteractionState)
override. Invoked when the interactive modification of this node has been canceled.cancelModify
in class DiagramNode
ist
- An InteractionState
object containing more information about the current state of the operation.public void updateFromPoints()
protected void onUpdateBounds()
DiagramNode.onUpdateBounds()
override. Invoked when the bounding rectangle of this node has changed.onUpdateBounds
in class DiagramNode
public boolean containsPoint(java.awt.geom.Point2D point)
DiagramNode.containsPoint(Point2D)
override. Checks whether this node
contains the specified point. This method is called during hit-testing to determine
if the mouse pointer is over the node.containsPoint
in class DiagramNode
point
- The point to check.public boolean containsPoint(java.awt.geom.Point2D point, float threshold)
DiagramNode.containsPoint(Point2D, float)
override. Checks whether this node
contains the specified point. This method is called during hit-testing to determine
if the mouse pointer is over the node.containsPoint
in class DiagramNode
point
- The point to check.threshold
- Specifies the size of the area around the node outlines where the point is still considered inside.protected void draw(java.awt.Graphics2D g, RenderOptions options)
DiagramNode.draw(java.awt.Graphics2D, com.mindfusion.diagramming.RenderOptions)
override. Draws this node on the specified Graphics2D surface.draw
in class DiagramNode
g
- A java.awt.Graphics2D instance.options
- Provides options for the drawing operation.protected void drawShadow(java.awt.Graphics2D g, RenderOptions options)
DiagramNode.drawShadow(java.awt.Graphics2D, com.mindfusion.diagramming.RenderOptions)
override. Draws the node's shadow on the specified Graphics2D surface.drawShadow
in class DiagramNode
g
- A java.awt.Graphics2D instance.options
- Provides options for the drawing operation.public AdjustmentHandle hitTestHandle(java.awt.geom.Point2D point)
DiagramNode.hitTestHandle(java.awt.geom.Point2D)
override. Determines whether a selection handle of this node is located at the specified point.hitTestHandle
in class DiagramNode
point
- A Point2D instance specifying the location where to look for adjustment handles.NodeAdjustmentHandle
or FreeFormHandle
representing the adjustment
handle found at the specified location, or null if there is none.protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
saveToXml
in class DiagramNode
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
loadFromXml
in class DiagramNode
xmlElement
- An XmlElement containing the item's data.context
- An XmlPersistContext
object providing contextual
information about the serialization process and some helper serialization methodsjavax.xml.transform.TransformerException
XmlException
protected void saveToJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
saveToJson
in class DiagramNode
obj
- A JsonObject instance to contain the serialized data.context
- A JsonPersistContext object providing contextual information
about the serialization process and helper serialization methods.protected void loadFromJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
loadFromJson
in class DiagramNode
obj
- A JsonObject containing the node's data.context
- A JsonPersistContext object providing contextual information about
the serialization process and helper serialization methods.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class DiagramNode
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 DiagramNode
java.io.IOException
java.lang.ClassNotFoundException
protected DiagramItemState createState()
createState
in class DiagramNode
protected void saveState(DiagramItemState state)
saveState
in class DiagramNode
protected void restoreState(DiagramItemState state)
restoreState
in class DiagramNode
protected DiagramItemProperties createProperties()
createProperties
in class DiagramNode
protected void saveProperties(DiagramItemProperties props)
saveProperties
in class DiagramNode
props
- A DiagramItemProperties-derived object where
the item's properties should be saved.protected void restoreProperties(DiagramItemProperties props)
restoreProperties
in class DiagramNode
props
- A DiagramItemProperties -derived object containing a
snapshot of the item's properties.public java.lang.String getText()
String
containing the label text.public void setText(java.lang.String value)
value
- A String
containing the label text.public java.lang.String getTextToEdit()
getTextToEdit
in interface InplaceEditable
public void setEditedText(java.lang.String newText)
setEditedText
in interface InplaceEditable
newText
- The new text of this node.public java.awt.geom.Rectangle2D getEditRect(DiagramItem item, java.awt.geom.Point2D mousePosition)
getEditRect
in interface InplaceEditable
item
- A reference to this node.mousePosition
- A Point2D instance specifying the current pointer position.