Here’s what I use, in case it’s useful:

qx.Class.define("grasshopper.af.ui.ProgressPopup", {
  extend : qx.ui.core.Widget,

  construct : function(caption) {
    this.base(arguments);
    this._setLayout(new qx.ui.layout.VBox(5));
    this._add(this.getChildControl("caption"));
    this._add(this.getChildControl("pole"));
    this.set({
      width : 220,
      height : 80
    });
    if (caption)
      this.setCaption(caption);
    this.setVisibility("hidden");
  },

  properties : {
    appearance : {
      refine : true,
      init : "progress"
    },

    /**
     * Text caption
     */
    caption : {
      init : "",
      nullable : false,
      check : "String",
      apply : "_applyCaption"
    },

    /**
     * Whether to block the ui while the widget is displayed
     */
    useBlocker : {
      check : "Boolean",
      init : true
    },

    /**
     * The blocker's color
     */
    blockerColor : {
      check : "String",
      init : "black"
    },

    /**
     * The blocker's opacity
     */
    blockerOpacity : {
      check : "Number",
      init : 0.25
    }
  },

  members : {
    __blocker : null,

    /**
     * Shows the progress popup on screen, above all other windows
     */
    show : function() {
      if (this.isUseBlocker()) {
        var root = qx.core.Init.getApplication().getRoot();

        // Create it
        if (!this.__blocker) {
          this.__blocker = new qx.ui.core.Blocker(root);
          this.__blocker.setOpacity(this.getBlockerOpacity());
          this.__blocker.setColor(this.getBlockerColor());
        }

        // make sure the popup is above any opened window
        var maxWindowZIndex = root.getZIndex();
        var windows = root.getWindows();
        for ( var i = 0; i < windows.length; i++) {
          var zIndex = windows[i].getZIndex();
          maxWindowZIndex = Math.max(maxWindowZIndex, zIndex);
        }
        maxWindowZIndex = Math.max(maxWindowZIndex, 200000);
        this.setZIndex(maxWindowZIndex + 2);
        this.__blocker.blockContent(maxWindowZIndex + 1);
      }

      var parent = this.getLayoutParent();
      if (parent) {
        var bounds = parent.getBounds();
        if (bounds) {
          var hint = this.getSizeHint();

          var left = Math.round((bounds.width - hint.width) / 2);
          var top = Math.round((bounds.height - hint.height) / 2);

          if (top < 0) {
            top = 0;
          }

          this.setLayoutProperties({
            left : left,
            top : top
          });
        }
      }

      this.setVisibility("visible");
      this.__previousFocus = 
qx.ui.core.FocusHandler.getInstance().getActiveWidget();
    },

    /**
     * Hides the popup
     */
    hide : function() {
      this.setVisibility("hidden");
      if (this.isUseBlocker()) {
        if (this.__blocker)
          this.__blocker.unblock();
      }

      if (this.__previousFocus) {
        try {
          this.__previousFocus.focus();
        } catch (e) {
        }
      }
    },

    /**
     * Apply for caption
     */
    _applyCaption : function(value, oldValue) {
      this.getChildControl("caption").setValue(value);
    },

    /*
     * @Override
     */
    _createChildControlImpl : function(id) {
      switch (id) {
      case "caption":
        return new qx.ui.basic.Label(this.getCaption()).set({
          allowGrowX : true
        });

      case "pole":
        return new qx.ui.basic.Image("grasshopper/progress.gif");
      }
    }
  }
});


Then elsewhere I have these methods:

    /**
     * Returns the progress popup, creating if necessary
     */
    _getProgressPopup: function(title) {
      if (!this.__progress) {
        this.__progress = new grasshopper.af.ui.ProgressPopup("Working...");
        var root = qx.core.Init.getApplication().getDocumentRoot();
        root.add(this.__progress);
      }
      if (title)
        this.__progress.setCaption(title);
      return this.__progress;
    },
    
    /**
     * Shows the progress with optional caption
     */
    showProgress: function(title) {
      this._getProgressPopup(title);
      this.setProgressVisible(true);
    },
    
    /**
     * Hides the progress, if necessary
     */
    hideProgress: function() {
      this.setProgressVisible(false);
    },
    

Attached is the barbers pole waiting animated gif

John


> On 26 Jan 2015, at 12:59, halcwb <hal...@gmail.com> wrote:
> 
> John Spackman-3 wrote
>> No but there is a general purpose qx.ui.core.Blocker which you can use to
>> cover the whole screen and then put a progress bar/feedback on top
> 
> Thanks, I am working on a general method to this. With the mobile app it was
> trivial using a 'busy popup', unfortunately, using the desktop gui, it isn't
> that easy.
> 
> 
> 
> 
> --
> View this message in context: 
> http://qooxdoo.678.n2.nabble.com/Loading-mask-for-combo-select-box-tp7586720p7586723.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel 
> <https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to