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.

CustomLayoutUsingTheme.java 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package com.vaadin.tests.components.customlayout;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.tests.util.LoremIpsum;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.Button.ClickEvent;
  6. import com.vaadin.ui.Button.ClickListener;
  7. import com.vaadin.ui.CustomLayout;
  8. import com.vaadin.ui.Label;
  9. import com.vaadin.ui.NativeButton;
  10. import com.vaadin.ui.VerticalLayout;
  11. import com.vaadin.v7.ui.LegacyTextField;
  12. public class CustomLayoutUsingTheme extends TestBase implements ClickListener {
  13. private CustomLayout layout;
  14. @Override
  15. protected void setup() {
  16. setTheme("tests-tickets");
  17. layout = new CustomLayout("Ticket1775");
  18. addComponent(layout);
  19. layout.addComponent(new LegacyTextField("Username"), "loginUser");
  20. layout.addComponent(new LegacyTextField("Password"), "loginPassword");
  21. layout.addComponent(new Button("Login"), "loginButton");
  22. layout.setWidth(null);
  23. VerticalLayout menu = new VerticalLayout();
  24. menu.addComponent(new Button("Set body to label", new ClickListener() {
  25. @Override
  26. public void buttonClick(ClickEvent event) {
  27. layout.addComponent(new Label(LoremIpsum.get(200)), "body");
  28. }
  29. }));
  30. menu.addComponent(new Button("Set body to huge NativeButton",
  31. new ClickListener() {
  32. @Override
  33. public void buttonClick(ClickEvent event) {
  34. layout.addComponent(
  35. new NativeButton("This is it, the body!"),
  36. "body");
  37. }
  38. }));
  39. layout.addComponent(menu, "menu");
  40. }
  41. @Override
  42. protected String getDescription() {
  43. return "Test for using a CustomLayout with a template read from an input stream and passed through the state";
  44. }
  45. @Override
  46. protected Integer getTicketNumber() {
  47. return null;
  48. }
  49. @Override
  50. public void buttonClick(ClickEvent event) {
  51. layout.addComponent(new LegacyTextField("A text field!"), "location2");
  52. }
  53. }