com.alee.laf.tree
Class WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTree
                  extended by com.alee.laf.tree.WebTree<E>
Type Parameters:
E - tree nodes type
All Implemented Interfaces:
SettingsMethods, EventMethods, FontMethods<WebTree<E>>, SwingMethods, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable
Direct Known Subclasses:
DictionariesTree, WebAsyncTree, WebCheckBoxTree, WebExTree

public class WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>
extends javax.swing.JTree
implements EventMethods, SettingsMethods, FontMethods<WebTree<E>>

This JTree extension class provides a direct access to WebTreeUI methods. There is also a set of additional methods to simplify some operations with tree.

This component should never be used with a non-Web UIs as it might cause an unexpected behavior. You could still use that component even if WebLaF is not your application L&F as this component will use Web-UI in any case.

Author:
Mikle Garin
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTree
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DropLocation, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirector
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.util.List<javax.swing.event.CellEditorListener> cellEditorListeners
          Tree cell editor listeners.
static int CONTIGUOUS_TREE_SELECTION
          Contiguous selection mode.
static int DISCONTIGUOUS_TREE_SELECTION
          Discontiguous selection mode.
protected  StateProvider<E> editableStateProvider
          Special state provider that can be set to check whether or not specific nodes are editable.
protected  javax.swing.event.TreeSelectionListener scrollToSelectionListener
          Listener that forces tree to scroll view to selection.
static int SINGLE_TREE_SELECTION
          Single selection mode.
protected  ToolTipProvider<? extends WebTree> toolTipProvider
          Custom WebLaF tooltip provider.
static java.lang.String TREE_COMPARATOR_PROPERTY
          Bound property name for tree comparator.
static java.lang.String TREE_DATA_PROVIDER_PROPERTY
          Bound property name for tree data provider.
static java.lang.String TREE_FILTER_PROPERTY
          Bound property name for tree filter.
 
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
accessibleContext, 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
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
WebTree()
          Constructs tree with default sample model.
WebTree(E root)
          Constructs tree with model based on specified root node.
WebTree(E root, boolean asksAllowsChildren)
          Constructs tree with model based on specified root node and which decides whether a node is a leaf node in the specified manner.
WebTree(java.util.Hashtable<?,?> value)
          Constructs tree with model based on specified values.
WebTree(java.lang.Object[] value)
          Constructs tree with model based on specified values.
WebTree(javax.swing.tree.TreeModel newModel)
          Constructs tree with specified model.
WebTree(java.util.Vector<?> value)
          Constructs tree with model based on specified values.
 
Method Summary
 void addCellEditorListener(javax.swing.event.CellEditorListener listener)
          Adds tree cell editor listener.
 WebTree<E> changeFontSize(int change)
          Changes font size of the specified component.
protected static javax.swing.tree.TreeModel createTreeModel(java.lang.Object value)
          Returns a TreeModel wrapping the specified object.
 void expandAll()
          Expands all tree nodes in a single call.
 void expandAll(E node)
          Expands all child nodes of the specified node.
 void expandAll(E node, Filter<E> shouldExpand)
          Expands all child nodes accepted by filter in a single call.
 void expandAll(Filter<E> shouldExpand)
          Expands all tree nodes accepted by filter in a single call.
 void expandAll(int depth)
          Expands all child nodes until the specified structure depth is reached.
 void expandNode(E node)
          Expands the specified node.
 void expandRoot()
          Expands the root path, assuming the current TreeModel has been set.
 java.util.List<E> getAllNodes()
          Returns list of all nodes added into the tree.
 javax.swing.CellRendererPane getCellRendererPane()
          Returns tree cell renderer pane.
 E getClosestNodeForLocation(int x, int y)
          Returns closest tree node for the specified location.
 E getClosestNodeForLocation(java.awt.Point location)
          Returns closest tree node for the specified location.
 javax.swing.tree.TreePath getClosestPathForLocation(java.awt.Point location)
          Returns the path to the node that is closest to the specified location.
static javax.swing.tree.TreeModel getDefaultTreeModel()
          Creates and returns a sample TreeModel.
 int getDropCellShadeWidth()
          Returns drop cell highlight shade width.
 StateProvider<E> getEditableStateProvider()
          Returns special state provider that can be set to check whether or not specific nodes are editable.
 E getFirstVisibleLeafNode()
          Returns first visible leaf node from the top of the tree.
 java.lang.String getFontName()
          Returns component font name.
 int getFontSize()
          Returns component font size.
 java.awt.Rectangle getFullRowBounds(E node)
          Returns full row bounds including the space before the node and after the node.
 java.awt.Rectangle getFullRowBounds(int row)
          Returns full row bounds including the space before the node and after the node.
 java.awt.Color getLinesColor()
          Returns tree structure lines color.
 java.awt.Rectangle getNodeBounds(E node)
          Returns node bounds.
 java.awt.Rectangle getNodeBounds(java.util.List<E> nodes)
          Returns nodes combined bounds.
 E getNodeForLocation(int x, int y)
          Returns tree node for the specified location.
 E getNodeForLocation(java.awt.Point location)
          Returns tree node for the specified location.
 E getNodeForPath(javax.swing.tree.TreePath path)
          Returns tree node for specified path.
 E getNodeForRow(int row)
          Returns tree node for the specified row.
 javax.swing.tree.TreePath getPathForLocation(java.awt.Point location)
          Returns the path for the node at the specified location.
 javax.swing.tree.TreePath getPathForNode(E node)
          Returns tree path for specified node.
 E getRootNode()
          Returns tree root node.
 int getRowForNode(E node)
          Returns row of the specified node.
 E getSelectedNode()
          Returns selected node.
 java.awt.Rectangle getSelectedNodeBounds()
          Returns selected node bounds.
 java.util.List<E> getSelectedNodes()
          Returns selected nodes.
 java.awt.Color getSelectionBackgroundColor()
          Returns selection background color.
 java.awt.Color getSelectionBorderColor()
          Returns selection border color.
 int getSelectionRound()
          Returns tree selection rounding.
 int getSelectionShadeWidth()
          Returns tree selection shade width.
 TreeSelectionStyle getSelectionStyle()
          Returns tree selection style.
 java.awt.Color getSelectorBorderColor()
          Returns selector border color.
 java.awt.Color getSelectorColor()
          Returns selector color.
 int getSelectorRound()
          Returns selector rounding.
 java.awt.BasicStroke getSelectorStroke()
          Returns selector border stroke.
 ToolTipProvider<? extends WebTree> getToolTipProvider()
          Returns custom WebLaF tooltip provider.
 TreeState getTreeState()
          Returns tree expansion and selection states.
 TreeState getTreeState(boolean saveSelection)
          Returns tree expansion and selection states.
 java.util.List<E> getVisibleSelectedNodes()
          Returns only selected nodes which are currently visible in tree area.
 WebTreeUI getWebUI()
          Returns Web-UI applied to this class.
