default void moveToOffset(JCas aJCas, int aOffset) { // Fetch the first sentence on screen or first sentence Sentence sentence; if (getFirstVisibleUnitAddress() > -1) { sentence = selectByAddr(aJCas, Sentence.class, getFirstVisibleUnitAddress()); } else { sentence = getFirstSentence(aJCas); } // Calculate the first sentence in the window in such a way that the annotation // currently selected is in the center of the window sentence = findWindowStartCenteringOnSelection(aJCas, sentence, aOffset, getProject(), getDocument(), getPreferences().getWindowSize()); // Move to it setFirstVisibleUnit(sentence); // FIXME getSentenceNumber is not a good option... if we aim for the begin offset of the // very last unit, then we get (max-units - 1) instead of (max-units). However, this // method is used also in curation and I dimly remember that things broke when I tried // to fix it. Probably better to move away from it in the long run. -- REC setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, aOffset)); }
default void moveToOffset(JCas aJCas, int aOffset) { // Fetch the first sentence on screen or first sentence Sentence sentence; if (getFirstVisibleUnitAddress() > -1) { sentence = selectByAddr(aJCas, Sentence.class, getFirstVisibleUnitAddress()); } else { sentence = getFirstSentence(aJCas); } // Calculate the first sentence in the window in such a way that the annotation // currently selected is in the center of the window sentence = findWindowStartCenteringOnSelection(aJCas, sentence, aOffset, getProject(), getDocument(), getPreferences().getWindowSize()); // Move to it setFirstVisibleUnit(sentence); // FIXME getSentenceNumber is not a good option... if we aim for the begin offset of the // very last unit, then we get (max-units - 1) instead of (max-units). However, this // method is used also in curation and I dimly remember that things broke when I tried // to fix it. Probably better to move away from it in the long run. -- REC setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, aOffset)); }