Author: d.bulahov
Date: 2007-03-07 04:55:45 -0500 (Wed, 07 Mar 2007)
New Revision: 27
Modified:
trunk/richfaces/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
trunk/richfaces/datascroller/src/main/resources/org/richfaces/renderkit/html/css/datascroller.xcss
Log:
RFA-282 fixed
RFA-299 fixed
Modified:
trunk/richfaces/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
---
trunk/richfaces/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-03-06
20:27:54 UTC (rev 26)
+++
trunk/richfaces/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-03-07
09:55:45 UTC (rev 27)
@@ -128,14 +128,61 @@
//}
+ public void processUpdates(FacesContext context){
+ try {
+
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ } finally
+ { allowCache = false; _UIData = null; }
+
+ }
+
+ public void processValidators(FacesContext context){
+ try {
+
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }finally
+ { allowCache = false; _UIData = null; }
+
+
+ }
+
+ public void processDecodes(FacesContext context){
+ try {
+ decode(context);
+
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+
+ }finally
+ { allowCache = false; _UIData = null; }
+
+ }
+
+
private transient UIData _UIData;
+ private transient boolean allowCache;
+// private UIData getUIData() {
+// if (_UIData == null) {
+// _UIData = getDataTable();
+// }
+// return _UIData;
+// }
+
private UIData getUIData() {
- if (_UIData == null) {
+ if (!allowCache) {
_UIData = getDataTable();
+ allowCache=true;
}
return _UIData;
}
+
/**
* Finds the dataTable which id is mapped to the "for" property
@@ -219,6 +266,7 @@
}
else if (NEXT_FACET_NAME.equals(facetName)) {
int next = dataTable.getFirst() + getRows();
+ if (next>getMaxPages()) next=getMaxPages();
if (next < getRowCount()) dataTable.setFirst(next);
}
else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
@@ -228,6 +276,9 @@
int rowcount = getRowCount();
if (next >= rowcount)
next = (rowcount - 1) - ((rowcount - 1) % getRows());
+ if (next>getMaxPages()){
+ next=getMaxPages();
+ }
dataTable.setFirst(next);
}
else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
@@ -244,6 +295,9 @@
int first = delta > 0 && delta < rows ? rowcount - delta : rowcount
- rows;
if (first >= 0) {
+ if (first>getMaxPages()){
+ first=getMaxPages();
+ }
dataTable.setFirst(first);
}
else {
@@ -308,12 +362,52 @@
//let's implement "dychotomic" discovery
// setPage(1)... if isPageAvailable() setPage(2) then 4, 8, etc.
// setPage() { setRowIndex(pageIdx * rows); }
- // isPageAvailable() { return isRowAvailable() }
+ // isPageAvailable() { return isRowAvailable() }
return getUIData().getRowCount();
+ //return BinarySearch(getUIData());
}
+ private int BinarySearch(UIData Data)
+ {
+ int n=1;
+ int k=2;
+ for (;;){
+ Data.setRows(k-1);
+ if (Data.isRowAvailable()){
+ n=k;
+ k=k*2;
+ }
+ else{
+ break;
+ }
+ }
+
+
+ while (n < k) {
+ //int kk = (int)Math.round((n + k)/ 2 + 0.5) - 1;
+ int kk = (int)Math.round((n + k)/ 2);
+ Data.setRows(kk-1);
+ if (Data.isRowAvailable()){
+ n = kk;
+ }
+ else{
+ k=kk-1;
+ }
+ }
+
+
+ Data.setRows(k-1);
+ if (Data.isRowAvailable()){
+ return k;
+ }
+ else{
+ return 0;
+ }
+ }
+
+
/**
* @return int
*/
Modified:
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
---
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-03-06
20:27:54 UTC (rev 26)
+++
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-03-07
09:55:45 UTC (rev 27)
@@ -136,13 +136,15 @@
out.startElement("td", component);
if (isCurrentPage){
out.writeAttribute("align", "center", null);
- out.writeAttribute("class", "dr-dscr-act rich-datascr-act
"+scroller.getStyleClass(), null);
+ //out.writeAttribute("class", "dr-dscr-act rich-datascr-act
"+scroller.getStyleClass(), null);
+ out.writeAttribute("class", "dr-dscr-act rich-datascr-act",
null);
out.writeAttribute("style", ""+scroller.getSelectedStyle(),
null);
}
else{
out.writeAttribute("align", "center", null);
- out.writeAttribute("class", "dr-dscr-inact rich-datascr-inact
"+scroller.getStyleClass(), null);
- out.writeAttribute("style", ""+scroller.getStyle(), null);
+ //out.writeAttribute("class", "dr-dscr-inact rich-datascr-inact
"+scroller.getStyleClass(), null);
+ out.writeAttribute("class", "dr-dscr-inact rich-datascr-inact",
null);
+ //out.writeAttribute("style", ""+scroller.getStyle(),
null);
out.writeAttribute("onclick", getOnClick(context,
component,Integer.toString(j)) , null);
}
out.writeText(Integer.toString(i + 1), null);
Modified:
trunk/richfaces/datascroller/src/main/resources/org/richfaces/renderkit/html/css/datascroller.xcss
===================================================================
---
trunk/richfaces/datascroller/src/main/resources/org/richfaces/renderkit/html/css/datascroller.xcss 2007-03-06
20:27:54 UTC (rev 26)
+++
trunk/richfaces/datascroller/src/main/resources/org/richfaces/renderkit/html/css/datascroller.xcss 2007-03-07
09:55:45 UTC (rev 27)
@@ -4,6 +4,8 @@
xmlns="http://www.w3.org/1999/xhtml" >
<f:verbatim><![CDATA[
+.dr-dscr{
+}
.dr-dscr-t{
border : 1px solid #c0c0c0; /*panelBorderColor*/
background-color : #ffffff; /*tableBackgroundColor*/