private void commonUpdate() throws IOException { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); // Determine the FIRST visible unit final Sentence firstVisibleUnit = selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); state.setFirstVisibleUnit(firstVisibleUnit); // Determine the LAST visible unit List<Sentence> followingUnits = selectFollowing(jCas, Sentence.class, firstVisibleUnit, state.getPreferences().getWindowSize()); // Check also, when getting the last sentence address in the display window, if this is the // last sentence or the ONLY sentence in the document Sentence lastVisibleUnit = followingUnits.size() == 0 ? firstVisibleUnit : followingUnits.get(followingUnits.size() - 1); curationView.setCurationBegin(firstVisibleUnit.getBegin()); curationView.setCurationEnd(lastVisibleUnit.getEnd()); // Determine the number of the first and last visible unit int ws = state.getPreferences().getWindowSize(); Sentence fs = WebAnnoCasUtil.selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); Sentence ls = WebAnnoCasUtil.getLastSentenceInDisplayWindow(jCas, getAddr(fs), ws); fSn = WebAnnoCasUtil.getSentenceNumber(jCas, fs.getBegin()); lSn = WebAnnoCasUtil.getSentenceNumber(jCas, ls.getBegin()); }
private void commonUpdate() throws IOException { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); // Determine the FIRST visible unit final Sentence firstVisibleUnit = selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); state.setFirstVisibleUnit(firstVisibleUnit); // Determine the LAST visible unit List<Sentence> followingUnits = selectFollowing(jCas, Sentence.class, firstVisibleUnit, state.getPreferences().getWindowSize()); // Check also, when getting the last sentence address in the display window, if this is the // last sentence or the ONLY sentence in the document Sentence lastVisibleUnit = followingUnits.size() == 0 ? firstVisibleUnit : followingUnits.get(followingUnits.size() - 1); curationView.setCurationBegin(firstVisibleUnit.getBegin()); curationView.setCurationEnd(lastVisibleUnit.getEnd()); // Determine the number of the first and last visible unit int ws = state.getPreferences().getWindowSize(); Sentence fs = WebAnnoCasUtil.selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); Sentence ls = WebAnnoCasUtil.getLastSentenceInDisplayWindow(jCas, getAddr(fs), ws); fSn = WebAnnoCasUtil.getSentenceNumber(jCas, fs.getBegin()); lSn = WebAnnoCasUtil.getSentenceNumber(jCas, ls.getBegin()); }