summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/AbstractComponent.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-12-15 22:48:50 +0200
committerArtur Signell <artur@vaadin.com>2014-12-15 23:18:58 +0200
commitea1d229c70fa2e9edc63b234c483c36ee6114a29 (patch)
treeb6ca1636f23acf8c6275627a24fe4477be550016 /server/src/com/vaadin/ui/AbstractComponent.java
parentbac6b9599bce821d3cb554aa4ccb729e956493ee (diff)
downloadvaadin-framework-ea1d229c70fa2e9edc63b234c483c36ee6114a29.tar.gz
vaadin-framework-ea1d229c70fa2e9edc63b234c483c36ee6114a29.zip
Handle tab indexes in a generic way (#7749)
Change-Id: I6e449ed7fd0acaf683da98ae3fcf55ff544c3b48
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractComponent.java')
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 83833b75ce..4d4556d4d9 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -950,6 +950,13 @@ public abstract class AbstractComponent extends AbstractClientConnector
ContentMode.HTML, ErrorLevel.ERROR);
setComponentError(error);
}
+ // Tab index when applicable
+ if (design.hasAttr("tabindex") && this instanceof Focusable) {
+ ((Focusable) this).setTabIndex(DesignAttributeHandler
+ .readAttribute("tabindex", design.attributes(),
+ Integer.class));
+ }
+
// handle responsive
setResponsive(attr.hasKey("responsive")
&& !attr.get("responsive").equalsIgnoreCase("false"));
@@ -1188,7 +1195,12 @@ public abstract class AbstractComponent extends AbstractClientConnector
* implementation
*/
protected Collection<String> getCustomAttributes() {
- return new ArrayList<String>(Arrays.asList(customAttributes));
+ ArrayList<String> l = new ArrayList<String>(
+ Arrays.asList(customAttributes));
+ if (this instanceof Focusable) {
+ l.add("tab-index");
+ }
+ return l;
}
private static final String[] customAttributes = new String[] { "width",
@@ -1232,6 +1244,13 @@ public abstract class AbstractComponent extends AbstractClientConnector
if (!SharedUtil.equals(errorMsg, defErrorMsg)) {
attr.put("error", errorMsg);
}
+ // handle tab index
+ if (this instanceof Focusable) {
+ DesignAttributeHandler.writeAttribute("tabindex", attr,
+ ((Focusable) this).getTabIndex(),
+ ((Focusable) def).getTabIndex(), Integer.class);
+ }
+
// handle responsive
if (isResponsive()) {
attr.put("responsive", "");