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.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package com.vaadin.tests.components.splitpanel;
  2. import com.vaadin.terminal.Sizeable;
  3. import com.vaadin.tests.components.AbstractTestCase;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.HorizontalLayout;
  6. import com.vaadin.ui.NativeButton;
  7. import com.vaadin.ui.SplitPanel;
  8. import com.vaadin.ui.Window;
  9. import com.vaadin.ui.Button.ClickEvent;
  10. import com.vaadin.ui.Button.ClickListener;
  11. public class SplitPanelExtraScrollbars extends AbstractTestCase implements
  12. ClickListener {
  13. private SplitPanel sp;
  14. private HorizontalLayout hl;
  15. private Button b;
  16. @Override
  17. public void init() {
  18. sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
  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. Window w = new Window("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.addListener(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. public void buttonClick(ClickEvent event) {
  46. if (b.getHeight() == 200) {
  47. b.setHeight("1200px");
  48. } else {
  49. b.setHeight("200px");
  50. }
  51. // Sending all changes in one repaint triggers the bug
  52. hl.requestRepaint();
  53. sp.requestRepaint();
  54. }
  55. }