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&lt;MyEntity&gt; {
+ *      ...
+ *  }
+ *
+ * List&lt;ICellPopulator&lt;MyEntity&gt;&gt; columns = new 
ArrayList&lt;&gt;();
  * 
- * List&lt;ICellPopulator&gt; columns = new ArrayList&lt;ICellPopulator&gt;();
- * 
- * columns.add(new PropertyPopulator(&quot;firstName&quot;));
- * columns.add(new PropertyPopulator(&quot;lastName&quot;));
+ * columns.add(new PropertyPopulator&lt;MyEntity&gt;(&quot;firstName&quot;));
+ * columns.add(new PropertyPopulator&lt;MyEntity&gt;(&quot;lastName&quot;));
  * 
- * add(new DataGridView(&quot;rows&quot;, columns, new UserProvider()));
+ * add(new DataGridView&lt;MyEntity&gt;(&quot;rows&quot;, 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&lt;IColumn&lt;T&gt;&gt; columns = new 
ArrayList&lt;IColumn&lt;T&gt;&gt;();
+ * // Application specific POJO to view/edit
+ * public class MyEntity {
+ *   private String firstName;
+ *   private String lastName;
+ *
+ *   // getters and setters
+ * }
+ *
+ * public class MyEntityProvider implements IDataProvider&lt;MyEntity&gt; {
+ *     ...
+ * }
+ *
+ * List&lt;IColumn&lt;MyEntity, String&gt;&gt; columns = new 
ArrayList&lt;&gt;();
  * 
- * columns.add(new PropertyColumn(new Model&lt;String&gt;(&quot;First 
Name&quot;), &quot;name.first&quot;, &quot;name.first&quot;));
- * columns.add(new PropertyColumn(new Model&lt;String&gt;(&quot;Last 
Name&quot;), &quot;name.last&quot;));
+ * columns.add(new PropertyColumn&lt;MyEntity, String&gt;(new 
Model&lt;String&gt;(&quot;First Name&quot;), &quot;firstName&quot;, 
&quot;firstName&quot;));
+ * columns.add(new PropertyColumn&lt;MyEntity, String&gt;(new 
Model&lt;String&gt;(&quot;Last Name&quot;), &quot;lastName&quot;));
  * 
- * DataTable table = new DataTable(&quot;datatable&quot;, columns, new 
UserProvider(), 10);
+ * DataTable&lt;MyEntity,String&gt; table = new 
DataTable&lt;&gt;(&quot;datatable&quot;, 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

Reply via email to