diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-02-10 11:29:40 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-02-10 11:29:40 +0200 |
commit | f4e19c674b02b41fa1c96e14e96ca4e87caff2a0 (patch) | |
tree | 07c606876ae0c7734aee4325a4ce8a7e95b944fc /tests | |
parent | 124f5b32e25c311b70be60d90d9790d9135eefa5 (diff) | |
download | vaadin-framework-f4e19c674b02b41fa1c96e14e96ca4e87caff2a0.tar.gz vaadin-framework-f4e19c674b02b41fa1c96e14e96ca4e87caff2a0.zip |
Update CssLayout to use MeasureManager (#8313)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/panel/BasicPanelTest.java | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/panel/BasicPanelTest.java b/tests/testbench/com/vaadin/tests/components/panel/BasicPanelTest.java new file mode 100644 index 0000000000..d23e317572 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/panel/BasicPanelTest.java @@ -0,0 +1,88 @@ +package com.vaadin.tests.components.panel; + +import java.util.Map; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Panel; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.themes.Reindeer; + +public class BasicPanelTest extends TestBase { + private final Label scrollPosition = new Label(); + private final Panel panel = new Panel("Panel caption") { + @Override + public void changeVariables(Object source, Map<String, Object> variables) { + super.changeVariables(source, variables); + updateLabelText(); + } + }; + + @Override + protected void setup() { + getLayout().setWidth("600px"); + getLayout().setHeight("100%"); + + HorizontalLayout actions = new HorizontalLayout(); + actions.setSpacing(true); + + actions.addComponent(scrollPosition); + actions.addComponent(new Button("Sync")); + + final CheckBox heightSelection = new CheckBox("Undefined height"); + heightSelection.setImmediate(true); + heightSelection.addListener(new ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + if (heightSelection.getValue() == Boolean.TRUE) { + panel.setHeight(null); + } else { + panel.setHeight("100%"); + } + } + }); + actions.addComponent(heightSelection); + + panel.setWidth("200px"); + panel.setHeight("100%"); + panel.setStyleName(Reindeer.PANEL_LIGHT); + + panel.getContent().setCaption("Content caption"); + + TextArea textArea = new TextArea("TextArea caption"); + textArea.setWidth("300px"); + textArea.setHeight("500px"); + panel.addComponent(textArea); + + getLayout().addComponent(actions); + getLayout().addComponent(panel); + getLayout().setExpandRatio(panel, 1); + + panel.setScrollable(true); + panel.setScrollTop(50); + panel.setScrollLeft(50); + panel.setImmediate(true); + + updateLabelText(); + } + + private void updateLabelText() { + scrollPosition.setValue("Scrolled to " + panel.getScrollTop()); + } + + @Override + protected String getDescription() { + return "Simple test for basic panel functionality"; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} |