protected  void init()
          Initializes additional tree settings.
 boolean isAutoExpandSelectedNode()
          Returns whether tree should auto-expand nodes on selection or not.
 boolean isAutoExpandSingleChildNode()
          Returns whether tree should auto-expand single child nodes or not.
 boolean isBoldFont()
          Returns whether component font is bold or not.
 boolean isExpanded(E node)
          Returns whether node is expanded or not.
 boolean isHighlightRolloverNode()
          Returns whether tree should highlight rollover node or not.
 boolean isItalicFont()
          Returns whether component font is italic or not.
 boolean isNodeEditable(E node)
          Returns whether the specified tree node is editable or not.
 boolean isPaintLines()
          Returns whether tree should paint structure lines or not.
 boolean isPathEditable(javax.swing.tree.TreePath path)
          
 boolean isPlainFont()
          Returns whether component font is plain or not.
 boolean isRolloverSelectionEnabled()
          Returns whether rollover selection is enabled for this list or not.
 boolean isScrollToSelection()
          Returns whether tree automatically scrolls to selection or not.
 boolean isSelected(E node)
          Returns whether specified node is selected or not.
 boolean isSelectorEnabled()
          Returns whether selector is enabled or not.
 boolean isWebColoredSelection()
          Returns whether selection should be web-colored or not.
 void loadSettings()
          Loads saved settings into the component if it is registered.
 java.awt.event.MouseAdapter onDoubleClick(MouseEventRunnable runnable)
          Shortcut method for double-click mouse event.
 java.awt.event.FocusAdapter onFocusGain(FocusEventRunnable runnable)
          Shortcut method for focus gain event.
 java.awt.event.FocusAdapter onFocusLoss(FocusEventRunnable runnable)
          Shortcut method for focus loss event.
 java.awt.event.KeyAdapter onKeyPress(HotkeyData hotkey, KeyEventRunnable runnable)
          Shortcut method for key press event.
 java.awt.event.KeyAdapter onKeyPress(KeyEventRunnable runnable)
          Shortcut method for key press event.
 java.awt.event.KeyAdapter onKeyRelease(HotkeyData hotkey, KeyEventRunnable runnable)
          Shortcut method for key release event.
 java.awt.event.KeyAdapter onKeyRelease(KeyEventRunnable runnable)
          Shortcut method for key release event.
 java.awt.event.KeyAdapter onKeyType(HotkeyData hotkey, KeyEventRunnable runnable)
          Shortcut method for key type event.
 java.awt.event.KeyAdapter onKeyType(KeyEventRunnable runnable)
          Shortcut method for key type event.
 java.awt.event.MouseAdapter onMenuTrigger(MouseEventRunnable runnable)
          Shortcut method for mouse event triggering popup menu.
 java.awt.event.MouseAdapter onMouseClick(MouseButton mouseButton, MouseEventRunnable runnable)
          Shortcut method for mouse click event.
 java.awt.event.MouseAdapter onMouseClick(MouseEventRunnable runnable)
          Shortcut method for mouse click event.
 java.awt.event.MouseAdapter onMouseDrag(MouseButton mouseButton, MouseEventRunnable runnable)
          Shortcut method for mouse drag event.
 java.awt.event.MouseAdapter onMouseDrag(MouseEventRunnable runnable)
          Shortcut method for mouse drag event.
 java.awt.event.MouseAdapter onMouseEnter(MouseEventRunnable runnable)
          Shortcut method for mouse enter event.
 java.awt.event.MouseAdapter onMouseExit(MouseEventRunnable runnable)
          Shortcut method for mouse exit event.
 java.awt.event.MouseAdapter onMousePress(MouseButton mouseButton, MouseEventRunnable runnable)
          Shortcut method for mouse press event.
 java.awt.event.MouseAdapter onMousePress(MouseEventRunnable runnable)
          Shortcut method for mouse press event.
 void registerSettings(SettingsProcessor settingsProcessor)
          Registers component for settings auto-save.
 void registerSettings(java.lang.String key)
          Registers component for settings auto-save.
 void registerSettings(java.lang.String key, boolean loadInitialSettings, boolean applySettingsChanges)
          Registers component for settings auto-save.
<V extends DefaultValue>
void
registerSettings(java.lang.String key, java.lang.Class<V> defaultValueClass)
          Registers component for settings auto-save.
<V extends DefaultValue>
void
registerSettings(java.lang.String key, java.lang.Class<V> defaultValueClass, boolean loadInitialSettings, boolean applySettingsChanges)
          Registers component for settings auto-save.
 void registerSettings(java.lang.String key, java.lang.Object defaultValue)
          Registers component for settings auto-save.
 void registerSettings(java.lang.String key, java.lang.Object defaultValue, boolean loadInitialSettings, boolean applySettingsChanges)
          Registers component for settings auto-save.
 void registerSettings(java.lang.String group, java.lang.String key)
          Registers component for settings auto-save.
<V extends DefaultValue>
void
registerSettings(java.lang.String group, java.lang.String key, java.lang.Class<V> defaultValueClass)
          Registers component for settings auto-save.
