diff --git a/inception/inception-agreement/src/main/java/de/tudarmstadt/ukp/clarin/webanno/agreement/measures/krippendorffalpha/KrippendorffAlphaAgreementMeasureSupport.java b/inception/inception-agreement/src/main/java/de/tudarmstadt/ukp/clarin/webanno/agreement/measures/krippendorffalpha/KrippendorffAlphaAgreementMeasureSupport.java index d29551fd43f..74651c99fcd 100644 --- a/inception/inception-agreement/src/main/java/de/tudarmstadt/ukp/clarin/webanno/agreement/measures/krippendorffalpha/KrippendorffAlphaAgreementMeasureSupport.java +++ b/inception/inception-agreement/src/main/java/de/tudarmstadt/ukp/clarin/webanno/agreement/measures/krippendorffalpha/KrippendorffAlphaAgreementMeasureSupport.java @@ -48,7 +48,7 @@ public String getId() @Override public String getName() { - return "Krippendorff's Kappa (coding / nominal)"; + return "Krippendorff's Alpha (coding / nominal)"; } @Override diff --git a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraits.java b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraits.java index 18ed45f6a60..c65d6c9aa48 100644 --- a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraits.java +++ b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraits.java @@ -17,6 +17,8 @@ */ package de.tudarmstadt.ukp.inception.annotation.feature.number; +import static de.tudarmstadt.ukp.inception.annotation.feature.number.NumberFeatureTraits.EditorType.SPINNER; + import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; @@ -54,7 +56,7 @@ public String toString() private boolean limited = false; private Number minimum = 0; private Number maximum = 0; - private EditorType editorType = EditorType.SPINNER; + private EditorType editorType = SPINNER; public NumberFeatureTraits() { @@ -66,9 +68,9 @@ public boolean isLimited() return limited; } - public void setLimited(boolean limited) + public void setLimited(boolean aLimited) { - this.limited = limited; + limited = aLimited; } public Number getMinimum() @@ -76,9 +78,9 @@ public Number getMinimum() return minimum; } - public void setMinimum(Number minimum) + public void setMinimum(Number aMinimum) { - this.minimum = minimum; + minimum = aMinimum; } public Number getMaximum() @@ -86,9 +88,9 @@ public Number getMaximum() return maximum; } - public void setMaximum(Number maximum) + public void setMaximum(Number aMaximum) { - this.maximum = maximum; + maximum = aMaximum; } public EditorType getEditorType() @@ -96,8 +98,8 @@ public EditorType getEditorType() return editorType; } - public void setEditorType(EditorType editorType) + public void setEditorType(EditorType aEditorType) { - this.editorType = editorType; + editorType = aEditorType; } } diff --git a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.html b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.html index aaf148c1118..283ae5e7ced 100644 --- a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.html +++ b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.html @@ -18,18 +18,18 @@ --> -
-
-
- - +
+
+
+
+ + +
-
- -
+
@@ -37,7 +37,7 @@
-
+
diff --git a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.java b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.java index d4945d09e28..77176ca8216 100644 --- a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.java +++ b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/number/NumberFeatureTraitsEditor.java @@ -17,6 +17,8 @@ */ package de.tudarmstadt.ukp.inception.annotation.feature.number; +import static de.tudarmstadt.ukp.inception.annotation.feature.number.NumberFeatureTraits.EditorType.SPINNER; +import static de.tudarmstadt.ukp.inception.support.lambda.HtmlElementEvents.CHANGE_EVENT; import static de.tudarmstadt.ukp.inception.support.lambda.LambdaBehavior.visibleWhen; import java.io.Serializable; @@ -31,7 +33,6 @@ import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; -import org.apache.wicket.model.PropertyModel; import org.apache.wicket.spring.injection.annot.SpringBean; import org.wicketstuff.jquery.core.Options; import org.wicketstuff.kendo.ui.form.NumberTextField; @@ -70,7 +71,7 @@ public NumberFeatureTraitsEditor(String aId, feature = aFeature; traits = Model.of(readTraits()); - Form form = new Form(MID_FORM, CompoundPropertyModel.of(traits)) + var form = new Form(MID_FORM, CompoundPropertyModel.of(traits)) { private static final long serialVersionUID = 4456748721289266655L; @@ -82,8 +83,6 @@ protected void onSubmit() } }; form.setOutputMarkupPlaceholderTag(true); - form.add(visibleWhen( - () -> traits.getObject().isLimited() && feature.getObject().getTagset() == null)); add(form); Class clazz = Integer.class; @@ -101,25 +100,30 @@ protected void onSubmit() } } - DropDownChoice editorType = new DropDownChoice<>( - CID_EDITOR_TYPE); - editorType.setModel(PropertyModel.of(traits, "editorType")); + var limited = new CheckBox("limited"); + limited.add(new LambdaAjaxFormComponentUpdatingBehavior(CHANGE_EVENT, + target -> target.add(form))); + form.add(limited); + + var editorType = new DropDownChoice(CID_EDITOR_TYPE); + // editorType.setModel(PropertyModel.of(traits, "editorType")); editorType.setChoices(Arrays.asList(NumberFeatureTraits.EditorType.values())); editorType.add(new LambdaAjaxFormComponentUpdatingBehavior("change")); - editorType.add(visibleWhen(() -> isEditorTypeSelectionPossible())); + editorType.add(visibleWhen( + () -> traits.getObject().isLimited() && isEditorTypeSelectionPossible())); form.add(editorType); var minimum = new NumberTextField<>("minimum", clazz, options); - minimum.setModel(PropertyModel.of(traits, "minimum")); + minimum.add(visibleWhen(() -> traits.getObject().isLimited())); form.add(minimum); var maximum = new NumberTextField<>("maximum", clazz, options); - maximum.setModel(PropertyModel.of(traits, "maximum")); + maximum.add(visibleWhen(() -> traits.getObject().isLimited())); form.add(maximum); minimum.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> { - BigDecimal min = new BigDecimal(traits.getObject().getMinimum().toString()); - BigDecimal max = new BigDecimal(traits.getObject().getMaximum().toString()); + var min = new BigDecimal(traits.getObject().getMinimum().toString()); + var max = new BigDecimal(traits.getObject().getMaximum().toString()); if (min.compareTo(max) > 0) { traits.getObject().setMaximum(traits.getObject().getMinimum()); } @@ -127,19 +131,13 @@ protected void onSubmit() })); maximum.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> { - BigDecimal min = new BigDecimal(traits.getObject().getMinimum().toString()); - BigDecimal max = new BigDecimal(traits.getObject().getMaximum().toString()); + var min = new BigDecimal(traits.getObject().getMinimum().toString()); + var max = new BigDecimal(traits.getObject().getMaximum().toString()); if (min.compareTo(max) > 0) { traits.getObject().setMinimum(traits.getObject().getMaximum()); } target.add(form); })); - - CheckBox multipleRows = new CheckBox("limited"); - multipleRows.setModel(PropertyModel.of(traits, "limited")); - multipleRows.add( - new LambdaAjaxFormComponentUpdatingBehavior("change", target -> target.add(form))); - add(multipleRows); } /** @@ -168,9 +166,9 @@ private UimaPrimitiveFeatureSupport_ImplBase getFeatureSupp */ private Traits readTraits() { - Traits result = new Traits(); + var result = new Traits(); - NumberFeatureTraits t = getFeatureSupport().readTraits(feature.getObject()); + var t = getFeatureSupport().readTraits(feature.getObject()); result.setLimited(t.isLimited()); result.setMinimum(t.getMinimum()); @@ -186,13 +184,13 @@ private Traits readTraits() */ private void writeTraits() { - NumberFeatureTraits t = new NumberFeatureTraits(); + var t = new NumberFeatureTraits(); t.setLimited(traits.getObject().isLimited()); t.setMinimum(traits.getObject().getMinimum()); t.setMaximum(traits.getObject().getMaximum()); - t.setEditorType(isEditorTypeSelectionPossible() ? traits.getObject().getEditorType() - : NumberFeatureTraits.EditorType.SPINNER); + t.setEditorType( + isEditorTypeSelectionPossible() ? traits.getObject().getEditorType() : SPINNER); getFeatureSupport().writeTraits(feature.getObject(), t); } @@ -216,9 +214,9 @@ public boolean isLimited() return limited; } - public void setLimited(boolean limited) + public void setLimited(boolean aLimited) { - this.limited = limited; + limited = aLimited; } public Number getMinimum() @@ -226,9 +224,9 @@ public Number getMinimum() return minimum; } - public void setMinimum(Number minimum) + public void setMinimum(Number aMinimum) { - this.minimum = minimum; + minimum = aMinimum; } public Number getMaximum() @@ -236,9 +234,9 @@ public Number getMaximum() return maximum; } - public void setMaximum(Number maximum) + public void setMaximum(Number aMaximum) { - this.maximum = maximum; + maximum = aMaximum; } public NumberFeatureTraits.EditorType getEditorType() @@ -246,9 +244,9 @@ public NumberFeatureTraits.EditorType getEditorType() return editorType; } - public void setEditorType(NumberFeatureTraits.EditorType editorType) + public void setEditorType(NumberFeatureTraits.EditorType aEditorType) { - this.editorType = editorType; + editorType = aEditorType; } } } diff --git a/inception/inception-diam-editor/src/main/ts/src/AnnotationsByLayerList.svelte b/inception/inception-diam-editor/src/main/ts/src/AnnotationsByLayerList.svelte index 8578b7c88af..8e93d6c2ae5 100644 --- a/inception/inception-diam-editor/src/main/ts/src/AnnotationsByLayerList.svelte +++ b/inception/inception-diam-editor/src/main/ts/src/AnnotationsByLayerList.svelte @@ -219,7 +219,7 @@
scrollTo(ann)}> -
+
scrollTo(target)} > -
+
scrollToSpan(firstSpan)} > -
+
{#each spans as span} @@ -144,7 +144,7 @@ class="flex-grow-1 my-1 mx-2 overflow-hidden" on:click={() => scrollToRelation(relation)} > -
+
getFeatureType(AnnotationFeature aFeature) } return Optional.of(new FeatureType(aFeature.getType(), - aFeature.getType().substring(PREFIX.length()), featureSupportId)); + "Lookup (" + aFeature.getType().substring(PREFIX.length()) + ")", + featureSupportId)); } @Override public List getSupportedFeatureTypes(AnnotationLayer aAnnotationLayer) { - return asList(new FeatureType(TYPE_STRING_LOOKUP, "Lookup", featureSupportId)); + return asList( + new FeatureType(TYPE_STRING_LOOKUP, "Lookup (" + STRING + ")", featureSupportId)); } @Override diff --git a/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/FeatureDetailForm.java b/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/FeatureDetailForm.java index 45e1da37bf3..e29cae6ba31 100644 --- a/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/FeatureDetailForm.java +++ b/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/FeatureDetailForm.java @@ -19,20 +19,23 @@ import static de.tudarmstadt.ukp.clarin.webanno.ui.project.layers.ProjectLayersPanel.MID_FEATURE_DETAIL_FORM; import static de.tudarmstadt.ukp.clarin.webanno.ui.project.layers.ProjectLayersPanel.MID_FEATURE_SELECTION_FORM; -import static de.tudarmstadt.ukp.inception.support.WebAnnoConst.CHAIN_TYPE; -import static de.tudarmstadt.ukp.inception.support.WebAnnoConst.RELATION_TYPE; +import static de.tudarmstadt.ukp.inception.support.lambda.HtmlElementEvents.CHANGE_EVENT; import static de.tudarmstadt.ukp.inception.support.lambda.LambdaBehavior.enabledWhen; import static de.tudarmstadt.ukp.inception.support.lambda.LambdaBehavior.visibleWhen; import static java.util.Arrays.asList; import static java.util.Objects.isNull; import static org.apache.commons.lang3.StringUtils.isNotBlank; +import static org.apache.uima.cas.CAS.TYPE_NAME_BOOLEAN; +import static org.apache.uima.cas.CAS.TYPE_NAME_DOUBLE; +import static org.apache.uima.cas.CAS.TYPE_NAME_FLOAT; +import static org.apache.uima.cas.CAS.TYPE_NAME_INTEGER; +import static org.apache.uima.cas.CAS.TYPE_NAME_STRING; +import static org.apache.uima.cas.CAS.TYPE_NAME_STRING_ARRAY; import java.io.IOException; -import org.apache.uima.cas.CAS; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import org.apache.wicket.feedback.IFeedback; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; @@ -53,6 +56,8 @@ import de.tudarmstadt.ukp.clarin.webanno.api.casstorage.CasStorageService; import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature; import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer; +import de.tudarmstadt.ukp.inception.annotation.layer.chain.ChainLayerSupport; +import de.tudarmstadt.ukp.inception.annotation.layer.relation.RelationLayerSupport; import de.tudarmstadt.ukp.inception.bootstrap.dialog.ChallengeResponseDialog; import de.tudarmstadt.ukp.inception.documents.api.DocumentService; import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService; @@ -62,6 +67,7 @@ import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureType; import de.tudarmstadt.ukp.inception.schema.api.layer.LayerSupportRegistry; import de.tudarmstadt.ukp.inception.support.lambda.LambdaAjaxButton; +import de.tudarmstadt.ukp.inception.support.lambda.LambdaAjaxFormComponentUpdatingBehavior; import de.tudarmstadt.ukp.inception.support.lambda.LambdaBehavior; import de.tudarmstadt.ukp.inception.support.lambda.LambdaButton; import de.tudarmstadt.ukp.inception.support.lambda.LambdaModelAdapter; @@ -108,7 +114,7 @@ public FeatureDetailForm(String id, IModel aFeature) add(new TextArea("description")); defaultOptionsContainer = new WebMarkupContainer("defaultOptionsContainer"); - defaultOptionsContainer.add(LambdaBehavior.visibleWhen(this::isUsingDefaultOptions)); + defaultOptionsContainer.add(visibleWhen(this::isUsingDefaultOptions)); add(defaultOptionsContainer); defaultOptionsContainer.add(new CheckBox("enabled").setOutputMarkupPlaceholderTag(true)); defaultOptionsContainer.add(new CheckBox("curatable").setOutputMarkupPlaceholderTag(true)); @@ -116,9 +122,9 @@ public FeatureDetailForm(String id, IModel aFeature) required = new CheckBox("required"); required.setOutputMarkupPlaceholderTag(true); required.add(LambdaBehavior.onConfigure(_this -> { - boolean mandatory = asList(CAS.TYPE_NAME_INTEGER, CAS.TYPE_NAME_FLOAT, - CAS.TYPE_NAME_DOUBLE, CAS.TYPE_NAME_BOOLEAN) - .contains(FeatureDetailForm.this.getModelObject().getType()); + var type = FeatureDetailForm.this.getModelObject().getType(); + var mandatory = asList(TYPE_NAME_INTEGER, TYPE_NAME_FLOAT, TYPE_NAME_DOUBLE, + TYPE_NAME_BOOLEAN).contains(type); _this.setEnabled(!mandatory); if (mandatory) { required.setModel(Model.of(true)); @@ -130,15 +136,26 @@ public FeatureDetailForm(String id, IModel aFeature) defaultOptionsContainer.add(required); defaultOptionsContainer.add(new CheckBox("visible").setOutputMarkupPlaceholderTag(true)); + defaultOptionsContainer.add(new CheckBox("hideUnconstraintFeature") // + .setOutputMarkupPlaceholderTag(true) // + .add(visibleWhen(() -> { + var type = FeatureDetailForm.this.getModelObject().getType(); + var constaintsSupportType = asList(TYPE_NAME_STRING_ARRAY, TYPE_NAME_STRING) + .contains(type); + var hasTagset = FeatureDetailForm.this.getModelObject().getTagset() != null; + return constaintsSupportType && hasTagset; + })) // + .setOutputMarkupPlaceholderTag(true)); defaultOptionsContainer - .add(new CheckBox("hideUnconstraintFeature").setOutputMarkupPlaceholderTag(true)); - defaultOptionsContainer.add(new CheckBox("includeInHover") - .setOutputMarkupPlaceholderTag(true).add(LambdaBehavior.visibleWhen(() -> { - var layertype = FeatureDetailForm.this.getModelObject().getLayer().getType(); - // Currently not configurable for chains or relations - // TODO: technically it is possible - return !CHAIN_TYPE.equals(layertype) && !RELATION_TYPE.equals(layertype); - }))); + .add(new CheckBox("includeInHover").setOutputMarkupPlaceholderTag(true) // + .add(visibleWhen(() -> { + var layertype = FeatureDetailForm.this.getModelObject().getLayer() + .getType(); + // Currently not configurable for chains or relations + // TODO: technically it is possible + return !ChainLayerSupport.TYPE.equals(layertype) + && !RelationLayerSupport.TYPE.equals(layertype); + }))); add(featureType = new DropDownChoice("type") { @@ -180,24 +197,17 @@ protected void onModelChanged() asList(featureSupportRegistry.getFeatureType(getModelObject()))); } })); - featureType.add(new AjaxFormComponentUpdatingBehavior("change") - { - private static final long serialVersionUID = -2904306846882446294L; - - @Override - protected void onUpdate(AjaxRequestTarget aTarget) - { - aTarget.add(required); - aTarget.add(traitsContainer); - } - }); + featureType.add(new LambdaAjaxFormComponentUpdatingBehavior(CHANGE_EVENT, _target -> { + _target.add(required); + _target.add(traitsContainer); + })); // Processing the data in onAfterSubmit so the traits panel can use the // override onSubmit in its nested form and store the traits before // we clear the currently selected feature. add(new LambdaAjaxButton<>("save", this::actionSave).triggerAfterSubmit()); add(new LambdaAjaxButton<>("delete", this::actionDelete) - .add(enabledWhen(() -> isDeletable()))); + .add(enabledWhen(this::isDeletable))); // Set default form processing to false to avoid saving data add(new LambdaButton("cancel", this::actionCancel).setDefaultFormProcessing(false)); diff --git a/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/ProjectLayersPanel.html b/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/ProjectLayersPanel.html index cd2a24eeb0f..bd17ea65701 100644 --- a/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/ProjectLayersPanel.html +++ b/inception/inception-ui-project/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/project/layers/ProjectLayersPanel.html @@ -156,6 +156,7 @@
+
Type cannot be changed after creation
@@ -284,6 +285,7 @@