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.sencha.gxt.widget.core.client.grid.GroupSummaryView.java

License:sencha.com license

protected SafeHtml renderSummary(GroupingData<M> groupInfo, Map<ValueProvider<? super M, ?>, Number> data) {
    int colCount = cm.getColumnCount();
    int last = colCount - 1;

    String unselectableClass = " " + unselectable;

    String cellClass = styles.cell() + " " + states.cell();
    String cellInner = styles.cellInner() + " " + states.cellInner();
    String cellFirstClass = " x-grid-cell-first";
    String cellLastClass = " x-grid-cell-last";

    SafeHtmlBuilder trBuilder = new SafeHtmlBuilder();

    for (int i = 0, len = colCount; i < len; i++) {
        SummaryColumnConfig<M, ?> cf = (SummaryColumnConfig<M, ?>) cm.getColumn(i);
        ColumnData cd = getColumnData().get(i);

        String cellClasses = cellClass;
        cellClasses += (i == 0 ? cellFirstClass : (i == last ? cellLastClass : ""));

        if (cf.getCellClassName() != null) {
            cellClasses += " " + cf.getCellClassName();
        }/*  w ww .  j  ava2 s  .co  m*/

        Number n = data.get(cm.getValueProvider(i));
        SafeHtml value = SafeHtmlUtils.EMPTY_SAFE_HTML;

        if (cf.getSummaryFormat() != null) {
            if (n != null) {
                value = SafeHtmlUtils.fromString(cf.getSummaryFormat().format(n.doubleValue()));
            }
        } else if (cf.getSummaryRenderer() != null) {
            value = cf.getSummaryRenderer().render(n, data);
        }
        final SafeHtml tdContent;
        if (!selectable && GXT.isIE()) {
            tdContent = tpls.tdUnselectable(i, cellClasses, cd.getStyles(), cellInner, cf.getColumnTextStyle(),
                    value);
        } else {
            tdContent = tpls.td(i, cellClasses, cd.getStyles(), cellInner, cf.getColumnTextStyle(), value);
        }
        trBuilder.append(tdContent);

    }

    String rowClasses = getGroupingAppearance().style().summaryRow();

    if (!selectable) {
        rowClasses += unselectableClass;
    }

    SafeHtml cells = trBuilder.toSafeHtml();

    return tpls.tr(rowClasses, cells);
}

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

License:sencha.com license

/**
 * Sets the heading html.//w  w  w  .  j  a v a2  s.c om
 *
 * @param html the heading html
 */
public void setHeading(SafeHtml html) {
    this.heading = html;
    if (html == SafeHtmlUtils.EMPTY_SAFE_HTML) {
        getAppearance().getHeadingElem(getElement()).setInnerSafeHtml(Util.NBSP_SAFE_HTML);
    } else {
        getAppearance().getHeadingElem(getElement()).setInnerSafeHtml(html);
    }
}

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

License:sencha.com license

/**
 * Refreshes the view by reloading the data from the store and re-rendering
 * the template./* www.  j a  v a  2s.  co  m*/
 */
public void refresh() {
    if (!isOrWasAttached()) {
        return;
    }
    getElement().setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
    getElement().repaint();

    List<M> models = store == null ? new ArrayList<M>() : store.getAll();
    all.removeAll();

    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    bufferRender(models, sb);

    SafeHtml markup = sb.toSafeHtml();
    getElement().setInnerSafeHtml(markup);

    SafeHtmlBuilder esb = new SafeHtmlBuilder();
    appearance.renderEnd(esb);
    DomHelper.insertHtml("beforeend", getElement(), esb.toSafeHtml());

    List<Element> elems = appearance.findElements(getElement());

    all = new CompositeElement(elems);
    updateIndexes(0, -1);

    ensureFocusElement();

    fireEvent(new RefreshEvent());
}

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

License:sencha.com license

/**
 * Is called before a load when a {@link #setLoader(Loader) and {@link #setLoadingIndicator(SafeHtml) or
 * {@link #setLoadingIndicator(String)} are used the list will display the loading HTML.
 * <p/>//ww  w . j a v a  2 s.com
 * <ul>
 * <li>The {@link #setLoader(Loader)} has to be set for this to be called.
 * <li>The css class name 'loading-indicator' can style the loading HTML or text.
 * </ul>
 */
