diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2016-12-14 15:36:14 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2016-12-14 15:36:14 +0200 |
commit | afcd95da1dba4abfd6158f38ab0a95755e2623e4 (patch) | |
tree | 9be6dfe6f1ea576e17171c573ffdf34310e2301d /client | |
parent | ce26bf7c4ce2d3f4a40904d103cb85bdd8fb17c6 (diff) | |
download | vaadin-framework-afcd95da1dba4abfd6158f38ab0a95755e2623e4.tar.gz vaadin-framework-afcd95da1dba4abfd6158f38ab0a95755e2623e4.zip |
Make AbstractListing implement Focusable (#7965)
* Make AbstractListing implement Focusable
Fixes vaadin/framework8-issues#552
* Add tests for other components that inherit from AbstractListing
* Fix setTabIndex in NativeSelect, ListSelect, RadioButtonGroup
Also adds a test for TwinColSelect.
Diffstat (limited to 'client')
5 files changed, 25 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java b/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java index 5005c79fbb..0ff6fe01f2 100644 --- a/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java @@ -60,6 +60,16 @@ public class VNativeSelect extends FocusableFlowPanelComposite } /** + * Sets the tab index. + * + * @param tabIndex + * the tab index to set + */ + public void setTabIndex(int tabIndex) { + getListBox().setTabIndex(tabIndex); + } + + /** * Gets the underlying ListBox widget that this widget wraps. * * @return the ListBox this widget wraps diff --git a/client/src/main/java/com/vaadin/client/ui/listselect/ListSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/listselect/ListSelectConnector.java index 3e20b115e0..11aa21ebd9 100644 --- a/client/src/main/java/com/vaadin/client/ui/listselect/ListSelectConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/listselect/ListSelectConnector.java @@ -51,4 +51,8 @@ public class ListSelectConnector extends AbstractMultiSelectConnector { getWidget().setReadOnly(isReadOnly()); } + @OnStateChange("tabIndex") + void updateTabIndex() { + getWidget().setTabIndex(getState().tabIndex); + } } diff --git a/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java index 18764f8b86..33c3170168 100644 --- a/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java @@ -77,7 +77,6 @@ public class NativeSelectConnector } @OnStateChange("readOnly") - @SuppressWarnings("deprecation") void updateWidgetReadOnly() { getWidget().getListBox().setEnabled(isEnabled() && !isReadOnly()); } @@ -87,6 +86,11 @@ public class NativeSelectConnector getWidget().setSelectedItem(getState().selectedItemKey); } + @OnStateChange("tabIndex") + void updateTabIndex() { + getWidget().setTabIndex(getState().tabIndex); + } + @Override public NativeSelectState getState() { return (NativeSelectState) super.getState(); diff --git a/client/src/main/java/com/vaadin/client/ui/optiongroup/RadioButtonGroupConnector.java b/client/src/main/java/com/vaadin/client/ui/optiongroup/RadioButtonGroupConnector.java index 13e39677d3..4331273b1e 100644 --- a/client/src/main/java/com/vaadin/client/ui/optiongroup/RadioButtonGroupConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/optiongroup/RadioButtonGroupConnector.java @@ -61,6 +61,7 @@ public class RadioButtonGroupConnector @Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); + getWidget().setTabIndex(getState().tabIndex); getWidget().client = getConnection(); } diff --git a/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java index 304f5dcab0..8be2c0da15 100644 --- a/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java @@ -70,6 +70,11 @@ public class TwinColSelectConnector extends AbstractMultiSelectConnector getWidget().setReadOnly(isReadOnly()); } + @OnStateChange("tabIndex") + void updateTabIndex() { + getWidget().setTabIndex(getState().tabIndex); + } + @Override public void layoutVertically() { if (isUndefinedHeight()) { |