Package org.opencms.gwt.client.property
Class CmsPropertySubmitHandler
- java.lang.Object
-
- org.opencms.gwt.client.property.CmsPropertySubmitHandler
-
- All Implemented Interfaces:
I_CmsFormSubmitHandler
public class CmsPropertySubmitHandler extends java.lang.Object implements I_CmsFormSubmitHandler
This class handles form submits from property forms and passes the form data to a property editor handler.
-
-
Constructor Summary
Constructors Constructor Description CmsPropertySubmitHandler(I_CmsPropertyEditorHandler handler)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getAndRemoveValue(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String key)
Helper method which retrieves a value for a given key from a map and then deletes the entry for the key.protected java.util.List<org.opencms.gwt.shared.property.CmsPropertyModification>
getPropertyChanges(java.util.Map<java.lang.String,java.lang.String> fieldValues)
Converts a map of field values to a list of property changes.void
onSubmitForm(CmsForm form, java.util.Map<java.lang.String,java.lang.String> fieldValues, java.util.Set<java.lang.String> editedFields)
The method which should be called when aCmsForm
is submitted.protected java.lang.String
removeTabSuffix(java.lang.String fieldId)
Removes the tab suffix from a field id.protected java.util.Set<java.lang.String>
removeTabSuffixes(java.util.Collection<java.lang.String> fieldIds)
Removes the tab suffixes from each field id of a collection.protected java.util.Map<java.lang.String,java.lang.String>
removeTabSuffixes(java.util.Map<java.lang.String,java.lang.String> fieldValues)
Removes the tab suffixes from the keys of a map.
-
-
-
Constructor Detail
-
CmsPropertySubmitHandler
public CmsPropertySubmitHandler(I_CmsPropertyEditorHandler handler)
Creates a new instance.- Parameters:
handler
- the property editor handler
-
-
Method Detail
-
onSubmitForm
public void onSubmitForm(CmsForm form, java.util.Map<java.lang.String,java.lang.String> fieldValues, java.util.Set<java.lang.String> editedFields)
Description copied from interface:I_CmsFormSubmitHandler
The method which should be called when aCmsForm
is submitted.The map passed as a parameter will contain key-value pairs where the key is the name of the field and the value is the value obtained from the field. It is explicitly allowed that the value is null; this means that the property is set to 'default'.
- Specified by:
onSubmitForm
in interfaceI_CmsFormSubmitHandler
- Parameters:
form
- the formfieldValues
- a map of field valueseditedFields
- the fields which have been edited- See Also:
I_CmsFormSubmitHandler.onSubmitForm(org.opencms.gwt.client.ui.input.form.CmsForm, java.util.Map, java.util.Set)
-
getAndRemoveValue
protected java.lang.String getAndRemoveValue(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String key)
Helper method which retrieves a value for a given key from a map and then deletes the entry for the key.- Parameters:
map
- the map from which to retrieve the valuekey
- the key- Returns:
- the removed value
-
getPropertyChanges
protected java.util.List<org.opencms.gwt.shared.property.CmsPropertyModification> getPropertyChanges(java.util.Map<java.lang.String,java.lang.String> fieldValues)
Converts a map of field values to a list of property changes.- Parameters:
fieldValues
- the field values- Returns:
- the property changes
-
removeTabSuffix
protected java.lang.String removeTabSuffix(java.lang.String fieldId)
Removes the tab suffix from a field id.- Parameters:
fieldId
- a field id- Returns:
- the field id without the suffix
-
removeTabSuffixes
protected java.util.Set<java.lang.String> removeTabSuffixes(java.util.Collection<java.lang.String> fieldIds)
Removes the tab suffixes from each field id of a collection.- Parameters:
fieldIds
- the field ids from which to remove the tab suffix- Returns:
- a new collection of field ids without tab suffixes
-
removeTabSuffixes
protected java.util.Map<java.lang.String,java.lang.String> removeTabSuffixes(java.util.Map<java.lang.String,java.lang.String> fieldValues)
Removes the tab suffixes from the keys of a map.- Parameters:
fieldValues
- a map of field values- Returns:
- a new map of field values, with tab suffixes removed from the keys
-
-