Class EditorHelper
java.lang.Object
de.hybris.platform.cockpit.model.editor.EditorHelper
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CreateContextapplyReferenceRelatedAttributes(ReferenceUIEditor referenceEditor, PropertyDescriptor propertyDescriptor, Map<String, ? extends Object> parameters, TypedObject currentObject, Object currentValue, String isoCode, UICockpitArea cockpitArea, UISession session) protected static booleancheckLanguageVisibility(TypedObject item, String languageIso) static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist) Convenience method for creating and rendering aUIEditor.static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, EditorListener editorListener, String editorCode) Convenience method for creating and rendering aUIEditorvariant specified byeditorCode.static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode) Convenience method for creating and rendering aUIEditorvariant specified byeditorCode.static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params) Convenience method for creating and rendering aUIEditorvariant specified byeditorCode.static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, boolean focus) Convenience method for creating and rendering aUIEditorvariant specified byeditorCode.static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, EditorListener editorListener) Convenience method for creating and rendering aUIEditorvariant specified byeditorCode.static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, EditorListener editorListener, boolean focus) Convenience method for creating and rendering aUIEditorvariant specified byeditorCode.static voidcreateEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, EditorListener editorListener, boolean autoPersist) Convenience method for creating and rendering aUIEditor.static <T> List<? extends T>filterValues(PropertyDescriptor propDescr, List<? extends T> values) Deprecated.since 6.3getAvailableValues(Map<String, ? extends Object> params, PropertyDescriptor propertyDescriptor) Gets available values for a ListUIEditor using configuredAvailableValuesProviderspring bean.static TypedObjectstatic SearchTypegetRootSearchType(PropertyDescriptor propDescr, UISession session) protected static UIAccessRightServicestatic UIEditorgetUIEditor(PropertyDescriptor propDescr, String editorCode) Convenience method for creating and retrieving aUIEditor.static voidinitializeSections(EditorConfiguration cfg, ObjectType type, TypedObject object, TypeService typeService) static booleanisDragAndDropDisabled(Map<String, ? extends Object> parameters) Check whether "Drag & Drop" action for item's qualifier paremeter is disabled.static booleanisEditable(PropertyDescriptor propDescr, boolean creationMode) Deprecated.since 6.3, useUIAccessRightService's isWritable methods instead.static final Set<ObjectType>parseTemplateCodes(String input, TypeService typeService) static voidpersistValues(TypedObject item, ObjectValueContainer valueContainer) static voidpersistValues(TypedObject item, ObjectValueContainer valueContainer, Map<String, ? extends Object> params) static ObjectTemplateprocessVariantTypeCheck(ObjectTemplate type, TypedObject object, PropertyDescriptor propertyDescriptor, TypeService typeService) removeHiddenLanguages(TypedObject item, Collection<String> languages) static voidrenderLocalizedEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, boolean focus) static voidrenderLocalizedEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, boolean focus, EditorListener editorListener) static voidrenderSingleEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, String isoCode, boolean focus) static voidrenderSingleEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, String isoCode, boolean focus, EditorListener editorListener) static voidsetAvailableValuesInListEditor(ListUIEditor editor, PropertyDescriptor propertyDescriptor, Map<String, ? extends Object> params) Helper method to set available values inListUIEditoreditor.static voidtryOpenContextAreaEditor(UICockpitPerspective perspective, ObjectTemplate type, Collection value, TypedObject currentObject, PropertyDescriptor propertyDescriptor, Map<String, ? extends Object> parameters)
-
Field Details
-
EVENT_SOURCE
- See Also:
-
ALLOWED_VALUES_LIST
- See Also:
-
PARAM_DISABLE_DRAG_AND_DROP
- See Also:
-
-
Constructor Details
-
EditorHelper
public EditorHelper()
-
-
Method Details
-
applyReferenceRelatedAttributes
public static CreateContext applyReferenceRelatedAttributes(ReferenceUIEditor referenceEditor, PropertyDescriptor propertyDescriptor, Map<String, ? extends Object> parameters, TypedObject currentObject, Object currentValue, String isoCode, UICockpitArea cockpitArea, UISession session) -
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist) throws IllegalArgumentException Convenience method for creating and rendering aUIEditor. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. Creates the default editor for the property type specified. Internally callscreateEditor(propDescr, parent, valueContainer, null).- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valuesautoPersist- whether values should be automatically persisted or not- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, EditorListener editorListener, String editorCode) throws IllegalArgumentException Convenience method for creating and rendering aUIEditorvariant specified byeditorCode. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. In order to create the default editor for the specified property usecreateEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)instead.- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valuesautoPersist- whether values should be automatically persisted or noteditorListener- current editor listener instanceEditorListenereditorCode- the editor variant to be created ornullfor the default one- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, EditorListener, boolean)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener, boolean)getUIEditor(PropertyDescriptor, String)
-
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode) throws IllegalArgumentException Convenience method for creating and rendering aUIEditorvariant specified byeditorCode. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. In order to create the default editor for the specified property usecreateEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)instead.- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valuesautoPersist- whether values should be automatically persisted or noteditorCode- the editor variant to be created ornullfor the default one- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params) throws IllegalArgumentExceptionConvenience method for creating and rendering aUIEditorvariant specified byeditorCode. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. In order to create the default editor for the specified property usecreateEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)instead.- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valuesautoPersist- whether values should be automatically persisted or noteditorCode- the editor variant to be created ornullfor the default oneparams- creation parameters- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, boolean)getUIEditor(PropertyDescriptor, String)
-
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, boolean focus) throws IllegalArgumentExceptionConvenience method for creating and rendering aUIEditorvariant specified byeditorCode. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. In order to create the default editor for the specified property usecreateEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)instead.- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valuesautoPersist- whether values should be automatically persisted or noteditorCode- the editor variant to be created ornullfor the default oneparams- creation parametersfocus- whether the created editor should be given initial focus or not- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, EditorListener editorListener) throws IllegalArgumentExceptionConvenience method for creating and rendering aUIEditorvariant specified byeditorCode. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. In order to create the default editor for the specified property usecreateEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)instead.- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valuesautoPersist- whether values should be automatically persisted or noteditorCode- the editor variant to be created ornullfor the default oneparams- creation parameterseditorListener- current editor listener instanceEditorListener- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, EditorListener, boolean)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, EditorListener, String)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener, boolean)getUIEditor(PropertyDescriptor, String)
-
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, EditorListener editorListener, boolean focus) throws IllegalArgumentExceptionConvenience method for creating and rendering aUIEditorvariant specified byeditorCode. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. In order to create the default editor for the specified property usecreateEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)instead.- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valuesautoPersist- whether values should be automatically persisted or noteditorCode- the editor variant to be created ornullfor the default oneparams- creation parameterseditorListener- current editor listener instanceEditorListenerfocus- whether the created editor should be given initial focus or not- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, EditorListener, boolean)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, EditorListener, String)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener)getUIEditor(PropertyDescriptor, String)
-
createEditor
public static void createEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, EditorListener editorListener, boolean autoPersist) throws IllegalArgumentException Convenience method for creating and rendering aUIEditor. Handles editor events and loads/stores data from/to the specifiedObjectValueContainervalueContainer. IfautoPersististruevalues are stored in the value container and instantly persisted. Creates the default editor for the property type specified. Internally callscreateEditor(propDescr, parent, valueContainer, null).- Parameters:
item- the item instance for which an editor is to be createdpropDescr- the property descriptor for which a corresponding editor is to be createdparent- the parent component to which the editor is to be addedvalueContainer- theObjectValueContainerused for loading/storing valueseditorListener- current editor listener instanceEditorListenerautoPersist- whether values should be automatically persisted or not- Throws:
IllegalArgumentException- if the property descriptor, parent component or value container is invalid- See Also:
-
createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, EditorListener, String)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener, boolean)getUIEditor(PropertyDescriptor, String)
-
filterValues
@Deprecated public static <T> List<? extends T> filterValues(PropertyDescriptor propDescr, List<? extends T> values) Deprecated.since 6.3 -
getRootSearchType
-
getUIAccessRightService
-
getUIEditor
public static UIEditor getUIEditor(PropertyDescriptor propDescr, String editorCode) throws IllegalArgumentException Convenience method for creating and retrieving aUIEditor. Note: If no editor variant is found with the codeeditorCode, the default editor for the specified property is returned.- Parameters:
propDescr- the property descriptor for which a corresponding editor is to be retrievededitorCode- the editor variant to be used- Returns:
- a new
UIEditorinstance for the specified property and - if available - for the specified editor variant - Throws:
IllegalArgumentException- if the property descriptor is invalid- See Also:
-
createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, boolean)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, EditorListener, boolean)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, EditorListener, String)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener)createEditor(TypedObject, PropertyDescriptor, HtmlBasedComponent, ObjectValueContainer, boolean, String, Map, EditorListener, boolean)
-
initializeSections
public static void initializeSections(EditorConfiguration cfg, ObjectType type, TypedObject object, TypeService typeService) -
isEditable
Deprecated.since 6.3, useUIAccessRightService's isWritable methods instead.Returns whether the specified property is editable or not.- Parameters:
propDescr- the property descriptor- Returns:
trueif the property is editable,falseotherwise
-
persistValues
public static void persistValues(TypedObject item, ObjectValueContainer valueContainer) throws ValueHandlerException - Throws:
ValueHandlerException
-
persistValues
public static void persistValues(TypedObject item, ObjectValueContainer valueContainer, Map<String, ? extends Object> params) throws ValueHandlerException- Throws:
ValueHandlerException
-
processVariantTypeCheck
public static ObjectTemplate processVariantTypeCheck(ObjectTemplate type, TypedObject object, PropertyDescriptor propertyDescriptor, TypeService typeService) -
tryOpenContextAreaEditor
public static void tryOpenContextAreaEditor(UICockpitPerspective perspective, ObjectTemplate type, Collection value, TypedObject currentObject, PropertyDescriptor propertyDescriptor, Map<String, ? extends Object> parameters) -
parseTemplateCodes
-
renderLocalizedEditor
public static void renderLocalizedEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, boolean focus) -
checkLanguageVisibility
-
renderLocalizedEditor
public static void renderLocalizedEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, boolean focus, EditorListener editorListener) -
renderSingleEditor
public static void renderSingleEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, String isoCode, boolean focus) -
renderSingleEditor
public static void renderSingleEditor(TypedObject item, PropertyDescriptor propDescr, org.zkoss.zk.ui.HtmlBasedComponent parent, ObjectValueContainer valueContainer, boolean autoPersist, String editorCode, Map<String, ? extends Object> params, String isoCode, boolean focus, EditorListener editorListener) -
getAvailableValues
public static List<Object> getAvailableValues(Map<String, ? extends Object> params, PropertyDescriptor propertyDescriptor) Gets available values for a ListUIEditor using configuredAvailableValuesProviderspring bean. Spring bean's name is passed as a value of the ALLOWED_VALUES_LIST configuration parameter -ALLOWED_VALUES_LIST -
setAvailableValuesInListEditor
public static void setAvailableValuesInListEditor(ListUIEditor editor, PropertyDescriptor propertyDescriptor, Map<String, ? extends Object> params) Helper method to set available values inListUIEditoreditor. First it tries to use configuredAvailableValuesProviderspring bean to get a list of available values. If no bean is configured, it usesTypeService.getAvailableValues(PropertyDescriptor)method.- Parameters:
editor- target editor.propertyDescriptor- The property descriptor of the property to be set with one of the "available values".params- keeps the set of parameters configured for the editor.
-
getCatalogVersionIfPresent
-
removeHiddenLanguages
-
isDragAndDropDisabled
Check whether "Drag & Drop" action for item's qualifier paremeter is disabled.- Parameters:
parameters- - all item's qualifier parameters- Returns:
-