Example usage for org.apache.wicket.extensions.markup.html.repeater.data.table.filter GoAndClearFilter GoAndClearFilter

List of usage examples for org.apache.wicket.extensions.markup.html.repeater.data.table.filter GoAndClearFilter GoAndClearFilter

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.markup.html.repeater.data.table.filter GoAndClearFilter GoAndClearFilter.

Prototype

public GoAndClearFilter(final String id, final IModel<String> goModel, final IModel<String> clearModel,
        Object originalState) 

Source Link

Document

Constructor

Usage

From source file:wicket.contrib.phonebook.web.page.ListContactsPage.java

License:Apache License

/**
 * Create a composite column extending FilteredAbstractColumn. This column adds a
 * UserActionsPanel as its cell contents. It also provides the go-and-clear filter control
 * panel.//from w  w  w .java 2 s  . c  o  m
 */
private FilteredAbstractColumn<Contact, String> createActionsColumn() {
    return new FilteredAbstractColumn<Contact, String>(Model.of(getString("actions"))) {
        private static final long serialVersionUID = 1L;

        // return the go-and-clear filter for the filter toolbar
        public Component getFilter(String componentId, FilterForm<?> form) {
            return new GoAndClearFilter(componentId, form, new ResourceModel("filter"),
                    new ResourceModel("clear"));
        }

        // add the UserActionsPanel to the cell item
        public void populateItem(Item<ICellPopulator<Contact>> cellItem, String componentId,
                IModel<Contact> rowModel) {
            cellItem.add(new UserActionsPanel(componentId, rowModel));
        }
    };
}

From source file:za.org.rfm.web.memberdata.page.ListMembersPage.java

License:Apache License

/**
 * Create a composite column extending FilteredAbstractColumn. This column adds a
 * UserActionsPanel as its cell contents. It also provides the go-and-clear filter control
 * panel./*from  ww  w . ja va  2  s.  c  o  m*/
 */
private FilteredAbstractColumn<Member, String> createActionsColumn() {
    return new FilteredAbstractColumn<Member, String>(new Model<String>(getString("actions"))) {
        private static final long serialVersionUID = 1L;

        // return the go-and-clear filter for the filter toolbar
        public Component getFilter(String componentId, FilterForm<?> form) {
            return new GoAndClearFilter(componentId, form, new ResourceModel("filter"),
                    new ResourceModel("clear"));
        }

        // add the UserActionsPanel to the cell item
        public void populateItem(Item<ICellPopulator<Member>> cellItem, String componentId,
                final IModel<Member> rowModel) {
            cellItem.add(new UserActionsPanel(componentId, rowModel));
            cellItem.add(new AjaxEventBehavior("onclick") {

                private static final long serialVersionUID = 6720512493017210281L;

                @Override
                protected void onEvent(AjaxRequestTarget target) {
                    PageParameters pageParameters = new PageParameters();
                    pageParameters.add("memberid", rowModel.getObject().getId().toString());
                    setResponsePage(ViewMember.class, pageParameters);
                }

            });

        }
    };
}