Package jexer.ttree

Class TTreeItem

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>
    Direct Known Subclasses:
    TDirectoryTreeItem

    public class TTreeItem
    extends TWidget
    TTreeItem is a single item in a tree view.
    • Field Detail

      • level

        protected int level
        Tree level.
    • Constructor Detail

      • TTreeItem

        public TTreeItem​(TTreeView view,
                         java.lang.String text,
                         boolean expanded)
        Public constructor.
        Parameters:
        view - root TTreeView
        text - text for this item
        expanded - if true, have it expanded immediately
    • Method Detail

      • onMouseUp

        public void onMouseUp​(TMouseEvent mouse)
        Handle mouse release events.
        Overrides:
        onMouseUp in class TWidget
        Parameters:
        mouse - mouse button release event
      • onExpand

        public void onExpand()
        Called when this item is expanded or collapsed. this.expanded will be true if this item was just expanded from a mouse click or keypress.
      • onKeypress

        public void onKeypress​(TKeypressEvent keypress)
        Handle keystrokes.
        Overrides:
        onKeypress in class TWidget
        Parameters:
        keypress - keystroke event
      • draw

        public void draw()
        Draw this item to a window.
        Overrides:
        draw in class TWidget
      • getTreeView

        public final TTreeView getTreeView()
        Get the parent TTreeView.
        Returns:
        the parent TTreeView
      • getText

        public final java.lang.String getText()
        Get the displayable text for this item.
        Returns:
        the displayable text for this item
      • setText

        public final void setText​(java.lang.String text)
        Set the displayable text for this item.
        Parameters:
        text - the displayable text for this item
      • isExpanded

        public final boolean isExpanded()
        Get expanded value.
        Returns:
        if true, this item is expanded
      • setExpanded

        public final void setExpanded​(boolean expanded)
        Set expanded value.
        Parameters:
        expanded - new value
      • isExpandable

        public final boolean isExpandable()
        Get expandable value.
        Returns:
        if true, this item is expandable
      • setExpandable

        public final void setExpandable​(boolean expandable)
        Set expandable value.
        Parameters:
        expandable - new value
      • getPrefix

        public final java.lang.String getPrefix()
        Get the vertical bars and such along the left side.
        Returns:
        the vertical bars and such along the left side
      • isSelected

        public final boolean isSelected()
        Get selected value.
        Returns:
        if true, this item is selected
      • setSelected

        public final void setSelected​(boolean selected)
        Set selected value.
        Parameters:
        selected - new value
      • setSelectable

        public final void setSelectable​(boolean selectable)
        Set selectable value.
        Parameters:
        selectable - new value
      • getMaximumColumn

        public int getMaximumColumn()
        Get the length of the widest item to display.
        Returns:
        the maximum number of columns for this item or its children
      • expandTree

        public java.util.List<TTreeItem> expandTree​(java.lang.String prefix,
                                                    boolean last)
        Recursively expand the tree into a linear array of items.
        Parameters:
        prefix - vertical bar of parent levels and such that is set on each child
        last - if true, this is the "last" leaf node of a tree
        Returns:
        additional items to add to the array
      • unselect

        public void unselect()
        Recursively unselect me and my children.