<V extends DefaultValue>
void
registerSettings(java.lang.String group, java.lang.String key, java.lang.Class<V> defaultValueClass, boolean loadInitialSettings, boolean applySettingsChanges)
          Registers component for settings auto-save.
 void registerSettings(java.lang.String group, java.lang.String key, java.lang.Object defaultValue)
          Registers component for settings auto-save.
 void registerSettings(java.lang.String group, java.lang.String key, java.lang.Object defaultValue, boolean loadInitialSettings, boolean applySettingsChanges)
          Registers component for settings auto-save.
 void removeCellEditorListener(javax.swing.event.CellEditorListener listener)
          Removes tree cell editor listener.
 void repaint(E node)
          Repaints specified node.
 void repaint(int row)
          Repaints specified tree row.
 void repaint(int from, int to)
          Repaints all tree rows in specified range.
 void repaint(java.util.List<E> nodes)
          Repaints specified node.
 void saveSettings()
          Saves component settings.
 void scrollToNode(E node)
          Scrolls tree view to specified node.
 void scrollToSelection()
          Scrolls tree view to selected nodes.
 void scrollToStart()
          Scrolls tree view to the beginning of the tree.
 void selectFirstVisibleLeafNode()
          Selects first visible leaf node from the top of the tree.
 void selectNextRow()
          Selects row next to currently selected.
 void selectNextRow(boolean cycle)
          Selects row next to currently selected.
 void selectNodeUnderPoint(int x, int y)
          Selects node under the specified point.
 void selectNodeUnderPoint(java.awt.Point point)
          Selects node under the specified point.
 void selectPreviousRow()
          Selects row next to currently selected.
 void selectPreviousRow(boolean cycle)
          Selects row previous to currently selected.
 void setAutoExpandSelectedNode(boolean autoExpand)
          Sets whether tree should auto-expand nodes on selection or not.
 void setAutoExpandSingleChildNode(boolean autoExpand)
          Sets whether tree should auto-expand single child nodes or not.
 WebTree<E> setBoldFont()
          Sets bold font for the component.
 WebTree<E> setBoldFont(boolean apply)
          Sets bold font for the component.
 void setCellEditor(javax.swing.tree.TreeCellEditor cellEditor)
          
 void setDropCellShadeWidth(int dropCellShadeWidth)
          Sets drop cell highlight shade width.
 void setEditableStateProvider(StateProvider<E> stateProvider)
          Sets special state provider that can be set to check whether or not specific nodes are editable.
 WebTree<E> setFontName(java.lang.String fontName)
          Sets component font name.
 WebTree<E> setFontSize(int fontSize)
          Sets component font size.
 WebTree<E> setFontSizeAndStyle(int fontSize, boolean bold, boolean italic)
          Sets font size and style for the specified component.
 WebTree<E> setFontSizeAndStyle(int fontSize, int style)
          Sets font size and style for the specified component.
 WebTree<E> setFontStyle(boolean bold, boolean italic)
          Sets component font style.
 WebTree<E> setFontStyle(int style)
          Sets component font style.
 void setHighlightRolloverNode(boolean highlight)
          Sets whether tree should highlight rollover node or not.
 WebTree<E> setItalicFont()
          Sets italic or plain font for the component.
 WebTree<E> setItalicFont(boolean apply)
          Sets italic or plain font for the component.
 void setLinesColor(java.awt.Color color)
          Sets tree structure lines color.
 void setMultiplySelectionAllowed(boolean allowed)
          Sets whether multiply nodes selection allowed or not.
 void setPaintLines(boolean paint)
          Sets whether tree should paint structure lines or not.
 WebTree<E> setPlainFont()
          Sets plain font for the component.
 WebTree<E> setPlainFont(boolean apply)
          Sets plain font for the component.
 void setRolloverSelectionEnabled(boolean enabled)
          Sets whether rollover selection is enabled for this list or not.
 void setScrollToSelection(boolean scroll)
          Sets whether tree should automatically scroll to selection or not.
 void setSelectedNode(E node)
          Sets selected nodes.
 void setSelectedNodes(E[] nodes)
          Sets selected nodes.
 void setSelectedNodes(java.util.List<E> nodes)
          Sets selected nodes.
 void setSelectionBackgroundColor(java.awt.Color color)
          Sets selection background color.
 void setSelectionBorderColor(java.awt.Color color)
          Sets selection border color.
 void setSelectionMode(int mode)
          Sets tree selection mode.
 void setSelectionRound(int round)
          Sets tree selection rounding.
 void setSelectionShadeWidth(int shadeWidth)
          Sets tree selection shade width.
 void setSelectionStyle(TreeSelectionStyle style)
          Sets tree selection style.
 void setSelectorBorderColor(java.awt.Color color)
          Sets selector border color.
 void setSelectorColor(java.awt.Color color)
          Sets selector color.
 void setSelectorEnabled(boolean enabled)
          Sets whether selector is enabled or not.
 void setSelectorRound(int round)
          Sets selector rounding.
 void setSelectorStroke(java.awt.BasicStroke stroke)
          Sets selector border stroke.
 void setToolTipProvider(ToolTipProvider<? extends WebTree> provider)
          Sets custom WebLaF tooltip provider.
 void setTreeState(TreeState treeState)
          Restores tree expansion and selection states.
 void setTreeState(TreeState treeState, boolean restoreSelection)
          Restores tree expansion and selection states.
 void setWebColoredSelection(boolean webColored)
          Sets whether selection should be web-colored or not.
 void startEditingNode(E node)
          Starts editing the specified node.
 void startEditingSelectedNode()
          Starts editing selected tree node.
 void unregisterSettings()
          Unregisters component from settings auto-save.
 void updateAllVisibleNodes()
          Updates all visible nodes.
 void updateUI()
          Installs a Web-UI into this component.
 
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, 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, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, 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
 
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TREE_DATA_PROVIDER_PROPERTY

public static final java.lang.String TREE_DATA_PROVIDER_PROPERTY
Bound property name for tree data provider. Data provider is not supported by WebTree, but it is a base for various extensions so property is located here.

See Also:
Constant Field Values

TREE_FILTER_PROPERTY

public static final java.lang.String TREE_FILTER_PROPERTY
Bound property name for tree filter. Filtering is not supported by WebTree, but it is a base for various extensions so property is located here.

See Also:
Constant Field Values

TREE_COMPARATOR_PROPERTY

public static final java.lang.String TREE_COMPARATOR_PROPERTY
Bound property name for tree comparator. Sorting is not supported by WebTree, but it is a base for various extensions so property is located here.

See Also:
Constant Field Values

SINGLE_TREE_SELECTION

public static final int SINGLE_TREE_SELECTION
Single selection mode. Only one node can be selected.

See Also:
Constant Field Values

CONTIGUOUS_TREE_SELECTION

public static final int CONTIGUOUS_TREE_SELECTION
Contiguous selection mode. Any amount of nodes can be selected in a row.

See Also:
Constant Field Values

DISCONTIGUOUS_TREE_SELECTION

public static final int DISCONTIGUOUS_TREE_SELECTION
Discontiguous selection mode. Any amount of nodes can be selected anywhere.

See Also:
Constant Field Values

cellEditorListeners

protected java.util.List<javax.swing.event.CellEditorListener> cellEditorListeners
Tree cell editor listeners. These listeners act separately from the cell editor and will be moved to new tree cell editor automatically on set.


