X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2FDataTable.java;h=e17714c8ab02569edda2d31af6fc1e2f729554c7;hb=7f4a02fc53f56a5507d1d059c5c0636ed977ae62;hp=3f131a224c05ea3df8fe33014c8842c64cf4031e;hpb=ef1a8a72160bd31940a269e5fe75e4fcf0ff8017;p=gigi.git diff --git a/src/org/cacert/gigi/output/DataTable.java b/src/org/cacert/gigi/output/DataTable.java index 3f131a22..e17714c8 100644 --- a/src/org/cacert/gigi/output/DataTable.java +++ b/src/org/cacert/gigi/output/DataTable.java @@ -15,19 +15,19 @@ public class DataTable implements Outputable { this.cells = content; } - @Override - public void output(PrintWriter out, Language l, Map vars) { - int mesCells = cells.size(); + public void output(PrintWriter out, Language l) { + float mesCells = cells.size(); for (Cell c : cells) { if (c.getColSpan() > 1) { mesCells += c.getColSpan(); } } out.println(""); - for (int i = 0; i < mesCells / columnCount; i++) { + int cellsRendered = 0; + for (int i = 0; i < Math.ceil(mesCells / columnCount) - 1; i++) { out.println(""); for (int j = 0; j < columnCount;) { - Cell current = cells.get((i * columnCount) + j); + Cell current = cells.get(cellsRendered++); j += current.getColSpan(); out.println("
"); out.print(current.shouldTranslate() ? l.getTranslation(current @@ -53,6 +53,9 @@ public class DataTable implements Outputable { this.text = text; this.translate = translate; this.htmlAttribs = htmlAttribs; + if (colSpan > 1) { + this.htmlAttribs += " colspan=\"" + colSpan + "\""; + } this.colSpan = colSpan; } @@ -82,4 +85,9 @@ public class DataTable implements Outputable { } + @Override + public void output(PrintWriter out, Language l, Map vars) { + output(out, l); + } + }