com.tensegrity.gui
Class UIItem

java.lang.Object
  extended bycom.tensegrity.gui.UIItem
All Implemented Interfaces:
java.io.Serializable

public class UIItem
extends java.lang.Object
implements java.io.Serializable

The class UIItem represents a basic user interface item. Such an item consists of a state, text and an identifier (id).

Version:
$Id: UIItem.java,v 1.12 2005/10/25 13:33:26 KevinCVS Exp $
Author:
Michael Kegel
See Also:
Serialized Form

Field Summary
static int DISABLED
          Disabled state constant.
static int HIDDEN
          Hidden state constant
protected  java.lang.String ID
          The field to store Items ID.
protected  int state
          the field to store the current state.
 java.lang.String text
          Some text for this Item.
 
Constructor Summary
UIItem()
          Default constructor for a UIItem.
UIItem(java.lang.String ID, int state, java.lang.String text)
          Creates a new UIItem with the given ID and text.
UIItem(java.lang.String ID, java.lang.String text)
          Creates a new UIItem with the given ID and text.
 
Method Summary
 boolean disabled()
          Determines whether this items state is DISABLED.
 boolean enabled()
          Determines whether this items state is DISABLED.
 boolean equals(java.lang.Object ID)
           
 boolean equals(UIItem other)
          Compares this item id with the id of the given item.
 java.lang.String getID()
          Returns this item's identifier.
 int getState()
          Returns the current state of this item.
 boolean hidden()
          Checks if this item state is HIDDEN.
 void set(int state, java.lang.String text)
          Sets the state and text for this item.
 void set(UIItem other)
          Copies the state and text values from the passed UIItem.
 java.lang.String toString()
          Returns a formatted String representing this objects id, state and text.
 boolean visible()
          Checks if this item state is not HIDDEN.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISABLED

public static final int DISABLED
Disabled state constant.

See Also:
Constant Field Values

HIDDEN

public static final int HIDDEN
Hidden state constant

See Also:
Constant Field Values

text

public java.lang.String text
Some text for this Item.


state

protected int state
the field to store the current state.


ID

protected java.lang.String ID
The field to store Items ID.

Constructor Detail

UIItem

public UIItem()
Default constructor for a UIItem. It creates an item with the id -1, state 0 and a zero-length text.


UIItem

public UIItem(java.lang.String ID,
              java.lang.String text)
Creates a new UIItem with the given ID and text.

Parameters:
ID - the id to use.
text - the textual resource to bind the ID too.

UIItem

public UIItem(java.lang.String ID,
              int state,
              java.lang.String text)
Creates a new UIItem with the given ID and text.

Parameters:
ID - the id to use.
state - the state of the item.
text - the textual resource to bind the ID too.
See Also:
DISABLED, HIDDEN
Method Detail

getID

public java.lang.String getID()
Returns this item's identifier.

Returns:
int the id as a long.

Find more information in the class documentation


getState

public int getState()
Returns the current state of this item. Valid values are

Returns:
int the state as int.
See Also:
DISABLED, HIDDEN

Find more information in the class documentation


disabled

public boolean disabled()
Determines whether this items state is DISABLED.

Returns:
boolean returns true if this item is disabled, otherwise false.
See Also:
DISABLED

enabled

public boolean enabled()
Determines whether this items state is DISABLED.

Returns:
boolean returns false if this item is disabled, otherwise false.
See Also:
DISABLED

hidden

public boolean hidden()
Checks if this item state is HIDDEN.

Returns:
boolean Returns true if this item is hidden.
See Also:
HIDDEN

set

public void set(int state,
                java.lang.String text)
Sets the state and text for this item.

Parameters:
state - the state which should be represented by this item.
text - the text for this item.

Find more information in the class documentation


set

public void set(UIItem other)
Copies the state and text values from the passed UIItem.

Parameters:
other - The item from which state and text are copied.

Find more information in the class documentation


equals

public boolean equals(UIItem other)
Compares this item id with the id of the given item.

Parameters:
other - the item to compare with.
Returns:
boolean returns true if this item id, state and text equals to the other items fields.

equals

public boolean equals(java.lang.Object ID)

toString

public java.lang.String toString()
Returns a formatted String representing this objects id, state and text.
id [state=X, text= Abc]

Returns:
String the string representing this item.

visible

public boolean visible()
Checks if this item state is not HIDDEN.

Returns:
boolean Returns true if this item is visible.
See Also:
HIDDEN


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.