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.

FormLayoutInVerticalLayout.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.vaadin.tests.components.formlayout;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractTestUI;
  4. import com.vaadin.ui.CssLayout;
  5. import com.vaadin.ui.FormLayout;
  6. import com.vaadin.ui.Label;
  7. import com.vaadin.ui.themes.ValoTheme;
  8. import com.vaadin.v7.ui.TextField;
  9. /**
  10. * Test UI for H2 label inside FormLayout.
  11. *
  12. * @author Vaadin Ltd
  13. */
  14. public class FormLayoutInVerticalLayout extends AbstractTestUI {
  15. @Override
  16. protected void setup(VaadinRequest request) {
  17. CssLayout container = new CssLayout();
  18. addComponent(container);
  19. FormLayout formLayout = new FormLayout();
  20. Label sectionLabel = createLabel();
  21. formLayout.addComponent(sectionLabel);
  22. TextField nameTextField = new TextField("Name");
  23. nameTextField.setValue("Lorem ipsum");
  24. nameTextField.setWidth("50%");
  25. formLayout.addComponent(nameTextField);
  26. container.addComponent(formLayout);
  27. container.addComponent(createLabel());
  28. }
  29. @Override
  30. protected Integer getTicketNumber() {
  31. return super.getTicketNumber();
  32. }
  33. @Override
  34. protected String getTestDescription() {
  35. return "FormLayout 'margin-top' value should take precedence over "
  36. + "the rule defined in any other selector.";
  37. }
  38. private Label createLabel() {
  39. Label sectionLabel = new Label("Personal info");
  40. sectionLabel.addStyleName(ValoTheme.LABEL_H2);
  41. sectionLabel.addStyleName(ValoTheme.LABEL_COLORED);
  42. return sectionLabel;
  43. }
  44. }