JBoss Rich Faces SVN: r5334 - trunk/cdk/maven-cdk-plugin/src/main/resources.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-01-12 15:24:37 -0500 (Sat, 12 Jan 2008)
New Revision: 5334
Modified:
trunk/cdk/maven-cdk-plugin/src/main/resources/VM_global_library.vm
Log:
http://jira.jboss.com/jira/browse/RF-1818
Modified: trunk/cdk/maven-cdk-plugin/src/main/resources/VM_global_library.vm
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/VM_global_library.vm 2008-01-12 16:48:13 UTC (rev 5333)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/VM_global_library.vm 2008-01-12 20:24:37 UTC (rev 5334)
@@ -10,7 +10,11 @@
#if($prop.classname == "javax.el.MethodExpression" || $prop.classname == "javax.faces.el.MethodBinding")
#set($type = "MethodExpression")
#else
- #set($type = "ValueExpression")
+ #if ($prop.el)
+ #set($type = "ValueExpression")
+ #else
+ #set($type = ${prop.classname})
+ #end
#end
/*
17 years
JBoss Rich Faces SVN: r5333 - trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-12 11:48:13 -0500 (Sat, 12 Jan 2008)
New Revision: 5333
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
cosmetic changes
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-12 16:27:49 UTC (rev 5332)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-12 16:48:13 UTC (rev 5333)
@@ -34,24 +34,7 @@
this.classes = classes;
this.isDisabled = isDisabled;
- this.initCombobox();
- },
-
- initCombobox : function() {
- this.button.observe("click", function(e){this.clickHandler(e);}.bindAsEventListener(this));
- this.field.observe("keydown", function(e){this.keyboardManager(e);}.bindAsEventListener(this));
- this.field.observe("blur", function(e){this.focusHandler(e);}.bindAsEventListener(this));
- this.field.observe("focus", function(e){this.fieldHandler(e);}.bindAsEventListener(this));
- this.comboList.listParent.observe("mousedown", function(e){this.listMousedownHandler(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("keyup", function(e){this.dataUpdating(e);}.bindAsEventListener(this));
-
- this.comboList.listParent.observe("mousemove", function(e){this.listListener(e)}.bindAsEventListener(this));
- this.comboList.listParent.observe("click", function(e){this.valueHandler(e);}.bindAsEventListener(this));
-
if (this.onselected) {
this.combobox.observe("rich:onitemselected", this.onselected);
}
@@ -59,13 +42,28 @@
if (this.isDisabled) {
this.doDisable();
}
+
+ this.initHandlers();
},
- getCurrentWidth : function() {
- return this.combobox.firstChild.offsetWidth;
+ 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.field.observe("keydown", function(e){this.fieldKeyDownHandler(e);}.bindAsEventListener(this));
+ this.field.observe("blur", function(e){this.fieldBlurHandler(e);}.bindAsEventListener(this));
+ this.field.observe("focus", function(e){this.fieldFocusHandler(e);}.bindAsEventListener(this));
+ this.field.observe("keyup", function(e){this.dataUpdating(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));
},
- clickHandler : function(event) {
+ buttonClickHandler : function(event) {
if (this.comboList.visible()) {
this.comboList.hide();
} else {
@@ -76,32 +74,12 @@
}
this.comboList.isList = false;
}
- this.field.focus();
},
- listListener : function(event) {
- //changes item's decoration
- var item = this.comboList.getEventItem(event);
- if (item) {
- this.comboList.doActiveItem(this.comboList.getEventItem(event));
- }
+ buttonMouseUpHandler : function(e) {
+ this.field.focus();
},
- 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;
- }
- },
-
buttonMousedownHandler : function(e) {
this.comboList.isList = true;
},
@@ -123,55 +101,37 @@
}
},
+ listMouseMoveHandler : function(event) {
+ //changes item's decoration
+ var item = this.comboList.getEventItem(event);
+ if (item) {
+ this.comboList.doActiveItem(this.comboList.getEventItem(event));
+ }
+ },
- fieldHandler : function() {
- this.doActive();
- if (this.field.value == this.defaultMessage) {
- this.field.value = "";
+ 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 {
- if (this.isSelection) {
- Richfaces.ComboBox.textboxSelect(this.field, 0, this.field.value.length);
- }
- this.isSelection = true;
+ this.comboList.isList = true;
}
},
- valueHandler : function(event) {
+ listClickHandler : function(event) {
this.isSelection = false;
this.field.focus();
this.setValue(true);
this.comboList.hide();
},
- setValue : function(toSetOnly) {
- if (!this.comboList.activeItem) {
- return;
- }
- var value = this.comboList.activeItem.innerHTML;
- if (toSetOnly) {
- var oV = this.field.value;
- if (oV == value) {
- if (Prototype.Browser.Gecko) {
- this.field.value = "";
- }
- }
- this.field.value = value;
- this.comboList.doSelectItem(this.comboList.activeItem);
- this.combobox.fire("rich:onitemselected", {});
- /*if (oV != value) {
- this.combobox.fire("rich:onchange", {});
- }*/
- } else {
- if (this.directInputSuggestions) {
- var startInd = this.field.value.length;
- var endInd = value.length;
- this.field.value = value;
- Richfaces.ComboBox.textboxSelect(this.field, startInd, endInd);
- }
- }
- },
-
- keyboardManager : function(event) {
+ fieldKeyDownHandler : function(event) {
switch (event.keyCode) {
case Event.KEY_RETURN :
this.setValue(true);
@@ -192,7 +152,19 @@
}
},
- focusHandler : function(event) {
+ fieldFocusHandler : function() {
+ this.doActive();
+ if (this.field.value == this.defaultMessage) {
+ this.field.value = "";
+ } else {
+ if (this.isSelection) {
+ Richfaces.ComboBox.textboxSelect(this.field, 0, this.field.value.length);
+ }
+ this.isSelection = true;
+ }
+ },
+
+ fieldBlurHandler : function(event) {
if (!this.comboList.isList) {
var value = this.field.value;
if (value.length == 0) {
@@ -217,10 +189,6 @@
}
},
- applyDefaultText : function() {
- this.field.value = this.defaultMessage;
- },
-
dataUpdating : function(event) {
if (Richfaces.ComboBox.SPECIAL_KEYS.indexOf(event.keyCode) == -1) {
this.comboList.hide();
@@ -246,6 +214,39 @@
}
}
},
+
+ setValue : function(toSetOnly) {
+ if (!this.comboList.activeItem) {
+ return;
+ }
+ var value = this.comboList.activeItem.innerHTML;
+ if (toSetOnly) {
+ var oV = this.field.value;
+ if (oV == value) {
+ if (Prototype.Browser.Gecko) {
+ this.field.value = "";
+ }
+ }
+ this.field.value = value;
+ this.comboList.doSelectItem(this.comboList.activeItem);
+ this.combobox.fire("rich:onitemselected", {});
+ /*if (oV != value) {
+ this.combobox.fire("rich:onchange", {});
+ }*/
+ } else {
+ if (this.directInputSuggestions) {
+ var startInd = this.field.value.length;
+ var endInd = value.length;
+ this.field.value = value;
+ Richfaces.ComboBox.textboxSelect(this.field, startInd, endInd);
+ }
+ }
+ },
+
+ applyDefaultText : function() {
+ this.field.value = this.defaultMessage;
+ },
+
isActive : function() {
return (this.field.className == this.classes.FIELD.ACTIVE);
@@ -277,6 +278,10 @@
this.button.disabled = false;
this.field.disabled = false;
this.isDisabled = false;
+ },
+
+ getCurrentWidth : function() {
+ return this.combobox.firstChild.offsetWidth;
}
};
17 years
JBoss Rich Faces SVN: r5332 - in trunk/sandbox/ui/combobox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-01-12 11:27:49 -0500 (Sat, 12 Jan 2008)
New Revision: 5332
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
fix hover classes behavior
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-12 15:32:58 UTC (rev 5331)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-12 16:27:49 UTC (rev 5332)
@@ -141,12 +141,6 @@
}
.rich-combobox-button-hovered {
- position : absolute;
- top : 0px;
- right : 0px; //left: fullWidth - 17px;
- width : 17px;
- margin : 0px;
- border : 1px solid;
}
.rich-combobox-button-background {
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-12 15:32:58 UTC (rev 5331)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-12 16:27:49 UTC (rev 5332)
@@ -45,7 +45,8 @@
this.field.observe("focus", function(e){this.fieldHandler(e);}.bindAsEventListener(this));
this.comboList.listParent.observe("mousedown", function(e){this.listMousedownHandler(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("keyup", function(e){this.dataUpdating(e);}.bindAsEventListener(this));
this.comboList.listParent.observe("mousemove", function(e){this.listListener(e)}.bindAsEventListener(this));
@@ -105,6 +106,24 @@
this.comboList.isList = true;
},
+ buttonMouseOverHandler : function(e) {
+ var classCss = this.classes.BUTTON.CLASSES;
+ if (this.isActive()) {
+ this.button.className= classCss.ACTIVE + " " + classCss.HOVERED;
+ } else {
+ this.button.className = classCss.NORMAL + " " + classCss.HOVERED;
+ }
+ },
+
+ buttonMouseOutHandler : function(e) {
+ if (this.isActive()) {
+ this.button.className= this.classes.BUTTON.CLASSES.ACTIVE;
+ } else {
+ this.button.className = this.classes.BUTTON.CLASSES.NORMAL;
+ }
+ },
+
+
fieldHandler : function() {
this.doActive();
if (this.field.value == this.defaultMessage) {
@@ -227,11 +246,16 @@
}
}
},
+ isActive : function() {
+ return (this.field.className == this.classes.FIELD.ACTIVE);
+
+ },
doActive : function() {
this.button.className = this.classes.BUTTON.CLASSES.ACTIVE;
this.field.className = this.classes.FIELD.CLASSES.ACTIVE;
this.buttonBG.className = this.classes.BUTTONBG.CLASSES.ACTIVE;
+ this.isDisabled = false;
},
doDisable : function() {
@@ -241,6 +265,8 @@
this.button.disabled = true;
this.field.disabled = true;
+
+ this.isDisabled = true;
},
doNormal : function() {
@@ -250,6 +276,7 @@
this.button.disabled = false;
this.field.disabled = false;
+ this.isDisabled = false;
}
};
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-12 15:32:58 UTC (rev 5331)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-12 16:27:49 UTC (rev 5332)
@@ -198,10 +198,9 @@
<input id="comboBoxButtonBG#{clientId}" readonly="true" type="text" value="" class="rich-combobox-font rich-combobox-button-background rich-combobox-button"/>
<input id="comboboxButton#{clientId}" readonly="true" disabled="#{disabled}" type="text" value="" style="#{buttonStyle}"
class="rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button #{buttonDisabledClass}"
- onmousedown="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-pressed-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-button-pressed rich-combobox-font rich-combobox-button-icon';"
- onmouseup="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-font rich-combobox-button-icon'"
- onmouseout="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button'"
- onmouseover="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button-hovered'"/>
+ onmousedown="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-pressed-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-button-pressed rich-combobox-font rich-combobox-button-icon rich-combobox-button-hovered';"
+ onmouseup="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-font rich-combobox-button-icon rich-combobox-button-hovered'"/>
+
<input type="text" class="rich-combobox-strut rich-combobox-font" style="width:#{width}"/>
</div>
@@ -223,7 +222,8 @@
BUTTON : {CLASSES :
{NORMAL : "rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button-disabled #{buttonDisabledClass}",
ACTIVE : "rich-combobox-font rich-combobox-button-icon rich-combobox-button #{buttonClass}",
- DISABLED : "rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button-disabled #{buttonDisabledClass}"},
+ DISABLED : "rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button-disabled #{buttonDisabledClass}",
+ HOVERED : "rich-combobox-button-hovered"},
STYLE :
{NORMAL: #{buttonDisabledStyle},
ACTIVE: #{buttonStyle},
17 years
JBoss Rich Faces SVN: r5331 - trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-12 10:32:58 -0500 (Sat, 12 Jan 2008)
New Revision: 5331
Modified:
trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
Log:
http://jira.jboss.com/jira/browse/RF-1895
Modified: trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
--- trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-01-12 14:39:36 UTC (rev 5330)
+++ trunk/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2008-01-12 15:32:58 UTC (rev 5331)
@@ -191,8 +191,7 @@
ffcheck: function(relTarg)
{
// FF fix [Exception... "'Permission denied to get property HTMLDivElement.parentNode' when calling method...]
- if (this.parent.tagName.toLowerCase()=="input" && relTarg)
- {
+ if (this.parent.tagName.toLowerCase()=="input" && relTarg) {
var className;
try {
className = relTarg.className;
@@ -202,6 +201,13 @@
return true;
}
if (relTarg==this.parent) return true;
+ } else {
+ while (relTarg) {
+ if(relTarg == this.parent){
+ return true;
+ }
+ relTarg = relTarg.parentNode;
+ }
}
return false;
//end fix
@@ -563,4 +569,4 @@
}
}
-}
\ No newline at end of file
+}
17 years
JBoss Rich Faces SVN: r5330 - trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-12 09:39:36 -0500 (Sat, 12 Jan 2008)
New Revision: 5330
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
scroll handler was added
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-12 14:24:24 UTC (rev 5329)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-12 14:39:36 UTC (rev 5330)
@@ -92,7 +92,6 @@
this.clickOnScroll = true;
}
this.comboList.isList = true;
- //this.field.focus();
} else if (Prototype.Browser.Gecko) {
if (this.comboList.getEventItem(e)) {
this.comboList.isList = true;
@@ -191,8 +190,8 @@
this.doActive();
}
- //IE only
if (this.clickOnScroll) {
+ //after clicking on scroll (IE)
this.field.focus();
this.comboList.isList = false;
this.clickOnScroll = false;
17 years
JBoss Rich Faces SVN: r5329 - in trunk/sandbox/ui/combobox/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-12 09:24:24 -0500 (Sat, 12 Jan 2008)
New Revision: 5329
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:
scroll handler was added
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-12 13:40:19 UTC (rev 5328)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-12 14:24:24 UTC (rev 5329)
@@ -3,7 +3,7 @@
Richfaces.ComboBox.prototype = {
- initialize: function(combobox, listId, parentListId, fieldId, buttonId,buttonBGId, classes, listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue, selectFirstOnUpdate, onlistcall, onselected, defaultMessage, isDisabled) {
+ initialize: function(combobox, listId, parentListId, fieldId, buttonId,buttonBGId, classes, listWidth, listHeight, itemsText, directInputSuggestions, filterNewValue, selectFirstOnUpdate, onlistcall, onselected, defaultMessage, isDisabled, value) {
this.directInputSuggestions = directInputSuggestions;
this.filterNewValue = filterNewValue;
@@ -15,9 +15,19 @@
fieldDem.height = this.field.offsetHeight;
listWidth = (!listWidth) ? this.getCurrentWidth() : listWidth;
this.comboList = new Richfaces.ComboBoxList(listId, parentListId, selectFirstOnUpdate, classes.COMBO_LIST, listWidth, listHeight, itemsText, onlistcall, fieldDem);
-
this.defaultMessage = defaultMessage;
+ if (value) {
+ var item = this.comboList.findItemBySubstr(value);
+ if (item) {
+ this.comboList.doSelectItem(item);
+ }
+ } else {
+ if (this.defaultMessage) {
+ this.applyDefaultText();
+ }
+ }
+
this.onselected = onselected;
this.isSelection = true;
@@ -34,7 +44,7 @@
this.field.observe("blur", function(e){this.focusHandler(e);}.bindAsEventListener(this));
this.field.observe("focus", function(e){this.fieldHandler(e);}.bindAsEventListener(this));
this.comboList.listParent.observe("mousedown", function(e){this.listMousedownHandler(e);}.bindAsEventListener(this));
- this.button.observe("mousedown", function(e){this.listMousedownHandler(e);}.bindAsEventListener(this));
+ this.button.observe("mousedown", function(e){this.buttonMousedownHandler(e);}.bindAsEventListener(this));
this.field.observe("keyup", function(e){this.dataUpdating(e);}.bindAsEventListener(this));
@@ -45,10 +55,6 @@
this.combobox.observe("rich:onitemselected", this.onselected);
}
- if (this.defaultMessage) {
- this.applyDefaultText();
- }
-
if (this.isDisabled) {
this.doDisable();
}
@@ -81,6 +87,22 @@
},
listMousedownHandler : function(e) {
+ if (Prototype.Browser.IE) {
+ if (!this.comboList.getEventItem(e)) {
+ this.clickOnScroll = true;
+ }
+ this.comboList.isList = true;
+ //this.field.focus();
+ } else if (Prototype.Browser.Gecko) {
+ if (this.comboList.getEventItem(e)) {
+ this.comboList.isList = true;
+ }
+ } else {
+ this.comboList.isList = true;
+ }
+ },
+
+ buttonMousedownHandler : function(e) {
this.comboList.isList = true;
},
@@ -168,6 +190,13 @@
} else {
this.doActive();
}
+
+ //IE only
+ if (this.clickOnScroll) {
+ this.field.focus();
+ this.comboList.isList = false;
+ this.clickOnScroll = false;
+ }
},
applyDefaultText : function() {
@@ -288,6 +317,7 @@
if (this.selectedItem) {
//was created new item list, so necessary to recreate selectedItem
+ //alert(this.selectedItem.innerHTML);
this.doSelectItem(this.findItemBySubstr(this.selectedItem.innerHTML));
}
@@ -517,7 +547,17 @@
createNewList : function(items) {
//FIX for FF
+ if (this.selectedItem) {
+ var text = this.selectedItem.innerHTML;
+ }
this.list.innerHTML = items.join("");
+ //was created new item list, so necessary to recreate selectedItem
+ if (this.selectedItem) {
+ var item = this.findItemBySubstr(text);
+ if (item) {
+ this.doSelectItem(item);
+ }
+ }
//this.listParent.appendChild(tempList);
},
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-12 13:40:19 UTC (rev 5328)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-12 14:24:24 UTC (rev 5329)
@@ -53,8 +53,8 @@
String inputSize = (String) component.getAttributes().get("inputSize");
variables.setVariable("inputSize", inputSize);
- String defaultMessage = (String) component.getAttributes().get("defaultMessage");
- variables.setVariable("defaultMessage", defaultMessage);
+ String defaultLabel = (String) component.getAttributes().get("defaultLabel");
+ variables.setVariable("defaultLabel", defaultLabel);
Boolean selectFirstOnUpdate = (Boolean) component.getAttributes().get("selectFirstOnUpdate");
variables.setVariable("selectFirstOnUpdate", selectFirstOnUpdate);
@@ -271,7 +271,7 @@
#{selectFirstOnUpdate},
#{this:getAsEventHandler(context, component, "onlistcall")},
#{this:getAsEventHandler(context, component, "onitemselected")},
- "#{defaultMessage}",
- #{disabled});
+ "#{defaultLabel}",
+ #{disabled}, "#{value}");
</script>
</f:root>
\ No newline at end of file
17 years
JBoss Rich Faces SVN: r5328 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-12 08:40:19 -0500 (Sat, 12 Jan 2008)
New Revision: 5328
Modified:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml
Log:
http://jira.jboss.com/jira/browse/RF-1702 - add Key Feature
Modified: trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml 2008-01-12 13:39:59 UTC (rev 5327)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml 2008-01-12 13:40:19 UTC (rev 5328)
@@ -28,9 +28,10 @@
<listitem>Browser like selection</listitem>
<listitem>Smart user-defined positioning</listitem>
<listitem>Multicolumn suggestion popup list</listitem>
- <listitem>Possible to set the popup appearance delay through <emphasis><property>"showDelay"</property></emphasis>
+ <!--listitem>Possible to set the popup appearance delay through <emphasis><property>"showDelay"</property></emphasis>
or <emphasis><property>"minChars"</property></emphasis> attributes
- </listitem>
+ </listitem-->
+ <listitem>Seam entity converter support</listitem>
</itemizedlist>
</section>
17 years
JBoss Rich Faces SVN: r5327 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-12 08:39:59 -0500 (Sat, 12 Jan 2008)
New Revision: 5327
Modified:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
Log:
http://jira.jboss.com/jira/browse/RF-1702 - add Details of Usage, JavaScript API, Look-and-Feel Customization, Skin Parameters Redefinition, Definition of Custom Style Classes sections
Modified: trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-01-12 13:12:55 UTC (rev 5326)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-01-12 13:39:59 UTC (rev 5327)
@@ -44,14 +44,13 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it could be used on a page: </para>
-
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
-<rich:comboBox value="#{bean.state}" valueChangeListener="#{bean.selectionChanged}" suggestionValues="#{bean.suggestions}">
+<rich:comboBox value="#{bean.state}" valueChangeListener="#{bean.selectionChanged}" >
<f:selectItems value="#{bean.selectItems}"/>
-<rich:comboBox>
+</rich:comboBox>
...]]></programlisting>
</section>
<section>
@@ -64,4 +63,213 @@
HtmlComboBox myComboBox = new HtmlComboBox();
...]]></programlisting>
</section>
+ <section>
+ <title>Details of Usage</title>
+ <para>The <emphasis role="bold">
+ <property><rich:comboBox></property>
+ </emphasis> component consists of an <property>input field</property>, the <property>button</property> and the <property>popup list</property> of suggestions
+ attached to input.
+ The component could be in two states:
+
+ <!-- NEED DESCRIPTION "HOW TO MANAGE THIS"-->
+
+ <itemizedlist>
+ <listitem>Default - only input and button is shown</listitem>
+ <listitem>Input, button and popup list of suggestions attached to input is shown</listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ There are two ways to get values for the popup list of suggestions:
+ <itemizedlist>
+ <listitem>Using the <emphasis><property>"suggestionValues"</property></emphasis> attribute, that defines the suggestion collection
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML">
+<![CDATA[...
+<rich:comboBox value="#{bean.state}" valueChangeListener="#{bean.selectionChanged}" suggestionValues="#{bean.suggestions}" />
+...]]></programlisting>
+ </listitem>
+ <listitem>Using the <emphasis role="bold"><property><f:selectItem /></property></emphasis> or <emphasis role="bold">
+ <property><f:selectItems /></property></emphasis> components
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML">
+<![CDATA[...
+<rich:comboBox value="#{bean.state}" valueChangeListener="#{bean.selectionChanged}">
+ <f:selectItems value="#{bean.selectItems}"/>
+ <f:selectItem itemValue="Oregon"/>
+ <f:selectItem itemValue="Pennsylvania"/>
+ <f:selectItem itemValue="Rhode Island"/>
+ <f:selectItem itemValue="South Carolina"/>
+</rich:comboBox>
+...]]></programlisting>
+ </listitem>
+ </itemizedlist>
+ Popup list content loads at page render time. No additional requests could be performed on the popup calling.
+ </para>
+ <para>
+ The <emphasis><property> "value"</property></emphasis> attribute stores value from input after submit.
+ </para>
+ <para>
+ The <emphasis><property> "directInputSuggestions"</property></emphasis> attribute defines, how the first value from the suggested appears in input field.
+ If it's "true" the first value appears with untyped part highlighted.
+
+ <!--ADD SCREENSHOT FOR directInputSuggestions-->
+
+ </para>
+
+ <para>
+ The <emphasis><property> "selectFirstOnUpdate"</property></emphasis> attribute defines if the first value from suggested is selected in popup list.
+ If it's "false" nothing is selected in the list before user hovered some item via mouse. Also nothing could be selected after mouse out the list.
+
+ <!--ADD SCREENSHOT FOR selectFirstOnUpdate-->
+
+ </para>
+
+ <para>
+ The <emphasis><property> "filterNewValues"</property></emphasis> attribute defines the appearance of values in the list.
+ If it's "true" only the part of list, which satisfies the prefix entered, could appears in popup list.
+ If it's "false" all values appear in the popup list. But the list could be scrolled to the first value that satisfies the prefix.
+ </para>
+
+ <para>
+ The <emphasis role="bold"><property><rich:comboBox></property></emphasis> component provides to use sizes attributes:
+ <itemizedlist>
+ <listitem>
+ <emphasis><property> "listWidth"</property></emphasis> and <emphasis><property> "listHeight"</property></emphasis> attributes
+ specify popup list sizes with values in pixels
+ </listitem>
+ <listitem>
+ <emphasis><property> "inputSize"</property></emphasis> attribute customizes the size of input element with values in symbols as for standard input field.
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ The <emphasis><property> "defaultLabel"</property></emphasis> attribute defines the default label of the input element.
+ </para>
+
+
+ </section>
+ <section>
+ <title>JavaScript API</title>
+ <table>
+ <title>JavaScript API</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Function</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>showList()</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>hideList()</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>Enable()</entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>Disable()</entry>
+ <entry></entry>
+ </row>`
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>Look-and-Feel Customization</title>
+ <para>For skinnability implementation, the components use a <emphasis>
+ <property>style class redefinition method.</property>
+ </emphasis> Default style classes are mapped on <emphasis>
+ <property>skin parameters.</property>
+ </emphasis></para>
+ <para>There are two ways to redefine the appearance of all <emphasis role="bold">
+ <property><rich:comboBox></property>
+ </emphasis> components at once: <itemizedlist>
+ <listitem>Redefine the corresponding skin parameters</listitem>
+ <listitem> Add to your style sheets style classes used by a <emphasis role="bold">
+ <property><rich:comboBox></property>
+ </emphasis> component</listitem>
+ </itemizedlist>
+ </para>
+ </section>
+ <section>
+ <title>Skin Parameters Redefinition</title>
+
+ <table>
+ <title>Skin parameters redefinition for </title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ <section>
+ <title>Definition of Custom Style Classes</title>
+
+ <para>On the screenshot there are classes names that define styles for component elements.</para>
+
+ <figure>
+ <title>Classes names</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref=""/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <table>
+ <title>Classes names that define </title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Class name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>In order to redefine styles for all <emphasis role="bold"><property><rich:comboBox></property></emphasis> components on a page using CSS,
+ it's enough to create classes with the same names and define necessary properties in them.
+ </para>
+ <para>To change styles of particular <emphasis role="bold"><property><rich:comboBox></property></emphasis> components,
+ define your own style classes in the corresponding <emphasis role="bold"><property><rich:comboBox></property></emphasis> component attributes.
+ </para>
+ </section>
+ <section>
+ <title>Relevant Resources Links</title>
+ <para>
+ <ulink url="">Here</ulink> you can see an example of <emphasis role="bold"><property><rich:comboBox></property></emphasis> usage
+ and sources for the given example.
+ </para>
+ </section>
</section>
\ No newline at end of file
17 years
JBoss Rich Faces SVN: r5326 - trunk/samples/tooltip-sample/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-12 08:12:55 -0500 (Sat, 12 Jan 2008)
New Revision: 5326
Modified:
trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp
Log:
Merged tool tip sample.
Modified: trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2008-01-12 13:01:03 UTC (rev 5325)
+++ trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2008-01-12 13:12:55 UTC (rev 5326)
@@ -8,6 +8,27 @@
<html>
<head>
<title></title>
+ <style>
+ .abs_div {
+ position: absolute;
+ top: 250px;
+ left: 100px;
+ width: 200px;
+ height: 200px;
+ overflow: auto;
+ color: gray;
+ border: 1px solid red;
+ }
+
+ .inner_div {
+ display: block;
+ width: 400px;
+ height: 100px;
+ top: 50px;
+ left: 0px;
+ border: 1px solid green;
+ }
+ </style>
</head>
<body>
<f:view>
@@ -49,7 +70,20 @@
</h:commandButton--%>
<%--a4j:log popup="false" level="ALL"></a4j:log--%>
-
+
+ <a4j:outputPanel layout="block" styleClass="abs_div" >
+ <a4j:outputPanel layout="block" styleClass="inner_div" >
+ <rich:toolTip id="abs_t" followMouse="true" value=""
+ layout="block" horizontalOffset="0" verticalOffset="0"
+ direction="top-right" >
+ <f:facet name="defaultContent">
+ <f:verbatim>DEFAULT CONTENT</f:verbatim>
+ </f:facet>
+ <h:outputText value="Tooltip on scrolled absolutly positioned element." />
+ </rich:toolTip>
+ </a4j:outputPanel>
+ </a4j:outputPanel>
+
<h:outputText id="text1" value="Text with tooltip">
<rich:toolTip id="controlledTooltip" followMouse="false" direction="top-right" value="#{bean.toolTipContent}" horizontalOffset="5" verticalOffset="5" layout="inline">
</rich:toolTip>
@@ -81,8 +115,7 @@
</rich:toolTip>
</h:inputText>
</h:form>
-
+ <h:panelGroup style="width: 1000px; height: 10px;" layout="block"></h:panelGroup>
</f:view>
</body>
</html>
-
17 years
JBoss Rich Faces SVN: r5325 - in trunk: framework/api/src/main/java/org/richfaces/event/sort and 19 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-01-12 08:01:03 -0500 (Sat, 12 Jan 2008)
New Revision: 5325
Added:
trunk/framework/api/src/main/java/org/richfaces/component/Sortable2.java
trunk/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java
trunk/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java
trunk/framework/api/src/main/java/org/richfaces/model/Ordering.java
trunk/framework/api/src/main/java/org/richfaces/model/SortField2.java
trunk/framework/api/src/main/java/org/richfaces/model/SortOrder2.java
trunk/framework/api/src/main/java/org/richfaces/model/filter/
trunk/framework/api/src/main/java/org/richfaces/model/filter/Filter.java
trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java
trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java
trunk/sandbox/ui/sortableHeader/src/main/config/
trunk/sandbox/ui/sortableHeader/src/main/config/component/
trunk/sandbox/ui/sortableHeader/src/main/config/component/sortControl.xml
trunk/sandbox/ui/sortableHeader/src/main/java/org/
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/Mode.java
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/UISortableControl.java
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/event/
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/renderkit/
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/renderkit/html/
trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/renderkit/html/SortControlRenderer.java
Modified:
trunk/framework/impl/src/main/java/org/richfaces/model/SortableModel.java
trunk/framework/impl/src/main/java/org/richfaces/model/SortableRange.java
trunk/framework/impl/src/main/java/org/richfaces/model/SortedModel.java
trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java
trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java
trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java
trunk/sandbox/api/pom.xml
trunk/sandbox/ui/sortableHeader/pom.xml
trunk/ui/dataTable/
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js
Log:
initial placement of sortControl. Introduction of Sortable2
Added: trunk/framework/api/src/main/java/org/richfaces/component/Sortable2.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/component/Sortable2.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/component/Sortable2.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import org.richfaces.model.SortOrder2;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface Sortable2 {
+
+ public SortOrder2 getSortOrder();
+
+ public void setSortOrder(SortOrder2 sortOrder);
+
+}
Added: trunk/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/event/sort/SortEvent2.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,52 @@
+/**
+ *
+ */
+package org.richfaces.event.sort;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SortEvent2 extends FacesEvent{
+
+ private static final long serialVersionUID = -3141067055845421505L;
+
+ //TODO: making ValueExpression here - should redesign SortOrder/SortField?
+ private ValueExpression sortExpression;
+
+ private boolean force;
+
+ public SortEvent2(UIComponent component, ValueExpression sortExpression,
+ boolean force) {
+ super(component);
+ this.sortExpression = sortExpression;
+ this.force = force;
+ }
+
+ public SortEvent2(UIComponent component, ValueExpression sortExpression) {
+ this(component, sortExpression, false);
+ }
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof SortListener2;
+ }
+
+ @Override
+ public void processListener(FacesListener listener) {
+ ((SortListener2) listener).processSorting(this);
+ }
+
+ public boolean isForce() {
+ return force;
+ }
+
+ public ValueExpression getSortExpression() {
+ return sortExpression;
+ }
+}
Added: trunk/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/event/sort/SortListener2.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,7 @@
+package org.richfaces.event.sort;
+
+import javax.faces.event.FacesListener;
+
+public interface SortListener2 extends FacesListener{
+ public void processSorting(SortEvent2 event);
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/Ordering.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/Ordering.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/Ordering.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,10 @@
+package org.richfaces.model;
+/**
+ *
+ * @author Maksim Kaszynski
+ *
+ */
+public enum Ordering {
+ ASCENDING {},
+ DESCENDING {}
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/SortField2.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/SortField2.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/SortField2.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,80 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.Serializable;
+
+import javax.el.ValueExpression;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SortField2 implements Serializable{
+
+ private static final long serialVersionUID = 2122437301428777493L;
+
+ private Ordering ordering;
+
+ private ValueExpression expression;
+
+ public SortField2(ValueExpression expression) {
+ super();
+ this.expression = expression;
+ }
+
+ public SortField2(ValueExpression expression, Ordering ordering) {
+ super();
+ this.expression = expression;
+ this.ordering = ordering;
+ }
+
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SortField2 other = (SortField2) obj;
+ if (expression == null) {
+ if (other.expression != null)
+ return false;
+ } else if (!expression.getExpressionString().equals(other.expression.getExpressionString()))
+ return false;
+ if (ordering == null) {
+ if (other.ordering != null)
+ return false;
+ } else if (!ordering.equals(other.ordering))
+ return false;
+ return true;
+ }
+ public ValueExpression getExpression() {
+ return expression;
+ }
+ public Ordering getOrdering() {
+ return ordering;
+ }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((expression == null) ? 0 : expression.hashCode());
+ result = prime * result
+ + ((ordering == null) ? 0 : ordering.hashCode());
+ return result;
+ }
+
+ public void setExpression(ValueExpression expression) {
+ this.expression = expression;
+ }
+
+ public void setOrdering(Ordering ordering) {
+ this.ordering = ordering;
+ }
+
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/SortOrder2.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/SortOrder2.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/SortOrder2.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,62 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SortOrder2 implements Serializable{
+
+ private static final long serialVersionUID = -8464361988367479001L;
+
+ private List<SortField2> fields = new LinkedList<SortField2>();
+
+ public List<SortField2> getFields() {
+ return fields;
+ }
+
+ public void setFields(List<SortField2> fields) {
+ this.fields = fields;
+ }
+
+ public void addField(SortField2 field2) {
+ fields.add(field2);
+ }
+
+ public boolean isEmpty() {
+ return fields == null || fields.isEmpty();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fields == null) ? 0 : fields.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SortOrder2 other = (SortOrder2) obj;
+ if (fields == null) {
+ if (other.fields != null)
+ return false;
+ } else if (!fields.equals(other.fields))
+ return false;
+ return true;
+ }
+
+
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/filter/Filter.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/filter/Filter.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/filter/Filter.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package org.richfaces.model.filter;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface Filter<T> {
+ public boolean accept(T t);
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/SortableModel.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/SortableModel.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/SortableModel.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -101,10 +101,9 @@
boolean result = false;
if (range instanceof SortableRange) {
SortableRange sortableRange = (SortableRange) range;
- SortOrder sortOrder = sortableRange.getSortOrder();
+ SortOrder2 sortOrder = sortableRange.getSortOrder();
if (sortOrder != null) {
- SortField[] fields = sortOrder.getFields();
- result = fields != null && fields.length > 0;
+ result = !sortOrder.isEmpty();
}
}
return result;
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/SortableRange.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/SortableRange.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/SortableRange.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -11,16 +11,16 @@
*/
public class SortableRange extends SequenceRange {
- private SortOrder sortOrder;
+ private SortOrder2 sortOrder;
private String var;
- public SortableRange(int firstRow, int rows, String var, SortOrder sortOrder) {
+ public SortableRange(int firstRow, int rows, String var, SortOrder2 sortOrder) {
super(firstRow, rows);
this.sortOrder = sortOrder;
this.var = var;
}
- public SortOrder getSortOrder() {
+ public SortOrder2 getSortOrder() {
return sortOrder;
}
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/SortedModel.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/SortedModel.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/SortedModel.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -16,7 +16,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.model.impl.expressive.ObjectWrapperFactory;
-import org.richfaces.model.impl.expressive.WrappedBeanComparator;
+import org.richfaces.model.impl.expressive.WrappedBeanComparator2;
@@ -59,9 +59,9 @@
log.error(e.getMessage(), e);
}
- SortOrder sortOrder = range.getSortOrder();
+ SortOrder2 sortOrder = range.getSortOrder();
ObjectWrapperFactory wrapperFactory = new ObjectWrapperFactory(context, range.getVar(), sortOrder);
- WrappedBeanComparator wrappedBeanComparator = new WrappedBeanComparator(sortOrder.getFields());
+ WrappedBeanComparator2 wrappedBeanComparator = new WrappedBeanComparator2(sortOrder);
wrapperFactory.wrapList(collection);
Collections.sort(collection, wrappedBeanComparator);
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/NullExpression.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -8,8 +8,8 @@
/**
* @param n
*/
- NullExpression(String n) {
- super(n);
+ NullExpression(String name) {
+ super(name);
}
public Object evaluate(Object base) {
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ObjectWrapperFactory.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -35,7 +35,9 @@
import org.ajax4jsf.util.ELUtils;
import org.richfaces.model.SortField;
+import org.richfaces.model.SortField2;
import org.richfaces.model.SortOrder;
+import org.richfaces.model.SortOrder2;
/**
*
* class responsible for packaging objects with their properties evaluated using EL.
@@ -88,6 +90,40 @@
}
+ public ObjectWrapperFactory(FacesContext context, final String var, SortOrder2 sortOrder) {
+
+ this.context = context;
+
+ Application application = context.getApplication();
+ ELResolver resolver = application.getELResolver();
+ ELContext elContext = context.getELContext();
+ this.var = var;
+
+ List<SortField2> fields = sortOrder.getFields();
+
+ expressions = new Expression[fields.size()];
+
+ int i = 0;
+ for (SortField2 field : fields) {
+ ValueExpression valueExpression = field.getExpression();
+ Expression expression;
+
+ if (valueExpression.isLiteralText()) {
+ String expressionString = valueExpression.getExpressionString();
+
+ if (expressionString.startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
+ expression = new NullExpression(expressionString);
+ } else {
+ expression = new SimplePropertyExpression(expressionString, elContext, resolver);
+ }
+ } else {
+ expression = new ValueBindingExpression(context, valueExpression, var);
+ }
+
+ expressions[i++] = expression;
+ }
+
+ }
void convertList (List<? super Object> list, ObjectConvertor c) {
int l = list.size();
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/ValueBindingExpression.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -37,6 +37,16 @@
mapper = context.getVariableMapper();
factory = expressionFactory;
}
+
+ ValueBindingExpression(FacesContext faces, ValueExpression valueExpression, String var) {
+ super(valueExpression.getExpressionString());
+ this.context = faces.getELContext();
+ this.var = var;
+ ExpressionFactory expressionFactory = faces.getApplication().getExpressionFactory();
+ this.valueExpression = valueExpression;
+ mapper = context.getVariableMapper();
+ factory = expressionFactory;
+ }
public Object evaluate(Object base) {
mapper.setVariable(var, factory.createValueExpression(base, Object.class));
Added: trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator2.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,67 @@
+package org.richfaces.model.impl.expressive;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.el.ValueExpression;
+
+import org.richfaces.model.Ordering;
+import org.richfaces.model.SortField;
+import org.richfaces.model.SortField2;
+import org.richfaces.model.SortOrder2;
+
+/**
+ * Comparator for {@link JavaBeanWrapper} objects.
+ * Compares them using {@link SortField} sequence.
+ *
+ * @author Maksim Kaszynski
+ *
+ */
+public final class WrappedBeanComparator2 implements Comparator<Object> {
+
+ private final SortOrder2 sortOrder;
+
+ public WrappedBeanComparator2(SortOrder2 sortOrder) {
+ super();
+ this.sortOrder = sortOrder;
+ }
+
+ public int compare(Object o1, Object o2) {
+ return compare((JavaBeanWrapper) o1, (JavaBeanWrapper) o2);
+ }
+
+ @SuppressWarnings("unchecked")
+ private int compare(JavaBeanWrapper w1, JavaBeanWrapper w2) {
+
+ int result = 0;
+
+ List<SortField2> fields = sortOrder.getFields();
+
+ for (Iterator<SortField2> iterator = fields.iterator(); iterator.hasNext() && result == 0;) {
+ SortField2 sortField2 = iterator.next();
+ ValueExpression expression = sortField2.getExpression();
+ String prop = expression.getExpressionString();
+ Ordering ordering = sortField2.getOrdering();
+ if (ordering != null) {
+ Object p1 = w1.getProperty(prop);
+ Object p2 = w2.getProperty(prop);
+
+ if (p1 instanceof Comparable && p2 instanceof Comparable) {
+ result = ((Comparable<Object>) p1).compareTo(p2);
+ } else if (p1 == null && p2 != null) {
+ result = 1;
+ } else if (p2 == null && p1 != null) {
+ result = -1;
+ }
+
+ if (ordering.equals(Ordering.DESCENDING)) {
+ result = -result;
+ }
+ }
+
+ }
+
+ return result;
+ }
+}
\ No newline at end of file
Added: trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanFilter.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package org.richfaces.model.impl.expressive;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class WrappedBeanFilter implements org.richfaces.model.filter.Filter<JavaBeanWrapper>{
+
+ public boolean accept(JavaBeanWrapper t) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
Modified: trunk/sandbox/api/pom.xml
===================================================================
--- trunk/sandbox/api/pom.xml 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/sandbox/api/pom.xml 2008-01-12 13:01:03 UTC (rev 5325)
@@ -9,12 +9,29 @@
<artifactId>richfaces-sandbox-api</artifactId>
<name>Richfaces Sandbox API</name>
<version>3.2.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-api</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
Modified: trunk/sandbox/ui/sortableHeader/pom.xml
===================================================================
--- trunk/sandbox/ui/sortableHeader/pom.xml 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/sandbox/ui/sortableHeader/pom.xml 2008-01-12 13:01:03 UTC (rev 5325)
@@ -9,6 +9,38 @@
<artifactId>sortableHeader</artifactId>
<name>sortableHeader</name>
<version>3.2.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <!--execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution-->
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces.sandbox</prefix>
+ <taglib>
+ <shortName>sortable</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
@@ -22,16 +54,6 @@
<artifactId>richfaces-impl</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.richfaces.sandbox</groupId>
- <artifactId>richfaces-sandbox-api</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.sandbox</groupId>
- <artifactId>richfaces-sandbox-impl</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>core</artifactId>
Added: trunk/sandbox/ui/sortableHeader/src/main/config/component/sortControl.xml
===================================================================
--- trunk/sandbox/ui/sortableHeader/src/main/config/component/sortControl.xml (rev 0)
+++ trunk/sandbox/ui/sortableHeader/src/main/config/component/sortControl.xml 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.SortControl</name>
+ <family>org.richfaces.SortControl</family>
+ <classname>org.richfaces.component.HtmlSortableControl</classname>
+ <superclass>org.richfaces.component.UISortableControl</superclass>
+ <description>
+ <![CDATA[
+ ]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.richfaces.SortControlRenderer</name>
+ <classname>org.richfaces.renderkit.html.SortControlRenderer</classname>
+ </renderer>
+ <tag>
+ <name>sortControl</name>
+ <classname>org.richfaces.taglib.SortControlTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ <test/>
+ </tag>
+ &ui_component_attributes;
+ </component>
+</components>
Added: trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/Mode.java
===================================================================
--- trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/Mode.java (rev 0)
+++ trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/Mode.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,14 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public enum Mode {
+ AJAX,
+ SERVER,
+ CLIENT
+}
Added: trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/UISortableControl.java
===================================================================
--- trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/UISortableControl.java (rev 0)
+++ trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/component/UISortableControl.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class UISortableControl extends UIComponentBase{
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.SortControl";
+
+ public static final String COMPONENT_TYPE = "org.richfaces.SortControl";
+
+ private ValueExpression sortExpression;
+
+ private Mode mode;
+
+ public ValueExpression getSortExpression() {
+ return sortExpression;
+ }
+
+ public void setSortExpression(ValueExpression sortExpression) {
+ this.sortExpression = sortExpression;
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public Mode getMode() {
+ return mode;
+ }
+
+ public UIDataTable getTable() {
+ UIComponent component = getParent();
+ while(component != null && !(component instanceof UIDataTable)) {
+ component = component.getParent();
+ }
+ return (UIDataTable) component;
+ }
+
+ public void setMode(Mode mode) {
+ this.mode = mode;
+ }
+
+ @Override
+ public Object saveState(FacesContext context) {
+ Object [] o = new Object[3];
+ o[0] = super.saveState(context);
+ o[1] = mode;
+ o[2] = saveAttachedState(context, sortExpression);
+ return o;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object [] o = (Object[]) state;
+ super.restoreState(context, o[0]);
+ mode = (Mode) o[1];
+ sortExpression = (ValueExpression) restoreAttachedState(context, o[2]);
+ }
+
+}
Added: trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/renderkit/html/SortControlRenderer.java
===================================================================
--- trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/renderkit/html/SortControlRenderer.java (rev 0)
+++ trunk/sandbox/ui/sortableHeader/src/main/java/org/richfaces/renderkit/html/SortControlRenderer.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -0,0 +1,168 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import static org.ajax4jsf.renderkit.RendererUtils.HTML.SCRIPT_ELEM;
+import static org.ajax4jsf.renderkit.RendererUtils.HTML.INPUT_ELEM;
+import static org.ajax4jsf.renderkit.RendererUtils.HTML.NAME_ATTRIBUTE;
+import static org.ajax4jsf.renderkit.RendererUtils.HTML.id_ATTRIBUTE;
+import static org.richfaces.component.Mode.AJAX;
+import static org.richfaces.component.Mode.CLIENT;
+import static org.richfaces.component.Mode.SERVER;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.UIDataAdaptor;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.AjaxScript;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.PrototypeScript;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.component.Mode;
+import org.richfaces.component.UIDataTable;
+import org.richfaces.component.UISortableControl;
+import org.richfaces.event.sort.SortEvent2;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SortControlRenderer extends HeaderResourcesRendererBase{
+
+ interface RendererCommand {
+ void encodeMarkup(ResponseWriter writer, FacesContext context, UISortableControl control) throws IOException;
+ }
+
+ private final static InternetResource[] scripts = {
+ new AjaxScript(),
+ new PrototypeScript()
+ };
+
+ private RendererCommand[] commands = new RendererCommand[Mode.values().length];
+
+ public SortControlRenderer() {
+ commands[AJAX.ordinal()] = new RendererCommand() {
+ public void encodeMarkup(ResponseWriter writer, FacesContext context,
+ UISortableControl control) throws IOException {
+
+ JSFunction constructor = new JSFunction("new RichFaces.SortControl.Ajax");
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(control, context);
+
+ constructor.addParameter(control.getClientId(context));
+ constructor.addParameter(ajaxFunction);
+ writeScript(context, control, constructor);
+ }
+ };
+ commands[CLIENT.ordinal()] = new RendererCommand() {
+ public void encodeMarkup(ResponseWriter writer, FacesContext context,
+ UISortableControl control) throws IOException {
+
+ UIDataAdaptor table = control.getTable();
+ String sortBy = null;
+ ValueExpression sortExpression = control.getSortExpression();
+
+ if (sortExpression != null) {
+ sortBy = sortExpression.getExpressionString();
+ }
+
+ JSFunction function = new JSFunction("new RichFaces.SortControl");
+
+ function.addParameter(control.getClientId(context));
+ function.addParameter(table.getClientId(context));
+ function.addParameter(sortBy == null ? JSReference.NULL: new JSReference(sortBy));
+ function.addParameter(control.getParent().getClientId(context));
+ writeScript(context, control, function);
+ }
+ };
+ commands[SERVER.ordinal()] = new RendererCommand() {
+ public void encodeMarkup(ResponseWriter writer, FacesContext context,
+ UISortableControl control) throws IOException {
+
+ JSFunction constructor = new JSFunction("new RichFaces.SortControl.Server");
+
+ constructor.addParameter(control.getClientId(context));
+ writeScript(context, control, constructor);
+ writer.startElement(INPUT_ELEM, control);
+ writer.writeAttribute(NAME_ATTRIBUTE, control.getClientId(context), "name");
+ writer.writeAttribute(id_ATTRIBUTE, control.getClientId(context) + "s", "name");
+ writer.endElement(INPUT_ELEM);
+ }
+ };
+ }
+
+ private void writeScript(FacesContext context, UIComponent component, Object script)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(SCRIPT_ELEM, component);
+ writer.writeAttribute(id_ATTRIBUTE, component.getClientId(context), "id");
+ writer.writeText(script, null);
+ writer.endElement(SCRIPT_ELEM);
+ }
+
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UISortableControl.class;
+ }
+
+ @Override
+ protected InternetResource[] getScripts() {
+ return scripts;
+ }
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+
+ UISortableControl control = (UISortableControl) component;
+ String clientId = control.getClientId(context);
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, String> parameterMap = externalContext.getRequestParameterMap();
+ String string = parameterMap.get(clientId);
+ if (string != null) {
+ UIDataTable table = control.getTable();
+
+ new SortEvent2(table, control.getSortExpression());
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
+
+ //TODO: AjaxEvent?
+ if (ajaxContext.isAjaxRequest()) {
+ ajaxContext.addComponentToAjaxRender(table);
+ }
+ }
+
+
+ }
+
+ @Override
+ public boolean getRendersChildren() {
+ return false;
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+
+ UISortableControl control = (UISortableControl) component;
+ Mode mode = control.getMode();
+ if (mode == null) {
+ mode = SERVER;
+ }
+ RendererCommand rendererCommand = commands[mode.ordinal()];
+ if (rendererCommand != null) {
+ rendererCommand.encodeMarkup(writer, context, control);
+ }
+
+ }
+}
Property changes on: trunk/ui/dataTable
___________________________________________________________________
Name: svn:ignore
- target
.settings
.classpath
.project
+ target
.settings
.classpath
.project
.buildpath
.externalToolBuilders
bin
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -33,4 +33,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Column";
+ public abstract String getSortMode();
+
+ public abstract void setSortMode(String mode);
}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -42,7 +42,7 @@
* JSF component class
*
*/
-public abstract class UIDataTable extends SequenceDataAdaptor implements Sortable {
+public abstract class UIDataTable extends SequenceDataAdaptor implements Sortable2 {
/**
* @author shura
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-01-12 13:01:03 UTC (rev 5325)
@@ -32,6 +32,7 @@
import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.FilterIterator;
@@ -39,8 +40,6 @@
import org.richfaces.component.Row;
import org.richfaces.component.UIDataTable;
-import com.sun.org.apache.xpath.internal.compiler.OpCodes;
-
/**
* @author shura
*
@@ -147,18 +146,35 @@
writer.writeAttribute("scope", "col", null);
getUtils().encodeAttribute(context, column, "colspan");
- if (column instanceof Column) {
- Column col = (Column) column;
- String clientId = column.getClientId(context) + facetName;
+ if (column instanceof org.richfaces.component.UIColumn) {
+ org.richfaces.component.UIColumn col =
+ (org.richfaces.component.UIColumn) column;
+ String clientId = col.getClientId(context) + facetName;
writer.writeAttribute("id", clientId, null);
if (col.isSortable()) {
String sortExpression = col.getSortExpression();
- JSFunction function = new JSFunction("new RichFaces.SortControl");
- function.addParameter(clientId);
- function.addParameter(((UIDataAdaptor)column.getParent()).getBaseClientId(context));
- function.addParameter(new JSReference(sortExpression));
- function.addParameter(column.getClientId(context));
- getUtils().writeScript(context, column, function.toScript());
+ String sortMode = col.getSortMode();
+ if ("client".equals(sortMode)) {
+ JSFunction function = new JSFunction("new RichFaces.SortControl");
+ function.addParameter(clientId);
+ function.addParameter(((UIDataAdaptor)column.getParent()).getBaseClientId(context));
+ function.addParameter(new JSReference(sortExpression));
+ function.addParameter(column.getClientId(context));
+ getUtils().writeScript(context, column, function.toScript());
+ } else if ("ajax".equals(sortMode)) {
+
+ //AjaxRendererUtils.buildOnClick(uiComponent, facesContext)
+
+ JSFunction function = new JSFunction("new RichFaces.SortControl.Ajax");
+ function.addParameter(clientId);
+ getUtils().writeScript(context, column, function.toScript());
+
+ } else {
+ JSFunction function = new JSFunction("new RichFaces.SortControl.Server");
+ function.addParameter(clientId);
+ getUtils().writeScript(context, column, function.toScript());
+ }
+
}
}
Modified: trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js
===================================================================
--- trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js 2008-01-12 12:04:13 UTC (rev 5324)
+++ trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/scripts/data-table.js 2008-01-12 13:01:03 UTC (rev 5325)
@@ -1,6 +1,4 @@
-if (!window.RichFaces) {
- window.RichFaces = {};
-}
+if (!window.RichFaces) var RichFaces = {};
@@ -86,27 +84,34 @@
this.tableId = tableId;
this.columnId = columnId;
this.sortExpression = sortExpression;
- this.onclick = this.invoke.bindAsEventListener(this);
+ this.prepareEvents();
+ //TODO:Set cursor via clazz
+ //element.setStyle({cursor: "pointer"});
- var element = $(this.id);
- element.observe("click", this.onclick);
- element.setStyle({cursor: "pointer"});
-
RichFaces.SortController.registerControl(this);
},
+
+ prepareEvents : function() {
+ this.onclick = this.invoke.bindAsEventListener(this);
+ var element = this.getElement();
+ element.observe("click", this.onclick);
+ },
+ getElement : function () {
+ return $($(this.id).parentNode);
+ },
displaySortedAscending : function() {
- $(this.id)
+ this.getElement()
.removeClassName("rich-sort-desc")
.addClassName("rich-sort-asc");
},
displaySortedDescending : function() {
- $(this.id)
+ this.getElement()
.removeClassName("rich-sort-asc")
.addClassName("rich-sort-desc");
},
displayNotSortedAtAll : function() {
- $(this.id)
+ this.getElement()
.removeClassName("rich-sort-desc")
.removeClassName("rich-sort-asc");
},
@@ -268,4 +273,20 @@
}
-});
\ No newline at end of file
+});
+RichFaces.SortControl.Server = Class.create(RichFaces.SortControl, {
+ invoke : function(event) {
+ $(this.id + 's').click();
+ }
+});
+RichFaces.SortControl.Ajax = Class.create(RichFaces.SortControl, {
+ initialize: function(id, f) {
+ this.id = id;
+ this.f = f;
+ this.prepareEvents();
+ },
+ invoke : function(event) {
+ this.f(event);
+ }
+});
+
17 years