diff options
author | Artur Signell <artur@vaadin.com> | 2012-06-21 15:21:56 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-06-21 17:11:35 +0300 |
commit | bdb89b555123312c1b0f954f8ba05723b7c7a93d (patch) | |
tree | 2243b70ee35e686fe406941765a7afc15892e965 /tests | |
parent | d0eeb5bf53d02b57a58222ad40c07028d0643c96 (diff) | |
download | vaadin-framework-bdb89b555123312c1b0f954f8ba05723b7c7a93d.tar.gz vaadin-framework-bdb89b555123312c1b0f954f8ba05723b7c7a93d.zip |
Store measuredSize in map instead of in DOM in IE8 (#8717)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/orderedlayout/LayoutResizeTest.java | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/LayoutResizeTest.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/LayoutResizeTest.java new file mode 100644 index 0000000000..455c16c425 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/LayoutResizeTest.java @@ -0,0 +1,140 @@ +package com.vaadin.tests.components.orderedlayout; + +import com.vaadin.terminal.ThemeResource; +import com.vaadin.terminal.gwt.client.ui.label.ContentMode; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Embedded; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.HorizontalSplitPanel; +import com.vaadin.ui.JavaScript; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.VerticalSplitPanel; +import com.vaadin.ui.themes.Reindeer; + +public class LayoutResizeTest extends TestBase { + + @Override + protected void setup() { + getLayout().setSizeFull(); + + HorizontalSplitPanel split1 = new HorizontalSplitPanel(); + split1.setSizeFull(); + addComponent(split1); + + VerticalLayout left = new VerticalLayout(); + left.setSizeFull(); + split1.setFirstComponent(left); + + left.setSpacing(true); + left.setMargin(true); + + left.addComponent(new Label("<h2>Layout resize test</h2>", + ContentMode.XHTML)); + + Button resize = new Button("Resize to 700x400", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + JavaScript + .getCurrent() + .execute( + "setTimeout(function() {window.resizeTo(700,400)}, 500)"); + } + }); + left.addComponent(resize); + + resize = new Button("Resize to 900x600", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + JavaScript + .getCurrent() + .execute( + "setTimeout(function() {window.resizeTo(900,600)}, 500)"); + } + }); + left.addComponent(resize); + + left.addComponent(new Label( + "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin vel ante a orci tempus eleifend ut et magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus luctus urna sed urna ultricies.")); + + Table table1 = new Table(); + table1.setSizeFull(); + table1.addContainerProperty("Column", String.class, ""); + for (int i = 1; i <= 100; i++) { + table1.addItem(new Object[] { "Value " + i }, i); + } + left.addComponent(table1); + left.setExpandRatio(table1, 1); + + VerticalSplitPanel split2 = new VerticalSplitPanel(); + split2.setSizeFull(); + split1.setSecondComponent(split2); + + Table table2 = new Table(); + table2.setSizeFull(); + table2.addContainerProperty("Column 1", String.class, ""); + table2.addContainerProperty("Column 2", String.class, ""); + table2.addContainerProperty("Column 3", String.class, ""); + table2.addContainerProperty("Column 4", String.class, ""); + for (int i = 1; i <= 100; i++) { + table2.addItem(new Object[] { "Value " + i, "Value " + i, + "Value " + i, "Value " + i }, i); + } + split2.setFirstComponent(table2); + + VerticalLayout rows = new VerticalLayout(); + rows.setWidth("100%"); + rows.setSpacing(true); + rows.setMargin(true); + for (int i = 1; i <= 100; i++) { + rows.addComponent(getRow(i)); + } + split2.setSecondComponent(rows); + } + + private HorizontalLayout getRow(int i) { + HorizontalLayout row = new HorizontalLayout(); + row.setWidth("100%"); + row.setSpacing(true); + + Embedded icon = new Embedded(null, new ThemeResource( + "../runo/icons/32/document.png")); + row.addComponent(icon); + row.setComponentAlignment(icon, Alignment.MIDDLE_LEFT); + + Label text = new Label( + "Row content #" + + i + + ". In pellentesque faucibus vestibulum. Nulla at nulla justo, eget luctus tortor. Nulla facilisi. Duis aliquet."); + row.addComponent(text); + row.setExpandRatio(text, 1); + + Button button = new Button("Edit"); + button.addStyleName(Reindeer.BUTTON_SMALL); + row.addComponent(button); + row.setComponentAlignment(button, Alignment.MIDDLE_LEFT); + + button = new Button("Delete"); + button.addStyleName(Reindeer.BUTTON_SMALL); + row.addComponent(button); + row.setComponentAlignment(button, Alignment.MIDDLE_LEFT); + + return row; + } + + @Override + protected String getDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} |