Search in sources :

Example 6 with Tag

use of edu.stanford.bmir.protege.web.shared.tag.Tag in project webprotege by protegeproject.

the class TagRepository_IT method shouldUpdateTag.

@Test
public void shouldUpdateTag() {
    Tag updatedTag = new Tag(tagId, projectId, "An updated label", THE_TAG_DESCRIPTION, COLOR, BG_COLOR);
    repository.saveTag(updatedTag);
    assertThat(getTagsCollectionSize(), is(1L));
    Optional<Tag> foundTag = repository.findTagByTagId(tagId);
    assertThat(foundTag, is(Optional.of(updatedTag)));
}
Also used : Tag(edu.stanford.bmir.protege.web.shared.tag.Tag) Test(org.junit.Test)

Example 7 with Tag

use of edu.stanford.bmir.protege.web.shared.tag.Tag in project webprotege by protegeproject.

the class EntityHierarchyTreeNodeRenderer method getHtmlRendering.

@Override
public String getHtmlRendering(EntityHierarchyNode node) {
    StringBuilder sb = new StringBuilder();
    sb.append("<div style='display: flex; flex-direction: row; align-items: center;'>");
    String iconIri;
    DataResource icon = getIcon(node);
    sb.append("<img src='").append(icon.getSafeUri().asString()).append("'/>");
    if (node.isDeprecated()) {
        sb.append("<div style=\"text-decoration: line-through; color: #a0a0a0;\">");
    } else {
        sb.append("<div>");
    }
    sb.append(node.getBrowserText());
    sb.append("</div>");
    if (node.getOpenCommentCount() > 0) {
        sb.append("<img style='padding-left: 6px;' src='").append(BUNDLE.svgCommentSmallFilledIcon().getSafeUri().asString()).append("'/>");
        sb.append("<div style='padding-left: 4px; padding-bottom: 4px; font-size: smaller;'> (").append(node.getOpenCommentCount()).append(")</div>");
    }
    node.getWatches().stream().filter(w -> loggedInUserProvider.getCurrentUserId().equals(w.getUserId())).map(Watch::getType).forEach(watchType -> {
        sb.append("<img style='padding-left: 4px;' src='");
        if (watchType == WatchType.ENTITY) {
            sb.append(BUNDLE.svgEyeIcon().getSafeUri().asString());
        } else {
            sb.append(BUNDLE.svgEyeIconDown().getSafeUri().asString());
        }
        sb.append("'/>");
    });
    Collection<Tag> tags = node.getTags();
    tags.forEach(tag -> {
        sb.append("<div title='").append(tag.getDescription()).append("' class='wp-tag wp-tag--inline-tag' style='color:").append(tag.getColor().getHex()).append("; background-color:").append(tag.getBackgroundColor().getHex()).append(";'>");
        sb.append(tag.getLabel());
        sb.append("</div>");
    });
    sb.append("</div>");
    return sb.toString();
}
Also used : DataResource(com.google.gwt.resources.client.DataResource) Tag(edu.stanford.bmir.protege.web.shared.tag.Tag)

Aggregations

Tag (edu.stanford.bmir.protege.web.shared.tag.Tag)7 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)3 IRI (org.semanticweb.owlapi.model.IRI)3 EntitySearchResult (edu.stanford.bmir.protege.web.shared.search.EntitySearchResult)2 Nullable (javax.annotation.Nullable)2 SearchMatch (org.eclipse.jdt.core.search.SearchMatch)2 Test (org.junit.Test)2 Optional (com.google.common.base.Optional)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Stopwatch (com.google.common.base.Stopwatch)1 HashMultimap (com.google.common.collect.HashMultimap)1 Multimap (com.google.common.collect.Multimap)1 DataResource (com.google.gwt.resources.client.DataResource)1 BROWSING (edu.stanford.bmir.protege.web.server.logging.Markers.BROWSING)1 HasGetRendering (edu.stanford.bmir.protege.web.server.mansyntax.render.HasGetRendering)1 MongoTestUtils.createMorphia (edu.stanford.bmir.protege.web.server.persistence.MongoTestUtils.createMorphia)1 TagsManager (edu.stanford.bmir.protege.web.server.tag.TagsManager)1 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)1 SearchField.displayName (edu.stanford.bmir.protege.web.shared.search.SearchField.displayName)1