TreePanel

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openswing.swing.tree.client
Class TreePanel

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      org.openswing.swing.tree.client.TreePanel

All Implemented Interfaces:
  javax.accessibility.Accessible, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, SearchControl, java.io.Serializable

public class TreePanel
extends javax.swing.JPanel
implements java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, SearchControl

Title: OpenSwing Framework

Description: Panel that contains an expandable tree. Nodes may be dragged inside the tree if enabledDrag method is invoked.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Field Summary

Fields inherited from class javax.swing.JComponent
`TOOL_TIP_TEXT_KEY, 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
`TreePanel()` Constructor.

Method Summary
`void` | `addItemListener(java.awt.event.ItemListener listener)` Add an Item Listener to the tree, that listen for check-box selections.
`void` | `addKeyListener(java.awt.event.KeyListener listener)` Add a key listener to the tree.
`void` | `addMouseListener(java.awt.event.MouseListener listener)` Add a mouse listener to the tree.
`void` | `addNotify()`
`void` | `addPopupMenuItem(java.lang.String menuName, char mnemonic, boolean enabled, java.awt.event.ActionListener menuListener)` Add a pop-up menu item.
`void` | `addPopupMenuItem(java.lang.String menuName, java.lang.String parentMenuName, char mnemonic, boolean enabled, java.awt.event.ActionListener menuListener)` Add a pop-up menu item to a parent menu item.
`void` | `addPopupSeparator()` Add a separator to the pop-up menu.
`void` | `clearTree()` Remove all nodes (expept the root node) from the tree.
`void` | `collapseAllNodes()` Collapse all tree nodes.
`void` | `collapseNode(int index)` Collapse a tree node.
`boolean` | `disableListener()`
`void` | `dragDropEnd(java.awt.dnd.DragSourceDropEvent event)` This message goes to DragSourceListener, informing it that the dragging has ended.
`void` | `dragEnter(java.awt.dnd.DragSourceDragEvent event)` This message goes to DragSourceListener, informing it that the dragging has entered the DropSite
`void` | `dragEnter(java.awt.dnd.DropTargetDragEvent event)` This method is invoked when you are dragging over the DropSite.
`void` | `dragExit(java.awt.dnd.DragSourceEvent event)` This message goes to DragSourceListener, informing it that the dragging has exited the DropSite.
`void` | `dragExit(java.awt.dnd.DropTargetEvent event)` This method is invoked when you are exit the DropSite without dropping.
`void` | `dragOver(java.awt.dnd.DragSourceDragEvent e)` This message goes to DragSourceListener, informing it that the dragging is currently ocurring over the DropSite.
`void` | `dragOver(java.awt.dnd.DropTargetDragEvent event)` This method is invoked when a drag operation is going on.
`void` | `drop(java.awt.dnd.DropTargetDropEvent event)` This method is invoked when a drop event has occurred.
`void` | `dropActionChanged(java.awt.dnd.DragSourceDragEvent event)` This method is invoked when the user changes the dropAction.
`void` | `dropActionChanged(java.awt.dnd.DropTargetDragEvent event)` This method is invoked if the use modifies the current drop gesture.
`void` | `enableDrag(java.lang.String treeId, TreeDragNDropListener dndListener)` Enable drag onto the grid.
`void` | `expandAllNodes()` Expand all tree nodes.
`void` | `expandNode(int index)` Expand a tree node.
`java.util.HashSet` | `getCheckedLeaves()`
`java.util.HashSet` | `getCheckedNodes()`
`javax.swing.JComponent` | `getComponent()`
`java.awt.Cursor` | `getDragCursor()`
`java.lang.String` | `getFolderIconName()`
`java.lang.String` | `getIconAttributeName()`
`java.awt.event.ItemListener[]` | `getItemListeners()`
`java.lang.String` | `getLeavesImageName()`
`int` | `getRowCount()`
`int` | `getRowHeight()` Returns the height of each row.
`int` | `getSelectedIndex()`
`javax.swing.tree.DefaultMutableTreeNode` | `getSelectedNode()`
`java.awt.Color` | `getSelectionBackground()`
`java.awt.Color` | `getSelectionForeground()`
`int` | `getSelectionMode()` Returns the current selection mode, one of `TreeSelectionModel.SINGLE_TREE_SELECTION`, `TreeSelectionModel.CONTIGUOUS_TREE_SELECTION` or `TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION`.
`javax.swing.tree.TreePath` | `getSelectionPath()` Returns the path to the first selected node.
`javax.swing.tree.TreePath[]` | `getSelectionPaths()` Returns the paths of all selected values.
`int[]` | `getSelectionRows()` Returns all of the currently selected rows.
`boolean` | `getShowsRootHandles()` Returns the value of the `showsRootHandles` property.
`java.lang.String` | `getTooltipAttributeName()`
`javax.swing.JTree` | `getTree()`
`TreeController` | `getTreeController()`
`TreeDataLocator` | `getTreeDataLocator()`
`java.lang.String` | `getValueAt(int index)`
`boolean` | `isChanged()`
`boolean` | `isExpandAllNodes()`
`boolean` | `isExpandRoot()`
`boolean` | `isLoadWhenVisibile()`
`boolean` | `isReadOnly()` 1
`boolean` | `isRootVisible()` Returns true if the root node of the tree is displayed.
`boolean` | `isShowCheckBoxes()`
`boolean` | `isShowCheckBoxesOnLeaves()`
`void` | `reloadTree()` Force tree reloading.
`void` | `removeItemListener(java.awt.event.ItemListener listener)` Remove an ItemListener from the tree.
`void` | `removeKeyListener(java.awt.event.KeyListener listener)` Remove a key listener from the tree.
`void` | `removeMouseListener(java.awt.event.MouseListener listener)` Remove a mouse listener from the tree.
`void` | `repaintTree()` Redraw the tree.
`void` | `revalidateTree()` Revalidate tree content.
`void` | `scrollPathToVisible(javax.swing.tree.TreePath path)` Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed.
`void` | `scrollRowToVisible(int row)` Scrolls the item identified by row until it is displayed.
`int` | `search(java.lang.String textToSeach)` Method invoked by SearchWindowManager when the specified "textToSeach" pattern has not matchings in the current content of binded control.
`void` | `setCheckedNodes(java.util.HashSet checkedNodes)` Set current checked nodes (i.e. nodes having selected the associated check-box).
`void` | `setDragCursor(java.awt.Cursor dragCursor)` Set the cursor to show on dragging.
`void` | `setEnabled(boolean enabled)`
`void` | `setExpandAllNodes(boolean expandAllNodes)` Define if all tree nodes must be expanded after loading.
`void` | `setExpandRoot(boolean expandRoot)` Define if root node must be automatically expanded when "expandAllNodes" property is set to `false`; default value: `true`.
`void` | `setFolderIconName(java.lang.String folderIconName)` Set the folder icon name.
`void` | `setIconAttributeName(java.lang.String iconAttributeName)` Set the attribute name that contains the icon name; default value: null; if defined, this attribute overrides "folderIcon"/"leafIcon" values.
`void` | `setLeavesImageName(java.lang.String leavesImageName)` Set image icon used for leaves.
`void` | `setLoadWhenVisibile(boolean loadWhenVisibile)` Define if tree will be filled on viewing this panel.
`void` | `setMenuItemEnabled(java.lang.String menuName, boolean enabled)` Set menu item abilitation.
`void` | `setMenuItemVisible(java.lang.String menuName, boolean visible)` Set menu item visibility.
`void` | `setRootVisible(boolean rootVisible)` Determines whether or not the root node from the `TreeModel` is visible.
`void` | `setRowHeight(int rowHeight)` Sets the height of each cell, in pixels.
`void` | `setSelectedIndex(int index)` Set the selected index.
`void` | `setSelectedNode(javax.swing.tree.DefaultMutableTreeNode node)` Select a node in the tree.
`void` | `setSelectionBackground(java.awt.Color selectionBackground)` Set tree selection background color
`void` | `setSelectionForeground(java.awt.Color selectionForeground)` Set tree selection foreground color
`void` | `setSelectionMode(int selectionMode)` Sets the selection model, which must be one of TreeSelectionModel.SINGLE_TREE_SELECTION, TreeSelectionModel.CONTIGUOUS_TREE_SELECTION or TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION.
`void` | `setSelectionPath(javax.swing.tree.TreePath path)` Selects the node identified by the specified path.
`void` | `setSelectionPaths(javax.swing.tree.TreePath[] paths)` Selects the nodes identified by the specified array of paths.
`void` | `setSelectionRow(int row)` Selects the node at the specified row in the display.
`void` | `setSelectionRows(int[] rows)` Selects the nodes corresponding to each of the specified rows in the display.
`void` | `setShowCheckBoxes(boolean showCheckBoxes)` Define if a check-box must be showed for each node.
`void` | `setShowCheckBoxesOnLeaves(boolean showCheckBoxesOnLeaves)` Define if a check-box must be showed for leaves nodes too.
`void` | `setShowsRootHandles(boolean showsRootHandles)` Sets the value of the `showsRootHandles` property, which specifies whether the node handles should be displayed.
`void` | `setTooltipAttributeName(java.lang.String tooltipAttributeName)` Set the attribute name that contains the tool tip text for the node; default value: null.
`void` | `setTreeController(TreeController treeController)` Set the tree controller: it manages tree events.
`void` | `setTreeDataLocator(TreeDataLocator treeDataLocator)` Set the data source used to fill in the tree
`void` | `treeDoubleClick(java.awt.event.MouseEvent e, javax.swing.JTree tree)` Method called when user has double clicked.
`void` | `treeLeftClick(java.awt.event.MouseEvent e, javax.swing.JTree tree)` Method called when user has clicked on the left mouse button.
`void` | `treeRightClick(java.awt.event.MouseEvent e, javax.swing.JTree tree)` Method called when user has clicked on the right mouse button.

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, setUI, updateUI`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeMouseMotionListener, removeMouseWheelListener, 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
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TreePanel

    public TreePanel()

  Constructor.

