Search this API

y.view
Class LocalViewCreator.Neighborhood

java.lang.Object
  extended by y.view.LocalViewCreator
      extended by y.view.LocalViewCreator.AbstractLocalViewCreator
          extended by y.view.LocalViewCreator.Neighborhood
Enclosing class:
LocalViewCreator

public static class LocalViewCreator.Neighborhood
extends LocalViewCreator.AbstractLocalViewCreator

Local view creator that creates local views based upon the neighborhood of its focused nodes. More technically, this class uses directed and undirected breadth first search to determine the neighborhood of its focus nodes.

 

Nested Class Summary
 
Nested classes/interfaces inherited from class y.view.LocalViewCreator
LocalViewCreator.AbstractLocalViewCreator, LocalViewCreator.AncestorGroups, LocalViewCreator.CommonParentGroup, LocalViewCreator.EdgeGroup, LocalViewCreator.FolderContents, LocalViewCreator.Neighborhood, LocalViewCreator.SourceAndTarget
 
Field Summary
static byte EDGE_POLICY_INDUCED_SUBGRAPH
          Policy specifier that determines that all edges that connect any two nodes in the calculated neighborhood set should be included in the neighborhood view.
static byte EDGE_POLICY_NONE
          Policy specifier that determines that no edges at all should be included in neighborhood views.
static byte EDGE_POLICY_SHORTEST_PATHS
          Policy specifier that determines that only edges that lie on the shortest path from a focus node to a node in its neighborhood (that is not a focus node) should be included in the neighborhood view.
static int FOCUSED_FOLDERS_DEFAULT
          Policy specifier that determines that in a hierarchy aware context interedges of focused folders are handled like all other edges.
static int FOCUSED_FOLDERS_KEEP_INTEREDGES
          Policy specifier that determines that in a hierarchy aware context interedges of focused folders are handled like they were directly connected to the folder.
static byte NEIGHBORHOOD_TYPE_NEIGHBORS
          Type specifier for neighborhood nodes that are reachable by ignoring edge direction.
static byte NEIGHBORHOOD_TYPE_PREDECESSORS
          Type specifier for neighborhood nodes that are reachable by traversing edges from target to source only.
static byte NEIGHBORHOOD_TYPE_PREDECESSORS_AND_SUCCESSORS
          Type specifier which determines that neighborhood nodes are the union of the neighborhoods defined by NEIGHBORHOOD_TYPE_PREDECESSORS and NEIGHBORHOOD_TYPE_SUCCESSORS.
static byte NEIGHBORHOOD_TYPE_SUCCESSORS
          Type specifier for neighborhood nodes that are reachable by traversing edges from source to target only.
 
Fields inherited from class y.view.LocalViewCreator.AbstractLocalViewCreator
ELEMENT_TYPE_EDGE, ELEMENT_TYPE_NODE
 
Constructor Summary
LocalViewCreator.Neighborhood(Graph2D model)
          Creates a new Neighborhood instance for the specified model graph.
LocalViewCreator.Neighborhood(Graph2D model, GraphCopier.CopyFactory factory)
          Creates a new Neighborhood instance for the specified model graph and copy factory.
LocalViewCreator.Neighborhood(Graph2D model, GraphCopier.CopyFactory factory, Graph2D view)
          Creates a new Neighborhood instance for the specified model graph, copy factory, and view graph.
 
Method Summary
protected  void buildViewGraph()
          Creates graph elements in the creator's view graph.
protected  NodeRealizer createViewRealizer(Node model, Node view)
          Creates and/or configures the realizer to display group nodes in the view graph whose corresponding model nodes are folder nodes.
 byte getEdgePolicy()
          Returns the policy specifier that determines which edges should be included in the local view.
 int getFocusedFolderPolicy()
          Determines how to handle interedges at focused folders.
 int getMaximumGraphDistance()
          Returns the maximum number of edges to be traversed to collect a node in the neighborhood of the focus nodes.
 Graph2D getModel()
          Returns the model graph for which the creator may create local views.
 Edge getModelEdge(Edge view)
          Returns a edge in the creator's model graph that corresponds to the specified edge in the creator's view graph or null if there is no corresponding edge.
 Node getModelNode(Node view)
          Returns a node in the creator's model graph that corresponds to the specified node in the creator's view graph or null if there is no corresponding node.
 byte getNeighborhoodType()
          Returns the node type for the nodes included in the neighborhood set.
 Edge getViewEdge(Edge model)
          Returns a edge in the creator's view graph that corresponds to the specified edge in the creator's model graph or null if there is no corresponding edge.
 Graph2D getViewGraph()
          Returns the view graph that is modified by the creator's updateViewGraph method.
 Node getViewNode(Node model)
          Returns a node in the creator's view graph that corresponds to the specified node in the creator's model graph or null if there is no corresponding node.
 boolean isHierarchyAware()
          Determines whether the local view displays the real end nodes of all displayed edges and adds all ancestors of the displayed nodes.
 void setEdgePolicy(byte policy)
          Specifies the policy specifier that determines which edges should be included in the local view.
 void setFocusedFolderPolicy(int policy)
          Specifies how to handle interedges at focused folders.
 void setHierarchyAware(boolean enabled)
          Specifies whether the local view displays the real end nodes of all displayed edges and adds all ancestors of the displayed nodes.
 void setMaximumGraphDistance(int maximumGraphDistance)
          Specifies the maximum number of edges to be traversed to collect a node in the neighborhood of the focus nodes.
 void setNeighborhoodType(byte neighborhoodType)
          Specifies the node type for the nodes included in the neighborhood set.
 
