@Test public void testWriteTag() throws IOException { assertThat(of().write(DIV).writer.toString()).isEqualTo("<div/>"); assertThat(of().write(DIV, "content").writer.toString()).isEqualTo("<div>content</div>"); assertThat(of().write(DIV, "content", NO_CLASS).writer.toString()).isEqualTo("<div>content</div>"); assertThat(of().write(DIV, "content", HELLO_CLASS).writer.toString()).isEqualTo("<div class=\"hello\">content</div>"); }
private void writeTag(HtmlTag tag) throws IOException { writer.append(tag.tag); }
HtmlStream implements Closeable { private void writeTag(HtmlTag tag) throws IOException { writer.append(tag.tag); } }
HtmlStream implements Closeable { private void writeTag(HtmlTag tag) throws IOException { writer.append(tag.tag); } HtmlStream(Writer writer); }
HtmlStream implements Closeable { private void writeTag(HtmlTag tag) throws IOException { writer.append(tag.tag); } HtmlStream(Writer writer); void open(); @Override void close(); HtmlStream newLine(); HtmlStream newLines(int n); HtmlStream open(HtmlTag tag); HtmlStream open(HtmlTag tag, HtmlClass classNames); HtmlStream close(HtmlTag tag); HtmlStream write(HtmlTag tag); HtmlStream write(HtmlTag tag, String text); HtmlStream write(HtmlTag tag, String text, HtmlClass classNames); HtmlStream write(String text, HtmlClass classNames); HtmlStream write(char c); HtmlStream write(double d); HtmlStream write(int i); HtmlStream write(String txt); HtmlStream open(HtmlTable table); HtmlStream write(HtmlTableCell cell); HtmlStream write(HtmlTableHeader header); HtmlStream write(IHtmlElement obj); @Deprecated HtmlStream write(String text, HtmlStyle... styles); @Deprecated HtmlStream open(HtmlTag tag, String attrName, String attrValue); @Deprecated HtmlStream open(HtmlTag tag, CssStyle style); @Deprecated HtmlStream open(HtmlTag tag, CssStyle style, String attrName, String attrValue); @Deprecated HtmlStream open(HtmlTag tag, Map<String, String> attributes); @Deprecated HtmlStream write(HtmlTag tag, CssStyle style, String text); @Deprecated HtmlStream write(HtmlTableCell cell, String cellBg); }
HtmlStream implements Closeable { private void writeTag(HtmlTag tag) throws IOException { writer.append(tag.tag); } HtmlStream(Writer writer); void open(); @Override void close(); HtmlStream newLine(); HtmlStream newLines(int n); HtmlStream open(HtmlTag tag); HtmlStream open(HtmlTag tag, HtmlClass classNames); HtmlStream close(HtmlTag tag); HtmlStream write(HtmlTag tag); HtmlStream write(HtmlTag tag, String text); HtmlStream write(HtmlTag tag, String text, HtmlClass classNames); HtmlStream write(String text, HtmlClass classNames); HtmlStream write(char c); HtmlStream write(double d); HtmlStream write(int i); HtmlStream write(String txt); HtmlStream open(HtmlTable table); HtmlStream write(HtmlTableCell cell); HtmlStream write(HtmlTableHeader header); HtmlStream write(IHtmlElement obj); @Deprecated HtmlStream write(String text, HtmlStyle... styles); @Deprecated HtmlStream open(HtmlTag tag, String attrName, String attrValue); @Deprecated HtmlStream open(HtmlTag tag, CssStyle style); @Deprecated HtmlStream open(HtmlTag tag, CssStyle style, String attrName, String attrValue); @Deprecated HtmlStream open(HtmlTag tag, Map<String, String> attributes); @Deprecated HtmlStream write(HtmlTag tag, CssStyle style, String text); @Deprecated HtmlStream write(HtmlTableCell cell, String cellBg); final Writer writer; }