Java Code Examples for org.apache.wicket.markup.html.form.DropDownChoice#setChoiceRenderer()

The following examples show how to use org.apache.wicket.markup.html.form.DropDownChoice#setChoiceRenderer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActiveLearningSidebar.java    From inception with Apache License 2.0 6 votes vote down vote up
private Form<Void> createSessionControlForm()
{
    Form<Void> form = new Form<>(CID_SESSION_CONTROL_FORM);

    DropDownChoice<AnnotationLayer> layersDropdown = new BootstrapSelect<>(CID_SELECT_LAYER);
    layersDropdown.setModel(alStateModel.bind("layer"));
    layersDropdown.setChoices(LoadableDetachableModel.of(this::listLayersWithRecommenders));
    layersDropdown.setChoiceRenderer(new LambdaChoiceRenderer<>(AnnotationLayer::getUiName));
    layersDropdown.add(LambdaBehavior.onConfigure(it -> it.setEnabled(!alStateModel
        .getObject().isSessionActive())));
    layersDropdown.setOutputMarkupId(true);
    layersDropdown.setRequired(true);
    form.add(layersDropdown);
    
    form.add(new LambdaAjaxSubmitLink(CID_START_SESSION_BUTTON, this::actionStartSession)
            .add(visibleWhen(() -> !alStateModel.getObject().isSessionActive())));
    form.add(new LambdaAjaxLink(CID_STOP_SESSION_BUTTON, this::actionStopSession)
        .add(visibleWhen(() -> alStateModel.getObject().isSessionActive())));
    form.add(visibleWhen(() -> alStateModel.getObject().isDoExistRecommenders()));

    return form;
}
 
Example 2
Source File: StatementGroupPanel.java    From inception with Apache License 2.0 6 votes vote down vote up
public NewStatementGroupFragment(String aId) {
    super(aId, "newStatementGroup", StatementGroupPanel.this, groupModel);
                
    IModel<KBProperty> property = Model.of();
    
    Form<KBProperty> form = new Form<>("form", property);
    DropDownChoice<KBProperty> type = new BootstrapSelect<>("property");
    type.setModel(property);
    type.setChoiceRenderer(new ChoiceRenderer<>("uiLabel"));            
    type.setChoices(getUnusedProperties());
    type.setRequired(true);
    type.setOutputMarkupId(true);
    form.add(type);
    focusComponent = type;
    
    form.add(new LambdaAjaxButton<>("create", this::actionNewProperty));
    form.add(new LambdaAjaxLink("cancel", this::actionCancelNewProperty));
    add(form);
}
 
Example 3
Source File: ExternalSearchAnnotationSidebar.java    From inception with Apache License 2.0 6 votes vote down vote up
public DocumentRepositorySelectionForm(String aId)
{
    super(aId);

    DropDownChoice<DocumentRepository> repositoryCombo =
        new BootstrapSelect<DocumentRepository>("repositoryCombo",
        new PropertyModel<DocumentRepository>(ExternalSearchAnnotationSidebar.this,
            "currentRepository"), repositoriesModel);

    repositoryCombo.setChoiceRenderer(new ChoiceRenderer<DocumentRepository>("name"));
    repositoryCombo.setNullValid(false);

    // Just update the selection
    repositoryCombo.add(new LambdaAjaxFormComponentUpdatingBehavior("change"));
    add(repositoryCombo);

}
 
Example 4
Source File: SearchPage.java    From inception with Apache License 2.0 6 votes vote down vote up
public SearchForm(String id)
{
    super(id);
    
    setModel(CompoundPropertyModel.of(new SearchFormModel()));
    
    DropDownChoice<DocumentRepository> repositoryCombo = 
            new BootstrapSelect<DocumentRepository>("repository");
    repositoryCombo.setChoices(LoadableDetachableModel
            .of(() -> externalSearchService.listDocumentRepositories(project)));
    repositoryCombo.setChoiceRenderer(new ChoiceRenderer<DocumentRepository>("name"));
    repositoryCombo.setNullValid(false);
    add(repositoryCombo);
    
    if (!repositoryCombo.getChoices().isEmpty()) {
        repositoryCombo.setModelObject(repositoryCombo.getChoices().get(0));
    }
    
    add(new TextField<>("query", String.class));
    
    LambdaAjaxSubmitLink searchLink = new LambdaAjaxSubmitLink("submitSearch",
            this::actionSearch);
    add(searchLink);
    setDefaultButton(searchLink);
}
 