Methods inherited from class y.view.LocalViewCreator.AbstractLocalViewCreator
addFocusEdge, addFocusNode, addSelectionTrigger, clearFocusEdges, clearFocusNodes, createHoverTrigger, createSelectionTrigger, focusEdges, focusNodes, getElementType, getTriggerDelay, isFocusEdge, isFocusNode, isSingleFocus, removeFocusEdge, removeFocusNode, removeSelectionTrigger, setSingleFocus, setTriggerDelay
 
Methods inherited from class y.view.LocalViewCreator
createDefaultLayouter, getLayouter, layoutViewGraph, publishViewGraph, setLayouter, updateViewGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEIGHBORHOOD_TYPE_PREDECESSORS

public static final byte NEIGHBORHOOD_TYPE_PREDECESSORS
Type specifier for neighborhood nodes that are reachable by traversing edges from target to source only.

See Also:
getNeighborhoodType(), setNeighborhoodType(byte), Constant Field Values

NEIGHBORHOOD_TYPE_SUCCESSORS

public static final byte NEIGHBORHOOD_TYPE_SUCCESSORS
Type specifier for neighborhood nodes that are reachable by traversing edges from source to target only.

See Also:
getNeighborhoodType(), setNeighborhoodType(byte), Constant Field Values

NEIGHBORHOOD_TYPE_PREDECESSORS_AND_SUCCESSORS

public static final byte NEIGHBORHOOD_TYPE_PREDECESSORS_AND_SUCCESSORS
Type specifier which determines that neighborhood nodes are the union of the neighborhoods defined by NEIGHBORHOOD_TYPE_PREDECESSORS and NEIGHBORHOOD_TYPE_SUCCESSORS.

See Also:
getNeighborhoodType(), setNeighborhoodType(byte), Constant Field Values

NEIGHBORHOOD_TYPE_NEIGHBORS

public static final byte NEIGHBORHOOD_TYPE_NEIGHBORS
Type specifier for neighborhood nodes that are reachable by ignoring edge direction.

See Also:
getNeighborhoodType(), setNeighborhoodType(byte), Constant Field Values

EDGE_POLICY_NONE

public static final byte EDGE_POLICY_NONE
Policy specifier that determines that no edges at all should be included in neighborhood views.

See Also:
getEdgePolicy(), setEdgePolicy(byte), Constant Field Values

EDGE_POLICY_INDUCED_SUBGRAPH

public static final byte EDGE_POLICY_INDUCED_SUBGRAPH
Policy specifier that determines that all edges that connect any two nodes in the calculated neighborhood set should be included in the neighborhood view.

See Also:
getEdgePolicy(), setEdgePolicy(byte), Constant Field Values

EDGE_POLICY_SHORTEST_PATHS

public static final byte EDGE_POLICY_SHORTEST_PATHS
Policy specifier that determines that only edges that lie on the shortest path from a focus node to a node in its neighborhood (that is not a focus node) should be included in the neighborhood view.

See Also:
getEdgePolicy(), setEdgePolicy(byte), Constant Field Values

FOCUSED_FOLDERS_DEFAULT

public static final int FOCUSED_FOLDERS_DEFAULT
Policy specifier that determines that in a hierarchy aware context interedges of focused folders are handled like all other edges. If they are not connected to a focus node or its predecessors/successors, they will not appear in the local view because the focused folder node is not one of their real end nodes. So the folder may appear to have fewer neighbors in the local view than in the original graph.

