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

Variable Index

 o cellEditor
Editor for the tree.
 o collapsedIcon
 o currentCellRenderer
Renderer that is being used to do the actual cell drawing.
 o editingComponent
When editing, this will be the Component that is doing the actual editing.
 o editingNode
Node that is being edited.
 o expandedIcon
 o hashColor
Color used to draw hash marks.
 o isKeyDown
Set to true while keyPressed is active.
 o lastSelectedRow
Index of the row that was last selected.
 o leftChildIndent
Distance between left margin and where verical dashes will be drawn.
 o preferredMinSize
Minimum preferred size.
 o rendererPane
Used to paint the TreeCellRenderer.
 o repeatKeyAction
Key code that is being generated for.
 o rightChildIndent
Distance to add to leftChildIndent to determine where cell contents will be drawn.
 o stopEditingInCompleteEditing
Set to false when editing and startEditing() returns true meaning the node should be selected before editing, used in completeEditing.
 o totalChildIndent
Total distance that will be indented.
 o tree
Component that we're going to be drawing into.

Constructor Index

 o BasicTreeUI()

Method Index

 o cancelEditing()
Cancels the current editing session.
 o 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.
 o completeEditing(boolean, boolean, boolean)
Stops the editing session.
 o createNodeForValue(Object)
Creates an instance of BasicVisibleTreeNode.
 o createUI(JTree)
 o deinstallUI(JComponent)
 o editingCanceled(ChangeEvent)
Stops the editing session by messaging cancelEditing(false).
 o editingStarted(ChangeEvent)
Does nothing.
 o editingStopped(ChangeEvent)
Stops the editing session by messaging stopEditing(false).
 o 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.
 o ensureRowsAreVisible(int, int)
Ensures that the rows identified by beginRow throug endRow are visible.
 o focusGained(FocusEvent)
Invoked when focus is activated on the tree we're in, should redraw for selected component.
 o focusLost(FocusEvent)
Invoked when focus is removed on the tree we're in, should redraw for selected component.
 o getCellRenderer()
Return currentCellRenderer, which will either be the trees renderer, or defaultCellRenderer, which ever wasn't null.
 o getCollapsedIcon()
 o getDefaultCellEditor()
Creates a default cell editor.
 o getDefaultCellRenderer()
Returns the default cell renderer that is used to do the stamping of each node.
 o getEditingPath()
Returns the path to the element that is being edited.
 o getExpandedIcon()
 o getHashColor()
 o getInsets(JComponent)
 o getLeftChildIndent()
 o 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.
 o getMinimumSize(JComponent)
Returns the minimum size for this component.
 o getPreferredMinSize()
Returns the minimum preferred size.
 o getPreferredSize(JComponent)
Returns the preferred size to properly display the tree, this is a cover method for getPreferredSize(c, false).
 o getPreferredSize(JComponent, boolean)
Returns the preferred size to represent the tree in c.
 o getRightChildIndent()
 o getSizeOfNode(AbstractTreeUI. VisibleTreeNode)
Messages the tree to configure the cell, and returns the the size of the component.
 o 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.
 o installUI(JComponent)
 o isEditing()
Returns true if the tree is being edited.
 o keyPressed(KeyEvent)
 o keyReleased(KeyEvent)
 o keyTyped(KeyEvent)
 o mouseClicked(MouseEvent)
Invoked when the mouse has been clicked on a component.
 o mouseEntered(MouseEvent)
Invoked when the mouse enters a component.
 o mouseExited(MouseEvent)
Invoked when the mouse exits a component.
 o mousePressed(MouseEvent)
Invoked when a mouse button has been pressed on a component.
 o mouseReleased(MouseEvent)
Invoked when a mouse button has been released on a component.
 o nodeWasCollapsed(AbstractTreeUI. VisibleTreeNode)
Messaged from the VisibleTreeNode after it has collapsed.
 o nodeWasExpanded(AbstractTreeUI. VisibleTreeNode)
Messaged from the VisibleTreeNode after it has been expanded.
 o paint(Graphics, JComponent)
 o propertyChange(PropertyChangeEvent)
Based on the value has changed will message the appropriate method.
 o rebuild()
Stops editing and messags super.
 o repaintNode(AbstractTreeUI. VisibleTreeNode)
Repaints the particular node by getting its bounds.
 o 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).
 o scrollRowToVisible(int)
Scrolls the item identified by row to be visible.
 o setCollapsedIcon(Icon)
 o setExpandedIcon(Icon)
 o setHashColor(Color)
 o setLeftChildIndent(int)
 o setModel(TreeModel)
Stops editing and messages super.
 o setPreferredMinSize(Dimension)
