com.dlsc.flexgantt.swing.treetable

## Class NodeAnimationController

- java.lang.Object
- - com.dlsc.flexgantt.swing.treetable.NodeAnimationController

-     public class NodeAnimationController
      extends Object

  The node animation controller is used as a central provider of the settings that control the animation of tree node expansion / collapse.

  The default settings are:

  - nodeAnimated = true
  - maximumAnimationDuration = 1000 (milliseconds)
  - minimumAnimationDuration = 500 (milliseconds)
  - shadowVisible = true (drop shadow below the toggled node)
  - animationTimePerRow = 50 (milliseconds)
  - usingTransparency = true
  Since:
    2.0
  Author:
    Dirk Lemmermann
  See Also:
    `TreeTable.setNodeAnimationController(NodeAnimationController)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NodeAnimationController()` Constructs a new controller.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAnimationDuration(int rowCount)` Calculates the animation duration.
    `int` | `getAnimationTimePerRow()` Returns the animation duration in milliseconds per row.
    `int` | `getMaximumAnimationDuration()` Returns the amount of time that the animation may run.
    `int` | `getMinimumAnimationDuration()` Returns the minimum time the animation can run.
    `boolean` | `isNodeAnimated(TreeTableNode node)` Determines if the given node will be toggled with an animation or not.
    `boolean` | `isShadowVisible()` Determines if the controller is configured to show a drop shadow below the toggled tree node.
    `boolean` | `isUsingTransparency()` Determines if the expand / collapse animation will use transparency to make the children nodes that slide in / out fade in / out.
    `void` | `setAnimationTimePerRow(int millis)` Sets the animation duration in milliseconds per row.
    `void` | `setMaximumAnimationDuration(int millis)` Limits the amount of time that the animation may run.
    `void` | `setMinimumAnimationDuration(int millis)` Specifies the minimum time the animation can run.
    `void` | `setNodeAnimated(boolean animate)` Specifies whether the tree table will animate the tree node expansion or not.
    `void` | `setShadowVisible(boolean visible)` Specifies whether a drop shadow will be shown below the expanded / collapsed node.
    `void` | `setUsingTransparency(boolean use)` Specifies whether the expand / collapse animation will use transparency to make the children nodes that slide in / out fade in / out.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### NodeAnimationController

          public NodeAnimationController()

      Constructs a new controller.
      Since:
        2.0

  - ### Method Detail

    - #### setNodeAnimated

          public void setNodeAnimated(boolean animate)

      Specifies whether the tree table will animate the tree node expansion or not. If not then all the other settings of the controller are irrelevant.
      Parameters:
        `animate` - if TRUE then the node will be opened / closed with a little animation
      Since:
        2.0

    - #### isNodeAnimated

          public boolean isNodeAnimated(TreeTableNode node)

      Determines if the given node will be toggled with an animation or not. The default implementation of this method uses the global value set by `setNodeAnimated(boolean)`. This class needs to be subclassed and this method needs to be overriden in order to control the animation for indivudual nodes.
      Parameters:
        `node` - the node to check
      Returns:
        TRUE if an animation shall be shown
      Since:
        2.0

    - #### setShadowVisible

          public void setShadowVisible(boolean visible)

      Specifies whether a drop shadow will be shown below the expanded / collapsed node. Using a shadow increases the "drawer" look of the animation.
      Parameters:
        `visible` - if TRUE a drop shadow will be shown
      Since:
        2.0

    - #### isShadowVisible

          public boolean isShadowVisible()

      Determines if the controller is configured to show a drop shadow below the toggled tree node.
      Returns:
        TRUE if a shadow will be shown
      Since:
        2.0

    - #### setUsingTransparency

          public void setUsingTransparency(boolean use)

      Specifies whether the expand / collapse animation will use transparency to make the children nodes that slide in / out fade in / out.
      Parameters:
        `use` - if TRUE the animation will also use transparency to make the nodes fade in / out.
      Since:
        2.0

    - #### isUsingTransparency

          public boolean isUsingTransparency()

      Determines if the expand / collapse animation will use transparency to make the children nodes that slide in / out fade in / out.
      Returns:
        TRUE if the animation uses transparency
      Since:
        2.0

    - #### setMaximumAnimationDuration

          public void setMaximumAnimationDuration(int millis)

      Limits the amount of time that the animation may run. If a node has a lot of children nodes then closing that node might easily take a few seconds when 50 milliseconds are used for each row. This is not desirable and this method allows us to limit the time.
      Parameters:
        `millis` - the maximum animation duration
      Since:
        2.0

    - #### getMaximumAnimationDuration

          public int getMaximumAnimationDuration()

      Returns the amount of time that the animation may run.
      Returns:
        the maximum animation duration in milliseconds
      Since:
        2.0

    - #### setMinimumAnimationDuration

          public void setMinimumAnimationDuration(int millis)

      Specifies the minimum time the animation can run. If a node has only one child then the animation will be so fast that the user can hardly recognize it and might get confused. The minimum duration property allows us to prevent this from happening.
      Parameters:
        `millis` - the duration to set
      Since:
        2.0

    - #### getMinimumAnimationDuration

          public int getMinimumAnimationDuration()

      Returns the minimum time the animation can run.
      Returns:
        the minimum animation duration in milliseconds
      Since:
        2.0

    - #### getAnimationTimePerRow

          public int getAnimationTimePerRow()

      Returns the animation duration in milliseconds per row. The total animation duration will be the number of children rows multiplied with this value (and limited by the minimum and the maximum animation duration).
      Returns:
        the animation time per row in milliseconds
      Since:
        2.0
      See Also:
        `setMaximumAnimationDuration(int)`, `setMinimumAnimationDuration(int)`

    - #### setAnimationTimePerRow

          public void setAnimationTimePerRow(int millis)

      Sets the animation duration in milliseconds per row. The total animation duration will be the number of children rows multiplied with this value (and limited by the minimum and the maximum animation duration).
      Parameters:
        `millis` - the animation duration per row
      Since:
        2.0
      See Also:
        `setMaximumAnimationDuration(int)`, `setMinimumAnimationDuration(int)`

    - #### getAnimationDuration

          public int getAnimationDuration(int rowCount)

      Calculates the animation duration.

           duration = Math.max(minimumAnimationDuration,
                          Math.min(maximumAnimationDuration, rowCount * animationTimePerRow))

      Parameters:
        `rowCount` - the number of rows affected by the animation = children nodes of toggled node
      Returns:
        the animation duration in milliseconds
      Since:
        2.0

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.