Example usage for org.apache.wicket.markup.html.form CheckBoxMultipleChoice setSuffix

List of usage examples for org.apache.wicket.markup.html.form CheckBoxMultipleChoice setSuffix

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form CheckBoxMultipleChoice setSuffix.

Prototype

public final CheckBoxMultipleChoice<T> setSuffix(final String suffix) 

Source Link

Usage

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 www.j  ava 2 s. 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// ww  w .  j a  v a 2 s  . co m
*            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.geoserver.gwc.web.layer.StyleParameterFilterSubform.java

License:Open Source License

public StyleParameterFilterSubform(String id, IModel<StyleParameterFilter> model) {
    super(id, model);

    final Component defaultValue;

    final String allStyles = getLocalizer().getString("allStyles", this);
    final String layerDefault = getLocalizer().getString("layerDefault", this);

    final IModel<List<String>> availableStylesModelDefault = new SetAsListModel(
            new PropertyModel<Set<String>>(model, "layerStyles"), layerDefault);
    final IModel<List<String>> availableStylesModelAllowed = new SetAsListModel(
            new PropertyModel<Set<String>>(model, "layerStyles"), allStyles);
    final IModel<List<String>> selectedStylesModel = new NullableSetAsListModel(
            new PropertyModel<Set<String>>(model, "styles"), allStyles);
    final IModel<String> selectedDefaultModel = new LabelledEmptyStringModel(
            new PropertyModel<String>(model, "realDefault"), layerDefault);

    defaultValue = new DropDownChoice<String>("defaultValue", selectedDefaultModel,
            availableStylesModelDefault);
    add(defaultValue);//from   w  ww.j  a  v a  2s.  c  om

    final CheckBoxMultipleChoice<String> styles = new CheckBoxMultipleChoice<String>("styles",
            selectedStylesModel, availableStylesModelAllowed);
    styles.setPrefix("<li>");
    styles.setSuffix("</li>");
    add(styles);
}

From source file:org.onehippo.forge.embargo.frontend.plugins.SetEmbargoDialog.java

License:Apache License

public SetEmbargoDialog(StdWorkflow<EmbargoWorkflow> action, IModel<List<String>> selectedEmbargoGroups,
        List<String> availableEmbargoGroups) {
    super(selectedEmbargoGroups);
    add(new Label("text", new ResourceModel("select-embargo-groups-text")));
    final CheckBoxMultipleChoice<String> embargoGroups = new CheckBoxMultipleChoice<>("checkboxes",
            selectedEmbargoGroups, availableEmbargoGroups);
    embargoGroups.setPrefix("<div>");
    embargoGroups.setSuffix("</div>");
    add(embargoGroups);//  ww w . ja  v  a2s.  c  om
    this.action = action;
}

From source file:org.onexus.website.api.widgets.selection.SelectorFiltersWidget.java

License:Apache License

public SelectorFiltersWidget(String componentId, IModel<SelectorFiltersWidgetStatus> statusModel) {
    super(componentId, statusModel);
    onEventFireUpdate(EventQueryUpdate.class);

    Form form = new Form("form");

    CheckBoxMultipleChoice<FilterConfig> filters = new CheckBoxMultipleChoice<FilterConfig>("filters",
            new PropertyModel<List<FilterConfig>>(statusModel, "selectedFilters"), getConfig().getFilters(),
            new ChoiceRenderer<FilterConfig>("name"));
    filters.setSuffix("");
    form.add(filters);/*from w ww  .j  a  va2 s .  c om*/
    form.setOutputMarkupId(true);
    add(form);

    AjaxFormValidatingBehavior.addToAllFormComponents(form, "change");

    /*
    add(new AjaxSubmitLink("apply", form) {
    @Override
    protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
        send(getPage(), Broadcast.BREADTH, EventFiltersUpdate.EVENT);
    }
    });*/

}