portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r909693 - in /portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp: WEB-INF/jetui/yui/ decorations/portlet/blue-gradient/css/ decorations/portlet/gray-gradient-noborder/css/ decorations/portlet/gray-gradient/css/ decoration...
Date Sat, 13 Feb 2010 01:59:51 GMT
Author: taylor
Date: Sat Feb 13 01:59:51 2010
New Revision: 909693

URL: http://svn.apache.org/viewvc?rev=909693&view=rev
Log:
first commit of resize and focus management in jetui pipeline
- added a new PTitleActive style for the active (selected) portlet window
- a resize tool is added to all detached portlets (resize currently not supported in grid
portlets)
- implemented z-ordering handling for focus management to handle on clicks and related window
selections
this commit does not complete the feature, most notably persisting window height and width
not implemented in this commit

Modified:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/blue-gradient/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient-noborder/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/greenearth/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/jetspeed/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/purpleplanet/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/turbo/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/css/portal.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
Sat Feb 13 01:59:51 2010
@@ -338,6 +338,5 @@
     </div>
   </div>
 </div>
-
 </body>
 </html>

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/blue-gradient/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/blue-gradient/css/styles.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/blue-gradient/css/styles.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/blue-gradient/css/styles.css
Sat Feb 13 01:59:51 2010
@@ -32,10 +32,21 @@
     border-left: 1px solid #517B94;
     border-right: 1px solid #517B94;
     border-top: 1px solid #517B94;
-    color: #01375D;    
-    
+    color: #01375D;        
     background-image: url(../images/grad2blue.png);
 }
+.blue-gradient .PTitleActive
+{
+    padding-left:2px;
+    padding-top: 2px;
+    padding-bottom: 16px;
+    padding-right: 2px; 
+    border-left: 1px solid #517B94;
+    border-right: 1px solid #517B94;
+    border-top: 1px solid #517B94;
+    background: #01375D;
+    color: #ffffff;        
+}
 
 .blue-gradient .PTitleContent
 {   

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient-noborder/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient-noborder/css/styles.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient-noborder/css/styles.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient-noborder/css/styles.css
Sat Feb 13 01:59:51 2010
@@ -29,10 +29,25 @@
     padding-top: 2px;
     padding-bottom: 16px;
     padding-right: 2px; 
-    color: #01375D;
-    
+    color: #01375D;    
     background-image: url(../images/grad2gray.png);    
 }
+.gray-gradient-noborder .PTitle
+{
+    padding-top: 2px;
+    padding-bottom: 16px;
+    padding-right: 2px; 
+    color: #01375D;    
+    background-image: url(../images/grad2gray.png);    
+}
+.gray-gradient-noborder .PTitleActive
+{
+    padding-top: 2px;
+    padding-bottom: 16px;
+    padding-right: 2px;
+    color: #ffffff; 
+    background: #01375D;    
+}
 
 .gray-gradient-noborder .PTitleContent
 {

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient/css/styles.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient/css/styles.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/gray-gradient/css/styles.css
Sat Feb 13 01:59:51 2010
@@ -42,7 +42,18 @@
     background-image: url(../images/grad2gray.png);  
   
 }
-
+.gray-gradient .PTitleActive
+{
+    padding-left:2px;
+    padding-top: 2px;
+    padding-bottom: 16px;
+    padding-right: 2px; 
+    border-left: 1px solid #999999;
+    border-right: 1px solid #999999;
+    border-top: 1px solid #999999;
+    color: #ffffff;
+    background: #01375D;   
+}
 .gray-gradient .PTitleContent
 {
     font-weight:bold;

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/greenearth/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/greenearth/css/styles.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/greenearth/css/styles.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/greenearth/css/styles.css
Sat Feb 13 01:59:51 2010
@@ -22,6 +22,7 @@
 /* font */
 .greenearth .PTitleLeft,
 .greenearth .PTitle,
+.greenearth .PTitleActive,
 .greenearth .PTitleContent,
 .greenearth .PTitleRight,
 .greenearth .PContentLeft,
@@ -52,6 +53,18 @@
     height:5px;
 }
 
