Package diva.graph.toolbox
Class TypedNodeRenderer
- java.lang.Object
-
- diva.graph.toolbox.TypedNodeRenderer
-
- All Implemented Interfaces:
NodeRenderer
public class TypedNodeRenderer extends java.lang.Object implements NodeRenderer
A NodeRenderer implementation which allows a user to add different specialized node renderers which are called selectively, based on the type of the user object that is contained in the node that is being rendered.- Version:
- $Id$
- Author:
- Michael Shilman
- Pt.AcceptedRating:
- Red
-
-
Constructor Summary
Constructors Constructor Description TypedNodeRenderer(GraphController controller, NodeRenderer defaultRenderer)
A typed node renderer with the given node renderer as its default (i.e.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTypedRenderer(java.lang.Class c, NodeRenderer r)
Add a renderer which is invoked when the rendered node's semantic object is an instance of the given class.void
removeTypedRenderer(java.lang.Class c)
Remove a typed renderer.Figure
render(java.lang.Object node)
Return the rendered visual representation of this node by looking up the class of its semantic object.
-
-
-
Constructor Detail
-
TypedNodeRenderer
public TypedNodeRenderer(GraphController controller, NodeRenderer defaultRenderer)
A typed node renderer with the given node renderer as its default (i.e. how to render a node if it has a type that is not understood by this renderer).
-
-
Method Detail
-
addTypedRenderer
public void addTypedRenderer(java.lang.Class c, NodeRenderer r)
Add a renderer which is invoked when the rendered node's semantic object is an instance of the given class.
-
removeTypedRenderer
public void removeTypedRenderer(java.lang.Class c)
Remove a typed renderer.- See Also:
addTypedRenderer(Class,NodeRenderer)
-
render
public Figure render(java.lang.Object node)
Return the rendered visual representation of this node by looking up the class of its semantic object.- Specified by:
render
in interfaceNodeRenderer
- Parameters:
node
- The node to render.- Returns:
- The persistent object that is drawn on the screen.
-
-