示例#1
0
  public void updatePanel(AjaxRequestTarget aTarget, CurationContainer aCC)
      throws UIMAException, ClassNotFoundException, IOException, BratAnnotationException {
    JCas jCas = repository.readCurationCas(bModel.getDocument());

    final int sentenceAddress =
        getAddr(
            selectSentenceAt(jCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset()));
    bModel.setSentenceAddress(sentenceAddress);

    final Sentence sentence = selectByAddr(jCas, Sentence.class, sentenceAddress);
    List<Sentence> followingSentences =
        selectFollowing(jCas, Sentence.class, sentence, bModel.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 lastSentenceAddressInDisplayWindow =
        followingSentences.size() == 0
            ? sentence
            : followingSentences.get(followingSentences.size() - 1);
    if (curationView == null) {
      curationView = new SourceListView();
    }
    curationView.setCurationBegin(sentence.getBegin());
    curationView.setCurationEnd(lastSentenceAddressInDisplayWindow.getEnd());

    int ws = bModel.getPreferences().getWindowSize();
    Sentence fs =
        BratAjaxCasUtil.selectSentenceAt(
            jCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset());
    int l = BratAjaxCasUtil.getLastSentenceAddressInDisplayWindow(jCas, getAddr(fs), ws);
    Sentence ls = (Sentence) selectByAddr(jCas, FeatureStructure.class, l);
    fSn = BratAjaxCasUtil.getSentenceNumber(jCas, fs.getBegin());
    lSn = BratAjaxCasUtil.getSentenceNumber(jCas, ls.getBegin());

    sentencesListView.addOrReplace(sentenceList);
    aTarget.add(sentencesListView);

    /*
     * corssSentAnnoView.addOrReplace(crossSentAnnoList); aTarget.add(corssSentAnnoView);
     */
    aTarget.add(suggestionViewPanel);
    if (annotate) {
      annotator.bratRender(aTarget, editor.getCas(bModel));
      annotator.bratSetHighlight(aTarget, bModel.getSelection().getAnnotation());

    } else {
      annotator.bratRenderLater(aTarget);
    }
    annotate = false;
    CuratorUtil.updatePanel(
        aTarget,
        suggestionViewPanel,
        aCC,
        annotator,
        repository,
        annotationSelectionByUsernameAndAddress,
        curationView,
        annotationService,
        userRepository);
  }
示例#2
0
  private void setCurationSegmentBeginEnd()
      throws UIMAException, ClassNotFoundException, IOException {
    JCas jCas = repository.readAnnotationCas(bModel.getDocument(), bModel.getUser());

    final int sentenceAddress =
        getAddr(
            selectSentenceAt(jCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset()));

    final Sentence sentence = selectByAddr(jCas, Sentence.class, sentenceAddress);
    List<Sentence> followingSentences =
        selectFollowing(jCas, Sentence.class, sentence, bModel.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 lastSentenceAddressInDisplayWindow =
        followingSentences.size() == 0
            ? sentence
            : followingSentences.get(followingSentences.size() - 1);
    curationSegment.setBegin(sentence.getBegin());
    curationSegment.setEnd(lastSentenceAddressInDisplayWindow.getEnd());
  }
示例#3
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);
  }