Use new focus manager

This commit is contained in:
Julia Radzhabova 2020-10-13 14:30:52 +03:00
parent 198c25e580
commit bf2c9918d3
28 changed files with 148 additions and 108 deletions

View file

@ -58,8 +58,7 @@ define([
}), }),
header: false, header: false,
width: 340, width: 340,
height: 272, height: 272
focusManager: true
}); });
this.hexRe = /\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/; this.hexRe = /\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/;
@ -144,11 +143,13 @@ define([
if (this.color!==undefined) if (this.color!==undefined)
this.setColor(this.color); this.setColor(this.color);
this.focusManager.add([this.spinR, this.spinG, this.spinB], '.form-control');
this.focusManager.add(this.textColor, 'input');
return this; return this;
}, },
getFocusedComponents: function() {
return [this.spinR, this.spinG, this.spinB, {cmp: this.textColor, selector: 'input'}];
},
onChangeColor: function(o, color) { onChangeColor: function(o, color) {
this.colorNew.css({'background-color' : color}); this.colorNew.css({'background-color' : color});

View file

@ -58,8 +58,7 @@ define([
style: 'min-width: 240px;', style: 'min-width: 240px;',
cls: 'modal-dlg', cls: 'modal-dlg',
split: false, split: false,
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -319,8 +318,10 @@ define([
el.width(Math.max($window.find('.numbering .text').width(), el.width())); el.width(Math.max($window.find('.numbering .text').width(), el.width()));
this.afterRender(); this.afterRender();
},
this.focusManager.add([this.cmbNumFormat, this.cmbBulletFormat, this.spnSize, this.spnStart], '.form-control'); getFocusedComponents: function() {
return [this.cmbNumFormat, this.cmbBulletFormat, this.spnSize, this.spnStart];
}, },
afterRender: function() { afterRender: function() {

View file

@ -49,8 +49,7 @@ define([
DE.Views.CaptionDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ DE.Views.CaptionDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 351, contentWidth: 351,
height: 350, height: 350
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -344,11 +343,13 @@ define([
this.lblExample = this.$window.find('#caption-label-example'); this.lblExample = this.$window.find('#caption-label-example');
this.focusManager.add([this.txtCaption, this.cmbPosition, this.cmbLabel, this.cmbNumbering, this.cmbChapter, this.cmbSeparator], '.form-control');
this.afterRender(); this.afterRender();
}, },
getFocusedComponents: function() {
return [this.txtCaption, this.cmbPosition, this.cmbLabel, this.cmbNumbering, this.cmbChapter, this.cmbSeparator];
},
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);

View file

@ -52,8 +52,7 @@ define([
header: true, header: true,
style: 'min-width: 214px;', style: 'min-width: 214px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -129,13 +128,16 @@ define([
var $window = this.getChild(); var $window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.focusManager.add([this.cmbRowCol, this.spnCount], '.form-control');
var me = this; var me = this;
setTimeout(function(){ setTimeout(function(){
me.spnCount.focus(); me.spnCount.focus();
}, 100); }, 100);
}, },
getFocusedComponents: function() {
return [this.cmbRowCol, this.spnCount];
},
_handleInput: function(state) { _handleInput: function(state) {
if (this.options.handler) { if (this.options.handler) {
this.options.handler.call(this, state, this.getSettings()); this.options.handler.call(this, state, this.getSettings());

View file

@ -50,8 +50,7 @@ define([
header: true, header: true,
style: 'min-width: 216px;', style: 'min-width: 216px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -130,12 +129,15 @@ define([
this.updateMetricUnit(); this.updateMetricUnit();
this.focusManager.add([this.spnColumns, this.spnSpacing], '.form-control');
setTimeout(function(){ setTimeout(function(){
me.spnColumns.focus(); me.spnColumns.focus();
}, 100); }, 100);
}, },
getFocusedComponents: function() {
return [this.spnColumns, this.spnSpacing];
},
_handleInput: function(state) { _handleInput: function(state) {
if (this.options.handler) { if (this.options.handler) {
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);

View file

@ -50,8 +50,7 @@ define([
width: 350, width: 350,
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function (options) { initialize : function (options) {
@ -175,13 +174,15 @@ define([
this._setDefaults(); this._setDefaults();
this.focusManager.add([this.cmbLang], '.form-control');
this.focusManager.add([this.listFormats], '.listview');
setTimeout(function(){ setTimeout(function(){
me.cmbLang.focus(); me.cmbLang.focus();
}, 100); }, 100);
}, },
getFocusedComponents: function() {
return [this.cmbLang, {cmp: this.listFormats, selector: '.listview'}];
},
_setDefaults: function () { _setDefaults: function () {
this.props = new Asc.CAscDateTime(); this.props = new Asc.CAscDateTime();
if (this.lang) { if (this.lang) {

View file

@ -58,8 +58,7 @@ define([
width: 350, width: 350,
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -183,10 +182,10 @@ define([
me.internalList.on('entervalue', _.bind(me.onPrimary, me)); me.internalList.on('entervalue', _.bind(me.onPrimary, me));
me.externalPanel = $window.find('#id-external-link'); me.externalPanel = $window.find('#id-external-link');
me.internalPanel = $window.find('#id-internal-link'); me.internalPanel = $window.find('#id-internal-link');
},
this.focusManager.add(this.inputUrl, '.form-control'); getFocusedComponents: function() {
this.focusManager.add(this.internalList, '.treeview'); return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputDisplay, this.inputTip];
this.focusManager.add([this.inputDisplay, this.inputTip], '.form-control');
}, },
ShowHideElem: function(value) { ShowHideElem: function(value) {

View file

@ -50,8 +50,7 @@ define([
options: { options: {
contentWidth: 300, contentWidth: 300,
height: 380, height: 380,
buttons: null, buttons: null
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -283,10 +282,13 @@ define([
this.afterRender(); this.afterRender();
}, },
getFocusedComponents: function() {
return [this.cmbFootnote, this.cmbEndnote, this.cmbFormat, this.spnStart, this.cmbNumbering, this.txtCustom, this.cmbApply];
},
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);
this.focusManager.add([this.cmbFootnote, this.cmbEndnote, this.cmbFormat, this.spnStart, this.cmbNumbering, this.txtCustom, this.cmbApply], '.form-control');
var me = this; var me = this;
setTimeout(function(){ setTimeout(function(){
me.cmbFormat.focus(); me.cmbFormat.focus();

View file

@ -50,8 +50,7 @@ define([
style: 'min-width: 404px;', style: 'min-width: 404px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-page-margins', id: 'window-page-margins',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -308,13 +307,16 @@ define([
this.updateMetricUnit(); this.updateMetricUnit();
this.focusManager.add([this.spnTop, this.spnBottom, this.spnLeft, this.spnRight, this.spnGutter, this.cmbGutterPosition, this.cmbOrientation, this.cmbMultiplePages], '.form-control');
var me = this; var me = this;
setTimeout(function(){ setTimeout(function(){
me.spnTop.focus(); me.spnTop.focus();
}, 100); }, 100);
}, },
getFocusedComponents: function() {
return [this.spnTop, this.spnBottom, this.spnLeft, this.spnRight, this.spnGutter, this.cmbGutterPosition, this.cmbOrientation, this.cmbMultiplePages];
},
_handleInput: function(state) { _handleInput: function(state) {
if (this.options.handler) { if (this.options.handler) {
if (state == 'ok') { if (state == 'ok') {

View file

@ -50,8 +50,7 @@ define([
style: 'min-width: 216px;', style: 'min-width: 216px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-page-size', id: 'window-page-size',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -169,13 +168,16 @@ define([
this.updateMetricUnit(); this.updateMetricUnit();
this.focusManager.add([this.cmbPreset, this.spnWidth, this.spnHeight], '.form-control');
var me = this; var me = this;
setTimeout(function(){ setTimeout(function(){
me.cmbPreset.focus(); me.cmbPreset.focus();
}, 100); }, 100);
}, },
getFocusedComponents: function() {
return [this.cmbPreset, this.spnWidth, this.spnHeight];
},
_handleInput: function(state) { _handleInput: function(state) {
if (this.options.handler) { if (this.options.handler) {
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);

View file

@ -48,8 +48,7 @@ define([
height: 196, height: 196,
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -110,8 +109,10 @@ define([
disabled : (this.options.formats.length==0) disabled : (this.options.formats.length==0)
}); });
this.cmbNextStyle.setValue(-1); this.cmbNextStyle.setValue(-1);
},
this.focusManager.add([this.inputTitle, this.cmbNextStyle], '.form-control'); getFocusedComponents: function() {
return [this.inputTitle, this.cmbNextStyle];
}, },
show: function() { show: function() {

View file

@ -48,8 +48,7 @@ define([
width: 300, width: 300,
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -164,8 +163,10 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.afterRender(); this.afterRender();
},
this.focusManager.add([this.inputFormula, this.cmbFormat, this.cmbFunction, this.cmbBookmark], '.form-control'); getFocusedComponents: function() {
return [this.inputFormula, this.cmbFormat, this.cmbFunction, this.cmbBookmark];
}, },
onSelectItem: function(picker, item, record, e){ onSelectItem: function(picker, item, record, e){

View file

@ -50,8 +50,7 @@ define([
width: 350, width: 350,
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function (options) { initialize : function (options) {
@ -175,12 +174,15 @@ define([
this._setDefaults(); this._setDefaults();
this.focusManager.add([this.cmbLang, this.listFormats], '.form-control');
setTimeout(function(){ setTimeout(function(){
me.cmbLang.focus(); me.cmbLang.focus();
}, 100); }, 100);
}, },
getFocusedComponents: function() {
return [this.cmbLang, {cmp: this.listFormats, selector: '.listview'}];
},
_setDefaults: function () { _setDefaults: function () {
this.props = new AscCommonSlide.CAscDateTime(); this.props = new AscCommonSlide.CAscDateTime();
if (this.lang) { if (this.lang) {

View file

@ -60,8 +60,7 @@ define([
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-hyperlink-settings', id: 'window-hyperlink-settings',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -186,10 +185,10 @@ define([
me.internalList.on('entervalue', _.bind(me.onPrimary, me)); me.internalList.on('entervalue', _.bind(me.onPrimary, me));
me.externalPanel = $window.find('#id-external-link'); me.externalPanel = $window.find('#id-external-link');
me.internalPanel = $window.find('#id-internal-link'); me.internalPanel = $window.find('#id-internal-link');
},
this.focusManager.add(this.inputUrl, '.form-control'); getFocusedComponents: function() {
this.focusManager.add(this.internalList, '.treeview'); return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputDisplay, this.inputTip];
this.focusManager.add([this.inputDisplay, this.inputTip], '.form-control');
}, },
setSettings: function (props) { setSettings: function (props) {

View file

@ -50,8 +50,7 @@ define([
style: 'min-width: 250px;', style: 'min-width: 250px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-slide-size-settings', id: 'window-slide-size-settings',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -204,13 +203,16 @@ define([
this.updateMetricUnit(); this.updateMetricUnit();
this.focusManager.add([this.cmbSlideSize, this.spnWidth, this.spnHeight, this.cmbSlideOrientation], '.form-control');
var me = this; var me = this;
setTimeout(function(){ setTimeout(function(){
me.cmbSlideSize.focus(); me.cmbSlideSize.focus();
}, 100); }, 100);
}, },
getFocusedComponents: function() {
return [this.cmbSlideSize, this.spnWidth, this.spnHeight, this.cmbSlideOrientation];
},
_handleInput: function(state) { _handleInput: function(state) {
if (this.options.handler) { if (this.options.handler) {
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);

View file

@ -47,8 +47,7 @@ define([
options: { options: {
width: 330, width: 330,
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -96,11 +95,13 @@ define([
var $window = this.getChild(); var $window = this.getChild();
$window.find('.btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.btn').on('click', _.bind(this.onBtnClick, this));
this.focusManager.add([this.inputDecimalSeparator, this.inputThousandsSeparator], '.form-control');
this.afterRender(); this.afterRender();
}, },
getFocusedComponents: function() {
return [this.inputDecimalSeparator, this.inputThousandsSeparator];
},
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);
}, },

View file

@ -61,8 +61,7 @@ define([
cls : 'filter-dlg', cls : 'filter-dlg',
contentTemplate : '', contentTemplate : '',
title : t.txtTitle, title : t.txtTitle,
items : [], items : []
focusManager: true
}, options); }, options);
this.template = options.template || [ this.template = options.template || [
@ -188,9 +187,12 @@ define([
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.loadDefaults(); this.loadDefaults();
this.focusManager.add([this.cmbCondition1, this.cmbValue1, this.cmbCondition2, this.cmbValue2], '.form-control');
}, },
getFocusedComponents: function() {
return [this.cmbCondition1, this.cmbValue1, this.cmbCondition2, this.cmbValue2];
},
show: function () { show: function () {
Common.UI.Window.prototype.show.call(this); Common.UI.Window.prototype.show.call(this);
@ -321,8 +323,7 @@ define([
contentTemplate : '', contentTemplate : '',
title : t.txtTitle, title : t.txtTitle,
items : [], items : [],
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, options); }, options);
this.template = options.template || [ this.template = options.template || [
@ -411,8 +412,12 @@ define([
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.loadDefaults(); this.loadDefaults();
this.focusManager.add([this.cmbType, this.spnCount, this.cmbItem, this.cmbFields], '.form-control');
}, },
getFocusedComponents: function() {
return [this.cmbType, this.spnCount, this.cmbItem, this.cmbFields];
},
show: function () { show: function () {
Common.UI.Window.prototype.show.call(this); Common.UI.Window.prototype.show.call(this);
@ -530,8 +535,7 @@ define([
cls : 'filter-dlg', cls : 'filter-dlg',
contentTemplate : '', contentTemplate : '',
title : (options.type=='label') ? t.txtTitleLabel : t.txtTitleValue, title : (options.type=='label') ? t.txtTitleLabel : t.txtTitleValue,
items : [], items : []
focusManager: true
}, options); }, options);
this.api = options.api; this.api = options.api;
@ -651,8 +655,12 @@ define([
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.loadDefaults(); this.loadDefaults();
this.focusManager.add([this.cmbFields, this.cmbCondition1, this.inputValue, this.inputValue2], '.form-control');
}, },
getFocusedComponents: function() {
return [this.cmbFields, this.cmbCondition1, this.inputValue, this.inputValue2];
},
show: function () { show: function () {
Common.UI.Window.prototype.show.call(this); Common.UI.Window.prototype.show.call(this);

View file

@ -52,8 +52,7 @@ define([
type: 0, // 0 - category, 1 - series type: 0, // 0 - category, 1 - series
width : 350, width : 350,
cls : 'modal-dlg', cls : 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -172,12 +171,15 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.focusManager.add([me.inputRange1, me.inputRange2, me.inputRange3], '.form-control');
setTimeout(function(){ setTimeout(function(){
me.inputRange1.cmpEl.find('input').focus(); me.inputRange1.cmpEl.find('input').focus();
}, 10); }, 10);
}, },
getFocusedComponents: function() {
return [this.inputRange1, this.inputRange2, this.inputRange3];
},
onPrimary: function() { onPrimary: function() {
this._handleInput('ok'); this._handleInput('ok');
return false; return false;

View file

@ -48,8 +48,7 @@ define([
SSE.Views.CreatePivotDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ SSE.Views.CreatePivotDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 310, contentWidth: 310,
height: 250, height: 250
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -162,11 +161,13 @@ define([
me.txtDestRange.cmpEl.find('input').focus(); me.txtDestRange.cmpEl.find('input').focus();
}); });
this.focusManager.add([this.txtSourceRange, this.txtDestRange], '.form-control');
this.afterRender(); this.afterRender();
}, },
getFocusedComponents: function() {
return [this.txtSourceRange, this.txtDestRange];
},
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);

View file

@ -49,8 +49,7 @@ define([
SSE.Views.FormatSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ SSE.Views.FormatSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 284, contentWidth: 284,
height: 340, height: 340
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -249,11 +248,13 @@ define([
this.lblExample = this.$window.find('#format-settings-label-example'); this.lblExample = this.$window.find('#format-settings-label-example');
this.focusManager.add([this.cmbFormat, this.spnDecimal, this.cmbSymbols, this.cmbNegative, this.cmbType, this.cmbCode], '.form-control');
this.afterRender(); this.afterRender();
}, },
getFocusedComponents: function() {
return [this.cmbFormat, this.spnDecimal, this.cmbSymbols, this.cmbNegative, this.cmbType, this.cmbCode];
},
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);
var cmp = this.cmbFormat; var cmp = this.cmbFormat;

View file

@ -63,8 +63,7 @@ define([
contentTemplate : '', contentTemplate : '',
title : t.txtTitle, title : t.txtTitle,
items : [], items : [],
buttons: null, buttons: null
focusManager: true
}, options); }, options);
this.template = options.template || [ this.template = options.template || [
@ -115,7 +114,6 @@ define([
} }
me.filterFormulas(); me.filterFormulas();
}); });
this.focusManager.add(this.inputSearch._input);
this.btnOk = new Common.UI.Button({ this.btnOk = new Common.UI.Button({
el: $('#formula-dlg-btn-ok') el: $('#formula-dlg-btn-ok')
@ -125,6 +123,11 @@ define([
this.descLabel = $('#formula-dlg-desc'); this.descLabel = $('#formula-dlg-desc');
this.fillFormulasGroups(); this.fillFormulasGroups();
}, },
getFocusedComponents: function() {
return [this.inputSearch, this.cmbFuncGroup, {cmp: this.cmbListFunctions, selector: '.listview'}];
},
show: function (group) { show: function (group) {
if (this.$window) { if (this.$window) {
var main_width, main_height, top, left, win_height = this.initConfig.height; var main_width, main_height, top, left, win_height = this.initConfig.height;
@ -249,7 +252,6 @@ define([
takeFocusOnClose: true takeFocusOnClose: true
}); });
this.cmbFuncGroup.on('selected', _.bind(this.onSelectGroup, this)); this.cmbFuncGroup.on('selected', _.bind(this.onSelectGroup, this));
this.focusManager.add(this.cmbFuncGroup, '.form-control');
} else { } else {
this.cmbFuncGroup.setData(groupsListItems); this.cmbFuncGroup.setData(groupsListItems);
} }
@ -280,8 +282,6 @@ define([
this.cmbListFunctions.onKeyDown = _.bind(this.onKeyDown, this.cmbListFunctions); this.cmbListFunctions.onKeyDown = _.bind(this.onKeyDown, this.cmbListFunctions);
this.cmbListFunctions.scrollToRecord = _.bind(this.onScrollToRecordCustom, this.cmbListFunctions); this.cmbListFunctions.scrollToRecord = _.bind(this.onScrollToRecordCustom, this.cmbListFunctions);
this.onUpdateFocus(); this.onUpdateFocus();
this.focusManager.add(this.cmbListFunctions, '.listview');
} }
if (this.functions) { if (this.functions) {

View file

@ -55,8 +55,7 @@ define([
width : 350, width : 350,
style : 'min-width: 230px;', style : 'min-width: 230px;',
cls : 'modal-dlg', cls : 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -250,10 +249,10 @@ define([
me.externalPanel = $window.find('#id-external-link'); me.externalPanel = $window.find('#id-external-link');
me.internalPanel = $window.find('#id-internal-link'); me.internalPanel = $window.find('#id-internal-link');
},
this.focusManager.add(this.inputUrl, '.form-control'); getFocusedComponents: function() {
this.focusManager.add(this.internalList, '.treeview'); return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputRange, this.inputDisplay, this.inputTip];
this.focusManager.add([this.inputRange, this.inputDisplay, this.inputTip], '.form-control');
}, },
show: function() { show: function() {

View file

@ -52,8 +52,7 @@ define([
options: { options: {
alias: 'NamedRangeEditDlg', alias: 'NamedRangeEditDlg',
contentWidth: 380, contentWidth: 380,
height: 250, height: 250
focusManager: true
}, },
initialize: function (options) { initialize: function (options) {
@ -173,11 +172,13 @@ define([
}); });
this.txtDataRange.on('button:click', _.bind(this.onSelectData, this)); this.txtDataRange.on('button:click', _.bind(this.onSelectData, this));
this.focusManager.add([this.inputName, this.cmbScope, this.txtDataRange], '.form-control');
this.afterRender(); this.afterRender();
}, },
getFocusedComponents: function() {
return [this.inputName, this.cmbScope, this.txtDataRange];
},
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);
this.setTitle((this.isEdit) ? this.txtTitleEdit : this.txtTitleNew); this.setTitle((this.isEdit) ? this.txtTitleEdit : this.txtTitleNew);

View file

@ -50,8 +50,7 @@ define([
style: 'min-width: 216px;', style: 'min-width: 216px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-page-margins', id: 'window-page-margins',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -147,7 +146,6 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
$window.find('input').on('keypress', _.bind(this.onKeyPress, this)); $window.find('input').on('keypress', _.bind(this.onKeyPress, this));
this.focusManager.add(this.spinners, '.form-control');
var cmp = this.spnTop; var cmp = this.spnTop;
setTimeout(function(){ setTimeout(function(){
(cmp.$el || $(cmp.el)).find('.form-control').focus(); (cmp.$el || $(cmp.el)).find('.form-control').focus();
@ -156,6 +154,10 @@ define([
this.updateMetricUnit(); this.updateMetricUnit();
}, },
getFocusedComponents: function() {
return this.spinners;
},
_handleInput: function(state) { _handleInput: function(state) {
if (this.options.handler) if (this.options.handler)
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);

View file

@ -52,8 +52,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
alias: 'PrintSettings', alias: 'PrintSettings',
contentWidth: 280, contentWidth: 280,
height: 575, height: 575,
buttons: null, buttons: null
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -278,14 +277,17 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
this.extended = (value!==null && parseInt(value)==0); this.extended = (value!==null && parseInt(value)==0);
this.handlerShowDetails(this.btnHide); this.handlerShowDetails(this.btnHide);
this.focusManager.add([this.cmbRange, this.cmbSheet, this.cmbPaperSize, this.cmbPaperOrientation, this.cmbLayout, this.txtRangeTop, this.txtRangeLeft,
this.spnMarginTop, this.spnMarginBottom, this.spnMarginLeft, this.spnMarginRight], '.form-control');
var me = this; var me = this;
setTimeout(function(){ setTimeout(function(){
me.cmbRange.focus(); me.cmbRange.focus();
},100); },100);
}, },
getFocusedComponents: function() {
return [this.cmbRange, this.cmbSheet, this.cmbPaperSize, this.cmbPaperOrientation, this.cmbLayout, this.txtRangeTop, this.txtRangeLeft,
this.spnMarginTop, this.spnMarginBottom, this.spnMarginLeft, this.spnMarginRight];
},
addCustomScale: function (add) { addCustomScale: function (add) {
if (add) { if (add) {
this.cmbLayout.setData([ this.cmbLayout.setData([

View file

@ -50,8 +50,7 @@ define([
style: 'min-width: 216px;', style: 'min-width: 216px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-page-margins', id: 'window-page-margins',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -186,12 +185,15 @@ define([
this.setSettings(); this.setSettings();
this.focusManager.add([this.txtRangeTop, this.txtRangeLeft], '.form-control');
setTimeout(function(){ setTimeout(function(){
me.txtRangeTop.focus(); me.txtRangeTop.focus();
},100); },100);
}, },
getFocusedComponents: function() {
return [this.txtRangeTop, this.txtRangeLeft];
},
isRangeValid: function() { isRangeValid: function() {
if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, this.txtRangeTop.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) { if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, this.txtRangeTop.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) {
this.txtRangeTop.focus(); this.txtRangeTop.focus();

View file

@ -50,8 +50,7 @@ define([
header: true, header: true,
style: 'min-width: 215px;', style: 'min-width: 215px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'], buttons: ['ok', 'cancel']
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -166,8 +165,10 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.afterRender(); this.afterRender();
},
this.focusManager.add([this.cmbScaleWidth, this.cmbScaleHeight, this.spnScale], '.form-control'); getFocusedComponents: function() {
return [this.cmbScaleWidth, this.cmbScaleHeight, this.spnScale];
}, },
afterRender: function() { afterRender: function() {

View file

@ -49,8 +49,7 @@ define([
SSE.Views.ValueFieldSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ SSE.Views.ValueFieldSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 284, contentWidth: 284,
height: 220, height: 220
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -194,12 +193,15 @@ define([
this.afterRender(); this.afterRender();
this.focusManager.add([this.inputCustomName, this.cmbSummarize], '.form-control');
setTimeout(function(){ setTimeout(function(){
me.inputCustomName.focus(); me.inputCustomName.focus();
},100); },100);
}, },
getFocusedComponents: function() {
return [this.inputCustomName, this.cmbSummarize];
},
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);
}, },