scrollToSelectionListener

protected javax.swing.event.TreeSelectionListener scrollToSelectionListener
Listener that forces tree to scroll view to selection. It is disabled by default and null in that case.


editableStateProvider

protected StateProvider<E extends javax.swing.tree.DefaultMutableTreeNode> editableStateProvider
Special state provider that can be set to check whether or not specific nodes are editable.


toolTipProvider

protected ToolTipProvider<? extends WebTree> toolTipProvider
Custom WebLaF tooltip provider.

Constructor Detail

WebTree

public WebTree()
Constructs tree with default sample model.


WebTree

public WebTree(java.lang.Object[] value)
Constructs tree with model based on specified values.

Parameters:
value - tree data

WebTree

public WebTree(java.util.Vector<?> value)
Constructs tree with model based on specified values.

Parameters:
value - tree data

WebTree

public WebTree(java.util.Hashtable<?,?> value)
Constructs tree with model based on specified values.

Parameters:
value - tree data

WebTree

public WebTree(E root)
Constructs tree with model based on specified root node.

Parameters:
root - tree root node

WebTree

public WebTree(E root,
               boolean asksAllowsChildren)
Constructs tree with model based on specified root node and which decides whether a node is a leaf node in the specified manner.

Parameters:
root - tree root node
asksAllowsChildren - false if any node can have children, true if each node is asked to see if it can have children

WebTree

public WebTree(javax.swing.tree.TreeModel newModel)
Constructs tree with specified model.

Parameters:
newModel - tree model
Method Detail

init

protected void init()
Initializes additional tree settings.


setCellEditor

public void setCellEditor(javax.swing.tree.TreeCellEditor cellEditor)

Overrides:
setCellEditor in class javax.swing.JTree

addCellEditorListener

public void addCellEditorListener(javax.swing.event.CellEditorListener listener)
Adds tree cell editor listener. These listeners act separately from the cell editor and will be moved to new tree cell editor automatically on set.

Parameters:
listener - cell editor listener to add

getEditableStateProvider

public StateProvider<E> getEditableStateProvider()
Returns special state provider that can be set to check whether or not specific nodes are editable. By default this provider is not specified and simply ignored by the tree.

Returns:
special state provider that can be set to check whether or not specific nodes are editable

setEditableStateProvider

public void setEditableStateProvider(StateProvider<E> stateProvider)
Sets special state provider that can be set to check whether or not specific nodes are editable. You can provide null to disable this state check at all.

Parameters:
stateProvider - special state provider that can be set to check whether or not specific nodes are editable

isPathEditable

public boolean isPathEditable(javax.swing.tree.TreePath path)

Overrides:
isPathEditable in class javax.swing.JTree

isNodeEditable

public boolean isNodeEditable(E node)
Returns whether the specified tree node is editable or not. This method is an improved version of default JTree method isPathEditable.

Parameters:
node - node to check editable state for
Returns:
true if the specified tree node is editable, false otherwise
See Also:
isPathEditable(javax.swing.tree.TreePath)

getToolTipProvider

public ToolTipProvider<? extends WebTree> getToolTipProvider()
Returns custom WebLaF tooltip provider.

Returns:
custom WebLaF tooltip provider

setToolTipProvider

public void setToolTipProvider(ToolTipProvider<? extends WebTree> provider)
Sets custom WebLaF tooltip provider.

Parameters:
provider - custom WebLaF tooltip provider

removeCellEditorListener

public void removeCellEditorListener(javax.swing.event.CellEditorListener listener)
Removes tree cell editor listener.

Parameters:
listener - cell editor listener to remove

expandRoot

public void expandRoot()
Expands the root path, assuming the current TreeModel has been set.


expandAll

public void expandAll()
Expands all tree nodes in a single call. It is not recommended to expand large trees this way since that might cause huge interface lags.


expandAll

public void expandAll(Filter<E> shouldExpand)
Expands all tree nodes accepted by filter in a single call. It is not recommended to expand large trees this way since that might cause huge interface lags.

Parameters:
shouldExpand - expand filter

expandAll

public void expandAll(E node)
Expands all child nodes of the specified node.

Parameters:
node - node to expand

expandAll

public void expandAll(E node,
                      Filter<E> shouldExpand)
Expands all child nodes accepted by filter in a single call.

Parameters:
node - node to expand
shouldExpand - expand filter

expandAll

public void expandAll(int depth)
Expands all child nodes until the specified structure depth is reached. Depth == 1 will force tree to expand all nodes under the root.

Parameters:
depth - max structure depth to be expanded

expandNode

public void expandNode(E node)
Expands the specified node.

Parameters:
node - node to expand

isExpanded

public boolean isExpanded(E node)
Returns whether node is expanded or not.

Parameters:
node - node to check
Returns:
true if node is expanded, false otherwise

getSelectedNodeBounds

public java.awt.Rectangle getSelectedNodeBounds()
Returns selected node bounds.

Returns:
selected node bounds

getNodeBounds

public java.awt.Rectangle getNodeBounds(E node)
Returns node bounds.

Parameters:
node - node to process
Returns:
node bounds

getNodeBounds

public java.awt.Rectangle getNodeBounds(java.util.List<E> nodes)
Returns nodes combined bounds.

Parameters:
nodes - nodes to process
Returns:
nodes combined bounds

getFullRowBounds

public java.awt.Rectangle getFullRowBounds(E node)
Returns full row bounds including the space before the node and after the node.

Parameters:
node - node to retrieve full row bounds for
Returns:
full row bounds including the space before the node and after the node

getFullRowBounds

public java.awt.Rectangle getFullRowBounds(int row)
Returns full row bounds including the space before the node and after the node.

Parameters:
row - row to retrieve full bounds for
Returns:
full row bounds including the space before the node and after the node

getRowForNode

public int getRowForNode(E node)
Returns row of the specified node.

Parameters:
node - node to find row for
Returns:
row of the specified node

getNodeForRow

public E getNodeForRow(int row)
Returns tree node for the specified row.

Parameters:
row - row to process
Returns:
tree node for the specified row

getPathForNode

public javax.swing.tree.TreePath getPathForNode(E node)
Returns tree path for specified node.

Parameters:
node - node to process
Returns:
tree path

getNodeForPath

public E getNodeForPath(javax.swing.tree.TreePath path)
Returns tree node for specified path.

Parameters:
path - path to process
Returns:
tree node for specified path

getNodeForLocation