Example 5
Source File: SingleChoiceEditor.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * Construct drop down box to select single value.
 *
 * @param id         editor id.
 * @param markupProvider markup object.
 * @param model      model.
 * @param labelModel label model
 * @param attrValue  {@link org.yes.cart.domain.entity.AttrValue}
 * @param choices    list of strings {@link org.yes.cart.domain.misc.Pair}, that represent options to select one
 * @param readOnly  if true this component is read only
 */
public SingleChoiceEditor(final String id,
                          final MarkupContainer markupProvider,
                          final IModel model,
                          final IModel<String> labelModel,
                          final IModel choices,
                          final AttrValueWithAttribute attrValue,
                          final boolean readOnly) {

    super(id, "singleChoiceEditor", markupProvider);

    final DropDownChoice<Pair<String, String>> dropDownChoice =
            new DropDownChoice<Pair<String, String>>(EDIT, model, choices);
    dropDownChoice.setLabel(labelModel);
    dropDownChoice.setEnabled(!readOnly);
    dropDownChoice.setRequired(attrValue.getAttribute().isMandatory());
    dropDownChoice.setChoiceRenderer(new PairChoiceRenderer());
    add(dropDownChoice);

}
 
Example 6
Source File: QualifierEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new fragement for editing a qualifier.<br>
 * The editor has two slightly different behaviors, depending on the value of
 * {@code isNewQualifier}:
 * <ul>
 * <li>{@code !isNewQualifier}: Save button commits changes, cancel button discards unsaved
 * changes, delete button removes the qualifier from the statement.</li>
 * <li>{@code isNewQualifier}: Save button commits changes (creates a new qualifier in the
 * statement), cancel button removes the qualifier from the UI, delete button is not visible
 * .</li>
 * </ul>
 *
 * @param aId
 *            markup ID
 * @param aQualifier
 *            qualifier model
 * @param isNewQualifier
 *            whether the qualifier being edited is new, meaning it has no corresponding
 *            qualifier in the KB backend
 */
public EditMode(String aId, IModel<KBQualifier> aQualifier, boolean isNewQualifier)
{
    super(aId, "editMode", QualifierEditor.this, aQualifier);

    IModel<KBQualifier> compoundModel = CompoundPropertyModel.of(aQualifier);

    Form<KBQualifier> form = new Form<>("form", compoundModel);
    DropDownChoice<KBProperty> type = new BootstrapSelect<>("property");
    type.setChoiceRenderer(new ChoiceRenderer<>("uiLabel"));
    type.setChoices(kbService.listProperties(kbModel.getObject(), false));
    type.setRequired(true);
    type.setOutputMarkupId(true);
    form.add(type);
    initialFocusComponent = type;

    form.add(new TextField<>("language"));

    Component valueTextArea = new TextArea<String>("value");
    form.add(valueTextArea);

    form.add(new LambdaAjaxButton<>("create", QualifierEditor.this::actionSave));
    form.add(new LambdaAjaxLink("cancel", t -> {
        if (isNewQualifier) {
            QualifierEditor.this.actionCancelNewQualifier(t);
        } else {
            QualifierEditor.this.actionCancelExistingQualifier(t);
        }
    }));
    form.add(new LambdaAjaxLink("delete", QualifierEditor.this::actionDelete)
        .setVisibilityAllowed(!isNewQualifier));

    add(form);
}
 
