This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new 79cca1e WICKET-6880 Documentation of DataTable/DataGridView has
reference to unknown class UserProvider
79cca1e is described below
commit 79cca1ec5fcbe5e4301b27a7d3ed739df22c5dec
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Mon Apr 19 11:59:37 2021 +0300
WICKET-6880 Documentation of DataTable/DataGridView has reference to
unknown class UserProvider
Replace User with MyEntity, trying to make it more obvious that this could
be any custom Java class.
---
.../html/repeater/data/grid/DataGridView.java | 21 ++++++++++++++-----
.../markup/html/repeater/data/table/DataTable.java | 24 ++++++++++++++++------
2 files changed, 34 insertions(+), 11 deletions(-)
diff --git
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/grid/DataGridView.java
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/grid/DataGridView.java
index 0822909..b8898fe 100644
---
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/grid/DataGridView.java
+++
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/grid/DataGridView.java
@@ -44,13 +44,24 @@ import org.apache.wicket.markup.repeater.data.IDataProvider;
* And the related Java code:
*
* <pre>
+ * // Application specific POJO to view/edit
+ * public class MyEntity {
+ * private String firstName;
+ * private String lastName;
+ *
+ * // getters and setters
+ * }
+ *
+ * public class MyEntityProvider implements IDataProvider<MyEntity> {
+ * ...
+ * }
+ *
+ * List<ICellPopulator<MyEntity>> columns = new
ArrayList<>();
*
- * List<ICellPopulator> columns = new ArrayList<ICellPopulator>();
- *
- * columns.add(new PropertyPopulator("firstName"));
- * columns.add(new PropertyPopulator("lastName"));
+ * columns.add(new PropertyPopulator<MyEntity>("firstName"));
+ * columns.add(new PropertyPopulator<MyEntity>("lastName"));
*
- * add(new DataGridView("rows", columns, new UserProvider()));
+ * add(new DataGridView<MyEntity>("rows", columns, new
MyEntityProvider()));
*
* </pre>
*
diff --git
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
index 8a9d77b..5a05abc 100644
---
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
+++
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
@@ -43,7 +43,7 @@ import org.apache.wicket.util.visit.IVisitor;
* 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.
* <p>
- * Data table also provides its own markup for an html table so the user does
not need to provide it
+ * Data table also provides its own markup for an html table so the developer
does not need to provide it
* himself. This makes it very simple to add a datatable to the markup,
however, some flexibility.
* <p>
* Example
@@ -56,12 +56,24 @@ import org.apache.wicket.util.visit.IVisitor;
* specified, the second column will not )
*
* <pre>
- * List<IColumn<T>> columns = new
ArrayList<IColumn<T>>();
+ * // Application specific POJO to view/edit
+ * public class MyEntity {
+ * private String firstName;
+ * private String lastName;
+ *
+ * // getters and setters
+ * }
+ *
+ * public class MyEntityProvider implements IDataProvider<MyEntity> {
+ * ...
+ * }
+ *
+ * List<IColumn<MyEntity, String>> columns = new
ArrayList<>();
*
- * columns.add(new PropertyColumn(new Model<String>("First
Name"), "name.first", "name.first"));
- * columns.add(new PropertyColumn(new Model<String>("Last
Name"), "name.last"));
+ * columns.add(new PropertyColumn<MyEntity, String>(new
Model<String>("First Name"), "firstName",
"firstName"));
+ * columns.add(new PropertyColumn<MyEntity, String>(new
Model<String>("Last Name"), "lastName"));
*
- * DataTable table = new DataTable("datatable", columns, new
UserProvider(), 10);
+ * DataTable<MyEntity,String> table = new
DataTable<>("datatable", columns, new MyEntityProvider(), 10);
* table.addBottomToolbar(new NavigationToolbar(table));
* table.addTopToolbar(new HeadersToolbar(table, null));
* add(table);
@@ -185,7 +197,7 @@ public class DataTable<T, S> extends Panel implements
IPageableItems
}
/**
- * Create the MarkupContainer for the <tbody> tag. Users may subclass
it to provide their own
+ * Create the MarkupContainer for the <tbody> tag. Developers may
subclass it to provide their own
* (modified) implementation.
*
* @param id