tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/src/documentation/content/xdocs index.xml
Date Fri, 01 Jul 2005 16:41:03 GMT
hlship      2005/07/01 09:41:03

  Modified:    .        status.xml
               framework/src/test/org/apache/tapestry/form MockForm.java
               framework/src/java/org/apache/tapestry
                        AbstractComponent.java IComponent.java
               src/documentation/content/xdocs index.xml
  Added:       framework/src/test/org/apache/tapestry
                        TestComponentMessageAccess.java
  Log:
  TAPESTRY-357: AbstractComponent: getMessages() and format() were removed, but should have
been deprecated
  
  Revision  Changes    Path
  1.147     +1 -0      jakarta-tapestry/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/status.xml,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- status.xml	24 Jun 2005 22:08:09 -0000	1.146
  +++ status.xml	1 Jul 2005 16:41:03 -0000	1.147
  @@ -54,6 +54,7 @@
     <changes>
       <release version="4.0-beta-2" date="unreleased">
         <action type="fix" dev="HLS" fixes-bug="TAPESTRY-356">FormConditional extends
BaseComponent but has no template</action>
  +      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-357">AbstractComponent: getMessages()
and format() were removed, but should have been deprecated</action>
       </release>
       <release version="4.0-beta-1" date="Jun 24 2005">
          <action type="add" dev="HLS">Add InvokeListener component.</action>
  
  
  
  1.7       +5 -0      jakarta-tapestry/framework/src/test/org/apache/tapestry/form/MockForm.java
  
  Index: MockForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/form/MockForm.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MockForm.java	6 Jun 2005 18:48:42 -0000	1.6
  +++ MockForm.java	1 Jul 2005 16:41:03 -0000	1.7
  @@ -317,4 +317,9 @@
       {
           return false;
       }
  +
  +    public String getMessage(String key)
  +    {
  +        return null;
  +    }
   }
  \ No newline at end of file
  
  
  
  1.1                  jakarta-tapestry/framework/src/test/org/apache/tapestry/TestComponentMessageAccess.java
  
  Index: TestComponentMessageAccess.java
  ===================================================================
  // Copyright 2005 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;
  
  import org.apache.hivemind.Messages;
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.apache.tapestry.test.Creator;
  import org.easymock.MockControl;
  
  /**
   * Tests support for several deprecated methods on {@link org.apache.tapestry.AbstractComponent}
   * related to accessing localized messages. This test case may be removed in 4.1, when the
   * corresponding methods are removed.
   * 
   * @author Howard Lewis Ship
   * @since 4.0
   */
  public class TestComponentMessageAccess extends HiveMindTestCase
  {
      private AbstractComponent newComponent(Messages messages)
      {
          Creator c = new Creator();
  
          return (AbstractComponent) c.newInstance(AbstractComponent.class, new Object[]
          { "messages", messages });
      }
  
      public void testGetMessage()
      {
          MockControl control = newControl(Messages.class);
          Messages m = (Messages) control.getMock();
  
          m.getMessage("fred");
          control.setReturnValue("flintstone");
  
          AbstractComponent ac = newComponent(m);
  
          replayControls();
  
          assertEquals("flintstone", ac.getMessage("fred"));
  
          verifyControls();
      }
  
      public void testFormat()
      {
          MockControl control = newControl(Messages.class);
          Messages m = (Messages) control.getMock();
  
          m.format("fred", "flintstone");
          control.setReturnValue("Fred Flintstone");
  
          AbstractComponent ac = newComponent(m);
  
          replayControls();
  
          assertEquals("Fred Flintstone", ac.format("fred", "flintstone"));
  
          verifyControls();
  
          m.format("fred", "wilma", "dino");
          control.setReturnValue("flintstone family");
  
          replayControls();
  
          assertEquals("flintstone family", ac.format("fred", "wilma", "dino"));
  
          verifyControls();
  
          m.format("fred", "wilma", "dino", "pebbles");
          control.setReturnValue("flintstone family 2");
  
          replayControls();
  
          assertEquals("flintstone family 2", ac.format("fred", "wilma", "dino", "pebbles"));
  
          verifyControls();
  
          Object[] arguments = new String[]
          { "flinstone" };
  
          m.format("fred", arguments);
          control.setReturnValue("flintstone family 3");
  
          replayControls();
  
          assertEquals("flintstone family 3", ac.format("fred", arguments));
  
          verifyControls();
  
      }
  }
  
  
  
  1.20      +66 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/AbstractComponent.java
  
  Index: AbstractComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/AbstractComponent.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AbstractComponent.java	18 Apr 2005 17:06:42 -0000	1.19
  +++ AbstractComponent.java	1 Jul 2005 16:41:03 -0000	1.20
  @@ -766,4 +766,70 @@
       {
           throw new IllegalStateException(TapestryMessages.providedByEnhancement("getSpecification"));
       }
  +
  +    /**
  +     * Returns a localized message.
  +     * 
  +     * @since 3.0
  +     * @deprecated To be removed in 4.1. Use {@link #getMessages()} instead.
  +     */
  +
  +    public String getMessage(String key)
  +    {
  +        return getMessages().getMessage(key);
  +    }
  +
  +    /**
  +     * Formats a localized message string, using
  +     * {@link Messages#format(java.lang.String, java.lang.Object[])}.
  +     * 
  +     * @param key
  +     *            the key used to obtain a localized pattern
  +     * @param arguments
  +     *            passed to the formatter
  +     * @since 3.0
  +     * @deprecated To be removed in 4.1. Use {@link #getMessages()} instead.
  +     */
  +
  +    public String format(String key, Object[] arguments)
  +    {
  +        return getMessages().format(key, arguments);
  +    }
  +
  +    /**
  +     * Convienience method for invoking {@link IMessages#format(String, Object)}
  +     * 
  +     * @since 3.0
  +     * @deprecated To be removed in 4.1. Use {@link #getMessages()} instead.
  +     */
  +
  +    public String format(String key, Object argument)
  +    {
  +        return getMessages().format(key, argument);
  +    }
  +
  +    /**
  +     * Convienience method for invoking {@link Messages#format(String, Object, Object)}.
  +     * 
  +     * @since 3.0
  +     * @deprecated To be removed in 4.1. Use {@link #getMessages()} instead.
  +     */
  +
  +    public String format(String key, Object argument1, Object argument2)
  +    {
  +        return getMessages().format(key, argument1, argument2);
  +    }
  +
  +    /**
  +     * Convienience method for {@link Messages#format(String, Object, Object, Object)}.
  +     * 
  +     * @since 3.0
  +     * @deprecated To be removed in 4.1. Use {@link #getMessages()} instead.
  +     */
  +
  +    public String format(String key, Object argument1, Object argument2, Object argument3)
  +    {
  +        return getMessages().format(key, argument1, argument2, argument3);
  +    }
  +
   }
  \ No newline at end of file
  
  
  
  1.13      +16 -2     jakarta-tapestry/framework/src/java/org/apache/tapestry/IComponent.java
  
  Index: IComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/IComponent.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- IComponent.java	20 May 2005 12:46:08 -0000	1.12
  +++ IComponent.java	1 Jul 2005 16:41:03 -0000	1.13
  @@ -317,11 +317,25 @@
   
       /**
        * Returns a {@link ListenerMap} for the component. The map contains a number of synthetic
  -     * read-only properties that implement the {@link IActionListener} interface, but in
fact,
  -     * cause public instance methods to be invoked (via reflection).
  +     * read-only properties that implement the {@link IActionListener} interface, but in
fact, cause
  +     * public instance methods to be invoked (via reflection).
        * 
        * @since 4.0
        */
   
       public ListenerMap getListeners();
  +
  +    /**
  +     * Returns a localized string message. Each component has an optional set of localized
message
  +     * strings that are read from properties files.
  +     * 
  +     * @param key
  +     *            the key used to locate the message
  +     * @return the localized message for the key, or a placeholder if no message is defined
for the
  +     *         key.
  +     * @since 3.0
  +     * @deprecated To be removed in release 4.1. Use {@link #getMessages()} instead.
  +     */
  +
  +    public String getMessage(String key);
   }
  \ No newline at end of file
  
  
  
  1.19      +1 -1      jakarta-tapestry/src/documentation/content/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/index.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- index.xml	27 Jun 2005 04:40:29 -0000	1.18
  +++ index.xml	1 Jul 2005 16:41:03 -0000	1.19
  @@ -135,7 +135,7 @@
       because of how parameters are now implemented.
     </li>
     <li>
  -   HiveMind services and &Spring; beans to be directly injected
  +   HiveMind services and &Spring; beans can be directly injected
       into page and component classes.
     </li>
     <li>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message