Class ComboBox
java.lang.Object
com.ptc.core.components.rendering.AbstractGuiComponent
com.ptc.core.components.rendering.guicomponents.HTMLGuiComponent
com.ptc.core.components.rendering.guicomponents.ComboBox
- All Implemented Interfaces:
GuiComponent,com.ptc.netmarkets.util.misc.NmFormatable,Serializable
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");
Supported API: true
Extendable: false
Example :
ArrayList
ArrayList
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDisabled(String item) Mark option as disabled in combobox.Get the list of disabled options.getId()Gets the Id of combobox.Get a list of internal values.Get the list of selected values in combobox.intgetSize()Get the size of combobox.Will retrieve the tooltip for the combobox.Get a list of display values.booleanDetermines whether or not the given combobox is multi select.voidsetDisabled(ArrayList<String> a_Values) Set collection of disabled options.voidsetEditable(boolean editable) Sets the editable property true or false for combobox.voidsetEnabled(boolean a_Enabled) Sets the combobox as enabled or disabled.voidSets the Id for the combobox.voidsetInternalValues(ArrayList<String> a_InternalValues) Set a list of internal values for combobox.voidsetMultiSelect(boolean a_MultiSelect) Setting combobox to multiSelect.voidsetSelected(ArrayList<String> a_Selected) Set the list as selected for combobox.voidsetSize(int size) Sets the size of combobox, which determines the number of elements to be displayed in comboBox.voidsetTooltip(String tooltip) Set the tooltip for the combobox.voidSet a list of display (localized) values for combobox.Methods inherited from class com.ptc.core.components.rendering.guicomponents.HTMLGuiComponent
addJsAction, setNameQualifierMethods inherited from class com.ptc.core.components.rendering.AbstractGuiComponent
setColumnName, setLabel, setMultiValued, setName
-
Constructor Details
-
ComboBox
public ComboBox(ArrayList<String> internalValues, ArrayList<String> displayValues, ArrayList<String> selectedValues) Constructs a combo box using the suppliedinternalValues,displayValuesandselectedValues.
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 comboboxselectedValues- The list of selected Items to be displayed on the combobox. Its should be either all internalValues or displayValues
-
-
Method Details
-
setId
Sets the Id for the combobox. A string used to identify the component. Generated as the HTML id attribute.
Supported API: true- Overrides:
setIdin classAbstractGuiComponent- Parameters:
eyeD- The combobox identifier.
-
getId
Gets the Id of combobox. A string used to identify the component. Generated as the HTML id attribute.
Supported API: true- Overrides:
getIdin classAbstractGuiComponent- Returns:
- The combobox identifier.
-
getValues
Get a list of display values.
Supported API: true- Returns:
- The list of display values for this combobox.
-
setDisabled
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
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:
getTooltipin classHTMLGuiComponent- Returns:
- Returns an HTML escaped tooltip string..
-
setTooltip
Set the tooltip for the combobox.
Supported API: true- Overrides:
setTooltipin classHTMLGuiComponent- 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:
setEnabledin classAbstractGuiComponent- 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:
setEditablein classHTMLGuiComponent- Parameters:
editable-
-
addDisabled
Mark option as disabled in combobox.
Supported API: true- Parameters:
item-- Returns:
-
setValues
Set a list of display (localized) values for combobox.
Supported API: true- Parameters:
a_Values- The list of (localized) values.
-
getSelected
Get the list of selected values in combobox.
Supported API: true- Returns:
- The list of selected values for this combobox.
-
getDisabled
Get the list of disabled options.
Supported API: true- Returns:
- The list of disabled options for this combobox.
-
setSelected
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
Get a list of internal values.
Supported API: true- Returns:
- The list of internal values for this combobox.
-
setInternalValues
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.
-