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.

TextFieldsCssTest.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package com.vaadin.tests.components.uitest.components;
  2. import com.vaadin.tests.components.uitest.TestSampler;
  3. import com.vaadin.ui.Component;
  4. import com.vaadin.ui.GridLayout;
  5. import com.vaadin.ui.PasswordField;
  6. import com.vaadin.ui.RichTextArea;
  7. import com.vaadin.ui.TextArea;
  8. import com.vaadin.ui.TextField;
  9. import com.vaadin.ui.themes.ChameleonTheme;
  10. import com.vaadin.ui.themes.Reindeer;
  11. import com.vaadin.v7.ui.LegacyTextField;
  12. public class TextFieldsCssTest extends GridLayout {
  13. private TestSampler parent;
  14. private int debugIdCounter = 0;
  15. public TextFieldsCssTest(TestSampler parent) {
  16. this.parent = parent;
  17. setSpacing(true);
  18. setColumns(7);
  19. setRows(2);
  20. setWidth("100%");
  21. createTextFieldWith(null, null, null);
  22. createTextFieldWith("Input prompt", null, "Input prompt");
  23. createTextFieldWith("Small", Reindeer.TEXTFIELD_SMALL, null);
  24. createTextFieldWith("Big", ChameleonTheme.TEXTFIELD_BIG, null);
  25. createTextFieldWith("Search", ChameleonTheme.TEXTFIELD_SEARCH, null);
  26. TextArea ta = new TextArea();
  27. ta.setId("textfield" + debugIdCounter++);
  28. addComponent(ta);
  29. PasswordField pf = new PasswordField();
  30. pf.setId("textfield" + debugIdCounter++);
  31. addComponent(pf);
  32. RichTextArea rta = new RichTextArea();
  33. rta.setId("textfield" + debugIdCounter++);
  34. addComponent(rta, 0, 1, 6, 1);
  35. }
  36. private void createTextFieldWith(String caption, String primaryStyleName,
  37. String inputPrompt) {
  38. TextField tf = new TextField();
  39. tf.setId("textfield" + debugIdCounter++);
  40. if (caption != null) {
  41. tf.setCaption(caption);
  42. }
  43. if (primaryStyleName != null) {
  44. tf.addStyleName(primaryStyleName);
  45. }
  46. if (inputPrompt != null) {
  47. tf.setPlaceholder(inputPrompt);
  48. }
  49. addComponent(tf);
  50. }
  51. @Override
  52. public void addComponent(Component c) {
  53. parent.registerComponent(c);
  54. super.addComponent(c);
  55. }
  56. @Override
  57. public void addComponent(Component component, int column1, int row1,
  58. int column2, int row2)
  59. throws OverlapsException, OutOfBoundsException {
  60. parent.registerComponent(component);
  61. super.addComponent(component, column1, row1, column2, row2);
  62. }
  63. }