You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by th...@apache.org on 2014/05/26 23:19:54 UTC

git commit: TAP5-2270: BeanDisplay exception when used inside a Form Conflicts: tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AtImportTests.groovy

Repository: tapestry-5
Updated Branches:
  refs/heads/5.3 7485d9167 -> 4445ae4df


TAP5-2270: BeanDisplay exception when used inside a Form
Conflicts:
	tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AtImportTests.groovy


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

Branch: refs/heads/5.3
Commit: 4445ae4dff67457212058e6025a8d740d144883a
Parents: 7485d91
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...@arsmachina.com.br>
Committed: Mon May 26 18:19:09 2014 -0300

----------------------------------------------------------------------
 .../corelib/components/BeanDisplay.java         |  6 +-
 .../src/test/app1/BeanDisplayInsideForm.tml     | 11 ++++
 .../integration/app1/BeanDisplayTests.groovy    | 21 +++++++
 .../app1/pages/BeanDisplayInsideForm.java       | 59 ++++++++++++++++++++
 4 files changed, 94 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4445ae4d/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/4445ae4d/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/4445ae4d/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..2d46d41
--- /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", browserStartCommand="*opera")
+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/4445ae4d/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;
+    }
+
+}