コード例 #1
0
ファイル: AutomationPage.java プロジェクト: eldieon/webanno
  private void ubdateSentenceNumber(JCas aJCas, int aAddress) {
    bModel.setSentenceAddress(aAddress);
    Sentence sentence = selectByAddr(aJCas, Sentence.class, aAddress);
    bModel.setSentenceBeginOffset(sentence.getBegin());
    bModel.setSentenceEndOffset(sentence.getEnd());
    bModel.setSentenceNumber(BratAjaxCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));

    Sentence firstSentence =
        selectSentenceAt(aJCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset());
    int lastAddressInPage =
        getLastSentenceAddressInDisplayWindow(
            aJCas, getAddr(firstSentence), bModel.getPreferences().getWindowSize());
    // the last sentence address in the display window
    Sentence lastSentenceInPage =
        (Sentence) selectByAddr(aJCas, FeatureStructure.class, lastAddressInPage);
    bModel.setFSN(BratAjaxCasUtil.getSentenceNumber(aJCas, firstSentence.getBegin()));
    bModel.setLSN(BratAjaxCasUtil.getSentenceNumber(aJCas, lastSentenceInPage.getBegin()));
  }
コード例 #2
0
  private void updateCurationView(
      final CurationContainer curationContainer,
      final SourceListView curationViewItem,
      AjaxRequestTarget aTarget,
      JCas jCas) {
    int currentSentAddress =
        BratAjaxCasUtil.getCurrentSentence(
                jCas, curationViewItem.getBegin(), curationViewItem.getEnd())
            .getAddress();
    bModel.setSentenceAddress(
        BratAjaxCasUtil.getSentenceBeginAddress(
            jCas,
            currentSentAddress,
            curationViewItem.getBegin(),
            bModel.getProject(),
            bModel.getDocument(),
            bModel.getPreferences().getWindowSize()));

    Sentence sentence = selectByAddr(jCas, Sentence.class, bModel.getSentenceAddress());
    bModel.setSentenceBeginOffset(sentence.getBegin());
    bModel.setSentenceEndOffset(sentence.getEnd());

    Sentence firstSentence =
        selectSentenceAt(jCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset());
    int lastAddressInPage =
        getLastSentenceAddressInDisplayWindow(
            jCas, getAddr(firstSentence), bModel.getPreferences().getWindowSize());
    // the last sentence address in the display window
    Sentence lastSentenceInPage =
        (Sentence) selectByAddr(jCas, FeatureStructure.class, lastAddressInPage);
    bModel.setFSN(BratAjaxCasUtil.getSentenceNumber(jCas, firstSentence.getBegin()));
    bModel.setLSN(BratAjaxCasUtil.getSentenceNumber(jCas, lastSentenceInPage.getBegin()));

    curationContainer.setBratAnnotatorModel(bModel);
    onChange(aTarget);
  }