All Implemented Interfaces:
GuiComponent, com.ptc.netmarkets.util.misc.NmFormatable, Serializable

public class ComboBox extends HTMLGuiComponent
A simple GUI component that represents a HTML combobox. This can be configured as a single-select or a multi-select combobox.

Supported API: true

Extendable: false

Example :

ArrayList displayValues = new ArrayList();
ArrayList internalValues = new ArrayList();
ArrayList selectedValues = new ArrayList();

displayValues.add("RED");
displayValues.add("YELLOW");
displayValues.add("GREEN");

internalValues.add("red");
internalValues.add("yellow");
internalValues.add("green");

selectedValues.add("RED");
selectedValues.add("yellow");

ComboBox combo = new ComboBox(internalValues, displayValues, selectedValues);
combo.setId("combo1Id");
combo.setMultiSelect(true);
combo.setSize(2);
combo.setTooltip("Select colors");
See Also:
  • Constructor Details

    • ComboBox

      public ComboBox(ArrayList<String> internalValues, ArrayList<String> displayValues, ArrayList<String> selectedValues)
      Constructs a combo box using the supplied internalValues, displayValues and selectedValues.
      1.   If the provided value(s) of internalValues, displayValues is "" i.e. empty then it will create blank   entry (entries) at the top in the combobox to represent the 'Undefined' state.
      2.   The internalValues and displayValues are mandatory.
      3.   Provide displayValues or internalValues for selectedValues to display in Combobox.
      4.   If the provided value of selectedValues is null then there is no selection made within combobox for   the displayed list.


      Supported API: true
      Parameters:
      internalValues - The internal representation of the displayed values in the selection list in the combobox.
      displayValues - The list of values actually displayed in combobox
      selectedValues - The list of selected Items to be displayed on the combobox. Its should be either all internalValues or displayValues
  • Method Details

    • setId

      public void setId(String eyeD)
      Sets the Id for the combobox. A string used to identify the component. Generated as the HTML id attribute.

      Supported API: true
      Overrides:
      setId in class AbstractGuiComponent
      Parameters:
      eyeD - The combobox identifier.
    • getId

      public String getId()
      Gets the Id of combobox. A string used to identify the component. Generated as the HTML id attribute.

      Supported API: true
      Overrides:
      getId in class AbstractGuiComponent
      Returns:
      The combobox identifier.
    • getValues

      public ArrayList<String> getValues()
      Get a list of display values.

      Supported API: true
      Returns:
      The list of display values for this combobox.
    • setDisabled

      public void setDisabled(ArrayList<String> a_Values)
      Set collection of disabled options. All options specified in list would mark as disabled. Its should be either all internalValues or displayValues

      Supported API: true
      Parameters:
      a_Values -
    • getTooltip

      public String getTooltip()
      Will retrieve the tooltip for the combobox. This method is responsible for grabbing the tooltip and escaping the tooltip as HTML.

      Supported API: true
      Overrides:
      getTooltip in class HTMLGuiComponent
      Returns:
      Returns an HTML escaped tooltip string..
    • setTooltip

      public void setTooltip(String tooltip)
      Set the tooltip for the combobox.

      Supported API: true
      Overrides:
      setTooltip in class HTMLGuiComponent
      Parameters:
      tooltip - The tooltip to set for the combobox.
    • setEnabled

      public void setEnabled(boolean a_Enabled)
      Sets the combobox as enabled or disabled. Default is true; renders the combobox as enabled. if set as false; renders the combobox as disabled.

      Supported API: true
      Overrides:
      setEnabled in class AbstractGuiComponent
      Parameters:
      a_Enabled -
    • setEditable

      public void setEditable(boolean editable)
      Sets the editable property true or false for combobox. Default is true. True allows editing in the combobox. False make it non-editable.

      Supported API: true
      Overrides:
      setEditable in class HTMLGuiComponent
      Parameters:
      editable -
    • addDisabled

      public boolean addDisabled(String item)
      Mark option as disabled in combobox.

      Supported API: true
      Parameters:
      item -
      Returns:
    • setValues

      public void setValues(ArrayList<String> a_Values)
      Set a list of display (localized) values for combobox.

      Supported API: true
      Parameters:
      a_Values - The list of (localized) values.
    • getSelected

      public ArrayList<String> getSelected()
      Get the list of selected values in combobox.

      Supported API: true
      Returns:
      The list of selected values for this combobox.
    • getDisabled

      public ArrayList<String> getDisabled()
      Get the list of disabled options.

      Supported API: true
      Returns:
      The list of disabled options for this combobox.
    • setSelected

      public void setSelected(ArrayList<String> a_Selected)
      Set the list as selected for combobox. Its should be either all internalValues or displayValues

      Supported API: true
      Parameters:
      a_Selected - The list of values to mark as selected.
    • isMultiSelect

      public boolean isMultiSelect()
      Determines whether or not the given combobox is multi select.

      Supported API: true
      Returns:
      boolean
    • setMultiSelect

      public void setMultiSelect(boolean a_MultiSelect)
      Setting combobox to multiSelect. Default is false.

      Supported API: true
      Parameters:
      a_MultiSelect - boolean value as true or false.
    • getInternalValues

      public ArrayList<String> getInternalValues()
      Get a list of internal values.

      Supported API: true
      Returns:
      The list of internal values for this combobox.
    • setInternalValues

      public void setInternalValues(ArrayList<String> a_InternalValues)
      Set a list of internal values for combobox.

      Supported API: true
      Parameters:
      a_InternalValues - The list of internal values.
    • getSize

      public int getSize()
      Get the size of combobox. Default size is 1( i.e. Display single item.).

      Supported API: true
      Returns:
      The size of combobox.
    • setSize

      public void setSize(int size)
      Sets the size of combobox, which determines the number of elements to be displayed in comboBox. Default size is 1( i.e. Display single item.). size should be >= 1

      Supported API: true
      Parameters:
      size - The size of number of elements in the list.