Skip to content

Commit

Permalink
Merge branch 'release/32.x'
Browse files Browse the repository at this point in the history
* release/32.x:
  #4835 - Error when trying to open certain documents with stacked annotations for curation
  #4839 - Scrolling to selection does sometimes not work in Apache Annotator Editor
  • Loading branch information
reckart committed May 31, 2024
2 parents 73a1f2a + 4e0367b commit 8fd3e57
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Configuration

private final Position position;
final Map<String, AID> fsAddresses = new TreeMap<>();
private List<AID> extras;
private Map<String, List<AID>> extras;

/**
* Flag indicating that there is at least once CAS group containing more than one annotation at
Expand Down Expand Up @@ -88,9 +88,10 @@ public void add(String aCasGroupId, AID aAID)
var old = fsAddresses.put(aCasGroupId, aAID);
if (old != null) {
if (extras == null) {
extras = new ArrayList<>();
extras = new TreeMap<>();
}
extras.add(old);
var list = extras.computeIfAbsent(aCasGroupId, $ -> new ArrayList<AID>());
list.add(old);
stacked = true;
}
}
Expand Down Expand Up @@ -139,18 +140,23 @@ public boolean contains(String aCasGroupId, AID aAID)
return false;
}

return extras.contains(aAID);
var list = extras.get(aCasGroupId);
if (list == null) {
return false;
}

return list.contains(aAID);
}

private <T extends FeatureStructure> FeatureStructure getFs(String aCasGroupId, Class<T> aClass,
Map<String, CAS> aCasMap)
{
AID aid = fsAddresses.get(aCasGroupId);
var aid = fsAddresses.get(aCasGroupId);
if (aid == null) {
return null;
}

CAS cas = aCasMap.get(aCasGroupId);
var cas = aCasMap.get(aCasGroupId);
if (cas == null) {
return null;
}
Expand Down Expand Up @@ -179,8 +185,11 @@ private <T extends FeatureStructure> List<FeatureStructure> getFses(String aCasG
allFs.add(ICasUtil.selectFsByAddr(cas, aid.addr));

if (extras != null) {
for (var eAid : extras) {
allFs.add(ICasUtil.selectFsByAddr(cas, eAid.addr));
var list = extras.get(aCasGroupId);
if (list != null) {
for (var eAid : list) {
allFs.add(ICasUtil.selectFsByAddr(cas, eAid.addr));
}
}
}

Expand All @@ -206,7 +215,13 @@ public String toString()
sb.append(e.getValue());
if (extras != null) {
sb.append(" (extras: ");
sb.append(extras.stream().map(String::valueOf).collect(joining(", ")));
for (var entries : extras.entrySet()) {
sb.append(" {");
sb.append(entries.getKey());
sb.append(entries.getValue().stream().map(String::valueOf)
.collect(joining(", ")));
sb.append("} ");
}
sb.append(")");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ export class ApacheAnnotatorVisualizer {

window.clearTimeout(this.removeTransientMarkersTimeout)
this.removeTransientMarkers.forEach(remove => remove())
this.root.normalize() // https://github.com/apache/incubator-annotator/issues/120

const removeScrollMarker = highlightText(range, 'mark', { id: 'iaa-scroll-marker' })
this.removeTransientMarkers = [removeScrollMarker]
Expand Down Expand Up @@ -469,6 +470,7 @@ export class ApacheAnnotatorVisualizer {
this.removeTransientMarkersTimeout = window.setTimeout(() => {
this.removeTransientMarkers.forEach(remove => remove())
this.removeTransientMarkers = []
this.root.normalize() // https://github.com/apache/incubator-annotator/issues/120
}, 2000)
}

Expand Down

0 comments on commit 8fd3e57

Please sign in to comment.