You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2014/01/03 17:31:21 UTC

git commit: TAP5-2270: BeanDisplay exception when used inside a Form

Updated Branches:
  refs/heads/master 821183960 -> 592989f4a


TAP5-2270: BeanDisplay exception when used inside a Form

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

Branch: refs/heads/master
Commit: 592989f4a85958dd4a42b479cce561224d49bf04
Parents: 8211839
Author: Thiago H. de Paula Figueiredo <th...@apache.org>
Authored: Fri Jan 3 14:31:01 2014 -0200
Committer: Thiago H. de Paula Figueiredo <th...@apache.org>
Committed: Fri Jan 3 14:31:01 2014 -0200

----------------------------------------------------------------------
 .../corelib/components/BeanDisplay.java         |  6 +-
 .../corelib/components/BeanDisplay.tml          |  5 +-
 .../src/test/app1/BeanDisplayInsideForm.tml     | 11 ++++
 .../integration/app1/AtImportTests.groovy       |  2 +-
 .../integration/app1/BeanDisplayTests.groovy    | 21 +++++++
 .../app1/pages/BeanDisplayInsideForm.java       | 59 ++++++++++++++++++++
 6 files changed, 96 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/592989f4/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.java
index 406eb54..3eaefbc 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.java
@@ -67,7 +67,6 @@ public class BeanDisplay
      * parameters are <em>only</em> applied to a default model, not an explicitly provided one.
      */
     @Parameter
-    @Property(write = false)
     private BeanModel model;
     /**
      * A comma-separated list of property names to be retained from the
@@ -124,7 +123,7 @@ public class BeanDisplay
     @Property
     private String propertyName;
 
-    void setupRender()
+    public BeanModel getModel()
     {
         if (model == null)
         {
@@ -132,6 +131,7 @@ public class BeanDisplay
 
             BeanModelUtils.modify(model, add, include, exclude, reorder);
         }
+        return model;
     }
 
     /**
@@ -139,7 +139,7 @@ public class BeanDisplay
      */
     public PropertyModel getPropertyModel()
     {
-        return model.get(propertyName);
+        return getModel().get(propertyName);
     }
 
     public String getPropertyClass()

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/592989f4/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
index 0b31607..99ee314 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanDisplay.tml
@@ -8,7 +8,4 @@
             <t:propertydisplay model="propertyModel" overrides="overrides" object="object"/>
         </dd>
     </t:loop>
-</dl>
-        
-
-
+</dl>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/592989f4/tapestry-core/src/test/app1/BeanDisplayInsideForm.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/BeanDisplayInsideForm.tml b/tapestry-core/src/test/app1/BeanDisplayInsideForm.tml
new file mode 100644
index 0000000..5364ae7
--- /dev/null
+++ b/tapestry-core/src/test/app1/BeanDisplayInsideForm.tml
@@ -0,0 +1,11 @@
+<html t:type="Border"
+  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
+
+  <h1>BeanDisplay inside form</h1>
+
+  <t:form>
+    <t:beandisplay object="this"/>
+  	<input type="submit" id="submit"/>
+  </t:form>
+
+</html>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/592989f4/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AtImportTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AtImportTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AtImportTests.groovy
index b2d9184..8199f8e 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AtImportTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AtImportTests.groovy
@@ -4,7 +4,7 @@ import org.apache.tapestry5.integration.GroovyTapestryCoreTestCase
 import org.apache.tapestry5.test.TapestryTestConfiguration
 import org.testng.annotations.Test
 
-@TapestryTestConfiguration(webAppFolder = "src/test/app1", browserStartCommand = "*googlechrome")
+@TapestryTestConfiguration(webAppFolder = "src/test/app1")
 class AtImportTests extends GroovyTapestryCoreTestCase
 {
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/592989f4/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanDisplayTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanDisplayTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanDisplayTests.groovy
new file mode 100644
index 0000000..03704ed
--- /dev/null
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/BeanDisplayTests.groovy
@@ -0,0 +1,21 @@
+package org.apache.tapestry5.integration.app1
+
+import org.apache.tapestry5.integration.GroovyTapestryCoreTestCase
+import org.apache.tapestry5.test.TapestryTestConfiguration
+import org.testng.annotations.Test
+
+@TapestryTestConfiguration(webAppFolder = "src/test/app1")
+class BeanDisplayTests extends GroovyTapestryCoreTestCase
+{
+
+    /** TAP5-2270 */
+    @Test
+    void beandisplay_inside_form()
+    {
+        open "/BeanDisplayInsideForm"
+        click "submit"
+        waitForPageToLoad()
+        assert isElementPresent("css=div.panel-danger") == false
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/592989f4/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanDisplayInsideForm.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanDisplayInsideForm.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanDisplayInsideForm.java
new file mode 100644
index 0000000..d01aab3
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanDisplayInsideForm.java
@@ -0,0 +1,59 @@
+// Copyright 2014 Thiago H. de Paula Figueiredo
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// Copyright 2013 Thiago H. de Paula Figueiredo
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.integration.app1.pages;
+
+/**
+ * Part of the test for TAP5-2270
+ */
+public class BeanDisplayInsideForm
+{
+
+    private String string;
+
+    private int i;
+
+    public String getString()
+    {
+        return string;
+    }
+
+    public void setString(String string)
+    {
+        this.string = string;
+    }
+
+    public int getI()
+    {
+        return i;
+    }
+
+    public void setI(int i)
+    {
+        this.i = i;
+    }
+
+}