Skip to content

Commit

Permalink
Merge pull request #4757 from inception-project/bugfix/4756-Annotatio…
Browse files Browse the repository at this point in the history
…n-can-almost-be-resized-despite-document-being-finished

#4756 - Annotation can almost be resized despite document being finished
  • Loading branch information
reckart authored Apr 23, 2024
2 parents 454376c + 4dcd130 commit c1946d2
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ private void actionArc(AjaxRequestTarget aTarget, IRequestParameters aParams)
{
var page = getPage();

page.ensureIsEditable();

var origin = VID.parse(aParams.getParameterValue(PARAM_ORIGIN_SPAN_ID).toString());
var target = VID.parse(aParams.getParameterValue(PARAM_TARGET_SPAN_ID).toString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest)
{
try {
var page = getPage();

page.ensureIsEditable();

var cas = page.getEditorCas();
var state = getAnnotatorState();
var range = getRangeFromRequest(state, aRequest.getRequestParameters(), cas);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest)
try {
var page = getPage();

page.ensureIsEditable();

var vid = VID.parseOptional(
aRequest.getRequestParameters().getParameterValue(PARAM_ID).toOptionalString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
*/
package de.tudarmstadt.ukp.inception.diam.editor.actions;

import org.apache.uima.cas.CAS;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.request.Request;
import org.springframework.core.annotation.Order;

import de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase;
import de.tudarmstadt.ukp.inception.diam.editor.config.DiamAutoConfig;
import de.tudarmstadt.ukp.inception.diam.model.ajax.DefaultAjaxResponse;
import de.tudarmstadt.ukp.inception.editor.AnnotationEditorExtensionRegistry;
import de.tudarmstadt.ukp.inception.rendering.vmodel.VID;

/**
* <p>
Expand Down Expand Up @@ -62,10 +59,12 @@ public boolean accepts(Request aRequest)
public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest)
{
try {
AnnotationPageBase page = getPage();
String action = getAction(aRequest);
VID paramId = getVid(aRequest);
CAS cas = page.getEditorCas();
var page = getPage();
page.ensureIsEditable();

var action = getAction(aRequest);
var paramId = getVid(aRequest);
var cas = page.getEditorCas();

extensionRegistry.fireAction(page.getAnnotationActionHandler(), page.getModelObject(),
aTarget, cas, paramId, action);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest)
{
try {
var page = getPage();
page.ensureIsEditable();

var cas = page.getEditorCas();
var slotFillerId = getVid(aRequest);
// When filling a slot, the current selection is *NOT* changed. The Span annotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.wicket.request.Request;
import org.springframework.core.annotation.Order;

import de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase;
import de.tudarmstadt.ukp.inception.diam.editor.config.DiamAutoConfig;
import de.tudarmstadt.ukp.inception.diam.model.ajax.DefaultAjaxResponse;
import de.tudarmstadt.ukp.inception.diam.model.compact.CompactRange;
Expand Down Expand Up @@ -55,8 +54,10 @@ public String getCommand()
public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest)
{
try {
AnnotationPageBase page = getPage();
CAS cas = page.getEditorCas();
var page = getPage();
page.ensureIsEditable();

var cas = page.getEditorCas();
actionSpan(aTarget, aRequest.getRequestParameters(), cas);
return new DefaultAjaxResponse(getAction(aRequest));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest)
{
try {
var page = getPage();

page.ensureIsEditable();

var cas = page.getEditorCas();
var vid = getVid(aRequest);
var state = getAnnotatorState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public AjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest)
private void actionLinkTo(AjaxRequestTarget aTarget, VID paramId)
throws IOException, AnnotationException
{
var page = getPage();
page.ensureIsEditable();

var state = model.getObject();

if (!state.getSelection().isSpan()) {
Expand Down

0 comments on commit c1946d2

Please sign in to comment.