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

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

Introduction

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

Prototype

String STATE_PRESSED

To view the source code for com.google.gwt.user.client.ui Accessibility STATE_PRESSED.

Click Source Link

Usage

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

License:Apache License

/**
 * Sets whether this button is enabled./*from   w  w  w.  j a  va2s  .  c  o 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.travelsky.ebuild.hawkeye.client.ui.widget.AbstractCustomButton.java

License:Apache License

private void setAriaPressed(Face newFace) {
    boolean pressed = (newFace.getFaceID() & DOWN_ATTRIBUTE) == 1;
    Accessibility.setState(getElement(), Accessibility.STATE_PRESSED, pressed ? "true" : "false");
}

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

License:Open Source License

/**
 * Sets whether this button is enabled./*from www .  j  a  v a  2 s.  com*/
 * 
 * @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);
        }
    }
}