[2/2] tapestry-5 git commit: increment version number

2017-10-13 Thread jkemnade
increment version number


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/0b20ab33
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/0b20ab33
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/0b20ab33

Branch: refs/heads/master
Commit: 0b20ab337597900421f848baa282298005a23598
Parents: 6acc372
Author: Jochen Kemnade 
Authored: Fri Oct 13 16:31:42 2017 +0200
Committer: Jochen Kemnade 
Committed: Fri Oct 13 16:31:42 2017 +0200

--
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0b20ab33/build.gradle
--
diff --git a/build.gradle b/build.gradle
index f27e36e..b6db510 100755
--- a/build.gradle
+++ b/build.gradle
@@ -33,7 +33,7 @@ project.version = tapestryVersion()
 def tapestryVersion() {
 
 def major = "5.5.0"
-def minor = "-alpha-6"
+def minor = "-alpha-7"
 
 // When building on the CI server, make sure -SNAPSHOT is appended, as it 
is a nightly build.
 // When building normally, or for a release, no suffix is desired.



[tapestry-5] Git Push Summary

2017-10-13 Thread jkemnade
Repository: tapestry-5
Updated Tags:  refs/tags/5.5.0-alpha-6 [created] 6acc372ca


[1/2] tapestry-5 git commit: increment versionn number

2017-10-13 Thread jkemnade
Repository: tapestry-5
Updated Branches:
  refs/heads/master 68303b1d6 -> 0b20ab337


increment versionn number


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/6acc372c
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/6acc372c
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/6acc372c

Branch: refs/heads/master
Commit: 6acc372caa514339c1e4a7025f1a7586eb0272c3
Parents: 68303b1
Author: Jochen Kemnade 
Authored: Fri Oct 13 16:21:17 2017 +0200
Committer: Jochen Kemnade 
Committed: Fri Oct 13 16:21:17 2017 +0200

--
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6acc372c/build.gradle
--
diff --git a/build.gradle b/build.gradle
index d53b791..f27e36e 100755
--- a/build.gradle
+++ b/build.gradle
@@ -33,7 +33,7 @@ project.version = tapestryVersion()
 def tapestryVersion() {
 
 def major = "5.5.0"
-def minor = "-alpha-5"
+def minor = "-alpha-6"
 
 // When building on the CI server, make sure -SNAPSHOT is appended, as it 
is a nightly build.
 // When building normally, or for a release, no suffix is desired.



[jira] [Closed] (TAP5-2589) Improve Grid implementation for "slow" data sources

2017-10-13 Thread Jochen Kemnade (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-2589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jochen Kemnade closed TAP5-2589.

Resolution: Fixed

We'll ship an updated Grid implementation with 5.5. If the default pager is not 
used, we try to limit the {{count}} queries to the number of rows that we're 
actually going to show.

> Improve Grid implementation for "slow" data sources
> ---
>
> Key: TAP5-2589
> URL: https://issues.apache.org/jira/browse/TAP5-2589
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-core
>Reporter: Jochen Kemnade
> Fix For: 5.5.0
>
>
> When using a Grid that's backed by a data source for which performing a count 
> is expensive, performance is quite bad.
> There are some places where Grid (and subcomponents) call 
> {{getAvailableRows()}} to determine whether the data source is empty or has 
> (at least) a specific number of results. We should provide (and use) more 
> specific and efficient methods in {{GridDataSource}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TAP5-2589) Improve Grid implementation for "slow" data sources

2017-10-13 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-2589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16203298#comment-16203298
 ] 

Hudson commented on TAP5-2589:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle #1648 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1648/])
TAP5-2589: extend interface with methods that ease incremental paging 
(jochen.kemnade: rev 4958b713fff229c6b0f028a7226a719549cf4d5b)
* (edit) 
tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java
* (edit) 
tapestry-core/src/main/java/org/apache/tapestry5/grid/GridDataSource.java
TAP5-2589: improve data source handling if the pager is not shown 
(jochen.kemnade: rev 68303b1d61d09c997bade870587d4586625f17a6)
* (edit) 
tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridRows.java
* (edit) 
tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Grid.tml
* (edit) 
tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java


> Improve Grid implementation for "slow" data sources
> ---
>
> Key: TAP5-2589
> URL: https://issues.apache.org/jira/browse/TAP5-2589
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-core
>Reporter: Jochen Kemnade
> Fix For: 5.5.0
>
>
> When using a Grid that's backed by a data source for which performing a count 
> is expensive, performance is quite bad.
> There are some places where Grid (and subcomponents) call 
> {{getAvailableRows()}} to determine whether the data source is empty or has 
> (at least) a specific number of results. We should provide (and use) more 
> specific and efficient methods in {{GridDataSource}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (TAP5-2589) Improve Grid implementation for "slow" data sources

2017-10-13 Thread Jochen Kemnade (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-2589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jochen Kemnade updated TAP5-2589:
-
Fix Version/s: 5.5.0

> Improve Grid implementation for "slow" data sources
> ---
>
> Key: TAP5-2589
> URL: https://issues.apache.org/jira/browse/TAP5-2589
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-core
>Reporter: Jochen Kemnade
> Fix For: 5.5.0
>
>
> When using a Grid that's backed by a data source for which performing a count 
> is expensive, performance is quite bad.
> There are some places where Grid (and subcomponents) call 
> {{getAvailableRows()}} to determine whether the data source is empty or has 
> (at least) a specific number of results. We should provide (and use) more 
> specific and efficient methods in {{GridDataSource}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TAP5-2589) Improve Grid implementation for "slow" data sources

2017-10-13 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-2589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16203292#comment-16203292
 ] 

ASF subversion and git services commented on TAP5-2589:
---

Commit 4958b713fff229c6b0f028a7226a719549cf4d5b in tapestry-5's branch 
refs/heads/master from [~jkemnade]
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=4958b71 ]

TAP5-2589: extend interface with methods that ease incremental paging


> Improve Grid implementation for "slow" data sources
> ---
>
> Key: TAP5-2589
> URL: https://issues.apache.org/jira/browse/TAP5-2589
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-core
>Reporter: Jochen Kemnade
> Fix For: 5.5.0
>
>
> When using a Grid that's backed by a data source for which performing a count 
> is expensive, performance is quite bad.
> There are some places where Grid (and subcomponents) call 
> {{getAvailableRows()}} to determine whether the data source is empty or has 
> (at least) a specific number of results. We should provide (and use) more 
> specific and efficient methods in {{GridDataSource}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TAP5-2589) Improve Grid implementation for "slow" data sources

2017-10-13 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-2589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16203293#comment-16203293
 ] 

ASF subversion and git services commented on TAP5-2589:
---

Commit 68303b1d61d09c997bade870587d4586625f17a6 in tapestry-5's branch 
refs/heads/master from [~jkemnade]
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=68303b1 ]

