12345678910111213141516171819202122232425262728293031323334353637383940 |
- package com.vaadin.tests.components.orderedlayout;
-
- import com.vaadin.tests.components.TestBase;
- import com.vaadin.ui.Button;
- import com.vaadin.ui.VerticalLayout;
- import com.vaadin.ui.Button.ClickEvent;
-
- public class ReplaceComponentNPE extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3195;
- }
-
- final Button button = new Button("Button");
- final VerticalLayout outer = new VerticalLayout();
-
- @Override
- protected void setup() {
- outer.setMargin(true);
-
- Button changer = new Button("ReplaceComponent");
- changer.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- getLayout().replaceComponent(button, outer);
- outer.addComponent(button);
- }
- });
-
- getLayout().addComponent(button);
- getLayout().addComponent(changer);
-
- }
-
- }
|