Class CmsBasicFormField
java.lang.Object
org.opencms.gwt.client.ui.input.form.CmsBasicFormField
- All Implemented Interfaces:
I_CmsFormField
Basic implementation of the I_CmsFormField class.
- Since:
- 8.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencms.gwt.client.ui.input.I_CmsFormField
I_CmsFormField.LayoutData, I_CmsFormField.ValidationStatus
-
Constructor Summary
ConstructorsConstructorDescriptionCmsBasicFormField
(String id, String description, String label, Object defaultValue, I_CmsFormWidget widget) Constructs a new form field. -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(I_CmsStringModel model) Binds a model object to the form field.static CmsBasicFormField
createField
(org.opencms.xml.content.CmsXmlContentProperty propertyConfig) Utility method for creating a single basic form field from an id and a property configuration.static CmsBasicFormField
createField
(org.opencms.xml.content.CmsXmlContentProperty propertyConfig, String fieldId, I_CmsFormWidgetMultiFactory factory, Map<String, String> additionalParams, boolean alwaysAllowEmpty) Utility method for creating a single basic form field from an id and a property configuration.static CmsBasicFormField
createField
(org.opencms.xml.content.CmsXmlContentProperty propertyConfig, Map<String, String> additionalParams) Utility method for creating a basic form field.static Map<String,
I_CmsFormField> createFields
(Collection<org.opencms.xml.content.CmsXmlContentProperty> propertyConfigurations) Creates a map of fields from a map of field configurations.boolean
Returns the default value for the form field.The description of the form field, or null if there is no description.getId()
Returns the id of this form field, or null if the form field id has not been set.getLabel()
The label of the form field, or null if there is no label.Returns the layout data for this field.getModel()
Returns the model object for this field.Returns the model id.Returns the model value.Returns the validation status of this form field.Returns the validator for this form field, or null if the field has no validator.Returns the widget used by this form field.int
hashCode()
void
Sets the id of this form field.void
setValidationStatus
(I_CmsFormField.ValidationStatus validationStatus) Updates the validation status of this form field.void
setValidator
(I_CmsValidator validator) Sets the validator for this form field.void
unbind()
Removes the binding to this form field's model.
-
Constructor Details
-
CmsBasicFormField
public CmsBasicFormField(String id, String description, String label, Object defaultValue, I_CmsFormWidget widget) Constructs a new form field.- Parameters:
id
- the id of the form fielddescription
- the description of the form fieldlabel
- the label of the form fielddefaultValue
- the default value of the form fieldwidget
- the widget of the form field
-
-
Method Details
-
createField
public static CmsBasicFormField createField(org.opencms.xml.content.CmsXmlContentProperty propertyConfig) Utility method for creating a single basic form field from an id and a property configuration.- Parameters:
propertyConfig
- the configuration of the property- Returns:
- the newly created form field
-
createField
public static CmsBasicFormField createField(org.opencms.xml.content.CmsXmlContentProperty propertyConfig, Map<String, String> additionalParams) Utility method for creating a basic form field.- Parameters:
propertyConfig
- the property configurationadditionalParams
- the additional parameters- Returns:
- the newly created form fields
-
createField
public static CmsBasicFormField createField(org.opencms.xml.content.CmsXmlContentProperty propertyConfig, String fieldId, I_CmsFormWidgetMultiFactory factory, Map<String, String> additionalParams, boolean alwaysAllowEmpty) Utility method for creating a single basic form field from an id and a property configuration.- Parameters:
propertyConfig
- the configuration of the propertyfieldId
- the field idfactory
- a factory for creating form widgetsadditionalParams
- additional field parametersalwaysAllowEmpty
- indicates an empty value is allowed- Returns:
- the newly created form field
-
createFields
public static Map<String,I_CmsFormField> createFields(Collection<org.opencms.xml.content.CmsXmlContentProperty> propertyConfigurations) Creates a map of fields from a map of field configurations.- Parameters:
propertyConfigurations
- the map of field configurations- Returns:
- a map of form fields
-
bind
Description copied from interface:I_CmsFormField
Binds a model object to the form field.- Specified by:
bind
in interfaceI_CmsFormField
- Parameters:
model
- the model object- See Also:
-
equals
-
getDefaultValue
Description copied from interface:I_CmsFormField
Returns the default value for the form field.- Specified by:
getDefaultValue
in interfaceI_CmsFormField
- Returns:
- the default value for the form field
- See Also:
-
getDescription
Description copied from interface:I_CmsFormField
The description of the form field, or null if there is no description.- Specified by:
getDescription
in interfaceI_CmsFormField
- Returns:
- a description string or null
- See Also:
-
getId
Description copied from interface:I_CmsFormField
Returns the id of this form field, or null if the form field id has not been set. If a form field without an id is added to a form, typically it will receive a synthetic id.- Specified by:
getId
in interfaceI_CmsFormField
- Returns:
- the id
- See Also:
-
getLabel
Description copied from interface:I_CmsFormField
The label of the form field, or null if there is no label.- Specified by:
getLabel
in interfaceI_CmsFormField
- Returns:
- a label or null
- See Also:
-
getLayoutData
Description copied from interface:I_CmsFormField
Returns the layout data for this field.- Specified by:
getLayoutData
in interfaceI_CmsFormField
- Returns:
- the layout data for this field
- See Also:
-
getModel
Description copied from interface:I_CmsFormField
Returns the model object for this field.- Specified by:
getModel
in interfaceI_CmsFormField
- Returns:
- the model used for this field
- See Also:
-
getModelId
Description copied from interface:I_CmsFormField
Returns the model id.- Specified by:
getModelId
in interfaceI_CmsFormField
- Returns:
- the model id
- See Also:
-
getModelValue
Description copied from interface:I_CmsFormField
Returns the model value.- Specified by:
getModelValue
in interfaceI_CmsFormField
- Returns:
- the model value
- See Also:
-
getValidationStatus
Description copied from interface:I_CmsFormField
Returns the validation status of this form field.If the field has no validator, this should always return
valid
.- Specified by:
getValidationStatus
in interfaceI_CmsFormField
- Returns:
- the validation status
- See Also:
-
getValidator
Description copied from interface:I_CmsFormField
Returns the validator for this form field, or null if the field has no validator.- Specified by:
getValidator
in interfaceI_CmsFormField
- Returns:
- a validator or null
- See Also:
-
getWidget
Description copied from interface:I_CmsFormField
Returns the widget used by this form field.- Specified by:
getWidget
in interfaceI_CmsFormField
- Returns:
- a widget
- See Also:
-
hashCode
-
setId
Description copied from interface:I_CmsFormField
Sets the id of this form field.- Specified by:
setId
in interfaceI_CmsFormField
- Parameters:
id
- the new id- See Also:
-
setValidationStatus
Description copied from interface:I_CmsFormField
Updates the validation status of this form field.This will only have an effect if the field has a validator.
- Specified by:
setValidationStatus
in interfaceI_CmsFormField
- Parameters:
validationStatus
- the new validation status- See Also:
-
setValidator
Description copied from interface:I_CmsFormField
Sets the validator for this form field.- Specified by:
setValidator
in interfaceI_CmsFormField
- Parameters:
validator
- the new validator- See Also:
-
unbind
Description copied from interface:I_CmsFormField
Removes the binding to this form field's model.- Specified by:
unbind
in interfaceI_CmsFormField
- See Also:
-