Package org.opencms.gwt
Class CmsPropertyEditorHelper
java.lang.Object
org.opencms.gwt.CmsPropertyEditorHelper
- Direct Known Subclasses:
CmsNewResourceBuilder.PropertyEditorHelper
Helper class responsible for loading / saving properties when using the property dialog.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Map<String,
CmsClientProperty> convertProperties
(List<CmsProperty> properties) Converts CmsProperty objects to CmsClientProperty objects.getDefaultProperties
(List<CmsUUID> structureIds) Internal method for computing the default property configurations for a list of structure ids.protected Map<String,
CmsXmlContentProperty> getDefaultPropertiesForType
(String typeName) Helper method to get the default property configuration for the given resource type.protected Map<String,
CmsProperty> getPropertiesByName
(List<CmsProperty> properties) Converts a list of properties to a map.protected boolean
isWritable
(CmsObject cms, CmsResource resource) Returns whether the current user has write permissions, the resource is lockable or already locked by the current user and is in the current project.Loads the data needed for editing the properties of a resource.void
overrideStructureId
(CmsUUID structureId) Sets a structure id that overrides the one stored in a property change set.void
saveProperties
(CmsPropertyChangeSet changes) Saves a set of property changes.void
setUpdateIndex
(boolean updateIndex) Sets the 'update index' flag to control whether the index should be updated after saving.static void
updateWysiwygConfig
(Map<String, CmsXmlContentProperty> propertyConfig, CmsObject cms, CmsResource resource) Updates the property configuration for properties using WYSIWYG widgets.
-
Constructor Details
-
CmsPropertyEditorHelper
Creates a new instance.- Parameters:
cms
- the CMS context
-
-
Method Details
-
updateWysiwygConfig
public static void updateWysiwygConfig(Map<String, CmsXmlContentProperty> propertyConfig, CmsObject cms, CmsResource resource) Updates the property configuration for properties using WYSIWYG widgets.- Parameters:
propertyConfig
- the property configurationcms
- the CMS contextresource
- the current resource (may be null)
-
getDefaultProperties
public Map<CmsUUID,Map<String, getDefaultPropertiesCmsXmlContentProperty>> (List<CmsUUID> structureIds) throws CmsException Internal method for computing the default property configurations for a list of structure ids.- Parameters:
structureIds
- the structure ids for which we want the default property configurations- Returns:
- a map from the given structure ids to their default property configurations
- Throws:
CmsException
- if something goes wrong
-
loadPropertyData
Loads the data needed for editing the properties of a resource.- Parameters:
id
- the structure id of the resource- Returns:
- the data needed for editing the properties
- Throws:
CmsException
- if something goes wrong
-
overrideStructureId
Sets a structure id that overrides the one stored in a property change set.- Parameters:
structureId
- the new structure id
-
setUpdateIndex
Sets the 'update index' flag to control whether the index should be updated after saving.- Parameters:
updateIndex
- true if the index should be updated after saving
-
convertProperties
Converts CmsProperty objects to CmsClientProperty objects.- Parameters:
properties
- a list of server-side properties- Returns:
- a map of client-side properties
-
getDefaultPropertiesForType
Helper method to get the default property configuration for the given resource type.- Parameters:
typeName
- the name of the resource type- Returns:
- the default property configuration for the given type
-
getPropertiesByName
Converts a list of properties to a map.- Parameters:
properties
- the list of properties- Returns:
- a map from property names to properties
-
isWritable
Returns whether the current user has write permissions, the resource is lockable or already locked by the current user and is in the current project.- Parameters:
cms
- the cms contextresource
- the resource- Returns:
true
if the resource is writable- Throws:
CmsException
- in case checking the permissions fails
-