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

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Feb 19 11:34:21 EST 2008


Author: vmolotkov
Date: 2008-02-19 11:34:21 -0500 (Tue, 19 Feb 2008)
New Revision: 6174

Modified:
   trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
   trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
InplaceSelect component

Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js	2008-02-19 16:30:49 UTC (rev 6173)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js	2008-02-19 16:34:21 UTC (rev 6174)
@@ -1,21 +1,22 @@
 if(!window.Richfaces) window.Richfaces = {};
-Richfaces.InplaceSelect = Class.create(Richfaces.Input, {
-	inizialize : function($super, listObj, clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams) {
+Richfaces.InplaceSelect = Class.create(Richfaces.InplaceInput, {
+	initialize : function($super, listObj, clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams) {
+		this.comboList = listObj;
 		$super(clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams);
-		this.comboList = listObj;
 	},
 	
-	initHandlers : function() {
+	initHandlers : function($super) {
+		$super();
 		this.comboList.list.observe("click", function(e){this.listClickHandler(e);}.bindAsEventListener(this));
 		this.tempValueKeeper.observe("blur", function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
-		this.tempValueKeeper.observe("blur", function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
+		this.tempValueKeeper.observe("click", function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
 	},
 	
 	tempKeeperClickHandler : function() {
-		this.insList.showWithDelay();
+		this.comboList.showWithDelay();
 	},
 	
-	tmpValueBlurHandler : function(event) {
+	tmpValueBlurHandler : function($super, event) {
 		$super(event);
 		this.comboList.hideWithDelay();
 	},
@@ -24,5 +25,16 @@
 		this.tempValueKeeper.focus();
 		this.inputProcessing();
 		this.comboList.hideWithDelay();
+	},
+	
+	deleteViewArtifacts : function () {
+		var text = this.inplaceInput.childNodes[6];
+		if (text) {
+			this.inplaceInput.removeChild(text);
+		}
+	},
+	
+	getCurrentText : function() {
+		return this.inplaceInput.childNodes[6];
 	}
 });

Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx	2008-02-19 16:30:49 UTC (rev 6173)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx	2008-02-19 16:34:21 UTC (rev 6174)
@@ -16,21 +16,63 @@
 	new org.ajax4jsf.javascript.PrototypeScript(),
 	scripts/comboboxUtils.js,
 	scripts/combobox.js,
-	scripts/inplaceselect.js
+	scripts/inplaceinput.js,
+	scripts/inplaceselect.js,
+	/org/richfaces/renderkit/html/scripts/utils.js
 </h:scripts>
 
 <f:clientid var="clientId" />
-
 <f:resource var="saveIcon" name="org.richfaces.renderkit.html.images.saveControlIcon"/>
 <f:resource var="cancelIcon" name="org.richfaces.renderkit.html.images.CancelControlIcon"/>
+<jsp:scriptlet>
+		<![CDATA[
+		Object value = component.getAttributes().get("value");
+		Object fieldValue = component.getAttributes().get("value");
+	   	value = getConvertedStringValue(context, component,value);
+	   	if (value == null) {
+	   		fieldValue = "";
+	   		value = component.getAttributes().get("defaultLabel");
+	   	}
+	   	if (value.equals("")) {
+	   	 value = component.getAttributes().get("defaultLabel");
+	   	}
+	   	variables.setVariable("value", value);
+	   	variables.setVariable("fieldValue", fieldValue);
+	   	
+	   	/*String saveIcon =  (String)component.getAttributes().get("saveControlIcon");
+	   	if (saveIcon != null && saveIcon.length() != 0 ) {
+	   		variables.setVariable("saveIcon", saveIcon);
+	   	}
+	   	
+	   	String cancelIcon =  (String)component.getAttributes().get("cancelControlIcon");
+	   	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>
 <f:resource var="spacer" name="images/spacer.gif"/>
 	
 <span id="#{clientId}" class="insel_edit_state">
 	<input id="#{clientId}tabber" type="button" value="" style="width: 1px; position: absolute; left: -32767px;" />
 	<img id="#{clientId}inplaceStrut" src="#{spacer}" class="is_strut"/>
-	<input id="#{clientId}inplaceTmpValue" readonly="readonly" type="Text" value="New York" class="insel_field"/>
+	<input id="#{clientId}inplaceTmpValue" 
+		   readonly="readonly" 
+		   type="Text"
+		   style='display:none;' 
+		   value="#{fieldValue}" 
+		   autocomplete="off"
+		   maxlength='#{component.attributes["inputMaxLength"]}'
+		   tabindex='#{component.attributes["tabindex"]}'
+		   class="insel_field"/>
 	<input id='#{clientId}inplaceValue' name='#{clientId}value' type='hidden' value='#{fieldValue}'/>
-	<div class="insel_btn_set">
+	<div id="#{clientId}bar" class="insel_btn_set">
 		<div class="insel_shadow">
 			<table cellpadding="0" cellspacing="0" border="0" class="insel_shadow_size">
 				<tr>
@@ -58,7 +100,6 @@
 	</div>
 		
 	<div id="listParent#{clientId}" class="cb_width_list" style="position : absolute; height : 100px; left : 0px; top: 13px">
-		<iframe class="cb_width_list cb_list_scroll cb_list_position" frameborder="0"></iframe>
 		<div class="cb_shadow">
 			<table id="shadow#{clientId}" cellpadding="0" cellspacing="0" border="0" width="257" height="109">
 				<tr>
@@ -87,6 +128,7 @@
 			</div>
 		</div>
 	</div>
+	#{value}
 </span>
 <script type="text/javascript">
 	Richfaces.InplaceSelect.CLASSES = {
@@ -106,8 +148,12 @@
 				ITEM : {NORMAL : "rich-combobox-item #{itemClass}", 
 				    	SELECTED : "rich-combobox-item rich-combobox-item-selected #{itemSelectedClass}"
 				}
+			},
+			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 richInplaceSelAttributes = {defaultLabel : '#{component.attributes["defaultLabel"]}', 
 					  showControls : #{component.attributes["showControls"]},




More information about the richfaces-svn-commits mailing list