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

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

Introduction

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

Prototype

String ROLE_BUTTON

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

Click Source Link

Usage

From source file:com.extjs.gxt.ui.client.widget.button.Button.java

License:sencha.com license

@Override
protected void onRender(Element target, int index) {
    SafeHtml label = SafeGxt.emptyToNbSpace(html);
    String style = baseStyle + "-" + scale.name().toLowerCase() + " " + baseStyle + "-icon-"
            + scale.name().toLowerCase() + "-" + iconAlign.name().toLowerCase();

    DivElement element = com.google.gwt.dom.client.Document.get().createDivElement();
    element.setInnerSafeHtml(TEMPLATES.button(label, getType(), style, getMenuClass(), baseStyle));

    setElement(element, target, index);/*from w  w  w  .ja v  a 2 s .  c  om*/

    super.onRender(target, index);

    buttonEl = el().selectNode(buttonSelector);
    buttonEl.makePositionable();

    if (getFocusEl() != null) {
        getFocusEl().addEventsSunk(Event.FOCUSEVENTS);
    }

    preview.getIgnoreList().add(getElement());

    buttonEl.setTabIndex(0);

    if (GXT.isAriaEnabled()) {
        Accessibility.setRole(buttonEl.dom, Accessibility.ROLE_BUTTON);
        if (menu != null) {
            Accessibility.setState(buttonEl.dom, "aria-haspopup", "true");
            addStyleName(baseStyle + "-menu");
        }
    }

    sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS | Event.KEYEVENTS);
}

From source file:com.extjs.gxt.ui.client.widget.button.IconButton.java

License:sencha.com license

protected void onRender(Element target, int index) {
    setElement(DOM.createDiv(), target, index);
    addStyleName("x-icon-btn");
    addStyleName("x-nodrag");
    addStyleName(style);//from   w w  w  .ja va  2s . c  om
    sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS | Event.ONKEYUP);
    super.onRender(target, index);

    if (GXT.isHighContrastMode) {
        getElement().setInnerHTML("<i>&nbsp;</i>");
    }

    if (GXT.isFocusManagerEnabled()) {
        el().setTabIndex(0);
        Accessibility.setRole(getElement(), Accessibility.ROLE_BUTTON);
    }
}

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

License:Apache License

/**
 * Constructor for <code>CustomButton</code>.
 *//*from www .j  a v  a2 s  .c  o m*/
protected AbstractCustomButton() {
    // Use FocusPanel.impl rather than FocusWidget because only FocusPanel.impl
    // works across browsers to create a focusable element.
    // my change
    super(Document.get().createDivElement());
    sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS | Event.KEYEVENTS);
    setUpFace(createFace(null, "up", UP));
    setStyleName(STYLENAME_DEFAULT);

    // Add a11y role "button"
    Accessibility.setRole(getElement(), Accessibility.ROLE_BUTTON);
}

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

License:Open Source License

public VButton() {
    super(DOM.createDiv());
    setTabIndex(0);/* www  .  jav a2  s . c  o  m*/
    sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS | Event.KEYEVENTS);
    sinkEvents(VTooltip.TOOLTIP_EVENTS);

    setStyleName(CLASSNAME);

    // Add a11y role "button"
    Accessibility.setRole(getElement(), Accessibility.ROLE_BUTTON);

    wrapper.setClassName(getStylePrimaryName() + "-wrap");
    getElement().appendChild(wrapper);
    captionElement.setClassName(getStylePrimaryName() + "-caption");
    wrapper.appendChild(captionElement);

    addClickHandler(this);
}

From source file:org.sakaiproject.gradebook.gwt.client.gxt.a11y.AriaButton.java

License:Educational Community License

protected void onRender(Element target, int index) {
    super.onRender(target, index);

    Accessibility.setRole(el().dom, Accessibility.ROLE_BUTTON);

    getElement().setAttribute("accesskey", String.valueOf(accessKey));
}