List of usage examples for org.apache.wicket.markup.html.form CheckBoxMultipleChoice CheckBoxMultipleChoice
public CheckBoxMultipleChoice(String id, IModel<? extends List<? extends T>> choices)
From source file:com.cubeia.backoffice.web.wallet.AccountList.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 2s.c om * Page parameters */ public AccountList(final PageParameters parameters) { Form<AccountList> searchForm = new Form<AccountList>("searchForm", new CompoundPropertyModel<AccountList>(this)); TextField<Long> idField = new TextField<Long>("userId"); searchForm.add(idField); TextField<Long> userNameField = new TextField<Long>("accountId"); searchForm.add(userNameField); final CheckBoxMultipleChoice<AccountStatus> statusesChoice = new CheckBoxMultipleChoice<AccountStatus>( "includeStatuses", Arrays.asList(AccountStatus.values())); statusesChoice.setSuffix(" "); statusesChoice.add(new IValidator<Collection<AccountStatus>>() { private static final long serialVersionUID = 1L; @Override public void validate(IValidatable<Collection<AccountStatus>> validatable) { if (statusesChoice.getInputAsArray() == null) { ValidationError error = new ValidationError().setMessage("Select one or more status"); validatable.error(error); } } }); searchForm.add(statusesChoice); CheckBoxMultipleChoice<AccountType> typesChoice = new CheckBoxMultipleChoice<AccountType>("includeTypes", asList(AccountType.values())); typesChoice.setSuffix(" "); searchForm.add(typesChoice); add(searchForm); add(new FeedbackPanel("feedback")); ISortableDataProvider<Account, String> dataProvider = new AccountDataProvider(); ArrayList<IColumn<Account, String>> columns = new ArrayList<IColumn<Account, String>>(); columns.add(new AbstractColumn<Account, String>(new Model<String>("Account Id")) { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Account>> item, String componentId, IModel<Account> model) { Account account = model.getObject(); Long accountId = account.getId(); LabelLinkPanel panel = new LabelLinkPanel(componentId, "" + accountId, "details for account id " + accountId, AccountDetails.class, params(AccountDetails.PARAM_ACCOUNT_ID, accountId)); item.add(panel); } @Override public boolean isSortable() { return true; } @Override public String getSortProperty() { return AccountsOrder.ID.name(); } }); columns.add(new AbstractColumn<Account, String>(new Model<String>("User id")) { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Account>> item, String componentId, IModel<Account> model) { Account account = model.getObject(); Long userId = account.getUserId(); Component panel = new LabelLinkPanel(componentId, "" + userId, UserSummary.class, params(UserSummary.PARAM_USER_ID, userId)).setVisible(userId != null); item.add(panel); } @Override public boolean isSortable() { return true; } @Override public String getSortProperty() { return AccountsOrder.USER_ID.name(); } }); columns.add(new PropertyColumn<Account, String>(new Model<String>("Account name"), AccountsOrder.ACCOUNT_NAME.name(), "information.name")); columns.add(new PropertyColumn<Account, String>(new Model<String>("Status"), AccountsOrder.STATUS.name(), "status")); columns.add( new PropertyColumn<Account, String>(new Model<String>("Type"), AccountsOrder.TYPE.name(), "type")); columns.add(new PropertyColumn<Account, String>(new Model<String>("Currency"), "currencyCode")); columns.add(new DatePropertyColumn<Account, String>(new Model<String>("Creation date"), AccountsOrder.CREATION_DATE.name(), "created")); columns.add(new DatePropertyColumn<Account, String>(new Model<String>("Close date"), AccountsOrder.CLOSE_DATE.name(), "closed")); columns.add(new AbstractColumn<Account, String>(new Model<String>("Actions")) { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Account>> item, String componentId, IModel<Account> model) { Account account = model.getObject(); Long accountId = account.getId(); LabelLinkPanel panel = new LabelLinkPanel(componentId, "transactions", "transactions involving account id " + accountId, TransactionList.class, params(TransactionList.PARAM_ACCOUNT_ID, accountId)); item.add(panel); } }); AjaxFallbackDefaultDataTable<Account, String> userTable = new AjaxFallbackDefaultDataTable<Account, String>( "accountTable", columns, dataProvider, 20); add(userTable); }
From source file:com.cubeia.games.poker.admin.wicket.pages.wallet.AccountList.java
License:Open Source License
/** * Constructor that is invoked when page is invoked without a session. * * @param parameters/*from w w w . j a v a 2s.com*/ * Page parameters */ public AccountList(final PageParameters parameters) { super(parameters); Form<AccountList> searchForm = new Form<AccountList>("searchForm", new CompoundPropertyModel<AccountList>(this)); TextField<Long> idField = new TextField<Long>("userId"); searchForm.add(idField); TextField<Long> userNameField = new TextField<Long>("accountId"); searchForm.add(userNameField); final CheckBoxMultipleChoice<AccountStatus> statusesChoice = new CheckBoxMultipleChoice<AccountStatus>( "includeStatuses", Arrays.asList(AccountStatus.values())); statusesChoice.setSuffix(" "); statusesChoice.add(new IValidator<Collection<AccountStatus>>() { private static final long serialVersionUID = 1L; @Override public void validate(IValidatable<Collection<AccountStatus>> validatable) { if (statusesChoice.getInputAsArray() == null) { ValidationError error = new ValidationError().setMessage("Select one or more status"); validatable.error(error); } } }); searchForm.add(statusesChoice); CheckBoxMultipleChoice<AccountType> typesChoice = new CheckBoxMultipleChoice<AccountType>("includeTypes", asList(AccountType.values())); typesChoice.setSuffix(" "); searchForm.add(typesChoice); add(searchForm); add(new FeedbackPanel("feedback")); ISortableDataProvider<Account, String> dataProvider = new AccountDataProvider(); ArrayList<IColumn<Account, String>> columns = new ArrayList<IColumn<Account, String>>(); columns.add(new AbstractColumn<Account, String>(new Model<String>("Account Id")) { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Account>> item, String componentId, IModel<Account> model) { Account account = model.getObject(); Long accountId = account.getId(); LabelLinkPanel panel = new LabelLinkPanel(componentId, "" + accountId, "details for account id " + accountId, AccountDetails.class, params(AccountDetails.PARAM_ACCOUNT_ID, accountId)); item.add(panel); } @Override public boolean isSortable() { return true; } @Override public String getSortProperty() { return AccountsOrder.ID.name(); } }); columns.add(new AbstractColumn<Account, String>(new Model<String>("User id")) { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Account>> item, String componentId, IModel<Account> model) { Account account = model.getObject(); Long userId = account.getUserId(); Component panel = new LabelLinkPanel(componentId, "" + userId, UserSummary.class, params(UserSummary.PARAM_USER_ID, userId)).setVisible(userId != null); item.add(panel); } @Override public boolean isSortable() { return true; } @Override public String getSortProperty() { return AccountsOrder.USER_ID.name(); } }); columns.add(new PropertyColumn<Account, String>(new Model<String>("Account name"), AccountsOrder.ACCOUNT_NAME.name(), "information.name")); columns.add(new PropertyColumn<Account, String>(new Model<String>("Status"), AccountsOrder.STATUS.name(), "status")); columns.add( new PropertyColumn<Account, String>(new Model<String>("Type"), AccountsOrder.TYPE.name(), "type")); columns.add(new PropertyColumn<Account, String>(new Model<String>("Currency"), "currencyCode")); columns.add(new DatePropertyColumn<Account, String>(new Model<String>("Creation date"), AccountsOrder.CREATION_DATE.name(), "created")); columns.add(new DatePropertyColumn<Account, String>(new Model<String>("Close date"), AccountsOrder.CLOSE_DATE.name(), "closed")); columns.add(new AbstractColumn<Account, String>(new Model<String>("Actions")) { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Account>> item, String componentId, IModel<Account> model) { Account account = model.getObject(); Long accountId = account.getId(); LabelLinkPanel panel = new LabelLinkPanel(componentId, "transactions", "transactions involving account id " + accountId, TransactionList.class, params(TransactionList.PARAM_ACCOUNT_ID, accountId)); item.add(panel); } }); AjaxFallbackDefaultDataTable<Account, String> userTable = new AjaxFallbackDefaultDataTable<Account, String>( "accountTable", columns, dataProvider, 20); add(userTable); }
From source file:org.jabox.webapp.pages.container.EditContainerPage.java
License:Open Source License
public EditContainerPage(final IModel<Container> user) { Form<Container> form = new ShinyForm<Container>("form", new CompoundPropertyModel<Container>(user.getObject())) { private static final long serialVersionUID = -8262391690702864764L; @Override/*from w w w . j ava 2s . c o m*/ protected void onSubmit() { onSave(getModelObject()); } }; add(form); form.add(new RequiredTextField<Container>("name")); form.add(new RequiredTextField<Container>("port")); form.add(new RequiredTextField<Container>("rmiPort")); form.add(new RequiredTextField<Container>("ajpPort")); form.add(new RequiredTextField<Container>("jvmArgs")); List<EmbeddedServer> webapps = new ArrayList<EmbeddedServer>(); webapps.addAll(user.getObject().getServers()); webapps.add(new ArtifactoryServer()); webapps.add(new HudsonServer()); webapps.add(new JtracServer()); webapps.add(new ChiliprojectServer()); form.add(new CheckBoxMultipleChoice<EmbeddedServer>("webapps", webapps)); }
From source file:wicketdnd.examples.Example.java
License:Apache License
public Example(String id) { super(id);/*from w ww . j av a 2 s . c om*/ content = new WebMarkupContainer("content"); content.setOutputMarkupId(true); add(content); operations = new ArrayList<Operation>(); operations.addAll(EnumSet.allOf(Operation.class)); dragOperations.addAll(operations); dropOperations.addAll(operations); add(new Label("title", new AbstractReadOnlyModel<String>() { @Override public String getObject() { String name = Example.this.getClass().getSimpleName(); return name.substring(0, name.indexOf("Example")); } })); final WebMarkupContainer controls = new WebMarkupContainer("controls", new CompoundPropertyModel<Example>(this)); add(controls); controls.add(new CheckBoxMultipleChoice<Operation>("dragOperations", operations).setSuffix("") .add(new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { target.add(content); } })); controls.add(new CheckBoxMultipleChoice<Operation>("dropOperations", operations).setSuffix("") .add(new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { target.add(content); } })); controls.add(new TextField<String[]>("types", String[].class) { @Override @SuppressWarnings("unchecked") public <C> IConverter<C> getConverter(Class<C> type) { return (IConverter<C>) new StringArrayConverter(); } }.setConvertEmptyInputStringToNull(false).add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { target.add(content); } })); }