Module MaterialFX

Class MFXTreeItem<T>

Type Parameters:
T - The type of the data within TreeItem.
All Implemented Interfaces:
Styleable, EventTarget, Skinnable
Direct Known Subclasses:
MFXCheckTreeItem

public class MFXTreeItem<T> extends AbstractMFXTreeItem<T>
Simple implementation of an animated tree item.

Concrete implementation of AbstractMFXTreeItem<T> to provide less common functionalities such expand/collapse animations.

The default associated Skin is MFXTreeItemSkin<T>.

Overrides the layoutChildren method to set the AbstractMFXTreeItem.items margin to 20 by default. To change it you have to override the method inline or by extending this class.

See Also:
  • Property Details

  • Constructor Details

  • Method Details

    • isExpanded

      public boolean isExpanded()
      Returns:
      the item's expand state
    • expandedProperty

      public BooleanProperty expandedProperty()
      Expand property.

      NOTE: if you want the item to be expanded by default you must use AbstractMFXTreeItem.startExpandedProperty() instead.

      See Also:
    • setExpanded

      public void setExpanded(boolean expanded)
      Sets the item's expand state.

      WARNING: THIS METHOD IS FOR INTERNAL USE ONLY, THUS ITS USAGE IS NOT RECOMMENDED.

    • getInitialHeight

      public double getInitialHeight()
      Returns:
      the item's height when it's first laid out
    • initialHeightProperty

      public ReadOnlyDoubleProperty initialHeightProperty()
      Initial height property.

      We need this to set the fixed initial prefHeight of the control and for the calculation of the collapse event prefHeight.

      WARNING: THIS PROPERTY IS FOR INTERNAL USE ONLY

      See Also:
    • setInitialHeight

      public void setInitialHeight(double height)
      Sets the initial height property.

      WARNING: THIS METHOD IS FOR INTERNAL USE ONLY, THUS ITS USAGE IS NOT RECOMMENDED.

    • isAnimationRunning

      public boolean isAnimationRunning()
      Returns:
      the state of the expand/collapse animation on this item.
    • animationRunningProperty

      public ReadOnlyBooleanWrapper animationRunningProperty()
      Property to check if an animation is running on the control. It is bound into the Skin class.
    • getAnimationDuration

      public double getAnimationDuration()
      Gets the value of the property animationDuration.
      Property description:
      Specifies the duration of the expand/collapse animation (milliseconds).

      Too high values are not recommended.

    • animationDurationProperty

      public StyleableDoubleProperty animationDurationProperty()
      Specifies the duration of the expand/collapse animation (milliseconds).

      Too high values are not recommended.

      See Also:
    • setAnimationDuration

      public void setAnimationDuration(double animationDuration)
      Sets the value of the property animationDuration.
      Property description:
      Specifies the duration of the expand/collapse animation (milliseconds).

      Too high values are not recommended.

    • getControlCssMetaDataList

      public static List<CssMetaData<? extends Styleable,?>> getControlCssMetaDataList()
    • getSelectionModel

      public ITreeSelectionModel<T> getSelectionModel()
      Retrieves the selection model instance from the TreeView which contains the tree.
      Specified by:
      getSelectionModel in class AbstractMFXTreeItem<T>
    • defaultCellFactory

      protected void defaultCellFactory()
      If no cell factory is specified in the constructor then we provide a default one.

      This method is abstract in the superclass because a default cell factory should always be provided.

      Specified by:
      defaultCellFactory in class AbstractMFXTreeItem<T>
    • updateChildrenParent

      protected void updateChildrenParent(List<? extends AbstractMFXTreeItem<T>> treeItems, AbstractMFXTreeItem<T> newParent)
      Used in the items listener added by the initialize() method.

      When an item is added/removed its parent should be updated accordingly.

      Specified by:
      updateChildrenParent in class AbstractMFXTreeItem<T>
      Parameters:
      treeItems - the items for which to update the parent
      newParent - the parent to set (or null in case of removed items)
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class Control
    • getControlCssMetaData

      public List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
      Overrides:
      getControlCssMetaData in class Control
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region
    • layoutChildren

      protected void layoutChildren()
      Simple layout strategy. Each item in the AbstractMFXTreeItem.items list has a left margin defined by AbstractMFXTreeItem.childrenMarginProperty().
      Overrides:
      layoutChildren in class Control
    • toString

      public String toString()
      Overrides:
      toString in class Node