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.

SplitPanelExtraScrollbars.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.vaadin.tests.components.splitpanel;
  2. import com.vaadin.server.Sizeable;
  3. import com.vaadin.tests.components.AbstractTestCase;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.Button.ClickEvent;
  6. import com.vaadin.ui.Button.ClickListener;
  7. import com.vaadin.ui.HorizontalLayout;
  8. import com.vaadin.ui.HorizontalSplitPanel;
  9. import com.vaadin.ui.LegacyWindow;
  10. import com.vaadin.ui.NativeButton;
  11. public class SplitPanelExtraScrollbars extends AbstractTestCase
  12. implements ClickListener {
  13. private HorizontalSplitPanel sp;
  14. private HorizontalLayout hl;
  15. private Button b;
  16. @Override
  17. public void init() {
  18. sp = new HorizontalSplitPanel();
  19. sp.setSizeFull();
  20. sp.setSplitPosition(0, Sizeable.UNITS_PIXELS);
  21. hl = new HorizontalLayout();
  22. hl.setMargin(true);
  23. hl.setWidth("100%");
  24. hl.setHeight(null);
  25. b = createButton("200px");
  26. sp.setSecondComponent(hl);
  27. hl.addComponent(b);
  28. LegacyWindow w = new LegacyWindow("Test", sp);
  29. setMainWindow(w);
  30. }
  31. private Button createButton(String height) {
  32. Button b = new NativeButton("A BIG button");
  33. b.setHeight(height);
  34. b.addClickListener(this);
  35. return b;
  36. }
  37. @Override
  38. protected String getDescription() {
  39. return "Click the button to change its height. Making the button higher than the browser should not cause vertical but not horizontal scrollbars to appear.";
  40. }
  41. @Override
  42. protected Integer getTicketNumber() {
  43. return 3458;
  44. }
  45. @Override
  46. public void buttonClick(ClickEvent event) {
  47. if (b.getHeight() == 200) {
  48. b.setHeight("1200px");
  49. } else {
  50. b.setHeight("200px");
  51. }
  52. // Sending all changes in one repaint triggers the bug
  53. hl.markAsDirty();
  54. sp.markAsDirty();
  55. }
  56. }