Class Editor

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.AfterCompose, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.IdSpace, org.zkoss.zk.ui.sys.ComponentCtrl

    public class Editor
    extends AbstractCockpitComponent
    implements org.zkoss.zk.ui.ext.AfterCompose, org.zkoss.zk.ui.IdSpace
    Cockpit NG editor component. Holds an instance of a cockpit NG editor. It uses the EditorRegistry to look up the editor for the specified type. If the property attribute is specified it connects the editor with the widget model's property of that name and loads an stores the value automatically.
    See Also:
    EditorRegistry, Serialized Form
    • Field Detail

      • ON_VALUE_CHANGED

        public static final java.lang.String ON_VALUE_CHANGED
        See Also:
        Constant Field Values
      • DEFAULT_FOCUS_COMPONENT_ID

        public static final java.lang.String DEFAULT_FOCUS_COMPONENT_ID
        See Also:
        Constant Field Values
      • WIDGET_INSTANCE_MANAGER

        public static final java.lang.String WIDGET_INSTANCE_MANAGER
        See Also:
        Constant Field Values
      • EDITOR_INSTANCE_REFERENCE

        public static final java.lang.String EDITOR_INSTANCE_REFERENCE
        See Also:
        Constant Field Values
      • VALIDATION_RESULT_KEY

        public static final java.lang.String VALIDATION_RESULT_KEY
        See Also:
        Constant Field Values
      • PARAM_ATTRIBUTE_VALUE_DETACHED

        public static final java.lang.String PARAM_ATTRIBUTE_VALUE_DETACHED
        See Also:
        Constant Field Values
      • YW_LOCEDITOR_CAPTION_SPACER

        protected static final java.lang.String YW_LOCEDITOR_CAPTION_SPACER
        See Also:
        Constant Field Values
      • COCKPIT_EDITOR_CLASS_INSTANCE_PARAM

        protected static final java.lang.String COCKPIT_EDITOR_CLASS_INSTANCE_PARAM
        See Also:
        Constant Field Values
    • Constructor Detail

      • Editor

        public Editor()
    • Method Detail

      • reload

        public void reload()
      • afterCompose

        public void afterCompose()
        Specified by:
        afterCompose in interface org.zkoss.zk.ui.ext.AfterCompose
      • initialize

        public void initialize()
      • verifyLocalizedEditor

        protected void verifyLocalizedEditor()
      • handlesLocalization

        protected boolean handlesLocalization()
      • shouldReloadEditorOnCurrentObjectChange

        protected boolean shouldReloadEditorOnCurrentObjectChange​(java.lang.String property)
      • renderFallbackEditor

        protected void renderFallbackEditor​(EditorContext<java.lang.Object> editorContext)
      • applyCssStyleForEditor

        protected void applyCssStyleForEditor​(org.zkoss.zk.ui.Component viewComponent)
      • isValueChanged

        protected boolean isValueChanged​(java.lang.Object currentValue,
                                         java.lang.Object changedValue)
      • notifyChange

        protected void notifyChange​(java.lang.Object changedValue)
      • getProperty

        public java.lang.String getProperty()
        Editors may be used to manipulate with values of particular attributes. Then they are able to provide information about, what exact attribute is being manipulated by them. In some cases editors are used to manipulate some subvalue of an attribute (i.e. an editor of a value for a specified localization in localized attribute). Then getProperty() would return null, but getRelatedProperty() would still return name of a property which subvalue is being manipulated by this editor.
        Returns:
        exact name of a property related to current editor or null if editor is not bound to any property or manipulates a subvalue of property
        See Also:
        getRelatedProperty()
      • setProperty

        public void setProperty​(java.lang.String property)
      • getRelatedProperty

        public java.lang.String getRelatedProperty()
        Editors may be used to manipulate with values of particular attributes. Then they are able to provide information about, what exact attribute is being manipulated by them. In some cases editors are used to manipulate some subvalue of an attribute (i.e. an editor of a value for a specified localization in localized attribute). Then getProperty() would return null, but getRelatedProperty() would still return name of a property which subvalue is being manipulated by this editor.
        Returns:
        name of a property related to current editor (even if editor manipulates it's subvalue) or null if editor is not bound to any property
        See Also:
        getProperty()
      • getDefaultEditor

        public java.lang.String getDefaultEditor()
      • setDefaultEditor

        public void setDefaultEditor​(java.lang.String defaultEditor)
      • isReadOnly

        public boolean isReadOnly()
      • setReadOnly

        public void setReadOnly​(boolean readOnly)
      • isNestedObjectCreationDisabled

        public boolean isNestedObjectCreationDisabled()
      • setNestedObjectCreationDisabled

        public void setNestedObjectCreationDisabled​(boolean nestedObjectCreationDisabled)
      • getSuccessNotificationId

        public java.lang.String getSuccessNotificationId()
      • setSuccessNotificationId

        public void setSuccessNotificationId​(java.lang.String successNotificationId)
      • isOptional

        public boolean isOptional()
        This field can be provided via ZUL view.
        Returns:
        value of editor's corresponding attribute provided in the ZUL view.
      • setOptional

        public void setOptional​(boolean optional)
        This field can be provided via ZUL view.
        Parameters:
        optional - value of editor's corresponding attribute
      • getType

        public java.lang.String getType()
      • setType

        public void setType​(java.lang.String type)
      • getValue

        public java.lang.Object getValue()
      • setValue

        public void setValue​(java.lang.Object value)
      • setInitialValue

        public void setInitialValue​(java.lang.Object value)
        Sets editor's initial value. The difference from setValue(Object) is that if editor has property set getProperty() the value will be used as initial value and property accessor won't be called to obtain it during initialization.
      • clearInitialValue

        public void clearInitialValue()
        Clears editor's initial value. If editor has property set getProperty() the initial value will be obtained using property accessor during initialization.
      • getEditorLabel

        public java.lang.String getEditorLabel()
      • setEditorLabel

        public void setEditorLabel​(java.lang.String editorLabel)
      • focus

        public void focus()
        Overrides:
        focus in class org.zkoss.zk.ui.HtmlBasedComponent
      • getDefaultFocusComponent

        public org.zkoss.zk.ui.Component getDefaultFocusComponent()
      • getLabelService

        public LabelService getLabelService()
        Returns:
        the labelService
      • getParameters

        public java.util.Map<java.lang.String,​java.lang.Object> getParameters()
      • setParameters

        public void setParameters​(java.util.Map<java.lang.String,​java.lang.Object> parameters)
      • getParametersParsed

        public java.util.Map<java.lang.String,​java.lang.Object> getParametersParsed()
        Safer version of getParameters(). If a parameter is an editor setting defined in definition.xml, then it tries to parse it into the appropriate setting type, if possible.
      • addParameter

        public void addParameter​(java.lang.String key,
                                 java.lang.Object val)
      • addParameters

        public void addParameters​(java.util.Map<java.lang.String,​java.lang.Object> parameters)
      • removeParameter

        public void removeParameter​(java.lang.String key)
      • getReadableLocales

        public java.util.Set<java.util.Locale> getReadableLocales()
      • setReadableLocales

        public void setReadableLocales​(java.util.Set<java.util.Locale> readableLocales)
      • getWritableLocales

        public java.util.Set<java.util.Locale> getWritableLocales()
      • setWritableLocales

        public void setWritableLocales​(java.util.Set<java.util.Locale> writableLocales)
      • isLocalized

        @Deprecated(since="6.6",
                    forRemoval=true)
        public boolean isLocalized()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 6.6
        Returns:
        the localized
      • setLocalized

        @Deprecated(since="6.6",
                    forRemoval=true)
        public void setLocalized​(boolean localized)
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 6.6
        Parameters:
        localized - the localized to set
      • isOrdered

        public boolean isOrdered()
      • setOrdered

        public void setOrdered​(boolean ordered)
      • isPartOf

        public boolean isPartOf()
      • setPartOf

        public void setPartOf​(boolean partOf)
      • isPrimitive

        public boolean isPrimitive()
      • setPrimitive

        public void setPrimitive​(boolean primitive)
      • getPersistedValidationResult

        protected ValidationResult getPersistedValidationResult()
      • editorValidationChanged

        public void editorValidationChanged()
      • setValidatableContainer

        public void setValidatableContainer​(ValidatableContainer validatableContainer)
      • isAtomic

        public boolean isAtomic()
      • setAtomic

        public void setAtomic​(boolean atomic)
      • isFallbackEditorRendered

        public boolean isFallbackEditorRendered()
      • setRethrowAfterError

        public void setRethrowAfterError​(boolean fallbackEditorRendered)
      • getSelectionOf

        public java.lang.String getSelectionOf()
        Returns:
        the selectionOf property
      • setSelectionOf

        public void setSelectionOf​(java.lang.String selectionOf)