Package com.hybris.cockpitng.engine.impl
Class DefaultCockpitWidgetEngine
- java.lang.Object
-
- com.hybris.cockpitng.engine.impl.DefaultCockpitWidgetEngine
-
- All Implemented Interfaces:
CockpitWidgetEngine
- Direct Known Subclasses:
AdminmodeWidgetEngine
public class DefaultCockpitWidgetEngine extends java.lang.Object implements CockpitWidgetEngine
Default widget engine. Used in "normal" (not admin) rendering mode. For internal use only.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCP_FWD_ELprotected org.zkoss.idom.DocumentdocumentNoViewprotected org.zkoss.idom.DocumentdocumentWithWidgetSlotstatic java.lang.StringFULL_WIDTHstatic java.lang.StringHEIGHTstatic java.lang.StringMONITOR_WIDGET_COUNTER_ATTRIBstatic java.lang.StringON_CP_FWD_ELstatic java.lang.StringSCLASS_WIDGET_BODYstatic java.lang.StringSETTING_WIDGET_MOLDstatic java.lang.StringSLOT_IDstatic org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>STOP_PROPAGATION_LISTENERstatic java.lang.StringVIEW_ZULDeprecated, for removal: This API element is subject to removal in a future version.since 1808, useDefaultCockpitComponentDefinitionService.DEFAULT_VIEW_ZULinsteadstatic java.lang.StringWIDGETstatic java.lang.StringWIDGETSLOTstatic java.lang.StringWIDTHstatic java.lang.StringY_TESTID_PATH-
Fields inherited from interface com.hybris.cockpitng.engine.CockpitWidgetEngine
COMPONENT_RESOURCE_PATH_PARAM, COMPONENT_ROOT_PARAM, LABELS_PARAM, WIDGET_RESOURCE_PATH_PARAM, WIDGET_ROOT_PARAM, WR_PARAM
-
-
Constructor Summary
Constructors Constructor Description DefaultCockpitWidgetEngine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadjustWidgetSclass(WidgetInstance widgetInstance, WidgetDefinition definition, org.zkoss.zk.ui.Component component)protected booleancheckVisibility(Widget widget)Decides if the given widget should be displayed or not.protected voidcreateComponents(Widgetslot widgetslot)java.util.Map<java.lang.String,java.lang.Object>createLabelMap(WidgetDefinition definition, Widget widget)protected DefaultWidgetInstanceManagercreateWidgetInstanceManager(Widgetslot widgetslot, java.util.Map<java.lang.String,java.lang.Object> labelMap)voidcreateWidgetView(Widgetchildren widgetChildrenComponent)Same asCockpitWidgetEngine.createWidgetView(Widgetchildren, Map)with empty map as second arg.voidcreateWidgetView(Widgetchildren widgetChildrenComponent, java.util.Map<java.lang.String,java.lang.Object> ctx)Creates the view components for the specified widgetchildren slot.voidcreateWidgetView(Widgetslot widgetslot)Creates the view components for the specified widgetslot.java.util.Map<java.lang.String,WidgetChildrenContainerRenderer>getChildrenContainerRenderer()CockpitConfigurationServicegetCockpitConfigurationService()protected CockpitPropertiesgetCockpitProperties()protected CockpitThreadContextCreatorgetCockpitThreadContextCreator()CockpitTypeUtilsgetCockpitTypeUtils()protected <T> TgetComponentDefinition(java.lang.String widgetId)protected org.zkoss.zk.ui.DesktopgetDesktop()protected org.zkoss.idom.DocumentgetDocumentNoViewWidget()protected org.zkoss.idom.DocumentgetDocumentWithWidgetSlot()static java.lang.StringgetLabel(java.lang.String key, java.util.Map<java.lang.String,java.lang.Object> labels)LabelServicegetLabelService()NotificationServicegetNotificationService()protected java.lang.StringgetOutputSocketTypeMessage(WidgetSocket outputWidgetSocket, java.lang.String outputSocketType)protected WidgetTemplateRulesEnginegetRulesEngine()protected WidgetInstancegetSessionWidgetInstance(java.lang.String slotId)SocketConnectionServicegetSocketConnectionService()protected WidgetAuthorizationServicegetWidgetAuthorizationService()protected java.lang.StringgetWidgetBodySclass(WidgetInstance widgetInstance)java.util.List<WidgetConfigurationContextDecorator>getWidgetConfigurationContextDecoratorList()protected WidgetDefinitiongetWidgetDefinition(Widget widget)protected CockpitComponentDefinitionServicegetWidgetDefinitionService()protected WidgetInstanceFacadegetWidgetInstanceFacade()protected WidgetLibUtilsgetWidgetLibUtils()protected java.lang.StringgetWidgetMoldSclass(WidgetInstance widgetInstance, WidgetDefinition definition)protected WidgetPersistenceServicegetWidgetPersistenceService()WidgetServicegetWidgetService()protected WidgetUtilsgetWidgetUtils()protected voidinjectWidgetVariables(java.lang.Object widgetController, WidgetInstanceManager widgetInstanceManager)booleanisIndependentView(WidgetDefinition widget, java.lang.String url)Checks whether provided URL points to widget's view, which is defined as not dependent from ZK framework (i.e.protected booleanisSocketDataTypeValid(java.lang.Object object, Widget currentWidget, WidgetSocket outputWidgetSocket)protected booleanisSocketTypeMatching(java.lang.String socketDataType, WidgetSocket.Multiplicity socketMultiplicity, java.lang.Object object)protected voidlogSocketEvent(Widgetslot widgetContainer, java.lang.String targetSocketId, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance sourceWidgetInstance)protected WidgetInstancelookupGroupTemplateInstance(Widget groupContainerWidget, WidgetInstance currentWidgetInstance)protected voidrenderUnattachedChildren(Widgetslot widgetslot, java.util.List<Widget> unattachedChildren)protected WidgetSocket.MultiplicityresolveObjectMultiplicity(java.lang.Object object)protected WidgetInstanceresolveSingleTargetInstance(WidgetInstance source, Widget target)Checks, if an event should be routed to one single instance of the target widget.protected voidsendEventToTargetWidget(java.lang.String eventName, Widget target, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance source)protected voidsendEventToTargetWidgetInternal(java.lang.String eventName, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance source, java.util.List<WidgetInstance> widgetInstances)voidsendOutput(Widgetslot widgetslot, java.lang.String outputID)Calls sendOutput(widgetslot, outputID, null)}.voidsendOutput(Widgetslot widgetslot, java.lang.String outputID, java.lang.Object data)Calls sendOutput(widgetslot, outputID, data, false)}.voidsendOutput(Widgetslot widgetslot, java.lang.String outputId, java.lang.Object data, boolean ignoreSockets)Sends an output event from the widget attached to the widgetslot parameter with the given outputID.protected voidsendSocketEvent(Widgetslot widgetContainer, java.lang.String eventName, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance sourceWidgetInstance)voidsetChildrenContainerRenderer(java.util.Map<java.lang.String,WidgetChildrenContainerRenderer> childrenContainerRenderer)voidsetCockpitConfigurationService(CockpitConfigurationService cockpitConfigurationService)voidsetCockpitProperties(CockpitProperties cockpitProperties)voidsetCockpitResourceLoader(CockpitResourceLoader cockpitResourceLoader)voidsetCockpitThreadContextCreator(CockpitThreadContextCreator cockpitThreadContextCreator)voidsetCockpitTypeUtils(CockpitTypeUtils cockpitTypeUtils)voidsetComponentDefinitionService(CockpitComponentDefinitionService componentDefinitionService)voidsetLabelService(LabelService labelService)voidsetModelValueHandlerFactory(ModelValueHandlerFactory modelValueHandlerFactory)voidsetNotificationService(NotificationService notificationService)voidsetNotificationStack(NotificationStack notificationStack)voidsetRulesEngine(WidgetTemplateRulesEngine rulesEngine)protected voidsetSessionWidgetInstance(WidgetInstance instance, java.lang.String slotId)voidsetSessionWidgetInstanceRegistry(SessionWidgetInstanceRegistry sessionWidgetInstanceRegistry)voidsetSocketConnectionService(SocketConnectionService socketConnectionService)voidsetWidgetAuthorizationService(WidgetAuthorizationService widgetAuthorizationService)voidsetWidgetConfigurationContextDecoratorList(java.util.List<WidgetConfigurationContextDecorator> contextDecoratorList)voidsetWidgetInstanceFacade(WidgetInstanceFacade widgetInstanceFacade)voidsetWidgetLibUtils(WidgetLibUtils widgetLibUtils)voidsetWidgetPersistenceService(WidgetPersistenceService widgetPersistenceService)voidsetWidgetService(WidgetService widgetService)voidsetWidgetUtils(WidgetUtils widgetUtils)
-
-
-
Field Detail
-
VIEW_ZUL
@Deprecated(since="1808", forRemoval=true) public static final java.lang.String VIEW_ZULDeprecated, for removal: This API element is subject to removal in a future version.since 1808, useDefaultCockpitComponentDefinitionService.DEFAULT_VIEW_ZULinstead- See Also:
- Constant Field Values
-
MONITOR_WIDGET_COUNTER_ATTRIB
public static final java.lang.String MONITOR_WIDGET_COUNTER_ATTRIB
- See Also:
- Constant Field Values
-
ON_CP_FWD_EL
public static final java.lang.String ON_CP_FWD_EL
- See Also:
- Constant Field Values
-
STOP_PROPAGATION_LISTENER
public static final org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> STOP_PROPAGATION_LISTENER
-
WIDGET
public static final java.lang.String WIDGET
- See Also:
- Constant Field Values
-
WIDTH
public static final java.lang.String WIDTH
- See Also:
- Constant Field Values
-
HEIGHT
public static final java.lang.String HEIGHT
- See Also:
- Constant Field Values
-
SLOT_ID
public static final java.lang.String SLOT_ID
- See Also:
- Constant Field Values
-
WIDGETSLOT
public static final java.lang.String WIDGETSLOT
- See Also:
- Constant Field Values
-
FULL_WIDTH
public static final java.lang.String FULL_WIDTH
- See Also:
- Constant Field Values
-
SCLASS_WIDGET_BODY
public static final java.lang.String SCLASS_WIDGET_BODY
- See Also:
- Constant Field Values
-
CP_FWD_EL
public static final java.lang.String CP_FWD_EL
- See Also:
- Constant Field Values
-
SETTING_WIDGET_MOLD
public static final java.lang.String SETTING_WIDGET_MOLD
- See Also:
- Constant Field Values
-
Y_TESTID_PATH
public static final java.lang.String Y_TESTID_PATH
- See Also:
- Constant Field Values
-
documentWithWidgetSlot
protected org.zkoss.idom.Document documentWithWidgetSlot
-
documentNoView
protected org.zkoss.idom.Document documentNoView
-
-
Method Detail
-
getLabel
public static java.lang.String getLabel(java.lang.String key, java.util.Map<java.lang.String,java.lang.Object> labels)
-
setNotificationStack
public void setNotificationStack(NotificationStack notificationStack)
-
createWidgetView
public void createWidgetView(Widgetslot widgetslot)
Description copied from interface:CockpitWidgetEngineCreates the view components for the specified widgetslot. If no widget is attached to the slot, an error is displayed, otherwise the view representation of the attached widget is injected.- Specified by:
createWidgetViewin interfaceCockpitWidgetEngine
-
checkVisibility
protected boolean checkVisibility(Widget widget)
Decides if the given widget should be displayed or not.- Parameters:
widget- The widget to check, can be null.- Returns:
- true, if the widget should be displayed, false otherwise or if widget is null.
-
getWidgetBodySclass
protected java.lang.String getWidgetBodySclass(WidgetInstance widgetInstance)
-
getWidgetMoldSclass
protected java.lang.String getWidgetMoldSclass(WidgetInstance widgetInstance, WidgetDefinition definition)
-
injectWidgetVariables
protected void injectWidgetVariables(java.lang.Object widgetController, WidgetInstanceManager widgetInstanceManager)
-
createComponents
protected void createComponents(Widgetslot widgetslot)
-
createWidgetInstanceManager
protected DefaultWidgetInstanceManager createWidgetInstanceManager(Widgetslot widgetslot, java.util.Map<java.lang.String,java.lang.Object> labelMap)
-
adjustWidgetSclass
protected void adjustWidgetSclass(WidgetInstance widgetInstance, WidgetDefinition definition, org.zkoss.zk.ui.Component component)
-
getDocumentNoViewWidget
protected org.zkoss.idom.Document getDocumentNoViewWidget()
-
getDocumentWithWidgetSlot
protected org.zkoss.idom.Document getDocumentWithWidgetSlot()
-
createLabelMap
public java.util.Map<java.lang.String,java.lang.Object> createLabelMap(WidgetDefinition definition, Widget widget)
-
renderUnattachedChildren
protected void renderUnattachedChildren(Widgetslot widgetslot, java.util.List<Widget> unattachedChildren)
-
getWidgetDefinition
protected WidgetDefinition getWidgetDefinition(Widget widget)
-
getComponentDefinition
protected <T> T getComponentDefinition(java.lang.String widgetId)
-
getSessionWidgetInstance
protected WidgetInstance getSessionWidgetInstance(java.lang.String slotId)
-
setSessionWidgetInstance
protected void setSessionWidgetInstance(WidgetInstance instance, java.lang.String slotId)
-
sendOutput
public void sendOutput(Widgetslot widgetslot, java.lang.String outputID)
Description copied from interface:CockpitWidgetEngineCalls sendOutput(widgetslot, outputID, null)}.- Specified by:
sendOutputin interfaceCockpitWidgetEngine
-
sendOutput
public void sendOutput(Widgetslot widgetslot, java.lang.String outputID, java.lang.Object data)
Description copied from interface:CockpitWidgetEngineCalls sendOutput(widgetslot, outputID, data, false)}.- Specified by:
sendOutputin interfaceCockpitWidgetEngine
-
sendOutput
public void sendOutput(Widgetslot widgetslot, java.lang.String outputId, java.lang.Object data, boolean ignoreSockets)
Description copied from interface:CockpitWidgetEngineSends an output event from the widget attached to the widgetslot parameter with the given outputID. This method is finally called fromDefaultWidgetController.sendOutput(String, Object).- Specified by:
sendOutputin interfaceCockpitWidgetEngine- Parameters:
widgetslot- The source widget slotoutputId- The output socket iddata- The event dataignoreSockets- If false, the event is only sent if the output socket with outputID exists. Otherwise no check is done and the event is sent. This is only needed for internal use, especially for composed widget internal event handling.
-
isSocketDataTypeValid
protected boolean isSocketDataTypeValid(java.lang.Object object, Widget currentWidget, WidgetSocket outputWidgetSocket)
-
isSocketTypeMatching
protected boolean isSocketTypeMatching(java.lang.String socketDataType, WidgetSocket.Multiplicity socketMultiplicity, java.lang.Object object)
-
resolveObjectMultiplicity
protected WidgetSocket.Multiplicity resolveObjectMultiplicity(java.lang.Object object)
-
getOutputSocketTypeMessage
protected java.lang.String getOutputSocketTypeMessage(WidgetSocket outputWidgetSocket, java.lang.String outputSocketType)
-
lookupGroupTemplateInstance
protected WidgetInstance lookupGroupTemplateInstance(Widget groupContainerWidget, WidgetInstance currentWidgetInstance)
-
sendEventToTargetWidget
protected void sendEventToTargetWidget(java.lang.String eventName, Widget target, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance source)
-
sendEventToTargetWidgetInternal
protected void sendEventToTargetWidgetInternal(java.lang.String eventName, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance source, java.util.List<WidgetInstance> widgetInstances)
-
resolveSingleTargetInstance
protected WidgetInstance resolveSingleTargetInstance(WidgetInstance source, Widget target)
Checks, if an event should be routed to one single instance of the target widget.- Parameters:
source- TheWidgetInstancewhich has sent the event.target- The targetWidget.- Returns:
- The target
WidgetInstancethat should receive the event or null, if none could be resolved.
-
sendSocketEvent
protected void sendSocketEvent(Widgetslot widgetContainer, java.lang.String eventName, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance sourceWidgetInstance)
-
logSocketEvent
protected void logSocketEvent(Widgetslot widgetContainer, java.lang.String targetSocketId, java.lang.Object data, java.lang.String sourceSocketId, WidgetInstance sourceWidgetInstance)
-
getDesktop
protected org.zkoss.zk.ui.Desktop getDesktop()
-
createWidgetView
public void createWidgetView(Widgetchildren widgetChildrenComponent)
Description copied from interface:CockpitWidgetEngineSame asCockpitWidgetEngine.createWidgetView(Widgetchildren, Map)with empty map as second arg.- Specified by:
createWidgetViewin interfaceCockpitWidgetEngine
-
createWidgetView
public void createWidgetView(Widgetchildren widgetChildrenComponent, java.util.Map<java.lang.String,java.lang.Object> ctx)
Description copied from interface:CockpitWidgetEngineCreates the view components for the specified widgetchildren slot. For each matching child widget it creates a container, according to the type of the widgetchildren.- Specified by:
createWidgetViewin interfaceCockpitWidgetEngine
-
getChildrenContainerRenderer
public java.util.Map<java.lang.String,WidgetChildrenContainerRenderer> getChildrenContainerRenderer()
-
setChildrenContainerRenderer
public void setChildrenContainerRenderer(java.util.Map<java.lang.String,WidgetChildrenContainerRenderer> childrenContainerRenderer)
-
isIndependentView
public boolean isIndependentView(WidgetDefinition widget, java.lang.String url)
Description copied from interface:CockpitWidgetEngineChecks whether provided URL points to widget's view, which is defined as not dependent from ZK framework (i.e. uses pure html or some third party javascript library)- Specified by:
isIndependentViewin interfaceCockpitWidgetEngine- Parameters:
widget- widget definition to be checkedurl- requested URL- Returns:
trueif a URL points to view that is defined as independent
-
getWidgetService
public WidgetService getWidgetService()
-
setWidgetService
public void setWidgetService(WidgetService widgetService)
-
getWidgetDefinitionService
protected CockpitComponentDefinitionService getWidgetDefinitionService()
-
setComponentDefinitionService
public void setComponentDefinitionService(CockpitComponentDefinitionService componentDefinitionService)
-
getWidgetUtils
protected WidgetUtils getWidgetUtils()
-
setWidgetUtils
public void setWidgetUtils(WidgetUtils widgetUtils)
-
getRulesEngine
protected WidgetTemplateRulesEngine getRulesEngine()
-
setRulesEngine
public void setRulesEngine(WidgetTemplateRulesEngine rulesEngine)
-
getWidgetPersistenceService
protected WidgetPersistenceService getWidgetPersistenceService()
-
setWidgetPersistenceService
public void setWidgetPersistenceService(WidgetPersistenceService widgetPersistenceService)
-
setSessionWidgetInstanceRegistry
public void setSessionWidgetInstanceRegistry(SessionWidgetInstanceRegistry sessionWidgetInstanceRegistry)
-
getWidgetInstanceFacade
protected WidgetInstanceFacade getWidgetInstanceFacade()
-
setWidgetInstanceFacade
public void setWidgetInstanceFacade(WidgetInstanceFacade widgetInstanceFacade)
-
getCockpitThreadContextCreator
protected CockpitThreadContextCreator getCockpitThreadContextCreator()
-
setCockpitThreadContextCreator
public void setCockpitThreadContextCreator(CockpitThreadContextCreator cockpitThreadContextCreator)
-
getWidgetLibUtils
protected WidgetLibUtils getWidgetLibUtils()
-
setWidgetLibUtils
public void setWidgetLibUtils(WidgetLibUtils widgetLibUtils)
-
setModelValueHandlerFactory
public void setModelValueHandlerFactory(ModelValueHandlerFactory modelValueHandlerFactory)
-
getWidgetConfigurationContextDecoratorList
public java.util.List<WidgetConfigurationContextDecorator> getWidgetConfigurationContextDecoratorList()
-
setWidgetConfigurationContextDecoratorList
public void setWidgetConfigurationContextDecoratorList(java.util.List<WidgetConfigurationContextDecorator> contextDecoratorList)
-
getCockpitConfigurationService
public CockpitConfigurationService getCockpitConfigurationService()
-
setCockpitConfigurationService
public void setCockpitConfigurationService(CockpitConfigurationService cockpitConfigurationService)
-
getWidgetAuthorizationService
protected WidgetAuthorizationService getWidgetAuthorizationService()
-
setWidgetAuthorizationService
public void setWidgetAuthorizationService(WidgetAuthorizationService widgetAuthorizationService)
-
getCockpitProperties
protected CockpitProperties getCockpitProperties()
-
setCockpitProperties
public void setCockpitProperties(CockpitProperties cockpitProperties)
-
setCockpitResourceLoader
public void setCockpitResourceLoader(CockpitResourceLoader cockpitResourceLoader)
-
getCockpitTypeUtils
public CockpitTypeUtils getCockpitTypeUtils()
-
setCockpitTypeUtils
public void setCockpitTypeUtils(CockpitTypeUtils cockpitTypeUtils)
-
getSocketConnectionService
public SocketConnectionService getSocketConnectionService()
-
setSocketConnectionService
public void setSocketConnectionService(SocketConnectionService socketConnectionService)
-
getLabelService
public LabelService getLabelService()
-
setLabelService
public void setLabelService(LabelService labelService)
-
getNotificationService
public NotificationService getNotificationService()
-
setNotificationService
public void setNotificationService(NotificationService notificationService)
-
-