javax.swing.plaf.basic
public class BasicTreeUI extends TreeUI
JTree
according to
the Basic look and feel.JTree
Modifier and Type | Class and Description |
---|---|
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/grained.
|
class |
BasicTreeUI.KeyHandler
This is used to get multiple key down events to appropriately genereate
events.
|
class |
BasicTreeUI.MouseHandler
MouseListener 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.
|
class |
BasicTreeUI.SelectionModelPropertyChangeHandler
Listener on the TreeSelectionModel, resets the row selection if any of the
properties of the model change.
|
class |
BasicTreeUI.TreeCancelEditingAction
The action to cancel editing on this tree.
|
class |
BasicTreeUI.TreeExpansionHandler
Updates the TreeState in response to nodes expanding/collapsing.
|
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.
|
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.
|
class |
BasicTreeUI.TreeTraverseAction
TreeTraverseAction is the action used for left/right keys.
|
Modifier and Type | Field and Description |
---|---|
protected TreeCellEditor |
cellEditor
Editor for the tree.
|
protected Icon |
collapsedIcon
Collapse Icon for the tree.
|
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.
|
protected int |
depthOffset
How much the depth should be offset to properly calculate x locations.
|
protected Hashtable<TreePath,Boolean> |
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.
|
protected Icon |
expandedIcon
Expanded Icon for the tree.
|
protected boolean |
largeModel
True if doing optimizations for a largeModel.
|
protected int |
lastSelectedRow
Index of the row that was last selected.
|
protected int |
leftChildIndent
Distance between left margin and where vertical dashes will be drawn.
|
protected AbstractLayoutCache.NodeDimensions |
nodeDimensions
Responsible for telling the TreeState the size needed for a node.
|
protected Dimension |
preferredMinSize
Minimum size needed to completely display all the nodes.
|
protected Dimension |
preferredSize
Size needed to completely display all the nodes.
|
protected CellRendererPane |
rendererPane
Used to paint the TreeCellRenderer.
|
protected int |
rightChildIndent
Distance between leftChildIndent and where cell contents will be drawn.
|
protected boolean |
stopEditingInCompleteEditing
Set to false when editing and shouldSelectCall() returns true meaning the
node should be selected before editing, used in completeEditing.
|
protected int |
totalChildIndent
Total fistance that will be indented.
|
protected JTree |
tree
Component that we're going to be drawing onto.
|
protected TreeModel |
treeModel
Used to determine what to display.
|
protected TreeSelectionModel |
treeSelectionModel
Model maintaining the selection.
|
protected AbstractLayoutCache |
treeState
Object responsible for handling sizing and expanded issues.
|
protected boolean |
validCachedPreferredSize
Is the preferredSize valid?
|
Constructor and Description |
---|
BasicTreeUI()
Creates a new BasicTreeUI object.
|
Modifier and Type | Method and Description |
---|---|
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 or
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()
Invoked from uninstallUI after all the defaults/listeners have been
uninstalled.
|
protected void |
configureLayoutCache()
Resets the treeState instance based on the tree we're providing the look
and feel for.
|
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 the listener that is responsible for updating the display when
focus is lost/grained.
|
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 PropertyChangeListener |
createPropertyChangeListener()
Creates a listener that is reponsible for the updates the UI based on how
the tree changes.
|
protected 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
a 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 c)
Returns an instance of the UI delegate for the specified component.
|
protected void |
drawCentered(Component c,
Graphics g,
Icon icon,
int x,
int y)
Draws an icon at around a specific position
|
protected void |
drawDashedHorizontalLine(Graphics g,
int y,
int x1,
int x2)
Draws a dashed horizontal line.
|
protected void |
drawDashedVerticalLine(Graphics g,
int x,
int y1,
int y2)
Draws a dashed vertical line.
|
protected void |
ensureRowsAreVisible(int beginRow,
int endRow)
Ensures that the rows identified by beginRow through endRow are visible.
|
protected TreeCellEditor |
getCellEditor()
Returns the
TreeCellEditor for this tree. |
protected TreeCellRenderer |
getCellRenderer()
Return currentCellRenderer, which will either be the trees renderer, or
defaultCellRenderer, which ever was not null.
|
TreePath |
getClosestPathForLocation(JTree tree,
int x,
int y)
Returns the path to the node that is closest to x,y.
|
Icon |
getCollapsedIcon()
Returns the current collapsed icon.
|
TreePath |
getEditingPath(JTree tree)
Returns the path to the element that is being editted.
|
Icon |
getExpandedIcon()
Returns the current expanded icon.
|
protected Color |
getHashColor()
Returns the Hash color.
|
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.
|
protected TreePath |
getLastChildPath(TreePath parent)
Returns a path to the last child of
parent |
int |
getLeftChildIndent()
Returns the indent value for the left child.
|
Dimension |
getMaximumSize(JComponent c)
Returns the maximum size for the component, which will be the preferred
size if the instance is currently in JTree or (0,0).
|
Dimension |
getMinimumSize(JComponent c)
Returns the minimum size for this component.
|
protected TreeModel |
getModel()
Returns the tree's model
|
Rectangle |
getPathBounds(JTree tree,
TreePath path)
Returns the Rectangle enclosing the label portion that the last item in
path will be drawn to.
|
TreePath |
getPathForRow(JTree tree,
int row)
Returns the path for passed in row.
|
Dimension |
getPreferredMinSize()
Gets the preferred minimum 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()
Returns the indent value for the right child.
|
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()
Returns the current row height.
|
protected int |
getRowX(int row,
int depth)
Returns the amount to indent the given row
|
protected TreeSelectionModel |
getSelectionModel()
Returns the current selection model.
|
protected boolean |
getShowsRootHandles()
Returns true if the node handles are to be displayed.
|
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()
Installs the subcomponents of the tree, which is the renderer pane.
|
protected void |
installDefaults()
Install all defaults for the tree.
|
protected void |
installKeyboardActions()
Install all keyboard actions for this
|
protected void |
installListeners()
Install all listeners for this
|
void |
installUI(JComponent c)
Install the UI for the component
|
protected boolean |
isEditable()
Returns true if the receiver allows editing.
|
boolean |
isEditing(JTree tree)
Returns true if the tree is being edited.
|
protected boolean |
isLargeModel()
Returns true if largeModel is set
|
protected boolean |
isLeaf(int row)
Returns true if the node at
row is a leaf. |
protected boolean |
isLocationInExpandControl(TreePath path,
int mouseX,
int mouseY)
Returns true if the
mouseX and mouseY fall in
the area of row that is used to expand/collpse 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()
Returns true if the root is visible.
|
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 the 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)
Draws a horizontal line using the given graphic context
|
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)
Draws a vertical line using the given graphic context
|
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
default/listeners have been installed.
|
protected void |
prepareForUIUninstall()
Prepares for the UI to uninstall.
|
protected void |
selectPathForEvent(TreePath path,
MouseEvent event)
Messaged to update the selection based on a MouseEvent over a particular
row.
|
protected void |
setCellEditor(TreeCellEditor editor)
Sets the cell editor.
|
protected void |
setCellRenderer(TreeCellRenderer tcr)
Sets the TreeCellRenderer to
tcr . |
void |
setCollapsedIcon(Icon newG)
Sets the collapsed icon.
|
protected void |
setEditable(boolean newValue)
Configures the receiver to allow, or not allow, editing.
|
void |
setExpandedIcon(Icon newG)
Sets the expanded icon.
|
protected void |
setHashColor(Color color)
Sets the Hash color.
|
protected void |
setLargeModel(boolean largeModel)
Updates the componentListener, if necessary.
|
void |
setLeftChildIndent(int newAmount)
Sets the left child's indent value.
|
protected void |
setModel(TreeModel model)
Sets the tree's model.
|
void |
setPreferredMinSize(Dimension newSize)
Sets the preferred minimum size.
|
void |
setRightChildIndent(int newAmount)
Sets the right child's indent value.
|
protected void |
setRootVisible(boolean newValue)
Sets the root to being visible.
|
protected void |
setRowHeight(int rowHeight)
Sets the row height.
|
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 shouldSelectCall
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()
Uninstall the rendererPane.
|
protected void |
uninstallDefaults()
Uninstall the defaults for the tree
|
protected void |
uninstallKeyboardActions()
Uninstall all keyboard actions.
|
protected void |
uninstallListeners()
Uninstall all registered listeners
|
void |
uninstallUI(JComponent c)
Uninstall the UI for the component
|
protected void |
updateCachedPreferredSize()
Updates the
preferredSize instance variable, which is
returned from getPreferredSize() . |
protected void |
updateCellEditor()
Updates the cellEditor based on 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 the
path
by getting the expanded descendants from the tree and forwarding to the
tree state. |
protected void |
updateLayoutCacheExpandedNodes()
Make all the nodes that are expanded in JTree expanded in LayoutCache.
|
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 . |
contains, getAccessibleChild, getAccessibleChildrenCount, update
protected transient Icon collapsedIcon
protected transient Icon expandedIcon
protected int leftChildIndent
protected int rightChildIndent
protected int totalChildIndent
protected int lastSelectedRow
protected transient TreeCellRenderer currentCellRenderer
protected boolean createdRenderer
protected transient TreeCellEditor cellEditor
protected boolean createdCellEditor
protected boolean stopEditingInCompleteEditing
protected CellRendererPane rendererPane
protected Dimension preferredSize
protected Dimension preferredMinSize
protected boolean validCachedPreferredSize
protected AbstractLayoutCache treeState
protected Hashtable<TreePath,Boolean> drawingCache
protected boolean largeModel
protected AbstractLayoutCache.NodeDimensions nodeDimensions
protected TreeSelectionModel treeSelectionModel
protected int depthOffset
protected Component editingComponent
protected TreePath editingPath
protected int editingRow
protected boolean editorHasDifferentSize
public BasicTreeUI()
public static ComponentUI createUI(JComponent c)
c
- the JComponent
for which we need a UI delegate for.ComponentUI
for c.protected Color getHashColor()
Color
of the Hash.protected void setHashColor(Color color)
color
- the Color
to set the Hash to.public void setLeftChildIndent(int newAmount)
newAmount
- is the new indent value for the left child.public int getLeftChildIndent()
public void setRightChildIndent(int newAmount)
newAmount
- is the new indent value for the right child.public int getRightChildIndent()
public void setExpandedIcon(Icon newG)
newG
- is the new expanded icon.public Icon getExpandedIcon()
public void setCollapsedIcon(Icon newG)
newG
- is the new collapsed icon.public Icon getCollapsedIcon()
protected void setLargeModel(boolean largeModel)
largeModel
- sets this.largeModel to it.protected boolean isLargeModel()
protected void setRowHeight(int rowHeight)
rowHeight
- is the height to set this.rowHeight to.protected int getRowHeight()
protected void setCellRenderer(TreeCellRenderer tcr)
tcr
. This invokes
updateRenderer
.tcr
- is the new TreeCellRenderer.protected TreeCellRenderer getCellRenderer()
protected void setModel(TreeModel model)
model
- to set the treeModel to.protected void setRootVisible(boolean newValue)
newValue
- sets the visibility of the rootprotected boolean isRootVisible()
protected void setShowsRootHandles(boolean newValue)
newValue
- sets whether or not node handles should be displayed.protected boolean getShowsRootHandles()
protected void setCellEditor(TreeCellEditor editor)
editor
- to set the cellEditor to.protected TreeCellEditor getCellEditor()
TreeCellEditor
for this tree.protected void setEditable(boolean newValue)
newValue
- sets the receiver to allow editing if true.protected boolean isEditable()
protected void setSelectionModel(TreeSelectionModel newLSM)
newLSM
- resets the selection model.protected TreeSelectionModel getSelectionModel()
public Rectangle getPathBounds(JTree tree, TreePath path)
getPathBounds
in class TreeUI
tree
- is the current tree the path will be drawn to.path
- is the current path the tree to draw to.public TreePath getPathForRow(JTree tree, int row)
getPathForRow
in class TreeUI
tree
- is the current tree to return path for.row
- is the row number of the row to return.public int getRowForPath(JTree tree, TreePath path)
getRowForPath
in class TreeUI
tree
- is the current tree to return the row for.path
- is the path used to find the row.public int getRowCount(JTree tree)
getRowCount
in class TreeUI
tree
- is the current tree to return the number of rows for.public TreePath getClosestPathForLocation(JTree tree, int x, int y)
getClosestPathForLocation
in class TreeUI
tree
- the tree to search for the closest pathx
- is the x coordinate of the location to searchy
- is the y coordinate of the location to searchpublic boolean isEditing(JTree tree)
isEditing
in class TreeUI
tree
- is the tree to check for editing.TreeUI.getEditingPath(javax.swing.JTree)
public boolean stopEditing(JTree tree)
stopEditing
in class TreeUI
tree
- is the tree to stop the editing onpublic void cancelEditing(JTree tree)
cancelEditing
in class TreeUI
tree
- is the tree to cancel the editing session on.public void startEditingAtPath(JTree tree, TreePath path)
startEditingAtPath
in class TreeUI
tree
- is the tree to edit on.path
- is the path in tree to edit on.public TreePath getEditingPath(JTree tree)
getEditingPath
in class TreeUI
tree
- is the tree to get the editing path from.protected void prepareForUIInstall()
protected void completeUIInstall()
protected void completeUIUninstall()
protected void installComponents()
protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
protected PropertyChangeListener createPropertyChangeListener()
protected MouseListener createMouseListener()
protected FocusListener createFocusListener()
protected KeyListener createKeyListener()
protected 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()
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected void uninstallComponents()
protected int getVerticalLegBuffer()
protected int getHorizontalLegBuffer()
protected void updateLayoutCacheExpandedNodes()
protected void updateExpandedDescendants(TreePath path)
path
by getting the expanded descendants from the tree and forwarding to the
tree state.path
- the path used to update the expanded statesprotected TreePath getLastChildPath(TreePath parent)
parent
parent
- is the topmost path to specifiedprotected 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()
.protected void pathWasExpanded(TreePath path)
path
- is the path that has been expanded.protected void pathWasCollapsed(TreePath path)
protected void installDefaults()
protected void installKeyboardActions()
protected void installListeners()
public void installUI(JComponent c)
installUI
in class ComponentUI
c
- the component to install UI forComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
protected void uninstallDefaults()
public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
c
- the component to uninstall UI forComponentUI.installUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void paint(Graphics g, JComponent c)
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
componentsprotected void ensureRowsAreVisible(int beginRow, int endRow)
beginRow
- is the first rowendRow
- is the last rowpublic void setPreferredMinSize(Dimension newSize)
newSize
- is the new preferred minimum size.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 componentspublic Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
c
- the component whose preferred size is being queried.checkConsistancy
- if true must check consistancypublic Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
c
- the component whose min size is being queried.null
to indicate that
c
’s layout manager should be asked
to calculate the minimum size.public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
c
- the component whose preferred size is being queriedprotected void completeEditing()
getInvokesStopCellEditing
, stopCellEditing will be 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)
messageStop
- message to stop editingmessageCancel
- message to cancel editingmessageTree
- message to treeModelprotected boolean startEditing(TreePath path, MouseEvent event)
path
- is the path to start editingevent
- is the MouseEvent performed on the pathprotected void checkForClickInExpandControl(TreePath path, int mouseX, int mouseY)
mouseX
and mouseY
are in the expand or
collapse region of the row, this will toggle the row.path
- the path we are concerned withmouseX
- is the cursor's x positionmouseY
- is the cursor's y positionprotected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY)
mouseX
and mouseY
fall in
the area of row that is used to expand/collpse the node and the node at row
does not represent a leaf.path
- the path we are concerned withmouseX
- is the cursor's x positionmouseY
- is the cursor's y positionmouseX
and mouseY
fall in
the area of row that is used to expand/collpse the node and the
node at row does not represent a leaf.protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY)
path
- the path we are concerned withmouseX
- is the cursor's x positionmouseY
- is the cursor's y positionprotected void toggleExpandState(TreePath path)
path
- the path we are concerned withprotected boolean isToggleSelectionEvent(MouseEvent event)
event
- is the MouseEvent performed on the row.protected boolean isMultiSelectEvent(MouseEvent event)
event
- is the MouseEvent performed on the node.protected boolean isToggleEvent(MouseEvent event)
event
- is the MouseEvent performed on the row.protected void selectPathForEvent(TreePath path, MouseEvent event)
path
- is the path selected for an eventevent
- is the MouseEvent performed on the path.isToggleSelectionEvent(MouseEvent)
,
isMultiSelectEvent(MouseEvent)
protected boolean isLeaf(int row)
row
is a leaf.row
- is the row we are concerned with.row
is a leaf.protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
g
- is the graphic contextc
- is the component the new line will belong tox
- is the horizonal positiontop
- specifies the top of the linebottom
- specifies the bottom of the lineprotected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
g
- is the graphic contextc
- is the component the new line will belong toy
- is the vertical positionleft
- specifies the left point of the lineright
- specifies the right point of the lineprotected void drawCentered(Component c, Graphics g, Icon icon, int x, int y)
c
- is the component the new line will belong tog
- is the graphic contexticon
- is the icon which will be drawnx
- is the center position in x-directiony
- is the center position in y-directionprotected void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2)
g
- - the graphics configuration.y
- - the y location to start drawing atx1
- - the x location to start drawing atx2
- - the x location to finish drawing atprotected void drawDashedVerticalLine(Graphics g, int x, int y1, int y2)
g
- - the graphics configuration.x
- - the x location to start drawing aty1
- - the y location to start drawing aty2
- - the y location to finish drawing atprotected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
g
- - the graphics configurationclipBounds
- -insets
- -bounds
- - bounds of expand controlpath
- - path to draw control forrow
- - row to draw control forisExpanded
- - is the row expandedhasBeenExpanded
- - has the row already been expandedisLeaf
- - is the path a leafprotected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
g
- - the graphics configurationclipBounds
- -insets
- -bounds
- - bounds of the cellpath
- - path to draw leg forrow
- - row to start drawing atisExpanded
- - is the row expandedhasBeenExpanded
- - has the row already been expandedisLeaf
- - is the path a leafprotected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
g
- - the graphics configuration.clipBounds
- -insets
- -path
- - the path to draw the vertical part for.protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
g
- - the graphics configurationclipBounds
- -insets
- -bounds
- - bounds of expand controlpath
- - path to draw control forrow
- - row to draw control forisExpanded
- - is the row expandedhasBeenExpanded
- - has the row already been expandedisLeaf
- - is the path a leafprotected void prepareForUIUninstall()
protected boolean shouldPaintExpandControl(TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
path
- - current path to check for.row
- - current row to check for.isExpanded
- - true if the path is expandedhasBeenExpanded
- - true if the path has been expanded alreadyisLeaf
- - true if the row is a leadprotected int getRowX(int row, int depth)