本文整理汇总了Java中com.google.gwt.safehtml.shared.SafeHtmlBuilder.appendEscaped方法的典型用法代码示例。如果您正苦于以下问题:Java SafeHtmlBuilder.appendEscaped方法的具体用法?Java SafeHtmlBuilder.appendEscaped怎么用?Java SafeHtmlBuilder.appendEscaped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.safehtml.shared.SafeHtmlBuilder
的用法示例。
在下文中一共展示了SafeHtmlBuilder.appendEscaped方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Context context, TemplateInfo template, SafeHtmlBuilder sb) {
if (template == null)
return;
sb.appendHtmlConstant("<table>");
// Add the thumbnail image, if available, or a default image.
sb.appendHtmlConstant("<tr><td rowspan='3'>");
if ( !template.thumbStr.equals("") ) {
String src = hostUrl + TEMPLATES_ROOT_DIRECTORY + template.name + "/" + template.thumbStr;
sb.appendHtmlConstant("<img style='width:32px' src='" + src + "'>");
} else {
ImageResource imgResource = Ode.getImageBundle().appInventorLogo();
Image img = new Image(imgResource);
String url = img.getUrl();
sb.appendHtmlConstant("<img style='width:32px' src='" + url + "'>");
}
sb.appendHtmlConstant("</td>");
// Add the name and description.
sb.appendHtmlConstant("<td style='font-size:95%;'>");
sb.appendEscaped(template.name);
sb.appendHtmlConstant("</td></tr><tr><td>");
sb.appendEscaped(template.subtitle);
sb.appendHtmlConstant("</td></tr></table>");
}
示例2: onResponse
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
public void onResponse(String greet, String info, String agent) {
SafeHtmlBuilder builder = new SafeHtmlBuilder();
builder.appendEscaped(greet);
builder.appendHtmlConstant("<br><br>I am running ");
builder.appendEscaped(info);
builder.appendHtmlConstant(".<br><br>It looks like you are using:<br>");
builder.appendEscaped(agent);
dialogBox.setText("Remote Procedure Call");
dialogBox.center();
serverResponseLabel.removeStyleName(greetingCss.error());
serverResponseLabel.setHTML(builder.toSafeHtml());
closeButton.setFocus(true);
}
示例3: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Element itemElement, StackFrameDump itemData) {
TableCellElement label = Elements.createTDElement();
SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendEscaped(itemData.getLocation().getMethod().getName());
sb.appendEscaped("(");
List<? extends Variable> arguments = itemData.getLocation().getMethod().getArguments();
for (int i = 0; i < arguments.size(); i++) {
String type = arguments.get(i).getType();
sb.appendEscaped(type.substring(type.lastIndexOf(".") + 1));
if (i != arguments.size() - 1) {
sb.appendEscaped(", ");
}
}
sb.appendEscaped("):");
sb.append(itemData.getLocation().getLineNumber());
sb.appendEscaped(", ");
Path path = Path.valueOf(itemData.getLocation().getTarget());
String className;
if (path.isAbsolute()) {
className = path.removeFileExtension().lastSegment();
} else {
className = path.lastSegment();
}
sb.appendEscaped(className);
label.setInnerHTML(sb.toSafeHtml().asString());
itemElement.appendChild(label);
}
示例4: getDisplayString
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public String getDisplayString() {
int start = 0;
int keyLen = keyword.length();
SafeHtmlBuilder builder = new SafeHtmlBuilder();
for (; ; ) {
int index = value.indexOf(keyword, start);
if (index == -1) {
builder.appendEscaped(value.substring(start));
break;
}
builder.appendEscaped(value.substring(start, index));
builder.appendHtmlConstant("<strong>");
start = index + keyLen;
builder.appendEscaped(value.substring(index, start));
builder.appendHtmlConstant("</strong>");
}
return builder.toSafeHtml().asString();
}
示例5: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Context context, Term term, SafeHtmlBuilder sb) {
if(term != null) {
sb.appendHtmlConstant("<span class=\"codelist-term\">");
sb.appendEscaped(term.getName());
sb.appendHtmlConstant("</span>");
}
}
示例6: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Context context, EntityInfo value, SafeHtmlBuilder sb) {
// Value can be null, so do a null check..
if (value == null) {
return;
}
// sb.appendHtmlConstant("<table><tr><td style='font-size:95%;'>");
sb.appendHtmlConstant("<a class='gwt-Anchor' href='javascript:'>");
sb.appendEscaped( value.getName() );
sb.appendHtmlConstant("</a>");
// sb.appendHtmlConstant("</td></tr></table>");
}
示例7: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Cell.Context context,
SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div style='position: relative; cursor: pointer; padding: 0px;'>");
sb.appendHtmlConstant("<span style='padding-right: 10px'>");
sb.appendEscaped(text);
sb.appendHtmlConstant("</span>");
// sb.appendHtmlConstant("<div style='position:absolute;right:0px;top:0px;'></div>");
switch (sortDirection) {
case NONE:
// nothing
break;
case ASCENDING:
sb.appendHtmlConstant(sortIndex == 0 ? UP_ARROW : SMALL_UP_ARROW);
break;
case DESCENDING:
sb.appendHtmlConstant(sortIndex == 0 ? DOWN_ARROW : SMALL_DOWN_ARROW);
break;
default:
throw new IllegalArgumentException("Unknown sortDirection ("
+ sortDirection
+ ").");
}
sb.appendHtmlConstant("</div>");
// sb.appendHtmlConstant("<div>");
// sb.appendHtmlConstant("</div></div>");
}
示例8: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Context context, DataSourcePageRow dsRow, SafeHtmlBuilder sb) {
// Value can be null, so do a null check..
if (dsRow == null) {
return;
}
String statusImageHtml = null;
if(dsRow.getState()==DataSourcePageRow.State.OK) {
statusImageHtml = this.okImageHtml;
} else if(dsRow.getState()==DataSourcePageRow.State.DEPLOYING) {
statusImageHtml = this.deployingImageHtml;
} else if(dsRow.getState()==DataSourcePageRow.State.PLACEHOLDER) {
statusImageHtml = Constants.BLANK;
} else if(dsRow.getState()==DataSourcePageRow.State.NO_MATCHING_VDB){
statusImageHtml = this.yellowBulletImageHtml;
} else {
statusImageHtml = this.errorImageHtml;
}
String dType = dsRow.getType();
String dTypeImageHtml = Constants.BLANK;
if(dType!=null) {
dTypeImageHtml = ImageHelper.getInstance().getDataSourceForTypeSmallImageHtml(dType);
}
sb.appendHtmlConstant("<table>");
// Add the contact image.
sb.appendHtmlConstant("<tr><td>");
sb.appendHtmlConstant(statusImageHtml);
sb.appendHtmlConstant("</td>");
sb.appendHtmlConstant("<td style=\"width:72px;height:42px;padding: 2px 0px 0px 2px;\">");
sb.appendHtmlConstant(dTypeImageHtml);
sb.appendHtmlConstant("</td>");
// Add the name and address.
sb.appendHtmlConstant("<td style=\"width:3px;\"></td><td><em>");
sb.appendEscaped(dsRow.getName());
sb.appendHtmlConstant("</em></td></tr></table>");
}
示例9: appendPlain
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
private void appendPlain(SafeHtmlBuilder builder, String text) {
builder.appendEscaped(text);
}
示例10: appendHighlighted
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
private void appendHighlighted(SafeHtmlBuilder builder, String text) {
builder.appendHtmlConstant(
"<span class=\"" + resources.coreCss().foundPhraseHighlight() + "\">");
builder.appendEscaped(text);
builder.appendHtmlConstant("</span>");
}
示例11: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Element itemElement, QuickOpenEntry itemData) {
Element label = Elements.createSpanElement(css.proposalLabel());
Element icon = Elements.createSpanElement(css.proposalIcon());
Element group = Elements.createSpanElement(css.proposalGroup());
SafeHtmlBuilder builder = new SafeHtmlBuilder();
List<Match> highlights = itemData.getHighlights();
String text = itemData.getLabel();
int pos = 0;
SpanElement spanElement = Elements.createSpanElement();
for (Match highlight : highlights) {
if (highlight.getStart() == highlight.getEnd()) {
continue;
}
if (pos < highlight.getStart()) {
builder.appendHtmlConstant("<span>");
builder.appendEscaped(text.substring(pos, highlight.getStart()));
builder.appendHtmlConstant("</span>");
}
builder.appendHtmlConstant(
"<span class=\""
+ languageServerResources.quickOpenListCss().searchMatch()
+ "\">");
builder.appendEscaped(text.substring(highlight.getStart(), highlight.getEnd()));
builder.appendHtmlConstant("</span>");
pos = highlight.getEnd();
}
if (pos < text.length()) {
builder.appendHtmlConstant("<span>");
builder.appendEscaped(text.substring(pos));
builder.appendHtmlConstant("</span>");
}
spanElement.setInnerHTML(builder.toSafeHtml().asString());
label.getStyle().setPaddingLeft("5px");
label.getStyle().setPaddingRight("5px");
if (itemData.getIcon() != null) {
SVGImage svgImage = new SVGImage(itemData.getIcon());
icon.appendChild((elemental.dom.Node) svgImage.getElement());
itemElement.appendChild(icon);
}
if (itemData instanceof QuickOpenEntryGroup) {
QuickOpenEntryGroup entryGroup = (QuickOpenEntryGroup) itemData;
if (entryGroup.isWithBorder()) {
Elements.addClassName(
languageServerResources.quickOpenListCss().groupSeparator(), itemElement);
}
if (entryGroup.getGroupLabel() != null) {
group.setInnerText(entryGroup.getGroupLabel());
}
} else {
if (itemData.getDescription() != null) {
group.setInnerText(itemData.getDescription());
}
}
label.appendChild(spanElement);
itemElement.appendChild(label);
itemElement.appendChild(group);
}
示例12: appendHighlighted
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
private void appendHighlighted(SafeHtmlBuilder builder, String text) {
builder.appendHtmlConstant("<span class=\"" + resources.css().codeassistantHighlight() + "\">");
builder.appendEscaped(text);
builder.appendHtmlConstant("</span>");
}
示例13: appendDetail
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
private void appendDetail(SafeHtmlBuilder builder, String text) {
builder.appendHtmlConstant(" <span class=\"" + resources.css().codeassistantDetail() + "\">");
builder.appendEscaped(text);
builder.appendHtmlConstant("</span>");
}
示例14: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render(Element itemElement, DebuggerView.ActiveBreakpointWrapper breakpointWrapper) {
Breakpoint breakpoint = breakpointWrapper.getBreakpoint();
BreakpointConfiguration conf = breakpoint.getBreakpointConfiguration();
BreakpointResources.Css css = breakpointResources.getCss();
TableCellElement label = Elements.createTDElement();
SafeHtmlBuilder sb = new SafeHtmlBuilder();
// Add icon
sb.appendHtmlConstant("<table><tr><td>");
sb.appendHtmlConstant("<div class=\"");
if (!breakpoint.isEnabled()) {
sb.appendHtmlConstant(css.breakpoint() + " " + css.disabled());
} else if (breakpointWrapper.isActive()) {
sb.appendHtmlConstant(css.breakpoint() + " " + css.active());
} else {
sb.appendHtmlConstant(css.breakpoint() + " " + css.inactive());
}
sb.appendHtmlConstant("\" style=\"height: 14px; width: 14px; text-align: center\"");
sb.appendHtmlConstant(
" id=\""
+ breakpoint.getLocation().getTarget()
+ ":"
+ breakpoint.getLocation().getLineNumber()
+ "\">");
boolean hasCondition =
conf != null
&& ((conf.isConditionEnabled() && !isNullOrEmpty(conf.getCondition()))
|| (conf.isHitCountEnabled() && conf.getHitCount() != 0));
if (hasCondition) {
sb.appendHtmlConstant("?");
}
sb.appendHtmlConstant("</div>");
sb.appendHtmlConstant("</td>");
// Add title
sb.appendHtmlConstant("<td>");
String path = breakpoint.getLocation().getTarget();
sb.appendEscaped(
path.substring(path.lastIndexOf("/") + 1)
+ ":"
+ String.valueOf(breakpoint.getLocation().getLineNumber()));
sb.appendHtmlConstant("</td></tr></table>");
label.setInnerHTML(sb.toSafeHtml().asString());
itemElement.appendChild(label);
}
示例15: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入方法依赖的package包/类
@Override
public void render (Context context, String value, SafeHtmlBuilder sb) {
if (value != null) {
sb.appendHtmlConstant("<img ");
if (classNames != null) {
sb.appendHtmlConstant("class=\"");
boolean first = true;
for (String className : classNames) {
if (first) {
first = false;
} else {
sb.appendHtmlConstant(" ");
}
sb.appendEscaped(className);
}
sb.appendHtmlConstant("\" ");
}
sb.appendHtmlConstant("style=\"object-fit: cover;\" ");
if (width != null) {
sb.appendHtmlConstant("width=\"");
sb.appendEscaped(width.toString());
sb.appendEscaped("px");
sb.appendHtmlConstant("\" ");
}
if (height != null) {
sb.appendHtmlConstant("height=\"");
sb.appendEscaped(height.toString());
sb.appendEscaped("px");
sb.appendHtmlConstant("\" ");
}
sb.appendHtmlConstant("src=\"");
sb.append(SafeHtmlUtils.fromString(value));
sb.appendHtmlConstant("\">");
}
}