public class Item extends Object
JComboBox or JTree. The Item
class corresponds to the <item> tag in JAXX source files.| Modifier and Type | Field and Description |
|---|---|
static String |
LABEL_PROPERTY |
static String |
SELECTED_PROPERTY |
static String |
VALUE_PROPERTY |
| Constructor and Description |
|---|
Item(String id,
String label,
Object value,
boolean selected)
Creates a new Item.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
public static final String LABEL_PROPERTY
public static final String VALUE_PROPERTY
public static final String SELECTED_PROPERTY
public Item(String id, String label, Object value, boolean selected)
id - the item's IDlabel - the string that should be used to represent the item visuallyvalue - the item's actual valueselected - true if the item should be selected by defaultpublic String getId()
public String getLabel()
null,
String.valueOf(getValue()) will be used instead.setLabel(java.lang.String)public void setLabel(String label)
null, String.valueOf(getValue()) will be used instead.label - the new display stringgetLabel()public Object getValue()
Item itself is not
visible from the model, only the value.setValue(java.lang.Object)public void setValue(Object value)
Item itself is not
visible from the model, only the value.value - the new valuegetValue()public boolean isSelected()
true if this item is currently selected. This is a bound property.true if item is selectedsetSelected(boolean)public void setSelected(boolean selected)
selected - the new selection stateisSelected()public void addChild(Item item)
item - the new child itempublic void removeChild(Item item)
item - to removepublic void removeChilds(List<Item> items)
items - list of items to removepublic List<Item> getChildren()
public Item getParent()
Item containing this Item, or null for a top-level
Item.public void setParent(Item parent)
parent - the item parent (or null)public void addPropertyChangeListener(PropertyChangeListener listener)
public void addPropertyChangeListener(String property, PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(String property, PropertyChangeListener listener)
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
Copyright © 2008–2019 Ultreia.io. All rights reserved.