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.

FormLayoutCaptionStyles.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.vaadin.tests.components.formlayout;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.FormLayout;
  5. import com.vaadin.v7.ui.TextField;
  6. public class FormLayoutCaptionStyles extends TestBase {
  7. @Override
  8. protected void setup() {
  9. setTheme("reindeer-tests");
  10. FormLayout fl = new FormLayout();
  11. TextField f1 = createTextField("Text field 1", "");
  12. final TextField f2 = createTextField("Text field 2", "bold");
  13. fl.addComponent(f1);
  14. fl.addComponent(new Button("Toggle Text field 2 bold style", event -> {
  15. if ("bold".equals(f2.getStyleName())) {
  16. f2.setStyleName("");
  17. } else {
  18. f2.setStyleName("bold");
  19. }
  20. }));
  21. fl.addComponent(f2);
  22. addComponent(fl);
  23. }
  24. private TextField createTextField(String caption, String style) {
  25. TextField tf = new TextField(caption);
  26. tf.setStyleName(style);
  27. return tf;
  28. }
  29. @Override
  30. protected String getDescription() {
  31. return "The component style should be copied to the caption element. Changing the component style should update the caption style also";
  32. }
  33. @Override
  34. protected Integer getTicketNumber() {
  35. return 5982;
  36. }
  37. }