jaxx.runtime.swing
Class Item

java.lang.Object
  extended by jaxx.runtime.swing.Item

public class Item
extends Object

An item in a component such as JComboBox or JTree. The Item class corresponds to the <item> tag in JAXX source files.


Field Summary
static String LABEL_PROPERTY
           
static String SELECTED_PROPERTY
           
static String VALUE_PROPERTY
           
 
Constructor Summary
Item(String id, String label, Object value, boolean selected)
          Creates a new Item.
 
Method Summary
 void addChild(Item item)
          Adds a new child node (Items can be nested in trees).
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 void addPropertyChangeListener(String property, PropertyChangeListener listener)
           
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
           
 List<Item> getChildren()
          Returns a list of this item's children.
 String getId()
          Returns this item's ID.
 String getLabel()
          Returns the string that should be used to represent the item at display time.
 Item getParent()
          Returns the Item containing this Item, or null for a top-level Item.
 Object getValue()
          Returns the item's actual value as it appears in the component's model.
 boolean isSelected()
          Returns true if this item is currently selected.
 void removeChild(Item item)
          Remove child node a new child node
 void removeChilds(List<Item> items)
          Remove all childs nodes
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void removePropertyChangeListener(String property, PropertyChangeListener listener)
           
 void setLabel(String label)
          Sets the item's display string.
 void setParent(Item parent)
          Set the parent of this item
 void setSelected(boolean selected)
          Sets the item's selection state.
 void setValue(Object value)
          Sets the item's value as it appears in the component's model.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LABEL_PROPERTY

public static final String LABEL_PROPERTY
See Also:
Constant Field Values

VALUE_PROPERTY

public static final String VALUE_PROPERTY
See Also:
Constant Field Values

SELECTED_PROPERTY

public static final String SELECTED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

Item

public Item(String id,
            String label,
            Object value,
            boolean selected)
Creates a new Item. This should only be called from compiled JAXX files.

Parameters:
id - the item's ID
label - the string that should be used to represent the item visually
value - the item's actual value
selected - true if the item should be selected by default
Method Detail

getId

public String getId()
Returns this item's ID.

Returns:
the JAXX ID attribute

getLabel

public String getLabel()
Returns the string that should be used to represent the item at display time. If null, String.valueOf(getValue()) will be used instead.

Returns:
this item's display string
See Also:
setLabel(java.lang.String)

setLabel

public void setLabel(String label)
Sets the item's display string. If null, String.valueOf(getValue()) will be used instead.

Parameters:
label - the new display string
See Also:
getLabel()

getValue

public Object getValue()
Returns the item's actual value as it appears in the component's model. The Item itself is not visible from the model, only the value.

Returns:
the item's value
See Also:
setValue(java.lang.Object)

setValue

public void setValue(Object value)
Sets the item's value as it appears in the component's model. The Item itself is not visible from the model, only the value.

Parameters:
value - the new value
See Also:
getValue()

isSelected

public boolean isSelected()
Returns true if this item is currently selected. This is a bound property.

Returns:
true if item is selected
See Also:
setSelected(boolean)

setSelected

public void setSelected(boolean selected)
Sets the item's selection state. This is a bound property.

Parameters:
selected - the new selection state
See Also:
isSelected()

addChild

public void addChild(Item item)
Adds a new child node (Items can be nested in trees).

Parameters:
item - the new child item

removeChild

public void removeChild(Item item)
Remove child node a new child node

Parameters:
item - to remove

removeChilds

public void removeChilds(List<Item> items)
Remove all childs nodes

Parameters:
items - list of items to remove

getChildren

public List<Item> getChildren()
Returns a list of this item's children.

Returns:
a list of all nested child nodes

getParent

public Item getParent()
Returns the Item containing this Item, or null for a top-level Item.

Returns:
the item parent (or null)

setParent

public void setParent(Item parent)
Set the parent of this item

Parameters:
parent - the item parent (or null)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(String property,
                                      PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(String property,
                                         PropertyChangeListener listener)

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2011 CodeLutin. All Rights Reserved.