/** * Factory method for an HtmlAttributes instance. * This allows for subclass specialization. Also conforms to the fluent * interface compared to "new HtmlAttributes()" * * @return a new ToAttributesString */ public HtmlAttributes attributes() { return new HtmlAttributes(); }
/** * @param type * @return */ public static HtmlAttributes dataType(String type) { return new HtmlAttributes().add("data-type", type); }
/** * @param inline * @return */ public static HtmlAttributes dataInline(boolean inline) { return new HtmlAttributes().add("data-inline", String.valueOf(inline)); }
/** * @param key * @param value * @param escapeNeeded * @return a HtmlAttributes */ public static HtmlAttributes add(String key,String value,boolean escapeNeeded) { return new HtmlAttributes().add(key,value,escapeNeeded); } /**
/** * @param role * @return */ public static HtmlAttributes dataRole(String role) { return new HtmlAttributes().add("data-role", role); }
/** * @param dataContentTheme * @return */ public static HtmlAttributes dataContentTheme(String dataContentTheme) { return new HtmlAttributes().add("data-content-theme", dataContentTheme, false); } }
/** * @param allow * @return a HtmlAttributes */ public static HtmlAttributes allowScriptAccess(String allow) { return new HtmlAttributes().add("allowScriptAccess", allow, ESCAPE_CHARS); } /**
/** * @param rel * @return */ public static HtmlAttributes dataRel(String rel) { return new HtmlAttributes().add("data-rel", rel, false); }
/** * @param isMini * @return */ public static HtmlAttributes dataMini(boolean isMini) { return new HtmlAttributes().add("data-mini", Boolean.toString(isMini), false); } // fixed, inline
/** * @param flashvars * @return a HtmlAttributes */ public static HtmlAttributes flashvars(String flashvars) { return new HtmlAttributes().add("flashvars", flashvars, ESCAPE_CHARS); } /**
/** * If condition is true then add the attribute selected with value "selected". * @param condition * @return a HtmlAttributes */ public static HtmlAttributes selected_if(boolean condition) { return new HtmlAttributes().selected_if(condition); } /**
/** * If condition is true then add the attribute autofocus with value "autofocus". * @param condition * @return a HtmlAttributes */ public static HtmlAttributes autofocus_if(boolean condition) { return new HtmlAttributes().autofocus_if(condition); } /**
/** * @param enabled * @return */ public static HtmlAttributes dataAjax(boolean enabled) { return new HtmlAttributes().add("data-ajax", Boolean.toString(enabled),false); }
/** * @param icon * @return */ public static HtmlAttributes dataIcon(String icon) { return new HtmlAttributes().add("data-icon", icon); }
/** * @param direction * @return */ public static HtmlAttributes dataDirection(String direction) { return new HtmlAttributes().add("data-direction", direction, false); }
/** * @param xy * @return */ public static HtmlAttributes dataScroll(String xy) { return new HtmlAttributes().add("data-scroll", xy, false); }
/** * @param inline * @return */ public static HtmlAttributes dataInline(String inline) { return new HtmlAttributes().add("data-inline", inline, false); } /**
/** * @param allow * @return a HtmlAttributes */ public static HtmlAttributes allowFullscreen(boolean allow) { return new HtmlAttributes().add("allowFullScreen", Boolean.toString(allow), NO_ESCAPE); } /**
/** * @param inset * @return */ public static HtmlAttributes dataInset(boolean inset) { return new HtmlAttributes().add("data-inset", Boolean.toString(inset)); }
void generateHeader(HtmlCanvas reportPageBody, String cloudSlangImage) throws IOException { HtmlCanvas headerDiv = reportPageBody.div(new HtmlAttributes().id(HEADER_BAR_ID)); HtmlCanvas anchor = headerDiv.a(new HtmlAttributes().href(HTTP_CLOUD_SLANG_IO).target(BLANK)); HtmlCanvas img = new HtmlCanvas().img(new HtmlAttributes().src(cloudSlangImage).alt(CLOUD_SLANG_LOGO_ALT)); anchor.content(img.toHtml(), false); headerDiv._div(); reportPageBody.h1(new HtmlAttributes().class_(REPORT_TITLE_CLASS)).content(TEST_CASE_REPORT); }