|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.plaf.ComponentUI javax.swing.plaf.TreeUI javax.swing.plaf.basic.BasicTreeUI
The basic L&F for a hierarchical data structure.
Nested Class Summary | |
class |
BasicTreeUI.CellEditorHandler
Listener responsible for getting cell editing events and updating the tree accordingly. |
class |
BasicTreeUI.ComponentHandler
Updates the preferred size when scrolling (if necessary). |
class |
BasicTreeUI.FocusHandler
Repaints the lead selection row when focus is lost/gained. |
class |
BasicTreeUI.KeyHandler
This is used to get mutliple key down events to appropriately generate events. |
class |
BasicTreeUI.MouseHandler
TreeMouseListener is responsible for updating the selection based on mouse events. |
class |
BasicTreeUI.MouseInputHandler
MouseInputHandler handles passing all mouse events, including mouse motion events, until the mouse is released to the destination it is constructed with. |
class |
BasicTreeUI.NodeDimensionsHandler
Class responsible for getting size of node, method is forwarded to BasicTreeUI method. |
class |
BasicTreeUI.PropertyChangeHandler
PropertyChangeListener for the tree. |
private static class |
BasicTreeUI.ScrollAction
Scrolls the component it is created with a specified amount. |
class |
BasicTreeUI.SelectionModelPropertyChangeHandler
Listener on the TreeSelectionModel, resets the row selection if any of the properties of the model change. |
private class |
BasicTreeUI.TreeAddSelectionAction
Action to select everything in tree. |
class |
BasicTreeUI.TreeCancelEditingAction
ActionListener that invokes cancelEditing when action performed. |
(package private) static class |
BasicTreeUI.TreeDragGestureRecognizer
Drag gesture recognizer for JTree components |
(package private) static class |
BasicTreeUI.TreeDropTargetListener
A DropTargetListener to extend the default Swing handling of drop operations by moving the tree selection to the nearest location to the mouse pointer. |
private class |
BasicTreeUI.TreeEditAction
ActionListener invoked to start editing on the leadPath. |
class |
BasicTreeUI.TreeExpansionHandler
Updates the TreeState in response to nodes expanding/collapsing. |
private class |
BasicTreeUI.TreeExtendSelectionAction
Action to select everything in tree. |
class |
BasicTreeUI.TreeHomeAction
TreeHomeAction is used to handle end/home actions. |
class |
BasicTreeUI.TreeIncrementAction
TreeIncrementAction is used to handle up/down actions. |
class |
BasicTreeUI.TreeModelHandler
Forwards all TreeModel events to the TreeState. |
class |
BasicTreeUI.TreePageAction
TreePageAction handles page up and page down events. |
private class |
BasicTreeUI.TreeScrollLRAction
Scrolls the tree left/right the visible width of the tree. |
private class |
BasicTreeUI.TreeSelectAllAction
Action to select everything in tree. |
class |
BasicTreeUI.TreeSelectionHandler
Listens for changes in the selection model and updates the display accordingly. |
class |
BasicTreeUI.TreeToggleAction
For the first selected row expandedness will be toggled. |
(package private) static class |
BasicTreeUI.TreeTransferHandler
|
class |
BasicTreeUI.TreeTraverseAction
TreeTraverseAction is the action used for left/right keys.
|
Field Summary | |
protected TreeCellEditor |
cellEditor
Editor for the tree. |
private CellEditorListener |
cellEditorListener
Listens for CellEditor events. |
protected Icon |
collapsedIcon
|
private ComponentListener |
componentListener
Used for large models, listens for moved/resized events and updates the validCachedPreferredSize bit accordingly. |
protected boolean |
createdCellEditor
Set to true if editor that is currently in the tree was created by this instance. |
protected boolean |
createdRenderer
Set to true if the renderer that is currently in the tree was created by this instance. |
protected TreeCellRenderer |
currentCellRenderer
Renderer that is being used to do the actual cell drawing. |
private static BasicTreeUI.TreeDragGestureRecognizer |
defaultDragRecognizer
|
private static DropTargetListener |
defaultDropTargetListener
|
private static TransferHandler |
defaultTransferHandler
|
protected int |
depthOffset
How much the depth should be offset to properly calculate x locations. |
protected Hashtable |
drawingCache
Used for minimizing the drawing of vertical lines. |
protected Component |
editingComponent
When editing, this will be the Component that is doing the actual editing. |
protected TreePath |
editingPath
Path that is being edited. |
protected int |
editingRow
Row that is being edited. |
protected boolean |
editorHasDifferentSize
Set to true if the editor has a different size than the renderer. |
private static Insets |
EMPTY_INSETS
|
protected Icon |
expandedIcon
|
private FocusListener |
focusListener
|
private Color |
hashColor
Color used to draw hash marks. |
private boolean |
ignoreLAChange
If true, the property change event for LEAD_SELECTION_PATH_PROPERTY, or ANCHOR_SELECTION_PATH_PROPERTY will not generate a repaint. |
private KeyListener |
keyListener
|
protected boolean |
largeModel
True if doing optimizations for a largeModel. |
protected int |
lastSelectedRow
Index of the row that was last selected. |
private int |
lastWidth
Last width the tree was at when painted. |
private int |
leadRow
Row correspondin to lead path. |
protected int |
leftChildIndent
Distance between left margin and where vertical dashes will be drawn. |
private boolean |
leftToRight
Indicates the orientation. |
private MouseListener |
mouseListener
|
protected AbstractLayoutCache.NodeDimensions |
nodeDimensions
Reponsible for telling the TreeState the size needed for a node. |
protected Dimension |
preferredMinSize
Minimum preferred size. |
protected Dimension |
preferredSize
Size needed to completely display all the nodes. |
private java.beans.PropertyChangeListener |
propertyChangeListener
|
protected CellRendererPane |
rendererPane
Used to paint the TreeCellRenderer. |
protected int |
rightChildIndent
Distance to add to leftChildIndent to determine where cell contents will be drawn. |
private java.beans.PropertyChangeListener |
selectionModelPropertyChangeListener
|
protected boolean |
stopEditingInCompleteEditing
Set to false when editing and shouldSelectCell() returns true meaning the node should be selected before editing, used in completeEditing. |
protected int |
totalChildIndent
Total distance that will be indented. |
protected JTree |
tree
Component that we're going to be drawing into. |
private TreeExpansionListener |
treeExpansionListener
Updates the treestate as the nodes expand. |
protected TreeModel |
treeModel
Used to determine what to display. |
private TreeModelListener |
treeModelListener
Is responsible for updating the display based on model events. |
private TreeSelectionListener |
treeSelectionListener
Updates the display when the selection changes. |
protected TreeSelectionModel |
treeSelectionModel
Model maintaing the selection. |
protected AbstractLayoutCache |
treeState
Object responsible for handling sizing and expanded issues. |
protected boolean |
validCachedPreferredSize
Is the preferredSize valid? |
Constructor Summary | |
BasicTreeUI()
|
Method Summary | |
void |
cancelEditing(JTree tree)
Cancels the current editing session. |
protected void |
checkForClickInExpandControl(TreePath path,
int mouseX,
int mouseY)
If the mouseX and mouseY are in the
expand/collapse region of the row , this will toggle
the row. |
protected void |
completeEditing()
Messages to stop the editing session. |
protected void |
completeEditing(boolean messageStop,
boolean messageCancel,
boolean messageTree)
Stops the editing session. |
protected void |
completeUIInstall()
Invoked from installUI after all the defaults/listeners have been installed. |
protected void |
completeUIUninstall()
|
protected void |
configureLayoutCache()
Resets the TreeState instance based on the tree we're providing the look and feel for. |
(package private) ActionMap |
createActionMap()
|
protected CellEditorListener |
createCellEditorListener()
Creates a listener to handle events from the current editor. |
protected CellRendererPane |
createCellRendererPane()
Returns the renderer pane that renderer components are placed in. |
protected ComponentListener |
createComponentListener()
Creates and returns a new ComponentHandler. |
protected TreeCellEditor |
createDefaultCellEditor()
Creates a default cell editor. |
protected TreeCellRenderer |
createDefaultCellRenderer()
Returns the default cell renderer that is used to do the stamping of each node. |
protected FocusListener |
createFocusListener()
Creates a listener that is responsible for updating the display when focus is lost/gained. |
protected KeyListener |
createKeyListener()
Creates the listener reponsible for getting key events from the tree. |
protected AbstractLayoutCache |
createLayoutCache()
Creates the object responsible for managing what is expanded, as well as the size of nodes. |
protected MouseListener |
createMouseListener()
Creates the listener responsible for updating the selection based on mouse events. |
protected AbstractLayoutCache.NodeDimensions |
createNodeDimensions()
Creates an instance of NodeDimensions that is able to determine the size of a given node in the tree. |
protected java.beans.PropertyChangeListener |
createPropertyChangeListener()
Creates a listener that is responsible that updates the UI based on how the tree changes. |
protected java.beans.PropertyChangeListener |
createSelectionModelPropertyChangeListener()
Creates the listener responsible for getting property change events from the selection model. |
protected TreeExpansionListener |
createTreeExpansionListener()
Creates and returns the object responsible for updating the treestate when nodes expanded state changes. |
protected TreeModelListener |
createTreeModelListener()
Returns a listener that can update the tree when the model changes. |
protected TreeSelectionListener |
createTreeSelectionListener()
Creates the listener that updates the display based on selection change methods. |
static ComponentUI |
createUI(JComponent x)
Returns an instance of the UI delegate for the specified component. |
protected void |
drawCentered(Component c,
Graphics graphics,
Icon icon,
int x,
int y)
|
protected void |
drawDashedHorizontalLine(Graphics g,
int y,
int x1,
int x2)
|
protected void |
drawDashedVerticalLine(Graphics g,
int x,
int y1,
int y2)
|
protected void |
ensureRowsAreVisible(int beginRow,
int endRow)
Ensures that the rows identified by beginRow through endRow are visible. |
private void |
extendSelection(TreePath newLead)
Extends the selection from the anchor to make newLead
the lead of the selection. |
(package private) ActionMap |
getActionMap()
|
private TreePath |
getAnchorSelectionPath()
|
protected TreeCellEditor |
getCellEditor()
|
protected TreeCellRenderer |
getCellRenderer()
Return currentCellRenderer, which will either be the trees renderer, or defaultCellRenderer, which ever wasn't null. |
TreePath |
getClosestPathForLocation(JTree tree,
int x,
int y)
Returns the path to the node that is closest to x,y. |
Icon |
getCollapsedIcon()
|
TreePath |
getEditingPath(JTree tree)
Returns the path to the element that is being edited. |
Icon |
getExpandedIcon()
|
protected Color |
getHashColor()
|
protected int |
getHorizontalLegBuffer()
The horizontal element of legs between nodes starts at the right of the left-hand side of the child node by default. |
(package private) InputMap |
getInputMap(int condition)
|
protected TreePath |
getLastChildPath(TreePath parent)
Returns a path to the last child of parent . |
private TreePath |
getLeadSelectionPath()
|
private int |
getLeadSelectionRow()
|
int |
getLeftChildIndent()
|
Dimension |
getMaximumSize(JComponent c)
Returns the maximum size for this component, which will be the preferred size if the instance is currently in a JTree, or 0, 0. |
Dimension |
getMinimumSize(JComponent c)
Returns the minimum size for this component. |
private int |
getMinX(Rectangle bounds)
Returns the minimum x location for the nodes in bounds . |
protected TreeModel |
getModel()
|
Rectangle |
getPathBounds(JTree tree,
TreePath path)
Returns the Rectangle enclosing the label portion that the last item in path will be drawn into. |
TreePath |
getPathForRow(JTree tree,
int row)
Returns the path for passed in row. |
Dimension |
getPreferredMinSize()
Returns the minimum preferred size. |
Dimension |
getPreferredSize(JComponent c)
Returns the preferred size to properly display the tree, this is a cover method for getPreferredSize(c, false). |
Dimension |
getPreferredSize(JComponent c,
boolean checkConsistancy)
Returns the preferred size to represent the tree in c. |
int |
getRightChildIndent()
|
int |
getRowCount(JTree tree)
Returns the number of rows that are being displayed. |
int |
getRowForPath(JTree tree,
TreePath path)
Returns the row that the last item identified in path is visible at. |
protected int |
getRowHeight()
|
protected TreeSelectionModel |
getSelectionModel()
|
protected boolean |
getShowsRootHandles()
|
protected int |
getVerticalLegBuffer()
The vertical element of legs between nodes starts at the bottom of the parent node by default. |
protected void |
handleExpandControlClick(TreePath path,
int mouseX,
int mouseY)
Messaged when the user clicks the particular row, this invokes toggleExpandState. |
protected void |
installComponents()
Intalls the subcomponents of the tree, which is the renderer pane. |
protected void |
installDefaults()
|
protected void |
installKeyboardActions()
|
protected void |
installListeners()
|
void |
installUI(JComponent c)
Configures the specified component appropriate for the look and feel. |
protected boolean |
isEditable()
|
boolean |
isEditing(JTree tree)
Returns true if the tree is being edited. |
protected boolean |
isLargeModel()
|
protected boolean |
isLeaf(int row)
|
protected boolean |
isLocationInExpandControl(TreePath path,
int mouseX,
int mouseY)
Returns true if mouseX and mouseY fall
in the area of row that is used to expand/collapse the node and
the node at row does not represent a leaf. |
protected boolean |
isMultiSelectEvent(MouseEvent event)
Returning true signifies a mouse event on the node should select from the anchor point. |
protected boolean |
isRootVisible()
|
protected boolean |
isToggleEvent(MouseEvent event)
Returning true indicates the row under the mouse should be toggled based on the event. |
protected boolean |
isToggleSelectionEvent(MouseEvent event)
Returning true signifies a mouse event on the node should toggle the selection of only the row under mouse. |
void |
paint(Graphics g,
JComponent c)
Paints the specified component appropriate for the look and feel. |
protected void |
paintExpandControl(Graphics g,
Rectangle clipBounds,
Insets insets,
Rectangle bounds,
TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Paints the expand (toggle) part of a row. |
protected void |
paintHorizontalLine(Graphics g,
JComponent c,
int y,
int left,
int right)
Paints a horizontal line. |
protected void |
paintHorizontalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
Rectangle bounds,
TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Paints the horizontal part of the leg. |
protected void |
paintRow(Graphics g,
Rectangle clipBounds,
Insets insets,
Rectangle bounds,
TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Paints the renderer part of a row. |
protected void |
paintVerticalLine(Graphics g,
JComponent c,
int x,
int top,
int bottom)
Paints a vertical line. |
protected void |
paintVerticalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
TreePath path)
Paints the vertical part of the leg. |
protected void |
pathWasCollapsed(TreePath path)
Messaged from the VisibleTreeNode after it has collapsed. |
protected void |
pathWasExpanded(TreePath path)
Messaged from the VisibleTreeNode after it has been expanded. |
protected void |
prepareForUIInstall()
Invoked after the tree instance variable has been
set, but before any defaults/listeners have been installed. |
protected void |
prepareForUIUninstall()
|
private void |
redoTheLayout()
Recomputes the right margin, and invalidates any tree states |
private void |
repaintPath(TreePath path)
Invokes repaint on the JTree for the passed in TreePath,
path . |
protected void |
selectPathForEvent(TreePath path,
MouseEvent event)
Messaged to update the selection based on a MouseEvent over a particular row. |
private void |
setAnchorSelectionPath(TreePath newPath)
|
protected void |
setCellEditor(TreeCellEditor editor)
Sets the cell editor. |
protected void |
setCellRenderer(TreeCellRenderer tcr)
Sets the TreeCellRenderer to tcr . |
void |
setCollapsedIcon(Icon newG)
|
protected void |
setEditable(boolean newValue)
Configures the receiver to allow, or not allow, editing. |
void |
setExpandedIcon(Icon newG)
|
protected void |
setHashColor(Color color)
|
protected void |
setLargeModel(boolean largeModel)
Updates the componentListener, if necessary. |
private void |
setLeadSelectionPath(TreePath newPath)
|
private void |
setLeadSelectionPath(TreePath newPath,
boolean repaint)
|
void |
setLeftChildIndent(int newAmount)
|
protected void |
setModel(TreeModel model)
Sets the TreeModel. |
void |
setPreferredMinSize(Dimension newSize)
Sets the preferred minimum size. |
void |
setRightChildIndent(int newAmount)
|
protected void |
setRootVisible(boolean newValue)
Sets the root to being visible. |
protected void |
setRowHeight(int rowHeight)
Sets the row height, this is forwarded to the treeState. |
protected void |
setSelectionModel(TreeSelectionModel newLSM)
Resets the selection model. |
protected void |
setShowsRootHandles(boolean newValue)
Determines whether the node handles are to be displayed. |
protected boolean |
shouldPaintExpandControl(TreePath path,
int row,
boolean isExpanded,
boolean hasBeenExpanded,
boolean isLeaf)
Returns true if the expand (toggle) control should be drawn for the specified row. |
protected boolean |
startEditing(TreePath path,
MouseEvent event)
Will start editing for node if there is a cellEditor and shouldSelectCell returns true. |
void |
startEditingAtPath(JTree tree,
TreePath path)
Selects the last item in path and tries to edit it. |
boolean |
stopEditing(JTree tree)
Stops the current editing session. |
protected void |
toggleExpandState(TreePath path)
Expands path if it is not expanded, or collapses row if it is expanded. |
protected void |
uninstallComponents()
Uninstalls the renderer pane. |
protected void |
uninstallDefaults()
|
protected void |
uninstallKeyboardActions()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent c)
Reverses configuration which was done on the specified component during installUI . |
protected void |
updateCachedPreferredSize()
Updates the preferredSize instance variable,
which is returned from getPreferredSize() . |
protected void |
updateCellEditor()
Updates the cellEditor based on the editability of the JTree that we're contained in. |
protected void |
updateDepthOffset()
Updates how much each depth should be offset by. |
protected void |
updateExpandedDescendants(TreePath path)
Updates the expanded state of all the descendants of path
by getting the expanded descendants from the tree and forwarding
to the tree state. |
protected void |
updateLayoutCacheExpandedNodes()
Makes all the nodes that are expanded in JTree expanded in LayoutCache. |
private void |
updateLeadRow()
|
protected void |
updateRenderer()
Messaged from the tree we're in when the renderer has changed. |
protected void |
updateSize()
Marks the cached size as being invalid, and messages the tree with treeDidChange . |
Methods inherited from class javax.swing.plaf.ComponentUI |
contains, getAccessibleChild, getAccessibleChildrenCount, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Insets EMPTY_INSETS
protected transient Icon collapsedIcon
protected transient Icon expandedIcon
private Color hashColor
null
no hash marks
will be drawn.
protected int leftChildIndent
protected int rightChildIndent
protected int totalChildIndent
protected Dimension preferredMinSize
protected int lastSelectedRow
protected JTree tree
protected transient TreeCellRenderer currentCellRenderer
protected boolean createdRenderer
protected transient TreeCellEditor cellEditor
protected boolean createdCellEditor
protected boolean stopEditingInCompleteEditing
protected CellRendererPane rendererPane
protected Dimension preferredSize
protected boolean validCachedPreferredSize
protected AbstractLayoutCache treeState
protected Hashtable drawingCache
protected boolean largeModel
protected AbstractLayoutCache.NodeDimensions nodeDimensions
protected TreeModel treeModel
protected TreeSelectionModel treeSelectionModel
protected int depthOffset
private int lastWidth
protected Component editingComponent
protected TreePath editingPath
protected int editingRow
protected boolean editorHasDifferentSize
private int leadRow
private boolean ignoreLAChange
private boolean leftToRight
private java.beans.PropertyChangeListener propertyChangeListener
private java.beans.PropertyChangeListener selectionModelPropertyChangeListener
private MouseListener mouseListener
private FocusListener focusListener
private KeyListener keyListener
private ComponentListener componentListener
private CellEditorListener cellEditorListener
private TreeSelectionListener treeSelectionListener
private TreeModelListener treeModelListener
private TreeExpansionListener treeExpansionListener
private static final BasicTreeUI.TreeDragGestureRecognizer defaultDragRecognizer
private static DropTargetListener defaultDropTargetListener
private static final TransferHandler defaultTransferHandler
Constructor Detail |
public BasicTreeUI()
Method Detail |
public static ComponentUI createUI(JComponent x)
ComponentUI
createUI
method that returns an instance of that UI delegate subclass.
If the UI delegate subclass is stateless, it may return an instance
that is shared by multiple components. If the UI delegate is
stateful, then it should return a new instance per component.
The default implementation of this method throws an error, as it
should never be invoked.
protected Color getHashColor()
protected void setHashColor(Color color)
public void setLeftChildIndent(int newAmount)
public int getLeftChildIndent()
public void setRightChildIndent(int newAmount)
public int getRightChildIndent()
public void setExpandedIcon(Icon newG)
public Icon getExpandedIcon()
public void setCollapsedIcon(Icon newG)
public Icon getCollapsedIcon()
protected void setLargeModel(boolean largeModel)
protected boolean isLargeModel()
protected void setRowHeight(int rowHeight)
protected int getRowHeight()
protected void setCellRenderer(TreeCellRenderer tcr)
tcr
. This invokes
updateRenderer
.
protected TreeCellRenderer getCellRenderer()
protected void setModel(TreeModel model)
protected TreeModel getModel()
protected void setRootVisible(boolean newValue)
protected boolean isRootVisible()
protected void setShowsRootHandles(boolean newValue)
protected boolean getShowsRootHandles()
protected void setCellEditor(TreeCellEditor editor)
protected TreeCellEditor getCellEditor()
protected void setEditable(boolean newValue)
protected boolean isEditable()
protected void setSelectionModel(TreeSelectionModel newLSM)
protected TreeSelectionModel getSelectionModel()
public Rectangle getPathBounds(JTree tree, TreePath path)
getPathBounds
in class TreeUI
public TreePath getPathForRow(JTree tree, int row)
getPathForRow
in class TreeUI
public int getRowForPath(JTree tree, TreePath path)
getRowForPath
in class TreeUI
public int getRowCount(JTree tree)
getRowCount
in class TreeUI
public TreePath getClosestPathForLocation(JTree tree, int x, int y)
getClosestPathForLocation
in class TreeUI
public boolean isEditing(JTree tree)
isEditing
in class TreeUI
public boolean stopEditing(JTree tree)
stopEditing
in class TreeUI
public void cancelEditing(JTree tree)
cancelEditing
in class TreeUI
public void startEditingAtPath(JTree tree, TreePath path)
startEditingAtPath
in class TreeUI
public TreePath getEditingPath(JTree tree)
getEditingPath
in class TreeUI
public void installUI(JComponent c)
ComponentUI
ComponentUI
instance is being installed
as the UI delegate on the specified component. This method should
completely configure the component for the look and feel,
including the following:
LayoutManager
on the component if necessary.
PropertyChangeListener
on the component in order
to detect and respond to component property changes appropriately.
installUI
in class ComponentUI
c
- the component where this UI delegate is being installedComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
protected void prepareForUIInstall()
tree
instance variable has been
set, but before any defaults/listeners have been installed.
protected void completeUIInstall()
protected void installDefaults()
protected void installListeners()
protected void installKeyboardActions()
InputMap getInputMap(int condition)
ActionMap getActionMap()
ActionMap createActionMap()
protected void installComponents()
protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
protected java.beans.PropertyChangeListener createPropertyChangeListener()
protected MouseListener createMouseListener()
protected FocusListener createFocusListener()
protected KeyListener createKeyListener()
protected java.beans.PropertyChangeListener createSelectionModelPropertyChangeListener()
protected TreeSelectionListener createTreeSelectionListener()
protected CellEditorListener createCellEditorListener()
protected ComponentListener createComponentListener()
protected TreeExpansionListener createTreeExpansionListener()
protected AbstractLayoutCache createLayoutCache()
protected CellRendererPane createCellRendererPane()
protected TreeCellEditor createDefaultCellEditor()
protected TreeCellRenderer createDefaultCellRenderer()
protected TreeModelListener createTreeModelListener()
public void uninstallUI(JComponent c)
ComponentUI
installUI
. This method is invoked when this
UIComponent
instance is being removed as the UI delegate
for the specified component. This method should undo the
configuration performed in installUI
, being careful to
leave the JComponent
instance in a clean state (no
extraneous listeners, look-and-feel-specific property objects, etc.).
This should include the following:
uninstallUI
in class ComponentUI
c
- the component from which this UI delegate is being removed;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected void prepareForUIUninstall()
protected void completeUIUninstall()
protected void uninstallDefaults()
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected void uninstallComponents()
private void redoTheLayout()
public void paint(Graphics g, JComponent c)
ComponentUI
ComponentUI.update
method when
the specified component is being painted. Subclasses should override
this method and use the specified Graphics
object to
render the content of the component.
paint
in class ComponentUI
g
- the Graphics
context in which to paintc
- the component being painted;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
clipBounds
, or insets
.
NOTE: parentRow
can be -1 if the root is not visible.
protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
clipBounds
, insets
.
protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
clipBounds
, or insets
.
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
clipBounds
, or insets
.
protected boolean shouldPaintExpandControl(TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
protected int getVerticalLegBuffer()
protected int getHorizontalLegBuffer()
protected void drawCentered(Component c, Graphics graphics, Icon icon, int x, int y)
protected void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2)
protected void drawDashedVerticalLine(Graphics g, int x, int y1, int y2)
protected void updateLayoutCacheExpandedNodes()
protected void updateExpandedDescendants(TreePath path)
path
by getting the expanded descendants from the tree and forwarding
to the tree state.
protected TreePath getLastChildPath(TreePath parent)
parent
.
protected void updateDepthOffset()
protected void updateCellEditor()
protected void updateRenderer()
protected void configureLayoutCache()
protected void updateSize()
treeDidChange
.
protected void updateCachedPreferredSize()
preferredSize
instance variable,
which is returned from getPreferredSize()
.For left to right orientations, the size is determined from the current AbstractLayoutCache. For RTL orientations, the preferred size becomes the width minus the minimum x position.
private int getMinX(Rectangle bounds)
bounds
.
protected void pathWasExpanded(TreePath path)
protected void pathWasCollapsed(TreePath path)
protected void ensureRowsAreVisible(int beginRow, int endRow)
public void setPreferredMinSize(Dimension newSize)
public Dimension getPreferredMinSize()
public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
c
- the component whose preferred size is being queried;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsJComponent.getPreferredSize()
,
LayoutManager.preferredLayoutSize(java.awt.Container)
public Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
c
- the component whose minimum size is being queried;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple components
Dimension
object or null
JComponent.getMinimumSize()
,
LayoutManager.minimumLayoutSize(java.awt.Container)
,
ComponentUI.getPreferredSize(javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
c
- the component whose maximum size is being queried;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple components
Dimension
object or null
JComponent.getMaximumSize()
,
LayoutManager2.maximumLayoutSize(java.awt.Container)
protected void completeEditing()
getInvokesStopCellEditing
, stopCellEditing will
invoked on the current editor. Then completeEditing will
be messaged with false, true, false to cancel any lingering
editing.
protected void completeEditing(boolean messageStop, boolean messageCancel, boolean messageTree)
protected boolean startEditing(TreePath path, MouseEvent event)
This assumes that path is valid and visible.
protected void checkForClickInExpandControl(TreePath path, int mouseX, int mouseY)
mouseX
and mouseY
are in the
expand/collapse region of the row
, this will toggle
the row.
protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY)
mouseX
and mouseY
fall
in the area of row that is used to expand/collapse the node and
the node at row
does not represent a leaf.
protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY)
protected void toggleExpandState(TreePath path)
protected boolean isToggleSelectionEvent(MouseEvent event)
protected boolean isMultiSelectEvent(MouseEvent event)
protected boolean isToggleEvent(MouseEvent event)
protected void selectPathForEvent(TreePath path, MouseEvent event)
protected boolean isLeaf(int row)
row
is a leaf.private void setAnchorSelectionPath(TreePath newPath)
private TreePath getAnchorSelectionPath()
private void setLeadSelectionPath(TreePath newPath)
private void setLeadSelectionPath(TreePath newPath, boolean repaint)
private TreePath getLeadSelectionPath()
private void updateLeadRow()
private int getLeadSelectionRow()
private void extendSelection(TreePath newLead)
newLead
the lead of the selection. This does not scroll.
private void repaintPath(TreePath path)
repaint
on the JTree for the passed in TreePath,
path
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |