All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.basic.BasicTreeUI
java.lang.Object
|
+----com.sun.java.swing.basic.AbstractTreeUI
|
+----com.sun.java.swing.basic.BasicTreeUI
- public class BasicTreeUI
- extends AbstractTreeUI
- implements CellEditorListener, FocusListener, KeyListener, MouseListener, PropertyChangeListener, TreeUI
-
cellEditor
- Editor for the tree.
-
collapsedIcon
-
-
currentCellRenderer
- Renderer that is being used to do the actual cell drawing.
-
editingComponent
- When editing, this will be the Component that is doing the actual
editing.
-
editingNode
- Node that is being edited.
-
expandedIcon
-
-
hashColor
- Color used to draw hash marks.
-
isKeyDown
- Set to true while keyPressed is active.
-
lastSelectedRow
- Index of the row that was last selected.
-
leftChildIndent
- Distance between left margin and where verical dashes will be
drawn.
-
preferredMinSize
- Minimum preferred size.
-
rendererPane
- Used to paint the TreeCellRenderer.
-
repeatKeyAction
- Key code that is being generated for.
-
rightChildIndent
- Distance to add to leftChildIndent to determine where cell
contents will be drawn.
-
stopEditingInCompleteEditing
- Set to false when editing and startEditing() returns true meaning
the node should be selected before editing, used in completeEditing.
-
totalChildIndent
- Total distance that will be indented.
-
tree
- Component that we're going to be drawing into.
-
BasicTreeUI()
-
-
cancelEditing()
- Cancels the current editing session.
-
checkConsistency()
- Checks to insure that the all the sizes of the nodes are valid,
and if there isn't a valid node size, as determined by
updateNodeSizes in our superclass, than updateNodeSizes()
is messaged.
-
completeEditing(boolean, boolean, boolean)
- Stops the editing session.
-
createNodeForValue(Object)
- Creates an instance of BasicVisibleTreeNode.
-
createUI(JTree)
-
-
deinstallUI(JComponent)
-
-
editingCanceled(ChangeEvent)
- Stops the editing session by messaging cancelEditing(false).
-
editingStarted(ChangeEvent)
-
Does nothing.
-
editingStopped(ChangeEvent)
- Stops the editing session by messaging stopEditing(false).
-
ensureRectIsVisible(Rectangle)
- If the tree is contained in a JViewport and any portion of
rect is not visible the location of the tree is adjusted to
make as much of rect visible as is possible.
-
ensureRowsAreVisible(int, int)
- Ensures that the rows identified by beginRow throug endRow are
visible.
-
focusGained(FocusEvent)
- Invoked when focus is activated on the tree we're in, should
redraw for selected component.
-
focusLost(FocusEvent)
- Invoked when focus is removed on the tree we're in, should
redraw for selected component.
-
getCellRenderer()
- Return currentCellRenderer, which will either be the trees
renderer, or defaultCellRenderer, which ever wasn't null.
-
getCollapsedIcon()
-
-
getDefaultCellEditor()
- Creates a default cell editor.
-
getDefaultCellRenderer()
- Returns the default cell renderer that is used to do the
stamping of each node.
-
getEditingPath()
- Returns the path to the element that is being edited.
-
getExpandedIcon()
-
-
getHashColor()
-
-
getInsets(JComponent)
-
-
getLeftChildIndent()
-
-
getMaximumSize(JComponent)
- Returns the maximum size for this component, which will be the
preferred size if the instance is currently in a JTree, or 0, 0.
-
getMinimumSize(JComponent)
- Returns the minimum size for this component.
-
getPreferredMinSize()
- Returns the minimum preferred size.
-
getPreferredSize(JComponent)
- Returns the preferred size to properly display the tree,
this is a cover method for getPreferredSize(c, false).
-
getPreferredSize(JComponent, boolean)
- Returns the preferred size to represent the tree in
c.
-
getRightChildIndent()
-
-
getSizeOfNode(AbstractTreeUI. VisibleTreeNode)
- Messages the tree to configure the cell, and returns the
the size of the component.
-
getXOriginOfNode(AbstractTreeUI. VisibleTreeNode)
- Returns the x origin of the given node, which is based on whether
or not we're showing handles and the visible level of the node
multiplied by the right and left indent factor.
-
installUI(JComponent)
-
-
isEditing()
- Returns true if the tree is being edited.
-
keyPressed(KeyEvent)
-
-
keyReleased(KeyEvent)
-
-
keyTyped(KeyEvent)
-
-
mouseClicked(MouseEvent)
- Invoked when the mouse has been clicked on a component.
-
mouseEntered(MouseEvent)
- Invoked when the mouse enters a component.
-
mouseExited(MouseEvent)
- Invoked when the mouse exits a component.
-
mousePressed(MouseEvent)
- Invoked when a mouse button has been pressed on a component.
-
mouseReleased(MouseEvent)
- Invoked when a mouse button has been released on a component.
-
nodeWasCollapsed(AbstractTreeUI. VisibleTreeNode)
- Messaged from the VisibleTreeNode after it has collapsed.
-
nodeWasExpanded(AbstractTreeUI. VisibleTreeNode)
- Messaged from the VisibleTreeNode after it has been expanded.
-
paint(Graphics, JComponent)
-
-
propertyChange(PropertyChangeEvent)
- Based on the value has changed will message the appropriate
method.
-
rebuild()
- Stops editing and messags super.
-
repaintNode(AbstractTreeUI. VisibleTreeNode)
- Repaints the particular node by getting its bounds.
-
scrollPathToVisible(JTreePath)
- Makes sure all the path components in path are expanded (accept
for the last path component) and tries to scroll the resulting path
to be visible (the scrolling will only work if the JTree is
contained in a JScrollPane).
-
scrollRowToVisible(int)
- Scrolls the item identified by row to be visible.
-
setCollapsedIcon(Icon)
-
-
setExpandedIcon(Icon)
-
-
setHashColor(Color)
-
-
setLeftChildIndent(int)
-
-
setModel(TreeModel)
- Stops editing and messages super.
-
setPreferredMinSize(Dimension)
- Sets the preferred minimum size.
-
setRightChildIndent(int)
-
-
setSelectedPath(JTreePath, boolean)
- Stops editing and messags super.
-
setSelectedRow(int, boolean)
- Stops editing and messags super.
-
setSelectionModel(TreeSelectionModel)
- Stops editing and messags super.
-
setupKeyboard()
- Registers for keyboard events to manipulate the current selection.
-
startEditing(AbstractTreeUI. VisibleTreeNode, MouseEvent)
- Will start editing for node if there is a cellEditor and
startEditing returns true.
-
startEditingAtPath(JTreePath)
- Selects the last item in path and tries to edit it.
-
stopEditing()
- Stops the current editing session, returns true if the tree is
current editing and the editor returns true from stopEditing().
-
treeRendererChanged(JTree)
- Messaged from the tree we're in when the renderer has changed.
-
unsetKeyboard()
- Unregisters for keyboard events that were previously registered for
in setupKeyboard.
-
updateCellEditor()
-
Updates the cellEditor based on the editability of the JTree that
we're contained in.
-
valueChanged(TreeSelectionEvent)
- Messaged when the selection changes in the tree we're displaying
for.
-
visibleNodesChanged()
- Messaged whenever nodes are added/removed from the visible list,
or the height/width of a node changes.
collapsedIcon
protected Icon collapsedIcon
expandedIcon
protected Icon expandedIcon
hashColor
protected Color hashColor
- Color used to draw hash marks. If null no hash marks will be
drawn.
leftChildIndent
protected int leftChildIndent
- Distance between left margin and where verical dashes will be
drawn.
rightChildIndent
protected int rightChildIndent
- Distance to add to leftChildIndent to determine where cell
contents will be drawn.
totalChildIndent
protected int totalChildIndent
- Total distance that will be indented. The sum of leftChildIndent
and rightChildIndent.
preferredMinSize
protected Dimension preferredMinSize
- Minimum preferred size.
lastSelectedRow
protected int lastSelectedRow
- Index of the row that was last selected.
tree
protected JTree tree
- Component that we're going to be drawing into.
currentCellRenderer
protected TreeCellRenderer currentCellRenderer
- Renderer that is being used to do the actual cell drawing.
cellEditor
protected TreeCellEditor cellEditor
- Editor for the tree.
editingComponent
protected Component editingComponent
- When editing, this will be the Component that is doing the actual
editing.
editingNode
protected AbstractTreeUI. VisibleTreeNode editingNode
- Node that is being edited.
repeatKeyAction
protected JAction repeatKeyAction
- Key code that is being generated for.
isKeyDown
protected boolean isKeyDown
- Set to true while keyPressed is active.
stopEditingInCompleteEditing
protected boolean stopEditingInCompleteEditing
- Set to false when editing and startEditing() returns true meaning
the node should be selected before editing, used in completeEditing.
rendererPane
protected CellRendererPane rendererPane
- Used to paint the TreeCellRenderer.
BasicTreeUI
public BasicTreeUI()
createUI
public static TreeUI createUI(JTree x)
setLeftChildIndent
public void setLeftChildIndent(int newAmount)
getLeftChildIndent
public int getLeftChildIndent()
setRightChildIndent
public void setRightChildIndent(int newAmount)
getRightChildIndent
public int getRightChildIndent()
setExpandedIcon
public void setExpandedIcon(Icon newG)
getExpandedIcon
public Icon getExpandedIcon()
setCollapsedIcon
public void setCollapsedIcon(Icon newG)
getCollapsedIcon
public Icon getCollapsedIcon()
setHashColor
public void setHashColor(Color newColor)
getHashColor
public Color getHashColor()
installUI
public void installUI(JComponent c)
deinstallUI
public void deinstallUI(JComponent c)
propertyChange
public void propertyChange(PropertyChangeEvent event)
- Based on the value has changed will message the appropriate
method. Which is one of treeRendererChanged, setModel,
setRootVisible, setShowsRootHandles, or setRowHeight.
setupKeyboard
protected void setupKeyboard()
- Registers for keyboard events to manipulate the current selection.
unsetKeyboard
protected void unsetKeyboard()
- Unregisters for keyboard events that were previously registered for
in setupKeyboard.
updateCellEditor
protected void updateCellEditor()
- Updates the cellEditor based on the editability of the JTree that
we're contained in. If the tree is editable but doesn't have a
cellEditor, a basic one will be used.
treeRendererChanged
public void treeRendererChanged(JTree tree)
- Messaged from the tree we're in when the renderer has changed.
Updates the size if necessary.
checkConsistency
public boolean checkConsistency()
- Checks to insure that the all the sizes of the nodes are valid,
and if there isn't a valid node size, as determined by
updateNodeSizes in our superclass, than updateNodeSizes()
is messaged.
getDefaultCellEditor
protected TreeCellEditor getDefaultCellEditor()
- Creates a default cell editor.
getDefaultCellRenderer
public TreeCellRenderer getDefaultCellRenderer()
- Returns the default cell renderer that is used to do the
stamping of each node.
getXOriginOfNode
public int getXOriginOfNode(AbstractTreeUI. VisibleTreeNode node)
- Returns the x origin of the given node, which is based on whether
or not we're showing handles and the visible level of the node
multiplied by the right and left indent factor.
- Overrides:
- getXOriginOfNode in class AbstractTreeUI
getSizeOfNode
public Dimension getSizeOfNode(AbstractTreeUI. VisibleTreeNode node)
- Messages the tree to configure the cell, and returns the
the size of the component.
- Overrides:
- getSizeOfNode in class AbstractTreeUI
visibleNodesChanged
public void visibleNodesChanged()
- Messaged whenever nodes are added/removed from the visible list,
or the height/width of a node changes. This updates the size
of the JTree we're drawing for based on the dimension
returned from getPreferredSize.
- Overrides:
- visibleNodesChanged in class AbstractTreeUI
nodeWasExpanded
protected void nodeWasExpanded(AbstractTreeUI. VisibleTreeNode node)
- Messaged from the VisibleTreeNode after it has been expanded.
- Overrides:
- nodeWasExpanded in class AbstractTreeUI
nodeWasCollapsed
protected void nodeWasCollapsed(AbstractTreeUI. VisibleTreeNode node)
- Messaged from the VisibleTreeNode after it has collapsed.
- Overrides:
- nodeWasCollapsed in class AbstractTreeUI
ensureRowsAreVisible
public void ensureRowsAreVisible(int beginRow,
int endRow)
- Ensures that the rows identified by beginRow throug endRow are
visible.
ensureRectIsVisible
public void ensureRectIsVisible(Rectangle rect)
- If the tree is contained in a JViewport and any portion of
rect is not visible the location of the tree is adjusted to
make as much of rect visible as is possible.
scrollPathToVisible
public void scrollPathToVisible(JTreePath path)
- Makes sure all the path components in path are expanded (accept
for the last path component) and tries to scroll the resulting path
to be visible (the scrolling will only work if the JTree is
contained in a JScrollPane).
scrollRowToVisible
public void scrollRowToVisible(int row)
- Scrolls the item identified by row to be visible. This will
only work if the JTree is contained in a JSrollPane.
getCellRenderer
public TreeCellRenderer getCellRenderer()
- Return currentCellRenderer, which will either be the trees
renderer, or defaultCellRenderer, which ever wasn't null.
currentCellRenderer is set as part of checkConsistency().
paint
public void paint(Graphics g,
JComponent c)
setPreferredMinSize
public void setPreferredMinSize(Dimension newSize)
- Sets the preferred minimum size.
getPreferredMinSize
public Dimension getPreferredMinSize()
- Returns the minimum preferred size.
getPreferredSize
public Dimension getPreferredSize(JComponent c)
- Returns the preferred size to properly display the tree,
this is a cover method for getPreferredSize(c, false).
getPreferredSize
public Dimension getPreferredSize(JComponent c,
boolean checkConsistancy)
- Returns the preferred size to represent the tree in
c. If checkConsistancy is true
checkConsistancy is messaged first.
getMinimumSize
public Dimension getMinimumSize(JComponent c)
- Returns the minimum size for this component. Which will be
the min preferred size or 0, 0.
getMaximumSize
public 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.
getInsets
public Insets getInsets(JComponent c)
valueChanged
public void valueChanged(TreeSelectionEvent event)
- Messaged when the selection changes in the tree we're displaying
for. Stops editing, messages super and displays the changed paths.
- Overrides:
- valueChanged in class AbstractTreeUI
editingStarted
public void editingStarted(ChangeEvent e)
- Does nothing.
editingStopped
public void editingStopped(ChangeEvent e)
- Stops the editing session by messaging stopEditing(false).
editingCanceled
public void editingCanceled(ChangeEvent e)
- Stops the editing session by messaging cancelEditing(false).
isEditing
public boolean isEditing()
- Returns true if the tree is being edited. The item that is being
edited can be returned by getSelectionPath().
stopEditing
public boolean stopEditing()
- Stops the current editing session, returns true if the tree is
current editing and the editor returns true from stopEditing().
cancelEditing
public void cancelEditing()
- Cancels the current editing session.
completeEditing
protected void completeEditing(boolean messageStop,
boolean messageCancel,
boolean messageTree)
- Stops the editing session. If messageStop is true the editor
is messaged with stopEditing, if messageCancel is true the
editor is messaged with cancelEditing.
startEditingAtPath
public void startEditingAtPath(JTreePath path)
- Selects the last item in path and tries to edit it. Editing will
fail if the CellEditor won't allow it for the selected item.
startEditing
protected boolean startEditing(AbstractTreeUI. VisibleTreeNode node,
MouseEvent event)
- Will start editing for node if there is a cellEditor and
startEditing returns true.
getEditingPath
public JTreePath getEditingPath()
- Returns the path to the element that is being edited.
mouseClicked
public void mouseClicked(MouseEvent e)
- Invoked when the mouse has been clicked on a component.
mousePressed
public void mousePressed(MouseEvent e)
- Invoked when a mouse button has been pressed on a component.
mouseReleased
public void mouseReleased(MouseEvent e)
- Invoked when a mouse button has been released on a component.
mouseEntered
public void mouseEntered(MouseEvent e)
- Invoked when the mouse enters a component.
mouseExited
public void mouseExited(MouseEvent e)
- Invoked when the mouse exits a component.
focusGained
public void focusGained(FocusEvent e)
- Invoked when focus is activated on the tree we're in, should
redraw for selected component.
focusLost
public void focusLost(FocusEvent e)
- Invoked when focus is removed on the tree we're in, should
redraw for selected component.
keyPressed
public void keyPressed(KeyEvent e)
keyReleased
public void keyReleased(KeyEvent e)
keyTyped
public void keyTyped(KeyEvent e)
setModel
public void setModel(TreeModel newModel)
- Stops editing and messages super.
- Overrides:
- setModel in class AbstractTreeUI
rebuild
public void rebuild()
- Stops editing and messags super.
- Overrides:
- rebuild in class AbstractTreeUI
setSelectedPath
public void setSelectedPath(JTreePath path,
boolean addToSelection)
- Stops editing and messags super.
- Overrides:
- setSelectedPath in class AbstractTreeUI
setSelectedRow
public void setSelectedRow(int row,
boolean addToSelection)
- Stops editing and messags super.
- Overrides:
- setSelectedRow in class AbstractTreeUI
setSelectionModel
public void setSelectionModel(TreeSelectionModel newLSM)
- Stops editing and messags super.
- Overrides:
- setSelectionModel in class AbstractTreeUI
createNodeForValue
protected AbstractTreeUI. VisibleTreeNode createNodeForValue(Object value)
- Creates an instance of BasicVisibleTreeNode.
- Overrides:
- createNodeForValue in class AbstractTreeUI
repaintNode
protected void repaintNode(AbstractTreeUI. VisibleTreeNode node)
- Repaints the particular node by getting its bounds.
All Packages Class Hierarchy This Package Previous Next Index