public E getNodeForLocation(java.awt.Point location)
Returns tree node for the specified location.

Parameters:
location - location to process
Returns:
tree node for the specified location

getNodeForLocation

public E getNodeForLocation(int x,
                            int y)
Returns tree node for the specified location.

Parameters:
x - location X coordinate
y - location Y coordinate
Returns:
tree node for the specified location

getPathForLocation

public javax.swing.tree.TreePath getPathForLocation(java.awt.Point location)
Returns the path for the node at the specified location.

Parameters:
location - location to process
Returns:
the TreePath for the node at that location

getClosestNodeForLocation

public E getClosestNodeForLocation(java.awt.Point location)
Returns closest tree node for the specified location.

Parameters:
location - location to process
Returns:
tree node for the specified location

getClosestNodeForLocation

public E getClosestNodeForLocation(int x,
                                   int y)
Returns closest tree node for the specified location.

Parameters:
x - location X coordinate
y - location Y coordinate
Returns:
tree node for the specified location

getClosestPathForLocation

public javax.swing.tree.TreePath getClosestPathForLocation(java.awt.Point location)
Returns the path to the node that is closest to the specified location.

Parameters:
location - location to process
Returns:
the TreePath for the node closest to that location, null if nothing is viewable or there is no model

isSelected

public boolean isSelected(E node)
Returns whether specified node is selected or not.

Parameters:
node - node to check
Returns:
true if specified node is selected, false otherwise

getSelectedNode

public E getSelectedNode()
Returns selected node.

Returns:
selected node

getSelectedNodes

public java.util.List<E> getSelectedNodes()
Returns selected nodes.

Returns:
selected nodes

getVisibleSelectedNodes

public java.util.List<E> getVisibleSelectedNodes()
Returns only selected nodes which are currently visible in tree area. This will include nodes which are fully and partially visible in tree area.

Returns:
selected nodes which are currently visible in tree area

selectNodeUnderPoint

public void selectNodeUnderPoint(java.awt.Point point)
Selects node under the specified point.

Parameters:
point - point to look for node

selectNodeUnderPoint

public void selectNodeUnderPoint(int x,
                                 int y)
Selects node under the specified point.

Parameters:
x - point X coordinate
y - point Y coordinate

setSelectedNode

public void setSelectedNode(E node)
Sets selected nodes.


setSelectedNodes

public void setSelectedNodes(java.util.List<E> nodes)
Sets selected nodes.


setSelectedNodes

public void setSelectedNodes(E[] nodes)
Sets selected nodes.


getFirstVisibleLeafNode

public E getFirstVisibleLeafNode()
Returns first visible leaf node from the top of the tree. This doesn't include nodes under collapsed paths but does include nodes which are not in visible rect.

Returns:
first visible leaf node from the top of the tree

selectFirstVisibleLeafNode

public void selectFirstVisibleLeafNode()
Selects first visible leaf node from the top of the tree.


selectNextRow

public void selectNextRow()
Selects row next to currently selected. First row will be selected if none or last row was selected.


selectNextRow

public void selectNextRow(boolean cycle)
Selects row next to currently selected. First row will be selected if none was selected. First row will be selected if last row was selected and cycling is allowed.


selectPreviousRow

public void selectPreviousRow()
Selects row next to currently selected. Last row will be selected if none or first row was selected.


selectPreviousRow

public void selectPreviousRow(boolean cycle)
Selects row previous to currently selected. Last row will be selected if none or last was selected. Last row will be selected if first row was selected and cycling is allowed.


getRootNode

public E getRootNode()
Returns tree root node.

Returns:
tree root node

getAllNodes

public java.util.List<E> getAllNodes()
Returns list of all nodes added into the tree.

Returns:
list of all nodes added into the tree

setSelectionMode

public void setSelectionMode(int mode)
Sets tree selection mode.

Parameters:
mode - tree selection mode

setMultiplySelectionAllowed

public void setMultiplySelectionAllowed(boolean allowed)
Sets whether multiply nodes selection allowed or not. This call simply changes selection mode according to provided value.

Parameters:
allowed - whether multiply nodes selection allowed or not

isScrollToSelection

public boolean isScrollToSelection()
Returns whether tree automatically scrolls to selection or not.

Returns:
true if tree automatically scrolls to selection, false otherwise

setScrollToSelection

public void setScrollToSelection(boolean scroll)
Sets whether tree should automatically scroll to selection or not.

Parameters:
scroll - whether tree should automatically scroll to selection or not

scrollToStart

public void scrollToStart()
Scrolls tree view to the beginning of the tree.


scrollToSelection

public void scrollToSelection()
Scrolls tree view to selected nodes.


scrollToNode

public void scrollToNode(E node)
Scrolls tree view to specified node.

Parameters:
node - node to scroll to

startEditingSelectedNode

public void startEditingSelectedNode()
Starts editing selected tree node.


startEditingNode

public void startEditingNode(E node)
Starts editing the specified node.

Parameters:
node - tree node to edit

updateAllVisibleNodes

public void updateAllVisibleNodes()
Updates all visible nodes. This might be used to update node sizes if renderer has changed.


getTreeState

public TreeState getTreeState()
Returns tree expansion and selection states. Tree nodes must be instances of UniqueNode class.

Returns:
tree expansion and selection states

getTreeState

public TreeState getTreeState(boolean saveSelection)
Returns tree expansion and selection states. Tree nodes must be instances of UniqueNode class.

Parameters:
saveSelection - whether to save selection states or not
Returns:
tree expansion and selection states

setTreeState

public void setTreeState(TreeState treeState)
Restores tree expansion and selection states. Tree nodes must be instances of UniqueNode class.

Parameters:
treeState - tree expansion and selection states

setTreeState

public void setTreeState(TreeState treeState,
                         boolean restoreSelection)
Restores tree expansion and selection states. Tree nodes must be instances of UniqueNode class.

Parameters:
treeState - tree expansion and selection states
restoreSelection - whether to restore selection states or not

isAutoExpandSelectedNode

public boolean isAutoExpandSelectedNode()
Returns whether tree should auto-expand nodes on selection or not.

Returns:
true if tree should auto-expand nodes on selection, false otherwise

setAutoExpandSelectedNode

public void setAutoExpandSelectedNode(boolean autoExpand)
Sets whether tree should auto-expand nodes on selection or not.

Parameters:
autoExpand - whether tree should auto-expand nodes on selection or not

isAutoExpandSingleChildNode

