本文整理匯總了Java中org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java SafeHtmlBuilder類的具體用法?Java SafeHtmlBuilder怎麽用?Java SafeHtmlBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SafeHtmlBuilder類屬於org.waveprotocol.wave.client.common.safehtml包,在下文中一共展示了SafeHtmlBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: outputHtml
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public void outputHtml(SafeHtmlBuilder output) {
String extra = " " + TOTAL_BLIPS_ATTRIBUTE + "='" + totalBlipCount + "'" +
" " + UNREAD_BLIPS_ATTRIBUTE + "='" + unreadBlipCount + "'";
openWith(output, id, css.thread(), TypeCodes.kind(Type.ROOT_THREAD), extra);
{
open(output, Components.BLIPS.getDomId(id), null, TypeCodes.kind(Type.BLIPS));
blips.outputHtml(output);
close(output);
replyBox.outputHtml(output);
continuationIndicator.outputHtml(output);
}
close(output);
}
示例2: outputHtml
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public void outputHtml(SafeHtmlBuilder output) {
String className = css.participant() + " ";
switch(state) {
case NORMAL: className += css.normal(); break;
case ADDED: className += css.added(); break;
case REMOVED: className += css.removed(); break;
}
String name = extractName(participantId);
String title = composeTitle(name, hint);
OutputHelper.image(output, id, className,
EscapeUtils.fromString(avatarUrl),
EscapeUtils.fromString(title),
TypeCodes.kind(Type.PARTICIPANT),
" " + PARTICIPANT_ID_ATTRIBUTE + "='" + participantId + "'");
}
示例3: outputHtml
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public void outputHtml(SafeHtmlBuilder out) {
open(out, id, css.fixedSelf(), TypeCodes.kind(Type.ROOT_CONVERSATION));
{
// Participants
participants.outputHtml(out);
// Toolbar
append(out, Components.TOOLBAR_CONTAINER.getDomId(id), css.toolbar(), null);
// Scroll panel
open(
out, Components.THREAD_CONTAINER.getDomId(id), css.fixedThread(),
TypeCodes.kind(Type.SCROLL_PANEL));
{
thread.outputHtml(out);
}
close(out);
// Tags
tags.outputHtml(out);
}
close(out);
}
示例4: outputHtml
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public void outputHtml(SafeHtmlBuilder out) {
open(out, id, null, TypeCodes.kind(Type.ROOT_CONVERSATION));
{
// Participants
participants.outputHtml(out);
// Toolbar
append(out, Components.TOOLBAR_CONTAINER.getDomId(id), css.toolbar(), null);
// Non-scrollable panel
open(out, Components.THREAD_CONTAINER.getDomId(id), null, null);
{
thread.outputHtml(out);
}
close(out);
// Tags
tags.outputHtml(out);
}
close(out);
}
示例5: render
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public UiBuilder render(final ConversationBlip blip, UiBuilder document,
final IdentityMap<ConversationThread, UiBuilder> anchorUis) {
UiBuilder threadsUi = new UiBuilder() {
@Override
public void outputHtml(SafeHtmlBuilder out) {
for (ConversationThread thread : blip.getReplyThreads()) {
if (thread.isInline()) {
anchorUis.get(thread).outputHtml(out);
}
}
}
};
BlipMetaViewBuilder metaUi = BlipMetaViewBuilder.create(viewIdMapper.metaOf(blip), document);
return BlipViewBuilder.create(viewIdMapper.blipOf(blip), metaUi, threadsUi);
}
示例6: makeTitleHTML
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
private String makeTitleHTML(String title, Pair<Integer, Integer> match,
boolean italic, boolean inBrackets) {
SafeHtmlBuilder html = new SafeHtmlBuilder();
if (italic) {
html.appendHtmlConstant("<i style=\"color: gray\">");
}
if (inBrackets) {
html.appendEscaped("(");
}
if (match == null || match.first == match.second) {
html.appendEscaped(title);
} else {
html.appendEscaped(title.substring(0, match.first));
html.appendHtmlConstant("<b>");
html.appendEscaped(title.substring(match.first, match.second));
html.appendHtmlConstant("</b>");
html.appendEscaped(title.substring(match.second));
}
if (inBrackets) {
html.appendEscaped(")");
}
if (italic) {
html.appendHtmlConstant("</i>");
}
return html.toSafeHtml().asString();
}
示例7: dump
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
void dump(Element timeBox) {
final SafeHtmlBuilder timeHtml = new SafeHtmlBuilder();
timeHtml.appendHtmlConstant("<table cellpadding='0' cellspacing='0'>");
events.each(new ProcV<Integer>() {
@Override
public void apply(String key, Integer value) {
timeHtml.appendHtmlConstant("<tr><td>");
timeHtml.appendEscaped(key);
timeHtml.appendHtmlConstant(":</td><td>");
timeHtml.appendEscaped("" + value);
timeHtml.appendHtmlConstant("</td></tr>");
}
});
timeHtml.appendHtmlConstant("</table>");
timeBox.setInnerHTML(timeHtml.toSafeHtml().asString());
}
示例8: outputHtml
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public void outputHtml(SafeHtmlBuilder output) {
// HACK HACK HACK
// This code should be automatically generated from UiBinder template, not
// hand written.
open(output, id, css.blip(), TypeCodes.kind(Type.BLIP));
// Meta (no wrapper).
meta.outputHtml(output);
// Replies.
open(output, Components.REPLIES.getDomId(id), css.replies(), null);
replies.outputHtml(output);
close(output);
// Private Replies.
open(output, Components.PRIVATE_REPLIES.getDomId(id), css.privateReplies(), null);
privateReplies.outputHtml(output);
close(output);
close(output);
}
示例9: menuBuilder
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
/**
* Creates a builder for a blip menu.
*/
public static UiBuilder menuBuilder(final Set<MenuOption> options, final Set<MenuOption> selected,
final BlipViewBuilder.Css css) {
return new UiBuilder() {
@Override
public void outputHtml(SafeHtmlBuilder out) {
for (MenuOption option : options) {
out.append(EscapeUtils.fromSafeConstant("|"));
String style = selected.contains(option) //
? css.menuOption() + css.menuOptionSelected() : css.menuOption();
String extra = OPTION_ID_ATTRIBUTE + "='" + MENU_CODES.get(option).asString() + "'"
+ (selected.contains(option) ? " " + OPTION_SELECTED_ATTRIBUTE + "='s'" : "");
openSpanWith(out, null, style, TypeCodes.kind(Type.MENU_ITEM), extra);
out.append(MENU_LABELS.get(option));
closeSpan(out);
}
}
};
}
示例10: render
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public UiBuilder render(final ConversationThread thread,
final IdentityMap<ConversationBlip, UiBuilder> blipUis) {
HtmlClosure blipsUi = new HtmlClosure() {
@Override
public void outputHtml(SafeHtmlBuilder out) {
for (ConversationBlip blip : thread.getBlips()) {
UiBuilder blipUi = blipUis.get(blip);
// Not all blips are rendered.
if (blipUi != null) {
blipUi.outputHtml(out);
}
}
}
};
String threadId = viewIdMapper.threadOf(thread);
String replyIndicatorId = viewIdMapper.replyIndicatorOf(thread);
UiBuilder builder = null;
if (thread.getConversation().getRootThread() == thread) {
ReplyBoxViewBuilder replyBoxBuilder =
ReplyBoxViewBuilder.create(replyIndicatorId);
builder = RootThreadViewBuilder.create(threadId, blipsUi, replyBoxBuilder);
} else {
ContinuationIndicatorViewBuilder indicatorBuilder = ContinuationIndicatorViewBuilder.create(
replyIndicatorId);
InlineThreadViewBuilder inlineBuilder =
InlineThreadViewBuilder.create(threadId, blipsUi, indicatorBuilder);
int read = readMonitor.getReadCount(thread);
int unread = readMonitor.getUnreadCount(thread);
inlineBuilder.setTotalBlipCount(read + unread);
inlineBuilder.setUnreadBlipCount(unread);
builder = inlineBuilder;
}
return builder;
}
示例11: setAvatars
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
@Override
public void setAvatars(Iterable<Profile> profiles) {
SafeHtmlBuilder html = new SafeHtmlBuilder();
for (Profile profile : profiles) {
renderAvatar(html, profile);
}
avatars.setInnerHTML(html.toSafeHtml().asString());
}
示例12: renderUnreadMessages
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
private SafeHtml renderUnreadMessages(int unread, int total) {
SafeHtmlBuilder html = new SafeHtmlBuilder();
html.appendHtmlConstant("<span class='" + css.unreadCount() + "'>");
html.appendHtmlConstant(String.valueOf(unread));
html.appendHtmlConstant("</span>");
html.appendHtmlConstant(" " + messages.of(total));
return html.toSafeHtml();
}
示例13: renderAvatar
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
private void renderAvatar(SafeHtmlBuilder html, Profile profile) {
// URL is trusted to be attribute safe (i.e., no ' or ")
String name = profile.getFullName();
html.appendHtmlConstant("<img class='" + css.avatar() + "' src='");
html.appendHtmlConstant(profile.getImageUrl());
html.appendHtmlConstant("' alt='");
html.appendEscaped(name);
html.appendHtmlConstant("' title='");
html.appendEscaped(name);
html.appendHtmlConstant("'>");
}
示例14: of
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
public static UiBuilder of(final SafeHtml html) {
return new UiBuilder() {
@Override
public void outputHtml(SafeHtmlBuilder out) {
out.append(html);
}
};
}
示例15: image
import org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder; //導入依賴的package包/類
/**
* Appends an image.
*
* @param builder
* @param id
* @param style
* @param url attribute-value safe URL
* @param info attribute-value safe image information
* @param kind
* @param extra additional HTML
*/
public static void image(
SafeHtmlBuilder builder, String id, String style, SafeHtml url, SafeHtml info, String kind,
String extra) {
String safeUrl = url != null ? EscapeUtils.sanitizeUri(url.asString()) : null;
StringBuilder s = new StringBuilder();
s.append("<img ");
if (id != null) {
s.append("id='").append(id).append("' ");
}
if (style != null) {
s.append("class='").append(style).append("' ");
}
if (safeUrl != null) {
s.append("src='").append(safeUrl).append("' ");
}
if (info != null) {
s.append("alt='").append(info.asString()).append("' title='")
.append(info.asString()).append("' ");
}
if (kind != null) {
s.append(KIND_ATTRIBUTE).append("='").append(kind).append("'");
}
if (extra != null) {
s.append(extra);
}
s.append("></img>");
builder.appendHtmlConstant(s.toString());
}