6 import java.util.function.*;
7 import static jrw.sp.cons.*;
8 import static jrw.sp.xhtml.cons.*;
10 public class Skeleton {
11 public static Environment.Variable<Supplier<? extends Skeleton>> defskel = new Environment.Variable<>(() -> Skeleton::new);
12 public List<String> styles = new ArrayList<>();
13 public Element body = xhtml.cons.body();
16 public Skeleton(String title, Object... contents) {
18 populate(body, contents);
25 public Skeleton title(String title) {this.title = title; return(this);}
26 public Skeleton style(String... styles) {this.styles.addAll(Arrays.asList(styles)); return(this);}
27 public Skeleton body(Object... data) {populate(body, data); return(this);}
29 public Element head(Request req) {
30 Element head = xhtml.cons.head(xhtml.cons.title(title));
31 for(String style : styles)
32 populate(head, link($("rel", "stylesheet"), $("type", "text/css"), $("href", style)));
36 public Element body(Request req) {
40 public Element message(Request req) {
41 return(html(head(req), body(req)));
44 public Element error(Request req) {