public boolean isAutoExpandSingleChildNode()
Returns whether tree should auto-expand single child nodes or not. If set to true when any node is expanded and there is only one single child node in it - it will be automatically expanded.

Returns:
true if tree should auto-expand single child nodes, false otherwise

setAutoExpandSingleChildNode

public void setAutoExpandSingleChildNode(boolean autoExpand)
Sets whether tree should auto-expand single child nodes or not. If set to true when any node is expanded and there is only one single child node in it - it will be automatically expanded.

Parameters:
autoExpand - whether tree should auto-expand single child nodes or not

isRolloverSelectionEnabled

public boolean isRolloverSelectionEnabled()
Returns whether rollover selection is enabled for this list or not.

Returns:
true if rollover selection is enabled for this list, false otherwise

setRolloverSelectionEnabled

public void setRolloverSelectionEnabled(boolean enabled)
Sets whether rollover selection is enabled for this list or not.

Parameters:
enabled - whether rollover selection is enabled for this list or not

isHighlightRolloverNode

public boolean isHighlightRolloverNode()
Returns whether tree should highlight rollover node or not.

Returns:
true if tree should highlight rollover, false otherwise

setHighlightRolloverNode

public void setHighlightRolloverNode(boolean highlight)
Sets whether tree should highlight rollover node or not.

Parameters:
highlight - whether tree should highlight rollover node or not

isPaintLines

public boolean isPaintLines()
Returns whether tree should paint structure lines or not.

Returns:
true if tree should paint structure lines, false otherwise

setPaintLines

public void setPaintLines(boolean paint)
Sets whether tree should paint structure lines or not.

Parameters:
paint - whether tree should paint structure lines or not

getLinesColor

public java.awt.Color getLinesColor()
Returns tree structure lines color.

Returns:
tree structure lines color

setLinesColor

public void setLinesColor(java.awt.Color color)
Sets tree structure lines color.

Parameters:
color - tree structure lines color

getSelectionStyle

public TreeSelectionStyle getSelectionStyle()
Returns tree selection style.

Returns:
tree selection style

setSelectionStyle

public void setSelectionStyle(TreeSelectionStyle style)
Sets tree selection style.

Parameters:
style - tree selection style

getSelectionRound

public int getSelectionRound()
Returns tree selection rounding.

Returns:
tree selection rounding

setSelectionRound

public void setSelectionRound(int round)
Sets tree selection rounding.

Parameters:
round - tree selection rounding

getSelectionShadeWidth

public int getSelectionShadeWidth()
Returns tree selection shade width.

Returns:
tree selection shade width

setSelectionShadeWidth

public void setSelectionShadeWidth(int shadeWidth)
Sets tree selection shade width.

Parameters:
shadeWidth - tree selection shade width

isSelectorEnabled

public boolean isSelectorEnabled()
Returns whether selector is enabled or not.

Returns:
true if selector is enabled, false otherwise

setSelectorEnabled

public void setSelectorEnabled(boolean enabled)
Sets whether selector is enabled or not.

Parameters:
enabled - whether selector is enabled or not

getSelectorColor

public java.awt.Color getSelectorColor()
Returns selector color.

Returns:
selector color

setSelectorColor

public void setSelectorColor(java.awt.Color color)
Sets selector color.

Parameters:
color - selector color

getSelectorBorderColor

public java.awt.Color getSelectorBorderColor()
Returns selector border color.

Returns:
selector border color

setSelectorBorderColor

public void setSelectorBorderColor(java.awt.Color color)
Sets selector border color.

Parameters:
color - selector border color

getSelectorRound

public int getSelectorRound()
Returns selector rounding.

Returns:
selector rounding

setSelectorRound

public void setSelectorRound(int round)
Sets selector rounding.

Parameters:
round - selector rounding

getSelectorStroke

public java.awt.BasicStroke getSelectorStroke()
Returns selector border stroke.

Returns:
selector border stroke

setSelectorStroke

public void setSelectorStroke(java.awt.BasicStroke stroke)
Sets selector border stroke.

Parameters:
stroke - selector border stroke

isWebColoredSelection

public boolean isWebColoredSelection()
Returns whether selection should be web-colored or not. In case it is not web-colored selectionBackgroundColor value will be used as background color.

Returns:
true if selection should be web-colored, false otherwise

setWebColoredSelection

public void setWebColoredSelection(boolean webColored)
Sets whether selection should be web-colored or not. In case it is not web-colored selectionBackgroundColor value will be used as background color.

Parameters:
webColored - whether selection should be web-colored or not

getSelectionBorderColor

public java.awt.Color getSelectionBorderColor()
Returns selection border color.

Returns:
selection border color

setSelectionBorderColor

public void setSelectionBorderColor(java.awt.Color color)
Sets selection border color.

Parameters:
color - selection border color

getSelectionBackgroundColor

public java.awt.Color getSelectionBackgroundColor()
Returns selection background color. It is used only when webColoredSelection is set to false.

Returns:
selection background color

setSelectionBackgroundColor

public void setSelectionBackgroundColor(java.awt.Color color)
Sets selection background color. It is used only when webColoredSelection is set to false.

Parameters:
color - selection background color

getDropCellShadeWidth

public int getDropCellShadeWidth()
Returns drop cell highlight shade width.

Returns:
drop cell highlight shade width

setDropCellShadeWidth

public void setDropCellShadeWidth(int dropCellShadeWidth)
Sets drop cell highlight shade width.

Parameters:
dropCellShadeWidth - new drop cell highlight shade width

getWebUI

public WebTreeUI getWebUI()
Returns Web-UI applied to this class.

Returns:
Web-UI applied to this class

updateUI

public void updateUI()
Installs a Web-UI into this component.

Overrides:
updateUI in class javax.swing.JTree

repaint

public void repaint(int row)
Repaints specified tree row.

Parameters:
row - row index

repaint

public void repaint(int from,
                    int to)
Repaints all tree rows in specified range.

Parameters:
from - first row index
to - last row index

repaint

public void repaint(E node)
Repaints specified node.

Parameters:
node - node to repaint

repaint

public void repaint(java.util.List<E> nodes)
Repaints specified node.

Parameters:
nodes - nodes to repaint

getCellRendererPane

public javax.swing.CellRendererPane getCellRendererPane()
Returns tree cell renderer pane.

Returns:
tree cell renderer pane

onMousePress

public java.awt.event.MouseAdapter onMousePress(MouseEventRunnable runnable)
Shortcut method for mouse press event.

