use of de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxFormComponentUpdatingBehavior in project webanno by webanno.
the class LayerSelectionPanel method createForwardAnnotationCheckBox.
/**
* Part of <i>forward annotation</i> mode: creates the checkbox to toggle forward annotation
* mode.
*/
private CheckBox createForwardAnnotationCheckBox() {
CheckBox checkbox = new CheckBox("forwardAnnotation");
checkbox.setOutputMarkupId(true);
checkbox.add(LambdaBehavior.onConfigure(_this -> {
// Force-disable forward annotation mode if current layer is not forwardable
if (!isForwardable()) {
getModelObject().setForwardAnnotation(false);
}
}));
checkbox.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> owner.getFeatureEditorListPanel().focusForwardAnnotationComponent(_target, true)));
return checkbox;
}
use of de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxFormComponentUpdatingBehavior in project webanno by webanno.
the class AnnotationPreferencesDialogContent method createLayerContainer.
private ListView<AnnotationLayer> createLayerContainer() {
return new ListView<AnnotationLayer>("annotationLayers") {
private static final long serialVersionUID = -4040731191748923013L;
@Override
protected void populateItem(ListItem<AnnotationLayer> aItem) {
Preferences prefs = form.getModelObject();
AnnotationLayer layer = aItem.getModelObject();
Set<Long> hiddenLayerIds = stateModel.getObject().getPreferences().getHiddenAnnotationLayerIds();
// add visibility checkbox
CheckBox layerVisible = new CheckBox("annotationLayerActive", Model.of(!hiddenLayerIds.contains(layer.getId())));
layerVisible.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> {
if (!layerVisible.getModelObject()) {
hiddenLayerIds.add(layer.getId());
} else {
hiddenLayerIds.remove(layer.getId());
}
}));
aItem.add(layerVisible);
// add coloring strategy choice
DropDownChoice<ColoringStrategyType> layerColor = new BootstrapSelect<>("layercoloring");
layerColor.setModel(Model.of(prefs.colorPerLayer.get(layer.getId())));
layerColor.setChoiceRenderer(new ChoiceRenderer<>("descriptiveName"));
layerColor.setChoices(asList(ColoringStrategyType.values()));
layerColor.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> prefs.colorPerLayer.put(layer.getId(), layerColor.getModelObject())));
aItem.add(layerColor);
// add label
aItem.add(new Label("annotationLayerDesc", layer.getUiName()));
}
};
}
Aggregations