Class RosterEntryComboBox

All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, ListDataListener, RosterEntrySelector
Direct Known Subclasses:
GlobalRosterEntryComboBox

public class RosterEntryComboBox
extends JComboBox<Object>
implements RosterEntrySelector
A JComboBox containing roster entries or a string indicating that no roster entry is selected.

This is a JComboBox<Object> so that it can represent both.

This class has a self contained data model, and will automatically update the display if a RosterEntry is added, removed, or changes.

See Also:
Roster, RosterEntry, JComboBox, Serialized Form
  • Field Details

  • Constructor Details

    • RosterEntryComboBox

      Create a combo box with the default Roster and all entries in the active roster group.
    • RosterEntryComboBox

      public RosterEntryComboBox​(Roster roster)
      Create a combo box with an arbitrary Roster and all entries in the active roster group.
      Parameters:
      roster - roster to use.
    • RosterEntryComboBox

      public RosterEntryComboBox​(String rosterGroup)
      Create a combo box with the default Roster and all entries in an arbitrary roster group.
      Parameters:
      rosterGroup - group to display.
    • RosterEntryComboBox

      public RosterEntryComboBox​(Roster roster, String rosterGroup)
      Create a combo box with an arbitrary Roster and all entries in an arbitrary roster group.
      Parameters:
      roster - roster to use.
      rosterGroup - group to display.
    • RosterEntryComboBox

      public RosterEntryComboBox​(String roadName, String roadNumber, String dccAddress, String mfg, String decoderMfgID, String decoderVersionID, String id)
      Create a combo box with the default Roster and entries in the active roster group matching the specified attributes. Attributes with a null value will not be considered when filtering the roster entries.
      Parameters:
      roadName - road name.
      roadNumber - road number.
      dccAddress - dcc address.
      mfg - manufacturer.
      decoderMfgID - decoder manufacturer.
      decoderVersionID - decoder version id.
      id - roster id. *
    • RosterEntryComboBox

      public RosterEntryComboBox​(Roster roster, String roadName, String roadNumber, String dccAddress, String mfg, String decoderMfgID, String decoderVersionID, String id)
      Create a combo box with an arbitrary Roster and entries in the active roster group matching the specified attributes. Attributes with a null value will not be considered when filtering the roster entries.
      Parameters:
      roster - roster to use.
      roadName - road name.
      roadNumber - road number.
      dccAddress - dcc address.
      mfg - manufacturer.
      decoderMfgID - decoder manufacturer.
      decoderVersionID - decoder version id.
      id - roster id.
    • RosterEntryComboBox

      public RosterEntryComboBox​(String rosterGroup, String roadName, String roadNumber, String dccAddress, String mfg, String decoderMfgID, String decoderVersionID, String id)
      Create a combo box with the default Roster and entries in an arbitrary roster group matching the specified attributes. Attributes with a null value will not be considered when filtering the roster entries.
      Parameters:
      rosterGroup - group to display.
      roadName - road name.
      roadNumber - road number.
      dccAddress - dcc address.
      mfg - manufacturer.
      decoderMfgID - decoder manufacturer.
      decoderVersionID - decoder version id.
      id - roster id.
    • RosterEntryComboBox

      public RosterEntryComboBox​(Roster roster, String rosterGroup, String roadName, String roadNumber, String dccAddress, String mfg, String decoderMfgID, String decoderVersionID, String id)
      Create a combo box with an arbitrary Roster and entries in an arbitrary roster group matching the specified attributes. Attributes with a null value will not be considered when filtering the roster entries.

      All attributes used to filter roster entries are retained and reused when updating the combo box unless new attributes are specified when calling update.

      All other constructors call this constructor with various default parameters.

      Parameters:
      roster - roster to use.
      rosterGroup - group to display.
      roadName - road name.
      roadNumber - road number.
      dccAddress - dcc address.
      mfg - manufacturer.
      decoderMfgID - decoder manufacturer.
      decoderVersionID - decoder version id.
      id - roster id.
  • Method Details

    • update

      public void update()
      Update the combo box with the currently selected roster group, using the same roster entry attributes specified in a prior call to update or when creating the combo box.
    • update

      public final void update​(String rosterGroup)
      Update the combo box with an arbitrary roster group, using the same roster entry attributes specified in a prior call to update or when creating the combo box.
      Parameters:
      rosterGroup - group to display.
    • update

      public void update​(String roadName, String roadNumber, String dccAddress, String mfg, String decoderMfgID, String decoderVersionID, String id)
      Update the combo box with the currently selected roster group, using new roster entry attributes.
      Parameters:
      roadName - road name.
      roadNumber - road number.
      dccAddress - dcc address.
      mfg - manufacturer.
      decoderMfgID - decoder manufacturer.
      decoderVersionID - decoder version id.
      id - roster id.
    • update

      public final void update​(String rosterGroup, String roadName, String roadNumber, String dccAddress, String mfg, String decoderMfgID, String decoderVersionID, String id)
      Update the combo box with an arbitrary roster group, using new roster entry attributes.
      Parameters:
      rosterGroup - group to display.
      roadName - road name.
      roadNumber - road number.
      dccAddress - dcc address.
      mfg - manufacturer.
      decoderMfgID - decoder manufacturer.
      decoderVersionID - decoder version id.
      id - roster id.
    • setNonSelectedItem

      public void setNonSelectedItem​(String itemText)
      Set the text of the item that visually indicates that no roster entry is selected in the comboBox.
      Parameters:
      itemText - text to indicate no entry.
    • getNonSelectedItem

      Get the text of the item that visually indicates that no roster entry is selected in the comboBox. If this returns null, it indicates that the comboBox has no special item to indicate an empty selection.
      Returns:
      The text or null
    • getSelectedRosterEntries

      Description copied from interface: RosterEntrySelector
      Get the currently selected roster entries. Since the selection could contain multiple roster entries, this returns an array of RosterEntry instead of a single RosterEntry.
      Specified by:
      getSelectedRosterEntries in interface RosterEntrySelector
      Returns:
      an array of RosterEntries
    • getSelectedRosterEntries

      protected RosterEntry[] getSelectedRosterEntries​(boolean force)
    • fireSelectedRosterEntriesPropertyChange