Repository: tapestry-5 Updated Branches: refs/heads/master 340257f5b -> 232b637a1
TAP5-2515: use the empty parameter also if renderTableIfEmpty is set to true Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/232b637a Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/232b637a Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/232b637a Branch: refs/heads/master Commit: 232b637a1faa1935a033b67e7103fd53c732d56e Parents: 340257f Author: Jochen Kemnade <jochen.kemn...@eddyson.de> Authored: Thu Nov 12 11:58:54 2015 +0100 Committer: Jochen Kemnade <jochen.kemn...@eddyson.de> Committed: Thu Nov 12 11:58:54 2015 +0100 ---------------------------------------------------------------------- .../org/apache/tapestry5/corelib/components/Grid.java | 1 + .../org/apache/tapestry5/corelib/components/Grid.tml | 2 +- tapestry-core/src/test/app1/EmptyGrid.tml | 1 + .../apache/tapestry5/integration/app1/GridTests.java | 13 ++++++++++++- 4 files changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/232b637a/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 e2458ed..814d5e1 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 @@ -173,6 +173,7 @@ public class Grid implements GridModel, ClientElement //@Parameter(value = BindingConstants.SYMBOL + ":" + ComponentParameterConstants.GRID_EMPTY_BLOCK, @Parameter(value = "block:empty", defaultPrefix = BindingConstants.LITERAL) + @Property(write = false) private Block empty; /** http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/232b637a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Grid.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Grid.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Grid.tml index 0e5979c..2ba5ede 100644 --- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Grid.tml +++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Grid.tml @@ -10,7 +10,7 @@ </t:if> <t:if test="!dataSource.availableRows"> <tr> - <td colspan="${numberOfProperties}"><t:delegate to="block:empty"/></td> + <td colspan="${numberOfProperties}"><t:delegate to="prop:empty"/></td> </tr> </t:if> </tbody> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/232b637a/tapestry-core/src/test/app1/EmptyGrid.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/app1/EmptyGrid.tml b/tapestry-core/src/test/app1/EmptyGrid.tml index 9d0853f..4505f8c 100644 --- a/tapestry-core/src/test/app1/EmptyGrid.tml +++ b/tapestry-core/src/test/app1/EmptyGrid.tml @@ -11,6 +11,7 @@ <table t:type="Grid" source="source" renderTableIfEmpty="true" model="model"/> </t:if> + <table t:type="Grid" source="source" renderTableIfEmpty="true" model="model" empty="No data, dude!"/> <div> <t:eventlink event="removemodel" class="btn">Remove the Grid's model</t:eventlink> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/232b637a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java index 375a29b..5381f3a 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java @@ -156,6 +156,17 @@ public class GridTests extends App1TestCase assertText("//table/tbody/tr/td[@colspan='1']", "There is no data to display."); } + // TAP5-2515 + @Test + public void empty_grid_with_columns_and_empty_parameter() throws Exception + { + openLinks("Empty Grid Demo"); + + assertText("//table[2]/thead/tr/th[1]", "Random"); + + assertText("//table[2]/tbody/tr/td[@colspan='1']", "No data, dude!"); + } + // TAP5-244 @Test public void empty_grid_with_columns_requires_model_parameter() throws Exception @@ -164,7 +175,7 @@ public class GridTests extends App1TestCase assertTextPresent("You should bind the model parameter explicitly."); } - + @Test public void grid_inside_form() {