Search this API

y.view
Class LocalViewCreator

java.lang.Object
  extended by y.view.LocalViewCreator
Direct Known Subclasses:
LocalViewCreator.AbstractLocalViewCreator

public abstract class LocalViewCreator
extends java.lang.Object

Abstract base class for all local view creator implementations that both defines the contract for such classes as well as provides convenience implementation for laying out and publishing newly created local views. In this context, a local view describes a graph structure that is created from information provided in a model graph according to a arbitrary but specific criteria such as contents of folder nodes or neighborhood of selected nodes.

 

Nested Class Summary
static class LocalViewCreator.AbstractLocalViewCreator
          Abstract base class for local view creator implementations that create local views based upon a subset of either nodes or edges of the model graph.
static class LocalViewCreator.AncestorGroups
          Local view creator that creates local views that display all ancestor group nodes of the creator's focus nodes.
static class LocalViewCreator.CommonParentGroup
          Local view creator that creates local views that display all nodes that share the same parent group node as at least one of the creator's focus nodes and all edges that connect any two of the displayed nodes.
static class LocalViewCreator.EdgeGroup
          Local view creator that tries to identify groups of edges according to shared source and/or target nodes or using ids provided that are bound to the model graph.
static class LocalViewCreator.FolderContents
          Local view creator that creates local views that display the content of all folder nodes in the creator's collection of focus nodes.
static class LocalViewCreator.Neighborhood
          Local view creator that creates local views based upon the neighborhood of its focused nodes.
static class LocalViewCreator.SourceAndTarget
          Local view creator that creates local views by simply displaying its collection of focused edges (and their target and source nodes).
 
Constructor Summary
protected LocalViewCreator()
           
 
Method Summary
protected abstract  void buildViewGraph()
          Creates graph elements in the creator's view graph.
protected  Layouter createDefaultLayouter()
          Creates a preconfigured instance of a layout algorithm that is used by default to lay out the contents of a newly created local view.
 Layouter getLayouter()
          Returns the layout algorithm used to lay out the contents of a newly created local view or null if the contents of said view should not be laid out at all.
abstract  Graph2D getModel()
          Returns the model graph for which the creator may create local views.
abstract  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.
abstract  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.
abstract  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.
abstract  Graph2D getViewGraph()
          Returns the view graph that is modified by the creator's updateViewGraph method.
abstract  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.
protected  void layoutViewGraph()
          Lays out the contents of the creator's view graph using the layout algorithm returned by getLayouter() which is additionally wrapped using MinNodeSizeStage.
protected  void publishViewGraph()
          Notifies all View implementations registered for the creator's view graph that the graph may have changed (due to updateViewGraph).
 void setLayouter(Layouter layouter)
          Specifies the layout algorithm to lay out the contents of a newly created local view.
 void updateViewGraph()
          Creates the local view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalViewCreator

protected LocalViewCreator()
Method Detail

getLayouter

public Layouter getLayouter()
Returns the layout algorithm used to lay out the contents of a newly created local view or null if the contents of said view should not be laid out at all.

Returns:
the layout algorithm used to lay out the contents of a newly created local view or null if the contents of said view should not be laid out at all.
See Also:
setLayouter(y.layout.Layouter)

setLayouter

public void setLayouter(Layouter layouter)
Specifies the layout algorithm to lay out the contents of a newly created local view.

Parameters:
layouter - the layout algorithm to lay out the contents of a newly created local view or null if the contents of said view should not be laid out at all.
See Also:
getLayouter()

createDefaultLayouter

protected Layouter createDefaultLayouter()
Creates a preconfigured instance of a layout algorithm that is used by default to lay out the contents of a newly created local view. This method may return null to indicate, that the contents of newly created local views should not be laid out at all. The default implementation creates a new instance of IncrementalHierarchicLayouter that is configured to consider node labels and use integrated edge labeling as well as to route edges in an orthogonal fashion.

Note: This factory method is called from the creator's constructor.

Returns:
a preconfigured instance of a layout algorithm.
See Also:
IncrementalHierarchicLayouter.setConsiderNodeLabelsEnabled(boolean), IncrementalHierarchicLayouter.setIntegratedEdgeLabelingEnabled(boolean), IncrementalHierarchicLayouter.setOrthogonallyRouted(boolean)

updateViewGraph

public void updateViewGraph()
Creates the local view. This method first clears the creator's view graph then calls in order:
  1. buildViewGraph();
  2. layoutViewGraph();
  3. publishViewGraph();

See Also:
buildViewGraph(), layoutViewGraph(), publishViewGraph()

layoutViewGraph

protected void layoutViewGraph()
Lays out the contents of the creator's view graph using the layout algorithm returned by getLayouter() which is additionally wrapped using MinNodeSizeStage. The default implementation uses Graph2DLayoutExecutor with port intersection calculation enabled to execute the aforementioned layout algorithm.

See Also:
updateViewGraph()

publishViewGraph

protected void publishViewGraph()
Notifies all View implementations registered for the creator's view graph that the graph may have changed (due to updateViewGraph). The default implementation calls updateView for each registered view. If a registered view is of type Graph2DView, fitContent is called right before updateView.

See Also:
updateViewGraph(), View.updateView(), Graph2DView.fitContent()

getModel

public abstract Graph2D getModel()
Returns the model graph for which the creator may create local views.

Returns:
the model graph for which the creator may create local views.

getViewGraph

public abstract Graph2D getViewGraph()
Returns the view graph that is modified by the creator's updateViewGraph method.

Returns:
the view graph that is modified by the creator's updateViewGraph method.
See Also:
updateViewGraph()

buildViewGraph

protected abstract void buildViewGraph()
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.

See Also:
updateViewGraph()

getModelNode

public abstract 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.

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 abstract 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.

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 abstract 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.

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 abstract 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.

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-2022,
yWorks GmbH.
All rights reserved.