- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TreeUI
-
- javax.swing.plaf.basic.BasicTreeUI
-
- util.ui.SingleAndDoubleClickTreeUI
-
- All Implemented Interfaces:
java.awt.event.MouseListener
,java.util.EventListener
public class SingleAndDoubleClickTreeUI extends javax.swing.plaf.basic.BasicTreeUI implements java.awt.event.MouseListener
A tree UI that expands paths for single and double click, but collapse paths only if current path is selected for single click or always for double click.- Since:
- 2.6
- Author:
- René Mach
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTreeUI
javax.swing.plaf.basic.BasicTreeUI.CellEditorHandler, javax.swing.plaf.basic.BasicTreeUI.ComponentHandler, javax.swing.plaf.basic.BasicTreeUI.FocusHandler, javax.swing.plaf.basic.BasicTreeUI.KeyHandler, javax.swing.plaf.basic.BasicTreeUI.MouseHandler, javax.swing.plaf.basic.BasicTreeUI.MouseInputHandler, javax.swing.plaf.basic.BasicTreeUI.NodeDimensionsHandler, javax.swing.plaf.basic.BasicTreeUI.PropertyChangeHandler, javax.swing.plaf.basic.BasicTreeUI.SelectionModelPropertyChangeHandler, javax.swing.plaf.basic.BasicTreeUI.TreeCancelEditingAction, javax.swing.plaf.basic.BasicTreeUI.TreeExpansionHandler, javax.swing.plaf.basic.BasicTreeUI.TreeHomeAction, javax.swing.plaf.basic.BasicTreeUI.TreeIncrementAction, javax.swing.plaf.basic.BasicTreeUI.TreeModelHandler, javax.swing.plaf.basic.BasicTreeUI.TreePageAction, javax.swing.plaf.basic.BasicTreeUI.TreeSelectionHandler, javax.swing.plaf.basic.BasicTreeUI.TreeToggleAction, javax.swing.plaf.basic.BasicTreeUI.TreeTraverseAction
-
-
Field Summary
Fields Modifier and Type Field Description static int
AUTO_COLLAPSE_EXPAND
Type for expand and automatically collapse other paths when expand other pathsstatic int
EXPAND_AND_COLLAPSE
Type for expand and collapse only on user clicks-
Fields inherited from class javax.swing.plaf.basic.BasicTreeUI
cellEditor, collapsedIcon, createdCellEditor, createdRenderer, currentCellRenderer, depthOffset, drawingCache, editingComponent, editingPath, editingRow, editorHasDifferentSize, expandedIcon, largeModel, lastSelectedRow, leftChildIndent, nodeDimensions, preferredMinSize, preferredSize, rendererPane, rightChildIndent, stopEditingInCompleteEditing, totalChildIndent, tree, treeModel, treeSelectionModel, treeState, validCachedPreferredSize
-
-
Constructor Summary
Constructors Constructor Description SingleAndDoubleClickTreeUI(int type, javax.swing.tree.TreePath selectedPath)
Creates an instance of this plugin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.event.MouseListener
createMouseListener()
javax.swing.Icon
getCollapsedIcon()
javax.swing.Icon
getExpandedIcon()
void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mousePressed(java.awt.event.MouseEvent e)
void
mouseReleased(java.awt.event.MouseEvent e)
protected void
paintHorizontalLine(java.awt.Graphics g, javax.swing.JComponent c, int y, int left, int right)
protected void
paintVerticalLine(java.awt.Graphics g, javax.swing.JComponent c, int x, int top, int bottom)
void
setLastSelectedPath(javax.swing.tree.TreePath path)
Sets the last selected path to the given one.-
Methods inherited from class javax.swing.plaf.basic.BasicTreeUI
cancelEditing, checkForClickInExpandControl, completeEditing, completeEditing, completeUIInstall, completeUIUninstall, configureLayoutCache, createCellEditorListener, createCellRendererPane, createComponentListener, createDefaultCellEditor, createDefaultCellRenderer, createFocusListener, createKeyListener, createLayoutCache, createNodeDimensions, createPropertyChangeListener, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, createTreeSelectionListener, createUI, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getDropLineRect, getEditingPath, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeadSelectionRow, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathBounds, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, isDropLine, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paint, paintDropLine, paintExpandControl, paintHorizontalPartOfLeg, paintRow, paintVerticalPartOfLeg, pathWasCollapsed, pathWasExpanded, prepareForUIInstall, prepareForUIUninstall, selectPathForEvent, setCellEditor, setCellRenderer, setCollapsedIcon, setEditable, setExpandedIcon, setHashColor, setLargeModel, setLeftChildIndent, setModel, setPreferredMinSize, setRightChildIndent, setRootVisible, setRowHeight, setSelectionModel, setShowsRootHandles, shouldPaintExpandControl, startEditing, startEditingAtPath, stopEditing, toggleExpandState, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateLeadSelectionRow, updateRenderer, updateSize
-
-
-
-
Field Detail
-
EXPAND_AND_COLLAPSE
public static final int EXPAND_AND_COLLAPSE
Type for expand and collapse only on user clicks- See Also:
- Constant Field Values
-
AUTO_COLLAPSE_EXPAND
public static final int AUTO_COLLAPSE_EXPAND
Type for expand and automatically collapse other paths when expand other paths- See Also:
- Constant Field Values
-
-
Method Detail
-
createMouseListener
protected java.awt.event.MouseListener createMouseListener()
- Overrides:
createMouseListener
in classjavax.swing.plaf.basic.BasicTreeUI
-
setLastSelectedPath
public void setLastSelectedPath(javax.swing.tree.TreePath path)
Sets the last selected path to the given one.- Parameters:
path
- The path to set.
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
paintHorizontalLine
protected void paintHorizontalLine(java.awt.Graphics g, javax.swing.JComponent c, int y, int left, int right)
- Overrides:
paintHorizontalLine
in classjavax.swing.plaf.basic.BasicTreeUI
-
paintVerticalLine
protected void paintVerticalLine(java.awt.Graphics g, javax.swing.JComponent c, int x, int top, int bottom)
- Overrides:
paintVerticalLine
in classjavax.swing.plaf.basic.BasicTreeUI
-
getCollapsedIcon
public javax.swing.Icon getCollapsedIcon()
- Overrides:
getCollapsedIcon
in classjavax.swing.plaf.basic.BasicTreeUI
-
getExpandedIcon
public javax.swing.Icon getExpandedIcon()
- Overrides:
getExpandedIcon
in classjavax.swing.plaf.basic.BasicTreeUI
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
-