[richfaces-svn-commits] JBoss Rich Faces SVN: r6082 - 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
Thu Feb 14 10:22:29 EST 2008


Author: vmolotkov
Date: 2008-02-14 10:22:29 -0500 (Thu, 14 Feb 2008)
New Revision: 6082

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 is added

Modified: trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml	2008-02-14 15:21:59 UTC (rev 6081)
+++ trunk/sandbox/ui/inplaceInput/src/main/config/component/inplaceinput.xml	2008-02-14 15:22:29 UTC (rev 6082)
@@ -119,7 +119,45 @@
 		  		<classname>java.lang.String</classname>
 		  	</property>
 		  	
+		  	<property>
+		  		<name>styleClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>viewClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>editClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>changedClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>controlClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>viewHoveredClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>changedHoveredClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>controlPressedClass</name>
+		  		<classname>java.lang.String</classname>
+		  	</property>
+		  	<property>
+		  		<name>controlHoveredClass</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-14 15:21:59 UTC (rev 6081)
+++ trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js	2008-02-14 15:22:29 UTC (rev 6082)
@@ -32,6 +32,9 @@
 	
 	initHandlers : function() {
 		this.inplaceInput.observe(this.attributes.editEvent, function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
+		this.inplaceInput.observe("mouseout", function(e){this.inplaceMouseOutHandler(e);}.bindAsEventListener(this));
+		this.inplaceInput.observe("mouseover", function(e){this.inplaceMouseOverHandler(e);}.bindAsEventListener(this));
+		
 		this.tempValueKeeper.observe("blur", function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
 		this.tempValueKeeper.observe("keydown", function(e){this.tmpValueKeyDownHandler(e);}.bindAsEventListener(this));
 		
@@ -62,6 +65,23 @@
 	/*
 	 *  HANDLERS
 	 */
+	 
+	inplaceMouseOverHandler : function(e) {
+		if (this.currentState == Richfaces.InplaceInput.STATES[0]) {
+			this.inplaceInput.className += " " + this.classes.COMPONENT.VIEW.HOVERED; 
+		} else if (this.currentState == Richfaces.InplaceInput.STATES[2]) {
+			this.inplaceInput.className += " " + this.classes.COMPONENT.CHANGED.HOVERED; 
+		}
+	},
+	
+	inplaceMouseOutHandler : function(e) {
+		if (this.currentState == Richfaces.InplaceInput.STATES[0]) {
+			this.inplaceInput.className = this.classes.COMPONENT.VIEW.NORMAL; 
+		} else if (this.currentState == Richfaces.InplaceInput.STATES[2]) {
+			this.inplaceInput.className = this.classes.COMPONENT.CHANGED.NORMAL; 
+		}
+	},
+	
 	switchingStatesHandler : function(e) {
 		var target;
 		if (e.target) {
@@ -171,14 +191,14 @@
 		this.changeState(Richfaces.InplaceInput.STATES[0]);
 		
 		this.createNewText(this.currentText);
-		this.inplaceInput.className = this.classes.COMPONENT.VIEW;
+		this.inplaceInput.className = this.classes.COMPONENT.VIEW.NORMAL;
 	},
 	
 	startChangedState : function () {
 		this.changeState(Richfaces.InplaceInput.STATES[2]);
 		
 		this.createNewText(this.valueKeeper.value);
-		this.inplaceInput.className = this.classes.COMPONENT.CHANGED;
+		this.inplaceInput.className = this.classes.COMPONENT.CHANGED.NORMAL;
 	},
 	
 	/**
@@ -306,7 +326,6 @@
 	
 	positioning : function(inpWidth, inpHeight) {
 		this.bar.style.position = "absolute";
-		//this.bsPanel.style.position = "relative";
 		var bs = this.bar.style;
 		switch (this.position) {
 			case "top" : 
@@ -331,11 +350,6 @@
 };
 
 Richfaces.InplaceInput.STATES = [0, 1, 2];// 0 - view, 1- editable, 2 - changed
-Richfaces.InplaceInput.CLASSES = {
-	COMPONENT : {CHANGED : "rich-inplace rich-inplace-changed", 
-				 VIEW : "rich-inplace rich-inplace-view", 
-				 EDITABLE : "rich-inplace rich-inplace-edit"}
-}
 
 Richfaces.InplaceInput.textboxSelect = function(oTextbox, iStart, iEnd) {
    if (Prototype.Browser.IE) {
@@ -349,4 +363,4 @@
    		//FIXME
    		oTextbox.setSelectionRange(iStart, iEnd);
    }                    
-}
\ No newline at end of file
+};
\ 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-14 15:21:59 UTC (rev 6081)
+++ trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx	2008-02-14 15:22:29 UTC (rev 6082)
@@ -46,10 +46,17 @@
 	   	if (cancelIcon != null && cancelIcon.length() != 0 ) {
 	   		variables.setVariable("cancelIcon", cancelIcon);
 	   	}
+	   	
+	   	String controllClass = (String)component.getAttributes().get("controllClass");
+	   	variables.setVariable("controllClass", controllClass);
+	   	String controllHoveredClass = (String)component.getAttributes().get("controllHoveredClass"); 
+	   	variables.setVariable("controllHoveredClass", controllHoveredClass);
+	   	String controllPressedClass = (String)component.getAttributes().get("controllPressedClass"); 
+	   	variables.setVariable("controllPressedClass", controllPressedClass);
 	   	]]>
 	</jsp:scriptlet>
 	
-	<span id="#{clientId}" class="rich-inplace rich-inplace-view">
+	<span id="#{clientId}" class='rich-inplace rich-inplace-view #{component.attributes["styleClass"]}'>
 		<input id="#{clientId}tabber" type="button" value="" style="width: 1px; position: absolute; left: -32767px;" />
 		<input id='#{clientId}tempValue'
 			   class='rich-inplace-field' 
@@ -91,12 +98,20 @@
 				</table>
 			</div>
 			<div id="#{clientId}buttons" style="position:relative;">
-				<input id="#{clientId}ok" class="rich-inplace-control" type="image" onmouseup="this.className='rich-inplace-control'" 
-					   onmouseout="this.className='rich-inplace-control'" onmousedown="this.className='rich-inplace-control-press'" 
-					   src="#{saveIcon}"/>
-				<input id="#{clientId}cancel" class="rich-inplace-control" type="image" onmouseup="this.className='rich-inplace-control'" 
-					   onmouseout="this.className='rich-inplace-control'" onmousedown="this.className='rich-inplace-control-press'" 
-					   src="#{cancelIcon}"/>
+				<input id='#{clientId}ok' class='rich-inplace-control #{controlClass}' 
+					   type='image' 
+					   onmouseup="this.className='rich-inplace-control #{controlClass}'"
+					   onmouseout="this.className='rich-inplace-control #{controlClass}'"
+					   onmousedown="this.className='rich-inplace-control-press #{controlPressedClass}'"
+					   onmouseover="this.className='rich-inplace-control #{controlHoveredClass}'"
+					   src='#{saveIcon}'/>
+				<input id='#{clientId}cancel' class='rich-inplace-control #{controlClass}' 
+					   type='image' 
+					   onmouseup="this.className='rich-inplace-control #{controlClass}'"
+					   onmouseout="this.className='rich-inplace-control #{controlClass}'" 
+					   onmousedown="this.className='rich-inplace-control-press  #{controlPressedClass}'"
+					   onmouseover="this.className='rich-inplace-control #{controlHoveredClass}'"
+					   src='#{cancelIcon}'/>
 			</div>
 			<jsp:scriptlet>
 				<![CDATA[
@@ -123,6 +138,12 @@
 					  oneditactivated : #{this:getAsEventHandler(context, component, "oneditactivated")}, 
 					  onviewactivated : #{this:getAsEventHandler(context, component, "onviewactivated")}};
 		
+		Richfaces.InplaceInput.CLASSES = {
+				COMPONENT : {CHANGED : {NORMAL : 'rich-inplace rich-inplace-changed #{component.attributes["changedClass"]}', HOVERED : '#{component.attributes["changedHoveredClass"]}'},  
+				 			 VIEW : {NORMAL : 'rich-inplace rich-inplace-view #{component.attributes["viewClass"]}', HOVERED : '#{component.attributes["viewHoveredClass"]}'}, 
+				 			 EDITABLE : 'rich-inplace rich-inplace-edit #{component.attributes["editClass"]}'}
+		};
+
 		var inplaceInput = new Richfaces.InplaceInput('#{clientId}', '#{clientId}tempValue', '#{clientId}value', '#{clientId}tabber', attributes, events, Richfaces.InplaceInput.CLASSES, ['#{clientId}bar', '#{clientId}ok', '#{clientId}cancel', '#{clientId}buttons']);
 	</script>
 </f:root>	
\ No newline at end of file




More information about the richfaces-svn-commits mailing list