device.print("<button name=\"");
writeButtonStart(component, device, component.getSelectionParameter(row, false)); device.print(" type=\"submit\" name=\"");
    private void writeTreeNode(STree component, Device device, int row, int depth)            throws IOException {        boolean childSelectorWorkaround = !component.getSession().getUserAgent().supportsCssChildSelector();        final TreePath path = component.getPathForRow(row);        final Object node = path.getLastPathComponent();        final STreeCellRenderer cellRenderer = component.getCellRenderer();        final boolean isLeaf = component.getModel().isLeaf(node);        final boolean isExpanded = component.isExpanded(path);        final boolean isSelected = component.isPathSelected(path);        final boolean isSelectable = (component.getSelectionModel() != SDefaultTreeSelectionModel.NO_SELECTION_MODEL);        SComponent cellComp = cellRenderer.getTreeCellRendererComponent(component, node,                isSelected,                isExpanded,                isLeaf, row,                false);        /*         * now, write the component.         */        device.print("<li");        if (isSelected) {            device.print(" selected=\"true\"");            if (childSelectorWorkaround)                Utils.childSelectorWorkaround(device, "selected");        }        device.print(">");        /*        * in most applications, the is no need to render a control icon for a        * leaf. So in that case, we can avoid writing the sourrounding         * table, that will speed up things in browsers.        */        final boolean renderControlIcon = !(isLeaf && leafControlIcon == null);        if (renderControlIcon) {            /*             * This table has to be here so that block level elements can be             * nodes. I just can't think around it. So it won...             */            device.print("<table border=\"0\"><tr><td>");            if (isLeaf) {                writeIcon(device, leafControlIcon, false);            } else {                if (component.getShowAsFormComponent()) {                    device.print("<button name=\"");                    Utils.write(device, Utils.event(component));                    device.print("\" value=\"");                    Utils.write(device, component.getExpansionParameter(row, false));                    device.print("\"");                } else {                    RequestURL selectionAddr = component.getRequestURL();                    selectionAddr.addParameter(Utils.event(component),                            component.getExpansionParameter(row, false));                    device.print("<a href=\"");                    Utils.write(device, selectionAddr.toString());                    device.print("\"");                }                device.print(">");                if (isExpanded) {                    if (collapseControlIcon == null) {                        device.print("-");                    } else {                        writeIcon(device, collapseControlIcon, true);                    }                } else {                    if (expandControlIcon == null) {                        device.print("+");                    } else {                        writeIcon(device, expandControlIcon, true);                    }                }                if (component.getShowAsFormComponent())                    device.print("</button>");                else                    device.print("</a>");            }            /*             * closing layout td             */            device.print("</td><td>");        }        SCellRendererPane rendererPane = component.getCellRendererPane();        if (isSelectable) {            if (component.getShowAsFormComponent()) {                device.print("<button name=\"");                Utils.write(device, Utils.event(component));                device.print("\" value=\"");                Utils.write(device, component.getSelectionParameter(row, false));                device.print("\"");            } else {                RequestURL selectionAddr = component.getRequestURL();                selectionAddr.addParameter(Utils.event(component),                        component.getSelectionParameter(row, false));                device.print("<a href=\"");                Utils.write(device, selectionAddr.toString());                device.print("\"");            }            Utils.optAttribute(device, "tabindex", component.getFocusTraversalIndex());            Utils.writeEvents(device, component);            device.print(">");            rendererPane.writeComponent(device, cellComp, component);            if (component.getShowAsFormComponent())                device.print("</button>");            else                device.print("</a>");        } else {            rendererPane.writeComponent(device, cellComp, component);        }                if (renderControlIcon) {            /*             * we have to close the table             */            device.print("</td></tr></table>\n");        }                //handle the depth level of the tree        int nextPathCount = 1;        int pathCount = path.getPathCount();        TreePath nextPath = component.getPathForRow(row + 1);        // is there a next element? else use initialized level.        if (nextPath != null) {            nextPathCount = nextPath.getPathCount();        }        if ( pathCount < nextPathCount ) {            indentOnce(device, component, path);        } else if ( pathCount > nextPathCount ) {            device.print("</li>\n");            for (int i = nextPathCount; i < pathCount; i++) {                device.print("</ul></div></li>\n");            }        } else if ( path.getPathCount() == nextPathCount ) {            device.print("</li>");        }    }