Author: [EMAIL PROTECTED]
Date: Thu Sep 18 12:31:46 2008
New Revision: 3665
Modified:
trunk/user/src/com/google/gwt/user/client/ui/FormPanel.java
trunk/user/src/com/google/gwt/user/client/ui/impl/FormPanelImpl.java
trunk/user/test/com/google/gwt/user/client/ui/FormPanelTest.java
Log:
Add a FormPanel.reset() method.
Patch by: jlabanca
Review by: ajr
Issue: 32
Modified: trunk/user/src/com/google/gwt/user/client/ui/FormPanel.java
==============================================================================
--- trunk/user/src/com/google/gwt/user/client/ui/FormPanel.java (original)
+++ trunk/user/src/com/google/gwt/user/client/ui/FormPanel.java Thu Sep 18
12:31:46 2008
@@ -327,6 +327,13 @@
}
/**
+ * Resets the form, clearing all fields.
+ */
+ public void reset() {
+ impl.reset(getElement());
+ }
+
+ /**
* Sets the 'action' associated with this form. This is the URL to which
it
* will be submitted.
*
Modified:
trunk/user/src/com/google/gwt/user/client/ui/impl/FormPanelImpl.java
==============================================================================
--- trunk/user/src/com/google/gwt/user/client/ui/impl/FormPanelImpl.java
(original)
+++ trunk/user/src/com/google/gwt/user/client/ui/impl/FormPanelImpl.java
Thu Sep 18 12:31:46 2008
@@ -83,6 +83,15 @@
}-*/;
/**
+ * Resets a form.
+ *
+ * @param form the form to be reset
+ */
+ public native void reset(Element form) /*-{
+ form.reset();
+ }-*/;
+
+ /**
* Sets the form element's encoding.
*
* @param form the form whose encoding is to be set
Modified: trunk/user/test/com/google/gwt/user/client/ui/FormPanelTest.java
==============================================================================
--- trunk/user/test/com/google/gwt/user/client/ui/FormPanelTest.java
(original)
+++ trunk/user/test/com/google/gwt/user/client/ui/FormPanelTest.java Thu
Sep 18 12:31:46 2008
@@ -162,6 +162,16 @@
form.submit();
}
+ public void testReset() {
+ FormPanel form = new FormPanel();
+ TextBox textBox = new TextBox();
+ textBox.setText("Hello World");
+ form.setWidget(textBox);
+ assertEquals("Hello World", textBox.getText());
+ form.reset();
+ assertEquals("", textBox.getText());
+ }
+
public void testSubmitAndHideDialog() {
final FormPanel form = new FormPanel();
form.setMethod(FormPanel.METHOD_GET);
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---