Skip to content

Commit

Permalink
Merge branch 'main' into refactoring/3415-Move-all-configuration-opti…
Browse files Browse the repository at this point in the history
…ons-to-Spring-configuration-beans

* main:
  No issue: Slightly improve annotation sidebar layout to ensure that no text is shown left of the label badge
  #5106 - Type of lookup feature is display wrong after creation
  #5104 - Agreement measure has wrong name
  #5098 - Conditional feature option for integer features should not be offered
  #5101 - Limited option on integer features cannot be turned off
  #5094 - Improve curation merge dialog layout
  • Loading branch information
reckart committed Oct 29, 2024
2 parents fc2fad4 + d31dc51 commit 8ca0415
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public String getId()
@Override
public String getName()
{
return "Krippendorff's Kappa (coding / nominal)";
return "Krippendorff's Alpha (coding / nominal)";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
{
Expand All @@ -66,38 +68,38 @@ public boolean isLimited()
return limited;
}

public void setLimited(boolean limited)
public void setLimited(boolean aLimited)
{
this.limited = limited;
limited = aLimited;
}

public Number getMinimum()
{
return minimum;
}

public void setMinimum(Number minimum)
public void setMinimum(Number aMinimum)
{
this.minimum = minimum;
minimum = aMinimum;
}

public Number getMaximum()
{
return maximum;
}

public void setMaximum(Number maximum)
public void setMaximum(Number aMaximum)
{
this.maximum = maximum;
maximum = aMaximum;
}

public EditorType getEditorType()
{
return editorType;
}

public void setEditorType(EditorType editorType)
public void setEditorType(EditorType aEditorType)
{
this.editorType = editorType;
editorType = aEditorType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@
-->
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="row form-row" wicket:enclosure="limited">
<div class="col-sm-8 offset-sm-4">
<div class="form-check">
<input wicket:id="limited" class="form-check-input" type="checkbox">
<label wicket:for="limited" class="form-check-label">
Limited
</label>
<form wicket:id="form">
<div class="row form-row" wicket:enclosure="limited">
<div class="col-sm-8 offset-sm-4">
<div class="form-check">
<input wicket:id="limited" class="form-check-input" type="checkbox">
<label wicket:for="limited" class="form-check-label">
Limited
</label>
</div>
</div>
</div>
</div>
<form wicket:id="form">
<div class="row form-row">
<div class="row form-row" wicket:enclosure="minimum">
<label wicket:for="minimum" class="col-sm-4 col-form-label">
Minimum
</label>
<div class="col-sm-8">
<input type="number" style="width:100%;" wicket:id="minimum" data-container="body"></input>
</div>
</div>
<div class="row form-row">
<div class="row form-row" wicket:enclosure="maximum">
<label wicket:for="maximum" class="col-sm-4 col-form-label">
Maximum
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -70,7 +71,7 @@ public NumberFeatureTraitsEditor(String aId,
feature = aFeature;
traits = Model.of(readTraits());

Form<Traits> form = new Form<Traits>(MID_FORM, CompoundPropertyModel.of(traits))
var form = new Form<Traits>(MID_FORM, CompoundPropertyModel.of(traits))
{
private static final long serialVersionUID = 4456748721289266655L;

Expand All @@ -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;
Expand All @@ -101,45 +100,44 @@ protected void onSubmit()
}
}

DropDownChoice<NumberFeatureTraits.EditorType> 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<NumberFeatureTraits.EditorType>(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());
}
target.add(form);
}));

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);
}

/**
Expand Down Expand Up @@ -168,9 +166,9 @@ private UimaPrimitiveFeatureSupport_ImplBase<NumberFeatureTraits> 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());
Expand All @@ -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);
}
Expand All @@ -216,39 +214,39 @@ public boolean isLimited()
return limited;
}

public void setLimited(boolean limited)
public void setLimited(boolean aLimited)
{
this.limited = limited;
limited = aLimited;
}

public Number getMinimum()
{
return minimum;
}

public void setMinimum(Number minimum)
public void setMinimum(Number aMinimum)
{
this.minimum = minimum;
minimum = aMinimum;
}

public Number getMaximum()
{
return maximum;
}

public void setMaximum(Number maximum)
public void setMaximum(Number aMaximum)
{
this.maximum = maximum;
maximum = aMaximum;
}

public NumberFeatureTraits.EditorType getEditorType()
{
return editorType;
}

public void setEditorType(NumberFeatureTraits.EditorType editorType)
public void setEditorType(NumberFeatureTraits.EditorType aEditorType)
{
this.editorType = editorType;
editorType = aEditorType;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class="flex-grow-1 my-1 mx-2 position-relative overflow-hidden" on:click={() => scrollTo(ann)}>
<div class="float-end labels me-1">
<div class="float-end labels">
<LabelBadge
annotation={ann}
{ajaxClient}
Expand Down Expand Up @@ -253,7 +253,7 @@
class="flex-grow-1 my-1 mx-2 overflow-hidden"
on:click={() => scrollTo(target)}
>
<div class="float-end labels me-1">
<div class="float-end labels">
<LabelBadge
annotation={relation}
{ajaxClient}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
class="flex-grow-1 my-1 mx-2 overflow-hidden"
on:click={() => scrollToSpan(firstSpan)}
>
<div class="float-end labels me-1">
<div class="float-end labels">
{#each spans as span}
<span
on:mouseover={(ev) =>
Expand Down Expand Up @@ -144,7 +144,7 @@
class="flex-grow-1 my-1 mx-2 overflow-hidden"
on:click={() => scrollToRelation(relation)}
>
<div class="float-end labels me-1">
<div class="float-end labels">
<LabelBadge
annotation={relation}
{ajaxClient}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static java.util.Arrays.asList;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

import java.lang.invoke.MethodHandles;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -61,7 +62,7 @@ public class LookupFeatureSupport
public static final String STRING = "string";
public static final String TYPE_STRING_LOOKUP = PREFIX + STRING;

private static final Logger LOG = LoggerFactory.getLogger(LookupFeatureSupport.class);
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private final LookupCache labelCache;
private final LookupServiceProperties properties;
Expand Down Expand Up @@ -94,13 +95,15 @@ public Optional<FeatureType> 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<FeatureType> getSupportedFeatureTypes(AnnotationLayer aAnnotationLayer)
{
return asList(new FeatureType(TYPE_STRING_LOOKUP, "Lookup", featureSupportId));
return asList(
new FeatureType(TYPE_STRING_LOOKUP, "Lookup (" + STRING + ")", featureSupportId));
}

@Override
Expand Down
Loading

0 comments on commit 8ca0415

Please sign in to comment.