Author: vmolotkov
Date: 2008-04-03 13:51:54 -0400 (Thu, 03 Apr 2008)
New Revision: 7590
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js
trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2814,
http://jira.jboss.com/jira/browse/RF-2862,
http://jira.jboss.com/jira/browse/RF-2857
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
---
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-04-03
14:20:11 UTC (rev 7589)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-04-03
17:51:54 UTC (rev 7590)
@@ -8,8 +8,6 @@
this.inplaceSelect = $(clientId);
this.inplaceSelect.component = this;
- this.attrCloseOnSelect = true; //will be corrected in a future version
(
http://jira.jboss.com/jira/browse/RF-2814)
-
this.currentItemValue = this.value;
this.button.style.top = Richfaces.getBorderWidth(this.tempValueKeeper, "tb")
+ "px";
this["rich:destructor"] = "destroy";
@@ -76,39 +74,35 @@
},
tmpValueBlurHandler : function($super, event) {
+ if (!this.comboList.isList) {
+ //click somewhere out of the component area
+ if (this.comboList.activeItem) {
+ this.comboList.doNormalItem(this.comboList.activeItem);
+ }
+ /*if (!this.attributes.closeOnSelect && !this.attributes.showControls
&& this.comboList.isListOpened) {
+ this.comboList.hideWithDelay();
+ this.comboList.isList = false;
+ this.tempValueKeeper.focus();
+ return;
+ }*/
+ this.comboList.hideWithDelay();
+ }
- if (this.button.isClicked) {
- // click on arrow under IE
- this.button.isClicked = false;
- return;
- }
-
if (this.clickOnScroll) {
//click on scroll under IE
this.clickOnScroll = false;
this.tempValueKeeper.focus();
+ this.comboList.isList = false;
return;
}
- $super(event);
- if (!this.byTab) {
- if (!this.comboList.isList || this.clickOnBar) {
- if (this.comboList.activeItem) {
- this.comboList.doNormalItem(this.comboList.activeItem);
- }
- this.comboList.hideWithDelay();
- }
- if (!this.attributes.showControls) {
- this.save();
- } else {
- this.applyTmpValue();
- }
- this.comboList.isList = false;
- } else if(event.target != this.tabber) {
- this.comboList.hideWithDelay();
+ if (!this.attributes.showControls) {
+ this.save();
} else {
- this.byTab = false;
+ this.applyTmpValue();
}
+ this.comboList.isList = false;
+
},
listClickHandler : function(event) {
@@ -137,14 +131,6 @@
} else {
this.comboList.isList = true;
}
-
- if (this.attrCloseOnSelect) {
- //bug :
http://jira.jboss.com/jira/browse/RF-2810,
- //will be corrected in a future version (
http://jira.jboss.com/jira/browse/RF-2814)
- if (!this.attributes.showControls) {
- this.comboList.isList = false;
- }
- }
},
tmpValueKeyDownHandler : function(event) {
@@ -177,13 +163,14 @@
save : function($super) {
this.applyTmpValue();
- if (!this.comboList.isList || this.clickOnBar) {
+ if (((this.attributes.closeOnSelect && !this.attributes.showControls)
&& this.comboList.isList)
+ || (this.clickOnBar || !this.comboList.isList)) {
+ //bug :
http://jira.jboss.com/jira/browse/RF-2810,
+ //will be corrected in a future version (
http://jira.jboss.com/jira/browse/RF-2814)
this.saveValue(this.currentItemValue, this.tempValueKeeper.value);
}
- if (this.attributes.showControls) {
- this.comboList.hide();
- }
+ this.comboList.hide();
},
applyTmpValue : function() {
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js
===================================================================
---
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js 2008-04-03
14:20:11 UTC (rev 7589)
+++
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js 2008-04-03
17:51:54 UTC (rev 7590)
@@ -3,6 +3,7 @@
initialize : function($super, listId, parentListId, selectFirstOnUpdate, classes, width,
height, itemsText, onlistcall, fieldId, shadowId, showDelay, hideDelay, value) {
$super(listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText,
onlistcall, fieldId, shadowId, showDelay, hideDelay);
this.wrappingItems(value);
+ this.isListOpened = false;
},
setPosition : function($super, fieldTop, fieldLeft, fieldHeight) {
@@ -32,6 +33,7 @@
},
show : function($super) {
+ this.isListOpened = true;
$super();
},
@@ -59,6 +61,7 @@
},
hide : function() {
+ this.isListOpened = false;
this.resetState();
if (this.iframe) {
this.iframe.hide();
Modified: trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-04-03 14:20:11 UTC
(rev 7589)
+++ trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-04-03 17:51:54 UTC
(rev 7590)
@@ -191,7 +191,8 @@
inputWidth :
'#{component.attributes["selectWidth"]}',
minInputWidth :
'#{component.attributes["minSelectWidth"]}',
maxInputWidth :
'#{component.attributes["maxSelectWidth"]}',
- openOnEdit:#{component.attributes["openOnEdit"]}},
+ openOnEdit: #{component.attributes["openOnEdit"]},
+ closeOnSelect: true},
{oneditactivation : #{this:getAsEventHandler(context, component,
"oneditactivation")},
onviewactivation : #{this:getAsEventHandler(context, component,
"onviewactivation")},
oneditactivated : #{this:getAsEventHandler(context, component,
"oneditactivated")},