X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2FDataTable.java;h=47f1fc974c1d4bf769d9d2caca7357f4ee795ff7;hb=593548a6309299e63fa56f54d97b569d9d704150;hp=8c8b06e66d4570f6b88698aa26ee7f54cbf2e2f8;hpb=7ff9efc4b22e9f32a78ed70409064ec887d2fb4d;p=gigi.git diff --git a/src/org/cacert/gigi/output/DataTable.java b/src/org/cacert/gigi/output/DataTable.java index 8c8b06e6..47f1fc97 100644 --- a/src/org/cacert/gigi/output/DataTable.java +++ b/src/org/cacert/gigi/output/DataTable.java @@ -7,26 +7,20 @@ import java.util.Map; import org.cacert.gigi.Language; public abstract class DataTable implements Outputable { - protected abstract String[] getColumns(); + protected abstract int getColoumnCount(); protected abstract LinkedList getTableContent(); @Override public void output(PrintWriter out, Language l, Map vars) { out.println(""); - out.println(""); - for (String column : getColumns()) { - out.print(""); - } - out.println(""); LinkedList tableContnet = getTableContent(); - for (int i = 0; i < tableContnet.size() / getColumns().length; i++) { + for (int i = 0; i < tableContnet.size() / getColoumnCount(); i++) { out.println(""); - for (int j = 0; j < getColumns().length; j++) { - out.println(""); @@ -36,13 +30,28 @@ public abstract class DataTable implements Outputable { out.println("
"); - out.print(l.getTranslation(column)); - out.println("
"); - Cell current = tableContnet.get((i * getColumns().length) + j); + for (int j = 0; j < getColoumnCount(); j++) { + Cell current = tableContnet.get((i * getColoumnCount()) + j); + out.println(""); out.print(current.shouldTranslate() ? l.getTranslation(current .getText()) : current.getText()); out.print("
"); } + /** + * Note: All cells have the html attribute class="DataTD"! + * + * @author janis + * + */ public static class Cell { - private String text; + private String text, htmlAttribs; private boolean translate; - public Cell(String text, boolean translate) { + public Cell() { + this(" ", false); + } + + public Cell(String text, boolean translate, String htmlAttribs) { this.text = text; this.translate = translate; + this.htmlAttribs = htmlAttribs; + } + + public Cell(String text, boolean translate) { + this(text, translate, ""); } public boolean shouldTranslate() { @@ -53,12 +62,8 @@ public abstract class DataTable implements Outputable { return text; } - } - - public static class EmptyCell extends Cell { - - public EmptyCell() { - super(" ", false); + public String getHtmlAttribs() { + return htmlAttribs; } }