[richfaces-svn-commits] JBoss Rich Faces SVN: r5280 - 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
Thu Jan 10 15:04:37 EST 2008


Author: vmolotkov
Date: 2008-01-10 15:04:37 -0500 (Thu, 10 Jan 2008)
New Revision: 5280

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:
disable/enable functionality

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-10 18:55:59 UTC (rev 5279)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js	2008-01-10 20:04:37 UTC (rev 5280)
@@ -3,7 +3,7 @@
 
 Richfaces.ComboBox.prototype = {
 	
-	initialize: function(combobox, listId, parentListId, fieldId, buttonId, classes, listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue, selectFirstOnUpdate, onlistcall, onselected, onchange, defaultMessage) {
+	initialize: function(combobox, listId, parentListId, fieldId, buttonId, classes, listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue, selectFirstOnUpdate, onlistcall, onselected, defaultMessage) {
 		this.directInputSuggestions = directInputSuggestions;
 		this.filterNewValue = filterNewValue;
 		
@@ -12,7 +12,7 @@
 		this.button = $(buttonId);
 		var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
 		fieldDem.height = this.field.offsetHeight;
-		this.comboList = new Richfaces.ComboBoxList(listId, parentListId, selectFirstOnUpdate, classes, listWidth, listHeight, itemsText, onlistcall, fieldDem);
+		this.comboList = new Richfaces.ComboBoxList(listId, parentListId, selectFirstOnUpdate, classes.COMBO_LIST, listWidth, listHeight, itemsText, onlistcall, fieldDem);
 		
 		this.defaultMessage = defaultMessage;
 		
@@ -21,6 +21,8 @@
 		
 		this.isSelection = true;
 		
+		this.classes = classes;
+		
 		this.initCombobox();
 	},
 	
@@ -42,13 +44,13 @@
 			this.combobox.observe("rich:onitemselected", this.onselected);
 		}
 		
-		if (this.onchange) {
-			this.combobox.observe("rich:onchange", this.onchange);
-		}
-		
 		if (this.defaultMessage) {
 			this.applyDefaultText();
 		}
+		
+		if (this.isDisabled) {
+			this.doDidable();
+		}
 	},
 	
 	clickHandler : function(event) {
@@ -111,9 +113,9 @@
 			this.field.value = value;
 			this.comboList.doSelectItem(this.comboList.activeItem);
 			this.combobox.fire("rich:onitemselected", {});
-			if (oV != value) {
+			/*if (oV != value) {
 				this.combobox.fire("rich:onchange", {});
-			}
+			}*/
 		} else {
 			if (this.directInputSuggestions) {
 				var startInd = this.field.value.length; 
@@ -157,7 +159,7 @@
 				}
 			}
 			this.comboList.hide();
-			this.doDisable();
+			this.doNormal();
 		} else {
 			this.doActive();
 		}
@@ -194,13 +196,24 @@
 	},
 	
 	doActive : function() {
-		this.button.className = "rich-combobox-font rich-combobox-button-icon rich-combobox-button";
- 		this.field.className = "rich-combobox-font rich-combobox-input-default rich-combobox-input"; //FIXME
+		this.button.className = this.classes.BUTTON.CLASS.ACTIVE;
+ 		this.field.className = this.classes.FIELD.CLASS.ACTIVE;
 	},
 	
 	doDisable : function() {
-		this.button.className = "rich-combobox-font rich-combobox-button-icon-disabled rich-combobox-button";
-		this.field.className = "rich-combobox-font-disabled rich-combobox-input-default-disabled rich-combobox-input-disabled"; //FIXME
+		this.button.className = this.classes.BUTTON.CLASS.DISABLED;
+		this.field.className = this.classes.FIELD.CLASS.DISABLED;
+		
+		this.button.disabled = true;
+		this.field.disabled = true;
+	},
+	
+	doNormal : function() {
+		this.button.className = this.classes.BUTTON.CLASS.NORMAL;
+		this.field.className = this.classes.FIELD.CLASS.NORMAL;
+		
+		this.button.disabled = false;
+		this.field.disabled = false;
 	}
 };
 

Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-10 18:55:59 UTC (rev 5279)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-10 20:04:37 UTC (rev 5280)
@@ -144,7 +144,6 @@
 											   #{selectFirstOnUpdate},
 											   #{this:getAsEventHandler(context, component, "onlistcall")}, 
 											   #{this:getAsEventHandler(context, component, "onitemselected")},
-											   #{this:getAsEventHandler(context, component, "onchange")},
 											   "#{defaultMessage}");
 	</script>
 </f:root>	
\ No newline at end of file




More information about the richfaces-svn-commits mailing list