Package com.formdev.flatlaf.ui
Class FlatTreeUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TreeUI
-
- javax.swing.plaf.basic.BasicTreeUI
-
- com.formdev.flatlaf.ui.FlatTreeUI
-
- All Implemented Interfaces:
FlatStylingSupport.StyleableUI
public class FlatTreeUI extends javax.swing.plaf.basic.BasicTreeUI implements FlatStylingSupport.StyleableUI
Provides the Flat LaF UI delegate forJTree
.
-
-
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 private java.awt.Color
defaultCellNonSelectionBackground
private javax.swing.Icon
defaultClosedIcon
private javax.swing.Icon
defaultLeafIcon
private javax.swing.Icon
defaultOpenIcon
private java.awt.Color
defaultSelectionBackground
private java.awt.Color
defaultSelectionBorderColor
private java.awt.Color
defaultSelectionForeground
java.lang.String
iconArrowType
java.awt.Color
iconClosedColor
java.awt.Color
iconCollapsedColor
java.awt.Color
iconExpandedColor
java.awt.Color
iconLeafColor
java.awt.Color
iconOpenColor
private java.util.Map<java.lang.String,java.lang.Object>
oldStyleValues
private boolean
paintLines
protected boolean
paintSelection
protected int
selectionArc
protected java.awt.Color
selectionBackground
protected java.awt.Color
selectionBorderColor
protected java.awt.Color
selectionForeground
protected java.awt.Color
selectionInactiveBackground
protected java.awt.Color
selectionInactiveForeground
protected java.awt.Insets
selectionInsets
protected boolean
showCellFocusIndicator
protected boolean
showDefaultIcons
protected boolean
wideSelection
-
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 FlatTreeUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyStyle(java.lang.Object style)
protected java.lang.Object
applyStyleProperty(java.lang.String key, java.lang.Object value)
protected java.awt.event.MouseListener
createMouseListener()
protected java.beans.PropertyChangeListener
createPropertyChangeListener()
protected javax.swing.event.TreeSelectionListener
createTreeSelectionListener()
static javax.swing.plaf.ComponentUI
createUI(javax.swing.JComponent c)
protected java.awt.Rectangle
getDropLineRect(javax.swing.JTree.DropLocation loc)
java.awt.Rectangle
getPathBounds(javax.swing.JTree tree, javax.swing.tree.TreePath path)
java.util.Map<java.lang.String,java.lang.Class<?>>
getStyleableInfos(javax.swing.JComponent c)
java.lang.Object
getStyleableValue(javax.swing.JComponent c, java.lang.String key)
protected void
installDefaults()
protected void
installStyle()
void
installUI(javax.swing.JComponent c)
private boolean
isDropRow(int row)
Checks whether dropping on a row.protected boolean
isPaintSelection()
protected boolean
isWideSelection()
void
paint(java.awt.Graphics g, javax.swing.JComponent c)
private void
paintCellBackground(java.awt.Graphics g, java.awt.Component rendererComponent, java.awt.Rectangle bounds, int row, boolean paintSelection)
protected void
paintHorizontalLine(java.awt.Graphics g, javax.swing.JComponent c, int y, int left, int right)
protected void
paintRow(java.awt.Graphics g, java.awt.Rectangle clipBounds, java.awt.Insets insets, java.awt.Rectangle bounds, javax.swing.tree.TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
Similar to super.paintRow(), but supports wide selection and uses inactive selection background/foreground if tree is not focused.protected void
paintVerticalLine(java.awt.Graphics g, javax.swing.JComponent c, int x, int top, int bottom)
private void
paintWideSelection(java.awt.Graphics g, java.awt.Rectangle bounds, int row)
private void
repaintWideDropLocation(javax.swing.JTree.DropLocation loc)
private java.awt.Color
setRendererBackgroundSelectionColor(java.awt.Component rendererComponent, java.awt.Color color)
private java.awt.Color
setRendererBorderSelectionColor(java.awt.Component rendererComponent, java.awt.Color color)
private void
setRendererForeground(java.awt.Component rendererComponent, java.awt.Color color)
protected void
uninstallDefaults()
protected void
updateRenderer()
private boolean
useUnitedRoundedSelection()
-
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, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getEditingPath, getExpandedIcon, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeadSelectionRow, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installKeyboardActions, installListeners, isDropLine, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paintDropLine, paintExpandControl, paintHorizontalPartOfLeg, 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, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateLeadSelectionRow, updateSize
-
-
-
-
Field Detail
-
selectionBackground
protected java.awt.Color selectionBackground
-
selectionForeground
protected java.awt.Color selectionForeground
-
selectionInactiveBackground
protected java.awt.Color selectionInactiveBackground
-
selectionInactiveForeground
protected java.awt.Color selectionInactiveForeground
-
selectionBorderColor
protected java.awt.Color selectionBorderColor
-
selectionInsets
protected java.awt.Insets selectionInsets
- Since:
- 3
-
selectionArc
protected int selectionArc
- Since:
- 3
-
wideSelection
protected boolean wideSelection
-
showCellFocusIndicator
protected boolean showCellFocusIndicator
-
showDefaultIcons
protected boolean showDefaultIcons
- Since:
- 3
-
iconArrowType
public java.lang.String iconArrowType
- Since:
- 2
-
iconExpandedColor
public java.awt.Color iconExpandedColor
- Since:
- 2
-
iconCollapsedColor
public java.awt.Color iconCollapsedColor
- Since:
- 2
-
iconLeafColor
public java.awt.Color iconLeafColor
- Since:
- 2
-
iconClosedColor
public java.awt.Color iconClosedColor
- Since:
- 2
-
iconOpenColor
public java.awt.Color iconOpenColor
- Since:
- 2
-
paintSelection
protected boolean paintSelection
- Since:
- 2
-
defaultLeafIcon
private javax.swing.Icon defaultLeafIcon
-
defaultClosedIcon
private javax.swing.Icon defaultClosedIcon
-
defaultOpenIcon
private javax.swing.Icon defaultOpenIcon
-
paintLines
private boolean paintLines
-
defaultCellNonSelectionBackground
private java.awt.Color defaultCellNonSelectionBackground
-
defaultSelectionBackground
private java.awt.Color defaultSelectionBackground
-
defaultSelectionForeground
private java.awt.Color defaultSelectionForeground
-
defaultSelectionBorderColor
private java.awt.Color defaultSelectionBorderColor
-
oldStyleValues
private java.util.Map<java.lang.String,java.lang.Object> oldStyleValues
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
-
installUI
public void installUI(javax.swing.JComponent c)
- Overrides:
installUI
in classjavax.swing.plaf.basic.BasicTreeUI
-
installDefaults
protected void installDefaults()
- Overrides:
installDefaults
in classjavax.swing.plaf.basic.BasicTreeUI
-
uninstallDefaults
protected void uninstallDefaults()
- Overrides:
uninstallDefaults
in classjavax.swing.plaf.basic.BasicTreeUI
-
updateRenderer
protected void updateRenderer()
- Overrides:
updateRenderer
in classjavax.swing.plaf.basic.BasicTreeUI
-
createMouseListener
protected java.awt.event.MouseListener createMouseListener()
- Overrides:
createMouseListener
in classjavax.swing.plaf.basic.BasicTreeUI
-
createPropertyChangeListener
protected java.beans.PropertyChangeListener createPropertyChangeListener()
- Overrides:
createPropertyChangeListener
in classjavax.swing.plaf.basic.BasicTreeUI
-
repaintWideDropLocation
private void repaintWideDropLocation(javax.swing.JTree.DropLocation loc)
-
createTreeSelectionListener
protected javax.swing.event.TreeSelectionListener createTreeSelectionListener()
- Overrides:
createTreeSelectionListener
in classjavax.swing.plaf.basic.BasicTreeUI
-
getPathBounds
public java.awt.Rectangle getPathBounds(javax.swing.JTree tree, javax.swing.tree.TreePath path)
- Overrides:
getPathBounds
in classjavax.swing.plaf.basic.BasicTreeUI
-
installStyle
protected void installStyle()
- Since:
- 2
-
applyStyle
protected void applyStyle(java.lang.Object style)
- Since:
- 2
-
applyStyleProperty
protected java.lang.Object applyStyleProperty(java.lang.String key, java.lang.Object value)
- Since:
- 2
-
getStyleableInfos
public java.util.Map<java.lang.String,java.lang.Class<?>> getStyleableInfos(javax.swing.JComponent c)
- Specified by:
getStyleableInfos
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2
-
getStyleableValue
public java.lang.Object getStyleableValue(javax.swing.JComponent c, java.lang.String key)
- Specified by:
getStyleableValue
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2.5
-
paint
public void paint(java.awt.Graphics g, javax.swing.JComponent c)
- Overrides:
paint
in classjavax.swing.plaf.basic.BasicTreeUI
-
paintRow
protected void paintRow(java.awt.Graphics g, java.awt.Rectangle clipBounds, java.awt.Insets insets, java.awt.Rectangle bounds, javax.swing.tree.TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
Similar to super.paintRow(), but supports wide selection and uses inactive selection background/foreground if tree is not focused.- Overrides:
paintRow
in classjavax.swing.plaf.basic.BasicTreeUI
-
setRendererBackgroundSelectionColor
private java.awt.Color setRendererBackgroundSelectionColor(java.awt.Component rendererComponent, java.awt.Color color)
-
setRendererForeground
private void setRendererForeground(java.awt.Component rendererComponent, java.awt.Color color)
-
setRendererBorderSelectionColor
private java.awt.Color setRendererBorderSelectionColor(java.awt.Component rendererComponent, java.awt.Color color)
-
paintWideSelection
private void paintWideSelection(java.awt.Graphics g, java.awt.Rectangle bounds, int row)
-
paintCellBackground
private void paintCellBackground(java.awt.Graphics g, java.awt.Component rendererComponent, java.awt.Rectangle bounds, int row, boolean paintSelection)
-
useUnitedRoundedSelection
private boolean useUnitedRoundedSelection()
-
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
-
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
-
isDropRow
private boolean isDropRow(int row)
Checks whether dropping on a row. See DefaultTreeCellRenderer.getTreeCellRendererComponent().
-
getDropLineRect
protected java.awt.Rectangle getDropLineRect(javax.swing.JTree.DropLocation loc)
- Overrides:
getDropLineRect
in classjavax.swing.plaf.basic.BasicTreeUI
-
isWideSelection
protected boolean isWideSelection()
-
isPaintSelection
protected boolean isPaintSelection()
-
-