Sets the preferred minimum size.
 o setRightChildIndent(int)
 o setSelectedPath(JTreePath, boolean)
Stops editing and messags super.
 o setSelectedRow(int, boolean)
Stops editing and messags super.
 o setSelectionModel(TreeSelectionModel)
Stops editing and messags super.
 o setupKeyboard()
Registers for keyboard events to manipulate the current selection.
 o startEditing(AbstractTreeUI. VisibleTreeNode, MouseEvent)
Will start editing for node if there is a cellEditor and startEditing returns true.
 o startEditingAtPath(JTreePath)
Selects the last item in path and tries to edit it.
 o stopEditing()
Stops the current editing session, returns true if the tree is current editing and the editor returns true from stopEditing().
 o treeRendererChanged(JTree)
Messaged from the tree we're in when the renderer has changed.
 o unsetKeyboard()
Unregisters for keyboard events that were previously registered for in setupKeyboard.
 o updateCellEditor()
Updates the cellEditor based on the editability of the JTree that we're contained in.
 o valueChanged(TreeSelectionEvent)
Messaged when the selection changes in the tree we're displaying for.
 o visibleNodesChanged()
Messaged whenever nodes are added/removed from the visible list, or the height/width of a node changes.

Variables

 o collapsedIcon
 protected Icon collapsedIcon
 o expandedIcon
 protected Icon expandedIcon
 o hashColor
 protected Color hashColor
Color used to draw hash marks. If null no hash marks will be drawn.

 o leftChildIndent
 protected int leftChildIndent
Distance between left margin and where verical dashes will be drawn.

 o rightChildIndent
 protected int rightChildIndent
Distance to add to leftChildIndent to determine where cell contents will be drawn.

 o totalChildIndent
 protected int totalChildIndent
Total distance that will be indented. The sum of leftChildIndent and rightChildIndent.

 o preferredMinSize
 protected Dimension preferredMinSize
Minimum preferred size.

 o lastSelectedRow
 protected int lastSelectedRow
Index of the row that was last selected.

 o tree
 protected JTree tree
Component that we're going to be drawing into.

 o currentCellRenderer
 protected TreeCellRenderer currentCellRenderer
Renderer that is being used to do the actual cell drawing.

 o cellEditor
 protected TreeCellEditor cellEditor
Editor for the tree.

 o editingComponent
 protected Component editingComponent
When editing, this will be the Component that is doing the actual editing.

 o editingNode
 protected AbstractTreeUI. VisibleTreeNode editingNode
Node that is being edited.

 o repeatKeyAction
 protected JAction repeatKeyAction
Key code that is being generated for.

 o isKeyDown
 protected boolean isKeyDown
Set to true while keyPressed is active.

 o stopEditingInCompleteEditing
 protected boolean stopEditingInCompleteEditing
Set to false when editing and startEditing() returns true meaning the node should be selected before editing, used in completeEditing.

 o rendererPane
 protected CellRendererPane rendererPane
Used to paint the TreeCellRenderer.

Constructors

 o BasicTreeUI
 public BasicTreeUI()

Methods

 o createUI
 public static TreeUI createUI(JTree x)
 o setLeftChildIndent
 public void setLeftChildIndent(int newAmount)
 o getLeftChildIndent
 public int getLeftChildIndent()
 o setRightChildIndent
 public void setRightChildIndent(int newAmount)
 o getRightChildIndent
 public int getRightChildIndent()
 o setExpandedIcon
 public void setExpandedIcon(Icon newG)
 o getExpandedIcon
 public Icon getExpandedIcon()
 o setCollapsedIcon
 public void setCollapsedIcon(Icon newG)
 o getCollapsedIcon
 public Icon getCollapsedIcon()
 o setHashColor
 public void setHashColor(Color newColor)
 o getHashColor
 public Color getHashColor()
 o installUI
 public void installUI(JComponent c)
 o deinstallUI
 public void deinstallUI(JComponent c)
 o 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.

 o setupKeyboard
 protected void setupKeyboard()
Registers for keyboard events to manipulate the current selection.

 o unsetKeyboard
 protected void unsetKeyboard()
Unregisters for keyboard events that were previously registered for in setupKeyboard.

 o 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.

 o treeRendererChanged
 public void treeRendererChanged(JTree tree)
Messaged from the tree we're in when the renderer has changed. Updates the size if necessary.

 o 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.

 o getDefaultCellEditor
 protected TreeCellEditor getDefaultCellEditor()
Creates a default cell editor.

 o getDefaultCellRenderer
 public TreeCellRenderer getDefaultCellRenderer()
