本文整理匯總了Java中com.google.gwt.safehtml.shared.SafeHtml.asString方法的典型用法代碼示例。如果您正苦於以下問題:Java SafeHtml.asString方法的具體用法?Java SafeHtml.asString怎麽用?Java SafeHtml.asString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.safehtml.shared.SafeHtml
的用法示例。
在下文中一共展示了SafeHtml.asString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setHTML
import com.google.gwt.safehtml.shared.SafeHtml; //導入方法依賴的package包/類
public void setHTML(SafeHtml html) {
String text = html == null ? null: html.asString();
if (libraryLoaded && (isInitialized() || isInitializing())) {
if (isInitializing()) {
pendingSetHtmlText = html;
addPendingSetHtml();
return;
}
try {
setContent(elementId, text);
} catch (JavaScriptException e) {
// Don't do anything, just allow it to return.
GWT.log("Unable to set the content on the TinyMCE editor.", e);
}
return;
} else {
super.setText(text);
}
}
示例2: render
import com.google.gwt.safehtml.shared.SafeHtml; //導入方法依賴的package包/類
@Override
protected void render(Context context,
SafeHtml data,
SafeHtmlBuilder sb) {
hideAllPopover();
final String content = data.asString();
if (Strings.isNullOrEmpty(content)) {
return;
}
final Element div = DOM.createDiv();
div.setId(DOM.createUniqueId());
div.setInnerHTML(content);
div.getStyle().setOverflow(Style.Overflow.HIDDEN);
div.getStyle().setTextOverflow(Style.TextOverflow.ELLIPSIS);
div.getStyle().setWhiteSpace(Style.WhiteSpace.NOWRAP);
final String html = div.getString();
sb.appendHtmlConstant(html);
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
initPopover(div.getId(),
placement.name().toLowerCase());
}
});
}
示例3: setHTML
import com.google.gwt.safehtml.shared.SafeHtml; //導入方法依賴的package包/類
@Override
public void setHTML (SafeHtml markdown) {
this.markdown = markdown.asString();
getElement().setInnerHTML(getHTML());
}
示例4: add
import com.google.gwt.safehtml.shared.SafeHtml; //導入方法依賴的package包/類
@Override
public ImageListEditorView<T> add(final SafeUri uri, final String width, final String height,
final SafeHtml heading, final SafeHtml text,
final boolean selected, final Command clickCommand) {
final VerticalPanel panel = new VerticalPanel();
panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
panel.setHeight("100%");
final Image image = new Image(uri);
image.setWidth(width);
image.setHeight(height);
image.addStyleName(style.image());
final double alpha = selected ? 1 : 0.2;
image.getElement().setAttribute("style", "filter: alpha(opacity=5);opacity: " + alpha);
final Tooltip tooltip = new Tooltip();
tooltip.setTitle( text.asString() );
tooltip.setWidget(image);
tooltip.setContainer("body");
tooltip.setPlacement(Placement.BOTTOM);
tooltip.setIsAnimated(false);
tooltip.setShowDelayMs(100);
final HTML label = new HTML(heading.asString());
final HorizontalPanel labelPanel = new HorizontalPanel();
labelPanel.setWidth("100%");
labelPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
labelPanel.add(label);
panel.add(tooltip);
panel.add(labelPanel);
mainPanel.add(panel);
image.addClickHandler(e -> {
tooltip.hide();
tooltip.destroy();
clickCommand.execute();
});
return this;
}
示例5: BaseCheckBox
import com.google.gwt.safehtml.shared.SafeHtml; //導入方法依賴的package包/類
/**
* Creates a check box with the specified text label.
*
* @param label the check box's label
*/
public BaseCheckBox(SafeHtml label) {
this(label.asString(), true);
}