Example usage for com.google.gwt.safehtml.shared SafeHtmlUtils EMPTY_SAFE_HTML

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils EMPTY_SAFE_HTML

Introduction

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

Prototype

SafeHtml EMPTY_SAFE_HTML

To view the source code for com.google.gwt.safehtml.shared SafeHtmlUtils EMPTY_SAFE_HTML.

Click Source Link

Document

An empty String.

Usage

From source file:com.gafactory.core.client.ui.grids.BaseListGrid.java

License:Open Source License

protected Column<T, SafeHtml> addTrustedHtmlColumn(final ValueProvider<T, String> valueProvider, String header,
        int width, boolean sortable) {
    return addColumn(new Column<T, SafeHtml>(new SafeHtmlCell()) {
        @Override//from w w  w . j  a  va 2 s  .c  om
        public SafeHtml getValue(T object) {
            return object != null ? SafeHtmlUtils.fromTrustedString(valueProvider.getValue(object))
                    : SafeHtmlUtils.EMPTY_SAFE_HTML;
        }
    }, header, width, sortable, valueProvider.getPath());
}

From source file:com.gafactory.core.client.ui.grids.BaseListGrid.java

License:Open Source License

protected Column<T, T> addBooleanColumn(final ValueProvider<T, Boolean> field, final IconType yes,
        final IconType no, String header, int width, boolean sortable) {
    return addSafeHtmlColumn(new AbstractSafeHtmlRenderer<T>() {
        @Override//w  w  w.j a  va  2  s . com
        public SafeHtml render(T object) {
            Boolean b = field.getValue(object);
            if (b != null) {
                boolean selected = isSelected(object);
                String color;

                if (selected) {
                    color = TABLE_LINK_SELECTED;
                } else {
                    color = b ? "icon-yes" : "icon-no";
                }
                return templates.icon(Styles.FONT_AWESOME_BASE, b ? yes.getCssName() : no.getCssName(), color);

            } else {
                return SafeHtmlUtils.EMPTY_SAFE_HTML;
            }
        }
    }, header, width, sortable, sortable ? field.getPath() : null);
}

From source file:com.gwt2go.dev.client.ui.widget.celltree.CellTreeNodeSafeHtmlRenderer.java

License:Apache License

@Override
public SafeHtml render(GotoPlacesModel object) {
    return (object == null) ? SafeHtmlUtils.EMPTY_SAFE_HTML : SafeHtmlUtils.fromString(object.getName());
}

From source file:com.sencha.gxt.chart.client.draw.engine.VML.java

License:sencha.com license

@Override
public void deleteSprite(Sprite sprite) {
    XElement elt = getElement(sprite);// w  w w  . ja  va 2 s . c o  m
    super.deleteSprite(sprite);
    if (sprite instanceof TextSprite) {
        textBBoxCache.remove(sprite);
        textRenderedPoints.remove(sprite);
        textRenderedBaseline.remove(sprite);
    }
    if (poolingEnabled && !(sprite instanceof ImageSprite) && elt != null) {
        if (GXTLogConfiguration.loggingIsEnabled()) {
            logger.finest("Saving element for reuse: " + sprite + " = " + elt);
        }
        //wipe out child elements
        elt.setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
        //path
        elt.setAttribute("path", "");
        //stroke
        elt.setPropertyJSO("stroke", null);
        //fill
        elt.setPropertyJSO("fill", null);
        //clip
        elt.getStyle().setProperty("clip", "auto");
        //z-index
        elt.getStyle().clearZIndex();
        //id
        elt.setId(null);
        //hidden class
        elt.removeClassName(css.hideClass());
        pool.push(elt);
    }
}

From source file:com.sencha.gxt.core.client.dom.XElement.java

License:sencha.com license

