Author: [email protected]
Date: Tue May 12 10:52:02 2009
New Revision: 5351

Modified:
    trunk/user/src/com/google/gwt/user/client/ui/CheckBox.java
    trunk/user/src/com/google/gwt/user/client/ui/RadioButton.java
    trunk/user/test/com/google/gwt/user/client/ui/CheckBoxTest.java

Log:
Fixed checkstyle errors.

Patch by: jlabanca
Review by: rjrjr

Modified: trunk/user/src/com/google/gwt/user/client/ui/CheckBox.java
==============================================================================
--- trunk/user/src/com/google/gwt/user/client/ui/CheckBox.java  (original)
+++ trunk/user/src/com/google/gwt/user/client/ui/CheckBox.java  Tue May 12  
10:52:02 2009
@@ -119,17 +119,6 @@
      return addHandler(handler, ValueChangeEvent.getType());
    }

-  protected void ensureDomEventHandlers() {
-    addClickHandler(new ClickHandler() {
-      public void onClick(ClickEvent event) {
-        // Checkboxes always toggle their value, no need to compare
-        // with old value. Radio buttons are not so lucky, see
-        // overrides in RadioButton
-        ValueChangeEvent.fire(CheckBox.this, getValue());
-      }
-    });
-  }
-
    /**
     * Returns the value property of the input element that backs this  
widget.
     * This is the value that will be associated with the CheckBox name and
@@ -326,6 +315,17 @@
      } else {
        super.sinkEvents(eventBitsToAdd);
      }
+  }
+
+  protected void ensureDomEventHandlers() {
+    addClickHandler(new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        // Checkboxes always toggle their value, no need to compare
+        // with old value. Radio buttons are not so lucky, see
+        // overrides in RadioButton
+        ValueChangeEvent.fire(CheckBox.this, getValue());
+      }
+    });
    }

    /**

Modified: trunk/user/src/com/google/gwt/user/client/ui/RadioButton.java
==============================================================================
--- trunk/user/src/com/google/gwt/user/client/ui/RadioButton.java       
(original)
+++ trunk/user/src/com/google/gwt/user/client/ui/RadioButton.java       Tue May 
 
12 10:52:02 2009
@@ -18,7 +18,6 @@
  import com.google.gwt.dom.client.Element;
  import com.google.gwt.dom.client.EventTarget;
  import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.ClickEvent;
  import com.google.gwt.event.dom.client.KeyDownEvent;
  import com.google.gwt.event.dom.client.MouseUpEvent;
  import com.google.gwt.event.logical.shared.ValueChangeEvent;
@@ -70,6 +69,44 @@
    }

    /**
+   * Creates a new radio associated with a particular group, and  
initialized
+   * with the given HTML label. All radio buttons associated with the same  
group
+   * name belong to a mutually-exclusive set.
+   *
+   * Radio buttons are grouped by their name attribute, so changing their  
name
+   * using the setName() method will also change their associated group.
+   *
+   * @param name the group name with which to associate the radio button
+   * @param label this radio button's label
+   */
+  public RadioButton(String name, String label) {
+    this(name);
+    setText(label);
+  }
+
+  /**
+   * Creates a new radio button associated with a particular group, and
+   * initialized with the given label (optionally treated as HTML). All  
radio
+   * buttons associated with the same group name belong to a  
mutually-exclusive
+   * set.
+   *
+   * Radio buttons are grouped by their name attribute, so changing their  
name
+   * using the setName() method will also change their associated group.
+   *
+   * @param name name the group with which to associate the radio button
+   * @param label this radio button's label
+   * @param asHTML <code>true</code> to treat the specified label as HTML
+   */
+  public RadioButton(String name, String label, boolean asHTML) {
+    this(name);
+    if (asHTML) {
+      setHTML(label);
+    } else {
+      setText(label);
+    }
+  }
+
+  /**
     * Overridden to send ValueChangeEvents only when appropriate.
     */
    @Override
@@ -104,6 +141,26 @@
      super.onBrowserEvent(event);
    }

+  /**
+   * Change the group name of this radio button.
+   *
+   * Radio buttons are grouped by their name attribute, so changing their  
name
+   * using the setName() method will also change their associated group.
+   *
+   * If changing this group name results in a new radio group with multiple
+   * radio buttons selected, this radio button will remain selected and the
+   * other radio buttons will be unselected.
+   *
+   * @param name name the group with which to associate the radio button
+   */
+  @Override
+  public void setName(String name) {
+    // Just changing the radio button name tends to break groupiness,
+    // so we have to replace it. Note that replaceInputElement is careful
+    // not to propagate name when it propagates everything else
+    super.replaceInputElement(DOM.createInputRadio(name));
+  }
+
    @Override
    public void sinkEvents(int eventBitsToAdd) {
      // Like CheckBox, we want to hear about inputElem. We
@@ -126,63 +183,5 @@
     */
    @Override
    protected void ensureDomEventHandlers() {
-  }
-
-  /**
-   * Creates a new radio associated with a particular group, and  
initialized
-   * with the given HTML label. All radio buttons associated with the same  
group
-   * name belong to a mutually-exclusive set.
-   *
-   * Radio buttons are grouped by their name attribute, so changing their  
name
-   * using the setName() method will also change their associated group.
-   *
-   * @param name the group name with which to associate the radio button
-   * @param label this radio button's label
-   */
-  public RadioButton(String name, String label) {
-    this(name);
-    setText(label);
-  }
-
-  /**
-   * Creates a new radio button associated with a particular group, and
-   * initialized with the given label (optionally treated as HTML). All  
radio
-   * buttons associated with the same group name belong to a  
mutually-exclusive
-   * set.
-   *
-   * Radio buttons are grouped by their name attribute, so changing their  
name
-   * using the setName() method will also change their associated group.
-   *
-   * @param name name the group with which to associate the radio button
-   * @param label this radio button's label
-   * @param asHTML <code>true</code> to treat the specified label as HTML
-   */
-  public RadioButton(String name, String label, boolean asHTML) {
-    this(name);
-    if (asHTML) {
-      setHTML(label);
-    } else {
-      setText(label);
-    }
-  }
-
-  /**
-   * Change the group name of this radio button.
-   *
-   * Radio buttons are grouped by their name attribute, so changing their  
name
-   * using the setName() method will also change their associated group.
-   *
-   * If changing this group name results in a new radio group with multiple
-   * radio buttons selected, this radio button will remain selected and the
-   * other radio buttons will be unselected.
-   *
-   * @param name name the group with which to associate the radio button
-   */
-  @Override
-  public void setName(String name) {
-    // Just changing the radio button name tends to break groupiness,
-    // so we have to replace it. Note that replaceInputElement is careful
-    // not to propagate name when it propagates everything else
-    super.replaceInputElement(DOM.createInputRadio(name));
    }
  }

Modified: trunk/user/test/com/google/gwt/user/client/ui/CheckBoxTest.java
==============================================================================
--- trunk/user/test/com/google/gwt/user/client/ui/CheckBoxTest.java      
(original)
+++ trunk/user/test/com/google/gwt/user/client/ui/CheckBoxTest.java     Tue May 
 
12 10:52:02 2009
@@ -45,7 +45,6 @@
      public void onClick(Widget sender) {
        ++fired;
      }
-
    }

    private static class Handler implements ValueChangeHandler<Boolean> {

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to