Class AbstractReferenceEditor<T,K>
- java.lang.Object
-
- com.hybris.cockpitng.engine.impl.AbstractComponentWidgetAdapterAware
-
- com.hybris.cockpitng.editor.commonreferenceeditor.AbstractReferenceEditor<T,K>
-
- All Implemented Interfaces:
ReferenceEditorLogic<T>,ComponentWidgetAdapterAware
- Direct Known Subclasses:
DefaultMultiReferenceEditor,DefaultReferenceEditor
public abstract class AbstractReferenceEditor<T,K> extends AbstractComponentWidgetAdapterAware implements ReferenceEditorLogic<T>
Base class forDefaultReferenceEditorandDefaultMultiReferenceEditor
-
-
Field Summary
Fields Modifier and Type Field Description protected ReferenceEditorLayout<T>editorLayoutprotected Pageable<T>pageableprotected intpageSizestatic java.lang.StringPARAM_AVAILABLE_VALUES_PROVIDERstatic java.lang.StringPARAM_CREATE_ONLYstatic java.lang.StringPARAM_DISABLE_DISPLAYING_DETAILSstatic java.lang.StringPARAM_DISABLE_REMOVE_REFERENCEstatic java.lang.StringPARAM_LABEL_PROVIDER_BEANstatic java.lang.StringPARAM_NESTED_CREATION_DISABLEDstatic java.lang.StringPARAM_PAGE_SIZEstatic java.lang.StringPARAM_PLACEHOLDER_KEYstatic java.lang.StringPARAM_REDIRECT_REFERENCE_SELECTED_SOCKET_IDstatic java.lang.StringPARAM_REFERENCE_ADVANCED_SEARCH_ENABLEDstatic java.lang.StringPARAM_RESTRICT_TO_TYPEstatic java.lang.StringPARAM_WHITELISTED_TYPESstatic java.lang.StringPARENT_OBJECTprotected intrenderOnDemandSizeprotected intselectedItemsMaxSizeprotected static java.lang.StringSOCKET_IN_REFERENCE_EDITORprotected static java.lang.StringSOCKET_OUT_REFERENCE_EDITORprotected static java.lang.StringSOCKET_OUT_REFERENCE_SEARCH_CTXprotected static java.lang.StringSOCKET_OUT_REFRENCE_SELECTEDstatic java.lang.StringTYPE_CODE
-
Constructor Summary
Constructors Constructor Description AbstractReferenceEditor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanallowNestedObjectCreation()Determines if nested object creation controlls should be rendered.protected org.zkoss.zk.ui.event.EventListenercreateInputSocketEventListener()voidcreateNewReference()Creates new object within the context.voidcreateNewReference(java.lang.String type)Creates new object within the context.ReferenceEditorLayout<T>createReferenceLayout(EditorContext context)protected intextractPageSize(java.lang.Object parameterPageSize)Tries to extract page size from the object passed.protected EditorfindAncestorEditor(org.zkoss.zk.ui.Component component)find first component in hierarchy which is an EditorCockpitConfigurationServicegetCockpitConfigurationService()CockpitUserServicegetCockpitUserService()protected java.lang.StringgetCustomValuesProviderBeanId()Extracts from editor parameters bean id of available values providerPARAM_AVAILABLE_VALUES_PROVIDER.EditorContext<K>getEditorContext()ReferenceEditorLayout<T>getEditorLayout()EditorListener<K>getEditorListener()java.util.Optional<LabelProvider<T>>getLabelProvider()protected java.util.Optional<java.lang.String>getLabelProviderBeanName()LabelServicegetLabelService()ObjectFacadegetObjectFacade()Pageable<T>getPageable()protected EditorgetParentEditor()java.lang.ObjectgetParentObject()PermissionFacadegetPermissionFacade()java.lang.StringgetPlaceholderKey()PropertyValueServicegetPropertyValueService()protected java.lang.StringgetRedirectReferenceSelectedToParentWidget()ReferenceEditorSearchConditionHandlergetReferenceEditorSearchConditionHandler()ReferenceEditorSearchFacade<T>getReferenceEditorSearchFacade()java.util.Map<java.lang.String,java.lang.Object>getReferenceSearchConditions()java.util.Map<java.lang.String,java.lang.Object>getReferenceSearchContextMap()protected abstract java.util.regex.PatterngetRegexEditorPattern()The pattern should match when the editor may be applied.java.lang.StringgetStringRepresentationOfObject(T obj)java.lang.StringgetSuccessNotificationId()java.lang.StringgetTypeCode()TypeFacadegetTypeFacade()booleanisDisableDisplayingDetails()booleanisDisableRemoveReference()booleanisOnlyCreateMode()Determines if choosing existing item is possible.booleanisReferenceAdvancedSearchEnabled()Tells if search button should open advanced reference search in a popup.protected BaseloadBaseConfiguration(java.lang.String typeCode, EditorContext<T> context)protected BaseloadBaseConfiguration(java.lang.String typeCode, WidgetInstanceManager wim)protected SimpleSearchloadSimpleSearchConfiguration()Loads cockpit configuration for simple-search for the given typeCodevoidopenReferenceAdvancedSearch(java.util.Collection<T> currentlySelected)Sends a socked event onSOCKET_OUT_REFERENCE_SEARCH_CTXvoidpreserveFocus()Sets focus on parent editorabstract java.lang.StringreadTypeCode(java.lang.String valueType)protected java.lang.StringresolveTypeToCreate(java.lang.String type)protected voidrestrictTypeCode(java.lang.Object restrictToTypeValue)protected voidsetCommonEditorParameters(java.util.Map<java.lang.String,java.lang.Object> parametersFromConfig)voidsetCreateOnly(boolean createOnly)voidsetEditorContext(EditorContext<K> editorContext)protected voidsetEditorLayout(ReferenceEditorLayout<T> editorLayout)voidsetEditorListener(EditorListener<K> editorListener)voidsetLabelProviderBeanName(java.lang.Object labelProviderBeanName)voidsetNestedObjectCreationDisabled(boolean nestedCreationDisabled)protected voidsetPageSize(int pageSize)protected voidsetParentEditor(Editor parentEditor)voidsetParentObject(java.lang.Object parentObject)voidsetReferenceSearchConditions(java.util.Map<java.lang.String,java.lang.Object> referenceSearchConditions)protected voidsetRenderOnDemandSize(int renderOnDemandSize)protected voidsetSelectedItemsMaxSize(int size)voidsetSuccessNotificationId(java.lang.String successNotificationId)protected voidsetTypeCode(java.lang.String typeCode)voidtriggerReferenceSelected(java.lang.Object selected)Triggers selected reference socktet output to outside widgetsvoidupdateReferencesListBoxModel()Perform search for all elements and refresh paging componentvoidupdateReferencesListBoxModel(java.lang.String textQuery)Updates search state based on the given text query.-
Methods inherited from class com.hybris.cockpitng.engine.impl.AbstractComponentWidgetAdapterAware
addSocketInputEventListener, getComponentID, handleSocketInputEvent, initialize, initializeDefaultEventListeners, registerStubInstance, sendOutput, setComponentID, unregisterStubInstance
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.hybris.cockpitng.editor.commonreferenceeditor.ReferenceEditorLogic
addSelectedObject, forwardEditorEvent, isEditable, refreshObjects, removeSelectedObject
-
-
-
-
Field Detail
-
TYPE_CODE
public static final java.lang.String TYPE_CODE
- See Also:
- Constant Field Values
-
PARENT_OBJECT
public static final java.lang.String PARENT_OBJECT
- See Also:
- Constant Field Values
-
PARAM_PAGE_SIZE
public static final java.lang.String PARAM_PAGE_SIZE
- See Also:
- Constant Field Values
-
PARAM_AVAILABLE_VALUES_PROVIDER
public static final java.lang.String PARAM_AVAILABLE_VALUES_PROVIDER
- See Also:
- Constant Field Values
-
PARAM_RESTRICT_TO_TYPE
public static final java.lang.String PARAM_RESTRICT_TO_TYPE
- See Also:
- Constant Field Values
-
PARAM_DISABLE_DISPLAYING_DETAILS
public static final java.lang.String PARAM_DISABLE_DISPLAYING_DETAILS
- See Also:
- Constant Field Values
-
PARAM_PLACEHOLDER_KEY
public static final java.lang.String PARAM_PLACEHOLDER_KEY
- See Also:
- Constant Field Values
-
PARAM_DISABLE_REMOVE_REFERENCE
public static final java.lang.String PARAM_DISABLE_REMOVE_REFERENCE
- See Also:
- Constant Field Values
-
PARAM_NESTED_CREATION_DISABLED
public static final java.lang.String PARAM_NESTED_CREATION_DISABLED
- See Also:
- Constant Field Values
-
PARAM_CREATE_ONLY
public static final java.lang.String PARAM_CREATE_ONLY
- See Also:
- Constant Field Values
-
PARAM_REFERENCE_ADVANCED_SEARCH_ENABLED
public static final java.lang.String PARAM_REFERENCE_ADVANCED_SEARCH_ENABLED
- See Also:
- Constant Field Values
-
PARAM_REDIRECT_REFERENCE_SELECTED_SOCKET_ID
public static final java.lang.String PARAM_REDIRECT_REFERENCE_SELECTED_SOCKET_ID
- See Also:
- Constant Field Values
-
PARAM_WHITELISTED_TYPES
public static final java.lang.String PARAM_WHITELISTED_TYPES
- See Also:
- Constant Field Values
-
PARAM_LABEL_PROVIDER_BEAN
public static final java.lang.String PARAM_LABEL_PROVIDER_BEAN
- See Also:
- Constant Field Values
-
SOCKET_IN_REFERENCE_EDITOR
protected static final java.lang.String SOCKET_IN_REFERENCE_EDITOR
- See Also:
- Constant Field Values
-
SOCKET_OUT_REFERENCE_EDITOR
protected static final java.lang.String SOCKET_OUT_REFERENCE_EDITOR
- See Also:
- Constant Field Values
-
SOCKET_OUT_REFRENCE_SELECTED
protected static final java.lang.String SOCKET_OUT_REFRENCE_SELECTED
- See Also:
- Constant Field Values
-
SOCKET_OUT_REFERENCE_SEARCH_CTX
protected static final java.lang.String SOCKET_OUT_REFERENCE_SEARCH_CTX
- See Also:
- Constant Field Values
-
editorLayout
protected ReferenceEditorLayout<T> editorLayout
-
pageSize
protected int pageSize
-
selectedItemsMaxSize
protected int selectedItemsMaxSize
-
renderOnDemandSize
protected int renderOnDemandSize
-
-
Method Detail
-
getPageable
public Pageable<T> getPageable()
- Specified by:
getPageablein interfaceReferenceEditorLogic<T>- Returns:
- the pageable
-
updateReferencesListBoxModel
public void updateReferencesListBoxModel()
Description copied from interface:ReferenceEditorLogicPerform search for all elements and refresh paging component- Specified by:
updateReferencesListBoxModelin interfaceReferenceEditorLogic<T>
-
createReferenceLayout
public ReferenceEditorLayout<T> createReferenceLayout(EditorContext context)
-
loadBaseConfiguration
protected Base loadBaseConfiguration(java.lang.String typeCode, EditorContext<T> context)
-
loadBaseConfiguration
protected Base loadBaseConfiguration(java.lang.String typeCode, WidgetInstanceManager wim)
-
updateReferencesListBoxModel
public void updateReferencesListBoxModel(java.lang.String textQuery)
Updates search state based on the given text query.- Specified by:
updateReferencesListBoxModelin interfaceReferenceEditorLogic<T>- Parameters:
textQuery-
-
getReferenceSearchContextMap
public java.util.Map<java.lang.String,java.lang.Object> getReferenceSearchContextMap()
-
getStringRepresentationOfObject
public java.lang.String getStringRepresentationOfObject(T obj)
- Specified by:
getStringRepresentationOfObjectin interfaceReferenceEditorLogic<T>- Returns:
- Label for given object
-
loadSimpleSearchConfiguration
protected SimpleSearch loadSimpleSearchConfiguration()
Loads cockpit configuration for simple-search for the given typeCode- Returns:
SimpleSearch
-
setPageSize
protected void setPageSize(int pageSize)
- Parameters:
pageSize- size of the page
-
setSelectedItemsMaxSize
protected void setSelectedItemsMaxSize(int size)
-
setRenderOnDemandSize
protected void setRenderOnDemandSize(int renderOnDemandSize)
-
restrictTypeCode
protected void restrictTypeCode(java.lang.Object restrictToTypeValue)
-
setCommonEditorParameters
protected void setCommonEditorParameters(java.util.Map<java.lang.String,java.lang.Object> parametersFromConfig)
-
getSuccessNotificationId
public java.lang.String getSuccessNotificationId()
-
setSuccessNotificationId
public void setSuccessNotificationId(java.lang.String successNotificationId)
-
extractPageSize
protected int extractPageSize(java.lang.Object parameterPageSize)
Tries to extract page size from the object passed. In case of failure returnsDEFAULT_PAGE_SIZE
-
readTypeCode
public abstract java.lang.String readTypeCode(java.lang.String valueType)
-
getRegexEditorPattern
protected abstract java.util.regex.Pattern getRegexEditorPattern()
The pattern should match when the editor may be applied. If the pattern's matcher matches it should guarantee that group(1) on it's matcher returns the type code.- Returns:
- Pattern that identifies the editor
- See Also:
Pattern,Matcher
-
getReferenceEditorSearchFacade
public ReferenceEditorSearchFacade<T> getReferenceEditorSearchFacade()
- Returns:
- the referenceEditorSearchFacade
-
getPermissionFacade
public PermissionFacade getPermissionFacade()
-
getTypeFacade
public TypeFacade getTypeFacade()
-
getPropertyValueService
public PropertyValueService getPropertyValueService()
-
getObjectFacade
public ObjectFacade getObjectFacade()
-
getCockpitConfigurationService
public CockpitConfigurationService getCockpitConfigurationService()
-
getLabelService
public LabelService getLabelService()
- Returns:
- the labelService
-
getLabelProvider
public java.util.Optional<LabelProvider<T>> getLabelProvider()
-
getEditorLayout
public ReferenceEditorLayout<T> getEditorLayout()
- Returns:
- the editorLayout
-
setEditorLayout
protected void setEditorLayout(ReferenceEditorLayout<T> editorLayout)
- Parameters:
editorLayout- the editorLayout to set
-
getTypeCode
public java.lang.String getTypeCode()
- Specified by:
getTypeCodein interfaceReferenceEditorLogic<T>- Returns:
- the typeCode
-
setTypeCode
protected void setTypeCode(java.lang.String typeCode)
- Parameters:
typeCode- the typeCode to set
-
isDisableDisplayingDetails
public boolean isDisableDisplayingDetails()
- Specified by:
isDisableDisplayingDetailsin interfaceReferenceEditorLogic<T>
-
isDisableRemoveReference
public boolean isDisableRemoveReference()
- Specified by:
isDisableRemoveReferencein interfaceReferenceEditorLogic<T>
-
getParentEditor
protected Editor getParentEditor()
- Returns:
- the parentEditor
-
setParentEditor
protected void setParentEditor(Editor parentEditor)
- Parameters:
parentEditor- the parentEditor to set
-
createInputSocketEventListener
protected org.zkoss.zk.ui.event.EventListener createInputSocketEventListener()
- Returns:
-
createNewReference
public void createNewReference()
Description copied from interface:ReferenceEditorLogicCreates new object within the context.- Specified by:
createNewReferencein interfaceReferenceEditorLogic<T>
-
createNewReference
public void createNewReference(java.lang.String type)
Description copied from interface:ReferenceEditorLogicCreates new object within the context.- Specified by:
createNewReferencein interfaceReferenceEditorLogic<T>
-
resolveTypeToCreate
protected java.lang.String resolveTypeToCreate(java.lang.String type)
-
setNestedObjectCreationDisabled
public void setNestedObjectCreationDisabled(boolean nestedCreationDisabled)
-
setCreateOnly
public void setCreateOnly(boolean createOnly)
-
isOnlyCreateMode
public boolean isOnlyCreateMode()
Description copied from interface:ReferenceEditorLogicDetermines if choosing existing item is possible.- Specified by:
isOnlyCreateModein interfaceReferenceEditorLogic<T>- Returns:
-
allowNestedObjectCreation
public boolean allowNestedObjectCreation()
Description copied from interface:ReferenceEditorLogicDetermines if nested object creation controlls should be rendered.- Specified by:
allowNestedObjectCreationin interfaceReferenceEditorLogic<T>- Returns:
-
triggerReferenceSelected
public void triggerReferenceSelected(java.lang.Object selected)
Description copied from interface:ReferenceEditorLogicTriggers selected reference socktet output to outside widgets- Specified by:
triggerReferenceSelectedin interfaceReferenceEditorLogic<T>- Parameters:
selected- reference currently selected
-
getRedirectReferenceSelectedToParentWidget
protected java.lang.String getRedirectReferenceSelectedToParentWidget()
-
openReferenceAdvancedSearch
public void openReferenceAdvancedSearch(java.util.Collection<T> currentlySelected)
Description copied from interface:ReferenceEditorLogicSends a socked event onSOCKET_OUT_REFERENCE_SEARCH_CTX- Specified by:
openReferenceAdvancedSearchin interfaceReferenceEditorLogic<T>
-
isReferenceAdvancedSearchEnabled
public boolean isReferenceAdvancedSearchEnabled()
Description copied from interface:ReferenceEditorLogicTells if search button should open advanced reference search in a popup.- Specified by:
isReferenceAdvancedSearchEnabledin interfaceReferenceEditorLogic<T>
-
getCustomValuesProviderBeanId
protected java.lang.String getCustomValuesProviderBeanId()
Extracts from editor parameters bean id of available values providerPARAM_AVAILABLE_VALUES_PROVIDER.- Returns:
- bean id if parameter value is not blank String or null.
-
getParentObject
public java.lang.Object getParentObject()
-
setParentObject
public void setParentObject(java.lang.Object parentObject)
-
findAncestorEditor
protected Editor findAncestorEditor(org.zkoss.zk.ui.Component component)
find first component in hierarchy which is an Editor- Parameters:
component-- Returns:
-
getPlaceholderKey
public java.lang.String getPlaceholderKey()
-
getEditorContext
public EditorContext<K> getEditorContext()
-
setEditorContext
public void setEditorContext(EditorContext<K> editorContext)
-
getEditorListener
public EditorListener<K> getEditorListener()
-
setEditorListener
public void setEditorListener(EditorListener<K> editorListener)
-
getReferenceSearchConditions
public java.util.Map<java.lang.String,java.lang.Object> getReferenceSearchConditions()
-
setReferenceSearchConditions
public void setReferenceSearchConditions(java.util.Map<java.lang.String,java.lang.Object> referenceSearchConditions)
-
getLabelProviderBeanName
protected java.util.Optional<java.lang.String> getLabelProviderBeanName()
-
setLabelProviderBeanName
public void setLabelProviderBeanName(java.lang.Object labelProviderBeanName)
-
getReferenceEditorSearchConditionHandler
public ReferenceEditorSearchConditionHandler getReferenceEditorSearchConditionHandler()
-
getCockpitUserService
public CockpitUserService getCockpitUserService()
-
preserveFocus
public void preserveFocus()
Description copied from interface:ReferenceEditorLogicSets focus on parent editor- Specified by:
preserveFocusin interfaceReferenceEditorLogic<T>
-
-