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.
|
Selection(Diagram diagram) |
Modifier and Type | Method and Description |
---|---|
void |
addItem(DiagramItem item)
Adds the specified item to the selection.
|
protected boolean |
allowCreate(android.graphics.PointF 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(android.graphics.PointF 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(android.graphics.PointF end)
Invoked when the user finishes drawing this item.
|
protected void |
completeModify(android.graphics.PointF end,
InteractionState ist)
Invoked when the item modification has been completed.
|
boolean |
containsPoint(android.graphics.PointF point)
DiagramItem.containsPoint override.
|
protected void |
draw(android.graphics.Canvas g,
RenderOptions options)
Draws this item on the specified Canvas surface.
|
protected void |
drawShadow(android.graphics.Canvas g,
RenderOptions options)
Draws the item's shadow on the specified Canvas surface.
|
boolean |
getAllowMultipleSelection()
Gets a value indicating whether users are allowed to select
multiple items.
|
android.graphics.RectF |
getBounds()
Gets the smallest rectangle that bounds all selected items.
|
SelectionStyle |
getHandlesStyle()
Gets a value indicating how multiple selection is drawn on the screen.
|
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 android.graphics.RectF |
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(android.graphics.PointF 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 |
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(android.graphics.PointF org)
Invoked once when the user starts drawing a new item interactively.
|
protected void |
startModify(android.graphics.PointF 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(android.graphics.PointF current)
Invoked during interactive creation of this item.
|
protected void |
updateModify(android.graphics.PointF current,
InteractionState ist)
Invoked during interactive modification of this item.
|
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable.
|
clone, createProperties, createState, getBrush, getEffectiveBrush, getEffectiveFont, getEffectivePen, getEffectiveShadowBrush, getEffectiveTextBrush, getFont, getHyperLink, getId, getIgnoreLayout, getLayerIndex, getLayoutTraits, getLocked, getMasterGroup, getMeasureUnit, getParent, getPen, getPrintable, getRuntimeIndex, getSelected, getShadowBrush, getShadowOffsetX, getShadowOffsetY, getStyle, getSubordinateGroup, getTag, getTextBrush, getTextPadding, getToolTip, getValue, getVisible, getWeight, getZIndex, hasSubordinates, loadFromXml, onAdd, onChangeFont, onChangeTextPadding, onChildModified, onClick, onDoubleClick, onLoad, onMeasureUnitChanged, onRemove, onStyleChanged, putSelected, query, repaint, repaint, repaint, restoreProperties, restoreState, saveProperties, saveState, saveToXml, setBrush, setDiagramDirty, setFont, setHyperLink, setId, setIgnoreLayout, setLayerIndex, setLocked, setPen, setPrintable, setSelected, setShadowBrush, setShadowOffsetX, setShadowOffsetY, setStyle, setTag, setTextBrush, setTextPadding, setToolTip, setVisible, setWeight, setZIndex, shouldRender, zBottom, zLevelDown, zLevelUp, zTop
public Selection(Diagram diagram)
public Selection()
protected void startModify(android.graphics.PointF org, AdjustmentHandle handle, InteractionState ist)
DiagramItem
startModify
in class DiagramItem
org
- The initial position of the 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(android.graphics.PointF current, InteractionState ist)
DiagramItem
updateModify
in class DiagramItem
current
- The current position of the pointer.ist
- An InteractionState
object containing more information about the current state of the operation.protected void completeModify(android.graphics.PointF end, InteractionState ist)
DiagramItem
completeModify
in class DiagramItem
end
- The pointer position.ist
- An InteractionState
object containing more information about the current state of the operation.protected void startCreate(android.graphics.PointF org)
DiagramItem
startCreate
in class DiagramItem
org
- The initial position of the pointer.protected void updateCreate(android.graphics.PointF current)
DiagramItem
updateCreate
in class DiagramItem
current
- The current position of the pointer.protected void completeCreate(android.graphics.PointF end)
DiagramItem
completeCreate
in class DiagramItem
end
- The pointer position.protected boolean allowModify(android.graphics.PointF current, InteractionState ist)
DiagramItem
allowModify
in class DiagramItem
current
- The current 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(android.graphics.Canvas g, RenderOptions options)
DiagramItem
draw
in class DiagramItem
g
- An android.graphics.Canvas instance.options
- Provides options for the drawing operation.protected void drawShadow(android.graphics.Canvas g, RenderOptions options)
DiagramItem
drawShadow
in class DiagramItem
g
- An android.graphics.Canvas instance.options
- Provides options for the drawing operation.public boolean containsPoint(android.graphics.PointF point)
containsPoint
in class DiagramItem
point
- The point to check.public AdjustmentHandle hitTestHandle(android.graphics.PointF point)
hitTestHandle
in class DiagramItem
point
- A PointF instance specifying the location where to look for adjustment handles.protected android.graphics.RectF 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(android.graphics.PointF current, InteractionState ist)
DiagramItem
allowCreate
in class DiagramItem
current
- The current 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 android.graphics.RectF getBounds()
getBounds
in class DiagramItem
RectF
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 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()