Specified by:
onMousePress in interface EventMethods
Parameters:
runnable - mouse event runnable
Returns:
used mouse adapter

onMousePress

public java.awt.event.MouseAdapter onMousePress(MouseButton mouseButton,
                                                MouseEventRunnable runnable)
Shortcut method for mouse press event.

Specified by:
onMousePress in interface EventMethods
Parameters:
mouseButton - mouse button filter
runnable - mouse event runnable
Returns:
used mouse adapter

onMouseEnter

public java.awt.event.MouseAdapter onMouseEnter(MouseEventRunnable runnable)
Shortcut method for mouse enter event.

Specified by:
onMouseEnter in interface EventMethods
Parameters:
runnable - mouse event runnable
Returns:
used mouse adapter

onMouseExit

public java.awt.event.MouseAdapter onMouseExit(MouseEventRunnable runnable)
Shortcut method for mouse exit event.

Specified by:
onMouseExit in interface EventMethods
Parameters:
runnable - mouse event runnable
Returns:
used mouse adapter

onMouseDrag

public java.awt.event.MouseAdapter onMouseDrag(MouseEventRunnable runnable)
Shortcut method for mouse drag event.

Specified by:
onMouseDrag in interface EventMethods
Parameters:
runnable - mouse event runnable
Returns:
used mouse adapter

onMouseDrag

public java.awt.event.MouseAdapter onMouseDrag(MouseButton mouseButton,
                                               MouseEventRunnable runnable)
Shortcut method for mouse drag event.

Specified by:
onMouseDrag in interface EventMethods
Parameters:
mouseButton - mouse button filter
runnable - mouse event runnable
Returns:
used mouse adapter

onMouseClick

public java.awt.event.MouseAdapter onMouseClick(MouseEventRunnable runnable)
Shortcut method for mouse click event.

Specified by:
onMouseClick in interface EventMethods
Parameters:
runnable - mouse event runnable
Returns:
used mouse adapter

onMouseClick

public java.awt.event.MouseAdapter onMouseClick(MouseButton mouseButton,
                                                MouseEventRunnable runnable)
Shortcut method for mouse click event.

Specified by:
onMouseClick in interface EventMethods
Parameters:
mouseButton - mouse button filter
runnable - mouse event runnable
Returns:
used mouse adapter

onDoubleClick

public java.awt.event.MouseAdapter onDoubleClick(MouseEventRunnable runnable)
Shortcut method for double-click mouse event.

Specified by:
onDoubleClick in interface EventMethods
Parameters:
runnable - mouse event runnable
Returns:
used mouse adapter

onMenuTrigger

public java.awt.event.MouseAdapter onMenuTrigger(MouseEventRunnable runnable)
Shortcut method for mouse event triggering popup menu.

Specified by:
onMenuTrigger in interface EventMethods
Parameters:
runnable - mouse event runnable
Returns:
used mouse adapter

onKeyType

public java.awt.event.KeyAdapter onKeyType(KeyEventRunnable runnable)
Shortcut method for key type event.

Specified by:
onKeyType in interface EventMethods
Parameters:
runnable - key event runnable
Returns:
used key adapter

onKeyType

public java.awt.event.KeyAdapter onKeyType(HotkeyData hotkey,
                                           KeyEventRunnable runnable)
Shortcut method for key type event.

Specified by:
onKeyType in interface EventMethods
Parameters:
hotkey - hotkey filter
runnable - key event runnable
Returns:
used key adapter

onKeyPress

public java.awt.event.KeyAdapter onKeyPress(KeyEventRunnable runnable)
Shortcut method for key press event.

Specified by:
onKeyPress in interface EventMethods
Parameters:
runnable - key event runnable
Returns:
used key adapter

onKeyPress

public java.awt.event.KeyAdapter onKeyPress(HotkeyData hotkey,
                                            KeyEventRunnable runnable)
Shortcut method for key press event.

Specified by:
onKeyPress in interface EventMethods
Parameters:
hotkey - hotkey filter
runnable - key event runnable
Returns:
used key adapter

onKeyRelease

public java.awt.event.KeyAdapter onKeyRelease(KeyEventRunnable runnable)
Shortcut method for key release event.

Specified by:
onKeyRelease in interface EventMethods
Parameters:
runnable - key event runnable
Returns:
used key adapter

onKeyRelease

public java.awt.event.KeyAdapter onKeyRelease(HotkeyData hotkey,
                                              KeyEventRunnable runnable)
Shortcut method for key release event.

Specified by:
onKeyRelease in interface EventMethods
Parameters:
hotkey - hotkey filter
runnable - key event runnable
Returns:
used key adapter

onFocusGain

public java.awt.event.FocusAdapter onFocusGain(FocusEventRunnable runnable)
Shortcut method for focus gain event.

Specified by:
onFocusGain in interface EventMethods
Parameters:
runnable - focus event runnable
Returns:
used focus adapter

onFocusLoss

public java.awt.event.FocusAdapter onFocusLoss(FocusEventRunnable runnable)
Shortcut method for focus loss event.

Specified by:
onFocusLoss in interface EventMethods
Parameters:
runnable - focus event runnable
Returns:
used focus adapter

registerSettings

public void registerSettings(java.lang.String key)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
key - component settings key

registerSettings

public <V extends DefaultValue> void registerSettings(java.lang.String key,
                                                      java.lang.Class<V> defaultValueClass)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Type Parameters:
V - default value type
Parameters:
key - component settings key
defaultValueClass - component default value class
See Also:
DefaultValue

registerSettings

public void registerSettings(java.lang.String key,
                             java.lang.Object defaultValue)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
key - component settings key
defaultValue - component default value

registerSettings

public void registerSettings(java.lang.String group,
                             java.lang.String key)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
group - component settings group
key - component settings key

registerSettings

public <V extends DefaultValue> void registerSettings(java.lang.String group,
                                                      java.lang.String key,
                                                      java.lang.Class<V> defaultValueClass)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Type Parameters:
V - default value type
Parameters:
group - component settings group
key - component settings key
defaultValueClass - component default value class
See Also:
DefaultValue

registerSettings

public void registerSettings(java.lang.String group,
                             java.lang.String key,
                             java.lang.Object defaultValue)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
group - component settings group
key - component settings key
defaultValue - component default value

registerSettings

public void registerSettings(java.lang.String key,
                             boolean loadInitialSettings,
                             boolean applySettingsChanges)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
