public final class Selection extends DiagramItem
Diagram
has its
own Selection
instance, which can be accessed via the
Diagram.getSelection()
method.brush, cycleDetected, cycleProtect, modifyDX, modifyDY, modifyHandle, modifying, pen, ptEnd, ptMdfLast, ptOrg, ptSavedEnd, ptSavedOrg, subordinateGroup
Constructor and Description |
---|
Selection()
Initializes a new Selection instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addItem(DiagramItem item)
Adds the specified item to the selection.
|
protected boolean |
allowCreate(java.awt.geom.Point2D current,
InteractionState ist)
Invoked while the user draws this item 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.
|
protected void |
cancelModify(InteractionState ist)
Invoked when the interactive modification of this item has been canceled.
|
void |
change(DiagramItem item)
Changes the selection to the specified item.
|
void |
clear()
Removes all items from the selection.
|
protected void |
completeCreate(java.awt.geom.Point2D end)
Invoked when the user finishes drawing this item.
|
protected void |
completeModify(java.awt.geom.Point2D end,
InteractionState ist)
Invoked when the item modification has been completed.
|
boolean |
containsPoint(java.awt.geom.Point2D point)
DiagramItem.containsPoint override.
|
boolean |
containsPoint(java.awt.geom.Point2D point,
float threshold)
DiagramItem.containsPoint override.
|
protected void |
draw(java.awt.Graphics2D g,
RenderOptions options)
Draws this item on the specified Graphics2D surface.
|
protected void |
drawShadow(java.awt.Graphics2D g,
RenderOptions options)
Draws the item's shadow on the specified Graphics2D surface.
|
boolean |
getAllowMultipleSelection()
Gets a value indicating whether users are allowed to select
multiple items.
|
java.awt.geom.Rectangle2D.Float |
getBounds()
Gets the smallest rectangle that bounds all selected items.
|
SelectionStyle |
getHandlesStyle()
Gets a value indicating how multiple selection is drawn on the screen.
|
boolean |
getIncludeItemsIfIntersect()
Gets a value indicating which items are selected when drawing a selection rectangle.
|
DiagramItemList |
getItems()
Gets a list of all selected items.
|
DiagramLinkList |
getLinks()
Gets a list of all selected links.
|
DiagramNodeList |
getNodes()
Gets a list of all selected boxes.
|
boolean |
getOffsetUnconnectedLinks()
Gets whether moving the selection should offset all points of selected unconnected links.
|
protected java.awt.geom.Rectangle2D |
getRepaintRect(boolean connected)
Gets the repaint region for this item, taking into account
factors such as pen, selection handles and shadow.
|
boolean |
getSetsDirtyFlag()
Gets a value indicating whether the diagram's Dirty flag
should be set when selection changes.
|
AdjustmentHandle |
hitTestHandle(java.awt.geom.Point2D point)
|
boolean |
itemInSelection(DiagramItem item)
Determines whether the specified item is selected.
|
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable.
|
boolean |
removeItem(DiagramItem item)
Removes the specified item from the selection.
|
void |
setAllowMultipleSelection(boolean value)
Sets a value indicating whether users are allowed to select
multiple items.
|
void |
setHandlesStyle(SelectionStyle value)
Sets a value indicating how multiple selection should be drawn
on the screen.
|
void |
setIncludeItemsIfIntersect(boolean value)
Sets a value indicating which items are selected when drawing a selection rectangle.
|
void |
setOffsetUnconnectedLinks(boolean value)
Sets whether moving the selection should offset all points of selected unconnected links.
|
void |
setSetsDirtyFlag(boolean value)
Sets a value indicating whether the diagram's Dirty flag
should be set when selection changes.
|
int |
size()
Returns the number of selected items.
|
protected void |
startCreate(java.awt.geom.Point2D org)
Invoked once when the user starts drawing a new item interactively.
|
protected void |
startModify(java.awt.geom.Point2D org,
AdjustmentHandle handle,
InteractionState ist)
Invoked when the user starts modifying this item interactively.
|
void |
toggle(DiagramItem item)
Toggles the selection state of the specified item.
|
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.
|
as, clone, createProperties, createState, getBrush, getEffectiveBrush, getEffectiveFont, getEffectivePen, getEffectiveShadowBrush, getEffectiveTextBrush, getFont, getHyperLink, getId, getIgnoreLayout, getLayerIndex, getLayoutTraits, getLocked, getMasterGroup, getMeasureUnit, getOpacity, getParent, getPen, getPrintable, getRuntimeIndex, getSelected, getShadowBrush, getShadowOffsetX, getShadowOffsetY, getStyle, getSubordinateGroup, getTag, getTextBrush, getTextPadding, getToolTip, getValue, getVisible, getWeight, getZIndex, hasSubordinates, hitTest, labelFromPoint, loadFromJson, loadFromXml, onAdd, onChangeFont, onChangeTextPadding, onChildModified, onClick, onDoubleClick, onLoad, onMeasureUnitChanged, onRemove, onStyleChanged, onStyleFontChanged, putSelected, query, repaint, repaint, repaint, restoreProperties, restoreState, saveProperties, saveState, saveToJson, saveToXml, 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
protected void startModify(java.awt.geom.Point2D org, AdjustmentHandle handle, InteractionState ist)
DiagramItem
startModify
in class DiagramItem
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)
DiagramItem
updateModify
in class DiagramItem
current
- The current position of the mouse pointer.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 startCreate(java.awt.geom.Point2D org)
DiagramItem
startCreate
in class DiagramItem
org
- The initial position of the mouse pointer.protected void updateCreate(java.awt.geom.Point2D current)
DiagramItem
updateCreate
in class DiagramItem
current
- The current position of the mouse pointer.protected void completeCreate(java.awt.geom.Point2D end)
DiagramItem
completeCreate
in class DiagramItem
end
- The mouse pointer position.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 cancelModify(InteractionState ist)
DiagramItem
cancelModify
in class DiagramItem
ist
- An InteractionState
object containing more information about the current state of the operation.protected void draw(java.awt.Graphics2D g, RenderOptions options)
DiagramItem
draw
in class DiagramItem
g
- A java.awt.Graphics2D instance.options
- Provides options for the drawing operation.protected void drawShadow(java.awt.Graphics2D g, RenderOptions options)
DiagramItem
drawShadow
in class DiagramItem
g
- A java.awt.Graphics2D instance.options
- Provides options for the drawing operation.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)
containsPoint
in class DiagramItem
point
- The point to check.threshold
- Specifies the size of the area around the item outlines where the point is still considered inside the item.public AdjustmentHandle hitTestHandle(java.awt.geom.Point2D point)
hitTestHandle
in class DiagramItem
point
- A Point2D instance specifying the location where to look for adjustment handles.protected java.awt.geom.Rectangle2D getRepaintRect(boolean connected)
DiagramItem
getRepaintRect
in class DiagramItem
connected
- true if related items should be considered too; otherwise, false.public int size()
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.public void toggle(DiagramItem item)
item
- An DiagramItem
whose selection state should be toggled.public void change(DiagramItem item)
item
- The DiagramItem
that should be selected.public void addItem(DiagramItem item)
item
- An DiagramItem
that should be added to the multiple selection.public boolean removeItem(DiagramItem item)
item
- The DiagramItem
that should be deselected.false
if the specified item was not selected,
otherwise true
.public boolean itemInSelection(DiagramItem item)
item
- The DiagramItem
whose selection state to check.true
if the item is selected,
otherwise false
.public void clear()
public DiagramItemList getItems()
DiagramItemList
containing the selected items.public DiagramLinkList getLinks()
DiagramLinkList
containing the selected links.public DiagramNodeList getNodes()
ShapeNodeList
containing the selected boxes.public SelectionStyle getHandlesStyle()
SelectionStyle
enumeration.public void setHandlesStyle(SelectionStyle value)
value
- A member of the SelectionStyle
enumeration.public boolean getAllowMultipleSelection()
true
if users are allowed to select
multiple items, otherwise false
.public void setAllowMultipleSelection(boolean value)
value
- true
if users are allowed to select
multiple items, otherwise false
.public java.awt.geom.Rectangle2D.Float getBounds()
getBounds
in class DiagramItem
Rectangle2D.Float
object representing
the rectangle that bounds all selected items.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
public void setIncludeItemsIfIntersect(boolean value)
value
- true to select items which intersect the selection rectangle,
or false to select only items that are entirely within the rectangle.public boolean getIncludeItemsIfIntersect()
public void setSetsDirtyFlag(boolean value)
value
- true to set the Dirty flag when selection changes, otherwise, false.public boolean getSetsDirtyFlag()
public void setOffsetUnconnectedLinks(boolean value)
value
- true to move all points of unconnected links, or false otherwise.public boolean getOffsetUnconnectedLinks()