Class PushComponent<T extends PushController>

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Span
de.hybris.platform.cockpit.components.PushComponent<T>
All Implemented Interfaces:
DesktopRemovalAwareComponent, Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl

public class PushComponent<T extends PushController> extends org.zkoss.zul.Span implements DesktopRemovalAwareComponent
A push component is a component which allows ZK components to be updated asynchronously using reverse Ajax.

Together with a PushController it enables server push in a Cockpit application. A push component is responsible for handling the execution of its PushController and sending CockpitEvents in an asynchronous fashion. It does not allow any child components to be added and should not be used for visually displaying content.

Each push component typically has (or creates) its own PushController instance, typically implemented as a Java thread. The PushController (thread) is started as soon as the push component has been rendered by the browser using ZK's timer events.

Note: Each thread is gently stopped (within the duration of the specified update interval) once the desktop to which this push component belongs has been removed. However, in order to avoid excessive creation of threads a push component should typically be added to a relatively "long-lived" component e.g. the ZK application's root component.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent

    org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrl

    Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

    org.zkoss.zk.ui.AbstractComponent.Children
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
     

    Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent

    _zclass

    Fields inherited from interface org.zkoss.zk.ui.Component

    APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE

    Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl

    AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
  • Constructor Summary

    Constructors
    Constructor
    Description
    PushComponent(Class<T> controllerClass)
    Creates a new push component instance with the default update interval and a PushController of the class specified by controllerClass.
    PushComponent(Class<T> controllerClass, int updateInterval)
    Creates a new push component instance with the specified update interval and a PushController of the class specified by controllerClass.
    PushComponent(T controller)
    Creates a new push component instance with the specified PushController controller with an update interval set to the value of controller's update interval.
    PushComponent(T controller, int updateInterval)
    Creates a new push component instance with the specified PushController controller and an update interval of updateInterval milliseconds.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds an event to this push components internal event queue.
    protected void
    appendChildInternal(org.zkoss.zk.ui.Component child)
     
    void
    Clears the event queue i.e.
    void
    desktopRemoved(org.zkoss.zk.ui.Desktop desktop)
     
    void
     
    void
    Dispatches the queued events.
    void
    enableServerPush(boolean enable)
     
    Returns the events in the internal event queue.
    boolean
    insertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
     
    void
    setParent(org.zkoss.zk.ui.Component parent)
     

    Methods inherited from class org.zkoss.zul.impl.XulElement

    clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, renderProperties, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes

    Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent

    addSclass, evalCSSFlex, focus, 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, 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, invalidate, invalidatePartial, isChildable, isInitialized, 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, 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

    Methods inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl

    invalidatePartial
  • Field Details

  • Constructor Details

  • Method Details

    • insertBefore

      public boolean insertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
      Specified by:
      insertBefore in interface org.zkoss.zk.ui.Component
      Overrides:
      insertBefore in class org.zkoss.zk.ui.AbstractComponent
    • appendChildInternal

      protected void appendChildInternal(org.zkoss.zk.ui.Component child)
    • clearEvents

      public void clearEvents()
      Clears the event queue i.e. removes all the previously queued events.
    • addEvent

      public void addEvent(CockpitEvent event)
      Adds an event to this push components internal event queue.

      The events are typically dispatched as soon as control is returned from the push controller thread.

      Parameters:
      event - the event to be dispatched
    • getEvents

      public List<CockpitEvent> getEvents()
      Returns the events in the internal event queue.
      Returns:
      the queued events
    • dispatchEvents

      public void dispatchEvents()
      Dispatches the queued events.
    • desktopRemoved

      public void desktopRemoved(org.zkoss.zk.ui.Desktop desktop)
      Specified by:
      desktopRemoved in interface DesktopRemovalAwareComponent
    • detach

      public void detach()
      Specified by:
      detach in interface org.zkoss.zk.ui.Component
      Overrides:
      detach in class org.zkoss.zk.ui.AbstractComponent
    • setParent

      public void setParent(org.zkoss.zk.ui.Component parent)
      Specified by:
      setParent in interface org.zkoss.zk.ui.Component
      Overrides:
      setParent in class org.zkoss.zk.ui.AbstractComponent
    • enableServerPush

      public void enableServerPush(boolean enable)