You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/01/04 19:13:32 UTC

svn commit: r608947 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry/annotations/ main/java/org/apache/tapestry/corelib/components/ main/java/org/apache/tapestry/model/ main/resources/org/apache/tapestry/corelib/component...

Author: hlship
Date: Fri Jan  4 10:13:29 2008
New Revision: 608947

URL: http://svn.apache.org/viewvc?rev=608947&view=rev
Log:
TAPESTRY-2013: BeanEditor does not support informal parameters

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorOverride.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorOverride.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/Errors_zh_CN.properties
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/ValidationMessages_zh_CN.properties
    tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/project-layout.apt
    tapestry/tapestry5/trunk/tapestry-core/src/site/site.xml
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Component.java Fri Jan  4 10:13:29 2008
@@ -1,17 +1,17 @@
-// Copyright 2006, 2008 The Apache Software Foundation
-//
-// 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 2006, 2008 The Apache Software Foundation
+//
+// 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.tapestry.annotations;
 
 import java.lang.annotation.Documented;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditor.java?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditor.java Fri Jan  4 10:13:29 2008
@@ -19,6 +19,7 @@
 import org.apache.tapestry.ComponentResources;
 import org.apache.tapestry.annotations.Environmental;
 import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.annotations.SupportsInformalParameters;
 import org.apache.tapestry.beaneditor.BeanModel;
 import org.apache.tapestry.corelib.internal.InternalMessages;
 import org.apache.tapestry.internal.beaneditor.BeanModelUtils;
@@ -33,6 +34,7 @@
  * central component of the {@link BeanEditForm}, and utilizes a {@link PropertyEditor} for much of
  * its functionality.
  */
+@SupportsInformalParameters
 public class BeanEditor
 {
     public static class Prepare implements ComponentAction<BeanEditor>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/model/EmbeddedComponentModel.java Fri Jan  4 10:13:29 2008
@@ -1,17 +1,17 @@
-// Copyright 2006, 2008 The Apache Software Foundation
-//
-// 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 2006, 2008 The Apache Software Foundation
+//
+// 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.tapestry.model;
 
 import org.apache.tapestry.annotations.Component;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/Errors_zh_CN.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/Errors_zh_CN.properties?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/Errors_zh_CN.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/Errors_zh_CN.properties Fri Jan  4 10:13:29 2008
@@ -1,5 +1,4 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
-# Copyright 2006 The Apache Software Foundation
+# Copyright 2008 The Apache Software Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/ValidationMessages_zh_CN.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/ValidationMessages_zh_CN.properties?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/ValidationMessages_zh_CN.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/ValidationMessages_zh_CN.properties Fri Jan  4 10:13:29 2008
@@ -1,4 +1,3 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 # Copyright 2006, 2007 The Apache Software Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");

Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/project-layout.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/project-layout.apt?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/project-layout.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/project-layout.apt Fri Jan  4 10:13:29 2008
@@ -12,8 +12,8 @@
   Parts of this project layout mimics the format of an <exploded WAR> (a WAR file unpackaged onto the
   file system).  This will often enable you to run your application directly from your workspace,
   without any special build or packaging process, while developing.  Each of the major IDEs has plugins
-  to allow you to accomplish this task ... and its one of the things (combined with
-  {{{reload.html}live class reloading}} that makes working with Tapestry a breeze.
+  to allow you to accomplish this task ... and its one of the factors (combined with
+  {{{reload.html}live class reloading}}) that makes working with Tapestry a breeze.
 
   Below is a sample project, whose root package is <<<com.example.myapp>>>:
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/site.xml?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/site.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/site.xml Fri Jan  4 10:13:29 2008
@@ -1,20 +1,20 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!-- 
-   Copyright 2006, 2007 The Apache Software Foundation
-
-   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 2006, 2007 The Apache Software Foundation
+
+   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.
+-->
+
 <project name="Tapestry Core">
     <bannerLeft>
         <name>Tapestry 5</name>

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorOverride.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorOverride.tml?rev=608947&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorOverride.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorOverride.tml Fri Jan  4 10:13:29 2008
@@ -0,0 +1,26 @@
+<html t:type="Border"
+      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+    <h1>BeanEditor Override Demo</h1>
+
+    <p>Demonstrates that the BeanEditor properly supports overrides of its property editors.</p>
+
+    <t:form>
+        <t:errors/>
+
+        <div class="t-beaneditor">
+            <div t:id="editor">
+                <t:parameter name="firstName">
+                    <t:label for="firstName"/>
+                    <t:textfield t:id="firstName" value="registrationData.firstName"/>
+                    [FirstName Property Editor Override]
+                </t:parameter>
+            </div>
+        </div>
+
+        <input type="submit" value="Register"/>
+    </t:form>
+
+    <p>[<t:actionlink t:id="clear">Clear Data</t:actionlink>]
+    </p>
+</html>
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Start.tml Fri Jan  4 10:13:29 2008
@@ -302,6 +302,11 @@
             and is being used properly
         </li>
 
+        <li>
+            <t:pagelink page="BeanEditorOverride">BeanEditor Override</t:pagelink>
+            -- Property editor overrides work for the BeanEditor component itself (not just the BeanEditForm component)
+        </li>
+
     </ul>
 
 </html>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=608947&r1=608946&r2=608947&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Fri Jan  4 10:13:29 2008
@@ -1309,4 +1309,15 @@
         }
     }
 
+    /**
+     * TAPESTRY-2013
+     */
+    @Test
+    public void bean_editor_overrides()
+    {
+        start("BeanEditor Override", "Clear Data");
+
+        assertTextPresent("[FirstName Property Editor Override]");
+    }
+
 }

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorOverride.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorOverride.java?rev=608947&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorOverride.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorOverride.java Fri Jan  4 10:13:29 2008
@@ -0,0 +1,49 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// 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.tapestry.integration.app1.pages;
+
+import org.apache.tapestry.annotations.ApplicationState;
+import org.apache.tapestry.annotations.Component;
+import org.apache.tapestry.corelib.components.BeanEditor;
+import org.apache.tapestry.corelib.components.Form;
+import org.apache.tapestry.integration.app1.data.RegistrationData;
+
+public class BeanEditorOverride
+{
+    @Component
+    private Form _form;
+
+    @Component(parameters = {"object=registrationData"})
+    private BeanEditor _editor;
+
+    @ApplicationState
+    private RegistrationData _data;
+
+    public RegistrationData getRegistrationData()
+    {
+        return _data;
+    }
+
+    Object onSuccess()
+    {
+        return ViewRegistration.class;
+    }
+
+    void onActionFromClear()
+    {
+        _data = null;
+        _form.clearErrors();
+    }
+}