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 16:30:11 UTC

svn commit: r940873 - in /portals/applications/sandbox/csre/trunk/src/main/webapp: index.jsp javascript/csre/yui/csre-desktop.js javascript/csre/yui/csre-widget.js

Author: woonsan
Date: Tue May  4 14:30:11 2010
New Revision: 940873

URL: http://svn.apache.org/viewvc?rev=940873&view=rev
Log:
CSRE: adding client codes.

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/javascript/csre/yui/csre-widget.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=940873&r1=940872&r2=940873&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 14:30:11 2010
@@ -8,35 +8,17 @@ var csre_config = { base: "/csre" };
 </script>
 <script type="text/javascript" src="javascript/csre/csre.js"></script>
 <script type="text/javascript">
-function addWorkspace_onclick() {
-    var name = prompt("Enter workspace name");
-    if (!name) return;
+function test_onclick() {
+    // initialize desktop and workspace
     var desktop = csre_desktop;
     var workspace = desktop.createWorkspace();
     desktop.addWorkspace(workspace);
-}
-function selectWorkspace_onclick() {
-    var name = prompt("Enter workspace name");
-    if (!name) return;
-    var desktop = csre_desktop;
-    var workspace = desktop.getWorkspace(name);
-    if (workspace) {
-        desktop.selectWorkspace(workspace);
-    }
-}
-function setLayoutOfWorkspace_onclick() {
-    var name = prompt("Enter layout name");
-    if (!name) return;
-    var desktop = csre_desktop;
-    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;
+
+    // add widgets
     var widget = desktop.createWidget();
     desktop.get("workspace").addWidget(widget);
+    document.getElementById("awidget").style.display = "";
+    widget.set("node", "#awidget");
     widget.render();
 }
 </script>
@@ -46,22 +28,23 @@ function addWidgetToWorkspace_onclick() 
 
 <hr/>
 <form>
-<input type="button" value="Add Workspace" onclick="return addWorkspace_onclick();"/>
-<input type="button" value="Select Workspace" onclick="return selectWorkspace_onclick();"/>
-<input type="button" value="Set Layout of workspace" onclick="return setLayoutOfWorkspace_onclick();"/>
-<input type="button" value="Add Widget to Workspace" onclick="return addWidgetToWorkspace_onclick();"/>
+<input type="button" value="Test" onclick="return test_onclick();"/>
 </form>
 <hr/>
 
 <div class="workspace" style="WIDTH: 800; HEIGHT: 600; OVERFLOW: auto">
 </div>
 
-<div id="form_container">
-    <form class="yui3-widget-bd" id="theme_form" action="#" method="get">
-        <fieldset>
-            <h3>Widget Example</h3>
-        </fieldset>
-    </form>
+<div id="awidget" style="DISPLAY: none" style="border: 1px">
+  <div class="yui3-widget-hd" style="border: black solid 1px">
+    <span><strong>Title</strong></span>
+  </div>
+  <div class="yui3-widget-bd" style="border: black solid 1px">
+    <h3>Widget Example</h3>
+  </div>
+  <div class="yui3-widget-ft" style="border: black solid 1px">
+    <span><strong>Footer</strong></span>
+  </div>
 </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=940873&r1=940872&r2=940873&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 Tue May  4 14:30:11 2010
@@ -99,6 +99,9 @@ YUI.add('csre-desktop', function(Y) {
         
         workspace: {
             getter: function() {
+                if (!this._workspace) {
+                    this._workspace = this._workspaces[0];
+                }
                 return this._workspace;
             }
         }
@@ -147,7 +150,6 @@ YUI.add('csre-desktop', function(Y) {
          */
         addWorkspace: function(workspace) {
             this._workspaces.push(workspace);
-            Y.log("workspaces: " + this._workspaces);
         },
         
         /**

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=940873&r1=940872&r2=940873&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 14:30:11 2010
@@ -39,7 +39,7 @@ YUI.add('csre-widget', function(Y) {
         NAME : 'Widget',
     });
     
-    Y.extend(Y.CSRE.Widget, Y.Base, {
+    Y.extend(Y.CSRE.Widget, Y.CSRE.Component, {
         /**
          * Initializer lifecycle implementation.
          * @method initializer
@@ -62,18 +62,18 @@ YUI.add('csre-widget', function(Y) {
         render: function() {
             if (!this._overlay) {
                 var node = this.get("node");
-                if (!node) {
-                    node = Y.one('#form_container');
-                    this.set("node", node);
+                if (node) {
+                    this._overlay = new Y.Overlay({
+                        srcNode: node,
+                        width: '225px',
+                        align: { points: [ 400, 400 ] },
+                        plugins: [ Y.Plugin.Drag ]
+                    });
                 }
-                this._overlay = new Y.Overlay({
-                    srcNode: node,
-                    width: '225px',
-                    align: { points: [ 400, 400 ] },
-                    plugins: [ Y.Plugin.Drag ]
-                });
             }
-            this._overlay.render();
+            if (this._overlay) {
+                this._overlay.render();
+            }
         }
     });