key - component settings key
loadInitialSettings - whether to load initial available settings into the component or not
applySettingsChanges - whether to apply settings changes to the component or not

registerSettings

public <V extends DefaultValue> void registerSettings(java.lang.String key,
                                                      java.lang.Class<V> defaultValueClass,
                                                      boolean loadInitialSettings,
                                                      boolean applySettingsChanges)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Type Parameters:
V - default value type
Parameters:
key - component settings key
defaultValueClass - component default value class
loadInitialSettings - whether to load initial available settings into the component or not
applySettingsChanges - whether to apply settings changes to the component or not
See Also:
DefaultValue

registerSettings

public void registerSettings(java.lang.String key,
                             java.lang.Object defaultValue,
                             boolean loadInitialSettings,
                             boolean applySettingsChanges)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
key - component settings key
defaultValue - component default value
loadInitialSettings - whether to load initial available settings into the component or not
applySettingsChanges - whether to apply settings changes to the component or not

registerSettings

public <V extends DefaultValue> void registerSettings(java.lang.String group,
                                                      java.lang.String key,
                                                      java.lang.Class<V> defaultValueClass,
                                                      boolean loadInitialSettings,
                                                      boolean applySettingsChanges)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Type Parameters:
V - default value type
Parameters:
group - component settings group
key - component settings key
defaultValueClass - component default value class
loadInitialSettings - whether to load initial available settings into the component or not
applySettingsChanges - whether to apply settings changes to the component or not
See Also:
DefaultValue

registerSettings

public void registerSettings(java.lang.String group,
                             java.lang.String key,
                             java.lang.Object defaultValue,
                             boolean loadInitialSettings,
                             boolean applySettingsChanges)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
group - component settings group
key - component settings key
defaultValue - component default value
loadInitialSettings - whether to load initial available settings into the component or not
applySettingsChanges - whether to apply settings changes to the component or not

registerSettings

public void registerSettings(SettingsProcessor settingsProcessor)
Registers component for settings auto-save.

Also registered component will be: - listened for settings changes to save them when requested - automatically updated with any loaded settings for that key if requested - automatically updated with any changes made in its settings if requested

Specified by:
registerSettings in interface SettingsMethods
Parameters:
settingsProcessor - component settings processor

unregisterSettings

public void unregisterSettings()
Unregisters component from settings auto-save.

Specified by:
unregisterSettings in interface SettingsMethods

loadSettings

public void loadSettings()
Loads saved settings into the component if it is registered.

Specified by:
loadSettings in interface SettingsMethods

saveSettings

public void saveSettings()
Saves component settings.

Specified by:
saveSettings in interface SettingsMethods

setPlainFont

public WebTree<E> setPlainFont()
Sets plain font for the component.

Specified by:
setPlainFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
modified component

setPlainFont

public WebTree<E> setPlainFont(boolean apply)
Sets plain font for the component.

Specified by:
setPlainFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
apply - whether to apply font changes or not
Returns:
modified component

isPlainFont

public boolean isPlainFont()
Returns whether component font is plain or not.

Specified by:
isPlainFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
true if component font is plain, false otherwise

setBoldFont

public WebTree<E> setBoldFont()
Sets bold font for the component.

Specified by:
setBoldFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
modified component

setBoldFont

public WebTree<E> setBoldFont(boolean apply)
Sets bold font for the component.

Specified by:
setBoldFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
apply - whether to apply font changes or not
Returns:
modified component

isBoldFont

public boolean isBoldFont()
Returns whether component font is bold or not.

Specified by:
isBoldFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
true if component font is bold, false otherwise

setItalicFont

public WebTree<E> setItalicFont()
Sets italic or plain font for the component.

Specified by:
setItalicFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
modified component

setItalicFont

public WebTree<E> setItalicFont(boolean apply)
Sets italic or plain font for the component.

Specified by:
setItalicFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
apply - whether to apply font changes or not
Returns:
modified component

isItalicFont

public boolean isItalicFont()
Returns whether component font is italic or not.

Specified by:
isItalicFont in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
true if component font is italic, false otherwise

setFontStyle

public WebTree<E> setFontStyle(boolean bold,
                               boolean italic)
Sets component font style.

Specified by:
setFontStyle in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
bold - whether should set bold font or not
italic - whether should set italic font or not
Returns:
modified component

setFontStyle

public WebTree<E> setFontStyle(int style)
Sets component font style.

Specified by:
setFontStyle in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
style - new style
Returns:
modified component

setFontSize

public WebTree<E> setFontSize(int fontSize)
Sets component font size.

Specified by:
setFontSize in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
fontSize - font size
Returns:
modified component

changeFontSize

public WebTree<E> changeFontSize(int change)
Changes font size of the specified component.

Specified by:
changeFontSize in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
change - font size change amount
Returns:
modified component

getFontSize

public int getFontSize()
Returns component font size.

Specified by:
getFontSize in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
component font size

setFontSizeAndStyle

public WebTree<E> setFontSizeAndStyle(int fontSize,
                                      boolean bold,
                                      boolean italic)
Sets font size and style for the specified component.

Specified by:
setFontSizeAndStyle in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
fontSize - new font size
bold - whether should set bold font or not
italic - whether should set italic font or not
Returns:
modified component

setFontSizeAndStyle

public WebTree<E> setFontSizeAndStyle(int fontSize,
                                      int style)
Sets font size and style for the specified component.

Specified by:
setFontSizeAndStyle in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
fontSize - new font size
style - new style
Returns:
modified component

setFontName

public WebTree<E> setFontName(java.lang.String fontName)
Sets component font name.

Specified by:
setFontName in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
fontName - new font name
Returns:
modified component

getFontName

public java.lang.String getFontName()
Returns component font name.

Specified by:
getFontName in interface FontMethods<WebTree<E extends javax.swing.tree.DefaultMutableTreeNode>>
Returns:
component font name

createTreeModel

protected static javax.swing.tree.TreeModel createTreeModel(java.lang.Object value)
Returns a TreeModel wrapping the specified object. If the object is an array of Object, Hashtable or Vector then a new root node is created with each of the incoming objects as children. Otherwise, a new root is created with the specified object as its value.

Parameters:
value - Object used as the foundation for the TreeModel
Returns:
a TreeModel wrapping the specified object

getDefaultTreeModel

public static javax.swing.tree.TreeModel getDefaultTreeModel()
Creates and returns a sample TreeModel. Used primarily for beanbuilders to show something interesting.

Returns:
the default TreeModel