Class AbstractWidget<T extends WidgetModel,U extends WidgetController>

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Div
de.hybris.platform.cockpit.widgets.impl.AbstractWidget<T,U>
All Implemented Interfaces:
FocusableComponent, WidgetModelListener, Widget<T,U>, Serializable, Cloneable, org.zkoss.zk.ui.api.HtmlBasedComponent, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl
Direct Known Subclasses:
DefaultWidget

public abstract class AbstractWidget<T extends WidgetModel,U extends WidgetController> extends org.zkoss.zul.Div implements Widget<T,U>
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 String
     

    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
    Creates a new widget instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Called whenever this widget is invalidated or when a cleanup is needed.
    org.zkoss.zk.ui.api.HtmlBasedComponent
    Returns this widget's caption component.
    org.zkoss.zk.ui.api.HtmlBasedComponent
    Returns this widget's content component
    Returns this widget's controller context.
    Returns the widget's code.
    Returns the widget container to which this widget belongs.
    Returns the widget's controller.
    Returns the widget's (view) model.
    Returns the widget renderer.
    Returns the widget's title.
    void
    handleFocus(boolean focused)
    Called whenever the focus view state of this component should be changed.
    void
    Initializes this widget.
    boolean
    Returns whether this widget can be focused or not.
    boolean
    Returns whether this widget has been initialized or not.
    boolean
    Returns whether content lazy loading is enabled or not.
    protected void
    setCaption(org.zkoss.zk.ui.api.HtmlBasedComponent caption)
    Sets this widget's caption component to caption.
    protected void
    setContent(org.zkoss.zk.ui.api.HtmlBasedComponent content)
    Sets this widget's content component to content.
    void
    setControllerCtx(String controllerCtx)
    Sets this widget's controller context i.e.
    void
    setFocusable(boolean focusable)
    Sets whether this widget can be focused or not.
    void
    setLazyLoadingEnabled(boolean lazyLoading)
    Enables or disables content lazy loading.
    void
    setWidgetCode(String widgetCode)
    Sets the widget's code.
    void
    Sets the widget container to which this widget belongs.
    void
    setWidgetController(U widgetController)
    Sets the widget's controller to controller.
    void
    Sets the widget's (view) model.
    void
    Sets the widget renderer.
    void
    Sets the widget's title to title.

    Methods inherited from class org.zkoss.zul.Div

    getAlign, renderProperties, setAlign

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

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

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

    addSclass, 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, detach, 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, insertBefore, invalidate, isChildable, 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, setParent, 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.Component

    addEventListener, addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, clone, detach, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientAttribute, getClientDataAttribute, getDefinition, getDesktop, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getShadowVariable, getShadowVariable, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, query, queryAll, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setTemplate, setVisible, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride

    Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent

    focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex

    Methods inherited from interface org.zkoss.zk.ui.ext.Scope

    addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute

    Methods inherited from interface de.hybris.platform.cockpit.widgets.events.WidgetModelListener

    onModelEvent
  • Field Details

  • Constructor Details

    • AbstractWidget

      public AbstractWidget()
      Creates a new widget instance.
  • Method Details

    • initialize

      public void initialize(Map<String,Object> params)
      Description copied from interface: Widget
      Initializes this widget.
      Specified by:
      initialize in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      params - initialization parameters
    • isInitialized

      public boolean isInitialized()
      Description copied from interface: Widget
      Returns whether this widget has been initialized or not.
      Specified by:
      isInitialized in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      true if widget has been initialized, false otherwise
    • handleFocus

      public void handleFocus(boolean focused)
      Description copied from interface: FocusableComponent
      Called whenever the focus view state of this component should be changed.
      Specified by:
      handleFocus in interface FocusableComponent
      Parameters:
      focused - true if the component should be rendered as focused, false otherwise
    • cleanup

      public abstract void cleanup()
      Description copied from interface: Widget
      Called whenever this widget is invalidated or when a cleanup is needed.

      Typically unregisters itself and releases any acquired resources.

      Specified by:
      cleanup in interface Widget<T extends WidgetModel,U extends WidgetController>
    • getContent

      public org.zkoss.zk.ui.api.HtmlBasedComponent getContent()
      Description copied from interface: Widget
      Returns this widget's content component
      Specified by:
      getContent in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      the content component
      See Also:
    • setContent

      protected void setContent(org.zkoss.zk.ui.api.HtmlBasedComponent content)
      Sets this widget's content component to content.

      Note: If a content component has already been set the old one will be removed.

      Parameters:
      content - content component
    • getCaption

      public org.zkoss.zk.ui.api.HtmlBasedComponent getCaption()
      Description copied from interface: Widget
      Returns this widget's caption component.
      Specified by:
      getCaption in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      the caption component
      See Also:
    • setCaption

      protected void setCaption(org.zkoss.zk.ui.api.HtmlBasedComponent caption)
      Sets this widget's caption component to caption.

      Note: If a caption component has already been set the old one will be removed.

      Parameters:
      caption - caption component
    • setWidgetContainer

      public void setWidgetContainer(WidgetContainer container)
      Description copied from interface: Widget
      Sets the widget container to which this widget belongs.
      Specified by:
      setWidgetContainer in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      container - widget container
    • getWidgetContainer

      public WidgetContainer getWidgetContainer()
      Description copied from interface: Widget
      Returns the widget container to which this widget belongs.
      Specified by:
      getWidgetContainer in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      this widget's widget container
    • setWidgetModel

      public void setWidgetModel(T model)
      Description copied from interface: Widget
      Sets the widget's (view) model.
      Specified by:
      setWidgetModel in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      model - the model
    • getWidgetModel

      public T getWidgetModel()
      Description copied from interface: Widget
      Returns the widget's (view) model.
      Specified by:
      getWidgetModel in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      widget's model or null if no model is available
    • setWidgetCode

      public void setWidgetCode(String widgetCode)
      Description copied from interface: Widget
      Sets the widget's code.

      The code of a widget is used for focus handling and internal mapping, thus it is important that widgets' codes are unique within one WidgetContainer.

      Specified by:
      setWidgetCode in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      widgetCode - widget code
    • getWidgetCode

      public String getWidgetCode()
      Description copied from interface: Widget
      Returns the widget's code.
      Specified by:
      getWidgetCode in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      this widget's code
      See Also:
    • setWidgetRenderer

      public void setWidgetRenderer(WidgetRenderer widgetRenderer)
      Description copied from interface: Widget
      Sets the widget renderer.
      Specified by:
      setWidgetRenderer in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      widgetRenderer - widget renderer
    • getWidgetRenderer

      public WidgetRenderer getWidgetRenderer()
      Description copied from interface: Widget
      Returns the widget renderer.
      Specified by:
      getWidgetRenderer in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      widget renderer
    • setFocusable

      public void setFocusable(boolean focusable)
      Description copied from interface: Widget
      Sets whether this widget can be focused or not.
      Specified by:
      setFocusable in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      focusable - true means focusing is enabled, false means disabled
    • isFocusable

      public boolean isFocusable()
      Description copied from interface: Widget
      Returns whether this widget can be focused or not.
      Specified by:
      isFocusable in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      true if focusing is enabled, false otherwise
    • setWidgetController

      public void setWidgetController(U widgetController)
      Description copied from interface: Widget
      Sets the widget's controller to controller.
      Specified by:
      setWidgetController in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      widgetController - widget controller
    • getWidgetController

      public U getWidgetController()
      Description copied from interface: Widget
      Returns the widget's controller.
      Specified by:
      getWidgetController in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      widget controller
    • setControllerCtx

      public void setControllerCtx(String controllerCtx)
      Description copied from interface: Widget
      Sets this widget's controller context i.e. the context for which this widget should use when dealing with its controller.
      Specified by:
      setControllerCtx in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      controllerCtx - controller context code
    • getControllerCtx

      public String getControllerCtx()
      Description copied from interface: Widget
      Returns this widget's controller context.
      Specified by:
      getControllerCtx in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      controller context code
    • isLazyLoadingEnabled

      public boolean isLazyLoadingEnabled()
      Description copied from interface: Widget
      Returns whether content lazy loading is enabled or not.
      Specified by:
      isLazyLoadingEnabled in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      true if lazy loading is enabled, false otherwise
    • setLazyLoadingEnabled

      public void setLazyLoadingEnabled(boolean lazyLoading)
      Description copied from interface: Widget
      Enables or disables content lazy loading.
      Specified by:
      setLazyLoadingEnabled in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      lazyLoading - lazy loading
    • setWidgetTitle

      public void setWidgetTitle(String title)
      Description copied from interface: Widget
      Sets the widget's title to title.
      Specified by:
      setWidgetTitle in interface Widget<T extends WidgetModel,U extends WidgetController>
      Parameters:
      title - widget title as either i3-label key or direct value
    • getWidgetTitle

      public String getWidgetTitle()
      Description copied from interface: Widget
      Returns the widget's title.

      Note: This method will return the raw title as set by previous call to Widget.setWidgetTitle(String) i.e. in the case of an i3-label key, no evaluation is done.

      Specified by:
      getWidgetTitle in interface Widget<T extends WidgetModel,U extends WidgetController>
      Returns:
      widget's title