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.box.ProgressMessageBox.java

License:sencha.com license

/**
 * Creates a progress message box with the specified heading HTML.
 *
 * @param headingHtml the HTML to display for the message box heading
 *///from  w  w  w .ja  v  a  2 s. c  om
public ProgressMessageBox(SafeHtml headingHtml) {
    this(headingHtml, SafeHtmlUtils.EMPTY_SAFE_HTML);
}

From source file:com.sencha.gxt.widget.core.client.form.error.ElementErrorHandler.java

License:sencha.com license

@Override
public void clearInvalid() {
    Element elem = element;/*from w ww .j a  v  a 2  s. c o  m*/
    if (elem == null) {
        elem = DOM.getElementById(elementId);
    }
    if (elem != null) {
        elem.setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
    }
}

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

License:sencha.com license

/**
 * True to show the select all checkbox in the grid header, false to hide it and prevent select all behavior. Defaults
 * to true./*w w  w  . jav a  2s . c om*/
 * <p/>
 * Must either be called before the grid header is rendered, or calling code must force the header to be rerendered
 * (for example, via {@link GridView#refresh(boolean)}, passing {@code true} to get the header to refresh).
 *
 * @param showSelectAll true to show a header checkbox, false to hide it
 */
public void setShowSelectAll(boolean showSelectAll) {
    this.showSelectAll = showSelectAll;
    config.setHeader(showSelectAll ? appearance.renderHeadCheckBox() : SafeHtmlUtils.EMPTY_SAFE_HTML);
}

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

License:sencha.com license

/**
 * Creates a new column footer./*from   w  ww  . ja v a  2  s .c om*/
 * 
 * @param grid the target grid
 * @param cm the column model
 */
public ColumnFooter(Grid<M> grid, ColumnModel<M> cm) {
    this.grid = grid;
    this.cm = cm;

    this.gridView = grid.getView();
    this.tpls = gridView.tpls;

    this.styles = grid.getView().getAppearance().styles();

    setElement(Document.get().createDivElement());
    setStyleName(styles.footer());
    getElement().getStyle().setOverflow(Overflow.HIDDEN);

    SafeStyles rowStyles = XDOM.EMPTY_SAFE_STYLE;

    getElement().setInnerSafeHtml(tpls.table("", rowStyles, SafeHtmlUtils.EMPTY_SAFE_HTML,
            gridView.renderHiddenHeaders(gridView.getColumnWidths())));

    table = getElement().getFirstChildElement().cast();

    DomHelper.append(table.getFirstChildElement().getNextSiblingElement(), renderRows());
}

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

License:sencha.com license

protected <N, O> SafeHtml getRenderedValue(int row, int col) {
    AggregationRowConfig<M> config = cm.getAggregationRow(row);
    ColumnConfig<M, N> c = cm.getColumn(col);

    AggregationRenderer<M> renderer = config.getRenderer(c);
    if (renderer != null) {
        SafeHtml s = renderer.render(col, grid);
        return s;
    }/* w  w  w  .  j a va 2s. c o  m*/
    return SafeHtmlUtils.EMPTY_SAFE_HTML;
}

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

License:sencha.com license

/**
 * Rebuilds the grid using its current configuration and data.
 *
 * @param headerToo true to refresh the header
 *//*from w  ww.j a v a  2  s .c o m*/
public void refresh(boolean headerToo) {
    if (grid != null && grid.isViewReady()) {

        if (!preventScrollToTopOnRefresh) {
            scrollToTop(headerToo);
        }

        if (GXT.isIE()) {
            dataTableBody.removeChildren();
            dataTableSizingHead.removeChildren();
        } else {
            dataTableBody.setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
            dataTableSizingHead.setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
        }

        DomHelper.insertHtml("afterBegin", dataTableSizingHead, renderHiddenHeaders(getColumnWidths()));
        DomHelper.insertHtml("afterBegin", dataTableBody, renderRows(0, -1));

        dataTable.getStyle().setWidth(getTotalWidth(), Unit.PX);

        if (headerToo) {
            sortState = null;

            header.refresh();

            header.setEnableColumnResizing(grid.isColumnResize());
            header.setEnableColumnReorder(grid.isColumnReordering());
        }

        processRows(0, true);

        if (footer != null) {
            ComponentHelper.doDetach(footer);
            footer.getElement().removeFromParent();
        }
        if (cm.getAggregationRows().size() > 0) {
            footer = new ColumnFooter<M>(grid, cm);
            renderFooter();
            if (grid.isAttached()) {
                ComponentHelper.doAttach(footer);
            }
        }

        calculateVBar(true);

        updateHeaderSortState();

        applyEmptyText();

        grid.getElement().repaint();

        grid.fireEvent(new RefreshEvent());
    }
}

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

License:sencha.com license

/**
 * Applies the empty text, then displaying it if the grid is empty.
 *///w w w . j  a v  a 2 s.  co m
protected void applyEmptyText() {
    if (!hasRows()) {
        if (GXT.isIE()) {
            dataTableBody.removeChildren();
        } else {
            dataTableBody.setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
        }

        SafeHtml con = appearance.renderEmptyContent(emptyText);
        con = tpls.tr("", tpls.tdWrap(cm.getColumnCount(), "", styles.empty(), con));
        DomHelper.append(dataTableBody, con);
    }
}

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

License:sencha.com license

/**
 * Inserts the given rows (already present in the grid's list store) into the grid view.
 *
 * @param firstRow the first row index/*from   w  w w .  j a v a  2 s.co  m*/
 * @param lastRow the last row index
 * @param isUpdate true if update to existing rows
 */
protected void insertRows(int firstRow, int lastRow, boolean isUpdate) {
    if (lastRow < firstRow) {
        return;
    }

    if (!hasRows()) {
        if (GXT.isIE()) {
            dataTableBody.removeChildren();
        } else {
            dataTableBody.setInnerSafeHtml(SafeHtmlUtils.EMPTY_SAFE_HTML);
        }
    }

    SafeHtml html = renderRows(firstRow, lastRow);
    XElement before = getRow(firstRow).cast();

    if (before != null) {
        DomHelper.insertBefore(before, html);
    } else {
        DomHelper.insertHtml("beforeEnd", dataTableBody, html);
    }
    if (!isUpdate) {
        processRows(firstRow, false);
    }
}

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

License:sencha.com license

/**
 * Renders the grid's rows.//from  w  w  w.  j  av  a  2 s. com
 *
 * @param startRow the index in the store of the first row to render
 * @param endRow the index of the last row to render (may be -1 to indicate all rows)
 * @return safe HTML representing the rendered rows
 */
protected SafeHtml renderRows(int startRow, int endRow) {
    if (ds.size() < 1) {
        return SafeHtmlUtils.EMPTY_SAFE_HTML;
    }

    List<ColumnData> cs = getColumnData();

    if (endRow == -1) {
        endRow = ds.size() - 1;
    }

    List<M> rs = ds.subList(startRow, ++endRow);
    return doRender(cs, rs, startRow);
}

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

License:sencha.com license

protected void refreshSummaries() {
    if (groupingColumn == null) {
        return;//from  w w  w  . j a v  a2  s  .  c om
    }

    NodeList<Element> groups = getGroups();
    NodeList<Element> summaries = getSummaries();
    List<GroupingData<M>> groupData = createGroupingData();
    for (int i = 0; i < groupData.size(); i++) {
        Element g = groups.getItem(i);
        if (g == null)
            continue;
        SafeHtml s = renderGroupSummary(groupData.get(i));
        s = tpls.table("", SafeStylesUtils.fromTrustedString(""), s, SafeHtmlUtils.EMPTY_SAFE_HTML);
        Element existing = summaries.getItem(i);
        existing.getParentElement()
                .replaceChild(XDOM.create(s).getLastChild().<Element>cast().getFirstChildElement(), existing);
    }
}