List of usage examples for org.apache.wicket.markup.html.form EnumChoiceRenderer EnumChoiceRenderer
public EnumChoiceRenderer()
From source file:jp.xet.uncommons.wicket.gp.EnumDropDownChoice.java
License:Apache License
/** * ??/* w ww .j a v a 2s . c o m*/ * * @param id The non-null id of this component * @param clazz {@link Enum} class * @since 1.0 */ public EnumDropDownChoice(String id, Class<T> clazz) { super(id, Arrays.asList(clazz.getEnumConstants()), new EnumChoiceRenderer<T>()); }
From source file:jp.xet.uncommons.wicket.gp.EnumDropDownChoice.java
License:Apache License
/** * ??/*from ww w . ja v a2 s . com*/ * * @param id The non-null id of this component * @param model The component's model * @param clazz {@link Enum} class * @since 1.0 */ public EnumDropDownChoice(String id, IModel<T> model, Class<T> clazz) { super(id, model, Arrays.asList(clazz.getEnumConstants()), new EnumChoiceRenderer<T>()); }
From source file:net.rrm.ehour.ui.admin.config.panel.MiscConfigPanel.java
License:Open Source License
private void addMiscComponents(Form<?> form) { // show turnover checkbox CheckBox showTurnover = new CheckBox("config.showTurnover"); showTurnover.setMarkupId("showTurnover"); form.add(showTurnover);/* w w w . j av a 2s . c o m*/ final MainConfigBackingBean configBackingBean = (MainConfigBackingBean) getDefaultModelObject(); // working hours TextField<Float> workHours = new TextField<>("config.completeDayHours", Float.class); workHours.setLabel(new ResourceModel("admin.config.workHours")); workHours.add(new ValidatingFormComponentAjaxBehavior()); workHours.add(RangeValidator.minimum(0f)); workHours.add(RangeValidator.maximum(24f)); workHours.setRequired(true); form.add(new AjaxFormComponentFeedbackIndicator("workHoursValidationError", workHours)); form.add(workHours); // weeks start at DropDownChoice<Date> weekStartsAt; weekStartsAt = new DropDownChoice<>("firstWeekStart", DateUtil .createDateSequence(DateUtil.getDateRangeForWeek(new GregorianCalendar()), new EhourConfigStub()), new WeekDayRenderer(configBackingBean.getLocaleLanguage())); form.add(weekStartsAt); // Timezone DropDownChoice<String> timezone = new DropDownChoice<>("config.timeZone", Lists.newArrayList(DateTimeZone.getAvailableIDs())); form.add(timezone); // pm access rights form.add(new DropDownChoice<>("config.pmPrivilege", Arrays.asList(PmPrivilege.values()), new EnumChoiceRenderer<PmPrivilege>())); // split admin role final Container convertManagersContainer = new Container("convertManagers"); DropDownChoice<UserRole> convertManagersTo = new DropDownChoice<>("convertManagersTo", Lists.newArrayList(UserRole.ADMIN, UserRole.USER), new UserRoleRenderer()); convertManagersContainer.add(convertManagersTo); convertManagersContainer.setVisible(false); form.add(convertManagersContainer); AjaxCheckBox withManagerCheckbox = new AjaxCheckBox("config.splitAdminRole") { @Override protected void onUpdate(AjaxRequestTarget target) { Boolean managersEnabled = this.getModelObject(); boolean showConvert = !managersEnabled && !userService.getUsers(UserRole.MANAGER).isEmpty(); if (convertManagersContainer.isVisible() != showConvert) { convertManagersContainer.setVisible(showConvert); target.add(convertManagersContainer); } } }; withManagerCheckbox.setMarkupId("splitAdminRole"); form.add(withManagerCheckbox); }
From source file:org.cdlflex.ui.ajax.markup.html.form.AjaxEnumRadioChoice.java
License:Apache License
public AjaxEnumRadioChoice(String id, Class<T> enumType) { this(id, enumType, new EnumChoiceRenderer<T>()); }