Example 7
Source File: DocumentMetadataAnnotationSelectionPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public DocumentMetadataAnnotationSelectionPanel(String aId, IModel<Project> aProject,
        IModel<SourceDocument> aDocument, IModel<String> aUsername,
        CasProvider aCasProvider, AnnotationPage aAnnotationPage,
        AnnotationActionHandler aActionHandler, AnnotatorState aState)
{
    super(aId, aProject);

    setOutputMarkupPlaceholderTag(true);
    
    annotationPage = aAnnotationPage;
    sourceDocument = aDocument;
    username = aUsername;
    jcasProvider = aCasProvider;
    project = aProject;
    selectedLayer = Model.of();
    actionHandler = aActionHandler;
    state = aState;

    annotationsContainer = new WebMarkupContainer(CID_ANNOTATIONS_CONTAINER);
    annotationsContainer.setOutputMarkupId(true);
    annotationsContainer.add(createAnnotationList());
    add(annotationsContainer);
    
    DropDownChoice<AnnotationLayer> layer = new BootstrapSelect<>(CID_LAYER);
    layer.setModel(selectedLayer);
    layer.setChoices(this::listMetadataLayers);
    layer.setChoiceRenderer(new ChoiceRenderer<>("uiName"));
    layer.add(new LambdaAjaxFormComponentUpdatingBehavior("change"));
    add(layer);
    
    add(new LambdaAjaxLink(CID_CREATE, this::actionCreate));
}
 
Example 8
Source File: ProjectDetailPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
public ProjectDetailPanel(String id, IModel<Project> aModel)
{
    super(id, aModel);
    
    projectModel = aModel;
    
    Form<Project> form = new Form<>("form", CompoundPropertyModel.of(aModel));
    add(form);
    
    TextField<String> projectNameTextField = new TextField<>("name");
    projectNameTextField.setRequired(true);
    projectNameTextField.add(new ProjectExistsValidator());
    projectNameTextField.add(new ProjectNameValidator());
    form.add(projectNameTextField);

    // If we run in development mode, then also show the ID of the project
    form.add(idLabel = new Label("id"));
    idLabel.setVisible(RuntimeConfigurationType.DEVELOPMENT
            .equals(getApplication().getConfigurationType()));

    form.add(new TextArea<String>("description").setOutputMarkupId(true));
    
    DropDownChoice<ScriptDirection> scriptDirection = new BootstrapSelect<>("scriptDirection");
    scriptDirection.setChoiceRenderer(new EnumChoiceRenderer<>(this));
    scriptDirection.setChoices(Arrays.asList(ScriptDirection.values()));
    form.add(scriptDirection);
    
    form.add(new CheckBox("disableExport").setOutputMarkupPlaceholderTag(true));

    form.add(new CheckBox("anonymousCuration").setOutputMarkupPlaceholderTag(true));

    form.add(projectTypes = makeProjectTypeChoice());
    
    form.add(new LambdaAjaxButton<>("save", this::actionSave));
}
 
Example 9
Source File: LayerSelectionPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
private DropDownChoice<AnnotationLayer> createDefaultAnnotationLayerSelector()
{
    DropDownChoice<AnnotationLayer> selector = new BootstrapSelect<>("defaultAnnotationLayer");
    selector.setChoices(LoadableDetachableModel.of(this::getSelectableLayers));
    selector.setChoiceRenderer(new ChoiceRenderer<>("uiName"));
    selector.setOutputMarkupId(true);
    selector.add(LambdaAjaxFormComponentUpdatingBehavior.onUpdate("change",
            this::actionChangeDefaultLayer));
    return selector;
}
 
