本文整理汇总了Java中com.google.gwt.safehtml.shared.SafeHtmlBuilder类的典型用法代码示例。如果您正苦于以下问题:Java SafeHtmlBuilder类的具体用法?Java SafeHtmlBuilder怎么用?Java SafeHtmlBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SafeHtmlBuilder类属于com.google.gwt.safehtml.shared包,在下文中一共展示了SafeHtmlBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createColumnList
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
private ColumnModel<LayerDef> createColumnList(LayerDefProperties props,
RowExpander<LayerDef> rowExpander) {
rowExpander.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
rowExpander.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
ColumnConfig<LayerDef, String> nameColumn = new ColumnConfig<LayerDef, String>(
props.name(), 200, SafeHtmlUtils.fromTrustedString("<b>"
+ UIMessages.INSTANCE.layerManagerToolText() + "</b>"));
nameColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
ColumnConfig<LayerDef, String> typeColumn = new ColumnConfig<LayerDef, String>(
props.type(), 75, UICatalogMessages.INSTANCE.type());
typeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
typeColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
ColumnConfig<LayerDef, ImageResource> iconColumn = new ColumnConfig<LayerDef, ImageResource>(
props.icon(), 32, "");
iconColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
iconColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
iconColumn.setCell(new ImageResourceCell() {
@Override
public void render(Context context, ImageResource value, SafeHtmlBuilder sb) {
super.render(context, value, sb);
}
});
List<ColumnConfig<LayerDef, ?>> columns = new ArrayList<ColumnConfig<LayerDef, ?>>();
columns.add(rowExpander);
columns.add(iconColumn);
columns.add(nameColumn);
columns.add(typeColumn);
return new ColumnModel<LayerDef>(columns);
}
示例2: createRowExpander
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
private RowExpander<VehicleJSO> createRowExpander() {
return new RowExpander<VehicleJSO>(new AbstractCell<VehicleJSO>() {
@Override
public void render(Context context, VehicleJSO value,
SafeHtmlBuilder sb) {
String comment = value.getComments();
if( comment == null) {
comment = UISgfMessages.INSTANCE.noCommentLabel();
}
sb.appendHtmlConstant("<p style='margin: 5px 5px 10px'><b>"
+ UISgfMessages.INSTANCE.commentColumn() + ":</b> "
+ comment + "</p>");
}
});
}
示例3: init
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
protected void init() {
buttonContent = new Span();
buttonImage = new Span();
buttonText = new Span();
solveButton.getElement().setAttribute("class", "btn btn-success");
buttonImage.getElement().setAttribute("class", "glyphicon glyphicon-play");
buttonImage.getElement().setAttribute("aria-hidden", "true");
buttonText.setHTML(new SafeHtmlBuilder()
.appendEscaped(CONSTANTS.format("AbstractRosterViewPanel.solve"))
.toSafeHtml().asString());
buttonContent.add(buttonImage);
buttonContent.add(buttonText);
solveButton.add(buttonContent);
solverObservable.addObserver(this);
}
示例4: initWidget
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
@PostConstruct
protected void initWidget() {
employeeName.setValue(employee.getName());
employeeSkills.removeAll();
CollectionDataset<Skill> data = new CollectionDataset<Skill>(skills) {
@Override
public String getValue(Skill skill) {
return (skill == null) ? "" : skill.getName();
}
};
employeeSkills.setDatasets((Dataset<Skill>) data);
employeeSkills.setItemValue(Skill::getName);
employeeSkills.setItemText(Skill::getName);
employeeSkills.reconfigure();
employeeSkills.add(employee.getSkillProficiencyList().stream()
.map((p) -> p.getSkill())
.collect(Collectors.toList()));
employee.getSkillProficiencyList().stream().map((p) -> p.getSkill())
.forEach((s) -> employeeSkills.add(s));
title.setInnerSafeHtml(new SafeHtmlBuilder().appendEscaped(employee.getName())
.toSafeHtml());
popup = FormPopup.getFormPopup(this);
popup.center();
}
示例5: 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>");
}
示例6: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
/**
* This method provides style for your wrap data
*
*/
public void render(Cell.Context context, WrapString value, SafeHtmlBuilder sb) {
String longString = value.getLongString();
@SuppressWarnings("unused")
String row1Content = longString;
@SuppressWarnings("unused")
String row2Content = null;
int LINE_SIZE = 60;
sb.appendHtmlConstant("<div><table width='100%'>");
while (longString != null && !longString.isEmpty()) {
if (longString.length() <= LINE_SIZE) {
sb.appendHtmlConstant("<tr><td><div>"+longString+"</div></td></tr>");
break;
} else {
sb.appendHtmlConstant("<tr><td><div>"+longString.subSequence(0, LINE_SIZE)+"</div></td></tr>");
longString = longString.substring(LINE_SIZE);
}
}
sb.appendHtmlConstant("</table></div>");
}
示例7: onViewLoaded
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
@Override
public void onViewLoaded() {
personRowAdapter = new TableRowAdapter<Person>(view.getTable(), 4) {
@Override
protected Object getCellContent(int column, Person item) {
switch (column) {
case 0:
return new SafeHtmlBuilder().appendHtmlConstant("<a href=\"#person/").append(item.id).appendHtmlConstant("\">")
.appendEscaped(item.name).appendHtmlConstant("</a>").toSafeHtml();
case 1:
return item.email;
case 2:
return item.phone;
case 3:
return item.city;
}
return null;
}
};
}
示例8: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
@Override
public void render(Context context, SafeHtml data, SafeHtmlBuilder sb) {
final ButtonType type = getType();
final IconType icon = getIcon();
final ButtonSize size = getSize();
final String _title = this.title != null ? " title=\"" + this.title + "\" " : "";
sb.appendHtmlConstant("<button " + _title + " type=\"button\" class=\"btn "
+ (type != null ? type.get() : "") + (size != null ? " " + size.get() : "") + "\" tabindex=\"-1\">");
if (data != null) {
if (icon != null) {
sb.appendHtmlConstant("<i class=\"" + icon.get() + "\"></i> ");
}
sb.append(data);
}
sb.appendHtmlConstant("</button>");
}
示例9: render
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
@Override
public SafeHtml render(KieContainer container) {
final KieImageType type = container.getType();
if (type != null) {
final KieContainerTypeSafeHtmlRenderer r = KieContainerTypeSafeHtmlRenderer.getInstance();
final SafeHtmlBuilder htmlBuilder = new SafeHtmlBuilder();
final SafeHtml typeHtml = r.render(type);
htmlBuilder.append(typeHtml);
final List<KieImageType> subTypes = container.getSubTypes();
if (subTypes != null && !subTypes.isEmpty()) {
for (final KieImageType _suType : subTypes) {
final SafeHtml sbuTypeHtml = r.render(_suType);
htmlBuilder.append(sbuTypeHtml);
}
}
return htmlBuilder.toSafeHtml();
}
return null;
}
示例10: DataPreviewGrid
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
public DataPreviewGrid(TablePreviewModel result) {
List<ColumnConfig<Tuple<Integer, List<String>>, ?>> list = new ArrayList<ColumnConfig<Tuple<Integer, List<String>>, ?>>();
int count = 0;
for (String col : result.getHeaders()) {
ColumnConfig<Tuple<Integer, List<String>>, String> cc = new ColumnConfig<Tuple<Integer, List<String>>, String>(
new MyValueProvider(count), 80, col);
cc.setToolTip(new SafeHtmlBuilder().appendHtmlConstant(col)
.toSafeHtml());
cc.setCell(new TitledCell());
list.add(cc);
count++;
}
getListStore().addAll(result.getData());
ColumnModel<Tuple<Integer, List<String>>> colModel = new ColumnModel<Tuple<Integer, List<String>>>(
list);
grid = new Grid<Tuple<Integer, List<String>>>(getListStore(), colModel);
grid.setHeight(175);
grid.setAllowTextSelection(true);
grid.getView().setAdjustForHScroll(false);
grid.getView().setEmptyText("没有数据!");
}
示例11: 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);
}
示例12: UIEnabledActionCell
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
public UIEnabledActionCell(SafeHtml text, UIVisiblePredicate<T> isVisiblePredicate,
UIEnabledPredicate<T> isEnabledPredicate,
UIEnabledActionCell.Delegate<T> delegate) {
super("click", "keydown");
this.isEnabledPredicate = isEnabledPredicate;
this.isVisiblePredicate = isVisiblePredicate;
this.delegate = delegate;
htmlEnabled = new SafeHtmlBuilder()
.appendHtmlConstant(
"<button class=\"gwt-Button\" type=\"button\" tabindex=\"-1\">").append(text)
.appendHtmlConstant("</button>").toSafeHtml();
htmlDisabled = new SafeHtmlBuilder()
.appendHtmlConstant(
"<button class=\"gwt-Button\" type=\"button\" tabindex=\"-1\" disabled>").append(text)
.appendHtmlConstant("</button>").toSafeHtml();
}
示例13: createStopButton
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
private ActionButton createStopButton(Process process, StopProcessHandler handler) {
final SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder.appendHtmlConstant(FontAwesome.STOP);
final ActionButton button = new ActionButton(safeHtmlBuilder.toSafeHtml());
button.addClickHandler(
event -> {
event.stopPropagation(); // prevent dropdown list from opening/closing
handler.onStopProcess(process);
});
button.ensureDebugId("dropdown-processes-stop");
Tooltip.create((Element) button.getElement(), BOTTOM, MIDDLE, "Stop");
return button;
}
示例14: createRerunButton
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
private ActionButton createRerunButton(Process process, RerunProcessHandler handler) {
final SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder.appendHtmlConstant(FontAwesome.REPEAT);
final ActionButton button = new ActionButton(safeHtmlBuilder.toSafeHtml());
button.addClickHandler(
event -> {
event.stopPropagation(); // prevent dropdown list from opening/closing
handler.onRerunProcess(process);
});
button.ensureDebugId("dropdown-processes-rerun");
Tooltip.create((Element) button.getElement(), BOTTOM, MIDDLE, "Re-run");
return button;
}
示例15: getDisplayString
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; //导入依赖的package包/类
@Override
public String getDisplayString() {
SafeHtmlBuilder builder = new SafeHtmlBuilder();
String label = macro.getName();
int pos = 0;
for (Match highlight : matches) {
if (highlight.getStart() == highlight.getEnd()) {
continue;
}
if (pos < highlight.getStart()) {
appendPlain(builder, label.substring(pos, highlight.getStart()));
}
appendHighlighted(builder, label.substring(highlight.getStart(), highlight.getEnd()));
pos = highlight.getEnd();
}
if (pos < label.length()) {
appendPlain(builder, label.substring(pos));
}
return builder.toSafeHtml().asString();
}