Example usage for com.google.gwt.safecss.shared SafeStylesBuilder append

List of usage examples for com.google.gwt.safecss.shared SafeStylesBuilder append

Introduction

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

Prototype

public SafeStylesBuilder append(SafeStyles styles) 

Source Link

Document

Appends the contents of another SafeStyles object, without applying any escaping or sanitization to it.

Usage

From source file:com.sencha.gxt.theme.base.client.button.ButtonCellDefaultAppearance.java

License:sencha.com license

protected void writeValue(SafeHtmlBuilder builder, SafeHtml value, int width, int height) {
    SafeStylesBuilder sb = new SafeStylesBuilder();
    if (height > 0) {
        int adjustedHeight = height - heightOffset;
        sb.append(SafeStylesUtils.fromTrustedString("height:" + adjustedHeight + "px;"));
    }// ww  w. ja v  a 2 s. c om
    if (width > 0) {
        sb.append(SafeStylesUtils.fromTrustedString("width:" + width + "px;"));
    }
    builder.append(templates.textWithStyles(style.text(), sb.toSafeStyles(), value));
}

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

License:sencha.com license

/**
 * Returns the CSS styles for the given column.
 *
 * @param colIndex the column index/* w  w  w . ja  v  a 2 s . c om*/
 * @param isHeader true to include the column header styles
 * @return the styles
 */
protected SafeStyles getColumnStyle(int colIndex, boolean isHeader) {
    SafeStylesBuilder builder = new SafeStylesBuilder();
    if (!isHeader) {
        SafeStyles columnStyles = cm.getColumnStyles(colIndex);
        if (columnStyles != null) {
            builder.append(columnStyles);
        }
    }

    HorizontalAlignmentConstant alignHorz = cm.getColumnHorizontalAlignment(colIndex);
    if (alignHorz != null) {
        builder.append(SafeStylesUtils.fromTrustedString("text-align:" + alignHorz.getTextAlignString() + ";"));
    }

    VerticalAlignmentConstant alignVert = cm.getColumnVerticalAlignment(colIndex);
    if (alignVert != null) {
        builder.append(SafeStylesUtils
                .fromTrustedString("vertical-align:" + alignVert.getVerticalAlignString() + ";"));
    }

    return builder.toSafeStyles();
}

From source file:org.appverse.web.framework.frontend.gwt.theme.bluetouch.client.button.AppverseWebButtonCellDefaultAppearance.java

License:sencha.com license

private void writeText(SafeHtmlBuilder builder, String text, int width, int height) {
    SafeStylesBuilder sb = new SafeStylesBuilder();
    if (height > 0) {
        int adjustedHeight = height - heightOffset;
        sb.append(SafeStylesUtils.fromTrustedString("height:" + adjustedHeight + "px;"));
    }/*from w  w w  .ja  va 2s  . c  o m*/
    if (width > 0) {
        sb.append(SafeStylesUtils.fromTrustedString("width:" + width + "px;"));
    }
    builder.append(
            templates.textWithStyles(style.text(), sb.toSafeStyles(), SafeHtmlUtils.fromTrustedString(text)));
}

From source file:stroom.cell.info.client.SvgCell.java

License:Apache License

@Override
public void render(final Context context, final SvgPreset value, final SafeHtmlBuilder sb) {
    if (value == null) {
        sb.append(SafeHtmlUtils.EMPTY_SAFE_HTML);
    } else {//www .j av a  2 s  . c o  m
        final SafeStylesBuilder builder = new SafeStylesBuilder();
        builder.append(SafeStylesUtils.forWidth(value.getWidth(), Unit.PX));
        builder.append(SafeStylesUtils.forHeight(value.getHeight(), Unit.PX));

        String className = resources.style().icon();
        if (!value.isEnabled()) {
            className += " " + resources.style().disabled();
        }

        sb.append(template.icon(className, builder.toSafeStyles(), UriUtils.fromString(value.getUrl())));
    }
}