]> WPIA git - gigi.git/commitdiff
Correct colspan handling
authorJanis Streib <janis@dogcraft.de>
Fri, 27 Jun 2014 00:26:36 +0000 (02:26 +0200)
committerJanis Streib <janis@dogcraft.de>
Fri, 27 Jun 2014 00:26:36 +0000 (02:26 +0200)
src/org/cacert/gigi/output/DataTable.java

index 3f131a224c05ea3df8fe33014c8842c64cf4031e..771a0c2a82a9f06aace35d0d1820d61a51d491da 100644 (file)
@@ -24,10 +24,12 @@ public class DataTable implements Outputable {
                        }
                }
                out.println("<table align=\"center\" valign=\"middle\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"wrapper\">");
                        }
                }
                out.println("<table align=\"center\" valign=\"middle\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"wrapper\">");
+               int cellsRendered = 0;
                for (int i = 0; i < mesCells / columnCount; i++) {
                        out.println("<tr>");
                        for (int j = 0; j < columnCount;) {
                for (int i = 0; i < mesCells / columnCount; i++) {
                        out.println("<tr>");
                        for (int j = 0; j < columnCount;) {
-                               Cell current = cells.get((i * columnCount) + j);
+                               Cell current = cells.get(cellsRendered);
+                               cellsRendered++;
                                j += current.getColSpan();
                                out.println("<td " + current.getHtmlAttribs() + " >");
                                out.print(current.shouldTranslate() ? l.getTranslation(current
                                j += current.getColSpan();
                                out.println("<td " + current.getHtmlAttribs() + " >");
                                out.print(current.shouldTranslate() ? l.getTranslation(current
@@ -53,6 +55,9 @@ public class DataTable implements Outputable {
                        this.text = text;
                        this.translate = translate;
                        this.htmlAttribs = htmlAttribs;
                        this.text = text;
                        this.translate = translate;
                        this.htmlAttribs = htmlAttribs;
+                       if (colSpan > 1) {
+                               this.htmlAttribs += " colspan=\"" + colSpan + "\"";
+                       }
                        this.colSpan = colSpan;
                }
 
                        this.colSpan = colSpan;
                }