Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1321

Clients.showBusy execution is delayed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Invalid
    • Affects Version/s: 5.0.9
    • Fix Version/s: None
    • Component/s: ZK Client Engine
    • Labels:
    • Environment:

      Tomcat 6.0.35, Java jdk1.6.0_25, Windows XP.

      Description

      Here is the case.
      Suppose you have a long operation to do when you click on a menuitem, so you have an event listener on the item.
      Knowing that you may want to present user a showBusy mask. So you have a situation like (pseudoCode):

      private void registerMyHandlers() {
      menuItem.addEventListener(Events.onClick, new EventListener()

      {Clients.showBusy(componentToBlock)}

      );
      menuItem.addEventListener(Events.onClick, longOperationListener);
      }

      Going in debug I saw that Clients.showBusy() is executed before longOperationListener but the final result is that
      the mask is presented to user when longOperationListener is accomplished.

      Going deep in zk source I saw that the code doesn't execute anything but addAuResponse(AuResponse resposne);
      that, reporting the Javadoc, is

      "Adds an asynchronous response (

      {@link AuResponse}

      ) which will be sent to client at the end of the execution.
      It is the same as <code>addAuResponse(response.getOverrideKey(), resposne)"

      So I'm supposing that the execution flow is in a sort of box (I think it might is the event queue manager/ event dispatcher) in which the Clients.showbusy is executed when the box code is complete, say (pseudoCode)

      while (queue.hasEvents()) { // a monitored access to a variable makes is awakable if is queue is empty
      Events[] clickEvents = queue.getEvents(Events.OnClick);
      for (Event e in clickEvents) {
      Component target = e.getTarget();
      Iterator<EventListener> it = target.getListenerIterator(Events.OnClick);
      while (it.hasNext())

      { EventListener listener = it.next(); listener.onEvent(e); }

      }
      }

      What I'm thinking is that the Clients.showBusy, since it runs at the end of current execution, is executed when the while starts over.

      I'm thinking that this behaviour is defective by design.

      Am I wrong is any point?

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ZazzaZ ZazzaZ
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: