本文整理汇总了Java中org.waveprotocol.wave.client.common.safehtml.EscapeUtils.fromSafeConstant方法的典型用法代码示例。如果您正苦于以下问题:Java EscapeUtils.fromSafeConstant方法的具体用法?Java EscapeUtils.fromSafeConstant怎么用?Java EscapeUtils.fromSafeConstant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.waveprotocol.wave.client.common.safehtml.EscapeUtils
的用法示例。
在下文中一共展示了EscapeUtils.fromSafeConstant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleParticipantClicked
import org.waveprotocol.wave.client.common.safehtml.EscapeUtils; //导入方法依赖的package包/类
/**
* Shows a participation profileUi for the clicked participant.
*/
private void handleParticipantClicked(Element context) {
ParticipantView participantView = views.asParticipant(context);
Pair<Conversation, ParticipantId> participation = models.getParticipant(participantView);
Profile profile = profiles.getProfile(participation.second);
// Summon a popup view from a participant, and attach profile-popup logic to
// it.
ProfilePopupView profileView = participantView.showParticipation();
final Conversation conversation = participation.getFirst();
final ParticipantId participantId = participation.getSecond();
boolean isRemoved = ParticipantState.REMOVED.equals(participantView.getState());
SafeHtml buttonText = EscapeUtils.fromSafeConstant(isRemoved ? messages.close()
: messages.remove());
Command buttonCommand = isRemoved ? null : new Command() {
@Override
public void execute() {
conversation.removeParticipant(participantId);
markAsRead();
}
};
ProfilePopupPresenter profileUi = ProfilePopupPresenter.create(profile, profileView, profiles,
(ObservableConversation) conversation, buttonText, buttonCommand);
profileUi.show();
}
示例2: gwtSetUp
import org.waveprotocol.wave.client.common.safehtml.EscapeUtils; //导入方法依赖的package包/类
@Override
protected void gwtSetUp() {
SafeHtml dom = EscapeUtils.fromSafeConstant("" + // \u2620
"<div id='base' kind='base'>" + // \u2620
" <div>" + // \u2620
" <div kind='foo' id='foo'>" + // \u2620
" <div kind='unused'>" + // \u2620
" <div kind='bar' id='bar'>" + // \u2620
" <div id='source'></div>" + // \u2620
" </div>" + // \u2620
" </div>" + // \u2620
" </div>" + // \u2620
" </div>" + // \u2620
"</div>");
top = load(dom);
foo = Document.get().getElementById("foo");
bar = Document.get().getElementById("bar");
// Register some handlers.
handlers = new MockHandlers(top);
fooHandler = new MyHandler();
barHandler = new MyHandler();
handlers.register("foo", fooHandler);
handlers.register("bar", barHandler);
}
示例3: image
import org.waveprotocol.wave.client.common.safehtml.EscapeUtils; //导入方法依赖的package包/类
/**
* Appends an image.
*
* @param url attribute-value safe URL
* @param info attribute-value safe image information
* @param style
*/
public static void image(
SafeHtmlBuilder builder, String id, String style, SafeHtml url, SafeHtml info, String kind) {
String safeUrl = url != null ? EscapeUtils.sanitizeUri(url.asString()) : null;
SafeHtml img = EscapeUtils.fromSafeConstant("<img " //
+ "id='" + id + "' " //
+ "class='" + style + "' " //
+ (safeUrl != null ? "src='" + safeUrl + "' " : "") //
+ (info != null ? " alt='" + info.asString() + "' title='" + info.asString() + "' " : "") //
+ (kind != null ? " " + KIND_ATTRIBUTE + "='" + kind + "'" : "") //
+ "></img>");
builder.append(img);
}