TAP5-2589: improve data source handling if the pager is not shown
Counting the number of results in an expensive operation for some data sources 
(especially databases), so we count
only as far as we need to.


> Improve Grid implementation for "slow" data sources
> ---
>
> Key: TAP5-2589
> URL: https://issues.apache.org/jira/browse/TAP5-2589
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-core
>Reporter: Jochen Kemnade
> Fix For: 5.5.0
>
>
> When using a Grid that's backed by a data source for which performing a count 
> is expensive, performance is quite bad.
> There are some places where Grid (and subcomponents) call 
> {{getAvailableRows()}} to determine whether the data source is empty or has 
> (at least) a specific number of results. We should provide (and use) more 
> specific and efficient methods in {{GridDataSource}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[1/2] tapestry-5 git commit: TAP5-2589: extend interface with methods that ease incremental paging

2017-10-13 Thread jkemnade
Repository: tapestry-5
Updated Branches:
  refs/heads/master 61bc522ee -> 68303b1d6


TAP5-2589: extend interface with methods that ease incremental paging


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/4958b713
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/4958b713
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/4958b713

Branch: refs/heads/master
Commit: 4958b713fff229c6b0f028a7226a719549cf4d5b
Parents: 61bc522
Author: Jochen Kemnade 
Authored: Fri Oct 13 09:51:52 2017 +0200
Committer: Jochen Kemnade 
Committed: Fri Oct 13 09:51:52 2017 +0200

--
 .../apache/tapestry5/grid/GridDataSource.java   | 29 
 .../internal/grid/CollectionGridDataSource.java |  6 
 2 files changed, 35 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4958b713/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridDataSource.java
--
diff --git 
a/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridDataSource.java 
b/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridDataSource.java
index 9ebe488..8fca800 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridDataSource.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridDataSource.java
@@ -23,6 +23,35 @@ import java.util.List;
  */
 public interface GridDataSource
 {
+
+/**
+ * Return whether the data source is empty, i.e. does not have any rows 
available.
+ */
+default public boolean isEmpty()
+{
+return getAvailableRows(1) == 0;
+}
+
+/**
+ * Return the number of rows available in the data source with an upper 
limit.
+ * If determining the total number of rows is expensive, this method 
should be overridden to provide a more
+ * efficient implementation.
+ * Please note that the default Grid pager will still determine the total 
number of rows, so for this to have
+ * an effect, a custom pager should be used.
+ *
+ * @param limit the upper limit
+ * @return the number of rows or {@code limit}, whichever is lower
+ */
+default public int getAvailableRows(final int limit)
+{
+int availableRows = getAvailableRows();
+if (availableRows >= limit)
+{
+return limit;
+}
+return availableRows;
+}
+
 /**
  * Returns the number of rows available in the data source.
  */

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4958b713/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java
--
diff --git 
a/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java
 
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java
index 414d146..63591b1 100644
--- 
a/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java
+++ 
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java
@@ -36,6 +36,12 @@ public class CollectionGridDataSource implements 
GridDataSource
 list = CollectionFactory.newList(collection);
 }
 
+@Override
+public boolean isEmpty()
+{
+return list.isEmpty();
+}
+
 public int getAvailableRows()
 {
 return list.size();



[2/2] tapestry-5 git commit: TAP5-2589: improve data source handling if the pager is not shown Counting the number of results in an expensive operation for some data sources (especially databases), so

2017-10-13 Thread jkemnade
TAP5-2589: improve data source handling if the pager is not shown
Counting the number of results in an expensive operation for some data sources 
(especially databases), so we count
only as far as we need to.


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/68303b1d
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/68303b1d
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/68303b1d

Branch: refs/heads/master
Commit: 68303b1d61d09c997bade870587d4586625f17a6
Parents: 4958b71
Author: Jochen Kemnade 
Authored: Fri Oct 13 11:27:43 2017 +0200
Committer: Jochen Kemnade 
Committed: Fri Oct 13 11:27:43 2017 +0200

--
 .../tapestry5/corelib/components/Grid.java  | 87 +---
 .../tapestry5/corelib/components/GridRows.java  | 14 ++--
 .../tapestry5/corelib/components/Grid.tml   |  6 +-
 3 files changed, 87 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/68303b1d/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
--
diff --git 
a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java 
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
index 814d5e1..a884e52 100644
--- 
a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
+++ 
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
@@ -285,7 +285,7 @@ public class Grid implements GridModel, ClientElement
 }
 
 /**
- * A version of GridDataSource that caches the availableRows property. 
This addresses TAPESTRY-2245.
+ * A version of GridDataSource that caches the availableRows and empty 
properties. This addresses TAPESTRY-2245.
  */
 static class CachingDataSource implements GridDataSource
 {
@@ -295,17 +295,70 @@ public class Grid implements GridModel, ClientElement
 
 private int availableRows;
 
+private boolean emptyCached;
+
+private boolean empty;
+
 CachingDataSource(GridDataSource delegate)
 {
 this.delegate = delegate;
 }
 
+@Override
+public boolean isEmpty()
+{
+if (!emptyCached)
+{
+empty = delegate.isEmpty();
+emptyCached = true;
+if (empty)
+{
+availableRows = 0;
+availableRowsCached = true;
+}
+}
+
+return empty;
+}
+
+@Override
+public int getAvailableRows(int limit)
+{
+if (!availableRowsCached)
+{
+int result = delegate.getAvailableRows(limit);
+if (result == 0)
+{
+empty = true;
+emptyCached = true;
+} else {
+empty = false;
+emptyCached = true;
+}
+if (result < limit) {
+availableRows = result;
+availableRowsCached = true;
+}
+return result;
+} else {
+  return Math.min(availableRows, limit);
+}
+}
+
 public int getAvailableRows()
 {
 if (!availableRowsCached)
 {
 availableRows = delegate.getAvailableRows();
 availableRowsCached = true;
+if (availableRows == 0)
+{
+empty = true;
+emptyCached = true;
+} else {
+  empty = false;
+  emptyCached = true;
+  }
 }
 
 return availableRows;
@@ -461,7 +514,7 @@ public class Grid implements GridModel, ClientElement
 
 // If there's no rows, display the empty block placeholder.
 
-return !renderTableIfEmpty && cachingSource.getAvailableRows() == 0 ? 
empty : null;
+return !renderTableIfEmpty && cachingSource.isEmpty() ? empty : null;
 }
 
 void cleanupRender()
@@ -492,25 +545,35 @@ public class Grid implements GridModel, ClientElement
 // cached, and therefore access was very inefficient, and sorting was
 // very inconsistent during the processing of the form submission.
 
-cachingSource = new CachingDataSource(source);
+int effectiveCurrentPage = getCurrentPage();
 
-int availableRows = cachingSource.getAvailableRows();
+int numberOfRowsRequiredToShowCurrentPage = 1 + (effectiveCurrentPage 
- 1) * rowsPerPage;
+int