Class CmsBasicFormField
- java.lang.Object
-
- org.opencms.gwt.client.ui.input.form.CmsBasicFormField
-
- All Implemented Interfaces:
I_CmsFormField
public class CmsBasicFormField extends java.lang.Object implements 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
Constructors Constructor Description CmsBasicFormField(java.lang.String id, java.lang.String description, java.lang.String label, java.lang.Object defaultValue, I_CmsFormWidget widget)
Constructs a new form field.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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, java.lang.String fieldId, I_CmsFormWidgetMultiFactory factory, java.util.Map<java.lang.String,java.lang.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, java.util.Map<java.lang.String,java.lang.String> additionalParams)
Utility method for creating a basic form field.static java.util.Map<java.lang.String,I_CmsFormField>
createFields(java.util.Collection<org.opencms.xml.content.CmsXmlContentProperty> propertyConfigurations)
Creates a map of fields from a map of field configurations.boolean
equals(java.lang.Object o)
java.lang.Object
getDefaultValue()
Returns the default value for the form field.java.lang.String
getDescription()
The description of the form field, or null if there is no description.java.lang.String
getId()
Returns the id of this form field, or null if the form field id has not been set.java.lang.String
getLabel()
The label of the form field, or null if there is no label.I_CmsFormField.LayoutData
getLayoutData()
Returns the layout data for this field.I_CmsStringModel
getModel()
Returns the model object for this field.java.lang.String
getModelId()
Returns the model id.java.lang.String
getModelValue()
Returns the model value.I_CmsFormField.ValidationStatus
getValidationStatus()
Returns the validation status of this form field.I_CmsValidator
getValidator()
Returns the validator for this form field, or null if the field has no validator.I_CmsFormWidget
getWidget()
Returns the widget used by this form field.int
hashCode()
void
setId(java.lang.String id)
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 Detail
-
CmsBasicFormField
public CmsBasicFormField(java.lang.String id, java.lang.String description, java.lang.String label, java.lang.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 Detail
-
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, java.util.Map<java.lang.String,java.lang.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, java.lang.String fieldId, I_CmsFormWidgetMultiFactory factory, java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,I_CmsFormField> createFields(java.util.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
public void bind(I_CmsStringModel model)
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:
I_CmsFormField.bind(org.opencms.gwt.client.ui.input.I_CmsStringModel)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getDefaultValue
public java.lang.Object 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:
I_CmsFormField.getDefaultValue()
-
getDescription
public java.lang.String 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:
I_CmsFormField.getDescription()
-
getId
public java.lang.String 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:
I_CmsFormField.getId()
-
getLabel
public java.lang.String 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:
I_CmsFormField.getLabel()
-
getLayoutData
public I_CmsFormField.LayoutData 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:
I_CmsFormField.getLayoutData()
-
getModel
public I_CmsStringModel 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:
I_CmsFormField.getModel()
-
getModelId
public java.lang.String getModelId()
Description copied from interface:I_CmsFormField
Returns the model id.- Specified by:
getModelId
in interfaceI_CmsFormField
- Returns:
- the model id
- See Also:
I_CmsFormField.getModelId()
-
getModelValue
public java.lang.String getModelValue()
Description copied from interface:I_CmsFormField
Returns the model value.- Specified by:
getModelValue
in interfaceI_CmsFormField
- Returns:
- the model value
- See Also:
I_CmsFormField.getModelValue()
-
getValidationStatus
public I_CmsFormField.ValidationStatus 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:
I_CmsFormField.getValidationStatus()
-
getValidator
public I_CmsValidator 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:
I_CmsFormField.getValidator()
-
getWidget
public I_CmsFormWidget 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:
I_CmsFormField.getWidget()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
setId
public void setId(java.lang.String id)
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:
I_CmsFormField.setId(java.lang.String)
-
setValidationStatus
public void setValidationStatus(I_CmsFormField.ValidationStatus validationStatus)
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:
I_CmsFormField.setValidationStatus(org.opencms.gwt.client.ui.input.I_CmsFormField.ValidationStatus)
-
setValidator
public void setValidator(I_CmsValidator validator)
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:
I_CmsFormField.setValidator(org.opencms.gwt.client.validation.I_CmsValidator)
-
unbind
public void unbind()
Description copied from interface:I_CmsFormField
Removes the binding to this form field's model.- Specified by:
unbind
in interfaceI_CmsFormField
- See Also:
I_CmsFormField.unbind()
-
-