public void init(AjaxRequestTarget aTarget, CurationContainer aCC) throws UIMAException, ClassNotFoundException, IOException { commonUpdate(); suggestionViewPanel.init(aTarget, aCC, annotationSelectionByUsernameAndAddress, curationView); }
@SuppressWarnings("unchecked") public IModel<CurationContainer> getModel() { return (IModel<CurationContainer>) getDefaultModel(); }
public CurationContainer getModelObject() { return (CurationContainer) getDefaultModelObject(); }
setOutputMarkupId(true); add(sidebarCell); state = getModelObject().getAnnotatorState(); if (state != null) { userAnnotationSegments sourceListModel = sourceListModel == null ? getModelObject().getCurationViews() : sourceListModel; suggestionViewPanel.setOutputMarkupPlaceholderTag(true); suggestionViewPanel.add(LambdaBehavior.visibleWhen(() -> state.getDocument() != null)); add(suggestionViewPanel); add(annotationEditor); crossSentAnnoView.setOutputMarkupPlaceholderTag(true); crossSentAnnoView.add(LambdaBehavior.visibleWhen(() -> state.getDocument() != null)); add(crossSentAnnoView); crossSentAnnoList = new ListView<String>("crossSentAnnoList", this::invisibleCrossSentenceAnnotations) sentencesListView.setOutputMarkupPlaceholderTag(true); sentencesListView.add(LambdaBehavior.visibleWhen(() -> state.getDocument() != null)); add(sentencesListView); sentencesListView.add(new ListView<SourceListView>("sentencesList", LoadableDetachableModel.of(() -> getModelObject().getCurationViews()))
@Override public void onClick(AjaxRequestTarget aTarget) { final SourceListView curationViewItem = getModelObject(); curationView = curationViewItem; fSn = 0; try { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); updateCurationView(CurationPanel.this.getModelObject(), curationViewItem, aTarget, jCas); updatePanel(aTarget, CurationPanel.this.getModelObject()); state.setFocusUnitIndex(curationViewItem.getSentenceNumber()); } catch (UIMAException e) { error("Error: " + ExceptionUtils.getRootCauseMessage(e)); } catch (ClassNotFoundException | AnnotationException | IOException e) { error("Error: " + e.getMessage()); } } }
curationContainer = builder.buildCurationContainer(state); curationContainer.setBratAnnotatorModel(state); curationPanel.getEditor().reset(aTarget); updatePanel(curationContainer, aTarget); updateSentenceNumber(mergeJCas, state.getFirstVisibleUnitAddress()); curationPanel.init(aTarget, curationContainer);
@Override public void onDocumentSelected(AjaxRequestTarget aTarget) { AnnotatorState state = getModelObject(); String username = SecurityContextHolder.getContext().getAuthentication().getName(); /* * Changed for #152, getDocument was returning null even after opening a document * Also, surrounded following code into if block to avoid error. */ if (state.getProject() == null) { setResponsePage(getApplication().getHomePage()); return; } if (state.getDocument() != null) { try { documentService.createSourceDocument(state.getDocument()); upgradeCasAndSave(state.getDocument(), username); actionLoadDocument(aTarget); curationPanel.getEditor().loadFeatureEditorModels(aTarget); } catch (Exception e) { LOG.error("Unable to load data", e); error("Unable to load data: " + ExceptionUtils.getRootCauseMessage(e)); } } } });
private void updateCurationView(final CurationContainer curationContainer, final SourceListView curationViewItem, AjaxRequestTarget aTarget, JCas jCas) { Sentence currentSent = WebAnnoCasUtil.getCurrentSentence(jCas, curationViewItem.getBegin(), curationViewItem.getEnd()); state.setFirstVisibleUnit(WebAnnoCasUtil.findWindowStartCenteringOnSelection(jCas, currentSent, curationViewItem.getBegin(), state.getProject(), state.getDocument(), state.getPreferences().getWindowSize())); curationContainer.setBratAnnotatorModel(state); onChange(aTarget); }
@Override public JCas getEditorCas() throws IOException { return CurationPanel.this.getEditorCas(); } };
public void setModel(IModel<CurationContainer> aModel) { setDefaultModel(aModel); }
setOutputMarkupId(true); add(sidebarCell); state = getModelObject().getAnnotatorState(); if (state != null) { userAnnotationSegments sourceListModel = sourceListModel == null ? getModelObject().getCurationViews() : sourceListModel; suggestionViewPanel.setOutputMarkupPlaceholderTag(true); suggestionViewPanel.add(LambdaBehavior.visibleWhen(() -> state.getDocument() != null)); add(suggestionViewPanel); add(annotationEditor); crossSentAnnoView.setOutputMarkupPlaceholderTag(true); crossSentAnnoView.add(LambdaBehavior.visibleWhen(() -> state.getDocument() != null)); add(crossSentAnnoView); crossSentAnnoList = new ListView<String>("crossSentAnnoList", this::invisibleCrossSentenceAnnotations) sentencesListView.setOutputMarkupPlaceholderTag(true); sentencesListView.add(LambdaBehavior.visibleWhen(() -> state.getDocument() != null)); add(sentencesListView); sentencesListView.add(new ListView<SourceListView>("sentencesList", LoadableDetachableModel.of(() -> getModelObject().getCurationViews()))
@Override public void onClick(AjaxRequestTarget aTarget) { final SourceListView curationViewItem = getModelObject(); curationView = curationViewItem; fSn = 0; try { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); updateCurationView(CurationPanel.this.getModelObject(), curationViewItem, aTarget, jCas); updatePanel(aTarget, CurationPanel.this.getModelObject()); state.setFocusUnitIndex(curationViewItem.getSentenceNumber()); } catch (UIMAException e) { error("Error: " + ExceptionUtils.getRootCauseMessage(e)); } catch (ClassNotFoundException | AnnotationException | IOException e) { error("Error: " + e.getMessage()); } } }
curationContainer = builder.buildCurationContainer(state); curationContainer.setBratAnnotatorModel(state); curationPanel.getEditor().reset(aTarget); updatePanel(curationContainer, aTarget); updateSentenceNumber(mergeJCas, state.getFirstVisibleUnitAddress()); curationPanel.init(aTarget, curationContainer);
@Override public void onDocumentSelected(AjaxRequestTarget aTarget) { AnnotatorState state = getModelObject(); String username = SecurityContextHolder.getContext().getAuthentication().getName(); /* * Changed for #152, getDocument was returning null even after opening a document * Also, surrounded following code into if block to avoid error. */ if (state.getProject() == null) { setResponsePage(getApplication().getHomePage()); return; } if (state.getDocument() != null) { try { documentService.createSourceDocument(state.getDocument()); upgradeCasAndSave(state.getDocument(), username); actionLoadDocument(aTarget); curationPanel.getEditor().loadFeatureEditorModels(aTarget); } catch (Exception e) { LOG.error("Unable to load data", e); error("Unable to load data: " + ExceptionUtils.getRootCauseMessage(e)); } } } });
private void updateCurationView(final CurationContainer curationContainer, final SourceListView curationViewItem, AjaxRequestTarget aTarget, JCas jCas) { Sentence currentSent = WebAnnoCasUtil.getCurrentSentence(jCas, curationViewItem.getBegin(), curationViewItem.getEnd()); state.setFirstVisibleUnit(WebAnnoCasUtil.findWindowStartCenteringOnSelection(jCas, currentSent, curationViewItem.getBegin(), state.getProject(), state.getDocument(), state.getPreferences().getWindowSize())); curationContainer.setBratAnnotatorModel(state); onChange(aTarget); }
@Override public JCas getEditorCas() throws IOException { return CurationPanel.this.getEditorCas(); } };
public void setModel(IModel<CurationContainer> aModel) { setDefaultModel(aModel); }
public void init(AjaxRequestTarget aTarget, CurationContainer aCC) throws UIMAException, ClassNotFoundException, IOException { commonUpdate(); suggestionViewPanel.init(aTarget, aCC, annotationSelectionByUsernameAndAddress, curationView); }
private void actionFinishDocument(AjaxRequestTarget aTarget) { finishDocumentDialog.setConfirmAction((aCallbackTarget) -> { actionValidateDocument(aCallbackTarget, getEditorCas()); AnnotatorState state = getModelObject(); SourceDocument sourceDocument = state.getDocument(); if (SourceDocumentState.CURATION_FINISHED.equals(sourceDocument.getState())) { documentService.transitionSourceDocumentState(sourceDocument, CURATION_FINISHED_TO_CURATION_IN_PROGRESS); } else { documentService.transitionSourceDocumentState(sourceDocument, CURATION_IN_PROGRESS_TO_CURATION_FINISHED); } aCallbackTarget.add(finishDocumentIcon); aCallbackTarget.add(finishDocumentLink); aCallbackTarget.add(curationPanel.getEditor()); aCallbackTarget.add(remergeDocumentLink); }); finishDocumentDialog.show(aTarget); }
@SuppressWarnings("unchecked") public IModel<CurationContainer> getModel() { return (IModel<CurationContainer>) getDefaultModel(); }