com.mxgraph.swing.util

## Class mxMorphing

- java.lang.Object
- - com.mxgraph.util.mxEventSource
  - - com.mxgraph.swing.util.mxAnimation
    - - com.mxgraph.swing.util.mxMorphing

-     public class mxMorphing
      extends mxAnimation

  Provides animation effects.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.mxgraph.util.mxEventSource

      `mxEventSource.mxIEventListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Object[]` | `cells` Optional array of cells to limit the animation to.
    `protected mxRectangle` | `dirty`
    `protected double` | `ease` Ease-off for movement towards the given vector.
    `protected mxGraphComponent` | `graphComponent` Reference to the enclosing graph instance.
    `protected java.util.Map<java.lang.Object,mxPoint>` | `origins` Maps from cells to origins.
    `protected mxCellStatePreview` | `preview`
    `protected int` | `step` Counts the current number of steps of the animation.
    `protected int` | `steps` Specifies the maximum number of steps for the morphing.

    - ### Fields inherited from class com.mxgraph.swing.util.mxAnimation

      `DEFAULT_DELAY, delay, timer`

    - ### Fields inherited from class com.mxgraph.util.mxEventSource

      `eventListeners, eventsEnabled, eventSource`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `mxMorphing(mxGraphComponent graphComponent)` Constructs a new morphing instance for the given graph.
    `mxMorphing(mxGraphComponent graphComponent, int steps, double ease, int delay)` Constructs a new morphing instance for the given graph.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `animateCell(java.lang.Object cell, mxCellStatePreview move, boolean recurse)` Animates the given cell state using moveState.
    `protected mxPoint` | `getDelta(mxCellState state)` Returns the vector between the current rendered state and the future location of the state after the display will be updated.
    `double` | `getEase()` Returns the easing for the movements.
    `protected mxPoint` | `getOriginForCell(java.lang.Object cell)` Returns the top, left corner of the given cell.
    `int` | `getSteps()` Returns the number of steps for the animation.
    `void` | `paint(java.awt.Graphics g)`
    `void` | `setCells(java.lang.Object[] value)` Optional array of cells to be animated.
    `void` | `setEase(double value)` Sets the easing for the movements.
    `void` | `setSteps(int value)` Sets the number of steps for the animation.
    `protected void` | `show(mxCellStatePreview preview)` Shows the changes in the given mxCellStatePreview.
    `void` | `stopAnimation()` Stops the animation by deleting the timer and fires mxEvent.DONE.
    `protected boolean` | `stopRecursion(mxCellState state, mxPoint delta)` Returns true if the animation should not recursively find more deltas for children if the given parent state has been animated.
    `void` | `updateAnimation()` Animation step.

    - ### Methods inherited from class com.mxgraph.swing.util.mxAnimation

      `getDelay, isRunning, setDelay, startAnimation`

    - ### Methods inherited from class com.mxgraph.util.mxEventSource

      `addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### graphComponent

          protected mxGraphComponent graphComponent

      Reference to the enclosing graph instance.

    - #### steps

          protected int steps

      Specifies the maximum number of steps for the morphing. Default is 6.

    - #### step

          protected int step

      Counts the current number of steps of the animation.

    - #### ease

          protected double ease

      Ease-off for movement towards the given vector. Larger values are slower and smoother. Default is 1.5.

    - #### origins

          protected java.util.Map<java.lang.Object,mxPoint> origins

      Maps from cells to origins.

    - #### cells

          protected java.lang.Object[] cells

      Optional array of cells to limit the animation to.

    - #### dirty

          protected transient mxRectangle dirty

    - #### preview

          protected transient mxCellStatePreview preview

  - ### Constructor Detail

    - #### mxMorphing

          public mxMorphing(mxGraphComponent graphComponent)

      Constructs a new morphing instance for the given graph.

    - #### mxMorphing

          public mxMorphing(mxGraphComponent graphComponent,
                    int steps,
                    double ease,
                    int delay)

      Constructs a new morphing instance for the given graph.

  - ### Method Detail

    - #### getSteps

          public int getSteps()

      Returns the number of steps for the animation.

    - #### setSteps

          public void setSteps(int value)

      Sets the number of steps for the animation.

    - #### getEase

          public double getEase()

      Returns the easing for the movements.

    - #### setEase

          public void setEase(double value)

      Sets the easing for the movements.

    - #### setCells

          public void setCells(java.lang.Object[] value)

      Optional array of cells to be animated. If this is not specified then all cells are checked and animated if they have been moved in the current transaction.

    - #### updateAnimation

          public void updateAnimation()

      Animation step.
      Overrides:
        `updateAnimation` in class `mxAnimation`

    - #### stopAnimation

          public void stopAnimation()

      Description copied from class: `mxAnimation`
      Stops the animation by deleting the timer and fires mxEvent.DONE.
      Overrides:
        `stopAnimation` in class `mxAnimation`

    - #### show

          protected void show(mxCellStatePreview preview)

      Shows the changes in the given mxCellStatePreview.

    - #### animateCell

          protected void animateCell(java.lang.Object cell,
                         mxCellStatePreview move,
                         boolean recurse)

      Animates the given cell state using moveState.

    - #### stopRecursion

          protected boolean stopRecursion(mxCellState state,
                              mxPoint delta)

      Returns true if the animation should not recursively find more deltas for children if the given parent state has been animated.

    - #### getDelta

          protected mxPoint getDelta(mxCellState state)

      Returns the vector between the current rendered state and the future location of the state after the display will be updated.

    - #### getOriginForCell

          protected mxPoint getOriginForCell(java.lang.Object cell)

      Returns the top, left corner of the given cell.

    - #### paint

          public void paint(java.awt.Graphics g)

Copyright (c) 2010 Gaudenz Alder. All rights reserved.