tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drobia...@apache.org
Subject svn commit: r894884 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/components/ test/app1/ test/java/org/apache/tapestry5/integration/app1/ test/java/org/apache/tapestry5/integration/app1/pages/ test/resources/o...
Date Thu, 31 Dec 2009 16:45:11 GMT
Author: drobiazko
Date: Thu Dec 31 16:45:10 2009
New Revision: 894884

URL: http://svn.apache.org/viewvc?rev=894884&view=rev
Log:
TAP5-915: It should be possible to override a components message catalog

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/OverrideDateFieldMessageCatalogDemo.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.java
  (with props)
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.properties
  (with props)
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java?rev=894884&r1=894883&r2=894884&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
Thu Dec 31 16:45:10 2009
@@ -90,6 +90,14 @@
     @Parameter(defaultPrefix = BindingConstants.ASSET, value = "datefield.gif")
     private Asset icon;
 
+    /**
+     * Used to override the component's message catalog.
+     * 
+     * @since 5.2.0.0
+     */
+    @Parameter("componentResources.messages")
+    private Messages messages;
+
     @Environmental
     private RenderSupport support;
 
@@ -111,10 +119,6 @@
     @Inject
     private FieldValidationSupport fieldValidationSupport;
 
-    @Inject
-    private Messages messages;
-
-
     private static final String RESULT = "result";
 
     private static final String ERROR = "error";

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/OverrideDateFieldMessageCatalogDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/OverrideDateFieldMessageCatalogDemo.tml?rev=894884&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/OverrideDateFieldMessageCatalogDemo.tml
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/OverrideDateFieldMessageCatalogDemo.tml
Thu Dec 31 16:45:10 2009
@@ -0,0 +1,13 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
+    <h1>Override DateField Message Catalog</h1>
+    
+    <p>
+        <t:form>
+        	<t:errors/>
+        	<t:datefield t:id="birthday" messages="messages" />
+        	<input type="submit" value="Go"/>
+        </t:form>
+    </p>
+
+    
+</html>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java?rev=894884&r1=894883&r2=894884&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
Thu Dec 31 16:45:10 2009
@@ -779,4 +779,19 @@
         // Haven't figured out how to get selenium to check that fields are
         // disabled.
     }
+    
+    /**
+     * TAP5-915
+     */
+    @Test
+    public void override_datefield_message_catalog()
+    {
+        open(getBaseURL() + "overridedatefieldmessagecatalogdemo");
+
+        type("birthday", "aaaaa");
+        
+        clickAndWait("//input[@type='submit' and @value='Go']");
+       
+        assertTextPresent("The input 'aaaaa' is not a valid date");
+    }
 }

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.java?rev=894884&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.java
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.java
Thu Dec 31 16:45:10 2009
@@ -0,0 +1,33 @@
+// Copyright 2009 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 java.util.Date;
+
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.annotations.Inject;
+
+public class OverrideDateFieldMessageCatalogDemo
+{
+    @Inject
+    @Property
+    private Messages messages;
+    
+    @Persist
+    @Property
+    private Date birthday;
+    
+}

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.properties?rev=894884&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.properties
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.properties
Thu Dec 31 16:45:10 2009
@@ -0,0 +1,14 @@
+# Copyright 2009 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.
+date-value-not-parseable=The input '%s' is not a valid date
\ No newline at end of file

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/OverrideDateFieldMessageCatalogDemo.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message