/** * Creates a {@link Td} element with the specified child nodes. * * @param children The child nodes. * @return The new element. */ public static final Td td(Object...children) { return td().children(children); }
/** * Creates a {@link Td} element with the specified child nodes. * * @param children The child nodes. * @return The new element. */ public static final Td td(Object...children) { return td().children(children); }
/** * Creates a {@link Td} element with the specified child nodes. * * @param children The child nodes. * @return The new element. */ public static final Td td(Object...children) { return td().children(children); }
private Div headers(Session s, ResponseInfo ri) { if (! ri.hasHeaders()) return null; Table sectionTable = table(tr(th("Name"),th("Description"),th("Schema")))._class("section-table"); Div headers = div( div("Headers:")._class("section-name"), sectionTable )._class("headers"); for (Map.Entry<String,HeaderInfo> e : ri.getHeaders().entrySet()) { String name = e.getKey(); HeaderInfo hi = e.getValue(); sectionTable.child( tr( td(name)._class("name"), td(toBRL(hi.getDescription()))._class("description"), td(hi.asMap().keepAll("type","format","items","collectionFormat","default","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","maxItems","minItems","uniqueItems","enum","multipleOf")) ) ); } return headers; }
private Div headers(Session s, ResponseInfo ri) { if (! ri.hasHeaders()) return null; Table sectionTable = table(tr(th("Name"),th("Description"),th("Schema")))._class("section-table"); Div headers = div( div("Headers:")._class("section-name"), sectionTable )._class("headers"); for (Map.Entry<String,HeaderInfo> e : ri.getHeaders().entrySet()) { String name = e.getKey(); HeaderInfo hi = e.getValue(); sectionTable.child( tr( td(name)._class("name"), td(toBRL(hi.getDescription()))._class("description"), td(hi.asMap().keepAll("type","format","items","collectionFormat","default","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","maxItems","minItems","uniqueItems","enum","multipleOf")) ) ); } return headers; }
private Div headers(Session s, ResponseInfo ri) { if (! ri.hasHeaders()) return null; Table sectionTable = table(tr(th("Name"),th("Description"),th("Schema")))._class("section-table"); Div headers = div( div("Headers:")._class("section-name"), sectionTable )._class("headers"); for (Map.Entry<String,HeaderInfo> e : ri.getHeaders().entrySet()) { String name = e.getKey(); HeaderInfo hi = e.getValue(); sectionTable.child( tr( td(name)._class("name"), td(toBRL(hi.getDescription()))._class("description"), td(hi.asMap().keepAll("type","format","items","collectionFormat","default","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","maxItems","minItems","uniqueItems","enum","multipleOf")) ) ); } return headers; }
@Override /* Widget */ public Object getContent(RestRequest req) throws Exception { return div( form().id("form").action("servlet:/store/order").method(POST).children( table( tr( th("Pet:"), td( select().id("addPet_names").name("petId") ), td(new Tooltip("❓", "The pet to purchase.")) ), tr( th("Ship date:"), td(input().name("shipDate").type("date")), td(new Tooltip("❓", "The requested ship date.")) ), tr( td().colspan(2).style("text-align:right").children( button("reset", "Reset"), button("submit", "Submit") ) ) ).style("white-space:nowrap") ) ); } }
@Override /* Widget */ public Object getContent(RestRequest req) throws Exception { return div( form().id("form").action("servlet:/store/order").method(POST).children( table( tr( th("Pet:"), td( select().id("addPet_names").name("petId") ), td(new Tooltip("❓", "The pet to purchase.")) ), tr( th("Ship date:"), td(input().name("shipDate").type("date")), td(new Tooltip("❓", "The requested ship date.")) ), tr( td().colspan(2).style("text-align:right").children( button("reset", "Reset"), button("submit", "Submit") ) ) ).style("white-space:nowrap") ) ); } }
@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") ) ); } }
@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") ) ); } }
tr( th("Name:"), td(input().name("name").type("text")), td(new Tooltip("❓", "The name of the pet.", br(), "e.g. 'Fluffy'")) ), tr( th("Species:"), td( select().name("species").children( option("CAT"), option("DOG"), option("BIRD"), option("FISH"), option("MOUSE"), option("RABBIT"), option("SNAKE") td(new Tooltip("❓", "The kind of animal.")) ), tr( th("Price:"), td(input().name("price").type("number").placeholder("1.0").step("0.01").min(1).max(100).value(9.99)), td(new Tooltip("❓", "The price to charge for this pet.")) ), tr( th("Tags:"), td(input().name("tags").type("text")), td(new Tooltip("❓", "Arbitrary textual tags (comma-delimited).", br(), "e.g. 'fluffy,friendly'")) ), tr( td().colspan(2).style("text-align:right").children( button("reset", "Reset"), button("button","Cancel").onclick("window.location.href='/'"),
table.child(tr(th("Description:"),td(toBRL(info.getDescription())))); table.child(tr(th("Version:"),td(info.getVersion()))); t2.child(tr(th("Name:"),td(c.getName()))); if (c.hasUrl()) t2.child(tr(th("URL:"),td(a(c.getUrl(), c.getUrl())))); if (c.hasEmail()) t2.child(tr(th("Email:"),td(a("mailto:"+ c.getEmail(), c.getEmail())))); table.child(tr(th("Contact:"),td(t2))); if (l != null) { Object child = l.hasUrl() ? a(l.getUrl(), l.hasName() ? l.getName() : l.getUrl()) : l.getName(); table.child(tr(th("License:"),td(child))); if (ed != null) { Object child = ed.hasUrl() ? a(ed.getUrl(), ed.hasDescription() ? ed.getDescription() : ed.getUrl()) : ed.getDescription(); table.child(tr(th("Docs:"),td(child))); String tos = info.getTermsOfService(); Object child = StringUtils.isUri(tos) ? a(tos, tos) : tos; table.child(tr(th("Terms of Service:"),td(child)));
table.child(tr(th("Description:"),td(toBRL(info.getDescription())))); table.child(tr(th("Version:"),td(info.getVersion()))); t2.child(tr(th("Name:"),td(c.getName()))); if (c.hasUrl()) t2.child(tr(th("URL:"),td(a(c.getUrl(), c.getUrl())))); if (c.hasEmail()) t2.child(tr(th("Email:"),td(a("mailto:"+ c.getEmail(), c.getEmail())))); table.child(tr(th("Contact:"),td(t2))); if (l != null) { Object child = l.hasUrl() ? a(l.getUrl(), l.hasName() ? l.getName() : l.getUrl()) : l.getName(); table.child(tr(th("License:"),td(child))); if (ed != null) { Object child = ed.hasUrl() ? a(ed.getUrl(), ed.hasDescription() ? ed.getDescription() : ed.getUrl()) : ed.getDescription(); table.child(tr(th("Docs:"),td(child))); String tos = info.getTermsOfService(); Object child = StringUtils.isUri(tos) ? a(tos, tos) : tos; table.child(tr(th("Terms of Service:"),td(child)));
table.child(tr(th("Description:"),td(toBRL(info.getDescription())))); table.child(tr(th("Version:"),td(info.getVersion()))); t2.child(tr(th("Name:"),td(c.getName()))); if (c.hasUrl()) t2.child(tr(th("URL:"),td(a(c.getUrl(), c.getUrl())))); if (c.hasEmail()) t2.child(tr(th("Email:"),td(a("mailto:"+ c.getEmail(), c.getEmail())))); table.child(tr(th("Contact:"),td(t2))); if (l != null) { Object child = l.hasUrl() ? a(l.getUrl(), l.hasName() ? l.getName() : l.getUrl()) : l.getName(); table.child(tr(th("License:"),td(child))); if (ed != null) { Object child = ed.hasUrl() ? a(ed.getUrl(), ed.hasDescription() ? ed.getDescription() : ed.getUrl()) : ed.getDescription(); table.child(tr(th("Docs:"),td(child))); String tos = info.getTermsOfService(); Object child = StringUtils.isUri(tos) ? a(tos, tos) : tos; table.child(tr(th("Terms of Service:"),td(child)));
@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();" ) ); }
@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();" ) ); }
boolean required = pi.getRequired() == null ? false : pi.getRequired(); Td parameterKey = td( div(piName)._class("name" + (required ? " required" : "")), required ? div("required")._class("requiredlabel") : null, )._class("parameter-key"); Td parameterValue = td( div(toBRL(pi.getDescription()))._class("description"), examples(s, pi) ResponseInfo ri = e3.getValue(); Td code = td(e3.getKey())._class("response-key"); Td codeValue = td( div(toBRL(ri.getDescription()))._class("description"), examples(s, ri),
boolean required = pi.getRequired() == null ? false : pi.getRequired(); Td parameterKey = td( div(piName)._class("name" + (required ? " required" : "")), required ? div("required")._class("requiredlabel") : null, )._class("parameter-key"); Td parameterValue = td( div(toBRL(pi.getDescription()))._class("description"), examples(s, pi) ResponseInfo ri = e3.getValue(); Td code = td(e3.getKey())._class("response-key"); Td codeValue = td( div(toBRL(ri.getDescription()))._class("description"), examples(s, ri),
@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( 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())) ) ) ) ); }