You are viewing a plain text version of this content. The canonical link for it is here.
Posted to portalapps-dev@portals.apache.org by wo...@apache.org on 2010/05/03 16:07:26 UTC
svn commit: r940461 - in
/portals/applications/sandbox/csre/trunk/src/main/webapp: index.jsp
javascript/csre/yui/csre-desktop.js themes/gogreen/css/styles.css
Author: woonsan
Date: Mon May 3 14:07:26 2010
New Revision: 940461
URL: http://svn.apache.org/viewvc?rev=940461&view=rev
Log:
Client-side Rendering Engine: refining class hierarchy.
Modified:
portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp
portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-desktop.js
portals/applications/sandbox/csre/trunk/src/main/webapp/themes/gogreen/css/styles.css
Modified: portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp?rev=940461&r1=940460&r2=940461&view=diff
==============================================================================
--- portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp (original)
+++ portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp Mon May 3 14:07:26 2010
@@ -12,7 +12,7 @@ function addWorkspace_onclick() {
var name = prompt("Enter workspace name");
if (!name) return;
var desktop = csre_desktop;
- var workspace = desktop.createWorkspace({"name": name});
+ var workspace = desktop.createWorkspace();
desktop.addWorkspace(workspace);
}
function selectWorkspace_onclick() {
@@ -28,15 +28,15 @@ function setLayoutOfWorkspace_onclick()
var name = prompt("Enter layout name");
if (!name) return;
var desktop = csre_desktop;
- var layout = desktop.createLayout({"name": name});
- desktop.workspace.setLayout(layout);
+ var layout = desktop.createLayout();
+ desktop.get("workspace").setLayout(layout);
}
function addWidgetToWorkspace_onclick() {
var name = prompt("Enter widget name");
if (!name) return;
var desktop = csre_desktop;
- var widget = desktop.createWidget({"name": name});
- desktop.workspace.addWidget(widget);
+ var widget = desktop.createWidget();
+ desktop.get("workspace").addWidget(widget);
}
</script>
</head>
@@ -52,7 +52,7 @@ function addWidgetToWorkspace_onclick()
</form>
<hr/>
-<div class="desktop" style="WIDTH: 800; HEIGHT: 600; OVERFLOW: auto">
+<div class="workspace" style="WIDTH: 800; HEIGHT: 600; OVERFLOW: auto">
</div>
</body>
Modified: portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-desktop.js
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-desktop.js?rev=940461&r1=940460&r2=940461&view=diff
==============================================================================
--- portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-desktop.js (original)
+++ portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-desktop.js Mon May 3 14:07:26 2010
@@ -19,19 +19,29 @@
YUI.add('csre-desktop', function(Y) {
+ /**
+ * CSRE JavaScript Framework
+ * @module csre
+ */
Y.namespace("CSRE");
- Y.CSRE.Widget = function(widgetConfig) {
- Y.CSRE.Widget.superclass.constructor.apply(this, arguments);
+ /**
+ * Create a component to represent a UI block.
+ * @class CSRE.Component
+ * @extends Base
+ * @constructor
+ */
+ Y.CSRE.Component = function() {
+ Y.CSRE.Component.superclass.constructor.apply(this, arguments);
};
- Y.mix(Y.CSRE.Widget, {
- NAME : 'Widget',
+ Y.mix(Y.CSRE.Component, {
+ NAME : 'Component',
});
- Y.CSRE.Widget.ATTRS = {
+ Y.CSRE.Component.ATTRS = {
/**
- * The object for desktop
+ * The node object for this component.
* @attribute node
* @type Node
*/
@@ -42,14 +52,25 @@ YUI.add('csre-desktop', function(Y) {
if (!node) {
}
return node;
+ },
+ getter: function() {
+ return this._node;
+ }
+ },
+ name: {
+ setter: function(name) {
+ this._name = name;
+ return name;
+ },
+ getter: function() {
+ return this._name;
}
}
};
- Y.extend(Y.CSRE.Widget, Y.Base, {
+ Y.extend(Y.CSRE.Component, Y.Base, {
/**
* Initializer lifecycle implementation.
- *
* @method initializer
* @param {Object} config Configuration object with property name/value pairs.
*/
@@ -58,16 +79,19 @@ YUI.add('csre-desktop', function(Y) {
/**
* Destructor lifecycle implementation.
- *
- * Removes any event listeners or injected methods applied by the Plugin
- *
* @method destructor
*/
destructor: function() {
}
});
- Y.CSRE.Layout = function(layoutConfig) {
+ /**
+ * Create a layout to represent a layout of a workspace.
+ * @class CSRE.Layout
+ * @extends Base
+ * @constructor
+ */
+ Y.CSRE.Layout = function() {
Y.CSRE.Layout.superclass.constructor.apply(this, arguments);
};
@@ -75,27 +99,57 @@ YUI.add('csre-desktop', function(Y) {
NAME : 'Layout',
});
- Y.CSRE.Layout.ATTRS = {
+ Y.extend(Y.CSRE.Layout, Y.CSRE.Component, {
/**
- * The object for desktop
- * @attribute node
- * @type Node
+ * Initializer lifecycle implementation.
+ * @method initializer
+ * @param {Object} config Configuration object with property name/value pairs.
*/
- node: {
- setter: function(node) {
- node = Y.one(node);
- this._node = node;
- if (!node) {
- }
- return node;
+ initializer : function(config) {
+ },
+
+ /**
+ * Destructor lifecycle implementation.
+ * @method destructor
+ */
+ destructor: function() {
+ }
+ });
+
+ /**
+ * Create a container to to hold components
+ * @class CSRE.Container
+ * @extends Base
+ * @constructor
+ */
+ Y.CSRE.Container = function() {
+ Y.CSRE.Container.superclass.constructor.apply(this, arguments);
+ };
+
+ Y.mix(Y.CSRE.Container, {
+ NAME : 'Container',
+ });
+
+ Y.CSRE.Container.ATTRS = {
+ /**
+ * The layout object for this container.
+ * @attribute layout
+ * @type Y.CSRE.Layout
+ */
+ layout: {
+ setter: function(layout) {
+ this._layout = layout;
+ return layout;
+ },
+ getter: function() {
+ return this._layout;
}
}
};
- Y.extend(Y.CSRE.Layout, Y.Base, {
+ Y.extend(Y.CSRE.Container, Y.CSRE.Component, {
/**
* Initializer lifecycle implementation.
- *
* @method initializer
* @param {Object} config Configuration object with property name/value pairs.
*/
@@ -104,47 +158,58 @@ YUI.add('csre-desktop', function(Y) {
/**
* Destructor lifecycle implementation.
- *
- * Removes any event listeners or injected methods applied by the Plugin
- *
* @method destructor
*/
destructor: function() {
}
});
-
- Y.CSRE.Workspace = function() {
- Y.CSRE.Workspace.superclass.constructor.apply(this, arguments);
+
+ /**
+ * Create a widget to represent a UI block.
+ * @class CSRE.Widget
+ * @extends Base
+ * @constructor
+ */
+ Y.CSRE.Widget = function() {
+ Y.CSRE.Widget.superclass.constructor.apply(this, arguments);
};
- Y.mix(Y.CSRE.Workspace, {
- NAME : 'Workspace',
+ Y.mix(Y.CSRE.Widget, {
+ NAME : 'Widget',
});
- Y.CSRE.Workspace.ATTRS = {
+ Y.extend(Y.CSRE.Widget, Y.CSRE.Component, {
/**
- * The object for desktop
- * @attribute node
- * @type Node
+ * Initializer lifecycle implementation.
+ * @method initializer
+ * @param {Object} config Configuration object with property name/value pairs.
*/
- node: {
- setter: function(node) {
- node = Y.one(node);
- this._node = node;
- if (!node) {
- }
- return node;
- }
+ initializer : function(config) {
},
-
- name: {
- getter: function() {
- return this.name;
- }
+
+ /**
+ * Destructor lifecycle implementation.
+ * @method destructor
+ */
+ destructor: function() {
}
+ });
+
+ /**
+ * Create a workspace to represent a unit of the screen.
+ * @class CSRE.Workspace
+ * @extends Base
+ * @constructor
+ */
+ Y.CSRE.Workspace = function() {
+ Y.CSRE.Workspace.superclass.constructor.apply(this, arguments);
};
- Y.extend(Y.CSRE.Workspace, Y.Base, {
+ Y.mix(Y.CSRE.Workspace, {
+ NAME : 'Workspace',
+ });
+
+ Y.extend(Y.CSRE.Workspace, Y.CSRE.Container, {
/**
* Initializer lifecycle implementation.
*
@@ -177,6 +242,13 @@ YUI.add('csre-desktop', function(Y) {
}
});
+ /**
+ * Create a desktop as an abstract screen
+ *
+ * @class CSRE.Layout
+ * @extends Base
+ * @constructor
+ */
Y.CSRE.Desktop = function() {
Y.CSRE.Desktop.superclass.constructor.apply(this, arguments);
};
@@ -189,39 +261,24 @@ YUI.add('csre-desktop', function(Y) {
Y.CSRE.Desktop.ATTRS = {
- /**
- * The object for desktop
- * @attribute node
- * @type Node
- */
- node: {
- setter: function(node) {
- node = Y.one(node);
- this._node = node;
- if (!node) {
- }
- return node;
- }
- },
-
workspaces: {
getter: function() {
- return this.workspaces;
+ return this._workspaces;
}
},
workspace: {
getter: function() {
- return this.workspace;
+ return this._workspace;
}
}
};
- Y.extend(Y.CSRE.Desktop, Y.Base, {
+ Y.extend(Y.CSRE.Desktop, Y.CSRE.Container, {
- workspaces: [],
+ _workspaces: [],
- workspace: null,
+ _workspace: null,
/**
* Initializer lifecycle implementation.
@@ -230,7 +287,7 @@ YUI.add('csre-desktop', function(Y) {
* @param {Object} config Configuration object with property name/value pairs.
*/
initializer : function(config) {
- var ws = new Y.CSRE.Workspace({});
+ var ws = new Y.CSRE.Workspace();
},
/**
@@ -248,8 +305,8 @@ YUI.add('csre-desktop', function(Y) {
*
* @method createWorkspace
*/
- createWorkspace: function(workspaceConfig) {
- var ws = new Y.CSRE.Workspace(workspaceConfig);
+ createWorkspace: function() {
+ var ws = new Y.CSRE.Workspace();
return ws;
},
@@ -259,8 +316,8 @@ YUI.add('csre-desktop', function(Y) {
* @method createWorkspace
*/
addWorkspace: function(workspace) {
- this.workspaces.push(workspace);
- Y.log("workspaces: " + this.workspaces);
+ this._workspaces.push(workspace);
+ Y.log("workspaces: " + this._workspaces);
},
/**
@@ -269,7 +326,7 @@ YUI.add('csre-desktop', function(Y) {
* @method getWorkspace
*/
getWorkspace: function(name) {
- return this.workspaces[0];
+ return this._workspaces[0];
},
/**
@@ -280,7 +337,7 @@ YUI.add('csre-desktop', function(Y) {
selectWorkspace: function(name) {
var ws = this.getWorkspace(name);
if (ws) {
- this.workspace = ws;
+ this._workspace = ws;
}
},
@@ -289,8 +346,8 @@ YUI.add('csre-desktop', function(Y) {
*
* @method createLayout
*/
- createLayout: function(layoutConfig) {
- var layout = new Y.CSRE.Layout(layoutConfig);
+ createLayout: function() {
+ var layout = new Y.CSRE.Layout();
return layout;
},
@@ -299,8 +356,8 @@ YUI.add('csre-desktop', function(Y) {
*
* @method createWidget
*/
- createWidget: function(widgetConfig) {
- var widget = new Y.CSRE.Widget(widgetConfig);
+ createWidget: function() {
+ var widget = new Y.CSRE.Widget();
return widget;
}
Modified: portals/applications/sandbox/csre/trunk/src/main/webapp/themes/gogreen/css/styles.css
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/csre/trunk/src/main/webapp/themes/gogreen/css/styles.css?rev=940461&r1=940460&r2=940461&view=diff
==============================================================================
--- portals/applications/sandbox/csre/trunk/src/main/webapp/themes/gogreen/css/styles.css (original)
+++ portals/applications/sandbox/csre/trunk/src/main/webapp/themes/gogreen/css/styles.css Mon May 3 14:07:26 2010
@@ -15,4 +15,4 @@ See the License for the specific languag
limitations under the License.
*/
-.desktop { background-color: #efe }
+.workspace { background-color: #efe }