Example usage for com.google.gwt.user.client.ui Accessibility removeState

List of usage examples for com.google.gwt.user.client.ui Accessibility removeState

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Accessibility removeState.

Prototype

public static void removeState(Element elem, String stateName) 

Source Link

Document

Removes the state from the given element.

Usage

From source file:com.travelsky.ebuild.hawkeye.client.ui.widget.AbstractCustomButton.java

License:Apache License

/**
 * Sets whether this button is enabled.// w ww.j  a va  2s.  co  m
 * 
 * @param enabled <code>true</code> to enable the button, <code>false</code>
 * to disable it
 */
@Override
public final void setEnabled(boolean enabled) {
    if (isEnabled() != enabled) {
        toggleDisabled();
        super.setEnabled(enabled);
        if (!enabled) {
            cleanupCaptureState();
            Accessibility.removeState(getElement(), Accessibility.STATE_PRESSED);
        } else {
            setAriaPressed(getCurrentFace());
        }
    }
}

From source file:com.vaadin.terminal.gwt.client.ui.VButton.java

License:Open Source License

/**
 * Sets whether this button is enabled./*  www . j ava2  s .c  om*/
 * 
 * @param enabled
 *            <code>true</code> to enable the button, <code>false</code> to
 *            disable it
 */

@Override
public final void setEnabled(boolean enabled) {
    if (isEnabled() != enabled) {
        this.enabled = enabled;
        if (!enabled) {
            cleanupCaptureState();
            Accessibility.removeState(getElement(), Accessibility.STATE_PRESSED);
            super.setTabIndex(-1);
            addStyleName(ApplicationConnection.DISABLED_CLASSNAME);
        } else {
            Accessibility.setState(getElement(), Accessibility.STATE_PRESSED, "false");
            super.setTabIndex(tabIndex);
            removeStyleName(ApplicationConnection.DISABLED_CLASSNAME);
        }
    }
}