Method Detail

### addNotify

    public void addNotify()

### reloadTree

    public final void reloadTree()

  Force tree reloading.

### expandNode

    public final void expandNode(int index)

  Expand a tree node.

  Parameters:
    `index` - index of node to expand

### collapseNode

    public final void collapseNode(int index)

  Collapse a tree node.

  Parameters:
    `index` - index of node to collapse

### expandAllNodes

    public final void expandAllNodes()

  Expand all tree nodes.

### collapseAllNodes

    public final void collapseAllNodes()

  Collapse all tree nodes.

### repaintTree

    public final void repaintTree()

  Redraw the tree. Used when the tree model has been modified.

### clearTree

    public final void clearTree()

  Remove all nodes (expept the root node) from the tree.

### getSelectedNode

    public final javax.swing.tree.DefaultMutableTreeNode getSelectedNode()

  Returns:
    selected node or null if no node is selected

### setSelectedNode

    public final void setSelectedNode(javax.swing.tree.DefaultMutableTreeNode node)

  Select a node in the tree.

  Parameters:
    `node` - tree node to select

### treeDoubleClick

    public final void treeDoubleClick(java.awt.event.MouseEvent e,
                                      javax.swing.JTree tree)

  Method called when user has double clicked.

  Parameters:
    `e` - double click event
    `tree` - tree

