/** * Creates an {@link Form} element with the specified {@link Form#action(String)} attribute and child nodes. * * @param action The {@link Form#action(String)} attribute. * @param children The child nodes. * @return The new element. */ public static final Form form(String action, Object...children) { return form().action(action).children(children); }
/** * Creates an empty {@link Form} element. * * @return The new element. */ public static final Form form() { return new Form(); }
/** * {@doc HTML5.forms#attr-fs-enctype enctype} attribute. * * <p> * Form data set encoding type to use for form submission. * * @param enctype The new value for this attribute. * @return This object (for method chaining). */ public final Form enctype(String enctype) { attr("enctype", enctype); return this; }
@RestMethod( name=GET, path="/edit", summary="Render form entry page for editing config file", description="Renders a form entry page for editing the raw text of a config file." ) public Form getConfigEditForm() { return form().id("form").action("servlet:/").method("POST").enctype("application/x-www-form-urlencoded").children( div()._class("data").children( table( tr(td().style("text-align:right").children(button("submit","Submit"),button("reset","Reset"))), tr(th().child("Contents")), tr(th().child( textarea().name("contents").rows(40).cols(120).style("white-space:pre;word-wrap:normal;overflow-x:scroll;font-family:monospace;") .text(getServletConfig().getConfig().toString())) ) ) ) ); }
@RestMethod( summary="Initialize database form entry page" ) public Div getInit() { return div( form("servlet:/init").method(POST).target("buf").children( table( tr( th("Initialize petstore database:"), td(input("radio").name("init-method").value("direct").checked(true), "direct", input("radio").name("init-method").value("rest"), "rest"), td(button("submit", "Submit").style("float:right").onclick("scrolling=true")) ) ) ), br(), iframe().id("buf").name("buf").style("width:800px;height:600px;").onload("window.parent.scrolling=false;"), script("text/javascript", "var scrolling = false;", "function scroll() { if (scrolling) { document.getElementById('buf').contentWindow.scrollBy(0,50); } setTimeout('scroll()',200); } ", "scroll();" ) ); }
/** * Creates a {@link Form} element with the specified {@link Form#action(String)} attribute. * * @param action The {@link Form#action(String)} attribute. * @return The new element. */ public static final Form form(String action) { return form().action(action); }
/** * {@doc HTML5.forms#attr-fs-action action} attribute. * * <p> * URL to use for form submission. * * <p> * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. * Strings must be valid URIs. * * <p> * URIs defined by {@link UriResolver} can be used for values. * * @param action The new value for this attribute. * @return This object (for method chaining). */ public final Form action(String action) { attrUri("action", action); return this; }
@RestMethod( name=GET, path="/edit", summary="Render form entry page for editing config file", description="Renders a form entry page for editing the raw text of a config file." ) public Form getConfigEditForm() { return form().id("form").action("servlet:/").method("POST").enctype("application/x-www-form-urlencoded").children( div()._class("data").children( table( tr(td().style("text-align:right").children(button("submit","Submit"),button("reset","Reset"))), tr(th().child("Contents")), tr(th().child( textarea().name("contents").rows(40).cols(120).style("white-space:pre;word-wrap:normal;overflow-x:scroll;font-family:monospace;") .text(getServletConfig().getConfig().toString())) ) ) ) ); }
@RestMethod( summary="Initialize database form entry page" ) public Div getInit() { return div( form("servlet:/init").method(POST).target("buf").children( table( tr( th("Initialize petstore database:"), td(input("radio").name("init-method").value("direct").checked(true), "direct", input("radio").name("init-method").value("rest"), "rest"), td(button("submit", "Submit").style("float:right").onclick("scrolling=true")) ) ) ), br(), iframe().id("buf").name("buf").style("width:800px;height:600px;").onload("window.parent.scrolling=false;"), script("text/javascript", "var scrolling = false;", "function scroll() { if (scrolling) { document.getElementById('buf').contentWindow.scrollBy(0,50); } setTimeout('scroll()',200); } ", "scroll();" ) ); }
/** * Creates a {@link Form} element with the specified {@link Form#action(String)} attribute. * * @param action The {@link Form#action(String)} attribute. * @return The new element. */ public static final Form form(String action) { return form().action(action); }
/** * {@doc HTML5.forms#attr-fs-action action} attribute. * * <p> * URL to use for form submission. * * <p> * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. * Strings must be valid URIs. * * <p> * URIs defined by {@link UriResolver} can be used for values. * * @param action The new value for this attribute. * @return This object (for method chaining). */ public final Form action(String action) { attrUri("action", action); return this; }
@Override /* Widget */ public Object getContent(RestRequest req) throws Exception { return div( form().id("form").action("servlet:/upload").method(POST).enctype("multipart/form-data").children( table( tr( th("ID:"), td(input().name("id").type("text")), td(new Tooltip("❓", "The unique identifier of the photo.", br(), "e.g. 'Fluffy'")) ), tr( th("File:"), td(input().name("file").type("file").accept("image/*")), td(new Tooltip("❓", "The image file.")) ), tr( td().colspan(2).style("text-align:right").children( button("reset", "Reset"), button("button","Cancel").onclick("window.location.href='/'"), button("submit", "Submit") ) ) ).style("white-space:nowrap") ) ); } }
/** * Creates an {@link Form} element with the specified {@link Form#action(String)} attribute and child nodes. * * @param action The {@link Form#action(String)} attribute. * @param children The child nodes. * @return The new element. */ public static final Form form(String action, Object...children) { return form().action(action).children(children); }
/** * Creates a {@link Form} element with the specified {@link Form#action(String)} attribute. * * @param action The {@link Form#action(String)} attribute. * @return The new element. */ public static final Form form(String action) { return form().action(action); }
/** * {@doc HTML5.forms#attr-fs-method method} attribute. * * <p> * HTTP method to use for form submission. * * @param method The new value for this attribute. * @return This object (for method chaining). */ public final Form method(String method) { attr("method", method); return this; }
/** * Creates an empty {@link Form} element. * * @return The new element. */ public static final Form form() { return new Form(); }
/** * {@doc HTML5.forms#attr-fs-action action} attribute. * * <p> * URL to use for form submission. * * <p> * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. * Strings must be valid URIs. * * <p> * URIs defined by {@link UriResolver} can be used for values. * * @param action The new value for this attribute. * @return This object (for method chaining). */ public final Form action(String action) { attrUri("action", action); return this; }