[richfaces-svn-commits] JBoss Rich Faces SVN: r6219 - 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
Wed Feb 20 12:01:48 EST 2008


Author: vmolotkov
Date: 2008-02-20 12:01:47 -0500 (Wed, 20 Feb 2008)
New Revision: 6219

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/inplaceselectlist.js
   trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
list positioning added

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-20 16:56:36 UTC (rev 6218)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js	2008-02-20 17:01:47 UTC (rev 6219)
@@ -7,9 +7,13 @@
 	
 	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("click", function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
+		this.tempValueKeeper.observe("keydown", function(e){this.tmpValueKeyDownHandler(e);}.bindAsEventListener(this));
+		
+		this.comboList.listParent.observe("mousedown", function(e){this.listMousedownHandler(e);}.bindAsEventListener(this));
+		this.comboList.listParent.observe("mousemove", function(e){this.listMouseMoveHandler(e)}.bindAsEventListener(this));
+		this.comboList.listParent.observe("click", function(e){this.listClickHandler(e);}.bindAsEventListener(this));
 	},
 	
 	tempKeeperClickHandler : function() {
@@ -27,6 +31,48 @@
 		this.comboList.hideWithDelay();
 	},
 	
+	listMouseMoveHandler : function(event) {
+		//changes item's decoration
+		var item = this.comboList.getEventItem(event);
+		if (item) {
+			this.comboList.doActiveItem(this.comboList.getEventItem(event));			
+		}
+	},
+	
+	listMousedownHandler : function(e) {
+		if (Prototype.Browser.IE) {
+			if (!this.comboList.getEventItem(e)) {
+				this.clickOnScroll = true;
+			}
+			this.comboList.isList = true;
+		} else if (Prototype.Browser.Gecko) {
+			if (this.comboList.getEventItem(e)) {
+				this.comboList.isList = true;			
+			}
+		} else {
+			this.comboList.isList = true;
+		}
+	},
+	
+	tmpValueKeyDownHandler : function(event) {
+		switch (event.keyCode) {
+			case Event.KEY_RETURN : 
+				this.inputProcessing();
+				this.comboList.hideWithDelay();
+				Event.stop(event);
+				break;
+			case Event.KEY_DOWN : 
+				this.comboList.moveActiveItem(event);
+				break;
+			case Event.KEY_UP :
+				this.comboList.moveActiveItem(event);
+				break; 
+			case Event.KEY_ESC : 
+				this.comboList.hideWithDelay();
+				break;
+		}
+	},
+	
 	deleteViewArtifacts : function () {
 		var text = this.inplaceInput.childNodes[6];
 		if (text) {

Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js	2008-02-20 16:56:36 UTC (rev 6218)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js	2008-02-20 17:01:47 UTC (rev 6219)
@@ -9,17 +9,27 @@
 	setPosition : function($super, fieldTop, fieldLeft, fieldHeight) {
 		var field = this.fieldElem;
 		
-		//field.style.visibility = "hidden";
 		field.show();
 		var height = field.offsetHeight;				
-		//field.hide();
-		//field.style.visibility = "visible";
+		var top = height;
+		var docHeight = Richfaces.getDocumentHeight();
+		var comBottom = fieldTop + height;
+		var listHeight = parseInt(this.list.style.height) + Richfaces.getBorderWidth(this.list.parentNode, "tb");
 		
-		this.listParent.style.top = height + "px";
+		//var top = 0 ;//= -4;
+		/*var top = comBottom;
+		if (parseInt(listHeight) > (docHeight - comBottom)) {
+			if (fieldTop > (docHeight - comBottom)) {
+				top = fieldTop - parseInt(listHeight);
+				//var upPos = true;
+			}
+		}*/
+		
+		this.listParent.style.top = top + "px";
 		this.listParent.style.left = 0 + "px";
 		
 		if (this.iframe) {
-			this.iframe.style.top = 0 + "px";
+			this.iframe.style.top = top + "px";
 			this.iframe.style.left = 0 + "px";
 		}
 	}

Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx	2008-02-20 16:56:36 UTC (rev 6218)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx	2008-02-20 17:01:47 UTC (rev 6219)
@@ -147,7 +147,7 @@
 					    STYLE : {ACTIVE: "#{listStyle}"}
 					   },  	  		 	  
 				ITEM : {NORMAL : "rich-inplace-select-option #{itemClass}", 
-				    	SELECTED : "rich-inplace-select-option rich-inplace-select-select-item #{itemSelectedClass}"
+				    	SELECTED : "rich-inplace-select-option rich-inplace-select-item #{itemSelectedClass}"
 				}
 			},
 			COMPONENT : {CHANGED : {NORMAL : 'rich-inplace rich-inplace-select-default-state rich-inplace-select-changed-state #{component.attributes["changedClass"]}', HOVERED : '#{component.attributes["changedHoveredClass"]}'},  
@@ -173,7 +173,7 @@
 				  onviewactivated : #{this:getAsEventHandler(context, component, "onviewactivated")}};
 					  	
 	var richInplaceList = new Richfaces.InplaceSelectList('list#{clientId}', 'listParent#{clientId}', false, 
-													 Richfaces.InplaceSelect.CLASSES, '100px', '100px',  #{this:getItemsTextAsJSArray(context, component)}, null, 
+													 Richfaces.InplaceSelect.CLASSES.COMBO_LIST, '100px', '100px',  #{this:getItemsTextAsJSArray(context, component)}, null, 
 													 '#{clientId}inplaceTmpValue', 'shadow#{clientId}', 0, 0); 
 	var richInplaceSelect = new Richfaces.InplaceSelect(richInplaceList, '#{clientId}', '#{clientId}inplaceTmpValue', 
 														'#{clientId}inplaceValue', '#{clientId}tabber', '#{clientId}inplaceStrut', 




More information about the richfaces-svn-commits mailing list