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.

CustomLayoutPrimaryStyleName.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.vaadin.tests.components.customlayout;
  2. import java.io.ByteArrayInputStream;
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import com.vaadin.tests.components.TestBase;
  6. import com.vaadin.ui.Button;
  7. import com.vaadin.ui.Button.ClickEvent;
  8. import com.vaadin.ui.CustomLayout;
  9. import com.vaadin.v7.ui.LegacyTextField;
  10. public class CustomLayoutPrimaryStyleName extends TestBase {
  11. @Override
  12. protected void setup() {
  13. InputStream is = new ByteArrayInputStream(
  14. "<div location='loc1'>".getBytes());
  15. try {
  16. final CustomLayout cl = new CustomLayout(is);
  17. cl.addComponent(new LegacyTextField("Hello world"), "loc1");
  18. cl.setPrimaryStyleName("my-customlayout");
  19. addComponent(cl);
  20. addComponent(new Button("Set primary stylename",
  21. new Button.ClickListener() {
  22. @Override
  23. public void buttonClick(ClickEvent event) {
  24. cl.setPrimaryStyleName("my-second-customlayout");
  25. }
  26. }));
  27. } catch (IOException e) {
  28. // TODO Auto-generated catch block
  29. e.printStackTrace();
  30. }
  31. }
  32. @Override
  33. protected String getDescription() {
  34. return "CustomLayout should support primary stylenames both initially and dynamically";
  35. }
  36. @Override
  37. protected Integer getTicketNumber() {
  38. return 9902;
  39. }
  40. }