You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by km...@apache.org on 2008/08/20 04:19:59 UTC
svn commit: r687227 - in /tapestry/tapestry5/trunk/tapestry-core/src/test:
app1/ java/org/apache/tapestry5/integration/app1/components/
java/org/apache/tapestry5/integration/app1/pages/
Author: kmenard
Date: Tue Aug 19 19:19:58 2008
New Revision: 687227
URL: http://svn.apache.org/viewvc?rev=687227&view=rev
Log:
Fixed TAPESTRY-2592: BeanEditor should provide a "BeanEditContext" into the environment. (or PropertyEditContext should include the bean class).
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorBeanEditContext.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/BeanEditContextVerifier.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorBeanEditContext.java
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorBeanEditContext.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorBeanEditContext.tml?rev=687227&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorBeanEditContext.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BeanEditorBeanEditContext.tml Tue Aug 19 19:19:58 2008
@@ -0,0 +1,25 @@
+<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 places a BeanEditContext into the environment.</p>
+
+ <form t:id="form">
+ <t:errors/>
+
+ <div class="t-beaneditor">
+ <div t:id="editor">
+ <t:parameter name="firstName">
+ <t:BeanEditContextVerifier/>
+ [FirstName Property Editor Override]
+ </t:parameter>
+ </div>
+ </div>
+
+ <input type="submit" value="Register"/>
+ </form>
+
+ <p>[<t:actionlink t:id="clear">Clear Data</t:actionlink>]
+ </p>
+</html>
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/BeanEditContextVerifier.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/BeanEditContextVerifier.java?rev=687227&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/BeanEditContextVerifier.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/BeanEditContextVerifier.java Tue Aug 19 19:19:58 2008
@@ -0,0 +1,33 @@
+// 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.tapestry5.integration.app1.components;
+
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.annotations.Environmental;
+import org.apache.tapestry5.services.BeanEditContext;
+
+/**
+ * Used to check to make sure that the BeanEditor is properly pushing a BeanEditContext into the environment.
+ */
+public class BeanEditContextVerifier
+{
+ @Environmental
+ private BeanEditContext context;
+
+ void beginRender(MarkupWriter writer)
+ {
+ writer.write("Bean class from context is: " + context.getBeanClass().getName());
+ }
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorBeanEditContext.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorBeanEditContext.java?rev=687227&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorBeanEditContext.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/BeanEditorBeanEditContext.java Tue Aug 19 19:19:58 2008
@@ -0,0 +1,50 @@
+// 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.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.ApplicationState;
+import org.apache.tapestry5.annotations.Component;
+import org.apache.tapestry5.corelib.components.BeanEditor;
+import org.apache.tapestry5.corelib.components.Form;
+import org.apache.tapestry5.integration.app1.data.RegistrationData;
+
+public class BeanEditorBeanEditContext
+{
+ @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();
+ }
+}