List of usage examples for org.apache.wicket.extensions.ajax.markup.html.repeater.data.table AjaxFallbackDefaultDataTable AjaxFallbackDefaultDataTable
public AjaxFallbackDefaultDataTable(final String id, final List<? extends IColumn<T, S>> columns, final ISortableDataProvider<T, S> dataProvider, final int rowsPerPage)
From source file:ca.travelagency.config.LookupEntitiesPage.java
License:Apache License
private Component makeDataTable(IModel<LookupEntitiesFilter> model) { return new AjaxFallbackDefaultDataTable<T, String>(DATA_TABLE, makeColumns(), new DataProvider<T>(model), DATA_TABLE_PER_PAGE);/* w w w.j ava 2 s. c o m*/ }
From source file:ca.travelagency.customer.CustomersPage.java
License:Apache License
public CustomersPage() { super();//w ww . j a v a 2 s.co m IModel<CustomerFilter> model = Model.of(getAuthenticatedSession().getCustomerFilter()); add(makeSearchForm(model)); add(new Link<String>(CREATE) { private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(new CustomerPage()); } }); add(new AjaxFallbackDefaultDataTable<Customer, String>(DATA_TABLE, makeColumns(), new DataProvider<Customer>(model), DATA_TABLE_PER_PAGE)); }
From source file:ca.travelagency.identity.SystemUsersPage.java
License:Apache License
public SystemUsersPage(final IModel<SystemUserFilter> model) { super();/*from w ww .j a va 2 s. c o m*/ add(new SearchPanel<SystemUser, SystemUserFilter>(SEARCH_PANEL, model, new SystemUsersPageSearchButtons(model))); add(new AjaxFallbackDefaultDataTable<SystemUser, String>(DATA_TABLE, makeColumns(), new DataProvider<SystemUser>(model), DATA_TABLE_PER_PAGE)); add(new Link<String>(CREATE) { private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(new SystemUserPage()); } }.setVisible(canCreateSystemUser())); }
From source file:ca.travelagency.invoice.InvoicesPanel.java
License:Apache License
public InvoicesPanel(String id, IModel<InvoiceFilter> model) { super(id, model); setOutputMarkupId(true);//from w w w .ja va 2s . com add(new AjaxFallbackDefaultDataTable<Invoice, String>(DATA_TABLE, makeColumns(model), new DataProvider<Invoice>(model), BasePage.DATA_TABLE_PER_PAGE)); }
From source file:ca.travelagency.reconciliation.CommissionPage.java
License:Apache License
public CommissionPage() { super();/* w w w .jav a 2 s . c o m*/ IModel<InvoiceItemFilter> model = Model.of(getAuthenticatedSession().getInvoiceItemFilter()); add(makeSearchForm(model)); add(new AjaxFallbackDefaultDataTable<InvoiceItem, String>(DATA_TABLE, makeColumns(model), new DataProvider<InvoiceItem>(model), BasePage.DATA_TABLE_PER_PAGE)); }
From source file:ca.travelagency.reconciliation.PaymentPage.java
License:Apache License
public PaymentPage() { super();// w ww. j ava 2s . c o m IModel<InvoicePaymentFilter> model = Model.of(getAuthenticatedSession().getInvoicePaymentFilter()); add(makeSearchForm(model)); add(new AjaxFallbackDefaultDataTable<InvoicePayment, String>(DATA_TABLE, makeColumns(model), new DataProvider<InvoicePayment>(model), BasePage.DATA_TABLE_PER_PAGE)); }
From source file:ca.travelagency.traveler.TravelerLookupPanel.java
License:Apache License
public TravelerLookupPanel(String id, Form<InvoiceTraveler> travelerForm, ModalWindow modalWindow) { super(id);/* w w w .ja va 2 s. c om*/ this.travelerForm = travelerForm; this.modalWindow = modalWindow; Model<TravelerFilter> model = Model.of(new TravelerFilter(travelerForm.getModelObject().getLastName())); data = new AjaxFallbackDefaultDataTable<Traveler, String>(DATA, makeColumns(), new DataProvider<Traveler>(model), BasePage.DATA_TABLE_PER_PAGE); data.setOutputMarkupId(true); add(data); Form<TravelerFilter> form = new Form<TravelerFilter>(FORM, new CompoundPropertyModel<TravelerFilter>(model)); add(form); form.add(new ComponentFeedbackPanel(FEEDBACK, form)); form.add(new TextField<String>(TravelerFilter.Properties.searchText.name()) .setLabel(new ResourceModel("travelerLookupPanel.searchText")) .add(StringFieldHelper.maxLenFieldValidator()).add(new FieldDecorator(), new AjaxOnBlurBehavior())); form.add(new SearchButton(SEARCH, form)); }
From source file:com.cubeia.backoffice.web.user.UserList.java
License:Open Source License
/** * Constructor that is invoked when page is invoked without a session. * * @param parameters//from ww w . j a va 2 s. c o m * Page parameters */ public UserList(final PageParameters parameters) { final Form<?> searchForm = new Form<UserList>("searchForm", new CompoundPropertyModel<UserList>(this)); final TextField<String> idField = new TextField<String>("userId"); searchForm.add(idField); final TextField<String> userNameField = new TextField<String>("name"); searchForm.add(userNameField); searchForm.add(new Button("clearForm") { private static final long serialVersionUID = 1L; @Override public void onSubmit() { super.onSubmit(); idField.clearInput(); userNameField.clearInput(); } }); add(searchForm); add(new FeedbackPanel("feedback")); final UsersDataProvider dataProvider = new UsersDataProvider(); List<IColumn<User, String>> columns = new ArrayList<IColumn<User, String>>(); columns.add(new AbstractColumn<User, String>(Model.of("User Id")) { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<User>> item, String componentId, IModel<User> model) { Long userId = model.getObject().getUserId(); LabelLinkPanel panel = new LabelLinkPanel(componentId, "" + userId, UserSummary.class, params(UserSummary.PARAM_USER_ID, userId)); item.add(panel); } @Override public boolean isSortable() { return true; } @Override public String getSortProperty() { return UserOrder.ID.name(); } }); columns.add(new PropertyColumn<User, String>(Model.of("XId"), "externalUserId")); columns.add( new PropertyColumn<User, String>(Model.of("User name"), UserOrder.USER_NAME.name(), "userName")); columns.add(new PropertyColumn<User, String>(Model.of("Status"), UserOrder.STATUS.name(), "status")); // columns.add(new PropertyColumn<User,String>(Model.of("First name"), "userInformation.firstName")); // columns.add(new PropertyColumn<User,String>(Model.of("Last name"), "userInformation.lastName")); // columns.add(new PropertyColumn<User,String>(Model.of("Country"), UserOrder.COUNTRY.name(), "userInformation.country")); columns.add(new PropertyColumn<User, String>(Model.of("Ext. Username"), "attributes.externalUsername")); columns.add(new PropertyColumn<User, String>(Model.of("Screename"), "attributes.screenname")); AjaxFallbackDefaultDataTable<User, String> userTable = new AjaxFallbackDefaultDataTable<User, String>( "userTable", columns, dataProvider, 20); add(userTable); final ModalWindow modal = new ModalWindow("modal"); modal.setContent(new UserReportPanel(modal.getContentId(), modal)); modal.setTitle("Generate report"); modal.setCookieName("modal"); modal.setCssClassName(ModalWindow.CSS_CLASS_GRAY); modal.setInitialWidth(265); modal.setInitialHeight(200); add(modal); add(new AjaxLink<Void>("showReportPanel") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { List<User> users = getUserList(getUserId(), getName(), 0, Integer.MAX_VALUE, dataProvider.getSort().getProperty(), dataProvider.getSort().isAscending()).getUsers(); HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest(); request.getSession().setAttribute(ReportServlet.REPORTS_COLLECTION_DATA_SOURCE, users); modal.show(target); } }); }
From source file:com.cubeia.backoffice.web.wallet.AccountDetails.java
License:Open Source License
/** * Constructor that is invoked when page is invoked without a session. * * @param params//w ww .j av a 2s. c om * Page parameters */ public AccountDetails(PageParameters params) { Long accountId = params.get(PARAM_ACCOUNT_ID).toLongObject(); account = walletService.getAccountById(accountId); if (getAccount() == null) { setInvalidAccountResponsePage(accountId); return; } Long accountUserId = getAccount().getUserId(); add(new LabelLinkPanel("editAccount", "edit", EditAccount.class, ParamBuilder.params(EditAccount.PARAM_ACCOUNT_ID, accountId))); CompoundPropertyModel<?> cpm = new CompoundPropertyModel<AccountDetails>(this); add(new Label("balance", cpm.bind("balance"))); add(new Label(PARAM_ACCOUNT_ID, cpm.bind("account.id"))); add(new Label("userId", cpm.bind("account.userId"))); add(new Label("name", cpm.bind("account.information.name"))); add(new Label("currency", cpm.bind("account.currencyCode"))); add(new Label("status", cpm.bind("account.status"))); add(new Label("created", cpm.bind("account.created"))); add(new Label("closed", cpm.bind("account.closed"))); add(new Label("gameId", cpm.bind("account.information.gameId"))); add(new Label("objectId", cpm.bind("account.information.objectId"))); add(new Label("type", cpm.bind("account.type"))); add(new Label("negativeAmountAllowed", cpm.bind("account.negativeAmountAllowed"))); add(new LabelLinkPanel("editUser", "edit", EditUser.class, ParamBuilder.params(EditUser.PARAM_USER_ID, accountUserId))); ISortableDataProvider<Entry, String> dataProvider = new EntriesDataProvider(); List<IColumn<Entry, String>> columns = new ArrayList<IColumn<Entry, String>>(); columns.add( new PropertyColumn<Entry, String>(Model.of("Tx id"), TransactionsOrder.ID.name(), "transactionId") { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Entry>> item, String componentId, IModel<Entry> rowModel) { Long txId = rowModel.getObject().getTransactionId(); PageParameters pageParams = new PageParameters(); pageParams.set("transactionId", txId); item.add(new LabelLinkPanel(componentId, "" + txId, TransactionInfo.class, pageParams)); } }); columns.add(new PropertyColumn<Entry, String>(Model.of("Date"), "timestamp") { private static final long serialVersionUID = 1L; @Override public void populateItem(Item<ICellPopulator<Entry>> item, String componentId, IModel<Entry> model) { item.add(new Label(componentId, formatDate(model.getObject().getTimestamp()))); } }); columns.add(new PropertyColumn<Entry, String>(Model.of("Comment"), "transactionComment")); columns.add(new PropertyColumn<Entry, String>(Model.of("Amount"), "amount")); columns.add(new PropertyColumn<Entry, String>(Model.of("Resulting balance"), "resultingBalance")); AjaxFallbackDefaultDataTable<Entry, String> entryTable = new AjaxFallbackDefaultDataTable<Entry, String>( "entryTable", columns, dataProvider, 20); add(entryTable); }
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/* w ww . j a v a 2 s . c o m*/ * 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); }