Search in sources :

Example 41 with SafeHtmlBuilder

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);
    }
}
Also used : SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 42 with SafeHtmlBuilder

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());
}
Also used : DiffOperation(edu.stanford.bmir.protege.web.shared.diff.DiffOperation) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 43 with SafeHtmlBuilder

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());
}
Also used : SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 44 with SafeHtmlBuilder

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();
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) ChoiceDescriptor(edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 45 with SafeHtmlBuilder

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);
}
Also used : SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Aggregations

SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)142 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)26 Test (org.junit.Test)18 Column (com.google.gwt.user.cellview.client.Column)17 Cell (com.google.gwt.cell.client.Cell)14 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)12 Context (com.google.gwt.cell.client.Cell.Context)7 MenuItem (com.google.gwt.user.client.ui.MenuItem)7 NativeEvent (com.google.gwt.dom.client.NativeEvent)6 Command (com.google.gwt.user.client.Command)6 ArrayList (java.util.ArrayList)6 ValueUpdater (com.google.gwt.cell.client.ValueUpdater)5 GWT (com.google.gwt.core.client.GWT)5 Element (com.google.gwt.dom.client.Element)5 AbstractCell (com.google.gwt.cell.client.AbstractCell)4 ClickableTextCell (com.google.gwt.cell.client.ClickableTextCell)4 TextCell (com.google.gwt.cell.client.TextCell)4 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)4 ImageResource (com.google.gwt.resources.client.ImageResource)4 Map (java.util.Map)4