y.view.hierarchy
Class DefaultHierarchyGraphFactory

java.lang.Object
  |
  +--y.view.DefaultGraph2DFactory
        |
        +--y.view.hierarchy.DefaultHierarchyGraphFactory
All Implemented Interfaces:
GraphFactory

public class DefaultHierarchyGraphFactory
extends DefaultGraph2DFactory

This is the default graph factory used by HierarchyManager to create and configure new graph elements within the hierarchy.

The graph factory creates graphs of type Graph2D and corresponding graph elements. Whenever a new Graph is created by this factory, it will inherit all Graph-, Graph2D- and Graph2DSelectionListeners available in the parent graph.

This graph will also create and configure folder nodes and group nodes.


Constructor Summary
DefaultHierarchyGraphFactory()
          Create a new instance of DefaultHierarchyGraphFactory.
 
Method Summary
protected  void configureGraph(Graph2D createdGraph, Object hint)
          Adds all graph-, graph2d- and graph2dselectionlisteners found in the parent graph to the newly created graph.
 Graph createGraph(Object hint)
          Creates a new Graph2D that inherits all listeners from the parent graph
 Node createNode(Graph graph, Object hint)
          Creates a new node in the given graph.
 NodeRealizer createNodeRealizer(Object hint)
          Creates a realizer for a node.
 NodeRealizer getDefaultFolderNodeRealizer()
          Returns the default node realizer for folder nodes.
 NodeRealizer getDefaultGroupNodeRealizer()
          Returns the default node realizer for group nodes.
 boolean isProxyNodeRealizerEnabled()
          Returns whether or not to use a proxy node realizer that delegates to the default realizers for group or folder nodes.
 void setDefaultFolderNodeRealizer(NodeRealizer r)
          Sets the default node realizer for folder nodes.
 void setDefaultGroupNodeRealizer(NodeRealizer r)
          Sets the default node realizer for group nodes.
 void setProxyNodeRealizerEnabled(boolean proxyNodeRealizerEnabled)
          Whether or not this class should assign a proxy node realizer to all group and folder nodes.
 
Methods inherited from class y.view.DefaultGraph2DFactory
createEdge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultHierarchyGraphFactory

public DefaultHierarchyGraphFactory()
Create a new instance of DefaultHierarchyGraphFactory.

Method Detail

createGraph

public Graph createGraph(Object hint)
Creates a new Graph2D that inherits all listeners from the parent graph

Specified by:
createGraph in interface GraphFactory
Overrides:
createGraph in class DefaultGraph2DFactory
Parameters:
hint - expects hint to be the parent graph of the newly created graph.

configureGraph

protected void configureGraph(Graph2D createdGraph,
                              Object hint)
Adds all graph-, graph2d- and graph2dselectionlisteners found in the parent graph to the newly created graph.


createNode

public Node createNode(Graph graph,
                       Object hint)
Creates a new node in the given graph. If the hint is of type Graph2D then the newly created node is considered to be a folder node within the hierarchy. Otherwise it is considered to be a group node. A preconfigured GroupNodeRealizer will be assigned to such the newly created node.

Specified by:
createNode in interface GraphFactory
Overrides:
createNode in class DefaultGraph2DFactory
Parameters:
graph - the graph containing the newly created node.
hint - the hint object will be ignored.
Returns:
a newly created node
See Also:
DefaultHierarchyGraphFactory.createNodeRealizer(Object)

createNodeRealizer

public NodeRealizer createNodeRealizer(Object hint)
Creates a realizer for a node. By default a realizer of type GroupNodeRealizer will be returned.

See Also:
DefaultHierarchyGraphFactory.createNode(Graph, Object).

setDefaultGroupNodeRealizer

public void setDefaultGroupNodeRealizer(NodeRealizer r)
Sets the default node realizer for group nodes. A copy of this realizer will be bound to a newly created group node.


setDefaultFolderNodeRealizer

public void setDefaultFolderNodeRealizer(NodeRealizer r)
Sets the default node realizer for folder nodes. A copy of this realizer will be bound to a newly created folder node.


getDefaultGroupNodeRealizer

public NodeRealizer getDefaultGroupNodeRealizer()
Returns the default node realizer for group nodes.


getDefaultFolderNodeRealizer

public NodeRealizer getDefaultFolderNodeRealizer()
Returns the default node realizer for folder nodes.


setProxyNodeRealizerEnabled

public void setProxyNodeRealizerEnabled(boolean proxyNodeRealizerEnabled)
Whether or not this class should assign a proxy node realizer to all group and folder nodes. Both the default realizer for group nodes and for folder nodes will be added to the list of maintained realizers of this proxy node. Initially, the proxy node realizer will redirect its calls to the corresponding realizer. The realizer for group nodes can be found at position 0 of the realizer list. The realizer for folder nodes can be found at position 1 of this list.

The main purpose of using a proxy node realizer is to be able to use completely different realizers to represent open and closed group nodes.

By default this feature is deactivated.

See Also:
ProxyShapeNodeRealizer, ProxyShapeNodeRealizer.getRealizer(int), ProxyShapeNodeRealizer.setRealizerDelegate(NodeRealizer)

isProxyNodeRealizerEnabled

public boolean isProxyNodeRealizerEnabled()
Returns whether or not to use a proxy node realizer that delegates to the default realizers for group or folder nodes.

See Also:
DefaultHierarchyGraphFactory.setProxyNodeRealizerEnabled(boolean)

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

2003