### treeLeftClick

    public final void treeLeftClick(java.awt.event.MouseEvent e,
                                    javax.swing.JTree tree)

  Method called when user has clicked on the left mouse button.

  Parameters:
    `e` - left mouse button click event
    `tree` - tree

### setEnabled

    public void setEnabled(boolean enabled)

### treeRightClick

    public final void treeRightClick(java.awt.event.MouseEvent e,
                                     javax.swing.JTree tree)

  Method called when user has clicked on the right mouse button.

  Parameters:
    `e` - right mouse button click event
    `tree` - tree

### addPopupMenuItem

    public final void addPopupMenuItem(java.lang.String menuName,
                                       char mnemonic,
                                       boolean enabled,
                                       java.awt.event.ActionListener menuListener)

  Add a pop-up menu item.

  Parameters:
    `menuName` - menu item description (not yet translated)
    `mnemonic` - mnemonic value
    `enabled` - flag used to set menu item abilitation
    `menuListener` - listener used to capture menu item selection

### addPopupMenuItem

    public final void addPopupMenuItem(java.lang.String menuName,
                                       java.lang.String parentMenuName,
                                       char mnemonic,
                                       boolean enabled,
                                       java.awt.event.ActionListener menuListener)

  Add a pop-up menu item to a parent menu item.

  Parameters:
    `menuName` - menu item description (not yet translated)
    `parentMenuName` -
    `mnemonic` - mnemonic value
    `enabled` - flag used to set menu item abilitation
    `menuListener` - listener used to capture menu item selection

