com.levigo.util.swing.flextree
Class FlexibleTree

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.levigo.util.swing.flextree.FlexibleTree
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class FlexibleTree
extends JComponent
implements Accessible, Scrollable

See Also:
Serialized Form

Nested Class Summary
protected  class FlexibleTree.AccessilbeFlexibleTree
           
 
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 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
FlexibleTree()
           
 
Method Summary
 void addKeyListener(KeyListener l)
           
 void addModule(TreeModule module)
           
 void addSelectionPath(TreePath path)
           
 void addSelectionPaths(TreePath[] paths)
           
 void addTreeSelectionListener(TreeSelectionListener tsl)
           
 void clearSelection()
           
 void collapseAll()
          Collapses all nodes of this tree.
 void collapsePath(TreePath path)
           
 void collapseRoot()
           
 void expandAll()
          Expands all nodes in this tree.
 void expandLevel(int level)
          Expands all nodes of the passed level.
 void expandPath(TreePath path)
           
 void expandRoot()
           
 AccessibleContext getAccessibleContext()
           
protected  JTree getBackingTree()
           
 Object getInput()
           
 TreePath getLeadSelectionPath()
           
 Rectangle getPathBounds(TreePath path)
           
 TreePath getPathForLocation(int x, int y)
           
 Dimension getPreferredScrollableViewportSize()
           
 TreePath getRootPath()
           
 int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
           
 TreePath getSelectionPath()
           
 TreePath[] getSelectionPaths()
          Returns the paths of all selected values.
 EventList<TreeModule> getTreeModules()
           
<T extends TreeModule>
List<T>
getTreeModules(Class<T> type)
           
 void grabFocus()
           
 boolean isPathSelected(TreePath path)
           
 boolean isRootVisible()
           
 boolean isShowRootHandles()
           
protected  void processKeyEvent(KeyEvent e)
           
 void removeKeyListener(KeyListener l)
           
 void removeModule(TreeModule module)
           
 void removeSelectionPath(TreePath path)
           
 void removeSelectionPaths(TreePath[] paths)
           
 void removeTreeSelectionListener(TreeSelectionListener tsl)
           
 void requestFocus()
           
 boolean requestFocusInWindow()
           
 void scrollPathToVisible(TreePath path)
           
 void setInput(Object object)
           
 void setRootVisible(boolean rootVisible)
           
 void setSelectionPath(TreePath path)
           
 void setSelectionPaths(TreePath[] paths)
           
 void setShowRootHandles(boolean value)
           
 void startEditingAtPath(TreePath path)
           
 boolean stopEditing()
           
 
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, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, 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, updateUI
 
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, 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, 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
 

Constructor Detail

FlexibleTree

public FlexibleTree()
Method Detail

stopEditing

public boolean stopEditing()

startEditingAtPath

public void startEditingAtPath(TreePath path)

setRootVisible

public void setRootVisible(boolean rootVisible)

isRootVisible

public boolean isRootVisible()

setShowRootHandles

public void setShowRootHandles(boolean value)

isShowRootHandles

public boolean isShowRootHandles()

removeModule

public void removeModule(TreeModule module)

addModule

public void addModule(TreeModule module)

getInput

public Object getInput()

setInput

public void setInput(Object object)

addSelectionPath

public void addSelectionPath(TreePath path)

addSelectionPaths

public void addSelectionPaths(TreePath[] paths)

setSelectionPath

public void setSelectionPath(TreePath path)

getLeadSelectionPath

public TreePath getLeadSelectionPath()

getSelectionPath

public TreePath getSelectionPath()

getSelectionPaths

public TreePath[] getSelectionPaths()
Returns the paths of all selected values.

Returns:
an array of TreePath objects indicating the selected nodes, or null if nothing is currently selected

removeSelectionPath

public void removeSelectionPath(TreePath path)

removeSelectionPaths

public void removeSelectionPaths(TreePath[] paths)

scrollPathToVisible

public void scrollPathToVisible(TreePath path)
Parameters:
path -

addKeyListener

public void addKeyListener(KeyListener l)
Overrides:
addKeyListener in class Component

removeKeyListener

public void removeKeyListener(KeyListener l)
Overrides:
removeKeyListener in class Component

addTreeSelectionListener

public void addTreeSelectionListener(TreeSelectionListener tsl)

removeTreeSelectionListener

public void removeTreeSelectionListener(TreeSelectionListener tsl)

getTreeModules

public EventList<TreeModule> getTreeModules()

processKeyEvent

protected void processKeyEvent(KeyEvent e)
Overrides:
processKeyEvent in class JComponent

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent

grabFocus

public void grabFocus()
Overrides:
grabFocus in class JComponent

requestFocusInWindow

public boolean requestFocusInWindow()
Overrides:
requestFocusInWindow in class JComponent

getTreeModules

public <T extends TreeModule> List<T> getTreeModules(Class<T> type)

getAccessibleContext

public AccessibleContext getAccessibleContext()
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent

expandPath

public void expandPath(TreePath path)
Parameters:
path -
See Also:
JTree.expandPath(TreePath)

collapsePath

public void collapsePath(TreePath path)
Parameters:
path -
See Also:
JTree.collapsePath(TreePath)

expandRoot

public void expandRoot()

collapseRoot

public void collapseRoot()

expandAll

public void expandAll()
Expands all nodes in this tree. Use with caution, as opening a big tree maybe expensive.


collapseAll

public void collapseAll()
Collapses all nodes of this tree.
Since explicitly collapsing all subnodes, expanding the rootnode will react independently from the state before the collapse.


expandLevel

public void expandLevel(int level)
Expands all nodes of the passed level. Doesn't collapse already expanded nodes of a higher level. Level < 1 and Level > maximum level is silently ignored.

The level of a tree is defined as the number of parent nodes a tree node has. The root of the tree, therefore, is at level 0. Root's children are at level 1, etc. To be counted as a level, the level must have at least one non-null node. The maximum level of the tree is the last such level.

Parameters:
level -

clearSelection

public void clearSelection()

getPathForLocation

public TreePath getPathForLocation(int x,
                                   int y)

isPathSelected

public boolean isPathSelected(TreePath path)

getPathBounds

public Rectangle getPathBounds(TreePath path)

getBackingTree

protected JTree getBackingTree()

getRootPath

public TreePath getRootPath()

setSelectionPaths

public void setSelectionPaths(TreePath[] paths)

getPreferredScrollableViewportSize

public Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Specified by:
getScrollableUnitIncrement in interface Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Specified by:
getScrollableBlockIncrement in interface Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface Scrollable


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.