com.vaadin.client.ui.aria
Class AriaHelper

java.lang.Object
  extended by com.vaadin.client.ui.aria.AriaHelper

public class AriaHelper
extends java.lang.Object

Helper class that helps to implement the WAI-ARIA functionality.


Field Summary
static java.lang.String ASSISTIVE_DEVICE_ONLY_STYLE
           
 
Constructor Summary
AriaHelper()
           
 
Method Summary
static void bindCaption(Widget widget, Element captionElement)
          Binds a caption (label in HTML speak) to the form element as required by WAI-ARIA specification.
static java.lang.String ensureHasId(Element element)
          Makes sure that the provided element has an id attribute.
static void handleInputInvalid(Element element, boolean invalid)
          Handles the required actions depending of the input element contains unaccepted input.
static void handleInputInvalid(Widget widget, boolean invalid)
          Handles the required actions depending of the input Widget contains unaccepted input.
static void handleInputRequired(Element element, boolean required)
          Handles the required actions depending of the input element being required or not.
static void handleInputRequired(Widget widget, boolean required)
          Handles the required actions depending of the input Widget being required or not.
static void setVisibleForAssistiveDevicesOnly(Element element, boolean assistiveOnly)
          Allows to move an element out of the visible area of the browser window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASSISTIVE_DEVICE_ONLY_STYLE

public static final java.lang.String ASSISTIVE_DEVICE_ONLY_STYLE
See Also:
Constant Field Values
Constructor Detail

AriaHelper

public AriaHelper()
Method Detail

bindCaption

public static void bindCaption(Widget widget,
                               Element captionElement)
Binds a caption (label in HTML speak) to the form element as required by WAI-ARIA specification.

Parameters:
widget - Widget, that should be bound to the caption
captionElements - Element with of caption to bind

handleInputRequired

public static void handleInputRequired(Widget widget,
                                       boolean required)
Handles the required actions depending of the input Widget being required or not.

Parameters:
widget - Widget, typically an input Widget like TextField
required - boolean, true when the element is required

handleInputRequired

public static void handleInputRequired(Element element,
                                       boolean required)
Handles the required actions depending of the input element being required or not.

Parameters:
element - Element, typically from an input Widget like TextField
required - boolean, true when the element is required

handleInputInvalid

public static void handleInputInvalid(Widget widget,
                                      boolean invalid)
Handles the required actions depending of the input Widget contains unaccepted input.

Parameters:
widget - Widget, typically an input Widget like TextField
invalid - boolean, true when the Widget input has an error

handleInputInvalid

public static void handleInputInvalid(Element element,
                                      boolean invalid)
Handles the required actions depending of the input element contains unaccepted input.

Parameters:
element - Element, typically an input Widget like TextField
invalid - boolean, true when the element input has an error

ensureHasId

public static java.lang.String ensureHasId(Element element)
Makes sure that the provided element has an id attribute. Adds a new unique id if not.

Parameters:
element - Element to check
Returns:
String with the id of the element

setVisibleForAssistiveDevicesOnly

public static void setVisibleForAssistiveDevicesOnly(Element element,
                                                     boolean assistiveOnly)
Allows to move an element out of the visible area of the browser window. This makes it possible to have additional information for an assistive device, that is not in the way for visual users.

Parameters:
element - Element to move out of sight
boolean - assistiveOnly true when element should only be visible for assistive devices, false to make the element visible for all


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.