protected void onBeforeLoad() {
    if (loadingIndicator != SafeHtmlUtils.EMPTY_SAFE_HTML) {
        SafeHtmlBuilder sb = new SafeHtmlBuilder();
        sb.appendHtmlConstant("<div class='loading-indicator'>");
        sb.append(loadingIndicator);
        sb.appendHtmlConstant("</div>");
        getElement().setInnerSafeHtml(sb.toSafeHtml());
        all.removeAll();
    }
}

From source file:com.sencha.gxt.widget.core.client.tips.QuickTip.java

License:sencha.com license

private void updateTargetElement(Element target) {
    targetElem = target;//from   w w w . ja v  a 2  s . c o m

    final String qtip = getAttributeValue(target, interceptTitles ? "title" : "qtip");
    body = (qtip != null) ? SafeHtmlUtils.fromTrustedString(qtip) : SafeHtmlUtils.EMPTY_SAFE_HTML;

    final String qtitle = interceptTitles ? null : getAttributeValue(target, "qtitle");
    title = (qtitle != null) ? SafeHtmlUtils.fromTrustedString(qtitle) : SafeHtmlUtils.EMPTY_SAFE_HTML;

    String width = getAttributeValue(target, "qwidth");
    if (width != null && !"".equals(width)) {
        setWidth(Util.parseInt(width, 100));
    }
}

From source file:com.sencha.gxt.widget.core.client.tips.ToolTip.java

License:sencha.com license

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override/*  ww w .j a v  a 2s. c  o  m*/
protected void updateContent() {
    SafeHtml bh = SafeHtmlUtils.EMPTY_SAFE_HTML;

    if (toolTipConfig.getRenderer() != null) {
        Object data = toolTipConfig.getData();
        ToolTipRenderer r = toolTipConfig.getRenderer();
        bh = r.renderToolTip(data);
    } else {
        bh = body;
    }

    if (bh == SafeHtmlUtils.EMPTY_SAFE_HTML) {
        getAppearance().updateContent(getElement(), title, Util.NBSP_SAFE_HTML);
    } else {
        getAppearance().updateContent(getElement(), title, bh);
    }
}

From source file:com.sencha.gxt.widget.core.client.tree.Tree.java

License:sencha.com license

/**
 * Completely redraws the children of the given parent (or all items if parent is null), throwing away details like
 * currently expanded nodes, etc. Not designed to be used to update nodes, look into {@link #refresh(Object)} or
 * {@link Store#update(Object)}.//from   w ww  . j a v a 2 s  .co  m
 * 
 * @param parent the parent of the items to redraw
 */
protected void redraw(M parent) {
    if (!isOrWasAttached()) {
        return;
    }

    if (parent == null) {
        clear();
        renderChildren(null);

        if (autoSelect) {
            M m = store.getChild(0);
            if (m != null) {
                List<M> sel = new ArrayList<M>();
                sel.add(m);
                getSelectionModel().setSelection(sel);
            }
        }

    } else {
        TreeNode<M> n = findNode(parent);
        n.setLoaded(true);
        n.setLoading(false);
        if (n.isChildrenRendered()) {
            getContainer(parent).setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
        }

        renderChildren(parent);

        if (n.isExpand() && !isLeaf(n.getModel())) {
            n.setExpand(false);
            boolean c = caching;
            caching = true;
            boolean deep = n.isExpandDeep();
            n.setExpandDeep(false);
            setExpanded(parent, true, deep);
            caching = c;
        } else {
            refresh(parent);
        }
    }
}

From source file:com.sencha.gxt.widget.core.client.tree.TreeView.java

License:sencha.com license

public void onTextChange(TreeNode<M> node, SafeHtml html) {
    Element textEl = getTextElement(node);
    if (textEl != null) {
        if (html == SafeHtmlUtils.EMPTY_SAFE_HTML) {
            textEl.setInnerSafeHtml(Util.NBSP_SAFE_HTML);
        } else {/*from  w w  w  . j  av a2 s . c  o m*/
            textEl.setInnerSafeHtml(html);
        }
    }
}

From source file:com.tasktop.c2c.server.tasks.client.widgets.wiki.WikiHTMLPanel.java

License:Open Source License

public WikiHTMLPanel() {
    super(SafeHtmlUtils.EMPTY_SAFE_HTML);
}

From source file:org.jboss.as.console.client.administration.accesscontrol.ui.AccessControlView.java

License:Open Source License

@Override
public void reload() {
    browseByColumn.updateFrom(browseByItems);
    columnManager.reduceColumnsTo(1);
    setPreview(SafeHtmlUtils.EMPTY_SAFE_HTML);
}