關於EXT4.2的MVC開發

MVC模式java

//1.程序的入口。app.js
/**
 * 文件開始
 */
Ext.onReady(function(){
	//打開extjs的提示功能
	//Ext.quickTips.init();
	//啓動動態加載JS
//	Ext.Loader().setConfig({
//		enabled:true
//	});
	//開始執行程序
	Ext.application({
		name : "core",//命名空間,例如core.view.LoginWindow調用
		appFolder : "core/coreApp",//文檔寶
	//上面兩行代碼,定義了程序的命名空間。後面調用的時候用core.表明的就是core.coreAPP下的目錄
		launch:function(){
			Ext.create("Ext.container.Viewport",{
				layout : "fit",
				border : 0,
				//引入主佈局
				items : [{
					xtype:"mainviewlayout"
				}]
			});
		},
		加載主控制器
		controllers : ["core.app.controller.MainController"]
	});
});

//2,到所指定的控制器中
/**主控制器*/
Ext.define("core.app.controller.MainController",{
	extend : "Ext.app.Controller",//繼承EXT的控制器
	init : function(){
		var self = this;
	},
	views : ["core.app.view.TopView",
	         "core.app.view.WestView",
	         "core.app.view.CenterView",
	         "core.app.view.MainViewLayout" //加載對應的界面佈局
	         ],
	 store : [],
	 model : []
});
//3,對應的佈局
/**
 * 主程序界面佈局
 */
Ext.define("core.app.view.MainViewLayout",{
	extend : "Ext.panel.Panel",
	border : 0,
	layout : "border",
	alias : "widget.mainviewlayout",//別名,調用的時候直接用mainviewlayout
	width : 10,
	height :10,
	items : [{
		region : "north",
		xtype : "topview"
	},{
		region : "west",
		xtype : "westview"
	},{
		region : "center",
		layout : "fit",
		margins : "2 0 0 0",//上右下左
		items : [{
			xtype : "centerview"//加入中間的佈局
			//時間提醒的gridpanel
		}]
	}],
	initComponent : function(){
		this.callParent(arguments);
	}
});
相關文章
相關標籤/搜索