List of usage examples for com.google.gwt.safecss.shared SafeStylesUtils fromTrustedNameAndValue
public static SafeStyles fromTrustedNameAndValue(String name, String value)
Returns a SafeStyles constructed from a trusted name and a trusted value, i.e., without escaping the name and value.
From source file:edu.arizona.biosemantics.gxt.theme.green.client.base.progressbar.Css3ProgressBarAppearance.java
License:sencha.com license
@Override public void render(SafeHtmlBuilder sb, Double value, ProgressBarAppearanceOptions options) { value = value == null ? 0 : value;//from w w w . j av a2 s. com String text = options.getProgressText(); if (text != null) { int v = (int) Math.round(value * 100); text = Format.substitute(text, v); } SafeHtml txt; if (text == null) { txt = SafeHtmlUtils.fromSafeConstant(" "); } else { txt = SafeHtmlUtils.fromString(text); } SafeStyles widthStyles = SafeStylesUtils.fromTrustedNameAndValue("width", options.getWidth() + "px"); final SafeStyles progressBarStyles; if (value <= 0) { progressBarStyles = SafeStylesUtils.fromTrustedNameAndValue("visibility", "hidden"); } else { progressBarStyles = SafeStylesUtils.fromTrustedNameAndValue("width", value * 100 + "%"); } sb.append(template.render(txt, styles, null, progressBarStyles, null, widthStyles)); }