Class SimpleTreePresentationModel<N>

java.lang.Object
org.jhotdraw8.fxbase.tree.AbstractTreePresentationModel<N>
org.jhotdraw8.fxbase.tree.SimpleTreePresentationModel<N>
Type Parameters:
N - the node type
All Implemented Interfaces:
TreePresentationModel<N>

public class SimpleTreePresentationModel<N> extends AbstractTreePresentationModel<N>
This model can be used to present a TreeModel in a TreeView or a TreeTableView.

Maps TreeModel to a TreeItem&lt;E&gt; hierarchy.

Note: for performance reasons we do not expand the tree nodes by default.

Author:
Werner Randelshofer
  • Field Details

    • updating

      protected int updating
  • Constructor Details

    • SimpleTreePresentationModel

      public SimpleTreePresentationModel(Supplier<Map<N,javafx.scene.control.TreeItem<N>>> mapFactory)
      Creates a new instance.
      Parameters:
      mapFactory - used to create a map which maps from nodes of type N to javafx.scene.control.TreeItem<N>. For best performance, try to provide an IdentityHashMap here.
  • Method Details

    • getRoot

      public javafx.scene.control.TreeItem<N> getRoot()
    • getTreeItem

      public javafx.scene.control.TreeItem<N> getTreeItem(N f)
      Description copied from interface: TreePresentationModel
      Returns the tree item associated to the specified node.
      Parameters:
      f - the node value
      Returns:
      a TreeItem. Returns null if no tree item has been associated to the node because the tree is not expanded yet.
    • getValue

      public N getValue(javafx.scene.control.TreeItem<N> item)
    • onNodeAdded

      protected void onNodeAdded(N node, N parentE, int index)
    • onNodeAddedToTree

      protected void onNodeAddedToTree(N node, N parent, int index)
    • onNodeInvalidated

      protected void onNodeInvalidated(N f)
    • onNodeRemoved

      protected void onNodeRemoved(N f, N parentE, int index)
    • onNodeRemovedFromTree

      protected void onNodeRemovedFromTree(N f)
    • onRootChanged

      protected void onRootChanged()
    • onTreeModelChanged

      protected void onTreeModelChanged(@Nullable TreeModel<N> oldValue, TreeModel<N> newValue)
      Specified by:
      onTreeModelChanged in class AbstractTreePresentationModel<N>
    • isUpdating

      public boolean isUpdating()