struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cristian Peraferrer (JIRA)" <j...@apache.org>
Subject [jira] Updated: (WW-3425) Refactoring of Reset tag when testing if the key/value were entered
Date Wed, 07 Apr 2010 15:11:33 GMT

     [ https://issues.apache.org/jira/browse/WW-3425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Cristian Peraferrer updated WW-3425:
------------------------------------

    Attachment: resetTagRefactored.patch

Here's the patch for the latest revision, it is refactoring a tiny piece of code but also
corrects some documentations typos.

> Refactoring of Reset tag when testing if the key/value were entered
> -------------------------------------------------------------------
>
>                 Key: WW-3425
>                 URL: https://issues.apache.org/jira/browse/WW-3425
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Other
>    Affects Versions: 2.2.0
>            Reporter: Cristian Peraferrer
>            Priority: Trivial
>         Attachments: resetTagRefactored.patch
>
>
> Tiny code refactoring in the reset tag code when testing if the key/value are present.
There is no need to test if value is null two times.
> I have also corrected some typos in the comments/javadoc.
> Here the patch:
> Index: core/src/main/java/org/apache/struts2/components/Reset.java
> ===================================================================
> --- core/src/main/java/org/apache/struts2/components/Reset.java	(revision 929448)
> +++ core/src/main/java/org/apache/struts2/components/Reset.java	(working copy)
> @@ -37,7 +37,7 @@
>   * <li>input: renders as html &lt;input type="reset"...&gt;</li>
>   * <li>button: renders as html &lt;button type="reset"...&gt;</li>
>   * </ul>
> - * Please note that the button type has advantages by adding the possibility to seperate
the submitted value from the
> + * Please note that the button type has advantages by adding the possibility to separate
the submitted value from the
>   * text shown on the button face, but has issues with Microsoft Internet Explorer at
least up to 6.0
>   * <!-- END SNIPPET: javadoc -->
>   *
> @@ -51,7 +51,7 @@
>   *
>   * <pre>
>   * <!-- START SNIPPET: example2 -->
> - * Render an button reset:
> + * Render a reset button:
>   * &lt;s:reset type="button" key="reset"/&gt;
>   * <!-- END SNIPPET: example2 -->
>   * </pre>
> @@ -83,14 +83,10 @@
>  
>      public void evaluateParams() {
>  
> -        if ((key == null) && (value == null)) {
> -            value = "Reset";
> +        if (value == null) {
> +            value = (key != null ? "%{getText('"+key+"')}" : "Reset"); 
>          }
>  
> -        if (((key != null)) && (value == null)) {
> -            this.value = "%{getText('"+key +"')}";
> -        }
> -
>          super.evaluateParams();
>  
>      }
> @@ -98,7 +94,7 @@
>      /**
>       * Indicate whether the concrete button supports the type "image".
>       *
> -     * @return <tt>false</tt> to indicate type image is supported.
> +     * @return <tt>false</tt> to indicate type image is not supported.
>       */
>      protected boolean supportsImageType() {
>          return false;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message