From ccdc34051d6c74292ce981f66c31c160620a04da Mon Sep 17 00:00:00 2001 From: Dmitrii Rogozin Date: Tue, 3 Jun 2014 14:51:42 +0300 Subject: [PATCH] Refactored Layout tests. Remove errors (#13823) Split tests into separate classes. Create hierarcy for tests. Change-Id: I71e20a5410612f9a246bab051173e60768532185 --- .../layouttester/AbstractLayoutTests.java | 30 - .../layouttester/BaseAddReplaceMove.java | 109 +++ .../layouttester/BaseAddReplaceMoveTest.java | 43 ++ .../layouts/layouttester/BaseAlignment.java | 67 ++ .../layouttester/BaseAlignmentTest.java | 36 + .../layouts/layouttester/BaseCaption.java | 44 ++ .../layouts/layouttester/BaseCaptionTest.java | 35 + .../layouttester/BaseComponentSizing.java | 38 + .../layouttester/BaseComponentSizingTest.java | 45 ++ .../tests/layouts/layouttester/BaseIcon.java | 51 ++ .../layouts/layouttester/BaseIconTest.java | 37 + .../layouttester/BaseLayoutExpand.java | 77 ++ .../layouttester/BaseLayoutExpandTest.java | 49 ++ .../BaseLayoutForSpacingMargin.java | 81 +++ .../BaseLayoutMarginSpacingTest.java | 42 ++ .../layouttester/BaseLayoutRegErrorTest.java | 37 + .../layouttester/BaseLayoutSizing.java | 40 ++ .../layouttester/BaseLayoutSizingTest.java | 50 ++ .../layouttester/BaseLayoutTestUI.java | 288 ++++++++ .../layouts/layouttester/BaseRegError.java | 60 ++ .../GridLayout/GridAddReplaceMove.java | 105 +++ .../GridLayout/GridAddReplaceMoveTest.java | 27 + .../GridLayout/GridAlignment.java | 41 ++ .../GridLayout/GridAlignmentTest.java | 21 + .../GridLayout/GridBaseLayoutTestUI.java | 107 +++ .../layouttester/GridLayout/GridCaption.java | 35 + .../GridLayout/GridCaptionTest.java | 27 + .../GridLayout/GridComponentSizing.java | 32 + .../GridLayout/GridComponentSizingTest.java | 22 + .../layouttester/GridLayout/GridIcon.java | 42 ++ .../layouttester/GridLayout/GridIconTest.java | 27 + .../GridLayout/GridLayoutExpand.java | 64 ++ .../GridLayout/GridLayoutExpandTest.java | 26 + .../GridLayout/GridLayoutMarginSpacing.java | 74 ++ .../GridLayoutMarginSpacingTest.java | 27 + .../GridLayout/GridLayoutRegError.java | 54 ++ .../GridLayout/GridLayoutRegErrorTest.java | 27 + .../GridLayout/GridLayoutSizing.java | 32 + .../GridLayout/GridLayoutSizingTest.java | 27 + .../layouts/layouttester/GridLayoutTests.java | 657 ------------------ .../layouttester/HLayout/HAddReplaceMove.java | 32 + .../HLayout/HAddReplaceMoveTest.java | 22 + .../layouttester/HLayout/HAlignment.java | 27 + .../layouttester/HLayout/HAlignmentTest.java | 21 + .../layouttester/HLayout/HCaption.java | 32 + .../layouttester/HLayout/HCaptionTest.java | 22 + .../HLayout/HComponentSizing.java | 36 + .../HLayout/HComponentSizingTest.java | 21 + .../layouts/layouttester/HLayout/HIcon.java | 37 + .../layouttester/HLayout/HIconTest.java | 21 + .../layouttester/HLayout/HLayoutExpand.java | 36 + .../HLayout/HLayoutExpandTest.java | 21 + .../HLayout/HLayoutMarginSpacing.java | 37 + .../HLayout/HLayoutMarginSpacingTest.java | 22 + .../layouttester/HLayout/HLayoutRegError.java | 36 + .../HLayout/HLayoutRegErrorTest.java | 21 + .../layouttester/HLayout/HLayoutSizing.java | 36 + .../HLayout/HLayoutSizingTest.java | 22 + .../layouttester/HorizontalLayoutTests.java | 597 ---------------- .../layouttester/LayoutTesterApplication.java | 147 ---- .../LayoutTesterApplicationTest.java | 132 ---- .../layouttester/VLayout/VAddReplaceMove.java | 36 + .../VLayout/VAddReplaceMoveTest.java | 27 + .../layouttester/VLayout/VAlignment.java | 25 + .../layouttester/VLayout/VAlignmentTest.java | 21 + .../layouttester/VLayout/VCaption.java | 38 + .../layouttester/VLayout/VCaptionTest.java | 27 + .../VLayout/VComponentSizing.java | 37 + .../VLayout/VComponentSizingTest.java | 21 + .../layouts/layouttester/VLayout/VIcon.java | 37 + .../layouttester/VLayout/VIconTest.java | 21 + .../layouttester/VLayout/VLayoutExpand.java | 37 + .../VLayout/VLayoutExpandTest.java | 27 + .../VLayout/VLayoutMarginSpacing.java | 37 + .../VLayout/VLayoutMarginSpacingTest.java | 22 + .../layouttester/VLayout/VLayoutRegError.java | 36 + .../VLayout/VLayoutRegErrorTest.java | 27 + .../layouttester/VLayout/VLayoutSizing.java | 37 + .../VLayout/VLayoutSizingTest.java | 27 + .../layouttester/VerticalLayoutTests.java | 634 ----------------- 80 files changed, 3088 insertions(+), 2197 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMoveTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignment.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignmentTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaption.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaptionTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseIcon.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseIconTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpandTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutMarginSpacingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutRegErrorTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/BaseRegError.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMoveTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignmentTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaption.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaptionTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIconTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpandTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegErrorTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizingTest.java delete mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMoveTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignmentTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaptionTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIconTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpand.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpandTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegErrorTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizingTest.java delete mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java delete mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java delete mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMove.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMoveTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignmentTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaption.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaptionTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIconTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpand.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacingTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java delete mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java deleted file mode 100644 index c96d542a4c..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/AbstractLayoutTests.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.layouts.layouttester; - -import com.vaadin.ui.Layout; - -public abstract class AbstractLayoutTests { - - protected static final String FOLDER_16_PNG = "../icons/runo/16/folder.png"; - protected static final String CALENDAR_32_PNG = "../runo/icons/32/calendar.png"; - protected static final String LOCK_16_PNG = "../runo/icons/16/lock.png"; - protected static final String GLOBE_16_PNG = "../runo/icons/16/globe.png"; - - abstract protected Layout getCaptionsTests(); - - abstract protected Layout getIconsTests(); - - abstract protected Layout getRequiredErrorIndicatorsTests(); - - abstract protected Layout getAlignmentTests(); - - abstract protected Layout getExpandRatiosTests(); - - abstract protected Layout getMarginSpacingTests(); - - abstract protected Layout getComponentAddReplaceMoveTests(); - - abstract protected Layout getComponentSizingTests(); - - abstract protected Layout getLayoutSizingTests(); - -} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java new file mode 100644 index 0000000000..7ea8739cf4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java @@ -0,0 +1,109 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.TextField; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseAddReplaceMove extends BaseLayoutTestUI { + + /** + * @param layoutClass + */ + public BaseAddReplaceMove(Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + // Set undefined height to avoid expanding + l2.setHeight(null); + // extra layout from which components will be moved + final HorizontalLayout source = new HorizontalLayout(); + source.addComponent(new Label("OTHER LABEL 1")); + source.addComponent(new Label("OTHER LABEL 2")); + + final AbstractComponent c1 = new Label("LABEL", ContentMode.HTML); + final AbstractComponent c2 = new Label("LABEL", ContentMode.HTML); + final AbstractComponent c3 = new Table("TABLE"); + c3.setHeight("100px"); + c3.setWidth("100%"); + + final Button btnAdd = new Button("Test add"); + final Button btnReplace = new Button("Test replace"); + final Button btnMove = new Button("Test move"); + final Button btnRemove = new Button("Test remove"); + + l1.addComponent(btnAdd); + l1.addComponent(btnReplace); + l1.addComponent(btnMove); + l1.addComponent(btnRemove); + + btnAdd.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + l2.addComponent(new TextField()); + } + }); + btnReplace.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + l2.replaceComponent(c1, c3); + } + }); + btnMove.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + l2.moveComponentsFrom(source); + } + }); + btnRemove.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + l2.removeComponent(c1); + l2.removeComponent(c2); + } + }); + + l2.addComponent(c1); + l2.addComponent(c2); + l2.addComponent(c3); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMoveTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMoveTest.java new file mode 100644 index 0000000000..73dc39009d --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMoveTest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public abstract class BaseAddReplaceMoveTest extends MultiBrowserTest { + @Test + public void LayoutAlignment() throws IOException, InterruptedException { + openTestURL(); + sleep(500); + compareScreen("initial"); + String[] states = { "add", "replace", "move", "remove" }; + List buttons = $(ButtonElement.class).all(); + int index = 0; + // go through all buttons click them and see result + for (ButtonElement btn : buttons) { + btn.click(); + sleep(500); + compareScreen(states[index]); + index++; + } + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignment.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignment.java new file mode 100644 index 0000000000..bfdc53bf7c --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignment.java @@ -0,0 +1,67 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractOrderedLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ +abstract public class BaseAlignment extends BaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + // create two columns of components with different + // alignment. Used to test alignment in layouts + init(); + buildLayout(); + super.setup(request); + } + + public BaseAlignment(Class layoutClass) { + super(layoutClass); + } + + /** + * Build Layout for test + */ + private void buildLayout() { + for (int i = 0; i < components.length; i++) { + AbstractOrderedLayout layout = null; + try { + layout = (AbstractOrderedLayout) layoutClass.newInstance(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + layout.setHeight("300px"); + layout.setWidth("200px"); + layout.addComponent(components[i]); + layout.setComponentAlignment(components[i], alignments[i]); + if (i < components.length / 2) { + l1.addComponent(layout); + } else { + l2.addComponent(layout); + } + } + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignmentTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignmentTest.java new file mode 100644 index 0000000000..9dd90a4031 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseAlignmentTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public abstract class BaseAlignmentTest extends MultiBrowserTest { + + @Test + public void layoutAlignment() throws IOException { + openTestURL(); + compareScreen("alignment"); + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaption.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaption.java new file mode 100644 index 0000000000..37ce77e745 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaption.java @@ -0,0 +1,44 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.TabSheet; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseCaption extends BaseLayoutTestUI { + + /** + * @param layoutClass + */ + public BaseCaption(Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + l1.addComponent(createLabelsFields(ComboBox.class, true, "")); + l2.addComponent(createLabelsFields(TabSheet.class, false, "")); + super.setup(request); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaptionTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaptionTest.java new file mode 100644 index 0000000000..ed20657e2a --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseCaptionTest.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public abstract class BaseCaptionTest extends MultiBrowserTest { + @Test + public void LayoutCaption() throws IOException, InterruptedException { + openTestURL(); + compareScreen("caption"); + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizing.java new file mode 100644 index 0000000000..d9377c6a8b --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizing.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseComponentSizing extends BaseLayoutTestUI { + + public BaseComponentSizing(Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + getLayoutForLayoutSizing("component"); + super.setup(request); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizingTest.java new file mode 100644 index 0000000000..252cfcd359 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseComponentSizingTest.java @@ -0,0 +1,45 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public abstract class BaseComponentSizingTest extends MultiBrowserTest { + @Test + public void ComponentSizing() throws IOException, InterruptedException { + openTestURL(); + sleep(500); + compareScreen("initial"); + String[] states = { "setSize350px", "setSize_-1px", "setSize75Percent", + "setSize100Percent" }; + List buttons = $(ButtonElement.class).all(); + int index = 0; + // go through all buttons click them and see result + for (ButtonElement btn : buttons) { + btn.click(); + sleep(500); + compareScreen(states[index]); + index++; + } + } + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseIcon.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseIcon.java new file mode 100644 index 0000000000..34ec7928ff --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseIcon.java @@ -0,0 +1,51 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.Button; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Label; +import com.vaadin.ui.Link; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TextField; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseIcon extends BaseLayoutTestUI { + /** + * @param layoutClass + */ + public BaseIcon(Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + l1.addComponent(createLabelsFields(TextField.class, true, "")); + l1.addComponent(createLabelsFields(Label.class, true, "")); + l1.addComponent(createLabelsFields(Button.class, true, "")); + l2.addComponent(createLabelsFields(ComboBox.class, true, "")); + l2.addComponent(createLabelsFields(Link.class, true, "")); + l2.addComponent(createLabelsFields(TabSheet.class, true, "")); + super.setup(request); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseIconTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseIconTest.java new file mode 100644 index 0000000000..9322672eae --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseIconTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public abstract class BaseIconTest extends MultiBrowserTest { + + @Test + public void LayoutIcon() throws IOException { + openTestURL(); + compareScreen("icon"); + } + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java new file mode 100644 index 0000000000..f21db94f80 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpand.java @@ -0,0 +1,77 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.Button; +import com.vaadin.ui.Table; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseLayoutExpand extends BaseLayoutTestUI { + + public BaseLayoutExpand(Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + class ExpandButton extends Button { + final private AbstractComponent c1; + private AbstractComponent c2; + private float expandComp1; + private float expandComp2; + + public ExpandButton(final AbstractComponent c1, + final AbstractComponent c2, float e1, float e2) { + super(); + this.c1 = c1; + this.c2 = c2; + expandComp1 = e1; + expandComp2 = e2; + setCaption("Expand ratio: " + e1 * 100 + " /" + e2 * 100); + addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + l2.setExpandRatio(c1, expandComp1); + l2.setExpandRatio(c2, expandComp2); + } + }); + } + } + Table t1 = getTestTable(); + Table t2 = getTestTable(); + t1.setSizeFull(); + t2.setSizeFull(); + l2.addComponent(t1); + l2.addComponent(t2); + + l1.addComponent(new ExpandButton(t1, t2, 1.0f, 0.0f)); + l1.addComponent(new ExpandButton(t1, t2, 0.5f, 0.50f)); + l1.addComponent(new ExpandButton(t1, t2, .25f, 0.75f)); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpandTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpandTest.java new file mode 100644 index 0000000000..08f5aed808 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutExpandTest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public abstract class BaseLayoutExpandTest extends MultiBrowserTest { + + @Test + public void LayoutExpand() throws IOException, InterruptedException { + openTestURL(); + sleep(500); + compareScreen("initial"); + String[] states = { "expand_100_0", "expand_50_50", "expand_25_75" }; + List buttons = $(ButtonElement.class).all(); + int index = 0; + // go through all buttons click them and see result + for (ButtonElement btn : buttons) { + btn.click(); + sleep(500); + compareScreen(states[index]); + index++; + } + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java new file mode 100644 index 0000000000..e98573d170 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java @@ -0,0 +1,81 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseLayoutForSpacingMargin extends BaseLayoutTestUI { + /** + * @param layoutClass + */ + public BaseLayoutForSpacingMargin( + Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + Table t1 = getTestTable(); + Table t2 = getTestTable(); + t1.setSizeFull(); + t2.setSizeFull(); + l2.addComponent(t1); + l2.setMargin(false); + l2.setSpacing(false); + // Must add something around the hr to avoid the margins collapsing + l2.addComponent(new Label( + "

", + ContentMode.HTML)); + l2.addComponent(t2); + final Button btn1 = new Button("Toggle margin on/off"); + btn1.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + boolean margin = l2.getMargin().hasLeft(); + l2.setMargin(!margin); + + } + }); + final Button btn2 = new Button("Toggle spacing on/off"); + btn2.addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + l2.setSpacing(!l2.isSpacing()); + } + }); + l1.addComponent(btn1); + l1.addComponent(btn2); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutMarginSpacingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutMarginSpacingTest.java new file mode 100644 index 0000000000..46edfec986 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutMarginSpacingTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public abstract class BaseLayoutMarginSpacingTest extends MultiBrowserTest { + + @Test + public void LayoutMarginSpacing() throws IOException, InterruptedException { + openTestURL(); + sleep(500); + compareScreen("initial"); + String[] states = { "marginOnSpaceOff", "marginOnfSpaceOn" }; + ButtonElement marginBtn = $(ButtonElement.class).get(0); + ButtonElement spaceBtn = $(ButtonElement.class).get(1); + marginBtn.click(); + sleep(1000); + compareScreen(states[0]); + spaceBtn.click(); + sleep(1000); + compareScreen(states[1]); + } +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutRegErrorTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutRegErrorTest.java new file mode 100644 index 0000000000..61d6f8a362 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutRegErrorTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; + +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public abstract class BaseLayoutRegErrorTest extends MultiBrowserTest { + + @Test + public void LayoutRegError() throws IOException { + openTestURL(); + compareScreen("RegError"); + } + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizing.java new file mode 100644 index 0000000000..edc0b275d1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizing.java @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseLayoutSizing extends BaseLayoutTestUI { + /** + * @param layoutClass + */ + public BaseLayoutSizing(Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + getLayoutForLayoutSizing("layout"); + super.setup(request); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizingTest.java new file mode 100644 index 0000000000..e97353c989 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutSizingTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public abstract class BaseLayoutSizingTest extends MultiBrowserTest { + @Test + public void LayoutSizing() throws IOException, InterruptedException { + openTestURL(); + sleep(500); + compareScreen("initial"); + String[] states = { "setSize350px", "setSize_-1px", "setSize75Percent", + "setSize100Percent" }; + List buttons = $(ButtonElement.class).all(); + int index = 0; + // go through all buttons click them and see result + for (ButtonElement btn : buttons) { + btn.click(); + sleep(500); + compareScreen(states[index]); + index++; + } + } + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java new file mode 100644 index 0000000000..02fcb677cd --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java @@ -0,0 +1,288 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.Resource; +import com.vaadin.server.ThemeResource; +import com.vaadin.server.UserError; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.AbstractOrderedLayout; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.Table; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; + +/** + * + * Base class for Layout tests. + */ +public abstract class BaseLayoutTestUI extends AbstractTestUI { + protected static final String FOLDER_16_PNG = "../icons/runo/16/folder.png"; + protected static final String CALENDAR_32_PNG = "../runo/icons/16/calendar.png"; + protected static final String LOCK_16_PNG = "../runo/icons/16/lock.png"; + protected static final String GLOBE_16_PNG = "../runo/icons/16/globe.png"; + public Alignment[] alignments = new Alignment[] { Alignment.TOP_CENTER, + Alignment.TOP_LEFT, Alignment.TOP_RIGHT, Alignment.BOTTOM_CENTER, + Alignment.BOTTOM_LEFT, Alignment.BOTTOM_RIGHT, + Alignment.MIDDLE_CENTER, Alignment.MIDDLE_LEFT, + Alignment.MIDDLE_RIGHT }; + + public final String[] CAPTIONS = new String[] { "", + "VeryLongOneWordCaption", + "Very long caption of 50 approximately symbols aaaaaaaaaaaa aaaaaa aaa " }; + Resource[] ICONS = new Resource[] { new ThemeResource(CALENDAR_32_PNG), + new ThemeResource(LOCK_16_PNG), new ThemeResource(GLOBE_16_PNG) }; + public AbstractComponent[] components = new AbstractComponent[alignments.length]; + + protected AbstractOrderedLayout l1; + protected AbstractOrderedLayout l2; + protected Class layoutClass; + protected VerticalLayout mainLayout = new VerticalLayout(); + + public BaseLayoutTestUI(Class layoutClass) { + super(); + fillComponents(); + this.layoutClass = layoutClass; + + } + + protected void init() { + try { + l1 = (AbstractOrderedLayout) layoutClass.newInstance(); + l2 = (AbstractOrderedLayout) layoutClass.newInstance(); + } catch (InstantiationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IllegalAccessException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if (layoutClass.equals(HorizontalLayout.class)) { + setLayoutMeasures(l1, l2, "600px", "400px"); + } else if (layoutClass.equals(VerticalLayout.class)) { + setLayoutMeasures(l1, l2, "400px", "400px"); + } else { + setDefaultForVertical(l1, l2); + } + } + + private void fillComponents() { + for (int i = 0; i < components.length; i++) { + String name = "Field" + i; + TextField field = new TextField(); + field.setValue(name); + components[i] = field; + } + } + + protected AbstractLayout createLabelsFields( + Class compType) { + return createLabelsFields(compType, false, null); + } + + protected void getLayoutForLayoutSizing(final String compType) { + + l2.setSpacing(false); + l2.setMargin(false); + + final AbstractComponent c1 = getTestTable(); + c1.setSizeFull(); + final AbstractComponent c2 = getTestTable(); + c2.setSizeFull(); + + class SetSizeButton extends Button { + SetSizeButton(final String size) { + super(); + setCaption("Set size " + size); + addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + if (compType == "layout") { + l2.setHeight(size); + l2.setWidth(size); + } else if (compType == "component") { + c2.setHeight(size); + c2.setWidth(size); + } else { + } + + } + }); + } + + } + Button btn1 = new SetSizeButton("350px"); + Button btn2 = new SetSizeButton("-1px"); + Button btn3 = new SetSizeButton("75%"); + Button btn4 = new SetSizeButton("100%"); + + l1.addComponent(btn1); + l1.addComponent(btn2); + l1.addComponent(btn3); + l1.addComponent(btn4); + l2.addComponent(c1); + l2.addComponent(new Label( + "

", + ContentMode.HTML)); + l2.addComponent(c2); + l2.setExpandRatio(c1, 0.5f); + l2.setExpandRatio(c2, 0.5f); + + btn2.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + Label newLabel = new Label("--- NEW LABEL ---"); + newLabel.setSizeUndefined(); + l2.addComponent(newLabel); + + } + }); + } + + protected Table getTestTable() { + Table t = new Table(); + t.setPageLength(5); + t.addContainerProperty("test", String.class, null); + t.addItem(new Object[] { "qwertyuiop asdfghjköäxccvbnm,m,." }, 1); + t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2); + return t; + } + + protected AbstractLayout createLabelsFields( + Class compType, boolean useIcon, + String ErrorMessage) { + AbstractLayout mainLayout = new VerticalLayout(); + AbstractLayout curLayout = null; + try { + curLayout = layoutClass.newInstance(); + } catch (InstantiationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IllegalAccessException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + final Component[] components = new Component[CAPTIONS.length]; + + for (int i = 0; i < components.length; i++) { + AbstractComponent comp = null; + try { + comp = compType.newInstance(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + components[i] = comp; + comp.setCaption(CAPTIONS[i]); + if (useIcon) { + comp.setIcon(ICONS[i]); + } + if (ErrorMessage != null) { + if (ErrorMessage.length() == 0) { + comp.setComponentError(new UserError(null)); + } else { + comp.setComponentError(new UserError(ErrorMessage)); + } + } + // if component is a tab sheet add two tabs for it + if (comp instanceof TabSheet) { + comp.setSizeUndefined(); + TabSheet tab = (TabSheet) comp; + tab.addTab(new UndefWideLabel("TAB1"), "TAB1", + new ThemeResource(GLOBE_16_PNG)); + tab.addTab(new UndefWideLabel("TAB2"), "TAB2", null); + } + curLayout.addComponent(comp); + mainLayout.addComponent(curLayout); + } + return mainLayout; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + mainLayout.addComponent(l1); + mainLayout.addComponent(l2); + addComponent(mainLayout); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return null; + } + + protected void setLayoutMeasures(AbstractOrderedLayout l1, + AbstractOrderedLayout l2, String w, String h) { + l1.setWidth(w); + l1.setHeight(h); + l2.setWidth(h); + l2.setHeight(w); + } + + protected void setDefaultForVertical(AbstractOrderedLayout l1, + AbstractOrderedLayout l2) { + l1.setWidth("800px"); + l1.setHeight("600px"); + l2.setWidth("800px"); + l2.setHeight("600px"); + } + + protected void setDefaultForHorizontal(AbstractOrderedLayout l1, + AbstractOrderedLayout l2) { + l1.setWidth("600px"); + l1.setHeight("600px"); + l2.setWidth("600px"); + l2.setHeight("600px"); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/BaseRegError.java b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseRegError.java new file mode 100644 index 0000000000..df4053b533 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/BaseRegError.java @@ -0,0 +1,60 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.AbstractLayout; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.DateField; +import com.vaadin.ui.Label; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TextField; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class BaseRegError extends BaseLayoutTestUI { + + public BaseRegError(Class layoutClass) { + super(layoutClass); + } + + @Override + protected void setup(VaadinRequest request) { + init(); + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + + l1.addComponent(createLabelsFields(Label.class, true, "")); + l1.addComponent(createLabelsFields(Button.class, true, "")); + l1.addComponent(createLabelsFields(TabSheet.class, true, "")); + l1.addComponent(createLabelsFields(TextField.class, true, "")); + + l2.addComponent(createLabelsFields(ComboBox.class, true, "")); + l2.addComponent(createLabelsFields(DateField.class, true, "")); + l2.addComponent(createLabelsFields(NativeSelect.class, true, "")); + l2.addComponent(createLabelsFields(CheckBox.class, true, "")); + + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java new file mode 100644 index 0000000000..2771af01c6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java @@ -0,0 +1,105 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.TextField; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class GridAddReplaceMove extends GridBaseLayoutTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + + final HorizontalLayout source = new HorizontalLayout(); + source.addComponent(new Label("OTHER LABEL 1")); + source.addComponent(new Label("OTHER LABEL 2")); + + final AbstractComponent c1 = new Label("LABEL", ContentMode.HTML); + final AbstractComponent c2 = new Label("LABEL", ContentMode.HTML); + final AbstractComponent c3 = new Table("TABLE"); + c3.setHeight("100px"); + c3.setWidth("100%"); + + final Button btnAdd = new Button("Test add"); + final Button btnReplace = new Button("Test replace"); + final Button btnMove = new Button("Test move"); + final Button btnRemove = new Button("Test remove"); + + layout.addComponent(btnAdd); + layout.addComponent(btnReplace); + layout.addComponent(btnMove); + layout.addComponent(btnRemove); + + btnAdd.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + layout.addComponent(new TextField()); + } + }); + btnReplace.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + layout.replaceComponent(c1, c3); + } + }); + btnMove.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + layout.moveComponentsFrom(source); + } + }); + btnRemove.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + layout.removeComponent(c1); + layout.removeComponent(c2); + } + }); + + layout.addComponent(c1); + layout.addComponent(c2); + layout.addComponent(c3); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMoveTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMoveTest.java new file mode 100644 index 0000000000..f83a6ccf67 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMoveTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMoveTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridAddReplaceMoveTest extends BaseAddReplaceMoveTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java new file mode 100644 index 0000000000..e061532690 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignment.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; + +public class GridAlignment extends GridBaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + buildLayout(); + super.setup(request); + } + + /** + * Build Layout for test + */ + private void buildLayout() { + layout.setColumns(3); + layout.setRows(3); + // layout.setHeight("600px"); + // layout.setWidth("900px"); + for (int i = 0; i < components.length; i++) { + layout.addComponent(components[i]); + layout.setComponentAlignment(components[i], alignments[i]); + } + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignmentTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignmentTest.java new file mode 100644 index 0000000000..cdc040930b --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAlignmentTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAlignmentTest; + +public class GridAlignmentTest extends BaseAlignmentTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java new file mode 100644 index 0000000000..d79c52ccda --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java @@ -0,0 +1,107 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.tests.layouts.layouttester.BaseLayoutTestUI; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; + +/** + * + * @since + * @author Vaadin Ltd + */ +public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { + protected GridLayout layout = new GridLayout(); + + /** + * @param layoutClass + */ + public GridBaseLayoutTestUI() { + super(GridLayout.class); + } + + @Override + protected void setup(VaadinRequest request) { + layout.setMargin(true); + layout.setSizeFull(); + getUI().setContent(layout); + } + + @Override + protected void getLayoutForLayoutSizing(final String compType) { + + layout.setSpacing(false); + layout.setMargin(false); + + final AbstractComponent c1 = getTestTable(); + c1.setSizeFull(); + final AbstractComponent c2 = getTestTable(); + c2.setSizeFull(); + + class SetSizeButton extends Button { + SetSizeButton(final String size) { + super(); + setCaption("Set size " + size); + addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + if (compType == "layout") { + layout.setHeight(size); + layout.setWidth(size); + } else if (compType == "component") { + c2.setHeight(size); + c2.setWidth(size); + } else { + } + + } + }); + } + + } + Button btn1 = new SetSizeButton("550px"); + Button btn2 = new SetSizeButton("-1px"); + Button btn3 = new SetSizeButton("75%"); + Button btn4 = new SetSizeButton("100%"); + + layout.addComponent(btn1); + layout.addComponent(btn2); + layout.addComponent(btn3); + layout.addComponent(btn4); + layout.addComponent(c1); + layout.addComponent(new Label( + "

", + ContentMode.HTML)); + layout.addComponent(c2); + btn2.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + Label newLabel = new Label("--- NEW LABEL ---"); + newLabel.setSizeUndefined(); + layout.addComponent(newLabel); + } + }); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaption.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaption.java new file mode 100644 index 0000000000..7b1c3d9a65 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaption.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; + +public class GridCaption extends GridBaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + layout.addComponent(createLabelsFields(Button.class, true, "")); + layout.addComponent(createLabelsFields(Label.class, true, "")); + layout.addComponent(createLabelsFields(ComboBox.class, true, "")); + layout.addComponent(createLabelsFields(TabSheet.class, false, "")); + super.setup(request); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaptionTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaptionTest.java new file mode 100644 index 0000000000..ab8046ebf3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridCaptionTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseCaptionTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridCaptionTest extends BaseCaptionTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java new file mode 100644 index 0000000000..bebccfbf9d --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizing.java @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridComponentSizing extends GridBaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + getLayoutForLayoutSizing("component"); + super.setup(request); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizingTest.java new file mode 100644 index 0000000000..6572bd2a50 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridComponentSizingTest.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseComponentSizingTest; + +public class GridComponentSizingTest extends BaseComponentSizingTest { + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java new file mode 100644 index 0000000000..863a4f2c1d --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIcon.java @@ -0,0 +1,42 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.Label; +import com.vaadin.ui.Link; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TextField; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridIcon extends GridBaseLayoutTestUI { + @Override + protected void setup(VaadinRequest request) { + layout.addComponent(createLabelsFields(TextField.class, true, "")); + layout.addComponent(createLabelsFields(Label.class, true, "")); + layout.addComponent(createLabelsFields(Button.class, true, "")); + layout.addComponent(createLabelsFields(ComboBox.class, true, "")); + layout.addComponent(createLabelsFields(Link.class, true, "")); + layout.addComponent(createLabelsFields(TabSheet.class, true, "")); + super.setup(request); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIconTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIconTest.java new file mode 100644 index 0000000000..25a0faa88e --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridIconTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseIconTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridIconTest extends BaseIconTest { + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java new file mode 100644 index 0000000000..b3a84cdc26 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpand.java @@ -0,0 +1,64 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Table; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutExpand extends GridBaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + class ExpandButton extends Button { + + public ExpandButton(final int i1, final int i2, final float e1, + final float e2) { + super(); + setCaption("Expand ratio: " + e1 * 100 + " /" + e2 * 100); + addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + layout.setColumnExpandRatio(i1, e1); + layout.setColumnExpandRatio(i2, e2); + } + }); + } + } + Table t1 = getTestTable(); + Table t2 = getTestTable(); + t1.setSizeFull(); + t2.setSizeFull(); + layout.setColumns(4); + layout.setRows(4); + layout.addComponent(new ExpandButton(1, 2, 1.0f, 0.0f), 0, 0); + layout.addComponent(new ExpandButton(1, 2, 0.5f, 0.50f), 0, 1); + layout.addComponent(new ExpandButton(1, 2, .25f, 0.75f), 0, 2); + + layout.addComponent(t1, 1, 1); + layout.addComponent(t2, 2, 1); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpandTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpandTest.java new file mode 100644 index 0000000000..2a49af52a9 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutExpandTest.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutExpandTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutExpandTest extends BaseLayoutExpandTest { +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java new file mode 100644 index 0000000000..78a67bdf82 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java @@ -0,0 +1,74 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutMarginSpacing extends GridBaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + Table t1 = getTestTable(); + Table t2 = getTestTable(); + t1.setSizeFull(); + t2.setSizeFull(); + + final Button btn1 = new Button("Toggle margin on/off"); + btn1.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + boolean margin = layout.getMargin().hasLeft(); + layout.setMargin(!margin); + + } + }); + final Button btn2 = new Button("Toggle spacing on/off"); + btn2.addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + layout.setSpacing(!layout.isSpacing()); + } + }); + layout.addComponent(btn1); + layout.addComponent(btn2); + + layout.addComponent(t1); + layout.setMargin(false); + layout.setSpacing(false); + // Must add something around the hr to avoid the margins collapsing + layout.addComponent(new Label( + "

", + ContentMode.HTML)); + layout.addComponent(t2); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacingTest.java new file mode 100644 index 0000000000..516f3b088b --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacingTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutMarginSpacingTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutMarginSpacingTest extends BaseLayoutMarginSpacingTest { + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java new file mode 100644 index 0000000000..5b4dd2a947 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegError.java @@ -0,0 +1,54 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.DateField; +import com.vaadin.ui.Label; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TextField; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutRegError extends GridBaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + buildLayout(); + super.setup(request); + } + + private void buildLayout() { + + layout.addComponent(createLabelsFields(Label.class, true, "")); + layout.addComponent(createLabelsFields(Button.class, true, "")); + layout.addComponent(createLabelsFields(TabSheet.class, true, "")); + layout.addComponent(createLabelsFields(TextField.class, true, "")); + + layout.addComponent(createLabelsFields(ComboBox.class, true, "")); + layout.addComponent(createLabelsFields(DateField.class, true, "")); + layout.addComponent(createLabelsFields(NativeSelect.class, true, "")); + layout.addComponent(createLabelsFields(CheckBox.class, true, "")); + + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegErrorTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegErrorTest.java new file mode 100644 index 0000000000..e377a7b0c4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutRegErrorTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutRegErrorTest extends BaseLayoutRegErrorTest { + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java new file mode 100644 index 0000000000..8358f91997 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizing.java @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.server.VaadinRequest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutSizing extends GridBaseLayoutTestUI { + + @Override + protected void setup(VaadinRequest request) { + getLayoutForLayoutSizing("layout"); + super.setup(request); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizingTest.java new file mode 100644 index 0000000000..c8a48cd70c --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutSizingTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.GridLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutSizingTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class GridLayoutSizingTest extends BaseLayoutSizingTest { + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java deleted file mode 100644 index f55867c464..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java +++ /dev/null @@ -1,657 +0,0 @@ -package com.vaadin.tests.layouts.layouttester; - -import java.util.Date; - -import com.vaadin.server.LegacyApplication; -import com.vaadin.server.Resource; -import com.vaadin.server.SystemError; -import com.vaadin.server.ThemeResource; -import com.vaadin.server.UserError; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.AbstractField; -import com.vaadin.ui.AbstractOrderedLayout; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.themes.Reindeer; - -public class GridLayoutTests extends AbstractLayoutTests { - - private AbstractComponent rc1, col1, col2, col3, row1, row2, row3, x3, x22; - - public GridLayoutTests(LegacyApplication application) { - super(); - } - - @Override - protected Layout getAlignmentTests() { - HorizontalLayout hlo = new HorizontalLayout(); - hlo.setSpacing(true); - GridLayout glo = getTestGrid(); - glo.addStyleName(Reindeer.LAYOUT_WHITE); - Alignment[] alignments = new Alignment[] { Alignment.BOTTOM_LEFT, - Alignment.BOTTOM_CENTER, Alignment.BOTTOM_RIGHT, - Alignment.MIDDLE_LEFT, Alignment.MIDDLE_CENTER, - Alignment.MIDDLE_RIGHT, Alignment.TOP_LEFT, - Alignment.TOP_CENTER, Alignment.TOP_RIGHT }; - - glo.replaceComponent(col1, col1 = new TextField()); - glo.replaceComponent(col2, col2 = new TextField()); - glo.replaceComponent(col3, col3 = new TextField()); - ((TextField) col1).setValue("BOTTOM_RIGHT"); - ((TextField) col2).setValue("BOTTOM_LEFT"); - ((TextField) col3).setValue("BOTTOM_CENTER"); - glo.setComponentAlignment(col2, alignments[0]); - glo.setComponentAlignment(col3, alignments[1]); - glo.setComponentAlignment(col1, alignments[2]); - - glo.setComponentAlignment(row1, alignments[3]); - glo.setComponentAlignment(row2, alignments[4]); - glo.setComponentAlignment(row3, alignments[5]); - hlo.addComponent(glo); - glo = getTestGrid(); - glo.replaceComponent(row1, row1 = new DateField()); - glo.replaceComponent(row2, row2 = new DateField()); - glo.replaceComponent(row3, row3 = new DateField()); - ((DateField) row1).setResolution(DateField.RESOLUTION_SEC); - ((DateField) row2).setResolution(DateField.RESOLUTION_SEC); - ((DateField) row3).setResolution(DateField.RESOLUTION_SEC); - glo.setComponentAlignment(col2, alignments[6]); - glo.setComponentAlignment(col3, alignments[7]); - glo.setComponentAlignment(col1, alignments[8]); - hlo.addComponent(glo); - return hlo; - } - - @Override - protected Layout getCaptionsTests() { - GridLayout glo = getTestGrid(); - glo.setWidth("600px"); - String[] captions = new String[] { - "", - "abcdefghijklmnopq", - "abc def hij klm nop qrs tuv xyz qaz wsx edc rfv tgb yhn ujm mko nji bhu vgy cft cde" }; - glo.replaceComponent(col1, col1 = new TextField()); - glo.replaceComponent(col2, col2 = new TextField()); - glo.replaceComponent(col3, col3 = new TextField()); - - col1.setCaption(captions[0]); - col2.setCaption(captions[1]); - col3.setCaption(captions[2]); - col3.setIcon(new ThemeResource(LOCK_16_PNG)); - - glo.replaceComponent(row1, row1 = new Label()); - glo.replaceComponent(row2, row2 = new Label()); - glo.replaceComponent(row3, row3 = new Label()); - - row1.setCaption(captions[0]); - row2.setCaption(captions[1]); - row3.setCaption(captions[2]); - - glo.replaceComponent(x3, x3 = getTestTabsheet()); - glo.replaceComponent(x22, x22 = getTestTable()); - x22.setComponentError(new UserError("component error, user error")); - - x3.setCaption(captions[1]); - x22.setCaption(captions[2]); - - return glo; - } - - @Override - protected Layout getComponentAddReplaceMoveTests() { - final GridLayout glo = getTestGrid(); - glo.setHeight("350px"); - Layout baseLayout = getBaseLayout(); - final Button button1 = new Button("Test add"); - final Button button2 = new Button("Test replace"); - final Button button3 = new Button("Test move"); - final Button button4 = new Button("Test remove comp 1,1"); - final Button button5 = new Button("Test remove row 0"); - final Button button6 = new Button("Test remove comp row3"); - - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - button5.setId("testButton5"); - button6.setId("testButton6"); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - baseLayout.addComponent(button4); - baseLayout.addComponent(button5); - baseLayout.addComponent(button6); - baseLayout.addComponent(glo); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - button5.setEnabled(false); - button6.setEnabled(false); - - final HorizontalLayout source = new HorizontalLayout(); - source.addComponent(new Label("MOVE LABEL 1")); - source.addComponent(new Label("MOVE LABEL 2")); - - final AbstractComponent cc1 = getTestTabsheet(); - cc1.setCaption("ADDED COMPONENT"); - - final AbstractComponent cc2 = getTestTabsheet(); - cc2.setCaption("REPLACEMENT COMPONENT"); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.addComponent(cc1); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.replaceComponent(x22, cc2); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.moveComponentsFrom(source); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.removeComponent(1, 1); - button4.setEnabled(false); - button5.setEnabled(true); - } - }); - - button5.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.removeRow(0); - button5.setEnabled(false); - button6.setEnabled(true); - } - }); - button6.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.removeComponent(row3); - button6.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getComponentSizingTests() { - final GridLayout glo = getTestGrid(); - glo.setHeight("350px"); - Layout baseLayout = getBaseLayout(); - final Button button1 = new Button("full size, 3x1"); - final Button button2 = new Button("200 px width, 3x1"); - final Button button3 = new Button("200 px width, table"); - final Button button4 = new Button("undefined size+add, table"); - - glo.replaceComponent(x22, x22 = getTestTable()); - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - baseLayout.addComponent(button4); - baseLayout.addComponent(glo); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - x3.setSizeFull(); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - x3.setWidth("200px"); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - x22.setWidth("200px"); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - x22.setSizeUndefined(); - ((Table) x22).addItem(new Object[] { "NEW ROW1" }, 3); - ((Table) x22).addItem(new Object[] { "NEW ROW2" }, 4); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getExpandRatiosTests() { - final GridLayout glo = getTestGrid(); - Layout baseLayout = getBaseLayout(); - final Button button1 = new Button("set col 3 expand 1"); - final Button button2 = new Button("set all cols expand 0.25"); - final Button button3 = new Button("set row 0 expand 0.5"); - final Button button4 = new Button("set row 3 expand 0.2"); - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - glo.setHeight("400px"); - glo.replaceComponent(x22, x22 = getTestTable()); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - baseLayout.addComponent(button4); - baseLayout.addComponent(glo); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setColumnExpandRatio(3, 1); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setColumnExpandRatio(0, 0.25f); - glo.setColumnExpandRatio(1, 0.25f); - glo.setColumnExpandRatio(2, 0.25f); - glo.setColumnExpandRatio(3, 0.25f); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setRowExpandRatio(0, 0.5f); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setRowExpandRatio(3, 0.3f); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getIconsTests() { - GridLayout glo = getTestGrid(); - glo.setWidth("600px"); - Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG), - new ThemeResource(LOCK_16_PNG) }; - - glo.replaceComponent(col1, col1 = new TextField("TEXTFIELD")); - glo.replaceComponent(col2, col2 = new Label("LABEL")); - glo.replaceComponent(col3, col3 = new Link("LINK", null)); - - col1.setIcon(icons[0]); - col2.setIcon(icons[1]); - col3.setIcon(icons[0]); - rc1.setIcon(icons[1]); - col3.setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd"); - col3.setComponentError(new UserError("component error, user error")); - - glo.replaceComponent(row1, row1 = new DateField()); - glo.replaceComponent(row2, row2 = new NativeSelect()); - glo.replaceComponent(row3, row3 = getTestTabsheet()); - - row1.setIcon(icons[1]); - row2.setIcon(icons[0]); - row3.setIcon(icons[1]); - - glo.replaceComponent(x3, x3 = new CheckBox("CHECKBOX")); - VerticalLayout pl = new VerticalLayout(); - pl.setMargin(true); - glo.replaceComponent(x22, x22 = new Panel("PANEL", pl)); - x22.setIcon(new ThemeResource(CALENDAR_32_PNG)); - - x3.setIcon(icons[0]); - x22.setIcon(icons[1]); - - return glo; - } - - @Override - protected Layout getLayoutSizingTests() { - final GridLayout glo = getTestGrid(); - Layout baseLayout = getBaseLayout(); - baseLayout.setWidth("500px"); - baseLayout.setHeight("500px"); - final Button button1 = new Button("Set fixed height 350px"); - final Button button2 = new Button( - "Set undefined size and add component"); - final Button button3 = new Button("Set fixed width and height 75%"); - final Button button4 = new Button("Set size full"); - - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - glo.replaceComponent(x22, x22 = getTestTable()); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - baseLayout.addComponent(button4); - baseLayout.addComponent(glo); - // Don't expand the buttons - ((AbstractOrderedLayout) baseLayout).setExpandRatio(glo, 1); - - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setHeight("350px"); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setSizeUndefined(); - glo.addComponent(new Label("--- NEW LABEL ---")); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setWidth("75%"); - glo.setHeight("75%"); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setSizeFull(); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getMarginSpacingTests() { - final GridLayout glo = getTestGrid(); - Layout baseLayout = getBaseLayout(); - baseLayout.setWidth("500px"); - baseLayout.setHeight("500px"); - final Button button1 = new Button("Set margin on"); - final Button button2 = new Button("Set spacing on"); - final Button button3 = new Button("Set margin off"); - final Button button4 = new Button("Set spacing off"); - - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - baseLayout.addComponent(button4); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - baseLayout.addComponent(glo); - - // Don't expand the buttons - ((AbstractOrderedLayout) baseLayout).setExpandRatio(glo, 1); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setMargin(true); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setSpacing(true); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setMargin(false); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - glo.setSpacing(false); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getRequiredErrorIndicatorsTests() { - GridLayout glo = getTestGrid(); - glo.setWidth("600px"); - Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG), - new ThemeResource(LOCK_16_PNG) }; - - glo.replaceComponent(col1, col1 = new TextField("TEXTFIELD")); - glo.replaceComponent(col2, col2 = new Label("LABEL")); - // Make sure it doesn't shrink to 0px - col2.setWidth(null); - glo.replaceComponent(col3, col3 = new Link("LINK", null)); - - col1.setIcon(icons[0]); - col1.setComponentError(new UserError("component error, user error")); - col2.setComponentError(new SystemError("component error, system error")); - col3.setComponentError(new UserError("component error, user error")); - - glo.replaceComponent(row1, row1 = new DateField()); - glo.replaceComponent(row2, row2 = new NativeSelect()); - glo.replaceComponent(row3, row3 = getTestTabsheet()); - - ((AbstractField) col1).setRequired(true); - ((AbstractField) col1).setValidationVisible(true); - ((AbstractField) col1).setRequiredError("required error"); - - ((AbstractField) row1).setRequired(true); - ((AbstractField) row1).setValidationVisible(true); - ((AbstractField) row1).setRequiredError("required error"); - - ((AbstractField) row2).setRequired(true); - ((AbstractField) row2).setValidationVisible(true); - ((AbstractField) row2).setRequiredError("required error"); - row2.setComponentError(new UserError("component error, user error")); - - row3.setComponentError(new UserError("component error, user error")); - row3.setIcon(icons[1]); - row3.setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd"); - - glo.replaceComponent(x3, x3 = new CheckBox("CHECKBOX")); - VerticalLayout pl = new VerticalLayout(); - pl.setMargin(true); - glo.replaceComponent(x22, x22 = new Panel("PANEL", pl)); - - x3.setComponentError(new UserError("component error, user error")); - x22.setComponentError(new UserError("component error, user error")); - x22.setIcon(icons[0]); - - return glo; - } - - private GridLayout getTestGrid() { - // Create a 4 by 4 grid layout. - GridLayout grid = new GridLayout(4, 4); - // Fill out the first row using the cursor. - grid.addComponent(rc1 = new Button("R/C 1")); - - grid.addComponent(col1 = new Button("Col " + (grid.getCursorX() + 1))); - grid.addComponent(col2 = new Button("Col " + (grid.getCursorX() + 1))); - grid.addComponent(col3 = new Button("Col " + (grid.getCursorX() + 1))); - - // Fill out the first column using coordinates. - - grid.addComponent(row1 = new Button("Row " + 1), 0, 1); - grid.addComponent(row2 = new Button("Row " + 2), 0, 2); - grid.addComponent(row3 = new Button("Row " + 3), 0, 3); - - // Add some components of various shapes. - grid.addComponent(x3 = new Button("3x1 button"), 1, 1, 3, 1); - grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3); - x22 = new InlineDateField("A 2x2 date field"); - ((InlineDateField) x22).setResolution(DateField.RESOLUTION_DAY); - ((InlineDateField) x22).setValue(new Date(128028960000l)); - grid.addComponent(x22, 2, 2, 3, 3); - grid.setWidth("450px"); - grid.setHeight("450px"); - return grid; - } - - private VerticalLayout getBaseLayout() { - VerticalLayout vlo = new VerticalLayout(); - vlo.setSizeUndefined(); - return vlo; - } - - private AbstractComponent getTestTabsheet() { - TabSheet tabsheet = new TabSheet(); - tabsheet.setSizeUndefined(); - tabsheet.addTab(new UndefWideLabel("TAB1"), "TAB1", new ThemeResource( - GLOBE_16_PNG)); - tabsheet.addTab(new UndefWideLabel("TAB2"), "TAB2", null); - return tabsheet; - } - - private Table getTestTable() { - Table t = new Table(); - t.setSizeUndefined(); - t.setPageLength(5); - t.addContainerProperty("test", String.class, null); - t.addItem(new Object[] { "qwertyuiop asdfghjklzxccvbnm,m,." }, 1); - t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2); - return t; - } - -} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java new file mode 100644 index 0000000000..1c0e992a86 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMove; +import com.vaadin.ui.HorizontalLayout; + + +public class HAddReplaceMove extends BaseAddReplaceMove { + + /** + * @param layoutClass + */ + public HAddReplaceMove() { + super(HorizontalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMoveTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMoveTest.java new file mode 100644 index 0000000000..367664069d --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMoveTest.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMoveTest; + +public class HAddReplaceMoveTest extends BaseAddReplaceMoveTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java new file mode 100644 index 0000000000..9864fcaa41 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignment.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAlignment; +import com.vaadin.ui.HorizontalLayout; + +public class HAlignment extends BaseAlignment { + + public HAlignment() { + super(HorizontalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignmentTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignmentTest.java new file mode 100644 index 0000000000..055ad8e607 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAlignmentTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAlignmentTest; + +public class HAlignmentTest extends BaseAlignmentTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java new file mode 100644 index 0000000000..bb974a8c68 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseCaption; +import com.vaadin.ui.HorizontalLayout; + + +public class HCaption extends BaseCaption { + + /** + * @param layoutClass + */ + public HCaption() { + super(HorizontalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaptionTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaptionTest.java new file mode 100644 index 0000000000..c10da9eefe --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaptionTest.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseCaptionTest; + +public class HCaptionTest extends BaseCaptionTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java new file mode 100644 index 0000000000..b042c018eb --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizing.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import com.vaadin.ui.HorizontalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class HComponentSizing extends BaseComponentSizing { + + /** + * @param layoutClass + */ + public HComponentSizing() { + super(HorizontalLayout.class); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizingTest.java new file mode 100644 index 0000000000..86aa330901 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HComponentSizingTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseComponentSizingTest; + +public class HComponentSizingTest extends BaseComponentSizingTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java new file mode 100644 index 0000000000..cb4eb321b9 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIcon.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseIcon; +import com.vaadin.ui.HorizontalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class HIcon extends BaseIcon { + + /** + * @param layoutClass + */ + public HIcon() { + super(HorizontalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIconTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIconTest.java new file mode 100644 index 0000000000..e01e1d1726 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HIconTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseIconTest; + +public class HIconTest extends BaseIconTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpand.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpand.java new file mode 100644 index 0000000000..273ca07bc4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpand.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseLayoutExpand; +import com.vaadin.ui.HorizontalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class HLayoutExpand extends BaseLayoutExpand { + + /** + * @param layoutClass + */ + public HLayoutExpand() { + super(HorizontalLayout.class); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpandTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpandTest.java new file mode 100644 index 0000000000..f24abba9d2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutExpandTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutExpandTest; + +public class HLayoutExpandTest extends BaseLayoutExpandTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java new file mode 100644 index 0000000000..9fea380155 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacing.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseLayoutForSpacingMargin; +import com.vaadin.ui.HorizontalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class HLayoutMarginSpacing extends BaseLayoutForSpacingMargin { + + /** + * @param layoutClass + */ + public HLayoutMarginSpacing() { + super(HorizontalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacingTest.java new file mode 100644 index 0000000000..1abae12ce6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutMarginSpacingTest.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutMarginSpacingTest; + +public class HLayoutMarginSpacingTest extends BaseLayoutMarginSpacingTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java new file mode 100644 index 0000000000..3c7134a061 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegError.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseRegError; +import com.vaadin.ui.HorizontalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class HLayoutRegError extends BaseRegError { + + /** + * @param layoutClass + */ + public HLayoutRegError() { + super(HorizontalLayout.class); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegErrorTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegErrorTest.java new file mode 100644 index 0000000000..673c08d4fa --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutRegErrorTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest; + +public class HLayoutRegErrorTest extends BaseLayoutRegErrorTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java new file mode 100644 index 0000000000..350037b05c --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizing.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import com.vaadin.ui.HorizontalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class HLayoutSizing extends BaseComponentSizing { + + /** + * @param layoutClass + */ + public HLayoutSizing() { + super(HorizontalLayout.class); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizingTest.java new file mode 100644 index 0000000000..5f4d52a5d5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HLayoutSizingTest.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.HLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutSizingTest; + +public class HLayoutSizingTest extends BaseLayoutSizingTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java deleted file mode 100644 index afa53c012e..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java +++ /dev/null @@ -1,597 +0,0 @@ -package com.vaadin.tests.layouts.layouttester; - -import com.vaadin.server.LegacyApplication; -import com.vaadin.server.Resource; -import com.vaadin.server.SystemError; -import com.vaadin.server.ThemeResource; -import com.vaadin.server.UserError; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.AbstractField; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.Select; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.themes.Reindeer; - -public class HorizontalLayoutTests extends AbstractLayoutTests { - - public HorizontalLayoutTests(LegacyApplication application) { - super(); - } - - @Override - protected Layout getAlignmentTests() { - Layout baseLayout = getBaseLayout(); - HorizontalLayout vlo = getTestLaytout(); - AbstractComponent[] components = new AbstractComponent[9]; - String[] styles = { Reindeer.LAYOUT_BLUE, Reindeer.LAYOUT_WHITE }; - Alignment[] alignments = new Alignment[] { Alignment.BOTTOM_LEFT, - Alignment.BOTTOM_CENTER, Alignment.BOTTOM_RIGHT, - Alignment.MIDDLE_LEFT, Alignment.MIDDLE_CENTER, - Alignment.MIDDLE_RIGHT, Alignment.TOP_LEFT, - Alignment.TOP_CENTER, Alignment.TOP_RIGHT }; - - vlo.addStyleName(Reindeer.LAYOUT_WHITE); - baseLayout.addComponent(vlo); - int index = 0; - for (int i = 0; i < components.length; i++) { - if (i > 0 && i % 3 == 0) { - vlo = getTestLaytout(); - vlo.addStyleName(styles[index++]); - baseLayout.addComponent(vlo); - } - components[i] = new TextField(); - ((TextField) components[i]).setValue("FIELD " + i); - vlo.addComponent(components[i]); - vlo.setComponentAlignment(components[i], alignments[i]); - } - return baseLayout; - } - - @Override - protected Layout getCaptionsTests() { - Layout baseLayout = getBaseLayout(); - AbstractComponent component = null; - - String[] captions = new String[] { - "", - "abcdefghijklmnopq", - "abc def hij klm nop qrs tuv xyz qaz wsx edc rfv tgb yhn ujm mko nji bhu vgy cft cde" }; - - HorizontalLayout vlo = getTestLaytout(); - for (int i = 0; i < captions.length; i++) { - component = new TextField(); - ((TextField) component).setValue("FIELD " + i); - component.setCaption(captions[i]); - vlo.addComponent(component); - } - baseLayout.addComponent(vlo); - vlo = getTestLaytout(); - for (int i = 0; i < captions.length; i++) { - component = new Label(); - ((Label) component).setValue("Label " + i); - component.setCaption(captions[i]); - vlo.addComponent(component); - } - baseLayout.addComponent(vlo); - vlo = getTestLaytout(); - for (int i = 0; i < captions.length; i++) { - component = new Select(); - component.setCaption(captions[i]); - component.setIcon(new ThemeResource(LOCK_16_PNG)); - vlo.addComponent(component); - } - baseLayout.addComponent(vlo); - vlo = getTestLaytout(); - for (int i = 0; i < captions.length; i++) { - component = getTestTabsheet(); - component.setCaption(captions[i]); - component.setComponentError(new UserError("")); - vlo.addComponent(component); - } - baseLayout.addComponent(vlo); - return baseLayout; - } - - @Override - protected Layout getComponentAddReplaceMoveTests() { - final HorizontalLayout vlo = getTestLaytout(); - Layout baseLayout = getBaseLayout(); - final HorizontalLayout source = new HorizontalLayout(); - source.addComponent(new Label("OTHER LABEL 1")); - source.addComponent(new Label("OTHER LABEL 2")); - - final AbstractComponent c1 = new Button("BUTTON"); - final AbstractComponent c2 = new Label("LABEL", ContentMode.HTML); - final AbstractComponent c3 = new Table("TABLE"); - c3.setHeight("100px"); - c3.setWidth("100%"); - - final Button addButton = new Button("Test add"); - final Button replaceButton = new Button("Test replace"); - final Button moveButton = new Button("Test move"); - final Button removeButton = new Button("Test remove"); - addButton.setId("testButton1"); - replaceButton.setId("testButton2"); - moveButton.setId("testButton3"); - removeButton.setId("testButton4"); - replaceButton.setEnabled(false); - moveButton.setEnabled(false); - removeButton.setEnabled(false); - - addButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.addComponent(new TextField()); - addButton.setEnabled(false); - replaceButton.setEnabled(true); - } - }); - replaceButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.replaceComponent(c1, c3); - replaceButton.setEnabled(false); - moveButton.setEnabled(true); - } - }); - moveButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.moveComponentsFrom(source); - moveButton.setEnabled(false); - removeButton.setEnabled(true); - } - }); - removeButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.removeComponent(c1); - vlo.removeComponent(c2); - removeButton.setEnabled(false); - } - }); - - baseLayout.addComponent(addButton); - baseLayout.addComponent(replaceButton); - baseLayout.addComponent(moveButton); - baseLayout.addComponent(removeButton); - - vlo.addComponent(c1); - vlo.addComponent(c2); - vlo.addComponent(c3); - baseLayout.addComponent(vlo); - - return baseLayout; - } - - @Override - protected Layout getComponentSizingTests() { - final HorizontalLayout vlo = getTestLaytout(); - Layout baseLayout = getBaseLayout(); - - final AbstractComponent c = getTestTable(); - - final Button biggerButton = new Button("full size"); - final Button smallerButton = new Button("200 px width"); - final Button originalButton = new Button("undefined size+add"); - - biggerButton.setId("testButton1"); - smallerButton.setId("testButton2"); - originalButton.setId("testButton3"); - - baseLayout.addComponent(biggerButton); - baseLayout.addComponent(smallerButton); - baseLayout.addComponent(originalButton); - vlo.addComponent(c); - baseLayout.addComponent(vlo); - - biggerButton.setEnabled(true); - smallerButton.setEnabled(false); - originalButton.setEnabled(false); - - biggerButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - c.setSizeFull(); - biggerButton.setEnabled(false); - smallerButton.setEnabled(true); - } - }); - smallerButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - c.setWidth("200px"); - smallerButton.setEnabled(false); - originalButton.setEnabled(true); - } - }); - originalButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - originalButton.setEnabled(false); - c.setSizeUndefined(); - ((Table) c) - .addItem( - new Object[] { "VYVTCTC VYVYV ECECCE NIDSD SDMPOM" }, - 3); - } - }); - - return baseLayout; - } - - @Override - protected Layout getLayoutSizingTests() { - final HorizontalLayout vlo = getTestLaytout(); - vlo.setSpacing(false); - vlo.setMargin(false); - Layout baseLayout = getBaseLayout(); - final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); - final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); - - final Button button1 = new Button("Set fixed height 350px"); - final Button button2 = new Button( - "Set undefined size and add component"); - final Button button3 = new Button("Set fixed width and height 75%"); - final Button button4 = new Button("Set size full"); - - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - baseLayout.addComponent(button4); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - vlo.addComponent(c1); - vlo.addComponent(c2); - vlo.setExpandRatio(c1, 0.5f); - vlo.setExpandRatio(c2, 0.5f); - - baseLayout.addComponent(vlo); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setHeight("350px"); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setSizeUndefined(); - Label label = new Label("--- NEW LABEL ---"); - label.setWidth(null); - vlo.addComponent(label); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setWidth("75%"); - vlo.setHeight("75%"); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setSizeFull(); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getExpandRatiosTests() { - final HorizontalLayout vlo = getTestLaytout(); - Layout baseLayout = getBaseLayout(); - final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); - final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); - - final Button button1 = new Button("Expand to 1/undefined"); - final Button button2 = new Button("Expand to 0.5/0.5"); - final Button button3 = new Button("Expand to 0.75/0.25"); - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - - vlo.addComponent(c1); - vlo.addComponent(c2); - baseLayout.addComponent(vlo); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setExpandRatio(c1, 1.0f); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setExpandRatio(c1, 0.5f); - vlo.setExpandRatio(c2, 0.5f); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setExpandRatio(c1, 0.75f); - vlo.setExpandRatio(c2, 0.25f); - button3.setEnabled(false); - } - }); - return baseLayout; - } - - @Override - protected Layout getIconsTests() { - HorizontalLayout vlo = getTestLaytout(); - AbstractComponent[] components = new AbstractComponent[2]; - Layout baseLayout = getBaseLayout(); - Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG), - new ThemeResource(LOCK_16_PNG) }; - - for (int i = 0; i < components.length; i++) { - components[i] = new TextField(); - ((TextField) components[i]).setValue("FIELD " + i); - components[i].setIcon(icons[i]); - components[i] - .setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd"); - vlo.addComponent(components[i]); - } - for (int i = 0; i < components.length; i++) { - components[i] = new Label(); - ((Label) components[i]).setValue("Label " + i); - components[i].setIcon(icons[i]); - vlo.addComponent(components[i]); - } - baseLayout.addComponent(vlo); - vlo = getTestLaytout(); - for (int i = 0; i < components.length; i++) { - components[i] = new Select(); - components[i].setIcon(icons[i]); - vlo.addComponent(components[i]); - } - for (int i = 0; i < components.length; i++) { - components[i] = new Button(); - components[i].setComponentError(new UserError( - "component error, user error")); - components[i].setIcon(icons[i]); - vlo.addComponent(components[i]); - } - for (int i = 0; i < components.length; i++) { - components[i] = new Link("Link", null); - components[i].setIcon(icons[i]); - vlo.addComponent(components[i]); - } - baseLayout.addComponent(vlo); - return baseLayout; - } - - @Override - protected Layout getMarginSpacingTests() { - final HorizontalLayout vlo = getTestLaytout(); - vlo.setSpacing(false); - vlo.setMargin(false); - Layout baseLayout = getBaseLayout(); - final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); - final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); - - final Button button1 = new Button("Set margin on"); - final Button button2 = new Button("Set spacing on"); - final Button button3 = new Button("Set margin off"); - final Button button4 = new Button("Set spacing off"); - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - baseLayout.addComponent(button1); - baseLayout.addComponent(button2); - baseLayout.addComponent(button3); - baseLayout.addComponent(button4); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - vlo.addComponent(c1); - vlo.addComponent(c2); - vlo.setExpandRatio(c1, 0.5f); - vlo.setExpandRatio(c2, 0.5f); - baseLayout.addComponent(vlo); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setMargin(true); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setSpacing(true); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setMargin(false); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo.setSpacing(false); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getRequiredErrorIndicatorsTests() { - HorizontalLayout vlo = getTestLaytout(); - Layout baseLayout = getBaseLayout(); - AbstractComponent[] components = new AbstractComponent[4]; - components[0] = new Label("LABEL"); - components[0].setSizeUndefined(); - components[1] = new Button("BUTTON"); - components[2] = getTestTable(); - components[3] = getTestTabsheet(); - components[3].setIcon(new ThemeResource(LOCK_16_PNG)); - - AbstractField[] fields = new AbstractField[5]; - fields[0] = new TextField(); - fields[0].setRequired(true); - fields[0].setValidationVisible(true); - fields[0].setRequiredError("required error"); - - fields[1] = new TextField(); - ((TextField) fields[1]).setValue("TEXTFIELD2"); - fields[1] - .setComponentError(new UserError("component error, user error")); - - fields[2] = new Select(); - fields[2].setComponentError(new SystemError( - "component error, system error")); - fields[3] = new DateField(); - fields[3].setComponentError(new SystemError( - "component error, system error")); - - fields[4] = new CheckBox(); - fields[4] - .setComponentError(new UserError("component error, user error")); - - for (int i = 0; i < components.length; i++) { - components[i].setComponentError(new UserError( - "component error, user error")); - vlo.addComponent(components[i]); - } - baseLayout.addComponent(vlo); - vlo = getTestLaytout(); - for (int i = 0; i < fields.length; i++) { - vlo.addComponent(fields[i]); - } - baseLayout.addComponent(vlo); - return baseLayout; - } - - private VerticalLayout getBaseLayout() { - VerticalLayout vlo = new VerticalLayout(); - vlo.setSizeUndefined(); - return vlo; - } - - private HorizontalLayout getTestLaytout() { - HorizontalLayout vlo = new HorizontalLayout(); - vlo.setHeight("100px"); - vlo.setWidth("750px"); - return vlo; - } - - private AbstractComponent getTestTabsheet() { - TabSheet tabsheet = new TabSheet(); - tabsheet.setSizeUndefined(); - tabsheet.addTab(new UndefWideLabel("TAB1"), "TAB1", new ThemeResource( - GLOBE_16_PNG)); - tabsheet.addTab(new UndefWideLabel("TAB2"), "TAB2", null); - return tabsheet; - } - - private Table getTestTable() { - Table t = new Table(); - t.setSizeUndefined(); - t.setPageLength(5); - t.addContainerProperty("test", String.class, null); - t.addItem(new Object[] { "qwertyuiop asdfghjkl zxccvbnm,m,." }, 1); - t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2); - return t; - } -} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java deleted file mode 100644 index 5b68e04144..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.vaadin.tests.layouts.layouttester; - -import java.lang.reflect.Method; - -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.tests.components.AbstractTestCase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Layout; -import com.vaadin.ui.LegacyWindow; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.themes.Reindeer; - -@SuppressWarnings("serial") -public class LayoutTesterApplication extends AbstractTestCase { - Button nextButton = new Button("Next"); - private int layoutIndex = -1; - - static final String[] layoutGetters = new String[] { "getCaptionsTests", - "getIconsTests", "getRequiredErrorIndicatorsTests", - "getAlignmentTests", "getExpandRatiosTests", - "getMarginSpacingTests", "getComponentAddReplaceMoveTests", - "getComponentSizingTests", "getLayoutSizingTests" }; - public static final String NEXT_BUTTON_ID = "nextButton"; - private static final String LAYOUT_SELECT_ID = "layoutSelect"; - - private LegacyWindow mainWindow; - private NativeSelect layoutSelector; - - @Override - public void init() { - nextButton.setId(NEXT_BUTTON_ID); - mainWindow = new LegacyWindow("LayoutTesterApplication"); - setMainWindow(mainWindow); - nextLayout(); - - nextButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = -1577298910202253538L; - - @Override - public void buttonClick(ClickEvent event) { - nextLayout(); - } - }); - } - - private void nextLayout() { - try { - mainWindow.removeAllComponents(); - HorizontalLayout vlo = new HorizontalLayout(); - vlo.setSpacing(true); - ++layoutIndex; - if (layoutIndex >= layoutGetters.length) { - layoutIndex = 0; - } - mainWindow.addComponent(vlo); - vlo.addComponent(nextButton); - vlo.addComponent(getLayoutTypeSelect()); - vlo.addComponent(new UndefWideLabel(getLayoutGetterMethod( - layoutGetters[layoutIndex]).getName())); - - Layout lo = null; - if (layoutSelector.getValue() == VerticalLayout.class) { - lo = getVerticalTestLayout(layoutIndex); - } else if (layoutSelector.getValue() == HorizontalLayout.class) { - lo = getHorizontalTestLayout(layoutIndex); - } else if (layoutSelector.getValue() == GridLayout.class) { - lo = getGridTestLayout(layoutIndex); - } - if (lo != null) { - lo.addStyleName(Reindeer.LAYOUT_BLUE); - mainWindow.addComponent(lo); - } - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - private Method getLayoutGetterMethod(String method) { - try { - return AbstractLayoutTests.class.getDeclaredMethod(method); - } catch (SecurityException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public Layout getVerticalTestLayout(int index) throws Exception { - VerticalLayoutTests vlotest = new VerticalLayoutTests(this); - return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke( - vlotest, (Object[]) null); - } - - public Layout getHorizontalTestLayout(int index) throws Exception { - HorizontalLayoutTests hlotest = new HorizontalLayoutTests(this); - return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke( - hlotest, (Object[]) null); - } - - public Layout getGridTestLayout(int index) throws Exception { - GridLayoutTests hlotest = new GridLayoutTests(this); - return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke( - hlotest, (Object[]) null); - } - - private NativeSelect getLayoutTypeSelect() { - if (layoutSelector == null) { - layoutSelector = new NativeSelect(); - layoutSelector.setId(LAYOUT_SELECT_ID); - layoutSelector.addItem(VerticalLayout.class); - layoutSelector.addItem(HorizontalLayout.class); - layoutSelector.addItem(GridLayout.class); - layoutSelector.setNullSelectionAllowed(false); - layoutSelector.setImmediate(true); - layoutSelector.select(VerticalLayout.class); - layoutSelector.addListener(new Property.ValueChangeListener() { - private static final long serialVersionUID = -605319614765838359L; - - @Override - public void valueChange(ValueChangeEvent event) { - layoutIndex = -1; - nextLayout(); - } - }); - } - return layoutSelector; - } - - @Override - protected String getDescription() { - return "Test application for VerticalLayout, HorizontalLayout, and GridLayout"; - } - - @Override - protected Integer getTicketNumber() { - return 5334; - } - -} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java deleted file mode 100644 index 5d8a6e0e7a..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.tests.layouts.layouttester; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.ui.Select; - -import com.vaadin.tests.tb3.MultiBrowserTest; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.VerticalLayout; - -public class LayoutTesterApplicationTest extends MultiBrowserTest { - - @Override - protected DesiredCapabilities getDesiredCapabilities() { - DesiredCapabilities cap = new DesiredCapabilities( - super.getDesiredCapabilities()); - cap.setCapability("nativeEvents", false); - - return cap; - } - - Map numberOfSubTests = new HashMap(); - private Set tableOrIconsTests = new HashSet(); - - { - numberOfSubTests.put("getExpandRatiosTests", 3); - numberOfSubTests.put("getLayoutSizingTests", 4); - numberOfSubTests.put("getComponentAddReplaceMoveTests", 4); - numberOfSubTests.put("getMarginSpacingTests", 4); - numberOfSubTests.put("getComponentSizingTests", 3); - - tableOrIconsTests.add("getComponentSizingTests"); - tableOrIconsTests.add("getExpandRatiosTests"); - tableOrIconsTests.add("getLayoutSizingTests"); - tableOrIconsTests.add("getMarginSpacingTests"); - tableOrIconsTests.add("getIconsTests"); - - } - - @Test - public void verticalLayout() throws Exception { - openTestURL(); - runTest(VerticalLayout.class); - } - - @Test - public void horizontalLayout() throws Exception { - openTestURL(); - runTest(HorizontalLayout.class); - } - - @Test - public void gridLayout() throws Exception { - numberOfSubTests.put("getComponentAddReplaceMoveTests", 6); - numberOfSubTests.put("getComponentSizingTests", 4); - numberOfSubTests.put("getExpandRatiosTests", 4); - - openTestURL(); - runTest(GridLayout.class); - } - - private void runTest(Class layoutClass) throws Exception { - new Select(vaadinElementById("layoutSelect").findElement( - By.xpath("select"))) - .selectByVisibleText(layoutClass.toString()); - - for (String subTest : LayoutTesterApplication.layoutGetters) { - compareScreen(subTest); - Integer subTests = numberOfSubTests.get(subTest); - if (subTests != null) { - for (int i = 1; i <= subTests; i++) { - clickAndCompareScreen(subTest, "testButton" + i); - } - } - - hitButton("nextButton"); - } - - } - - /** - * Clicks the button with the given id and compares the result to a - * screenshot named 'screenshotPrefix'-buttonCaption. - * - * @param screenshotPrefix - * @param buttonId - * @throws Exception - */ - private void clickAndCompareScreen(String screenshotPrefix, String buttonId) - throws Exception { - hitButton(buttonId); - - if (needsDelayToStabilize(screenshotPrefix)) { - // Table does some extra layout phase and TestBench does not always - // take this into account, grabbing screenshots before the layout - // phase is done (see #12866). - sleep(500); - } - compareScreen(screenshotPrefix + "-" - + sanitize(driver.findElement(By.id(buttonId)).getText())); - } - - private boolean needsDelayToStabilize(String screenshotPrefix) { - return tableOrIconsTests.contains(screenshotPrefix); - } - - private String sanitize(String text) { - return text.replace("%", "pct").replaceAll("[^a-zA-Z0-9]", "-"); - } -} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMove.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMove.java new file mode 100644 index 0000000000..a0ef960f57 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMove.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMove; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VAddReplaceMove extends BaseAddReplaceMove { + + /** + * @param layoutClass + */ + public VAddReplaceMove() { + super(VerticalLayout.class); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMoveTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMoveTest.java new file mode 100644 index 0000000000..70f7237c96 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAddReplaceMoveTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMoveTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class VAddReplaceMoveTest extends BaseAddReplaceMoveTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java new file mode 100644 index 0000000000..9872b4bfd7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignment.java @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAlignment; +import com.vaadin.ui.VerticalLayout; + +public class VAlignment extends BaseAlignment { + public VAlignment() { + super(VerticalLayout.class); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignmentTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignmentTest.java new file mode 100644 index 0000000000..f49787754c --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VAlignmentTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseAlignmentTest; + +public class VAlignmentTest extends BaseAlignmentTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaption.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaption.java new file mode 100644 index 0000000000..b2f50961cb --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaption.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseCaption; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VCaption extends BaseCaption { + + /** + * @param layoutClass + */ + public VCaption() { + super(VerticalLayout.class); + // TODO Auto-generated constructor stub + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaptionTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaptionTest.java new file mode 100644 index 0000000000..942736b286 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VCaptionTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseCaptionTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class VCaptionTest extends BaseCaptionTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java new file mode 100644 index 0000000000..67fcb85652 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizing.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VComponentSizing extends BaseComponentSizing { + + /** + * @param layoutClass + */ + public VComponentSizing() { + super(VerticalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizingTest.java new file mode 100644 index 0000000000..bef10a6a58 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VComponentSizingTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseComponentSizingTest; + +public class VComponentSizingTest extends BaseComponentSizingTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java new file mode 100644 index 0000000000..1420be4907 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIcon.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseIcon; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VIcon extends BaseIcon { + + /** + * @param layoutClass + */ + public VIcon() { + super(VerticalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIconTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIconTest.java new file mode 100644 index 0000000000..221bf2e2db --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VIconTest.java @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseIconTest; + +public class VIconTest extends BaseIconTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpand.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpand.java new file mode 100644 index 0000000000..15a31b16f0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpand.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseLayoutExpand; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VLayoutExpand extends BaseLayoutExpand { + + /** + * @param layoutClass + */ + public VLayoutExpand() { + super(VerticalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java new file mode 100644 index 0000000000..57bb134be7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutExpandTest; + + +/** + * + * @since + * @author Vaadin Ltd + */ +public class VLayoutExpandTest extends BaseLayoutExpandTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java new file mode 100644 index 0000000000..d6d9040bae --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacing.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseLayoutForSpacingMargin; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VLayoutMarginSpacing extends BaseLayoutForSpacingMargin { + + /** + * @param layoutClass + */ + public VLayoutMarginSpacing() { + super(VerticalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacingTest.java new file mode 100644 index 0000000000..89ffdf792f --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutMarginSpacingTest.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutMarginSpacingTest; + +public class VLayoutMarginSpacingTest extends BaseLayoutMarginSpacingTest { + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java new file mode 100644 index 0000000000..72fd35b842 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegError.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseRegError; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VLayoutRegError extends BaseRegError { + + /** + * @param layoutClass + */ + public VLayoutRegError() { + super(VerticalLayout.class); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java new file mode 100644 index 0000000000..e3e5914e3a --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest; + + +/** + * + * @since + * @author Vaadin Ltd + */ +public class VLayoutRegErrorTest extends BaseLayoutRegErrorTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java new file mode 100644 index 0000000000..ea6464cfb7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizing.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.layouts.layouttester.BaseComponentSizing; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ + +public class VLayoutSizing extends BaseComponentSizing { + + /** + * @param layoutClass + */ + public VLayoutSizing() { + super(VerticalLayout.class); + } + +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java new file mode 100644 index 0000000000..372eb9cba4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester.VLayout; + +import com.vaadin.tests.layouts.layouttester.BaseLayoutSizingTest; + + +/** + * + * @since + * @author Vaadin Ltd + */ +public class VLayoutSizingTest extends BaseLayoutSizingTest { +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java deleted file mode 100644 index df9be8ffd0..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java +++ /dev/null @@ -1,634 +0,0 @@ -package com.vaadin.tests.layouts.layouttester; - -import com.vaadin.server.LegacyApplication; -import com.vaadin.server.Resource; -import com.vaadin.server.SystemError; -import com.vaadin.server.ThemeResource; -import com.vaadin.server.UserError; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.AbstractField; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.Select; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; - -public class VerticalLayoutTests extends AbstractLayoutTests { - - public VerticalLayoutTests(LegacyApplication application) { - super(); - } - - @Override - protected Layout getAlignmentTests() { - Layout baseLayout = getBaseLayout(); - ((HorizontalLayout) baseLayout).setSpacing(true); - VerticalLayout vlo = getTestLaytout(); - AbstractComponent[] components = new AbstractComponent[9]; - Alignment[] alignments = new Alignment[] { Alignment.BOTTOM_CENTER, - Alignment.BOTTOM_LEFT, Alignment.BOTTOM_RIGHT, - Alignment.MIDDLE_CENTER, Alignment.MIDDLE_LEFT, - Alignment.MIDDLE_RIGHT, Alignment.TOP_CENTER, - Alignment.TOP_LEFT, Alignment.TOP_RIGHT }; - - for (int i = 0; i < components.length / 2; i++) { - components[i] = new TextField(); - ((TextField) components[i]).setValue("FIELD " + i); - vlo.addComponent(components[i]); - vlo.setComponentAlignment(components[i], alignments[i]); - vlo.addComponent(new Label("
", ContentMode.HTML)); - } - baseLayout.addComponent(vlo); - vlo = getTestLaytout(); - for (int i = components.length / 2; i < components.length; i++) { - components[i] = new TextField(); - ((TextField) components[i]).setValue("FIELD " + i); - vlo.addComponent(components[i]); - vlo.setComponentAlignment(components[i], alignments[i]); - vlo.addComponent(new Label("
", ContentMode.HTML)); - } - baseLayout.addComponent(vlo); - return baseLayout; - } - - @Override - protected Layout getCaptionsTests() { - Layout baseLayout = getBaseLayout(); - VerticalLayout vlo = getTestLaytout(); - AbstractComponent component = null; - - String[] captions = new String[] { - "", - "abcdefghijklmnopq", - "abc def hij klm nop qrs tuv xyz qaz wsx edc rfv tgb yhn ujm mko nji bhu vgy cft cde" }; - - for (int i = 0; i < captions.length; i++) { - component = new TextField(); - ((TextField) component).setValue("FIELD " + i); - component.setCaption(captions[i]); - vlo.addComponent(component); - } - for (int i = 0; i < captions.length; i++) { - component = new Label(); - ((Label) component).setValue("Label " + i); - component.setCaption(captions[i]); - vlo.addComponent(component); - } - baseLayout.addComponent(vlo); - vlo = getTestLaytout(); - for (int i = 0; i < captions.length; i++) { - component = new Select(); - component.setCaption(captions[i]); - component.setIcon(new ThemeResource(LOCK_16_PNG)); - vlo.addComponent(component); - } - for (int i = 0; i < captions.length; i++) { - component = getTestTabsheet(); - component.setCaption(captions[i]); - component.setComponentError(new UserError("")); - vlo.addComponent(component); - } - baseLayout.addComponent(vlo); - return baseLayout; - } - - @Override - protected Layout getComponentAddReplaceMoveTests() { - Layout baseLayout = getBaseLayout(); - final VerticalLayout vlo = getTestLaytout(); - final VerticalLayout vlo2 = getTestLaytout(); - - // Set undefined height to avoid expanding - vlo2.setHeight(null); - - final HorizontalLayout source = new HorizontalLayout(); - source.addComponent(new Label("OTHER LABEL 1")); - source.addComponent(new Label("OTHER LABEL 2")); - - final AbstractComponent c1 = new Button("BUTTON"); - final AbstractComponent c2 = new Label("LABEL", ContentMode.HTML); - final AbstractComponent c3 = new Table("TABLE"); - c3.setHeight("100px"); - c3.setWidth("100%"); - - final Button addButton = new Button("Test add"); - final Button replaceButton = new Button("Test replace"); - final Button moveButton = new Button("Test move"); - final Button removeButton = new Button("Test remove"); - addButton.setId("testButton1"); - replaceButton.setId("testButton2"); - moveButton.setId("testButton3"); - removeButton.setId("testButton4"); - - replaceButton.setEnabled(false); - moveButton.setEnabled(false); - removeButton.setEnabled(false); - - addButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.addComponent(new TextField()); - addButton.setEnabled(false); - replaceButton.setEnabled(true); - } - }); - replaceButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.replaceComponent(c1, c3); - replaceButton.setEnabled(false); - moveButton.setEnabled(true); - } - }); - moveButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.moveComponentsFrom(source); - moveButton.setEnabled(false); - removeButton.setEnabled(true); - } - }); - removeButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.removeComponent(c1); - vlo2.removeComponent(c2); - removeButton.setEnabled(false); - } - }); - - vlo.addComponent(addButton); - vlo.addComponent(replaceButton); - vlo.addComponent(moveButton); - vlo.addComponent(removeButton); - - baseLayout.addComponent(vlo); - vlo2.addComponent(c1); - vlo2.addComponent(c2); - vlo2.addComponent(c3); - baseLayout.addComponent(vlo2); - return baseLayout; - } - - @Override - protected Layout getComponentSizingTests() { - Layout baseLayout = getBaseLayout(); - final VerticalLayout vlo = getTestLaytout(); - - final AbstractComponent c = getTestTable(); - - final Button biggerButton = new Button("full size"); - final Button smallerButton = new Button("200 px width"); - final Button originalButton = new Button("undefined size and add"); - biggerButton.setId("testButton1"); - smallerButton.setId("testButton2"); - originalButton.setId("testButton3"); - vlo.addComponent(biggerButton); - vlo.addComponent(smallerButton); - vlo.addComponent(originalButton); - baseLayout.addComponent(vlo); - final VerticalLayout vlo2 = getTestLaytout(); - vlo2.addComponent(c); - baseLayout.addComponent(vlo2); - - biggerButton.setEnabled(true); - smallerButton.setEnabled(false); - originalButton.setEnabled(false); - - biggerButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - c.setSizeFull(); - biggerButton.setEnabled(false); - smallerButton.setEnabled(true); - } - }); - smallerButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - c.setWidth("200px"); - smallerButton.setEnabled(false); - originalButton.setEnabled(true); - } - }); - originalButton.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - originalButton.setEnabled(false); - c.setSizeUndefined(); - ((Table) c) - .addItem( - new Object[] { "VYVTCTC VYVYV ECECCE NIDSD SDMPOM" }, - 3); - } - }); - - return baseLayout; - } - - @Override - protected Layout getLayoutSizingTests() { - Layout baseLayout = getBaseLayout(); - final VerticalLayout vlo = getTestLaytout(); - - vlo.setSpacing(false); - vlo.setMargin(false); - - final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); - final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); - - final Button button1 = new Button("Set fixed height 350px"); - final Button button2 = new Button( - "Set undefined size and add component"); - final Button button3 = new Button("Set fixed width and height 75%"); - final Button button4 = new Button("Set size full"); - - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - vlo.addComponent(button1); - vlo.addComponent(button2); - vlo.addComponent(button3); - vlo.addComponent(button4); - baseLayout.addComponent(vlo); - final VerticalLayout vlo2 = getTestLaytout(); - - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - vlo2.addComponent(c1); - vlo2.addComponent(new Label( - "

", - ContentMode.HTML)); - vlo2.addComponent(c2); - vlo2.setExpandRatio(c1, 0.5f); - vlo2.setExpandRatio(c2, 0.5f); - baseLayout.addComponent(vlo2); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setHeight("350px"); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setSizeUndefined(); - Label newLabel = new Label("--- NEW LABEL ---"); - newLabel.setSizeUndefined(); - vlo2.addComponent(newLabel); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setWidth("75%"); - vlo2.setHeight("75%"); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setSizeFull(); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getExpandRatiosTests() { - Layout baseLayout = getBaseLayout(); - final VerticalLayout vlo = getTestLaytout(); - - final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); - final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); - - final Button button1 = new Button("Expand to 1/undefined"); - button1.setId("testButton1"); - final Button button2 = new Button("Expand to 0.5/0.5"); - button2.setId("testButton2"); - final Button button3 = new Button("Expand to 0.75/0.25"); - button3.setId("testButton3"); - - vlo.addComponent(button1); - vlo.addComponent(button2); - vlo.addComponent(button3); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - - baseLayout.addComponent(vlo); - final VerticalLayout vlo2 = getTestLaytout(); - - vlo2.addComponent(c1); - vlo2.addComponent(c2); - baseLayout.addComponent(vlo2); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setExpandRatio(c1, 1.0f); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setExpandRatio(c1, 0.5f); - vlo2.setExpandRatio(c2, 0.5f); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setExpandRatio(c1, 0.75f); - vlo2.setExpandRatio(c2, 0.25f); - button3.setEnabled(false); - } - }); - return baseLayout; - } - - @Override - protected Layout getIconsTests() { - Layout baseLayout = getBaseLayout(); - VerticalLayout vlo = getTestLaytout(); - AbstractComponent[] components = new AbstractComponent[2]; - - Resource[] icons = new Resource[] { new ThemeResource(CALENDAR_32_PNG), - new ThemeResource(LOCK_16_PNG) }; - - for (int i = 0; i < components.length; i++) { - components[i] = new TextField(); - ((TextField) components[i]).setValue("FIELD " + i); - components[i].setIcon(icons[i]); - components[i] - .setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd"); - vlo.addComponent(components[i]); - } - - for (int i = 0; i < components.length; i++) { - components[i] = new Label(); - ((Label) components[i]).setValue("Label " + i); - components[i].setIcon(icons[i]); - vlo.addComponent(components[i]); - } - - for (int i = 0; i < components.length; i++) { - components[i] = new Select(); - components[i].setIcon(icons[i]); - vlo.addComponent(components[i]); - } - baseLayout.addComponent(vlo); - final VerticalLayout vlo2 = getTestLaytout(); - for (int i = 0; i < components.length; i++) { - components[i] = new Button(); - components[i].setComponentError(new UserError( - "component error, user error")); - components[i].setIcon(icons[i]); - vlo2.addComponent(components[i]); - } - - for (int i = 0; i < components.length; i++) { - components[i] = new Link("Link", null); - components[i].setIcon(icons[i]); - vlo2.addComponent(components[i]); - } - baseLayout.addComponent(vlo2); - return baseLayout; - } - - @Override - protected Layout getMarginSpacingTests() { - Layout baseLayout = getBaseLayout(); - final VerticalLayout vlo = getTestLaytout(); - vlo.setSpacing(false); - vlo.setMargin(false); - - final AbstractComponent c1 = getTestTable(); - c1.setSizeFull(); - final AbstractComponent c2 = getTestTable(); - c2.setSizeFull(); - - final Button button1 = new Button("Set margin on"); - final Button button2 = new Button("Set spacing on"); - final Button button3 = new Button("Set margin off"); - final Button button4 = new Button("Set spacing off"); - button1.setId("testButton1"); - button2.setId("testButton2"); - button3.setId("testButton3"); - button4.setId("testButton4"); - - vlo.addComponent(button1); - vlo.addComponent(button2); - vlo.addComponent(button3); - vlo.addComponent(button4); - button1.setEnabled(true); - button2.setEnabled(false); - button3.setEnabled(false); - button4.setEnabled(false); - - baseLayout.addComponent(vlo); - final VerticalLayout vlo2 = getTestLaytout(); - - vlo2.addComponent(c1); - // Must add something around the hr to avoid the margins collapsing - vlo2.addComponent(new Label( - "

", - ContentMode.HTML)); - vlo2.addComponent(c2); - vlo2.setExpandRatio(c1, 0.5f); - vlo2.setExpandRatio(c2, 0.5f); - baseLayout.addComponent(vlo2); - - button1.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setMargin(true); - button1.setEnabled(false); - button2.setEnabled(true); - } - }); - button2.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setSpacing(true); - button2.setEnabled(false); - button3.setEnabled(true); - } - }); - button3.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setMargin(false); - button3.setEnabled(false); - button4.setEnabled(true); - } - }); - button4.addListener(new Button.ClickListener() { - private static final long serialVersionUID = 7716267156088629379L; - - @Override - public void buttonClick(ClickEvent event) { - vlo2.setSpacing(false); - button4.setEnabled(false); - } - }); - - return baseLayout; - } - - @Override - protected Layout getRequiredErrorIndicatorsTests() { - Layout baseLayout = getBaseLayout(); - VerticalLayout vlo = getTestLaytout(); - AbstractComponent[] components = new AbstractComponent[4]; - components[0] = new Label("LABEL"); - components[0].setSizeUndefined(); - components[1] = new Button("BUTTON"); - components[2] = getTestTable(); - components[3] = getTestTabsheet(); - components[3].setIcon(new ThemeResource(LOCK_16_PNG)); - - AbstractField[] fields = new AbstractField[6]; - fields[0] = new TextField(); - fields[0].setRequired(true); - fields[0].setValidationVisible(true); - fields[0].setRequiredError("required error"); - - fields[1] = new TextField(); - ((TextField) fields[1]).setValue("TEXTFIELD2"); - fields[1] - .setComponentError(new UserError("component error, user error")); - - fields[2] = new Select(); - fields[2].setComponentError(new SystemError( - "component error, system error")); - fields[3] = new DateField(); - fields[3].setComponentError(new SystemError( - "component error, system error")); - - fields[4] = new CheckBox(); - fields[4] - .setComponentError(new UserError("component error, user error")); - - fields[5] = new NativeSelect(); - fields[5].setRequired(true); - fields[5].setValidationVisible(true); - fields[5].setRequiredError("required error"); - fields[5] - .setComponentError(new UserError("component error, user error")); - fields[5].setIcon(new ThemeResource(CALENDAR_32_PNG)); - - for (int i = 0; i < components.length; i++) { - components[i].setComponentError(new UserError( - "component error, user error")); - vlo.addComponent(components[i]); - } - baseLayout.addComponent(vlo); - final VerticalLayout vlo2 = getTestLaytout(); - for (int i = 0; i < fields.length; i++) { - vlo2.addComponent(fields[i]); - } - - baseLayout.addComponent(vlo2); - return baseLayout; - } - - private HorizontalLayout getBaseLayout() { - HorizontalLayout hlo = new HorizontalLayout(); - hlo.setSizeUndefined(); - return hlo; - } - - private VerticalLayout getTestLaytout() { - VerticalLayout vlo = new VerticalLayout(); - vlo.setHeight("500px"); - vlo.setWidth("400px"); - return vlo; - } - - private AbstractComponent getTestTabsheet() { - TabSheet tabsheet = new TabSheet(); - tabsheet.setSizeUndefined(); - tabsheet.addTab(new UndefWideLabel("TAB1"), "TAB1", new ThemeResource( - GLOBE_16_PNG)); - tabsheet.addTab(new UndefWideLabel("TAB2"), "TAB2", null); - return tabsheet; - } - - private Table getTestTable() { - Table t = new Table(); - t.setSizeUndefined(); - t.setPageLength(5); - t.addContainerProperty("test", String.class, null); - t.addItem(new Object[] { "qwertyuiop asdfghjköäxccvbnm,m,." }, 1); - t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2); - return t; - } -} -- 2.39.5