Package com.hybris.cockpitng.components
Class Editor
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zul.Div
-
- com.hybris.cockpitng.components.AbstractCockpitComponent
-
- com.hybris.cockpitng.components.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 theEditorRegistryto look up the editor for the specified type. If thepropertyattribute 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classEditor.CockpitEditorRendererFactory
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringCOCKPIT_EDITOR_CLASS_INSTANCE_PARAMprotected static java.lang.StringCURRENT_OBJECTstatic java.lang.StringDATA_TYPEstatic java.lang.StringDEFAULT_FOCUS_COMPONENT_IDstatic java.lang.StringEDITOR_GROUPstatic java.lang.StringEDITOR_INSTANCE_REFERENCEstatic java.lang.StringEDITOR_PROPERTYstatic java.lang.StringMODEL_PREFIXstatic java.lang.StringON_EDITOR_EVENTstatic java.lang.StringON_VALUE_CHANGEDstatic java.lang.StringPARAM_ATTRIBUTE_VALUE_DETACHEDstatic java.lang.StringPARENT_OBJECTstatic java.lang.StringVALIDATION_RESULT_KEYstatic java.lang.StringVALUE_EDITORstatic java.lang.StringWIDGET_INSTANCE_MANAGERprotected static java.lang.StringYW_LOCEDITOR_CAPTION_SPACER-
Fields inherited from class com.hybris.cockpitng.components.AbstractCockpitComponent
COCKPIT_COMPONENTS_ATTIBUTE, initialized, modelObserver, widgetInstanceManager
-
-
Constructor Summary
Constructors Constructor Description Editor()Editor(EditorContext<?> editorContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddParameter(java.lang.String key, java.lang.Object val)voidaddParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)voidafterCompose()protected voidapplyCssStyleForEditor(org.zkoss.zk.ui.Component viewComponent)protected voidbuildEditor(CockpitEditorRenderer<java.lang.Object> editorRenderer, EditorDefinition editorDefinition, EditorContext<java.lang.Object> editorContext)voidclearInitialValue()Clears editor's initial value.protected booleancontainsLocalization(java.lang.String code)Deprecated, for removal: This API element is subject to removal in a future version.since 6.4protected EditorListener<java.lang.Object>createEditorListener(EditorContext<java.lang.Object> ctx)voiddestroy()voideditorValidationChanged()voidfocus()java.lang.StringgetComponentID()ComponentWidgetAdaptergetComponentWidgetAdapter()java.lang.StringgetDefaultEditor()org.zkoss.zk.ui.ComponentgetDefaultFocusComponent()protected EditorDefinitiongetEditorDefinition()java.lang.StringgetEditorLabel()protected EditorRegistrygetEditorRegistry()CockpitEditorRenderergetEditorRenderer()LabelServicegetLabelService()protected ModelObservergetModelObserver()protected NotificationServicegetNotificationService()java.util.Map<java.lang.String,java.lang.Object>getParameters()java.util.Map<java.lang.String,java.lang.Object>getParametersParsed()Safer version ofgetParameters().protected ValidationResultgetPersistedValidationResult()java.lang.StringgetProperty()Editors may be used to manipulate with values of particular attributes.java.util.Set<java.util.Locale>getReadableLocales()java.lang.StringgetRelatedProperty()Editors may be used to manipulate with values of particular attributes.java.lang.StringgetSelectionOf()java.lang.StringgetSuccessNotificationId()java.lang.StringgetType()java.lang.ObjectgetValue()java.util.List<ComponentWidgetAdapterAware>getWidgetAdaptersAwareIfPresent()WidgetInstanceManagergetWidgetInstanceManager()java.util.Set<java.util.Locale>getWritableLocales()protected booleanhandlesLocalization()voidinitialize()voidinitValidation(ValidatableContainer validatableContainer, ValidationHandler handler)booleanisAtomic()booleanisFallbackEditorRendered()booleanisLocalized()Deprecated, for removal: This API element is subject to removal in a future version.since 6.6booleanisNestedObjectCreationDisabled()booleanisOptional()This field can be provided via ZUL view.booleanisOrdered()booleanisPartOf()booleanisPrimitive()booleanisReadOnly()protected booleanisValueChanged(java.lang.Object currentValue, java.lang.Object changedValue)protected voidnotifyChange(java.lang.Object changedValue)protected CockpitEditorRendererprepareEditorRenderer(EditorDefinition definition, java.lang.String tag)voidreload()voidremoveParameter(java.lang.String key)protected voidrenderEditor(CockpitEditorRenderer<java.lang.Object> editorRenderer, EditorDefinition editorDefinition, EditorContext<java.lang.Object> editorContext)protected voidrenderFallbackEditor(EditorContext<java.lang.Object> editorContext)voidsetAtomic(boolean atomic)voidsetDefaultEditor(java.lang.String defaultEditor)voidsetEditorLabel(java.lang.String editorLabel)voidsetInitialValue(java.lang.Object value)Sets editor's initial value.voidsetLocalized(boolean localized)Deprecated, for removal: This API element is subject to removal in a future version.since 6.6voidsetNestedObjectCreationDisabled(boolean nestedObjectCreationDisabled)voidsetOptional(boolean optional)This field can be provided via ZUL view.voidsetOrdered(boolean ordered)voidsetParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)voidsetPartOf(boolean partOf)voidsetPrimitive(boolean primitive)voidsetProperty(java.lang.String property)voidsetReadableLocales(java.util.Set<java.util.Locale> readableLocales)voidsetReadOnly(boolean readOnly)voidsetRethrowAfterError(boolean fallbackEditorRendered)voidsetSelectionOf(java.lang.String selectionOf)voidsetSuccessNotificationId(java.lang.String successNotificationId)voidsetType(java.lang.String type)voidsetValidatableContainer(ValidatableContainer validatableContainer)voidsetValue(java.lang.Object value)voidsetWritableLocales(java.util.Set<java.util.Locale> writableLocales)protected booleanshouldReloadEditorOnCurrentObjectChange(java.lang.String property)protected voidverifyLocalizedEditor()-
Methods inherited from class com.hybris.cockpitng.components.AbstractCockpitComponent
getComponentDefinitionService, initializeComponentWidgetAdapter, isInitialized, setComponentDefinitionService, setWidgetInstanceManager, unregisterObserver, unregisterWidgetStubInstance
-
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
-
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
DATA_TYPE
public static final java.lang.String DATA_TYPE
- See Also:
- Constant Field Values
-
MODEL_PREFIX
public static final java.lang.String MODEL_PREFIX
- See Also:
- Constant Field Values
-
EDITOR_PROPERTY
public static final java.lang.String EDITOR_PROPERTY
- See Also:
- Constant Field Values
-
EDITOR_GROUP
public static final java.lang.String EDITOR_GROUP
- See Also:
- Constant Field Values
-
ON_VALUE_CHANGED
public static final java.lang.String ON_VALUE_CHANGED
- See Also:
- Constant Field Values
-
ON_EDITOR_EVENT
public static final java.lang.String ON_EDITOR_EVENT
- See Also:
- Constant Field Values
-
DEFAULT_FOCUS_COMPONENT_ID
public static final java.lang.String DEFAULT_FOCUS_COMPONENT_ID
- See Also:
- Constant Field Values
-
VALUE_EDITOR
public static final java.lang.String VALUE_EDITOR
- 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
-
PARENT_OBJECT
public static final java.lang.String PARENT_OBJECT
- 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
-
CURRENT_OBJECT
protected static final java.lang.String CURRENT_OBJECT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Editor
public Editor()
-
Editor
public Editor(EditorContext<?> editorContext)
-
-
Method Detail
-
reload
public void reload()
-
afterCompose
public void afterCompose()
- Specified by:
afterComposein interfaceorg.zkoss.zk.ui.ext.AfterCompose
-
initialize
public void initialize()
-
verifyLocalizedEditor
protected void verifyLocalizedEditor()
-
containsLocalization
@Deprecated(since="6.4", forRemoval=true) protected boolean containsLocalization(java.lang.String code)Deprecated, for removal: This API element is subject to removal in a future version.since 6.4
-
handlesLocalization
protected boolean handlesLocalization()
-
getEditorRenderer
public CockpitEditorRenderer getEditorRenderer()
-
prepareEditorRenderer
protected CockpitEditorRenderer prepareEditorRenderer(EditorDefinition definition, java.lang.String tag)
-
getEditorDefinition
protected EditorDefinition getEditorDefinition()
-
buildEditor
protected void buildEditor(CockpitEditorRenderer<java.lang.Object> editorRenderer, EditorDefinition editorDefinition, EditorContext<java.lang.Object> editorContext)
-
getModelObserver
protected ModelObserver getModelObserver()
-
shouldReloadEditorOnCurrentObjectChange
protected boolean shouldReloadEditorOnCurrentObjectChange(java.lang.String property)
-
renderEditor
protected void renderEditor(CockpitEditorRenderer<java.lang.Object> editorRenderer, EditorDefinition editorDefinition, EditorContext<java.lang.Object> editorContext)
-
renderFallbackEditor
protected void renderFallbackEditor(EditorContext<java.lang.Object> editorContext)
-
getNotificationService
protected NotificationService getNotificationService()
-
getWidgetInstanceManager
public WidgetInstanceManager getWidgetInstanceManager()
- Overrides:
getWidgetInstanceManagerin classAbstractCockpitComponent
-
applyCssStyleForEditor
protected void applyCssStyleForEditor(org.zkoss.zk.ui.Component viewComponent)
-
createEditorListener
protected EditorListener<java.lang.Object> createEditorListener(EditorContext<java.lang.Object> ctx)
-
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). ThengetProperty()would returnnull, butgetRelatedProperty()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
nullif 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). ThengetProperty()would returnnull, butgetRelatedProperty()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
nullif 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 fromsetValue(Object)is that if editor has property setgetProperty()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 setgetProperty()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:
focusin classorg.zkoss.zk.ui.HtmlBasedComponent
-
getDefaultFocusComponent
public org.zkoss.zk.ui.Component getDefaultFocusComponent()
-
getEditorRegistry
protected EditorRegistry getEditorRegistry()
-
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 ofgetParameters(). 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)
-
getComponentWidgetAdapter
public ComponentWidgetAdapter getComponentWidgetAdapter()
- Overrides:
getComponentWidgetAdapterin classAbstractCockpitComponent
-
getComponentID
public java.lang.String getComponentID()
- Specified by:
getComponentIDin classAbstractCockpitComponent
-
getWidgetAdaptersAwareIfPresent
public java.util.List<ComponentWidgetAdapterAware> getWidgetAdaptersAwareIfPresent()
- Specified by:
getWidgetAdaptersAwareIfPresentin classAbstractCockpitComponent
-
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()
-
initValidation
public void initValidation(ValidatableContainer validatableContainer, ValidationHandler handler)
-
editorValidationChanged
public void editorValidationChanged()
-
setValidatableContainer
public void setValidatableContainer(ValidatableContainer validatableContainer)
-
destroy
public void destroy()
- Overrides:
destroyin classAbstractCockpitComponent
-
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)
-
-