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.

AbsoluteLayoutCorrectPositioningOfHiddenField.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.vaadin.tests.components.absolutelayout;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.AbsoluteLayout;
  4. import com.vaadin.ui.AbsoluteLayout.ComponentPosition;
  5. import com.vaadin.ui.Button;
  6. import com.vaadin.ui.Label;
  7. public class AbsoluteLayoutCorrectPositioningOfHiddenField extends TestBase {
  8. @Override
  9. protected void setup() {
  10. setTheme("tests-tickets");
  11. final AbsoluteLayout abs = new AbsoluteLayout();
  12. abs.setStyleName("borders");
  13. abs.setWidth("250px");
  14. abs.setHeight("100px");
  15. final Label l = new Label("Top 20, Left 20");
  16. l.setSizeUndefined();
  17. l.setId("positionedLabel");
  18. l.setVisible(false);
  19. abs.addComponent(l, "top:20px;left:20px");
  20. final Button action = new Button("Set visible");
  21. action.addClickListener(event -> {
  22. if (l.isVisible()) {
  23. l.setValue("Top 70, Left 20");
  24. ComponentPosition position = abs.getPosition(l);
  25. position.setCSSString("top:70px;left:20px;");
  26. abs.setPosition(l, position);
  27. } else {
  28. l.setVisible(true);
  29. action.setCaption("Move down");
  30. }
  31. });
  32. action.setId("actionButton");
  33. abs.addComponent(action, "top: 70px;left: 150px;");
  34. addComponent(abs);
  35. }
  36. @Override
  37. protected String getDescription() {
  38. return "AbsoluteLayout should reposition invisible components when set to visible";
  39. }
  40. @Override
  41. protected Integer getTicketNumber() {
  42. return 10180;
  43. }
  44. }