htmlWriter.writeCall(null, "f_setAutoFilters").write(
htmlWriter.writeMethodCall("f_setAutoFilters").write(
    private void encodeJsColumns(IJavaScriptWriter htmlWriter,            TableRenderContext tableContext) throws WriterException {        FacesContext facesContext = htmlWriter.getFacesContext();        int columnsStateCount = tableContext.getColumnStateCount();        DataGridComponent dataGridComponent = tableContext                .getDataGridComponent();        htmlWriter.writeCall(null, "f_setColumns");        boolean first = true;        for (int i = 0; i < columnsStateCount; i++) {            if (first) {                first = false;            } else {                htmlWriter.write(',');            }            String columnId = tableContext.getColumnId(i);            if (columnId != null) {                htmlWriter.writeString(columnId).write(',');            }            int rowState = tableContext.getColumnState(i);            if (rowState == TableRenderContext.SERVER_HIDDEN) {                htmlWriter.writeNull();                continue;            }            if (rowState == TableRenderContext.CLIENT_HIDDEN) {                htmlWriter.writeBoolean(false);                continue;            }            htmlWriter.writeBoolean(true);        }        htmlWriter.writeln(");");        IDataColumnIterator it = dataGridComponent.listColumns();        String urls[] = null;        String clazz[] = null;        int cnt = it.count();        StringAppender autoFilter = null;        DataColumnComponent rowValueColumn = tableContext.getRowValueColumn();        for (int i = 0; it.hasNext(); i++) {            DataColumnComponent dataColumnComponent = it.next();            String url = dataColumnComponent                    .getDefaultCellImageURL(facesContext);            if (url != null && url.length() > 0) {                if (urls == null) {                    urls = new String[cnt];                }                urls[i] = htmlWriter.allocateString(url);            }            String claz = dataColumnComponent.getStyleClass(facesContext);            if (claz != null && claz.length() > 0) {                if (clazz == null) {                    clazz = new String[cnt];                }                clazz[i] = claz;            }            if (rowValueColumn == dataColumnComponent) {                htmlWriter.writeCall(null, "f_setRowValueColumn").write(                        String.valueOf(i)).writeln(");");            }            if (dataColumnComponent.isAutoFilter(facesContext)) {                if (autoFilter == null) {                    autoFilter = new StringAppender(128);                } else {                    autoFilter.append(", ");                }                autoFilter.append(String.valueOf(i));            }        }        if (autoFilter != null) {            htmlWriter.writeCall(null, "f_setAutoFilters").write(                    autoFilter.toString()).writeln(");");        }        if (urls != null || tableContext.hasColumnImages()) {            htmlWriter.writeCall(null, "f_setColumnsImages");            int pred = 0;            first = true;            for (int i = 0; i < cnt; i++) {                if (tableContext.getColumnState(i) != TableRenderContext.VISIBLE) {                    continue;                }                String url = null;                // URL des images par defaut !                if (urls != null) {                    url = urls[i];                }                boolean cellImage = tableContext.isColumnImageURL(i);                // cellImage=false: une image par d�faut est peut etre                // positionn�e !                if (url == null && cellImage == false) {                    pred++;                    continue;                }                if (pred > 0) {                    // Si il y avait des pred avant, ce sont forcement des                    // colonnes qui n'ont pas d'image/cellule                    if (first) {                        pred--;                        htmlWriter.writeBoolean(false).write(',').writeNull();                        first = false;                    }                    for (; pred > 0; pred--) {                        htmlWriter.write(',').writeBoolean(false).write(',')                                .writeNull();                    }                }                if (first) {                    first = false;                } else {                    htmlWriter.write(',');                }                htmlWriter.writeBoolean(cellImage).write(',');                if (url != null) {                    htmlWriter.write(url);                } else {                    htmlWriter.writeNull();                }            }            htmlWriter.writeln(");");        }        if (clazz != null) {            List sc = new ArrayList(cnt);            int total = 0;            for (int i = 0; i < cnt; i++) {                if (tableContext.getColumnState(i) != TableRenderContext.VISIBLE) {                    continue;                }                String claz = clazz[i];                if (claz == null) {                    sc.add(null);                    continue;                }                if (claz.indexOf(',') >= 0 || claz.indexOf(';') >= 0                        || claz.indexOf(' ') >= 0) {                    StringTokenizer st = new StringTokenizer(claz, ",; ");                    if (st.countTokens() > 1) {                        String claz1 = st.nextToken();                        claz1 = htmlWriter.allocateString(claz1);                        String claz2 = st.nextToken();                        claz2 = htmlWriter.allocateString(claz2);                        sc.add(claz1);                        sc.add(claz2);                        total += 2;                        continue;                    }                    claz = st.nextToken();                }                claz = htmlWriter.allocateString(claz);                sc.add(claz);                sc.add(Boolean.FALSE);                total++;            }            if (total > 0) {                htmlWriter.writeCall(null, "f_setColumnsStyleClass");                int pred = 0;                first = true;                for (Iterator it2 = sc.iterator(); it2.hasNext();) {                    Object tok = it2.next();                    if (tok == null) {                        pred++;                        continue;                    }                    for (; pred > 0; pred--) {                        if (first == false) {                            htmlWriter.write(',');                        } else {                            first = false;                        }                        htmlWriter.writeNull();                    }                    if (first == false) {                        htmlWriter.write(',');                    } else {                        first = false;                    }                    if (tok == Boolean.FALSE) {                        htmlWriter.writeBoolean(false);                        continue;                    }                    htmlWriter.write((String) tok);                }                htmlWriter.writeln(");");            }        }        if (tableContext.hasCellStyleClass()) {            htmlWriter.writeCall(null, "f_setColumnsCellStyle");            writeBooleanArray(htmlWriter, tableContext, cnt, CELL_STYLE_CLASS);            htmlWriter.writeln(");");        }        if (tableContext.sortClientSide != null) {            int pred = 0;            htmlWriter.writeCall(null, "f_setColumnSorters");            // int cnt = tableContext.getColumnCount();            first = true;            for (int i = 0; i < cnt; i++) {                Object sort = tableContext.sortCommand[i];                if (tableContext.getColumnState(i) != TableRenderContext.VISIBLE) {                    continue;                }                if (sort == null) {                    pred++;                    continue;                }                if (sort instanceof String) {                    String aliasCommand = (String) sort;                    if (tableContext.sortClientSide[i] == false) {                        aliasCommand = (String) SORT_ALIASES                                .get(ISortEventCapability.SORT_SERVER);                    }                    for (; pred > 0; pred--) {                        if (first == false) {                            htmlWriter.write(',');                        } else {                            first = false;                        }                        htmlWriter.writeNull();                    }                    if (first == false) {                        htmlWriter.write(',');                    } else {                        first = false;                    }                    htmlWriter.writeSymbol(aliasCommand); // .write('\"');                    continue;                }                if (sort instanceof IScriptListener) {                    IScriptListener scriptListener = (IScriptListener) sort;                    for (; pred > 0; pred--) {                        if (first == false) {                            htmlWriter.write(',');                        } else {                            first = false;                        }                        htmlWriter.writeNull();                    }                    if (first == false) {                        htmlWriter.write(',');                    } else {                        first = false;                    }                    EventsRenderer.encodeJavaScriptCommmand(htmlWriter,                            scriptListener);                    // On envoie que le premier valide !                    continue;                }                if (sort instanceof IServerActionListener) {                    // Le tri se fait cot� serveur !                    for (; pred > 0; pred--) {                        if (first == false) {                            htmlWriter.write(',');                        } else {                            first = false;                        }                        htmlWriter.writeNull();                    }                    String aliasCommand = (String) SORT_ALIASES                            .get(ISortEventCapability.SORT_SERVER);                    if (first == false) {                        htmlWriter.write(',');                    } else {                        first = false;                    }                    htmlWriter.writeString(aliasCommand);                    continue;                }                // Ben y a pas de listener SCRIPT !                pred++;            }            htmlWriter.writeln(");");            ISortedComponent sortedComponents[] = tableContext                    .listSortedComponents();            if (sortedComponents.length > 0) {                htmlWriter.writeCall(null, "f_enableSorters");                pred = 0;                for (int j = 0; j < sortedComponents.length; j++) {                    ISortedComponent sortedComponent = sortedComponents[j];                    if (j > 0) {                        for (; pred > 0; pred--) {                            htmlWriter.write(',').writeNull();                        }                        htmlWriter.write(',');                    }                    htmlWriter.writeInt(sortedComponent.getIndex());                    if (sortedComponent.isAscending()) {                        htmlWriter.write(',').writeBoolean(true);                    } else {                        pred++;                    }                }                htmlWriter.writeln(");");            }        }    }