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

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Jan 14 12:11:49 EST 2008


Author: vmolotkov
Date: 2008-01-14 12:11:49 -0500 (Mon, 14 Jan 2008)
New Revision: 5358

Modified:
   trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
   trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
z-index is added to component

Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js	2008-01-14 17:00:00 UTC (rev 5357)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js	2008-01-14 17:11:49 UTC (rev 5358)
@@ -13,6 +13,9 @@
 		
 		this.combobox = $(combobox); 
 		this.field = $(fieldId);
+		
+		//this.field.prevValue = null;
+		
 		this.button = $(buttonId);
 		this.buttonBG = $(buttonBGId);
 		var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
@@ -212,12 +215,39 @@
 				}
 			}
 			
-			if (((event.keyCode != Event.KEY_BACKSPACE) && (event.keyCode != Event.KEY_DELETE)) && isSearchSuccessful) {
+			if (this.isValueSet(event) && isSearchSuccessful) {
 				this.setValue();
 			}
 		}
 	},
 	
+	wasTextDeleted : function(event) {
+		if ((event.keyCode == Event.KEY_BACKSPACE) 
+			|| (event.keyCode == Event.KEY_DELETE) 
+			|| (event.ctrlKey && (event.keyCode == 88))) {
+			return true;
+		}
+		return false;
+	},
+	
+	isValueSet : function(event) {
+		/*if (this.field.prevValue) {
+			if (this.field.prevValue.toLowerCase() != this.field.value.toLowerCase()) {
+				return true;
+			}
+			return false;
+		}
+		return true;*/
+		if (this.wasTextDeleted(event) 
+			|| (event.keyCode == 17) 
+			|| event.altKey 
+			|| event.ctrlKey 
+			|| event.shiftKey) {
+			return false;
+		}
+		return true;
+	},
+	
 	setValue : function(toSetOnly) {
 		if (!this.comboList.activeItem) {
 			return;
@@ -230,6 +260,7 @@
 					this.field.value = "";
 				}
 			}
+			this.field.prevValue = value;
 			this.field.value = value;
 			this.comboList.doSelectItem(this.comboList.activeItem);
 			this.combobox.fire("rich:onitemselected", {});
@@ -240,6 +271,7 @@
 			if (this.directInputSuggestions) {
 				var startInd = this.field.value.length; 
 				var endInd = value.length;
+				//this.field.prevValue = this.field.value;
 				this.field.value = value;
 				Richfaces.ComboBox.textboxSelect(this.field, startInd, endInd);
 			} 
@@ -625,9 +657,23 @@
        oRange.select();                                              
    } else if (Prototype.Browser.Gecko) {
        oTextbox.setSelectionRange(iStart, iEnd);
+   } else {
+   		//FIXME
+   		oTextbox.setSelectionRange(iStart, iEnd);
    }                    
 } 
 
+Richfaces.ComboBox.getSelectedText = function(oTextbox) {
+	if (window.getSelection) {
+		return window.getSelection().text;
+	} else if (document.selection) { 
+		// should come last; Opera!
+		return document.selection.createRange();
+	} else {
+		//TODO
+	}
+}
+
 Richfaces.ComboBox.SPECIAL_KEYS = [
 	Event.KEY_RETURN, Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RIGHT, Event.KEY_LEFT 
 ]
\ No newline at end of file

Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-14 17:00:00 UTC (rev 5357)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-14 17:11:49 UTC (rev 5358)
@@ -191,7 +191,7 @@
 	</jsp:scriptlet>
 	<div id="#{clientId}" class="rich-combobox-font rich-combobox-shell #{styleClass}" style="width:#{listWidth}; #{style}"
 		 x:passThruWithExclusions="value,name,type,id,styleClass,class,style,size,autocomplete,disabled,onchange">
-		<div class="rich-combobox-font rich-combobox-shell" style="width:#{width}">
+		<div class="rich-combobox-font rich-combobox-shell" style="width:#{width};z-index:1;">
 			<input id="comboboxField#{clientId}" 
 				   name="comboboxField#{clientId}" 
 				   disabled="#{disabled}" 
@@ -214,8 +214,8 @@
 		</div>
 		
 		<div id="listParent#{clientId}" class="rich-combobox-list-cord #{listClass}" style="display:none; #{listStyle};">
-			<iframe class="rich-combobox-list-scroll rich-combobox-list-position" frameborder="0" style="width:#{listWidth};"/>
-			<div id="listPosition#{clientId}" class="rich-combobox-list-position" style="width:#{listWidth};">
+			<iframe class="rich-combobox-list-scroll rich-combobox-list-position" frameborder="0" style="width:#{listWidth};z-index:2;background-color:white;"/>
+			<div id="listPosition#{clientId}" class="rich-combobox-list-position" style="width:#{listWidth};z-index:3;">
 				<div id="listDecoration#{clientId}" class="rich-combobox-list-decoration">
 					<div id="list#{clientId}" class="rich-combobox-list-scroll" style="width:#{listWidth};">
 						<f:call name="encodeItems"/>




More information about the richfaces-svn-commits mailing list