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/04 19:10:39 UTC
svn commit: r940966 - in
/portals/applications/sandbox/csre/trunk/src/main/webapp: index.jsp
javascript/csre/yui/csre-base.js javascript/csre/yui/csre-widget.js
javascript/csre/yui/csre-workspace.js
Author: woonsan
Date: Tue May 4 17:10:39 2010
New Revision: 940966
URL: http://svn.apache.org/viewvc?rev=940966&view=rev
Log:
CSRE: trying to add stacking of widgets.
Modified:
portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp
portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-base.js
portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-widget.js
portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-workspace.js
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=940966&r1=940965&r2=940966&view=diff
==============================================================================
--- portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp (original)
+++ portals/applications/sandbox/csre/trunk/src/main/webapp/index.jsp Tue May 4 17:10:39 2010
@@ -26,7 +26,7 @@ function test_onclick() {
// create a widget and attach the dom element to the widget.
var widget = desktop.createWidget();
- desktop.get("workspace").addWidget(widget);
+ desktop.get("workspace").add(widget);
widget.set("node", "#" + widgetDom.id);
widget.render();
}
Modified: portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-base.js
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-base.js?rev=940966&r1=940965&r2=940966&view=diff
==============================================================================
--- portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-base.js (original)
+++ portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-base.js Tue May 4 17:10:39 2010
@@ -65,6 +65,14 @@ YUI.add('csre-base', function(Y) {
getter: function() {
return this._name;
}
+ },
+ container: {
+ setter: function(container) {
+ this._container = container;
+ },
+ getter: function() {
+ return this._container;
+ }
}
};
@@ -144,6 +152,14 @@ YUI.add('csre-base', function(Y) {
getter: function() {
return this._layout;
}
+ },
+ components: {
+ getter: function() {
+ if (!this._components) {
+ this._components = [];
+ }
+ return this._components.slice(0);
+ }
}
};
@@ -161,6 +177,25 @@ YUI.add('csre-base', function(Y) {
* @method destructor
*/
destructor: function() {
+ },
+
+ /**
+ * @method add
+ */
+ add: function(component) {
+ if (!this._components) {
+ this._components = [];
+ }
+ component.set("container", this);
+ this._components.push(component);
+ },
+
+ /**
+ * @method remove
+ */
+ remove: function(component) {
+ if (this._components) {
+ }
}
});
Modified: portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-widget.js
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-widget.js?rev=940966&r1=940965&r2=940966&view=diff
==============================================================================
--- portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-widget.js (original)
+++ portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-widget.js Tue May 4 17:10:39 2010
@@ -60,19 +60,49 @@ YUI.add('csre-widget', function(Y) {
* @method render
*/
render: function() {
+ var node = this.get("node");
+ if (!node) return;
+
if (!this._overlay) {
- var node = this.get("node");
- if (node) {
- this._overlay = new Y.Overlay({
- srcNode: node,
- width: '225px',
- align: { points: [ 400, 400 ] },
- plugins: [ Y.Plugin.Drag ]
- });
- }
- }
- if (this._overlay) {
+ this._overlay = new Y.Overlay({
+ srcNode: node,
+ width: '225px',
+ align: { points: [ 400, 400 ] },
+ plugins: [ Y.Plugin.Drag ]
+ });
this._overlay.render();
+ Y.on("mousedown", this.onMouseDown, node);
+ }
+ },
+
+ /**
+ * @method onMouseDown
+ */
+ onMouseDown: function(e) {
+ var container = this.get("container");
+ if (!container) return;
+ var comps = container.get("components");
+ comps.sort(function(a, b) {
+ if (!a || !b || !a._overlay || !b._overlay) {
+ return 0;
+ } else {
+ var az = a._overlay.get("zIndex");
+ var bz = b._overlay.get("zIndex");
+ if (az > bz) {
+ return -1;
+ } else if (az < bz) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ });
+ var highest = comps[0];
+ if (highest != this) {
+ var hz = highest._overlay.get("zIndex");
+ var myz = this._overlay.get("zIndex");
+ myz.set("zIndex", hz);
+ highest.set("zIndex", myz);
}
}
});
Modified: portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-workspace.js
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-workspace.js?rev=940966&r1=940965&r2=940966&view=diff
==============================================================================
--- portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-workspace.js (original)
+++ portals/applications/sandbox/csre/trunk/src/main/webapp/javascript/csre/yui/csre-workspace.js Tue May 4 17:10:39 2010
@@ -57,18 +57,6 @@ YUI.add('csre-workspace', function(Y) {
* @method destructor
*/
destructor: function() {
- },
-
- /**
- * @method setLayout
- */
- setLayout: function(layout) {
- },
-
- /**
- * @method addWidget
- */
- addWidget: function(widget) {
}
});