Search in sources :

Example 1 with DiffOperation

use of edu.stanford.bmir.protege.web.shared.diff.DiffOperation 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)

Aggregations

SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1 DiffOperation (edu.stanford.bmir.protege.web.shared.diff.DiffOperation)1