List of usage examples for org.apache.wicket.extensions.markup.html.repeater.data.table.filter FilteredAbstractColumn FilteredAbstractColumn
public FilteredAbstractColumn(final IModel<String> displayModel)
From source file:org.cipango.ims.hss.web.privateid.PrivateIdBrowserPage.java
License:Apache License
@SuppressWarnings("unchecked") public PrivateIdBrowserPage() { super(null);//from w w w . ja v a 2 s . c o m IColumn[] columns = new IColumn[3]; columns[0] = new PropertyColumn(new StringResourceModel(getPrefix() + ".name", this, null), "identity"); columns[1] = new AbstractColumn(new StringResourceModel(getPrefix() + ".publicIds", this, null)) { public void populateItem(Item cellItem, String componentId, IModel model) { PrivateIdentity identity = (PrivateIdentity) model.getObject(); cellItem.add(new Label(componentId, String.valueOf(identity.getPublicIdentities().size()))); } }; columns[2] = new FilteredAbstractColumn(new Model("Actions")) { public void populateItem(Item cellItem, String componentId, IModel model) { final PrivateIdentity id = (PrivateIdentity) model.getObject(); cellItem.add(new ActionsPanel(componentId, id)); } // return the go-and-clear filter for the filter toolbar public Component getFilter(String componentId, FilterForm form) { return new GoAndClearFilter(componentId, form); } }; DefaultDataTable table = new DefaultDataTable("browser", columns, new DaoDataProvider("identity"), 15); add(table); setContextMenu(new IdentitiesContextPanel()); }
From source file:org.cipango.ims.hss.web.publicid.PublicIdBrowserPage.java
License:Apache License
@SuppressWarnings("unchecked") public PublicIdBrowserPage(PageParameters pageParameters) { super(pageParameters); String serviceProfile = pageParameters.getString("serviceProfile"); String applicationServer = pageParameters.getString("applicationServer"); String scscf = pageParameters.getString("scscf"); String search = pageParameters.getString("search"); addSearchField(search);/*from w w w. j a v a 2 s .c o m*/ add(new BookmarkablePageLink("createLink", EditPublicUserIdPage.class)); add(new BookmarkablePageLink("createPsiLink", EditPsiPage.class)); IColumn[] columns = new IColumn[5]; columns[0] = new PropertyColumn(new StringResourceModel(getPrefix() + ".name", this, null), "identity", "identity"); columns[1] = new PropertyColumn(new StringResourceModel(getPrefix() + ".barred", this, null), "barred", "barred"); columns[2] = new PropertyColumn(new StringResourceModel(getPrefix() + ".identityType", this, null), "TYPE,regex", "identityTypeAsString"); columns[3] = new PropertyColumn(new StringResourceModel(getPrefix() + ".state", this, null), "stateAsString"); columns[4] = new FilteredAbstractColumn(new Model("Actions")) { public void populateItem(Item cellItem, String componentId, IModel model) { final PublicIdentity id = (PublicIdentity) model.getObject(); cellItem.add(new ActionsPanel(componentId, id)); } // return the go-and-clear filter for the filter toolbar public Component getFilter(String componentId, FilterForm form) { return new GoAndClearFilter(componentId, form); } }; DaoDataProvider daoDataProvider = new DaoDataProvider("identity", serviceProfile, applicationServer, scscf, search); DefaultDataTable table = new DefaultDataTable("browser", columns, daoDataProvider, getItemByPage()); add(table); serviceProfile = daoDataProvider.getServiceProfile(); applicationServer = daoDataProvider.getApplicationServer(); scscf = daoDataProvider.getScscf(); if (!Strings.isEmpty(serviceProfile)) { setContextMenu(new ContextPanel(_serviceProfileDao.findById(serviceProfile))); _title = MapVariableInterpolator.interpolate(getString("serviceProfile.publicIds.browser.title"), new MicroMap("name", serviceProfile)); } else if (!Strings.isEmpty(applicationServer)) { setContextMenu( new org.cipango.ims.hss.web.as.ContextPanel(_applicationServerDao.findById(applicationServer))); _title = MapVariableInterpolator.interpolate(getString("as.psi.browser.title"), new MicroMap("name", applicationServer)); } else if (!Strings.isEmpty(scscf)) { setContextMenu(new org.cipango.ims.hss.web.scscf.ContextPanel(_scscfDao.findById(scscf))); _title = MapVariableInterpolator.interpolate(getString("scscf.psi.browser.title"), new MicroMap("name", scscf)); } else _title = getString(getPrefix() + ".browser.title"); add(new Label("title", _title)); setContextMenu(new IdentitiesContextPanel()); }
From source file:org.cipango.ims.hss.web.serviceprofile.ServiceProfileBrowserPage.java
License:Apache License
@SuppressWarnings("unchecked") public ServiceProfileBrowserPage(PageParameters pageParameters) { super(pageParameters); String ifcName = pageParameters.getString("ifc"); add(new BookmarkablePageLink("createLink", EditServiceProfilePage.class)); IColumn[] columns = new IColumn[4]; columns[0] = new PropertyColumn(new StringResourceModel(getPrefix() + ".name", this, null), "name", "name"); columns[1] = new AbstractColumn(new StringResourceModel(getPrefix() + ".nbPublicIds", this, null)) { public void populateItem(Item cellItem, String componentId, IModel model) { cellItem.add(new NbPublicIdsPanel(componentId, (ServiceProfile) model.getObject())); }/*from ww w. j a va 2s.c om*/ }; columns[2] = new AbstractColumn(new StringResourceModel(getPrefix() + ".ifcs", this, null)) { public void populateItem(Item cellItem, String componentId, IModel model) { ServiceProfile sp = (ServiceProfile) model.getObject(); cellItem.add(new Label(componentId, String.valueOf(sp.getAllIfcs().size()))); } }; columns[3] = new FilteredAbstractColumn(new Model("Actions")) { public void populateItem(Item cellItem, String componentId, IModel model) { ServiceProfile id = (ServiceProfile) model.getObject(); cellItem.add(new ActionsPanel(componentId, id)); } public Component getFilter(String componentId, FilterForm form) { return new GoAndClearFilter(componentId, form); } }; DaoDataProvider daoDataProvider = new DaoDataProvider("name", ifcName); DefaultDataTable table = new DefaultDataTable("browser", columns, daoDataProvider, getItemByPage()); add(table); ifcName = daoDataProvider.getIfc(); if (!Strings.isEmpty(ifcName)) { setContextMenu(new ContextPanel(_ifcDao.findById(ifcName))); _title = MapVariableInterpolator.interpolate(getString("ifc.serviceProfile.browser.title"), new MicroMap("name", ifcName)); } else _title = getString(getPrefix() + ".browser.title"); add(new Label("title", _title)); setContextMenu(new ServicesContextPanel()); }
From source file:org.cipango.ims.hss.web.subscription.SubscriptionBrowserPage.java
License:Apache License
@SuppressWarnings("unchecked") public SubscriptionBrowserPage(PageParameters pageParameters) { super(pageParameters); String scscf = pageParameters.getString("scscf"); add(new BookmarkablePageLink("createLink", AddSubscriptionPage.class)); IColumn[] columns = new IColumn[5]; columns[0] = new PropertyColumn(new StringResourceModel(getPrefix() + ".name", this, null), "name", "name"); columns[1] = new PropertyColumn(new StringResourceModel(getPrefix() + ".scscf", this, null), "scscf", "scscf"); columns[2] = new PropertyColumn(new Model(getString("contextPanel.privateIdentities")), null) { public void populateItem(Item cellItem, String componentId, IModel model) { final Subscription id = (Subscription) model.getObject(); cellItem.add(new IdentityPanel(componentId, id.getPrivateIds(), false)); }/* ww w. j ava2 s . c o m*/ }; columns[3] = new PropertyColumn(new Model(getString("contextPanel.publicIdentities")), null) { public void populateItem(Item cellItem, String componentId, IModel model) { final Subscription id = (Subscription) model.getObject(); cellItem.add(new IdentityPanel(componentId, id.getPublicIds(), true)); } }; columns[4] = new FilteredAbstractColumn(new Model(getString("actions"))) { public void populateItem(Item cellItem, String componentId, IModel model) { final Subscription id = (Subscription) model.getObject(); cellItem.add(new ActionsPanel(componentId, id)); } public Component getFilter(String componentId, FilterForm form) { return new GoAndClearFilter(componentId, form); } }; DaoDataProvider daoDataProvider = new DaoDataProvider("name", scscf); DefaultDataTable table = new DefaultDataTable("browser", columns, daoDataProvider, getItemByPage()); table.setOutputMarkupId(true); add(table); scscf = daoDataProvider.getScscf(); if (!Strings.isEmpty(scscf)) { setContextMenu(new ContextPanel(_scscfDao.findById(scscf))); _title = MapVariableInterpolator.interpolate(getString("scscf.subscriptions.browser.title"), new MicroMap("name", scscf)); } else _title = getString(getPrefix() + ".browser.title"); add(new Label("title", _title)); setContextMenu(new IdentitiesContextPanel()); }
From source file:org.openengsb.ui.common.taskbox.web.TaskOverviewPanel.java
License:Apache License
public TaskOverviewPanel(String id) { super(id);/* w w w . ja v a 2 s .c om*/ ArrayList<IColumn<Task>> columns = new ArrayList<IColumn<Task>>(); IColumn<Task> actionsColumn = new FilteredAbstractColumn<Task>(Model.of("Actions")) { @Override public Component getFilter(String componentId, FilterForm<?> form) { return new GoAndClearFilter(componentId, form); } @Override @SuppressWarnings("rawtypes") public void populateItem(Item cellItem, String componentId, IModel rowModel) { final Task task = (Task) rowModel.getObject(); cellItem.add(new UserActionsPanel(componentId, task)); } }; columns.add(actionsColumn); columns.add(new TextFilteredPropertyColumn<Task, String>(Model.of("TaskId"), "taskId", "taskId")); columns.add(new TextFilteredPropertyColumn<Task, String>(Model.of("TaskType"), "taskType", "taskType")); columns.add(new TextFilteredPropertyColumn<Task, String>(Model.of("Description"), "description", "description")); columns.add(new PropertyColumn<Task>(Model.of("TaskCreationTimestamp"), "taskCreationTimestamp", "taskCreationTimestamp")); FilterForm<Object> form = new FilterForm<Object>("form", dataProvider); DefaultDataTable<Task> dataTable = new DefaultDataTable<Task>("dataTable", columns, dataProvider, 15); dataTable.addTopToolbar(new FilterToolbar(dataTable, form, dataProvider)); form.add(dataTable); add(form); add(panel); }
From source file:org.wintersleep.usermgmt.wicket.UserListPage.java
License:Apache License
public UserListPage() { super();//from ww w . j a v a2s . c o m List<IColumn<User, String>> columns = new ArrayList<>(); columns.add(new FilteredAbstractColumn<User, String>(new Model<>("Actions")) { public void populateItem(Item<ICellPopulator<User>> cellItem, String componentId, final IModel<User> model) { cellItem.add(new ActionsPanel(componentId, new PageSourceLink<>("showLink", UserEditPage.class, model), new IPageLink() { public Page getPage() { return new UserEditPage(UserListPage.this, (HibernateObjectModel<Long, User>) model); } public Class<UserEditPage> getPageIdentity() { return UserEditPage.class; } }, new IPageLink() { public Page getPage() { User user = model.getObject(); return new DeletePage<>(UserListPage.this, model, "User: " + user.getFullName()); } public Class<DeletePage> getPageIdentity() { return DeletePage.class; } })); } public Component getFilter(String componentId, FilterForm<?> form) { return new GoAndClearAndNewFilter(componentId, form) { public Page createNewPage() { return new UserEditPage(UserListPage.this, new HibernateObjectModel<Long, User>(new User(WicketHibernateUtil.EMPTY_STRING))); } }; } }); columns.add(new TextFilteredPropertyColumn<User, User, String>(new Model<>("Login"), "login", "login")); columns.add( new TextFilteredPropertyColumn<User, User, String>(new Model<>("Name"), "fullName", "fullName")); /* // custom column to enable countries be be in the list and labeled correctly new MyChoiceFilteredPropertyColumn(new Model("Birth country"), "country.name", "country.name", "country", "name", countries), new MyChoiceFilteredPropertyColumn(new Model("Birth city"), "birthCity.name", "birthCity.name", "birthCity", "name", cities), new PropertyColumn(new Model("Final game"), "finalGame", "finalGame") */ UserFilter filter = new UserFilter(); final FilterForm<UserFilterState> filterForm = new FilterForm<>("form", filter); CriteriaSorter sorter = new CriteriaSorter(); HibernateProvider<Long, User> provider = new HibernateProvider<>(User.class, filter, sorter); DataTable<User, String> table = new DataTable<User, String>("table", columns, provider, 25) { protected Item<User> newRowItem(String id, int index, IModel<User> model) { return new OddEvenItem<>(id, index, model); } }; table.addTopToolbar(new NavigationToolbar(table)); table.addTopToolbar(new HeadersToolbar<>(table, sorter)); table.addTopToolbar(new FilterToolbar(table, filterForm, filter)); add(filterForm.add(table)); }
From source file:org.wintersleep.usermgmt.wicket.UserProfileListPage.java
License:Apache License
public UserProfileListPage() { super();// w w w . j a v a 2s .com UserProfileFilter filter = new UserProfileFilter(); final FilterForm<UserProfileFilterState> form = new FilterForm<>("form", filter); List<IColumn<UserProfile, String>> columns = new ArrayList<>(); columns.add(new FilteredAbstractColumn<UserProfile, String>(new Model<>("Actions")) { public void populateItem(Item<ICellPopulator<UserProfile>> cellItem, String componentId, final IModel<UserProfile> model) { cellItem.add(new ActionsPanel(componentId, new PageSourceLink<>("showLink", UserProfileEditPage.class, model), new IPageLink() { public Page getPage() { return new UserProfileEditPage(UserProfileListPage.this, model); } public Class<UserProfileEditPage> getPageIdentity() { return UserProfileEditPage.class; } }, new IPageLink() { public Page getPage() { UserProfile userProfile = model.getObject(); return new DeletePage<>(UserProfileListPage.this, model, "User Profile: " + userProfile.getName()); } public Class<DeletePage> getPageIdentity() { return DeletePage.class; } })); } public Component getFilter(String componentId, FilterForm form) { return new GoAndClearAndNewFilter(componentId, form) { public Page createNewPage() { return new UserProfileEditPage(UserProfileListPage.this, new HibernateObjectModel<Long, UserProfile>( new UserProfile(WicketHibernateUtil.EMPTY_STRING))); } }; } }); columns.add(new TextFilteredPropertyColumn<UserProfile, UserProfile, String>(new Model<>("Name"), "name", "name")); //new MyChoiceFilteredPropertyColumn(new Model("Role"), "role.name", "role.name", "role", "name", roles), /* new MyChoiceFilteredPropertyColumn(new Model("Birth city"), "birthCity.name", "birthCity.name", "birthCity", "name", cities), new PropertyColumn(new Model("Final game"), "finalGame", "finalGame") */ CriteriaSorter sorter = new CriteriaSorter(); HibernateProvider<Long, UserProfile> provider = new HibernateProvider<>(UserProfile.class, filter, sorter); DataTable<UserProfile, String> table = new DataTable<UserProfile, String>("table", columns, provider, 25) { protected Item<UserProfile> newRowItem(String id, int index, IModel<UserProfile> model) { return new OddEvenItem<>(id, index, model); } }; table.addTopToolbar(new NavigationToolbar(table)); table.addTopToolbar(new HeadersToolbar<>(table, sorter)); table.addTopToolbar(new FilterToolbar(table, form, filter)); add(form.add(table)); }
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.// w w w .j a va2 s .c om */ 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./* w w w . j av a 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); } }); } }; }