本文整理汇总了Java中com.google.gwt.aria.client.Roles类的典型用法代码示例。如果您正苦于以下问题:Java Roles类的具体用法?Java Roles怎么用?Java Roles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Roles类属于com.google.gwt.aria.client包,在下文中一共展示了Roles类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UniTimeTable
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
public UniTimeTable() {
setCellPadding(2);
setCellSpacing(0);
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
sinkEvents(Event.ONCLICK);
sinkEvents(Event.ONKEYDOWN);
sinkEvents(Event.ONDBLCLICK);
setStylePrimaryName("unitime-MainTable");
iHintPanel = new PopupPanel();
iHintPanel.setStyleName("unitime-PopupHint");
Roles.getGridRole().set(getElement());
}
示例2: addRow
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
public int addRow(Widget header, Widget... widgets) {
if (header.getElement().getId() == null || header.getElement().getId().isEmpty())
header.getElement().setId(DOM.createUniqueId());
P head = new P(DOM.createSpan(), "header-cell");
head.add(header);
add(head);
for (Widget widget: widgets) {
P body = new P(DOM.createSpan(), "content-cell");
add(body);
if (widget instanceof UniTimeTable) {
ScrollPanel scroll = new ScrollPanel(widget);
scroll.addStyleName("scroll");
body.add(scroll);
} else {
body.add(widget);
}
}
if (widgets.length > 0) {
if (widgets[0] instanceof UniTimeWidget)
Roles.getTextboxRole().setAriaLabelledbyProperty(((UniTimeWidget)widgets[0]).getWidget().getElement(), Id.of(header.getElement()));
else
Roles.getTextboxRole().setAriaLabelledbyProperty(widgets[0].getElement(), Id.of(header.getElement()));
}
return getWidgetCount() - widgets.length;
}
示例3: addRow
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
public int addRow(Widget header, Widget widget, int colSpan) {
header.addStyleName("label-cell");
int row = getRowCount();
setWidget(row, 0, header);
getCellFormatter().setStyleName(row, 0, "label-td");
if (widget instanceof HasMobileScroll) {
ScrollPanel scroll = new ScrollPanel(widget);
scroll.addStyleName("table-cell");
setWidget(row, 1, scroll);
getCellFormatter().setStyleName(row, 1, "table-td");
} else {
widget.addStyleName("widget-cell");
setWidget(row, 1, widget);
getCellFormatter().setStyleName(row, 1, "widget-td");
}
if (colSpan != 1)
getFlexCellFormatter().setColSpan(row, 1, colSpan);
if (header.getElement().getId() == null || header.getElement().getId().isEmpty())
header.getElement().setId(DOM.createUniqueId());
if (widget instanceof UniTimeWidget)
Roles.getTextboxRole().setAriaLabelledbyProperty(((UniTimeWidget)widget).getWidget().getElement(), Id.of(header.getElement()));
else
Roles.getTextboxRole().setAriaLabelledbyProperty(widget.getElement(), Id.of(header.getElement()));
return row;
}
示例4: ChipPanel
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
public ChipPanel(Chip chip, String color) {
iChip = chip;
setStyleName("chip");
addStyleName(color);
iLabel = new Label(chip.getTranslatedValue());
iLabel.setStyleName("text");
add(iLabel);
iButton = new HTML("×");
iButton.setStyleName("button");
add(iButton);
if (chip.hasToolTip())
setTitle(toString() + "\n" + chip.getToolTip());
else
setTitle(toString());
Roles.getDocumentRole().setAriaHiddenState(getElement(), true);
}
示例5: setTextInputAllowed
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
public void setTextInputAllowed(boolean textInputAllowed) {
debug("VComboBoxMultiselect: setTextInputAllowed()");
// Always update styles as they might have been overwritten
if (textInputAllowed) {
removeStyleDependentName(STYLE_NO_INPUT);
Roles.getTextboxRole()
.removeAriaReadonlyProperty(this.tb.getElement());
} else {
addStyleDependentName(STYLE_NO_INPUT);
Roles.getTextboxRole()
.setAriaReadonlyProperty(this.tb.getElement(), true);
}
if (this.textInputEnabled == textInputAllowed) {
return;
}
this.textInputEnabled = textInputAllowed;
updateReadOnly();
}
示例6: onStateChanged
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
getWidget().captionManagedByLayout = getState().captionManagedByLayout;
super.onStateChanged(stateChangeEvent);
if (!getWidget().captionManagedByLayout
&& isContextHelpIconEnabled()) {
if (getWidget().contextHelpIcon == null) {
getWidget().contextHelpIcon = DOM.createSpan();
getWidget().contextHelpIcon.setInnerHTML("?");
getWidget().contextHelpIcon.setClassName(CONTEXT_HELP_CLASSNAME);
Roles.getTextboxRole().setAriaHiddenState(getWidget().contextHelpIcon, true);
getWidget().getElement().appendChild(getWidget().contextHelpIcon);
DOM.sinkEvents(getWidget().contextHelpIcon, VTooltip.TOOLTIP_EVENTS | Event.ONCLICK);
} else {
getWidget().contextHelpIcon.getStyle().clearDisplay();
}
} else if (getWidget().contextHelpIcon != null) {
getWidget().contextHelpIcon.getStyle()
.setDisplay(Style.Display.NONE);
getWidget().setAriaInvalid(false);
}
}
示例7: SuggestionPopup
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public SuggestionPopup(Widget widget) {
super(true, true, true);
com.google.gwt.user.client.Element popup = getElement();
popup.getStyle().setZIndex(Z_INDEX);
Roles.getListRole().set(popup);
setStylePrimaryName(V_FILTERSELECT_SUGGESTPOPUP);
setAutoHideEnabled(true);
setOwner(CubaSuggestionFieldWidget.this);
addCloseHandler(this);
setWidget(widget);
}
示例8: selectItem
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
protected void selectItem(SuggestionItem item) {
if (item == selectedSuggestion) {
return;
}
if (selectedSuggestion != null) {
selectedSuggestion.updateSelection(false);
}
if (item != null) {
item.updateSelection(true);
Roles.getMenubarRole().setAriaActivedescendantProperty(getElement(), Id.of(item.getElement()));
}
selectedSuggestion = item;
}
示例9: SuggestionMenuItem
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public SuggestionMenuItem(String text, boolean asHTML) {
setElement(DOM.createTD());
setSelectionStyle(false);
if (asHTML) {
setHTML(text);
} else {
setText(text);
}
setStyleName("gwt-MenuItem");
getElement().setAttribute("id", DOM.createUniqueId());
// Add a11y role "menuitem"
Roles.getMenuitemRole().set(getElement());
}
示例10: accessibilityPrepare
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
private void accessibilityPrepare(){
// Add ARIA roles for accessibility
Roles.getButtonRole().set(backButton.getElement());
Roles.getButtonRole().setAriaLabelProperty(backButton.getElement(), "back");
Roles.getHeadingRole().set(heading.getElement());
Roles.getCheckboxRole().set(starButton.getElement());
Roles.getCheckboxRole().setAriaLabelProperty(starButton.getElement(), "favorite");
Roles.getTabRole().set(sailingsTab.getElement());
Roles.getTabRole().setAriaSelectedState(sailingsTab.getElement(), SelectedValue.TRUE);
Roles.getTabRole().setAriaLabelProperty(sailingsTab.getElement(), "sailings");
Roles.getTabRole().set(alertsTab.getElement());
Roles.getTabRole().setAriaSelectedState(alertsTab.getElement(), SelectedValue.FALSE);
Roles.getTabRole().setAriaLabelProperty(alertsTab.getElement(), "route alerts");
Roles.getProgressbarRole().set(progressIndicator.getElement());
Roles.getProgressbarRole().setAriaLabelProperty(progressIndicator.getElement(), "loading indicator");
accessibilityShowSailings();
}
示例11: updateAriaAttributes
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
private void updateAriaAttributes(int setSize) {
// Early out if this is a root node.
if (isRootNode()) {
return;
}
Roles.getTreeitemRole().setAriaSetsizeProperty(getElement(), setSize);
int selectionIndex = parentNode.indexOf(this);
Roles.getTreeitemRole().setAriaPosinsetProperty(getElement(), selectionIndex + 1);
// Set 'aria-expanded' state
// don't set aria-expanded on the leaf nodes
if (isLeaf()) {
Roles.getTreeitemRole().removeAriaExpandedState(getElement());
}
else {
Roles.getTreeitemRole().setAriaExpandedState(getElement(), ExpandedValue.of(open));
}
Roles.getTreeitemRole().setAriaLevelProperty(getElement(), this.depth);
}
示例12: setAriaLabel
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
@Override
public void setAriaLabel(String text) {
if (text == null || text.isEmpty())
Roles.getTextboxRole().removeAriaLabelledbyProperty(getElement());
else
Roles.getTextboxRole().setAriaLabelProperty(getElement(), text);
}
示例13: AriaCheckBox
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
public AriaCheckBox(Element elem) {
super(elem);
iAriaLabel = DOM.createLabel();
iAriaLabel.setId(DOM.createUniqueId());
iAriaLabel.setClassName("unitime-AriaLabel");
DOM.appendChild(getElement(), iAriaLabel);
Roles.getCheckboxRole().setAriaLabelledbyProperty(elem, Id.of(iAriaLabel));
}
示例14: setAriaLabel
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
@Override
public void setAriaLabel(String text) {
if (text == null || text.isEmpty())
Roles.getTextboxRole().removeAriaLabelProperty(getElement());
else
Roles.getTextboxRole().setAriaLabelProperty(getElement(), text);
}
示例15: setAriaLabel
import com.google.gwt.aria.client.Roles; //导入依赖的package包/类
@Override
public void setAriaLabel(String text) {
if (text == null || text.isEmpty())
Roles.getButtonRole().removeAriaLabelledbyProperty(getElement());
else
Roles.getButtonRole().setAriaLabelProperty(getElement(), text);
}