Search in sources :

Example 1 with BootstrapSelect

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()));
        }
    };
}
Also used : Form(org.apache.wicket.markup.html.form.Form) SpringBean(org.apache.wicket.spring.injection.annot.SpringBean) ProjectService(de.tudarmstadt.ukp.clarin.webanno.api.ProjectService) AnnotatorState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState) ColoringStrategyType(de.tudarmstadt.ukp.clarin.webanno.api.annotation.coloring.ColoringStrategyType) LoggerFactory(org.slf4j.LoggerFactory) CheckBox(org.apache.wicket.markup.html.form.CheckBox) CompoundPropertyModel(org.apache.wicket.model.CompoundPropertyModel) ANNOTATION(de.tudarmstadt.ukp.clarin.webanno.model.Mode.ANNOTATION) AnnotationSchemaService(de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService) Token(de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token) BootstrapSelect(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.select.BootstrapSelect) LambdaBehavior.visibleWhen(de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaBehavior.visibleWhen) Pair(org.apache.commons.lang3.tuple.Pair) AnnotationPreference(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotationPreference) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ChoiceRenderer(org.apache.wicket.markup.html.form.ChoiceRenderer) IModel(org.apache.wicket.model.IModel) ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) NumberTextField(org.apache.wicket.markup.html.form.NumberTextField) CURATION(de.tudarmstadt.ukp.clarin.webanno.model.Mode.CURATION) Logger(org.slf4j.Logger) ListItem(org.apache.wicket.markup.html.list.ListItem) LambdaAjaxFormComponentUpdatingBehavior(de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxFormComponentUpdatingBehavior) Model(org.apache.wicket.model.Model) UserDao(de.tudarmstadt.ukp.clarin.webanno.security.UserDao) Set(java.util.Set) ModalWindow(org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow) ReadonlyColoringBehaviour(de.tudarmstadt.ukp.clarin.webanno.api.annotation.coloring.ReadonlyColoringBehaviour) IOException(java.io.IOException) LambdaAjaxButton(de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxButton) Collectors(java.util.stream.Collectors) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Serializable(java.io.Serializable) CORRECTION(de.tudarmstadt.ukp.clarin.webanno.model.Mode.CORRECTION) Panel(org.apache.wicket.markup.html.panel.Panel) List(java.util.List) AnnotationEditorFactory(de.tudarmstadt.ukp.clarin.webanno.api.annotation.AnnotationEditorFactory) PreferencesUtil(de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.PreferencesUtil) LambdaAjaxLink(de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxLink) AnnotationLayer(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer) CHAIN_TYPE(de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.CHAIN_TYPE) AnnotationEditorRegistry(de.tudarmstadt.ukp.clarin.webanno.api.annotation.AnnotationEditorRegistry) Label(org.apache.wicket.markup.html.basic.Label) AnnotationLayer(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer) LambdaAjaxFormComponentUpdatingBehavior(de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxFormComponentUpdatingBehavior) ListView(org.apache.wicket.markup.html.list.ListView) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ListItem(org.apache.wicket.markup.html.list.ListItem) BootstrapSelect(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.select.BootstrapSelect) ColoringStrategyType(de.tudarmstadt.ukp.clarin.webanno.api.annotation.coloring.ColoringStrategyType)

Aggregations

BootstrapSelect (de.agilecoders.wicket.extensions.markup.html.bootstrap.form.select.BootstrapSelect)1 AnnotationSchemaService (de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService)1 ProjectService (de.tudarmstadt.ukp.clarin.webanno.api.ProjectService)1 CHAIN_TYPE (de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.CHAIN_TYPE)1 AnnotationEditorFactory (de.tudarmstadt.ukp.clarin.webanno.api.annotation.AnnotationEditorFactory)1 AnnotationEditorRegistry (de.tudarmstadt.ukp.clarin.webanno.api.annotation.AnnotationEditorRegistry)1 ColoringStrategyType (de.tudarmstadt.ukp.clarin.webanno.api.annotation.coloring.ColoringStrategyType)1 ReadonlyColoringBehaviour (de.tudarmstadt.ukp.clarin.webanno.api.annotation.coloring.ReadonlyColoringBehaviour)1 AnnotationPreference (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotationPreference)1 AnnotatorState (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState)1 PreferencesUtil (de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.PreferencesUtil)1 AnnotationLayer (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer)1 ANNOTATION (de.tudarmstadt.ukp.clarin.webanno.model.Mode.ANNOTATION)1 CORRECTION (de.tudarmstadt.ukp.clarin.webanno.model.Mode.CORRECTION)1 CURATION (de.tudarmstadt.ukp.clarin.webanno.model.Mode.CURATION)1 UserDao (de.tudarmstadt.ukp.clarin.webanno.security.UserDao)1 LambdaAjaxButton (de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxButton)1 LambdaAjaxFormComponentUpdatingBehavior (de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxFormComponentUpdatingBehavior)1 LambdaAjaxLink (de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxLink)1 LambdaBehavior.visibleWhen (de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaBehavior.visibleWhen)1