com.melloware.jukes.gui.view.node
Class AbstractTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.melloware.jukes.gui.view.node.AbstractTreeNode
All Implemented Interfaces:
NavigationNode, java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
ArtistNode, DiscNode, RootNode, TrackNode

public abstract class AbstractTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements NavigationNode

Abstract tree node class that all tree nodes must extend from. Supports lazy loading of children to conserve memory and better performance.

Copyright (c) 1999-2007 Melloware, Inc.

Version:
4.0
Author:
Emil A. Lefkof III
See Also:
DefaultMutableTreeNode, NavigationNode, Serialized Form

Field Summary
protected static java.awt.Font BASEFONT
          Base font used for all children to derive font from.
protected  boolean childrenLoaded
           
protected  java.awt.Font font
           
protected  java.awt.Color fontColor
           
protected  boolean loadingChildren
           
protected  AbstractJukesObject model
           
protected  NavigationNode parent
           
protected  Settings settings
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, userObject
 
Constructor Summary
AbstractTreeNode(NavigationNode aParent, AbstractJukesObject aModel)
          Constructor that takes the parent node and the domain model to contain.
 
Method Summary
 void add(javax.swing.tree.MutableTreeNode aNewChild)
           
 java.util.Enumeration children()
           
 void delete()
          Delete this domain object and it's tree node.
 boolean equals(java.lang.Object obj)
           
 javax.swing.tree.TreeNode getChildAt(int index)
           
 int getChildCount()
           
 java.awt.Font getFont()
          Returns this node's Font for the given selection state.
 java.awt.Color getFontColor()
          Gets the fontColor.
protected  MainFrame getMainFrame()
          Gets the MainFrame for the application.
protected  MainModule getMainModule()
          Gets the MainModule for the application.
 AbstractJukesObject getModel()
          Returns this node's model.
abstract  java.lang.String getName()
          Returns this node's name.
 javax.swing.Icon getNodeIcon(boolean selected)
          Returns the icon to represent this node and any overlays that should be applied.
 Settings getSettings()
          Gets the presentation settings.
 java.lang.Object getUserObject()
           
 int hashCode()
           
abstract  void loadChildren()
          Loads the node's child objects.
 void setFont(java.awt.Font aFont)
          Sets the font for this tree node.
 void setFontColor(java.awt.Color aFontColor)
          Sets the fontColor.
 void setSettings(Settings aSettings)
          Sets the Settings into this node.
 java.lang.String toString()
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
breadthFirstEnumeration, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.melloware.jukes.gui.view.node.NavigationNode
getIcon
 
Methods inherited from interface javax.swing.tree.TreeNode
getAllowsChildren, getIndex, getParent, isLeaf
 

Field Detail

BASEFONT

protected static final java.awt.Font BASEFONT
Base font used for all children to derive font from.


model

protected final AbstractJukesObject model

childrenLoaded

protected boolean childrenLoaded

loadingChildren

protected boolean loadingChildren

fontColor

protected java.awt.Color fontColor

font

protected java.awt.Font font

parent

protected final NavigationNode parent

settings

protected Settings settings
Constructor Detail

AbstractTreeNode

public AbstractTreeNode(NavigationNode aParent,
                        AbstractJukesObject aModel)
Constructor that takes the parent node and the domain model to contain.

Parameters:
aParent - the parent node
aModel - the domain model to contain in this node
Method Detail

getName

public abstract java.lang.String getName()
Returns this node's name. Subclasses typically implement this method by returning the model's name or identifier.

Specified by:
getName in interface NavigationNode
Returns:
this node's name

loadChildren

public abstract void loadChildren()
Loads the node's child objects. This is used for lazy loading and each subclass should implement this to retrieve its children.


getChildAt

public javax.swing.tree.TreeNode getChildAt(int index)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode
Overrides:
getChildAt in class javax.swing.tree.DefaultMutableTreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode
Overrides:
getChildCount in class javax.swing.tree.DefaultMutableTreeNode

getFont

public java.awt.Font getFont()
Description copied from interface: NavigationNode
Returns this node's Font for the given selection state.

Specified by:
getFont in interface NavigationNode
Returns:
this node's Font for the given selection state

getFontColor

public java.awt.Color getFontColor()
Gets the fontColor.

Specified by:
getFontColor in interface NavigationNode
Returns:
Returns the fontColor.

getModel

public AbstractJukesObject getModel()
Description copied from interface: NavigationNode
Returns this node's model.

Specified by:
getModel in interface NavigationNode
Returns:
this node's model

getNodeIcon

public javax.swing.Icon getNodeIcon(boolean selected)
Returns the icon to represent this node and any overlays that should be applied.

Specified by:
getNodeIcon in interface NavigationNode
Parameters:
selected - true if this node is currently selected
Returns:
the Icon to display

getSettings

public Settings getSettings()
Gets the presentation settings.

Returns:
Returns the settings.

getUserObject

public java.lang.Object getUserObject()
Overrides:
getUserObject in class javax.swing.tree.DefaultMutableTreeNode

setFont

public void setFont(java.awt.Font aFont)
Sets the font for this tree node.

Parameters:
aFont - The font to set.

setFontColor

public void setFontColor(java.awt.Color aFontColor)
Sets the fontColor.

Parameters:
aFontColor - The fontColor to set.

setSettings

public void setSettings(Settings aSettings)
Sets the Settings into this node.

Parameters:
aSettings - The settings to set.

add

public void add(javax.swing.tree.MutableTreeNode aNewChild)
Overrides:
add in class javax.swing.tree.DefaultMutableTreeNode

children

public java.util.Enumeration children()
Specified by:
children in interface javax.swing.tree.TreeNode
Overrides:
children in class javax.swing.tree.DefaultMutableTreeNode

delete

public void delete()
Delete this domain object and it's tree node.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode

getMainFrame

protected MainFrame getMainFrame()
Gets the MainFrame for the application.

Returns:
the MainFrame object

getMainModule

protected MainModule getMainModule()
Gets the MainModule for the application.

Returns:
the MainModule object


Copyright © 1999-2008 Melloware Inc. All Rights Reserved.