com.izforge.izpack.panels.userinput.field
Class SimpleChoiceReader

java.lang.Object
  extended by com.izforge.izpack.panels.userinput.field.ElementReader
      extended by com.izforge.izpack.panels.userinput.field.FieldReader
          extended by com.izforge.izpack.panels.userinput.field.SimpleChoiceReader
All Implemented Interfaces:
ChoiceFieldConfig, FieldConfig

public class SimpleChoiceReader
extends FieldReader
implements ChoiceFieldConfig


Field Summary
static String CHOICE
          The choice element name.
 
Fields inherited from class com.izforge.izpack.panels.userinput.field.FieldReader
OMIT_FROM_AUTO, SPEC, VARIABLE
 
Constructor Summary
SimpleChoiceReader(IXMLElement field, Config config, InstallData installData)
          Constructs a SimpleChoiceReader.
 
Method Summary
 List<Choice> getChoices()
          Returns the choices.
 String getDefaultValue()
          Returns the default value of the field without replacing variables.
 int getSelectedIndex(String variable)
          Returns the index of the selected choice.
protected  boolean isSelected(String value, IXMLElement choice, String variableValue)
          Determines if a choice is selected.
 
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 com.izforge.izpack.panels.userinput.field.ElementReader
getComplexPanelCondition, getConfig, getOsModels, getPacks, getUnselectedPacks
 
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
 

Field Detail

CHOICE

public static final String CHOICE
The choice element name.

See Also:
Constant Field Values
Constructor Detail

SimpleChoiceReader

public SimpleChoiceReader(IXMLElement field,
                          Config config,
                          InstallData installData)
Constructs a SimpleChoiceReader.

Parameters:
field - the field element to read
config - the configuration
Method Detail

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:

Parameters:
value - the choice value
choice - the choice element
variableValue - 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:

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.