Class DefaultWidgetController

    • Field Summary

      • Fields inherited from class org.zkoss.zk.ui.util.GenericAutowireComposer

        _separator, application, applicationScope, arg, componentScope, desktop, desktopScope, execution, page, pageScope, param, requestScope, self, session, sessionScope, spaceOwner, spaceScope
      • Fields inherited from class org.zkoss.zk.ui.util.GenericComposer

        _applied
    • Constructor Detail

      • DefaultWidgetController

        public DefaultWidgetController()
    • Method Detail

      • preInitialize

        public void preInitialize​(org.zkoss.zk.ui.Component comp)
        Override this method to initialize widget settings. Do not refer to view components since they may not have been wired yet.
      • initialize

        public void initialize​(org.zkoss.zk.ui.Component comp)
        Override this method to do initialization stuff for your widget, like initialize widget settings, restore view state from viewmodel, etc. This method will be invoked by doAfterCompose(Component) everytime your widget view is created. See GenericForwardComposer.doAfterCompose(Component) for more details.
      • doBeforeComposeChildren

        public void doBeforeComposeChildren​(org.zkoss.zk.ui.Component comp)
                                     throws java.lang.Exception
        Specified by:
        doBeforeComposeChildren in interface org.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>
        Overrides:
        doBeforeComposeChildren in class org.zkoss.zk.ui.util.GenericComposer<org.zkoss.zk.ui.Component>
        Throws:
        java.lang.Exception
      • doBeforeCompose

        public org.zkoss.zk.ui.metainfo.ComponentInfo doBeforeCompose​(org.zkoss.zk.ui.Page page,
                                                                      org.zkoss.zk.ui.Component parent,
                                                                      org.zkoss.zk.ui.metainfo.ComponentInfo compInfo)
        Specified by:
        doBeforeCompose in interface org.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>
        Overrides:
        doBeforeCompose in class org.zkoss.zk.ui.util.GenericComposer<org.zkoss.zk.ui.Component>
      • doAfterCompose

        public final void doAfterCompose​(org.zkoss.zk.ui.Component comp)
                                  throws java.lang.Exception
        This method is final, use initialize(Component) instead.
        Specified by:
        doAfterCompose in interface org.zkoss.zk.ui.util.Composer<org.zkoss.zk.ui.Component>
        Overrides:
        doAfterCompose in class ViewAnnotationAwareComposer
        Throws:
        java.lang.Exception
      • getWidgetRoot

        public java.lang.String getWidgetRoot()
        Returns root path prefix for the given widget. All resource paths within the widget must be preceded by this.
      • getWidgetslot

        public Widgetslot getWidgetslot()
      • setValue

        public void setValue​(java.lang.String key,
                             java.lang.Object value)
      • getValue

        public <T> T getValue​(java.lang.String key,
                              java.lang.Class<T> expectedClass)
      • invokeListenerMethod

        protected final void invokeListenerMethod​(java.lang.reflect.Method method,
                                                  org.zkoss.zk.ui.event.Event event,
                                                  ViewEvent viewAnnotation)
                                           throws java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException
        Description copied from class: ViewAnnotationAwareComposer
        Override to intercept listener calls
        Overrides:
        invokeListenerMethod in class ViewAnnotationAwareComposer
        Throws:
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • initWidgetSetting

        protected void initWidgetSetting​(java.lang.String key,
                                         java.lang.Object initialValue)
        Initializes a widget setting and sets an initial value if there is none, i.e. this method does nothing if there is already a value set for the given key. A common place to invoke this method is within initialize(Component).
      • initWidgetSetting

        protected void initWidgetSetting​(java.lang.String key)
        Same as initWidgetSetting(key, "").
      • initWidgetSetting

        protected void initWidgetSetting​(java.lang.String key,
                                         int initialValue)
        Same as initWidgetSetting(key, Integer.valueOf(initialValue)).
      • initWidgetSetting

        protected void initWidgetSetting​(java.lang.String key,
                                         boolean initialValue)
        Same as initWidgetSetting(key, Boolean.valueOf(initialValue)).
      • initWidgetSetting

        protected void initWidgetSetting​(java.lang.String key,
                                         double initialValue)
        Same as initWidgetSetting(key, Double.valueOf(initialValue)).
      • sendOutput

        public final void sendOutput​(java.lang.String id,
                                     java.lang.Object data)
        Sends an output event to the output socket with the given id.
        Parameters:
        id - The output socket id.
        data - The data to send or null.
      • sendOutputAfterOperation

        protected final void sendOutputAfterOperation​(java.lang.String id,
                                                      Operation operation)
        Same as sendOutputAfterOperation(id, operation, null, null).
      • sendOutputAfterOperation

        protected final void sendOutputAfterOperation​(java.lang.String id,
                                                      Operation operation,
                                                      java.lang.String busyMessage)
        Same as sendOutputAfterOperation(id, operation, null, busyMessage).
      • sendOutputAfterOperation

        protected final void sendOutputAfterOperation​(java.lang.String id,
                                                      Operation operation,
                                                      org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent,
                                                      java.lang.String busyMessage)
        Executes an Operation in a separate thread and sends an output event to the output socket with the given id after the operation has been finished.
        Parameters:
        id - The output socket id.
        operation - The operation to execute.
        callbackEvent - An optional callback event listener that is invoked after the output event has been sent.
        busyMessage - A busy message that should be displayed while the operation is executed.
      • executeOperation

        protected final void executeOperation​(Operation operation,
                                              org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent,
                                              java.lang.String busyMessage)
        Executes an Operation in a separate thread.l
        Parameters:
        operation - The operation to execute.
        callbackEvent - An optional callback event listener that is invoked after the operation has been finished.
        busyMessage - A busy message that should be displayed while the operation is executed.
      • onSocketInput

        public void onSocketInput​(org.zkoss.zk.ui.event.Event event)
        Override this method to handle all input socket events.
        Parameters:
        event - Usually an instance of ForwardEvent. Use ForwardEvent.getOrigin() to get the original event.
      • getWidgetTitle

        public java.lang.String getWidgetTitle()
        Gets the title of the current widget instance
      • setWidgetTitle

        public void setWidgetTitle​(java.lang.String title)
        Sets the title of the current widget instance
      • initDragAndDropAwareness

        @Deprecated(since="6.6",
                    forRemoval=true)
        protected void initDragAndDropAwareness()
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 6.6 we don't put beans to Widget Model