Package jexer.ttree
Class TTreeItem
- java.lang.Object
-
- jexer.TWidget
-
- jexer.ttree.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 Summary
Fields Modifier and Type Field Description protected intlevelTree level.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddraw()Draw this item to a window.java.util.List<TTreeItem>expandTree(java.lang.String prefix, boolean last)Recursively expand the tree into a linear array of items.intgetMaximumColumn()Get the length of the widest item to display.java.lang.StringgetPrefix()Get the vertical bars and such along the left side.java.lang.StringgetText()Get the displayable text for this item.TTreeViewgetTreeView()Get the parent TTreeView.booleanisExpandable()Get expandable value.booleanisExpanded()Get expanded value.booleanisSelected()Get selected value.voidonExpand()Called when this item is expanded or collapsed.voidonKeypress(TKeypressEvent keypress)Handle keystrokes.voidonMouseUp(TMouseEvent mouse)Handle mouse release events.voidsetExpandable(boolean expandable)Set expandable value.voidsetExpanded(boolean expanded)Set expanded value.voidsetSelectable(boolean selectable)Set selectable value.voidsetSelected(boolean selected)Set selected value.voidsetText(java.lang.String text)Set the displayable text for this item.voidunselect()Recursively unselect me and my children.-
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, 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, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getApplication, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getCustomMousePointer, getHeight, getLayoutManager, getLocale, getMouseStyle, getParent, getScreen, getTheme, getWidgetUnderMouse, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isPixelMouse, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onMenu, onMouseDoubleClick, onMouseDown, onMouseMotion, onResize, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setCustomMousePointer, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setHeight, setLayoutManager, setLocale, setMouseStyle, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY, vLineXY
-
-
-
-
Constructor Detail
-
TTreeItem
public TTreeItem(TTreeView view, java.lang.String text, boolean expanded)
Public constructor.- Parameters:
view- root TTreeViewtext- text for this itemexpanded- if true, have it expanded immediately
-
-
Method Detail
-
onMouseUp
public void onMouseUp(TMouseEvent mouse)
Handle mouse release events.
-
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:
onKeypressin classTWidget- Parameters:
keypress- keystroke event
-
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 childlast- 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.
-
-