Refine search
SafeHtmlBuilder accum = new SafeHtmlBuilder(); wordBounds.endIndex); cursor = wordBounds.endIndex; accum.appendEscaped(part1); accum.appendHtmlConstant("<strong>"); accum.appendEscaped(part2); accum.appendHtmlConstant("</strong>"); accum.appendEscaped(formattedSuggestion.substring(cursor)); MultiWordSuggestion suggestion = createSuggestion(formattedSuggestion, accum.toSafeHtml().asString()); suggestions.add(suggestion);
/** * Construct a new {@link ActionCell}. * * @param message the message to display on the button * @param delegate the delegate that will handle events */ public ActionCell(SafeHtml message, Delegate<C> delegate) { super(CLICK, KEYDOWN); this.delegate = delegate; this.html = new SafeHtmlBuilder().appendHtmlConstant( "<button type=\"button\" tabindex=\"-1\">").append(message).appendHtmlConstant( "</button>").toSafeHtml(); }
@Override public void render(Context context, SafeHtml data, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<button type=\"button\" tabindex=\"-1\">"); if (data != null) { sb.append(data); } sb.appendHtmlConstant("</button>"); }
/** * Render a list of row values. * * @param values the row values * @param start the absolute start index of the values * @param selectionModel the {@link SelectionModel} * @return null, unless the implementation renders using SafeHtml */ private SafeHtml renderRowValues(List<T> values, int start, SelectionModel<? super T> selectionModel) { try { SafeHtmlBuilder sb = new SafeHtmlBuilder(); hasData.renderRowValues(sb, values, start, selectionModel); return sb.toSafeHtml(); } catch (UnsupportedOperationException e) { // If renderRowValues throws, the implementation will render directly in // the replaceChildren method. return null; } } }
public void render( final Cell.Context context, final T value, final SafeHtmlBuilder sb ) { final SafeHtmlBuilder mysb = new SafeHtmlBuilder(); final Button btn = GWT.create( Button.class ); btn.setText( getText( value ) ); btn.setTitle( getText( value ) ); btn.setType( ButtonType.DEFAULT ); btn.setSize( ButtonSize.SMALL ); btn.getElement().getStyle().setMarginRight( 5, Style.Unit.PX ); mysb.appendHtmlConstant( btn.getElement().getString() ); sb.append( mysb.toSafeHtml() ); }
public static void showMessages(List<String> messages, DivElement divContainer) { final SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); for (String message : messages) { safeHtmlBuilder.append(SafeHtmlUtils.fromString(message)) .appendHtmlConstant("<br/>"); } divContainer.setInnerHTML(safeHtmlBuilder.toSafeHtml().asString()); }
@Override public void render(ButtonCellBase<C> cell, Context context, C value, SafeHtmlBuilder sb) { SafeHtmlBuilder classes = new SafeHtmlBuilder(); classes.appendEscaped(style.buttonCellBase()); Decoration decoration = cell.getDecoration(); if (decoration == Decoration.PRIMARY) { classes.appendEscaped(" " + style.buttonCellBasePrimary()); } else if (decoration == Decoration.NEGATIVE) { classes.appendEscaped(" " + style.buttonCellBaseNegative()); } else { classes.appendEscaped(" " + style.buttonCellBaseDefault()); classes.appendEscaped(" " + style.buttonCellBaseCollapseLeft()); classes.appendEscaped(" " + style.buttonCellBaseCollapseRight()); attributes.append("accessKey=\"").append(SafeHtmlUtils.htmlEscape("" + accessKey)); attributes.append("\" "); StringBuilder openTag = new StringBuilder(); openTag.append("<button type=\"button\""); openTag.append(" class=\"" + classes.toSafeHtml().asString() + "\""); openTag.append(" tabindex=\"" + tabIndex + "\" "); openTag.append(attributes.toString()).append(">"); sb.append(SafeHtmlUtils.fromTrustedString(openTag.toString())); sb.append(content); sb.appendHtmlConstant("</button>");
@Override public SafeHtml getName(NetworkView item) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(super.getName(item)); builder.appendEscaped(" ("); // $NON-NLS-1$ builder.appendEscaped(item.getDataCenterName()); builder.appendEscaped(")"); // $NON-NLS-1$ return builder.toSafeHtml(); }
private SafeHtml createEmptyOption() { SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(fromTrustedString("<option value=''></option>")); return builder.toSafeHtml(); }
/** * render a header and return the value as html * * @param group the header to render * @return the string value */ public String renderGroupHeader(G group) { SafeHtmlBuilder headerBuilder = new SafeHtmlBuilder(); header.render(headerBuilder, group); return headerBuilder.toSafeHtml().asString(); }
public static SafeHtml parseCode(String code) { SafeHtmlBuilder builder = new SafeHtmlBuilder(); String[] splitted = code.replaceAll("\\\\s", " ").split("\\\\n\\s?"); String[] arr$ = splitted; int len$ = splitted.length; for (int i$ = 0; i$ < len$; ++i$) { String s = arr$[i$]; builder.append(SafeHtmlUtils.fromTrustedString(SafeHtmlUtils.htmlEscapeAllowEntities(s))); builder.appendHtmlConstant("<br>"); } return builder.toSafeHtml(); }
public void render(Context context, C value, SafeHtmlBuilder sb) { SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder(); cell.render(context, value, cellBuilder); sb.append(template.outerDiv(outerDivPadding, isIconUsed(value) ? getIconHtml(value) : placeHolderHtml, cellBuilder.toSafeHtml())); }
private SafeHtml getSafeHtml( final String message ) { final SafeHtmlBuilder shb = new SafeHtmlBuilder(); shb.appendEscaped( message ); return shb.toSafeHtml(); }
/** * Redraw the widget. */ public void redraw() { SafeHtmlBuilder sb = new SafeHtmlBuilder(); cell.render(createContext(), value, sb); getElement().setInnerSafeHtml(sb.toSafeHtml()); /* * The rendered Cell should fill the root element so height and width styles * applied to the widget also apply to the Cell. If there is exactly one * child element, the height and width are set to 100% to fill the parent. */ Element child = getElement().getFirstChildElement(); if (child != null && child.getNextSiblingElement() == null) { child.getStyle().setHeight(100, Unit.PCT); child.getStyle().setWidth(100, Unit.PCT); } }
@Override public void render(Context context, SafeHtml value, SafeHtmlBuilder sb) { if (value != null) { sb.append(SafeHtmlUtils.fromTrustedString("<div title='" + value.asString() + "'>")); sb.append(value); sb.appendHtmlConstant("</div>"); } } });
private static SafeHtml buildItemList(Collection<String> items) { SafeHtmlBuilder itemBuilder = new SafeHtmlBuilder(); for (String i : items) { itemBuilder.append(templates.listItem(SafeHtmlUtils.fromSafeConstant(i))); } return templates.unsignedList(itemBuilder.toSafeHtml()); }
final public class ColumnHeaderFilterCell extends AbstractCell<String> { interface Templates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("<div class=\"headerText\">{0}</div>") SafeHtml text(String value); @SafeHtmlTemplates.Template("<div class=\"headerFilter\"><input type=\"text\" value=\"\"/></div>") SafeHtml filter(); } private static Templates templates = GWT.create(Templates.class); @Override public void render(Context context, String value, SafeHtmlBuilder sb) { if (value == null) { return; } SafeHtml renderedText = templates.text(value); sb.append(renderedText); SafeHtml renderedFilter = templates.filter(); sb.append(renderedFilter); } }
@Override public void setValue(final Double pvalue) { value = pvalue; final double rating = pvalue == null ? 0.0 : pvalue.doubleValue(); final SafeHtmlBuilder stars = new SafeHtmlBuilder(); for (int i = 1; i <= max; i++) { appendStar(stars, i, rating); } panel.getElement().setInnerSafeHtml(stars.toSafeHtml()); }
public void show() { clear(); stackPanel.setHTML(new SafeHtmlBuilder().appendEscapedLines(stack).toSafeHtml()); messageLabel.setText(message); messageLabel.setWordWrap(true); exceptionDialog.setPopupPositionAndShow(new PositionCallback() { @Override public void setPosition(int offsetWidth, int offsetHeight) { exceptionDialog.center(); } }); exceptionDialog.center(); }
public void render(String object, SafeHtmlBuilder appendable) { appendable.append(SafeHtmlUtils.fromString(object)); } }