use of de.agilecoders.wicket.extensions.markup.html.bootstrap.form.select.BootstrapSelect 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