|
Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cytoscape.data.SelectFilter
public class SelectFilter
This class implements the ability to set the selected state of every node or edge in a GraphPerspective. The state can be either on or off. Methods are provided for inspecting the current state of any graph object, for setting the state, or getting the full set of states for nodes or edges. This functionality is often used to identify a set of interesting nodes or edges in the graph.
A non-null GraphPerspective reference is required to construct an instance of this class. This class will listen to the graph to respond to the removal of graph objects. A currently selected object that is removed from the graph will lose its selected state, even if it is later added back to the graph.
When the selected state of a node or edge is changed, a event of type SelectEvent is fired. When a group of nodes or edges are changed together in a single operation, one event will be fired for the whole group (but separate events for nodes and edges). Note: a listener should not be removed from this object in response to the firing of an event, as this may cause a ConcurrentModificationException.
WARNING: for performance reasons, the set of objects returned by the getSelectedXX methods is the actual data object, not a copy. Users should not directly modify these sets.
Performance note: the implementation is a HashSet of selected objects, so most methods are O(1). Operations on groups of nodes are O(N) where N is either the number of selected objects or the number of objects in the graph, as applicable.
Constructor Summary | |
---|---|
SelectFilter(GraphPerspective graph)
Standard Constructor. |
Method Summary | |
---|---|
void |
addSelectEventListener(SelectEventListener listener)
If the argument is not already a listener to this object, it is added. |
Set |
getSelectedEdges()
Returns the set of all selected edges in the referenced GraphPespective. |
Set |
getSelectedNodes()
Returns the set of all selected nodes in the referenced GraphPespective. |
List |
getSelectEventListeners()
Gets a List of All Registered Listeners. |
void |
graphPerspectiveChanged(GraphPerspectiveChangeEvent event)
Implementation of the GraphPerspectiveChangeListener interface. |
boolean |
isSelected(Edge edge)
Returns true if the argument is a selected Edge in the referenced GraphPerspective, false otherwise. |
boolean |
isSelected(Node node)
Returns true if the argument is a selected Node in the referenced GraphPerspective, false otherwise. |
boolean |
passesFilter(Object o)
Implementation of the Filter interface. |
void |
removeSelectEventListener(SelectEventListener listener)
If the argument is a listener to this object, removes it from the list of listeners. |
Set |
selectAllEdges()
Sets the selected state to true for all Edges in the GraphPerspective. |
Set |
selectAllNodes()
Sets the selected state to true for all Nodes in the GraphPerspective. |
boolean |
setSelected(Edge edge,
boolean newState)
If the first argument is an Edge in the referenced GraphPerspective, sets its selected state to the value of the second argument. |
boolean |
setSelected(Node node,
boolean newState)
If the first argument is a Node in the referenced GraphPerspective, sets its selected state to the value of the second argument. |
Set<Edge> |
setSelectedEdges(Collection<Edge> edgesToSet,
boolean newState)
Sets the selected state defined by the second argument for all Edges contained in the first argument, which should be a Collection of Edge objects contained in the referenced GraphPerspective. |
Set<Node> |
setSelectedNodes(Collection<Node> nodesToSet,
boolean newState)
Sets the selected state defined by the second argument for all Nodes contained in the first argument, which should be a Collection of Node objects contained in the referenced GraphPerspective. |
Set |
unselectAllEdges()
Sets the selected state to false for all Edges in the GraphPerspective. |
Set |
unselectAllNodes()
Sets the selected state to false for all Nodes in the GraphPerspective. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SelectFilter(GraphPerspective graph)
NullPointerException
- if the argument is null.Method Detail |
---|
public Set getSelectedNodes()
WARNING: the returned set is the actual data object, not a copy. Don't directly modify this set.
public Set getSelectedEdges()
WARNING: the returned set is the actual data object, not a copy. Don't directly modify this set.
public boolean isSelected(Node node)
public boolean isSelected(Edge edge)
public boolean passesFilter(Object o)
passesFilter
in interface Filter
public boolean setSelected(Node node, boolean newState)
public boolean setSelected(Edge edge, boolean newState)
public Set<Node> setSelectedNodes(Collection<Node> nodesToSet, boolean newState)
ClassCastException
- if the first argument contains objects other than
giny.model.Node objectspublic Set<Edge> setSelectedEdges(Collection<Edge> edgesToSet, boolean newState)
ClassCastException
- if the first argument contains objects other than
giny.model.Edge objectspublic Set selectAllNodes()
public Set selectAllEdges()
public Set unselectAllNodes()
public Set unselectAllEdges()
public void graphPerspectiveChanged(GraphPerspectiveChangeEvent event)
graphPerspectiveChanged
in interface GraphPerspectiveChangeListener
public void addSelectEventListener(SelectEventListener listener)
public void removeSelectEventListener(SelectEventListener listener)
public List getSelectEventListeners()
|
www.cytoscape.org | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |