Author: abelevich
Date: 2010-10-13 11:35:34 -0400 (Wed, 13 Oct 2010)
New Revision: 19555
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
remove odd css class, fix selection, fix inplace specific popup behavior
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-13
15:01:05 UTC (rev 19554)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-13
15:35:34 UTC (rev 19555)
@@ -46,7 +46,7 @@
},
processItem: function(event, element) {
- var key = element.attr("id");
+ var key = $(element).attr("id");
var value = this.getItemValue(key);
this.saveItemValue(value);
@@ -54,7 +54,7 @@
//inplace label
this.setValue(label);
this.select.hide();
-
+ this.openPopup = false;
this.__setInputFocus();
},
@@ -114,7 +114,7 @@
__isPopupList: function(target) {
var parentId =
target.parents(".rf-is-lst-cord").attr("id");
- return (parentId && (parentId == this.select.__getId()));
+ return (parentId && (parentId == this.select.getId()));
}
}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-13
15:01:05 UTC (rev 19554)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-13
15:35:34 UTC (rev 19555)
@@ -8,13 +8,13 @@
this.popup = $(document.getElementById(id));
this.visible = options.visible;
- this.popup.bind("mouseover", $.proxy(this.__onMouseOver, this));
- this.popup.bind("click", $.proxy(this.__onClick, this));
+ this.popup.bind("mouseover", $.proxy(this.__onMouseOver, this));
+ this.popup.bind("click", $.proxy(this.__onClick, this));
};
rf.BaseComponent.extend(rf.ui.Popup);
var $super = rf.ui.Popup.$super;
-
+
$.extend(rf.ui.Popup.prototype, (function () {
return{
@@ -22,12 +22,12 @@
name : "popup",
show: function() {
- this.popup.css("display", "");
+ this.popup.css('display', '');
this.visible = true;
},
hide: function() {
- this.popup.css("display", "none");
+ this.popup.css('display', 'none');
this.visible = false;
},
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2010-10-13
15:01:05 UTC (rev 19554)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2010-10-13
15:35:34 UTC (rev 19555)
@@ -53,20 +53,36 @@
this.__selectByIndex(index);
},
- __selectByIndex: function(index) {
+ __selectByIndex: function(index, isOffset) {
+ if (this.items.length==0 || (!isOffset && this.index == index)) return;
+
var item;
if (this.index != -1) {
item = this.items.eq(this.index);
this.__unSelectItem(item);
}
-
- this.index += index;
- if (this.index < 0 ) {
- this.index = this.items.length - 1;
- } else if (this.index >= this.items.length) {
- this.index = 0;
- }
+
+ if (index==undefined) {
+ this.index = -1;
+ return;
+ }
+ if (isOffset) {
+ this.index += index;
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
+ } else {
+ if (index<0) {
+ index = 0;
+ } else if (index>=this.items.length) {
+ index = this.items.length - 1;
+ }
+ this.index = index;
+ }
+
item = this.items.eq(this.index);
this.__selectItem(item);
},
@@ -85,17 +101,19 @@
//remove event, rename
__onKeyUp: function(e) {
- this.__select(-1);
+ this.__selectByIndex(-1, true);
},
//remove event, rename
__onKeyDown: function(e) {
- this.__select(1);
+ this.__selectByIndex(1, true);
},
__onMouseOver: function(e) {
var item = this.__getItem(e);
- this.__select(item);
+ if(item) {
+ this.__select(item);
+ }
},
__onClick: function(e) {
@@ -105,7 +123,7 @@
},
__getItem: function(e) {
- return $(e.target).closest("."+this.itemCss, e.currentTarget);
+ return $(e.target).closest("."+this.itemCss, e.currentTarget).get(0);
},
__getItems: function () {
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-13 15:01:05
UTC (rev 19554)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-13 15:35:34
UTC (rev 19555)
@@ -79,7 +79,7 @@
</span>
</span>
</c:if>
- <span id="#{clientId}List" class="rf-is-none
rf-is-lst-cord">
+ <span id="#{clientId}List" class="rf-is-lst-cord">
<span class="rf-is-lst-pos" style="width:
#{component.attributes['listWidth']}">
<span class="rf-is-shdw">
<span class="rf-is-shdw-t"></span>