Package org.graffiti.selection
Class Selection
java.lang.Object
org.graffiti.selection.Selection
public class Selection extends Object
Contains selected nodes and edges.
Even if there are fundamental changes to the selection, don't use something like that:
Selection newSel = new Selection(SelectionModel.ACTIVE);
editorSession. getSelectionModel().add(SelectionModel.ACTIVE);
editorSession.
getSelectionModel().setActiveSelection(SelectionModel.ACTIVE);
Instead, remove all entries within the selection by calling
clear()
on the active selection (editorSession.
getSelectionModel().getActiveSelection()
) and add the new selection
elements to it. After all changes have been made and the system should be
updated, call editorSession.getSelectionmodel().
selectionChanged()
- Version:
- $Revision: 1.12 $
-
Constructor Summary
Constructors Constructor Description Selection()
Constructs a newSelection
instance with the given name.Selection(String name)
Constructs a newSelection
instance with the given name.Selection(String name, Collection<?> newElements)
Selection(Collection<?> newElements)
-
Method Summary
Modifier and Type Method Description void
add(Edge edge)
Adds the given edge to the list of selected edges.void
add(GraphElement ge)
Adds the given node or edge to the selection.void
add(Node node)
Adds the given node to the list of selected nodes.void
addAll(Collection<?> newElements)
Adds all (graph)elements of the given collection to this selection.void
addSelection(Selection sel)
Adds all elements from the given selection to this selection.void
clear()
Remove all elements from this selection.Object
clone()
boolean
contains(GraphElement ge)
Collection<Edge>
getEdges()
Returns the list of selected edges.List<GraphElement>
getElements()
Returns a list containing all edges and nodes in this selection.Collection<Graph>
getGraph()
String
getName()
Returns the name of this selection.Map<GraphElement,GraphElement>
getNewMarked()
Returns the map holding graph elements that have been marked since the last selectionChanged event.Map<GraphElement,GraphElement>
getNewUnmarked()
Returns the map holding graph elements that have been unmarked since the last selectionChanged event.Collection<Node>
getNodes()
Returns the list of selected nodes.int
getNumberOfEdges()
int
getNumberOfNodes()
boolean
isEmpty()
Returnstrue
if no nodes or edges are selected.void
remove(GraphElement ge)
Removes the given node or edge from the selection.void
removeAll(Collection<?> elements)
void
setName(String name)
Sets the name.void
setNewMarked(Map<GraphElement,GraphElement> newMarked)
Sets the list of graph elements that have been marked but the selection listeners have not yet been notified.void
setNewUnmarked(Map<GraphElement,GraphElement> newUnmarked)
Sets the list of graph elements that have been unmarked but the selection listeners have not yet been notified.String
toString()
Gets a string describing the selection.
-
Constructor Details
-
Selection
public Selection()Constructs a newSelection
instance with the given name. -
Selection
Constructs a newSelection
instance with the given name.- Parameters:
name
- the name of this selection.
-
Selection
-
Selection
-
-
Method Details
-
getEdges
Returns the list of selected edges.- See Also:
Edge
-
getElements
Returns a list containing all edges and nodes in this selection.- Returns:
- a list containing all edges and nodes in this selection.
-
isEmpty
public boolean isEmpty()Returnstrue
if no nodes or edges are selected.- Returns:
true
if no nodes or edges are selected.
-
setName
Sets the name.- Parameters:
name
- The name to set- Throws:
FieldAlreadySetException
- DOCUMENT ME!
-
getName
Returns the name of this selection.- Returns:
- the name of this selection.
-
setNewMarked
Sets the list of graph elements that have been marked but the selection listeners have not yet been notified.- Parameters:
newMarked
- list of newly marked graph elements
-
getNewMarked
Returns the map holding graph elements that have been marked since the last selectionChanged event.- Returns:
- map holding graph elements that have been marked since the last selectionChanged event.
-
setNewUnmarked
Sets the list of graph elements that have been unmarked but the selection listeners have not yet been notified.- Parameters:
newUnmarked
- list of newly unmarked graph elements
-
getNewUnmarked
Returns the map holding graph elements that have been unmarked since the last selectionChanged event.- Returns:
- the map holding graph elements that have been unmarked since the last selectionChanged event.
-
getNodes
Returns the list of selected nodes.- See Also:
Node
-
add
Adds the given node or edge to the selection.- Parameters:
ge
- the node or edge to add to the selection.
-
add
Adds the given node to the list of selected nodes.- Parameters:
node
- the node to add to the list of selected nodes.
-
add
Adds the given edge to the list of selected edges.- Parameters:
edge
- the edge to add to the list of selected edges.
-
addAll
Adds all (graph)elements of the given collection to this selection.- Parameters:
newElements
-
-
removeAll
-
addSelection
Adds all elements from the given selection to this selection.- Parameters:
sel
-
-
clear
public void clear()Remove all elements from this selection. -
clone
- See Also:
Object.clone()
-
remove
Removes the given node or edge from the selection.- Parameters:
ge
- the node or edge to remove from the selection.
-
toString
Gets a string describing the selection. Default: number of selected nodes and edges in a sentence. -
contains
-
getNumberOfNodes
public int getNumberOfNodes() -
getGraph
-
getNumberOfEdges
public int getNumberOfEdges()
-