Package adams.gui.core.dotnotationtree
Class DotNotationTree<N extends DotNotationNode>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JTree
-
- adams.gui.core.BaseTree
-
- adams.gui.core.DragAndDropTree
-
- adams.gui.core.dotnotationtree.DotNotationTree<N>
-
- All Implemented Interfaces:
DragGestureListener
,DragSourceListener
,DropTargetListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,Scrollable
- Direct Known Subclasses:
ActorPathTree
,ClassTree
,StringTree.HierarchicalStringTree
public class DotNotationTree<N extends DotNotationNode> extends DragAndDropTree
Displays dot-notation names in a tree structure.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.gui.core.DragAndDropTree
DragAndDropTree.DropMenu, DragAndDropTree.DropPosition
-
Nested classes/interfaces inherited from class javax.swing.JTree
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Compress
whether to compress the tree as much as possible.protected AbstractItemFilter
m_Filter
the item filter in use.protected List<AbstractInfoNodeGenerator>
m_InfoNodeGenerators
the info node generators to use.protected List<String>
m_Items
the underlying dot notations.protected PopupMenuHandler
m_PopupMenuHandler
the right-click menu handler.protected String
m_Search
the current search string.protected int
m_SelectionMode
the selection mode to use.protected boolean
m_Sorted
whether the items need to be sorted.-
Fields inherited from class adams.gui.core.DragAndDropTree
m_ColorCueLine, m_CueLineExtension, m_DragSource, m_DropTarget, m_ExpansionDelay, m_ExpansionExecutor, m_NodeDroppedListeners, m_Offset, m_RectCueLine, m_SourceNode
-
Fields inherited from class javax.swing.JTree
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description DotNotationTree()
Initializes the tree with no items.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInfoNodeGenerator(AbstractInfoNodeGenerator generator)
Adds the specified generator to the list of generators.void
addItem(String item)
Adds the item, if necessary.protected N
addItem(N root, String item)
Adds the item to the tree structure.void
addItems(BaseString[] items)
Adds the items to the current ones and rebuilds the tree.void
addItems(String[] items)
Adds the items to the current ones and rebuilds the tree.void
addItems(List<String> items)
Adds the items to the current ones and rebuilds the tree.protected List<String>
applyItemFilter(List<String> items)
Filters the items if a item filter has been specified.protected List<String>
applySearchFilter(List<String> items)
Filters the items according to the search string.protected void
buildTree()
Builds the tree.protected boolean
canStartDrag(BaseTreeNode[] source)
Checks whether the source node can be dragged at all.protected void
compress()
Removes unnecessary nesting, i.e., nodes with just one non-leaf child get collapsed.protected void
compress(N root)
Removes unncessary nesting.protected void
expandAfterSearch()
Gets called after setting a search term (can be empty string).protected N
findItem(N root, String item)
Finds the item in the tree structure.protected Object[]
findItem(N root, String[] parts)
Tries to match the parts of the string to children of the given root node.protected N
findRoot(N root, String item)
Finds the root for the given item.boolean
getCompress()
Returns whether the tree gets compressed or not.protected TreeCellRenderer
getDefaultRenderer()
Returns the default renderer to use.AbstractItemFilter
getFilter()
Returns the current filter.String
getFirstItem()
Returns the first stored item.PopupMenuHandler
getPopupMenuHandler()
Returns the current popup menu (right-click) handler.protected String
getRootNodeLabel()
Returns the label used for the root node.protected String
getRootPart(String item)
Returns the root part for the specified item.String
getSearch()
Returns the current search string.String
getSelectedItem()
Returns the item of the selected node.String[]
getSelectedItems()
Returns the items of the selected nodes.int
getSelectionMode()
Returns the selection mode.String
getSeparator()
Returns the separator in use.DefaultTreeModel
getTreeModel()
Returns the model.boolean
hasItem(String item)
Checks whether the item is among the stored ones.protected boolean
hasRootNodeLabel()
Checks whether a root node label is in use.protected void
initialize()
Further initialization of the tree.protected boolean
isDragEnabled()
Returns whether dragging is enabled.boolean
isSorted()
Returns whether the item get sorted.static void
main(String[] args)
For testing only.protected N
newNode(String label)
Creates a new node with the specified label.protected BaseTreeNode[]
newTreeNodes(Transferable data)
Creates a new TreeNode for this tree.int
numItems()
Returns the number of items in the tree.protected void
postAddLeaf(N node, String item)
Post-processes a leaf after being added, i.e., info node generators are applied.protected void
postBuildTree()
Hook method just after the tree got built and reloaded.void
removeInfoNodeGenerator(AbstractInfoNodeGenerator generator)
Removes the specified generator from the list of generators.void
setCompress(boolean value)
Sets whether to compress the tree (removal of unnecessary nestings) or not.void
setFilter(AbstractItemFilter value)
Sets the filter to use for filtering the display.void
setItems(BaseString[] items)
Displays the specified items.void
setItems(String[] items)
Displays the specified items.void
setItems(List<String> items)
Displays the specified items.void
setPopupMenuHandler(PopupMenuHandler value)
Sets the popup menu (right-click) handler to use.void
setSearch(String value)
Sets the search string.void
setSelectedItem(String item)
The item to select initially.void
setSelectedItems(String[] items)
The items to select initially.void
setSelectionMode(int value)
Sets the selection mode.void
setSorted(boolean value)
Sets whether the items are sorted or not.protected void
showPopup(MouseEvent e)
Displays a popup menu, if available.protected String[]
splitItem(String item)
Splits the item into its sub-parts.-
Methods inherited from class adams.gui.core.DragAndDropTree
addNodeDroppedListener, canDrop, doDrop, dragDropEnd, dragEnter, dragEnter, dragExit, dragExit, dragGestureRecognized, dragOver, dragOver, drop, dropActionChanged, dropActionChanged, getDropMenuActionCaption, getDropMenuActionIcon, getExpansionDelay, isDropEnabled, newNodeCollection, notifyNodeDroppedListeners, removeNodeDroppedListener, selectCursor, setExpansionDelay, showDropMenu
-
Methods inherited from class adams.gui.core.BaseTree
collapse, collapseAll, collapseAll, collapseAll, collapseRoot, expand, expand, expandAll, expandAll, expandAll, expandRoot, getCommonAncestor, getExpandedState, getExpandedStateList, getExpandedTreePaths, getExpandedTreePaths, getFirstVisibleRow, getLastVisibleRow, getParentDialog, getParentFrame, getParentInternalFrame, isRootSelected, redraw, redraw, setExpandedState, setExpandedStateList, setExpandedTreePaths, setExpandedTreePaths, toggleAll, toggleAll, toPlainText, toPlainText, toString, toString
-
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setDropMode, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_Search
protected String m_Search
the current search string.
-
m_Compress
protected boolean m_Compress
whether to compress the tree as much as possible.
-
m_Filter
protected AbstractItemFilter m_Filter
the item filter in use.
-
m_InfoNodeGenerators
protected List<AbstractInfoNodeGenerator> m_InfoNodeGenerators
the info node generators to use.
-
m_PopupMenuHandler
protected PopupMenuHandler m_PopupMenuHandler
the right-click menu handler.
-
m_Sorted
protected boolean m_Sorted
whether the items need to be sorted.
-
m_SelectionMode
protected int m_SelectionMode
the selection mode to use.
-
-
Method Detail
-
initialize
protected void initialize()
Further initialization of the tree.- Overrides:
initialize
in classDragAndDropTree
-
setSelectionMode
public void setSelectionMode(int value)
Sets the selection mode.- Parameters:
value
- the selection mode- See Also:
postBuildTree()
,TreeSelectionModel
-
getSelectionMode
public int getSelectionMode()
Returns the selection mode.- Returns:
- the selection mode
- See Also:
TreeSelectionModel
-
getDefaultRenderer
protected TreeCellRenderer getDefaultRenderer()
Returns the default renderer to use.- Returns:
- the renderer
-
showPopup
protected void showPopup(MouseEvent e)
Displays a popup menu, if available.- Parameters:
e
- the mouse event that triggered the popup menu request
-
isDragEnabled
protected boolean isDragEnabled()
Returns whether dragging is enabled.- Overrides:
isDragEnabled
in classDragAndDropTree
- Returns:
- always true
-
canStartDrag
protected boolean canStartDrag(BaseTreeNode[] source)
Checks whether the source node can be dragged at all.- Overrides:
canStartDrag
in classDragAndDropTree
- Parameters:
source
- the source node that is about to be dragged- Returns:
- true if the source node can be dragged
-
newTreeNodes
protected BaseTreeNode[] newTreeNodes(Transferable data)
Creates a new TreeNode for this tree. Only accepts STRING flavor.- Overrides:
newTreeNodes
in classDragAndDropTree
- Parameters:
data
- the data to use- Returns:
- the new node
-
getTreeModel
public DefaultTreeModel getTreeModel()
Returns the model.- Returns:
- the model
-
setSorted
public void setSorted(boolean value)
Sets whether the items are sorted or not.- Parameters:
value
- if true items get sorted
-
isSorted
public boolean isSorted()
Returns whether the item get sorted.- Returns:
- true if items get sorted
-
applySearchFilter
protected List<String> applySearchFilter(List<String> items)
Filters the items according to the search string.- Parameters:
items
- the items to apply the search filter- Returns:
- the filtered items
-
hasRootNodeLabel
protected boolean hasRootNodeLabel()
Checks whether a root node label is in use.- Returns:
- true if a root node label is used
-
getRootNodeLabel
protected String getRootNodeLabel()
Returns the label used for the root node.- Returns:
- the label, null if not used
-
getRootPart
protected String getRootPart(String item)
Returns the root part for the specified item.- Parameters:
item
- the item to determine the root part for- Returns:
- the root part
-
findRoot
protected N findRoot(N root, String item)
Finds the root for the given item. Creates the root node if necessary.- Parameters:
root
- optional root node to useitem
- the item to find the root for- Returns:
- the root node
-
newNode
protected N newNode(String label)
Creates a new node with the specified label.- Parameters:
label
- the label to use for the node- Returns:
- the new node
-
postAddLeaf
protected void postAddLeaf(N node, String item)
Post-processes a leaf after being added, i.e., info node generators are applied.- Parameters:
node
- the node to processitem
- the full item string- See Also:
m_InfoNodeGenerators
-
splitItem
protected String[] splitItem(String item)
Splits the item into its sub-parts.- Parameters:
item
- the full item string to split- Returns:
- the generated parts, without the separator
-
getSeparator
public String getSeparator()
Returns the separator in use.- Returns:
- the separator
-
addItem
protected N addItem(N root, String item)
Adds the item to the tree structure.- Parameters:
root
- the root nodeitem
- the item to add- Returns:
- the added node or null if not added, e.g., if root was null
-
findItem
protected Object[] findItem(N root, String[] parts)
Tries to match the parts of the string to children of the given root node.- Parameters:
root
- the root node to start fromparts
- the string array to match against the items- Returns:
- node + remaining array, or null if not found
-
findItem
protected N findItem(N root, String item)
Finds the item in the tree structure.- Parameters:
root
- the root nodeitem
- the item to find- Returns:
- the node or null if not found, e.g., if root was null
-
compress
protected void compress(N root)
Removes unncessary nesting.- Parameters:
root
- the root of the subtree to flatten
-
compress
protected void compress()
Removes unnecessary nesting, i.e., nodes with just one non-leaf child get collapsed.
-
buildTree
protected void buildTree()
Builds the tree. Takes any search string into account.
-
postBuildTree
protected void postBuildTree()
Hook method just after the tree got built and reloaded.
Default implementation sets the selection mode.
-
setCompress
public void setCompress(boolean value)
Sets whether to compress the tree (removal of unnecessary nestings) or not. Automatically rebuilds the tree, if necessary.- Parameters:
value
- if true then compression is attempted- See Also:
compress()
-
getCompress
public boolean getCompress()
Returns whether the tree gets compressed or not. Compressing means the removal of unnecessary nestings, like nodes with only 1 child that is a non-leaf.- Returns:
- true if tree gets compressed
- See Also:
compress()
-
setFilter
public void setFilter(AbstractItemFilter value)
Sets the filter to use for filtering the display.- Parameters:
value
- the filter, null if to disable filtering
-
getFilter
public AbstractItemFilter getFilter()
Returns the current filter.- Returns:
- the filter, null if none set
-
hasItem
public boolean hasItem(String item)
Checks whether the item is among the stored ones.- Parameters:
item
- the item to look for- Returns:
- true if already present
-
addItem
public void addItem(String item)
Adds the item, if necessary.- Parameters:
item
- the item to add
-
applyItemFilter
protected List<String> applyItemFilter(List<String> items)
Filters the items if a item filter has been specified.- Parameters:
items
- the items to filter- Returns:
- the filtered items
-
setItems
public void setItems(List<String> items)
Displays the specified items.- Parameters:
items
- the items to display
-
setItems
public void setItems(String[] items)
Displays the specified items.- Parameters:
items
- the items to display
-
setItems
public void setItems(BaseString[] items)
Displays the specified items.- Parameters:
items
- the items to display
-
addItems
public void addItems(List<String> items)
Adds the items to the current ones and rebuilds the tree.- Parameters:
items
- the additional items
-
addItems
public void addItems(String[] items)
Adds the items to the current ones and rebuilds the tree.- Parameters:
items
- the additional items
-
addItems
public void addItems(BaseString[] items)
Adds the items to the current ones and rebuilds the tree.- Parameters:
items
- the additional items
-
getFirstItem
public String getFirstItem()
Returns the first stored item.- Returns:
- the item or null if no items stored
-
setSelectedItem
public void setSelectedItem(String item)
The item to select initially.- Parameters:
item
- the item to select
-
setSelectedItems
public void setSelectedItems(String[] items)
The items to select initially.- Parameters:
items
- the items to select
-
getSelectedItem
public String getSelectedItem()
Returns the item of the selected node.- Returns:
- the selected item, null if none selected
-
getSelectedItems
public String[] getSelectedItems()
Returns the items of the selected nodes.- Returns:
- the selected items, empty array if none selected
-
numItems
public int numItems()
Returns the number of items in the tree.- Returns:
- the number of items
-
setSearch
public void setSearch(String value)
Sets the search string.- Parameters:
value
- the search string, use null or empty string to display all
-
expandAfterSearch
protected void expandAfterSearch()
Gets called after setting a search term (can be empty string).
-
getSearch
public String getSearch()
Returns the current search string.- Returns:
- the search string, null if none set
-
addInfoNodeGenerator
public void addInfoNodeGenerator(AbstractInfoNodeGenerator generator)
Adds the specified generator to the list of generators.- Parameters:
generator
- the generator to add
-
removeInfoNodeGenerator
public void removeInfoNodeGenerator(AbstractInfoNodeGenerator generator)
Removes the specified generator from the list of generators.- Parameters:
generator
- the generator to remove
-
setPopupMenuHandler
public void setPopupMenuHandler(PopupMenuHandler value)
Sets the popup menu (right-click) handler to use.- Parameters:
value
- the handler, null to remove handler
-
getPopupMenuHandler
public PopupMenuHandler getPopupMenuHandler()
Returns the current popup menu (right-click) handler.- Returns:
- the handler, null if none in use
-
main
public static void main(String[] args)
For testing only.- Parameters:
args
- ignored
-
-