summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-02-16 15:15:28 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-02-16 15:15:28 +0000
commitb85cc4e7915de55f04809627a628dd0d41792960 (patch)
tree7ddc6a027515b9ce3d967bf4e9e36b728ba7c8c0 /src/com/vaadin/ui
parent296138490ec5472d7ef062a56873cb290292551f (diff)
downloadvaadin-framework-b85cc4e7915de55f04809627a628dd0d41792960.tar.gz
vaadin-framework-b85cc4e7915de55f04809627a628dd0d41792960.zip
Patch for #5100 - TabSheet keyboard navigation
- The active tab button in the tab bar is now focusable by clicking or via tabulator - When the focus is in the tab bar, the tab can be changed with left and right arrow keys - Delete key closes the active focused tab if closable - TODO: programmatic control on server side, configurable keyboard shortcuts svn changeset:23052/svn branch:6.8
Diffstat (limited to 'src/com/vaadin/ui')
-rw-r--r--src/com/vaadin/ui/TabSheet.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/com/vaadin/ui/TabSheet.java b/src/com/vaadin/ui/TabSheet.java
index a13c336943..1275eda69f 100644
--- a/src/com/vaadin/ui/TabSheet.java
+++ b/src/com/vaadin/ui/TabSheet.java
@@ -14,6 +14,10 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.terminal.ErrorMessage;
import com.vaadin.terminal.KeyMapper;
import com.vaadin.terminal.PaintException;
@@ -21,6 +25,7 @@ import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.gwt.client.ui.VTabsheet;
import com.vaadin.terminal.gwt.server.CommunicationManager;
+import com.vaadin.ui.Component.Focusable;
import com.vaadin.ui.themes.Reindeer;
import com.vaadin.ui.themes.Runo;
@@ -55,7 +60,8 @@ import com.vaadin.ui.themes.Runo;
*/
@SuppressWarnings("serial")
@ClientWidget(VTabsheet.class)
-public class TabSheet extends AbstractComponentContainer {
+public class TabSheet extends AbstractComponentContainer implements Focusable,
+ FocusListener, BlurListener {
/**
* List of component tabs (tab contents). In addition to being on this list,
@@ -95,6 +101,8 @@ public class TabSheet extends AbstractComponentContainer {
*/
private CloseHandler closeHandler;
+ private int tabIndex;
+
/**
* Constructs a new Tabsheet. Tabsheet is immediate by default, and the
* default close handler removes the tab being closed.
@@ -363,6 +371,10 @@ public class TabSheet extends AbstractComponentContainer {
target.addAttribute("hidetabs", true);
}
+ if (tabIndex != 0) {
+ target.addAttribute("tabindex", tabIndex);
+ }
+
target.startTag("tabs");
Collection<Component> orphaned = new HashSet<Component>(paintedTabs);
@@ -1226,4 +1238,27 @@ public class TabSheet extends AbstractComponentContainer {
return components.indexOf(tab.getComponent());
}
+ public void blur(BlurEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void focus(FocusEvent event) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void focus() {
+ super.focus();
+ }
+
+ public int getTabIndex() {
+ return tabIndex;
+ }
+
+ public void setTabIndex(int tabIndex) {
+ this.tabIndex = tabIndex;
+ requestRepaint();
+ }
+
}