Skip to content

Commit

Permalink
Merge pull request #4555 from inception-project/feature/4554-Allow-di…
Browse files Browse the repository at this point in the history
…splaying-comments-from-annotators-on-hover-when-curating-using-curation-sidebar-on-the-annotation-page

#4554 - Allow displaying comments from annotators on hover when curating using curation sidebar on the annotation page
  • Loading branch information
reckart authored Feb 25, 2024
2 parents 1a90912 + 528107a commit e093169
Show file tree
Hide file tree
Showing 16 changed files with 528 additions and 353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ public boolean suppressAutoFocus(AnnotationFeature aFeature)
@Override
public List<VLazyDetailGroup> lookupLazyDetails(AnnotationFeature aFeature, Object aValue)
{
if (aValue instanceof String) {
var value = (String) aValue;
if (aValue instanceof String value) {
var tag = schemaService.getTag(value, aFeature.getTagset());

if (isNotBlank(value) && aFeature.getTagset() != null && tag.isEmpty()) {
return asList(new VLazyDetailGroup(new VLazyDetail(value, "Tag not in tagset")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ public List<VObject> render(VDocument aVDocument, AnnotationFS aFS,
}

@Override
public List<VLazyDetailGroup> lookupLazyDetails(CAS aCas, VID aVid, int aWindowBeginOffset,
int aWindowEndOffset)
public List<VLazyDetailGroup> lookupLazyDetails(CAS aCas, VID aVid)
{
if (!checkTypeSystem(aCas)) {
return Collections.emptyList();
Expand All @@ -278,7 +277,7 @@ public List<VLazyDetailGroup> lookupLazyDetails(CAS aCas, VID aVid, int aWindowB
renderYield(fs).ifPresent(
yield -> group.addDetail(new VLazyDetail("Yield", abbreviate(yield, "...", 300))));

var details = super.lookupLazyDetails(aCas, aVid, aWindowBeginOffset, aWindowEndOffset);
var details = super.lookupLazyDetails(aCas, aVid);
if (!group.getDetails().isEmpty()) {
details.add(0, group);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ public List<AnnotationFS> selectAnnotationsInWindow(CAS aCas, int aWindowBegin,
}

@Override
public List<VLazyDetailGroup> lookupLazyDetails(CAS aCas, VID aVid, int aWindowBeginOffset,
int aWindowEndOffset)
public List<VLazyDetailGroup> lookupLazyDetails(CAS aCas, VID aVid)
{
if (!checkTypeSystem(aCas)) {
return Collections.emptyList();
Expand All @@ -112,7 +111,7 @@ public List<VLazyDetailGroup> lookupLazyDetails(CAS aCas, VID aVid, int aWindowB
group.addDetail(
new VLazyDetail("Text", abbreviate(fs.getCoveredText(), MAX_HOVER_TEXT_LENGTH)));

var details = super.lookupLazyDetails(aCas, aVid, aWindowBeginOffset, aWindowEndOffset);
var details = super.lookupLazyDetails(aCas, aVid);
if (!group.getDetails().isEmpty()) {
details.add(0, group);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.googlecode.wicket.jquery.ui.widget.menu.IMenuItem;

import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.inception.editor.action.AnnotationActionHandler;
Expand Down Expand Up @@ -79,8 +80,8 @@ default void generateContextMenuItems(List<IMenuItem> aItems)
// Do nothing by default
}

default List<VLazyDetailGroup> lookupLazyDetails(SourceDocument aDocument, User aUser, VID aVid,
AnnotationFeature aFeature)
default List<VLazyDetailGroup> lookupLazyDetails(SourceDocument aDocument, User aUser, CAS aCas,
VID aVid, AnnotationLayer aLayer)
{
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter_ImplBase;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.Position;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.internal.AID;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.relation.RelationDiffAdapter;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.span.SpanDiffAdapter;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.span.SpanDiffAdapter;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.inception.annotation.layer.relation.RelationAdapter;
import de.tudarmstadt.ukp.inception.annotation.layer.span.SpanLayerSupport;
import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
Expand Down Expand Up @@ -930,9 +927,21 @@ public ConfigurationSet getConfigurationSet(Position aPosition)

public Optional<Configuration> findConfiguration(String aRepresentativeCasGroupId, AID aAid)
{
for (ConfigurationSet cfgSet : getConfigurationSets()) {
Optional<Configuration> cfg = cfgSet.findConfiguration(aRepresentativeCasGroupId,
aAid);
for (var cfgSet : getConfigurationSets()) {
var cfg = cfgSet.findConfiguration(aRepresentativeCasGroupId, aAid);
if (cfg.isPresent()) {
return cfg;
}
}

return Optional.empty();
}

public Optional<Configuration> findConfiguration(String aRepresentativeCasGroupId,
FeatureStructure aFS)
{
for (var cfgSet : getConfigurationSets()) {
var cfg = cfgSet.findConfiguration(aRepresentativeCasGroupId, aFS);
if (cfg.isPresent()) {
return cfg;
}
Expand Down Expand Up @@ -1139,18 +1148,18 @@ public static List<DiffAdapter> getDiffAdapters(AnnotationSchemaService schemaSe
return emptyList();
}

Project project = aLayers.iterator().next().getProject();
var project = aLayers.iterator().next().getProject();

var featuresByLayer = schemaService.listSupportedFeatures(project).stream() //
.collect(groupingBy(AnnotationFeature::getLayer));

List<DiffAdapter> adapters = new ArrayList<>();
var adapters = new ArrayList<DiffAdapter>();
nextLayer: for (AnnotationLayer layer : aLayers) {
if (!layer.isEnabled()) {
continue nextLayer;
}

Set<String> labelFeatures = new LinkedHashSet<>();
var labelFeatures = new LinkedHashSet<String>();
nextFeature: for (var f : featuresByLayer.getOrDefault(layer, emptyList())) {
if (!f.isEnabled() || !f.isCuratable()) {
continue nextFeature;
Expand Down
Loading

0 comments on commit e093169

Please sign in to comment.