org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable Java Examples
The following examples show how to use
org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultDataTable.java From onedev with MIT License | 6 votes |
public DefaultDataTable(final String id, final List<? extends IColumn<T, S>> columns, final ISortableDataProvider<T, S> dataProvider, final int rowsPerPage, @Nullable PagingHistorySupport pagingHistorySupport) { super(id, columns, dataProvider, rowsPerPage); if (pagingHistorySupport != null) setCurrentPage(pagingHistorySupport.getCurrentPage()); addBottomToolbar(new NavigationToolbar(this) { @Override protected PagingNavigator newPagingNavigator(String navigatorId, DataTable<?, ?> table) { return new HistoryAwarePagingNavigator(navigatorId, table, pagingHistorySupport); } }); addTopToolbar(new AjaxFallbackHeadersToolbar<S>(this, dataProvider)); addBottomToolbar(new NoRecordsToolbar(this)); }
Example #2
Source File: CustomerListPage.java From wicket-spring-boot with Apache License 2.0 | 6 votes |
private void customerDataTable(CustomerDataProvider customerDataProvider) { filterForm = new FilterForm<CustomerFilter>("filterForm", customerDataProvider); queue(filterForm); List<IColumn<Customer, CustomerSort>> columns = new ArrayList<>(); columns.add(idColumn()); columns.add(usernameColumn()); columns.add(firstnameColumn()); columns.add(lastnameColumn()); columns.add(activeColumn()); columns.add(actionColumn()); DataTable<Customer, CustomerSort> dataTable = new AjaxFallbackDefaultDataTable<Customer, CustomerSort>("table", columns, customerDataProvider, 10); FilterToolbar filterToolbar = new FilterToolbar(dataTable, filterForm); dataTable.addTopToolbar(filterToolbar); queue(dataTable); }
Example #3
Source File: CustomerListIntTest.java From wicket-spring-boot with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings({ "rawtypes", "unchecked" }) public void assert_start_customer_list_page(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().assertComponent("filterForm:table", DataTable.class); DataTable<Customer, CustomerSort> dataTable = (DataTable) getTester().getComponentFromLastRenderedPage("filterForm:table"); assertThat(dataTable.getItemCount(), equalTo(5L)); //id, username, firstname, lastname, active, actions assertThat(dataTable.getColumns().size(), equalTo(6)); //get third row Item<Customer> item3 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:3"); assertThat(item3.getModelObject().getId(), equalTo(3L)); assertThat(item3.getModelObject().getUsername(), equalTo("adalgrim")); Item<Customer> item5 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:5"); assertThat(item5.getModelObject().getId(), equalTo(5L)); assertThat(item5.getModelObject().getUsername(), equalTo("tuk")); }
Example #4
Source File: CustomerListPageTest.java From wicket-spring-boot with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings({ "rawtypes", "unchecked" }) public void assert_start_customer_list_page(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().assertComponent("filterForm:table", DataTable.class); DataTable<Customer, CustomerSort> dataTable = (DataTable) getTester().getComponentFromLastRenderedPage("filterForm:table"); assertThat(dataTable.getItemCount(), equalTo(CUSTOMERS_COUNT)); //id, username, firstname, lastname, active, actions assertThat(dataTable.getColumns().size(), equalTo(6)); //get third row Item<Customer> item3 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:3"); assertThat(item3.getModelObject().getId(), equalTo(3L)); assertThat(item3.getModelObject().getUsername(), equalTo("username3")); Item<Customer> item5 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:5"); assertThat(item5.getModelObject().getId(), equalTo(5L)); assertThat(item5.getModelObject().getUsername(), equalTo("username5")); }
Example #5
Source File: SakaiNavigatorLabel.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @param id component id * @param table dataview */ public SakaiNavigatorLabel(final String id, final DataTable table) { this(id, new PageableComponent() { private static final long serialVersionUID = 1L; @Override public int getCurrentPage() { return (int) table.getCurrentPage(); } @Override public int getRowCount() { return (int) table.getRowCount(); } @Override public int getRowsPerPage() { return (int) table.getItemsPerPage(); } }); }
Example #6
Source File: DeleteRowCommandColumn.java From Orienteer with Apache License 2.0 | 6 votes |
@Override public void populateItem(Item<ICellPopulator<ODocument>> cellItem, String componentId, final IModel<ODocument> rowModel) { cellItem.add(new AjaxFormCommand<ODocument>(componentId, "command.remove") { @Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { super.onClick(targetOptional); rowModel.getObject().delete(); DataTable<?, ?> table = findParent(DataTable.class); if(table!=null && targetOptional.isPresent()) targetOptional.get().add(table); } @Override protected void onConfigure() { super.onConfigure(); setVisibilityAllowed(modeModel.getObject().equals(DisplayMode.EDIT)); } }.setBootstrapSize(BootstrapSize.EXTRA_SMALL) .setBootstrapType(BootstrapType.DANGER) .setIcon((String) null)); }
Example #7
Source File: SakaiNavigatorLabel.java From sakai with Educational Community License v2.0 | 6 votes |
/** * @param id component id * @param table dataview */ public SakaiNavigatorLabel(final String id, final DataTable table) { this(id, new PageableComponent() { private static final long serialVersionUID = 1L; @Override public int getCurrentPage() { return (int) table.getCurrentPage(); } @Override public int getRowCount() { return (int) table.getRowCount(); } @Override public int getRowsPerPage() { return (int) table.getItemsPerPage(); } }); }
Example #8
Source File: OrienteerNavigationToolbar.java From Orienteer with Apache License 2.0 | 5 votes |
@Override protected PagingNavigator newPagingNavigator(final String navigatorId, final DataTable<?, ?> table) { return new OrienteerPagingNavigator(navigatorId, table) { private static final long serialVersionUID = 1L; @Override protected void onAjaxEvent(final AjaxRequestTarget target) { target.add(table); } }; }
Example #9
Source File: OrienteerHeadersToolbar.java From Orienteer with Apache License 2.0 | 5 votes |
/** * Constructor * * @param table table to add this toolbar to * @param stateLocator locator for sort state */ public OrienteerHeadersToolbar(DataTable<T, S> table, ISortStateLocator<S> stateLocator) { super(table); this.stateLocator = stateLocator; table.setOutputMarkupId(true); filteredColumnClass = "filtered-column"; }
Example #10
Source File: DataTableCommandsToolbar.java From Orienteer with Apache License 2.0 | 5 votes |
public DataTableCommandsToolbar(DataTable<T, ?> table) { super(table); WebMarkupContainer span = new WebMarkupContainer("span"); span.add(new AttributeModifier("colspan", new Model<String>(String.valueOf(table.getColumns().size())))); commands = new RepeatingView("commands"); span.add(commands); add(span); }
Example #11
Source File: AbstractListPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * Later: Try AjaxFallBackDatatable again. * @param columns * @param sortProperty * @param ascending * @return */ protected DataTable<O, String> createDataTable(final List<IColumn<O, String>> columns, final String sortProperty, final SortOrder sortOrder) { final int pageSize = form.getPageSize(); final SortParam<String> sortParam = sortProperty != null ? new SortParam<String>(sortProperty, sortOrder == SortOrder.ASCENDING) : null; return new DefaultDataTable<O, String>("table", columns, createSortableDataProvider(sortParam), pageSize); // return new AjaxFallbackDefaultDataTable<O>("table", columns, createSortableDataProvider(sortProperty, ascending), pageSize); }
Example #12
Source File: SakaiNavigationToolBar.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Constructor * * @param table * data table this toolbar will be attached to */ public SakaiNavigationToolBar(final DataTable table) { super(table); WebMarkupContainer span = (WebMarkupContainer) get("span"); span.add(new AttributeModifier("colspan", new Model(String.valueOf(table.getColumns().size())))); span.get("navigator").replaceWith(newPagingNavigator("navigator", table)); span.get("navigatorLabel").replaceWith(newNavigatorLabel("navigatorLabel", table)); }
Example #13
Source File: AjaxDataNavigationToolbar.java From syncope with Apache License 2.0 | 5 votes |
@Override protected PagingNavigator newPagingNavigator(final String navigatorId, final DataTable<?, ?> table) { return new BootstrapAjaxPagingNavigator(navigatorId, table) { private static final long serialVersionUID = -5254490177324296529L; @Override protected void onAjaxEvent(final AjaxRequestTarget target) { if (container != null) { target.add(container); } } }; }
Example #14
Source File: RunHistoryPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected DataTable<RunReportHistory, String> createRunHistoryTable(RunReportHistoryDataProvider dataProvider) { SortableDataProvider<RunReportHistory, String> sortableDataProvider = new SortableDataAdapter<RunReportHistory>( dataProvider); sortableDataProvider.setSort("endDate", SortOrder.DESCENDING); return new BaseTable<RunReportHistory>("runHistoryTable", createHistoryTableColumns(), sortableDataProvider, rowsPerPage); }
Example #15
Source File: MonitorPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected DataTable<ReportJobInfo, String> createJobsTable(ReportJobInfoDataProvider dataProvider) { SortableDataProvider<ReportJobInfo, String> sortableDataProvider = new SortableDataAdapter<ReportJobInfo>( dataProvider); sortableDataProvider.setSort("startDate", SortOrder.ASCENDING); return new BaseTable<ReportJobInfo>("jobsTable", createJobsTableColumns(), sortableDataProvider, Integer.MAX_VALUE); }
Example #16
Source File: MonitorPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
protected DataTable<SchedulerJob, String> createSchedulerJobsTable(ActiveSchedulerJobDataProvider dataProvider) { SortableDataProvider<SchedulerJob, String> sortableDataProvider = new SortableDataAdapter<SchedulerJob>( dataProvider); sortableDataProvider.setSort("nextRun", SortOrder.ASCENDING); return new BaseTable<SchedulerJob>("schedulerJobsTable", createActiveSchedulerJobsTableColumns(), sortableDataProvider, Integer.MAX_VALUE); }
Example #17
Source File: SakaiNavigationToolBar.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Constructor * * @param table * data table this toolbar will be attached to */ public SakaiNavigationToolBar(final DataTable table) { super(table); WebMarkupContainer span = (WebMarkupContainer) get("span"); span.add(new AttributeModifier("colspan", new Model(String.valueOf(table.getColumns().size())))); span.get("navigator").replaceWith(newPagingNavigator("navigator", table)); span.get("navigatorLabel").replaceWith(newNavigatorLabel("navigatorLabel", table)); }
Example #18
Source File: CustomerListIntTest.java From wicket-spring-boot with Apache License 2.0 | 5 votes |
@Test public void assert_delete_customer_method_called_once(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); DataTable<Customer, CustomerSort> dataTable = (DataTable) getTester().getComponentFromLastRenderedPage("filterForm:table"); assertThat(dataTable.getItemCount(), equalTo(5L)); getTester().clickLink(getTableCell(5, 6) + "items:1:item:link"); getTester().assertComponent("defaultModal", YesNoModal.class); getTester().clickLink("defaultModal:content:yes", true); assertThat(dataTable.getItemCount(), equalTo(4L)); }
Example #19
Source File: ExternalSearchAnnotationSidebar.java From inception with Apache License 2.0 | 5 votes |
@Override protected void onDetach() { ExternalSearchUserState searchState = searchStateModel.getObject(); // Save the current page number of the search results when the sidebar being switched DataTable<ExternalSearchResult, String> resultTable = (DataTable<ExternalSearchResult, String>) dataTableContainer.get("resultsTable"); searchState.setCurrentPage(resultTable.getCurrentPage()); // save current repository searchState.setCurrentRepository(currentRepository); super.onDetach(); }
Example #20
Source File: RunHistoryPanel.java From nextreports-server with Apache License 2.0 | 4 votes |
public DataTable<RunReportHistory, String> getRunHistoryTable() { return runHistoryTable; }
Example #21
Source File: AddressPagesTest.java From projectforge-webapp with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") @Test public void testViewPages() { loginTestAdmin(); tester.startPage(AddressListPage.class); tester.assertRenderedPage(AddressListPage.class); // Now, add a new address: tester.clickLink(findComponentByAccessKey(tester, PATH_CONTENT_MENU_REPEATER, 'n')); tester.assertRenderedPage(AddressEditPage.class); // Need new page to initialize model: final AddressEditPage editPage = new AddressEditPage(new PageParameters()); final AddressDO data = editPage.getForm().getData(); data.setName("Reinhard").setFirstName("Kai").setForm(FormOfAddress.MISTER).setContactStatus(ContactStatus.ACTIVE) .setAddressStatus(AddressStatus.UPTODATE).setTask(getTask("1.1")); tester.startPage(editPage); FormTester form = tester.newFormTester(PATH_EDITPAGE_FORM); form.submit(findComponentByLabel(form, KEY_EDITPAGE_BUTTON_CREATE)); tester.assertRenderedPage(AddressListPage.class); final DataTable<AddressDO, String> table = (DataTable<AddressDO, String>) tester.getComponentFromLastRenderedPage(PATH_LISTPAGE_TABLE); Assert.assertEquals(1, table.getRowCount()); // Check view page tester.clickLink("body:form:table:body:rows:1:cells:1:cell:2:link"); // View page tester.assertRenderedPage(AddressViewPage.class); // Check mobile view page final Integer id = addressDao.internalLoadAll().get(0).getId(); final PageParameters params = new PageParameters().add(AbstractEditPage.PARAMETER_KEY_ID, id); tester.startPage(AddressMobileViewPage.class, params); tester.assertRenderedPage(AddressMobileViewPage.class); // Delete entry tester.startPage(AddressListPage.class); tester.assertRenderedPage(AddressListPage.class); final Component link = findComponentByLabel(tester, PATH_LISTPAGE_TABLE, "select"); tester.clickLink(link); // Edit page tester.assertRenderedPage(AddressEditPage.class); form = tester.newFormTester(PATH_EDITPAGE_FORM); form.submit(findComponentByLabel(form, KEY_EDITPAGE_BUTTON_MARK_AS_DELETED)); }
Example #22
Source File: AbstractCheckBoxEnabledCommand.java From Orienteer with Apache License 2.0 | 4 votes |
public DataTable<T, ?> getTable() { return table; }
Example #23
Source File: ExternalSearchAnnotationSidebar.java From inception with Apache License 2.0 | 4 votes |
public ExternalSearchAnnotationSidebar(String aId, IModel<AnnotatorState> aModel, AnnotationActionHandler aActionHandler, CasProvider aCasProvider, AnnotationPage aAnnotationPage) { super(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage); // Attach search state to annotation page // This state is to maintain persistence of this sidebar so that when user moves to another // sidebar and comes back here, the state of this sidebar (search results) are preserved. searchStateModel = new CompoundPropertyModel<>(LambdaModelAdapter.of( () -> aAnnotationPage.getMetaData(CURRENT_ES_USER_STATE), searchState -> aAnnotationPage.setMetaData(CURRENT_ES_USER_STATE, searchState))); // Set up the search state in the page if it is not already there if (aAnnotationPage.getMetaData(CURRENT_ES_USER_STATE) == null) { searchStateModel.setObject(new ExternalSearchUserState()); } project = getModel().getObject().getProject(); List<DocumentRepository> repositories = externalSearchService .listDocumentRepositories(project); ExternalSearchUserState searchState = searchStateModel.getObject(); currentRepository = searchState.getCurrentRepository(); if (currentRepository == null && repositories.size() > 0) { currentRepository = repositories.get(0); } repositoriesModel = LoadableDetachableModel .of(() -> externalSearchService.listDocumentRepositories(project)); mainContainer = new WebMarkupContainer("mainContainer"); mainContainer.setOutputMarkupId(true); add(mainContainer); DocumentRepositorySelectionForm projectSelectionForm = new DocumentRepositorySelectionForm( "repositorySelectionForm"); mainContainer.add(projectSelectionForm); SearchForm searchForm = new SearchForm("searchForm"); add(searchForm); mainContainer.add(searchForm); List<IColumn<ExternalSearchResult, String>> columns = new ArrayList<>(); columns.add(new AbstractColumn<ExternalSearchResult, String>(new Model<>("Results")) { private static final long serialVersionUID = -5658664083675871242L; @Override public void populateItem(Item<ICellPopulator<ExternalSearchResult>> cellItem, String componentId, IModel<ExternalSearchResult> model) { @SuppressWarnings("rawtypes") Item rowItem = cellItem.findParent(Item.class); int rowIndex = rowItem.getIndex(); ResultRowView rowView = new ResultRowView(componentId, rowIndex + 1, model); cellItem.add(rowView); } }); if (searchState.getDataProvider() == null) { searchState.setDataProvider(new ExternalResultDataProvider(externalSearchService, userRepository.getCurrentUser())); } dataTableContainer = new WebMarkupContainer("dataTableContainer"); dataTableContainer.setOutputMarkupId(true); mainContainer.add(dataTableContainer); DataTable<ExternalSearchResult, String> resultTable = new DefaultDataTable<>("resultsTable", columns, searchState.getDataProvider(), 8); resultTable.setCurrentPage(searchState.getCurrentPage()); dataTableContainer.add(resultTable); }
Example #24
Source File: OrienteerHeadersToolbar.java From Orienteer with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") protected DataTable<T, S> getTable() { return (DataTable<T, S>) super.getTable(); }
Example #25
Source File: ViewInfoPanel.java From nextreports-server with Apache License 2.0 | 4 votes |
private void addParametersTable(ParamViewDataProvider dataProvider) { List<IColumn<ParamView, String>> columns = createColumns(); DataTable<ParamView, String> table = new BaseTable<ParamView>("table", columns, dataProvider, 300); table.setOutputMarkupId(true); add(table); }
Example #26
Source File: OrienteerNavigationToolbar.java From Orienteer with Apache License 2.0 | 4 votes |
public OrienteerNavigationToolbar(final DataTable<?, ?> table) { super(table); }
Example #27
Source File: DataTableCommandsToolbar.java From Orienteer with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public DataTable<T, ?> getTable() { return (DataTable<T, ?>)super.getTable(); }
Example #28
Source File: SakaiPagingNavigator.java From sakai with Educational Community License v2.0 | 4 votes |
public void setRowNumberSelector(String value) { ((DataTable) getPageable()).setItemsPerPage(Integer.valueOf(value)); }
Example #29
Source File: SakaiPagingNavigator.java From sakai with Educational Community License v2.0 | 4 votes |
public String getRowNumberSelector() { return String.valueOf(((DataTable) getPageable()).getItemsPerPage()); }
Example #30
Source File: AjaxDataNavigationToolbar.java From syncope with Apache License 2.0 | 4 votes |
public AjaxDataNavigationToolbar(final DataTable<?, ?> table, final WebMarkupContainer container) { super(table); this.container = container; }