org.apache.wicket.markup.html.form.DropDownChoice Java Examples
The following examples show how to use
org.apache.wicket.markup.html.form.DropDownChoice.
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: SchemasITCase.java From syncope with Apache License 2.0 | 6 votes |
@Test public void readPlainSchema() { browsingToPlainSchemas(); TESTER.assertLabel( PLAIN_DATATABLE_PATH + ":tablePanel:groupForm:" + "checkgroup:dataTable:body:rows:1:cells:1:cell", "aLong"); TESTER.executeAjaxEvent( PLAIN_DATATABLE_PATH + ":tablePanel:groupForm:checkgroup:dataTable:body:rows:1", Constants.ON_CLICK); TESTER.clickLink( "body:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:outerObjectsRepeater:1:outer:" + "container:content:togglePanelContainer:container:actions:actions:actionRepeater:0:action:action"); TESTER.assertComponent( "body:content:tabbedPanel:" + "panel:accordionPanel:tabs:0:body:content:outerObjectsRepeater:0:outer:" + "form:content:form:view:kind:dropDownChoiceField", DropDownChoice.class); }
Example #2
Source File: SearchAnnotationSidebar.java From inception with Apache License 2.0 | 6 votes |
private DropDownChoice<AnnotationLayer> createLayerDropDownChoice(String aId, List<AnnotationLayer> aChoices) { DropDownChoice<AnnotationLayer> layerChoice = new BootstrapSelect<>(aId, aChoices, new ChoiceRenderer<>("uiName")); layerChoice.add(new AjaxFormComponentUpdatingBehavior("change") { private static final long serialVersionUID = -6095969211884063787L; @Override protected void onUpdate(AjaxRequestTarget aTarget) { //update the choices for the feature selection dropdown groupingFeature.setChoices(annotationService .listAnnotationFeature(searchOptions.getObject().getGroupingLayer())); lowLevelPagingCheckBox.setModelObject(false); aTarget.add(groupingFeature, lowLevelPagingCheckBox); } }); layerChoice.setNullValid(true); return layerChoice; }
Example #3
Source File: UserEditForm.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
private static void addDateFormatCombobox(final GridBuilder gridBuilder, final PFUserDO user, final String labelKey, final String property, final String[] dateFormats, final boolean convertExcelFormat) { final FieldsetPanel fs = gridBuilder.newFieldset(gridBuilder.getString(labelKey)); final LabelValueChoiceRenderer<String> dateFormatChoiceRenderer = new LabelValueChoiceRenderer<String>(); for (final String str : dateFormats) { String dateString = "???"; final String pattern = convertExcelFormat == true ? str.replace('Y', 'y').replace('D', 'd') : str; try { final SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); dateString = dateFormat.format(new Date()); } catch (final Exception ex) { log.warn("Invalid date format in config.xml: " + pattern); } dateFormatChoiceRenderer.addValue(str, str + ": " + dateString); } final DropDownChoice<String> dateFormatChoice = new DropDownChoice<String>(fs.getDropDownChoiceId(), new PropertyModel<String>(user, property), dateFormatChoiceRenderer.getValues(), dateFormatChoiceRenderer); dateFormatChoice.setNullValid(true); fs.add(dateFormatChoice); }
Example #4
Source File: StatementGroupPanel.java From inception with Apache License 2.0 | 6 votes |
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 #5
Source File: KnowledgeBaseIriPanel.java From inception with Apache License 2.0 | 6 votes |
private DropDownChoice<Reification> selectReificationStrategy(String id, String property) { DropDownChoice<Reification> reificationDropDownChoice = new BootstrapSelect<>(id, kbModel.bind(property), asList(Reification.values())); reificationDropDownChoice.setRequired(true); reificationDropDownChoice.setOutputMarkupPlaceholderTag(true); // The current reification implementation only really does something useful when the // Wikidata schema is used on the actual Wikidata knowledge base (or a mirror). // Thus, we enable the option to activate reification only in this case. reificationDropDownChoice.add(visibleWhen(() -> WIKIDATASCHEMA.equals(selectedSchemaProfile.getObject()) && kbModel.getObject().getKb().isReadOnly() && REMOTE.equals(kbModel.getObject().getKb().getType()))); return reificationDropDownChoice; }
Example #6
Source File: ActiveLearningSidebar.java From inception with Apache License 2.0 | 6 votes |
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 #7
Source File: Kost1ListForm.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * @see org.projectforge.web.wicket.AbstractListForm#onOptionsPanelCreate(org.projectforge.web.wicket.flowlayout.FieldsetPanel, org.projectforge.web.wicket.flowlayout.DivPanel) */ @Override protected void onOptionsPanelCreate(final FieldsetPanel optionsFieldsetPanel, final DivPanel optionsCheckBoxesPanel) { // DropDownChoice listType final LabelValueChoiceRenderer<String> typeChoiceRenderer = new LabelValueChoiceRenderer<String>(); typeChoiceRenderer.addValue("all", getString("filter.all")); typeChoiceRenderer.addValue("active", getString("fibu.kost.status.active")); typeChoiceRenderer.addValue("nonactive", getString("fibu.kost.status.nonactive")); typeChoiceRenderer.addValue("notEnded", getString("notEnded")); typeChoiceRenderer.addValue("ended", getString("ended")); final DropDownChoice<String> typeChoice = new DropDownChoice<String>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<String>(this, "searchFilter.listType"), typeChoiceRenderer.getValues(), typeChoiceRenderer); typeChoice.setNullValid(false); optionsFieldsetPanel.add(typeChoice, true); }
Example #8
Source File: ScriptEditForm.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
private void addParameterSettings(final int idx) { final FieldsetPanel fs = gridBuilder.newFieldset(getString("scripting.script.parameterName") + " " + idx); final String parameterType = "parameter" + idx + "Type"; final String parameterName = "parameter" + idx + "Name"; final MaxLengthTextField name = new MaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, parameterName)); WicketUtils.setSize(name, 20); fs.add(name); // DropDownChoice type final LabelValueChoiceRenderer<ScriptParameterType> typeChoiceRenderer = new LabelValueChoiceRenderer<ScriptParameterType>(this, ScriptParameterType.values()); final DropDownChoice<ScriptParameterType> typeChoice = new DropDownChoice<ScriptParameterType>(fs.getDropDownChoiceId(), new PropertyModel<ScriptParameterType>(data, parameterType), typeChoiceRenderer.getValues(), typeChoiceRenderer); typeChoice.setNullValid(true); typeChoice.setRequired(false); fs.add(typeChoice); }
Example #9
Source File: SingleChoiceEditor.java From yes-cart with Apache License 2.0 | 6 votes |
/** * 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 #10
Source File: TypeBrowser.java From oodt with Apache License 2.0 | 6 votes |
/** * @param id * The wicket:id component ID of this form. */ public AddCriteriaForm(String id) { super(id, new CompoundPropertyModel<ElementCrit>(new ElementCrit())); List<Element> ptypeElements = fm.safeGetElementsForProductType(type); Collections.sort(ptypeElements, new Comparator<Element>() { public int compare(Element e1, Element e2) { return e1.getElementName().compareTo(e2.getElementName()); } }); add(new DropDownChoice<Element>("criteria_list", new PropertyModel( getDefaultModelObject(), "elem"), new ListModel<Element>( ptypeElements), new ChoiceRenderer<Element>("elementName", "elementId"))); add(new TextField<TermQueryCriteria>( "criteria_form_add_element_value", new PropertyModel<TermQueryCriteria>(getDefaultModelObject(), "value"))); add(new Button("criteria_elem_add")); }
Example #11
Source File: PollResultsDialog.java From openmeetings with Apache License 2.0 | 6 votes |
@Override protected void onInitialize() { add(chartDiv.setOutputMarkupId(true)); chartSimple = getString("1414"); chartPie = getString("1415"); add(name, question, count); chartType = new DropDownChoice<>("chartType", Model.of(chartSimple), List.of(chartSimple, chartPie)); add(chartType.add(new AjaxFormComponentUpdatingBehavior("change") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { redraw(target, false); } })); super.onInitialize(); }
Example #12
Source File: PagingNavigatorPanel.java From openmeetings with Apache License 2.0 | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); dataView.setItemsPerPage(entitiesPerPage); final Form<Void> f = new Form<>("pagingForm"); f.add(new OmPagingNavigator("navigator", dataView).setOutputMarkupId(true)) .add(new DropDownChoice<>("entitiesPerPage", new PropertyModel<Integer>(this, "entitiesPerPage"), numbers) .add(new AjaxFormComponentUpdatingBehavior("change") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { long newPage = dataView.getCurrentPage() * dataView.getItemsPerPage() / entitiesPerPage; dataView.setItemsPerPage(entitiesPerPage); dataView.setCurrentPage(newPage); target.add(f); PagingNavigatorPanel.this.onEvent(target); } })); add(f.setOutputMarkupId(true)); }
Example #13
Source File: OClusterMetaPanel.java From Orienteer with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override protected Component resolveComponent(String id, DisplayMode mode, String critery) { if(DisplayMode.EDIT.equals(mode) && !OSecurityHelper.isAllowed(ORule.ResourceGeneric.SCHEMA, null, OrientPermission.UPDATE)) { mode = DisplayMode.VIEW; } if(DisplayMode.VIEW.equals(mode)) { return new Label(id, getModel()); } else if(DisplayMode.EDIT.equals(mode)) { if (OClustersWidget.COMPRESSION.equals(critery)) { return new DropDownChoice<String>(id, (IModel<String>)getModel(), COMPRESSIONS); } else if(OClustersWidget.COUNT.equals(critery) || OClustersWidget.ID.equals(critery)){ return resolveComponent(id, DisplayMode.VIEW, critery); } else { return new TextField<V>(id, getModel()).setType(String.class); } } return null; }
Example #14
Source File: ProjectDetailPanel.java From webanno with Apache License 2.0 | 6 votes |
private DropDownChoice<String> makeProjectTypeChoice() { List<String> types = projectService.listProjectTypes().stream().map(t -> t.id()) .collect(Collectors.toList()); DropDownChoice<String> projTypes = new BootstrapSelect<>("mode", types); projTypes.setRequired(true); projTypes.add(LambdaBehavior.onConfigure(_this -> { // If there is only a single project type and the project mode has not been set yet, // then we can simply select that and do not need to show the choice at all. Project project = projectModel.getObject(); if (projectTypes.getChoices().size() == 1 && project.getMode() == null) { project.setMode(projectTypes.getChoices().get(0)); } _this.setEnabled( nonNull(projectModel.getObject()) && isNull(projectModel.getObject().getId())); // If there is only a single project type, then we can simply select that and do not // need to show the choice at all. _this.setVisible(projTypes.getChoices().size() > 1); })); return projTypes; }
Example #15
Source File: LogsITCase.java From syncope with Apache License 2.0 | 6 votes |
@Test public void updateConsoleLogs() { TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:1:link"); TESTER.assertComponent(CONTAINER_PATH, WebMarkupContainer.class); Component result = searchLog(KEY, CONTAINER_PATH, "org.apache.wicket"); assertNotNull(result); TESTER.getRequest().setMethod(Form.METHOD_GET); TESTER.getRequest().addParameter( result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", "6"); TESTER.assertComponent( result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", DropDownChoice.class); TESTER.executeAjaxEvent( result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", Constants.ON_CHANGE); assertSuccessMessage(); }
Example #16
Source File: LogsITCase.java From syncope with Apache License 2.0 | 6 votes |
@Test public void updateCoreLogs() { TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:0:link"); TESTER.assertComponent(CONTAINER_PATH, WebMarkupContainer.class); Component result = searchLog(KEY, CONTAINER_PATH, "io.swagger"); assertNotNull(result); TESTER.getRequest().setMethod(Form.METHOD_GET); TESTER.getRequest().addParameter( result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", "6"); TESTER.assertComponent( result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", DropDownChoice.class); TESTER.executeAjaxEvent( result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", Constants.ON_CHANGE); assertSuccessMessage(); }
Example #17
Source File: CafeAddress.java From tutorials with MIT License | 6 votes |
public CafeAddress(final PageParameters parameters) { super(parameters); initCafes(); ArrayList<String> cafeNames = new ArrayList<>(cafeNamesAndAddresses.keySet()); selectedCafe = cafeNames.get(0); address = new Address(cafeNamesAndAddresses.get(selectedCafe).getAddress()); final Label addressLabel = new Label("address", new PropertyModel<String>(this.address, "address")); addressLabel.setOutputMarkupId(true); final DropDownChoice<String> cafeDropdown = new DropDownChoice<>("cafes", new PropertyModel<>(this, "selectedCafe"), cafeNames); cafeDropdown.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { String name = (String) cafeDropdown.getDefaultModel().getObject(); address.setAddress(cafeNamesAndAddresses.get(name).getAddress()); target.add(addressLabel); } }); add(addressLabel); add(cafeDropdown); }
Example #18
Source File: EingangsrechnungEditForm.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override protected void addCellAfterFaelligkeit() { gridBuilder.newSplitPanel(GridSize.COL50); // DropDownChoice payment type final FieldsetPanel fs = gridBuilder.newFieldset(EingangsrechnungDO.class, "paymentType"); final LabelValueChoiceRenderer<PaymentType> paymentTypeChoiceRenderer = new LabelValueChoiceRenderer<PaymentType>(this, PaymentType.values()); final DropDownChoice<PaymentType> paymentTypeChoice = new DropDownChoice<PaymentType>(fs.getDropDownChoiceId(), new PropertyModel<PaymentType>(data, "paymentType"), paymentTypeChoiceRenderer.getValues(), paymentTypeChoiceRenderer); paymentTypeChoice.setNullValid(true); fs.add(paymentTypeChoice); }
Example #19
Source File: AbstractRechnungEditForm.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") protected void validation() { final TextField<Date> datumField = (TextField<Date>) dependentFormComponents[0]; final TextField<Date> bezahlDatumField = (TextField<Date>) dependentFormComponents[1]; final TextField<Date> faelligkeitField = (TextField<Date>) dependentFormComponents[2]; final TextField<BigDecimal> zahlBetragField = (TextField<BigDecimal>) dependentFormComponents[3]; final DropDownChoice<Integer> zahlungsZielChoice = (DropDownChoice<Integer>) dependentFormComponents[4]; final Date bezahlDatum = bezahlDatumField.getConvertedInput(); final Integer zahlungsZiel = zahlungsZielChoice.getConvertedInput(); Date faelligkeit = faelligkeitField.getConvertedInput(); if (faelligkeit == null && zahlungsZiel != null) { Date date = datumField.getConvertedInput(); if (date == null) { date = getData().getDatum(); } if (date != null) { final DayHolder day = new DayHolder(date); day.add(Calendar.DAY_OF_YEAR, zahlungsZiel); faelligkeit = day.getDate(); getData().setFaelligkeit(day.getSQLDate()); faelligkeitPanel.markModelAsChanged(); } } getData().recalculate(); final BigDecimal zahlBetrag = zahlBetragField.getConvertedInput(); final boolean zahlBetragExists = (zahlBetrag != null && zahlBetrag.compareTo(BigDecimal.ZERO) != 0); if (bezahlDatum != null && zahlBetragExists == false) { addError("fibu.rechnung.error.bezahlDatumUndZahlbetragRequired"); } if (faelligkeit == null) { addFieldRequiredError("fibu.rechnung.faelligkeit"); } }
Example #20
Source File: UserEditForm.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public static void createTimeNotation(final GridBuilder gridBuilder, final PFUserDO user) { // Time notation final FieldsetPanel fs = gridBuilder.newFieldset(gridBuilder.getString("timeNotation")); final LabelValueChoiceRenderer<TimeNotation> timeNotationChoiceRenderer = new LabelValueChoiceRenderer<TimeNotation>(); timeNotationChoiceRenderer.addValue(TimeNotation.H12, gridBuilder.getString("timeNotation.12")); timeNotationChoiceRenderer.addValue(TimeNotation.H24, gridBuilder.getString("timeNotation.24")); final DropDownChoice<TimeNotation> timeNotationChoice = new DropDownChoice<TimeNotation>(fs.getDropDownChoiceId(), new PropertyModel<TimeNotation>(user, "timeNotation"), timeNotationChoiceRenderer.getValues(), timeNotationChoiceRenderer); timeNotationChoice.setNullValid(true); fs.add(timeNotationChoice); }
Example #21
Source File: BatchDefinitionPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
private void init() { // Scheduler Batch is shown only for NEXT REPORTS if (!ReportConstants.NEXT.equals(schedulerJob.getReport().getType())) { return; } Label parameter = new Label("parameter", getString("ActionContributor.Run.batch.parameter")); add(parameter); ro.nextreports.engine.Report report = NextUtil.getNextReport(storageService.getSettings(), schedulerJob.getReport()); Map<String, QueryParameter> paramMap = ParameterUtil.getUsedNotHiddenParametersMap(report); List<String> parameters = new ArrayList<String>(); for (QueryParameter qp : paramMap.values()) { if (qp.getSelection().equals(QueryParameter.SINGLE_SELECTION) && (qp.getSource() != null)) { parameters.add(qp.getName()); } } parameterChoice = new DropDownChoice<String>("parameterChoice", new PropertyModel<String>(schedulerJob, "batchDefinition.parameter"), parameters); parameterChoice.setNullValid(true); add(parameterChoice); add(new Label("dataQuery", getString("ActionContributor.Run.batch.dataQuery"))); TextArea<String> dataQueryArea = new TextArea<String>("dataQueryArea", new PropertyModel<String>(schedulerJob, "batchDefinition.dataQuery")); dataQueryArea.setLabel(new Model<String>(getString("ActionContributor.Run.batch.dataQuery"))); add(dataQueryArea); add(new Label("infoDynamic", getString("ActionContributor.Run.batch.dynamic"))); add(new Label("infoDependent", getString("ActionContributor.Run.batch.dependent"))); }
Example #22
Source File: ODateTimeField.java From Orienteer with Apache License 2.0 | 5 votes |
private DropDownChoice<String> createChoice(String id, int mode) { DropDownChoice<String> choice = new DropDownChoice<>(id, new Model<>(), Arrays.asList(AM, PM)); boolean support = isSupportAmPm(); choice.setOutputMarkupId(true); choice.setNullValid(false); if (mode != -1) choice.setModelObject(mode == Calendar.AM ? choice.getChoices().get(0) : choice.getChoices().get(1)); else choice.setModelObject(choice.getChoices().get(0)); choice.setVisible(support); choice.setEnabled(support); return choice; }
Example #23
Source File: TeamAttendeesPanel.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
private void rebuildAttendees() { attendeesRepeater.removeAll(); for (final TeamEventAttendeeDO attendee : attendees) { final WebMarkupContainer item = new WebMarkupContainer(attendeesRepeater.newChildId()); attendeesRepeater.add(item); item.add(new AttendeeEditableLabel("editableLabel", Model.of(attendee), false)); final DropDownChoice<TeamAttendeeStatus> statusChoice = new DropDownChoice<TeamAttendeeStatus>("status", new PropertyModel<TeamAttendeeStatus>(attendee, "status"), statusChoiceRenderer.getValues(), statusChoiceRenderer); statusChoice.setEnabled(false); item.add(statusChoice); } }
Example #24
Source File: ContractListForm.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @see org.projectforge.web.wicket.AbstractListForm#onOptionsPanelCreate(org.projectforge.web.wicket.flowlayout.FieldsetPanel, * org.projectforge.web.wicket.flowlayout.DivPanel) */ @Override protected void onOptionsPanelCreate(final FieldsetPanel optionsFieldsetPanel, final DivPanel optionsCheckBoxesPanel) { // DropDownChoice years final ContractDao contractDao = getParentPage().getBaseDao(); final YearListCoiceRenderer yearListChoiceRenderer = new YearListCoiceRenderer(contractDao.getYears(), true); final DropDownChoice<Integer> yearChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "year"), yearListChoiceRenderer.getYears(), yearListChoiceRenderer); yearChoice.setNullValid(false); optionsFieldsetPanel.add(yearChoice, true); { // DropDownChoice status final LabelValueChoiceRenderer<ContractStatus> statusRenderer = new LabelValueChoiceRenderer<ContractStatus>(); for (final ContractStatus status : ContractStatus.values()) { statusRenderer.addValue(status, getString(status.getI18nKey())); } final DropDownChoice<ContractStatus> statusChoice = new DropDownChoice<ContractStatus>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<ContractStatus>(getSearchFilter(), "status"), statusRenderer.getValues(), statusRenderer); statusChoice.setNullValid(true); optionsFieldsetPanel.add(statusChoice, true).setTooltip(getString("status")); } final List<ContractType> contractTypes = ConfigXml.getInstance().getContractTypes(); if (CollectionUtils.isNotEmpty(contractTypes) == true) { // DropDownChoice type final LabelValueChoiceRenderer<ContractType> typeRenderer = new LabelValueChoiceRenderer<ContractType>(); for (final ContractType type : contractTypes) { typeRenderer.addValue(type, type.getLabel()); } final DropDownChoice<ContractType> typeChoice = new DropDownChoice<ContractType>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<ContractType>(getSearchFilter(), "type"), typeRenderer.getValues(), typeRenderer); typeChoice.setNullValid(true); optionsFieldsetPanel.add(typeChoice, true).setTooltip(getString("legalAffaires.contract.type")); } }
Example #25
Source File: SakaiSpinnerDropDownChoice.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Constructor * @param id the wicket id * @param choiceModel the model to hold the selected choice * @param choices the available choices * @param renderer how to render each choice * @param labelModel the model for the <label> tag * @param behavior behaviour invoked when the selection changes */ public SakaiSpinnerDropDownChoice(String id, IModel<T> choiceModel, List<T> choices, IChoiceRenderer<T> renderer, IModel<String> labelModel, SakaiSpinningSelectOnChangeBehavior behavior) { super(id, choiceModel); select = new DropDownChoice<>("spinnerSelect", choiceModel, choices, renderer); select.setLabel(labelModel); select.add(behavior); add(select); setRenderBodyOnly(true); }
Example #26
Source File: AjaxDropDownChoicePanel.java From syncope with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public FieldPanel<T> clone() { final AjaxDropDownChoicePanel<T> panel = (AjaxDropDownChoicePanel<T>) super.clone(); panel.setChoiceRenderer(DropDownChoice.class.cast(field).getChoiceRenderer()); panel.setChoices(DropDownChoice.class.cast(field).getChoices()); return panel; }
Example #27
Source File: TimesheetEditForm.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("serial") protected static DropDownChoice<Integer> createCost2ChoiceRenderer(final String id, final TimesheetDao timesheetDao, final TaskTree taskTree, final LabelValueChoiceRenderer<Integer> kost2ChoiceRenderer, final TimesheetDO data, final List<Kost2DO> kost2List) { final DropDownChoice<Integer> choice = new DropDownChoice<Integer>(id, new Model<Integer>() { @Override public Integer getObject() { return data.getKost2Id(); } @Override public void setObject(final Integer kost2Id) { if (kost2Id != null) { timesheetDao.setKost2(data, kost2Id); } else { data.setKost2(null); } } }, kost2ChoiceRenderer.getValues(), kost2ChoiceRenderer); choice.setNullValid(true); choice.add(new IValidator<Integer>() { @Override public void validate(final IValidatable<Integer> validatable) { final Integer value = validatable.getValue(); if (value != null && value >= 0) { return; } if (CollectionUtils.isNotEmpty(kost2List) == true) { // Kost2 available but not selected. choice.error(PFUserContext.getLocalizedString("timesheet.error.kost2Required")); } } }); return choice; }
Example #28
Source File: WeeklyJobPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
public WeeklyJobPanel(String id, SchedulerJob schedulerJob) { super(id); this.schedulerJob = schedulerJob; add(new Label("minuteLabel", getString("JobPanel.minute"))); add(new DropDownChoice<Integer>("minuteChoice", new PropertyModel<Integer>(schedulerJob, "time.minute"), getMinutes())); add(new IntervalFieldPanel("hoursPanel", new PropertyModel(schedulerJob, "time.hours"), SelectIntervalPanel.HOUR_ENTITY,TimeValues.DISCRETE_TYPE, true)); add(new IntervalFieldPanel("weekdaysPanel", new PropertyModel(schedulerJob, "time.daysOfWeek"), SelectIntervalPanel.DAY_OF_WEEK_ENTITY, null, true)); }
Example #29
Source File: AccessSettingsPanel.java From inception with Apache License 2.0 | 5 votes |
private DropDownChoice<RepositoryType> createTypeSelection(String id, String property) { DropDownChoice<RepositoryType> typeChoice = new BootstrapSelect<>(id, kbModel.bind(property), asList(RepositoryType.values()), new EnumChoiceRenderer<>(this)); typeChoice.setRequired(true); return typeChoice; }
Example #30
Source File: GanttChartEditTreeTablePanel.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("serial") private void addRelationTypeColumns(final Item<GanttTreeTableNode> item, final GanttTreeTableNode node, final GanttTask ganttObject, final TaskDO task) { final LabelValueChoiceRenderer<GanttRelationType> relationTypeChoiceRenderer = new LabelValueChoiceRenderer<GanttRelationType>(); relationTypeChoiceRenderer.addValue(GanttRelationType.START_START, getString(GanttRelationType.START_START.getI18nKey() + ".short")); relationTypeChoiceRenderer.addValue(GanttRelationType.START_FINISH, getString(GanttRelationType.START_FINISH.getI18nKey() + ".short")); relationTypeChoiceRenderer.addValue(GanttRelationType.FINISH_START, getString(GanttRelationType.FINISH_START.getI18nKey() + ".short")); relationTypeChoiceRenderer .addValue(GanttRelationType.FINISH_FINISH, getString(GanttRelationType.FINISH_FINISH.getI18nKey() + ".short")); final DropDownChoice<GanttRelationType> relationTypeChoice = new DropDownChoice<GanttRelationType>("relationType", new PropertyModel<GanttRelationType>(ganttObject, "relationType"), relationTypeChoiceRenderer.getValues(), relationTypeChoiceRenderer); relationTypeChoice.setNullValid(true); addColumn(item, relationTypeChoice, null); final GanttRelationType relationType = task != null ? task.getGanttRelationType() : null; new RejectSaveLinksFragment("rejectSaveRelationType", item, relationTypeChoice, task, relationType != null ? getString(relationType.getI18nKey()) : "") { @Override protected void onSave() { task.setGanttRelationType(ganttObject.getRelationType()); taskDao.update(task); } @Override protected void onReject() { ganttObject.setRelationType(task.getGanttRelationType()); } }; }