Package jexer.ttree
Class TTreeViewWidget
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TScrollableWidget
-
- jexer.ttree.TTreeViewWidget
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
,Scrollable
public class TTreeViewWidget extends TScrollableWidget
TTreeViewWidget wraps a tree view with horizontal and vertical scrollbars.
-
-
Field Summary
-
Fields inherited from class jexer.TScrollableWidget
hScroller, vScroller
-
-
Constructor Summary
Constructors Constructor Description TTreeViewWidget(TWidget parent, int x, int y, int width, int height)
Public constructor.TTreeViewWidget(TWidget parent, int x, int y, int width, int height, TAction action)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispatch()
Perform user selection action.TTreeItem
getSelected()
Get the tree view item that was selected.TTreeItem
getTreeRoot()
Get the root of the tree.TTreeView
getTreeView()
Get the underlying TTreeView.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
onMouseDown(TMouseEvent mouse)
Handle mouse press events.void
onMouseMotion(TMouseEvent mouse)
Handle mouse motion events.void
onMouseUp(TMouseEvent mouse)
Handle mouse release events.void
onResize(TResizeEvent event)
Handle window/screen resize events.void
reflowData()
Resize text and scrollbars for a new width/height.void
setHeight(int height)
Override TWidget's height: we need to set child widget heights.void
setSelected(TTreeItem item, boolean centerWindow)
Set the new selected tree view item.void
setTreeRoot(TTreeItem treeRoot)
Set the root of the tree.void
setTreeRoot(TTreeItem treeRoot, boolean centerWindow)
Set treeRoot.void
setWidth(int width)
Override TWidget's width: we need to set child widget widths.-
Methods inherited from class jexer.TScrollableWidget
bigHorizontalDecrement, bigHorizontalIncrement, bigVerticalDecrement, bigVerticalIncrement, getBottomValue, getHorizontalBigChange, getHorizontalScroller, getHorizontalSmallChange, getHorizontalValue, getLeftValue, getRightValue, getTopValue, getVerticalBigChange, getVerticalScroller, getVerticalSmallChange, getVerticalValue, horizontalDecrement, horizontalIncrement, placeScrollbars, setBottomValue, setHorizontalBigChange, setHorizontalSmallChange, setHorizontalValue, setLeftValue, setRightValue, setTopValue, setVerticalBigChange, setVerticalSmallChange, setVerticalValue, toBottom, toEnd, toHome, toLeft, toRight, toTop, verticalDecrement, verticalIncrement
-
Methods inherited from class jexer.TWidget
activate, activate, activate, activateAll, addButton, addCalendar, addCheckBox, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, close, compareTo, doRepaint, draw, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getApplication, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getScreen, getTheme, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onMenu, onMouseDoubleClick, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setLayoutManager, setParent, setupForTWindow, setVisible, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY
-
-
-
-
Constructor Detail
-
TTreeViewWidget
public TTreeViewWidget(TWidget parent, int x, int y, int width, int height)
Public constructor.- Parameters:
parent
- parent widgetx
- column relative to parenty
- row relative to parentwidth
- width of tree viewheight
- height of tree view
-
TTreeViewWidget
public TTreeViewWidget(TWidget parent, int x, int y, int width, int height, TAction action)
Public constructor.- Parameters:
parent
- parent widgetx
- column relative to parenty
- row relative to parentwidth
- width of tree viewheight
- height of tree viewaction
- action to perform when an item is selected
-
-
Method Detail
-
onResize
public void onResize(TResizeEvent event)
Handle window/screen resize events.- Overrides:
onResize
in classTScrollableWidget
- Parameters:
event
- resize event
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse press events.- Overrides:
onMouseDown
in classTWidget
- Parameters:
mouse
- mouse button press event
-
onMouseUp
public void onMouseUp(TMouseEvent mouse)
Handle mouse release events.
-
onMouseMotion
public void onMouseMotion(TMouseEvent mouse)
Handle mouse motion events.- Overrides:
onMouseMotion
in classTWidget
- Parameters:
mouse
- mouse motion event
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTWidget
- Parameters:
keypress
- keystroke event
-
setWidth
public void setWidth(int width)
Override TWidget's width: we need to set child widget widths.
-
setHeight
public void setHeight(int height)
Override TWidget's height: we need to set child widget heights.
-
reflowData
public void reflowData()
Resize text and scrollbars for a new width/height.- Overrides:
reflowData
in classTScrollableWidget
-
getTreeView
public TTreeView getTreeView()
Get the underlying TTreeView.- Returns:
- the TTreeView
-
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
-
setTreeRoot
public void setTreeRoot(TTreeItem treeRoot, boolean centerWindow)
Set treeRoot.- Parameters:
treeRoot
- ultimate root of treecenterWindow
- if true, move the window to put the root in view
-
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 selectedcenterWindow
- if true, move the window to put the selected into view
-
dispatch
public void dispatch()
Perform user selection action.
-
-