All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.swing.basic.VisibleTreeNode
java.lang.Object
|
+----java.awt.swing.tree.DefaultMutableTreeNode
|
+----java.awt.swing.basic.VisibleTreeNode
- public class VisibleTreeNode
- extends DefaultMutableTreeNode
VisibleTreeNode is used by AbstractTreeUI to keep track of each of
the nodes that have been expanded. This will also cache the preferred
size of the value this represents.
EMPTY_SIZE-
expanded- Is this node currently expanded?
hasBeenExpanded- Has this node been expanded at least once?
isValid- Is this node in a tree?
preferredSize- Preferred size needed to draw the user object.
treeUI- AbstractTreeUI this was created for.
yOrigin- Y location that the user object will be drawn at.
VisibleTreeNode(AbstractTreeUI, Object, int)
-
children()
- Returns the children of the receiver.
collapse()
- Collapsed the receiver.
collapse(boolean)
- Collapses this node in the tree.
didAdjustTree()
- Messaged from expand and collapse.
expand()
- Expands the receiver.
expand(boolean)
- Expands this node in the tree.
getLastVisibleNode()
- Returns the last visible node that is a child of this
instance.
getLoadedChildren(boolean)
- If createIfNeeded is true the children will be loaded from
the model if they haven't already been loaded.
getModelChildCount()
- Returns the number of children this will have.
getNodeBounds()
- Returns the location and size of this node.
getPreferredSize()
- Returns the preferred size needed to draw the value this
node represents.
getRow()
- Returns the row of the receiver.
getTreePath()
- Returns a TreePath instance for this node.
getValue()
- Returns the value the receiver is representing.
getVisibleLevel()
- The highest visible nodes have a depth of 0.
getVisibleNodes()
- Returns the visibleNodes instance variable of the tree the receiver
is contained in.
getYOrigin()
- Returns the y origin the user object will be drawn at.
hasBeenExpanded()
- Returns true if this node has been expanded at least once.
hasValidSize()
- Returns true if this node has a valid size.
isExpanded()
- Returns true if the receiver has been expanded.
isLeaf()
- Returns true if the receiver is a leaf.
isSelected()
- Returns true if the receiver is selected.
isVisible()
- Returns true if the receiver is currently visible.
modelChildCountChanged()
- Messaged when the child count has changed and this node hasn't
yet been expanded.
setParent(MutableTreeNode)
- Passes this message on to super and if the newParent is
null, meaning we're no longer in the tree.
setYOrigin(int)
- Sets y origin the user object will be drawn at to
newYOrigin.
shiftYOriginBy(int)
- Shifts the y origin by
offset
.
toggleExpanded()
- Toggles the receiver between expanded and collapsed.
updatePreferredSize()
-
updatePreferredSize(int)
- Updates the preferred size by asking the current renderer
for the Dimension needed to draw the user object this
instance represents.
updateTreeYLocationsFrom(int)
- Messages the tree with updateYLocationsFrom(row).
visibleChildCount()
- Returns the number of visible children.
treeUI
protected AbstractTreeUI treeUI
- AbstractTreeUI this was created for.
preferredSize
protected Dimension preferredSize
- Preferred size needed to draw the user object.
yOrigin
protected int yOrigin
- Y location that the user object will be drawn at.
expanded
protected boolean expanded
- Is this node currently expanded?
hasBeenExpanded
protected boolean hasBeenExpanded
- Has this node been expanded at least once?
isValid
protected boolean isValid
- Is this node in a tree?
EMPTY_SIZE
public static final Dimension EMPTY_SIZE
VisibleTreeNode
public VisibleTreeNode(AbstractTreeUI treeUI,
Object value,
int index)
setParent
public void setParent(MutableTreeNode newParent)
- Passes this message on to super and if the newParent is
null, meaning we're no longer in the tree. markInvalid
is messaged.
- Overrides:
- setParent in class DefaultMutableTreeNode
setYOrigin
protected void setYOrigin(int newYOrigin)
- Sets y origin the user object will be drawn at to
newYOrigin.
getYOrigin
public int getYOrigin()
- Returns the y origin the user object will be drawn at.
shiftYOriginBy
protected void shiftYOriginBy(int offset)
- Shifts the y origin by
offset
.
updatePreferredSize
public void updatePreferredSize()
updatePreferredSize
protected void updatePreferredSize(int index)
- Updates the preferred size by asking the current renderer
for the Dimension needed to draw the user object this
instance represents.
hasValidSize
public boolean hasValidSize()
- Returns true if this node has a valid size.
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size needed to draw the value this
node represents. Will always return a valid dimenion, but
dimension may be 0, 0
getNodeBounds
public Rectangle getNodeBounds()
- Returns the location and size of this node.
getVisibleLevel
public int getVisibleLevel()
- The highest visible nodes have a depth of 0.
getRow
public int getRow()
- Returns the row of the receiver.
hasBeenExpanded
public boolean hasBeenExpanded()
- Returns true if this node has been expanded at least once.
isExpanded
public boolean isExpanded()
- Returns true if the receiver has been expanded.
isSelected
public boolean isSelected()
- Returns true if the receiver is selected.
isLeaf
public boolean isLeaf()
- Returns true if the receiver is a leaf.
- Overrides:
- isLeaf in class DefaultMutableTreeNode
getLastVisibleNode
public VisibleTreeNode getLastVisibleNode()
- Returns the last visible node that is a child of this
instance.
getLoadedChildren
public Enumeration getLoadedChildren(boolean createIfNeeded)
- If createIfNeeded is true the children will be loaded from
the model if they haven't already been loaded. The children
are then loaded, regardless of whether or not this
node is currently expanded.
children
public Enumeration children()
- Returns the children of the receiver.
If the receiver is not currently expanded, this will return an
empty enumeration.
- Overrides:
- children in class DefaultMutableTreeNode
isVisible
public boolean isVisible()
- Returns true if the receiver is currently visible.
modelChildCountChanged
public void modelChildCountChanged()
- Messaged when the child count has changed and this node hasn't
yet been expanded. This is meant to be used by subclassers.
getModelChildCount
public int getModelChildCount()
- Returns the number of children this will have. If the children
have not yet been loaded, this messages the model.
visibleChildCount
public int visibleChildCount()
- Returns the number of visible children. This is a deep search.
toggleExpanded
public void toggleExpanded()
- Toggles the receiver between expanded and collapsed.
didAdjustTree
protected void didAdjustTree()
- Messaged from expand and collapse. This is meant for subclassers
that may wish to do something interesting with this.
expand
public void expand()
- Expands the receiver.
expand
protected void expand(boolean adjustTree)
- Expands this node in the tree. This will load the children
from the treeModel if this node has not previously been
expanded. If adjustTree is true the tree and selection
are updated accordingly.
collapse
public void collapse()
- Collapsed the receiver.
collapse
protected void collapse(boolean adjustTree)
- Collapses this node in the tree. If adjustTree is
true the tree and selection are updated accordingly.
getValue
public Object getValue()
- Returns the value the receiver is representing. This is a cover
for getUserObject.
getTreePath
protected TreePath getTreePath()
- Returns a TreePath instance for this node.
getVisibleNodes
protected Vector getVisibleNodes()
- Returns the visibleNodes instance variable of the tree the receiver
is contained in.
updateTreeYLocationsFrom
protected void updateTreeYLocationsFrom(int row)
- Messages the tree with updateYLocationsFrom(row).
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature