Commit aa5fede1 authored by tu's avatar tu

fixed bug: automatic assignment of id to STWR anno, automatic deletion

parent 8fa8939f
Pipeline #13017 passed with stage
in 5 minutes and 12 seconds
......@@ -689,9 +689,39 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
// Methods to change the CAS
private void deleteAnnotations(AnnotationFS... annos) {
List<AnnotationFS> toDelete = new ArrayList<>();
toDelete.addAll(Arrays.asList(annos));
String deleteID = "";
if (toDelete.get(0).getType() == stwrType){
deleteID = toDelete.get(0).getFeatureValueAsString(stwrIDFeat);
}
if (toDelete.get(0).getType() == frameType){
deleteID = toDelete.get(0).getFeatureValueAsString(frameIDFeat);
}
for (AnnotationFS speaker : speakerList)
{
if (speaker.getFeatureValueAsString(speakerIDFeat).equals(deleteID)){
List<AnnotationFS> speakerToDelete = new ArrayList<>();
speakerToDelete.add(speaker);
toDelete.add(speaker);
editor.removeAnnotations(speakerToDelete);
}
}
for (AnnotationFS intExpr : expressionList)
{
if (intExpr.getFeatureValueAsString(expressionIDFeat).equals(deleteID)){
List<AnnotationFS> intExprToDelete = new ArrayList<>();
intExprToDelete.add(intExpr);
toDelete.add(intExpr);
editor.removeAnnotations(intExprToDelete);
}
}
editor.removeAnnotations(toDelete);
}
......@@ -1003,7 +1033,7 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
// get the selection
if (selected == null) {
Point selection = editor.getActualSelectedText();
if (selection == null || selection.x == selection.y) {
return;
......@@ -1017,14 +1047,14 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
updateAnnotation(anno, speakerIDFeat, "0", true);
addAnnotation(anno);
for (AnnotationFS frame : frameList)
{
for (AnnotationFS frame : frameList){
if (anno.getBegin() >= frame.getBegin() && anno.getEnd() <= frame.getEnd())
{
anno.getFeatureValueAsString(speakerFeat);
addAnnotation(anno);
updateAnnotation(anno, speakerIDFeat, frame.getFeatureValueAsString(frameIDFeat), true);
}
}
for (AnnotationFS stwr : stwrList){
if (anno.getBegin() >= stwr.getBegin() && anno.getEnd() <= stwr.getEnd() && stwr.getFeatureValueAsString(rTypeFeat).equals("reported"))
......@@ -1035,26 +1065,7 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
}
}
/*
else
{
counter++;
}
if (counter == frameList.size())
{
JFrame jFrame = new JFrame("Information");
JOptionPane.showMessageDialog(jFrame, "Please mark a string in a frame.", "Attention", JOptionPane.WARNING_MESSAGE);
}
*/
}
}
/*
Display.getCurrent().asyncExec(() -> {
renewPage();
});
*/
renewPage();
}
}
......
package de.ids.tt.athen.rwview.ui;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
......@@ -194,7 +195,10 @@ public class RwFrameTableComposite extends Composite{
// change the pos feature
if (e.keyCode == 'p') {
part.togglePos(selectedAnnos);
}
else if (e.keyCode == KeyEvent.VK_DELETE){
part.deleteAnnotations(getSelectedAnnotationsFromTable());
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment