public class GraphSelection extends Object implements IGraphSelection, IEnumerable<IModelItem>
IGraphSelection interface.EMPTY| Constructor and Description |
|---|
GraphSelection()
Creates a new instance with no initial
Graph assigned. |
GraphSelection(IGraph graph)
Instantiates an instance using the the graph as the model.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<IModelItem>> itemSelectionChangedEvent)
Adds the given listener for the
ItemSelectionChanged event that occurs when an item changed its selection state
from selected to unselected or vice versa. |
void |
clear()
Clears the selection.
|
protected DefaultSelectionModel<IBend> |
createBendSelectionModel()
Factory method that creates the
DefaultSelectionModel to use for the bends. |
protected DefaultSelectionModel<IEdge> |
createEdgeSelectionModel()
Factory method that creates the
DefaultSelectionModel to use for the edges. |
protected DefaultSelectionModel<ILabel> |
createLabelSelectionModel()
Factory method that creates the
DefaultSelectionModel to use for the labels. |
protected DefaultSelectionModel<INode> |
createNodeSelectionModel()
Factory method that creates the
DefaultSelectionModel to use for the nodes. |
protected DefaultSelectionModel<IPort> |
createPortSelectionModel()
Factory method that creates the
DefaultSelectionModel to use for the ports. |
IEnumerator<IModelItem> |
enumerator()
Returns an enumerator that iterates through the collection of all selected elements.
|
IGraph |
getGraph()
Gets the
IGraph this instance is using as the domain for the selection. |
ISelectionModel<IBend> |
getSelectedBends()
An
ISelectionModel of the selected bends. |
ISelectionModel<IEdge> |
getSelectedEdges()
An
ISelectionModel of the selected edges. |
ISelectionModel<ILabel> |
getSelectedLabels()
An
ISelectionModel of the selected labels. |
ISelectionModel<INode> |
getSelectedNodes()
An
ISelectionModel of the selected nodes. |
ISelectionModel<IPort> |
getSelectedPorts()
An
ISelectionModel of the selected ports. |
boolean |
isSelected(IModelItem item)
Determines whether an item is currently selected.
|
protected void |
onItemSelectionChanged(ItemSelectionChangedEventArgs<IModelItem> args)
Raises the
ItemSelectionChanged event. |
void |
removeItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<IModelItem>> itemSelectionChangedEvent)
Removes the given listener for the
ItemSelectionChanged event that occurs when an item changed its selection
state from selected to unselected or vice versa. |
void |
setGraph(IGraph value)
Sets the
IGraph this instance is using as the domain for the selection. |
void |
setSelected(IModelItem item,
boolean selected)
Sets the selection state of an item.
|
int |
size()
Returns the number of selected items.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconcat, concat, create, create, iterator, parallelStream, streamforEach, spliteratorpublic GraphSelection()
public GraphSelection(IGraph graph)
public final void addItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<IModelItem>> itemSelectionChangedEvent)
ISelectionModelItemSelectionChanged event that occurs when an item changed its selection state
from selected to unselected or vice versa.addItemSelectionChangedListener in interface ISelectionModel<IModelItem>itemSelectionChangedEvent - The listener to add.ISelectionModel.setSelected(java.lang.Object, boolean),
ISelectionModel.removeItemSelectionChangedListener(IEventHandler)public final void clear()
ISelectionModelThis is a convenience method that will set the selection state of all elements to unselected.
clear in interface ISelectionModel<IModelItem>ISelectionModel.addItemSelectionChangedListener(IEventHandler)protected DefaultSelectionModel<IBend> createBendSelectionModel()
DefaultSelectionModel to use for the bends.protected DefaultSelectionModel<IEdge> createEdgeSelectionModel()
DefaultSelectionModel to use for the edges.protected DefaultSelectionModel<ILabel> createLabelSelectionModel()
DefaultSelectionModel to use for the labels.protected DefaultSelectionModel<INode> createNodeSelectionModel()
DefaultSelectionModel to use for the nodes.protected DefaultSelectionModel<IPort> createPortSelectionModel()
DefaultSelectionModel to use for the ports.public final IEnumerator<IModelItem> enumerator()
enumerator in interface IEnumerable<IModelItem>IEnumerator object that can be used to iterate through all selected elements.public final IGraph getGraph()
IGraph this instance is using as the domain for the selection.setGraph(IGraph)public final ISelectionModel<IBend> getSelectedBends()
IGraphSelectionISelectionModel of the selected bends.
This is the bend part of the selection that this instance is a composite of.
getSelectedBends in interface IGraphSelectionpublic final ISelectionModel<IEdge> getSelectedEdges()
IGraphSelectionISelectionModel of the selected edges.
This is the edge part of the selection that this instance is a composite of.
getSelectedEdges in interface IGraphSelectionpublic final ISelectionModel<ILabel> getSelectedLabels()
IGraphSelectionISelectionModel of the selected labels.
This is the label part of the selection that this instance is a composite of.
getSelectedLabels in interface IGraphSelectionpublic final ISelectionModel<INode> getSelectedNodes()
IGraphSelectionISelectionModel of the selected nodes.
This is the node part of the selection that this instance is a composite of.
getSelectedNodes in interface IGraphSelectionpublic final ISelectionModel<IPort> getSelectedPorts()
IGraphSelectionISelectionModel of the selected ports.
This is the ports part of the selection that this instance is a composite of.
getSelectedPorts in interface IGraphSelectionpublic boolean isSelected(IModelItem item)
ISelectionModelisSelected in interface ISelectionModel<IModelItem>item - The item to check.protected void onItemSelectionChanged(ItemSelectionChangedEventArgs<IModelItem> args)
ItemSelectionChanged event.args - The parameters for the eventpublic final void removeItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<IModelItem>> itemSelectionChangedEvent)
ISelectionModelItemSelectionChanged event that occurs when an item changed its selection
state from selected to unselected or vice versa.removeItemSelectionChangedListener in interface ISelectionModel<IModelItem>itemSelectionChangedEvent - The listener to remove.ISelectionModel.setSelected(java.lang.Object, boolean),
ISelectionModel.addItemSelectionChangedListener(IEventHandler)public final void setGraph(IGraph value)
IGraph this instance is using as the domain for the selection.value - The Graph to set.getGraph()public void setSelected(IModelItem item, boolean selected)
ISelectionModel
If the state changes, this will trigger the ItemSelectionChanged
event.
setSelected in interface ISelectionModel<IModelItem>item - The item to set the selection state for.selected - Whether to select the object.public final int size()
ISelectionModelsize in interface ISelectionModel<IModelItem>