Author: ivaynberg
Date: Fri Mar 14 13:46:09 2008
New Revision: 637257

URL: http://svn.apache.org/viewvc?rev=637257&view=rev
Log:
WICKET-1422: removed some finals and removed some unnecessary checks

Modified:
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java?rev=637257&r1=637256&r2=637257&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java
 Fri Mar 14 13:46:09 2008
@@ -18,7 +18,6 @@
 
 import java.util.List;
 
-import org.apache.wicket.Page;
 import org.apache.wicket.RequestContext;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.MarkupStream;
@@ -212,7 +211,7 @@
         *      List,IChoiceRenderer)
         */
        public RadioChoice(final String id, IModel model, final List choices,
-                       final IChoiceRenderer renderer)
+               final IChoiceRenderer renderer)
        {
                super(id, model, choices, renderer);
        }
@@ -353,7 +352,7 @@
        /**
         * @return Prefix to use before choice
         */
-       public final String getPrefix()
+       public String getPrefix()
        {
                return prefix;
        }
@@ -366,12 +365,7 @@
        public final RadioChoice setPrefix(String prefix)
        {
                // Tell the page that this component's prefix was changed
-               final Page page = findPage();
-               if (page != null)
-               {
-                       addStateChange(new PrefixChange(this.prefix));
-               }
-
+               addStateChange(new PrefixChange(this.prefix));
                this.prefix = prefix;
                return this;
        }
@@ -379,7 +373,7 @@
        /**
         * @return Separator to use between radio options
         */
-       public final String getSuffix()
+       public String getSuffix()
        {
                return suffix;
        }
@@ -392,12 +386,7 @@
        public final RadioChoice setSuffix(String suffix)
        {
                // Tell the page that this component's suffix was changed
-               final Page page = findPage();
-               if (page != null)
-               {
-                       addStateChange(new SuffixChange(this.suffix));
-               }
-
+               addStateChange(new SuffixChange(this.suffix));
                this.suffix = suffix;
                return this;
        }
@@ -406,7 +395,7 @@
         * @see org.apache.wicket.Component#onComponentTagBody(MarkupStream, 
ComponentTag)
         */
        protected final void onComponentTagBody(final MarkupStream markupStream,
-                       final ComponentTag openTag)
+               final ComponentTag openTag)
        {
                // Iterate through choices
                final List choices = getChoices();
@@ -449,11 +438,17 @@
                                final String idAttr = getInputName() + "_" + id;
 
                                // Add radio tag
-                               buffer.append("<input 
name=\"").append(getInputName()).append("\"").append(
-                                               " type=\"radio\"").append(
-                                               (isSelected(choice, index, 
selected) ? " checked=\"checked\"" : ""))
-                                               .append((isEnabled() ? "" : " 
disabled=\"disabled\"")).append(" value=\"")
-                                               .append(id).append("\" 
id=\"").append(idAttr).append("\"");
+                               buffer.append("<input name=\"")
+                                       .append(getInputName())
+                                       .append("\"")
+                                       .append(" type=\"radio\"")
+                                       .append((isSelected(choice, index, 
selected) ? " checked=\"checked\"" : ""))
+                                       .append((isEnabled() ? "" : " 
disabled=\"disabled\""))
+                                       .append(" value=\"")
+                                       .append(id)
+                                       .append("\" id=\"")
+                                       .append(idAttr)
+                                       .append("\"");
 
                                // Should a roundtrip be made (have 
onSelectionChanged called)
                                // when the option is clicked?
@@ -472,7 +467,7 @@
                                                        url = 
((PortletRequestContext)rc).getLastEncodedPath();
                                                }
                                                buffer.append(" 
onclick=\"").append(form.getJsForInterfaceUrl(url)).append(
-                                                               ";\"");
+                                                       ";\"");
                                        }
                                        else
                                        {
@@ -481,11 +476,13 @@
                                                // with an ActionURL or 
something
                                                // NOTE: do not encode the url 
as that would give
                                                // invalid JavaScript
-                                               buffer.append(" 
onclick=\"window.location.href='").append(url)
-                                                               .append(
-                                                                               
(url.toString().indexOf('?') > -1 ? "&amp;" : "?") +
-                                                                               
                getInputName()).append("=").append(id).append(
-                                                                               
"';\"");
+                                               buffer.append(" 
onclick=\"window.location.href='")
+                                                       .append(url)
+                                                       .append(
+                                                               
(url.toString().indexOf('?') > -1 ? "&amp;" : "?") + getInputName())
+                                                       .append("=")
+                                                       .append(id)
+                                                       .append("';\"");
                                        }
                                }
 
@@ -499,7 +496,7 @@
                                }
                                CharSequence escaped = 
Strings.escapeMarkup(display, false, true);
                                buffer.append("<label 
for=\"").append(idAttr).append("\">").append(escaped).append(
-                                               "</label>");
+                                       "</label>");
 
                                // Append option suffix
                                buffer.append(getSuffix());


Reply via email to