[richfaces-svn-commits] JBoss Rich Faces SVN: r5956 - 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 8 11:30:26 EST 2008


Author: vmolotkov
Date: 2008-02-08 11:30:26 -0500 (Fri, 08 Feb 2008)
New Revision: 5956

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:
component's attributes are added

Modified: trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml	2008-02-08 16:03:30 UTC (rev 5955)
+++ trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml	2008-02-08 16:30:26 UTC (rev 5956)
@@ -32,6 +32,63 @@
        			<name>value</name>
        			<classname>java.lang.String</classname>
        		</property>
+       		<property>
+		  		<name>inputSize</name>
+		  		<classname>java.lang.Integer</classname>
+		  		<defaultvalue>10</defaultvalue>
+		  	</property>
+		  	<property>
+		  		<name>inputMaxLength</name>
+		  		<classname>java.lang.Integer</classname>
+		  		<defaultvalue>10</defaultvalue>
+		  	</property>
+		  	<property>
+		  		<name>inputMinLength</name>
+		  		<classname>java.lang.Integer</classname>
+		  		<defaultvalue>10</defaultvalue>
+		  	</property>
+		  	<property>
+		  		<name>defaultLabel</name>
+		  		<classname>java.lang.String</classname>
+		  		<defaultvalue><![CDATA["Click..."]]></defaultvalue>
+		  	</property>
+		  	<property>
+		  		<name>showControls</name>
+		  		<classname>boolean</classname>
+		  		<defaultvalue>false</defaultvalue>
+		  	</property>
+		  	<property>
+		  		<name>apllyFromControlsOnly</name>
+		  		<classname>boolean</classname>
+		  		<defaultvalue>false</defaultvalue>
+		  	</property>
+		  	<property>
+		  		<name>apllyFromControlsOnly</name>
+		  		<classname>boolean</classname>
+		  		<defaultvalue>false</defaultvalue>
+		  	</property>
+		  	<property>
+		  		<name>editEvent</name>
+		  		<classname>java.lang.String</classname>
+		  		<defaultvalue><![CDATA["click"]]></defaultvalue>
+		  	</property>
+		  	
+		  	<property>
+		  		<name>oneditactivation</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>onviewactivation</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>oneditactivated</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>onviewactivated</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
 		</properties>    
     </component>
 </components>

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 16:03:30 UTC (rev 5955)
+++ trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js	2008-02-08 16:30:26 UTC (rev 5956)
@@ -4,10 +4,25 @@
 
 Richfaces.InplaceInput.prototype = {
 	
-	initialize: function() {
+	initialize: function(clientId, temValueKeepId, valueKeepId, attributes, events) {
+		this.inplaceInput = $(clientId);
+		this.tempValueKeeper = $(temValueKeepId);
+		this.valueKeeper = $(valueKeepId);
+		this.attributes = attributes;
+		
+		this.currentState = Richfaces.InplaceInput.STATES[0];
+		
 		this.initHandlers();	
 	},
 	
 	initHandlers : function() {
+		this.inplaceInput.observe(this.attributes['editEvent'], function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
 	},
-};
\ No newline at end of file
+	
+	switchingStatesHandler : function() {
+		
+		this.currentState = Richfaces.InplaceInput.STATES[1];
+	}
+};
+
+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 16:03:30 UTC (rev 5955)
+++ trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx	2008-02-08 16:30:26 UTC (rev 5956)
@@ -18,7 +18,29 @@
 	</h:scripts>
  
 	<f:clientid var="clientId" />
+	<span id="#{clientId}" class="rich-inplace">
+		#{component.attributes["value"]}
+		<input id='#{clientId}tempValue"'
+			   class='rich-inplace-input' 
+			   style='display:none;' 
+			   type='text'
+			   size='#{component.attributes["inputSize"]}'
+			   maxlength='#{component.attributes["inputMaxLength"]}'
+			   minlength='#{component.attributes["inputMinLength"]}' 
+			   value='#{component.attributes["value"]}'/>
+		<input id='#{clientId}value' type='hidden' value='#{component.attributes["value"]}'/>
+	</span>
 	<script type="text/javascript">
-		var inplaceInput = new Richfaces.InplaceInput();
+		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 inplaceInput = new Richfaces.InplaceInput('#{clientId}', '#{clientId}tempValue', '#{clientId}value', attributes, events);
 	</script>
 </f:root>	
\ No newline at end of file




More information about the richfaces-svn-commits mailing list