You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Cristian Peraferrer (JIRA)" <ji...@apache.org> on 2010/03/31 13:08:27 UTC
[jira] Created: (WW-3425) Refactoring of Reset tag when testing if
the key/value were entered
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
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 <input type="reset"...></li>
* <li>button: renders as html <button type="reset"...></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:
* <s:reset type="button" key="reset"/>
* <!-- 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.
[jira] Updated: (WW-3425) Refactoring of Reset tag when testing if
the key/value were entered
Posted by "Cristian Peraferrer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cristian Peraferrer updated WW-3425:
------------------------------------
Attachment: (was: resetTagRefactored.patch)
> 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
>
> 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 <input type="reset"...></li>
> * <li>button: renders as html <button type="reset"...></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:
> * <s:reset type="button" key="reset"/>
> * <!-- 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.
[jira] Commented: (WW-3425) Refactoring of Reset tag when testing
if the key/value were entered
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852069#action_12852069 ]
Lukasz Lenart commented on WW-3425:
-----------------------------------
Nice, but I will have to merge as I'm working on WW-2624 ;-)
> 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 <input type="reset"...></li>
> * <li>button: renders as html <button type="reset"...></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:
> * <s:reset type="button" key="reset"/>
> * <!-- 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.
[jira] Updated: (WW-3425) Refactoring of Reset tag when testing if
the key/value were entered
Posted by "Cristian Peraferrer (JIRA)" <ji...@apache.org>.
[ 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
I've also attached the patch file
> 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 <input type="reset"...></li>
> * <li>button: renders as html <button type="reset"...></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:
> * <s:reset type="button" key="reset"/>
> * <!-- 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.
[jira] Updated: (WW-3425) Refactoring of Reset tag when testing if
the key/value were entered
Posted by "Cristian Peraferrer (JIRA)" <ji...@apache.org>.
[ 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 <input type="reset"...></li>
> * <li>button: renders as html <button type="reset"...></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:
> * <s:reset type="button" key="reset"/>
> * <!-- 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.
[jira] Updated: (WW-3425) Refactoring of Reset tag when testing if
the key/value were entered
Posted by "Cristian Peraferrer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cristian Peraferrer updated WW-3425:
------------------------------------
Description:
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.
I've attached the patch to fix it.
was:
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 <input type="reset"...></li>
* <li>button: renders as html <button type="reset"...></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:
* <s:reset type="button" key="reset"/>
* <!-- 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;
Deleted the old pasted patch. Use the attached one.
> 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.
> I've attached the patch to fix it.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.