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

java.lang.Object
  extended by com.izforge.izpack.panels.userinput.field.Field
Direct Known Subclasses:
AbstractFileField, ButtonField, CheckField, ChoiceField, CustomField, Divider, PasswordGroupField, RuleField, SearchField, Spacer, StaticText, TextField, TitleField

public abstract class Field
extends Object

Describes a user input field.

Author:
Tim Anderson

Constructor Summary
Field(FieldConfig config, InstallData installData)
          Constructs a Field.
 
Method Summary
 String getDefaultValue()
          Returns the default value of the field with resolved variables.
 String getDescription()
          Returns the field description with resolved variable values.
 String getDescription(boolean resolve)
          Returns the field description.
 String getInitialValue()
          Returns the initial value to use for this field with resolved variables.
 InstallData getInstallData()
          Returns the installation data.
 String getLabel()
          Returns the field label with resolved variable values.
 String getLabel(boolean resolve)
          Returns the field label.
 boolean getOmitFromAuto()
          Returns the value of 'omitFromAuto' from fields spec
 List<OsModel> getOsModels()
          Returns the operating systems that the field applies to.
 List<String> getPacks()
          Returns the packs that the field applies to.
 List<FieldProcessor> getProcessors()
          Returns the field processors.
 int getSize()
          Returns the field size.
 String getSummaryKey()
          Returns the summaryKey.
 String getTooltip()
          Returns the field tooltip with resolved variable values.
 String getValue()
          Returns the variable value.
 String getVariable()
          Returns the variable.
 boolean isConditionTrue()
          Determines if the condition associated with the field is true.
 boolean isEffectiveDisplayHidden(boolean defaultFlag, RulesEngine rules)
          Returns an effective value whether a field should be currently displayed read-only if hidden.
 boolean isEffectiveReadonly(boolean defaultFlag, RulesEngine rules)
          Returns an effective value whether a field should be currently displayed read-only.
protected  String replaceVariables(String value)
          Replaces any variables in the supplied value.
 void setSaving(boolean flag)
           
 void setValue(String value)
          Sets the variable value.
 void setVariable(String newVariableName)
           
 ValidationStatus validate(String... values)
          Validates values using any validators associated with the field.
 ValidationStatus validate(ValuesProcessingClient values)
          Validates values using any validators associated with the field.
 String wrapDefaultValue(String originalValue)
          Wrap the default value of a field, which is the value of the default attribute in the field's spec to the effective value to be assigned to the variable.
 String wrapInitialValue(String originalValue)
          Wrap the initial value of a field, which is the value of the set attribute in the field's spec to the effective value to be assigned to the variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Field

public Field(FieldConfig config,
             InstallData installData)
Constructs a Field.

Parameters:
config - the field configuration
installData - the installation data
Throws:
IzPackException - if the configuration is invalid
Method Detail

getVariable

public String getVariable()
Returns the variable.

Returns:
the variable. May be null

getOmitFromAuto

public boolean getOmitFromAuto()
Returns the value of 'omitFromAuto' from fields spec

Returns:
the 'omitFromAuto' attribute

getSummaryKey

public String getSummaryKey()
Returns the summaryKey.

Returns:
the summaryKey. May be null

isEffectiveReadonly

public boolean isEffectiveReadonly(boolean defaultFlag,
                                   RulesEngine rules)
Returns an effective value whether a field should be currently displayed read-only.

Returns:
true if field should be shown read-only, or false

isEffectiveDisplayHidden

public boolean isEffectiveDisplayHidden(boolean defaultFlag,
                                        RulesEngine rules)
Returns an effective value whether a field should be currently displayed read-only if hidden.

Returns:
true if field should be shown read-only if hidden, or false

getPacks

public List<String> getPacks()
Returns the packs that the field applies to.

Returns:
the pack names

getOsModels

public List<OsModel> getOsModels()
Returns the operating systems that the field applies to.

Returns:
the OS family names

getDefaultValue

public String getDefaultValue()
Returns the default value of the field with resolved variables.

Returns:
the default value. May be null

getInitialValue

public String getInitialValue()
Returns the initial value to use for this field with resolved variables.

The following non-null value is used from the following search order

Returns:
The initial value to use for this field

getValue

public String getValue()
Returns the variable value.

Returns:
the variable value. May be null

setSaving

public void setSaving(boolean flag)

setValue

public void setValue(String value)
Sets the variable value.

Parameters:
value - the variable value. May be null

wrapInitialValue

public String wrapInitialValue(String originalValue)
Wrap the initial value of a field, which is the value of the set attribute in the field's spec to the effective value to be assigned to the variable. This can be used for enumeration type conversions.

This method can be optionally overridden by several user input field types.

Example: The set attribute in the checkbox user input field has a boolean value, the value should be wrapped to the value of the true attribute in case of set="true" or to the value of the false attribute in case of set="false".

Parameters:
originalValue - the original value of the set attribute
Returns:
the wrapped value
See Also:
CheckField

wrapDefaultValue

public String wrapDefaultValue(String originalValue)
Wrap the default value of a field, which is the value of the default attribute in the field's spec to the effective value to be assigned to the variable. This can be used for enumeration type conversions. To be overridden by several user input field types.

This method can be optionally overridden by several user input field types.

Example: The set attribute in the checkbox user input field has a boolean value, the value should be wrapped to the value of the true attribute in case of default="true" or to the value of the false attribute in case of default="false".

Parameters:
originalValue - the original value of the default attribute
Returns:
the wrapped value
See Also:
CheckField, CheckField

getSize

public int getSize()
Returns the field size.

Returns:
the field size, or -1 if no size is defined

validate

public ValidationStatus validate(String... values)
Validates values using any validators associated with the field.

Parameters:
values - the values to validate
Returns:
the status of the validation

validate

public ValidationStatus validate(ValuesProcessingClient values)
Validates values using any validators associated with the field.

Parameters:
values - the values to validate
Returns:
the status of the validation

getProcessors

public List<FieldProcessor> getProcessors()
Returns the field processors.

Returns:
the field processors. May be null

getLabel

public String getLabel()
Returns the field label with resolved variable values.

Returns:
the field label. May be null

getLabel

public String getLabel(boolean resolve)
Returns the field label.

Parameters:
resolve - whether the label should be returned with resolved variables
Returns:
the field label. May be null

getDescription

public String getDescription()
Returns the field description with resolved variable values.

Returns:
the field description. May be null

getDescription

public String getDescription(boolean resolve)
Returns the field description.

Parameters:
resolve - whether the description should be returned with resolved variables
Returns:
the field label. May be null

getTooltip

public String getTooltip()
Returns the field tooltip with resolved variable values.

Returns:
the field tooltip. May be null

isConditionTrue

public boolean isConditionTrue()
Determines if the condition associated with the field is true.

Returns:
true if the condition evaluates {true} or if the field has no condition

getInstallData

public InstallData getInstallData()
Returns the installation data.

Returns:
the installation data

replaceVariables

protected String replaceVariables(String value)
Replaces any variables in the supplied value.

Parameters:
value - the value
Returns:
the value with variables replaced

setVariable

public void setVariable(String newVariableName)


Copyright © 2018. All rights reserved.