[richfaces-svn-commits] JBoss Rich Faces SVN: r5668 - 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 28 11:26:53 EST 2008


Author: vmolotkov
Date: 2008-01-28 11:26:53 -0500 (Mon, 28 Jan 2008)
New Revision: 5668

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:
layout is corrected

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-28 16:21:58 UTC (rev 5667)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js	2008-01-28 16:26:53 UTC (rev 5668)
@@ -4,7 +4,7 @@
 
 Richfaces.ComboBox.prototype = {
 	
-	initialize: function(combobox, listId, parentListId, fieldId, buttonId, buttonBGId, iframeId, classes, 
+	initialize: function(combobox, listId, parentListId, fieldId, buttonId, buttonBGId, classes, 
 						 listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue, 
 						 selectFirstOnUpdate, onlistcall, onselected, defaultMessage, isDisabled, value,
 						 showDelay, hideDelay) {
@@ -23,7 +23,7 @@
 //		fieldDem.height = this.field.offsetHeight;
 		listWidth = (!listWidth) ? this.getCurrentWidth() : listWidth;
 		
-		this.comboList = new Richfaces.ComboBoxList(listId, parentListId, iframeId, selectFirstOnUpdate, classes.COMBO_LIST, listWidth, 
+		this.comboList = new Richfaces.ComboBoxList(listId, parentListId, selectFirstOnUpdate, classes.COMBO_LIST, listWidth, 
 													listHeight, itemsText, onlistcall, fieldId, showDelay, hideDelay);
 		this.defaultMessage = defaultMessage;
 		if (value) {
@@ -46,15 +46,20 @@
 		if (this.isDisabled) {
 			this.doDisable();
 		}
+		
+		if (Prototype.Browser.IE) {
+			//this.comboList.createIframe(this.combobox, listWidth, this.combobox.id, 
+			//							"rich-combobox-list-width rich-combobox-list-scroll rich-combobox-list-position");
+		}
 		this.initHandlers();
 	},
 	
 	initHandlers : function() {
 		this.button.observe("click", function(e){this.buttonClickHandler(e);}.bindAsEventListener(this));
-		this.button.observe("mouseup", function(e){this.buttonMouseUpHandler(e);}.bindAsEventListener(this));
-		this.button.observe("mousedown", function(e){this.buttonMousedownHandler(e);}.bindAsEventListener(this));
-		this.button.observe("mouseover", function(e){this.buttonMouseOverHandler(e);}.bindAsEventListener(this));
-		this.button.observe("mouseout", function(e){this.buttonMouseOutHandler(e);}.bindAsEventListener(this));
+		//this.button.observe("mouseup", function(e){this.buttonMouseUpHandler(e);}.bindAsEventListener(this));
+		//this.button.observe("mousedown", function(e){this.buttonMousedownHandler(e);}.bindAsEventListener(this));
+		//this.button.observe("mouseover", function(e){this.buttonMouseOverHandler(e);}.bindAsEventListener(this));
+		//this.button.observe("mouseout", function(e){this.buttonMouseOutHandler(e);}.bindAsEventListener(this));
 		
 		this.field.observe("keydown", function(e){this.fieldKeyDownHandler(e);}.bindAsEventListener(this));
 		this.field.observe("blur", function(e){this.fieldBlurHandler(e);}.bindAsEventListener(this));
@@ -344,12 +349,13 @@
 Richfaces.ComboBoxList = Class.create();
 Richfaces.ComboBoxList.prototype = {
 	
-	initialize: function(listId, parentListId, iframeId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId,
+	initialize: function(listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId,
 						 showDelay, hideDelay) {
 		 
 		this.list = $(listId);
 		this.listParent = $(parentListId);
-		this.iframe = $(iframeId);
+		//this.iframe = $(iframeId);
+		this.iframe = null;
 		this.fieldElem = $(fieldId);
 		this.itemsText = itemsText;
 		
@@ -411,7 +417,7 @@
 	
 	show : function() {
 		this.fieldDimensions = Richfaces.ComboBoxList.getElemXY(this.fieldElem);
-		this.fieldDimensions.height = this.fieldElem.offsetHeight;
+		this.fieldDimensions.height = this.fieldElem.parentNode.offsetHeight;
 
 		this.setSize();
 		
@@ -432,7 +438,9 @@
 				}
 			}
 		}
-		this.iframe.show();
+		if (this.iframe) {
+			this.iframe.show();
+		}
 		this.listParent.show();
 		this.listParent.fire("rich:onlistcall", {});
 		
@@ -447,7 +455,9 @@
 	
 	hide : function() {
 		this.resetState();
-		this.iframe.hide();
+		if (this.iframe) {
+			this.iframe.hide();			
+		}
 		this.listParent.hide();
 	},
 	
@@ -490,36 +500,43 @@
 	},
 	
 	setWidth : function(width) {
-		var positionElem = this.listParent.childNodes[2];
+		var positionElem = this.listParent.childNodes[1];
 		var combobox = this.listParent.parentNode;
 	
 		//positionElem.style.width = width;
-		var correction = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild, "lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") + "px"; 
+		var correction = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild, "lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") + "px";
 		this.list.style.width = correction;
 		combobox.style.width = correction;
-		this.iframe.style.width = correction;
+		if (this.iframe) {
+			this.iframe.style.width = correction;			
+		}
 		 
 	},
 	
 	setPosition : function(fieldTop, fieldLeft, fieldHeight) {
 		var docHeight = Richfaces.getDocumentHeight();
 		var comBottom = fieldTop + fieldHeight;
-		var listHeight = this.list.style.height;
+		var listHeight = parseInt(this.list.style.height) + Richfaces.getBorderWidth(this.list.parentNode, "tb");
 		
-		var top = 0 ;//= -4;
+		//var top = 0 ;//= -4;
+		var top = comBottom;
 		if (parseInt(listHeight) > (docHeight - comBottom)) {
 			if (fieldTop > (docHeight - comBottom)) {
-				top -= (parseInt(listHeight) + fieldHeight);
+				top = fieldTop - parseInt(listHeight);
 				var upPos = true;
 			}
-		} 
+		}
+		 
 		this.listParent.style.top = top + "px";
-		this.listParent.style.left = 0 + "px";
+		this.listParent.style.left = fieldLeft + "px";
+		
 		if (!upPos) {
 			top = Richfaces.ComboBoxList.getElemXY(this.listParent).top + this.fieldDimensions.height;
 		}
-		this.iframe.style.top = top + "px";
-		this.iframe.style.left = Richfaces.ComboBoxList.getElemXY(this.listParent).left + "px";
+		if (this.iframe) {
+			this.iframe.style.top = top + "px";
+			this.iframe.style.left = Richfaces.ComboBoxList.getElemXY(this.listParent).left + "px";
+		}
 	},
 	
 	scrolling : function(event) {
@@ -606,7 +623,7 @@
 	
 	resetState : function() {
 		var tempList = this.list.cloneNode(false);
-		this.listParent.childNodes[2].firstChild.replaceChild(tempList, this.list);
+		this.listParent.childNodes[1].firstChild.replaceChild(tempList, this.list);
 		this.list = $(tempList.id);
 		this.activeItem = null;
 		this.isList = false;
@@ -655,19 +672,34 @@
 	
 	createItem : function(text, className) {
 		return "<span class=\"" + className+ "\">" + text + "</span>";
+	},
+	
+	createIframe : function(parentElem, width, comboboxId, classes) {
+		var iframe = document.createElement("iframe");
+		
+		iframe.id = "iframe" + comboboxId;
+		
+		iframe.style.display = "none";
+		iframe.style.width = width;
+		iframe.style.zIndex = "2";
+		
+		iframe.className = classes;
+		
+		parentElem.appendChild(iframe);
+		this.iframe = $(iframe.id);
 	}
 }
 
 Richfaces.ComboBoxList.getElemXY = function(elem) {
     
     // for FF support
-    var originalVisibility = elem.style.visibility;
+    /*var originalVisibility = elem.style.visibility;
     var originalPosition = elem.style.position;
 	var originalDisplay = elem.style.display;
 	      	
     elem.style.visibility = 'hidden';
     elem.style.position = 'absolute';      
-    elem.style.display = 'block';
+    elem.style.display = 'block';*/
     
     var x = elem.offsetLeft;
     var y = elem.offsetTop;
@@ -678,10 +710,9 @@
         y += parent.offsetTop;
     }
 	
-	elem.style.display = originalDisplay;
+	/*elem.style.display = originalDisplay;
 	elem.style.visibility = originalVisibility;
-	elem.style.position = originalPosition; 
-	 
+	elem.style.position = originalPosition;*/ 
 	
 	return {left: x, top: y};
 }

Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-28 16:21:58 UTC (rev 5667)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-28 16:26:53 UTC (rev 5668)
@@ -203,10 +203,10 @@
 	</jsp:scriptlet>
 		<f:resource var="spacer" name="images/spacer.gif"/>
 		
-<div id="control#{clientId}" class="rich-combobox-list-width rich-combobox-font rich-combobox-shell rich-combobox= #{styleClass}" style="width:#{listWidth};#{style}"
+<div id="control#{clientId}" class="rich-combobox-list-width rich-combobox-font rich-combobox #{styleClass}" style="width:#{listWidth};#{style}"
 	 x:passThruWithExclusions="value,name,type,id,styleClass,class,style,size,autocomplete,disabled,onchange">
 	<div class="rich-combobox-list-cord"></div>
-	<div class="rich-combobox-input-width rich-combobox-font rich-combobox-shell" style="width:#{width};">
+	<div class="rich-combobox-input-width rich-combobox-font rich-combobox-shell" style="width:#{width};z-index:1;">
 		<input id="comboboxField#{clientId}" 
 					   name="comboboxField#{clientId}" 
 					   disabled="#{disabled}" 
@@ -224,8 +224,7 @@
 		<div class="rich-combobox-input-width rich-combobox-strut rich-combobox-font" style="width:#{correction}">Strut</div>		   
 	</div>
 	
-	<div id="listParent#{clientId}" class="rich-combobox-list-cord #{listClass}" style="display:none; #{listStyle};">
-		<iframe id="iframe#{clientId}" class="rich-combobox-list-width rich-combobox-list-scroll rich-combobox-list-position" frameborder="0" style="display:none; width:#{listWidth};"/>
+	<div id="listParent#{clientId}" class="rich-combobox-list-cord #{listClass}" style="display:none; #{listStyle};z-index: 3;position:absolute;">
 		<div class="rich-combobox-shadow">
 			<table cellpadding="0" cellspacing="0" border="0" width="255" height="109">
 				<tr>
@@ -303,7 +302,6 @@
 											   "comboboxField#{clientId}", 
 											   "comboboxButton#{clientId}", 
 											   "comboBoxButtonBG#{clientId}",
-											   "iframe#{clientId}",
 											   Richfaces.ComboBox.CLASSES, 
 											   "#{listWidth}", "#{listHeight}",
 											   #{this:getItemsTextAsJSArray(context, component)}, 




More information about the richfaces-svn-commits mailing list