--- component/src/com/icesoft/faces/component/dataexporter/DataExporter.java.orig	2009-05-19 18:13:08.000000000 +0200
+++ component/src/com/icesoft/faces/component/dataexporter/DataExporter.java	2009-07-24 15:51:29.066776700 +0200
@@ -15,9 +15,13 @@
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer;
 import com.icesoft.faces.application.D2DViewHandler;
 import com.icesoft.faces.component.DisplayEvent;
+import com.icesoft.faces.component.ext.RowSelector;
 import com.icesoft.faces.component.ext.UIColumn;
 import com.icesoft.faces.component.outputresource.OutputResource;
 import com.icesoft.faces.context.FileResource;
@@ -29,6 +33,8 @@
 	public static final String COMPONENT_TYPE = "com.icesoft.faces.DataExporter";
 	public static final String DEFAULT_RENDERER_TYPE = "com.icesoft.faces.DataExporterRenderer";
 	
+    static final Log LOG = LogFactory.getLog(DataExporter.class);
+
 	private boolean readyToExport = false;
 
 	private String _for;
@@ -279,31 +285,31 @@
             setMimeType(outputHandler.getMimeType());
 
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.error("createFile(" + type + ")", e);
         }
         return outputHandler != null ? outputHandler.getFile() : null;
 
     }
 
-    private String encodeParentAndChildrenAsString(FacesContext fc,
-            UIComponent uic, String str) {
+    private String encodeParentAndChildrenAsString(FacesContext fc, UIComponent uic) {
+        StringBuilder str = new StringBuilder();
         Object value = uic.getAttributes().get("value");
         if (value != null)
-            str += "" + value;
+            str.append(value);
         else {
             ValueBinding vb = uic.getValueBinding("value");
             if (vb != null)
-                str += String.valueOf(vb.getValue(fc));
+                str.append(vb.getValue(fc));
         }
 
         if (uic.getChildCount() > 0) {
             Iterator iter = uic.getChildren().iterator();
             while (iter.hasNext()) {
                 UIComponent child = (UIComponent) iter.next();
-                str += encodeParentAndChildrenAsString(fc, child, str);
+                str.append(encodeParentAndChildrenAsString(fc, child));
             }
         }
-        return str;
+        return str.toString();
     }
 
     protected List getRenderedChildColumnsList(UIComponent component) {
@@ -336,13 +342,9 @@
 
                 UIComponent headerComp = nextColumn.getFacet("header");
                 if (headerComp != null) {
-                    String headerText = "";
-                    headerText = encodeParentAndChildrenAsString(fc,
-                            headerComp, headerText);
-                    if (headerText != null) {
+                    String headerText = encodeParentAndChildrenAsString(fc, headerComp);
                         outputHandler.writeHeaderCell(headerText, colIndex);
                     }
-                }
                 colIndex++;
             }
 
@@ -358,23 +360,20 @@
                 while (childColumns.hasNext()) {
                     UIColumn nextColumn = (UIColumn) childColumns.next();
 
-                    Object output = null;
-                    String stringOutput = "";
+                    StringBuilder stringOutput = new StringBuilder();
 
-                    Iterator childrenOfThisColumn = nextColumn.getChildren()
-                            .iterator();
+                    Iterator childrenOfThisColumn = nextColumn.getChildren().iterator();
                     while (childrenOfThisColumn.hasNext()) {
-
-                        UIComponent nextChild = (UIComponent) childrenOfThisColumn
-                                .next();
-                        if (nextChild.isRendered()) {
-                            stringOutput += encodeParentAndChildrenAsString(fc,
-                                    nextChild, stringOutput);
+                        UIComponent nextChild = (UIComponent) childrenOfThisColumn.next();
+                        if (nextChild.isRendered() &&
+                            !(nextChild instanceof RowSelector)) { // FIXME probably more to exclude
+                            stringOutput.append(
+                                encodeParentAndChildrenAsString(fc, nextChild));
+                            if (childrenOfThisColumn.hasNext())
+                                stringOutput.append(' '); // at least a blank to separate
                         }
-
                     }
-                    output = stringOutput;
-                    outputHandler.writeCell(output, colIndex, rowIndex);
+                    outputHandler.writeCell(stringOutput.toString(), colIndex, rowIndex);
                     colIndex++;
                 }
                 // keep track of rows displayed
@@ -390,7 +389,7 @@
 
             outputHandler.flushFile();
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.error("renderToHandler()", e);
         }
 
     }
