Author: jmorliaguet
Date: Tue Jan  3 02:42:43 2006
New Revision: 2126

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html
Log:

- implemented switching perspectives



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Tue Jan  3 
02:42:43 2006
@@ -42,7 +42,8 @@
           if (!(perspective in CPSSkins.Perspectives)) {
             CPSSkins.Perspectives[perspective] = $A([]);
           }
-          CPSSkins.Perspectives[perspective].push(Renderers.panel(e));
+          var panel = new Renderers.panel(e);
+          CPSSkins.Perspectives[perspective].push(panel);
           break;
         }
       }
@@ -51,8 +52,19 @@
 
   getHandlers: function(controller) {
     return this.Controllers[controller].handlers;
-  }
+  },
 
+  switchPerspective: function(perspective) {
+    CPSSkins.Perspectives.each(function(s) {
+      var p = s[0];
+      if (p == perspective) {
+        CPSSkins.Perspectives[p].each(function(s) {s.show()});
+      } else {
+        CPSSkins.Perspectives[p].each(function(s) {s.hide()});
+      }
+    });
+  }
+  
 }
 
 Event.observe(window, "load", CPSSkins.init);
@@ -297,7 +309,7 @@
       class: ["contextMenu", view.getAttribute("class")],
       style: {position:"absolute", display:"none", whitespace:"nowrap"}
     });
-    new CPSSkins.ContextualMenu(widget, view);
+    return new CPSSkins.ContextualMenu(widget, view);
   },
 
   tooltip: function(view) {
@@ -306,12 +318,15 @@
       class: "tooltip",
       style: {position:"absolute", display:"none"}
     });
-    new CPSSkins.Tooltip(widget, view);
+    return new CPSSkins.Tooltip(widget, view);
   },
 
   panel: function(view) {
-    var widget = Canvas.addNode(view.parentNode, {tag: "div"});
-    new CPSSkins.Panel(widget, view);
+    var widget = Canvas.addNode(view.parentNode, {
+      tag: "div",
+      style: {display: "none"}
+    });
+    return new CPSSkins.Panel(widget, view);
   }
 
 });
@@ -335,7 +350,11 @@
   },
 
   show: function() {
-    Element.show(widget);
+    Element.show(this.widget);
+  },
+
+  hide: function() {
+    Element.hide(this.widget);
   }
 }
 

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html
   (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html
   Tue Jan  3 02:42:43 2006
@@ -25,32 +25,50 @@
 
   <h1>CPSSkins panels</h1>
 
+  <div id="msg"></div>
+
+  <a href="javascript:CPSSkins.switchPerspective('page-designer')">Page 
designer</a>
+  <a href="javascript:CPSSkins.switchPerspective('layout-designer')">Layout 
designer</a>
+
   <table style="width:100%">
     <tr style="vertical-align: top">
-      <td colspan="2">
+      <td colspan="3">
 
         <cpsskins:panel perspective="page-designer" url="panel1.html">
         </cpsskins:panel>
 
+        <cpsskins:panel perspective="layout-designer" url="panel1.html">
+        </cpsskins:panel>
+
       </td>
     </tr>
 
     <tr style="vertical-align: top">
-      <td>
+      <td style="width: 20%">
 
         <cpsskins:panel perspective="page-designer" url="panel2.html">
         </cpsskins:panel>
 
-        <cpsskins:panel perspective="layout-designer" url="panel3.html">
+        <cpsskins:panel perspective="layout-designer" url="panel2.html">
         </cpsskins:panel>
 
       </td>
-      <td>
+      <td syle="width: 60%">
+
+        <cpsskins:panel perspective="page-designer" url="panel3.html">
+        </cpsskins:panel>
 
         <cpsskins:panel perspective="page-designer" url="panel4.html">
         </cpsskins:panel>
 
       </td>
+      <td style="width: 20%">
+
+        <cpsskins:panel perspective="layout-designer" url="panel4.html">
+        </cpsskins:panel>
+
+      </td>
+
     </tr>
   </table>
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to