Example 10
Source File: KnowledgeBasePanel.java    From inception with Apache License 2.0 4 votes vote down vote up
public KnowledgeBasePanel(String id, IModel<Project> aProjectModel,
        IModel<KnowledgeBase> aKbModel)
{
    super(id, aKbModel);

    setOutputMarkupId(true);

    kbModel = aKbModel;
    
    // add the selector for the knowledge bases
    DropDownChoice<KnowledgeBase> ddc = new BootstrapSelect<KnowledgeBase>("knowledgebases",
            LoadableDetachableModel
                    .of(() -> kbService.getEnabledKnowledgeBases(aProjectModel.getObject())));
    
    ddc.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> {
        long projectId = aProjectModel.getObject().getId();
        String kbName = aKbModel.getObject().getName();

        PageParameters params = new PageParameters()
            .set(PAGE_PARAM_PROJECT_ID, projectId)
            .set(PAGE_PARAM_KB_NAME, kbName);

        setResponsePage(KnowledgeBasePage.class, params);
    }));

    ddc.setModel(aKbModel);
    ddc.setChoiceRenderer(new ChoiceRenderer<>("name"));
    add(ddc);

    add(createSearchField("searchBar", searchHandleModel, aProjectModel));

    add(conceptTreePanel = new ConceptTreePanel("concepts", kbModel, selectedConceptHandle));
    add(propertyListPanel = new PropertyListPanel("properties", kbModel,
            selectedPropertyHandle));
    
    detailContainer = new WebMarkupContainer(DETAIL_CONTAINER_MARKUP_ID);
    detailContainer.setOutputMarkupId(true);
    add(detailContainer);
    
    details = new EmptyPanel(DETAILS_MARKUP_ID);
    detailContainer.add(details);
}
 
Example 11
Source File: LinkFeatureTraitsEditor.java    From webanno with Apache License 2.0 4 votes vote down vote up
public LinkFeatureTraitsEditor(String aId, SlotFeatureSupport aFS,
        IModel<AnnotationFeature> aFeatureModel)
{
    super(aId, aFeatureModel);
    
    // We cannot retain a reference to the actual SlotFeatureSupport instance because that
    // is not serializable, but we can retain its ID and look it up again from the registry
    // when required.
    featureSupportId = aFS.getId();
    feature = aFeatureModel;
    
    traits = Model.of(readTraits());
    
    Form<Traits> form = new Form<Traits>(MID_FORM, CompoundPropertyModel.of(traits))
    {
        private static final long serialVersionUID = -3109239605783291123L;

        @Override
        protected void onSubmit()
        {
            super.onSubmit();
            // when saving reset the selected tagset if role labels are not enabled
            if (!traits.getObject().isEnableRoleLabels()) {
                feature.getObject().setTagset(null);
            }
            writeTraits();
        }
    };
    form.setOutputMarkupPlaceholderTag(true);
    add(form);
    
    MultiSelect<Tag> defaultSlots  = new MultiSelect<Tag>("defaultSlots") {
        private static final long serialVersionUID = 8231304829756188352L;
        
        @Override
        public void onConfigure(JQueryBehavior aBehavior)
        {
            super.onConfigure(aBehavior);
            //aBehavior.setOption("placeholder", Options.asString(getString("placeholder")));
            aBehavior.setOption("filter", Options.asString("contains"));
            aBehavior.setOption("autoClose", false);
        }
    };
    defaultSlots.setChoices(LambdaModel.of(this::listTags));
    defaultSlots.setChoiceRenderer(new ChoiceRenderer<>("name"));
    defaultSlots.add(visibleWhen(() -> traits.getObject().isEnableRoleLabels()
            && feature.getObject().getTagset() != null));
    form.add(defaultSlots);

    CheckBox enableRoleLabels = new CheckBox("enableRoleLabels");
    enableRoleLabels.setModel(PropertyModel.of(traits, "enableRoleLabels"));
    enableRoleLabels.add(new LambdaAjaxFormComponentUpdatingBehavior("change", 
        target -> target.add(form)
    ));
    form.add(enableRoleLabels);
    
    DropDownChoice<TagSet> tagset = new BootstrapSelect<>("tagset");
    tagset.setOutputMarkupPlaceholderTag(true);
    tagset.setOutputMarkupId(true);
    tagset.setChoiceRenderer(new ChoiceRenderer<>("name"));
    tagset.setNullValid(true);
    tagset.setModel(PropertyModel.of(aFeatureModel, "tagset"));
    tagset.setChoices(LambdaModel.of(() -> annotationService
            .listTagSets(aFeatureModel.getObject().getProject())));
    tagset.add(new LambdaAjaxFormComponentUpdatingBehavior("change", target -> {
        traits.getObject().setDefaultSlots(new ArrayList<>());
        target.add(form);
    }));
    tagset.add(visibleWhen(() -> traits.getObject().isEnableRoleLabels()));
    form.add(tagset);
}
 
