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.

LongNotifications.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package com.vaadin.tests.components.window;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.Notification;
  5. public class LongNotifications extends TestBase {
  6. private final String text = "This is a veeeery large notification in the main window which should definitly not exist at all, in any app. But they finally do in real world applications, no matter what you do. People have small screens and desperatly try to run web apps in their iphones.";
  7. @Override
  8. protected String getDescription() {
  9. return "Notifications should not be wider than the screen.";
  10. }
  11. @Override
  12. protected Integer getTicketNumber() {
  13. return 2632;
  14. }
  15. @Override
  16. protected void setup() {
  17. setTheme("tests-tickets");
  18. Button b = new Button("Show loooong notification",
  19. event -> getMainWindow().showNotification(text,
  20. "This is description for the same notifications."
  21. + text,
  22. Notification.TYPE_HUMANIZED_MESSAGE));
  23. getLayout().addComponent(b);
  24. b = new Button("Show notifications",
  25. event -> getMainWindow().showNotification("Example failed",
  26. "This is description for the same notifications.",
  27. Notification.TYPE_HUMANIZED_MESSAGE));
  28. getLayout().addComponent(b);
  29. b = new Button("Show loooong notification (error)",
  30. event -> getMainWindow().showNotification(text,
  31. "This is description for the same notifications."
  32. + text,
  33. Notification.TYPE_ERROR_MESSAGE));
  34. getLayout().addComponent(b);
  35. b = new Button("Show notification (error)",
  36. event -> getMainWindow().showNotification("Example failed",
  37. "This is description for the same notifications.",
  38. Notification.TYPE_ERROR_MESSAGE));
  39. getLayout().addComponent(b);
  40. }
  41. }