我怎么可以拆分为HPC网关附加组件的逻辑到单独的文件?即我想要做这样的事情:
Main.js
Ext.define('App.view.main.Main', {
extend: 'Ext.tab.Panel',
items: [{
title: 'Stuff',
xtype: 'stuff',
iconCls: 'x-fa fa-object-group'
}, {
title: 'About',
xtype: 'about',
iconCls: 'x-fa fa-info-circle',
}]
});
Stuff.js
Ext.define('App.widget.Stuff', {
extend: 'Ext.panel.Panel',
alias: 'widget.stuff',
html: '<h1>Stuff'
});
About.js
Ext.define('App.widget.About', {
extend: 'Ext.panel.Panel',
alias: 'widget.about',
html: '<h1>Version: x.y.z'
});
根据官方文档富士通为creating an addon,有没有你的逻辑分隔成多个文件,只是其中两个含有视图和控制器逻辑整体文件的例子:
appModule.js
Ext.define('desktop.addons.app_abcdef12.view.appModule', {
extend: 'desktop.core.utils.Module',
requires:[],
/**
* Create window
* @param taskBar the task bar
* @returns {desktop.core.view.utils.ModuleView} the module view
*/
createWindow: function (taskBar) {
var me = this;
return Ext.create('desktop.core.view.utils.ModuleView', {
title: me.title,
iconCls: me.iconCls,
stateId: 'app-module',
name: 'app-window',
taskBar: taskBar,
multipleView: false,
width: 320,
height: 150,
items:me.buildItems(),
buttons: [
]
});
},
/**
* Build items
* @returns {{xtype: string, layout: {type: string, align: string}, items: *[]}} items in json format
*/
buildItems:function(){
return {
xtype: 'panel',
layout: 'center',
items: [{
xtype: 'textfield',
name: 'value',
fieldLabel: desktop.core.utils.Symbols.getText('app_abcdef12.textfield.input')+" *",
allowBlank:false,
listeners: {
change: function(textfield, newValue){
var window = textfield.up('window');
window.fireEvent('textfieldChanged', textfield, newValue);
}
}
}]
};
}
});
appController.js
Ext.define('desktop.addons.app_abcdef12.controller.appController', {
extend: 'desktop.core.controller.abstract.AbstractToriiController',
requires: [],
control: {
'window[name=app-window]': {
textfieldChanged: 'performTextfieldChanged'
}
},
performTextfieldChanged: function (textfield, newValue) {
if (Ext.isEmpty(newValue)) {
textfield.up('window').down('button[name=save]').disable();
} else {
textfield.up('window').down('button[name=save]').enable();
}
}
});
当我试图创建类似desktop.addons.app_abcdef12.view.Stuff
与widget.stuff
的的xtype我坠毁的HPC实例,并不得不删除MongoDB中列出的插件,然后重新启动服务。这严重降低的时候,我可以使用试验和错误,找出工作的数量。
有人这样做过?
最终我没能得到任何使用xtype
工作,但我直接用Ext.create
什么时候:
appModule.js
buildItems:function(){
return {
xtype: 'tabpanel',
items: [
Ext.create('desktop.addons.app_abcdef12.view.Stuff'),
Ext.create('desktop.addons.app_abcdef12.view.About'),
]
};
}
Stuff.js
Ext.define('desktop.addons.app_abcdef12.view.Stuff', {
title: 'Stuff',
extend: 'Ext.panel.Panel',
iconCls: 'x-fa fa-id-card',
html: '<h1>Stuff'
});
About.js
Ext.define('desktop.addons.app_abcdef12.view.About', {
title: 'About',
extend: 'Ext.panel.Panel',
iconCls: 'x-fa fa-info',
html: '<h1>About'
});