List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromString
public static SafeHtml fromString(String s)
From source file:com.sencha.gxt.widget.core.client.form.error.ElementErrorHandler.java
License:sencha.com license
@Override public void markInvalid(List<EditorError> errors) { Element elem = element;//from w ww.jav a 2 s. c o m if (elem == null) { elem = DOM.getElementById(elementId); } if (elem != null && errors != null && errors.size() > 0) { elem.setInnerSafeHtml(SafeHtmlUtils.fromString(errors.get(0).getMessage())); } }
From source file:com.sencha.gxt.widget.core.client.grid.AggregationNumberSummaryRenderer.java
License:sencha.com license
@Override public SafeHtml render(int colIndex, Grid<M> grid) { ValueProvider<? super M, N> v = grid.getColumnModel().getValueProvider(colIndex); Number n = summaryType.calculate(grid.getStore().getAll(), v); return SafeHtmlUtils.fromString(getFormat().format(n)); }
From source file:com.sencha.gxt.widget.core.client.grid.AggregationSafeHtmlRenderer.java
License:sencha.com license
public AggregationSafeHtmlRenderer(String text) { this(SafeHtmlUtils.fromString(text)); }
From source file:com.sencha.gxt.widget.core.client.grid.ColumnConfig.java
License:sencha.com license
/** * Creates a new column config./*from www .j a v a2 s . c o m*/ * * @param valueProvider thevalueProvider * @param width the column width * @param header the heading text */ public ColumnConfig(ValueProvider<? super M, N> valueProvider, int width, String header) { this(valueProvider, width, SafeHtmlUtils.fromString(header)); }
From source file:com.sencha.gxt.widget.core.client.grid.ColumnConfig.java
License:sencha.com license
/** * Sets the column's header text.//from w w w . j a va 2 s. c o m * * Text that contains reserved html characters will be escaped. * * @see #setHeader(SafeHtml) * @param text the column's header text */ public void setHeader(String text) { setHeader(SafeHtmlUtils.fromString(text)); }
From source file:com.sencha.gxt.widget.core.client.grid.ColumnConfig.java
License:sencha.com license
/** * Sets the column's tool tip as text, to be displayed as escaped html. * * @param toolTip the tool tip/*from w w w.j a v a 2s .com*/ */ public void setToolTip(String toolTip) { this.toolTip = SafeHtmlUtils.fromString(toolTip); }
From source file:com.sencha.gxt.widget.core.client.grid.GridView.java
License:sencha.com license
/** * Renders the value of a cell into safe HTML. * * @param rowIndex the row index/* w w w . j ava2 s .c o m*/ * @param colIndex the column index * @param m the data model * @param record the optional {@link Record} for this row (may be null) * @return the safe HTML representing the cell */ protected <N> SafeHtml getRenderedValue(int rowIndex, int colIndex, M m, ListStore<M>.Record record) { ValueProvider<? super M, N> valueProvider = cm.getValueProvider(colIndex); N val = null; if (record != null) { val = record.getValue(valueProvider); } else { val = valueProvider.getValue(m); } Cell<N> r = cm.getCell(colIndex); if (r != null) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); r.render(new Context(rowIndex, colIndex, ds.getKeyProvider().getKey(m)), val, sb); return sb.toSafeHtml(); } String text = null; if (val != null) { text = val.toString(); } return Util.isEmptyString(text) ? Util.NBSP_SAFE_HTML : SafeHtmlUtils.fromString(text); }
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 . ja v a2s . c o 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.grid.HeaderGroupConfig.java
License:sencha.com license
/** * Creates a new header group without rowspan and colspan. * /* w ww . j av a 2s .c om*/ * @param html the group text or html */ public HeaderGroupConfig(String html) { this(SafeHtmlUtils.fromString(html)); }
From source file:com.sencha.gxt.widget.core.client.grid.HeaderGroupConfig.java
License:sencha.com license
/** * Creates a header group.//from w ww . j av a2 s. co m * * @param html the group text or html * @param rowspan the rowspan * @param colspan the colspan */ public HeaderGroupConfig(String html, int rowspan, int colspan) { this(SafeHtmlUtils.fromString(html), rowspan, colspan); }