See Also:
setFocusedFolderPolicy(int), getFocusedFolderPolicy(), HierarchyManager.getRealSource(y.base.Edge), HierarchyManager.getRealTarget(y.base.Edge), Constant Field Values

FOCUSED_FOLDERS_KEEP_INTEREDGES

public static final int FOCUSED_FOLDERS_KEEP_INTEREDGES
Policy specifier that determines that in a hierarchy aware context interedges of focused folders are handled like they were directly connected to the folder. So the focused folder has the same number of edges in the local view as in the original graph even if some of the neighbors may be neighbors of nodes in the inner graph.

See Also:
setFocusedFolderPolicy(int), getFocusedFolderPolicy(), HierarchyManager.getRealSource(y.base.Edge), HierarchyManager.getRealTarget(y.base.Edge), Constant Field Values
Constructor Detail

LocalViewCreator.Neighborhood

public LocalViewCreator.Neighborhood(Graph2D model)
Creates a new Neighborhood instance for the specified model graph. Invoking this constructor is equivalent to:
new Neighborhood(model, model.getGraphCopyFactory(), (Graph2D) model.getGraphCopyFactory().createGraph());

Parameters:
model - the graph for which local views are to be created.

LocalViewCreator.Neighborhood

public LocalViewCreator.Neighborhood(Graph2D model,
                                     GraphCopier.CopyFactory factory)
Creates a new Neighborhood instance for the specified model graph and copy factory. Invoking this constructor is equivalent to:
new Neighborhood(model, factory, (Graph2D) factory.createGraph());

Note: The graph instances created by the specified factory have to be of type Graph2D or subclasses thereof. Moreover, the factory.

Parameters:
model - the graph for which local views are to be created.
factory - that CopyFactory that will be used to create graph elements in the creator's view graph.

LocalViewCreator.Neighborhood

public LocalViewCreator.Neighborhood(Graph2D model,
                                     GraphCopier.CopyFactory factory,
                                     Graph2D view)
Creates a new Neighborhood instance for the specified model graph, copy factory, and view graph.

Note: The specified factory has to be able to create graph elements in the specified view graph.

Parameters:
model - the graph for which local views are to be created.
factory - that CopyFactory that will be used to create graph elements in the creator's view graph.
view - the graph that will be modified by the creator.
Method Detail

getMaximumGraphDistance

public int getMaximumGraphDistance()
Returns the maximum number of edges to be traversed to collect a node in the neighborhood of the focus nodes.

Returns:
the maximum number of edges to be traversed to collect a node in the neighborhood of the focus nodes.
See Also:
getMaximumGraphDistance()

setMaximumGraphDistance

public void setMaximumGraphDistance(int maximumGraphDistance)
Specifies the maximum number of edges to be traversed to collect a node in the neighborhood of the focus nodes. If the specified distance is smaller than 0, 0 is used instead.

Parameters:
maximumGraphDistance - the maximum number of edges to be traversed to collect a node in the neighborhood of the focus nodes.
See Also:
getMaximumGraphDistance()

getNeighborhoodType

public byte getNeighborhoodType()
Returns the node type for the nodes included in the neighborhood set. One of

Defaults to NEIGHBORHOOD_TYPE_PREDECESSORS_AND_SUCCESSORS.

Returns:
the node type for the nodes included in the neighborhood set.
See Also:
setNeighborhoodType(byte)

setNeighborhoodType

public void setNeighborhoodType(byte neighborhoodType)
Specifies the node type for the nodes included in the neighborhood set.

Defaults to NEIGHBORHOOD_TYPE_PREDECESSORS_AND_SUCCESSORS.

Parameters:
neighborhoodType - one of
Throws:
java.lang.IllegalArgumentException - if the specified type is not one of the listed constants.
See Also:
getNeighborhoodType()

getEdgePolicy

public byte getEdgePolicy()
Returns the policy specifier that determines which edges should be included in the local view. One of

Defaults to EDGE_POLICY_SHORTEST_PATHS.

Returns:
the policy specifier that determines which edges should be included in the local view.
See Also:
setEdgePolicy(byte)

setEdgePolicy

public void setEdgePolicy(byte policy)
Specifies the policy specifier that determines which edges should be included in the local view.

Defaults to EDGE_POLICY_SHORTEST_PATHS.

Parameters:
policy - one of
Throws:
java.lang.IllegalArgumentException - if the specified policy is not one of the listed constants.
See Also:
getEdgePolicy()

isHierarchyAware

public boolean isHierarchyAware()
Determines whether the local view displays the real end nodes of all displayed edges and adds all ancestors of the displayed nodes.

By default, this property is set to false.

