Search this API

y.view
Class Selections

java.lang.Object
  extended by y.view.Selections

public abstract class Selections
extends java.lang.Object

This utility class provides static methods, that perform several different actions and create objects that can be used in conjunction with selections on a Graph2D.

 

Nested Class Summary
static class Selections.SelectionStateObserver
          Base class that can be subclassed to receive notification about changes in the selection state of a Graph2D.
 
Method Summary
static DataProvider createSelectionDataProvider(Graph2D graph)
          Creates a DataProvider, that can be used to query the selection state of graph elements in the given graph.
static EdgeMap createSelectionEdgeMap(Graph2D graph)
          Creates an EdgeMap view of the selection state of the edges in the given graph.
static NodeMap createSelectionNodeMap(Graph2D graph)
          Creates a NodeMap view of the selection state of the nodes in the given graph.
static void deselectNodeAndSelfLoopBends(Graph2D graph, Node v)
          Deselects a node and the bends of its self-loop.
static void findExtendedGroupingSelection(Graph2D graph, NodeList childNodes, NodeList parentNodes, BendList additionalBends)
          Collects additional elements within a grouped graph that depend on the current node selection.
static boolean isEdgeSelectionEmpty(Graph2D graph)
          Queries the given graph if it contains any selected edges.
static boolean isNodeSelectionEmpty(Graph2D graph)
          Queries the given graph if it contains any selected nodes.
static boolean isSelected(Graph2D graph, java.lang.Object selectableGraphElement)
          Returns true, if the selectable graph element (node, edge, bend, label, node port) is actually selected.
static void selectNodeAndSelfLoopBends(Graph2D graph, Node v)
          Selects a node and the bends of its self-loop.
static void selectNodesAndSelfLoopBends(Graph2D graph)
          Selects all nodes and the bends of self-loops.
static void setSelected(Graph2D graph, java.lang.Object selectableGraphElement, boolean flag)
          Sets the selection state of the selectable graph element (node, edge, bend, label, node port) to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSelected

public static boolean isSelected(Graph2D graph,
                                 java.lang.Object selectableGraphElement)
Returns true, if the selectable graph element (node, edge, bend, label, node port) is actually selected.

Parameters:
graph - the graph the element belongs to
selectableGraphElement - a selectable graph element (node, edge, bend, label, node port)
Returns:
true, if element is selected

setSelected

public static void setSelected(Graph2D graph,
                               java.lang.Object selectableGraphElement,
                               boolean flag)
Sets the selection state of the selectable graph element (node, edge, bend, label, node port) to the specified value.

Parameters:
graph - the graph the element belongs to
selectableGraphElement - a selectable graph element (node, edge, bend, label, node port)
flag - the new selection state

selectNodesAndSelfLoopBends

public static void selectNodesAndSelfLoopBends(Graph2D graph)
Selects all nodes and the bends of self-loops.

Parameters:
graph - the graph

selectNodeAndSelfLoopBends

public static void selectNodeAndSelfLoopBends(Graph2D graph,
                                              Node v)
Selects a node and the bends of its self-loop.

Parameters:
graph - the graph
v - the vertex

deselectNodeAndSelfLoopBends

public static void deselectNodeAndSelfLoopBends(Graph2D graph,
                                                Node v)
Deselects a node and the bends of its self-loop.

Parameters:
graph - the graph
v - the node

createSelectionDataProvider

public static DataProvider createSelectionDataProvider(Graph2D graph)
Creates a DataProvider, that can be used to query the selection state of graph elements in the given graph.

Parameters:
graph - the graph
Returns:
a data provider, which can be queried for boolean values

createSelectionNodeMap

public static NodeMap createSelectionNodeMap(Graph2D graph)
Creates a NodeMap view of the selection state of the nodes in the given graph. The map can be used to read and write boolean values for each node in the graph in order to query and modify the selection state.

Parameters:
graph - the graph
Returns:
the map

createSelectionEdgeMap

public static EdgeMap createSelectionEdgeMap(Graph2D graph)
Creates an EdgeMap view of the selection state of the edges in the given graph. The map can be used to read and write boolean values for each edge in the graph in order to query and modify the selection state.

Parameters:
graph - the graph
Returns:
the map

findExtendedGroupingSelection

public static void findExtendedGroupingSelection(Graph2D graph,
                                                 NodeList childNodes,
                                                 NodeList parentNodes,
                                                 BendList additionalBends)
Collects additional elements within a grouped graph that depend on the current node selection.

Parameters:
childNodes - return value. Collects all unselected nodes whose ancestor nodes are already selected.
parentNodes - return value. Collects all parent group nodes within the same graph that have selected children.
additionalBends - return value. Collects all unselected bends that belong to edges connecting the nodes collected in the list childNodes.

isNodeSelectionEmpty

public static boolean isNodeSelectionEmpty(Graph2D graph)
Queries the given graph if it contains any selected nodes.


isEdgeSelectionEmpty

public static boolean isEdgeSelectionEmpty(Graph2D graph)
Queries the given graph if it contains any selected edges.


© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.