本文整理汇总了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);
}