You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/01/13 20:56:01 UTC
svn commit: r495958 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
Author: bommel
Date: Sat Jan 13 11:56:00 2007
New Revision: 495958
URL: http://svn.apache.org/viewvc?view=rev&rev=495958
Log:
(TOBAGO-239) UIData of tobago should support rows == 0
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?view=diff&rev=495958&r1=495957&r2=495958
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Sat Jan 13 11:56:00 2007
@@ -411,7 +411,10 @@
public int getPage() {
int first = getFirst() + 1;
int rows = getRows();
-
+ if (rows == 0) {
+ // avoid division by zero
+ return 0;
+ }
if ((first % rows) > 0) {
return (first / rows) + 1;
} else {
@@ -420,7 +423,11 @@
}
public int getPages() {
- return getRowCount() / getRows() + (getRowCount() % getRows() == 0 ? 0 : 1);
+ int rows = getRows();
+ if (rows == 0) {
+ return 0;
+ }
+ return getRowCount() / rows + (getRowCount() % rows == 0 ? 0 : 1);
}
public List<UIComponent> getRenderedChildrenOf(UIColumn column) {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?view=diff&rev=495958&r1=495957&r2=495958
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Sat Jan 13 11:56:00 2007
@@ -307,7 +307,6 @@
LOG.debug("first = " + data.getFirst() + " rows = " + data.getRows());
}
- //final Map requestMap = facesContext.getExternalContext().getRequestMap();
final String var = data.getVar();
boolean odd = false;
@@ -327,14 +326,6 @@
LOG.debug("list " + data.getValue());
}
- //final Object value = data.getRowData();
-
- //*if (LOG.isDebugEnabled()) {
- // LOG.debug("element " + value);
- //}
-
- //requestMap.put(var, value);
-
writer.startElement(HtmlConstants.TR, null);
writer.writeClassAttribute(rowClass);
writer.writeIdAttribute(sheetId + "_data_tr_" + rowIndex);
@@ -419,7 +410,6 @@
data.setRowIndex(-1);
- //requestMap.remove(var);
writer.endElement(HtmlConstants.TABLE);
writer.endElement(HtmlConstants.DIV);