com.izforge.izpack.panels.userinput.field
Class SimpleChoiceReader
java.lang.Object
com.izforge.izpack.panels.userinput.field.ElementReader
com.izforge.izpack.panels.userinput.field.FieldReader
com.izforge.izpack.panels.userinput.field.SimpleChoiceReader
- All Implemented Interfaces:
- ChoiceFieldConfig, FieldConfig
public class SimpleChoiceReader
- extends FieldReader
- implements ChoiceFieldConfig
| Methods inherited from class com.izforge.izpack.panels.userinput.field.FieldReader |
getCondition, getDescription, getDisplayHiddenCondition, getField, getInitialValue, getLabel, getOmitFromAuto, getOsModels, getPacks, getProcessors, getReadonlyCondition, getSize, getSpec, getSpec, getSummaryKey, getText, getTooltip, getValidators, getValidators, getVariable, isDisplayHidden, isReadonly |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.izforge.izpack.panels.userinput.field.FieldConfig |
getCondition, getDescription, getDisplayHiddenCondition, getInitialValue, getLabel, getOmitFromAuto, getOsModels, getPacks, getProcessors, getReadonlyCondition, getSize, getSummaryKey, getTooltip, getValidators, getValidators, getVariable, isDisplayHidden, isReadonly |
CHOICE
public static final String CHOICE
- The choice element name.
- See Also:
- Constant Field Values
SimpleChoiceReader
public SimpleChoiceReader(IXMLElement field,
Config config,
InstallData installData)
- Constructs a
SimpleChoiceReader.
- Parameters:
field - the field element to readconfig - the configuration
getChoices
public List<Choice> getChoices()
- Returns the choices.
- Specified by:
getChoices in interface ChoiceFieldConfig
- Returns:
- the choices
isSelected
protected boolean isSelected(String value,
IXMLElement choice,
String variableValue)
- Determines if a choice is selected.
A choice is selected if:
- the variable value is the same as the choice "value" attribute; or
- the "set" attribute is 'true'
- Parameters:
value - the choice valuechoice - the choice elementvariableValue - the variable value. May be null
- Returns:
true if the choice is selected
getDefaultValue
public String getDefaultValue()
- Description copied from class:
FieldReader
- Returns the default value of the field without replacing variables.
This is obtained from the 'default' attribute of the 'spec' element.
- Specified by:
getDefaultValue in interface FieldConfig- Overrides:
getDefaultValue in class FieldReader
- Returns:
- the default value. May be
null
getSelectedIndex
public int getSelectedIndex(String variable)
- Returns the index of the selected choice.
A choice is selected if:
- the variable value is the same as the choice "value" attribute; or
- the "set" attribute is 'true'
This is only valid after #() is invoked.
- Specified by:
getSelectedIndex in interface ChoiceFieldConfig
- Returns:
- the selected index or
-1 if no choice is selected
Copyright © 2018. All rights reserved.