private void actionShowOpenDocumentDialog(AjaxRequestTarget aTarget) { getModelObject().getSelection().clear(); openDocumentsModal.show(aTarget); }
public void selectSpan(JCas aJCas, int aBegin, int aEnd) { selectSpan(VID.NONE_ID, aJCas, aBegin, aEnd); }
private void createNewChainElement(AjaxRequestTarget aTarget, ChainAdapter aAdapter, JCas aJCas) throws AnnotationException { AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); AnnotationFS annoFs = aAdapter.addSpan(state.getDocument(), state.getUser().getUsername(), aJCas, selection.getBegin(), selection.getEnd()); selection.selectSpan(new VID(annoFs), aJCas, annoFs.getBegin(), annoFs.getEnd()); }
private void createNewChainLinkAnnotation(ChainAdapter aAdapter, JCas aJCas) { LOG.trace("createNewChainLinkAnnotation()"); AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); AnnotationFS originFs = selectByAddr(aJCas, selection.getOrigin()); AnnotationFS targetFs = selectByAddr(aJCas, selection.getTarget()); // Creating a new chain link int addr = aAdapter.addArc(state.getDocument(), state.getUser().getUsername(), aJCas, originFs, targetFs); selection.selectArc(new VID(addr), originFs, targetFs); }
@Override protected void onConfigure() { super.onConfigure(); setVisible(!getModelObject().getSelection().getAnnotation().isSet()); } };
if (state.getSelection().getEnd() >= state.getWindowEndOffset()) { autoScroll(aJCas, true); state.getSelection().getBegin(), state.getSelection().getEnd()); if (nextToken != null) { if (getModelObject().getWindowEndOffset() > nextToken.getBegin()) { state.getSelection().selectSpan(aJCas, nextToken.getBegin(), nextToken.getEnd()); actionCreateForward(aTarget, aJCas, true); .getAdapter(state.getSelectedAnnotationLayer()); AnnotationFS fs = selectByAddr(aJCas, state.getSelection().getAnnotation().getId()); deleteAnnotation(aJCas, state, fs, featureStates.get(0).feature.getLayer(), adapter); state.getSelection().getBegin(), state.getSelection().getEnd()); if (nextToken != null) { if (getModelObject().getWindowEndOffset() > nextToken.getBegin()) { state.getSelection().selectSpan(aJCas, nextToken.getBegin(), nextToken.getEnd()); actionCreateForward(aTarget, aJCas, true);
AnnotationFS fs = selectByAddr(jCas, state.getSelection().getAnnotation().getId()); AnnotationLayer layer = annotationService.getLayer(state.getProject(), fs); TypeAdapter adapter = annotationService.getAdapter(layer); int sentenceNumber = getSentenceNumber(jCas, state.getSelection().getBegin()); state.setFocusUnitIndex(sentenceNumber); state.getDocument().setSentenceAccessed(sentenceNumber); state.getSelection().clear();
private SpanAnnotationResponse actionSpan(AjaxRequestTarget aTarget, IRequestParameters request, JCas jCas, VID paramId) throws IOException, AnnotationException { Offsets offsets = getOffsetsFromRequest(request, jCas, paramId); AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); if (state.isSlotArmed()) { // When filling a slot, the current selection is *NOT* changed. The // Span annotation which owns the slot that is being filled remains // selected! getActionHandler().actionFillSlot(aTarget, jCas, offsets.getBegin(), offsets.getEnd(), paramId); } else { if (!paramId.isSynthetic()) { selection.selectSpan(paramId, jCas, offsets.getBegin(), offsets.getEnd()); if (selection.getAnnotation().isNotSet()) { // Create new annotation getActionHandler().actionCreateOrUpdate(aTarget, jCas); } else { getActionHandler().actionSelect(aTarget, jCas); } } } return new SpanAnnotationResponse(); }
private Component createReverseButton() { LambdaAjaxLink link = new LambdaAjaxLink("reverse", editorPanel::actionReverse); link.setOutputMarkupPlaceholderTag(true); link.add(LambdaBehavior.onConfigure(_this -> { AnnotatorState state = AnnotationFeatureForm.this.getModelObject(); _this.setVisible(state.getSelection().getAnnotation().isSet() && state.getSelection().isArc() && state.getSelectedAnnotationLayer() .getType().equals(WebAnnoConst.RELATION_TYPE)); // Avoid reversing in read-only layers _this.setEnabled(state.getSelectedAnnotationLayer() != null && !state.getSelectedAnnotationLayer().isReadonly()); })); return link; }
AnnotationFS idFs = selectByAddr(jCas, state.getSelection().getAnnotation().getId()); AnnotationFS originFs = selectByAddr(jCas, state.getSelection().getOrigin()); AnnotationFS targetFs = selectByAddr(jCas, state.getSelection().getTarget()); state.getUser().getUsername(), targetFs, originFs, jCas, state.getWindowBeginOffset(), state.getWindowEndOffset()); state.getSelection().setAnnotation(new VID(getAddr(arc))); state.getSelection().reverseArc();
if (selection.isSpan()) { annotationFeatureForm.updateLayersDropdown(); if (selection.getAnnotation().isSet()) { AnnotationFS annoFs = selectByAddr(aJCas, state.getSelection().getAnnotation() .getId()); if (!selection.isArc() && !state.getPreferences().isRememberLayer()) { state.setSelectedAnnotationLayer(layer); if (selection.isArc()) {
if (state.getSelection().isArc()) { LOG.trace("actionAnnotate() relation annotation - looking for attached layer"); AnnotationFS originFS = selectByAddr(aJCas, state.getSelection().getOrigin()); AnnotationLayer spanLayer = annotationService.getLayer(state.getProject(), originFS); if ( state.getPreferences().isRememberLayer() && state.getSelection().getAnnotation().isNotSet() && // i.e. new annotation !spanLayer.equals(state.getDefaultAnnotationLayer()) ) {
private ArcAnnotationResponse actionArc(AjaxRequestTarget aTarget, IRequestParameters request, JCas jCas, VID paramId) throws IOException, AnnotationException { AnnotationFS originFs = selectByAddr(jCas, request.getParameterValue(PARAM_ORIGIN_SPAN_ID).toInt()); AnnotationFS targetFs = selectByAddr(jCas, request.getParameterValue(PARAM_TARGET_SPAN_ID).toInt()); AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); selection.selectArc(paramId, originFs, targetFs); if (selection.getAnnotation().isNotSet()) { // Create new annotation getActionHandler().actionCreateOrUpdate(aTarget, jCas); } else { getActionHandler().actionSelect(aTarget, jCas); } return new ArcAnnotationResponse(); }
if (state.getSelection().getAnnotation().isNotSet()) { int sentenceNumber = getSentenceNumber(aJCas, state.getSelection().getBegin()); state.setFocusUnitIndex(sentenceNumber); state.getDocument().setSentenceAccessed(sentenceNumber);
AnnotationFS fs = selectByAddr(jCas, state.getSelection().getAnnotation().getId()); AnnotationLayer currentLayer = annotationService.getLayer(state.getProject(), fs); Selection savedSel = editorPanel.getModelObject().getSelection().copy(); state.getSelection().set(savedSel); state.getSelection().setAnnotation(VID.NONE_ID); state.setSelectedAnnotationLayer(layer); state.setDefaultAnnotationLayer(layer);
default void moveToSelection(JCas aJCas) { moveToOffset(aJCas, getSelection().getBegin()); }
@Override public void rememberFeatures() { if (getSelection().isArc()) { this.rememberedArcLayer = getSelectedAnnotationLayer(); setRememberedArcFeatures(featureModels); } else { this.rememberedSpanLayer = getSelectedAnnotationLayer(); setRememberedSpanFeatures(featureModels); } }
private void removeSelectedLabel(AjaxRequestTarget aTarget) { List<LinkWithRoleModel> links = (List<LinkWithRoleModel>) this.getModelObject().value; AnnotatorState state = this.stateModel.getObject(); String role = roleModel.role; roleModel = new LinkWithRoleModel(); roleModel.role = role; links.set(0, roleModel); // Auto-commit if working on existing annotation if (state.getSelection().getAnnotation().isSet()) { try { actionHandler.actionCreateOrUpdate(aTarget, actionHandler.getEditorCas()); } catch (Exception e) { handleException(this, aTarget, e); } } }