Commit 14bd078b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update GridWithFilter, WithUrlSelector and MathJax to always mask the viewport.

parent 719c0684
......@@ -5,14 +5,14 @@
* and the second one the {@link Dbui.grid.Filter grid filter}.
*
*/
Ext.define('Dbui.panel.GridWithFilter', {
Ext.define("Dbui.panel.GridWithFilter", {
extend: 'Dbui.panel.BaseWithSelector',
alias: 'widget.xgridwithfilter',
extend: "Dbui.panel.BaseWithSelector",
alias: "widget.xgridwithfilter",
requires: [
'Dbui.grid.Filter',
'Dbui.grid.Panel',
'Ext.LoadMask'
"Dbui.grid.Filter",
"Dbui.grid.Panel",
"Ext.LoadMask"
],
// private short cuts
......@@ -20,7 +20,7 @@ Ext.define('Dbui.panel.GridWithFilter', {
grid: null,
// Private properties for internationalization
textLoad: 'Loading...',
textLoad: "Loading...",
// jshint strict: false
......@@ -33,21 +33,21 @@ Ext.define('Dbui.panel.GridWithFilter', {
me.callParent(arguments);
// bind the filter to the grid
me.filter = me.selectorPanel.child('xgridfilter');
me.grid = me.mainPanel.child('xgrid');
me.filter = me.selectorPanel.child("xgridfilter");
me.grid = me.mainPanel.child("xgrid");
me.filter.bind(me.grid);
// connect buttons
me.goButton.hide();
me.resetButton.on('click', me.filter.onReset, me.filter);
me.resetButton.on("click", me.filter.onReset, me.filter);
// collapse the selectorPanel
me.selectorPanel.collapsed = true;
// Mask the GridFilter during loading
me.grid.getView().loadMask = Ext.create('Ext.LoadMask', {
me.grid.getView().loadMask = Ext.create("Ext.LoadMask", {
msg: me.textLoad,
target: me,
target: me.up("xviewport"),
store: me.grid.store
});
},
......@@ -57,7 +57,7 @@ Ext.define('Dbui.panel.GridWithFilter', {
var me = this;
me.resetButton.un('click', me.filter.onReset, me.filter);
me.resetButton.un("click", me.filter.onReset, me.filter);
me.callParent(arguments);
}
......
......@@ -21,10 +21,10 @@
* string, by the server.
*
*/
Ext.define('Dbui.panel.WithUrlSelector', {
Ext.define("Dbui.panel.WithUrlSelector", {
extend: 'Dbui.panel.BaseWithSelector',
alias: 'widget.xpanelwithurlselector',
extend: "Dbui.panel.BaseWithSelector",
alias: "widget.xpanelwithurlselector",
/**
* @cfg {Object} baseParams
......@@ -52,7 +52,7 @@ Ext.define('Dbui.panel.WithUrlSelector', {
* the property #Dbui.extToURI.
*
*/
defaultURI: 'data:text/plain;charset=utf-8',
defaultURI: "data:text/plain;charset=utf-8",
/**
* @cfg {String}
......@@ -79,9 +79,9 @@ Ext.define('Dbui.panel.WithUrlSelector', {
// Private properties for internationalization
textChrome: "The size of the file is too big for Chrome.<br> A wait out is to use FireFox!",
textLoad: 'Loading...',
textProgressBar: 'Preparing your file, please wait...',
textWarning: 'Warning',
textLoad: "Loading...",
textProgressBar: "Preparing your file, please wait...",
textWarning: "Warning",
// jshint strict: false
......@@ -97,13 +97,13 @@ Ext.define('Dbui.panel.WithUrlSelector', {
}
// handlers for button
me.goButton.on('click', me.onGo, me);
me.resetButton.on('click', me.onReset, me);
me.goButton.on("click", me.onGo, me);
me.resetButton.on("click", me.onReset, me);
// mask for the viewport
me.mask = Ext.create('Ext.LoadMask', {
// mask the viewport
me.mask = Ext.create("Ext.LoadMask", {
msg: me.textProgressBar,
target: Ext.ComponentQuery.query('xviewport')[0]
target: me.up("xviewport")
});
},
......@@ -112,8 +112,8 @@ Ext.define('Dbui.panel.WithUrlSelector', {
var me = this;
me.goButton.un('click', me.onGo, me);
me.resetButton.un('click', me.onReset, me);
me.goButton.un("click", me.onGo, me);
me.resetButton.un("click", me.onReset, me);
me.callParent(arguments);
},
......@@ -190,15 +190,15 @@ Ext.define('Dbui.panel.WithUrlSelector', {
url.http = me.baseUrl;
if (url.ctrl !== undefined) {
url.http = url.http + '/' + url.ctrl;
url.http = url.http + "/" + url.ctrl;
}
if (url.func !== undefined) {
url.http = url.http + '/' + url.func;
url.http = url.http + "/" + url.func;
}
if (url.ext !== undefined) {
url.http = url.http + '.' + url.ext;
url.http = url.http + "." + url.ext;
}
return url;
......@@ -244,12 +244,12 @@ Ext.define('Dbui.panel.WithUrlSelector', {
// activate the auto scrolling
me.mainPanel.setAutoScroll(true);
if (!extension || extension.indexOf('htm') !== -1) {
if (!extension || extension.indexOf("htm") !== -1) {
// load the HTML content in the main panel masking the viewport
mask = {
msg: me.textLoad,
target: me.up('xviewport')
target: me.up("xviewport")
};
me.mainPanel.getLoader().load({
......
......@@ -10,11 +10,11 @@
* @since 0.6.0.10
*
*/
Ext.define('Dbui.plugin.MathJax', {
Ext.define("Dbui.plugin.MathJax", {
extend: 'Ext.AbstractPlugin',
alias: 'plugin.pMathJax',
uses: ['Ext.LoadMask'],
extend: "Ext.AbstractPlugin",
alias: "plugin.pMathJax",
uses: ["Ext.LoadMask"],
/**
* @property {Boolean}
......@@ -28,7 +28,7 @@ Ext.define('Dbui.plugin.MathJax', {
targetType: undefined,
// Private attributes for internationalization
textMask: 'Processing symbols',
textMask: "Processing symbols",
/**
* Initialize the plugin
......@@ -52,34 +52,34 @@ Ext.define('Dbui.plugin.MathJax', {
// determine the target component to be processed
switch (xtype) {
case 'grid':
case "grid":
me.target = cmp.getView();
me.targetType = 'grid';
me.targetType = "grid";
break;
case 'panel':
case "panel":
me.target = cmp;
me.targetType = 'panel';
me.targetType = "panel";
break;
case 'xpanelwithurlselector':
case "xpanelwithurlselector":
me.target = cmp.mainPanel;
me.targetType = 'panel';
me.targetType = "panel";
break;
case 'xpanelwithselector':
case "xpanelwithselector":
me.target = cmp.mainPanel;
me.targetType = 'panel';
me.targetType = "panel";
break;
case 'xgrid':
case "xgrid":
me.target = cmp.getView();
me.targetType = 'grid';
me.targetType = "grid";
break;
case 'xgridwithfilter':
case "xgridwithfilter":
me.target = cmp.grid.getView();
me.targetType = 'grid';
me.targetType = "grid";
break;
}
......@@ -88,27 +88,27 @@ Ext.define('Dbui.plugin.MathJax', {
// listener to trigger the MathJax processing
switch (me.targetType) {
case 'grid':
case "grid":
//
// process equation each time the view is refreshed.
// This happen when the view is render for the first time or
// when page is chnages
//
me.target.on('refresh', me.onProcessMath, me);
me.target.on("refresh", me.onProcessMath, me);
//
// process equation each time a record is add, update or delete
//
me.target.on('itemadd', me.onProcessMath, me);
me.target.on('itemupdate', me.onProcessMath, me);
me.target.on('itemremove', me.onProcessMath, me);
me.target.on("itemadd", me.onProcessMath, me);
me.target.on("itemupdate", me.onProcessMath, me);
me.target.on("itemremove", me.onProcessMath, me);
break;
case 'panel':
case "panel":
//
// process equation when the panel is loaded
//
me.target.getLoader().on('load', me.onProcessMath, me);
me.target.getLoader().on("load", me.onProcessMath, me);
break;
}
},
......@@ -122,15 +122,15 @@ Ext.define('Dbui.plugin.MathJax', {
var me = this;
switch (me.targetType) {
case 'grid':
me.target.un('itemadd', me.onProcessMath, me);
me.target.un('itemupdate', me.onProcessMath, me);
me.target.un('itemremove', me.onProcessMath, me);
me.target.un('refresh', me.onProcessMath, me);
case "grid":
me.target.un("itemadd", me.onProcessMath, me);
me.target.un("itemupdate", me.onProcessMath, me);
me.target.un("itemremove", me.onProcessMath, me);
me.target.un("refresh", me.onProcessMath, me);
break;
case 'panel':
me.target.getLoader().un('load', me.onProcessMath, me);
case "panel":
me.target.getLoader().un("load", me.onProcessMath, me);
break;
}
},
......@@ -145,38 +145,24 @@ Ext.define('Dbui.plugin.MathJax', {
var me = this,
cmp = me.getCmp(),
loadMask,
parent,
targetMask = cmp;
viewport = cmp.up("xviewport");
if (!me.activated) {
return;
}
// parent of a grid can be gridWithFilter.
// In that case the gridWithFilter should be masked
//
// NOTE: the parent is not define when the plugin is initialized.
//
if (me.targetType === 'grid') {
parent = cmp.up('xgridwithfilter');
if (parent) {
targetMask = parent;
}
// protection -- in some case the viewport is not found by cmp.up
if (viewport === undefined) {
viewport = Ext.ComponentQuery.query("xviewport")[0];
}
// mask the component
loadMask = Ext.create('Ext.LoadMask', {
target: targetMask,
msg: me.textMask
});
loadMask.show();
// mask the viewport
viewport.mask(me.textMask);
// MatJax processing followed by the unmasking
MathJax.Hub.Queue(["Typeset", MathJax.Hub, me.targetDomEl]);
MathJax.Hub.Queue([function (mask) {
mask.hide();
}, loadMask]);
MathJax.Hub.Queue([function () {
viewport.unmask();
}]);
}
});
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment