Author: nbelaevski
Date: 2010-05-18 21:06:32 -0400 (Tue, 18 May 2010)
New Revision: 17117
Modified:
root/ui-sandbox/tables/trunk/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
Log:
https://jira.jboss.org/browse/RF-7856
https://jira.jboss.org/browse/RF-8630
Modified:
root/ui-sandbox/tables/trunk/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
---
root/ui-sandbox/tables/trunk/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-05-19
00:44:27 UTC (rev 17116)
+++
root/ui-sandbox/tables/trunk/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-05-19
01:06:32 UTC (rev 17117)
@@ -90,6 +90,8 @@
private Part current;
private Iterator<Part> partIterator;
+ private EncoderVariance encoderVariance = EncoderVariance.full;
+
public RendererState(FacesContext context, UIDataTableBase table) {
super(context);
this.table = table;
@@ -148,307 +150,266 @@
return partIterator.hasNext();
}
+ public EncoderVariance getEncoderVariance() {
+ return encoderVariance;
+ }
+
+ public void setEncoderVariance(EncoderVariance encoderVariance) {
+ this.encoderVariance = encoderVariance;
+ }
}
- private class BaseTableEncoderStrategy {
-
- void encodeStartUpdate(FacesContext context, String targetId) throws IOException
{
+ private enum EncoderVariance {
+ full {
+ @Override
+ public void encodeStartUpdate(FacesContext context, String targetId) throws
IOException {
+ //do nothing
+ }
- }
+ @Override
+ public void encodeEndUpdate(FacesContext context) throws IOException {
+ //do nothing
+ }
+ },
- void encodeEndUpdate(FacesContext context) throws IOException {
-
- }
+ partial {
+
+ private void switchResponseWriter(FacesContext context, boolean writerState)
{
+ ResponseWriter writer = context.getResponseWriter();
+ ((OnOffResponseWriter) writer).setSwitchedOn(writerState);
+ }
+
+ @Override
+ public void encodeStartUpdate(FacesContext context, String targetId) throws
IOException {
+ switchResponseWriter(context, true);
+
+
context.getPartialViewContext().getPartialResponseWriter().startUpdate(targetId);
+ }
+
+ @Override
+ public void encodeEndUpdate(FacesContext context) throws IOException {
+ context.getPartialViewContext().getPartialResponseWriter().endUpdate();
+
+ switchResponseWriter(context, false);
+ }
+ };
+
+ public abstract void encodeStartUpdate(FacesContext context, String targetId)
throws IOException;
- private void encodeHeaderOrFooterCell(FacesContext context, ResponseWriter
writer, UIComponent column,
- String facetName) throws IOException {
- if (column.isRendered()) {
+ public abstract void encodeEndUpdate(FacesContext context) throws IOException;
+
+ }
+
+ private void encodeHeaderOrFooterCell(FacesContext context, ResponseWriter writer,
UIComponent column,
+ String facetName) throws IOException {
+ if (column.isRendered()) {
- String classAttribute = facetName + "Class";
- writer.startElement(HTML.TD_ELEM, column);
- if ("header".equals(facetName)) {
- writer.startElement(HTML.DIV_ELEM, column);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-resizer-holder rich-extable-cell-width-"
- + column.getId(), null);
- writer.startElement(HTML.DIV_ELEM, column);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-resizer", null);
- writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.DIV_ELEM);
- }
+ String classAttribute = facetName + "Class";
+ writer.startElement(HTML.TD_ELEM, column);
+ if ("header".equals(facetName)) {
writer.startElement(HTML.DIV_ELEM, column);
- writer
- .writeAttribute(HTML.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses("rich-extable-" + facetName + "-cell",
- "rich-extable-cell-width-" + column.getId(), (String)
column.getAttributes().get(classAttribute)),
- null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-resizer-holder rich-extable-cell-width-"
+ + column.getId(), null);
writer.startElement(HTML.DIV_ELEM, column);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-" +
facetName + "-cell-content", null);
- UIComponent facet = column.getFacet(facetName);
- if (facet != null && facet.isRendered()) {
- facet.encodeAll(context);
- }
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-resizer", null);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.TD_ELEM);
}
- }
-
- private void encodeHeaderOrFooter(RendererState state, String name) throws
IOException {
- FacesContext context = state.getContext();
- ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = state.getRow();
- if (table.isColumnFacetPresent(name)) {
- writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses("rich-extable-" + name, (String) table
- .getAttributes().get(name + "Class")), 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);
- for (state.startIterate(); state.hasNextPart();) {
- Part part = state.nextPart();
- PartName partName = part.getName();
- Iterator<UIComponent> columns = part.getColumns().iterator();
- if (columns.hasNext()) {
- writer.startElement(HTML.TD_ELEM, table);
- if (PartName.frozen.equals(partName) &&
"footer".equals(name)) {
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-footer-align", null);
- }
- writer.startElement(HTML.DIV_ELEM, table);
- if (PartName.frozen.equals(partName)) {
- 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);
- }
-
- String tableId = table.getClientId(context) + ":cf" +
name.charAt(0) + partName.name().charAt(0);
- encodeStartUpdate(context, tableId);
-
- writer.startElement(HTML.TABLE_ELEMENT, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, tableId, null);
- 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);
-
- encodeEndUpdate(context);
-
- 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);
+ writer.startElement(HTML.DIV_ELEM, column);
+ writer
+ .writeAttribute(HTML.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses("rich-extable-" + facetName + "-cell",
+ "rich-extable-cell-width-" + column.getId(), (String)
column.getAttributes().get(classAttribute)),
+ null);
+ writer.startElement(HTML.DIV_ELEM, column);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-" +
facetName + "-cell-content", null);
+ UIComponent facet = column.getFacet(facetName);
+ if (facet != null && facet.isRendered()) {
+ facet.encodeAll(context);
}
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.TD_ELEM);
}
+ }
- public void encodeHeader(RendererState state) throws IOException {
- FacesContext context = state.getContext();
- ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = state.getRow();
-
- UIComponent header = table.getFacet("header");
- if (header != null && header.isRendered()) {
- String elementId = table.getClientId(context) + ":tfh";
-
- encodeStartUpdate(context, elementId);
-
- writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, elementId, null);
- header.encodeAll(context);
- writer.endElement(HTML.DIV_ELEM);
-
- encodeEndUpdate(context);
- }
-
- encodeHeaderOrFooter(state, "header");
- }
-
- public void encodeBody(RendererState state) throws IOException {
- FacesContext context = state.getContext();
- ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = state.getRow();
+ private void encodeHeaderOrFooter(RendererState state, String name) throws
IOException {
+ FacesContext context = state.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+ UIDataTableBase table = state.getRow();
+ if (table.isColumnFacetPresent(name)) {
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);
- if (table.getRowCount() == 0) {
- UIComponent facet = table.getFacet("noData");
- if (facet != null && facet.isRendered()) {
- facet.encodeAll(context);
- } else {
- Object noDataLabel =
table.getAttributes().get("noDataLabel");
- if (noDataLabel != null) {
- writer.writeText(noDataLabel, "noDataLabel");
- }
- }
- } else {
- table.getAttributes().put("clientFirst", 0);
- writer.startElement(HTML.DIV_ELEM, table);
- writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-spacer", null);
- 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.startElement(HTML.TR_ELEMENT, table);
- for (state.startIterate(); state.hasNextPart();) {
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses("rich-extable-" + name, (String) table
+ .getAttributes().get(name + "Class")), 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);
+ for (state.startIterate(); state.hasNextPart();) {
+ Part part = state.nextPart();
+ PartName partName = part.getName();
+ Iterator<UIComponent> columns = part.getColumns().iterator();
+ if (columns.hasNext()) {
writer.startElement(HTML.TD_ELEM, table);
+ if (PartName.frozen.equals(partName) &&
"footer".equals(name)) {
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-footer-align", null);
+ }
writer.startElement(HTML.DIV_ELEM, table);
- PartName partName = state.nextPart().getName();
- if (PartName.normal.equals(partName)) {
- writer.writeAttribute(HTML.ID_ATTRIBUTE,
table.getClientId(context) + ":body", null);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE,
"rich-extable-part rich-extable-part-width", null);
+ if (PartName.frozen.equals(partName)) {
+ 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);
}
-
- String targetId = table.getClientId(context) + ":tbt" +
partName.name().charAt(0);
-
- encodeStartUpdate(context, targetId);
-
+
+ String tableId = table.getClientId(context) + ":cf" +
name.charAt(0) + partName.name().charAt(0);
+ EncoderVariance encoderVariance = state.getEncoderVariance();
+ encoderVariance.encodeStartUpdate(context, tableId);
+
writer.startElement(HTML.TABLE_ELEMENT, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, targetId, null);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, tableId, null);
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"
- + partName.toString().charAt(0), null);
- encodeRows(state);
+ 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);
-
- encodeEndUpdate(context);
-
+
+ encoderVariance.encodeEndUpdate(context);
+
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);
}
+ writer.endElement(HTML.TR_ELEMENT);
+ writer.endElement(HTML.TBOBY_ELEMENT);
+ writer.endElement(HTML.TABLE_ELEMENT);
writer.endElement(HTML.DIV_ELEM);
}
+ }
- public void encodeFooter(RendererState state) throws IOException {
- FacesContext context = state.getContext();
- ResponseWriter writer = context.getResponseWriter();
- UIDataTableBase table = state.getRow();
-
- encodeHeaderOrFooter(state, "footer");
-
- UIComponent footer = table.getFacet("footer");
- if (footer != null && footer.isRendered()) {
- String elementId = table.getClientId(context) + ":tff";
-
- encodeStartUpdate(context, elementId);
-
- writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.ID_ATTRIBUTE, elementId, null);
- footer.encodeAll(context);
- writer.endElement(HTML.DIV_ELEM);
+ public void encodeHeader(RendererState state) throws IOException {
+ FacesContext context = state.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+ UIDataTableBase table = state.getRow();
- encodeEndUpdate(context);
- }
+ UIComponent header = table.getFacet("header");
+ if (header != null && header.isRendered()) {
+ String elementId = table.getClientId(context) + ":tfh";
+
+ EncoderVariance encoderVariance = state.getEncoderVariance();
+ encoderVariance.encodeStartUpdate(context, elementId);
+
+ writer.startElement(HTML.DIV_ELEM, table);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, elementId, null);
+ header.encodeAll(context);
+ writer.endElement(HTML.DIV_ELEM);
+
+ encoderVariance.encodeEndUpdate(context);
}
-
- public void encodeMetaComponent(RendererState state, String metaComponentId)
throws IOException {
- if (UIExtendedDataTable.HEADER.equals(metaComponentId)) {
- encodeHeader(state);
- } else if (UIExtendedDataTable.FOOTER.equals(metaComponentId)) {
- encodeFooter(state);
- } else if (UIExtendedDataTable.BODY.equals(metaComponentId)) {
- encodeBody(state);
- } else {
- throw new IllegalArgumentException("Unsupported
metaComponentIdentifier: " + metaComponentId);
- }
- }
+
+ encodeHeaderOrFooter(state, "header");
}
- private class PartialTableEncoderStrategy extends BaseTableEncoderStrategy {
- private void switchResponseWriter(FacesContext context, boolean writerState) {
- ResponseWriter writer = context.getResponseWriter();
- if (writer instanceof OnOffResponseWriter) {
- ((OnOffResponseWriter) writer).setSwitchedOn(writerState);
+ public void encodeBody(RendererState state) throws IOException {
+ FacesContext context = state.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+ UIDataTableBase table = state.getRow();
+
+ //TODO nick - add startUpdate(...) for "noData" case
+
+ 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);
+ if (table.getRowCount() == 0) {
+ UIComponent facet = table.getFacet("noData");
+ if (facet != null && facet.isRendered()) {
+ facet.encodeAll(context);
+ } else {
+ Object noDataLabel = table.getAttributes().get("noDataLabel");
+ if (noDataLabel != null) {
+ writer.writeText(noDataLabel, "noDataLabel");
+ }
}
- }
-
- private ResponseWriter install(FacesContext context) {
- ResponseWriter writer = context.getResponseWriter();
-
- assert !(writer instanceof OnOffResponseWriter);
-
- context.setResponseWriter(new OnOffResponseWriter(writer));
-
- return writer;
- }
-
- private void uninstall(FacesContext context, ResponseWriter
initialResponseWriter) {
- ResponseWriter writer = context.getResponseWriter();
+ } else {
+ table.getAttributes().put("clientFirst", 0);
+ writer.startElement(HTML.DIV_ELEM, table);
+ writer.startElement(HTML.DIV_ELEM, table);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-spacer",
null);
+ 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.startElement(HTML.TR_ELEMENT, table);
+ for (state.startIterate(); state.hasNextPart();) {
+ writer.startElement(HTML.TD_ELEM, table);
+ writer.startElement(HTML.DIV_ELEM, table);
+ PartName partName = state.nextPart().getName();
+ if (PartName.normal.equals(partName)) {
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) +
":body", null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-part
rich-extable-part-width", null);
+ }
- assert (writer instanceof OnOffResponseWriter);
-
- context.setResponseWriter(initialResponseWriter);
- }
+ String targetId = table.getClientId(context) + ":tbt" +
partName.name().charAt(0);
- public void encodeHeader(RendererState state) throws IOException {
- FacesContext context = state.getContext();
- ResponseWriter writer = install(context);
- try {
- super.encodeHeader(state);
- } finally {
- uninstall(context, writer);
+ EncoderVariance encoderVariance = state.getEncoderVariance();
+ encoderVariance.encodeStartUpdate(context, targetId);
+
+ writer.startElement(HTML.TABLE_ELEMENT, table);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, targetId, null);
+ 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"
+ + partName.toString().charAt(0), null);
+ encodeRows(state);
+ writer.endElement(HTML.TBOBY_ELEMENT);
+ writer.endElement(HTML.TABLE_ELEMENT);
+
+ encoderVariance.encodeEndUpdate(context);
+
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.TD_ELEM);
}
- };
-
- public void encodeBody(RendererState state) throws IOException {
- FacesContext context = state.getContext();
- ResponseWriter writer = install(context);
- try {
- super.encodeBody(state);
- } finally {
- uninstall(context, writer);
- }
- };
-
- public void encodeFooter(RendererState state) throws IOException {
- FacesContext context = state.getContext();
- ResponseWriter writer = install(context);
- try {
- super.encodeFooter(state);
- } finally {
- uninstall(context, writer);
- }
- };
-
- void encodeStartUpdate(FacesContext context, String targetId) throws IOException
{
- switchResponseWriter(context, true);
-
-
context.getPartialViewContext().getPartialResponseWriter().startUpdate(targetId);
+ writer.endElement(HTML.TR_ELEMENT);
+ writer.endElement(HTML.TBOBY_ELEMENT);
+ writer.endElement(HTML.TABLE_ELEMENT);
+ writer.endElement(HTML.DIV_ELEM);
}
-
- void encodeEndUpdate(FacesContext context) throws IOException {
- context.getPartialViewContext().getPartialResponseWriter().endUpdate();
-
- switchResponseWriter(context, false);
- }
+ writer.endElement(HTML.DIV_ELEM);
}
- private BaseTableEncoderStrategy fullEncodeStrategy = new
BaseTableEncoderStrategy();
+ public void encodeFooter(RendererState state) throws IOException {
+ FacesContext context = state.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+ UIDataTableBase table = state.getRow();
- private BaseTableEncoderStrategy partialEncodeStrategy = new
PartialTableEncoderStrategy();
+ encodeHeaderOrFooter(state, "footer");
+
+ UIComponent footer = table.getFacet("footer");
+ if (footer != null && footer.isRendered()) {
+ String elementId = table.getClientId(context) + ":tff";
+
+ EncoderVariance encoderVariance = state.getEncoderVariance();
+ encoderVariance.encodeStartUpdate(context, elementId);
+
+ writer.startElement(HTML.DIV_ELEM, table);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, elementId, null);
+ footer.encodeAll(context);
+ writer.endElement(HTML.DIV_ELEM);
+
+ encoderVariance.encodeEndUpdate(context);
+ }
+ }
@Override
protected Class<? extends UIComponent> getComponentClass() {
@@ -543,8 +504,28 @@
table.restoreOrigValue(context);
}
} else {
- RendererState state = createRowHolder(context, component);
- partialEncodeStrategy.encodeMetaComponent(state, metaComponentId);
+
+ ResponseWriter initialWriter = context.getResponseWriter();
+ assert !(initialWriter instanceof OnOffResponseWriter);
+
+ try {
+ context.setResponseWriter(new OnOffResponseWriter(initialWriter));
+
+ RendererState state = createRowHolder(context, component);
+ state.setEncoderVariance(EncoderVariance.partial);
+
+ if (UIExtendedDataTable.HEADER.equals(metaComponentId)) {
+ encodeHeader(state);
+ } else if (UIExtendedDataTable.FOOTER.equals(metaComponentId)) {
+ encodeFooter(state);
+ } else if (UIExtendedDataTable.BODY.equals(metaComponentId)) {
+ encodeBody(state);
+ } else {
+ throw new IllegalArgumentException("Unsupported
metaComponentIdentifier: " + metaComponentId);
+ }
+ } finally {
+ context.setResponseWriter(initialWriter);
+ }
}
}
@@ -572,10 +553,10 @@
table.captureOrigValue(context);
table.setRowKey(context, null);
RendererState state = createRowHolder(context, table);
- fullEncodeStrategy.encodeHeader(state);
+ encodeHeader(state);
encodeStyle(state);
- fullEncodeStrategy.encodeBody(state);
- fullEncodeStrategy.encodeFooter(state);
+ encodeBody(state);
+ encodeFooter(state);
table.setRowKey(context, key);
table.restoreOrigValue(context);
}