use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.
the class ChangeDetailsViewImpl method setDiff.
@Override
public void setDiff(List<DiffElement<String, SafeHtml>> diff, int totalChanges) {
diffView.setDiff(diff, lineElement -> lineElement, document -> new SafeHtmlBuilder().appendHtmlConstant(document).toSafeHtml());
if (diff.size() < totalChanges) {
tooManyChangesMessage.setText(messages.showing() + " " + format(diff.size()) + " " + messages.pagination_of() + " " + format(totalChanges) + " " + messages.change_changes());
tooManyChangesMessage.setVisible(true);
int hiddenChanges = totalChanges - diff.size();
hiddenChangesCount.setText(messages.plus() + " " + format(hiddenChanges) + " " + messages.change_moreChangesNotShownHere());
hiddenChangesCount.setVisible(true);
} else {
tooManyChangesMessage.setVisible(false);
hiddenChangesCount.setVisible(false);
}
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.
the class DiffViewImpl method setDiff.
@Override
public <S extends Serializable, E extends Serializable> void setDiff(List<DiffElement<S, E>> diff, DiffLineElementRenderer<E> renderer, DiffSourceDocumentRenderer<S> sourceDocumentRenderer) {
StringBuilder sb = new StringBuilder();
for (DiffElement<S, E> element : diff) {
DiffOperation op = element.getDiffOperation();
DiffClientBundle.DiffCssResource style = DiffClientBundle.INSTANCE.style();
String operationStyle = op == DiffOperation.ADD ? style.add() : style.remove();
sb.append("<div class=\"").append(style.line()).append(" ").append(operationStyle).append("\">");
renderBulletSpan(sb, op);
renderSourceDocumentSpan(sb, element.getSourceDocument(), sourceDocumentRenderer);
sb.append("<div class=\" " + style.lineElement() + " \">");
sb.append(renderer.getRendering(element.getLineElement()).asString());
sb.append("</div>");
sb.append("</div>");
}
diffRendering.setHTML(new SafeHtmlBuilder().appendHtmlConstant(sb.toString()).toSafeHtml());
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.
the class DefaultHttpLinkRenderer method renderEscaped.
private void renderEscaped(String iri, StringBuilder sb) {
SafeHtmlBuilder htmlBuilder = new SafeHtmlBuilder();
htmlBuilder.appendEscaped(iri);
sb.append(htmlBuilder.toSafeHtml().asString());
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.
the class ChoiceFieldRadioButtonEditor method setChoices.
@Override
public void setChoices(List<ChoiceDescriptor> choices) {
container.clear();
choiceButtons.clear();
nameCounter++;
for (ChoiceDescriptor descriptor : choices) {
RadioButton radioButton = new RadioButton("Choice" + nameCounter, new SafeHtmlBuilder().appendHtmlConstant(descriptor.getLabel()).toSafeHtml());
radioButton.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
radioButton.addValueChangeHandler(radioButtonValueChangedHandler);
radioButton.addFocusHandler(event -> {
radioButton.addStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
radioButton.removeStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
});
radioButton.addBlurHandler(event -> {
radioButton.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
radioButton.removeStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
});
container.add(radioButton);
choiceButtons.put(radioButton, descriptor);
}
selectDefaultChoice();
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project webprotege by protegeproject.
the class PrimitiveDataEditorImpl method showErrorLabel.
private void showErrorLabel() {
String errorMessage = freshEntitiesHandler.getErrorMessage(view.getText());
SafeHtml errorMessageHTML = new SafeHtmlBuilder().appendHtmlConstant(errorMessage).toSafeHtml();
Set<EntityType<?>> suggestTypes;
if (freshEntitiesHandler.getFreshEntitiesPolicy() == FreshEntitiesPolicy.ALLOWED) {
suggestTypes = getMatchTypes();
} else {
suggestTypes = Collections.emptySet();
}
view.showErrorMessage(errorMessageHTML, suggestTypes);
}
Aggregations