]> git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/overrides/app/Application.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / overrides / app / Application.js
1 /**
2 *
3 */
4 Ext.define('Ext.overrides.app.Application', {
5 override: 'Ext.app.Application',
6 uses: [
7 'Ext.tip.QuickTipManager'
8 ],
9
10 // @cmd-auto-dependency {aliasPrefix: "view.", mvc: true, requires: ["Ext.plugin.Viewport"]}
11 /**
12 * @cfg {Boolean/String} [autoCreateViewport=false]
13 * @deprecated 5.1 Instead use {@link #mainView}
14 * @member Ext.app.Application
15 */
16 autoCreateViewport: false,
17
18 config: {
19 /**
20 * @cfg {Boolean} enableQuickTips
21 * True to automatically set up Ext.tip.QuickTip support.
22 * @member Ext.app.Application
23 */
24 enableQuickTips: true
25 },
26
27 applyMainView: function(mainView) {
28 var view, proto, config, plugins;
29
30 if (typeof mainView === 'string') {
31 view = this.getView(mainView);
32 } else {
33 view = Ext.ClassManager.getByConfig(mainView);
34 }
35 proto = view.prototype;
36
37 if (!proto.isViewport) {
38 plugins = proto.plugins;
39 // Need to copy over any plugins defined on the prototype.
40 plugins = ['viewport'].concat(plugins ? Ext.Array.from(plugins, true) : []);
41 config = {
42 plugins: plugins
43 };
44 }
45
46 return view.create(config);
47 },
48
49 getDependencies: function(cls, data, requires) {
50 var Controller = Ext.app.Controller,
51 proto = cls.prototype,
52 namespace = data.$namespace,
53 viewportClass = data.autoCreateViewport;
54
55 if (viewportClass) {
56 //<debug>
57 if (!namespace) {
58 Ext.raise("[Ext.app.Application] Can't resolve namespace for " +
59 data.$className + ", did you forget to specify 'name' property?");
60 }
61 //</debug>
62
63 if (viewportClass === true) {
64 viewportClass = 'Viewport';
65 } else {
66 requires.push('Ext.plugin.Viewport');
67 }
68
69 Controller.processDependencies(proto, requires, namespace, 'view', viewportClass);
70 }
71 },
72
73 onBeforeLaunch: function() {
74 var me = this,
75 autoCreateViewport = me.autoCreateViewport;
76
77 if (me.getEnableQuickTips()) {
78 me.initQuickTips();
79 }
80
81 if(autoCreateViewport) {
82 me.initViewport();
83 }
84
85 this.callParent(arguments);
86 },
87
88 getViewportName: function () {
89 var name = null,
90 autoCreate = this.autoCreateViewport;
91
92 if (autoCreate) {
93 name = (autoCreate === true) ? 'Viewport' : autoCreate;
94 }
95
96 return name;
97 },
98
99 initViewport: function() {
100 this.setMainView(this.getViewportName());
101 },
102
103 initQuickTips: function() {
104 Ext.tip.QuickTipManager.init();
105 }
106 });