/** * Creates a {@link CssContentHeaderItem} for the given content. * * @param css * css content to be rendered. * @param id * unique id for the <style> element. This can be <code>null</code>, however in * that case the ajax header contribution can't detect duplicate CSS fragments. * @return A newly created {@link CssContentHeaderItem} for the given content. */ public static CssContentHeaderItem forCSS(CharSequence css, String id) { return forCSS(css, id, null); }
/** * Creates a {@link CssContentHeaderItem} for the given content. * * @param css * css content to be rendered. * @param id * unique id for the <style> element. This can be <code>null</code>, however in * that case the ajax header contribution can't detect duplicate CSS fragments. * @return A newly created {@link CssContentHeaderItem} for the given content. */ public static CssContentHeaderItem forCSS(CharSequence css, String id) { return forCSS(css, id, null); }
@Override public void renderHead(IHeaderResponse response) { String css = ".qos-panel { " + "border: 1px solid #c6e09b; " + "padding: 5px; " + " }"; response.render(CssHeaderItem.forCSS(css, "qosPanelCss")); }
private void renderHeaderCss(IHeaderResponse header) throws IOException, TemplateException { Map<String, Object> context = new HashMap<String, Object>(); context.put("id", olPreview.getMarkupId()); Template template = templates.getTemplate("ol-style.ftl"); StringWriter css = new java.io.StringWriter(); template.process(context, css); header.render(CssHeaderItem.forCSS(css.toString(), null)); }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); // HACK ajuste para corrigir bug do metronic no alinhamento do menu dropdown response.render(CssHeaderItem.forCSS( ".dropdown-menu-right{left:auto !important;}", BSDropDownMenu.class.getSimpleName() + "_tweaks")); }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); // HACK ajuste para corrigir bug do metronic no alinhamento do menu dropdown response.render(CssHeaderItem.forCSS( ".dropdown-menu-right{left:auto !important;}", BSDropDownMenu.class.getSimpleName() + "_tweaks")); }
/** * Build the {@link CssHeaderItem} with the indicator style * * @return the {@link HeaderItem} */ private static HeaderItem newIndicatorCssHeaderItem() { IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR); String css = String.format(".k-i-%s { background-image: url(%s); background-position: 0 0; }", CSS_INDICATOR, RequestCycle.get().urlFor(handler)); return CssHeaderItem.forCSS(css, "kendo-ui-icon-indicator"); }
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR); /* adds and configure the busy indicator */ response.render(CssHeaderItem.forCSS(".ui-icon.ui-icon-indicator { background-image: url(" + RequestCycle.get().urlFor(handler).toString() + ") !important; background-position: 0 0; }", "jquery-ui-icon-indicator")); /* adds and configure the busy indicator */ StringBuilder script = new StringBuilder("jQuery(function() {"); script.append("jQuery('").append(selector).append("')"); script.append(".click(function() { jQuery(this).button('option', 'icons', {").append(position == Position.LEFT ? "primary" : "secondary").append(": 'ui-icon-indicator' }); })"); script.append(".ajaxStop(function() { jQuery(this).button('option', 'icons', {").append(position == Position.LEFT ? "primary" : "secondary").append(": null }); })"); script.append("});"); response.render(JavaScriptHeaderItem.forScript(script, this.getClass().getName() + "-" + selector)); } };
/** * Build the {@link CssHeaderItem} with the indicator style * * @return the {@link HeaderItem} */ private static HeaderItem newIndicatorCssHeaderItem() { IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR); String css = String.format(".k-i-%s { background-image: url(%s); background-position: 0 0; }", CSS_INDICATOR, RequestCycle.get().urlFor(handler)); return CssHeaderItem.forCSS(css, "kendo-ui-icon-indicator"); }
/** * Build the {@link CssHeaderItem} with the indicator style * * @return the {@link HeaderItem} */ public static HeaderItem newIndicatorCssHeaderItem() { IRequestHandler handler = new ResourceReferenceRequestHandler(AbstractDefaultAjaxBehavior.INDICATOR); String css = String.format(".ui-icon.%s { background-image: url(%s) !important; background-position: 0 0; }", CSS_INDICATOR, RequestCycle.get().urlFor(handler)); return CssHeaderItem.forCSS(css, "jquery-ui-icon-indicator"); }
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(CssHeaderItem.forCSS("" + ".modal-header-icon {" + " background-color: transparent;" + " float: right;" + " border: 0;" + " margin: 0;" + " padding: 0;" + " border-image: none;" + " line-height: 14px;" + " margin-top: -4px;" + " margin-right: 8px;" + " color: #ccc;" + "}" + ".modal-header-icon:hover {" + " color: #888;" + "}", "ModalBorder_modal-header-icon")); } });
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(CssHeaderItem.forCSS("" + ".modal-header-icon {" + " background-color: transparent;" + " float: right;" + " border: 0;" + " margin: 0;" + " padding: 0;" + " border-image: none;" + " line-height: 14px;" + " margin-top: -4px;" + " margin-right: 8px;" + " color: #ccc;" + "}" + ".modal-header-icon:hover {" + " color: #888;" + "}", "ModalBorder_modal-header-icon")); } });
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); PackageTextTemplate template = new PackageTextTemplate(CroppableImage.class, "crop.css"); String css = template.interpolate(vars).asString(); response.render(CssHeaderItem.forCSS(css, "croppable-image." + getMarkupId())); }
@Override public void renderHead(IHeaderResponse response) { String shapeDefinition = "shape-outside: " + this.shape.getName() + "(" + this.shape.getValues() + ");"; String css = String.format("." + this.getMarkupId() + "{ float: %s %s %s %s %s %s", this.getOrientation().name() + ";", this.getDimension(), "-webkit-" + shapeDefinition, shapeDefinition, "-webkit-shape-margin:" + this.getMargin() + ";", "shape-margin:" + this.getMargin() + ";"); String transitionCss = ""; if (this.transition != null) { css += " transition: " + (this.transition.getTransitionTime() != null ? this.transition.getTransitionTime() + ";" : "1s;"); String shapeTransitionDefinition = "shape-outside: " + this.transition.getName() + "(" + this.transition.getValues() + ");"; transitionCss = String.format("." + this.getMarkupId() + ":hover{ %s %s }", "-webkit-" + shapeTransitionDefinition, shapeTransitionDefinition); } css += "}"; response.render(CssHeaderItem.forCSS(css + " " + transitionCss, this.getMarkupId() + "css")); }