/**
 * Retrieves the data using the request builder and updates the element's contents.
 * <p/>//from   w  w w . ja  v  a 2s  .c o m
 * Please note that the <code>Response</code> from the <code>RequestBuilder</code> is treated as raw html
 * without any sanitizing. If is up to the caller to ensure that the call does not return unsafe html.
 * <p/>
 * This method is subject to change.
 * 
 * @param builder the request builder
 */
public final Request load(RequestBuilder builder) {
    try {
        builder.setCallback(new RequestCallback() {

            public void onError(Request request, Throwable exception) {
                setInnerSafeHtml(exception != null && exception.getMessage() != null
                        ? SafeHtmlUtils.fromString(exception.getMessage())
                        : SafeHtmlUtils.EMPTY_SAFE_HTML);
            }

            public void onResponseReceived(Request request, Response response) {
                setInnerSafeHtml(response != null && response.getText() != null
                        ? SafeHtmlUtils.fromString(response.getText())
                        : SafeHtmlUtils.EMPTY_SAFE_HTML);
            }

        });
        return builder.send();
    } catch (Exception e) {
        setInnerSafeHtml(e != null && e.getMessage() != null ? SafeHtmlUtils.fromString(e.getMessage())
                : SafeHtmlUtils.EMPTY_SAFE_HTML);
        return null;
    }
}

From source file:com.sencha.gxt.core.client.dom.XElement.java

License:sencha.com license

/**
 * Removes all the elements children./*from   w  w w .  j  av  a  2s. co m*/
 */
public final void removeChildren() {
    Element child = null;
    while ((child = getFirstChildElement()) != null) {
        removeChild(child);
    }
    String tag = getTagName().toLowerCase();
    if (!tag.equals("table") && !tag.equals("tbody") && !tag.equals("tr") && !tag.equals("td")) {
        setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
    }
}

From source file:com.sencha.gxt.core.client.util.TextMetrics.java

License:sencha.com license

/**
 * Returns the size of the specified text based on the internal element's style and width properties.
 *
 * @param html the html or text to measure
 * @return the size/*from  w w  w .  java 2 s.  c  o  m*/
 */
public Size getSize(SafeHtml html) {
    Size size;
    el.setInnerSafeHtml(html);
    size = el.getSize();
    el.setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
    return size;
}

From source file:com.sencha.gxt.theme.base.client.grid.RowNumbererDefaultAppearance.java

License:sencha.com license

@Override
public SafeHtml renderHeader() {
    return SafeHtmlUtils.EMPTY_SAFE_HTML;
}

From source file:com.sencha.gxt.theme.base.client.info.DefaultInfoConfigDefaultAppearance.java

License:sencha.com license

@Override
public void render(SafeHtmlBuilder sb, SafeHtml title, SafeHtml message) {

    if (title != SafeHtmlUtils.EMPTY_SAFE_HTML) {
        sb.appendHtmlConstant("<div class='" + style.infoTitle() + "'>");
        sb.append(title);//from www.j a v  a 2s  .  com
        sb.appendHtmlConstant("</div>");
    }
    if (message != SafeHtmlUtils.EMPTY_SAFE_HTML) {
        sb.appendHtmlConstant("<div class='" + style.infoMessage() + "'>");
        sb.append(message);
        sb.appendHtmlConstant("</div>");
    }
}

From source file:com.sencha.gxt.theme.base.client.menu.MenuItemBaseAppearance.java

License:sencha.com license

@Override
public void setHtml(XElement parent, SafeHtml html) {
    XElement oldIcon = parent.selectNode("." + style.menuItemIcon());

    if (html == SafeHtmlUtils.EMPTY_SAFE_HTML) {
        getAnchor(parent).setInnerSafeHtml(Util.NBSP_SAFE_HTML);
    } else {/*from   w  w w.j a  v a2s .c  o m*/
        getAnchor(parent).setInnerSafeHtml(html);
    }

    if (oldIcon != null) {
        getAnchor(parent).insertFirst(oldIcon);
    }
}