Returns:
true if the real end nodes of the edges and every node's ancestors should be shown in the created local view and false otherwise.
See Also:
setHierarchyAware(boolean), HierarchyManager.isInterEdge(y.base.Edge)

setHierarchyAware

public void setHierarchyAware(boolean enabled)
Specifies whether the local view displays the real end nodes of all displayed edges and adds all ancestors of the displayed nodes.

By default, this property is set to false.

Parameters:
enabled - true if the real end nodes of the edges and every node's ancestors should be shown in the created local view and false otherwise.
See Also:
isHierarchyAware(), HierarchyManager.isInterEdge(y.base.Edge)

getFocusedFolderPolicy

public int getFocusedFolderPolicy()
Determines how to handle interedges at focused folders.

By default, this property is set to FOCUSED_FOLDERS_DEFAULT.

Returns:
either FOCUSED_FOLDERS_DEFAULT or FOCUSED_FOLDERS_KEEP_INTEREDGES.
See Also:
setFocusedFolderPolicy(int)

setFocusedFolderPolicy

public void setFocusedFolderPolicy(int policy)
Specifies how to handle interedges at focused folders.

By default, this property is set to FOCUSED_FOLDERS_DEFAULT.

Parameters:
policy - either FOCUSED_FOLDERS_DEFAULT or FOCUSED_FOLDERS_KEEP_INTEREDGES.
Throws:
java.lang.IllegalArgumentException - if the specified policy is not one of the listed constants.
See Also:
getFocusedFolderPolicy()

buildViewGraph

protected void buildViewGraph()
Description copied from class: LocalViewCreator
Creates graph elements in the creator's view graph. This method is also responsible for creating mappings between graph elements in the creator's model graph and the creator's view graph.

Specified by:
buildViewGraph in class LocalViewCreator
See Also:
LocalViewCreator.updateViewGraph()

createViewRealizer

protected NodeRealizer createViewRealizer(Node model,
                                          Node view)
Creates and/or configures the realizer to display group nodes in the view graph whose corresponding model nodes are folder nodes.

Parameters:
model - a folder node in creator's model graph.
view - a group node in the creator's view graph that is the representative of the specified model node for which a realizer should be created and/or configured.
Returns:
the view node's adjusted realizer.

getModel

public Graph2D getModel()
Description copied from class: LocalViewCreator
Returns the model graph for which the creator may create local views.

Specified by:
getModel in class LocalViewCreator
Returns:
the model graph for which the creator may create local views.

getViewGraph

public Graph2D getViewGraph()
Description copied from class: LocalViewCreator
Returns the view graph that is modified by the creator's updateViewGraph method.

Specified by:
getViewGraph in class LocalViewCreator
Returns:
the view graph that is modified by the creator's updateViewGraph method.
See Also:
LocalViewCreator.updateViewGraph()

getModelNode

public Node getModelNode(Node view)
Description copied from class: LocalViewCreator
Returns a node in the creator's model graph that corresponds to the specified node in the creator's view graph or null if there is no corresponding node.

Specified by:
getModelNode in class LocalViewCreator
Parameters:
view - a node in the creator's view graph.
Returns:
a node in the creator's model graph that corresponds to the specified node in the creator's view graph or null if there is no corresponding node.

getViewNode

public Node getViewNode(Node model)
Description copied from class: LocalViewCreator
Returns a node in the creator's view graph that corresponds to the specified node in the creator's model graph or null if there is no corresponding node.

Specified by:
getViewNode in class LocalViewCreator
Parameters:
model - a node in the creator's model graph.
Returns:
a node in the creator's view graph that corresponds to the specified node in the creator's model graph or null if there is no corresponding node.

getModelEdge

public Edge getModelEdge(Edge view)
Description copied from class: LocalViewCreator
Returns a edge in the creator's model graph that corresponds to the specified edge in the creator's view graph or null if there is no corresponding edge.

Specified by:
getModelEdge in class LocalViewCreator
Parameters:
view - a edge in the creator's view graph.
Returns:
a edge in the creator's model graph that corresponds to the specified edge in the creator's view graph or null if there is no corresponding edge.

getViewEdge

public Edge getViewEdge(Edge model)
Description copied from class: LocalViewCreator
Returns a edge in the creator's view graph that corresponds to the specified edge in the creator's model graph or null if there is no corresponding edge.

Specified by:
getViewEdge in class LocalViewCreator
Parameters:
model - a edge in the creator's model graph.
Returns:
a edge in the creator's view graph that corresponds to the specified edge in the creator's model graph or null if there is no corresponding edge.

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