public class GMultipleChoice extends GContainer implements GDisplay, GReadWrite, GListener, GClear
GCheckBox
controls. The class allows a multiple choices among a list
of options. This list is preceded by a label with the name. The different options are represented by
GCheckBox
objects. Each option has an associated integer value. By default, the associated value
corresponds to the rank number in the list, but it is possible to associate arbitrary values. At any time,
the list of choices can be modified dynamically by the application maker and the display is updated. The
class allows also to save or to load to the configuration file.Index | Class | Item | Constraint |
0 | GLabelWithIndicator | label | 0, 0 => "newline , split 2" 0, 1 => (null) |
1 | GCheckBox | checkBox0 | "split 1" |
2 | GCheckBox | checkBox1 | (null) |
... | ... | ... | ... |
i+1 | GCheckBox | checkBoxi | (null) |
GComponent.CopyPasteOperation, GComponent.DisplayIndicatorStatus, GComponent.ItemType, GComponent.Operation
NAME_ATTRIBUTE
Constructor and Description |
---|
GMultipleChoice()
Constructor by default
|
GMultipleChoice(String label,
int[] selectedValues,
int[] valueList,
String... labels)
Constructor when values are identical to the index of the choices.The widget identifier is created
automatically.
|
GMultipleChoice(String label,
int[] selectedValues,
String... labels)
Constructor when values are identical to the index of the choices.The widget identifier is created
automatically.
|
GMultipleChoice(String widgetId,
String label,
int[] selectedValues,
int[] valueList,
String... labels)
Constructor when values are identical to the index of the choices.
|
GMultipleChoice(String widgetId,
String label,
int[] selectedValues,
int[] valueList,
String[] labels,
String[] tooltips)
Constructor when values are identical to the index of the choices.
|
GMultipleChoice(String widgetId,
String label,
int[] selectedValues,
String... labels)
Constructor when values are identical to the index of the choices.
|
Modifier and Type | Method and Description |
---|---|
void |
after(GEvent e)
Called after the event is processed.
|
void |
attachCopyPasteMenu(String label,
GComponent.CopyPasteOperation... operationList)
Attach the copy and paste menu to this component.
|
void |
before(GEvent e)
Called before the event is processed.
|
void |
clear()
Called when the element is to be cleared, so it can perform the actions required to return to the last
saved/loaded values.
|
void |
display()
Called when the element is to be displayed, so it can perform the actions required for its display, and
the display of its inmmediate descendants.
|
void |
generic()
The prototype of the generic function that shall exist in all the descendants.
|
ArrayList<GCheckBox> |
getGCheckBoxList()
Get the array of GCheckBoxes associated with the component.
|
GLabelWithIndicator |
getLabel()
Get the GLabel associated with the component.
|
int[] |
getSavedSelectedValueList()
Get the last saved list of selected values.
|
int[] |
getSelectedValues()
Get the list of selected values.
|
GComponent |
getSubComponent(int position)
Gets the subcomponent occupying the position defined by position.
|
GComponent.CopyPasteOperation |
isCopyPasteEvent(GEvent event)
Checks if the event corresponds to one of the copy and paste menu operations.
|
boolean |
isEnabled()
Return the enable/disable status of the component.
|
boolean |
isModified()
Gets the modification status of the component against the last set of values loaded or saved.
|
void |
read()
Implementaion of the routines that allow the component to be loaded from a configuration file.
|
void |
setDefaultValue(int[] values)
Change the default list of selected values.
|
void |
setDefaultValueList(int[] values,
int[] valueList,
String... labels)
Change the default list of selected values, the value list and labels of the multiple choice.
|
void |
setDefaultValueList(int[] values,
int[] valueList,
String[] labels,
String[] tooltips)
Change the default list of selected values, the value list and labels of the multiple choice.
|
void |
setEnabled(boolean b)
Set the enable/disable status of the component.
|
void |
setSavedSelectedValueList(int[] values)
Change the saved list of selected values of the multiple choice.
|
void |
setSelectedValues(int[] selectedValues)
Set the selected values of the component.
|
void |
setShortcut(int... shorcutKeyList)
Set the shortcut keys for selecting the corresponding value.
|
void |
setStatusMessages(String okMess,
String warnMess,
String errorMess)
Method to set the tooltip status messages
|
void |
setStringConstraint(String constraints)
Set the constraint in string format for the component.
|
void |
setTooltipsList(String[] tooltipsList)
Set the list of tooltips associated to each item in the GMultipleChoice.
|
void |
setToolTipText(String text)
Set the tooltip text for the entry's label.
|
void |
setValueList(int[] selectedValues,
int[] values,
String... buttonsText)
Change the list of values, the selected value list and the labels of the checkboxes.
|
void |
setValueList(int[] selectedValues,
int[] values,
String[] buttonsText,
String[] tooltips)
Change the list of values, the selected value list and the labels of the checkboxes.
|
void |
setValueList(int[] selectedValues,
String... labels)
Change the list of checkboxes labels and set the selected value.
|
protected void |
updateIsModifiedIndicator()
Updates the is modified indicator.
|
void |
updateStatus()
Update the status of the multiple choice depending on the selected values.
|
void |
write()
Implementaion of the routines that allow the component to be saved to a configuration file.
|
put
activateConstraintsByType, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, clearAllInnerDescendantConstraint, clearConstraint, clearInnerDescendantContraint, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getComponent, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGClassName, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getPathInConfigFile, getSimpleWidgetId, getStatus, getStringConstraint, getWidgetId, handleCopyPasteEvent, handleCopyPasteEvent, handleProcessEventException, isForcedStatus, launchInvalidPositionException, mouseWheelMoved, parseSimpleConstraint, processGEvent, processMouseWheelEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDefaultConstraints, setDisplayIsModifiedIndicator, setElement, setForcedStatus, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setName, setNameAndCommentInConfigFile, setNameInConfigFile, setPathInConfigFile, setStatus, setWidgetId, setWidth, setWindowBusyCursor, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
public GMultipleChoice()
public GMultipleChoice(String widgetId, String label, int[] selectedValues, String... labels)
widgetId
- Widget identifier.label
- to display for the list of choices.selectedValues
- to be selected at construction.labels
- text of the different choices.public GMultipleChoice(String label, int[] selectedValues, String... labels)
label
- to display for the list of choices.selectedValues
- to be selected at construction.labels
- text of the different choices.public GMultipleChoice(String label, int[] selectedValues, int[] valueList, String... labels)
label
- to display for the list of choices.selectedValues
- to be selected at construction.valueList
- list of values to associate to the different choices.labels
- text of the different choices.public GMultipleChoice(String widgetId, String label, int[] selectedValues, int[] valueList, String... labels)
widgetId
- Widget identifier.label
- to display for the list of choices.selectedValues
- to be selected at construction.valueList
- list of values to associate to the different choices.labels
- text of the different choices.public GMultipleChoice(String widgetId, String label, int[] selectedValues, int[] valueList, String[] labels, String[] tooltips)
widgetId
- Widget identifier.label
- to display for the list of choices.selectedValues
- to be selected at construction.valueList
- list of values to associate to the different choices.labels
- text of the different choices.tooltips
- for the different choices.public GComponent getSubComponent(int position) throws GComponentException
getSubComponent
in class GComponent
position
- position of the requested component.GComponentException
- in case the position argument is invalid.public void generic() throws GException
GContainer
generic
in class GContainer
GException
- In case of problem.public void display() throws GException
GDisplay
display
in interface GDisplay
GException
- in case of problem while reading the value from file.public boolean isEnabled()
isEnabled
in class GComponent
public void setEnabled(boolean b)
setEnabled
in class GComponent
b
- if true the component is enabled, otherwise is disabled.public int[] getSelectedValues()
public void setSelectedValues(int[] selectedValues)
selectedValues
- to set.public final void setValueList(int[] selectedValues, int[] values, String[] buttonsText, String[] tooltips)
selectedValues
- new values to select.values
- new values list; it can be null if the values are the indexes of the elements in the
checkboxes.buttonsText
- text of the different choices.tooltips
- for the different choices.public void setValueList(int[] selectedValues, int[] values, String... buttonsText)
selectedValues
- new values to select.values
- new values list; it can be null if the values are the indexes of the elements in the
checkboxes.buttonsText
- text of the different choices.public void setValueList(int[] selectedValues, String... labels)
selectedValues
- new value to select.labels
- text of the different choices.public GLabelWithIndicator getLabel()
public ArrayList<GCheckBox> getGCheckBoxList()
public void before(GEvent e) throws GException
before
in interface GListener
e
- event to processed.GException
- in case there is a problem managing the event.public void after(GEvent e) throws GException
after
in interface GListener
e
- processed event.GException
- in case there is a problem managing the event.public void attachCopyPasteMenu(String label, GComponent.CopyPasteOperation... operationList)
attachCopyPasteMenu
in class GComponent
label
- of the copy&paste menu, if null no label is displayed.operationList
- list of operations to set in the menu. Valid values are Copy if the
"Copy" menu is available, Paste if the "Paste" menu is available, Import if the
"Import" menu is available, and Export if the "Export" menu is available.public GComponent.CopyPasteOperation isCopyPasteEvent(GEvent event)
isCopyPasteEvent
in class GComponent
event
- to check.public void read() throws GException
read
in interface GReadWrite
GException
public void write() throws GException
write
in interface GReadWrite
GException
public boolean isModified()
GComponent
isModified
in class GComponent
public void setStatusMessages(String okMess, String warnMess, String errorMess)
okMess
- message if OKwarnMess
- message if warningerrorMess
- message if errorpublic void updateStatus()
protected void updateIsModifiedIndicator()
updateIsModifiedIndicator
in class GComponent
public void clear() throws GException
GClear
clear
in interface GClear
GException
- in case of problem while clearing the values.public void setDefaultValue(int[] values)
values
- new default selected values.public void setDefaultValueList(int[] values, int[] valueList, String... labels)
values
- new default selected values.valueList
- new default value list.labels
- default labels.public final void setDefaultValueList(int[] values, int[] valueList, String[] labels, String[] tooltips)
values
- new default selected values.valueList
- new default value list.labels
- default labels.tooltips
- default tooltips.public final void setSavedSelectedValueList(int[] values)
values
- new saved values.public int[] getSavedSelectedValueList()
public void setToolTipText(String text)
setToolTipText
in class GComponent
text
- the tooltip text for the entry's label.public void setShortcut(int... shorcutKeyList) throws GException
shorcutKeyList
- the shortcut key list to be attached to the widget.GException
- in case of giving a list with wrong number of shortcut keys.public void setTooltipsList(String[] tooltipsList)
tooltipsList
- the list of tooltips for the choices.public void setStringConstraint(String constraints)
setStringConstraint
in class GComponent
constraints
- constraint in string format to set for the component.Copyright © 2024. All rights reserved.