Refine search
/** * @see BidiFormatter#spanWrap(String, boolean, boolean) * * @param html The input html * @param dirReset Whether to append a trailing unicode bidi mark matching the * context direction, when needed, to prevent the possible garbling * of whatever may follow {@code html} * @return Input html after applying the above processing. */ public SafeHtml spanWrap(SafeHtml html, boolean dirReset) { return SafeHtmlUtils.fromTrustedString( spanWrapBase(html.asString(), true, dirReset)); }
public void render(String object, SafeHtmlBuilder appendable) { appendable.append(SafeHtmlUtils.fromString(object)); } }
/** * Creates a stamper that will be use the given token, which is assumed * to be unique and will be escaped before being used. */ public RenderableStamper(String token) { this.token = SafeHtmlUtils.htmlEscape(token); }
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()); }
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(); }
@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()); 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>");
loginTitle.getElement().setInnerSafeHtml( SafeHtmlUtils.fromSafeConstant(Utils.messages.loginTitle())); loginButton.addStyleName(Utils.kaaAdminStyle.loginButton()); loginTable.setWidget(3, 2, loginButton); loginButton.getElement().getStyle().setMarginTop(15, Unit.PX);
public static String formatErrorMessages(List<String> values) { if (values.size() == 1) { return values.get(0); } SafeHtmlBuilder allSb = new SafeHtmlBuilder(); allSb.append(SafeHtmlUtils.fromTrustedString("<br/><br/>")); //$NON-NLS-1$ SafeHtml sh = buildItemList(values); allSb.append(sh); return allSb.toSafeHtml().asString(); }
@Override public String getValue() { return SafeHtmlUtils.fromString(header.getElement().getInnerHTML()).asString(); } }
@Override public void setValue(String value, boolean fireEvents) { value = SafeHtmlUtils.fromString(value).asString(); getElement().setInnerText(value); super.setValue(value, fireEvents); }
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()); }
@Override public String getValue() { return SafeHtmlUtils.fromString(getElement().getInnerText()).asString(); }
@Override public void render(Context context, ComparableImageResource value, SafeHtmlBuilder sb) { if (value != null) { // The template will sanitize the URI. sb.append(SafeHtmlUtils.fromTrustedString(value.getImageHTML())); } } }
/** * Insert custom text inside the note zone. */ protected void insertText(Element e, String text) { $(e).materialnote("insertText", SafeHtmlUtils.fromString(text).asString()); }
protected IsWidget createMacColumn(VmNetworkInterface networkInterface) { Column column = new Column(ColumnSize.SM_4); column.addStyleName(VM_NIC_OVERFLOW); DListElement dl = Document.get().createDLElement(); SafeHtml mac = SafeHtmlUtils.fromString(networkInterface.getMacAddress()); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), mac, dl); column.getElement().appendChild(dl); WidgetTooltip tooltip = new WidgetTooltip(column); tooltip.setHtml(mac); return tooltip; }
@Override public void setText(String text) { getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(text)); } }
public SafeHtml createDivStart(String title, String defaultValue, String cssClasses) { if (title == null || "".equals(title)) { title = defaultValue; } final String css = cssClasses == null ? "" : "class=\"" + cssClasses + "\""; return SafeHtmlUtils.fromTrustedString("<div title=\"" + SafeHtmlUtils.htmlEscape(title.trim()) + "\" " + css + " >"); }
/** * Construct a new {@link ActionCell} with a text String that does not contain * HTML markup. * * @param text the text to display on the button * @param delegate the delegate that will handle events */ public ActionCell(String text, Delegate<C> delegate) { this(SafeHtmlUtils.fromString(text), delegate); }
/** * Return the HTML as a {@link SafeHtml} string. */ public SafeHtml asSafeHtml() { // End all open tags. endAllTags(); /* * sb is trusted because we only append trusted strings or escaped strings * to it. */ return SafeHtmlUtils.fromTrustedString(sb.toString()); }
@Override public void render(Context context, T value, SafeHtmlBuilder sb, String id) { Icon icon = new Icon(); icon.setId(id); StyleHelper.addEnumStyleName(icon, iconType); icon.addStyleName(isEnabled(value) ? "icon-enabled" : "icon-disabled"); //$NON-NLS-1$ //$NON-NLS-2$ sb.append(SafeHtmlUtils.fromSafeConstant(icon.toString())); } }