List of usage examples for org.apache.wicket.markup.html.form Radio Radio
public Radio(final String id, final RadioGroup<T> group)
From source file:ch.bd.qv.quiz.panels.RadioQuestionPanel.java
License:Apache License
public RadioQuestionPanel(String inner, RadioQuestion bq) { super(inner, bq); this.radioQuestion = bq; RadioGroup<String> rg = new RadioGroup<>("radiogroup", input); rg.add(new ListView<String>("repeater", Lists.newArrayList(bq.getAnswerKeys())) { @Override/*from w w w.j ava 2 s .co m*/ protected void populateItem(ListItem<String> item) { item.add(new Radio("radio", item.getModel())); item.add(new Label("radio_label", new ResourceModel(item.getModelObject()))); } }); rg.setRequired(true); add(rg); }
From source file:com.cubeia.backoffice.web.user.UserReportPanel.java
License:Open Source License
public UserReportPanel(String id, final ModalWindow modal) { super(id);//from w w w.ja v a2s .co m Form<?> form = new Form<Void>("form"); form.setOutputMarkupId(true); form.add(new AjaxSubmitLink("reportLink", form) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { String url = getRequest().getContextPath() + "reportbuilder/reports/users/?format=" + format; target.appendJavaScript("document.location = '" + url + "'"); modal.close(target); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { // nothing to do here... } }); RadioGroup<String> formatGroup = new RadioGroup<String>("formatGroup", new PropertyModel<String>(this, "format")); formatGroup.add(new Radio<String>("csv", Model.of("csv"))); formatGroup.add(new Radio<String>("xls", Model.of("xls"))); formatGroup.add(new Radio<String>("pdf", Model.of("pdf"))); form.add(formatGroup); add(form); }
From source file:com.cubeia.backoffice.web.wallet.TransactionList.java
License:Open Source License
/** * Constructor that is invoked when page is invoked without a session. * * @param parameters// ww w . ja v a2 s . c o m * Page parameters */ public TransactionList(final PageParameters parameters) { long accountIdParam = parameters.get(PARAM_ACCOUNT_ID).toLong(-1); long userIdParam = parameters.get("userId").toLong(-1); if (accountIdParam != -1) { setId1(accountIdParam); setId1ByUserId(false); setId1Direction(DEBIT_CREDIT.BOTH); } else if (userIdParam != -1) { setId1(userIdParam); setId1ByUserId(true); setId1Direction(DEBIT_CREDIT.BOTH); } Form<TransactionList> searchForm = new Form<TransactionList>("searchForm", new CompoundPropertyModel<TransactionList>(this)); searchForm.add(new TextField<Long>("id1")); searchForm.add(new TextField<Long>("id2")); RadioGroup<Boolean> id1RadioGroup = new RadioGroup<Boolean>("id1Group", new PropertyModel<Boolean>(this, "id1ByUserId")); id1RadioGroup.add(new Radio<Boolean>("id1ByUser", new Model<Boolean>(Boolean.TRUE))); id1RadioGroup.add(new Radio<Boolean>("id1ByAccount", new Model<Boolean>(Boolean.FALSE))); searchForm.add(id1RadioGroup); RadioGroup<Boolean> id2RadioGroup = new RadioGroup<Boolean>("id2Group", new PropertyModel<Boolean>(this, "id2ByUserId")); id2RadioGroup.add(new Radio<Boolean>("id2ByUser", new Model<Boolean>(Boolean.TRUE))); id2RadioGroup.add(new Radio<Boolean>("id2ByAccount", new Model<Boolean>(Boolean.FALSE))); searchForm.add(id2RadioGroup); DateField startDatePicker = new DateField("startDate", new PropertyModel<Date>(this, "startDate")); searchForm.add(startDatePicker); DateField endDatePicker = new DateField("endDate", new PropertyModel<Date>(this, "endDate")); searchForm.add(endDatePicker); searchForm.add(new DropDownChoice<DEBIT_CREDIT>("id1Direction", new PropertyModel<DEBIT_CREDIT>(this, "id1Direction"), Arrays.asList(DEBIT_CREDIT.values()))); searchForm.add(new DropDownChoice<DEBIT_CREDIT>("id2Direction", new PropertyModel<DEBIT_CREDIT>(this, "id2Direction"), Arrays.asList(DEBIT_CREDIT.values()))); add(searchForm); add(new FeedbackPanel("feedback")); ISortableDataProvider<Transaction, String> dataProvider = new TxDataProvider(); List<IColumn<Transaction, String>> columns = new ArrayList<IColumn<Transaction, String>>(); columns.add(new PropertyColumn<Transaction, String>(Model.of("Tx Id"), TransactionsOrder.ID.name(), "id") { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Transaction>> item, String componentId, IModel<Transaction> model) { Transaction tx = (Transaction) model.getObject(); Long txId = tx.getId(); PageParameters pageParams = new PageParameters(); pageParams.set("transactionId", txId); item.add(new LabelLinkPanel(componentId, "" + txId, "transaction details for tx id " + txId, TransactionInfo.class, pageParams)); } }); columns.add(new DatePropertyColumn<Transaction, String>(new Model<String>("Date"), "timestamp")); columns.add(new PropertyColumn<Transaction, String>(Model.of("Comment"), "comment")); columns.add(new TxEntryColumn(new Model<String>("Entries"))); AjaxFallbackDefaultDataTable<Transaction, String> txTable = new AjaxFallbackDefaultDataTable<Transaction, String>( "txTable", columns, dataProvider, 20); add(txTable); }
From source file:com.cubeia.games.poker.admin.wicket.pages.wallet.TransactionList.java
License:Open Source License
/** * Constructor that is invoked when page is invoked without a session. * * @param parameters/*from w w w . ja v a 2 s . c o m*/ * Page parameters */ public TransactionList(final PageParameters parameters) { super(parameters); long accountIdParam = parameters.get(PARAM_ACCOUNT_ID).toLong(-1); long userIdParam = parameters.get("userId").toLong(-1); if (accountIdParam != -1) { setId1(accountIdParam); setId1ByUserId(false); setId1Direction(DEBIT_CREDIT.BOTH); } else if (userIdParam != -1) { setId1(userIdParam); setId1ByUserId(true); setId1Direction(DEBIT_CREDIT.BOTH); } Form<TransactionList> searchForm = new Form<TransactionList>("searchForm", new CompoundPropertyModel<TransactionList>(this)); searchForm.add(new TextField<Long>("id1")); searchForm.add(new TextField<Long>("id2")); RadioGroup<Boolean> id1RadioGroup = new RadioGroup<Boolean>("id1Group", new PropertyModel<Boolean>(this, "id1ByUserId")); id1RadioGroup.add(new Radio<Boolean>("id1ByUser", new Model<Boolean>(Boolean.TRUE))); id1RadioGroup.add(new Radio<Boolean>("id1ByAccount", new Model<Boolean>(Boolean.FALSE))); searchForm.add(id1RadioGroup); RadioGroup<Boolean> id2RadioGroup = new RadioGroup<Boolean>("id2Group", new PropertyModel<Boolean>(this, "id2ByUserId")); id2RadioGroup.add(new Radio<Boolean>("id2ByUser", new Model<Boolean>(Boolean.TRUE))); id2RadioGroup.add(new Radio<Boolean>("id2ByAccount", new Model<Boolean>(Boolean.FALSE))); searchForm.add(id2RadioGroup); DateField startDatePicker = new DateField("startDate", new PropertyModel<Date>(this, "startDate")); searchForm.add(startDatePicker); DateField endDatePicker = new DateField("endDate", new PropertyModel<Date>(this, "endDate")); searchForm.add(endDatePicker); searchForm.add(new DropDownChoice<DEBIT_CREDIT>("id1Direction", new PropertyModel<DEBIT_CREDIT>(this, "id1Direction"), Arrays.asList(DEBIT_CREDIT.values()))); searchForm.add(new DropDownChoice<DEBIT_CREDIT>("id2Direction", new PropertyModel<DEBIT_CREDIT>(this, "id2Direction"), Arrays.asList(DEBIT_CREDIT.values()))); add(searchForm); add(new FeedbackPanel("feedback")); ISortableDataProvider<Transaction, String> dataProvider = new TxDataProvider(); List<IColumn<Transaction, String>> columns = new ArrayList<IColumn<Transaction, String>>(); columns.add(new PropertyColumn<Transaction, String>(Model.of("Tx Id"), TransactionsOrder.ID.name(), "id") { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Transaction>> item, String componentId, IModel<Transaction> model) { Transaction tx = (Transaction) model.getObject(); Long txId = tx.getId(); PageParameters pageParams = new PageParameters(); pageParams.set("transactionId", txId); item.add(new LabelLinkPanel(componentId, "" + txId, "transaction details for tx id " + txId, TransactionInfo.class, pageParams)); } }); columns.add(new DatePropertyColumn<Transaction, String>(new Model<String>("Date"), "timestamp")); columns.add(new PropertyColumn<Transaction, String>(Model.of("Comment"), "comment")); columns.add(new TxEntryColumn(new Model<String>("Entries"))); AjaxFallbackDefaultDataTable<Transaction, String> txTable = new AjaxFallbackDefaultDataTable<Transaction, String>( "txTable", columns, dataProvider, 20); add(txTable); }
From source file:com.customeric.panels.AccountFormPanel.java
public AccountFormPanel(String id, IModel<Accounts> model) { super(id, model); if (model == null) { model = new Model<Accounts>(new Accounts()); }/* w w w . j av a 2s . c o m*/ final Form<Accounts> accountForm = new Form<Accounts>("accountForm", new CompoundPropertyModel<Accounts>(model)) { @Override protected void onSubmit() { super.onSubmit(); final Accounts account = getModelObject(); try { if (account.getId() == null) { DocamineServiceFactory.getAccountsJpaController().create(account); } else { DocamineServiceFactory.getAccountsJpaController().edit(account); } } catch (Exception ex) { log.error("Not able to save account in Account Form"); } } }; add(accountForm); final TextField companyName = new TextField("companyName"); final EmailTextField companyEmailAddress = new EmailTextField("companyEmailAddress"); final TextField phoneNumber = new TextField("phoneNumber"); final TextField street1 = new TextField("street1"); final TextField street2 = new TextField("street2"); final TextField zip = new TextField("zip"); final TextField city = new TextField("city"); final TextField state = new TextField("state"); final TextField country = new TextField("country"); final TextField twitterHandle = new TextField("twitterHandle"); final TextField facebookHandle = new TextField("facebookHandle"); final TextField linkdedInHandle = new TextField("linkdedInHandle"); final TextField skypeHandle = new TextField("skypeHandle"); final TextField blogUrl = new TextField("blogUrl"); final TextArea comments = new TextArea("comments"); final RadioGroup radioGroup = new RadioGroup("customerTypeChoice"); radioGroup.add(new Radio("premium", new Model<String>("premium"))); radioGroup.add(new Radio("valued", new Model<String>("valued"))); radioGroup.add(new Radio("normal", new Model<String>("normal"))); accountForm.add(companyName).add(companyEmailAddress).add(phoneNumber).add(street1).add(street2).add(zip) .add(city).add(state).add(country).add(twitterHandle).add(facebookHandle).add(linkdedInHandle) .add(skypeHandle).add(blogUrl).add(comments).add(radioGroup); }
From source file:com.customeric.panels.LeadFormPanel.java
public LeadFormPanel(String id, IModel<Leads> model) { super(id, model); if (model == null) { model = new Model<Leads>(new Leads()); }//w w w . j av a 2 s . c o m final Form<Leads> leadForm = new Form<Leads>("leadForm", new CompoundPropertyModel<Leads>(model)) { @Override protected void onSubmit() { super.onSubmit(); final Leads lead = getModelObject(); try { DocamineServiceFactory.getLeadsJpaController().edit(lead); } catch (Exception ex) { log.error("Not able to save lead in lead Form"); } } }; add(leadForm); final DropDownChoice title = new DropDownChoice("title", Arrays.asList("Mr", "Mrs", "Miss", "Dr")); final TextField firstName = new TextField("firstName"); final TextField lastName = new TextField("lastName"); final TextField companyName = new TextField("companyName"); final EmailTextField companyEmailAddress = new EmailTextField("companyEmailAddress"); final TextField phoneNumber = new TextField("phoneNumber"); final TextField street1 = new TextField("street1"); final TextField street2 = new TextField("street2"); final TextField zip = new TextField("zip"); final TextField city = new TextField("city"); final TextField stateName = new TextField("stateName"); final TextField country = new TextField("country"); final TextField twitterHandle = new TextField("twitterHandle"); final TextField facebookHandle = new TextField("facebookHandle"); final TextField linkdedInHandle = new TextField("linkdedInHandle"); final TextField skypeHandle = new TextField("skypeHandle"); final TextField blogUrl = new TextField("blogUrl"); final TextArea comments = new TextArea("comments"); final RadioGroup radioGroup = new RadioGroup("leadTypeChoice"); radioGroup.add(new Radio("hot", new Model<String>("hot"))); radioGroup.add(new Radio("cold", new Model<String>("cold"))); radioGroup.add(new Radio("warm", new Model<String>("warm"))); leadForm.add(title).add(firstName).add(lastName).add(companyName).add(companyEmailAddress).add(phoneNumber) .add(street1).add(street2).add(zip).add(city).add(stateName).add(country).add(twitterHandle) .add(facebookHandle).add(linkdedInHandle).add(skypeHandle).add(blogUrl).add(comments) .add(radioGroup); }
From source file:com.doculibre.constellio.wicket.panels.search.SearchFormPanel.java
License:Open Source License
private void addChoice(String id) { searchTypeField.add(new Radio(id, new Model(id)) { @Override//w ww .j a v a 2s .co m public String getValue() { return super.getId(); } protected boolean getStatelessHint() { return true; } }); searchTypeField.add(new Label("lbl_" + id, new StringResourceModel("searchType." + id, this, null))); }
From source file:com.fdorigo.rmfly.wicket.RecordPage.java
private void init() { add(new FeedbackPanel("feedback")); final DateTextField dateTextField = new DateTextField("arrivalDate"); dateTextField.setRequired(true);/* w w w . java2 s . com*/ DatePicker datePicker = new DatePicker() { @Override protected String getAdditionalJavaScript() { return "${calendar}.cfg.setProperty(\"navigator\",true,false); ${calendar}.render();"; } }; datePicker.setShowOnFieldClick(true); datePicker.setAutoHide(true); dateTextField.add(datePicker); final TextField<String> nNumberField = new TextField<>("nnumber"); nNumberField.setRequired(true); if (validNnumber) { nNumberField.add(AttributeModifier.append("readonly", "true")); } else { nNumberField.add(AttributeModifier.append("placeholder", "Not Found")); } DropDownChoice<AirplaneType> listCategories = new DropDownChoice<>("category", new PropertyModel<>(this, "selected"), Arrays.asList(AirplaneType.values())); listCategories.setRequired(true); final TextField<String> firstNameField = new TextField<>("firstName"); final TextField<String> lastNameField = new TextField<>("lastName"); final TextField<String> primaryPhoneField = new TextField<>("primaryPhone"); primaryPhoneField.setRequired(true); final TextField<String> secondaryPhoneField = new TextField<>("secondaryPhone"); final TextField<String> addressOneField = new TextField<>("addressOne"); final TextField<String> addressStateField = new TextField<>("addressState"); final TextField<String> addressCityField = new TextField<>("addressCity"); final TextField<String> addressZipField = new TextField<>("addressZip"); final TextField<String> emailAddressField = new TextField<>("emailAddress"); emailAddressField.add(EmailAddressValidator.getInstance()); emailAddressField.setRequired(true); final TextField<String> airplaneMakeField = new TextField<>("airplaneMake"); final TextField<String> airplaneModelField = new TextField<>("airplaneModel"); final NumberTextField<Integer> manufactureYearField = new NumberTextField<>("manufactureYear"); manufactureYearField.setType(Integer.class); int year = Calendar.getInstance().get(Calendar.YEAR); manufactureYearField.setMinimum(1903).setMaximum(year); RadioGroup<String> group = new RadioGroup<>("needJudging"); group.setRequired(true); add(group); ListView<Boolean> radios = new ListView<Boolean>("radios", TRUE_FALSE) { @Override protected void populateItem(ListItem<Boolean> item) { Radio<Boolean> radio = new Radio<>("radio", item.getModel()); radio.setLabel(new Model(item.getModelObject())); item.add(radio); item.add(new SimpleFormComponentLabel("boolval", radio)); } }.setReuseItems(true); group.add(radios); Model<Record> recordModel = new Model<>(record); Form<Record> recordForm = new Form<>("recordForm", new CompoundPropertyModel<>(recordModel)); final Button saveRecordButton = new Button("save") { @Override public void onSubmit() { record.setCategory(selected.toString()); if (manufactureYearField.getInput() != null) { record.setManufactureYear(manufactureYearField.getInput()); } recordFacade.edit(record); setResponsePage(HomePage.class); } }; if (formControlsEnabled != true) { saveRecordButton.setVisible(false); } recordForm.add(saveRecordButton); final Button deleteRecordButton = new Button("delete") { @Override public void onSubmit() { recordFacade.remove(record); setResponsePage(HomePage.class); } }; deleteRecordButton.setDefaultFormProcessing(false); if (formControlsEnabled != true) { deleteRecordButton.setVisible(false); } recordForm.add(deleteRecordButton); add(recordForm); recordForm.add(nNumberField); recordForm.add(firstNameField); recordForm.add(lastNameField); recordForm.add(secondaryPhoneField); recordForm.add(addressOneField); recordForm.add(addressStateField); recordForm.add(addressCityField); recordForm.add(addressZipField); recordForm.add(emailAddressField); recordForm.add(airplaneMakeField); recordForm.add(airplaneModelField); recordForm.add(manufactureYearField); /* Mandatory Fields */ recordForm.add(dateTextField); recordForm.add(primaryPhoneField); recordForm.add(group); recordForm.add(listCategories); // recordForm.add(new FormComponentFeedbackBorder("arrivalDateBorder").add(dateTextField)); // recordForm.add(new FormComponentFeedbackBorder("primaryPhoneBorder").add(primaryPhoneField)); // recordForm.add(new FormComponentFeedbackBorder("needJudgingBorder").add(group)); // recordForm.add(new FormComponentFeedbackBorder("categoryBorder").add(listCategories)); }
From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationCreatePanel.java
License:Apache License
private void createAppForm() { appForm = new Form<>("appForm", new CompoundPropertyModel<>(new FirstApplicationReleaseInfos())); TextField<String> appLabel = new TextField<>("appLabel"); appLabel.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.label.label")); appLabel.add(new AbstractValidator<String>() { @Override//from ww w. jav a 2s. co m protected void onValidate(IValidatable<String> iValidatable) { if (!parentPage.isApplicationLabelUnique(iValidatable.getValue())) { error(iValidatable); } } @Override protected String resourceKey() { return "portal.application.label.non.unique"; } @Override protected Map<String, Object> variablesMap(IValidatable<String> stringIValidatable) { Map<String, Object> map = super.variablesMap(stringIValidatable); map.put("label", stringIValidatable.getValue()); return map; } }); appLabel.add(new PropertyValidator<>()); appForm.add(appLabel); TextField<String> appCode = new TextField<>("appCode"); appCode.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.code.label")); appCode.add(new PropertyValidator<>()); appForm.add(appCode); TextArea<String> appDescription = new TextArea<>("appDescription"); appDescription.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.description.label")); appDescription.add(new PropertyValidator<>()); appForm.add(appDescription); RadioGroup<Boolean> appVisibility = new RadioGroup<>("appPublic"); appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-public", new Model<>(Boolean.TRUE))); appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-private", new Model<>(Boolean.FALSE))); appVisibility.add(new PropertyValidator<>()); appForm.add(appVisibility); appForm.add( new CacheActivatedImage("imageHelp.visibilityField", new ResourceModel("image.help").getObject())); TextField<String> members = new TextField<>("members"); members.add(new PropertyValidator<>()); appForm.add(members); appForm.add(new CacheActivatedImage("imageHelp.membersField", new ResourceModel("image.help").getObject())); releaseFiedsetPanel = new ReleaseFieldsetPanel("releaseFieldsetPanel", parentPage, manageApplicationRelease); appForm.add(releaseFiedsetPanel); createFormButtons(appForm); // set default visibility to private appForm.getModelObject().setAppPublic(Boolean.FALSE); add(appForm); }
From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationInformationPanel.java
License:Apache License
private void createEditShowInformationComponent(Application app) { appForm = new Form<>("appForm"); appForm.setDefaultModel(new CompoundPropertyModel<Application>(app)); label = new TextField<>("label"); label.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.label.label")); label.add(new PropertyValidator<>()); appForm.add(label);/*from ww w . j a va 2 s . c o m*/ code = new TextField<>("code"); code.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.code.label")); code.add(new PropertyValidator<>()); appForm.add(code); appVisibility = new RadioGroup<>("isPublic"); appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-public", new Model<>(Boolean.TRUE))); appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-private", new Model<>(Boolean.FALSE))); appVisibility.add(new PropertyValidator<>()); appVisibility.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.visibility.label")); users = new TextField<>("members", new PropertyModel<String>(this, "members")); users.add(new PropertyValidator<>()); appForm.add(users); appForm.add(new CacheActivatedImage("membersHelp", new ResourceModel("image.help").getObject())); appForm.add(appVisibility); description = new TextArea<>("description"); description.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.description.label")); description.add(new PropertyValidator<>()); appForm.add(description); add(appForm); createButtons(); manageButtonsVisibility(); updateEditableInput(); }