### addPopupSeparator

    public final void addPopupSeparator()

  Add a separator to the pop-up menu.

### setMenuItemEnabled

    public final void setMenuItemEnabled(java.lang.String menuName,
                                         boolean enabled)

  Set menu item abilitation.

  Parameters:
    `menuName` - menu item description (not yet translated)
    `enabled` - flag used to enable the menu item

### setMenuItemVisible

    public final void setMenuItemVisible(java.lang.String menuName,
                                         boolean visible)

  Set menu item visibility.

  Parameters:
    `menuName` - menu item description (not yet translated)
    `visible` - flag used to hide/show the menu item

### getTreeController

    public final TreeController getTreeController()

  Returns:
    tree controller: it manages tree events

### getTreeDataLocator

    public final TreeDataLocator getTreeDataLocator()

  Returns:
    data source used to fill in the tree

### setTreeDataLocator

    public final void setTreeDataLocator(TreeDataLocator treeDataLocator)

  Set the data source used to fill in the tree

  Parameters:
    `treeDataLocator` - data source used to fill in the tree

### setTreeController

    public final void setTreeController(TreeController treeController)

  Set the tree controller: it manages tree events.

  Parameters:
    `treeController` - tree controller: it manages tree events.

### getLeavesImageName

    public final java.lang.String getLeavesImageName()

  Returns:
    image icon used for leaves

### setLeavesImageName

    public final void setLeavesImageName(java.lang.String leavesImageName)

  Set image icon used for leaves.

  Parameters:
    `leavesImageName` - image icon used for leaves

### isLoadWhenVisibile

    public final boolean isLoadWhenVisibile()

  Returns:
    define if tree will be filled on viewing this panel

### setLoadWhenVisibile

    public final void setLoadWhenVisibile(boolean loadWhenVisibile)

  Define if tree will be filled on viewing this panel.

  Parameters:
    `loadWhenVisibile` - define if tree will be filled on viewing this panel

### isExpandAllNodes

    public final boolean isExpandAllNodes()

  Returns:
    boolean define if all tree nodes must be expanded after loading

### setExpandAllNodes

    public final void setExpandAllNodes(boolean expandAllNodes)

  Define if all tree nodes must be expanded after loading.

  Parameters:
    `expandAllNodes` - boolean define if all tree nodes must be expanded after loading

### getFolderIconName

    public final java.lang.String getFolderIconName()

  Returns:
    folder icon name

### setFolderIconName

    public final void setFolderIconName(java.lang.String folderIconName)

  Set the folder icon name.

### getTree

    public final javax.swing.JTree getTree()

  Returns:
    tree

### enableDrag

    public final void enableDrag(java.lang.String treeId,
                                 TreeDragNDropListener dndListener)

  Enable drag onto the grid.

### dragEnter

    public final void dragEnter(java.awt.dnd.DragSourceDragEvent event)

  This message goes to DragSourceListener, informing it that the dragging has entered the DropSite

  Specified by:
    `dragEnter` in interface `java.awt.dnd.DragSourceListener`

### dragExit

    public final void dragExit(java.awt.dnd.DragSourceEvent event)

  This message goes to DragSourceListener, informing it that the dragging has exited the DropSite.

  Specified by:
    `dragExit` in interface `java.awt.dnd.DragSourceListener`

### dragOver

    public final void dragOver(java.awt.dnd.DragSourceDragEvent e)

  This message goes to DragSourceListener, informing it that the dragging is currently ocurring over the DropSite.

  Specified by:
    `dragOver` in interface `java.awt.dnd.DragSourceListener`

### dropActionChanged

    public final void dropActionChanged(java.awt.dnd.DragSourceDragEvent event)

  This method is invoked when the user changes the dropAction.

  Specified by:
    `dropActionChanged` in interface `java.awt.dnd.DragSourceListener`

