You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ButtonTabIndex.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.components.button;
  17. import com.vaadin.tests.components.TestBase;
  18. import com.vaadin.ui.Button;
  19. import com.vaadin.ui.NativeButton;
  20. import com.vaadin.v7.ui.TextField;
  21. public class ButtonTabIndex extends TestBase {
  22. @Override
  23. protected void setup() {
  24. TextField tf1 = new TextField("Tab index 0");
  25. tf1.setTabIndex(0);
  26. TextField tf2 = new TextField("Tab index -1, focused initially");
  27. tf2.setTabIndex(-1);
  28. tf2.focus();
  29. addComponent(tf1);
  30. addComponent(tf2);
  31. addComponent(createButton(1));
  32. addComponent(createButton(5));
  33. addComponent(createNativeButton(3));
  34. addComponent(createButton(4));
  35. addComponent(createNativeButton(2));
  36. }
  37. private Button createButton(int i) {
  38. Button b = new Button("Button with tab index " + i);
  39. b.setTabIndex(i);
  40. return b;
  41. }
  42. private NativeButton createNativeButton(int i) {
  43. NativeButton b = new NativeButton("NativeButton with tab index " + i);
  44. b.setTabIndex(i);
  45. return b;
  46. }
  47. @Override
  48. protected String getDescription() {
  49. return "Test for tab indexes for Button and NativeButton";
  50. }
  51. @Override
  52. protected Integer getTicketNumber() {
  53. return 9022;
  54. }
  55. }