Updated patch for issue 3527 (getDisabled() -> isDisabled() on Select
and OptGroup elements.
Review: http://gwt-code-reviews.appspot.com/97803
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6962 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/dom/client/OptGroupElement.java b/user/src/com/google/gwt/dom/client/OptGroupElement.java
index a00aacd..2527d38 100644
--- a/user/src/com/google/gwt/dom/client/OptGroupElement.java
+++ b/user/src/com/google/gwt/dom/client/OptGroupElement.java
@@ -41,6 +41,7 @@
* The control is unavailable in this context.
*
* @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
+ * @deprecated use {@link #isDisabled()} instead.
*/
public final native String getDisabled() /*-{
return this.disabled;
@@ -60,6 +61,24 @@
*
* @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
*/
+ public final native boolean isDisabled() /*-{
+ return !!this.disabled;
+ }-*/;
+
+ /**
+ * The control is unavailable in this context.
+ *
+ * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
+ */
+ public final native void setDisabled(boolean disabled) /*-{
+ this.disabled = disabled;
+ }-*/;
+
+ /**
+ * The control is unavailable in this context.
+ *
+ * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
+ */
public final native void setDisabled(String disabled) /*-{
this.disabled = disabled;
}-*/;
diff --git a/user/src/com/google/gwt/dom/client/SelectElement.java b/user/src/com/google/gwt/dom/client/SelectElement.java
index 90ecede..f64c8e9 100644
--- a/user/src/com/google/gwt/dom/client/SelectElement.java
+++ b/user/src/com/google/gwt/dom/client/SelectElement.java
@@ -80,6 +80,7 @@
* The control is unavailable in this context.
*
* @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
+ * @deprecated use {@link #isDisabled()} instead.
*/
public final native String getDisabled() /*-{
return this.disabled;
@@ -161,6 +162,15 @@
}-*/;
/**
+ * The control is unavailable in this context.
+ *
+ * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
+ */
+ public final native boolean isDisabled() /*-{
+ return !!this.disabled;
+ }-*/;
+
+ /**
* If true, multiple OPTION elements may be selected in this SELECT.
*
* @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-multiple">W3C HTML Specification</a>
@@ -184,6 +194,15 @@
*
* @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
*/
+ public final native void setDisabled(boolean disabled) /*-{
+ this.disabled = disabled;
+ }-*/;
+
+ /**
+ * The control is unavailable in this context.
+ *
+ * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C HTML Specification</a>
+ */
public final native void setDisabled(String disabled) /*-{
this.disabled = disabled;
}-*/;
diff --git a/user/test/com/google/gwt/dom/client/ElementTest.java b/user/test/com/google/gwt/dom/client/ElementTest.java
index 361c8a9..66d8484 100644
--- a/user/test/com/google/gwt/dom/client/ElementTest.java
+++ b/user/test/com/google/gwt/dom/client/ElementTest.java
@@ -84,6 +84,16 @@
assertFalse(input.isDisabled());
input.setDisabled(true);
assertTrue(input.isDisabled());
+
+ SelectElement select = Document.get().createSelectElement();
+ assertFalse(select.isDisabled());
+ select.setDisabled(true);
+ assertTrue(select.isDisabled());
+
+ OptGroupElement optgroup = Document.get().createOptGroupElement();
+ assertFalse(optgroup.isDisabled());
+ optgroup.setDisabled(true);
+ assertTrue(optgroup.isDisabled());
}
/**