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.String LABEL_PROPERTY  
    static java.lang.String SELECTED_PROPERTY  
    static java.lang.String VALUE_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
    void addChild​(Item item)
    Adds a new child node (Items can be nested in trees).
    void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)  
    void addPropertyChangeListener​(java.lang.String property, java.beans.PropertyChangeListener listener)  
    protected void firePropertyChange​(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.String getId()
    Returns this item's ID.
    java.lang.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.
    java.lang.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​(java.util.List<Item> items)
    Remove all childs nodes
    void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)  
    void removePropertyChangeListener​(java.lang.String property, java.beans.PropertyChangeListener listener)  
    void setLabel​(java.lang.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​(java.lang.Object value)
    Sets the item's value as it appears in the component's model.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • 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 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 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. 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​(java.lang.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 java.lang.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​(java.lang.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​(java.util.List<Item> items)
      Remove all childs nodes
      Parameters:
      items - list of items to remove
    • getChildren

      public java.util.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​(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:
      toString in class java.lang.Object