+.greenearth .PTitleActive
+{
+    padding-bottom: 16px;
+    color: #363738;
+    background: #79B400;
+    border-right:1px solid #b4b4b4;
+    border-left:1px solid #b4b4b4;
+    border-top:1px solid #b4b4b4;
+/*    border-bottom:1px solid #b4b4b4;*/
+    height:5px;
+}
+
 .greenearth .PTitleContent
 {
     font-weight: bold;

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/jetspeed/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/jetspeed/css/styles.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/jetspeed/css/styles.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/jetspeed/css/styles.css
Sat Feb 13 01:59:51 2010
@@ -22,6 +22,7 @@
 /* font */
 .jetspeed .PTitleLeft,
 .jetspeed .PTitle,
+.jetspeed .PTitleActive,
 .jetspeed .PTitleContent,
 .jetspeed .PTitleRight,
 .jetspeed .PContentLeft,
@@ -52,6 +53,20 @@
     height:5px;
 }
 
+.jetspeed .PTitleActive
+{
+    padding-bottom: 16px;
+    color: #ffffff;
+    background: #05549C;
+    border-right:1px solid #b4b4b4;
+    border-left:1px solid #b4b4b4;
+    border-top:1px solid #b4b4b4;
+/*    border-bottom:1px solid #b4b4b4;*/
+    height:5px;
+}
+
+
+
 .jetspeed .PTitleContent
 {
     font-weight: bold;

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/purpleplanet/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/purpleplanet/css/styles.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/purpleplanet/css/styles.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/purpleplanet/css/styles.css
Sat Feb 13 01:59:51 2010
@@ -22,6 +22,7 @@
 /* font */
 .purpleplanet .PTitleLeft,
 .purpleplanet .PTitle,
+.purpleplanet .PTitleActive,
 .purpleplanet .PTitleContent,
 .purpleplanet .PTitleRight,
 .purpleplanet .PContentLeft,
@@ -51,6 +52,17 @@
 /*    border-bottom:1px solid #b4b4b4;*/
     height:5px;
 }
+.purpleplanet .PTitleActive
+{
+    padding-bottom: 16px;
+    color: #ffffff;
+    background:#32004b;
+    border-right:1px solid #b4b4b4;
+    border-left:1px solid #b4b4b4;
+    border-top:1px solid #b4b4b4;
+/*    border-bottom:1px solid #b4b4b4;*/
+    height:5px;
+}
 
 .purpleplanet .PTitleContent
 {

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/turbo/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/turbo/css/styles.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/turbo/css/styles.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/portlet/turbo/css/styles.css
Sat Feb 13 01:59:51 2010
@@ -22,6 +22,7 @@
 /* font */
 .turbo .PTitleLeft,
 .turbo .PTitle,
+.turbo .PTitleActive,
 .turbo .PTitleContent,
 .turbo .PTitleRight,
 .turbo .PContentLeft,
@@ -51,6 +52,17 @@
 /*    border-bottom:1px solid #b4b4b4;*/
     height:5px;
 }
+.turbo .PTitleActive
+{
+    padding-bottom: 16px;
+    color: #ffffff;
+    background:#193B53;
+    border-right:1px solid #b4b4b4;
+    border-left:1px solid #b4b4b4;
+    border-top:1px solid #b4b4b4;
+/*    border-bottom:1px solid #b4b4b4;*/
+    height:5px;
+}
 
 .turbo .PTitleContent
 {

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
Sat Feb 13 01:59:51 2010
@@ -141,6 +141,11 @@
         lastX : 0,
         
         /**
+         * Active window selected
+         */
+        activeWindow : null,
+        
+        /**
          * Construction logic executed during instantiation.
          *
          * @method initializer
@@ -204,7 +209,7 @@
         /**
          * Updates toolbar state
          * 
-         * @method updateToolbar
+         * @method up`dateToolbar
          */        
         updateToolbar : function(toolbar, state) {
             var portal = JETUI_YUI.getPortalInstance();        	
@@ -266,10 +271,10 @@
                 groups: ['grid']            
                 });
             }
-            // BOZO: im manipulating internal DD structures, should find a way to detach
the handler
             var i = 0;
             while (i < Y.DD.DDM.targets.length) {
                 if (Y.DD.DDM.targets[i] == e.drop) {
+                	Y.log("found it!");
                     Y.DD.DDM.targets.splice(i, 1);
                     break;
                 }
@@ -278,7 +283,7 @@
             // I don't think this is working
             e.drop.unplug(Y.Plugin.Drop);
         },
