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.

CheckBoxes.java 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.vaadin.tests.components.checkbox;
  2. import java.util.Date;
  3. import com.vaadin.server.Resource;
  4. import com.vaadin.server.ThemeResource;
  5. import com.vaadin.tests.components.ComponentTestCase;
  6. import com.vaadin.ui.CheckBox;
  7. public class CheckBoxes extends ComponentTestCase<CheckBox> {
  8. private ThemeResource SMALL_ICON = new ThemeResource(
  9. "../runo/icons/16/ok.png");
  10. private ThemeResource LARGE_ICON = new ThemeResource(
  11. "../runo/icons/64/document.png");
  12. private ThemeResource LARGE_ICON_NOCACHE = new ThemeResource(
  13. "../runo/icons/64/document.png?" + new Date().getTime());
  14. @Override
  15. protected Class<CheckBox> getTestClass() {
  16. return CheckBox.class;
  17. }
  18. @Override
  19. protected void initializeComponents() {
  20. setTheme("tests-tickets");
  21. CheckBox cb;
  22. cb = createCheckBox("CheckBox with normal text");
  23. addTestComponent(cb);
  24. cb = createCheckBox("CheckBox with large text");
  25. cb.setStyleName("large");
  26. addTestComponent(cb);
  27. cb = createCheckBox("CheckBox with normal text and small icon",
  28. SMALL_ICON);
  29. addTestComponent(cb);
  30. cb = createCheckBox("CheckBox with large text and small icon",
  31. SMALL_ICON);
  32. cb.setStyleName("large");
  33. addTestComponent(cb);
  34. cb = createCheckBox("CheckBox with normal text and large icon",
  35. LARGE_ICON);
  36. addTestComponent(cb);
  37. cb = createCheckBox("CheckBox with large text and large icon",
  38. LARGE_ICON_NOCACHE);
  39. cb.setStyleName("large");
  40. addTestComponent(cb);
  41. }
  42. private CheckBox createCheckBox(String caption, Resource icon) {
  43. CheckBox cb = createCheckBox(caption);
  44. cb.setIcon(icon);
  45. return cb;
  46. }
  47. private CheckBox createCheckBox(String caption) {
  48. return new CheckBox(caption);
  49. }
  50. @Override
  51. protected String getDescription() {
  52. return "A generic test for CheckBoxes in different configurations";
  53. }
  54. @Override
  55. protected Integer getTicketNumber() {
  56. return null;
  57. }
  58. }