- Added javadoc for Role interface methods. - Fixed issue 7567 (http://code.google.com/p/google-web-toolkit/issues/detail?id=7567) Review at http://gwt-code-reviews.appspot.com/1828804 Review by: skybrian@google.com git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11266 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/aria/client/Attribute.java b/user/src/com/google/gwt/aria/client/Attribute.java index 70bee11..8899c23 100644 --- a/user/src/com/google/gwt/aria/client/Attribute.java +++ b/user/src/com/google/gwt/aria/client/Attribute.java
@@ -58,7 +58,7 @@ * Gets the HTML attribute value for the attribute with name {@code name} for element * {@code element} * - * @param element HTM element + * @param element HTML element * @return The attribute value for {@code element} */ public String get(Element element) { @@ -112,17 +112,20 @@ element.setAttribute(name, defaultValue); } + /** + * Gets the string representation of {@code value} to be set as an attribute value + * to an HTML element. + * + * @param value The item to be stringified + * @return the stringified representation of {@code value} + */ protected abstract String getSingleValue(T value); private String getAriaValue(T... value) { - if (value.length == 1) { - return getSingleValue(value[0]); - } else { - StringBuffer buf = new StringBuffer(); - for (T item : value) { - buf.append(getSingleValue(item)).append(" "); - } - return buf.toString().trim(); + StringBuffer buf = new StringBuffer(); + for (T item : value) { + buf.append(getSingleValue(item)).append(" "); } + return buf.toString().trim(); } }
diff --git a/user/src/com/google/gwt/aria/client/ButtonRole.java b/user/src/com/google/gwt/aria/client/ButtonRole.java index c638ab9..e3d596c 100644 --- a/user/src/com/google/gwt/aria/client/ButtonRole.java +++ b/user/src/com/google/gwt/aria/client/ButtonRole.java
@@ -27,15 +27,47 @@ * @see Roles */ public interface ButtonRole extends CommandRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaExpandedState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed"> + * aria-pressed</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaPressedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute from the {@code element}. + */ void removeAriaExpandedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed"> + * aria-pressed</a> attribute from the {@code element}. + */ void removeAriaPressedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaExpandedState(Element element, ExpandedValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-pressed"> + * aria-pressed</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaPressedState(Element element, PressedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/CheckboxRole.java b/user/src/com/google/gwt/aria/client/CheckboxRole.java index 43b62bd..8d50559 100644 --- a/user/src/com/google/gwt/aria/client/CheckboxRole.java +++ b/user/src/com/google/gwt/aria/client/CheckboxRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface CheckboxRole extends InputRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked"> + * aria-checked</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaCheckedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked"> + * aria-checked</a> attribute from the {@code element}. + */ void removeAriaCheckedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked"> + * aria-checked</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaCheckedState(Element element, CheckedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/ColumnheaderRole.java b/user/src/com/google/gwt/aria/client/ColumnheaderRole.java index b0ffab0..d3600d1 100644 --- a/user/src/com/google/gwt/aria/client/ColumnheaderRole.java +++ b/user/src/com/google/gwt/aria/client/ColumnheaderRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface ColumnheaderRole extends GridcellRole, SectionheadRole, WidgetRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort"> + * aria-sort</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSortProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort"> + * aria-sort</a> attribute from the {@code element}. + */ void removeAriaSortProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort"> + * aria-sort</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSortProperty(Element element, SortValue value); }
diff --git a/user/src/com/google/gwt/aria/client/ComboboxRole.java b/user/src/com/google/gwt/aria/client/ComboboxRole.java index 1dae8bb..bfeb1e6 100644 --- a/user/src/com/google/gwt/aria/client/ComboboxRole.java +++ b/user/src/com/google/gwt/aria/client/ComboboxRole.java
@@ -27,15 +27,47 @@ * @see Roles */ public interface ComboboxRole extends SelectRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-autocomplete"> + * aria-autocomplete</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaAutocompleteProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRequiredProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-autocomplete"> + * aria-autocomplete</a> attribute from the {@code element}. + */ void removeAriaAutocompleteProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute from the {@code element}. + */ void removeAriaRequiredProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-autocomplete"> + * aria-autocomplete</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaAutocompleteProperty(Element element, AutocompleteValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRequiredProperty(Element element, boolean value); }
diff --git a/user/src/com/google/gwt/aria/client/CompositeRole.java b/user/src/com/google/gwt/aria/client/CompositeRole.java index 8b5cab9..e60c501 100644 --- a/user/src/com/google/gwt/aria/client/CompositeRole.java +++ b/user/src/com/google/gwt/aria/client/CompositeRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface CompositeRole extends WidgetRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaActivedescendantProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute from the {@code element}. + */ void removeAriaActivedescendantProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaActivedescendantProperty(Element element, Id value); }
diff --git a/user/src/com/google/gwt/aria/client/DocumentRole.java b/user/src/com/google/gwt/aria/client/DocumentRole.java index 3ce1f9c..56fed2e 100644 --- a/user/src/com/google/gwt/aria/client/DocumentRole.java +++ b/user/src/com/google/gwt/aria/client/DocumentRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface DocumentRole extends StructureRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaExpandedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute from the {@code element}. + */ void removeAriaExpandedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaExpandedState(Element element, ExpandedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/GridRole.java b/user/src/com/google/gwt/aria/client/GridRole.java index 18c8661..21bb455 100644 --- a/user/src/com/google/gwt/aria/client/GridRole.java +++ b/user/src/com/google/gwt/aria/client/GridRole.java
@@ -27,21 +27,69 @@ * @see Roles */ public interface GridRole extends CompositeRole, RegionRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLevelProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaMultiselectableProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaReadonlyProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute from the {@code element}. + */ void removeAriaLevelProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute from the {@code element}. + */ void removeAriaMultiselectableProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute from the {@code element}. + */ void removeAriaReadonlyProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLevelProperty(Element element, int value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaMultiselectableProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaReadonlyProperty(Element element, boolean value); }
diff --git a/user/src/com/google/gwt/aria/client/GridcellRole.java b/user/src/com/google/gwt/aria/client/GridcellRole.java index b98e8ce..df08d61 100644 --- a/user/src/com/google/gwt/aria/client/GridcellRole.java +++ b/user/src/com/google/gwt/aria/client/GridcellRole.java
@@ -27,21 +27,69 @@ * @see Roles */ public interface GridcellRole extends SectionRole, WidgetRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaReadonlyProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRequiredProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSelectedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute from the {@code element}. + */ void removeAriaReadonlyProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute from the {@code element}. + */ void removeAriaRequiredProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute from the {@code element}. + */ void removeAriaSelectedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaReadonlyProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRequiredProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSelectedState(Element element, SelectedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/GroupRole.java b/user/src/com/google/gwt/aria/client/GroupRole.java index 6a37649..f16aa31 100644 --- a/user/src/com/google/gwt/aria/client/GroupRole.java +++ b/user/src/com/google/gwt/aria/client/GroupRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface GroupRole extends SectionRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaActivedescendantProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute from the {@code element}. + */ void removeAriaActivedescendantProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaActivedescendantProperty(Element element, Id value); }
diff --git a/user/src/com/google/gwt/aria/client/HeadingRole.java b/user/src/com/google/gwt/aria/client/HeadingRole.java index ecae557..e13238d 100644 --- a/user/src/com/google/gwt/aria/client/HeadingRole.java +++ b/user/src/com/google/gwt/aria/client/HeadingRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface HeadingRole extends SectionheadRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLevelProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute from the {@code element}. + */ void removeAriaLevelProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLevelProperty(Element element, int value); }
diff --git a/user/src/com/google/gwt/aria/client/LinkRole.java b/user/src/com/google/gwt/aria/client/LinkRole.java index e5243e3..14bbd62 100644 --- a/user/src/com/google/gwt/aria/client/LinkRole.java +++ b/user/src/com/google/gwt/aria/client/LinkRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface LinkRole extends CommandRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaExpandedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute from the {@code element}. + */ void removeAriaExpandedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaExpandedState(Element element, ExpandedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/ListboxRole.java b/user/src/com/google/gwt/aria/client/ListboxRole.java index 1bb4932..fd4d8b3 100644 --- a/user/src/com/google/gwt/aria/client/ListboxRole.java +++ b/user/src/com/google/gwt/aria/client/ListboxRole.java
@@ -27,15 +27,47 @@ * @see Roles */ public interface ListboxRole extends ListRole, SelectRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaMultiselectableProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRequiredProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute from the {@code element}. + */ void removeAriaMultiselectableProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute from the {@code element}. + */ void removeAriaRequiredProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaMultiselectableProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRequiredProperty(Element element, boolean value); }
diff --git a/user/src/com/google/gwt/aria/client/ListitemRole.java b/user/src/com/google/gwt/aria/client/ListitemRole.java index 5a6a2e6..476b151 100644 --- a/user/src/com/google/gwt/aria/client/ListitemRole.java +++ b/user/src/com/google/gwt/aria/client/ListitemRole.java
@@ -27,21 +27,69 @@ * @see Roles */ public interface ListitemRole extends SectionRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLevelProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset"> + * aria-posinset</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaPosinsetProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize"> + * aria-setsize</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSetsizeProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute from the {@code element}. + */ void removeAriaLevelProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset"> + * aria-posinset</a> attribute from the {@code element}. + */ void removeAriaPosinsetProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize"> + * aria-setsize</a> attribute from the {@code element}. + */ void removeAriaSetsizeProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLevelProperty(Element element, int value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset"> + * aria-posinset</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaPosinsetProperty(Element element, int value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize"> + * aria-setsize</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSetsizeProperty(Element element, int value); }
diff --git a/user/src/com/google/gwt/aria/client/MenuitemRoleImpl.java b/user/src/com/google/gwt/aria/client/MenuitemRoleImpl.java index 837275b..c908d86 100644 --- a/user/src/com/google/gwt/aria/client/MenuitemRoleImpl.java +++ b/user/src/com/google/gwt/aria/client/MenuitemRoleImpl.java
@@ -24,5 +24,4 @@ MenuitemRoleImpl(String roleName) { super(roleName); } - }
diff --git a/user/src/com/google/gwt/aria/client/OptionRole.java b/user/src/com/google/gwt/aria/client/OptionRole.java index 9ce9be0..7735663 100644 --- a/user/src/com/google/gwt/aria/client/OptionRole.java +++ b/user/src/com/google/gwt/aria/client/OptionRole.java
@@ -27,27 +27,91 @@ * @see Roles */ public interface OptionRole extends InputRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked"> + * aria-checked</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaCheckedState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset"> + * aria-posinset</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaPosinsetProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSelectedState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize"> + * aria-setsize</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSetsizeProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked"> + * aria-checked</a> attribute from the {@code element}. + */ void removeAriaCheckedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset"> + * aria-posinset</a> attribute from the {@code element}. + */ void removeAriaPosinsetProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute from the {@code element}. + */ void removeAriaSelectedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize"> + * aria-setsize</a> attribute from the {@code element}. + */ void removeAriaSetsizeProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked"> + * aria-checked</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaCheckedState(Element element, CheckedValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset"> + * aria-posinset</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaPosinsetProperty(Element element, int value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSelectedState(Element element, SelectedValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize"> + * aria-setsize</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSetsizeProperty(Element element, int value); }
diff --git a/user/src/com/google/gwt/aria/client/PresentationRoleImpl.java b/user/src/com/google/gwt/aria/client/PresentationRoleImpl.java index 9c1f946..7aca2c1 100644 --- a/user/src/com/google/gwt/aria/client/PresentationRoleImpl.java +++ b/user/src/com/google/gwt/aria/client/PresentationRoleImpl.java
@@ -24,5 +24,4 @@ PresentationRoleImpl(String roleName) { super(roleName); } - }
diff --git a/user/src/com/google/gwt/aria/client/RadiogroupRole.java b/user/src/com/google/gwt/aria/client/RadiogroupRole.java index 0f00e49..7a6fd37 100644 --- a/user/src/com/google/gwt/aria/client/RadiogroupRole.java +++ b/user/src/com/google/gwt/aria/client/RadiogroupRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface RadiogroupRole extends SelectRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRequiredProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute from the {@code element}. + */ void removeAriaRequiredProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRequiredProperty(Element element, boolean value); }
diff --git a/user/src/com/google/gwt/aria/client/RangeRole.java b/user/src/com/google/gwt/aria/client/RangeRole.java index 6aad17d..cfcbb3e 100644 --- a/user/src/com/google/gwt/aria/client/RangeRole.java +++ b/user/src/com/google/gwt/aria/client/RangeRole.java
@@ -27,27 +27,91 @@ * @see Roles */ public interface RangeRole extends WidgetRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax"> + * aria-valuemax</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaValuemaxProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin"> + * aria-valuemin</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaValueminProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow"> + * aria-valuenow</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaValuenowProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuetext"> + * aria-valuetext</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaValuetextProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax"> + * aria-valuemax</a> attribute from the {@code element}. + */ void removeAriaValuemaxProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin"> + * aria-valuemin</a> attribute from the {@code element}. + */ void removeAriaValueminProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow"> + * aria-valuenow</a> attribute from the {@code element}. + */ void removeAriaValuenowProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuetext"> + * aria-valuetext</a> attribute from the {@code element}. + */ void removeAriaValuetextProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax"> + * aria-valuemax</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaValuemaxProperty(Element element, Number value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin"> + * aria-valuemin</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaValueminProperty(Element element, Number value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow"> + * aria-valuenow</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaValuenowProperty(Element element, Number value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuetext"> + * aria-valuetext</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaValuetextProperty(Element element, String value); }
diff --git a/user/src/com/google/gwt/aria/client/Role.java b/user/src/com/google/gwt/aria/client/Role.java index f1a67d8..a5773bb 100644 --- a/user/src/com/google/gwt/aria/client/Role.java +++ b/user/src/com/google/gwt/aria/client/Role.java
@@ -33,113 +33,408 @@ * in the ARIA specification.</p> */ public interface Role { - String get(Element element); + /** + * Returns the value of the 'role' attribute for the {@code element} + * or the empty string if no 'role' attribute is present. + * + * @see <a href="http://www.w3.org/TR/wai-aria/roles">Roles documentation</a> + */ + String get(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-atomic"> + * aria-atomic</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaAtomicProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-busy"> + * aria-busy</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaBusyState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-controls"> + * aria-controls</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaControlsProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-describedby"> + * aria-describedby</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaDescribedbyProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-disabled"> + * aria-disabled</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaDisabledState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-dropeffect"> + * aria-dropeffect</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaDropeffectProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-flowto"> + * aria-flowto</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaFlowtoProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-grabbed"> + * aria-grabbed</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaGrabbedState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-haspopup"> + * aria-haspopup</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaHaspopupProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden"> + * aria-hidden</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaHiddenState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid"> + * aria-invalid</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaInvalidState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-labelledby"> + * aria-labelledby</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLabelledbyProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-label"> + * aria-label</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLabelProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-live"> + * aria-live</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLiveProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-owns"> + * aria-owns</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaOwnsProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-relevant"> + * aria-relevant</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRelevantProperty(Element element); + /** + * Gets the ARIA 'role' attribute name as defined in the + * <a href="http://www.w3.org/TR/wai-aria">WAI-ARIA</a> standard. + * + * @see <a href="http://www.w3.org/TR/wai-aria/roles">Roles documentation</a> + */ String getName(); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#tabIndex"> + * tabIndex</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getTabindexExtraAttribute(Element element); + /** + * Removes the 'role' attribute from the {@code element}. + * + * @see <a href="http://www.w3.org/TR/wai-aria/roles">Roles documentation</a> + */ void remove(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-atomic"> + * aria-atomic</a> attribute from the {@code element}. + */ void removeAriaAtomicProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-busy"> + * aria-busy</a> attribute from the {@code element}. + */ void removeAriaBusyState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-controls"> + * aria-controls</a> attribute from the {@code element}. + */ void removeAriaControlsProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-describedby"> + * aria-describedby</a> attribute from the {@code element}. + */ void removeAriaDescribedbyProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-disabled"> + * aria-disabled</a> attribute from the {@code element}. + */ void removeAriaDisabledState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-dropeffect"> + * aria-dropeffect</a> attribute from the {@code element}. + */ void removeAriaDropeffectProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-flowto"> + * aria-flowto</a> attribute from the {@code element}. + */ void removeAriaFlowtoProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-grabbed"> + * aria-grabbed</a> attribute from the {@code element}. + */ void removeAriaGrabbedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-haspopup"> + * aria-haspopup</a> attribute from the {@code element}. + */ void removeAriaHaspopupProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden"> + * aria-hidden</a> attribute from the {@code element}. + */ void removeAriaHiddenState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid"> + * aria-invalid</a> attribute from the {@code element}. + */ void removeAriaInvalidState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-labelledby"> + * aria-labelledby</a> attribute from the {@code element}. + */ void removeAriaLabelledbyProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-label"> + * aria-label</a> attribute from the {@code element}. + */ void removeAriaLabelProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-live"> + * aria-live</a> attribute from the {@code element}. + */ void removeAriaLiveProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-owns"> + * aria-owns</a> attribute from the {@code element}. + */ void removeAriaOwnsProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-relevant"> + * aria-relevant</a> attribute from the {@code element}. + */ void removeAriaRelevantProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#tabIndex"> + * tabIndex</a> attribute from the {@code element}. + */ void removeTabindexExtraAttribute(Element element); + /** + * Sets the 'role' attribute of the given {@code element} to the appropriate + * value for this role. + * + * @see <a href="http://www.w3.org/TR/wai-aria/roles">Roles documentation</a> + */ void set(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-atomic"> + * aria-atomic</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaAtomicProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-busy"> + * aria-busy</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaBusyState(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-controls"> + * aria-controls</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaControlsProperty(Element element, Id... value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-describedby"> + * aria-describedby</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaDescribedbyProperty(Element element, Id... value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-disabled"> + * aria-disabled</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaDisabledState(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-dropeffect"> + * aria-dropeffect</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaDropeffectProperty(Element element, DropeffectValue... value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-flowto"> + * aria-flowto</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaFlowtoProperty(Element element, Id... value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-grabbed"> + * aria-grabbed</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaGrabbedState(Element element, GrabbedValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-haspopup"> + * aria-haspopup</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaHaspopupProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden"> + * aria-hidden</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaHiddenState(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid"> + * aria-invalid</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaInvalidState(Element element, InvalidValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-labelledby"> + * aria-labelledby</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLabelledbyProperty(Element element, Id... value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-label"> + * aria-label</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLabelProperty(Element element, String value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-live"> + * aria-live</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLiveProperty(Element element, LiveValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-owns"> + * aria-owns</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaOwnsProperty(Element element, Id... value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-relevant"> + * aria-relevant</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRelevantProperty(Element element, RelevantValue... value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#tabIndex"> + * tabIndex</a> attribute for the {@code element} to the given {@code value}. + */ void setTabindexExtraAttribute(Element element, int value); }
diff --git a/user/src/com/google/gwt/aria/client/RoleImpl.java b/user/src/com/google/gwt/aria/client/RoleImpl.java index 96ed6ad..48d6abe 100644 --- a/user/src/com/google/gwt/aria/client/RoleImpl.java +++ b/user/src/com/google/gwt/aria/client/RoleImpl.java
@@ -33,16 +33,16 @@ this.roleName = roleName; } - /** - * Gets the role for the element {@code element}. If none is set, "" is returned. - * - * @param element HTML element - * @return The role attribute value - */ @Override public String get(Element element) { assert element != null : "Element cannot be null."; - return element.getAttribute(ATTR_NAME_ROLE); + String roleAttributeValue = element.getAttribute(ATTR_NAME_ROLE); + for (String testRoleName : roleAttributeValue.split(" ")) { + if (Roles.isRoleName(testRoleName)) { + return testRoleName; + } + } + return ""; } @Override @@ -125,11 +125,6 @@ return Property.RELEVANT.get(element); } - /** - * Gets the role name - * - * @return The role name - */ @Override public String getName() { return roleName; @@ -140,11 +135,6 @@ return ExtraAttribute.TABINDEX.get(element); } - /** - * Removes the role for element {@code element} - * - * @param element HTML element - */ @Override public void remove(Element element) { assert element != null : "Element cannot be null."; @@ -236,11 +226,6 @@ ExtraAttribute.TABINDEX.remove(element); } - /** - * Sets the role to element {@code element} - * - * @param element HTML element - */ @Override public void set(Element element) { assert element != null : "Element cannot be null.";
diff --git a/user/src/com/google/gwt/aria/client/Roles.java b/user/src/com/google/gwt/aria/client/Roles.java index 43c7b48..c04a4a0 100644 --- a/user/src/com/google/gwt/aria/client/Roles.java +++ b/user/src/com/google/gwt/aria/client/Roles.java
@@ -17,6 +17,9 @@ // This is auto-generated code. Do not manually edit! // ///////////////////////////////////////////////////////// +import java.util.ArrayList; +import java.util.List; + /** * <p>A factory providing each concrete role in the ARIA specification. Each role implements * methods that a GWT application can use to modify the appropriate DOM attributes for that @@ -129,6 +132,84 @@ private static final TreeitemRole TREEITEM = new TreeitemRoleImpl("treeitem"); private static final TreeRole TREE = new TreeRoleImpl("tree"); + private static List<String> ROLE_NAMES = new ArrayList(); + + static { + ROLE_NAMES.add("roletype"); + ROLE_NAMES.add("structure"); + ROLE_NAMES.add("section"); + ROLE_NAMES.add("region"); + ROLE_NAMES.add("alert"); + ROLE_NAMES.add("window"); + ROLE_NAMES.add("dialog"); + ROLE_NAMES.add("alertdialog"); + ROLE_NAMES.add("landmark"); + ROLE_NAMES.add("application"); + ROLE_NAMES.add("document"); + ROLE_NAMES.add("article"); + ROLE_NAMES.add("banner"); + ROLE_NAMES.add("widget"); + ROLE_NAMES.add("command"); + ROLE_NAMES.add("button"); + ROLE_NAMES.add("input"); + ROLE_NAMES.add("checkbox"); + ROLE_NAMES.add("gridcell"); + ROLE_NAMES.add("sectionhead"); + ROLE_NAMES.add("columnheader"); + ROLE_NAMES.add("composite"); + ROLE_NAMES.add("group"); + ROLE_NAMES.add("select"); + ROLE_NAMES.add("combobox"); + ROLE_NAMES.add("complementary"); + ROLE_NAMES.add("contentinfo"); + ROLE_NAMES.add("definition"); + ROLE_NAMES.add("list"); + ROLE_NAMES.add("directory"); + ROLE_NAMES.add("form"); + ROLE_NAMES.add("grid"); + ROLE_NAMES.add("heading"); + ROLE_NAMES.add("img"); + ROLE_NAMES.add("link"); + ROLE_NAMES.add("listbox"); + ROLE_NAMES.add("listitem"); + ROLE_NAMES.add("log"); + ROLE_NAMES.add("main"); + ROLE_NAMES.add("marquee"); + ROLE_NAMES.add("math"); + ROLE_NAMES.add("menu"); + ROLE_NAMES.add("menubar"); + ROLE_NAMES.add("menuitem"); + ROLE_NAMES.add("menuitemcheckbox"); + ROLE_NAMES.add("option"); + ROLE_NAMES.add("radio"); + ROLE_NAMES.add("menuitemradio"); + ROLE_NAMES.add("navigation"); + ROLE_NAMES.add("note"); + ROLE_NAMES.add("presentation"); + ROLE_NAMES.add("range"); + ROLE_NAMES.add("progressbar"); + ROLE_NAMES.add("radiogroup"); + ROLE_NAMES.add("row"); + ROLE_NAMES.add("rowgroup"); + ROLE_NAMES.add("rowheader"); + ROLE_NAMES.add("search"); + ROLE_NAMES.add("separator"); + ROLE_NAMES.add("scrollbar"); + ROLE_NAMES.add("slider"); + ROLE_NAMES.add("spinbutton"); + ROLE_NAMES.add("status"); + ROLE_NAMES.add("tab"); + ROLE_NAMES.add("tablist"); + ROLE_NAMES.add("tabpanel"); + ROLE_NAMES.add("textbox"); + ROLE_NAMES.add("timer"); + ROLE_NAMES.add("toolbar"); + ROLE_NAMES.add("tooltip"); + ROLE_NAMES.add("tree"); + ROLE_NAMES.add("treegrid"); + ROLE_NAMES.add("treeitem"); + } + public static AlertdialogRole getAlertdialogRole() { return ALERTDIALOG; } @@ -372,4 +453,8 @@ public static TreeRole getTreeRole() { return TREE; } + + public static boolean isRoleName(String testRoleName) { + return ROLE_NAMES.contains(testRoleName); + } }
diff --git a/user/src/com/google/gwt/aria/client/RowRole.java b/user/src/com/google/gwt/aria/client/RowRole.java index 82f1032..2dfe4d7 100644 --- a/user/src/com/google/gwt/aria/client/RowRole.java +++ b/user/src/com/google/gwt/aria/client/RowRole.java
@@ -27,15 +27,47 @@ * @see Roles */ public interface RowRole extends GroupRole, WidgetRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLevelProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSelectedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute from the {@code element}. + */ void removeAriaLevelProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute from the {@code element}. + */ void removeAriaSelectedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLevelProperty(Element element, int value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSelectedState(Element element, SelectedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/RowheaderRole.java b/user/src/com/google/gwt/aria/client/RowheaderRole.java index 73ab027..c6a6a0d 100644 --- a/user/src/com/google/gwt/aria/client/RowheaderRole.java +++ b/user/src/com/google/gwt/aria/client/RowheaderRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface RowheaderRole extends GridcellRole, SectionheadRole, WidgetRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort"> + * aria-sort</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSortProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort"> + * aria-sort</a> attribute from the {@code element}. + */ void removeAriaSortProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort"> + * aria-sort</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSortProperty(Element element, SortValue value); }
diff --git a/user/src/com/google/gwt/aria/client/ScrollbarRole.java b/user/src/com/google/gwt/aria/client/ScrollbarRole.java index 723447e..6f57f4d 100644 --- a/user/src/com/google/gwt/aria/client/ScrollbarRole.java +++ b/user/src/com/google/gwt/aria/client/ScrollbarRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface ScrollbarRole extends InputRole, RangeRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaOrientationProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute from the {@code element}. + */ void removeAriaOrientationProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaOrientationProperty(Element element, OrientationValue value); }
diff --git a/user/src/com/google/gwt/aria/client/SectionRole.java b/user/src/com/google/gwt/aria/client/SectionRole.java index bf6a7b2..2ebc810 100644 --- a/user/src/com/google/gwt/aria/client/SectionRole.java +++ b/user/src/com/google/gwt/aria/client/SectionRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface SectionRole extends StructureRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaExpandedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute from the {@code element}. + */ void removeAriaExpandedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaExpandedState(Element element, ExpandedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/SectionheadRole.java b/user/src/com/google/gwt/aria/client/SectionheadRole.java index c54e8a2..47bd28f 100644 --- a/user/src/com/google/gwt/aria/client/SectionheadRole.java +++ b/user/src/com/google/gwt/aria/client/SectionheadRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface SectionheadRole extends StructureRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaExpandedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute from the {@code element}. + */ void removeAriaExpandedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaExpandedState(Element element, ExpandedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/SeparatorRole.java b/user/src/com/google/gwt/aria/client/SeparatorRole.java index ffc966d..1322c05 100644 --- a/user/src/com/google/gwt/aria/client/SeparatorRole.java +++ b/user/src/com/google/gwt/aria/client/SeparatorRole.java
@@ -27,15 +27,47 @@ * @see Roles */ public interface SeparatorRole extends StructureRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaExpandedState(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaOrientationProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute from the {@code element}. + */ void removeAriaExpandedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute from the {@code element}. + */ void removeAriaOrientationProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaExpandedState(Element element, ExpandedValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaOrientationProperty(Element element, OrientationValue value); }
diff --git a/user/src/com/google/gwt/aria/client/SliderRole.java b/user/src/com/google/gwt/aria/client/SliderRole.java index ab268b2..c7b4333 100644 --- a/user/src/com/google/gwt/aria/client/SliderRole.java +++ b/user/src/com/google/gwt/aria/client/SliderRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface SliderRole extends InputRole, RangeRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaOrientationProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute from the {@code element}. + */ void removeAriaOrientationProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-orientation"> + * aria-orientation</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaOrientationProperty(Element element, OrientationValue value); }
diff --git a/user/src/com/google/gwt/aria/client/SpinbuttonRole.java b/user/src/com/google/gwt/aria/client/SpinbuttonRole.java index cddb0b6..ea3e4c2 100644 --- a/user/src/com/google/gwt/aria/client/SpinbuttonRole.java +++ b/user/src/com/google/gwt/aria/client/SpinbuttonRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface SpinbuttonRole extends InputRole, RangeRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRequiredProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute from the {@code element}. + */ void removeAriaRequiredProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRequiredProperty(Element element, boolean value); }
diff --git a/user/src/com/google/gwt/aria/client/TabRole.java b/user/src/com/google/gwt/aria/client/TabRole.java index 47875c7..09773ca 100644 --- a/user/src/com/google/gwt/aria/client/TabRole.java +++ b/user/src/com/google/gwt/aria/client/TabRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface TabRole extends SectionheadRole, WidgetRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaSelectedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute from the {@code element}. + */ void removeAriaSelectedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected"> + * aria-selected</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaSelectedState(Element element, SelectedValue value); }
diff --git a/user/src/com/google/gwt/aria/client/TablistRole.java b/user/src/com/google/gwt/aria/client/TablistRole.java index b795ed8..97b6f33 100644 --- a/user/src/com/google/gwt/aria/client/TablistRole.java +++ b/user/src/com/google/gwt/aria/client/TablistRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface TablistRole extends CompositeRole, DirectoryRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaLevelProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute from the {@code element}. + */ void removeAriaLevelProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-level"> + * aria-level</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaLevelProperty(Element element, int value); }
diff --git a/user/src/com/google/gwt/aria/client/TextboxRole.java b/user/src/com/google/gwt/aria/client/TextboxRole.java index 7c6ea38..5b8c61e 100644 --- a/user/src/com/google/gwt/aria/client/TextboxRole.java +++ b/user/src/com/google/gwt/aria/client/TextboxRole.java
@@ -27,33 +27,113 @@ * @see Roles */ public interface TextboxRole extends InputRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaActivedescendantProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-autocomplete"> + * aria-autocomplete</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaAutocompleteProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiline"> + * aria-multiline</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaMultilineProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaReadonlyProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRequiredProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute from the {@code element}. + */ void removeAriaActivedescendantProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-autocomplete"> + * aria-autocomplete</a> attribute from the {@code element}. + */ void removeAriaAutocompleteProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiline"> + * aria-multiline</a> attribute from the {@code element}. + */ void removeAriaMultilineProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute from the {@code element}. + */ void removeAriaReadonlyProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute from the {@code element}. + */ void removeAriaRequiredProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-activedescendant"> + * aria-activedescendant</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaActivedescendantProperty(Element element, Id value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-autocomplete"> + * aria-autocomplete</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaAutocompleteProperty(Element element, AutocompleteValue value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiline"> + * aria-multiline</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaMultilineProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly"> + * aria-readonly</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaReadonlyProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRequiredProperty(Element element, boolean value); }
diff --git a/user/src/com/google/gwt/aria/client/TreeRole.java b/user/src/com/google/gwt/aria/client/TreeRole.java index eaf1993..bac9154 100644 --- a/user/src/com/google/gwt/aria/client/TreeRole.java +++ b/user/src/com/google/gwt/aria/client/TreeRole.java
@@ -27,15 +27,47 @@ * @see Roles */ public interface TreeRole extends SelectRole { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaMultiselectableProperty(Element element); + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaRequiredProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute from the {@code element}. + */ void removeAriaMultiselectableProperty(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute from the {@code element}. + */ void removeAriaRequiredProperty(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable"> + * aria-multiselectable</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaMultiselectableProperty(Element element, boolean value); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-required"> + * aria-required</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaRequiredProperty(Element element, boolean value); }
diff --git a/user/src/com/google/gwt/aria/client/WindowRole.java b/user/src/com/google/gwt/aria/client/WindowRole.java index 73ad921..3bf2495 100644 --- a/user/src/com/google/gwt/aria/client/WindowRole.java +++ b/user/src/com/google/gwt/aria/client/WindowRole.java
@@ -27,9 +27,25 @@ * @see Roles */ public interface WindowRole extends Role { + /** + * Returns the value of the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} or "" if no + * such attribute is present. + */ String getAriaExpandedState(Element element); + /** + * Removes the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute from the {@code element}. + */ void removeAriaExpandedState(Element element); + /** + * Sets the + * <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded"> + * aria-expanded</a> attribute for the {@code element} to the given {@code value}. + */ void setAriaExpandedState(Element element, ExpandedValue value); }
diff --git a/user/test/com/google/gwt/aria/client/AttributeTest.java b/user/test/com/google/gwt/aria/client/AttributeTest.java index 94db21a..8d8545c 100644 --- a/user/test/com/google/gwt/aria/client/AttributeTest.java +++ b/user/test/com/google/gwt/aria/client/AttributeTest.java
@@ -17,8 +17,6 @@ import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.junit.client.GWTTestCase; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.Label; /** * Tests {@link Attribute} ARIA class @@ -73,15 +71,6 @@ ref2.setId("ref2"); attribute5.set(div, Id.of(ref1), Id.of(ref2)); assertEquals("ref1 ref2", attribute5.get(div)); - - Button b = new Button(); - b.getElement().setId("b"); - Label l1 = new Label(); - l1.getElement().setId("l1"); - Label l2 = new Label(); - l2.getElement().setId("l2"); - attribute5.set(b.getElement(), Id.of(l1), Id.of(l2)); - assertEquals("l1 l2", attribute5.get(b.getElement())); } public void testSetDefaultValue_noSet() {
diff --git a/user/test/com/google/gwt/aria/client/RoleImplTest.java b/user/test/com/google/gwt/aria/client/RoleImplTest.java index 65d9e2a..0fc476e 100644 --- a/user/test/com/google/gwt/aria/client/RoleImplTest.java +++ b/user/test/com/google/gwt/aria/client/RoleImplTest.java
@@ -32,6 +32,12 @@ assertEquals(regionRole.getName(), regionRole.get(div)); regionRole.remove(div); assertEquals("", regionRole.get(div)); + div.setAttribute("role", "region fallback1 fallback2"); + assertEquals("region", regionRole.get(div)); + div.setAttribute("role", "fallback1 region fallback2"); + assertEquals("region", regionRole.get(div)); + div.setAttribute("role", "fallback1 fallback2 fallback3"); + assertEquals("", regionRole.get(div)); } public void testSetGetRemoveProperty() {