y.view
Class LayoutMorpher

java.lang.Object
  |
  +--y.anim.AnimationCommand
        |
        +--y.view.LayoutMorpher
All Implemented Interfaces:
AnimationObject, Command

public class LayoutMorpher
extends AnimationCommand

Command that applies a suitable GraphLayoutInfo object to a Graph2D in an animated fashion. Since an animation needs a view to display it's effects, the target graph of the animation will be the one associated with a given Graph2DView.

To start the animated layout morphing use the method AnimationCommand.execute() or pass it to an AnimationPlayer object.


Field Summary
 
Fields inherited from class y.anim.AnimationCommand
animationLength, preferredDuration
 
Constructor Summary
LayoutMorpher(Graph2DView view, GraphLayout gli)
          Creates a new LayoutMorpher that applies the given GraphLayout to the graph that resides in the given view.
 
Method Summary
protected static void assignLayout(Graph2D targetGraph, GraphLayout sourceGraph)
           
 void calcNextFrame(int cursor, int delta)
          Calculates the next animation frame.
 void disposeAnimation()
          Disposes the animation.
 void initAnimation()
          Initializes the animation.
 void redo()
          Not implemented.
 void setFocusNode(Node v)
          Sets the node being focused at the end of the animation.
 void setSmoothViewTransform(boolean b)
          If set the animation will smoothly transform the view's zoom level and translation.
 void undo()
          Not implemented.
 
Methods inherited from class y.anim.AnimationCommand
emit, execute, getAnimationLength, getAnimationListener, getPreferredDuration, setAnimationLength, setAnimationListener, setPreferredDuration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutMorpher

public LayoutMorpher(Graph2DView view,
                     GraphLayout gli)
Creates a new LayoutMorpher that applies the given GraphLayout to the graph that resides in the given view.

Precondition:The given GraphLayout be valid for all nodes and edges of the graph that belongs to the given view.

Method Detail

setFocusNode

public void setFocusNode(Node v)
Sets the node being focused at the end of the animation. If the given focus node is unequal to null and part of the associated view's graph then the coordinate system of the view will smoothly translated during the animation to the effect that the focused node will be centered at the end of the animation process. The zoom level ogf the view will remain unchanged if such a focus node is defined. If no focus node is given the the view's will be transformed such that it fits the bounding box of the given graph layout info.


setSmoothViewTransform

public void setSmoothViewTransform(boolean b)
If set the animation will smoothly transform the view's zoom level and translation. By default this feature is disabled.


initAnimation

public void initAnimation()
Initializes the animation. Do not call this method directly. It is used by the animation framework classes.


calcNextFrame

public void calcNextFrame(int cursor,
                          int delta)
Calculates the next animation frame. Do not call this method directly. It is used by the animation framework classes.


disposeAnimation

public void disposeAnimation()
Disposes the animation. Do not call this method directly. It is used by the animation framework classes.


assignLayout

protected static void assignLayout(Graph2D targetGraph,
                                   GraphLayout sourceGraph)

redo

public void redo()
Not implemented.


undo

public void undo()
Not implemented.


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

2003