public class SourceListTreeUI extends BasicTreeUI
A UI delegate that paints a JTree
as an Apple defined
Source List. Consider using this UI delegate with
MacWidgetFactory.createSourceListScrollPane(javax.swing.JComponent)
.
For the best development experience, it is recommended that you migrate your code to use the
SourceList
with the SourceListModel
, as this component abstracts away many of the
complexities of JTree
.
Pictured below are the two different rendering styles of a Source List: focused and unfocused.
The corresponding JTree
's focusable property drives this rendering style.
![]() |
![]() |
Focusable SourceList | Non-focusable SourceList |
DefaultMutableTreeNode
, and the
DefaultMutableTreeNode.getUserObject()
is an instance of TextProvider
, then
the TextProvider
will be queried for the node text.TextProvider
is found, the standard
JTree.convertValueToText(Object, boolean, boolean, boolean, int, boolean)
method will
be consulted.DefaultMutableTreeNode
, and the
DefaultMutableTreeNode.getUserObject()
is an instance of IconProvider
, then
the IconProvider
will be queried for the node icon.BasicTreeUI.CellEditorHandler, BasicTreeUI.ComponentHandler, BasicTreeUI.FocusHandler, BasicTreeUI.KeyHandler, BasicTreeUI.MouseHandler, BasicTreeUI.MouseInputHandler, BasicTreeUI.NodeDimensionsHandler, BasicTreeUI.PropertyChangeHandler, BasicTreeUI.SelectionModelPropertyChangeHandler, BasicTreeUI.TreeCancelEditingAction, BasicTreeUI.TreeExpansionHandler, BasicTreeUI.TreeHomeAction, BasicTreeUI.TreeIncrementAction, BasicTreeUI.TreeModelHandler, BasicTreeUI.TreePageAction, BasicTreeUI.TreeSelectionHandler, BasicTreeUI.TreeToggleAction, BasicTreeUI.TreeTraverseAction
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 and Description |
---|
SourceListTreeUI() |
Modifier and Type | Method and Description |
---|---|
protected void |
completeUIInstall() |
protected AbstractLayoutCache.NodeDimensions |
createNodeDimensions() |
SourceListColorScheme |
getColorScheme()
Gets the
SourceListColorScheme that this SourceListTreeUI uses to paint. |
Rectangle |
getPathBounds(JTree tree,
TreePath path) |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
paint(Graphics g,
JComponent c) |
protected void |
paintExpandControl(Graphics g,
Rectangle clipBounds,
Insets insets,
Rectangle bounds,
TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf) |
protected void |
paintHorizontalLine(Graphics g,
JComponent c,
int y,
int left,
int right) |
protected void |
paintVerticalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
TreePath path) |
protected void |
selectPathForEvent(TreePath path,
MouseEvent event) |
void |
setColorScheme(SourceListColorScheme colorScheme)
Sets the
SourceListColorScheme that this SourceListTreeUI uses to paint. |
protected void |
setModel(TreeModel model) |
cancelEditing, checkForClickInExpandControl, completeEditing, completeEditing, completeUIUninstall, configureLayoutCache, createCellEditorListener, createCellRendererPane, createComponentListener, createDefaultCellEditor, createDefaultCellRenderer, createFocusListener, createKeyListener, createLayoutCache, createMouseListener, createPropertyChangeListener, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, createTreeSelectionListener, createUI, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getDropLineRect, getEditingPath, getExpandedIcon, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeadSelectionRow, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installDefaults, installUI, isDropLine, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paintDropLine, paintHorizontalPartOfLeg, paintRow, paintVerticalLine, pathWasCollapsed, pathWasExpanded, prepareForUIInstall, prepareForUIUninstall, setCellEditor, setCellRenderer, setCollapsedIcon, setEditable, setExpandedIcon, setHashColor, setLargeModel, setLeftChildIndent, setPreferredMinSize, setRightChildIndent, setRootVisible, setRowHeight, setSelectionModel, setShowsRootHandles, shouldPaintExpandControl, startEditing, startEditingAtPath, stopEditing, toggleExpandState, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateLeadSelectionRow, updateRenderer, updateSize
contains, getAccessibleChild, getAccessibleChildrenCount, update
protected void completeUIInstall()
completeUIInstall
in class BasicTreeUI
protected void installListeners()
installListeners
in class BasicTreeUI
protected void installKeyboardActions()
installKeyboardActions
in class BasicTreeUI
protected void setModel(TreeModel model)
setModel
in class BasicTreeUI
public SourceListColorScheme getColorScheme()
SourceListColorScheme
that this SourceListTreeUI
uses to paint.SourceListColorScheme
that this SourceList
uses to paint.public void setColorScheme(SourceListColorScheme colorScheme)
SourceListColorScheme
that this SourceListTreeUI
uses to paint.colorScheme
- the SourceListColorScheme
that this SourceList
uses to
paint.protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
paintExpandControl
in class BasicTreeUI
protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
createNodeDimensions
in class BasicTreeUI
public Rectangle getPathBounds(JTree tree, TreePath path)
getPathBounds
in class BasicTreeUI
public void paint(Graphics g, JComponent c)
paint
in class BasicTreeUI
protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
paintHorizontalLine
in class BasicTreeUI
protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
paintVerticalPartOfLeg
in class BasicTreeUI
protected void selectPathForEvent(TreePath path, MouseEvent event)
selectPathForEvent
in class BasicTreeUI