[qo-modules-dev] [39] docs and file cleanup |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qo-modules-dev Archives
]
Revision: 39
Author: mjlecomte
Date: 2008-12-03 19:22:06 +0100 (Wed, 03 Dec 2008)
Log Message:
-----------
docs and file cleanup
Modified Paths:
--------------
mickael/trunk/ext/v3.0.0-a1/learn/desktop/controller.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/desktop.html
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Launch.js
Added Paths:
-----------
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/button/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/button/TaskButton.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/data/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/data/RemoteLoader.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/menu/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/menu/StartMenu.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/modules/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/modules/layoutwindow/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/modules/layoutwindow/layoutwindow.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/overrides/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/overrides/override.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/ActiveApps.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/Appbar.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/TaskBar.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/Desktop.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/View.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/preload.js
Removed Paths:
-------------
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/ActiveApps.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Appbar.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Desktop.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/RemoteLoader.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/StartMenu.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskBar.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskButton.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/View.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/layoutwindow.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/modules-preload.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/override.js
mickael/trunk/ext/v3.0.0-a1/learn/desktop/sample.css
Modified: mickael/trunk/ext/v3.0.0-a1/learn/desktop/controller.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/controller.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/controller.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -36,7 +36,7 @@
* @cfg {Object} Platform load configuration
*/
platformConfig: {
- url: 'modules-preload.js',
+ url: 'preload.js',
params: 'foo'
},
Modified: mickael/trunk/ext/v3.0.0-a1/learn/desktop/desktop.html
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/desktop.html 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/desktop.html 2008-12-03 18:22:06 UTC (rev 39)
@@ -6,12 +6,9 @@
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="./resources/css/desktop.css" />
- <link rel="stylesheet" type="text/css" href="sample.css" />
-
<link rel="stylesheet" type="text/css" href="./system/modules/acc-win/acc-win.css" />
-
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<!--
@@ -20,11 +17,11 @@
<script type="text/javascript" src="../../ext-all-detail.js"></script>
<!-- OVERRIDES --> <!-- Destroy context menus -->
- <script type="text/javascript" src="override.js"></script>
+ <script type="text/javascript" src="js/overrides/override.js"></script>
<!-- APPLICATION --> <!-- These must be loaded immediately (logic to get modules, etc.) -->
<script type="text/javascript" src="js/Module.js"></script>
- <script type="text/javascript" src="js/RemoteLoader.js"></script>
+ <script type="text/javascript" src="js/data/RemoteLoader.js"></script>
<script type="text/javascript" src="js/Launch.js"></script>
<script type="text/javascript" src="js/App.js"></script>
@@ -37,14 +34,14 @@
<script type="text/javascript" src="controller.js"></script>
<!-- VIEW RELATED --> <!-- These files not needed until onReady -->
- <script type="text/javascript" src="js/StartMenu.js"></script>
- <script type="text/javascript" src="js/Appbar.js"></script>
- <script type="text/javascript" src="js/ActiveApps.js"></script>
- <script type="text/javascript" src="js/TaskBar.js"></script>
- <script type="text/javascript" src="js/TaskButton.js"></script>
+ <script type="text/javascript" src="js/menu/StartMenu.js"></script>
+ <script type="text/javascript" src="js/toolbar/Appbar.js"></script>
+ <script type="text/javascript" src="js/toolbar/ActiveApps.js"></script>
+ <script type="text/javascript" src="js/toolbar/TaskBar.js"></script>
+ <script type="text/javascript" src="js/button/TaskButton.js"></script>
- <script type="text/javascript" src="js/View.js"></script>
- <script type="text/javascript" src="js/Desktop.js"></script>
+ <script type="text/javascript" src="js/view/View.js"></script>
+ <script type="text/javascript" src="js/view/Desktop.js"></script>
</head>
<body></body>
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/ActiveApps.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/ActiveApps.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/ActiveApps.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,252 +0,0 @@
-/**
- * @class Ext.ux.ActiveAppsPanel
- * @extends Ext.ux.Appbar
- */
-Ext.ux.ActiveAppsPanel = Ext.extend(Ext.ux.Appbar, {
- activeButton: null,
- enableScroll: true,
- scrollIncrement: 0,
- scrollRepeatInterval: 400,
- scrollDuration: 0.35,
- animScroll: true,
- resizeButtons: true,
- buttonWidth: 168,
- minButtonWidth: 118,
- buttonMargin: 2,//2,
- buttonWidthSet: false,
- toggleGroup: 'taskbuttons',
-
- baseCls: 'ux-taskbuttons',
-
- afterAdd: function (btn) {
- if (!this.buttonWidthSet) {
- this.lastButtonWidth = btn.container.getWidth();
- }
- this.setActiveButton(btn);
- },
-
- delegateUpdates: function () {
- /*if(this.suspendUpdates){
- return;
- }*/
-
- if (this.rendered && this.items) {
- if (this.resizeButtons) {
- //this.autoSize();
- }
- if (this.enableScroll) {
- //this.autoScroll();
- }
- }
- },
-
- createButton: function (win, el) {
- var btn = new Ext.ux.TaskBar.TaskButton(win, el);
- return btn;
- },
-
- removeButton: function (btn) {
-
- btn.destroy();
-
- var s = [];
- for (var i = 0, len = this.items.length; i < len; i++) {
- if (this.items[i] !== btn) {
- s.push(this.items[i]);
- }
- }
- this.items = s;
- this.delegateUpdates();
- },
-
- setActiveButton: function (btn) {
- this.activeButton = btn;
- this.delegateUpdates();
- },
-
- autoSize: function () {
- var count, ow, aw, each, btns, btn, tw, iw;
- // if (!this.items) return;
- count = this.items.length;
- ow = this.el.dom.offsetWidth;
- aw = this.el.dom.clientWidth;
-
- if (!this.resizeButtons || count < 1 || !aw) { // !aw for display:none
- return;
- }
-
- each = Math.max(Math.min(Math.floor((aw - 4) / count) - this.buttonMargin, this.buttonWidth), this.minButtonWidth); // -4 for float errors in IE
- btns = this.stripWrap.dom.getElementsByTagName('button');
-
- this.lastButtonWidth = Ext.get(btns[0].id).findParent('li').offsetWidth;
-
- for (var i = 0, len = btns.length; i < len; i++) {
- btn = btns[i];
-
- tw = Ext.get(btns[i].id).findParent('li').offsetWidth;
- iw = btn.offsetWidth;
-
- btn.style.width = (each - (tw - iw)) + 'px';
- }
- },
-
- autoScroll: function () {
- var count, ow, tw, wrap, cw, pos, l;
- count = this.items.length;
- ow = this.el.dom.offsetWidth;
- tw = this.el.dom.clientWidth;
-
- wrap = this.stripWrap;
- cw = wrap.dom.offsetWidth;
- pos = this.getScrollPos();
- l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;
-
- if (!this.enableScroll || count < 1 || cw < 20) { // 20 to prevent display:none issues
- return;
- }
-
- wrap.setWidth(tw); // moved to here because of problem in Safari
-
- if (l <= tw) {
- wrap.dom.scrollLeft = 0;
- //wrap.setWidth(tw); moved from here because of problem in Safari
- if (this.scrolling) {
- this.scrolling = false;
- this.el.removeClass('x-taskbuttons-scrolling');
- this.scrollLeft.hide();
- this.scrollRight.hide();
- }
- } else {
- if (!this.scrolling) {
- this.el.addClass('x-taskbuttons-scrolling');
- }
- tw -= wrap.getMargins('lr');
- wrap.setWidth(tw > 20 ? tw : 20);
- if (!this.scrolling) {
- if (!this.scrollLeft) {
- this.createScrollers();
- } else {
- this.scrollLeft.show();
- this.scrollRight.show();
- }
- }
- this.scrolling = true;
- if (pos > (l - tw)) { // ensure it stays within bounds
- wrap.dom.scrollLeft = l - tw;
- } else { // otherwise, make sure the active button is still visible
- this.scrollToButton(this.activeButton, true); // true to animate
- }
- this.updateScrollButtons();
- }
- },
-
- createScrollers: function () {
- var h, sl, sr;
- h = this.el.dom.offsetHeight; //var h = this.stripWrap.dom.offsetHeight;
-
- // left
- sl = this.el.insertFirst({
- cls: 'ux-taskbuttons-scroller-left'
- });
- sl.setHeight(h);
- sl.addClassOnOver('ux-taskbuttons-scroller-left-over');
- this.leftRepeater = new Ext.util.ClickRepeater(sl, {
- interval: this.scrollRepeatInterval,
- handler: this.onScrollLeft,
- scope: this
- });
- this.scrollLeft = sl;
-
- // right
- sr = this.el.insertFirst({
- cls: 'ux-taskbuttons-scroller-right'
- });
- sr.setHeight(h);
- sr.addClassOnOver('ux-taskbuttons-scroller-right-over');
- this.rightRepeater = new Ext.util.ClickRepeater(sr, {
- interval: this.scrollRepeatInterval,
- handler: this.onScrollRight,
- scope: this
- });
- this.scrollRight = sr;
- },
-
- getScrollWidth: function () {
- return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();
- },
-
- getScrollPos: function () {
- return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;
- },
-
- getScrollArea: function () {
- return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;
- },
-
- getScrollAnim: function () {
- return {
- duration: this.scrollDuration,
- callback: this.updateScrollButtons,
- scope: this
- };
- },
-
- getScrollIncrement: function () {
- return (this.scrollIncrement || this.lastButtonWidth + 2);
- },
-
- /* getBtnEl : function(item){
- return document.getElementById(item.id);
- }, */
-
- scrollToButton : function (item, animate) {
- var el, pos, area, right, left;
- item = item.el.dom.parentNode; // li
- if (!item) {
- return;
- }
- el = item; //this.getBtnEl(item);
- pos = this.getScrollPos();
- area = this.getScrollArea();
- left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;
- right = left + el.offsetWidth;
- if (left < pos) {
- this.scrollTo(left, animate);
- } else if (right > (pos + area)) {
- this.scrollTo(right - area, animate);
- }
- },
-
- scrollTo: function (pos, animate) {
- this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);
- if (!animate) {
- this.updateScrollButtons();
- }
- },
-
- onScrollRight: function () {
- var sw, pos, s;
- sw = this.getScrollWidth() - this.getScrollArea();
- pos = this.getScrollPos();
- s = Math.min(sw, pos + this.getScrollIncrement());
- if (s !== pos) {
- this.scrollTo(s, this.animScroll);
- }
- },
-
- onScrollLeft: function () {
- var pos, s;
- pos = this.getScrollPos();
- s = Math.max(0, pos - this.getScrollIncrement());
- if (s !== pos) {
- this.scrollTo(s, this.animScroll);
- }
- },
-
- updateScrollButtons: function () {
- var pos = this.getScrollPos();
- this.scrollLeft[pos === 0 ? 'addClass' : 'removeClass']('ux-taskbuttons-scroller-left-disabled');
- this.scrollRight[pos >= (this.getScrollWidth() - this.getScrollArea()) ? 'addClass' : 'removeClass']('ux-taskbuttons-scroller-right-disabled');
- }
-});
-Ext.reg('activeAppsPanel', Ext.ux.ActiveAppsPanel);
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Appbar.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Appbar.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Appbar.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,43 +0,0 @@
-/**
- * A specialized Toolbar implementation for the Start Menu
- * @class Ext.ux.Appbar
- * @extends Ext.Toolbar
- */
-Ext.ux.Appbar = Ext.extend(Ext.Toolbar, {
-
- //prevent a border from being applied
- border: false,
-
- /* @private */
- constructor: function (config) {
-
- this.app = Ext.app.controller;
-
- Ext.apply(this, config);
- if (config.launchers) {
- config.buttons = this.initButtons(config.launchers);
- }
- if (!this.items) this.autoEl = {};
- Ext.ux.Appbar.superclass.constructor.apply(this, arguments);
- },
-
- /**
- * //Initialize any buttons
- * @param {String} l launch menu type
- */
- initButtons: function (l) {
- var qItems = this.app.getLaunchers(l);
- if(qItems){
- var btns = [];
- var b = {};
- Ext.each(qItems, function(item, index, allItems){
- b.iconCls = item.iconCls;
- b.handler = item.handler;
- // do not display text
- btns.push(b);
- })
- }
- return btns;
- }
-});
-Ext.reg('appbar', Ext.ux.Appbar);
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Desktop.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Desktop.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Desktop.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,212 +0,0 @@
-Ext.ns('Ext.ux.gui');
-
-/**
- * <p>This GUI mimics a Windows OS desktop appliction.</p>
- * @class Ext.ux.gui.Desktop
- * @extends Ext.ux.View
- */
-Ext.ux.gui.Desktop = Ext.extend(Ext.ux.View, {
-
- activeWindow: null,
-
- xTickSize: 1,
- yTickSize: 1,
-
- initComponent: function () {
-
- // window manager
- this.windows = new Ext.WindowGroup();
-
- this.desktopBody = new Ext.Panel({
- region: 'center',
- id: 'x-desktop',
- //xtype: 'panel',
- //TODO: this is going to an inner div, while the 'wallpaper'
- //is being applied to the parent div. They should go to the same
- //div so there isn't two active images. The other wallpaper
- //is set in View.js/setWallpaper().
- bodyStyle: "background-image:url(wallpapers/eos.jpg) !important",
- autoEl: {}
- });
-
- this.taskbar = new Ext.ux.TaskBar({
- //xtype: 'taskbar',
- //TODO: make region configurable north/south
- //if make this north, need to change the origin of menus
- //so they don't go off the page
- region: 'south',
- collapsible: true,
- collapseMode: 'mini',
- split: true,
- listeners: {
- // Set any styles if defined (background color, wallpaper, fontcolor, etc.)
- // initStyles() uses desktop elements so they must be rendered already
- afterRender: this.initStyles,
- scope: this
- },
- view: this
- });
-
- Ext.apply(this, {
- id: 'app-viewport',
- layout: 'border',
-// bodyBorder: false
- defaults: {
- border: false,
- cmargins: '0 0 0 0', // only used by border layout
- margins: '0 0 0 0'
- },
- items: [this.desktopBody, this.taskbar]
- });
-
- Ext.ux.gui.Desktop.superclass.initComponent.call(this);
- },
-
- getManager: function () {
- return this.windows;
- },
-
- getWindow: function (id) {
- return this.windows.get(id);
- },
-
- setTickSize: function (xTickSize, yTickSize) {
- this.xTickSize = xTickSize;
- if (arguments.length === 1) {
- this.yTickSize = xTickSize;
- } else {
- this.yTickSize = yTickSize;
- }
- this.windows.each(function (win) {
- win.dd.xTickSize = this.xTickSize;
- win.dd.yTickSize = this.yTickSize;
- win.resizer.widthIncrement = this.xTickSize;
- win.resizer.heightIncrement = this.yTickSize;
- }, this);
- },
-
- cascade: function (btn, e) {
- var x, y, xTick, yTick;
- xTick = Math.max(this.xTickSize, 20);
- yTick = Math.max(this.yTickSize, 20);
- x = xTick;
- y = yTick;
- this.windows.each(function (win) {
- if (win.isVisible() && !win.maximized) {
- win.setPosition(x, y);
- x += xTick;
- y += yTick;
- }
- }, this);
- },
-
- tile: function (btn, e) {
- var availWidth, nextY, w, x, y;
- availWidth = this.getEl().getWidth(true);
- x = this.xTickSize;
- y = this.yTickSize;
- nextY = y;
- this.windows.each(function (win) {
- if (win.isVisible() && !win.maximized) {
- w = win.el.getWidth();
-
- // Wrap to next row if we are not at the line start and this Window will go off the end
- if ((x > this.xTickSize) && (x + w > availWidth)) {
- x = this.xTickSize;
- y = nextY;
- }
-
- win.setPosition(x, y);
- x += w + this.xTickSize;
- nextY = Math.max(nextY, y + win.el.getHeight() + this.yTickSize);
- }
- }, this);
- },
-//////////////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////////////
-// below here not implemented
-
- // Private
- addContextMenuItem: function (item) {
-/*
- var m = app.getModule(id);
- if (m && !m.contextMenuItem) {
- / * if (m.moduleType === 'menu') { // handle menu modules
- var items = m.items;
- for (var i = 0, len = items.length; i < len; i++) {
- m.launcher.menu.items.push(app.getModule(items[i]).launcher);
- }
- } * /
- this.cmenu.add(m.launcher);
- }
-*/
- if (Ext.isArray(item)) {
- for (var i = 0, len = item.length; i < len; i++) {
- this.addContextMenuItem(item[i]);
- }
- return;
- }
- this.cmenu.add(item);
- },
-
- onContextmenu: function (e) {
-// if (e.target.id === desktopEl.id) {
- e.stopEvent();
- if (!this.cmenu.el) {
- this.cmenu.render();
- }
- var xy = e.getXY();
- xy[1] -= this.cmenu.el.getHeight();
- this.cmenu.showAt(xy);
-// }
-// this.fireEvent('contextmenu', this, e.target.id, e);
- },
- //TODO: the names here should be generalized to adding 'shortcuts' to any menu
- //in case the GUI is not a "desktop"
-
- addShortcut: function (id, updateConfig) {
-// var m = this.app.getModule(id);
- var c, m = Ext.getCmp(id);
-
- if (m && !m.shortcut) {
- c = m.launcher;
-
- m.shortcut = this.shortcuts.addShortcut({
- handler: c.handler,
- iconCls: c.shortcutIconCls,
- scope: c.scope,
- text: c.text,
- tooltip: c.tooltip || ''
- });
-
- if (updateConfig) {
- this.app.launchers.shortcut.push(id);
- }
- }
-
- },
-
- removeShortcut: function (id, updateConfig) {
- var i, sc, m = this.app.getModule(id);
-
- if (m && m.shortcut) {
- this.shortcuts.removeShortcut(m.shortcut);
- m.shortcut = null;
-
- if (updateConfig) {
- sc = this.app.launchers.shortcut;
- i = 0;
- while (i < sc.length) {
- if (sc[i] === id) {
- sc.splice(i, 1);
- } else {
- i++;
- }
- }
- }
- }
- }
-
-});
-
-Ext.ux.View.GUIS['desktop'] = Ext.ux.gui.Desktop;
\ No newline at end of file
Modified: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Launch.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Launch.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Launch.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -36,6 +36,10 @@
* @private
*/
var result = Ext.extend(Object, {
+ /**
+ * constructor
+ * @private
+ */
constructor: function(config){
Ext.apply(this, config);
if (this.launchId || this.id) {
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/RemoteLoader.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/RemoteLoader.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/RemoteLoader.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,150 +0,0 @@
-Ext.namespace('Ext.ux');
-
-/**
- * A specialized implemenations of Ext.data.Connection to load remote components dynamically.
- * Remotely loaded components should have an id so that Ext.ComponentMgr's onAvailable
- * function can be utilized to manipulate the components as they are added.
- * @class Ext.ux.RemoteLoader
- * @extends Ext.data.Connection
- * @singleton
- */
-Ext.ux.RemoteLoader = function () {
- var cm = Ext.ComponentMgr, // TODO: not currently used
- conn = new Ext.data.Connection(),
- method = 'POST';
- return {
- /**
- * Dynamically load components from a server resource
- * config options include anything available in @link Ext.data.Connection#request
- * @param {Object} config
- */
- load : function (config) {
- this.root = config.root || this.root;
- // append the connection configuration for later use
- var cb = this.onLoad.createDelegate(this, [config], true);
- var r = Ext.apply({}, config);
- Ext.apply(r, {
- method: method,
- callback: cb
- });
- // submit ajax request to server
- // save id of the server transaction in case we want to cancel the request
- this.transId = conn.request(r);
- },
-
- /**
- * Callback method for the load request.
- * @param {Object} opts
- * @param {Object} success
- * @param {Object} response
- * @param {Object} c data connection config object
- */
- onLoad : function (opts, success, response, c) {
- try {
- // use Ext.util.JSON.decode to decode the responseText
- var o = Ext.decode(response.responseText);
- }
- catch (e) {
- this.onFailure(opts, success, response, c);
- return;
- }
- Ext.callback(c.callback, c.scope, [o, arguments]);
- },
-
- /* @private */
-/*
- onFailure: function (opts, success, response, c) {
- Ext.Msg.alert('Load failure.');
- },
-*/
- /**
- * Requests the module's javascript code and loads it according to the
- * configured onFileLoad method ('eval' or 'head').
- * @param {Object} m
- * @param {Object} cb
- * @param {Object} scope
- */
- requestModule: function (m, scope) {
- var cb, url = m.loader.url;
-
- cb = this.onFileLoad.createDelegate(scope, [m, this], true);
- if (this.onFileLoad === 'eval') {
- this.loadLocalFile(url, m, cb, scope);
- } else {
- this.loadRemoteFile(url, m, cb, scope, 'js');
- }
- },
-
- /**
- * Use this method to load a file from your own site (same domain).
- * This method uses AJAX ( responseText ) to retrieve JSON formated data
- * or Javascript off your own site instead of dynamic <script> attachment.
- * After retrieving the object via ajax, it is passed through the eval
- * command (which is basically just the javascript compiler). After this
- * is done the functions and variables will be available to use.
- * @param {Object} filename
- * @param {Object} filetype
- * @param {Object} cb
- */
- loadLocalFile: function (url, m, cb, scope) {
- this.load({
- url: url,
- callback: cb,
- root: null,
- params: m.loader.params,
- scope: scope
- });
- },
-
- /**
- * This method makes it possible to load a remote file from another domain.
- * Importing cross-domain javascript in this manner should be approached
- * with caution in this fashion as you are cross-connecting these domains,
- * which potentially gives the site you are connecting to control over your
- * web page. Use caution!
- * @param {Object} filename name (and path) of resource to include)
- * @param {Object} filetype type of file to load ('js', 'css')
- * @param {Object} cb callback function
- */
- loadRemoteFile: function (filename, m, cb, scope, filetype) {
- var fileref;
- if (filetype === "js") { //if filename is a external JavaScript file
- //create a new 'script' document element
- fileref = document.createElement('script');
- //assign the proper attributes
- fileref.setAttribute("type", "text/javascript");
- fileref.setAttribute("src", filename);
- }
- if (filetype === "css") { //if filename is an external CSS file
- fileref = document.createElement("link");
- fileref.setAttribute("rel", "stylesheet");
- fileref.setAttribute("type", "text/css");
- fileref.setAttribute("href", filename);
- }
- if (typeof fileref !== "undefined") {
- //call the callback when it's loaded
- //fileref.onload = cb;
- fileref.onload = cb.createDelegate(this, [m, this], true);
- }
- //get a reference to the head element and append the new element to the very end of the HEAD section
- document.getElementsByTagName("head")[0].appendChild(fileref);
- },
-
- /* @private */
- onFileLoad: function (opts, success, response, m, scope) {
- if (this.processRemoteFile === 'eval') {
- //eval() the response (safe for same domain ajax requests?)
- try {
- eval(response.responseText);
- }
- catch (e) {
- return;
- }
- }
- // module is now loaded
- m.loaded = true;
- this.onLoad(m);
- this.createModule(m);
- }
- };
-}();
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/StartMenu.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/StartMenu.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/StartMenu.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,443 +0,0 @@
-/**
- * Creates a new StartMenu
- * @class Ext.ux.StartMenu
- * @extends Ext.menu.Menu
- */
-Ext.ux.StartMenu = Ext.extend(Ext.menu.Menu, {
-
- /* @private */
- constructor: function (config) {
- Ext.apply(this, config);
-
- // Start Menu
- var defaults = {
- iconCls: 'user',
- id: 'TaskBarStartMenu',
- height: 300,
- shadow: true,
- title: 'Start Menu',
- width: 300
- };
- Ext.applyIf(config, defaults);
-
- // config for start menu
- this.startConfig = this.startConfig || this.getStartConfig();
- this.startItemsConfig = this.startItemsConfig || this.getStartItemsConfig();
- Ext.apply(config, this.startConfig, this.startItemsConfig);
- Ext.ux.StartMenu.superclass.constructor.call(this, config);
-
- var tools = this.toolItems;
- this.toolItems = new Ext.util.MixedCollection();
- if (tools) {
- this.addTool.apply(this, tools);
- }
-
- // Start Menu's logout button
- if (this.logoutConfig) {
- this.addTool(this.logoutConfig);
- }
- },
-
- /* @private */
- render: function () {
- if (this.el) {
- return;
- }
- var el, header, headerText, tl, tr, tc, ml, mc, bwrap, bc, br, bl, ul, toolsUl, ulListeners;
-
- this.el = new Ext.Layer({
- cls: "x-menu ux-start-menu", // this might affect item click
- shadow: this.shadow,
- constrain: false,
- parentEl: this.parentEl || document.body,
- zindex: 15000
- });
-
- el = this.el;
-
- header = el.createChild({
- tag: "div",
- cls: "x-window-header x-unselectable x-panel-icon " + this.iconCls
- });
- this.header = header;
- headerText = header.createChild({
- tag: "span",
- cls: "x-window-header-text"
- });
- tl = header.wrap({
- cls: "ux-start-menu-tl"
- });
- tr = header.wrap({
- cls: "ux-start-menu-tr"
- });
- tc = header.wrap({
- cls: "ux-start-menu-tc"
- });
-
- this.menuBWrap = el.createChild({
- tag: "div",
- cls: "x-window-body x-border-layout-ct ux-start-menu-body"
- });
- ml = this.menuBWrap.wrap({
- cls: "ux-start-menu-ml"
- });
- mc = this.menuBWrap.wrap({
- cls: "x-window-mc ux-start-menu-bwrap"
- });
-
- this.menuPanel = this.menuBWrap.createChild({
- tag: "div",
- cls: "x-panel x-border-panel ux-start-menu-apps-panel"
- });
- this.toolsPanel = this.menuBWrap.createChild({
- tag: "div",
- cls: "x-panel x-border-panel ux-start-menu-tools-panel"
- });
-
- bwrap = ml.wrap({cls: "x-window-bwrap"});
- bc = bwrap.createChild({
- tag: "div",
- cls: "ux-start-menu-bc"
- });
- bl = bc.wrap({
- cls: "ux-start-menu-bl x-panel-nofooter"
- });
- br = bc.wrap({
- cls: "ux-start-menu-br"
- });
-
- this.keyNav = new Ext.menu.MenuNav(this);
-
- if (this.plain) {
- el.addClass("x-menu-plain");
- }
- if (this.cls) {
- el.addClass(this.cls);
- }
- // generic focus element
- this.focusEl = el.createChild({
- tag: "a",
- cls: "x-menu-focus",
- href: "#",
- onclick: "return false;",
- tabIndex: "-1"
- });
-
- ul = this.menuPanel.createChild({
- tag: "ul",
- cls: "x-menu-list"
- });
-
- toolsUl = this.toolsPanel.createChild({
- tag: "ul",
- cls: "x-menu-list"
- });
-
- ulListeners = {
- "click": {
- fn: this.onClick,
- scope: this
- },
- "mouseover": {
- fn: this.onMouseOver,
- scope: this
- },
- "mouseout": {
- fn: this.onMouseOut,
- scope: this
- }
- };
-
- ul.on(ulListeners);
-
- this.items.each(
- function (item) {
- var li = document.createElement("li");
- li.className = "x-menu-list-item";
- ul.dom.appendChild(li);
- item.render(li, this);
- }, this);
-
- this.ul = ul;
- this.doAutoSize();//this.autoWidth();
-
- toolsUl.on(ulListeners);
-
- this.toolItems.each(
- function (item) {
- var li = document.createElement("li");
- li.className = "x-menu-list-item";
- toolsUl.dom.appendChild(li);
- item.render(li, this);
- }, this);
-
- this.toolsUl = toolsUl;
- this.doAutoSize();//this.autoWidth();
-
- this.menuBWrap.setStyle('position', 'relative');
- this.menuBWrap.setHeight(this.height);
-
- this.menuPanel.setStyle({
- padding: '2px',
- position: 'absolute',
- overflow: 'auto'
- });
-
- this.toolsPanel.setStyle({
- padding: '2px 4px 2px 2px',
- position: 'absolute',
- overflow: 'auto'
- });
-
- this.setTitle(this.title);
- },
-
- /* @private */
- findTargetItem: function (e) {
- var t = e.getTarget(".x-menu-list-item", this.ul, true);
- if (t && t.menuItemId) {
- if (this.items.get(t.menuItemId)) {
- return this.items.get(t.menuItemId);
- } else {
- return this.toolItems.get(t.menuItemId);
- }
- }
- },
-
- /**
- * Displays this menu relative to another element
- * @param {Mixed} element The element to align to
- * @param {String} position (optional) The {@link Ext.Element#alignTo} anchor position to use in aligning to
- * the element (defaults to this.defaultAlign)
- * @param {Ext.ux.StartMenu} parentMenu (optional) This menu's parent menu, if applicable (defaults to undefined)
- */
- show: function (el, pos, parentMenu) {
- var tPanelWidth, box;
- this.parentMenu = parentMenu;
- if (!this.el) {
- this.render();
- }
-
- this.fireEvent("beforeshow", this);
- this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);
-
- tPanelWidth = 100;
- box = this.menuBWrap.getBox();
- this.menuPanel.setWidth(box.width - tPanelWidth);
- this.menuPanel.setHeight(box.height);
-
- this.toolsPanel.setWidth(tPanelWidth);
- this.toolsPanel.setX(box.x + box.width - tPanelWidth);
- this.toolsPanel.setHeight(box.height);
- },
-
- addTool: function () {
- var a = arguments, l = a.length, item, el;
- for (var i = 0; i < l; i++) {
- el = a[i];
- if (el.render) { // some kind of Item
- item = this.addToolItem(el);
- } else if (typeof el === "string") { // string
- if (el === "separator" || el === "-") {
- item = this.addToolSeparator();
- } else {
- item = this.addText(el);
- }
- } else if (el.tagName || el.el) { // element
- item = this.addElement(el);
- } else if (typeof el === "object") { // must be menu item config?
- item = this.addToolMenuItem(el);
- }
- }
- return item;
- },
-
- /**
- * Adds a separator bar to the Tools
- * @return {Ext.menu.Item} The menu item that was added
- */
- addToolSeparator: function () {
- return this.addToolItem(new Ext.menu.Separator({itemCls: 'ux-toolmenu-sep'}));
- },
-
- addToolItem: function (item) {
- this.toolItems.add(item);
- if (this.ul) {
- var li = document.createElement("li");
- li.className = "x-menu-list-item";
- this.ul.dom.appendChild(li);
- item.render(li, this);
- this.delayAutoWidth();
- }
- return item;
- },
-
- addToolMenuItem: function (config) {
- if (!(config instanceof Ext.menu.Item)) {
- if (typeof config.checked === "boolean") { // must be check menu item config?
- config = new Ext.menu.CheckItem(config);
- } else {
- config = new Ext.menu.Item(config);
- }
- }
- return this.addToolItem(config);
- },
-
- setTitle: function (title, iconCls) {
- this.title = title;
- this.header.child('span').update(title);
- return this;
- },
-
- //abstract method to be overridden if needed
- getStartConfig: Ext.emptyFn,
-
- /**
- * Returns the Start Menu items and toolItems configs
- * @param {array} ms An array of the modules.
- */
- getStartItemsConfig: function () {
- var ms = this.startItems;
- var sortFn = this.startMenuSortFn;
- /**
- * Creates nested arrays that represent the Start Menu.
- *
- * @param {array} pMenu The Start Menu
- * @param {array} texts The menu texts
- * @param {object} launcher The launcher config
- */
- var simplify = function (pMenu, paths, launcher) {
- var newMenu;
- var foundMenu;
-
- for (var i = 1, len = paths.length; i < len; i++) { // ignore the root (StartMenu, ToolMenu)
- foundMenu = findMenu(pMenu.items, paths[i]); // text exists?
-
- if (!foundMenu) {
- newMenu = {
- iconCls: 'ux-start-menu-submenu',
- handler: function () {
- return false;
- },
- menu: {
- items: []
- },
- text: paths[i]
- };
- pMenu.items.push(newMenu);
- pMenu = newMenu.menu;
- } else {
- pMenu = foundMenu;
- }
- }
-
- pMenu.items.push(launcher);
- };
-
- /**
- * Returns the menu if found.
- *
- * @param {array} pMenu The parent menu to search
- * @param {string} text
- */
- var findMenu = function (pMenu, text) {
- for (var j = 0, jlen = pMenu.length; j < jlen; j++) {
- if (pMenu[j].text === text) {
- return pMenu[j].menu; // found the menu, return it
- }
- }
- return null;
- };
-
- /**
- * @param {array} menu The nested array to sort
- */
- var sort = function (menu) {
- var items = menu.items;
- for (var i = 0, ilen = items.length; i < ilen; i++) {
- if (items[i].menu) {
- sort(items[i].menu); // use recursion to iterate nested arrays
- }
- bubbleSort(items, 0, items.length); // sort the menu items
- }
- }
-
- /**
- * @param {array} items Menu items to sort
- * @param {integer} start The start index
- * @param {integer} stop The stop index
- */
- var bubbleSort = function (items, start, stop) {
- for (var i = stop - 1; i >= start; i--) {
- for (var j = start; j <= i; j++) {
- if (items[j + 1] && items[j]) {
- if (sortFn(items[j], items[j + 1])) {
- var tempValue = items[j];
- items[j] = items[j + 1];
- items[j + 1] = tempValue;
- }
-
- }
- }
- }
- return items;
- };
-
- if (ms) {
- var paths, k = 0, root, sm, smi;
- // initial config for the Start Menu
- sm = { menu: { items: [] } }; // Start Menu
- // shorthand for Start Menu items
- smi = sm.menu.items;
-
- // add the two primary menus to the Start Menu
- smi.push({text: 'StartMenu', menu: { items: [] } });
- smi.push({text: 'ToolMenu', menu: { items: [] } });
-
- // loop through
- for (var i = 0, iLen = ms.length; i < iLen; i++) { // loop through modules
- if (ms[i].path) {
- paths = ms[i].path.split('/');
- root = paths[0];
-
- if (paths.length > 0) {
- if (root === 'tool') {
- k = 1;
- }
- simplify(smi[k].menu, paths, ms[i]);
- sort(smi[k].menu);
- }
- }
- }
-
- return {
- items: smi[0].menu.items,
- toolItems: smi[1].menu.items
- };
- }
- return null;
- },
-
- /**
- * Function that handles sorting of the Start Menu
- * Return true to swap a and b
- */
- startMenuSortFn: function (a, b) {
- // Sort in ASC alphabetical order
- // if( b.text < a.text ){
- // return true;
- // }
-
- // Sort in ASC alphabetical order with menus at the bottom
- // if( (b.text < a.text) && !b.menu ){
- // return true;
- // }
-
- // Sort in ASC alphabetical order with menus at the top
- if (((b.menu && a.menu) && (b.text < a.text)) || (b.menu && !a.menu) || ((b.text < a.text) && !a.menu)) {
- return true;
- }
-
- return false;
- }
-});
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskBar.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskBar.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskBar.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,175 +0,0 @@
-/**
- * @class Ext.ux.TaskBar
- * @extends Ext.Panel
- */
-Ext.ux.TaskBar = Ext.extend(Ext.Panel, {
-
- collapsible: true,
-
- // start button width
- sbWidth: 93,
- //var width = Ext.get('ux-startbutton').getWidth()+10;
-
- // system tray width
- stWidth: 60,
-
- // quick start width
- qsWidth: 94,
- qsWidthMin: 60,
-
- style: 'z-index:23000',
-
- constructor: function (config) {
- Ext.apply(this, config);
-
- this.app = Ext.app.controller;
-
- // Quick Start Applications (TaskBarQuickStart)
- var tbQuickStart = new Ext.ux.Appbar({
- launchers: 'quick',
- id: 'ux-quickstart-panel',
- minWidth: this.qsWidthMin,
- region: 'west',
- split: true,
- width: this.qsWidth
- });
-
- // System Tray Panel
- var tbTray = new Ext.ux.Appbar({
- launchers: 'tray',
- id: 'ux-systemtray-panel',
- minWidth: this.stWidth,
- region: 'east',
- split: true,
- width: this.stWidth
- });
-
- // Task Bar Active Application Buttons
- var tbPanel = {
- xtype: 'activeAppsPanel', // new Ext.ux.TaskButtonsPanel
- autoEl: {},//create empty div
- id: 'ux-taskbuttons-panel',
- border: false,
- region: 'center'
- };
-
- // Task Bar Applications
- var tbApps = {
- xtype: 'container',
- autoEl: {},//create empty div
- id: 'ux-taskbar-panel-wrap',
- border: false,
- region: 'center',
- layout: 'border',
- items: [tbQuickStart, tbPanel]
- };
-
- // ------------------
-
- // Start Button Panel
- var startItems = this.app.getLaunchers('start');
-
- // Start Menu
- this.startMenu = new Ext.ux.StartMenu({
- startConfig: this.view.startConfig,
- logoutConfig: this.view.logoutConfig,
- startItems: startItems
- });
-
- this.startBtn = new Ext.Button({
- text: 'Start',
- id: 'ux-startbutton',
- iconCls: 'start',
- menu: this.startMenu,
- menuAlign: 'bl-tl',
- clickEvent: 'mousedown',
- template: new Ext.Template('<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>', '<td class="x-btn-left"><i> </i></td>', '<td class="x-btn-center">', '<em unselectable="on"><button class="x-btn-text" type="{1}" style="height:30px;">{0}</button></em></td>', '<td class="x-btn-right"><i> </i></td>', "</tr></tbody></table>")
- });
-
- var tbStart = {
- xtype: 'container',
- autoEl: {},//create empty div
- id: 'ux-taskbar-start',
- items: [this.startBtn],
- border: false,
- minWidth: this.sbWidth,
- region: 'west',
- split: false,
- width: this.sbWidth
- };
-
- // ------------------
-
- // Assemble the parts into the taskbar container
- // Combined Taskbar
- var taskbar = {
- //xtype: 'panel',
- id: this.id || 'ux-taskbar',
- height: 90,
- collapsible: true,
- collapseMode: 'mini',
- layout: 'border'
- };
- this.view.taskbar = this;
-
- Ext.apply(this, taskbar);
-
- this.items = [tbStart, tbApps, tbTray];
-
- Ext.ux.TaskBar.superclass.constructor.call(this, config);
- },
-
- initComponent: function () {
-
- Ext.ux.TaskBar.superclass.initComponent.apply(this, arguments);
-
- this.on({
- beforecollapse: {
- fn: function () {
- //need to maintain a high z-index so the
- //taskbar remains visually on top (Ext resets
- //the z-index when it expands/collapses)
- this.el.applyStyles('z-index:23001');
- },
- scope: this
- },
- expand: {
- fn: function () {
- this.el.applyStyles('z-index:23002');
- },
- scope: this
- },
- render: {
- fn: function () {
- this.el.addClass("transparent");
- },
- scope: this
- }
- });
-
- this.app.on({
- activate: this.markActive
- });
- },
-
- markActive: function () {
- //console.info('markActive called');
- },
-
- addTaskButton: function (win) {
- var btn = new Ext.ux.TaskBar.TaskButton(win);
- this.activeAppsPanel = Ext.getCmp('ux-taskbuttons-panel');
- this.activeAppsPanel.addButton(btn);
- this.activeAppsPanel.doLayout();
- return btn;
- },
-
- removeTaskButton: function (btn) {
- this.activeAppsPanel.removeButton(btn);
- },
-
- setActiveButton: function (btn) {
- this.activeAppsPanel.setActiveButton(btn);
- }
-});
-Ext.reg('taskbar', Ext.ux.TaskBar);
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskButton.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskButton.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskButton.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,107 +0,0 @@
-/**
- * @class Ext.ux.TaskBar.TaskButton
- * @extends Ext.Button
- */
-Ext.ux.TaskBar.TaskButton = Ext.extend(Ext.Button, {
-
- constructor: function (win) {
- this.win = win;
- Ext.ux.TaskBar.TaskButton.superclass.constructor.call(this, {
- iconCls: win.iconCls,
- id: win.id + '_TaskBarTaskButton',
- text: Ext.util.Format.ellipsis(win.title, 12),
- handler : function () {
- if (win.minimized || win.hidden) {
- win.show();
- } else if (win === win.manager.getActive()) {
- win.minimize();
- } else {
- win.toFront();
- }
- },
- clickEvent: 'mousedown'
- });
- },
-
- onRender: function (ct, position) {
- Ext.ux.TaskBar.TaskButton.superclass.onRender.apply(this, arguments);
- var view = this.win.app.view
- // context menu to arrange windows
- var arrange = {
- items: [
- // stick any markup in a menu
- '<b class="menu-title">Choose an Arrangement</b>',
- {
- text: 'Tile',
- handler: view.tile,
- scope: view
- }, {
- text: 'Cascade',
- handler: view.cascade,
- scope: view
- }, {
- //TODO: add checkbox menu for selecting which items will be included in the arrangement selected
- text: 'Items',
- scope: this
- }
- ]
- };
-
- this.cmenu = new Ext.menu.Menu({
- items: [{
- text: 'Restore',
- handler: function () {
- if (!this.win.isVisible()) {
- this.win.show();
- } else {
- this.win.restore();
- }
- },
- scope: this
- }, {
- text: 'Minimize',
- handler: this.win.minimize,
- scope: this.win
- }, {
- text: 'Maximize',
- handler: this.win.maximize,
- scope: this.win
- }, {
- text: 'Arrange',
- menu: arrange
- }, '-', {
- text: 'Close',
- handler: this.closeWin.createDelegate(this, this.win, true),
- scope: this.win
- }]
- });
- this.cmenu = new Ext.menu.Menu();
-
- this.cmenu.on('beforeshow', function () {
- var w, items = this.cmenu.items.items;
- w = this.win;
- items[0].setDisabled(w.maximized !== true && w.hidden !== true);
- items[1].setDisabled(w.minimized === true);
- items[2].setDisabled(w.maximized === true || w.hidden === true);
- }, this);
-
- this.el.on('contextmenu', function (e) {
- e.stopEvent();
- if (!this.cmenu.el) {
- this.cmenu.render();
- }
- var xy = e.getXY();
- xy[1] -= this.cmenu.el.getHeight();
- this.cmenu.showAt(xy);
- }, this);
- },
-
- closeWin : function (cMenu, e, win) {
- if (!win.isVisible()) {
- win.show();
- } else {
- win.restore();
- }
- win.close();
- }
-});
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/View.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/View.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/View.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,211 +0,0 @@
-/**
- * <p>The Ext.ux.View Class provides the basic foundation for all other view classes.
- * This class provides the base logic required for a View to function as a GUI.
- * This class is intended to be extended and should generally not need to be
- * created directly via the new keyword.</p>
- * @class Ext.ux.View
- * @extends Ext.Viewport
- */
-Ext.ux.View = Ext.extend(Ext.Viewport, {
-
- monitorResize: true,
-
- /**
- * @cfg {Object} styles Configuration object for custom styling. Sample:
- * <pre><code>
- styles: {
- "backgroundcolor": "575757",
- "fontcolor": "FFFFFF",
- "transparency": "100",
- "theme": {
- "id": "3",
- "name": "Vista Glass",
- "pathtofile": "..\/desktop\/resources\/themes\/xtheme-vistaglass\/css\/xtheme-vistaglass.css"},
- "wallpaper": {
- "id": "11",
- "name": "Blue Psychedelic",
- // href of the new stylesheet to include
- "pathtofile": "..\/desktop\/resources\/wallpapers\/blue-psychedelic.jpg"
- },
- "wallpaperposition":"tile"
- } // end of styles
- * </code></pre>
- */
-
- /* @private */
- constructor: function (config) {
- Ext.apply(this, config);
- Ext.ux.View.superclass.constructor.call(this);
- },
-
- /* @private */
- initComponent : function () {
- Ext.ux.View.superclass.initComponent.apply(this, arguments);
-
- this.on({
- beforechange: this.onBeforeChange,
- afterchange: this.onAfterChange,
- scope: this
- });
- },
-
- /**
- * Listener function for beforechange event. Return false to prevent
- * the change.
- * @param {Object} o scope
- * @param {String} f The feature being changed
- * @param {Object} cfg Config object for the feature being changed
- */
- onBeforeChange: function (o, f, cfg) {
-/*
- var notifyWin = this.showNotification({
- html: 'Loading wallpaper...'
- , title: 'Please wait'
- });
-*/
- return true;
- },
-
- /**
- * Listener function for afterchange event. Possibly use this to
- * display notification messages, etc.
- * @param {Object} o scope
- * @param {String} f The feature being changed
- * @param {Object} cfg Config object for the feature being changed
- */
- onAfterChange: function (o, f, cfg) {
-/*
- notifyWin.setIconClass('x-icon-done');
- notifyWin.setTitle('Finished');
- notifyWin.setMessage('Wallpaper loaded.');
- this.hideNotification(notifyWin);
-*/
- },
-
- /**
- * Initialize any custom styling (background color, wallpaper, fontcolor, etc.)
- * See {@link #styles} config object for sample styles config object.
- * @private
- */
- initStyles: function () {
- if (!this.styles) {
- return false;
- }
- this.setBackgroundColor();
- this.setFontColor();
- this.setTheme();
- this.setTransparency();
- this.setWallpaper();
- this.setWallpaperPosition();
- return true;
- },
-
- /**
- * Set the background-color style for document.body
- * @param {Object} v The hexadecimal color value.
- */
- setBackgroundColor: function (v) {
- v = v || this.styles.backgroundcolor;
- if (v) {
- Ext.get(document.body).setStyle('background-color', '#' + v);
- }
- },
-
- /**
- * Set the font color for shortcut buttons text.
- * @param {Object} v The hexadecimal color value.
- */
- setFontColor: function (v) {
- v = v || this.styles.fontcolor;
- if (v) {
- Ext.util.CSS.updateRule('.ux-shortcut-btn-text', 'color', '#' + v);
- }
- },
-
- /**
- * Set the theme.
- * See {@link #styles} config object for sample theme config object.
- * This method swaps in a new stylesheet reference to replace an existing
- * stylesheet with link of this form (note the id).
- * <pre><code>
- * <link rel="stylesheet" type="text/css" id="theme" href="whatever.css"/>
- * </code></pre>
- * @param {Object} o Theme config object.
- */
- setTheme: function (o) {
- o = o || this.styles.theme;
- if (o && o.id && o.name && o.pathtofile) {
- Ext.util.CSS.swapStyleSheet('theme', o.pathtofile);
- }
- },
-
- /**
- * Set the transparency.
- * See {@link #styles} config object for sample theme config object.
- * This method updates the .transparent class for the value passed.
- * @param {Integer} v Integer value (0-100) to set the transparency.
- */
- setTransparency: function (v) {
- v = v || this.styles.transparency;
- if (v >= 0 && v <= 100) {
- Ext.util.CSS.updateRule('.transparent', 'opacity', v / 100);
- Ext.util.CSS.updateRule('.transparent', '-moz-opacity', v / 100);
- Ext.util.CSS.updateRule('.transparent', 'filter', 'alpha(opacity=' + v + ')');
- }
- },
-
- /**
- * Set the background wallpaper.
- * See {@link #styles} config object for sample wallpaper config object.
- * This method updates the desktopBody element background-image.
- * @param {Integer} o Wallpaper config object.
- */
- setWallpaper: function (o) {
- var s = this.styles;
- o = o || s.wallpaper;
- if (o && o.id && o.name && o.pathtofile) {
- if (this.fireEvent("beforechange", this, 'background', o) !== false) {
- s.image = new Image();
- s.task = new Ext.util.DelayedTask(this.verify, this);
- s.task.delay(200);
- }
- } else {
- //console.warn('background configured wrong');
- }
- },
-
- verify: function () {
- var s = this.styles;
- if (s.image.complete) {
- s.task.cancel();
- this.fireEvent("afterchange", this, 'background', s.wallpaper);
-// document.body.background = s.wallpaper.pathtofile;
- this.desktopBody.el.setStyle('background-image', 'url(' + s.wallpaper.pathtofile + ')');
- } else {
- //TODO: will this run forever if not found?
- //need timeout or counter if so
- s.task.delay(200);
- }
- },
-
- setWallpaperPosition: function (pos) {
- pos = pos || this.styles.wallpaperposition;
- if (pos) {
- //var b = Ext.get(document.body);
- var b = this.desktopBody.el,
- t = 'wallpaper-tile',
- c = 'wallpaper-center';
- if (pos === "tile") {
- b.removeClass(c);
- b.addClass(t);
- } else {
- b.removeClass(t);
- b.addClass(c);
- }
- }
- }
-});
-
-Ext.ux.View.GUIS = {};
-
-Ext.reg('view', Ext.ux.View);
\ No newline at end of file
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/button/TaskButton.js (from rev 36, mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskButton.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/button/TaskButton.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/button/TaskButton.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,107 @@
+/**
+ * @class Ext.ux.button.TaskButton
+ * @extends Ext.Button
+ */
+Ext.ux.button.TaskButton = Ext.extend(Ext.Button, {
+
+ constructor: function (win) {
+ this.win = win;
+ Ext.ux.TaskBar.TaskButton.superclass.constructor.call(this, {
+ iconCls: win.iconCls,
+ id: win.id + '_TaskBarTaskButton',
+ text: Ext.util.Format.ellipsis(win.title, 12),
+ handler : function () {
+ if (win.minimized || win.hidden) {
+ win.show();
+ } else if (win === win.manager.getActive()) {
+ win.minimize();
+ } else {
+ win.toFront();
+ }
+ },
+ clickEvent: 'mousedown'
+ });
+ },
+
+ onRender: function (ct, position) {
+ Ext.ux.TaskBar.TaskButton.superclass.onRender.apply(this, arguments);
+ var view = this.win.app.view
+ // context menu to arrange windows
+ var arrange = {
+ items: [
+ // stick any markup in a menu
+ '<b class="menu-title">Choose an Arrangement</b>',
+ {
+ text: 'Tile',
+ handler: view.tile,
+ scope: view
+ }, {
+ text: 'Cascade',
+ handler: view.cascade,
+ scope: view
+ }, {
+ //TODO: add checkbox menu for selecting which items will be included in the arrangement selected
+ text: 'Items',
+ scope: this
+ }
+ ]
+ };
+
+ this.cmenu = new Ext.menu.Menu({
+ items: [{
+ text: 'Restore',
+ handler: function () {
+ if (!this.win.isVisible()) {
+ this.win.show();
+ } else {
+ this.win.restore();
+ }
+ },
+ scope: this
+ }, {
+ text: 'Minimize',
+ handler: this.win.minimize,
+ scope: this.win
+ }, {
+ text: 'Maximize',
+ handler: this.win.maximize,
+ scope: this.win
+ }, {
+ text: 'Arrange',
+ menu: arrange
+ }, '-', {
+ text: 'Close',
+ handler: this.closeWin.createDelegate(this, this.win, true),
+ scope: this.win
+ }]
+ });
+ this.cmenu = new Ext.menu.Menu();
+
+ this.cmenu.on('beforeshow', function () {
+ var w, items = this.cmenu.items.items;
+ w = this.win;
+ items[0].setDisabled(w.maximized !== true && w.hidden !== true);
+ items[1].setDisabled(w.minimized === true);
+ items[2].setDisabled(w.maximized === true || w.hidden === true);
+ }, this);
+
+ this.el.on('contextmenu', function (e) {
+ e.stopEvent();
+ if (!this.cmenu.el) {
+ this.cmenu.render();
+ }
+ var xy = e.getXY();
+ xy[1] -= this.cmenu.el.getHeight();
+ this.cmenu.showAt(xy);
+ }, this);
+ },
+
+ closeWin : function (cMenu, e, win) {
+ if (!win.isVisible()) {
+ win.show();
+ } else {
+ win.restore();
+ }
+ win.close();
+ }
+});
\ No newline at end of file
Property changes on: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/button/TaskButton.js
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/data/RemoteLoader.js (from rev 36, mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/RemoteLoader.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/data/RemoteLoader.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/data/RemoteLoader.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,150 @@
+Ext.namespace('Ext.ux');
+
+/**
+ * A specialized implemenations of Ext.data.Connection to load remote components dynamically.
+ * Remotely loaded components should have an id so that Ext.ComponentMgr's onAvailable
+ * function can be utilized to manipulate the components as they are added.
+ * @class Ext.ux.RemoteLoader
+ * @extends Ext.data.Connection
+ * @singleton
+ */
+Ext.ux.RemoteLoader = function () {
+ var cm = Ext.ComponentMgr, // TODO: not currently used
+ conn = new Ext.data.Connection(),
+ method = 'POST';
+ return {
+ /**
+ * Dynamically load components from a server resource
+ * config options include anything available in @link Ext.data.Connection#request
+ * @param {Object} config
+ */
+ load : function (config) {
+ this.root = config.root || this.root;
+ // append the connection configuration for later use
+ var cb = this.onLoad.createDelegate(this, [config], true);
+ var r = Ext.apply({}, config);
+ Ext.apply(r, {
+ method: method,
+ callback: cb
+ });
+ // submit ajax request to server
+ // save id of the server transaction in case we want to cancel the request
+ this.transId = conn.request(r);
+ },
+
+ /**
+ * Callback method for the load request.
+ * @param {Object} opts
+ * @param {Object} success
+ * @param {Object} response
+ * @param {Object} c data connection config object
+ */
+ onLoad : function (opts, success, response, c) {
+ try {
+ // use Ext.util.JSON.decode to decode the responseText
+ var o = Ext.decode(response.responseText);
+ }
+ catch (e) {
+ this.onFailure(opts, success, response, c);
+ return;
+ }
+ Ext.callback(c.callback, c.scope, [o, arguments]);
+ },
+
+ /* @private */
+/*
+ onFailure: function (opts, success, response, c) {
+ Ext.Msg.alert('Load failure.');
+ },
+*/
+ /**
+ * Requests the module's javascript code and loads it according to the
+ * configured onFileLoad method ('eval' or 'head').
+ * @param {Object} m
+ * @param {Object} cb
+ * @param {Object} scope
+ */
+ requestModule: function (m, scope) {
+ var cb, url = m.loader.url;
+
+ cb = this.onFileLoad.createDelegate(scope, [m, this], true);
+ if (this.onFileLoad === 'eval') {
+ this.loadLocalFile(url, m, cb, scope);
+ } else {
+ this.loadRemoteFile(url, m, cb, scope, 'js');
+ }
+ },
+
+ /**
+ * Use this method to load a file from your own site (same domain).
+ * This method uses AJAX ( responseText ) to retrieve JSON formated data
+ * or Javascript off your own site instead of dynamic <script> attachment.
+ * After retrieving the object via ajax, it is passed through the eval
+ * command (which is basically just the javascript compiler). After this
+ * is done the functions and variables will be available to use.
+ * @param {Object} filename
+ * @param {Object} filetype
+ * @param {Object} cb
+ */
+ loadLocalFile: function (url, m, cb, scope) {
+ this.load({
+ url: url,
+ callback: cb,
+ root: null,
+ params: m.loader.params,
+ scope: scope
+ });
+ },
+
+ /**
+ * This method makes it possible to load a remote file from another domain.
+ * Importing cross-domain javascript in this manner should be approached
+ * with caution in this fashion as you are cross-connecting these domains,
+ * which potentially gives the site you are connecting to control over your
+ * web page. Use caution!
+ * @param {Object} filename name (and path) of resource to include)
+ * @param {Object} filetype type of file to load ('js', 'css')
+ * @param {Object} cb callback function
+ */
+ loadRemoteFile: function (filename, m, cb, scope, filetype) {
+ var fileref;
+ if (filetype === "js") { //if filename is a external JavaScript file
+ //create a new 'script' document element
+ fileref = document.createElement('script');
+ //assign the proper attributes
+ fileref.setAttribute("type", "text/javascript");
+ fileref.setAttribute("src", filename);
+ }
+ if (filetype === "css") { //if filename is an external CSS file
+ fileref = document.createElement("link");
+ fileref.setAttribute("rel", "stylesheet");
+ fileref.setAttribute("type", "text/css");
+ fileref.setAttribute("href", filename);
+ }
+ if (typeof fileref !== "undefined") {
+ //call the callback when it's loaded
+ //fileref.onload = cb;
+ fileref.onload = cb.createDelegate(this, [m, this], true);
+ }
+ //get a reference to the head element and append the new element to the very end of the HEAD section
+ document.getElementsByTagName("head")[0].appendChild(fileref);
+ },
+
+ /* @private */
+ onFileLoad: function (opts, success, response, m, scope) {
+ if (this.processRemoteFile === 'eval') {
+ //eval() the response (safe for same domain ajax requests?)
+ try {
+ eval(response.responseText);
+ }
+ catch (e) {
+ return;
+ }
+ }
+ // module is now loaded
+ m.loaded = true;
+ this.onLoad(m);
+ this.createModule(m);
+ }
+ };
+}();
\ No newline at end of file
Property changes on: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/data/RemoteLoader.js
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/menu/StartMenu.js (from rev 36, mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/StartMenu.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/menu/StartMenu.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/menu/StartMenu.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,443 @@
+/**
+ * Creates a new StartMenu
+ * @class Ext.ux.StartMenu
+ * @extends Ext.menu.Menu
+ */
+Ext.ux.StartMenu = Ext.extend(Ext.menu.Menu, {
+
+ /* @private */
+ constructor: function (config) {
+ Ext.apply(this, config);
+
+ // Start Menu
+ var defaults = {
+ iconCls: 'user',
+ id: 'TaskBarStartMenu',
+ height: 300,
+ shadow: true,
+ title: 'Start Menu',
+ width: 300
+ };
+ Ext.applyIf(config, defaults);
+
+ // config for start menu
+ this.startConfig = this.startConfig || this.getStartConfig();
+ this.startItemsConfig = this.startItemsConfig || this.getStartItemsConfig();
+ Ext.apply(config, this.startConfig, this.startItemsConfig);
+ Ext.ux.StartMenu.superclass.constructor.call(this, config);
+
+ var tools = this.toolItems;
+ this.toolItems = new Ext.util.MixedCollection();
+ if (tools) {
+ this.addTool.apply(this, tools);
+ }
+
+ // Start Menu's logout button
+ if (this.logoutConfig) {
+ this.addTool(this.logoutConfig);
+ }
+ },
+
+ /* @private */
+ render: function () {
+ if (this.el) {
+ return;
+ }
+ var el, header, headerText, tl, tr, tc, ml, mc, bwrap, bc, br, bl, ul, toolsUl, ulListeners;
+
+ this.el = new Ext.Layer({
+ cls: "x-menu ux-start-menu", // this might affect item click
+ shadow: this.shadow,
+ constrain: false,
+ parentEl: this.parentEl || document.body,
+ zindex: 15000
+ });
+
+ el = this.el;
+
+ header = el.createChild({
+ tag: "div",
+ cls: "x-window-header x-unselectable x-panel-icon " + this.iconCls
+ });
+ this.header = header;
+ headerText = header.createChild({
+ tag: "span",
+ cls: "x-window-header-text"
+ });
+ tl = header.wrap({
+ cls: "ux-start-menu-tl"
+ });
+ tr = header.wrap({
+ cls: "ux-start-menu-tr"
+ });
+ tc = header.wrap({
+ cls: "ux-start-menu-tc"
+ });
+
+ this.menuBWrap = el.createChild({
+ tag: "div",
+ cls: "x-window-body x-border-layout-ct ux-start-menu-body"
+ });
+ ml = this.menuBWrap.wrap({
+ cls: "ux-start-menu-ml"
+ });
+ mc = this.menuBWrap.wrap({
+ cls: "x-window-mc ux-start-menu-bwrap"
+ });
+
+ this.menuPanel = this.menuBWrap.createChild({
+ tag: "div",
+ cls: "x-panel x-border-panel ux-start-menu-apps-panel"
+ });
+ this.toolsPanel = this.menuBWrap.createChild({
+ tag: "div",
+ cls: "x-panel x-border-panel ux-start-menu-tools-panel"
+ });
+
+ bwrap = ml.wrap({cls: "x-window-bwrap"});
+ bc = bwrap.createChild({
+ tag: "div",
+ cls: "ux-start-menu-bc"
+ });
+ bl = bc.wrap({
+ cls: "ux-start-menu-bl x-panel-nofooter"
+ });
+ br = bc.wrap({
+ cls: "ux-start-menu-br"
+ });
+
+ this.keyNav = new Ext.menu.MenuNav(this);
+
+ if (this.plain) {
+ el.addClass("x-menu-plain");
+ }
+ if (this.cls) {
+ el.addClass(this.cls);
+ }
+ // generic focus element
+ this.focusEl = el.createChild({
+ tag: "a",
+ cls: "x-menu-focus",
+ href: "#",
+ onclick: "return false;",
+ tabIndex: "-1"
+ });
+
+ ul = this.menuPanel.createChild({
+ tag: "ul",
+ cls: "x-menu-list"
+ });
+
+ toolsUl = this.toolsPanel.createChild({
+ tag: "ul",
+ cls: "x-menu-list"
+ });
+
+ ulListeners = {
+ "click": {
+ fn: this.onClick,
+ scope: this
+ },
+ "mouseover": {
+ fn: this.onMouseOver,
+ scope: this
+ },
+ "mouseout": {
+ fn: this.onMouseOut,
+ scope: this
+ }
+ };
+
+ ul.on(ulListeners);
+
+ this.items.each(
+ function (item) {
+ var li = document.createElement("li");
+ li.className = "x-menu-list-item";
+ ul.dom.appendChild(li);
+ item.render(li, this);
+ }, this);
+
+ this.ul = ul;
+ this.doAutoSize();//this.autoWidth();
+
+ toolsUl.on(ulListeners);
+
+ this.toolItems.each(
+ function (item) {
+ var li = document.createElement("li");
+ li.className = "x-menu-list-item";
+ toolsUl.dom.appendChild(li);
+ item.render(li, this);
+ }, this);
+
+ this.toolsUl = toolsUl;
+ this.doAutoSize();//this.autoWidth();
+
+ this.menuBWrap.setStyle('position', 'relative');
+ this.menuBWrap.setHeight(this.height);
+
+ this.menuPanel.setStyle({
+ padding: '2px',
+ position: 'absolute',
+ overflow: 'auto'
+ });
+
+ this.toolsPanel.setStyle({
+ padding: '2px 4px 2px 2px',
+ position: 'absolute',
+ overflow: 'auto'
+ });
+
+ this.setTitle(this.title);
+ },
+
+ /* @private */
+ findTargetItem: function (e) {
+ var t = e.getTarget(".x-menu-list-item", this.ul, true);
+ if (t && t.menuItemId) {
+ if (this.items.get(t.menuItemId)) {
+ return this.items.get(t.menuItemId);
+ } else {
+ return this.toolItems.get(t.menuItemId);
+ }
+ }
+ },
+
+ /**
+ * Displays this menu relative to another element
+ * @param {Mixed} element The element to align to
+ * @param {String} position (optional) The {@link Ext.Element#alignTo} anchor position to use in aligning to
+ * the element (defaults to this.defaultAlign)
+ * @param {Ext.ux.StartMenu} parentMenu (optional) This menu's parent menu, if applicable (defaults to undefined)
+ */
+ show: function (el, pos, parentMenu) {
+ var tPanelWidth, box;
+ this.parentMenu = parentMenu;
+ if (!this.el) {
+ this.render();
+ }
+
+ this.fireEvent("beforeshow", this);
+ this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);
+
+ tPanelWidth = 100;
+ box = this.menuBWrap.getBox();
+ this.menuPanel.setWidth(box.width - tPanelWidth);
+ this.menuPanel.setHeight(box.height);
+
+ this.toolsPanel.setWidth(tPanelWidth);
+ this.toolsPanel.setX(box.x + box.width - tPanelWidth);
+ this.toolsPanel.setHeight(box.height);
+ },
+
+ addTool: function () {
+ var a = arguments, l = a.length, item, el;
+ for (var i = 0; i < l; i++) {
+ el = a[i];
+ if (el.render) { // some kind of Item
+ item = this.addToolItem(el);
+ } else if (typeof el === "string") { // string
+ if (el === "separator" || el === "-") {
+ item = this.addToolSeparator();
+ } else {
+ item = this.addText(el);
+ }
+ } else if (el.tagName || el.el) { // element
+ item = this.addElement(el);
+ } else if (typeof el === "object") { // must be menu item config?
+ item = this.addToolMenuItem(el);
+ }
+ }
+ return item;
+ },
+
+ /**
+ * Adds a separator bar to the Tools
+ * @return {Ext.menu.Item} The menu item that was added
+ */
+ addToolSeparator: function () {
+ return this.addToolItem(new Ext.menu.Separator({itemCls: 'ux-toolmenu-sep'}));
+ },
+
+ addToolItem: function (item) {
+ this.toolItems.add(item);
+ if (this.ul) {
+ var li = document.createElement("li");
+ li.className = "x-menu-list-item";
+ this.ul.dom.appendChild(li);
+ item.render(li, this);
+ this.delayAutoWidth();
+ }
+ return item;
+ },
+
+ addToolMenuItem: function (config) {
+ if (!(config instanceof Ext.menu.Item)) {
+ if (typeof config.checked === "boolean") { // must be check menu item config?
+ config = new Ext.menu.CheckItem(config);
+ } else {
+ config = new Ext.menu.Item(config);
+ }
+ }
+ return this.addToolItem(config);
+ },
+
+ setTitle: function (title, iconCls) {
+ this.title = title;
+ this.header.child('span').update(title);
+ return this;
+ },
+
+ //abstract method to be overridden if needed
+ getStartConfig: Ext.emptyFn,
+
+ /**
+ * Returns the Start Menu items and toolItems configs
+ * @param {array} ms An array of the modules.
+ */
+ getStartItemsConfig: function () {
+ var ms = this.startItems;
+ var sortFn = this.startMenuSortFn;
+ /**
+ * Creates nested arrays that represent the Start Menu.
+ *
+ * @param {array} pMenu The Start Menu
+ * @param {array} texts The menu texts
+ * @param {object} launcher The launcher config
+ */
+ var simplify = function (pMenu, paths, launcher) {
+ var newMenu;
+ var foundMenu;
+
+ for (var i = 1, len = paths.length; i < len; i++) { // ignore the root (StartMenu, ToolMenu)
+ foundMenu = findMenu(pMenu.items, paths[i]); // text exists?
+
+ if (!foundMenu) {
+ newMenu = {
+ iconCls: 'ux-start-menu-submenu',
+ handler: function () {
+ return false;
+ },
+ menu: {
+ items: []
+ },
+ text: paths[i]
+ };
+ pMenu.items.push(newMenu);
+ pMenu = newMenu.menu;
+ } else {
+ pMenu = foundMenu;
+ }
+ }
+
+ pMenu.items.push(launcher);
+ };
+
+ /**
+ * Returns the menu if found.
+ *
+ * @param {array} pMenu The parent menu to search
+ * @param {string} text
+ */
+ var findMenu = function (pMenu, text) {
+ for (var j = 0, jlen = pMenu.length; j < jlen; j++) {
+ if (pMenu[j].text === text) {
+ return pMenu[j].menu; // found the menu, return it
+ }
+ }
+ return null;
+ };
+
+ /**
+ * @param {array} menu The nested array to sort
+ */
+ var sort = function (menu) {
+ var items = menu.items;
+ for (var i = 0, ilen = items.length; i < ilen; i++) {
+ if (items[i].menu) {
+ sort(items[i].menu); // use recursion to iterate nested arrays
+ }
+ bubbleSort(items, 0, items.length); // sort the menu items
+ }
+ }
+
+ /**
+ * @param {array} items Menu items to sort
+ * @param {integer} start The start index
+ * @param {integer} stop The stop index
+ */
+ var bubbleSort = function (items, start, stop) {
+ for (var i = stop - 1; i >= start; i--) {
+ for (var j = start; j <= i; j++) {
+ if (items[j + 1] && items[j]) {
+ if (sortFn(items[j], items[j + 1])) {
+ var tempValue = items[j];
+ items[j] = items[j + 1];
+ items[j + 1] = tempValue;
+ }
+
+ }
+ }
+ }
+ return items;
+ };
+
+ if (ms) {
+ var paths, k = 0, root, sm, smi;
+ // initial config for the Start Menu
+ sm = { menu: { items: [] } }; // Start Menu
+ // shorthand for Start Menu items
+ smi = sm.menu.items;
+
+ // add the two primary menus to the Start Menu
+ smi.push({text: 'StartMenu', menu: { items: [] } });
+ smi.push({text: 'ToolMenu', menu: { items: [] } });
+
+ // loop through
+ for (var i = 0, iLen = ms.length; i < iLen; i++) { // loop through modules
+ if (ms[i].path) {
+ paths = ms[i].path.split('/');
+ root = paths[0];
+
+ if (paths.length > 0) {
+ if (root === 'tool') {
+ k = 1;
+ }
+ simplify(smi[k].menu, paths, ms[i]);
+ sort(smi[k].menu);
+ }
+ }
+ }
+
+ return {
+ items: smi[0].menu.items,
+ toolItems: smi[1].menu.items
+ };
+ }
+ return null;
+ },
+
+ /**
+ * Function that handles sorting of the Start Menu
+ * Return true to swap a and b
+ */
+ startMenuSortFn: function (a, b) {
+ // Sort in ASC alphabetical order
+ // if( b.text < a.text ){
+ // return true;
+ // }
+
+ // Sort in ASC alphabetical order with menus at the bottom
+ // if( (b.text < a.text) && !b.menu ){
+ // return true;
+ // }
+
+ // Sort in ASC alphabetical order with menus at the top
+ if (((b.menu && a.menu) && (b.text < a.text)) || (b.menu && !a.menu) || ((b.text < a.text) && !a.menu)) {
+ return true;
+ }
+
+ return false;
+ }
+});
\ No newline at end of file
Property changes on: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/menu/StartMenu.js
___________________________________________________________________
Name: svn:mergeinfo
+
Added: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/modules/layoutwindow/layoutwindow.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/modules/layoutwindow/layoutwindow.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/modules/layoutwindow/layoutwindow.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,73 @@
+/**
+ * <p>This class creates a specialized Window for :</p>
+ *
+ * @class Ext.app.module.LayoutWindow
+ * @extends Ext.ux.Module
+ * @author Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
+ * @license <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0</a>
+ * @version 0.01
+ */
+Ext.app.module.LayoutWindow = Ext.extend(Ext.ux.Module, {
+
+ /**
+ * @cfg {Boolean} loaded
+ * Whether or not the module will be loaded when this code is applied
+ */
+ loaded: true,
+
+ /** @private */
+ constructor : function (config) {
+ Ext.apply(this, config);
+/*
+ // Panel for the west
+ var nav = new Ext.Panel({
+ title : 'Navigation',
+ region : 'west',
+ split : true,
+ width : 200,
+ collapsible : true,
+ margins : '3 0 3 3',
+ cmargins : '3 3 3 3'
+ });
+
+ var center = new Ext.Panel({
+ height: 400,
+ title : 'Center',
+ region : 'center',
+ split : true,
+ width : 200,
+ margins : '3 0 3 3',
+ cmargins : '3 3 3 3'
+ });
+*/
+ Ext.apply(this, {
+ title : 'Layout Window',
+// autoHeight: true,
+ height: 300,
+ autoEl: {},
+ plain : true,
+ width: 600
+/*
+ ,
+ items: {
+ height: 200,
+ xtype: 'container',
+ autoEl: {},
+ layout : 'border',
+ items : [nav, center2]
+ }
+*/
+ });
+
+ Ext.app.module.LayoutWindow.superclass.constructor.call(this);
+ },
+
+ /** @private */
+ initComponent : function () {
+ //call parent
+ Ext.app.module.LayoutWindow.superclass.initComponent.call(this);
+ }
+});
+
+//register the xtype
+Ext.reg('grid-win', Ext.app.module.LayoutWindow);
\ No newline at end of file
Added: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/overrides/override.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/overrides/override.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/overrides/override.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,41 @@
+Ext.override(Ext.Component, {
+ /**
+ * Destroys this component by purging any event listeners, removing the component's element from the DOM,
+ * removing the component from its {@link Ext.Container} (if applicable) and unregistering it from
+ * {@link Ext.ComponentMgr}. Destruction is generally handled automatically by the framework and this method
+ * should usually not need to be called directly.
+ */
+ destroy : function(){
+ if(this.fireEvent("beforedestroy", this) !== false){
+ this.beforeDestroy();
+ if(this.rendered){
+ this.el.removeAllListeners();
+ this.el.remove();
+ if(this.actionMode == "container" || this.removeMode == "container"){
+ this.container.remove();
+ }
+ }
+ this.onDestroy();
+//*********************************************************************************************************
+//*********************************************************************************************************
+ //destroy any context menu:
+ if (this.cmenu) {
+ Ext.destroy(this.cmenu);
+ }
+//*********************************************************************************************************
+//*********************************************************************************************************
+ Ext.ComponentMgr.unregister(this);
+ this.fireEvent("destroy", this);
+ this.purgeListeners();
+ }
+ },
+
+ /**
+ * Returns the id of this component.
+ * @return {String}
+ */
+ getId : function(){
+// return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));
+ return this.id || (this.id = this.ctype + "-" + (++Ext.Component.AUTO_ID));
+ }
+});
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/ActiveApps.js (from rev 36, mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/ActiveApps.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/ActiveApps.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/ActiveApps.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,252 @@
+/**
+ * @class Ext.ux.ActiveAppsPanel
+ * @extends Ext.ux.Appbar
+ */
+Ext.ux.ActiveAppsPanel = Ext.extend(Ext.ux.Appbar, {
+ activeButton: null,
+ enableScroll: true,
+ scrollIncrement: 0,
+ scrollRepeatInterval: 400,
+ scrollDuration: 0.35,
+ animScroll: true,
+ resizeButtons: true,
+ buttonWidth: 168,
+ minButtonWidth: 118,
+ buttonMargin: 2,//2,
+ buttonWidthSet: false,
+ toggleGroup: 'taskbuttons',
+
+ baseCls: 'ux-taskbuttons',
+
+ afterAdd: function (btn) {
+ if (!this.buttonWidthSet) {
+ this.lastButtonWidth = btn.container.getWidth();
+ }
+ this.setActiveButton(btn);
+ },
+
+ delegateUpdates: function () {
+ /*if(this.suspendUpdates){
+ return;
+ }*/
+
+ if (this.rendered && this.items) {
+ if (this.resizeButtons) {
+ //this.autoSize();
+ }
+ if (this.enableScroll) {
+ //this.autoScroll();
+ }
+ }
+ },
+
+ createButton: function (win, el) {
+ var btn = new Ext.ux.TaskBar.TaskButton(win, el);
+ return btn;
+ },
+
+ removeButton: function (btn) {
+
+ btn.destroy();
+
+ var s = [];
+ for (var i = 0, len = this.items.length; i < len; i++) {
+ if (this.items[i] !== btn) {
+ s.push(this.items[i]);
+ }
+ }
+ this.items = s;
+ this.delegateUpdates();
+ },
+
+ setActiveButton: function (btn) {
+ this.activeButton = btn;
+ this.delegateUpdates();
+ },
+
+ autoSize: function () {
+ var count, ow, aw, each, btns, btn, tw, iw;
+ // if (!this.items) return;
+ count = this.items.length;
+ ow = this.el.dom.offsetWidth;
+ aw = this.el.dom.clientWidth;
+
+ if (!this.resizeButtons || count < 1 || !aw) { // !aw for display:none
+ return;
+ }
+
+ each = Math.max(Math.min(Math.floor((aw - 4) / count) - this.buttonMargin, this.buttonWidth), this.minButtonWidth); // -4 for float errors in IE
+ btns = this.stripWrap.dom.getElementsByTagName('button');
+
+ this.lastButtonWidth = Ext.get(btns[0].id).findParent('li').offsetWidth;
+
+ for (var i = 0, len = btns.length; i < len; i++) {
+ btn = btns[i];
+
+ tw = Ext.get(btns[i].id).findParent('li').offsetWidth;
+ iw = btn.offsetWidth;
+
+ btn.style.width = (each - (tw - iw)) + 'px';
+ }
+ },
+
+ autoScroll: function () {
+ var count, ow, tw, wrap, cw, pos, l;
+ count = this.items.length;
+ ow = this.el.dom.offsetWidth;
+ tw = this.el.dom.clientWidth;
+
+ wrap = this.stripWrap;
+ cw = wrap.dom.offsetWidth;
+ pos = this.getScrollPos();
+ l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;
+
+ if (!this.enableScroll || count < 1 || cw < 20) { // 20 to prevent display:none issues
+ return;
+ }
+
+ wrap.setWidth(tw); // moved to here because of problem in Safari
+
+ if (l <= tw) {
+ wrap.dom.scrollLeft = 0;
+ //wrap.setWidth(tw); moved from here because of problem in Safari
+ if (this.scrolling) {
+ this.scrolling = false;
+ this.el.removeClass('x-taskbuttons-scrolling');
+ this.scrollLeft.hide();
+ this.scrollRight.hide();
+ }
+ } else {
+ if (!this.scrolling) {
+ this.el.addClass('x-taskbuttons-scrolling');
+ }
+ tw -= wrap.getMargins('lr');
+ wrap.setWidth(tw > 20 ? tw : 20);
+ if (!this.scrolling) {
+ if (!this.scrollLeft) {
+ this.createScrollers();
+ } else {
+ this.scrollLeft.show();
+ this.scrollRight.show();
+ }
+ }
+ this.scrolling = true;
+ if (pos > (l - tw)) { // ensure it stays within bounds
+ wrap.dom.scrollLeft = l - tw;
+ } else { // otherwise, make sure the active button is still visible
+ this.scrollToButton(this.activeButton, true); // true to animate
+ }
+ this.updateScrollButtons();
+ }
+ },
+
+ createScrollers: function () {
+ var h, sl, sr;
+ h = this.el.dom.offsetHeight; //var h = this.stripWrap.dom.offsetHeight;
+
+ // left
+ sl = this.el.insertFirst({
+ cls: 'ux-taskbuttons-scroller-left'
+ });
+ sl.setHeight(h);
+ sl.addClassOnOver('ux-taskbuttons-scroller-left-over');
+ this.leftRepeater = new Ext.util.ClickRepeater(sl, {
+ interval: this.scrollRepeatInterval,
+ handler: this.onScrollLeft,
+ scope: this
+ });
+ this.scrollLeft = sl;
+
+ // right
+ sr = this.el.insertFirst({
+ cls: 'ux-taskbuttons-scroller-right'
+ });
+ sr.setHeight(h);
+ sr.addClassOnOver('ux-taskbuttons-scroller-right-over');
+ this.rightRepeater = new Ext.util.ClickRepeater(sr, {
+ interval: this.scrollRepeatInterval,
+ handler: this.onScrollRight,
+ scope: this
+ });
+ this.scrollRight = sr;
+ },
+
+ getScrollWidth: function () {
+ return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();
+ },
+
+ getScrollPos: function () {
+ return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;
+ },
+
+ getScrollArea: function () {
+ return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;
+ },
+
+ getScrollAnim: function () {
+ return {
+ duration: this.scrollDuration,
+ callback: this.updateScrollButtons,
+ scope: this
+ };
+ },
+
+ getScrollIncrement: function () {
+ return (this.scrollIncrement || this.lastButtonWidth + 2);
+ },
+
+ /* getBtnEl : function(item){
+ return document.getElementById(item.id);
+ }, */
+
+ scrollToButton : function (item, animate) {
+ var el, pos, area, right, left;
+ item = item.el.dom.parentNode; // li
+ if (!item) {
+ return;
+ }
+ el = item; //this.getBtnEl(item);
+ pos = this.getScrollPos();
+ area = this.getScrollArea();
+ left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;
+ right = left + el.offsetWidth;
+ if (left < pos) {
+ this.scrollTo(left, animate);
+ } else if (right > (pos + area)) {
+ this.scrollTo(right - area, animate);
+ }
+ },
+
+ scrollTo: function (pos, animate) {
+ this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);
+ if (!animate) {
+ this.updateScrollButtons();
+ }
+ },
+
+ onScrollRight: function () {
+ var sw, pos, s;
+ sw = this.getScrollWidth() - this.getScrollArea();
+ pos = this.getScrollPos();
+ s = Math.min(sw, pos + this.getScrollIncrement());
+ if (s !== pos) {
+ this.scrollTo(s, this.animScroll);
+ }
+ },
+
+ onScrollLeft: function () {
+ var pos, s;
+ pos = this.getScrollPos();
+ s = Math.max(0, pos - this.getScrollIncrement());
+ if (s !== pos) {
+ this.scrollTo(s, this.animScroll);
+ }
+ },
+
+ updateScrollButtons: function () {
+ var pos = this.getScrollPos();
+ this.scrollLeft[pos === 0 ? 'addClass' : 'removeClass']('ux-taskbuttons-scroller-left-disabled');
+ this.scrollRight[pos >= (this.getScrollWidth() - this.getScrollArea()) ? 'addClass' : 'removeClass']('ux-taskbuttons-scroller-right-disabled');
+ }
+});
+Ext.reg('activeAppsPanel', Ext.ux.ActiveAppsPanel);
\ No newline at end of file
Property changes on: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/ActiveApps.js
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/Appbar.js (from rev 36, mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Appbar.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/Appbar.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/Appbar.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,43 @@
+/**
+ * A specialized Toolbar implementation for the Start Menu
+ * @class Ext.ux.Appbar
+ * @extends Ext.Toolbar
+ */
+Ext.ux.Appbar = Ext.extend(Ext.Toolbar, {
+
+ //prevent a border from being applied
+ border: false,
+
+ /* @private */
+ constructor: function (config) {
+
+ this.app = Ext.app.controller;
+
+ Ext.apply(this, config);
+ if (config.launchers) {
+ config.buttons = this.initButtons(config.launchers);
+ }
+ if (!this.items) this.autoEl = {};
+ Ext.ux.Appbar.superclass.constructor.apply(this, arguments);
+ },
+
+ /**
+ * //Initialize any buttons
+ * @param {String} l launch menu type
+ */
+ initButtons: function (l) {
+ var qItems = this.app.getLaunchers(l);
+ if(qItems){
+ var btns = [];
+ var b = {};
+ Ext.each(qItems, function(item, index, allItems){
+ b.iconCls = item.iconCls;
+ b.handler = item.handler;
+ // do not display text
+ btns.push(b);
+ })
+ }
+ return btns;
+ }
+});
+Ext.reg('appbar', Ext.ux.Appbar);
\ No newline at end of file
Property changes on: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/Appbar.js
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/TaskBar.js (from rev 38, mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/TaskBar.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/TaskBar.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/TaskBar.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,175 @@
+/**
+ * @class Ext.ux.TaskBar
+ * @extends Ext.Panel
+ */
+Ext.ux.TaskBar = Ext.extend(Ext.Panel, {
+
+ collapsible: true,
+
+ // start button width
+ sbWidth: 93,
+ //var width = Ext.get('ux-startbutton').getWidth()+10;
+
+ // system tray width
+ stWidth: 60,
+
+ // quick start width
+ qsWidth: 94,
+ qsWidthMin: 60,
+
+ style: 'z-index:23000',
+
+ constructor: function (config) {
+ Ext.apply(this, config);
+
+ this.app = Ext.app.controller;
+
+ // Quick Start Applications (TaskBarQuickStart)
+ var tbQuickStart = new Ext.ux.Appbar({
+ launchers: 'quick',
+ id: 'ux-quickstart-panel',
+ minWidth: this.qsWidthMin,
+ region: 'west',
+ split: true,
+ width: this.qsWidth
+ });
+
+ // System Tray Panel
+ var tbTray = new Ext.ux.Appbar({
+ launchers: 'tray',
+ id: 'ux-systemtray-panel',
+ minWidth: this.stWidth,
+ region: 'east',
+ split: true,
+ width: this.stWidth
+ });
+
+ // Task Bar Active Application Buttons
+ var tbPanel = {
+ xtype: 'activeAppsPanel', // new Ext.ux.TaskButtonsPanel
+ autoEl: {},//create empty div
+ id: 'ux-taskbuttons-panel',
+ border: false,
+ region: 'center'
+ };
+
+ // Task Bar Applications
+ var tbApps = {
+ xtype: 'container',
+ autoEl: {},//create empty div
+ id: 'ux-taskbar-panel-wrap',
+ border: false,
+ region: 'center',
+ layout: 'border',
+ items: [tbQuickStart, tbPanel]
+ };
+
+ // ------------------
+
+ // Start Button Panel
+ var startItems = this.app.getLaunchers('start');
+
+ // Start Menu
+ this.startMenu = new Ext.ux.StartMenu({
+ startConfig: this.view.startConfig,
+ logoutConfig: this.view.logoutConfig,
+ startItems: startItems
+ });
+
+ this.startBtn = new Ext.Button({
+ text: 'Start',
+ id: 'ux-startbutton',
+ iconCls: 'start',
+ menu: this.startMenu,
+ menuAlign: 'bl-tl',
+ clickEvent: 'mousedown',
+ template: new Ext.Template('<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>', '<td class="x-btn-left"><i> </i></td>', '<td class="x-btn-center">', '<em unselectable="on"><button class="x-btn-text" type="{1}" style="height:30px;">{0}</button></em></td>', '<td class="x-btn-right"><i> </i></td>', "</tr></tbody></table>")
+ });
+
+ var tbStart = {
+ xtype: 'container',
+ autoEl: {},//create empty div
+ id: 'ux-taskbar-start',
+ items: [this.startBtn],
+ border: false,
+ minWidth: this.sbWidth,
+ region: 'west',
+ split: false,
+ width: this.sbWidth
+ };
+
+ // ------------------
+
+ // Assemble the parts into the taskbar container
+ // Combined Taskbar
+ var taskbar = {
+ //xtype: 'panel',
+ id: this.id || 'ux-taskbar',
+ height: 90,
+ collapsible: true,
+ collapseMode: 'mini',
+ layout: 'border'
+ };
+ this.view.taskbar = this;
+
+ Ext.apply(this, taskbar);
+
+ this.items = [tbStart, tbApps, tbTray];
+
+ Ext.ux.TaskBar.superclass.constructor.call(this, config);
+ },
+
+ initComponent: function () {
+
+ Ext.ux.TaskBar.superclass.initComponent.apply(this, arguments);
+
+ this.on({
+ beforecollapse: {
+ fn: function () {
+ //need to maintain a high z-index so the
+ //taskbar remains visually on top (Ext resets
+ //the z-index when it expands/collapses)
+ this.el.applyStyles('z-index:23001');
+ },
+ scope: this
+ },
+ expand: {
+ fn: function () {
+ this.el.applyStyles('z-index:23002');
+ },
+ scope: this
+ },
+ render: {
+ fn: function () {
+ this.el.addClass("transparent");
+ },
+ scope: this
+ }
+ });
+
+ this.app.on({
+ activate: this.markActive
+ });
+ },
+
+ markActive: function () {
+ //console.info('markActive called');
+ },
+
+ addTaskButton: function (win) {
+ var btn = new Ext.ux.TaskBar.TaskButton(win);
+ this.activeAppsPanel = Ext.getCmp('ux-taskbuttons-panel');
+ this.activeAppsPanel.addButton(btn);
+ this.activeAppsPanel.doLayout();
+ return btn;
+ },
+
+ removeTaskButton: function (btn) {
+ this.activeAppsPanel.removeButton(btn);
+ },
+
+ setActiveButton: function (btn) {
+ this.activeAppsPanel.setActiveButton(btn);
+ }
+});
+Ext.reg('taskbar', Ext.ux.TaskBar);
\ No newline at end of file
Property changes on: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/toolbar/TaskBar.js
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/Desktop.js (from rev 38, mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/Desktop.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/Desktop.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/Desktop.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,212 @@
+Ext.ns('Ext.ux.gui');
+
+/**
+ * <p>This GUI mimics a Windows OS desktop appliction.</p>
+ * @class Ext.ux.gui.Desktop
+ * @extends Ext.ux.View
+ */
+Ext.ux.gui.Desktop = Ext.extend(Ext.ux.View, {
+
+ activeWindow: null,
+
+ xTickSize: 1,
+ yTickSize: 1,
+
+ initComponent: function () {
+
+ // window manager
+ this.windows = new Ext.WindowGroup();
+
+ this.desktopBody = new Ext.Panel({
+ region: 'center',
+ id: 'x-desktop',
+ //xtype: 'panel',
+ //TODO: this is going to an inner div, while the 'wallpaper'
+ //is being applied to the parent div. They should go to the same
+ //div so there isn't two active images. The other wallpaper
+ //is set in View.js/setWallpaper().
+ bodyStyle: "background-image:url(wallpapers/eos.jpg) !important",
+ autoEl: {}
+ });
+
+ this.taskbar = new Ext.ux.TaskBar({
+ //xtype: 'taskbar',
+ //TODO: make region configurable north/south
+ //if make this north, need to change the origin of menus
+ //so they don't go off the page
+ region: 'south',
+ collapsible: true,
+ collapseMode: 'mini',
+ split: true,
+ listeners: {
+ // Set any styles if defined (background color, wallpaper, fontcolor, etc.)
+ // initStyles() uses desktop elements so they must be rendered already
+ afterRender: this.initStyles,
+ scope: this
+ },
+ view: this
+ });
+
+ Ext.apply(this, {
+ id: 'app-viewport',
+ layout: 'border',
+// bodyBorder: false
+ defaults: {
+ border: false,
+ cmargins: '0 0 0 0', // only used by border layout
+ margins: '0 0 0 0'
+ },
+ items: [this.desktopBody, this.taskbar]
+ });
+
+ Ext.ux.gui.Desktop.superclass.initComponent.call(this);
+ },
+
+ getManager: function () {
+ return this.windows;
+ },
+
+ getWindow: function (id) {
+ return this.windows.get(id);
+ },
+
+ setTickSize: function (xTickSize, yTickSize) {
+ this.xTickSize = xTickSize;
+ if (arguments.length === 1) {
+ this.yTickSize = xTickSize;
+ } else {
+ this.yTickSize = yTickSize;
+ }
+ this.windows.each(function (win) {
+ win.dd.xTickSize = this.xTickSize;
+ win.dd.yTickSize = this.yTickSize;
+ win.resizer.widthIncrement = this.xTickSize;
+ win.resizer.heightIncrement = this.yTickSize;
+ }, this);
+ },
+
+ cascade: function (btn, e) {
+ var x, y, xTick, yTick;
+ xTick = Math.max(this.xTickSize, 20);
+ yTick = Math.max(this.yTickSize, 20);
+ x = xTick;
+ y = yTick;
+ this.windows.each(function (win) {
+ if (win.isVisible() && !win.maximized) {
+ win.setPosition(x, y);
+ x += xTick;
+ y += yTick;
+ }
+ }, this);
+ },
+
+ tile: function (btn, e) {
+ var availWidth, nextY, w, x, y;
+ availWidth = this.getEl().getWidth(true);
+ x = this.xTickSize;
+ y = this.yTickSize;
+ nextY = y;
+ this.windows.each(function (win) {
+ if (win.isVisible() && !win.maximized) {
+ w = win.el.getWidth();
+
+ // Wrap to next row if we are not at the line start and this Window will go off the end
+ if ((x > this.xTickSize) && (x + w > availWidth)) {
+ x = this.xTickSize;
+ y = nextY;
+ }
+
+ win.setPosition(x, y);
+ x += w + this.xTickSize;
+ nextY = Math.max(nextY, y + win.el.getHeight() + this.yTickSize);
+ }
+ }, this);
+ },
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+// below here not implemented
+
+ // Private
+ addContextMenuItem: function (item) {
+/*
+ var m = app.getModule(id);
+ if (m && !m.contextMenuItem) {
+ / * if (m.moduleType === 'menu') { // handle menu modules
+ var items = m.items;
+ for (var i = 0, len = items.length; i < len; i++) {
+ m.launcher.menu.items.push(app.getModule(items[i]).launcher);
+ }
+ } * /
+ this.cmenu.add(m.launcher);
+ }
+*/
+ if (Ext.isArray(item)) {
+ for (var i = 0, len = item.length; i < len; i++) {
+ this.addContextMenuItem(item[i]);
+ }
+ return;
+ }
+ this.cmenu.add(item);
+ },
+
+ onContextmenu: function (e) {
+// if (e.target.id === desktopEl.id) {
+ e.stopEvent();
+ if (!this.cmenu.el) {
+ this.cmenu.render();
+ }
+ var xy = e.getXY();
+ xy[1] -= this.cmenu.el.getHeight();
+ this.cmenu.showAt(xy);
+// }
+// this.fireEvent('contextmenu', this, e.target.id, e);
+ },
+ //TODO: the names here should be generalized to adding 'shortcuts' to any menu
+ //in case the GUI is not a "desktop"
+
+ addShortcut: function (id, updateConfig) {
+// var m = this.app.getModule(id);
+ var c, m = Ext.getCmp(id);
+
+ if (m && !m.shortcut) {
+ c = m.launcher;
+
+ m.shortcut = this.shortcuts.addShortcut({
+ handler: c.handler,
+ iconCls: c.shortcutIconCls,
+ scope: c.scope,
+ text: c.text,
+ tooltip: c.tooltip || ''
+ });
+
+ if (updateConfig) {
+ this.app.launchers.shortcut.push(id);
+ }
+ }
+
+ },
+
+ removeShortcut: function (id, updateConfig) {
+ var i, sc, m = this.app.getModule(id);
+
+ if (m && m.shortcut) {
+ this.shortcuts.removeShortcut(m.shortcut);
+ m.shortcut = null;
+
+ if (updateConfig) {
+ sc = this.app.launchers.shortcut;
+ i = 0;
+ while (i < sc.length) {
+ if (sc[i] === id) {
+ sc.splice(i, 1);
+ } else {
+ i++;
+ }
+ }
+ }
+ }
+ }
+
+});
+
+Ext.ux.View.GUIS['desktop'] = Ext.ux.gui.Desktop;
\ No newline at end of file
Property changes on: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/Desktop.js
___________________________________________________________________
Name: svn:mergeinfo
+
Added: mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/View.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/View.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/js/view/View.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,211 @@
+/**
+ * <p>The Ext.ux.View Class provides the basic foundation for all other view classes.
+ * This class provides the base logic required for a View to function as a GUI.
+ * This class is intended to be extended and should generally not need to be
+ * created directly via the new keyword.</p>
+ * @class Ext.ux.View
+ * @extends Ext.Viewport
+ */
+Ext.ux.View = Ext.extend(Ext.Viewport, {
+
+ monitorResize: true,
+
+ /**
+ * @cfg {Object} styles Configuration object for custom styling. Sample:
+ * <pre><code>
+ styles: {
+ "backgroundcolor": "575757",
+ "fontcolor": "FFFFFF",
+ "transparency": "100",
+ "theme": {
+ "id": "3",
+ "name": "Vista Glass",
+ "pathtofile": "..\/desktop\/resources\/themes\/xtheme-vistaglass\/css\/xtheme-vistaglass.css"},
+ "wallpaper": {
+ "id": "11",
+ "name": "Blue Psychedelic",
+ // href of the new stylesheet to include
+ "pathtofile": "..\/desktop\/resources\/wallpapers\/blue-psychedelic.jpg"
+ },
+ "wallpaperposition":"tile"
+ } // end of styles
+ * </code></pre>
+ */
+
+ /* @private */
+ constructor: function (config) {
+ Ext.apply(this, config);
+ Ext.ux.View.superclass.constructor.call(this);
+ },
+
+ /* @private */
+ initComponent : function () {
+ Ext.ux.View.superclass.initComponent.apply(this, arguments);
+
+ this.on({
+ beforechange: this.onBeforeChange,
+ afterchange: this.onAfterChange,
+ scope: this
+ });
+ },
+
+ /**
+ * Listener function for beforechange event. Return false to prevent
+ * the change.
+ * @param {Object} o scope
+ * @param {String} f The feature being changed
+ * @param {Object} cfg Config object for the feature being changed
+ */
+ onBeforeChange: function (o, f, cfg) {
+/*
+ var notifyWin = this.showNotification({
+ html: 'Loading wallpaper...'
+ , title: 'Please wait'
+ });
+*/
+ return true;
+ },
+
+ /**
+ * Listener function for afterchange event. Possibly use this to
+ * display notification messages, etc.
+ * @param {Object} o scope
+ * @param {String} f The feature being changed
+ * @param {Object} cfg Config object for the feature being changed
+ */
+ onAfterChange: function (o, f, cfg) {
+/*
+ notifyWin.setIconClass('x-icon-done');
+ notifyWin.setTitle('Finished');
+ notifyWin.setMessage('Wallpaper loaded.');
+ this.hideNotification(notifyWin);
+*/
+ },
+
+ /**
+ * Initialize any custom styling (background color, wallpaper, fontcolor, etc.)
+ * See {@link #styles} config object for sample styles config object.
+ * @private
+ */
+ initStyles: function () {
+ if (!this.styles) {
+ return false;
+ }
+ this.setBackgroundColor();
+ this.setFontColor();
+ this.setTheme();
+ this.setTransparency();
+ this.setWallpaper();
+ this.setWallpaperPosition();
+ return true;
+ },
+
+ /**
+ * Set the background-color style for document.body
+ * @param {Object} v The hexadecimal color value.
+ */
+ setBackgroundColor: function (v) {
+ v = v || this.styles.backgroundcolor;
+ if (v) {
+ Ext.get(document.body).setStyle('background-color', '#' + v);
+ }
+ },
+
+ /**
+ * Set the font color for shortcut buttons text.
+ * @param {Object} v The hexadecimal color value.
+ */
+ setFontColor: function (v) {
+ v = v || this.styles.fontcolor;
+ if (v) {
+ Ext.util.CSS.updateRule('.ux-shortcut-btn-text', 'color', '#' + v);
+ }
+ },
+
+ /**
+ * Set the theme.
+ * See {@link #styles} config object for sample theme config object.
+ * This method swaps in a new stylesheet reference to replace an existing
+ * stylesheet with link of this form (note the id).
+ * <pre><code>
+ * <link rel="stylesheet" type="text/css" id="theme" href="whatever.css"/>
+ * </code></pre>
+ * @param {Object} o Theme config object.
+ */
+ setTheme: function (o) {
+ o = o || this.styles.theme;
+ if (o && o.id && o.name && o.pathtofile) {
+ Ext.util.CSS.swapStyleSheet('theme', o.pathtofile);
+ }
+ },
+
+ /**
+ * Set the transparency.
+ * See {@link #styles} config object for sample theme config object.
+ * This method updates the .transparent class for the value passed.
+ * @param {Integer} v Integer value (0-100) to set the transparency.
+ */
+ setTransparency: function (v) {
+ v = v || this.styles.transparency;
+ if (v >= 0 && v <= 100) {
+ Ext.util.CSS.updateRule('.transparent', 'opacity', v / 100);
+ Ext.util.CSS.updateRule('.transparent', '-moz-opacity', v / 100);
+ Ext.util.CSS.updateRule('.transparent', 'filter', 'alpha(opacity=' + v + ')');
+ }
+ },
+
+ /**
+ * Set the background wallpaper.
+ * See {@link #styles} config object for sample wallpaper config object.
+ * This method updates the desktopBody element background-image.
+ * @param {Integer} o Wallpaper config object.
+ */
+ setWallpaper: function (o) {
+ var s = this.styles;
+ o = o || s.wallpaper;
+ if (o && o.id && o.name && o.pathtofile) {
+ if (this.fireEvent("beforechange", this, 'background', o) !== false) {
+ s.image = new Image();
+ s.task = new Ext.util.DelayedTask(this.verify, this);
+ s.task.delay(200);
+ }
+ } else {
+ //console.warn('background configured wrong');
+ }
+ },
+
+ verify: function () {
+ var s = this.styles;
+ if (s.image.complete) {
+ s.task.cancel();
+ this.fireEvent("afterchange", this, 'background', s.wallpaper);
+// document.body.background = s.wallpaper.pathtofile;
+ this.desktopBody.el.setStyle('background-image', 'url(' + s.wallpaper.pathtofile + ')');
+ } else {
+ //TODO: will this run forever if not found?
+ //need timeout or counter if so
+ s.task.delay(200);
+ }
+ },
+
+ setWallpaperPosition: function (pos) {
+ pos = pos || this.styles.wallpaperposition;
+ if (pos) {
+ //var b = Ext.get(document.body);
+ var b = this.desktopBody.el,
+ t = 'wallpaper-tile',
+ c = 'wallpaper-center';
+ if (pos === "tile") {
+ b.removeClass(c);
+ b.addClass(t);
+ } else {
+ b.removeClass(t);
+ b.addClass(c);
+ }
+ }
+ }
+});
+
+Ext.ux.View.GUIS = {};
+
+Ext.reg('view', Ext.ux.View);
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/layoutwindow.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/layoutwindow.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/layoutwindow.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,73 +0,0 @@
-/**
- * <p>This class creates a specialized Window for :</p>
- *
- * @class Ext.app.module.LayoutWindow
- * @extends Ext.ux.Module
- * @author Michael LeComte (<a href="http://extjs.com/forum/member.php?u=6834">mjlecomte</a>)
- * @license <a href="http://www.gnu.org/licenses/lgpl.html">LGPL 3.0</a>
- * @version 0.01
- */
-Ext.app.module.LayoutWindow = Ext.extend(Ext.ux.Module, {
-
- /**
- * @cfg {Boolean} loaded
- * Whether or not the module will be loaded when this code is applied
- */
- loaded: true,
-
- /** @private */
- constructor : function (config) {
- Ext.apply(this, config);
-/*
- // Panel for the west
- var nav = new Ext.Panel({
- title : 'Navigation',
- region : 'west',
- split : true,
- width : 200,
- collapsible : true,
- margins : '3 0 3 3',
- cmargins : '3 3 3 3'
- });
-
- var center = new Ext.Panel({
- height: 400,
- title : 'Center',
- region : 'center',
- split : true,
- width : 200,
- margins : '3 0 3 3',
- cmargins : '3 3 3 3'
- });
-*/
- Ext.apply(this, {
- title : 'Layout Window',
-// autoHeight: true,
- height: 300,
- autoEl: {},
- plain : true,
- width: 600
-/*
- ,
- items: {
- height: 200,
- xtype: 'container',
- autoEl: {},
- layout : 'border',
- items : [nav, center2]
- }
-*/
- });
-
- Ext.app.module.LayoutWindow.superclass.constructor.call(this);
- },
-
- /** @private */
- initComponent : function () {
- //call parent
- Ext.app.module.LayoutWindow.superclass.initComponent.call(this);
- }
-});
-
-//register the xtype
-Ext.reg('grid-win', Ext.app.module.LayoutWindow);
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/modules-preload.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/modules-preload.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/modules-preload.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,263 +0,0 @@
-/* Sample Application Configuration */
-{
- /* success */
- // you must specify success: true
- // the authentication class may reject the request and send back a message or something
- // (not implemented yet)
- success: true,
-
- /* platform */
- // root node for remote configuration of the application consisting of these properties:
- // +modules
- // +---launchers
- // +privileges
- // +viewConfig
- // +---startConfig
- // +---styles
- // +---logoutConfig
- // TODO: rank when each of the above must be loaded in order, so that we can determine
- // how the loading might be streamed in to give perception of faster loaded application
- platform: {
-
- /* viewConfig */
- // config for the View
- viewConfig: {
- gui: 'desktop',
-
- /* startConfig */
- // config for the start menu
- startConfig: {
- iconCls: 'user',
- title: 'Michael J', // get_cookie('memberName'),
- toolItems: [{
- text: 'Settings',
- iconCls: 'settings',
- scope: this
- },'-',{
- text: 'Word wrap needed for long items',
- iconCls: 'logout',
- scope: this
- }],
- toolPanelWidth: 115
- },
-
- /* logoutConfig */
- //logoutConfig: { }, //included in controller.js already
-
- /* styles */
- styles: {
- "backgroundcolor": "575757",
- "fontcolor": "FFFFFF",
- "transparency": "100",
- "theme": {
- "id": "3",
- "name": "Vista Glass",
- "pathtofile": "..\/desktop\/resources\/themes\/xtheme-vistaglass\/css\/xtheme-vistaglass.css"},
- "wallpaper": {
- "id": "11",
- "name": "Blue Psychedelic",
- "pathtofile": "..\/desktop\/resources\/wallpapers\/blue-psychedelic.jpg"
- },
- "wallpaperposition":"tile"
- } // end of styles
- }, // end of viewConfig
-
- /* modules */
- modules: [{
-
- //A typical module config object will have this minimum form if not preloaded:
-
- // id (required), must be unique for entire app
- id: 'grid-win',
-
- xtype : 'grid-win',
-
- // To signify that no additional configuration should be retrieved from the server
- // just set the 'loaded' config property to true so that the component will not be
- // retrieved from the server again. This property is optional, but the app will
- // attempt to load this module until this property is set to true.
- loaded : false,
-
- // the number of instances of this module that may be run at one time
- // all launchers except the active apps taskbar will check this before
- // creating a new instance versus just showing the one instance.
- limit : 2,
-
- iconCls: 'acc-icon',
-
- // defaults will be applied to all launchers
- launchDefaults: {
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
-
- // launchers: an array of launcher config objects or just the name of the menu type
- // if the defaults are to be applied. Possible launcher types for a desktop type
- // environment include:
- // autorun : equivalent to the 'Startup' folder for Windows OS
- // context : right click on the desktop body
- // quick : Quick Start Buttons just to the right of the main Start Button on the taskbar
- // shortcut : Desktop shortcuts or navigation menu for other GUI's
- // start : seen after clicking on the Start button
- // tray : Buttons for the system tray (far right of taskbar)
-
- launchers : [
-
- // just specify a string for the name, and any defaults will be applied:
- 'autorun', 'context', 'quick', 'tray',
-
- // or specify a full config for finer control:
- {
- type: 'shortcut',
- // notice that these properties are the same as used in 'defaults' config
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
-
- // To add this module to the Start Menu, specify one of the following:
- // 1. the string name 'start' as a config item (see above) or
- // 2. a config object as shown below to customize the placement of the
- // module in the start menu further.
- // Specify the path the module should be listed at in the start menu
- // You can list a module in submenus by adding forward slashes to the path.
- // for example:
- // path: 'start/Bogus Menu'
- {
- type: 'start',
- path: 'start'//'start', 'tool', 'start/Bogus Menu'
- }
-
- // the handler to launch this module
- // typically you should not need to specify this as the default is this.show
- //handler : this.show,
-
- // typically you should not need to specify the scope for the handler (defaults to this module)
- //scope: this
- ], // end launchers
-
- // additional optional properties
-
- // optionally specify a different load configuration:
- loader: {
-// url: 'loader.php', // so use loader.url || this.loader;
- url: 'layoutwindow.js', // so use loader.url || this.loader;
- params: {
- foo: 'bar'
- }
- },
-
- //As with any class or xtype, specify as much additional configuration as you want may be preconfigured
- foo : 'bar'
- },{
- // id (required), must be unique for entire app
- id: 'grid-win2',
- xtype : 'grid-win',
- loaded : false,
- limit : 2,
- iconCls: 'grid-icon',
- launchDefaults: {
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
- launchers : [
- 'context', 'quick', 'tray',
- {
- type: 'shortcut',
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
- {
- type: 'start',
- path: 'start'//'start', 'tool', 'start/Bogus Menu'
- }
- ], // end launchers
- loader: {
- url: 'layoutwindow.js'
- }
- },{
- // id (required), must be unique for entire app
- id: 'grid-win3',
- xtype : 'grid-win',
- loaded : false,
- limit : 2,
- iconCls: 'grid-icon',
- launchDefaults: {
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
- launchers : [
- 'quick', 'tray',
- {
- type: 'shortcut',
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
- {
- type: 'start',
- path: 'start'//'start', 'tool', 'start/Bogus Menu'
- }
- ], // end launchers
- loader: {
- url: 'layoutwindow.js'
- }
- },{
- // id (required), must be unique for entire app
- id: 'grid-win4',
- xtype : 'grid-win',
- loaded : false,
- limit : 2,
- iconCls: 'grid-icon',
- launchDefaults: {
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
- launchers : [
- 'quick', 'tray',
- {
- type: 'shortcut',
- iconCls: 'acc-icon',
- shortcutIconCls: 'demo-acc-shortcut',
- text: 'Accordion Window',
- tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
- },
- {
- type: 'start',
- path: 'start'//'start', 'tool', 'start/Bogus Menu'
- }
- ], // end launchers
- loader: {
- url: 'layoutwindow.js'
- }
- }], // end of modules
-
- /* privileges */
- // TODO: may need to rework this, I haven't looked at what it is used for yet.
- privileges: [{
- className: 'QoDesk.QoPreferences',
- moduleId: 'qo-preferences',
- moduleType: 'system/preferences',
- menuPath: 'ToolMenu',
- launcher: {
- iconCls: 'pref-icon',
- shortcutIconCls: 'pref-shortcut-icon',
- text: 'Preferences',
- tooltip: '<b>Preferences</b><br />Allows you to modify your desktop'
- },
- loaded: false
- }] // end of privileges
- } // end of platform
-}
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/override.js
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/override.js 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/override.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,41 +0,0 @@
-Ext.override(Ext.Component, {
- /**
- * Destroys this component by purging any event listeners, removing the component's element from the DOM,
- * removing the component from its {@link Ext.Container} (if applicable) and unregistering it from
- * {@link Ext.ComponentMgr}. Destruction is generally handled automatically by the framework and this method
- * should usually not need to be called directly.
- */
- destroy : function(){
- if(this.fireEvent("beforedestroy", this) !== false){
- this.beforeDestroy();
- if(this.rendered){
- this.el.removeAllListeners();
- this.el.remove();
- if(this.actionMode == "container" || this.removeMode == "container"){
- this.container.remove();
- }
- }
- this.onDestroy();
-//*********************************************************************************************************
-//*********************************************************************************************************
- //destroy any context menu:
- if (this.cmenu) {
- Ext.destroy(this.cmenu);
- }
-//*********************************************************************************************************
-//*********************************************************************************************************
- Ext.ComponentMgr.unregister(this);
- this.fireEvent("destroy", this);
- this.purgeListeners();
- }
- },
-
- /**
- * Returns the id of this component.
- * @return {String}
- */
- getId : function(){
-// return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));
- return this.id || (this.id = this.ctype + "-" + (++Ext.Component.AUTO_ID));
- }
-});
Copied: mickael/trunk/ext/v3.0.0-a1/learn/desktop/preload.js (from rev 38, mickael/trunk/ext/v3.0.0-a1/learn/desktop/modules-preload.js)
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/preload.js (rev 0)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/preload.js 2008-12-03 18:22:06 UTC (rev 39)
@@ -0,0 +1,266 @@
+/* Sample Application Configuration */
+{
+ /* success */
+ // you must specify success: true
+ // the authentication class may reject the request and send back a message or something
+ // (not implemented yet)
+ success: true,
+
+ /* platform */
+ // root node for remote configuration of the application consisting of these properties:
+ // +modules
+ // +---launchers
+ // +privileges
+ // +viewConfig
+ // +---startConfig
+ // +---styles
+ // +---logoutConfig
+ // TODO: rank when each of the above must be loaded in order, so that we can determine
+ // how the loading might be streamed in to give perception of faster loaded application
+ platform: {
+
+ /* viewConfig */
+ // config for the View
+ viewConfig: {
+ gui: 'desktop',
+
+ /* startConfig */
+ // config for the start menu
+ startConfig: {
+ iconCls: 'user',
+ title: 'Michael J', // get_cookie('memberName'),
+ toolItems: [{
+ text: 'Settings',
+ iconCls: 'settings',
+ scope: this
+ },'-',{
+ text: 'Word wrap needed for long items',
+ iconCls: 'logout',
+ scope: this
+ }],
+ toolPanelWidth: 115
+ },
+
+ /* logoutConfig */
+ //logoutConfig: { }, //included in controller.js already
+
+ /* styles */
+ styles: {
+ "backgroundcolor": "575757",
+ "fontcolor": "FFFFFF",
+ "transparency": "100",
+ "theme": {
+ "id": "3",
+ "name": "Vista Glass",
+ "pathtofile": "..\/desktop\/resources\/themes\/xtheme-vistaglass\/css\/xtheme-vistaglass.css"},
+ "wallpaper": {
+ "id": "11",
+ "name": "Blue Psychedelic",
+ "pathtofile": "..\/desktop\/resources\/wallpapers\/blue-psychedelic.jpg"
+ },
+ "wallpaperposition":"tile"
+ } // end of styles
+ }, // end of viewConfig
+
+ /* modules */
+ modules: [{
+
+ //A typical module config object will have this minimum form if not preloaded:
+
+ // id (required), must be unique for entire app
+ id: 'grid-win',
+
+ xtype : 'grid-win',
+
+ // To signify that no additional configuration should be retrieved from the server
+ // just set the 'loaded' config property to true so that the component will not be
+ // retrieved from the server again. This property is optional, but the app will
+ // attempt to load this module until this property is set to true.
+ loaded : false,
+
+ // the number of instances of this module that may be run at one time
+ // all launchers except the active apps taskbar will check this before
+ // creating a new instance versus just showing the one instance.
+ limit : 2,
+
+ iconCls: 'acc-icon',
+
+ // defaults will be applied to all launchers
+ launchDefaults: {
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+
+ // launchers: an array of launcher config objects or just the name of the menu type
+ // if the defaults are to be applied. Possible launcher types for a desktop type
+ // environment include:
+ // autorun : equivalent to the 'Startup' folder for Windows OS
+ // context : right click on the desktop body
+ // quick : Quick Start Buttons just to the right of the main Start Button on the taskbar
+ // shortcut : Desktop shortcuts or navigation menu for other GUI's
+ // start : seen after clicking on the Start button
+ // tray : Buttons for the system tray (far right of taskbar)
+
+ launchers : [
+
+ // just specify a string for the name, and any defaults will be applied:
+ 'autorun', 'context', 'quick', 'tray',
+
+ // or specify a full config for finer control:
+ {
+ type: 'shortcut',
+ // notice that these properties are the same as used in 'defaults' config
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+
+ // To add this module to the Start Menu, specify one of the following:
+ // 1. the string name 'start' as a config item (see above) or
+ // 2. a config object as shown below to customize the placement of the
+ // module in the start menu further.
+ // Specify the path the module should be listed at in the start menu
+ // You can list a module in submenus by adding forward slashes to the path.
+ // for example:
+ // path: 'start/Bogus Menu'
+ {
+ type: 'start',
+ path: 'start'//'start', 'tool', 'start/Bogus Menu'
+ }
+
+ // the handler to launch this module
+ // typically you should not need to specify this as the default is this.show
+ //handler : this.show,
+
+ // typically you should not need to specify the scope for the handler (defaults to this module)
+ //scope: this
+ ], // end launchers
+
+ // additional optional properties
+
+ // optionally specify a different load configuration:
+ loader: {
+ // Option 1: just map to a file
+ url: 'js/modules/layoutwindow/layoutwindow.js',
+ // Option 2: map to backend controller and pass any params backend needs
+ // so the backend knows what to deliver back to client
+// url: 'loader.php',
+ params: {
+ foo: 'bar'
+ }
+ },
+
+ //As with any class or xtype, specify as much additional configuration as you want may be preconfigured
+ foo : 'bar'
+ },{
+ // id (required), must be unique for entire app
+ id: 'grid-win2',
+ xtype : 'grid-win',
+ loaded : false,
+ limit : 2,
+ iconCls: 'grid-icon',
+ launchDefaults: {
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+ launchers : [
+ 'context', 'quick', 'tray',
+ {
+ type: 'shortcut',
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+ {
+ type: 'start',
+ path: 'start'//'start', 'tool', 'start/Bogus Menu'
+ }
+ ], // end launchers
+ loader: {
+ url: 'layoutwindow.js'
+ }
+ },{
+ // id (required), must be unique for entire app
+ id: 'grid-win3',
+ xtype : 'grid-win',
+ loaded : false,
+ limit : 2,
+ iconCls: 'grid-icon',
+ launchDefaults: {
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+ launchers : [
+ 'quick', 'tray',
+ {
+ type: 'shortcut',
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+ {
+ type: 'start',
+ path: 'start'//'start', 'tool', 'start/Bogus Menu'
+ }
+ ], // end launchers
+ loader: {
+ url: 'layoutwindow.js'
+ }
+ },{
+ // id (required), must be unique for entire app
+ id: 'grid-win4',
+ xtype : 'grid-win',
+ loaded : false,
+ limit : 2,
+ iconCls: 'grid-icon',
+ launchDefaults: {
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+ launchers : [
+ 'quick', 'tray',
+ {
+ type: 'shortcut',
+ iconCls: 'acc-icon',
+ shortcutIconCls: 'demo-acc-shortcut',
+ text: 'Accordion Window',
+ tooltip: '<b>Accordion Window</b><br />A window with an accordion layout'
+ },
+ {
+ type: 'start',
+ path: 'start'//'start', 'tool', 'start/Bogus Menu'
+ }
+ ], // end launchers
+ loader: {
+ url: 'layoutwindow.js'
+ }
+ }], // end of modules
+
+ /* privileges */
+ // TODO: may need to rework this, I haven't looked at what it is used for yet.
+ privileges: [{
+ className: 'QoDesk.QoPreferences',
+ moduleId: 'qo-preferences',
+ moduleType: 'system/preferences',
+ menuPath: 'ToolMenu',
+ launcher: {
+ iconCls: 'pref-icon',
+ shortcutIconCls: 'pref-shortcut-icon',
+ text: 'Preferences',
+ tooltip: '<b>Preferences</b><br />Allows you to modify your desktop'
+ },
+ loaded: false
+ }] // end of privileges
+ } // end of platform
+}
\ No newline at end of file
Deleted: mickael/trunk/ext/v3.0.0-a1/learn/desktop/sample.css
===================================================================
--- mickael/trunk/ext/v3.0.0-a1/learn/desktop/sample.css 2008-12-03 16:31:19 UTC (rev 38)
+++ mickael/trunk/ext/v3.0.0-a1/learn/desktop/sample.css 2008-12-03 18:22:06 UTC (rev 39)
@@ -1,27 +0,0 @@
-/*
- * Ext JS Library 2.2
- * Copyright(c) 2006-2008, Ext JS, LLC.
- * licensing@xxxxxxxxx
- *
- * http://extjs.com/license
- */
-
-html, body {
- font:normal 12px verdana;
- margin:0;
- padding:0;
- border:0 none;
- overflow:hidden;
- height:100%;
-}
-
-.x-panel-body p {
- margin:5px;
-}
-
-.settings {
- background-image:url( ../shared/icons/fam/folder_wrench.png ) !important;
-}
-.nav {
- background-image:url( ../shared/icons/fam/folder_go.png ) !important;
-}
\ No newline at end of file