List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromString
public static SafeHtml fromString(String s)
From source file:com.sencha.gxt.explorer.client.grid.WordWrapGridExample.java
License:sencha.com license
private SafeHtml wrapString(String untrustedString) { SafeHtml escapedString = SafeHtmlUtils.fromString(untrustedString); SafeHtml safeHtml = SafeHtmlUtils/*from w w w . j a v a 2 s . c o m*/ .fromTrustedString("<span style='white-space: normal;'>" + escapedString.asString() + "</span>"); return safeHtml; }
From source file:com.sencha.gxt.theme.base.client.field.TextAreaDefaultAppearance.java
License:sencha.com license
@Override public void render(SafeHtmlBuilder sb, String value, FieldAppearanceOptions options) { int width = options.getWidth(); int height = options.getHeight(); boolean empty = false; String name = options.getName() != null ? " name='" + options.getName() + "' " : ""; String disabled = options.isDisabled() ? " disabled=true" : ""; String ro = options.isReadonly() ? " readonly" : ""; String placeholder = options.getEmptyText() != null ? " placeholder='" + SafeHtmlUtils.htmlEscape(options.getEmptyText()) + "' " : ""; if ((value == null || value.equals("")) && options.getEmptyText() != null) { if (GXT.isIE8() || GXT.isIE9()) { value = options.getEmptyText(); }/*from w w w . j a v a2 s. co m*/ empty = true; } if (width == -1) { width = 150; } String inputStyles = ""; String wrapStyles = ""; Size adjusted = adjustTextAreaSize(width, height); if (width != -1) { wrapStyles += "width:" + width + "px;"; width = adjusted.getWidth(); inputStyles += "width:" + width + "px;"; } if (height != -1) { height = adjusted.getHeight(); inputStyles += "height: " + height + "px;"; } String cls = style.area() + " " + style.field(); if (empty) { cls += " " + style.empty(); } if (options instanceof TextAreaCellOptions) { TextAreaCellOptions opts = (TextAreaCellOptions) options; inputStyles += "resize:" + opts.getResizable().name().toLowerCase() + ";"; } sb.appendHtmlConstant("<div style='" + wrapStyles + "' class='" + style.wrap() + "'>"); sb.appendHtmlConstant("<textarea " + name + disabled + " style='" + inputStyles + "' type='text' class='" + cls + "'" + ro + placeholder + ">"); sb.append(SafeHtmlUtils.fromString(value)); sb.appendHtmlConstant("</textarea></div>"); }
From source file:com.sencha.gxt.theme.base.client.grid.GridBaseAppearance.java
License:sencha.com license
@Override public SafeHtml renderEmptyContent(String emptyText) { return Util.isEmptyString(emptyText) ? Util.NBSP_SAFE_HTML : SafeHtmlUtils.fromString(emptyText); }
From source file:com.sencha.gxt.theme.base.client.progress.ProgressBarDefaultAppearance.java
License:sencha.com license
@Override public void render(SafeHtmlBuilder sb, Double value, ProgressBarAppearanceOptions options) { value = value == null ? 0 : value;/*from ww w .jav a2s . c o m*/ double valueWidth = value * options.getWidth(); int vw = new Double(valueWidth).intValue(); String text = options.getProgressText(); if (text != null) { int v = (int) Math.round(value * 100); text = Format.substitute(text, v); } SafeHtml txt = Util.isEmptyString(text) ? Util.NBSP_SAFE_HTML : SafeHtmlUtils.fromString(text); int adj = GXT.isIE() ? 4 : 2; SafeStyles wrapStyles = SafeStylesUtils.fromTrustedString("width:" + (options.getWidth() - adj) + "px;"); SafeStyles progressBarStyles = SafeStylesUtils.fromTrustedString("width:" + vw + "px;"); SafeStyles progressTextStyles = SafeStylesUtils.fromTrustedString("width:" + Math.max(vw - 8, 0) + "px;"); SafeStyles widthStyles = SafeStylesUtils .fromTrustedString("width:" + (Math.max(0, options.getWidth() - adj)) + "px;"); sb.append(template.render(txt, style, wrapStyles, progressBarStyles, progressTextStyles, widthStyles)); }
From source file:com.sencha.gxt.widget.core.client.box.AlertMessageBox.java
License:sencha.com license
/** * Creates a message box with an error icon and the specified title and * message./*w ww. j a v a2s . c om*/ * * @param headingText the text to display for the message box heading * @param messageText the text to display in the message box */ public AlertMessageBox(String headingText, String messageText) { this(SafeHtmlUtils.fromString(headingText), SafeHtmlUtils.fromString(messageText)); }
From source file:com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox.java
License:sencha.com license
/** * Creates a progress message box with the specified heading HTML. The * progress bar auto-updates using the current duration, increment, and * interval (see {@link #getProgressBar()}. * * @param headingText the text to display for the message box heading. */// w ww . java 2s . c om public AutoProgressMessageBox(String headingText) { this(SafeHtmlUtils.fromString(headingText), SafeHtmlUtils.EMPTY_SAFE_HTML); }
From source file:com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox.java
License:sencha.com license
/** * Creates a progress message box with the specified heading and message HTML. * The progress bar auto-updates using the current duration, increment, and * interval (see {@link #getProgressBar()}. * * @param headingText the text to display for the message box heading * @param messageText the text to display in the message box *//*w w w . j av a2s .co m*/ public AutoProgressMessageBox(String headingText, String messageText) { this(SafeHtmlUtils.fromString(headingText), SafeHtmlUtils.fromString(messageText)); }
From source file:com.sencha.gxt.widget.core.client.box.ConfirmMessageBox.java
License:sencha.com license
/** * Creates a message box that prompts for confirmation with YES and NO * buttons.//from w w w . j av a 2 s .c om * * @param titleText the title of the message box * @param messageText the message that appears in the message box */ public ConfirmMessageBox(String titleText, String messageText) { this(SafeHtmlUtils.fromString(titleText), SafeHtmlUtils.fromString(messageText)); }
From source file:com.sencha.gxt.widget.core.client.box.MessageBox.java
License:sencha.com license
/** * Creates a message box with the specified heading text. * * @param headingText the text to display for the message box heading. *///from ww w . j a v a 2s .c o m public MessageBox(String headingText) { this(SafeHtmlUtils.fromString(headingText), SafeHtmlUtils.EMPTY_SAFE_HTML); }
From source file:com.sencha.gxt.widget.core.client.box.MessageBox.java
License:sencha.com license
/** * Creates a message box with the specified heading and message text. * * @param headingText the text to display for the message box heading * @param messageText the text to display in the message box *//*w ww . j ava 2 s. c o m*/ public MessageBox(String headingText, String messageText) { this(SafeHtmlUtils.fromString(headingText), SafeHtmlUtils.fromString(messageText), GWT.<WindowAppearance>create(WindowAppearance.class), GWT.<MessageBoxAppearance>create(MessageBoxAppearance.class)); }