Class ConfigurableMultiReferenceEditor<V,D extends AbstractEditorData>
- java.lang.Object
-
- com.hybris.cockpitng.engine.impl.AbstractComponentWidgetAdapterAware
-
- de.hybris.platform.adaptivesearchbackoffice.editors.configurablemultireference.ConfigurableMultiReferenceEditor<V,D>
-
- All Implemented Interfaces:
com.hybris.cockpitng.editors.CockpitEditorRenderer<java.util.Collection<V>>,com.hybris.cockpitng.engine.ComponentWidgetAdapterAware,MultiReferenceEditorLogic<D,V>,EditorLogic<java.util.Collection<V>>
public class ConfigurableMultiReferenceEditor<V,D extends AbstractEditorData> extends com.hybris.cockpitng.engine.impl.AbstractComponentWidgetAdapterAware implements com.hybris.cockpitng.editors.CockpitEditorRenderer<java.util.Collection<V>>, MultiReferenceEditorLogic<D,V>
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringCONTEXT_PARAMprotected static java.lang.StringCREATE_BUTTON_LABELprotected static java.lang.StringCREATE_ICON_SCLASSprotected static java.lang.StringCREATE_SCLASSprotected static java.lang.StringDATA_HANDLER_PARAMprotected static java.lang.StringDATA_HANDLER_PARAMETERS_PARAMprotected static java.lang.StringDEFAULT_ITEM_DETAIL_RENDERERprotected static java.lang.StringDEFAULT_ITEM_MASTER_RENDERERprotected static java.lang.StringEDITABLE_COLUMNS_PARAMprotected static java.lang.StringEDITOR_DATA_KEYprotected static intEDITOR_MAX_SIZEprotected static java.lang.StringEDITOR_SCLASSprotected static java.lang.StringERROR_NOTIFICATION_IDprotected static java.lang.StringFILTER_SCLASSprotected static java.lang.StringIN_SEARCH_RESULT_SCLASSprotected static java.lang.StringITEM_ATTRIBUTEprotected static java.lang.StringITEM_DETAIL_INNER_SCLASSprotected static java.lang.StringITEM_DETAIL_RENDERER_PARAMprotected static java.lang.StringITEM_DETAIL_SCLASSprotected static java.lang.StringITEM_MASTER_INNER_SCLASSprotected static java.lang.StringITEM_MASTER_RENDERER_PARAMprotected static java.lang.StringITEM_MASTER_SCLASSprotected static java.lang.StringITEM_SCLASSprotected static intLISTBOX_PRELOAD_SIZE_FACTORprotected static java.lang.StringOPEN_ATTRIBUTEprotected static java.lang.StringSEARCH_RESULTprotected static java.lang.StringSOCKET_IN_CREATE_RESULTprotected static java.lang.StringSOCKET_IN_UPDATE_RESULTprotected static java.lang.StringSOCKET_OUT_CREATE_REQUESTprotected static java.lang.StringSOCKET_OUT_UPDATE_REQUESTprotected static java.lang.StringSORTABLE_PARAMprotected static java.util.regex.PatternSPEL_REGEXP
-
Constructor Summary
Constructors Constructor Description ConfigurableMultiReferenceEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringbuildItemStyleClass(AbstractEditorData editorData)protected booleancanCreate(java.lang.String typeCode)protected DataHandlercreateDataHandler()protected java.util.Map<java.lang.String,java.lang.Object>createDataHandlerParameters()protected java.util.Map<java.lang.String,java.lang.Object>createEvaluationContext()protected org.zkoss.zul.ListModel<D>createFilteredListModel(org.zkoss.zul.ListModel<D> originalListModel, java.lang.String filter)protected EditorRenderercreateItemDetailRenderer()protected EditorRenderercreateItemMasterRenderer()protected org.zkoss.zul.ListModel<D>createListModel()protected voidcreateReference(java.lang.Object data)protected java.lang.Objectevaluate(java.lang.String value)com.hybris.cockpitng.components.EditorfindEditor(org.zkoss.zk.ui.Component component)Finds the nearest editor component.org.zkoss.zk.ui.ComponentfindEditorItem(org.zkoss.zk.ui.Component component)Finds the nearest editor item component.java.util.Collection<java.lang.String>getColumns()Returns the columns.java.lang.StringgetContext()Returns the editor context.DataHandler<D,V>getDataHandler()Returns the data handler.java.util.Collection<java.lang.String>getEditableColumns()Returns the editable columns.com.hybris.cockpitng.editors.EditorContext<java.util.Collection<V>>getEditorContext()Returns the editor context.com.hybris.cockpitng.editors.EditorListener<java.util.Collection<V>>getEditorListener()Returns the editor listener.EditorRenderergetItemDetailRenderer()Returns the renderer for the item detail section.EditorRenderergetItemMasterRenderer()Returns the renderer for the item master section.org.zkoss.zul.ListModel<D>getListModel()Returns the list model.protected java.lang.ObjectgetParentObject()protected java.lang.StringgetParentTypeCode()com.hybris.cockpitng.engine.WidgetInstanceManagergetWidgetInstanceManager()Returns the widget instance manager.protected voidhandleDropEvent(org.zkoss.zk.ui.event.Event event)booleanisOpen(org.zkoss.zk.ui.Component component)Returns whether the given component is open.booleanisSortable()Returns whether the editor items can be sorted.voidrender(org.zkoss.zk.ui.Component parent, com.hybris.cockpitng.editors.EditorContext<java.util.Collection<V>> editorContext, com.hybris.cockpitng.editors.EditorListener<java.util.Collection<V>> editorListener)protected voidrenderItem(org.zkoss.zul.Listitem listitem, AbstractEditorData editorData)protected voidrenderItemDetail(org.zkoss.zk.ui.Component item, AbstractEditorData editorData)protected voidrenderItemDetailHelper(org.zkoss.zk.ui.Component parent, AbstractEditorData editorData, boolean open)protected voidrenderItemMaster(org.zkoss.zk.ui.Component item, AbstractEditorData editorData)protected voidrenderList(org.zkoss.zk.ui.Component parent)protected java.util.List<java.lang.String>resolveColumns()protected java.lang.StringresolveContext()protected java.util.Collection<java.lang.String>resolveEditableColumns()protected java.lang.ObjectresolveParentObject(org.zkoss.zk.ui.Component parent)protected SearchResultDataresolveSearchResult()protected booleanresolveSortable()protected java.lang.StringresolveTypeCode(java.lang.Object object)protected voidsetColumns(java.util.Collection<java.lang.String> columns)protected voidsetContext(java.lang.String context)protected voidsetDataHandler(DataHandler<D,V> dataHandler)protected voidsetEditableColumns(java.util.Collection<java.lang.String> editableColumns)protected voidsetEditorContext(com.hybris.cockpitng.editors.EditorContext<java.util.Collection<V>> editorContext)protected voidsetEditorListener(com.hybris.cockpitng.editors.EditorListener<java.util.Collection<V>> editorListener)protected voidsetItemDetailRenderer(EditorRenderer itemDetailRenderer)protected voidsetItemMasterRenderer(EditorRenderer itemMasterRenderer)protected voidsetListModel(org.zkoss.zul.ListModel<D> listModel)voidsetOpen(org.zkoss.zk.ui.Component component, boolean open)Changes the open status of a component.protected voidsetParentObject(java.lang.Object parentObject)protected voidsetParentTypeCode(java.lang.String parentTypeCode)protected voidsetSortable(boolean sortable)voidtriggerCreateReference()Triggers the creation of a new item.voidtriggerUpdateReference(AbstractEditorData editorData)Triggers the update of an existing item.voidupdateAttributeValue(D data, java.lang.String attributeName, java.lang.Object attributeValue)Updates the value of an item attribute.protected voidupdateReference(java.lang.Object data)voidupdateValue(java.util.Collection<V> value)Updates the value of the editor.
-
-
-
Field Detail
-
ERROR_NOTIFICATION_ID
protected static final java.lang.String ERROR_NOTIFICATION_ID
- See Also:
- Constant Field Values
-
CREATE_BUTTON_LABEL
protected static final java.lang.String CREATE_BUTTON_LABEL
- See Also:
- Constant Field Values
-
DATA_HANDLER_PARAM
protected static final java.lang.String DATA_HANDLER_PARAM
- See Also:
- Constant Field Values
-
DATA_HANDLER_PARAMETERS_PARAM
protected static final java.lang.String DATA_HANDLER_PARAMETERS_PARAM
- See Also:
- Constant Field Values
-
ITEM_MASTER_RENDERER_PARAM
protected static final java.lang.String ITEM_MASTER_RENDERER_PARAM
- See Also:
- Constant Field Values
-
ITEM_DETAIL_RENDERER_PARAM
protected static final java.lang.String ITEM_DETAIL_RENDERER_PARAM
- See Also:
- Constant Field Values
-
CONTEXT_PARAM
protected static final java.lang.String CONTEXT_PARAM
- See Also:
- Constant Field Values
-
SORTABLE_PARAM
protected static final java.lang.String SORTABLE_PARAM
- See Also:
- Constant Field Values
-
EDITABLE_COLUMNS_PARAM
protected static final java.lang.String EDITABLE_COLUMNS_PARAM
- See Also:
- Constant Field Values
-
DEFAULT_ITEM_MASTER_RENDERER
protected static final java.lang.String DEFAULT_ITEM_MASTER_RENDERER
- See Also:
- Constant Field Values
-
DEFAULT_ITEM_DETAIL_RENDERER
protected static final java.lang.String DEFAULT_ITEM_DETAIL_RENDERER
- See Also:
- Constant Field Values
-
SEARCH_RESULT
protected static final java.lang.String SEARCH_RESULT
- See Also:
- Constant Field Values
-
SPEL_REGEXP
protected static final java.util.regex.Pattern SPEL_REGEXP
-
EDITOR_SCLASS
protected static final java.lang.String EDITOR_SCLASS
- See Also:
- Constant Field Values
-
ITEM_SCLASS
protected static final java.lang.String ITEM_SCLASS
- See Also:
- Constant Field Values
-
ITEM_MASTER_SCLASS
protected static final java.lang.String ITEM_MASTER_SCLASS
- See Also:
- Constant Field Values
-
ITEM_MASTER_INNER_SCLASS
protected static final java.lang.String ITEM_MASTER_INNER_SCLASS
- See Also:
- Constant Field Values
-
ITEM_DETAIL_SCLASS
protected static final java.lang.String ITEM_DETAIL_SCLASS
- See Also:
- Constant Field Values
-
ITEM_DETAIL_INNER_SCLASS
protected static final java.lang.String ITEM_DETAIL_INNER_SCLASS
- See Also:
- Constant Field Values
-
IN_SEARCH_RESULT_SCLASS
protected static final java.lang.String IN_SEARCH_RESULT_SCLASS
- See Also:
- Constant Field Values
-
FILTER_SCLASS
protected static final java.lang.String FILTER_SCLASS
- See Also:
- Constant Field Values
-
CREATE_SCLASS
protected static final java.lang.String CREATE_SCLASS
- See Also:
- Constant Field Values
-
CREATE_ICON_SCLASS
protected static final java.lang.String CREATE_ICON_SCLASS
- See Also:
- Constant Field Values
-
SOCKET_OUT_CREATE_REQUEST
protected static final java.lang.String SOCKET_OUT_CREATE_REQUEST
- See Also:
- Constant Field Values
-
SOCKET_IN_CREATE_RESULT
protected static final java.lang.String SOCKET_IN_CREATE_RESULT
- See Also:
- Constant Field Values
-
SOCKET_OUT_UPDATE_REQUEST
protected static final java.lang.String SOCKET_OUT_UPDATE_REQUEST
- See Also:
- Constant Field Values
-
SOCKET_IN_UPDATE_RESULT
protected static final java.lang.String SOCKET_IN_UPDATE_RESULT
- See Also:
- Constant Field Values
-
ITEM_ATTRIBUTE
protected static final java.lang.String ITEM_ATTRIBUTE
- See Also:
- Constant Field Values
-
OPEN_ATTRIBUTE
protected static final java.lang.String OPEN_ATTRIBUTE
- See Also:
- Constant Field Values
-
EDITOR_DATA_KEY
protected static final java.lang.String EDITOR_DATA_KEY
- See Also:
- Constant Field Values
-
EDITOR_MAX_SIZE
protected static final int EDITOR_MAX_SIZE
- See Also:
- Constant Field Values
-
LISTBOX_PRELOAD_SIZE_FACTOR
protected static final int LISTBOX_PRELOAD_SIZE_FACTOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
render
public void render(org.zkoss.zk.ui.Component parent, com.hybris.cockpitng.editors.EditorContext<java.util.Collection<V>> editorContext, com.hybris.cockpitng.editors.EditorListener<java.util.Collection<V>> editorListener)- Specified by:
renderin interfacecom.hybris.cockpitng.editors.CockpitEditorRenderer<V>
-
resolveParentObject
protected java.lang.Object resolveParentObject(org.zkoss.zk.ui.Component parent)
-
resolveTypeCode
protected java.lang.String resolveTypeCode(java.lang.Object object)
-
resolveContext
protected java.lang.String resolveContext()
-
resolveSortable
protected boolean resolveSortable()
-
resolveColumns
protected java.util.List<java.lang.String> resolveColumns()
-
resolveEditableColumns
protected java.util.Collection<java.lang.String> resolveEditableColumns()
-
canCreate
protected boolean canCreate(java.lang.String typeCode)
-
resolveSearchResult
protected SearchResultData resolveSearchResult()
-
renderList
protected void renderList(org.zkoss.zk.ui.Component parent)
-
renderItem
protected void renderItem(org.zkoss.zul.Listitem listitem, AbstractEditorData editorData)
-
renderItemMaster
protected void renderItemMaster(org.zkoss.zk.ui.Component item, AbstractEditorData editorData)
-
renderItemDetail
protected void renderItemDetail(org.zkoss.zk.ui.Component item, AbstractEditorData editorData)
-
renderItemDetailHelper
protected void renderItemDetailHelper(org.zkoss.zk.ui.Component parent, AbstractEditorData editorData, boolean open)
-
buildItemStyleClass
protected java.lang.String buildItemStyleClass(AbstractEditorData editorData)
-
handleDropEvent
protected void handleDropEvent(org.zkoss.zk.ui.event.Event event)
-
createListModel
protected org.zkoss.zul.ListModel<D> createListModel()
-
createFilteredListModel
protected org.zkoss.zul.ListModel<D> createFilteredListModel(org.zkoss.zul.ListModel<D> originalListModel, java.lang.String filter)
-
createDataHandler
protected DataHandler createDataHandler()
-
createDataHandlerParameters
protected java.util.Map<java.lang.String,java.lang.Object> createDataHandlerParameters()
-
createItemMasterRenderer
protected EditorRenderer createItemMasterRenderer()
-
createItemDetailRenderer
protected EditorRenderer createItemDetailRenderer()
-
evaluate
protected java.lang.Object evaluate(java.lang.String value)
-
createEvaluationContext
protected java.util.Map<java.lang.String,java.lang.Object> createEvaluationContext()
-
triggerCreateReference
public void triggerCreateReference()
Description copied from interface:MultiReferenceEditorLogicTriggers the creation of a new item.- Specified by:
triggerCreateReferencein interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>
-
createReference
protected void createReference(java.lang.Object data)
-
triggerUpdateReference
public void triggerUpdateReference(AbstractEditorData editorData)
Description copied from interface:MultiReferenceEditorLogicTriggers the update of an existing item.- Specified by:
triggerUpdateReferencein interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Parameters:
editorData- - the item data
-
updateReference
protected void updateReference(java.lang.Object data)
-
getWidgetInstanceManager
public com.hybris.cockpitng.engine.WidgetInstanceManager getWidgetInstanceManager()
Description copied from interface:EditorLogicReturns the widget instance manager.- Specified by:
getWidgetInstanceManagerin interfaceEditorLogic<V>- Returns:
- the widget instance manager
-
isOpen
public boolean isOpen(org.zkoss.zk.ui.Component component)
Description copied from interface:MultiReferenceEditorLogicReturns whether the given component is open. This can be used, for example, to check if an editor item is open.- Specified by:
isOpenin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Parameters:
component- - the component- Returns:
trueif the component is open,falseotherwise
-
setOpen
public void setOpen(org.zkoss.zk.ui.Component component, boolean open)Description copied from interface:MultiReferenceEditorLogicChanges the open status of a component.- Specified by:
setOpenin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Parameters:
component- - the componentopen- - the new open status
-
findEditor
public com.hybris.cockpitng.components.Editor findEditor(org.zkoss.zk.ui.Component component)
Description copied from interface:MultiReferenceEditorLogicFinds the nearest editor component.- Specified by:
findEditorin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the nearest editor component or
nullif it could not be found
-
findEditorItem
public org.zkoss.zk.ui.Component findEditorItem(org.zkoss.zk.ui.Component component)
Description copied from interface:MultiReferenceEditorLogicFinds the nearest editor item component.- Specified by:
findEditorItemin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the nearest editor item component or
nullif it could not be found
-
updateValue
public void updateValue(java.util.Collection<V> value)
Description copied from interface:MultiReferenceEditorLogicUpdates the value of the editor.- Specified by:
updateValuein interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Parameters:
value- - the value
-
updateAttributeValue
public void updateAttributeValue(D data, java.lang.String attributeName, java.lang.Object attributeValue)
Description copied from interface:MultiReferenceEditorLogicUpdates the value of an item attribute.- Specified by:
updateAttributeValuein interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Parameters:
data- - the item dataattributeName- - the attribute nameattributeValue- - the attribute value
-
getEditorContext
public com.hybris.cockpitng.editors.EditorContext<java.util.Collection<V>> getEditorContext()
Description copied from interface:EditorLogicReturns the editor context.- Specified by:
getEditorContextin interfaceEditorLogic<V>- Returns:
- the editor context
-
setEditorContext
protected void setEditorContext(com.hybris.cockpitng.editors.EditorContext<java.util.Collection<V>> editorContext)
-
getEditorListener
public com.hybris.cockpitng.editors.EditorListener<java.util.Collection<V>> getEditorListener()
Description copied from interface:EditorLogicReturns the editor listener.- Specified by:
getEditorListenerin interfaceEditorLogic<V>- Returns:
- the editor listener
-
setEditorListener
protected void setEditorListener(com.hybris.cockpitng.editors.EditorListener<java.util.Collection<V>> editorListener)
-
getParentObject
protected java.lang.Object getParentObject()
-
setParentObject
protected void setParentObject(java.lang.Object parentObject)
-
getParentTypeCode
protected java.lang.String getParentTypeCode()
-
setParentTypeCode
protected void setParentTypeCode(java.lang.String parentTypeCode)
-
getContext
public java.lang.String getContext()
Description copied from interface:MultiReferenceEditorLogicReturns the editor context.- Specified by:
getContextin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the editor context
-
setContext
protected void setContext(java.lang.String context)
-
isSortable
public boolean isSortable()
Description copied from interface:MultiReferenceEditorLogicReturns whether the editor items can be sorted.- Specified by:
isSortablein interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
trueif the editor items can be sorted,falseotherwise
-
setSortable
protected void setSortable(boolean sortable)
-
getColumns
public java.util.Collection<java.lang.String> getColumns()
Description copied from interface:MultiReferenceEditorLogicReturns the columns.- Specified by:
getColumnsin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the columns
-
setColumns
protected void setColumns(java.util.Collection<java.lang.String> columns)
-
getEditableColumns
public java.util.Collection<java.lang.String> getEditableColumns()
Description copied from interface:MultiReferenceEditorLogicReturns the editable columns.- Specified by:
getEditableColumnsin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the editable columns
-
setEditableColumns
protected void setEditableColumns(java.util.Collection<java.lang.String> editableColumns)
-
getDataHandler
public DataHandler<D,V> getDataHandler()
Description copied from interface:MultiReferenceEditorLogicReturns the data handler.- Specified by:
getDataHandlerin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the data handler
-
setDataHandler
protected void setDataHandler(DataHandler<D,V> dataHandler)
-
getListModel
public org.zkoss.zul.ListModel<D> getListModel()
Description copied from interface:MultiReferenceEditorLogicReturns the list model.- Specified by:
getListModelin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the list model
-
setListModel
protected void setListModel(org.zkoss.zul.ListModel<D> listModel)
-
getItemMasterRenderer
public EditorRenderer getItemMasterRenderer()
Description copied from interface:MultiReferenceEditorLogicReturns the renderer for the item master section.- Specified by:
getItemMasterRendererin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the renderer for the item master section
-
setItemMasterRenderer
protected void setItemMasterRenderer(EditorRenderer itemMasterRenderer)
-
getItemDetailRenderer
public EditorRenderer getItemDetailRenderer()
Description copied from interface:MultiReferenceEditorLogicReturns the renderer for the item detail section.- Specified by:
getItemDetailRendererin interfaceMultiReferenceEditorLogic<V,D extends AbstractEditorData>- Returns:
- the renderer for the item detail section
-
setItemDetailRenderer
protected void setItemDetailRenderer(EditorRenderer itemDetailRenderer)
-
-