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

Spinner continues to increase indefinetly its value when Clients.showBusy is enabled and the cursor is hovering (not clicking!) one the the increase buttons

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Later Later
    • None
    • 6.5.3
    • ZK Client Engine
    • Server Side:
      -Ubuntu Linux
      -Java JDK 1.7
      -ZK v6.5.3

      Client side:
      -Ubuntu Linux
      -Google Chrome Browser v29.0.1547.65

      I have a ZK page in which the value of the spinner generates a complete report with graphs which can take a few seconds (2-5 seconds).
      The spinner is in fact the year that of the report it generates, so it is important to freeze the screen when the report is being generated to be more user friendly. The way I do that is by using "Clients.showBusy("Loading Data...");". Then, when the method that generates all the finishes it calls "Clients.clearBusy();".

      The problem is that when the user clicks on the increase/decrease button of the spinner and the screen gets in the "Loading Data..." screen, if the user hovers the mouse cursor on the increase/decrease button, the spinner will act as if the user was clicking (increasing or decreasing the spinner automatically and forcing the generation of new reports). This makes the spinner obviously unusable when using the "Clients.showBusy" method.

      To be more specific, the problem is in the file 'zul/src/archive/web/js/zul/inp/Spinner.js' in the following method:
      _startAutoIncProc: function (isup){
      var widget = this;
      if(this.timerId)
      clearInterval(this.timerId);

      this.timerId = setInterval(function()

      {widget._increase(isup)}

      , 200);
      }
      In the code, it starts a a timer which automatically increases the spinner value which seems not to have into account the fact that the button is not clicked.

      The first attempt to solve the bug was to recompile all the ZK code using Githup and by only changing the Spinner.js with the with an empty '_startAutoIncProc' method:
      _startAutoIncProc: function (isup){
      }
      This solution worked but obviously is a hack and the solution is jut not acceptable.

      I also tried unsuccessfully to solve the problem by creating and using a new Component that extends the Spinner class and overrides the method:

      public class SpinnerWithoutTimer extends Spinner {
      private static final long serialVersionUID = -6525158143567125754L;

      public SpinnerWithoutTimer() {
      super();
      this.smartUpdateWidgetOverride("_startAutoIncProc", "function (isup){}");
      }

      public void onCreate(Event event) {
      this.smartUpdateWidgetOverride("_startAutoIncProc", "function (isup){}");
      }
      }
      For some reason, it seems that the 'smartUpdateWidgetOverride' has no effect and the Spinner is still increasing using the original javascript source.

      There could be a very simple temporal solution which would imply a small modification of the Spinner componet with would be a boolean attribute to enable or disable the 'automatic increment' which would at least be a fast-to-implement initial solution. Currently there is not enabling or disabling of the automatic increment, so it may be added.

      I attach the source code of a simple test project that can be used to replicate the problem.

        1. index.zul
          0.7 kB
          paucarre
        2. SpinnerBugReportVM.java
          1 kB
          paucarre

            Unassigned Unassigned
            paucarre paucarre
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: