CallBackery

 view release on metacpan or  search on metacpan

lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/Busy.js  view on Meta::CPAN

/* ************************************************************************

   Copyrigtht: OETIKER+PARTNER AG
   License:    GPL V3 or later
   Authors:    Tobias Oetiker
   Utf8Check:  äöü

************************************************************************ */

/**
@asset(callbackery/spinner.gif);
 */

/**
 * singleton with two methods for blocking and unblocking the screen. while the screen
 * is blocked, a busy icon is shown.
 *
 * <pre code='javascript'>
 * var busy = callbackery.ui.Busy.getInstance();
 * busy.manifest();busy.vanish();
 * </pre>
 */

qx.Class.define("callbackery.ui.Busy", {
    extend : qx.ui.basic.Atom,
    type : "singleton",

    construct : function() {
        var img = 'callbackery/spinner.gif';
        var cfg = callbackery.data.Config.getInstance().getBaseConfig();
        if (cfg.spinner){
            img = cfg.spinner;
        }
        this.base(arguments,null,img);
        this.set({
            center : true,
            show: 'both',
            iconPosition: 'top',
            visibility: 'excluded',
            zIndex: 10000001
        });
        this.getApplicationRoot().add(this,{top:0,bottom:0,left:0,right:0});
        this.__blocker = new qx.ui.core.Blocker(this.getApplicationRoot()).set({
            opacity: 0.7,
            color   : '#fff',
            keepBlockerActive: true
        });
        this.__blocker.getBlockerElement().setStyle('zIndex',10000000);
    },
    members : {
        __blocker : null,
        manifest: function(label){
            this.setVisibility('visible');
            this.fadeIn(500);
            this.setLabel(label);
            this.__blocker.block();
        },
        vanish: function(){
            this.setVisibility('excluded');
            this.fadeOut(10);
            this.__blocker.unblock();
        }
    }
});



( run in 3.629 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )