Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- HTMLTableBuilder can now append to existing SafeHtmlBuilders

  • Loading branch information...
commit e99017b640c2529195b934b9be78997d2f21ed0f 1 parent ab5a213
@alexbiehl alexbiehl authored
View
25 src/main/java/org/fhw/asta/kasse/client/common/HTMLTableBuilder.java
@@ -92,12 +92,7 @@ public static HTMLTableBuilder mk(String tableClassName) {
private final List<RowBuilder> rows = Lists.newArrayList();
public RowBuilder row() {
-
- RowBuilder rb = new RowBuilder();
-
- rows.add(rb);
-
- return rb;
+ return row(null);
}
public RowBuilder row(String className) {
@@ -109,9 +104,11 @@ public RowBuilder row(String className) {
return rb;
}
- public SafeHtml toSafeHtml() {
-
- SafeHtmlBuilder htmlBuilder = new SafeHtmlBuilder();
+ public SafeHtmlBuilder build() {
+ return build(new SafeHtmlBuilder());
+ }
+
+ public SafeHtmlBuilder build(SafeHtmlBuilder htmlBuilder) {
htmlBuilder.appendHtmlConstant("<table "
+ (Strings.isNullOrEmpty(tableClass) ? "" : "class=\""
@@ -123,7 +120,15 @@ public SafeHtml toSafeHtml() {
htmlBuilder.appendHtmlConstant("</table>");
- return htmlBuilder.toSafeHtml();
+ return htmlBuilder;
+ }
+
+ public SafeHtml asSafeHtml() {
+ return build().toSafeHtml();
+ }
+
+ public SafeHtml asSafeHtml(SafeHtmlBuilder safeHtmlBuilder) {
+ return build(safeHtmlBuilder).toSafeHtml();
}
private static class Tuplelize implements
View
4 src/main/java/org/fhw/asta/kasse/client/widget/print/PrintWidget.java
@@ -1,7 +1,5 @@
package org.fhw.asta.kasse.client.widget.print;
-import org.fhw.asta.kasse.client.common.HTMLTableBuilder;
-
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.ui.IsWidget;
@@ -13,6 +11,4 @@
public void addHtml(SafeHtml safeHtml);
- public void addHtml(HTMLTableBuilder htmlTable);
-
}
View
5 src/main/java/org/fhw/asta/kasse/client/widget/print/PrintWidgetImpl.java
@@ -35,11 +35,6 @@ public void addHtml(String html) {
}
@Override
- public void addHtml(HTMLTableBuilder htmlTable) {
- addHtml(htmlTable.toString());
- }
-
- @Override
public void addHtml(SafeHtml safeHtml) {
addHtml(safeHtml.asString());
}
Please sign in to comment.
Something went wrong with that request. Please try again.