- 
+        
         /**
          * @method moveToGrid moves a portlet window to another grid position in the browser
          * this is a client side only operation. Operates in grid (non-detached) mode.
@@ -389,6 +394,7 @@
 			        	}
 		        	}
 	            }
+	            portal.addResizeHandle(window);
 		        var uri = portal.portalContextPath + "/services/pagelayout/fragment/" + windowId
+ "/pos/?_type=json";
 		        uri += "&x=" + x + "&y=" + y + "&layout=detach";
 		        var config = {
@@ -397,7 +403,8 @@
                       headers: { "X-Portal-Path" : portal.portalPagePath },
                       arguments: { complete: [ windowId ] }
                   };
-		        var request = Y.io(uri, config);    			
+		        var request = Y.io(uri, config); 
+		        portal.activateWindow(window);
             }            
         },
 
@@ -462,6 +469,8 @@
 	                i++;
 	            }
 	            layout.appendChild(window);
+	            portal.removeResizeHandle(window);
+	            portal.removeWidthHeight(window);
 	            var uri = portal.portalContextPath + "/services/pagelayout/fragment/" + windowId
+ "/pos/?_type=json";
 	            uri += "&row=" + row + "&col=" + col + "&layout=attach";
 	            var config = {
@@ -739,9 +748,164 @@
             
             var uri = portal.portalContextPath + "/portlet" + portal.portalPagePath + "?entity="
+ fragment.id;
             var request = Y.io(uri, { on: { complete: portal.onPortletRenderComplete }, arguments:
{ complete: v } } );
+        },
+
+        /**
+         * @method addResizeHandle
+         */        
+        addResizeHandle : function(v) {
+            var portal = JETUI_YUI.getPortalInstance();        	
+        	var region = v.get('region');        	
+	        var mt = portal.calculateResizeMargin(v);
+	        var rh = Y.Node.create("<div class='resizeHandle'/>");
+        	rh.setStyle('position', 'absolute');
+			rh.setStyle('top', (region.bottom - region.top - mt) + "px");
+			rh.setStyle('left', (region.right - region.left - mt) + "px");        				        
+	        v.appendChild(rh);		        
+	        rh.data = 'resize';
+	        var rhDrag = new Y.DD.Drag({
+	            node: rh,
+	            groups: [],
+	            dragMode: 'point'                    
+	        }).plug(Y.Plugin.DDProxy, { 
+	          	 moveOnEnd: false         	    	
+	        });    
+	        rhDrag.addHandle('.resizeHandle');		                	
+        },
+
+        /**
+         * @method removeResizeHandle
+         */        
+        removeResizeHandle : function(v) {
+	 		v.get('children').each(function(v2,k2) {
+	 			var cl = v2.getAttribute('class');
+			    if (cl.indexOf('resizeHandle') == 0) {
+			    	v2.remove();
+			    	return;
+			    }
+	 		});        	
+        },
+
+        removeWidthHeight : function(v) {
+	 		v.get('children').each(function(v2,k2) {
+	 			var cl = v2.getAttribute('class');
+			    if (cl.indexOf('portlet') == 0) {
+			 		v2.get('children').each(function(v3,k3) {
+			 			var cl = v3.getAttribute('class');
+					    if (cl.indexOf('PContentBorder') == 0) {
+					    	v3.setStyle('width', '');
+					    	v3.setStyle('height', '');
+					 		v3.get('children').each(function(v4,k4) {
+					 			var cl = v4.getAttribute('class');
+							    if (cl.indexOf('PContent') == 0) {
+							    	v4.setStyle('width', '');
+							    	v4.setStyle('height', '');
+							    }
+					 		});
+					    }
+			 		});
+			    }
+	 		});        	        	
+        },
+        
+        /**
+         * @method calculateResizeMargin
+         */                	
+        calculateResizeMargin : function(v) {
+	        var mtt = null;
+	 		v.get('children').each(function(v2,k2) {
+	 			var cl = v2.getAttribute('class');
+			    if (cl.indexOf('portlet') == 0) {				    	
+			    	mtt = v2.getComputedStyle('marginTop'); // TODO: margin-top could be different from
other 3 margins
+			    	if (!Y.Lang.isNull(mtt)) {
+			    		mtt = parseInt(mtt);
+			    	}
+			    	return;
+			    }
+	 		});
+	    	var mt = (mtt*2) + 7; // 7 is approx the diameter of the handle image
+	    	return mt;
+        },
+        
+        /**
+         * @method find Child By Class
+         */
+        findChildByClass : function(node, styles, index) {
+        	var portal = JETUI_YUI.getPortalInstance();
+        	var result = null;
+			node.get('children').each(function(v,k) {
+				 var cl = v.getAttribute('class');
+			     if (cl.indexOf(styles[index]) == 0) {
+			    	 if (index + 1 < styles.length) {
+			    		 index = index + 1;
+			    		 var res = portal.findChildByClass(v, styles, 1);
+          	             if (!Y.Lang.isNull(res)) {
+          	            	 result =  res;
+          	            	 return result;
+          	             }
+			    	 }
+			    	 else {
+      	            	 result =  v;
+			    		 return result;
+			    	 }
+			     }
+			});        	
+			return result;
+        },
+        
+        activateWindow : function(active) {
+            var portal = JETUI_YUI.getPortalInstance();        	
+            if (!Y.Lang.isNull(portal.activeWindow) && portal.activeWindow == active)
{
+            	return; // clicking on active window, do nothing
+            }
+        	active.setStyle('zIndex', portal.calculateNextZIndex());
+        	Y.log("current target = " + active);
+            var title = portal.findChildByClass(active, ['portlet ', 'PTitle'], 0);
+            if (!Y.Lang.isNull(title)) {
+            	//var unselect = title.getComputedStyle('background'); // this deadended for
me, was not working
+            	title.setAttribute('class', 'PTitleActive');
+            	var drag = Y.DD.DDM.getDrag(active);
+            	drag.removeHandle(".PTitle");        	
+            	drag.addHandle(".PTitleActive");
+                if (!Y.Lang.isNull(portal.activeWindow)) {
+                	var title = portal.findChildByClass(portal.activeWindow, ['portlet ', 'PTitleActive'],
0);
+                    if (!Y.Lang.isNull(title)) {                            
+                    	var drag = Y.DD.DDM.getDrag(portal.activeWindow);
+                    	drag.removeHandle(".PTitleActive");        	
+                    	drag.addHandle(".PTitle");
+                    	title.setAttribute('class', 'PTitle');
+                     }
+                 }
+            }
+        	portal.activeWindow = active;                                    	
+        },
+        
+        /**
+         * @method calculateNextZIndex
+         */                	
+        calculateNextZIndex : function() {
+        	var next = 10;
+        	var draggablePortlets = Y.Node.all(JetuiConfiguration.portletStyle);    
+            draggablePortlets.each(function(v, k) {
+            	if (v.getAttribute("id") != "jsPortletTemplate")
+            	{
+        	        var portlet = v.data;
+        	        if (portlet.get("detached") == true) {
+        	        	var zi = v.getStyle('zIndex');
+        	            if (!Y.Lang.isNull(zi)) {
+        	            	var zi = parseInt(zi);
+        	            	if (zi > next) {
+        	            		next = zi;
+        	            	}        	            		
+        	            }
+
+        	        }
+            	}
+            });            	
+            return next + 1;
         }
     });