### dragDropEnd

    public final void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)

  This message goes to DragSourceListener, informing it that the dragging has ended.

  Specified by:
    `dragDropEnd` in interface `java.awt.dnd.DragSourceListener`

### dragEnter

    public final void dragEnter(java.awt.dnd.DropTargetDragEvent event)

  This method is invoked when you are dragging over the DropSite.

  Specified by:
    `dragEnter` in interface `java.awt.dnd.DropTargetListener`

### dragExit

    public final void dragExit(java.awt.dnd.DropTargetEvent event)

  This method is invoked when you are exit the DropSite without dropping.

  Specified by:
    `dragExit` in interface `java.awt.dnd.DropTargetListener`

### dragOver

    public final void dragOver(java.awt.dnd.DropTargetDragEvent event)

  This method is invoked when a drag operation is going on.

  Specified by:
    `dragOver` in interface `java.awt.dnd.DropTargetListener`

### drop

    public final void drop(java.awt.dnd.DropTargetDropEvent event)

  This method is invoked when a drop event has occurred.

  Specified by:
    `drop` in interface `java.awt.dnd.DropTargetListener`

### dropActionChanged

    public final void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)

  This method is invoked if the use modifies the current drop gesture.

  Specified by:
    `dropActionChanged` in interface `java.awt.dnd.DropTargetListener`

### setIconAttributeName

    public final void setIconAttributeName(java.lang.String iconAttributeName)

  Set the attribute name that contains the icon name; default value: null; if defined, this attribute overrides "folderIcon"/"leafIcon" values.

  Parameters:
    `iconAttributeName` - attribute name that contains the icon name

### getIconAttributeName

    public final java.lang.String getIconAttributeName()

  Returns:
    attribute name that contains the icon name (optional)

### getTooltipAttributeName

    public final java.lang.String getTooltipAttributeName()

  Returns:
    attribute name that contains the tool tip text for the node

### setTooltipAttributeName

    public final void setTooltipAttributeName(java.lang.String tooltipAttributeName)

  Set the attribute name that contains the tool tip text for the node; default value: null.

  Parameters:
    `tooltipAttributeName` - attribute name that contains the tool tip text for the node

### getSelectedIndex

    public final int getSelectedIndex()

  Specified by:
    `getSelectedIndex` in interface `SearchControl`
  Returns:
    the selected index in the input control

### setSelectedIndex

    public final void setSelectedIndex(int index)

  Set the selected index.

  Specified by:
    `setSelectedIndex` in interface `SearchControl`

### getRowCount

    public final int getRowCount()

  Specified by:
    `getRowCount` in interface `SearchControl`
  Returns:
    total rows count in the input control

### getValueAt

    public final java.lang.String getValueAt(int index)

  Specified by:
    `getValueAt` in interface `SearchControl`
  Returns:
    the element at the specified index, converted in String format

### getComponent

    public final javax.swing.JComponent getComponent()

  Specified by:
    `getComponent` in interface `SearchControl`
  Returns:
    combo control

### isReadOnly

    public final boolean isReadOnly()

  1

  Specified by:
    `isReadOnly` in interface `SearchControl`
  Returns:
    `true` if the input control is in read only mode (so search is enabled), `false` otherwise

### disableListener

    public final boolean disableListener()

  Specified by:
    `disableListener` in interface `SearchControl`
  Returns:
    `true` to disable key listening on input control (for instance, in case of nested grids), `false` to listen for key events

### isRootVisible

    public final boolean isRootVisible()

  Returns true if the root node of the tree is displayed.

  Returns:
    true if the root node of the tree is displayed
  See Also:
    `#rootVisible`

### setRootVisible

    public final void setRootVisible(boolean rootVisible)

  Determines whether or not the root node from the `TreeModel` is visible.

  Parameters:
    `rootVisible` - true if the root node of the tree is to be displayed
  See Also:
    `#rootVisible`

### setSelectionMode

    public final void setSelectionMode(int selectionMode)

  Sets the selection model, which must be one of TreeSelectionModel.SINGLE_TREE_SELECTION, TreeSelectionModel.CONTIGUOUS_TREE_SELECTION or TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION.

  This may change the selection if the current selection is not valid for the new mode. For example, if three TreePaths are selected when the mode is changed to `TreeSelectionModel.SINGLE_TREE_SELECTION`, only one TreePath will remain selected. It is up to the particular implementation to decide what TreePath remains selected.

