Class AbstractWidget<T extends WidgetModel,​U extends WidgetController>

    • 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 java.lang.String LAZY_LOAD_EVT_KEY  
      • 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
      AbstractWidget()
      Creates a new widget instance.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void cleanup()
      Called whenever this widget is invalidated or when a cleanup is needed.
      org.zkoss.zk.ui.api.HtmlBasedComponent getCaption()
      Returns this widget's caption component.
      org.zkoss.zk.ui.api.HtmlBasedComponent getContent()
      Returns this widget's content component
      java.lang.String getControllerCtx()
      Returns this widget's controller context.
      java.lang.String getWidgetCode()
      Returns the widget's code.
      WidgetContainer getWidgetContainer()
      Returns the widget container to which this widget belongs.
      U getWidgetController()
      Returns the widget's controller.
      T getWidgetModel()
      Returns the widget's (view) model.
      WidgetRenderer getWidgetRenderer()
      Returns the widget renderer.
      java.lang.String getWidgetTitle()
      Returns the widget's title.
      void handleFocus​(boolean focused)
      Called whenever the focus view state of this component should be changed.
      void initialize​(java.util.Map<java.lang.String,​java.lang.Object> params)
      Initializes this widget.
      boolean isFocusable()
      Returns whether this widget can be focused or not.
      boolean isInitialized()
      Returns whether this widget has been initialized or not.
      boolean isLazyLoadingEnabled()
      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​(java.lang.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​(java.lang.String widgetCode)
      Sets the widget's code.
      void setWidgetContainer​(WidgetContainer container)
      Sets the widget container to which this widget belongs.
      void setWidgetController​(U widgetController)
      Sets the widget's controller to controller.
      void setWidgetModel​(T model)
      Sets the widget's (view) model.
      void setWidgetRenderer​(WidgetRenderer widgetRenderer)
      Sets the widget renderer.
      void setWidgetTitle​(java.lang.String title)
      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

        focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, 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, equals, 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

        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
    • Field Detail

      • LAZY_LOAD_EVT_KEY

        protected static final java.lang.String LAZY_LOAD_EVT_KEY
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractWidget

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

      • initialize

        public void initialize​(java.util.Map<java.lang.String,​java.lang.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>
      • 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
      • 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
      • 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​(java.lang.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
      • 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
      • setControllerCtx

        public void setControllerCtx​(java.lang.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 java.lang.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​(java.lang.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