]> WPIA git - gigi.git/commitdiff
Updated impl.
authorJanis Streib <janis@dogcraft.de>
Thu, 26 Jun 2014 23:47:32 +0000 (01:47 +0200)
committerJanis Streib <janis@dogcraft.de>
Thu, 26 Jun 2014 23:47:32 +0000 (01:47 +0200)
src/org/cacert/gigi/output/CertificateTable.java
src/org/cacert/gigi/output/DataTable.java

index 5cd6e0747b0e3d6d96d24f318a40a2695e93632e..a3aa4b63993f4bdaf99b5925460a1aa5fba88ca5 100644 (file)
@@ -21,6 +21,14 @@ public class CertificateTable implements Outputable {
                try {
                        out.println("<form method=\"post\" action=\"account.php\">");
                        final LinkedList<Cell> cells = new LinkedList<>();
+                       cells.add(new Cell("Renew/Revoke/Delete", true));
+                       cells.add(new Cell("Status", true));
+                       cells.add(new Cell("Email Address", true));
+                       cells.add(new Cell("SerialNumber", true));
+                       cells.add(new Cell("Revoked", true));
+                       cells.add(new Cell("Expires", true));
+                       cells.add(new Cell("Login", true));
+                       cells.add(new Cell("Comment *", true, "colspan=\"2\""));
                        rs.beforeFirst();
                        while (rs.next()) {
                                // out.println(rs.getString("id"));
@@ -45,14 +53,8 @@ public class CertificateTable implements Outputable {
                                }
 
                                @Override
-                               protected Cell[] getColumns() {
-                                       return new Cell[] { new Cell("Renew/Revoke/Delete", true),
-                                                       new Cell("Status", true),
-                                                       new Cell("Email Address", true),
-                                                       new Cell("SerialNumber", true),
-                                                       new Cell("Revoked", true),
-                                                       new Cell("Expires", true), new Cell("Login", true),
-                                                       new Cell("Comment *", true, "colspan=\"2\"") };
+                               protected int getColoumnCount() {
+                                       return 8;
                                }
                        };
                        t.output(out, l, vars);
index c9ba47b89082eda87f9606b5e9dd8652f9704b13..47f1fc974c1d4bf769d9d2caca7357f4ee795ff7 100644 (file)
@@ -7,26 +7,18 @@ import java.util.Map;
 import org.cacert.gigi.Language;
 
 public abstract class DataTable implements Outputable {
-       protected abstract Cell[] getColumns();
+       protected abstract int getColoumnCount();
 
        protected abstract LinkedList<Cell> getTableContent();
 
        @Override
        public void output(PrintWriter out, Language l, Map<String, Object> vars) {
                out.println("<table align=\"center\" valign=\"middle\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"wrapper\">");
-               out.println("<tr>");
-               for (Cell column : getColumns()) {
-                       out.print("<td " + column.getHtmlAttribs() + " class=\"DataTD\">");
-                       out.print(column.shouldTranslate() ? l.getTranslation(column
-                                       .getText()) : column.getText());
-                       out.println("</td>");
-               }
-               out.println("</tr>");
                LinkedList<Cell> tableContnet = getTableContent();
-               for (int i = 0; i < tableContnet.size() / getColumns().length; i++) {
+               for (int i = 0; i < tableContnet.size() / getColoumnCount(); i++) {
                        out.println("<tr>");
-                       for (int j = 0; j < getColumns().length; j++) {
-                               Cell current = tableContnet.get((i * getColumns().length) + j);
+                       for (int j = 0; j < getColoumnCount(); j++) {
+                               Cell current = tableContnet.get((i * getColoumnCount()) + j);
                                out.println("<td " + current.getHtmlAttribs()
                                                + " class=\"DataTD\">");
                                out.print(current.shouldTranslate() ? l.getTranslation(current