### getSelectionMode

    public final int getSelectionMode()

  Returns the current selection mode, one of `TreeSelectionModel.SINGLE_TREE_SELECTION`, `TreeSelectionModel.CONTIGUOUS_TREE_SELECTION` or `TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION`.

### setRowHeight

    public final void setRowHeight(int rowHeight)

  Sets the height of each cell, in pixels. If the specified value is less than or equal to zero the current cell renderer is queried for each row's height.

  Parameters:
    `rowHeight` - the height of each cell, in pixels

### getRowHeight

    public final int getRowHeight()

  Returns the height of each row. If the returned value is less than or equal to 0 the height for each row is determined by the renderer.

### setShowsRootHandles

    public final void setShowsRootHandles(boolean showsRootHandles)

  Sets the value of the `showsRootHandles` property, which specifies whether the node handles should be displayed. The default value of this property depends on the constructor used to create the `JTree`. Some look and feels might not support handles; they will ignore this property.

  See Also:
    `#showsRootHandles`, `getShowsRootHandles()`

### getShowsRootHandles

    public final boolean getShowsRootHandles()

  Returns the value of the `showsRootHandles` property.

  Returns:
    the value of the `showsRootHandles` property
  See Also:
    `#showsRootHandles`

### scrollRowToVisible

    public final void scrollRowToVisible(int row)

  Scrolls the item identified by row until it is displayed. The minimum of amount of scrolling necessary to bring the row into view is performed. Only works when this `JTree` is contained in a `JScrollPane`.

  Parameters:
    `row` - an integer specifying the row to scroll, where 0 is the first row in the display

### setSelectionRow

    public final void setSelectionRow(int row)

  Selects the node at the specified row in the display.

  Parameters:
    `row` - the row to select, where 0 is the first row in the display

### setSelectionRows

    public final void setSelectionRows(int[] rows)

  Selects the nodes corresponding to each of the specified rows in the display. If a particular element of `rows` is < 0 or >= `getRowCount`, it will be ignored. If none of the elements in `rows` are valid rows, the selection will be cleared. That is it will be as if `clearSelection` was invoked.

  Parameters:
    `rows` - an array of ints specifying the rows to select, where 0 indicates the first row in the display

### setSelectionPath

    public final void setSelectionPath(javax.swing.tree.TreePath path)

  Selects the node identified by the specified path. If any component of the path is hidden (under a collapsed node), and `getExpandsSelectedPaths` is true it is exposed (made viewable).

  Parameters:
    `path` - the `TreePath` specifying the node to select

### setSelectionPaths

    public final void setSelectionPaths(javax.swing.tree.TreePath[] paths)

  Selects the nodes identified by the specified array of paths. If any component in any of the paths is hidden (under a collapsed node), and `getExpandsSelectedPaths` is true it is exposed (made viewable).

  Parameters:
    `paths` - an array of `TreePath` objects that specifies the nodes to select

### scrollPathToVisible

    public final void scrollPathToVisible(javax.swing.tree.TreePath path)

  Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed. Only works when this `JTree` is contained in a `JScrollPane`.

  Parameters:
    `path` - the `TreePath` identifying the node to bring into view

### getSelectionPath

    public final javax.swing.tree.TreePath getSelectionPath()

  Returns the path to the first selected node.

  Returns:
    the `TreePath` for the first selected node, or `null` if nothing is currently selected

### getSelectionPaths

    public final javax.swing.tree.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

### getSelectionRows

    public final int[] getSelectionRows()

  Returns all of the currently selected rows. This method is simply forwarded to the `TreeSelectionModel`. If nothing is selected `null` or an empty array will be returned, based on the `TreeSelectionModel` implementation.

  Returns:
    an array of integers that identifies all currently selected rows where 0 is the first row in the display

### setSelectionBackground

    public final void setSelectionBackground(java.awt.Color selectionBackground)

  Set tree selection background color

  Parameters:
    `selectionBackground` - tree selection background color

### setSelectionForeground

    public final void setSelectionForeground(java.awt.Color selectionForeground)

  Set tree selection foreground color

  Parameters:
    `selectionForeground` - tree selection foreground color

