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.

DefaultCaptionWidth.java 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.vaadin.tests.components.colorpicker;
  2. import com.vaadin.annotations.Widgetset;
  3. import com.vaadin.server.VaadinRequest;
  4. import com.vaadin.tests.components.AbstractReindeerTestUI;
  5. import com.vaadin.ui.Button;
  6. import com.vaadin.ui.ColorPicker;
  7. /**
  8. * Test for color picker with default caption.
  9. *
  10. * @author Vaadin Ltd
  11. */
  12. @Widgetset("com.vaadin.DefaultWidgetSet")
  13. public class DefaultCaptionWidth extends AbstractReindeerTestUI {
  14. @Override
  15. protected void setup(VaadinRequest request) {
  16. final ColorPicker colorPicker = new ColorPicker();
  17. addComponent(colorPicker);
  18. colorPicker.setDefaultCaptionEnabled(true);
  19. Button setWidth = new Button("Set explicit width", event -> {
  20. colorPicker.setCaption(null);
  21. colorPicker.setWidth("150px");
  22. });
  23. setWidth.addStyleName("set-width");
  24. addComponent(setWidth);
  25. Button setCaption = new Button("Set explicit caption", event -> {
  26. colorPicker.setCaption("caption");
  27. colorPicker.setWidthUndefined();
  28. });
  29. setCaption.addStyleName("set-caption");
  30. addComponent(setCaption);
  31. }
  32. @Override
  33. protected String getTestDescription() {
  34. return "Color picker with default caption enabled should get appropriate style";
  35. }
  36. @Override
  37. protected Integer getTicketNumber() {
  38. return 17140;
  39. }
  40. }