use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project rstudio by rstudio.
the class MarkerSetsToolbarButton method updateAvailableMarkerSets.
public void updateAvailableMarkerSets(String[] sets) {
ToolbarPopupMenu menu = getMenu();
menu.clearItems();
for (final String set : sets) {
// command for selection
Scheduler.ScheduledCommand cmd = new Scheduler.ScheduledCommand() {
@Override
public void execute() {
ValueChangeEvent.fire(MarkerSetsToolbarButton.this, set);
}
};
SafeHtml menuHTML = new SafeHtmlBuilder().appendHtmlConstant(set).toSafeHtml();
menu.addItem(new MenuItem(menuHTML, cmd));
}
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project rstudio by rstudio.
the class SVNStatusRenderer method render.
@Override
public SafeHtml render(String str) {
if (str.length() != 1)
return SafeHtmlUtils.fromString(str);
ImageResource2x img = imgForStatus(str.charAt(0));
if (img == null)
return SafeHtmlUtils.fromString(str);
SafeHtmlBuilder builder = new SafeHtmlBuilder();
builder.append(SafeHtmlUtils.fromTrustedString("<span " + "class=\"" + ctRes_.cellTableStyle().status() + "\" " + "title=\"" + SafeHtmlUtils.htmlEscape(descForStatus(str)) + "\">"));
builder.append(img.getSafeHtml());
builder.appendHtmlConstant("</span>");
return builder.toSafeHtml();
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project kie-wb-common by kiegroup.
the class NotificationMessageUtilsTest method testCanvasValidationMessage.
@Test
public void testCanvasValidationMessage() {
final RuleViolation ruleViolation = mock(RuleViolation.class);
final CanvasViolation canvasViolation = mock(CanvasViolation.class);
when(canvasViolation.getViolationType()).thenReturn(Violation.Type.ERROR);
when(canvasViolation.getRuleViolation()).thenReturn(ruleViolation);
when(ruleViolation.getViolationType()).thenReturn(Violation.Type.ERROR);
when(ruleViolation.getViolationType()).thenReturn(Violation.Type.ERROR);
final Iterable<CanvasViolation> violations = Collections.singletonList(canvasViolation);
when(translationService.getValue(eq("aKey"))).thenReturn("aValue");
when(translationService.getViolationMessage(eq(canvasViolation))).thenReturn("cv1");
String message = NotificationMessageUtils.getCanvasValidationsErrorMessage(translationService, "aKey", violations);
message = new SafeHtmlBuilder().appendEscapedLines(message).toSafeHtml().asString();
assertEquals("aValue." + HTML_NEW_LINE + "R" + COLON + HTML_NEW_LINE + OPEN_BRA + "1" + CLOSE_BRA + "(ERROR) " + "cv1" + HTML_NEW_LINE, message);
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project drools-wb by kiegroup.
the class EnumEditorTextCellTests method testRenderDisabled.
@Test
public void testRenderDisabled() {
context = new Cell.Context(0, 0, new EnumRow("A raw value"));
final SafeHtmlBuilder safeHtmlBuilder = mock(SafeHtmlBuilder.class);
cell.render(context, "Fact", safeHtmlBuilder);
verify(cell, never()).doRender(eq(context), eq("Fact"), eq(safeHtmlBuilder));
verify(safeHtmlBuilder, times(1)).append(safeHtmlArgumentCaptor.capture());
final SafeHtml safeHtml = safeHtmlArgumentCaptor.getValue();
assertEquals("cellContent(disabled, invalidDefinitionDisabled, Fact)", safeHtml.asString());
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project drools-wb by kiegroup.
the class EnumEditorTextCellTests method testRenderEnabled.
@Test
public void testRenderEnabled() {
context = new Cell.Context(0, 0, new EnumRow("Fact", "field", "['a', 'b']"));
final SafeHtmlBuilder sb = mock(SafeHtmlBuilder.class);
cell.render(context, "Fact", sb);
verify(cell, times(1)).doRender(eq(context), eq("Fact"), eq(sb));
}
Aggregations