-    
+
     /**
      * Create a portlet window to represent a portal window.
      *

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/css/portal.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/css/portal.css?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/css/portal.css
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/css/portal.css
Sat Feb 13 01:59:51 2010
@@ -32,7 +32,14 @@
 	z-index: 100;
 	width: 192px;
 }
-.PTitle
+.PTitle, .PTitleActive
 {
    cursor: move;
 }
+.resizeHandle {
+    background:transparent url("/jetspeed/jetui/css/layout_sprite.png") no-repeat -20px -60px;
+	height:14px;
+    width: 14px;
+    cursor: move;    
+}
+

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js?rev=909693&r1=909692&r2=909693&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
Sat Feb 13 01:59:51 2010
@@ -1,5 +1,5 @@
 //Use loader to grab the modules needed
-YUI(JETUI_YUI).use('jetui-portal', 'console', 'dd', 'io', 'datatype-xml', 'dataschema-xml',
'dataschema-json', 'node', 'node-menunav', function(Y) {
+YUI(JETUI_YUI).use('jetui-portal', 'console', 'dd', 'io', 'datatype-xml', 'dataschema-xml',
'dataschema-json', 'node', 'dom-style', function(Y) {
 
     var portal = JETUI_YUI.getPortalInstance();
 	var config = JETUI_YUI.config;
@@ -21,9 +21,9 @@
        var nodelist = portal.jstbRight.get('children');
        nodelist.setStyle('display', currentStyle);          
 	}
-    var onClickToolbar = function(e) {
-//    	Y.log("clickd on e.target = " + e.target);
-//    	nav.setStyle('z-index', '500');
+    var onClickPortlet = function(e) {
+        var portal = JETUI_YUI.getPortalInstance();
+        portal.activateWindow(e.currentTarget);        
     }
 
     var onClickToggler = function(e) {
@@ -80,6 +80,7 @@
 		        dragGroups = ['detached'],	        
 		        dragMode = 'point';
 		        dropGroups = [];
+		        portal.addResizeHandle(v);
 	        }
 	        if (portlet.get("tool") == false)
 	        {
@@ -95,8 +96,9 @@
 		            node: v,
 		            groups: dropGroups            
 		        });
-	        }
-	    	// portlet.info();
+	        }	        
+	        v.on('click', onClickPortlet);		        
+	        // portlet.info();
     	}
     });
     
@@ -169,6 +171,16 @@
         if (drag.target) {
             drag.target.set('locked', false);
         }
+        var srcNode = drag.get('node');
+        if (srcNode.data == 'resize') {
+	        var dragParent = srcNode.get('parentNode');
+	        var region = dragParent.get('region');
+	        var mt = portal.calculateResizeMargin(dragParent);
+        	srcNode.setStyle('top', (region.bottom - region.top - mt) + "px");
+			srcNode.setStyle('left', (region.right - region.left - mt) + "px");        				      
 
+        	srcNode.setStyle('visibility', '');        	
+        	return;
+        }
         if (drag.get('node').data.get("detached"))
         {
             drag.get('node').setStyle('visibility', '');        	
@@ -185,14 +197,25 @@
     });        	
     
     Y.DD.DDM.on('drag:start', function(e) {
-        var drag = e.target;
+        var portal = JETUI_YUI.getPortalInstance();
+    	var drag = e.target;
         var dragNode = drag.get('dragNode');
         var srcNode = drag.get('node');
+        if (srcNode.data == 'resize') {
+        	dragNode.set('innerHTML', srcNode.get('innerHTML'));
+        	srcNode.setStyle('visibility', 'hidden');
+            var dragParent = srcNode.get('parentNode');        	
+            portal.activateWindow(dragParent);                	                	
+        	return;
+    	}
+        portal.activateWindow(srcNode);                	                	
+        
         dragNode.set('innerHTML', srcNode.get('innerHTML'));
 
         if (drag.get('node').data.get("detached"))
         {
-        	drag.get('node').setStyle('visibility', 'hidden');        	
+        	drag.get('node').setStyle('visibility', 'hidden');
+            portal.activateWindow(srcNode);                	
         }
         else
         {
@@ -204,6 +227,29 @@
         portal.lastY = drag.mouseXY[1];
     });
 
+    Y.DD.DDM.on('drag:drag', function(e) {
+    	var drag = e.target;
+        var srcNode = drag.get('node');    	
+        if (srcNode.data == 'resize') {
+	        var dragParent = drag.get('node').get('parentNode');
+	        var box = portal.findChildByClass(dragParent, ['portlet ', 'PContentBorder'], 0);
+	        var content = portal.findChildByClass(box, ['PContent'], 0);	        
+	    	var left = parseInt(dragParent.getStyle('left'));
+	    	var top =  parseInt(dragParent.getStyle('top'));
+	    	var width = (drag.mouseXY[0] - left) + "px";
+	    	var height = (drag.mouseXY[1] - top) + "px";
+	    	if (!Y.Lang.isNull(box)) {
+		    	box.setStyle('width', width);
+		    	box.setStyle('height', height);
+	    	}	    	
+	    	if (!Y.Lang.isNull(content)) {
+		    	content.setStyle('width', (drag.mouseXY[0] - left - 4) + "px"); // TODO: calculate
padding, border (4)
+		    	content.setStyle('height', height );
+	    	}	    	
+	    	var region = dragParent.get('region');
+        }
+    });
+    
     Y.DD.DDM.on('drag:over', function(e) {
         var portal = JETUI_YUI.getPortalInstance();
     	if (portal.isMoving)



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message