選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

FormLayoutInVerticalLayout.java 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. package com.vaadin.tests.components.formlayout;
  17. import com.vaadin.annotations.Theme;
  18. import com.vaadin.server.VaadinRequest;
  19. import com.vaadin.tests.components.AbstractTestUI;
  20. import com.vaadin.ui.CssLayout;
  21. import com.vaadin.ui.FormLayout;
  22. import com.vaadin.ui.Label;
  23. import com.vaadin.ui.TextField;
  24. import com.vaadin.ui.themes.ValoTheme;
  25. /**
  26. * Test UI for H2 label inside FormLayout.
  27. *
  28. * @author Vaadin Ltd
  29. */
  30. @Theme("valo")
  31. public class FormLayoutInVerticalLayout extends AbstractTestUI {
  32. @Override
  33. protected void setup(VaadinRequest request) {
  34. CssLayout container = new CssLayout();
  35. addComponent(container);
  36. FormLayout formLayout = new FormLayout();
  37. Label sectionLabel = createLabel();
  38. formLayout.addComponent(sectionLabel);
  39. TextField nameTextField = new TextField("Name");
  40. nameTextField.setValue("Lorem ipsum");
  41. nameTextField.setWidth("50%");
  42. formLayout.addComponent(nameTextField);
  43. container.addComponent(formLayout);
  44. container.addComponent(createLabel());
  45. }
  46. @Override
  47. protected Integer getTicketNumber() {
  48. return super.getTicketNumber();
  49. }
  50. @Override
  51. protected String getTestDescription() {
  52. return "FormLayout 'margin-top' value should take precedence over "
  53. + "the rule defined in any other selector.";
  54. }
  55. private Label createLabel() {
  56. Label sectionLabel = new Label("Personal info");
  57. sectionLabel.addStyleName(ValoTheme.LABEL_H2);
  58. sectionLabel.addStyleName(ValoTheme.LABEL_COLORED);
  59. return sectionLabel;
  60. }
  61. }