public abstract class HtmlWriter extends HtmlBuilder<HtmlWriter> implements MarkupBuilderWriter
HtmlBuilder
by calling write(Writer).
Example:
html = new HtmlWriter() {
protected void build() {
html().head().end().body();
text("Hello");
done();
}
};
//Now write.
String actual = html.write(writer).getBuffer().toString();
MarkupWriterMarkupBuilder.TagClosingPolicyindentOff, indentOn, indentSameLine| Constructor and Description |
|---|
HtmlWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
build()
Should build the markup and is called by
write(Writer). |
protected HtmlWriter |
getSelf()
Needed for fluent style and Java parameterization limitations.
|
<W extends java.io.Writer> |
write(W writer)
Writes using the given writer.
|
<W extends java.io.Writer> |
write(W writer,
int depth)
Writes using the given writer at the given depth.
|
checkbox, checkbox, escapeMarkup, optiona, abbr, abbr, accept, acceptCharset, accesskey, acronym, action, address, align, alink, alt, applet, archive, area, axis, b, background, base, basefont, bdo, bgcolor, big, blockquote, body, border, br, button, caption, cellpadding, cellspacing, center, charAttr, charoff, charset, checked, cite, cite, classAttr, classid, clear, code, code, codebase, codetype, col, colgroup, color, cols, colspan, compact, content, coords, data, datetime, dd, declare, defer, del, dfn, dir, dir, disabled, div, dl, dt, em, enctype, face, fieldset, font, forAttr, form, frame, frameborder, h1, h2, h3, h4, h5, h6, head, headers, height, hr, href, hreflang, hspace, html, httpEquiv, i, id, iframe, img, input, ins, isindex, ismap, kbd, label, label, lang, language, legend, li, link, link, longdesc, map, marginheight, marginwidth, maxlength, media, menu, meta, method, multiple, name, noframes, nohref, noscript, noshade, nowrap, object, object, ol, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onload, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onreset, onselect, onsubmit, onunload, optgroup, option, p, param, pre, profile, prompt, q, readonly, rel, rev, rows, rowspan, rules, s, samp, scheme, scope, script, scrolling, select, selected, shape, size, small, span, span, src, standby, startAttr, strike, strong, style, style, sub, summary, sup, tabindex, table, target, tbody, td, textarea, textAttr, tfoot, th, thead, title, title, tr, tt, type, u, ul, usemap, valign, value, valuetype, var, vlink, vspace, widthprotected HtmlWriter getSelf()
MarkupBuilderMost implementations only have to do:
return this;
getSelf in class MarkupBuilder<HtmlWriter>this object.public <W extends java.io.Writer> W write(W writer)
MarkupWriterwrite in interface MarkupWriterW - writer type.writer - not null.public <W extends java.io.Writer> W write(W writer,
int depth)
MarkupBuilderWriterwrite in interface MarkupBuilderWriterW - writer type.writer - not null.depth - the indent depth to start at.MarkupBuilder.write(MarkupWriter...)protected abstract void build()
write(Writer).MarkupBuilder