Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

TabSheetWithTabIds.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright 2000-2014 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. /**
  17. *
  18. */
  19. package com.vaadin.tests.components.tabsheet;
  20. import com.vaadin.server.VaadinRequest;
  21. import com.vaadin.tests.components.AbstractTestUI;
  22. import com.vaadin.ui.Button;
  23. import com.vaadin.ui.Button.ClickEvent;
  24. import com.vaadin.ui.Label;
  25. import com.vaadin.ui.TabSheet;
  26. import com.vaadin.ui.TabSheet.Tab;
  27. public class TabSheetWithTabIds extends AbstractTestUI {
  28. @Override
  29. protected void setup(VaadinRequest request) {
  30. TabSheet tabSheet = new TabSheet();
  31. final Tab tab1 = tabSheet.addTab(new Label("Label 1"), "Tab 1", null);
  32. final Tab tab2 = tabSheet.addTab(new Label("Label 2"), "Tab 2", null);
  33. final Tab tab3 = tabSheet.addTab(new Label("Label 3"), "Tab 3", null);
  34. addComponent(tabSheet);
  35. Button b = new Button("Set ids", new Button.ClickListener() {
  36. @Override
  37. public void buttonClick(ClickEvent event) {
  38. tab1.setId("tab1");
  39. tab2.setId("tab2");
  40. tab3.setId("tab3");
  41. }
  42. });
  43. addComponent(b);
  44. Button b2 = new Button("Clear ids", new Button.ClickListener() {
  45. @Override
  46. public void buttonClick(ClickEvent event) {
  47. tab1.setId(null);
  48. tab2.setId(null);
  49. tab3.setId(null);
  50. }
  51. });
  52. addComponent(b2);
  53. }
  54. @Override
  55. protected String getTestDescription() {
  56. return "Add support for setId to TabSheet.Tab";
  57. }
  58. @Override
  59. protected Integer getTicketNumber() {
  60. return 12064;
  61. }
  62. }