Package snap.view

Class TreeView<T>

All Implemented Interfaces:
PropChange.DoChange, Selectable<T>, XMLArchiver.Archivable

public class TreeView<T> extends ParentView implements Selectable<T>
A View subclass to show a list of hierarchical items.
  • Constructor Details

    • TreeView

      public TreeView()
      Constructor.
  • Method Details

    • getRowHeight

      public int getRowHeight()
      Returns the row height.
    • setRowHeight

      public void setRowHeight(int aValue)
      Sets the row height.
    • getPrefRowCount

      public int getPrefRowCount()
      Returns the preferred number of rows.
    • setPrefRowCount

      public void setPrefRowCount(int aValue)
      Sets the preferred number of rows.
    • getMaxRowCount

      public int getMaxRowCount()
      Returns the maximum number of rows.
    • setMaxRowCount

      public void setMaxRowCount(int aValue)
      Sets the maximum number of rows.
    • getCellConfigure

      public Consumer<ListCell<T>> getCellConfigure()
      Called to set method for rendering.
    • setCellConfigure

      public void setCellConfigure(Consumer<ListCell<T>> aCC)
      Called to set method for rendering.
    • getColCount

      public int getColCount()
      Returns the number of columns.
    • getCol

      public TreeCol<T> getCol(int anIndex)
      Returns the column at given index.
    • getCols

      public TreeCol<T>[] getCols()
      Returns the column at given index.
    • addCol

      public void addCol(TreeCol<T> aCol)
      Adds a column.
    • addCol

      public void addCol(TreeCol<T> aCol, int anIndex)
      Adds a column at index.
    • getRowCount

      public int getRowCount()
      Returns the number of rows.
    • getItems

      public List<T> getItems()
      Returns the items.
      Specified by:
      getItems in interface Selectable<T>
    • setItems

      public void setItems(List<T> theItems)
      Sets the items.
      Specified by:
      setItems in interface Selectable<T>
    • setItemsImpl

      protected void setItemsImpl(List<T> theItems)
      Sets the items.
    • getSelIndex

      public int getSelIndex()
      Returns the selected index.
      Specified by:
      getSelIndex in interface Selectable<T>
    • setSelIndex

      public void setSelIndex(int anIndex)
      Sets the selected index.
      Specified by:
      setSelIndex in interface Selectable<T>
    • getSelItem

      public T getSelItem()
      Returns the selected item.
      Specified by:
      getSelItem in interface Selectable<T>
    • setSelItem

      public void setSelItem(T anItem)
      Sets the selected index.
      Specified by:
      setSelItem in interface Selectable<T>
    • handlePickListSelChange

      protected void handlePickListSelChange(PropChange aPC)
      Called when PickList changes selection.
    • getExpandedItems

      public List<T> getExpandedItems(List<T> theItems)
      Returns the list of expanded items for given items.
    • updateItem

      public void updateItem(T anItem)
      Called to update item that has changed.
    • updateItems

      public void updateItems()
      Called to update all visible items.
    • updateItems

      public void updateItems(T[] theItems)
      Called to update items that have changed.
    • getSelRow

      public int getSelRow()
      Returns the selected row.
    • getSelCol

      public int getSelCol()
      Returns the selected column.
    • setSelCol

      public void setSelCol(int anIndex)
      Sets the selected column.
    • getRowIndexForY

      public int getRowIndexForY(double aY)
      Returns the row index at given point.
    • expandAll

      public void expandAll()
      Expands all tree nodes.
    • expandItem

      public void expandItem(T anItem)
      Expands the given item.
    • collapseItem

      public void collapseItem(T anItem)
      Expands the given item.
    • toggleItem

      public void toggleItem(T anItem)
      Expands the given item.
    • getResolver

      public TreeResolver<T> getResolver()
      Returns the resolver.
    • setResolver

      public void setResolver(TreeResolver<T> aResolver)
      Sets the resolver.
    • getItemParent

      public T getItemParent(T anItem)
      Returns the parent of given item.
    • getItemParentCount

      public int getItemParentCount(T anItem)
      Returns the parent of given item.
    • isItemAncestor

      public boolean isItemAncestor(T anItem, T aPar)
      Returns whether given item has given object as any of it's ancestors.
    • isItemParent

      public boolean isItemParent(T anItem)
      Whether given object is a parent (has children).
    • getItemChildren

      public List<T> getItemChildren(T aParent)
      Returns the children.
    • getItemText

      public String getItemText(T anItem, int aCol)
      Returns the text to be used for given item.
    • getItemImage

      public Image getItemImage(T anItem)
      Return the image to be used for given item.
    • getItemGraphic

      public View getItemGraphic(T anItem)
      Return the graphic to be used for given item.
    • isItemExpanded

      public boolean isItemExpanded(T anItem)
      Returns whether an item is expanded.
    • setItemExpanded

      public void setItemExpanded(T anItem, boolean aValue)
      Sets whether an item is expaned.
    • findItemParent

      public T findItemParent(T anItem)
      Searches for parent of given item (only works if given item is visible).
    • setY

      public void setY(double aValue)
      Override to reset cells.
      Overrides:
      setY in class View
    • setHeight

      public void setHeight(double aValue)
      Override to reset cells.
      Overrides:
      setHeight in class View
    • setBorderRadius

      public void setBorderRadius(double aValue)
      Override to propagate to inner views.
      Overrides:
      setBorderRadius in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to layout ScrollView.
      Overrides:
      layoutImpl in class ParentView
    • getMaxHeight

      public double getMaxHeight()
      Returns the maximum height.
      Overrides:
      getMaxHeight in class View
    • getValuePropName

      public String getValuePropName()
      Returns a mapped property name.
      Overrides:
      getValuePropName in class View
    • getExpandedImage

      public Image getExpandedImage()
      Returns an Icon of a down arrow.
    • getCollapsedImage

      public Image getCollapsedImage()
      Returns an image of a down arrow.
    • equalsItems

      protected boolean equalsItems(List<T> theItems)
      Returns whether given items are equal to set items.