Skip to content

Commit

Permalink
#1778 - Make tokenization editable
Browse files Browse the repository at this point in the history
- Move the properties to the proper location *cough*
  • Loading branch information
reckart committed Jul 11, 2021
1 parent 9524a3f commit f3e24ff
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ public interface AnnotationEditorProperties

boolean isSentenceLayerEditable();

/**
* @return whether the "forward annotation" setting is available to annotators.
*/
boolean isForwardAnnotationEnabled();

/**
* @return whether the "remember layer" setting is configurable by the user as preference. When
* disabled, {@link #isRememberLayer} always returns true.
*/
boolean isRememberLayerEnabled();

default boolean isLayerBlocked(AnnotationLayer aLayer)
{
if (!isTokenLayerEditable() && Token.class.getName().equals(aLayer.getName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class AnnotationEditorPropertiesImpl
{
private boolean tokenLayerEditable;
private boolean sentenceLayerEditable;
private boolean rememberLayerEnabled = false;
private boolean forwardAnnotationEnabled = false;

@ManagedAttribute
@Override
Expand All @@ -56,4 +58,26 @@ public void setSentenceLayerEditable(boolean aSentenceLayerEditable)
{
sentenceLayerEditable = aSentenceLayerEditable;
}

@Override
public boolean isForwardAnnotationEnabled()
{
return forwardAnnotationEnabled;
}

public void setForwardAnnotationEnabled(boolean aForwardAnnotationEnabled)
{
forwardAnnotationEnabled = aForwardAnnotationEnabled;
}

@Override
public boolean isRememberLayerEnabled()
{
return rememberLayerEnabled;
}

public void setRememberLayerEnabled(boolean aRememberLayerEnabled)
{
rememberLayerEnabled = aRememberLayerEnabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,4 @@ public interface AnnotationEditorDefaultPreferencesProperties
boolean isAutoScroll();

boolean isRememberLayer();

/**
* @return whether the "forward annotation" setting is available to annotators.
*/
boolean isForwardAnnotationEnabled();

/**
* @return whether the "remember layer" setting is configurable by the user as preference. When
* disabled, {@link #isRememberLayer} always returns true.
*/
boolean isRememberLayerEnabled();
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class AnnotationEditorDefaultPreferencesPropertiesImpl
private int pageSize = 5;
private boolean autoScroll = true;
private boolean rememberLayer = false;
private boolean rememberLayerEnabled = false;
private boolean forwardAnnotationEnabled = false;

@Override
public int getPageSize()
Expand All @@ -56,37 +54,11 @@ public void setAutoScroll(boolean aAutoScroll)
@Override
public boolean isRememberLayer()
{
if (!rememberLayerEnabled) {
return true;
}

return rememberLayer;
}

public void setRememberLayer(boolean aRememberLayer)
{
rememberLayer = aRememberLayer;
}

@Override
public boolean isForwardAnnotationEnabled()
{
return forwardAnnotationEnabled;
}

public void setForwardAnnotationEnabled(boolean aForwardAnnotationEnabled)
{
forwardAnnotationEnabled = aForwardAnnotationEnabled;
}

@Override
public boolean isRememberLayerEnabled()
{
return rememberLayerEnabled;
}

public void setRememberLayerEnabled(boolean aRememberLayerEnabled)
{
rememberLayerEnabled = aRememberLayerEnabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,15 @@ public synchronized AnnotationPreference loadPreferences(Project aProject, Strin
// TODO Use modular preference loading once it is available and if there is a corresponding
// data file. Otherwise, fall back to loading the legacy preferences

return loadLegacyPreferences(aProject, aUsername, aMode);
AnnotationPreference pref = loadLegacyPreferences(aProject, aUsername, aMode);

// If the choice for remember layer is not enabled, hard-set to "true" which is the default
// and in the future the only option ;)
if (!annotationEditorProperties.isRememberLayerEnabled()) {
pref.setRememberLayer(true);
}

return pref;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter.RelationAdapter;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter.SpanAdapter;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter.TypeAdapter;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.config.AnnotationEditorProperties;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.exception.AnnotationException;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.exception.IllegalPlacementException;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.event.LinkFeatureDeletedEvent;
Expand All @@ -95,7 +96,6 @@
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.Selection;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.VID;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.preferences.AnnotationEditorProperties;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.rendering.event.SelectionChangedEvent;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.util.WebAnnoCasUtil;
import de.tudarmstadt.ukp.clarin.webanno.constraints.evaluator.Evaluator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.FeatureSupportRegistry;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.preferences.AnnotationEditorProperties;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.preferences.UserPreferencesService;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
Expand All @@ -68,7 +67,6 @@ public class LayerSelectionPanel
private @SpringBean FeatureSupportRegistry featureSupportRegistry;
private @SpringBean AnnotationSchemaService annotationService;
private @SpringBean UserPreferencesService userPreferencesService;
private @SpringBean AnnotationEditorProperties annotationEditorProperties;
private @SpringBean UserDao userDao;
private @SpringBean AnnotationEditorProperties annotationEditorProperties;

Expand Down

0 comments on commit f3e24ff

Please sign in to comment.