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

java.lang.Object
  extended by com.izforge.izpack.panels.userinput.field.ElementReader
      extended by com.izforge.izpack.panels.userinput.field.FieldReader
All Implemented Interfaces:
FieldConfig
Direct Known Subclasses:
AbstractFileFieldReader, CheckFieldReader, CustomFieldReader, PasswordGroupFieldReader, RuleFieldReader, SearchFieldReader, SimpleChoiceReader, SimpleFieldReader

public class FieldReader
extends ElementReader
implements FieldConfig

Field reader.

Author:
Tim Anderson

Field Summary
static String OMIT_FROM_AUTO
          The omitFromAuto attribute name.
static String SPEC
          The field specification element name.
static String VARIABLE
          Variable attribute name.
 
Constructor Summary
FieldReader(IXMLElement field, Config config)
          Constructs a FieldReader.
 
Method Summary
 String getCondition()
          Returns the condition that determines if the field is displayed or not.
 String getDefaultValue()
          Returns the default value of the field without replacing variables.
 String getDescription()
          Returns the field description.
 String getDisplayHiddenCondition()
          Returns a condition for which the field should be displayed read-only on the panel regardless if its conditionid is true or false.
 IXMLElement getField()
          Returns the 'field' element.
 String getInitialValue()
          Returns the initial value of the field without replacing variables.
 String getLabel()
          Returns the field label.
 boolean getOmitFromAuto()
          Returns the value of 'omitFromAuto' from fields spec
 List<OsModel> getOsModels()
          Returns the operating systems that this field applies to.
 List<String> getPacks()
          Returns the packs that this field applies to.
 List<FieldProcessor> getProcessors()
          Returns the processor the field.
 String getReadonlyCondition()
          Returns a condition for which the field should be displayed read-only.
 int getSize()
          Returns the field size.
 IXMLElement getSpec()
          Returns the 'spec' element.
protected  IXMLElement getSpec(IXMLElement field, Config config)
          Returns the 'spec' element.
 String getSummaryKey()
          Returns the summaryKey that the field is associated with.
protected  String getText(IXMLElement element)
          Extracts the text from an element.
 String getTooltip()
          Returns the field's tooltip.
 List<FieldValidator> getValidators()
          Returns the validators for the field.
 List<FieldValidator> getValidators(IXMLElement field)
          Returns the validators for the field.
 String getVariable()
          Returns the variable that the field reads and updates.
 Boolean isDisplayHidden()
          Returns if the field should always be displayed read-only on the panel regardless if its conditionid is true or false.
 Boolean isReadonly()
          Returns if the field should always be displayed read-only.
 
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
 

Field Detail

VARIABLE

public static final String VARIABLE
Variable attribute name.

See Also:
Constant Field Values

SPEC

public static final String SPEC
The field specification element name.

See Also:
Constant Field Values

OMIT_FROM_AUTO

public static final String OMIT_FROM_AUTO
The omitFromAuto attribute name.

See Also:
Constant Field Values
Constructor Detail

FieldReader

public FieldReader(IXMLElement field,
                   Config config)
Constructs a FieldReader.

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

getField

public IXMLElement getField()
Returns the 'field' element.

Returns:
the 'field' element

getSpec

public IXMLElement getSpec()
Returns the 'spec' element.

Returns:
the 'spec' element, or null if none is present

getOmitFromAuto

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

Specified by:
getOmitFromAuto in interface FieldConfig
Returns:
the 'omitFromAuto' attribute

getVariable

public String getVariable()
Returns the variable that the field reads and updates.

This implementation throws an exception if the variable is not present; subclasses override and return null if the variable is optional.

Specified by:
getVariable in interface FieldConfig
Returns:
the 'variable' attribute, or null if the variable is optional but not present
Throws:
IzPackException - if the 'variable' attribute is mandatory but not present

getSummaryKey

public String getSummaryKey()
Returns the summaryKey that the field is associated with.

Specified by:
getSummaryKey in interface FieldConfig
Returns:
the 'summaryKey' attribute, or null

isDisplayHidden

public Boolean isDisplayHidden()
Description copied from interface: FieldConfig
Returns if the field should always be displayed read-only on the panel regardless if its conditionid is true or false.

Specified by:
isDisplayHidden in interface FieldConfig
Returns:
the 'displayHidden' attribute, or false

getDisplayHiddenCondition

public String getDisplayHiddenCondition()
Description copied from interface: FieldConfig
Returns a condition for which the field should be displayed read-only on the panel regardless if its conditionid is true or false. If the condition evaluates false, don't apply displayHidden.

Specified by:
getDisplayHiddenCondition in interface FieldConfig
Returns:
the condition, or null

isReadonly

public Boolean isReadonly()
Description copied from interface: FieldConfig
Returns if the field should always be displayed read-only.

Specified by:
isReadonly in interface FieldConfig
Returns:
the 'readonly' attribute, or false

getReadonlyCondition

public String getReadonlyCondition()
Description copied from interface: FieldConfig
Returns a condition for which the field should be displayed read-only. If the conditionid is false, don't apply readonly.

Specified by:
getReadonlyCondition in interface FieldConfig
Returns:
the 'readonlyCondition' attribute, or null

getPacks

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

Specified by:
getPacks in interface FieldConfig
Returns:
the list of pack names

getOsModels

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

Specified by:
getOsModels in interface FieldConfig
Returns:
the operating systems, or an empty list if the field applies to all operating systems

getDefaultValue

public String getDefaultValue()
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
Returns:
the default value. May be null

getInitialValue

public String getInitialValue()
Returns the initial value of the field without replacing variables.

This is obtained from the 'set' attribute of the 'spec' element.

Specified by:
getInitialValue in interface FieldConfig
Returns:
the default value. May be null

getSize

public int getSize()
Returns the field size.

Specified by:
getSize in interface FieldConfig
Returns:
the field size, or -1 if no size is specified, or the specified size is invalid

getValidators

public List<FieldValidator> getValidators(IXMLElement field)
Returns the validators for the field.

Specified by:
getValidators in interface FieldConfig
Returns:
the validators for the field

getValidators

public List<FieldValidator> getValidators()
Description copied from interface: FieldConfig
Returns the validators for the field.

Specified by:
getValidators in interface FieldConfig
Returns:
the validators for the field

getProcessors

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

Specified by:
getProcessors in interface FieldConfig
Returns:
the field processor, or null if none exists

getDescription

public String getDescription()
Returns the field description.

Specified by:
getDescription in interface FieldConfig
Returns:
the field description. May be @{code null}

getTooltip

public String getTooltip()
Returns the field's tooltip.

Specified by:
getTooltip in interface FieldConfig
Returns:
the field tooltip. May be @{code null}

getLabel

public String getLabel()
Returns the field label.

Specified by:
getLabel in interface FieldConfig
Returns:
the field label. May be null

getCondition

public String getCondition()
Returns the condition that determines if the field is displayed or not.

Specified by:
getCondition in interface FieldConfig
Returns:
the condition. May be null

getSpec

protected IXMLElement getSpec(IXMLElement field,
                              Config config)
Returns the 'spec' element.

Parameters:
field - the parent field element
config - the configuration
Returns:
the 'spec' element, or null if the spec element is optional and not found
Throws:
IzPackException - if the 'spec' element is mandatory but not present

getText

protected String getText(IXMLElement element)
Extracts the text from an element. The text can be defined:
  1. in the locale's messages, under the key defined by the id attribute; or
  2. as value of the attribute txt.

Parameters:
element - the element from which to extract the text
Returns:
the text, or null if none can be found


Copyright © 2018. All rights reserved.