Class ComboBoxOption

All Implemented Interfaces:
Serializable, Option, OptionElement, OptionProperties

public class ComboBoxOption extends AbstractOption
Option that uses a combo box to select its value.
Author:
Laurent Cohen
See Also:
  • Field Details

    • comboLabel

      protected JLabel comboLabel
      Label associated with the combo box.
    • items

      protected List<? extends Object> items
      The items in the drop down list.
  • Constructor Details

    • ComboBoxOption

      public ComboBoxOption()
      Constructor provided as a convenience to facilitate the creation of option elements through reflexion.
    • ComboBoxOption

      public ComboBoxOption(String name, String label, String tooltip, Object value, List<Object> items)
      Initialize this combo box option with the specified parameters.
      Parameters:
      name - this component's name.
      label - the label displayed with the checkbox.
      tooltip - the tooltip associated with the combobox.
      value - the initially selected value of this component.
      items - the initial list of items in the combo box.
  • Method Details

    • createUI

      public void createUI()
      Create the UI components for this option.
      Specified by:
      createUI in class AbstractOptionProperties
    • getValue

      public Object getValue()
      Get the current value for this option.
      Specified by:
      getValue in interface Option
      Overrides:
      getValue in class AbstractOption
      Returns:
      a Boolean instance.
    • setValue

      public void setValue(Object value)
      Set the current value for this option.
      Overrides:
      setValue in class AbstractOption
      Parameters:
      value - a Boolean instance.
    • setupValueChangeNotifications

      protected void setupValueChangeNotifications()
      Propagate the selection changes in the underlying combo box to the listeners to this option.
      Specified by:
      setupValueChangeNotifications in class AbstractOption
    • setEnabled

      public void setEnabled(boolean enabled)
      Enable or disable this option.
      Parameters:
      enabled - true to enable this option, false to disable it.
    • getItems

      public List<? extends Object> getItems()
      Get the list of items in the combo box.
      Returns:
      a list of Object instances.
    • setItems

      public void setItems(List<? extends Object> items)
      Set the list of items in the combo box.
      Parameters:
      items - a list of Object instances.
    • getComboBox

      public JComboBox<Object> getComboBox()
      Get the combo box used to select one among several items.
      Returns:
      a JComboBox instance.