Returns the default cell renderer that is used to do the stamping of each node.

 o 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
 o 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
 o 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
 o nodeWasExpanded
 protected void nodeWasExpanded(AbstractTreeUI. VisibleTreeNode node)
Messaged from the VisibleTreeNode after it has been expanded.

Overrides:
nodeWasExpanded in class AbstractTreeUI
 o nodeWasCollapsed
 protected void nodeWasCollapsed(AbstractTreeUI. VisibleTreeNode node)
Messaged from the VisibleTreeNode after it has collapsed.

Overrides:
nodeWasCollapsed in class AbstractTreeUI
 o ensureRowsAreVisible
 public void ensureRowsAreVisible(int beginRow,
                                  int endRow)
Ensures that the rows identified by beginRow throug endRow are visible.

 o 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.

 o 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).

 o 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.

 o 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().

 o paint
 public void paint(Graphics g,
                   JComponent c)
 o setPreferredMinSize
 public void setPreferredMinSize(Dimension newSize)
Sets the preferred minimum size.

 o getPreferredMinSize
 public Dimension getPreferredMinSize()
Returns the minimum preferred size.

 o getPreferredSize
 public Dimension getPreferredSize(JComponent c)
Returns the preferred size to properly display the tree, this is a cover method for getPreferredSize(c, false).

 o 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.

 o getMinimumSize
 public Dimension getMinimumSize(JComponent c)
Returns the minimum size for this component. Which will be the min preferred size or 0, 0.

 o 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.

 o getInsets
 public Insets getInsets(JComponent c)
 o 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
 o editingStarted
 public void editingStarted(ChangeEvent e)
Does nothing.

 o editingStopped
 public void editingStopped(ChangeEvent e)
Stops the editing session by messaging stopEditing(false).

 o editingCanceled
 public void editingCanceled(ChangeEvent e)
Stops the editing session by messaging cancelEditing(false).

 o isEditing
 public boolean isEditing()
Returns true if the tree is being edited. The item that is being edited can be returned by getSelectionPath().

 o stopEditing
 public boolean stopEditing()
Stops the current editing session, returns true if the tree is current editing and the editor returns true from stopEditing().

 o cancelEditing
 public void cancelEditing()
Cancels the current editing session.

 o 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.

 o 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.

 o startEditing
 protected boolean startEditing(AbstractTreeUI. VisibleTreeNode node,
                                MouseEvent event)
Will start editing for node if there is a cellEditor and startEditing returns true.

 o getEditingPath
 public JTreePath getEditingPath()
Returns the path to the element that is being edited.

 o mouseClicked
 public void mouseClicked(MouseEvent e)
Invoked when the mouse has been clicked on a component.

 o mousePressed
 public void mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.

 o mouseReleased
 public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.

 o mouseEntered
 public void mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.

 o mouseExited
 public void mouseExited(MouseEvent e)
Invoked when the mouse exits a component.

 o focusGained
 public void focusGained(FocusEvent e)
Invoked when focus is activated on the tree we're in, should redraw for selected component.

 o focusLost
 public void focusLost(FocusEvent e)
Invoked when focus is removed on the tree we're in, should redraw for selected component.

 o keyPressed
 public void keyPressed(KeyEvent e)
 o keyReleased
 public void keyReleased(KeyEvent e)
 o keyTyped
 public void keyTyped(KeyEvent e)
 o setModel
 public void setModel(TreeModel newModel)
Stops editing and messages super.

Overrides:
setModel in class AbstractTreeUI
 o rebuild
 public void rebuild()
Stops editing and messags super.

Overrides:
rebuild in class AbstractTreeUI
 o setSelectedPath
 public void setSelectedPath(JTreePath path,
                             boolean addToSelection)
Stops editing and messags super.

Overrides:
setSelectedPath in class AbstractTreeUI
 o setSelectedRow
 public void setSelectedRow(int row,
                            boolean addToSelection)
Stops editing and messags super.

Overrides:
setSelectedRow in class AbstractTreeUI
 o setSelectionModel
 public void setSelectionModel(TreeSelectionModel newLSM)
Stops editing and messags super.

Overrides:
setSelectionModel in class AbstractTreeUI
 o createNodeForValue
 protected AbstractTreeUI. VisibleTreeNode createNodeForValue(Object value)
Creates an instance of BasicVisibleTreeNode.

Overrides:
createNodeForValue in class AbstractTreeUI
 o repaintNode
 protected void repaintNode(AbstractTreeUI. VisibleTreeNode node)
Repaints the particular node by getting its bounds.


All Packages  Class Hierarchy  This Package  Previous  Next  Index