Class 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.
    • 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)
      • removePropertyChangeListener

        public void removePropertyChangeListener​(PropertyChangeListener listener)
      • firePropertyChange

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