Interface ListComponentHandler

  • All Superinterfaces:
    ComponentHandler<Object>

    public interface ListComponentHandler
    extends ComponentHandler<Object>

    A specialized component handler interface for components with list-like structures.

    This component handler interface extends the base interface by some methods that allow access to the component's ListModel and support its manipulation. This can be useful in cases where an application needs to update displayed lists at runtime, e.g. in reaction of user input.

    When dealing with list-like components like combo boxes or list boxes, the ComponentHandler reference returned by the ComponentBuilderData instance for these components can be casted into a ListComponentHandler. Then the additional methods are available.

    Version:
    $Id: ListComponentHandler.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • getListModel

        ListModel getListModel()
        Returns the ListModel for this component. From this object the list's current content can be obtained. Note that the object returned here need not be identical to or even of the same class than the original specified list model for the component. A component manager implementation can provide a different ListModel implementation.
        Returns:
        the component's list model
      • addItem

        void addItem​(int index,
                     Object display,
                     Object value)
        Adds an item to the component's list model. This new item will imediately be displayed in the component's list.
        Parameters:
        index - the index where the item is to be inserted (0 based)
        display - the display object (to be displayed in the list)
        value - the corresponding value object (to be stored in the form's data; can be null)
      • removeItem

        void removeItem​(int index)
        Removes the list item at the given index.
        Parameters:
        index - the index of the item to remove