Example 12
Source File: StringFeatureTraitsEditor.java    From webanno with Apache License 2.0 4 votes vote down vote up
public StringFeatureTraitsEditor(String aId,
        UimaPrimitiveFeatureSupport_ImplBase<StringFeatureTraits> aFS,
        IModel<AnnotationFeature> aFeature)
{
    super(aId, aFeature);

    // We cannot retain a reference to the actual SlotFeatureSupport instance because that
    // is not serializable, but we can retain its ID and look it up again from the registry
    // when required.
    featureSupportId = aFS.getId();
    feature = aFeature;

    traits = CompoundPropertyModel.of(getFeatureSupport().readTraits(feature.getObject()));

    keyBindings = newKeyBindingsConfigurationPanel(aFeature);
    add(keyBindings);

    Form<StringFeatureTraits> form = new Form<StringFeatureTraits>(MID_FORM, traits)
    {
        private static final long serialVersionUID = -3109239605783291123L;

        @Override
        protected void onSubmit()
        {
            super.onSubmit();

            // Tagsets only are allowed for single-row input fields, not for textareas
            if (traits.getObject().isMultipleRows()) {
                feature.getObject().setTagset(null);
            } else {
                traits.getObject().setDynamicSize(false);
            }

            getFeatureSupport().writeTraits(feature.getObject(), traits.getObject());
        }
    };
    form.setOutputMarkupPlaceholderTag(true);
    add(form);

    NumberTextField<Integer> collapsedRows = new NumberTextField<>("collapsedRows",
            Integer.class);
    collapsedRows.setModel(PropertyModel.of(traits, "collapsedRows"));
    collapsedRows.setMinimum(1);
    collapsedRows.add(visibleWhen(() -> traits.getObject().isMultipleRows()
            && !traits.getObject().isDynamicSize()));
    form.add(collapsedRows);

    NumberTextField<Integer> expandedRows = new NumberTextField<>("expandedRows",
            Integer.class);
    expandedRows.setModel(PropertyModel.of(traits, "expandedRows"));
    expandedRows.setMinimum(1);
    expandedRows.add(visibleWhen(() -> traits.getObject().isMultipleRows() 
            && !traits.getObject().isDynamicSize()));
    form.add(expandedRows);

    DropDownChoice<TagSet> tagset = new BootstrapSelect<>("tagset");
    tagset.setOutputMarkupPlaceholderTag(true);
    tagset.setChoiceRenderer(new ChoiceRenderer<>("name"));
    tagset.setNullValid(true);
    tagset.setModel(PropertyModel.of(aFeature, "tagset"));
    tagset.setChoices(LoadableDetachableModel
            .of(() -> annotationService.listTagSets(aFeature.getObject().getProject())));
    tagset.add(visibleWhen(() -> !traits.getObject().isMultipleRows()));
    // If we change the tagset, the input component for the key bindings may change, so we need
    // to re-generate the key bindings
    tagset.add(new LambdaAjaxFormComponentUpdatingBehavior("change", _target -> {
        KeyBindingsConfigurationPanel newKeyBindings = newKeyBindingsConfigurationPanel(
                aFeature);
        keyBindings.replaceWith(newKeyBindings);
        keyBindings = newKeyBindings;
        _target.add(keyBindings);
    }));
    form.add(tagset);

    CheckBox multipleRows = new CheckBox("multipleRows");
    multipleRows.setModel(PropertyModel.of(traits, "multipleRows"));
    multipleRows.add(
            new LambdaAjaxFormComponentUpdatingBehavior("change", target -> target.add(form)));
    form.add(multipleRows);

    CheckBox dynamicSize = new CheckBox("dynamicSize");
    dynamicSize.setModel(PropertyModel.of(traits, "dynamicSize"));
    dynamicSize.add(new LambdaAjaxFormComponentUpdatingBehavior("change",
        target -> target.add(form)
    ));
    dynamicSize.add(visibleWhen(() -> traits.getObject().isMultipleRows()));
    form.add(dynamicSize);
}
 
