y25.view.realizer
Class Realizer25DFactory

java.lang.Object
  extended byy25.view.realizer.Realizer25DFactory
All Implemented Interfaces:
GraphTools.RealizerFactory

public class Realizer25DFactory
extends Object
implements GraphTools.RealizerFactory

Copies node and edge realizers and adds the "25D" extension, if necessarry.

It is important that all node and edge realizers that are stored inside the Graph2Ds of a Graph25D extend the Node/EdgeRealizer classes as defined in the y.view package and implement the Node/EdgeRealizer25D interfaces defined in the y25.view package. This necessary in order to be able to both display the Graph2Ds inside a GraphView and inside a Graph25DView - the Node/EdgeRealizer provides the 2D drawing mechanisms and the Node/EdgeRealizer25D provides the OpenGl drawing mechanisms. A realizer that also implements the "25D" interface is said to have the "25D" extension.

When copying realizers, this class provides a convenient way to ensure that the result of the copy process is always a realizer with the "25D" extension, regardless of whether or not the original realizer had this extension or not. This is very useful when importing Graph2Ds into a Graph25D for instance.

To use this class you have to create an instance of it by passing it default node and edge realizers that have the "25D" extension. If a node or edge realizer has to be copied, copyNodeRealizer(y.view.NodeRealizer) and copyEdgeRealizer(y.view.EdgeRealizer) have to be called. Those methods first check if the passed realizer already has the 25D extension. If so, it is just copied and returned. If this is not the case, those methods check if there is a known 25D version of the passed realizer. If this is the case, an instance will be created and as much information as possible will be copied from the passed realizer. Finally, if no 25D version of the passed realizer is found, a copy of the default realizer that was spacified when creating the factory will be returned.

Note that as more and more realizers from the y.view package get a y25.view.realizer counterpart, this class should be extended to include those "25D"-realizers when searching for a match of the passed realizers.


Constructor Summary
Realizer25DFactory(NodeRealizer defNR, EdgeRealizer defER)
          Creates a new Realizer25DFactory with the passsed realizers as the default node and edge realizers.
 
Method Summary
 EdgeRealizer copyEdgeRealizer(EdgeRealizer er)
          Creates a "25D" version of the passed edge realizer as outlined in the class description above.
 NodeRealizer copyNodeRealizer(NodeRealizer nr)
          Creates a "25D" version of the passed node realizer as outlined in the class description above.
 EdgeRealizer createDefaultEdgeRealizer()
          Returns a copy of the default edge realizer of this factory.
 NodeRealizer createDefaultNodeRealizer()
          Returns a copy of the default node realizer of this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Realizer25DFactory

public Realizer25DFactory(NodeRealizer defNR,
                          EdgeRealizer defER)
Creates a new Realizer25DFactory with the passsed realizers as the default node and edge realizers. Note that the passed realizers have to implement the "25D" extension.

Method Detail

createDefaultNodeRealizer

public NodeRealizer createDefaultNodeRealizer()
Returns a copy of the default node realizer of this factory.

Specified by:
createDefaultNodeRealizer in interface GraphTools.RealizerFactory

createDefaultEdgeRealizer

public EdgeRealizer createDefaultEdgeRealizer()
Returns a copy of the default edge realizer of this factory.

Specified by:
createDefaultEdgeRealizer in interface GraphTools.RealizerFactory

copyNodeRealizer

public NodeRealizer copyNodeRealizer(NodeRealizer nr)
Creates a "25D" version of the passed node realizer as outlined in the class description above.

Specified by:
copyNodeRealizer in interface GraphTools.RealizerFactory

copyEdgeRealizer

public EdgeRealizer copyEdgeRealizer(EdgeRealizer er)
Creates a "25D" version of the passed edge realizer as outlined in the class description above.

Specified by:
copyEdgeRealizer in interface GraphTools.RealizerFactory