Permalink
Browse files

Initial commit of demo

  • Loading branch information...
0 parents commit e28887af4cad8dffc0421a68f6ff19da5ff84f3e @mitchellsimoens committed Jun 23, 2011
Showing 1,325 changed files with 285,636 additions and 0 deletions.
23 app.js
@@ -0,0 +1,23 @@
+Ext.Loader.setConfig({
+ enabled : true,
+ paths : {
+ 'Ext.ux' : 'assets/ux',
+ 'Ext.app' : 'assets/ux/app'
+ }
+});
+
+Ext.state.Manager.setProvider(
+ new Ext.state.CookieProvider({
+ expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
+ })
+);
+
+Ext.create('Ext.app.Application', {
+ name : 'JS',
+
+ autoCreateViewport : true,
+
+ controllers: [
+ 'JS.controller.Main'
+ ]
+});
@@ -0,0 +1,47 @@
+Ext.define('JS.controller.Main', {
+ extend : 'Ext.app.Controller',
+
+ init: function() {
+ var me = this;
+
+ me.control({
+ 'mainview button' : {
+ click : me.handleButtonClick
+ }
+ });
+ },
+
+ handleButtonClick: function(btn) {
+ var me = this,
+ app = me.application,
+ subapp = new Ext.app.SubApplication({
+ app : app,
+ id : 'JSApp.test.view.Main',
+ loadMask : true,
+ loadingText : 'Loading Test...',
+
+ controllers : [
+ 'JSApp.test.controller.Main'
+ ],
+
+ dependencies : {
+ css : [
+ 'apps/test/css/main.css'
+ ],
+ js : [
+ 'apps/test/controller/Main.js',
+ 'apps/test/view/Main.js'
+ ]
+ },
+
+ launch: function() {
+ var win = Ext.create('JSApp.test.view.Main', {
+ app : me
+ });
+ win.show();
+
+ return win;
+ }
+ });
+ }
+});
@@ -0,0 +1,30 @@
+Ext.define('JS.view.Main', {
+ extend : 'Ext.Panel',
+ alias : 'widget.mainview',
+
+ initComponent: function() {
+ var me = this;
+
+ Ext.apply(me, {
+ dockedItems : me.buildDocks(),
+ frame : true,
+ html : 'Test Sub App Loading',
+ });
+
+ me.callParent();
+ },
+
+ buildDocks: function() {
+ return [
+ {
+ xtype : 'toolbar',
+ dock : 'top',
+ items : [
+ {
+ text : 'Launch Sub App 1'
+ }
+ ]
+ }
+ ];
+ }
+});
@@ -0,0 +1,15 @@
+Ext.define('JS.view.Viewport', {
+ extend : 'Ext.container.Viewport',
+
+ uses : [
+ 'Ext.app.SubApplication',
+
+ 'JS.view.Main'
+ ],
+
+ layout : 'fit',
+
+ items : {
+ xtype : 'mainview'
+ }
+});
@@ -0,0 +1,20 @@
+Ext.define('JSApp.test.controller.Main', {
+ extend : 'Ext.app.Controller',
+
+ stores : [], //doesn't work
+ models : [], //doesn't work
+
+ init: function() {
+ var me = this;
+
+ me.control({
+ 'mainwin' : {
+ beforerender : me.handleMainBeforeRender
+ }
+ });
+ },
+
+ handleMainBeforeRender: function(win) {
+ console.log('Main Before Render');
+ }
+});
@@ -0,0 +1,4 @@
+.test-main-win .x-window-body {
+ font: 20px Courier New;
+ background-color: #D16587;
+}
@@ -0,0 +1,20 @@
+Ext.define('JSApp.test.view.Main', {
+ extend : 'Ext.window.Window',
+ alias : 'widget.mainwin',
+
+ cls : 'test-main-win',
+ height : 300,
+ modal : true,
+ width : 400,
+
+ initComponent: function() {
+ var me = this;
+
+ Ext.apply(me, {
+ html : 'This window was dynamically loaded!',
+ title : 'Dynamic Sub App'
+ });
+
+ me.callParent();
+ }
+});
@@ -0,0 +1,73 @@
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact: http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
+/**
+ * Load the library located at the same path with this file
+ *
+ * Will automatically load ext-all-debug.js if any of these conditions is true:
+ * - Current hostname is localhost
+ * - Current hostname is an IP v4 address
+ * - Current protocol is "file:"
+ *
+ * Will load ext-all.js (minified) otherwise
+ */
+(function() {
+
+ var scripts = document.getElementsByTagName('script'),
+ localhostTests = [
+ /^localhost$/,
+ /\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:\d{1,5})?\b/ // IP v4
+ ],
+ host = window.location.hostname,
+ isDevelopment = null,
+ queryString = window.location.search,
+ test, path, i, ln, scriptSrc, match;
+
+ for (i = 0, ln = scripts.length; i < ln; i++) {
+ scriptSrc = scripts[i].src;
+
+ match = scriptSrc.match(/bootstrap\.js$/);
+
+ if (match) {
+ path = scriptSrc.substring(0, scriptSrc.length - match[0].length);
+ break;
+ }
+ }
+
+ if (queryString.match('(\\?|&)debug') !== null) {
+ isDevelopment = true;
+ }
+ else if (queryString.match('(\\?|&)nodebug') !== null) {
+ isDevelopment = false;
+ }
+
+ if (isDevelopment === null) {
+ for (i = 0, ln = localhostTests.length; i < ln; i++) {
+ test = localhostTests[i];
+
+ if (host.search(test) !== -1) {
+ isDevelopment = true;
+ break;
+ }
+ }
+ }
+
+ if (isDevelopment === null && window.location.protocol === 'file:') {
+ isDevelopment = true;
+ }
+
+ document.write('<script type="text/javascript" src="' + path + 'ext-all' + ((isDevelopment) ? '-debug' : '') + '.js"></script>');
+
+})();
+
Oops, something went wrong.

0 comments on commit e28887a

Please sign in to comment.