Refactoring focus manager
This commit is contained in:
parent
ff39f7d581
commit
1949441c55
|
@ -58,7 +58,6 @@ Common.UI.FocusManager = new(function() {
|
||||||
}
|
}
|
||||||
fields.forEach(function(field) {
|
fields.forEach(function(field) {
|
||||||
if (field) {
|
if (field) {
|
||||||
// var item = (field.cmp && typeof field.selector == 'string') ? field : {cmp: field, selector: '.form-control'};
|
|
||||||
var item = {};
|
var item = {};
|
||||||
if (field.cmp && typeof field.selector == 'string')
|
if (field.cmp && typeof field.selector == 'string')
|
||||||
item = field;
|
item = field;
|
||||||
|
@ -68,6 +67,8 @@ Common.UI.FocusManager = new(function() {
|
||||||
item.selector = '.listview';
|
item.selector = '.listview';
|
||||||
else if (field instanceof Common.UI.CheckBox)
|
else if (field instanceof Common.UI.CheckBox)
|
||||||
item.selector = '.checkbox-indeterminate';
|
item.selector = '.checkbox-indeterminate';
|
||||||
|
else if (field instanceof Common.UI.TreeView)
|
||||||
|
item.selector = '.treeview';
|
||||||
else
|
else
|
||||||
item.selector = '.form-control';
|
item.selector = '.form-control';
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getFocusedComponents: function() {
|
getFocusedComponents: function() {
|
||||||
return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputDisplay, this.inputTip];
|
return [this.inputUrl, this.internalList, this.inputDisplay, this.inputTip];
|
||||||
},
|
},
|
||||||
|
|
||||||
ShowHideElem: function(value) {
|
ShowHideElem: function(value) {
|
||||||
|
|
|
@ -191,7 +191,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getFocusedComponents: function() {
|
getFocusedComponents: function() {
|
||||||
return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputDisplay, this.inputTip];
|
return [this.inputUrl, this.internalList, this.inputDisplay, this.inputTip];
|
||||||
},
|
},
|
||||||
|
|
||||||
setSettings: function (props) {
|
setSettings: function (props) {
|
||||||
|
|
|
@ -807,6 +807,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
|
||||||
});
|
});
|
||||||
this.chIconShow.on('change', function(field, newValue, oldValue, eOpts){
|
this.chIconShow.on('change', function(field, newValue, oldValue, eOpts){
|
||||||
});
|
});
|
||||||
|
Common.UI.FocusManager.add(this, this.chIconShow);
|
||||||
|
|
||||||
this.btnReverse = new Common.UI.Button({
|
this.btnReverse = new Common.UI.Button({
|
||||||
el: $('#format-rules-edit-btn-icon-reverse')
|
el: $('#format-rules-edit-btn-icon-reverse')
|
||||||
|
@ -916,6 +917,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
|
||||||
this.chFill.on('change', function(field, newValue, oldValue, eOpts){
|
this.chFill.on('change', function(field, newValue, oldValue, eOpts){
|
||||||
me.btnNegFill.setDisabled(field.getValue()=='checked');
|
me.btnNegFill.setDisabled(field.getValue()=='checked');
|
||||||
});
|
});
|
||||||
|
Common.UI.FocusManager.add(this, this.chFill);
|
||||||
|
|
||||||
// Border
|
// Border
|
||||||
this.cmbBorder = new Common.UI.ComboBox({
|
this.cmbBorder = new Common.UI.ComboBox({
|
||||||
|
@ -966,6 +968,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
|
||||||
this.chBorder.on('change', function(field, newValue, oldValue, eOpts){
|
this.chBorder.on('change', function(field, newValue, oldValue, eOpts){
|
||||||
me.btnNegBorder.setDisabled(field.getValue()=='checked');
|
me.btnNegBorder.setDisabled(field.getValue()=='checked');
|
||||||
});
|
});
|
||||||
|
Common.UI.FocusManager.add(this, this.chBorder);
|
||||||
|
|
||||||
// Axis
|
// Axis
|
||||||
this.cmbBarDirection = new Common.UI.ComboBox({
|
this.cmbBarDirection = new Common.UI.ComboBox({
|
||||||
|
@ -993,6 +996,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
|
||||||
el: $('#format-rules-edit-chk-show-bar'),
|
el: $('#format-rules-edit-chk-show-bar'),
|
||||||
labelText: this.textShowBar
|
labelText: this.textShowBar
|
||||||
});
|
});
|
||||||
|
Common.UI.FocusManager.add(this, this.chShowBar);
|
||||||
|
|
||||||
this.cmbAxisPos = new Common.UI.ComboBox({
|
this.cmbAxisPos = new Common.UI.ComboBox({
|
||||||
el : $('#format-rules-edit-combo-axis-pos'),
|
el : $('#format-rules-edit-combo-axis-pos'),
|
||||||
|
|
|
@ -213,7 +213,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
|
||||||
|
|
||||||
_setDefaults: function (props) {
|
_setDefaults: function (props) {
|
||||||
Common.UI.FocusManager.add(this, this.cmbScope);
|
Common.UI.FocusManager.add(this, this.cmbScope);
|
||||||
Common.UI.FocusManager.add(this, {cmp: this.rulesList, selector: '.listview'});
|
Common.UI.FocusManager.add(this, this.rulesList);
|
||||||
|
|
||||||
this.rulesList.on('item:add', _.bind(this.addControls, this));
|
this.rulesList.on('item:add', _.bind(this.addControls, this));
|
||||||
this.rulesList.on('item:change', _.bind(this.addControls, this));
|
this.rulesList.on('item:change', _.bind(this.addControls, this));
|
||||||
|
|
|
@ -125,7 +125,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getFocusedComponents: function() {
|
getFocusedComponents: function() {
|
||||||
return [this.inputSearch, this.cmbFuncGroup, {cmp: this.cmbListFunctions, selector: '.listview'}];
|
return [this.inputSearch, this.cmbFuncGroup, this.cmbListFunctions];
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultFocusableComponent: function () {
|
getDefaultFocusableComponent: function () {
|
||||||
|
|
|
@ -255,7 +255,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getFocusedComponents: function() {
|
getFocusedComponents: function() {
|
||||||
return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputRange, this.inputDisplay, this.inputTip];
|
return [this.inputUrl, this.internalList, this.inputRange, this.inputDisplay, this.inputTip];
|
||||||
},
|
},
|
||||||
|
|
||||||
setSettings: function(settings) {
|
setSettings: function(settings) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
},
|
},
|
||||||
|
|
||||||
getFocusedComponents: function() {
|
getFocusedComponents: function() {
|
||||||
return [ this.cmbFilter, {cmp: this.rangeList, selector: '.listview'} ];
|
return [ this.cmbFilter, this.rangeList ];
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultFocusableComponent: function () {
|
getDefaultFocusableComponent: function () {
|
||||||
|
|
Loading…
Reference in a new issue