### getSelectionBackground

    public final java.awt.Color getSelectionBackground()

  Returns:
    tree selection background color

### getSelectionForeground

    public final java.awt.Color getSelectionForeground()

  Returns:
    tree selection foreground color

### revalidateTree

    public final void revalidateTree()

  Revalidate tree content.

### addKeyListener

    public final void addKeyListener(java.awt.event.KeyListener listener)

  Add a key listener to the tree.

  Parameters:
    `listener` - KeyListener to add

### removeKeyListener

    public final void removeKeyListener(java.awt.event.KeyListener listener)

  Remove a key listener from the tree.

  Parameters:
    `listener` - KeyListener to remove

### addMouseListener

    public final void addMouseListener(java.awt.event.MouseListener listener)

  Add a mouse listener to the tree.

  Parameters:
    `listener` - MouseListener to add

### removeMouseListener

    public final void removeMouseListener(java.awt.event.MouseListener listener)

  Remove a mouse listener from the tree.

  Parameters:
    `listener` - MouseListener to remove

### addItemListener

    public final void addItemListener(java.awt.event.ItemListener listener)

  Add an Item Listener to the tree, that listen for check-box selections.

  Parameters:
    `listener` - ItemListener to add

### removeItemListener

    public final void removeItemListener(java.awt.event.ItemListener listener)

  Remove an ItemListener from the tree.

  Parameters:
    `listener` - ItemListener to remove

### getItemListeners

    public final java.awt.event.ItemListener[] getItemListeners()

  Returns:
    ItemListener objects added to this check-box tree

### isShowCheckBoxes

    public final boolean isShowCheckBoxes()

  Returns:
    define if a check-box must be showed for each node

### setShowCheckBoxes

    public final void setShowCheckBoxes(boolean showCheckBoxes)

  Define if a check-box must be showed for each node.

  Parameters:
    `showCheckBoxes` - define if a check-box must be showed for each node

### getCheckedNodes

    public final java.util.HashSet getCheckedNodes()

  Returns:
    current checked nodes (i.e. nodes having selected the associated check-box)

### setCheckedNodes

    public void setCheckedNodes(java.util.HashSet checkedNodes)

  Set current checked nodes (i.e. nodes having selected the associated check-box).

  Parameters:
    `checkedNodes` - current checked nodes (i.e. nodes having selected the associated check-box)

### isShowCheckBoxesOnLeaves

    public final boolean isShowCheckBoxesOnLeaves()

  Returns:
    define if a check-box must be showed for leaves nodes too

### setShowCheckBoxesOnLeaves

    public final void setShowCheckBoxesOnLeaves(boolean showCheckBoxesOnLeaves)

  Define if a check-box must be showed for leaves nodes too.

  Parameters:
    `showCheckBoxesOnLeaves` - define if a check-box must be showed for leaves nodes too

### getCheckedLeaves

    public final java.util.HashSet getCheckedLeaves()

  Returns:
    retrieve current leaves having their check-boxes selected

### isExpandRoot

    public final boolean isExpandRoot()

  Returns:
    define if root node must be automatically expanded when "expandAllNodes" property is set to `false`

### setExpandRoot

    public final void setExpandRoot(boolean expandRoot)

  Define if root node must be automatically expanded when "expandAllNodes" property is set to `false`; default value: `true`.

  Parameters:
    `expandRoot` - define if root node must be automatically expanded when "expandAllNodes" property is set to `false`

### isChanged

    public final boolean isChanged()

  Returns:
    mark the state "tree content changed"

### search

    public final int search(java.lang.String textToSeach)

  Method invoked by SearchWindowManager when the specified "textToSeach" pattern has not matchings in the current content of binded control. This callback can be used to retrieve additional data into control and to search inside new data.

  Specified by:
    `search` in interface `SearchControl`
  Parameters:
    `textToSeach` - patten of text to search
  Returns:
    -1 if no additional data is available, otherwise the row index of data just added that satify the pattern

### getDragCursor

    public final java.awt.Cursor getDragCursor()

  Returns:
    cursor to show on dragging

### setDragCursor

    public final void setDragCursor(java.awt.Cursor dragCursor)

  Set the cursor to show on dragging.

  Parameters:
    `dragCursor` - cursor to show on dragging

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD