@SuppressWarnings("unchecked") public AjaxDropDownChoicePanel<T> setChoiceRenderer(final IChoiceRenderer<T> renderer) { DropDownChoice.class.cast(field).setChoiceRenderer(renderer); return this; }
@Override protected void onBeforeRender() { super.onBeforeRender(); if (refresh == true) { refresh = false; final LabelValueChoiceRenderer<String> renderer = createRenderer(); choice.setChoiceRenderer(renderer); choice.setChoices(renderer.getValues()); } }
protected void refresh() { kost2List = timesheetDao.getKost2List(data); final LabelValueChoiceRenderer<Integer> kost2ChoiceRenderer = getKost2LabelValueChoiceRenderer(); kost2Choice.setChoiceRenderer(kost2ChoiceRenderer); kost2Choice.setChoices(kost2ChoiceRenderer.getValues()); }
protected void refresh() { final LabelValueChoiceRenderer<String> choiceRenderer = getValueLabelValueChoiceRenderer(); addressCampaignValueDropDownChoice.setChoiceRenderer(choiceRenderer); addressCampaignValueDropDownChoice.setChoices(choiceRenderer.getValues()); parentPage.refresh(); }
/** * @see org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilteredColumn#getFilter(java.lang.String, * org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm) */ @Override public Component getFilter(final String componentId, final FilterForm<?> form) { ChoiceFilter<Y> filter = new ChoiceFilter<>(componentId, getFilterModel(form), form, filterChoices, enableAutoSubmit()); IChoiceRenderer<Y> renderer = getChoiceRenderer(); if (renderer != null) { filter.getChoice().setChoiceRenderer(renderer); } return filter; }
/** * @see org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilteredColumn#getFilter(java.lang.String, * org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm) */ public Component getFilter(String componentId, FilterForm<?> form) { ChoiceFilter<Y> filter = new ChoiceFilter<Y>(componentId, getFilterModel(form), form, filterChoices, enableAutoSubmit()); IChoiceRenderer<Y> renderer = getChoiceRenderer(); if (renderer != null) { filter.getChoice().setChoiceRenderer(renderer); } return filter; }
private DropDownChoice<AnnotationLayer> createDefaultAnnotationLayerSelector() { DropDownChoice<AnnotationLayer> selector = new BootstrapSelect<>("defaultAnnotationLayer"); selector.setChoices(new PropertyModel<>(this, "annotationLayers")); selector.setChoiceRenderer(new ChoiceRenderer<>("uiName")); selector.setOutputMarkupId(true); selector.add(LambdaAjaxFormComponentUpdatingBehavior.onUpdate("change", this::actionChangeDefaultLayer)); return selector; }
private void refreshYearList() { final int[] years; if (filter.getUser() == null) { years = new int[] { new DateHolder().getYear() }; } else { years = timesheetDao.getYears(filter.getUser().getId()); } final LabelValueChoiceRenderer<Integer> yearChoiceRenderer = new LabelValueChoiceRenderer<Integer>(); for (final int year : years) { yearChoiceRenderer.addValue(year, String.valueOf(year)); } yearChoice.setChoiceRenderer(yearChoiceRenderer); yearChoice.setChoices(yearChoiceRenderer.getValues()); } }
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); } }
public UimaStringTraitsEditor(String aId, IModel<AnnotationFeature> aFeature) { super(aId); DropDownChoice<TagSet> tagset = new BootstrapSelect<>("tagset"); tagset.setOutputMarkupPlaceholderTag(true); tagset.setOutputMarkupId(true); tagset.setChoiceRenderer(new ChoiceRenderer<>("name")); tagset.setNullValid(true); tagset.setModel(PropertyModel.of(aFeature, "tagset")); tagset.setChoices(LoadableDetachableModel.of(() -> annotationService .listTagSets(aFeature.getObject().getProject()))); add(tagset); } }
public UimaStringTraitsEditor(String aId, IModel<AnnotationFeature> aFeature) { super(aId); DropDownChoice<TagSet> tagset = new BootstrapSelect<>("tagset"); tagset.setOutputMarkupPlaceholderTag(true); tagset.setOutputMarkupId(true); tagset.setChoiceRenderer(new ChoiceRenderer<>("name")); tagset.setNullValid(true); tagset.setModel(PropertyModel.of(aFeature, "tagset")); tagset.setChoices(LoadableDetachableModel.of(() -> annotationService .listTagSets(aFeature.getObject().getProject()))); add(tagset); } }
protected void refresh() { if (cost2ChoicePanel != null) { cost2List = getTaskTree().getKost2List(data.getTaskId()); final LabelValueChoiceRenderer<Integer> cost2ChoiceRenderer = getCost2LabelValueChoiceRenderer( parentPage.getBaseDao(), cost2List, data, null); cost2ChoicePanel.getDropDownChoice().setChoiceRenderer(cost2ChoiceRenderer); cost2ChoicePanel.getDropDownChoice().setChoices(cost2ChoiceRenderer.getValues()); updateCost2ChoiceValidation(); } consumptionBarPanel.replaceWith(getConsumptionBar()); }
public DocumentMetadataAnnotationSelectionPanel(String aId, IModel<Project> aProject, IModel<SourceDocument> aDocument, IModel<String> aUsername, JCasProvider aJCasProvider, DocumentMetadataAnnotationDetailPanel aDetails, AnnotationPage aAnnotationPage) { super(aId, aProject); setOutputMarkupPlaceholderTag(true); annotationPage = aAnnotationPage; sourceDocument = aDocument; username = aUsername; jcasProvider = aJCasProvider; detailPanel = aDetails; selectedLayer = Model.of(); add(createAnnotationList()); DropDownChoice<AnnotationLayer> layer = new BootstrapSelect<>("layer"); layer.setModel(selectedLayer); layer.setChoices(this::listMetadataLayers); layer.setChoiceRenderer(new ChoiceRenderer<>("uiName")); layer.add(new LambdaAjaxFormComponentUpdatingBehavior("change")); add(layer); add(new LambdaAjaxLink("create", this::actionCreate)); }
public NewStatementGroupFragment(String aId) { super(aId, "newStatementGroup", StatementGroupPanel.this, groupModel); IModel<KBHandle> property = Model.of(); Form<KBHandle> form = new Form<>("form", property); DropDownChoice<KBHandle> 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); }
public DocumentMetadataAnnotationSelectionPanel(String aId, IModel<Project> aProject, IModel<SourceDocument> aDocument, IModel<String> aUsername, JCasProvider aJCasProvider, DocumentMetadataAnnotationDetailPanel aDetails, AnnotationPage aAnnotationPage) { super(aId, aProject); setOutputMarkupPlaceholderTag(true); annotationPage = aAnnotationPage; sourceDocument = aDocument; username = aUsername; jcasProvider = aJCasProvider; detailPanel = aDetails; selectedLayer = Model.of(); add(createAnnotationList()); DropDownChoice<AnnotationLayer> layer = new BootstrapSelect<>("layer"); layer.setModel(selectedLayer); layer.setChoices(this::listMetadataLayers); layer.setChoiceRenderer(new ChoiceRenderer<>("uiName")); layer.add(new LambdaAjaxFormComponentUpdatingBehavior("change")); add(layer); add(new LambdaAjaxLink("create", this::actionCreate)); }
public NewStatementGroupFragment(String aId) { super(aId, "newStatementGroup", StatementGroupPanel.this, groupModel); IModel<KBHandle> property = Model.of(); Form<KBHandle> form = new Form<>("form", property); DropDownChoice<KBHandle> 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); }
scriptDirection.setChoiceRenderer(new EnumChoiceRenderer<>(this)); scriptDirection.setChoices(Arrays.asList(ScriptDirection.values())); form.add(scriptDirection);
scriptDirection.setChoiceRenderer(new EnumChoiceRenderer<>(this)); scriptDirection.setChoices(Arrays.asList(ScriptDirection.values())); form.add(scriptDirection);
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; }
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; }