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.getMenuRole().set(daysOfWeek.getElement()); Roles.getMenuRole().setAriaLabelProperty(daysOfWeek.getElement(), "select a departing day"); Roles.getMenuRole().setTabindexExtraAttribute(daysOfWeek.getElement(), 0); Roles.getMainRole().set(times.getElement()); Roles.getMainRole().set(cameras.getElement()); Roles.getTabRole().set(timesTab.getElement()); Roles.getTabRole().setAriaSelectedState(timesTab.getElement(), SelectedValue.TRUE); Roles.getTabRole().setAriaLabelProperty(timesTab.getElement(), "times"); Roles.getTabRole().set(camerasTab.getElement()); Roles.getTabRole().setAriaSelectedState(camerasTab.getElement(), SelectedValue.FALSE); Roles.getTabRole().setAriaLabelProperty(camerasTab.getElement(), "cameras"); Roles.getProgressbarRole().set(progressIndicator.getElement()); Roles.getProgressbarRole() .setAriaLabelProperty(progressIndicator.getElement(), "loading indicator"); // TODO Hide pull down until we can figure out how to get VoiceOver to work with it Roles.getButtonRole().setAriaHiddenState(pullArrowHeader.getElement(), true); accessibilityShowTimes(); }
@UiHandler("daysOfWeek") protected void onChange(ChangeEvent event) { if (presenter != null) { MListBox source = (MListBox) event.getSource(); presenter.onDayOfWeekSelected(source.getSelectedIndex()); } }
@Override public void renderDaysOfWeek(List<String> days) { daysOfWeek.clear(); for (String day : days) { daysOfWeek.addItem(dayOfWeekFormat.format(new Date(Long.parseLong(day)))); } }
@Override public void setDayOfWeekSelected(int index) { daysOfWeek.setSelectedIndex(index); }
@Override public int getDayOfWeekSelected() { return daysOfWeek.getSelectedIndex(); }