Example 13
Source File: AnnotationPreferencesDialogContent.java    From webanno with Apache License 2.0 4 votes vote down vote up
public AnnotationPreferencesDialogContent(String aId, final ModalWindow aModalWindow,
        IModel<AnnotatorState> aModel)
{
    super(aId);
    
    stateModel = aModel;
    modalWindow = aModalWindow;
    
    form = new Form<>("form", new CompoundPropertyModel<>(loadModel(stateModel.getObject())));

    NumberTextField<Integer> windowSizeField = new NumberTextField<>("windowSize");
    windowSizeField.setType(Integer.class);
    windowSizeField.setMinimum(1);
    form.add(windowSizeField);

    NumberTextField<Integer> sidebarSizeField = new NumberTextField<>("sidebarSize");
    sidebarSizeField.setType(Integer.class);
    sidebarSizeField.setMinimum(AnnotationPreference.SIDEBAR_SIZE_MIN);
    sidebarSizeField.setMaximum(AnnotationPreference.SIDEBAR_SIZE_MAX);
    form.add(sidebarSizeField);

    NumberTextField<Integer> fontZoomField = new NumberTextField<>("fontZoom");
    fontZoomField.setType(Integer.class);
    fontZoomField.setMinimum(AnnotationPreference.FONT_ZOOM_MIN);
    fontZoomField.setMaximum(AnnotationPreference.FONT_ZOOM_MAX);
    form.add(fontZoomField);

    List<Pair<String, String>> editorChoices = annotationEditorRegistry.getEditorFactories()
            .stream()
            .map(f -> Pair.of(f.getBeanName(), f.getDisplayName()))
            .collect(Collectors.toList());
    DropDownChoice<Pair<String, String>> editor = new BootstrapSelect<>("editor");
    editor.setChoiceRenderer(new ChoiceRenderer<>("value"));
    editor.setChoices(editorChoices);
    editor.add(visibleWhen(() -> editor.getChoices().size() > 1
            && ANNOTATION.equals(stateModel.getObject().getMode())));
    form.add(editor);

    // Add layer check boxes and combo boxes
    form.add(createLayerContainer());

    // Add a check box to enable/disable automatic page navigations while annotating
    form.add(new CheckBox("scrollPage"));

    // Add a check box to enable/disable arc collapsing
    form.add(new CheckBox("collapseArcs"));

    form.add(new CheckBox("rememberLayer"));

    // Add global read-only coloring strategy combo box
    DropDownChoice<ReadonlyColoringBehaviour> readOnlyColor = new BootstrapSelect<>(
            "readonlyLayerColoringBehaviour");
    readOnlyColor.setChoices(asList(ReadonlyColoringBehaviour.values()));
    readOnlyColor.setChoiceRenderer(new ChoiceRenderer<>("descriptiveName"));
    form.add(readOnlyColor);

    form.add(new LambdaAjaxButton<>("save", this::actionSave));
    form.add(new LambdaAjaxLink("cancel", this::actionCancel));
    
    add(form);
}
 
Example 14
Source File: AnnotationPreferencesDialogContent.java    From webanno with Apache License 2.0 4 votes vote down vote up
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()));
        }
    };
}