Example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder append

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder append

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder append.

Prototype

public SafeHtmlBuilder append(SafeHtml html) 

Source Link

Document

Appends the contents of another SafeHtml object, without applying HTML-escaping to it.

Usage

From source file:com.sencha.gxt.theme.base.client.progress.ProgressBarDefaultAppearance.java

License:sencha.com license

@Override
public void render(SafeHtmlBuilder sb, Double value, ProgressBarAppearanceOptions options) {
    value = value == null ? 0 : value;//ww  w.j  a  va 2 s .  co m
    double valueWidth = value * options.getWidth();

    int vw = new Double(valueWidth).intValue();

    String text = options.getProgressText();

    if (text != null) {
        int v = (int) Math.round(value * 100);
        text = Format.substitute(text, v);
    }

    SafeHtml txt = Util.isEmptyString(text) ? Util.NBSP_SAFE_HTML : SafeHtmlUtils.fromString(text);

    int adj = GXT.isIE() ? 4 : 2;

    SafeStyles wrapStyles = SafeStylesUtils.fromTrustedString("width:" + (options.getWidth() - adj) + "px;");
    SafeStyles progressBarStyles = SafeStylesUtils.fromTrustedString("width:" + vw + "px;");
    SafeStyles progressTextStyles = SafeStylesUtils.fromTrustedString("width:" + Math.max(vw - 8, 0) + "px;");
    SafeStyles widthStyles = SafeStylesUtils
            .fromTrustedString("width:" + (Math.max(0, options.getWidth() - adj)) + "px;");
    sb.append(template.render(txt, style, wrapStyles, progressBarStyles, progressTextStyles, widthStyles));
}

From source file:com.sencha.gxt.theme.base.client.slider.SliderHorizontalBaseAppearance.java

License:sencha.com license

@Override
public void render(double fractionalValue, int width, int height, SafeHtmlBuilder sb) {
    if (width == -1) {
        // default
        width = 200;/* ww w  .jav  a  2s .  com*/
    }

    // padding
    width -= getTrackPadding();

    SafeStyles offsetStyles = createThumbStyles(fractionalValue, width);
    SafeStyles widthStyle = SafeStylesUtils.fromTrustedString("width: " + width + "px;");
    sb.append(template.template(resources.style(), widthStyle, offsetStyles));
}

From source file:com.sencha.gxt.theme.base.client.slider.SliderVerticalBaseAppearance.java

License:sencha.com license

@Override
public void render(double fractionalValue, int width, int height, SafeHtmlBuilder sb) {
    if (height == -1) {
        // default
        height = 200;//from   ww w  .java  2  s  .c  o  m
    }

    SafeStyles offsetStyles = createThumbStyles(fractionalValue, height);
    SafeStyles heightStyle = SafeStylesUtils.fromTrustedString("");

    // ends
    height -= getTrackPadding();
    heightStyle = SafeStylesUtils.fromTrustedString("height: " + height + "px;");

    sb.append(template.template(resources.style(), offsetStyles, heightStyle));
}

From source file:com.sencha.gxt.theme.base.client.status.StatusBaseAppearance.java

License:sencha.com license

@Override
public void render(SafeHtmlBuilder sb) {
    sb.append(template.template(style));
}

From source file:com.sencha.gxt.theme.base.client.statusproxy.StatusProxyBaseAppearance.java

License:sencha.com license

@Override
public void render(SafeHtmlBuilder builder) {
    builder.append(templates.template(style));
}

From source file:com.sencha.gxt.theme.base.client.tabs.TabPanelBaseAppearance.java

License:sencha.com license

@Override
public void render(SafeHtmlBuilder builder) {
    builder.append(template.render(style));
}

From source file:com.sencha.gxt.theme.blue.client.tabs.BluePlainTabPanelAppearance.java

License:sencha.com license

@Override
public void render(SafeHtmlBuilder builder) {
    builder.append(template.renderPlain(style));
}

From source file:com.sencha.gxt.theme.blue.client.tabs.BluePlainTabPanelBottomAppearance.java

License:sencha.com license

@Override
public void render(SafeHtmlBuilder builder) {
    builder.append(template.renderPlain(resources.style()));
}

From source file:com.sencha.gxt.widget.core.client.grid.ColumnFooter.java

License:sencha.com license

protected SafeHtml doRender() {
    int colCount = cm.getColumnCount();

    // root builder
    SafeHtmlBuilder buf = new SafeHtmlBuilder();

    int rows = cm.getAggregationRows().size();

    String cellInner = styles.cellInner() + " " + gridView.getStateStyles().cellInner();

    SafeStyles empty = XDOM.EMPTY_SAFE_STYLE;

    for (int j = 0; j < rows; j++) {
        AggregationRowConfig<M> config = cm.getAggregationRow(j);

        SafeHtmlBuilder trBuilder = new SafeHtmlBuilder();

        // loop each cell per row
        for (int i = 0; i < colCount; i++) {
            String cellClass = styles.cell() + " " + gridView.getStateStyles().cell();
            String cs = config.getCellStyle(cm.getColumn(i));
            if (cs != null) {
                cellClass += " " + cs;
            }//ww w  .  ja v  a 2  s  .  c  o  m
            HorizontalAlignmentConstant align = cm.getColumnHorizontalAlignment(i);
            SafeStyles s = empty;
            if (align != null) {
                s = SafeStylesUtils.fromTrustedString("text-align:" + align.getTextAlignString() + ";");
            }
            trBuilder.append(tpls.td(i, cellClass, empty, cellInner, s, getRenderedValue(j, i)));
        }
        buf.append(tpls.tr("", trBuilder.toSafeHtml()));
    }

    return buf.toSafeHtml();
}

From source file:com.sencha.gxt.widget.core.client.grid.ColumnHeader.java

License:sencha.com license

protected SafeHtml renderHiddenHeaders(int[] columnWidths) {
    SafeHtmlBuilder heads = new SafeHtmlBuilder();
    for (int i = 0; i < columnWidths.length; i++) {
        // unlike GridView, we do NOT render TH's for hidden elements because of support of
        // rowspan and colspan with header configs
        if (cm.isHidden(i)) {
            continue;
        }//from w ww  .  j a  v  a  2  s  . c  o  m

        SafeStylesBuilder builder = new SafeStylesBuilder();
        builder.appendTrustedString("height: 0px;");
        builder.appendTrustedString("width:" + columnWidths[i] + "px;");
        heads.append(tpls.th("", builder.toSafeStyles()));
    }

    return tpls.tr("", heads.toSafeHtml());
}