org.safs
Class TreeNode

java.lang.Object
  extended by org.safs.TreeNode
Direct Known Subclasses:
RTreeNode

public abstract class TreeNode
extends java.lang.Object


Purpose: Generic tree node object for handle the status of MenuItem

Since:
APR 15, 2008
APR 15, 2008 (LeiWang) Original Release

Field Summary
protected  int childrenCounter
           
protected  int siblingCounter
           
static java.lang.String STATUS_BARBREAK
           
static java.lang.String STATUS_BITMAP
           
static java.lang.String STATUS_BREAK
           
static java.lang.String STATUS_CHECKED
           
static java.lang.String STATUS_DEFAULT
           
static java.lang.String STATUS_DISABLED
           
static java.lang.String STATUS_ENABLED
           
static java.lang.String STATUS_GRAYED
           
static java.lang.String STATUS_HILITED
           
static java.lang.String STATUS_NORMAL
           
static java.lang.String STATUS_SEPARATOR
           
static java.lang.String STATUS_SUBMENU_NUM
           
static java.lang.String STATUS_UNCHECKED
           
static java.lang.String STATUS_UNGRAYED
           
static java.lang.String STATUS_UNHILITEED
           
protected  java.lang.Object userObject
           
 
Constructor Summary
TreeNode()
           
 
Method Summary
protected abstract  boolean containsBitMap()
           
 java.lang.String getNodeLabel()
          
Note: To be overrided by it's subclass
protected  java.lang.String getStatusString()
           
 java.lang.Object getUserObject()
           
protected abstract  boolean isChecked()
           
protected abstract  boolean isEnabled()
           
protected abstract  boolean isSeparator()
           
 boolean matchStatus(java.lang.String status)
          Note: The separator must be a blank " "
 void setUserObject(java.lang.Object userObject)
           
protected abstract  boolean subMenuCountOk(java.lang.String subMenuNumber)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATUS_ENABLED

public static final java.lang.String STATUS_ENABLED
See Also:
Constant Field Values

STATUS_UNGRAYED

public static final java.lang.String STATUS_UNGRAYED
See Also:
Constant Field Values

STATUS_DISABLED

public static final java.lang.String STATUS_DISABLED
See Also:
Constant Field Values

STATUS_GRAYED

public static final java.lang.String STATUS_GRAYED
See Also:
Constant Field Values

STATUS_CHECKED

public static final java.lang.String STATUS_CHECKED
See Also:
Constant Field Values

STATUS_UNCHECKED

public static final java.lang.String STATUS_UNCHECKED
See Also:
Constant Field Values

STATUS_SUBMENU_NUM

public static final java.lang.String STATUS_SUBMENU_NUM
See Also:
Constant Field Values

STATUS_BITMAP

public static final java.lang.String STATUS_BITMAP
See Also:
Constant Field Values

STATUS_SEPARATOR

public static final java.lang.String STATUS_SEPARATOR
See Also:
Constant Field Values

STATUS_BARBREAK

public static final java.lang.String STATUS_BARBREAK
See Also:
Constant Field Values

STATUS_BREAK

public static final java.lang.String STATUS_BREAK
See Also:
Constant Field Values

STATUS_HILITED

public static final java.lang.String STATUS_HILITED
See Also:
Constant Field Values

STATUS_UNHILITEED

public static final java.lang.String STATUS_UNHILITEED
See Also:
Constant Field Values

STATUS_DEFAULT

public static final java.lang.String STATUS_DEFAULT
See Also:
Constant Field Values

STATUS_NORMAL

public static final java.lang.String STATUS_NORMAL
See Also:
Constant Field Values

userObject

protected java.lang.Object userObject

siblingCounter

protected int siblingCounter

childrenCounter

protected int childrenCounter
Constructor Detail

TreeNode

public TreeNode()
Method Detail

getUserObject

public java.lang.Object getUserObject()

setUserObject

public void setUserObject(java.lang.Object userObject)

getNodeLabel

public java.lang.String getNodeLabel()

Note: To be overrided by it's subclass

Returns:
A String which describe this node. For example, the text "File" on the menu.

isEnabled

protected abstract boolean isEnabled()
Returns:
boolean, Whether the menuItem is enabled

isChecked

protected abstract boolean isChecked()
Returns:
boolean, Whether this menuItem is selected

containsBitMap

protected abstract boolean containsBitMap()
Returns:
boolean, Whether this menuItem contains an Icon

isSeparator

protected abstract boolean isSeparator()
Returns:
boolean, Whether this is a Separator

subMenuCountOk

protected abstract boolean subMenuCountOk(java.lang.String subMenuNumber)
Parameters:
subMenuNumber, - String, Represent the number of submenus under this menu
Returns:
boolean

getStatusString

protected java.lang.String getStatusString()

matchStatus

public boolean matchStatus(java.lang.String status)
Note: The separator must be a blank " "

Parameters:
status - A String contains status of the node item, can be an combination of followings:
Supported: "Enabled" "Ungrayed" "Grayed" "Disabled" "Checked" "Unchecked" "Menu With N MenuItems" "BitMap" "Separator"
Future: "BarBreak" "Break" "Hilited" "Default" "Unhilited" "Normal"
Example:"Enabled Unchecked"
Returns:
If matched, return true

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object