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.

ButtonHtml.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.vaadin.tests.components.button;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.Button.ClickEvent;
  5. /*
  6. * NOTE This class is arbitrarily picked to represent a legacy application in
  7. * MultipleServletConfigurationTest and the corresponding "Embed App 1" servlet
  8. * configuration. The test will break if this class is refactored to extend UI
  9. * instead of LegacyApplication. Just a friendly warning.
  10. */
  11. public class ButtonHtml extends TestBase {
  12. @Override
  13. protected void setup() {
  14. Button b = new Button("<b>Plain text button</b>");
  15. addComponent(b);
  16. b = new Button(
  17. "<span style=\"color: red; font-weight: bold;\">HTML</span> button");
  18. b.setCaptionAsHtml(true);
  19. addComponent(b);
  20. final Button swapButton = new Button("<i>Swap button<i>");
  21. swapButton.addClickListener(new Button.ClickListener() {
  22. @Override
  23. public void buttonClick(ClickEvent event) {
  24. swapButton.setCaptionAsHtml(!swapButton.isCaptionAsHtml());
  25. }
  26. });
  27. addComponent(swapButton);
  28. }
  29. @Override
  30. protected String getDescription() {
  31. return "Verify that Button HTML rendering works";
  32. }
  33. @Override
  34. protected Integer getTicketNumber() {
  35. return 8663;
  36. }
  37. }