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.

EmbeddedInCustomComponent.java 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.vaadin.tests.components.customcomponent;
  2. import java.util.Date;
  3. import com.vaadin.server.ThemeResource;
  4. import com.vaadin.tests.components.TestBase;
  5. import com.vaadin.ui.CustomComponent;
  6. import com.vaadin.ui.Embedded;
  7. import com.vaadin.ui.HorizontalLayout;
  8. public class EmbeddedInCustomComponent extends TestBase {
  9. @Override
  10. protected void setup() {
  11. HorizontalLayout hl = new HorizontalLayout();
  12. hl.addComponent(wrap("An uncached image",
  13. "ok.png?random=" + new Date().getTime()));
  14. hl.addComponent(wrap("A cached image", "cancel.png"));
  15. addComponent(hl);
  16. }
  17. private CustomComponent wrap(String caption, String themeImage) {
  18. Embedded image = new Embedded(caption,
  19. new ThemeResource("../runo/icons/64/" + themeImage));
  20. CustomComponent cc = new CustomComponent(image);
  21. return cc;
  22. }
  23. @Override
  24. protected String getDescription() {
  25. return "Two embedded images are shown below, side-by-side. The first one has a random url so it is not cached, the second one is cached.";
  26. }
  27. @Override
  28. protected Integer getTicketNumber() {
  29. return 6304;
  30. }
  31. }