Class 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
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • 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 interface NodeRenderer
        Parameters:
        node - The node to render.
        Returns:
        The persistent object that is drawn on the screen.