Example usage for org.apache.wicket.request.mapper.parameter PageParameters set

List of usage examples for org.apache.wicket.request.mapper.parameter PageParameters set

Introduction

In this page you can find the example usage for org.apache.wicket.request.mapper.parameter PageParameters set.

Prototype

public PageParameters set(final String name, final Object value) 

Source Link

Document

Sets the page parameter with name and value

Usage

From source file:com.axway.ats.testexplorer.pages.model.BookmarkableTabbedPanel.java

License:Apache License

@Override
protected WebMarkupContainer newLink(String linkId, int index) {

    PageParameters newPageParameters = new PageParameters(pageParameters);
    if (index == defaultTabIndex) {
        newPageParameters.remove(tabParameterName);
    } else {// w  w  w  .  java  2  s. co m
        newPageParameters.set(tabParameterName, index);
    }

    WebMarkupContainer link = new BookmarkablePageLink<Object>(linkId, getPage().getClass(), newPageParameters);
    return link;
}

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  w w. j av  a  2 s.  com*/
*            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.TransactionInfo.java

License:Open Source License

private void setInvalidTransactionResponsePage(final Long accountId) {
    PageParameters pageParams = new PageParameters();
    pageParams.set("transactionId", accountId);
    setResponsePage(InvalidTransaction.class, pageParams);
}

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//www.  ja va  2s. co  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.history.ShowHandTest.java

License:Open Source License

@Test
public void testPageLoading() {
    PageParameters pageParameters = new PageParameters();
    pageParameters.set("handId", "someId");
    HistoricHand hand = createMockHand();

    when(historyService.findHandById("someId")).thenReturn(hand);

    tester.startPage(new ShowHand(pageParameters));
    tester.assertRenderedPage(ShowHand.class);
}

From source file:com.cubeia.games.poker.admin.wicket.pages.tournaments.history.ShowTournamentTest.java

License:Open Source License

@Test
public void testShowTournament() {
    WicketTester tester = new WicketTester();
    tester.getApplication().getComponentInstantiationListeners()
            .add(new SpringComponentInjector(tester.getApplication(), context));
    PageParameters pageParameters = new PageParameters();
    pageParameters.set("historicTournamentId", "someId");
    HistoricTournament tournament = new HistoricTournament();
    tournament.setId(new ObjectId());
    when(historyService.findTournamentByHistoricId("someId")).thenReturn(tournament);
    tester.startPage(new ShowTournament(pageParameters));
    tester.assertRenderedPage(ShowTournament.class);
}

From source file:com.cubeia.games.poker.admin.wicket.pages.wallet.AccountDetails.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param params/*from  ww w . j a  va 2  s  .c o m*/
*            Page parameters
*/
public AccountDetails(PageParameters params) {
    super(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,
            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, 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.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. java  2 s  . co  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.evolveum.midpoint.gui.api.page.PageBase.java

License:Apache License

public void updateBreadcrumbParameters(String key, Object value) {
    List<Breadcrumb> list = getSessionStorage().getBreadcrumbs();
    if (list.isEmpty()) {
        return;/*from w  ww.j av  a  2s . co m*/
    }

    Breadcrumb bc = list.get(list.size() - 1);
    PageParameters params = bc.getParameters();
    if (params == null) {
        return;
    }

    params.set(key, value);
}

From source file:com.evolveum.midpoint.gui.impl.page.admin.configuration.component.ObjectPolicyConfigurationTabPanel.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    PageParameters params = getPage().getPageParameters();
    StringValue val = params.get(PageSystemConfiguration.SELECTED_TAB_INDEX);
    if (val != null && !val.isNull()) {
        params.remove(params.getPosition(PageSystemConfiguration.SELECTED_TAB_INDEX));
    }//from  w  w w  .j a v a2s. co  m
    params.set(PageSystemConfiguration.SELECTED_TAB_INDEX,
            PageSystemConfiguration.CONFIGURATION_TAB_OBJECT_POLICY);

    initLayout();
}