thinwire.ui
Interface HierarchyComponent.Item<H extends HierarchyComponent,I extends HierarchyComponent.Item>

All Known Implementing Classes:
Menu.Item, Tree.Item
Enclosing interface:
HierarchyComponent<HI extends HierarchyComponent.Item>

public static interface HierarchyComponent.Item<H extends HierarchyComponent,I extends HierarchyComponent.Item>


Field Summary
static java.lang.String PROPERTY_ITEM_IMAGE
           
static java.lang.String PROPERTY_ITEM_TEXT
           
static java.lang.String PROPERTY_ITEM_USER_OBJECT
           
 
Method Summary
 java.util.List<I> getChildren()
          Get the List that contains the children of this item.
 H getHierarchy()
           
 java.lang.String getImage()
          Get the image file name that is displayed on the left side of the item.
 ImageInfo getImageInfo()
          Returns an immutable ImageInfo class that provides information about the assigned image, such as width, height, format, etc.
 int getIndex()
          A convenience method that returns the index of this item in it's parents children List.
 java.lang.Object getParent()
          Get the parent object of this item.
 java.lang.String getText()
          Get the text that is displayed for the item in the menu.
 java.lang.Object getUserObject()
          Get the user defined value for this item.
 boolean hasChildren()
           
 void setImage(java.lang.String image)
          Set the image file name that is displayed on the left side of the item.
 void setText(java.lang.String text)
          Set the text that is displayed for the item in the menu.
 void setUserObject(java.lang.Object userObject)
          Set a user defined value for this item.
 

Field Detail

PROPERTY_ITEM_IMAGE

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

PROPERTY_ITEM_TEXT

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

PROPERTY_ITEM_USER_OBJECT

static final java.lang.String PROPERTY_ITEM_USER_OBJECT
See Also:
Constant Field Values
Method Detail

getText

java.lang.String getText()
Get the text that is displayed for the item in the menu.

Returns:
the text that is displayed for the item, or an empty string if none.

setText

void setText(java.lang.String text)
Set the text that is displayed for the item in the menu.

Parameters:
text - the text that should be displayed for the item.

getImage

java.lang.String getImage()
Get the image file name that is displayed on the left side of the item.

Returns:
the image that is displayed for the item, or an empty string if none.

setImage

void setImage(java.lang.String image)
Set the image file name that is displayed on the left side of the item.

Parameters:
image - the name of the image file that should be displayed for the item.
Throws:
java.lang.IllegalArgumentException - if the image file does not exist.
java.lang.RuntimeException - if the system cannot determine the image file's canonical path.

getImageInfo

ImageInfo getImageInfo()
Returns an immutable ImageInfo class that provides information about the assigned image, such as width, height, format, etc.

Returns:
an immutable ImageInfo describing this item's image.

getUserObject

java.lang.Object getUserObject()
Get the user defined value for this item.

Returns:
the user defined value for this item if one is defined, null otherwise.

setUserObject

void setUserObject(java.lang.Object userObject)
Set a user defined value for this item.

Parameters:
value - an object that should be associated to this item.

getIndex

int getIndex()
A convenience method that returns the index of this item in it's parents children List. Equivalent to item.getParent().getChildren().indexOf(item);.

Returns:
the index of this item in it's parents children List.
Throws:
java.lang.IllegalStateException - if this item has not yet been added to another Menu.Item or if this item is the root item for the menu.

getHierarchy

H getHierarchy()

getParent

java.lang.Object getParent()
Get the parent object of this item.

Returns:
if this item is the root item, then this returns the Menu, otherwise this returns the parentMenu.Item or null if this item has not yet been added to another Menu.Item.

hasChildren

boolean hasChildren()

getChildren

java.util.List<I> getChildren()
Get the List that contains the children of this item.

Returns:
the List that contains the children of this item or an empty List if there are no children.


ThinWire® is a registered of Custom Credit Systems  Copyright © 2007 All rights reserved.
ThinWire_is_Open_Source_under_the_terms_of_the_LGPLv2.1 SourceForge.net_Project_Page java.net_Member Support_ThinWire,_Digg_our_Story