📄 htmlbuilder.java
字号:
if (StringUtils.isNotBlank(height)) {
write(" height=\"").write(height).write("\" ");
}
return this;
}
/**
* <p>The align attribute [align=].</p>
*/
public HtmlBuilder align(String align) {
if (StringUtils.isNotBlank(align)) {
write(" align=\"").write(align).write("\" ");
}
return this;
}
/**
* <p>The valign attribute [valign=].</p>
*/
public HtmlBuilder valign(String valign) {
if (StringUtils.isNotBlank(valign)) {
write(" valign=\"").write(valign).write("\" ");
}
return this;
}
/**
* <p>The border attribute [border=].</p>
*/
public HtmlBuilder border(String border) {
if (StringUtils.isNotBlank(border)) {
write(" border=\"").write(border).write("\" ");
}
return this;
}
/**
* <p>The cellpadding attribute [cellpadding=].</p>
*/
public HtmlBuilder cellPadding(String cellPadding) {
if (StringUtils.isNotBlank(cellPadding)) {
write(" cellpadding=\"").write(cellPadding).write("\" ");
}
return this;
}
/**
* <p>The cellspacing attribute [cellspacing=].</p>
*/
public HtmlBuilder cellSpacing(String cellSpacing) {
if (StringUtils.isNotBlank(cellSpacing)) {
write(" cellspacing=\"").write(cellSpacing).write("\" ");
}
return this;
}
/**
* <p>The colspan attribute [colspan=].</p>
*/
public HtmlBuilder colSpan(String colspan) {
if (StringUtils.isNotBlank(colspan)) {
write(" colspan=\"").write(colspan).write("\" ");
}
return this;
}
/**
* <p>The rowspan attribute [rowspan=].</p>
*/
public HtmlBuilder rowSpan(String rowspan) {
if (StringUtils.isNotBlank(rowspan)) {
write(" rowspan=\"").write(rowspan).write("\" ");
}
return this;
}
/**
* <p>The size attribute [size=].</p>
*/
public HtmlBuilder size(String size) {
if (StringUtils.isNotBlank(size)) {
write(" size=\"").write(size).write("\" ");
}
return this;
}
/**
* <p>The start of the span element [<span].</p>
*/
public HtmlBuilder span() {
write("<span");
return this;
}
/**
* <p>The close tag of the span element [</span>].</p>
*/
public HtmlBuilder spanEnd() {
write("</span>");
return this;
}
/**
* <p>The start of the div element [<div].</p>
*/
public HtmlBuilder div() {
write("<div");
return this;
}
/**
* <p>The close tag of the div element [</div>].</p>
*/
public HtmlBuilder divEnd() {
write("</div>");
return this;
}
/**
* <p>A URL parameter name/value [name=value]</p>
*/
public HtmlBuilder param(String name, String value) {
append(name);
equals();
append(value);
return this;
}
/**
* <p>The start of the a element plus the href attribute [<a href=].</p>
*/
public HtmlBuilder a(String href) {
append("<a href=");
quote();
append(href);
quote();
return this;
}
/**
* <p>The start of the a element plus the href attribute [<a href=].</p>
*/
public HtmlBuilder a() {
write("<a href=");
return this;
}
/**
* <p>The close tag of the a element [</div>].</p>
*/
public HtmlBuilder aEnd() {
write("</a>");
return this;
}
/**
* <p>The bold element [<b>].</p>
*/
public HtmlBuilder bold() {
write("<b>");
return this;
}
/**
* <p>The close tag of the bold element [</b>].</p>
*/
public HtmlBuilder boldEnd() {
write("</b>");
return this;
}
/**
* <p>A single quote ["].</p>
*/
public HtmlBuilder quote() {
write("\"");
return this;
}
/**
* <p>A single question mark [?].</p>
*/
public HtmlBuilder question() {
write("?");
return this;
}
/**
* <p>A single equals [=].</p>
*/
public HtmlBuilder equals() {
write("=");
return this;
}
/**
* <p>A single ampersand [&].</p>
*/
public HtmlBuilder ampersand() {
write("&");
return this;
}
/**
* <p>The start of the img element [<img].</p>
*/
public HtmlBuilder img() {
write("<img");
return this;
}
/**
* <p>The src attribute [src=].</p>
*/
public HtmlBuilder src(String src) {
if (StringUtils.isNotBlank(src)) {
write(" src=\"").write(src).write("\" ");
}
return this;
}
/**
* <p>The alt attribute [alt=].</p>
*/
public HtmlBuilder alt(String alt) {
if (StringUtils.isNotBlank(alt)) {
write(" alt=\"").write(alt).write("\" ");
}
return this;
}
/**
* <p>The start of the src element plus the src attribute [<img src= style=border:0/>].</p>
*/
public HtmlBuilder img(String src) {
write("<img src=\"").write(src).write("\" style=\"border:0\"/> ");
return this;
}
/**
* <p>The start of the src element plus the src attribute [<img src="" tooltip="" style="border:0">].</p>
*/
public HtmlBuilder img(String img, String tooltip) {
write("<img src=\"").write(img).write("\" style=\"border:0\"");
if (tooltip != null) {
write(" title=\"").write(tooltip).write("\">");
}
return this;
}
/**
* <p>The start of the textarea element [<textarea].</p>
*/
public HtmlBuilder textarea() {
write("<textarea");
return this;
}
/**
* <p>The close tag of the textarea element [</textarea>].</p>
*/
public HtmlBuilder textareaEnd() {
write("</textarea>");
return this;
}
/**
* <p>The cols attribute [cols=].</p>
*/
public HtmlBuilder cols(String cols) {
if (StringUtils.isNotBlank(cols)) {
write(" cols=\"").write(cols).write("\" ");
}
return this;
}
/**
* <p>The rows attribute [rows=].</p>
*/
public HtmlBuilder rows(String rows) {
if (StringUtils.isNotBlank(rows)) {
write(" rows=\"").write(rows).write("\" ");
}
return this;
}
/**
* <p>The checked attribute [checked="checked"].</p>
*/
public HtmlBuilder checked() {
write(" checked=\"checked\"");
return this;
}
/**
* <p>The selected attribute [selected="selected"].</p>
*/
public HtmlBuilder selected() {
write(" selected=\"selected\"");
return this;
}
/**
* <p>The readonly attribute [readonly="readonly"].</p>
*/
public HtmlBuilder readonly() {
write(" readonly=\"readonly\"");
return this;
}
/**
* <p>The non-breaking space [ ].</p>
*/
public HtmlBuilder nbsp() {
write(" ");
return this;
}
/**
* <p>The comment [<!-- -->].</p>
*/
public HtmlBuilder comment(String comment) {
if (StringUtils.isNotBlank(comment)) {
write(" <!-- ").write(comment).write(" -->");
}
return this;
}
/**
* <p>The ul element [<ul>].</p>
*/
public HtmlBuilder ul() {
write("<ul>");
return this;
}
/**
* <p>The close tag of the ul element [</ul>].</p>
*/
public HtmlBuilder ulEnd() {
write("</ul>");
return this;
}
/**
* <p>The li element [<li> </li>].</p>
*/
public HtmlBuilder li(String text) {
if (StringUtils.isNotBlank(text)) {
write("<li>").write(text).write("</li>");
}
return this;
}
/**
* <p>The br element [<br/>].</p>
*/
public HtmlBuilder br() {
write("<br/>");
return this;
}
/**
* <p>The disabled attribute [disabled="disabled"].</p>
*/
public HtmlBuilder disabled() {
write(" disabled=\"disabled\" ");
return this;
}
/**
* <p>The nowrap attribute [nowrap="nowrap"].</p>
*/
public HtmlBuilder nowrap() {
write(" nowrap=\"nowrap\" ");
return this;
}
/**
* <p>The maxlength attribute [maxlength=].</p>
*/
public HtmlBuilder maxlength(String maxlength) {
if (StringUtils.isNotBlank(maxlength)) {
write(" maxlength=\"").write(maxlength).write("\" ");
}
return this;
}
/**
* <p>The start of the tbody element [<tbody].</p>
*/
public HtmlBuilder tbody(int tabs) {
newline();
tabs(tabs);
write("<tbody");
return this;
}
/**
* <p>The end tag of the tbody element [</tbody>].</p>
*
* <p>
* Also appends a newline [\n] and the specified number of tabs [\t]
* before the </tbody>.
* </p>
*
* @param tabs The number of tab spaces [\t] to put in.
*/
public HtmlBuilder tbodyEnd(int tabs) {
newline();
tabs(tabs);
write("</tbody>");
return this;
}
/**
* <p>The start of the thead element [<thead].</p>
*/
public HtmlBuilder thead(int tabs) {
newline();
tabs(tabs);
write("<thead");
return this;
}
/**
* <p>The end tag of the thead element [</thead>].</p>
*
* <p>
* Also appends a newline [\n] and the specified number of tabs [\t]
* before the </thead>.
* </p>
*
* @param tabs The number of tab spaces [\t] to put in.
*/
public HtmlBuilder theadEnd(int tabs) {
newline();
tabs(tabs);
write("</thead>");
return this;
}
/**
* <p>The start of the tfoot element [<thead].</p>
*/
public HtmlBuilder tfoot(int tabs) {
newline();
tabs(tabs);
write("<tfoot");
return this;
}
/**
* <p>The end tag of the tfoot element [</thead>].</p>
*
* <p>
* Also appends a newline [\n] and the specified number of tabs [\t]
* before the </thead>.
* </p>
*
* @param tabs The number of tab spaces [\t] to put in.
*/
public HtmlBuilder tfootEnd(int tabs) {
newline();
tabs(tabs);
write("</tfoot>");
return this;
}
/**
* <p>The start of the p element [<p].</p>
*/
public HtmlBuilder p() {
write("<p");
return this;
}
/**
* <p>The close tag of the p element [</p>].</p>
*/
public HtmlBuilder pEnd() {
write("</p>");
return this;
}
/**
* <p>The start of the h1 element [<h1].</p>
*/
public HtmlBuilder h1() {
write("<h1");
return this;
}
/**
* <p>The close tag of the h1 element [</h1>].</p>
*/
public HtmlBuilder h1End() {
write("</h1>");
return this;
}
/**
* <p>The start of the h2 element [<h2].</p>
*/
public HtmlBuilder h2() {
write("<h2");
return this;
}
/**
* <p>The close tag of the h2 element [</h2>].</p>
*/
public HtmlBuilder h2End() {
write("</h2>");
return this;
}
/**
* <p>The start of the h3 element [<h3].</p>
*/
public HtmlBuilder h3() {
write("<h3");
return this;
}
/**
* <p>The close tag of the h3 element [</h3>].</p>
*/
public HtmlBuilder h3End() {
write("</h3>");
return this;
}
/**
* <p>The start of the h4 element [<h4].</p>
*/
public HtmlBuilder h4() {
write("<h4");
return this;
}
/**
* <p>The close tag of the h4 element [</h4>].</p>
*/
public HtmlBuilder h4End() {
write("</h4>");
return this;
}
/**
* <p>The start of the h5 element [<h5].</p>
*/
public HtmlBuilder h5() {
write("<h5");
return this;
}
/**
* <p>The close tag of the h5 element [</h5>].</p>
*/
public HtmlBuilder h5End() {
write("</h5>");
return this;
}
public HtmlBuilder attribute(String attributeName,String attributeValue) {
if (StringUtils.isNotBlank(attributeValue)) {
write(" ").append(attributeName).append("=\"").append(attributeValue).append("\" ");
}
return this;
}
public String toString() {
return writer.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -