Author: nbelaevski
Date: 2008-03-11 14:44:41 -0400 (Tue, 11 Mar 2008)
New Revision: 6726
Added:
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/ui/datascroller/src/main/java/org/richfaces/taglib/
trunk/ui/datascroller/src/main/java/org/richfaces/taglib/DatascrollerTagHandlerBase.java
Removed:
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/ui/datascroller/src/main/java/org/richfaces/event/
Modified:
trunk/ui/datascroller/src/main/config/component/datascroller.xml
trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
trunk/ui/datascroller/src/test/java/org/richfaces/event/DataScrollerEventTest.java
Log:
http://jira.jboss.com/jira/browse/RF-1133
Modified: trunk/ui/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/ui/datascroller/src/main/config/component/datascroller.xml 2008-03-11 18:44:27
UTC (rev 6725)
+++ trunk/ui/datascroller/src/main/config/component/datascroller.xml 2008-03-11 18:44:41
UTC (rev 6726)
@@ -38,7 +38,7 @@
<taghandler generate="true">
<classname>org.richfaces.taglib.DataScrollerTagHandler</classname>
-
<superclass>com.sun.facelets.tag.jsf.ComponentHandler</superclass>
+
<superclass>org.richfaces.taglib.DatascrollerTagHandlerBase</superclass>
</taghandler>
<!--
@@ -246,13 +246,9 @@
<name>actionExpression</name>
</property>
- <property hidden="true">
- <name>firstRow</name>
- </property>
-
- <property hidden="true">
+ <property>
<name>page</name>
- <classname>java.lang.String</classname>
+ <classname>int</classname>
</property>
<property>
@@ -266,7 +262,7 @@
<classname>java.lang.String</classname>
<description>Name of variable in request scope containing number of
pages</description>
</property>
-
+
</component>
&listeners;
</components>
Modified:
trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java 2008-03-11
18:44:27 UTC (rev 6725)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/component/DataScrollerViewPhaseListener.java 2008-03-11
18:44:41 UTC (rev 6726)
@@ -52,11 +52,10 @@
if (component.isRendered()) {
if (component instanceof UIDatascroller) {
UIDatascroller datascroller = (UIDatascroller) component;
- datascroller.updateFirstRow();
UIData dataTable = datascroller.getDataTable();
if (dataTable.isRendered()) {
- dataTable.setFirst(datascroller.getFirstRow());
+ dataTable.setFirst(datascroller.setupFirstRowValue());
}
}
Deleted: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-03-11
18:44:27 UTC (rev 6725)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-03-11
18:44:41 UTC (rev 6726)
@@ -1,585 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import javax.el.ELException;
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIData;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.richfaces.component.util.MessageUtil;
-import org.richfaces.event.DataScrollerEvent;
-import org.richfaces.event.DataScrollerListener;
-import org.richfaces.event.DataScrollerSource;
-
-
-/** JSF component class */
-//xxxx nick -> alex - extend UIComponentBase and
-//create event listener & event classes to define PageSwitchEvent
-//public abstract class UIDatascroller extends UIComponentBase implements
DataScrollerSource{
-public abstract class UIDatascroller extends AjaxActionComponent
-implements DataScrollerSource, ActionSource {
-
- private Integer firstRow;
-
- public static final String COMPONENT_TYPE = "org.richfaces.Datascroller";
- public static final String COMPONENT_FAMILY =
"org.richfaces.Datascroller";
-
- public static final String FIRST_FACET_NAME = "first";
-
- public static final String LAST_FACET_NAME = "last";
-
- public static final String NEXT_FACET_NAME = "next";
-
- public static final String PREVIOUS_FACET_NAME = "previous";
-
- public static final String FAST_FORWARD_FACET_NAME = "fastforward";
-
- public static final String FAST_REWIND_FACET_NAME = "fastrewind";
-
-
- public static final String FIRST_DISABLED_FACET_NAME = "first_disabled";
-
- public static final String LAST_DISABLED_FACET_NAME = "last_disabled";
-
- public static final String NEXT_DISABLED_FACET_NAME = "next_disabled";
-
- public static final String PREVIOUS_DISABLED_FACET_NAME
- = "previous_disabled";
-
- public static final String FAST_FORWARD_DISABLED_FACET_NAME
- = "fastforward_disabled";
-
- public static final String FAST_REWIND_DISABLED_FACET_NAME
- = "fastrewind_disabled";
-
- public void addScrollerListener(DataScrollerListener listener) {
- addFacesListener(listener);
- }
-
- public DataScrollerListener[] getScrollerListeners() {
- return (DataScrollerListener[]) getFacesListeners(
- DataScrollerListener.class);
- }
-
- public void removeScrollerListener(DataScrollerListener listener) {
- removeFacesListener(listener);
- }
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- super.broadcast(event);
- if (event instanceof DataScrollerEvent) {
- DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
- setPage(dataScrollerEvent.getNewScrolVal(), true);
-
- FacesContext context = FacesContext.getCurrentInstance();
- AjaxRendererUtils.addRegionByName(context, this, this.getId());
- AjaxRendererUtils.addRegionByName(context, this, this.getFor());
-
- setupReRender(context);
-
- MethodExpression scrollerListener = getScrollerListener();
- if (scrollerListener != null) {
- scrollerListener.invoke(context.getELContext(), new Object[]{event});
- }
- }
- }
-
- public abstract MethodExpression getScrollerListener();
-
- public abstract void setScrollerListener(MethodExpression scrollerListener);
-
- public abstract void setFor(String f);
-
- public abstract String getFor();
-
- public abstract int getFastStep();
-
- public abstract void setFastStep(int FastStep);
-
- public abstract boolean isRenderIfSinglePage();
-
- public abstract void setRenderIfSinglePage(boolean renderIfSinglePage);
-
- public abstract int getMaxPages();
-
- public abstract void setMaxPages(int maxPages);
-
- public abstract String getSelectedStyleClass();
-
- public abstract void setSelectedStyleClass(String selectedStyleClass);
-
- public abstract String getSelectedStyle();
-
- public abstract void setSelectedStyle(String selectedStyle);
-
- public abstract String getEventsQueue();
-
- public abstract void setEventsQueue(String eventsQueue);
-
- public abstract boolean isAjaxSingle();
-
- public abstract void setAjaxSingle(boolean ajaxSingle);
-
- public abstract int getRequestDelay();
-
- public abstract void setRequestDelay(int requestDelay);
-
- public abstract String getTableStyleClass();
-
- public abstract void setTableStyleClass(String tableStyleClass);
-
- public abstract String getStyleClass();
-
- public abstract String getStyle();
-
- public abstract void setStyleClass(String styleClass);
-
- public abstract void setStyle(String styleClass);
-
- public abstract String getAlign();
-
- public abstract void setAlign(String align);
-
- public abstract String getBoundaryControls();
-
- public abstract void setBoundaryControls(String boundaryControls);
-
- public abstract String getFastControls();
-
- public abstract void setFastControls(String fastControls);
-
- public abstract String getStepControls();
-
- public abstract void setStepControls(String stepControls);
-
- public abstract String getInactiveStyleClass();
-
- public abstract String getInactiveStyle();
-
- public abstract void setInactiveStyleClass(String inactiveStyleClass);
-
- public abstract void setInactiveStyle(String inactiveStyle);
- /**
- * Finds the dataTable which id is mapped to the "for" property
- *
- * @return the dataTable component
- */
- public UIData getDataTable() {
- String forAttribute = getFor();
- UIComponent forComp;
- if (forAttribute == null) {
- forComp = this;
- while ((forComp = forComp.getParent()) != null) {
- if (forComp instanceof UIData) {
- setFor(forComp.getId());
- return (UIData) forComp;
- }
- }
- throw new FacesException(
- "could not find dataTable for datascroller " +
this.getId());
- } else {
- forComp = RendererUtils.getInstance().findComponentFor(this, forAttribute);
- }
- if (forComp == null) {
- throw new IllegalArgumentException("could not find dataTable with id
'"
- + forAttribute + "'");
- } else if (!(forComp instanceof UIData)) {
- throw new IllegalArgumentException(
- "component with id '" + forAttribute
- + "' must be of type " + UIData.class.getName()
- + ", not type "
- + forComp.getClass().getName());
- }
- return (UIData) forComp;
- }
-
- public int getPageIndex(UIData uiData) {
- //xxxx nick -> alex - suppose this.getRows() would be better here
- int rows = getRows(uiData);
- if (0 == rows) {
- throw new FacesException("Missing 'rows' attribute on component
'"
- + uiData.getId() + "'");
- }
-
- int firstRow = getFirstRow();
-
- int pageIndex;
- if (rows > 0) {
- //xxxx nick -> alex - suppose this.getFirst() would be better here
- pageIndex = firstRow / rows + 1;
- } else {
- //TODO nick -> nick - is it valid if under 0?
- pageIndex = 0;
- }
-
- if (firstRow % rows > 0) {
- pageIndex++;
- }
-
- return pageIndex;
- }
-
- /**
- * Gets the index of the current page
- *
- * @return the page index
- */
- public int getPageIndex() {
- UIData uiData = getDataTable();
- return getPageIndex(uiData);
- }
-
- private void setFirstRowValue(int row) {
- FacesContext context = getFacesContext();
- ValueExpression ve = getValueExpression("firstRow");
- if (ve != null) {
- try {
- ve.setValue(context.getELContext(), row);
- firstRow = null;
- } catch (ELException e) {
- String messageStr = e.getMessage();
- Throwable result = e.getCause();
- while (null != result &&
- result.getClass().isAssignableFrom(ELException.class)) {
- messageStr = result.getMessage();
- result = result.getCause();
- }
- FacesMessage message;
- if (null == messageStr) {
- message =
- MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
- new Object[] { MessageUtil.getLabel(
- context, this) });
- } else {
- message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
- messageStr,
- messageStr);
- }
- context.getExternalContext().log(message.getSummary(), result);
- context.addMessage(getClientId(context), message);
- context.renderResponse();
- } catch (IllegalArgumentException e) {
- FacesMessage message =
- MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
- new Object[] { MessageUtil.getLabel(
- context, this) });
- context.getExternalContext().log(message.getSummary(), e);
- context.addMessage(getClientId(context), message);
- context.renderResponse();
- } catch (Exception e) {
- FacesMessage message =
- MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
- new Object[] { MessageUtil.getLabel(
- context, this) });
- context.getExternalContext().log(message.getSummary(), e);
- context.addMessage(getClientId(context), message);
- context.renderResponse();
- }
- } else {
- setFirstRow(row);
- }
- //TODO
- }
-
- private int getFirstRowForLastPage(int rowCount, int rows) {
- int delta = rowCount % rows;
- int newFirst = delta > 0 && delta < rows ? rowCount - delta :
rowCount
- - rows;
- if (newFirst >= 0) {
- return newFirst;
- } else {
- return 0;
- }
- }
-
- /**
- * Sets the page number according to the parameter recived from the
- * commandLink
- *
- * @param facetName - can be "first:, "last", "next",
"previous",
- * "fastforward", "fastrewind"
- */
- public void setPage(String facetName) {
- setPage(facetName, false);
- }
-
- public void setPage(String facetName, boolean updateModel) {
- // check if facet is selected
- if (FIRST_FACET_NAME.equals(facetName)) {
- setFirstRowValue(0);
- } else {
- UIData dataTable = getDataTable();
-
- int first = getFirstRow();
- int rows = getRows(dataTable);
- int rowCount = getRowCount(dataTable);
-
- if (PREVIOUS_FACET_NAME.equals(facetName)) {
- int previous = first - rows;
- if (previous >= 0) {
- setFirstRowValue(previous);
- }
- } else if (NEXT_FACET_NAME.equals(facetName)) {
- int next = first + rows;
- if (next < rowCount) {
- setFirstRowValue(next);
- }
- //if (rows>0){
- // if (((next+rows)/rows)>getMaxPages()){
- // next=getMaxPages()*rows-rows;;
- // }
- //}
- } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
- int fastStep = getFastStep();
- if (fastStep <= 0) {
- fastStep = 1;
- }
- int next = first + rows * fastStep;
- if (next >= rowCount) {
- next = (rowCount - 1) - ((rowCount - 1) % rows);
- }
- //if (rows>0){
- // if (((next+rows)/rows)>getMaxPages()){
- // next=getMaxPages()*rows-rows;;
- //}
- //}
- setFirstRowValue(next);
- } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
- int fastStep = getFastStep();
- if (fastStep <= 0) {
- fastStep = 1;
- }
- int previous = first - rows * fastStep;
- if (previous < 0) {
- previous = 0;
- }
- setFirstRowValue(previous);
- } else if (LAST_FACET_NAME.equals(facetName)) {
- setFirstRow(getFirstRowForLastPage(rowCount, rows));
- }
- // the paginator is selected
- else {
- int pageindex = Integer.parseInt(facetName);
- int pageCount = getPageCount(rowCount, rows);
- if (pageindex > pageCount) {
- pageindex = pageCount;
- } else if (pageindex <= 0) {
- pageindex = 1;
- }
- setFirstRowValue(rows * (pageindex - 1));
- }
-
- }
-
- }
-
- public int getPageCount(int rowCount, int rows) {
- int pageCount;
- if (rows > 0) {
- pageCount = rows <= 0 ? 1 : rowCount / rows;
- if (rowCount % rows > 0) {
- pageCount++;
- }
- if (pageCount == 0) {
- pageCount = 1;
- }
- } else {
- rows = 1;
- pageCount = 1;
- }
- return pageCount;
- }
-
- public int getPageCount(UIData data) {
- return getPageCount(getRowCount(data), getRows(data));
- }
-
- /** @return the page count of the uidata */
- public int getPageCount() {
- return getPageCount(getDataTable());
- }
-
- public int getRowCount(UIData data) {
- int rowCount = data.getRowCount();
- if (rowCount >= 0) {
- return rowCount;
- }
-
- return BinarySearch.search(data);
- }
-
- /** @return int */
- public int getRowCount() {
- //xxx nick -> alex - scrollable models can return -1 here
- //let's implement "dychotomic" discovery
- // setPage(1)... if isPageAvailable() setPage(2) then 4, 8, etc.
- // setPage() { setRowIndex(pageIdx * rows); }
- // isPageAvailable() { return isRowAvailable() }
- //return getUIData().getRowCount();
- return getRowCount(getDataTable());
- }
-
- public int getRows(UIData data) {
- int row = 0;
- row = data.getRows();
- if (row == 0) {
- row = getRowCount(data);
- }
-
- return row;
- }
-
- // facet getter methods
- public UIComponent getFirst() {
- return getFacet(FIRST_FACET_NAME);
- }
-
- public UIComponent getLast() {
- return getFacet(LAST_FACET_NAME);
- }
-
- public UIComponent getNext() {
- return getFacet(NEXT_FACET_NAME);
- }
-
- public UIComponent getFastForward() {
- return getFacet(FAST_FORWARD_FACET_NAME);
- }
-
- public UIComponent getFastRewind() {
- return getFacet(FAST_REWIND_FACET_NAME);
- }
-
- public UIComponent getPrevious() {
- return getFacet(PREVIOUS_FACET_NAME);
- }
-
- public void updateFirstRow() {
- UIData dataTable = getDataTable();
- int rowCount = getRowCount(dataTable);
- int firstRow = getFirstRow();
-
- if (firstRow < 0) {
- setFirstRow(0);
- } else if (firstRow >= rowCount) {
- setFirstRow(getFirstRowForLastPage(rowCount, getRows(dataTable)));
- }
- }
-
- public int getFirstRow() {
- if (this.firstRow != null) {
- return firstRow;
- }
-
- ValueExpression ve = getValueExpression("firstRow");
- if (ve != null) {
- try {
- Integer firstRowObject = (Integer)
ve.getValue(getFacesContext().getELContext());
-
- if (firstRowObject != null) {
- return firstRowObject;
- } else {
- return 0;
- }
- } catch (ELException e) {
- throw new FacesException(e);
- }
- } else {
- return 0;
- }
- }
-
- public void setFirstRow(int row) {
- this.firstRow = row;
- }
-
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- static class BinarySearch {
-
- public static int search(UIData data) {
- int rowIndex = data.getRowIndex();
- try {
- int n = 1;
- int k = 2;
- for (; ;) {
- data.setRowIndex(k - 1);
- if (data.isRowAvailable()) {
- n = k;
- k = k * 2;
- } else {
- break;
- }
- }
-
- while (n < k) {
- int kk = Math.round((n + k) / 2) + 1;
- data.setRowIndex(kk - 1);
- if (data.isRowAvailable()) {
- n = kk;
- } else {
- k = kk - 1;
- }
- }
-
- data.setRowIndex(k - 1);
- if (data.isRowAvailable()) {
- return k;
- } else {
- return 0;
- }
- } finally {
- data.setRowIndex(rowIndex);
- }
- }
- }
-
- public Object saveState(FacesContext context) {
- return new Object[] {
- super.saveState(context),
- firstRow,
- };
-
- }
-
- public void restoreState(FacesContext context, Object object) {
- Object[] state = (Object[]) object;
-
- super.restoreState(context, state[0]);
- firstRow = (Integer) state[1];
- }
-
-}
Added: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
(rev 0)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-03-11
18:44:41 UTC (rev 6726)
@@ -0,0 +1,583 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.component.AjaxActionComponent;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.component.util.MessageUtil;
+import org.richfaces.event.DataScrollerEvent;
+import org.richfaces.event.DataScrollerListener;
+import org.richfaces.event.DataScrollerSource;
+
+
+/** JSF component class */
+//xxxx nick -> alex - extend UIComponentBase and
+//create event listener & event classes to define PageSwitchEvent
+//public abstract class UIDatascroller extends UIComponentBase implements
DataScrollerSource{
+public abstract class UIDatascroller extends AjaxActionComponent
+implements DataScrollerSource, ActionSource {
+
+ private Integer pageNumber;
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Datascroller";
+ public static final String COMPONENT_FAMILY =
"org.richfaces.Datascroller";
+
+ public static final String FIRST_FACET_NAME = "first";
+
+ public static final String LAST_FACET_NAME = "last";
+
+ public static final String NEXT_FACET_NAME = "next";
+
+ public static final String PREVIOUS_FACET_NAME = "previous";
+
+ public static final String FAST_FORWARD_FACET_NAME = "fastforward";
+
+ public static final String FAST_REWIND_FACET_NAME = "fastrewind";
+
+
+ public static final String FIRST_DISABLED_FACET_NAME = "first_disabled";
+
+ public static final String LAST_DISABLED_FACET_NAME = "last_disabled";
+
+ public static final String NEXT_DISABLED_FACET_NAME = "next_disabled";
+
+ public static final String PREVIOUS_DISABLED_FACET_NAME
+ = "previous_disabled";
+
+ public static final String FAST_FORWARD_DISABLED_FACET_NAME
+ = "fastforward_disabled";
+
+ public static final String FAST_REWIND_DISABLED_FACET_NAME
+ = "fastrewind_disabled";
+
+ public void addScrollerListener(DataScrollerListener listener) {
+ addFacesListener(listener);
+ }
+
+ public DataScrollerListener[] getScrollerListeners() {
+ return (DataScrollerListener[]) getFacesListeners(
+ DataScrollerListener.class);
+ }
+
+ public void removeScrollerListener(DataScrollerListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ super.broadcast(event);
+ if (event instanceof DataScrollerEvent) {
+ DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
+
+ updateModel(dataScrollerEvent.getPage());
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ AjaxRendererUtils.addRegionByName(context, this, this.getId());
+ AjaxRendererUtils.addRegionByName(context, this, this.getFor());
+
+ setupReRender(context);
+
+ MethodExpression scrollerListener = getScrollerListener();
+ if (scrollerListener != null) {
+ scrollerListener.invoke(context.getELContext(), new Object[]{event});
+ }
+ }
+ }
+
+ public abstract MethodExpression getScrollerListener();
+
+ public abstract void setScrollerListener(MethodExpression scrollerListener);
+
+ public abstract void setFor(String f);
+
+ public abstract String getFor();
+
+ public abstract int getFastStep();
+
+ public abstract void setFastStep(int FastStep);
+
+ public abstract boolean isRenderIfSinglePage();
+
+ public abstract void setRenderIfSinglePage(boolean renderIfSinglePage);
+
+ public abstract int getMaxPages();
+
+ public abstract void setMaxPages(int maxPages);
+
+ public abstract String getSelectedStyleClass();
+
+ public abstract void setSelectedStyleClass(String selectedStyleClass);
+
+ public abstract String getSelectedStyle();
+
+ public abstract void setSelectedStyle(String selectedStyle);
+
+ public abstract String getEventsQueue();
+
+ public abstract void setEventsQueue(String eventsQueue);
+
+ public abstract boolean isAjaxSingle();
+
+ public abstract void setAjaxSingle(boolean ajaxSingle);
+
+ public abstract int getRequestDelay();
+
+ public abstract void setRequestDelay(int requestDelay);
+
+ public abstract String getTableStyleClass();
+
+ public abstract void setTableStyleClass(String tableStyleClass);
+
+ public abstract String getStyleClass();
+
+ public abstract String getStyle();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract void setStyle(String styleClass);
+
+ public abstract String getAlign();
+
+ public abstract void setAlign(String align);
+
+ public abstract String getBoundaryControls();
+
+ public abstract void setBoundaryControls(String boundaryControls);
+
+ public abstract String getFastControls();
+
+ public abstract void setFastControls(String fastControls);
+
+ public abstract String getStepControls();
+
+ public abstract void setStepControls(String stepControls);
+
+ public abstract String getInactiveStyleClass();
+
+ public abstract String getInactiveStyle();
+
+ public abstract void setInactiveStyleClass(String inactiveStyleClass);
+
+ public abstract void setInactiveStyle(String inactiveStyle);
+ /**
+ * Finds the dataTable which id is mapped to the "for" property
+ *
+ * @return the dataTable component
+ */
+ public UIData getDataTable() {
+ String forAttribute = getFor();
+ UIComponent forComp;
+ if (forAttribute == null) {
+ forComp = this;
+ while ((forComp = forComp.getParent()) != null) {
+ if (forComp instanceof UIData) {
+ setFor(forComp.getId());
+ return (UIData) forComp;
+ }
+ }
+ throw new FacesException(
+ "could not find dataTable for datascroller " +
this.getId());
+ } else {
+ forComp = RendererUtils.getInstance().findComponentFor(this, forAttribute);
+ }
+ if (forComp == null) {
+ throw new IllegalArgumentException("could not find dataTable with id
'"
+ + forAttribute + "'");
+ } else if (!(forComp instanceof UIData)) {
+ throw new IllegalArgumentException(
+ "component with id '" + forAttribute
+ + "' must be of type " + UIData.class.getName()
+ + ", not type "
+ + forComp.getClass().getName());
+ }
+ return (UIData) forComp;
+ }
+
+ /**
+ * Gets the index of the current page
+ *
+ * @param data
+ * @param pageCount
+ * @return the page index
+ */
+ public int getPageIndex(UIData data, int pageCount) {
+ int page = getPage();
+ if (page < 0) {
+ if (pageCount == 0) {
+ page = 1;
+ } else {
+ page = pageCount + page + 1;
+ }
+ }
+
+ return page;
+ }
+
+ private int getFastStepOrDefault() {
+ int step = getFastStep();
+ if (step <= 0) {
+ return 1;
+ } else {
+ return step;
+ }
+ }
+
+ public int getPageForFacet(String facetName) {
+ UIData dataTable = getDataTable();
+ int pageCount = getPageCount(dataTable);
+ int pageIndex = getPageIndex(dataTable, pageCount);
+
+ return getPageForFacet(facetName, pageIndex, pageCount);
+ }
+
+ public int getPageForFacet(String facetName, int pageIndex, int pageCount) {
+ int newPage = 1;
+
+ if (FIRST_FACET_NAME.equals(facetName)) {
+ newPage = 1;
+ } else if (PREVIOUS_FACET_NAME.equals(facetName)) {
+ newPage = pageIndex - 1;
+ } else if (NEXT_FACET_NAME.equals(facetName)) {
+ newPage = pageIndex + 1;
+ } else if (LAST_FACET_NAME.equals(facetName)) {
+ newPage = pageCount > 0 ? pageCount : 1;
+ } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
+ newPage = pageIndex + getFastStepOrDefault();
+ } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
+ newPage = pageIndex - getFastStepOrDefault();
+ } else {
+ if (facetName != null) {
+ try {
+ newPage = Integer.parseInt(facetName.toString());
+ } catch (NumberFormatException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ }
+ }
+
+ if (newPage < 0) {
+ if (pageCount == 0) {
+ newPage = 1;
+ } else {
+ //newPage = -1 should scroll to the last one
+ newPage = pageCount + newPage + 1;
+ }
+ }
+ }
+
+ if (newPage >= 1 && newPage <= pageCount) {
+ return newPage;
+ } else if (newPage == 0) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+
+ /**
+ * Sets the page number according to the parameter recived from the
+ * commandLink
+ *
+ * @param facetName - can be "first:, "last", "next",
"previous",
+ * "fastforward", "fastrewind"
+ *
+ * @see #setPage(int)
+ * @see #getPageForFacet(String)
+ *
+ * @deprecated as of 3.2 replaced with <code>setPage(int)</page>
+ */
+ public void setPage(String facetName) {
+ int newPage = getPageForFacet(facetName);
+ if (newPage > 0) {
+ setPage(newPage);
+ }
+ }
+
+ public int getPageCount(UIData data) {
+ int rowCount = getRowCount(data);
+ int rows = getRows(data);
+
+ int pageCount;
+ if (rows > 0) {
+ pageCount = rows <= 0 ? 1 : rowCount / rows;
+ if (rowCount % rows > 0) {
+ pageCount++;
+ }
+ if (pageCount == 0) {
+ pageCount = 1;
+ }
+ } else {
+ rows = 1;
+ pageCount = 1;
+ }
+ return pageCount;
+ }
+
+ /** @return the page count of the uidata */
+ public int getPageCount() {
+ return getPageCount(getDataTable());
+ }
+
+ public int getRowCount(UIData data) {
+ int rowCount = data.getRowCount();
+ if (rowCount >= 0) {
+ return rowCount;
+ }
+
+ return BinarySearch.search(data);
+ }
+
+ /** @return int */
+ public int getRowCount() {
+ //xxx nick -> alex - scrollable models can return -1 here
+ //let's implement "dychotomic" discovery
+ // setPage(1)... if isPageAvailable() setPage(2) then 4, 8, etc.
+ // setPage() { setRowIndex(pageIdx * rows); }
+ // isPageAvailable() { return isRowAvailable() }
+ //return getUIData().getRowCount();
+ return getRowCount(getDataTable());
+ }
+
+ public int getRows(UIData data) {
+ int row = 0;
+ row = data.getRows();
+ if (row == 0) {
+ row = getRowCount(data);
+ }
+
+ return row;
+ }
+
+ // facet getter methods
+ public UIComponent getFirst() {
+ return getFacet(FIRST_FACET_NAME);
+ }
+
+ public UIComponent getLast() {
+ return getFacet(LAST_FACET_NAME);
+ }
+
+ public UIComponent getNext() {
+ return getFacet(NEXT_FACET_NAME);
+ }
+
+ public UIComponent getFastForward() {
+ return getFacet(FAST_FORWARD_FACET_NAME);
+ }
+
+ public UIComponent getFastRewind() {
+ return getFacet(FAST_REWIND_FACET_NAME);
+ }
+
+ public UIComponent getPrevious() {
+ return getFacet(PREVIOUS_FACET_NAME);
+ }
+
+ private transient Integer currentPageIndex;
+ private transient Integer currentPageCount;
+
+ public Integer getCurrentPageCount(UIData dataTable) {
+ if (currentPageCount == null) {
+ currentPageCount = getPageCount(dataTable);
+ }
+
+ return currentPageCount;
+ }
+
+ public Integer getCurrentPageIndex(UIData dataTable) {
+ if (currentPageIndex == null) {
+ int pageCount = getCurrentPageCount(dataTable);
+ int pageIndex = getPageIndex(dataTable, pageCount);
+
+ if (pageCount < 1) {
+ pageCount = 1;
+ }
+
+ if (pageIndex < 1) {
+ pageIndex = 1;
+
+ this.updateModel(pageIndex);
+ } else if (pageIndex > pageCount) {
+ pageIndex = pageCount;
+
+ this.updateModel(pageIndex);
+ }
+
+ currentPageIndex = pageIndex;
+ }
+
+ return currentPageIndex;
+ }
+
+ public int setupFirstRowValue() {
+ UIData dataTable = getDataTable();
+ return (getCurrentPageIndex(dataTable) - 1) * getRows(dataTable);
+ }
+
+ public void setPage(int newPage) {
+ this.pageNumber = newPage;
+ }
+
+ public int getPage() {
+ if (this.pageNumber != null) {
+ return pageNumber;
+ }
+
+ ValueExpression ve = getValueExpression("page");
+ if (ve != null) {
+ try {
+ Integer pageObject = (Integer)
ve.getValue(getFacesContext().getELContext());
+
+ if (pageObject != null) {
+ return pageObject;
+ } else {
+ return 1;
+ }
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ return 1;
+ }
+ }
+
+ private void updateModel(int newPage) {
+ this.pageNumber = newPage;
+ FacesContext context = getFacesContext();
+ ValueExpression ve = getValueExpression("page");
+ if (ve != null) {
+ try {
+ ve.setValue(context.getELContext(), this.pageNumber);
+ this.pageNumber = null;
+ } catch (ELException e) {
+ String messageStr = e.getMessage();
+ Throwable result = e.getCause();
+ while (null != result &&
+ result.getClass().isAssignableFrom(ELException.class)) {
+ messageStr = result.getMessage();
+ result = result.getCause();
+ }
+ FacesMessage message;
+ if (null == messageStr) {
+ message =
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] { MessageUtil.getLabel(
+ context, this) });
+ } else {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ messageStr,
+ messageStr);
+ }
+ context.getExternalContext().log(message.getSummary(), result);
+ context.addMessage(getClientId(context), message);
+ context.renderResponse();
+ } catch (IllegalArgumentException e) {
+ FacesMessage message =
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] { MessageUtil.getLabel(
+ context, this) });
+ context.getExternalContext().log(message.getSummary(), e);
+ context.addMessage(getClientId(context), message);
+ context.renderResponse();
+ } catch (Exception e) {
+ FacesMessage message =
+ MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] { MessageUtil.getLabel(
+ context, this) });
+ context.getExternalContext().log(message.getSummary(), e);
+ context.addMessage(getClientId(context), message);
+ context.renderResponse();
+ }
+ }
+ }
+
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ static class BinarySearch {
+
+ public static int search(UIData data) {
+ int rowIndex = data.getRowIndex();
+ try {
+ int n = 1;
+ int k = 2;
+ for (; ;) {
+ data.setRowIndex(k - 1);
+ if (data.isRowAvailable()) {
+ n = k;
+ k = k * 2;
+ } else {
+ break;
+ }
+ }
+
+ while (n < k) {
+ int kk = Math.round((n + k) / 2) + 1;
+ data.setRowIndex(kk - 1);
+ if (data.isRowAvailable()) {
+ n = kk;
+ } else {
+ k = kk - 1;
+ }
+ }
+
+ data.setRowIndex(k - 1);
+ if (data.isRowAvailable()) {
+ return k;
+ } else {
+ return 0;
+ }
+ } finally {
+ data.setRowIndex(rowIndex);
+ }
+ }
+ }
+
+ public Object saveState(FacesContext context) {
+ return new Object[] {
+ super.saveState(context),
+ pageNumber
+ };
+
+ }
+
+ public void restoreState(FacesContext context, Object object) {
+ Object[] state = (Object[]) object;
+
+ super.restoreState(context, state[0]);
+ pageNumber = (Integer) state[1];
+ }
+
+}
Modified:
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2008-03-11
18:44:27 UTC (rev 6725)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2008-03-11
18:44:41 UTC (rev 6726)
@@ -48,28 +48,33 @@
}
public void doDecode(FacesContext context, UIComponent component) {
- UIDatascroller scroller = (UIDatascroller) component;
- if (scroller.getPageCount() > 1) {
- String param = (String) getParamMap(context).get(
- component.getClientId(context));
- if (param != null) {
- DataScrollerEvent event = new DataScrollerEvent(scroller,
- String.valueOf(scroller.getPageIndex()), param);
- if (scroller.isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ String param = (String) getParamMap(context).get(
+ component.getClientId(context));
+ if (param != null) {
+ UIDatascroller scroller = (UIDatascroller) component;
+ UIData data = scroller.getDataTable();
+ int pageCount = scroller.getPageCount(data);
+
+ if (pageCount > 1) {
+ int pageIndex = scroller.getPageIndex(data, pageCount);
+ int newPage = scroller.getPageForFacet(param, pageIndex, pageCount);
+ if (newPage > 0) {
+ DataScrollerEvent event = new DataScrollerEvent(scroller,
+ String.valueOf(pageIndex), param, newPage);
+ if (scroller.isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+
+ component.queueEvent(event);
}
-
- component.queueEvent(event);
}
}
}
public ControlsState getControlsState(FacesContext context,
- UIDatascroller datascroller, UIData dataTable) {
- int pageIndex = datascroller.getPageIndex(dataTable);
- int pageCount = datascroller.getPageCount(dataTable);
+ UIDatascroller datascroller, int pageIndex, int pageCount) {
int minPageIdx = 1;
int maxPageIdx = pageCount;
int fastStep = datascroller.getFastStep();
@@ -156,17 +161,18 @@
return controlsState;
}
- public void renderPager(FacesContext context, UIComponent component, UIData data)
+ public void renderPager(FacesContext context, UIComponent component, int pageIndex,
int count)
throws IOException {
ResponseWriter out = context.getResponseWriter();
UIDatascroller scroller = (UIDatascroller) component;
- int currentPage = scroller.getPageIndex(data);
+ int currentPage = pageIndex;
int maxPages = scroller.getMaxPages();
if (maxPages <= 1) {
maxPages = 1;
}
- int pageCount = scroller.getPageCount(data);
+
+ int pageCount = count;
if (pageCount <= 1) {
return;
}
@@ -221,12 +227,12 @@
}
- public void renderPages(FacesContext context, UIComponent component, UIData data)
+ public void renderPages(FacesContext context, UIComponent component, int pageIndex,
int count)
throws IOException {
UIDatascroller scroller = (UIDatascroller) component;
- int currentPage = scroller.getPageIndex(data);
+ int currentPage = pageIndex;
- int pageCount = scroller.getPageCount(data);
+ int pageCount = count;
if (pageCount <= 1) {
pageCount = 1;
}
Added:
trunk/ui/datascroller/src/main/java/org/richfaces/taglib/DatascrollerTagHandlerBase.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/taglib/DatascrollerTagHandlerBase.java
(rev 0)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/taglib/DatascrollerTagHandlerBase.java 2008-03-11
18:44:41 UTC (rev 6726)
@@ -0,0 +1,93 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.taglib;
+
+import javax.el.ValueExpression;
+
+import org.richfaces.component.UIDatascroller;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.MetaRule;
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.Metadata;
+import com.sun.facelets.tag.MetadataTarget;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import com.sun.facelets.tag.jsf.ComponentHandler;
+
+/**
+ * Created 11.03.2008
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class DatascrollerTagHandlerBase extends ComponentHandler {
+
+ private static final MetaRule pageRule = new MetaRule() {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if ("page".equals(name)) {
+ return new PageMapper(attribute);
+ } else {
+ return null;
+ }
+ }
+
+ };
+
+ private static final class PageMapper extends Metadata {
+
+ private final TagAttribute page;
+
+ /**
+ * @param attribute
+ */
+ public PageMapper(TagAttribute attribute) {
+ page = attribute;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.facelets.tag.Metadata#applyMetadata(com.sun.facelets.FaceletContext,
java.lang.Object)
+ */
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ UIDatascroller datascroller = (UIDatascroller) instance;
+ ValueExpression ve = page.getValueExpression(ctx, int.class);
+ if (ve.isLiteralText()) {
+ Integer value = (Integer) ve.getValue(ctx.getFacesContext().getELContext());
+ datascroller.setPage(value);
+ } else {
+ datascroller.setValueExpression("page", ve);
+ }
+ }
+
+ }
+
+ public DatascrollerTagHandlerBase(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset ruleset = super.createMetaRuleset(type);
+ ruleset.addRule(pageRule);
+ return ruleset;
+ }
+}
Modified: trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
===================================================================
---
trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2008-03-11
18:44:27 UTC (rev 6725)
+++
trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2008-03-11
18:44:41 UTC (rev 6726)
@@ -32,7 +32,8 @@
maxPages = 1;
}
- int pageCount = component.getPageCount(dataTable);
+ int pageCount = component.getCurrentPageCount(dataTable);
+ int pageIndex = component.getCurrentPageIndex(dataTable);
boolean singlePageRender = true;
@@ -60,7 +61,7 @@
<tr>
<jsp:scriptlet><![CDATA[
String facet;
- org.richfaces.renderkit.html.ControlsState controlsState =
getControlsState(context, component, dataTable);
+ org.richfaces.renderkit.html.ControlsState controlsState =
getControlsState(context, component, pageIndex, pageCount);
if (controlsState.isFirstRendered()){
if (controlsState.isFirstEnabled()){
@@ -193,7 +194,7 @@
]]></jsp:scriptlet>
<jsp:scriptlet><![CDATA[
- renderPages(context,component,dataTable);
+ renderPages(context, component, pageIndex, pageCount);
UIComponent pagesFacet = component.getFacet("pages");
if (pagesFacet !=null && pagesFacet.isRendered()) {
]]></jsp:scriptlet>
@@ -204,7 +205,7 @@
</td>
<jsp:scriptlet><![CDATA[
} else {
- renderPager(context,component,dataTable);
+ renderPager(context, component, pageIndex, pageCount);
}
]]></jsp:scriptlet>
Modified:
trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
===================================================================
---
trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2008-03-11
18:44:27 UTC (rev 6725)
+++
trunk/ui/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2008-03-11
18:44:41 UTC (rev 6726)
@@ -426,33 +426,31 @@
assertEquals(4,scroller.getPageCount());
scroller.setPage("2");
scroller.setFastStep(2);
- assertEquals(5,data.getFirst());
+ assertEquals(5,scroller.setupFirstRowValue());
scroller.setPage("next");
- assertEquals(10,data.getFirst());
+ assertEquals(10,scroller.setupFirstRowValue());
scroller.setPage("previous");
- assertEquals(5,data.getFirst());
+ assertEquals(5,scroller.setupFirstRowValue());
scroller.setPage("fastforward");
- assertEquals(15,data.getFirst());
+ assertEquals(15,scroller.setupFirstRowValue());
scroller.setPage("fastrewind");
- assertEquals(5,data.getFirst());
+ assertEquals(5,scroller.setupFirstRowValue());
scroller.setPage("first");
- assertEquals(0,data.getFirst());
+ assertEquals(0,scroller.setupFirstRowValue());
scroller.setPage("previous");
- assertEquals(0,data.getFirst());
+ assertEquals(0,scroller.setupFirstRowValue());
scroller.setPage("fastrewind");
- assertEquals(0,data.getFirst());
+ assertEquals(0,scroller.setupFirstRowValue());
scroller.setPage("last");
- assertEquals(15,data.getFirst());
+ assertEquals(15,scroller.setupFirstRowValue());
scroller.setPage("next");
- assertEquals(15,data.getFirst());
+ assertEquals(15,scroller.setupFirstRowValue());
scroller.setPage("fastforward");
- assertEquals(15,data.getFirst());
+ assertEquals(15,scroller.setupFirstRowValue());
scroller.setPage("5");
- assertEquals(15,data.getFirst());
+ assertEquals(15,scroller.setupFirstRowValue());
scroller.setPage("0");
- assertEquals(0,data.getFirst());
- data.setRows(0);
-
+ assertEquals(0,scroller.setupFirstRowValue());
}
public void testListener() throws Exception{
@@ -503,7 +501,7 @@
// }
// };
- DataScrollerEvent event = new DataScrollerEvent( ((UIComponent) scroller),
"1", "2" );
+ DataScrollerEvent event = new DataScrollerEvent( ((UIComponent) scroller),
"1", "2", 2);
this.scroller.setScrollerListener(binding);
this.scroller.broadcast(event);
Modified:
trunk/ui/datascroller/src/test/java/org/richfaces/event/DataScrollerEventTest.java
===================================================================
---
trunk/ui/datascroller/src/test/java/org/richfaces/event/DataScrollerEventTest.java 2008-03-11
18:44:27 UTC (rev 6725)
+++
trunk/ui/datascroller/src/test/java/org/richfaces/event/DataScrollerEventTest.java 2008-03-11
18:44:41 UTC (rev 6726)
@@ -52,7 +52,7 @@
super.setUp();
data = (UIData) application.createComponent(HtmlDataTable.COMPONENT_TYPE);
- event = new DataScrollerEvent(data, "old", "new");
+ event = new DataScrollerEvent(data, "old", "new", 1);
result = false;
}