Author: dmorozov
Date: 2008-07-28 12:35:45 -0400 (Mon, 28 Jul 2008)
New Revision: 9809
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
trunk/ui/dataTable/src/main/templates/org/richfaces/datatable/css/table.xcss
Log:
https://jira.jboss.org/jira/browse/RF-3979
https://jira.jboss.org/jira/browse/RF-4002
https://jira.jboss.org/jira/browse/RF-3965
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-07-28
16:34:17 UTC (rev 9808)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-07-28
16:35:45 UTC (rev 9809)
@@ -21,7 +21,6 @@
package org.richfaces.component;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -29,35 +28,27 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.el.ELContext;
import javax.el.ELException;
import javax.el.ValueExpression;
import javax.faces.FacesException;
-import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.Renderer;
-import org.ajax4jsf.component.AjaxChildrenEncoder;
import org.ajax4jsf.component.SequenceDataAdaptor;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.renderkit.AjaxChildrenRenderer;
import org.richfaces.model.AbstractModifiableModel;
import org.richfaces.model.FilterField;
import org.richfaces.model.ModifiableModel;
import org.richfaces.model.SortField2;
-import org.richfaces.renderkit.AbstractTableRenderer;
/**
* JSF component class
*
*/
-public abstract class UIDataTable extends SequenceDataAdaptor implements Sortable2,
Filterable, AjaxChildrenEncoder {
+public abstract class UIDataTable extends SequenceDataAdaptor implements Sortable2,
Filterable {
Collection<Object> sortPriority = new ArrayList<Object>();
@@ -189,30 +180,4 @@
super.restoreState(context, states[0]);
sortPriority = (Collection<Object>)states[1];
}
-
- @Override
- public void encodeAjaxChild(FacesContext context, String path, Set<String> ids,
Set<String> renderedAreas) throws IOException {
-
- boolean encodeChildren = true;
- Renderer renderer = this.getRenderer(context);
- if (renderer instanceof AbstractTableRenderer) {
- AbstractTableRenderer r = (AbstractTableRenderer) renderer;
- if (r.renderBodyOnly(context, this)) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- r.encodeTBodyAjax(context, this);
- ajaxContext.getAjaxRenderedAreas().add(this.getClientId(context) +
":tb");
- encodeChildren = false;
- }
- }
-
- AjaxChildrenRenderer childrenRenderer = getChildrenRenderer();
- if (encodeChildren) {
- childrenRenderer.encodeAjaxChildren(context, this, path, ids,
renderedAreas);
- } else {
- String childsPath = path + getId() + NamingContainer.SEPARATOR_CHAR;
- for (UIComponent component : getFacets().values()) {
- childrenRenderer.encodeAjaxComponent(context, component, childsPath,
ids, renderedAreas);
- }
- }
- }
}
\ No newline at end of file
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-07-28
16:34:17 UTC (rev 9808)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-07-28
16:35:45 UTC (rev 9809)
@@ -26,7 +26,9 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import javax.faces.component.NamingContainer;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
@@ -563,9 +565,46 @@
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
ajaxContext.addRegionsFromComponent(component);
+ ajaxContext.addComponentToAjaxRender(component);
+ ajaxContext.addRegionsFromComponent(component);
+
+ ajaxContext.addRenderedArea(clientId + ":tb");
+
+ // FIXME: check for correct client id.
+ // Now path & client id mixed here, it is possible that
+ // they will be different un case of dataTable in dataTable.
+
+ // Due to we are re render whole data table, Ajax runtime didn't add to reRender
+ // ids of those childs that specified in reRender data table attribute
+ // so let's add them to ajax render areas here by hand
+ Set<String> ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
+ Set<String> areasToRender = ajaxContext.getAjaxAreasToRender();
+ for (String area : areasToRender) {
+ // process only child components, all other should be added to render
+ // automatically by ajax
+ if (area.startsWith(NamingContainer.SEPARATOR_CHAR + clientId)) {
+ area = area.substring(1); // remove unnecessary start separator symbol
+ if (!area.equals(clientId) && !ajaxRenderedAreas.contains(area)) {
+ ajaxContext.addRenderedArea(area);
+ }
+ }
+ }
}
}
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ super.encodeEnd(context, component);
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
+ Set<String> ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
+ String clientId = component.getClientId(context);
+ if(ajaxRenderedAreas.contains(clientId+ ":tb")) {
+ ajaxRenderedAreas.remove(clientId);
+ }
+ }
+
protected void addInplaceInput(FacesContext context, UIComponent column,
String buffer) throws IOException {
UIInput filterValueInput = (UIInput) column
Modified:
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
===================================================================
---
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-07-28
16:34:17 UTC (rev 9808)
+++
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-07-28
16:35:45 UTC (rev 9809)
@@ -26,7 +26,7 @@
<f:verbatim skin="tableBorderWidth" />
<f:verbatim skin="tableBorderColor" />
</u:style>
- <u:style name="padding" value="4px 4px 4px 4px"/>
+ <!-- u:style name="padding" value="4px 4px 4px 4px"/ -->
<u:style name="font-size" skin="generalSizeFont"/>
<!--generalSizeFont-->
<u:style name="color" skin="generalTextColor"/>
<!--generalTextColor-->
<u:style name="font-family" skin="generalFamilyFont"/>
<!--generalFamilyFont-->
Modified: trunk/ui/dataTable/src/main/templates/org/richfaces/datatable/css/table.xcss
===================================================================
---
trunk/ui/dataTable/src/main/templates/org/richfaces/datatable/css/table.xcss 2008-07-28
16:34:17 UTC (rev 9808)
+++
trunk/ui/dataTable/src/main/templates/org/richfaces/datatable/css/table.xcss 2008-07-28
16:35:45 UTC (rev 9809)
@@ -12,7 +12,7 @@
.dr-table-cell{
border-right : 1px solid #c0c0c0; /*panelBorderColor*/
border-bottom : 1px solid #c0c0c0; /*panelBorderColor*/
- padding : 4px 4px 4px 4px;
+ /*padding : 4px 4px 4px 4px;*/
font-size : 11px; /*generalSizeFont*/
color : #000000; /*generalTextColor*/
font-family : verdana; /*generalFamilyFont*/