[richfaces-svn-commits] JBoss Rich Faces SVN: r6111 - in trunk/sandbox/ui/inplaceInput/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Feb 15 08:53:51 EST 2008


Author: vmolotkov
Date: 2008-02-15 08:53:51 -0500 (Fri, 15 Feb 2008)
New Revision: 6111

Modified:
   trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml
   trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
   trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
vertical and horizontal position of controls bar

Modified: trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml	2008-02-15 13:43:42 UTC (rev 6110)
+++ trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml	2008-02-15 13:53:51 UTC (rev 6111)
@@ -76,13 +76,13 @@
 		  	<property>
 		  		<name>controlsPosition</name>
 		  		<classname>java.lang.String</classname>
-		  		<defaultvalue><![CDATA["right"]]></defaultvalue>
+		  		<defaultvalue><![CDATA["center"]]></defaultvalue>
 		  	</property>
 		  	
 		  	<property>
 		  		<name>controlsHorizontalAlign</name>
 		  		<classname>java.lang.String</classname>
-		  		<defaultvalue><![CDATA["left"]]></defaultvalue>
+		  		<defaultvalue><![CDATA["right"]]></defaultvalue>
 		  	</property>
 		  	
 		  	<property>

Modified: trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js	2008-02-15 13:43:42 UTC (rev 6110)
+++ trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js	2008-02-15 13:53:51 UTC (rev 6111)
@@ -25,7 +25,7 @@
 		
 		if (this.attributes.showControls) {
 			this.bar = new Richfaces.InplaceInputBar(barParams[0], barParams[1], barParams[2], barParams[3], 
-													 this.attributes.controlsPosition);
+													 this.attributes.verticalPosition, this.attributes.horizontalPosition);
 		}
 		this.initHandlers();	
 		this.initEvents();
@@ -297,13 +297,14 @@
 
 Richfaces.InplaceInputBar = Class.create();
 Richfaces.InplaceInputBar.prototype = {
-	initialize : function(barId, okId, cancelId, buttonsPanelId, position) {
+	initialize : function(barId, okId, cancelId, buttonsPanelId, verticalPosition, horizontalPosition) {
 		this.bar = $(barId);
 		this.ok = $(okId);
 		this.cancel = $(cancelId);
 		this.bsPanel = $(buttonsPanelId);
 		
-		this.position = position;
+		this.verticalPosition = verticalPosition;
+		this.horizontalPosition = horizontalPosition;
 		this.initDimensions();
 	},
 	
@@ -332,23 +333,35 @@
 	positioning : function(inpWidth, inpHeight) {
 		this.bar.style.position = "absolute";
 		var bs = this.bar.style;
-		switch (this.position) {
-			case "top" : 
+		
+		if (this.verticalPosition == "top" || this.verticalPosition == "bottom") {
+			switch (this.horizontalPosition) {
+				case "left" : 
+					bs.left = "0px"; 
+					break;
+				case "right" : 
+					bs.left = inpWidth + "px"; 
+					break;
+				case "center" : 
+					bs.left = parseInt(inpWidth/2 - this.BAR_WIDTH/2) + "px"; 
+					break; 
+			}
+			
+			if (this.verticalPosition == "top") {
 				bs.top = -this.BAR_HEIGHT + "px";
-				bs.left = "0px"; 
-				break; 
-			case "bottom" :
+			} else {
 				bs.top = inpHeight + "px";
-				bs.left = "0px"; 
-				break; 
-			case "left" :
-			 	bs.top = "0px";
-				bs.left = -this.BAR_WIDTH + "px";
-				break; 
-			case "right" : 
-				bs.top = "0px";
-				bs.left = inpWidth + "px";
-				break; 
+			}
+		} else if (this.verticalPosition == "center") {
+			bs.top = "0px";
+			switch (this.horizontalPosition) {
+				case "left" : 
+					bs.left = -this.BAR_WIDTH + "px";
+					break;
+				case "right" :
+					bs.left = inpWidth + "px"; 
+					break;
+			}
 		}
 	}
 	

Modified: trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx	2008-02-15 13:43:42 UTC (rev 6110)
+++ trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx	2008-02-15 13:53:51 UTC (rev 6111)
@@ -128,7 +128,8 @@
 						  applyFromControlsOnly : #{component.attributes["applyFromControlsOnly"]},
 						  editEvent : '#{component.attributes["editEvent"]}',
 						  selectOnEdit : #{component.attributes["selectOnEdit"]},
-						  controlsPosition : '#{component.attributes["controlsPosition"]}',
+						  verticalPosition : '#{component.attributes["controlsPosition"]}',
+						  horizontalPosition : '#{component.attributes["controlsHorizontalAlign"]}',
 						  inputWidth : '#{component.attributes["inputWidth"]}',
 						  inputMinWidth : '#{component.attributes["inputMinWidth"]}',
 						  inputMaxWidth : '#{component.attributes["inputMaxWidth"]}'




More information about the richfaces-svn-commits mailing list