Package jexer.ttree

Class TTreeView

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>

    public class TTreeView
    extends TWidget
    TTreeView implements a simple tree view.
    • Constructor Detail

      • TTreeView

        public TTreeView​(TWidget parent,
                         int x,
                         int y,
                         int width,
                         int height)
        Public constructor.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        width - width of tree view
        height - height of tree view
      • TTreeView

        public TTreeView​(TWidget parent,
                         int x,
                         int y,
                         int width,
                         int height,
                         TAction action)
        Public constructor.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        width - width of tree view
        height - height of tree view
        action - action to perform when an item is selected
    • Method Detail

      • onKeypress

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

        public final TTreeItem getTreeRoot()
        Get the root of the tree.
        Returns:
        the root of the tree
      • setTreeRoot

        public final void setTreeRoot​(TTreeItem treeRoot)
        Set the root of the tree.
        Parameters:
        treeRoot - the new root of the tree
      • getSelected

        public final TTreeItem getSelected()
        Get the tree view item that was selected.
        Returns:
        the selected item, or null if no item is selected
      • setSelected

        public void setSelected​(TTreeItem item,
                                boolean centerWindow)
        Set the new selected tree view item.
        Parameters:
        item - new item that became selected
        centerWindow - if true, move the window to put the selected into view
      • dispatch

        public void dispatch()
        Perform user selection action.
      • getLeftColumn

        public int getLeftColumn()
        Get the left column value. 0 is the leftmost column.
        Returns:
        the left column
      • setLeftColumn

        public void setLeftColumn​(int leftColumn)
        Set the left column value. 0 is the leftmost column.
        Parameters:
        leftColumn - the new left column
      • getTopLine

        public int getTopLine()
        Get the top line (row) value. 0 is the topmost line.
        Returns:
        the top line
      • setTopLine

        public void setTopLine​(int topLine)
        Set the top line value. 0 is the topmost line.
        Parameters:
        topLine - the new top line
      • getTotalLineCount

        public int getTotalLineCount()
        Get the total line (rows) count, based on the items that are visible and expanded.
        Returns:
        the line count
      • 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