Class EditorConfigurator


  • public class EditorConfigurator
    extends java.lang.Object
    • Constructor Detail

      • EditorConfigurator

        public EditorConfigurator​(Editor editor)
        Creates a configurator - object that helps configuring existing Editor components.

        All needed facades will be taken from spring bean context as default.

        Parameters:
        editor - component to be configured
    • Method Detail

      • setPermissionFacade

        public void setPermissionFacade​(PermissionFacade permissionFacade)
      • 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)
      • 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 name
        value - 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)
      • 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 editor
        attribute - 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 editor
        qualifier - 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 editor
        qualifier - 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 editor
        attribute - 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 editor
        attribute - 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 - true if editor should allow providing values for different languages
        See Also:
        setSingleValued()
      • 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 - true if editor should allow providing values for different languages
        locales - 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)
        Configures validation for editor.
        Parameters:
        modelKey - name of widget model value under which an item may be found, which attribute will be changed by editor
        qualifier - qualifier of attribute which values will be changed by editor
        container - validatable container
      • enableValidation

        public void enableValidation​(ValidatableContainer container)
        Configures validation for editor.
        Parameters:
        container - validatable container