Class DefaultCockpitWidgetEngine

    • Field Detail

      • MONITOR_WIDGET_COUNTER_ATTRIB

        public static final java.lang.String MONITOR_WIDGET_COUNTER_ATTRIB
        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
      • SCLASS_WIDGET_BODY

        public static final java.lang.String SCLASS_WIDGET_BODY
        See Also:
        Constant Field Values
      • SETTING_WIDGET_MOLD

        public static final java.lang.String SETTING_WIDGET_MOLD
        See Also:
        Constant Field Values
      • documentWithWidgetSlot

        protected org.zkoss.idom.Document documentWithWidgetSlot
      • documentNoView

        protected org.zkoss.idom.Document documentNoView
    • Constructor Detail

      • DefaultCockpitWidgetEngine

        public DefaultCockpitWidgetEngine()
    • 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: CockpitWidgetEngine
        Creates 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:
        createWidgetView in interface CockpitWidgetEngine
      • 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)
      • injectWidgetVariables

        protected void injectWidgetVariables​(java.lang.Object widgetController,
                                             WidgetInstanceManager widgetInstanceManager)
      • createComponents

        protected void createComponents​(Widgetslot widgetslot)
      • 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)
      • 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,
                               java.lang.Object data,
                               boolean ignoreSockets)
        Description copied from interface: CockpitWidgetEngine
        Sends an output event from the widget attached to the widgetslot parameter with the given outputID. This method is finally called from DefaultWidgetController.sendOutput(String, Object).
        Specified by:
        sendOutput in interface CockpitWidgetEngine
        Parameters:
        widgetslot - The source widget slot
        outputId - The output socket id
        data - The event data
        ignoreSockets - 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)
      • getOutputSocketTypeMessage

        protected java.lang.String getOutputSocketTypeMessage​(WidgetSocket outputWidgetSocket,
                                                              java.lang.String outputSocketType)
      • 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 - The WidgetInstance which has sent the event.
        target - The target Widget.
        Returns:
        The target WidgetInstance that 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,
                                     java.util.Map<java.lang.String,​java.lang.Object> ctx)
        Description copied from interface: CockpitWidgetEngine
        Creates 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:
        createWidgetView in interface CockpitWidgetEngine
      • 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: CockpitWidgetEngine
        Checks 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:
        isIndependentView in interface CockpitWidgetEngine
        Parameters:
        widget - widget definition to be checked
        url - requested URL
        Returns:
        true if a URL points to view that is defined as independent
      • setWidgetService

        public void setWidgetService​(WidgetService widgetService)
      • getWidgetUtils

        protected WidgetUtils getWidgetUtils()
      • setWidgetUtils

        public void setWidgetUtils​(WidgetUtils widgetUtils)
      • setWidgetPersistenceService

        public void setWidgetPersistenceService​(WidgetPersistenceService widgetPersistenceService)
      • setSessionWidgetInstanceRegistry

        public void setSessionWidgetInstanceRegistry​(SessionWidgetInstanceRegistry sessionWidgetInstanceRegistry)
      • setWidgetInstanceFacade

        public void setWidgetInstanceFacade​(WidgetInstanceFacade widgetInstanceFacade)
      • setCockpitThreadContextCreator

        public void setCockpitThreadContextCreator​(CockpitThreadContextCreator cockpitThreadContextCreator)
      • setWidgetLibUtils

        public void setWidgetLibUtils​(WidgetLibUtils widgetLibUtils)
      • setModelValueHandlerFactory

        public void setModelValueHandlerFactory​(ModelValueHandlerFactory modelValueHandlerFactory)
      • setWidgetConfigurationContextDecoratorList

        public void setWidgetConfigurationContextDecoratorList​(java.util.List<WidgetConfigurationContextDecorator> contextDecoratorList)
      • setCockpitConfigurationService

        public void setCockpitConfigurationService​(CockpitConfigurationService cockpitConfigurationService)
      • setWidgetAuthorizationService

        public void setWidgetAuthorizationService​(WidgetAuthorizationService widgetAuthorizationService)
      • setCockpitProperties

        public void setCockpitProperties​(CockpitProperties cockpitProperties)
      • setCockpitResourceLoader

        public void setCockpitResourceLoader​(CockpitResourceLoader cockpitResourceLoader)
      • setCockpitTypeUtils

        public void setCockpitTypeUtils​(CockpitTypeUtils cockpitTypeUtils)
      • setSocketConnectionService

        public void setSocketConnectionService​(SocketConnectionService socketConnectionService)
      • setLabelService

        public void setLabelService​(LabelService labelService)
      • setNotificationService

        public void setNotificationService​(NotificationService notificationService)