[richfaces-svn-commits] JBoss Rich Faces SVN: r5960 - in trunk/sandbox/ui/inplaceInput/src/main: templates and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Feb 8 12:50:25 EST 2008


Author: vmolotkov
Date: 2008-02-08 12:50:25 -0500 (Fri, 08 Feb 2008)
New Revision: 5960

Modified:
   trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
   trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
component's attributes are added

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-08 17:11:17 UTC (rev 5959)
+++ trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js	2008-02-08 17:50:25 UTC (rev 5960)
@@ -16,13 +16,21 @@
 	},
 	
 	initHandlers : function() {
-		this.inplaceInput.observe(this.attributes['editEvent'], function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
+		this.inplaceInput.observe(this.attributes.editEvent, function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
 	},
 	
 	switchingStatesHandler : function() {
+		this.endViewState();
+		this.tempValueKeeper.show();
 		
 		this.currentState = Richfaces.InplaceInput.STATES[1];
+	},
+	
+	endViewState : function() {
+		var viewValue = (this.inplaceInput.textContent) ? this.inplaceInput.textContent : this.inplaceInput.textNode;  
+		this.inplaceInput.removeNode(viewValue);
 	}
+	
 };
 
 Richfaces.InplaceInput.STATES = [0, 1, 2];// 0 - view, 1- editable, 2 - changed
\ No newline at end of file

Modified: trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx	2008-02-08 17:11:17 UTC (rev 5959)
+++ trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx	2008-02-08 17:50:25 UTC (rev 5960)
@@ -31,15 +31,15 @@
 		<input id='#{clientId}value' type='hidden' value='#{component.attributes["value"]}'/>
 	</span>
 	<script type="text/javascript">
-		var attributes = [defaultLabel = '#{component.attributes["defaultLabel"]}', 
-						  showControls = '#{component.attributes["showControls"]}',
-						  apllyFromControlsOnly = '{component.attributes["apllyFromControlsOnly"]}',
-						  editEvent = '#{component.attributes["editEvent"]}'];
+		var attributes = {defaultLabel : '#{component.attributes["defaultLabel"]}', 
+						  showControls : '#{component.attributes["showControls"]}',
+						  apllyFromControlsOnly : '#{component.attributes["apllyFromControlsOnly"]}',
+						  editEvent : '#{component.attributes["editEvent"]}'};
 						  
-		var events = [oneditactivation = '#{component.attributes["oneditactivation"]}', 
-					  onviewactivation = '#{component.attributes["defaultLabel"]}', 
-					  oneditactivated = '#{component.attributes["onviewactivation"]}', 
-					  onviewactivated = '#{component.attributes["onviewactivated"]}'];
+		var events = {oneditactivation : '#{component.attributes["oneditactivation"]}', 
+					  onviewactivation : '#{component.attributes["onviewactivation"]}', 
+					  oneditactivated : '#{component.attributes["onviewactivation"]}', 
+					  onviewactivated : '#{component.attributes["onviewactivated"]}'};
 					  
 		var inplaceInput = new Richfaces.InplaceInput('#{clientId}', '#{clientId}tempValue', '#{clientId}value', attributes, events);
 	</script>




More information about the richfaces-svn-commits mailing list