Author: konstantin.mishin
Date: 2009-11-20 10:37:27 -0500 (Fri, 20 Nov 2009)
New Revision: 15946
Added:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlExtendedDataTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
RF-7871
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlExtendedDataTable.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlExtendedDataTable.java 2009-11-20
15:37:21 UTC (rev 15945)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlExtendedDataTable.java 2009-11-20
15:37:27 UTC (rev 15946)
@@ -27,7 +27,7 @@
public static final String COMPONENT_TYPE =
"org.richfaces.ExtendedDataTable";
- private static enum PropertyKeys {style, styleClass}
+ private static enum PropertyKeys {style, styleClass, frozenColumns}
public HtmlExtendedDataTable() {
setRendererType("org.richfaces.ExtendedDataTableRenderer");
@@ -49,14 +49,14 @@
getStateHelper().put(PropertyKeys.styleClass, styleClass);
}
-// public String getWidth() {
-// return (String) getStateHelper().eval(PropertyKeys.width, "");
-// }
+ public Integer getFrozenColumns() {
+ return (Integer) getStateHelper().eval(PropertyKeys.frozenColumns, 0);
+ }
+
+ public void setFrozenColumns(Integer frozenColumns) {
+ getStateHelper().put(PropertyKeys.frozenColumns, frozenColumns);
+ }
//
-// public void setWidth(String width) {
-// getStateHelper().put(PropertyKeys.width, width);
-// }
-//
// public String getHeight() {
// return (String) getStateHelper().eval(PropertyKeys.height, "");
// }
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-11-20
15:37:21 UTC (rev 15945)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-11-20
15:37:27 UTC (rev 15946)
@@ -29,7 +29,6 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.renderkit.RendererBase;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTableBase;
/**
* @author shura
@@ -50,31 +49,24 @@
*/
- public abstract void encodeRow(FacesContext context, RowHolder rowHolder) throws
IOException;
+ public abstract void encodeRow(RowHolderBase rowHolder) throws IOException;
public DataVisitResult process(FacesContext context, Object rowKey, Object argument) {
- RowHolder holder = (RowHolder) argument;
+ RowHolderBase holder = (RowHolderBase) argument;
Row row = holder.getRow();
row.setRowKey(context, rowKey);
try {
- encodeRow(context, holder);
+ encodeRow(holder);
} catch (IOException e) {
//TODO: seems we need add throws IOException ???
}
-
holder.nextRow();
return DataVisitResult.CONTINUE;
}
- //TODO remove
- public void encodeRows(FacesContext facesContext, UIDataTableBase table) throws
IOException {
- RowHolder rowHolder = new RowHolder(table);
- encodeRows(facesContext, table, rowHolder);
+ protected void encodeRows(RowHolderBase rowHolder) throws IOException {
+ rowHolder.getRow().walk(rowHolder.getContext(), this, rowHolder);
}
-
- protected void encodeRows(FacesContext context, Row table, RowHolder rowHolder) throws
IOException {
- table.walk(context, this, rowHolder);
- }
public boolean getRendersChildren() {
return true;
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2009-11-20
15:37:21 UTC (rev 15945)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2009-11-20
15:37:27 UTC (rev 15946)
@@ -64,18 +64,19 @@
public void encodeRows(FacesContext context, UIDataTableBase dataTable) throws
IOException {
- RowHolder holder = new RowHolder(dataTable);
+ RowHolder holder = new RowHolder(context, dataTable);
holder.setCellClass(dataTable.getCellSkinClass());
holder.setRowClass(dataTable.getRowSkinClass());
holder.setFirstRowClass(dataTable.getFirstRowSkinClass());
holder.setHeaderRow(false);
holder.setCellElement(HTML.TD_ELEM);
- encodeRows(context, dataTable, holder);
+ encodeRows(holder);
}
//TODO: refactor
- public void encodeRow(FacesContext context, RowHolder rowHolder) throws IOException {
-
+ public void encodeRow(RowHolderBase holder) throws IOException {
+ FacesContext context = holder.getContext();
+ RowHolder rowHolder = (RowHolder) holder;
boolean rowStart = true;
boolean bodyStart = false;
@@ -99,7 +100,7 @@
if(child instanceof Row) {
Row childRow = (Row)child;
- RowHolder childRowHolder = new RowHolder(childRow);
+ RowHolder childRowHolder = new RowHolder(context, childRow);
childRowHolder.setCurrentRow(processRow);
childRowHolder.setCellElement(rowHolder.getCellElement());
@@ -127,7 +128,7 @@
encodeTableBodyStart(writer, context, subTable);
encodeHeader(writer, context, subTable);
}
- encodeRows(context, childRow, childRowHolder);
+ encodeRows(childRowHolder);
if(child instanceof UISubTable) {
UISubTable subTable = (UISubTable)child;
@@ -180,7 +181,6 @@
if(bodyStart && rowHolder.isDataTable()) {
encodeTableBodyEnd(writer, context, (UIDataTableBase) row);
}
-
}
@Override
@@ -427,7 +427,7 @@
if(footer instanceof Row) {
Row row = (Row)footer;
- RowHolder holder = new RowHolder(row);
+ RowHolder holder = new RowHolder(context, row);
holder.setCellElement(element);
holder.setFirstRowClass(skinFirstRowClass);
holder.setRowClass(skinRowClass);
@@ -435,7 +435,7 @@
//holder.resetCurrentRow();
holder.setHeaderRow(true);
- encodeRows(context, row, holder);
+ encodeRows(holder);
} else {
writer.startElement(HTML.TR_ELEMENT, footer);
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-11-20
15:37:21 UTC (rev 15945)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-11-20
15:37:27 UTC (rev 15946)
@@ -22,7 +22,9 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
@@ -43,6 +45,64 @@
})
public class ExtendedDataTableRenderer extends AbstractTableRenderer {
+ private class RendererState extends RowHolderBase{
+
+ private UIDataTableBase table;
+ private List<UIComponent> frozenColumns;
+ private List<UIComponent> columns;
+ private boolean frozen;
+
+ public RendererState(FacesContext context, UIDataTableBase table) {
+ super(context);
+ this.table = table;
+ int count = getFrozenColumnsCount();
+ frozenColumns = new ArrayList<UIComponent>();
+ columns = new ArrayList<UIComponent>();
+ Iterator<UIComponent> iterator = table.columns();
+ for (; iterator.hasNext() && count > 0; count--) {
+ UIComponent component = iterator.next();
+ if(component.isRendered()) {
+ frozenColumns.add(component);
+ }
+ }
+ for (; iterator.hasNext();) {
+ UIComponent component = iterator.next();
+ if(component.isRendered()) {
+ columns.add(component);
+ }
+ }
+ }
+
+ private int getFrozenColumnsCount() {
+ int count = ((Integer)
table.getAttributes().get("frozenColumns")).intValue();
+ int columnsCount = getColumnsCount(table);
+ if (count > columnsCount) {
+ count = columnsCount;
+ }
+ return count;
+ }
+
+ public UIDataTableBase getRow() {
+ return table;
+ }
+
+ public List<UIComponent> getFrozenColumns() {
+ return frozenColumns;
+ }
+
+ public List<UIComponent> getColumns() {
+ return columns;
+ }
+
+ public void setFrozen(boolean frozen) {
+ this.frozen = frozen;
+ }
+
+ public boolean isFrozen() {
+ return frozen;
+ }
+ }
+
@Override
protected Class<? extends UIComponent> getComponentClass() {
return UIDataTableBase.class;
@@ -65,10 +125,12 @@
Object key = table.getRowKey();
table.captureOrigValue(context);
table.setRowKey(context, null);
- encodeStyle(writer, context, table);
- encodeHeaderOrFooter(writer, context, table, "header");
- encodeBody(writer, context, table);
- encodeHeaderOrFooter(writer, context, table, "footer");
+ RendererState state = new RendererState(context, table);
+ //TODO encodeCaption(context, table);
+ encodeStyle(state);
+ encodeHeaderOrFooter(state, "header");
+ encodeBody(state);
+ encodeHeaderOrFooter(state, "footer");
table.setRowKey(context,key);
table.restoreOrigValue(context);
}
@@ -83,27 +145,35 @@
writer.endElement(HTML.DIV_ELEM);
}
- private void encodeStyle(ResponseWriter writer, FacesContext context,
- UIDataTableBase table) throws IOException {
+ private void encodeStyle(RendererState state) throws IOException {
+ FacesContext context = state.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+ UIDataTableBase table = state.getRow();
writer.startElement("style", table);
writer.writeAttribute(HTML.TYPE_ATTR, "text/css", null);
writer.writeText(".rich-extable-part-width{", null); //TODO
getNormalizedId(context, state.getGrid())
writer.writeText("width: 100%;", "width");
writer.writeText("}", null);
- int columnIndex = 0;
Iterator<UIComponent> columns = table.columns();
while (columns.hasNext()) {
UIComponent column = (UIComponent) columns.next();
+ String id = column.getId();
+ if (id == null) {
+ column.getClientId(context); // hack initialize id
+ id = column.getId();
+ }
String width = getColumnWidth(column);
- writer.writeText(".rich-extable-cell-width-" + columnIndex++ + "
{", "width"); //TODO getNormalizedId(context, state.getGrid())
+ writer.writeText(".rich-extable-cell-width-" + id + " {",
"width"); //TODO getNormalizedId(context, state.getGrid())
writer.writeText("width: " + width + ";", "width");
writer.writeText("}", "width");
}
writer.endElement("style");
}
- private void encodeHeaderOrFooter(ResponseWriter writer, FacesContext context,
- UIDataTableBase table, String name) throws IOException {
+ private void encodeHeaderOrFooter(RendererState state, String name) throws IOException
{
+ FacesContext context = state.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+ UIDataTableBase table = state.getRow();
if (isColumnFacetPresent(table, name)) {
writer.startElement(HTML.DIV_ELEM, table);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses("rich-extable-" + name,
(String)table.getAttributes().get(name + "Class")), null);
@@ -112,61 +182,76 @@
writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
writer.startElement(HTML.TBOBY_ELEMENT, table);
writer.startElement(HTML.TR_ELEMENT, table);
- int columnIndex = 0;
- Iterator<UIComponent> columns = table.columns();
- writer.startElement(HTML.TD_ELEM, table);
- writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":n" +
name.charAt(0) + "pe", null);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable" +
("footer".equals(name) ? "-footer" : "") + "-part
rich-extable-part-width", null);
- writer.startElement(HTML.TABLE_ELEMENT, table);
- writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
- writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
- writer.startElement(HTML.TBOBY_ELEMENT, table);
- writer.startElement(HTML.TR_ELEMENT, table);
- while (columns.hasNext()) {
- encodeHeaderOrFooterCell(context, writer, columns.next(), "rich-extable-" +
name + "-cell", "rich-extable-cell-width-" + columnIndex++, name);
+ Iterator<UIComponent> columns = state.getFrozenColumns().iterator();
+ for (int i = 0; i < 2; i++) {
+ if (columns.hasNext()) {
+ writer.startElement(HTML.TD_ELEM, table);
+ writer.startElement(HTML.DIV_ELEM, table);
+ if (i == 0) {
+ if ("header".equals(name)) {
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) +
":frozenHeader", null);
+ }
+ } else {
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":"
+ name, null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable" +
("footer".equals(name) ? "-footer" : "") + "-part
rich-extable-part-width", null);
+ }
+ writer.startElement(HTML.TABLE_ELEMENT, table);
+ writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
+ writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
+ writer.startElement(HTML.TBOBY_ELEMENT, table);
+ writer.startElement(HTML.TR_ELEMENT, table);
+ while (columns.hasNext()) {
+ encodeHeaderOrFooterCell(context, writer, columns.next(), name);
+ }
+ writer.endElement(HTML.TR_ELEMENT);
+ writer.endElement(HTML.TBOBY_ELEMENT);
+ writer.endElement(HTML.TABLE_ELEMENT);
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.TD_ELEM);
+ }
+ columns = state.getColumns().iterator();
}
writer.endElement(HTML.TR_ELEMENT);
writer.endElement(HTML.TBOBY_ELEMENT);
writer.endElement(HTML.TABLE_ELEMENT);
writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.TD_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
- writer.endElement(HTML.TBOBY_ELEMENT);
- writer.endElement(HTML.TABLE_ELEMENT);
- writer.endElement(HTML.DIV_ELEM);
}
}
- private void encodeBody(ResponseWriter writer, FacesContext context,
- UIDataTableBase table) throws IOException {
+ private void encodeBody(RendererState state) throws IOException {
+ FacesContext context = state.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+ UIDataTableBase table = state.getRow();
writer.startElement(HTML.DIV_ELEM, table);
writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":b",
null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-body", null);
writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":c",
null);
writer.startElement(HTML.DIV_ELEM, table);
writer.endElement(HTML.DIV_ELEM);
writer.startElement(HTML.TABLE_ELEMENT, table);
writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
writer.startElement(HTML.TBOBY_ELEMENT, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":tb",
null);
writer.startElement(HTML.TR_ELEMENT, table);
- writer.startElement(HTML.TD_ELEM, table);
- writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) +
":nbpe", null);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-part
rich-extable-part-width", null);
- writer.startElement(HTML.TABLE_ELEMENT, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) +
":nbte", null);
- writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
- writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
- writer.startElement(HTML.TBOBY_ELEMENT, table);
- encodeRows(context, table);
- writer.endElement(HTML.TBOBY_ELEMENT);
- writer.endElement(HTML.TABLE_ELEMENT);
- writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.TD_ELEM);
+ state.setFrozen(true);
+ for (int i = 0; i < 2; i++) { //TODO Empty frozen part shouldn't be rendered
+ writer.startElement(HTML.TD_ELEM, table);
+ writer.startElement(HTML.DIV_ELEM, table);
+ if (i == 1) {
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) +
":body", null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-part
rich-extable-part-width", null);
+ }
+ writer.startElement(HTML.TABLE_ELEMENT, table);
+ writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
+ writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
+ writer.startElement(HTML.TBOBY_ELEMENT, table);
+ table.walk(context, this, state); //TODO encodeRows(context, table);
+ writer.endElement(HTML.TBOBY_ELEMENT);
+ writer.endElement(HTML.TABLE_ELEMENT);
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.TD_ELEM);
+ state.setFrozen(false);
+ }
writer.endElement(HTML.TR_ELEMENT);
writer.endElement(HTML.TBOBY_ELEMENT);
writer.endElement(HTML.TABLE_ELEMENT);
@@ -175,14 +260,13 @@
}
private void encodeHeaderOrFooterCell(FacesContext context, ResponseWriter writer,
- UIComponent column, String skinCellClass, String widthCellClass,
- String facetName) throws IOException {
+ UIComponent column, String facetName) throws IOException {
if (column.isRendered()) {
String classAttribute = facetName + "Class";
writer.startElement(HTML.TD_ELEM, column);
writer.startElement(HTML.DIV_ELEM, column);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses(skinCellClass,
widthCellClass,
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses("rich-extable-" + facetName + "-cell",
"rich-extable-cell-width-" + column.getId(),
(String) column.getAttributes().get(classAttribute)), null);
@@ -197,20 +281,25 @@
}
@Override
- public void encodeRow(FacesContext context, RowHolder rowHolder)
- throws IOException {
+ public void encodeRow(RowHolderBase rowHolder) throws IOException {
+ FacesContext context = rowHolder.getContext();
ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = (UIDataTableBase) rowHolder.getRow(); //TODO Don't use cast
this
+ RendererState state = (RendererState)rowHolder;
+ UIDataTableBase table = state.getRow();
writer.startElement(HTML.TR_ELEMENT, table);
writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context), null);
- Iterator<UIComponent> columns = table.columns();
- int columnIndex = 0;
+ Iterator<UIComponent> columns = null;
+ if (state.isFrozen()) {
+ columns = state.getFrozenColumns().iterator();
+ } else {
+ columns = state.getColumns().iterator();
+ }
while (columns.hasNext()) {
UIComponent column = (UIComponent) columns.next();
if (column.isRendered()) {
writer.startElement(HTML.TD_ELEM, table);
writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-cell
rich-extable-cell-width-" + columnIndex++, null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-cell
rich-extable-cell-width-" + column.getId(), null);
renderChildren(context, column);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
@@ -226,5 +315,4 @@
}
return width;
}
-
}
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2009-11-20
15:37:21 UTC (rev 15945)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2009-11-20
15:37:27 UTC (rev 15946)
@@ -1,14 +1,14 @@
package org.richfaces.renderkit;
+import javax.faces.context.FacesContext;
+
import org.richfaces.component.Row;
import org.richfaces.component.UIColumnGroup;
import org.richfaces.component.UIDataTable;
import org.richfaces.component.UISubTable;
-public class RowHolder {
+public class RowHolder extends RowHolderBase{
- private int currentRow = 0;
-
private String cellElement;
private String cellClass;
@@ -30,26 +30,11 @@
private Row row;
- public RowHolder(Row row) {
+ public RowHolder(FacesContext context, Row row) {
+ super(context);
this.row = row;
}
- public int getCurrentRow() {
- return currentRow;
- }
-
- public int nextRow() {
- return ++currentRow;
- }
-
- public void setCurrentRow(int currentRow) {
- this.currentRow = currentRow;
- }
-
- public void resetCurrentRow() {
- this.currentRow = 0;
- }
-
public String getCellClass() {
return this.cellClass;
}
Added:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java 2009-11-20
15:37:27 UTC (rev 15946)
@@ -0,0 +1,39 @@
+package org.richfaces.renderkit;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.Row;
+
+public abstract class RowHolderBase {
+
+ private FacesContext context;
+
+ private int currentRow = 0;
+
+ public RowHolderBase(FacesContext context) {
+ this.context = context;
+ }
+
+ public FacesContext getContext() {
+ return context;
+ }
+
+ public abstract Row getRow();
+
+ public int getCurrentRow() {
+ return currentRow;
+ }
+
+ public int nextRow() {
+ return ++currentRow;
+ }
+
+ public void setCurrentRow(int currentRow) {
+ this.currentRow = currentRow;
+ }
+
+ public void resetCurrentRow() {
+ this.currentRow = 0;
+ }
+}
+
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2009-11-20
15:37:21 UTC (rev 15945)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2009-11-20
15:37:27 UTC (rev 15946)
@@ -37,18 +37,18 @@
richfaces.ExtendedDataTable = function(id) {
var element = document.getElementById(id);
var bodyElement = document.getElementById(id + ":b");
- var contentElement = document.getElementById(id + ":c");
+ var contentElement = bodyElement.firstChild;//TODO Richfaces.firstDescendant;
var marginElement = contentElement.firstChild;//TODO this.marginElement =
Richfaces.firstDescendant(this.contentElement);
var dataTableElement = contentElement.lastChild;//TODO this.dataTableElement =
Richfaces.lastDescendant(this.contentElement);
- var frozenHeaderPartElement = document.getElementById(id + ":fhpe");
+ var frozenHeaderPartElement = document.getElementById(id + ":frozenHeader");
var normalPartStyle =
richfaces.getCSSRule(".rich-extable-part-width").style;
- var idSuffixs = [":nhpe", ":nbpe", ":nfpe"];
+ var idSuffixs = [":header", ":body", ":footer"];
+ var rows = document.getElementById(id + idSuffixs[1]).firstChild.rows.length;//TODO
Richfaces.firstDescendant;
+
var scrollElement = document.getElementById(id + idSuffixs[2]);
- var rows = document.getElementById(id + ":nbte").rows.length;
-
var updateLayout = function() {
var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
normalPartStyle.width = element.clientWidth - offsetWidth + "px";