Package jaxx.runtime.swing
Class Item
java.lang.Object
jaxx.runtime.swing.Item
public class Item
extends java.lang.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
Fields Modifier and Type Field Description static java.lang.StringLABEL_PROPERTYstatic java.lang.StringSELECTED_PROPERTYstatic java.lang.StringVALUE_PROPERTY -
Constructor Summary
Constructors Constructor Description Item(java.lang.String id, java.lang.String label, java.lang.Object value, boolean selected)Creates a new Item. -
Method Summary
Modifier and Type Method Description voidaddChild(Item item)Adds a new child node (Items can be nested in trees).voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)protected voidfirePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)java.util.List<Item>getChildren()Returns a list of this item's children.java.lang.StringgetId()Returns this item's ID.java.lang.StringgetLabel()Returns the string that should be used to represent the item at display time.ItemgetParent()Returns theItemcontaining thisItem, ornullfor a top-levelItem.java.lang.ObjectgetValue()Returns the item's actual value as it appears in the component's model.booleanisSelected()Returnstrueif this item is currently selected.voidremoveChild(Item item)Remove child node a new child nodevoidremoveChilds(java.util.List<Item> items)Remove all childs nodesvoidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)voidsetLabel(java.lang.String label)Sets the item's display string.voidsetParent(Item parent)Set the parent of this itemvoidsetSelected(boolean selected)Sets the item's selection state.voidsetValue(java.lang.Object value)Sets the item's value as it appears in the component's model.java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
LABEL_PROPERTY
public static final java.lang.String LABEL_PROPERTY- See Also:
- Constant Field Values
-
VALUE_PROPERTY
public static final java.lang.String VALUE_PROPERTY- See Also:
- Constant Field Values
-
SELECTED_PROPERTY
public static final java.lang.String SELECTED_PROPERTY- See Also:
- Constant Field Values
-
-
Constructor Details
-
Item
public Item(java.lang.String id, java.lang.String label, java.lang.Object value, boolean selected)Creates a new Item. This should only be called from compiled JAXX files.- Parameters:
id- the item's IDlabel- the string that should be used to represent the item visuallyvalue- the item's actual valueselected-trueif the item should be selected by default
-
-
Method Details
-
getId
public java.lang.String getId()Returns this item's ID.- Returns:
- the JAXX ID attribute
-
getLabel
public java.lang.String getLabel()Returns the string that should be used to represent the item at display time. Ifnull,String.valueOf(getValue())will be used instead.- Returns:
- this item's display string
- See Also:
setLabel(java.lang.String)
-
setLabel
public void setLabel(java.lang.String label)Sets the item's display string. Ifnull, String.valueOf(getValue())will be used instead.- Parameters:
label- the new display string- See Also:
getLabel()
-
getValue
public java.lang.Object getValue()Returns the item's actual value as it appears in the component's model. TheItemitself is not visible from the model, only the value.- Returns:
- the item's value
- See Also:
setValue(java.lang.Object)
-
setValue
public void setValue(java.lang.Object value)Sets the item's value as it appears in the component's model. TheItemitself is not visible from the model, only the value.- Parameters:
value- the new value- See Also:
getValue()
-
isSelected
public boolean isSelected()Returnstrueif this item is currently selected. This is a bound property.- Returns:
trueif 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
Adds a new child node (Items can be nested in trees).- Parameters:
item- the new child item
-
removeChild
Remove child node a new child node- Parameters:
item- to remove
-
removeChilds
Remove all childs nodes- Parameters:
items- list of items to remove
-
getChildren
Returns a list of this item's children.- Returns:
- a list of all nested child nodes
-
getParent
Returns theItemcontaining thisItem, ornullfor a top-levelItem.- Returns:
- the item parent (or null)
-
setParent
Set the parent of this item- Parameters:
parent- the item parent (or null)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) -
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener) -
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) -
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener) -
firePropertyChange
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue) -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-