Interface Widget<T extends WidgetModel,​U extends WidgetController>

    • Field Summary

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

        APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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 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.
      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 enabled)
      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 controller)
      Sets the widget's controller to controller.
      void setWidgetModel​(T model)
      Sets the widget's (view) model.
      void setWidgetRenderer​(WidgetRenderer renderer)
      Sets the widget renderer.
      void setWidgetTitle​(java.lang.String title)
      Sets the widget's title to title.
      • 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
    • Method Detail

      • setWidgetCode

        void setWidgetCode​(java.lang.String widgetCode)
        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.

        Parameters:
        widgetCode - widget code
      • getWidgetCode

        java.lang.String getWidgetCode()
        Returns the widget's code.
        Returns:
        this widget's code
        See Also:
        setWidgetCode(String)
      • setWidgetModel

        void setWidgetModel​(T model)
        Sets the widget's (view) model.
        Parameters:
        model - the model
      • getWidgetModel

        T getWidgetModel()
        Returns the widget's (view) model.
        Returns:
        widget's model or null if no model is available
      • setWidgetContainer

        void setWidgetContainer​(WidgetContainer container)
        Sets the widget container to which this widget belongs.
        Parameters:
        container - widget container
      • getWidgetContainer

        WidgetContainer getWidgetContainer()
        Returns the widget container to which this widget belongs.
        Returns:
        this widget's widget container
      • setFocusable

        void setFocusable​(boolean focusable)
        Sets whether this widget can be focused or not.
        Parameters:
        focusable - true means focusing is enabled, false means disabled
      • isFocusable

        boolean isFocusable()
        Returns whether this widget can be focused or not.
        Returns:
        true if focusing is enabled, false otherwise
      • setWidgetTitle

        void setWidgetTitle​(java.lang.String title)
        Sets the widget's title to title.
        Parameters:
        title - widget title as either i3-label key or direct value
      • getWidgetTitle

        java.lang.String getWidgetTitle()
        Returns the widget's title.

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

        Returns:
        widget's title
      • initialize

        void initialize​(java.util.Map<java.lang.String,​java.lang.Object> params)
        Initializes this widget.
        Parameters:
        params - initialization parameters
      • isInitialized

        boolean isInitialized()
        Returns whether this widget has been initialized or not.
        Returns:
        true if widget has been initialized, false otherwise
      • getCaption

        org.zkoss.zk.ui.api.HtmlBasedComponent getCaption()
        Returns this widget's caption component.
        Returns:
        the caption component
        See Also:
        WidgetRenderer.createCaption(Widget)
      • getContent

        org.zkoss.zk.ui.api.HtmlBasedComponent getContent()
        Returns this widget's content component
        Returns:
        the content component
        See Also:
        WidgetRenderer.createContent(Widget)
      • cleanup

        void cleanup()
        Called whenever this widget is invalidated or when a cleanup is needed.

        Typically unregisters itself and releases any acquired resources.

      • setWidgetRenderer

        void setWidgetRenderer​(WidgetRenderer renderer)
        Sets the widget renderer.
        Parameters:
        renderer - widget renderer
      • getWidgetRenderer

        WidgetRenderer getWidgetRenderer()
        Returns the widget renderer.
        Returns:
        widget renderer
      • setWidgetController

        void setWidgetController​(U controller)
        Sets the widget's controller to controller.
        Parameters:
        controller - widget controller
      • getWidgetController

        U getWidgetController()
        Returns the widget's controller.
        Returns:
        widget controller
      • setControllerCtx

        void setControllerCtx​(java.lang.String controllerCtx)
        Sets this widget's controller context i.e. the context for which this widget should use when dealing with its controller.
        Parameters:
        controllerCtx - controller context code
      • getControllerCtx

        java.lang.String getControllerCtx()
        Returns this widget's controller context.
        Returns:
        controller context code
      • setLazyLoadingEnabled

        void setLazyLoadingEnabled​(boolean enabled)
        Enables or disables content lazy loading.
        Parameters:
        enabled - lazy loading
      • isLazyLoadingEnabled

        boolean isLazyLoadingEnabled()
        Returns whether content lazy loading is enabled or not.
        Returns:
        true if lazy loading is enabled, false otherwise