X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2FDataTable.java;h=c9ba47b89082eda87f9606b5e9dd8652f9704b13;hp=8c8b06e66d4570f6b88698aa26ee7f54cbf2e2f8;hb=89fed14fafeb0af07b09c183bf934e1234d21e48;hpb=7ff9efc4b22e9f32a78ed70409064ec887d2fb4d diff --git a/src/org/cacert/gigi/output/DataTable.java b/src/org/cacert/gigi/output/DataTable.java index 8c8b06e6..c9ba47b8 100644 --- a/src/org/cacert/gigi/output/DataTable.java +++ b/src/org/cacert/gigi/output/DataTable.java @@ -7,7 +7,7 @@ import java.util.Map; import org.cacert.gigi.Language; public abstract class DataTable implements Outputable { - protected abstract String[] getColumns(); + protected abstract Cell[] getColumns(); protected abstract LinkedList getTableContent(); @@ -15,9 +15,10 @@ public abstract class DataTable implements Outputable { public void output(PrintWriter out, Language l, Map vars) { out.println(""); out.println(""); - for (String column : getColumns()) { - out.print(""); } out.println(""); @@ -25,8 +26,9 @@ public abstract class DataTable implements Outputable { for (int i = 0; i < tableContnet.size() / getColumns().length; i++) { out.println(""); for (int j = 0; j < getColumns().length; j++) { - out.println(""); @@ -36,13 +38,28 @@ public abstract class DataTable implements Outputable { out.println("
"); - out.print(l.getTranslation(column)); + for (Cell column : getColumns()) { + out.print(""); + out.print(column.shouldTranslate() ? l.getTranslation(column + .getText()) : column.getText()); out.println("
"); Cell current = tableContnet.get((i * getColumns().length) + 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 +70,8 @@ public abstract class DataTable implements Outputable { return text; } - } - - public static class EmptyCell extends Cell { - - public EmptyCell() { - super(" ", false); + public String getHtmlAttribs() { + return htmlAttribs; } }