Package com.hybris.cockpitng.common
Class EditorConfigurator
- java.lang.Object
-
- com.hybris.cockpitng.common.EditorConfigurator
-
public class EditorConfigurator extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description EditorConfigurator(Editor editor)Creates a configurator - object that helps configuring existingEditorcomponents.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddParameter(java.lang.String parameter, java.lang.Object value)Adds a parameter to editor's context.<VALUE> voidaddParameters(java.util.Map<java.lang.String,VALUE> parameters)Adds parameters to editor's context.voidconfigure(DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute and sets all default configuration that it causesvoidconfigure(DataType dataType)Sets default configuration of editor for specified data typevoidconfigure(java.lang.Object item, DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute and sets all default configuration that it causesvoidconfigure(java.lang.String widgetModelKey, DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute.voidconfigure(java.lang.String widgetModelKey, DataAttribute attribute, boolean attributeValueDetached)voidconfigureEditorDetached(java.lang.String widgetModelKey, DataAttribute attribute)protected <E extends org.zkoss.zk.ui.event.Event>
org.zkoss.zk.ui.event.EventListener<E>createReferenceUpdateListener(DataAttribute attribute)voidenableValidation(ValidatableContainer container)Configures validation for editor.voidenableValidation(java.lang.String modelKey, java.lang.String qualifier, ValidatableContainer container)Deprecated.useenableValidation(ValidatableContainer)insteadprotected java.lang.StringgetAttributeDescription(java.lang.String dataType, java.lang.String qualifier)protected java.lang.StringgetAttributeLabel(java.lang.String dataType, java.lang.String qualifier)protected ObjectValuePathgetEditorPathPrefix(ObjectValuePath editorProperty, java.lang.String attributeQualifier)protected EditorRegistrygetEditorRegistry()protected LabelServicegetLabelService()protected ObjectFacadegetObjectFacade()protected PermissionFacadegetPermissionFacade()ReferenceModelPropertiesgetReferenceModelProperties()TypeFacadegetTypeFacade()protected booleanisReferenceEditor(DataAttribute genericAttribute)protected java.util.Map<java.util.regex.Pattern,java.lang.String>prepareSinglingEditorMappings()voidsetAttached(DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute.voidsetAttached(java.lang.Object item, DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute.voidsetAttached(java.lang.Object item, java.lang.String qualifier)Configures editor in the way that it may be used to manipulate with values of specified attribute.voidsetAttached(java.lang.String qualifier)Configures editor in the way that it may be used to manipulate with values of specified attribute.voidsetAttached(java.lang.String widgetModelKey, java.lang.String qualifier)Configures editor in the way that it may be used to manipulate with values of specified attribute.protected voidsetDefaults(DataAttribute attribute)protected voidsetDefaults(DataType dataType)voidsetDescription(java.lang.String description)Some editors are capable of decorating editor component with proper description (i.e.voidsetEditorRegistry(EditorRegistry editorRegistry)voidsetGroup(java.lang.String groupName)Sets a name of editors group, that configured one belongs to.voidsetLabel(java.lang.String label)Some editors are capable of decorating editor component with proper label (i.e.voidsetLabelService(LabelService labelService)voidsetMultilingual(boolean multilingual)Configures editor so that it allows to input values different languages.voidsetMultilingual(boolean multilingual, java.lang.Object item)Configures editor so that it allows to input values different languages.voidsetMultilingual(boolean multilingual, java.util.Set<java.util.Locale> locales)Configures editor so that it allows to input values different languages.voidsetObjectFacade(ObjectFacade objectFacade)voidsetPermissionFacade(PermissionFacade permissionFacade)voidsetReferenceModelProperties(ReferenceModelProperties referenceModelProperties)voidsetSingleValued()Changes all multivalued editors into single-valued - i.e.voidsetTypeFacade(TypeFacade typeFacade)protected voidupdateObjectsReferencedByEditor(DataAttribute attribute)voiduseDefaultEditor()Resets editor, so that is uses the default one for previously configured data type
-
-
-
Method Detail
-
getPermissionFacade
protected PermissionFacade getPermissionFacade()
-
setPermissionFacade
public void setPermissionFacade(PermissionFacade permissionFacade)
-
getEditorRegistry
protected EditorRegistry getEditorRegistry()
-
setEditorRegistry
public void setEditorRegistry(EditorRegistry editorRegistry)
-
getObjectFacade
protected ObjectFacade getObjectFacade()
-
setObjectFacade
public void setObjectFacade(ObjectFacade objectFacade)
-
getLabelService
protected LabelService getLabelService()
-
setLabelService
public void setLabelService(LabelService labelService)
-
getTypeFacade
public TypeFacade getTypeFacade()
-
setTypeFacade
public void setTypeFacade(TypeFacade typeFacade)
-
getReferenceModelProperties
public ReferenceModelProperties getReferenceModelProperties()
-
setReferenceModelProperties
public void setReferenceModelProperties(ReferenceModelProperties referenceModelProperties)
-
addParameters
public <VALUE> void addParameters(java.util.Map<java.lang.String,VALUE> parameters)
Adds parameters to editor's context.- Parameters:
parameters- parameters to be added
-
addParameter
public void addParameter(java.lang.String parameter, java.lang.Object value)Adds a parameter to editor's context.- Parameters:
parameter- parameter namevalue- parameter
-
setSingleValued
public void setSingleValued()
Changes all multivalued editors into single-valued - i.e. localized editors should allow providing values only for a single language, multi-reference editors should allow providing only single reference, etc.
-
prepareSinglingEditorMappings
protected java.util.Map<java.util.regex.Pattern,java.lang.String> prepareSinglingEditorMappings()
-
setAttached
public void setAttached(DataAttribute attribute)
Configures editor in the way that it may be used to manipulate with values of specified attribute.- Parameters:
attribute- attribute which values will be changed by editor- See Also:
setDefaults(DataAttribute)
-
isReferenceEditor
protected boolean isReferenceEditor(DataAttribute genericAttribute)
-
createReferenceUpdateListener
protected <E extends org.zkoss.zk.ui.event.Event> org.zkoss.zk.ui.event.EventListener<E> createReferenceUpdateListener(DataAttribute attribute)
-
updateObjectsReferencedByEditor
protected void updateObjectsReferencedByEditor(DataAttribute attribute)
-
getEditorPathPrefix
protected ObjectValuePath getEditorPathPrefix(ObjectValuePath editorProperty, java.lang.String attributeQualifier)
-
getAttributeLabel
protected java.lang.String getAttributeLabel(java.lang.String dataType, java.lang.String qualifier)
-
getAttributeDescription
protected java.lang.String getAttributeDescription(java.lang.String dataType, java.lang.String qualifier)
-
setAttached
public void setAttached(java.lang.Object item, DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute.- Parameters:
item- item model which attribute will be changed by editorattribute- attribute which values will be changed by editor- See Also:
configure(Object, DataAttribute)
-
setAttached
public void setAttached(java.lang.Object item, java.lang.String qualifier)Configures editor in the way that it may be used to manipulate with values of specified attribute.- Parameters:
item- item model which attribute will be changed by editorqualifier- qualifier of attribute which values will be changed by editor
-
setAttached
public void setAttached(java.lang.String widgetModelKey, java.lang.String qualifier)Configures editor in the way that it may be used to manipulate with values of specified attribute.- Parameters:
widgetModelKey- name of widget model value under which an item may be found, which attribute will be changed by editorqualifier- qualifier of attribute which values will be changed by editor- See Also:
configure(String, DataAttribute)
-
setAttached
public void setAttached(java.lang.String qualifier)
Configures editor in the way that it may be used to manipulate with values of specified attribute.- Parameters:
qualifier- qualifier of attribute which values will be changed by editor- See Also:
configure(String, DataAttribute)
-
setDefaults
protected void setDefaults(DataType dataType)
-
setDefaults
protected void setDefaults(DataAttribute attribute)
-
configure
public void configure(DataType dataType)
Sets default configuration of editor for specified data type- Parameters:
dataType- type of data that is to be edited
-
configure
public void configure(DataAttribute attribute)
Configures editor in the way that it may be used to manipulate with values of specified attribute and sets all default configuration that it causes- Parameters:
attribute- attribute which values will be changed by editor- See Also:
setAttached(DataAttribute)
-
configure
public void configure(java.lang.Object item, DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute and sets all default configuration that it causes- Parameters:
item- item model which attribute will be changed by editorattribute- attribute which values will be changed by editor- See Also:
setAttached(Object, DataAttribute)
-
configure
public void configure(java.lang.String widgetModelKey, DataAttribute attribute, boolean attributeValueDetached)
-
configure
public void configure(java.lang.String widgetModelKey, DataAttribute attribute)Configures editor in the way that it may be used to manipulate with values of specified attribute.- Parameters:
widgetModelKey- name of widget model value under which an item may be found, which attribute will be changed by editorattribute- attribute which values will be changed by editor- See Also:
setAttached(String, String)
-
configureEditorDetached
public void configureEditorDetached(java.lang.String widgetModelKey, DataAttribute attribute)
-
setLabel
public void setLabel(java.lang.String label)
Some editors are capable of decorating editor component with proper label (i.e. localized editors). Please provide proper label to make it possible.- Parameters:
label- label to be used
-
setDescription
public void setDescription(java.lang.String description)
Some editors are capable of decorating editor component with proper description (i.e. localized editors). Please provide proper text to make it possible.- Parameters:
description- description to be used
-
setGroup
public void setGroup(java.lang.String groupName)
Sets a name of editors group, that configured one belongs to. A name of group is then passed directly to editor.- Parameters:
groupName- name of group that contains configured editor
-
setMultilingual
public void setMultilingual(boolean multilingual)
Configures editor so that it allows to input values different languages.- Parameters:
multilingual-trueif editor should allow providing values for different languages- See Also:
setSingleValued()
-
setMultilingual
public void setMultilingual(boolean multilingual, java.lang.Object item)Configures editor so that it allows to input values different languages.- Parameters:
multilingual-trueif editor should allow providing values for different languagesitem- an item which values will be provided/displayed by editor- See Also:
PermissionFacade.getReadableLocalesForInstance(Object),PermissionFacade.getWritableLocalesForInstance(Object)
-
setMultilingual
public void setMultilingual(boolean multilingual, java.util.Set<java.util.Locale> locales)Configures editor so that it allows to input values different languages.- Parameters:
multilingual-trueif editor should allow providing values for different languageslocales- collection of locales for which value may be provided
-
useDefaultEditor
public void useDefaultEditor()
Resets editor, so that is uses the default one for previously configured data type- See Also:
Editor.setType(String)
-
enableValidation
@Deprecated(since="20.05") public void enableValidation(java.lang.String modelKey, java.lang.String qualifier, ValidatableContainer container)Deprecated.useenableValidation(ValidatableContainer)insteadConfigures validation for editor.- Parameters:
modelKey- name of widget model value under which an item may be found, which attribute will be changed by editorqualifier- qualifier of attribute which values will be changed by editorcontainer- validatable container
-
enableValidation
public void enableValidation(ValidatableContainer container)
Configures validation for editor.- Parameters:
container- validatable container
-
-