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

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

Introduction

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

Prototype

String ROLE_MENUITEM

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

Click Source Link

Usage

From source file:com.extjs.gxt.ui.client.widget.menu.MenuBarItem.java

License:sencha.com license

@Override
protected void onRender(Element target, int index) {
    super.onRender(target, index);
    setElement(DOM.createDiv(), target, index);
    setStyleAttribute("display", "inline");
    setHtml(html);//from   w ww . j  a v a2  s  .  c om

    if (GXT.isAriaEnabled()) {
        if (menu != null) {
            getAriaSupport().setState("aria-owns", menu.getId());
            menu.getAriaSupport().setLabelledBy(getId());
        }
        // el().setTabIndex(-1);
        Accessibility.setRole(getElement(), Accessibility.ROLE_MENUITEM);
        Accessibility.setState(getElement(), "aria-haspopup", "true");
    }
}

From source file:com.extjs.gxt.ui.client.widget.menu.MenuItem.java

License:sencha.com license

@Override
protected void onRender(Element target, int index) {
    super.onRender(target, index);
    setElement(DOM.createSpan(), target, index);

    getElement().setAttribute("unselectable", "on");

    if (GXT.isAriaEnabled()) {
        Accessibility.setRole(getElement(), Accessibility.ROLE_MENUITEM);
    } else {// w w w. j a v  a2  s. co m
        getElement().setPropertyString("href", "#");
    }

    String s = itemStyle + (subMenu != null ? " x-menu-item-arrow" : "");
    addStyleName(s);

    if (widget != null) {
        setWidget(widget);
    } else {
        setHtml(html);
        if (directionEstimated && html != null && !Util.isEmptyString(html)) {
            BidiUtils.setDirectionOnElement(getElement(),
                    WordCountDirectionEstimator.get().estimateDirection(html));
        }
    }

    if (subMenu != null) {
        Accessibility.setState(getElement(), "aria-haspopup", "true");
    }
}

From source file:org.cruxframework.crux.widgets.client.stackmenu.StackMenuItem.java

License:Apache License

/**
 * Constructs a menu item with the given label and a given key.
 *
 * @param key a textual mark useful to identify which item was selected by the user 
 * @param label the text to be displayed on item
 */// w  w  w.ja v  a 2  s  .  c  o m
public StackMenuItem(String key, String label) {
    this.key = key;
    this.label = label;
    this.itemCaption = new StackMenuItemCaption(label, this);

    this.wrappingCanvas = new VerticalPanel();
    this.wrappingCanvas.setStyleName("itemWrapper");
    this.wrappingCanvas.setWidth("100%");
    this.wrappingCanvas.getElement().getStyle().setTableLayout(TableLayout.FIXED);
    this.wrappingCanvas.add(itemCaption);

    this.subItemsCanvas = new FlowPanel();
    this.subItemsCanvas.setStyleName("subItemsWrapper");
    this.subItemsCanvas.setWidth("100%");
    this.wrappingCanvas.add(subItemsCanvas);
    this.wrappingCanvas.setCellVerticalAlignment(subItemsCanvas, HasVerticalAlignment.ALIGN_TOP);

    showSubItens(false);
    initWidget(this.wrappingCanvas);
    setStyleName("crux-StackMenuItem");

    Accessibility.setRole(getElement(), Accessibility.ROLE_MENUITEM);
}

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

License:Educational Community License

@Override
protected void onRender(Element target, int index) {
    super.onRender(target, index);
    Accessibility.setRole(el().dom, Accessibility.ROLE_MENUITEM);
}