本文整理了Java中org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable
类的一些代码示例,展示了DataTable
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataTable
类的具体详情如下:
包路径:org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable
类名称:DataTable
[英]A data table builds on data grid view to introduce toolbars. Toolbars can be used to display sortable column headers, paging information, filter controls, and other information.
Data table also provides its own markup for an html table so the user does not need to provide it himself. This makes it very simple to add a datatable to the markup, however, some flexibility.
Example
<table wicket:id="datatable"></table>
And the related Java code: ( the first column will be sortable because its sort property is specified, the second column will not )
List<IColumn<T>> columns = new ArrayList<IColumn<T>>();
columns.add(new PropertyColumn(new Model<String>("First Name"), "name.first", "name.first"));
columns.add(new PropertyColumn(new Model<String>("Last Name"), "name.last"));
DataTable table = new DataTable("datatable", columns, new UserProvider(), 10);
table.addBottomToolbar(new NavigationToolbar(table));
table.addTopToolbar(new HeadersToolbar(table, null));
add(table);
[中]数据表构建在数据网格视图上,以引入工具栏。工具栏可用于显示可排序列标题、分页信息、筛选器控件和其他信息。
数据表还为html表提供了自己的标记,因此用户无需自己提供。这使得向标记中添加数据表变得非常简单,但也有一定的灵活性。
实例
<table wicket:id="datatable"></table>
和相关的Java代码:(第一列将是可排序的,因为它的排序属性已指定,第二列将不会)
List<IColumn<T>> columns = new ArrayList<IColumn<T>>();
columns.add(new PropertyColumn(new Model<String>("First Name"), "name.first", "name.first"));
columns.add(new PropertyColumn(new Model<String>("Last Name"), "name.last"));
DataTable table = new DataTable("datatable", columns, new UserProvider(), 10);
table.addBottomToolbar(new NavigationToolbar(table));
table.addTopToolbar(new HeadersToolbar(table, null));
add(table);
代码示例来源:origin: stackoverflow.com
new HashMap<String, FilterMatchMode>(table.getColumns().size());
for (Column column : table.getColumns()) {
ValueExpression filterExpression =
column.getValueExpression("filterBy");
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
@Override
public boolean isVisible() {
return getTable().getPageCount() > 1;
}
代码示例来源:origin: apache/wicket
@Override
protected void onSortChanged()
{
getTable().setCurrentPage(0);
}
};
代码示例来源:origin: stackoverflow.com
public void setPageDataTable() {
final DataTable d = (DataTable) FacesContext.getCurrentInstance().getViewRoot()
.findComponent("form:templateTable");
int first = 1;
if (d.getRowCount() % ROWS_DATATABLE == 0) {
first = (d.getRowCount() - ROWS_DATATABLE);
}
else
{
first = (d.getRowCount()/ROWS_DATATABLE)*ROWS_DATATABLE;
}
d.setFirst(first);
}
代码示例来源:origin: stackoverflow.com
String basePath = "C:\\excel file path";
DataTable table = new DataTable();
table.setHeaderless();
table.ImportSheet(basePath+"myTestingFile.xlsx");
System.out.println(Arrays.toString(table.getHeaderValues().toArray()));
for(int i = 1 ; i < table.getRowCount();i++){
table.setRowIndex(i);
System.out.println(table.getValueAt(0));
}
代码示例来源:origin: theonedev/onedev
add(fieldsTable = new DataTable<InputSpec, Void>("issueFields", columns, dataProvider, Integer.MAX_VALUE));
fieldsTable.addTopToolbar(new HeadersToolbar<Void>(fieldsTable, null));
fieldsTable.addBottomToolbar(new NoRecordsToolbar(fieldsTable));
fieldsTable.setOutputMarkupId(true);
fieldsTable.add(new SortBehavior() {
代码示例来源:origin: org.opensingular/wicket-utils
getTable().addTopToolbar(headersToolbar);
getTable().addBottomToolbar(noRecordsToolbar);
getTable().addBottomToolbar(paginationToolbar);
getTable().add(new Behavior() {
@Override
public void onComponentTag(Component component, ComponentTag tag) {
代码示例来源:origin: apache/wicket
/**
* This toolbar is only visible if there are rows in the data set and if there are exportable columns in the
* data table and if there are data exporters added to the toolbar.
*/
protected void calculateVisibility()
{
final boolean isVisible;
if (dataExporters.isEmpty())
{
isVisible = false;
}
else if (getTable().getRowCount() == 0)
{
isVisible = false;
}
else
{
boolean foundExportableColumn = false;
for (IColumn<?, ?> col : getTable().getColumns())
{
if (col instanceof IExportableColumn)
{
foundExportableColumn = true;
break;
}
}
isVisible = foundExportableColumn;
}
setVisible(isVisible);
}
代码示例来源:origin: theonedev/onedev
DataTable<PullRequest, Void> buildsTable = new DataTable<PullRequest, Void>("requests", columns, dataProvider, Integer.MAX_VALUE);
buildsTable.addTopToolbar(new AjaxFallbackHeadersToolbar<Void>(buildsTable, dataProvider));
buildsTable.addBottomToolbar(new NoRecordsToolbar(buildsTable));
add(buildsTable);
代码示例来源:origin: theonedev/onedev
new DataTable<ProjectFacade, Void>("projects", columns, dataProvider, WebConstants.PAGE_SIZE);
projectsTable.setCurrentPage(pagingHistorySupport.getCurrentPage());
projectsTable.addBottomToolbar(new NavigationToolbar(projectsTable) {
projectsTable.addBottomToolbar(new NoRecordsToolbar(projectsTable, Model.of("No Projects Found")));
add(projectsTable);
代码示例来源:origin: org.opensingular/wicket-utils
@Override
protected void onConfigure() {
super.onConfigure();
itensPerPageSelector.setVisible(getTable().getItemCount() > getInitialRowsPerPage());
paginator.setVisible(getTable().getPageCount() > 1);
/* if at least one control is visible, the toolbar must be visible. if none is visible there is no need for the toolbar.*/
boolean toolbarVisible = getTable().getPageCount() > 1;
toolbarVisible |= itensPerPageSelector.isVisible();
toolbarVisible |= paginator.isVisible();
this.setVisible(toolbarVisible);
}
}
代码示例来源:origin: apache/wicket
throws IOException
IDataProvider<T> dataProvider = dataTable.getDataProvider();
List<IExportableColumn<T, ?>> exportableColumns = new LinkedList<>();
for (IColumn<T, S> col : dataTable.getColumns())
代码示例来源:origin: apache/wicket
/**
* Construct.
*
* @param id
* component id
* @param columns
* columns for the {@link DataTable}
* @param provider
* the provider of the tree
* @param rowsPerPage
* rows to show on each page
* @param state
* expansion state
*/
public DefaultTableTree(String id, List<? extends IColumn<T, S>> columns,
ISortableTreeProvider<T, S> provider, int rowsPerPage, IModel<? extends Set<T>> state)
{
super(id, columns, provider, rowsPerPage, state);
getTable().addTopToolbar(new NavigationToolbar(getTable()));
getTable().addTopToolbar(new HeadersToolbar<>(getTable(), provider));
getTable().addBottomToolbar(new NoRecordsToolbar(getTable()));
add(new WindowsTheme());
}
代码示例来源:origin: apache/wicket
this.caption = new Caption("caption", getCaptionModel());
add(caption);
this.colGroup = new ColGroup("colGroup");
add(colGroup);
body = newBodyContainer("body");
datagrid = newDataGridView("rows", columns, dataProvider);
datagrid.setItemsPerPage(rowsPerPage);
body.add(datagrid);
add(body);
topToolbars = new ToolbarsContainer("topToolbars");
bottomToolbars = new ToolbarsContainer("bottomToolbars");
add(topToolbars);
add(bottomToolbars);
代码示例来源:origin: MarcGiffing/wicket-spring-boot
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);
}
代码示例来源:origin: org.wicketstuff/datatable-autocomplete
@Override
protected void onComponentTag(ComponentTag tag) {
// force the name of the tag to be table.
// this allows us to use this component on a span or div tag.
tag.setName("table");
super.onComponentTag(tag);
}
代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service
public int getRowCount()
{
return table.getRowCount();
}
代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service
body = newBodyContainer("body");
datagrid = new DataGridView<T>("rows", columns, dataProvider)
datagrid.setRowsPerPage(rowsPerPage);
body.add(datagrid);
add(body);
topToolbars = new ToolbarsContainer("topToolbars");
bottomToolbars = new ToolbarsContainer("bottomToolbars");
add(topToolbars);
add(bottomToolbars);
代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service
@Override
protected Item<T> newRowItem(String id, int index, IModel<T> model)
{
return DataTable.this.newRowItem(id, index, model);
}
};
代码示例来源:origin: apache/wicket
/**
* Constructor
*
* @param table
* @param stateLocator
*/
public AjaxFallbackHeadersToolbar(final DataTable<?, S> table, final ISortStateLocator<S> stateLocator)
{
super(table, stateLocator);
table.setOutputMarkupId(true);
}
内容来源于网络,如有侵权,请联系作者删除!