summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-04-22 12:44:40 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-04-22 12:44:40 +0300
commitd0d0875430a6d1d57bd2ebb7d4c827c04e1c7731 (patch)
tree9a9611bbbe5216f2bdb8933d607be12de834a8b8 /uitest/src
parenta69660c9d8cb35fc73af09b42df82c7a4a153caa (diff)
parentc0aa2f569663b25681a61319c65d30521b5b8a85 (diff)
downloadvaadin-framework-d0d0875430a6d1d57bd2ebb7d4c827c04e1c7731.tar.gz
vaadin-framework-d0d0875430a6d1d57bd2ebb7d4c827c04e1c7731.zip
Merge remote-tracking branch 'origin/master' into grid-7.5
Change-Id: I01c7d52b1e80483ec46f87ac8c5d7a48d4c01c84
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridResizeTerror.java45
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeMultiSelect.java26
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/declarative/GridMultiSelect.html118
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ModalWindowFocus.java74
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ModalWindowFocusTest.java102
-rw-r--r--uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeFavicon.java44
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java87
-rw-r--r--uitest/src/com/vaadin/tests/util/ResizeTerrorizer.java51
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/ResizeTerrorizerControlConnector.java157
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java3
11 files changed, 456 insertions, 256 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridResizeTerror.java b/uitest/src/com/vaadin/tests/components/grid/GridResizeTerror.java
deleted file mode 100644
index 365461caa9..0000000000
--- a/uitest/src/com/vaadin/tests/components/grid/GridResizeTerror.java
+++ /dev/null
@@ -1,45 +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.components.grid;
-
-import com.vaadin.annotations.Widgetset;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.util.ResizeTerrorizer;
-import com.vaadin.tests.widgetset.TestingWidgetSet;
-import com.vaadin.ui.Grid;
-import com.vaadin.ui.UI;
-
-@Widgetset(TestingWidgetSet.NAME)
-public class GridResizeTerror extends UI {
- @Override
- protected void init(VaadinRequest request) {
- Grid grid = new Grid();
-
- int cols = 10;
- Object[] data = new Object[cols];
-
- for (int i = 0; i < cols; i++) {
- grid.addColumn("Col " + i);
- data[i] = "Data " + i;
- }
-
- for (int i = 0; i < 500; i++) {
- grid.addRow(data);
- }
-
- setContent(new ResizeTerrorizer(grid));
- }
-}
diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeMultiSelect.java b/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeMultiSelect.java
new file mode 100644
index 0000000000..83dbdf541e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeMultiSelect.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.components.grid.declarative;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.tests.components.DeclarativeTestUI;
+import com.vaadin.tests.components.DeclarativeTestUI.DeclarativeUI;
+
+@Theme("valo")
+@SuppressWarnings("serial")
+@DeclarativeUI("GridMultiSelect.html")
+public class GridDeclarativeMultiSelect extends DeclarativeTestUI {
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridMultiSelect.html b/uitest/src/com/vaadin/tests/components/grid/declarative/GridMultiSelect.html
new file mode 100644
index 0000000000..b7b1fdaf60
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridMultiSelect.html
@@ -0,0 +1,118 @@
+<v-grid width='100%' height='100%' selection-mode='multi' editable='false'>
+<table>
+ <colgroup>
+ <col />
+ <col />
+ <col />
+ </colgroup>
+ <thead>
+ <tr>
+ <th>Description</th>
+ <th>Milestone</th>
+ <th>Status</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Issue #0</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #1</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #2</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #3</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #4</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #5</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #6</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #7</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #8</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #9</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #10</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #11</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #12</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #13</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #14</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #15</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #16</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #17</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #18</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ <tr>
+ <td>Issue #19</td>
+ <td>1.0</td>
+ <td>New</td>
+ </tr>
+ </tbody>
+</table>
+</v-grid>
diff --git a/uitest/src/com/vaadin/tests/components/window/ModalWindowFocus.java b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocus.java
new file mode 100644
index 0000000000..574a2d4991
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocus.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.components.window;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Window;
+
+public class ModalWindowFocus extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest req) {
+
+ Button button = new Button("Open windows");
+ button.setId("firstButton");
+ addComponent(button);
+ button.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Window w = new Window("This is first window");
+ w.setModal(true);
+ addWindow(w);
+
+ Window w2 = new Window("This is second window");
+ w2.setModal(true);
+ addWindow(w2);
+
+ HorizontalLayout lay = new HorizontalLayout();
+ Button buttonInWindow = new Button("Open window");
+ buttonInWindow.setId("windowButton");
+ lay.addComponent(buttonInWindow);
+ w2.setContent(lay);
+
+ buttonInWindow.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent e) {
+ Window w3 = new Window("This is third window");
+ w3.setModal(true);
+ w3.setId("window3");
+ addWindow(w3);
+ }
+ });
+ }
+ });
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Topmost modal window should be focused on opening "
+ + "and on closing an overlying window";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17021;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/ModalWindowFocusTest.java b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocusTest.java
new file mode 100644
index 0000000000..75b6eaa15c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocusTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.components.window;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that a modal window is focused on creation and that on closing a window
+ * focus is given to underlying modal window
+ *
+ * @author Vaadin Ltd
+ */
+public class ModalWindowFocusTest extends MultiBrowserTest {
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+ openTestURL();
+ }
+
+ /**
+ * First scenario: press button -> two windows appear, press Esc two times
+ * -> all windows should be closed
+ */
+ @Test
+ public void testModalWindowFocusTwoWindows() throws IOException {
+
+ waitForElementPresent(By.id("firstButton"));
+ WebElement button = findElement(By.id("firstButton"));
+ button.click();
+
+ waitForElementPresent(By.id("windowButton"));
+ assertTrue("Second window should be opened",
+ findElements(By.id("windowButton")).size() == 1);
+
+ pressEscAndWait();
+ pressEscAndWait();
+ assertTrue("All windows should be closed",
+ findElements(By.className("v-window")).size() == 0);
+
+ }
+
+ /**
+ * Second scenario: press button -> two windows appear, press button in the
+ * 2nd window -> 3rd window appears on top, press Esc three times -> all
+ * windows should be closed
+ */
+ @Test
+ public void testModalWindowFocusPressButtonInWindow() throws IOException {
+
+ waitForElementPresent(By.id("firstButton"));
+ WebElement button = findElement(By.id("firstButton"));
+ button.click();
+
+ waitForElementPresent(By.id("windowButton"));
+ WebElement buttonInWindow = findElement(By.id("windowButton"));
+ buttonInWindow.click();
+
+ waitForElementPresent(By.id("window3"));
+ assertTrue("Third window should be opened",
+ findElements(By.id("window3")).size() == 1);
+
+ pressEscAndWait();
+ pressEscAndWait();
+ pressEscAndWait();
+ assertTrue("All windows should be closed",
+ findElements(By.className("v-window")).size() == 0);
+
+ }
+
+ private void pressEscAndWait() {
+ new Actions(driver).sendKeys(Keys.ESCAPE).build().perform();
+ try {
+ sleep(100);
+ } catch (InterruptedException e) {
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java b/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java
index 2f97ce27c3..469428a357 100644
--- a/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java
+++ b/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java
@@ -66,6 +66,11 @@ public class ServletIntegrationTests {
notWebsocketCompatible.add("tomcat6");
notWebsocketCompatible.add("tomcat7apacheproxy");
notWebsocketCompatible.add("weblogic10");
+
+ // Requires an update to 8.5.5 and a fix for
+ // https://dev.vaadin.com/ticket/16354
+ // https://developer.ibm.com/answers/questions/186066/websocket-paths-using-uri-templates-do-not-work-pr/
+ notWebsocketCompatible.add("websphere8");
}
public static class ServletIntegrationTestSuite extends TB3TestSuite {
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeFavicon.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeFavicon.java
new file mode 100644
index 0000000000..8995583975
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeFavicon.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.themes;
+
+import java.util.Arrays;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class ThemeChangeFavicon extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ for (final String theme : Arrays.asList("valo", "reindeer")) {
+ addComponent(new Button(theme, new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ setTheme(theme);
+ }
+ }));
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ return "UI for testing that the favicon changes when changing themes";
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java
new file mode 100644
index 0000000000..e4788f93f5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.themes;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class ThemeChangeFaviconTest extends SingleBrowserTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ // Seems like stylesheet onload is not fired on PhantomJS
+ // https://github.com/ariya/phantomjs/issues/12332
+ return Collections.singletonList(Browser.FIREFOX
+ .getDesiredCapabilities());
+ }
+
+ @Test
+ public void changeFavicon() throws InterruptedException {
+ setDebug(true);
+ openTestURL();
+ assertFavicon("reindeer");
+
+ changeTheme("valo");
+ assertFavicon("valo");
+
+ changeTheme("reindeer");
+ assertFavicon("reindeer");
+ }
+
+ private void changeTheme(final String theme) {
+ $(ButtonElement.class).caption(theme).first().click();
+
+ final WebElement rootDiv = findElement(By
+ .xpath("//div[contains(@class,'v-app')]"));
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ String rootClass = rootDiv.getAttribute("class").trim();
+
+ return rootClass.contains(theme);
+ }
+ }, 30);
+ }
+
+ private void assertFavicon(String theme) {
+ String faviconUrl = "/VAADIN/themes/" + theme + "/favicon.ico";
+
+ List<WebElement> elements = findElements(By
+ .cssSelector("link[rel~=\"icon\"]"));
+
+ Assert.assertEquals(2, elements.size());
+
+ for (WebElement element : elements) {
+ Assert.assertTrue(element.getAttribute("href")
+ + " does not end with " + faviconUrl,
+ element.getAttribute("href").endsWith(faviconUrl));
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/util/ResizeTerrorizer.java b/uitest/src/com/vaadin/tests/util/ResizeTerrorizer.java
deleted file mode 100644
index f124305d8a..0000000000
--- a/uitest/src/com/vaadin/tests/util/ResizeTerrorizer.java
+++ /dev/null
@@ -1,51 +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.util;
-
-import com.vaadin.tests.widgetset.client.ResizeTerrorizerControlConnector.ResizeTerorrizerState;
-import com.vaadin.ui.AbstractComponent;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.VerticalLayout;
-
-public class ResizeTerrorizer extends VerticalLayout {
- private final ResizeTerrorizerControl control;
-
- public class ResizeTerrorizerControl extends AbstractComponent implements
- Component {
-
- public ResizeTerrorizerControl(Component target) {
- getState().target = target;
- }
-
- @Override
- protected ResizeTerorrizerState getState() {
- return (ResizeTerorrizerState) super.getState();
- }
- }
-
- public ResizeTerrorizer(Component target) {
- target.setWidth("700px");
- setSizeFull();
- addComponent(target);
- setExpandRatio(target, 1);
- control = new ResizeTerrorizerControl(target);
- addComponent(control);
- }
-
- public void setDefaultWidthOffset(int px) {
- control.getState().defaultWidthOffset = px;
- }
-}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ResizeTerrorizerControlConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/ResizeTerrorizerControlConnector.java
deleted file mode 100644
index 9fe037706b..0000000000
--- a/uitest/src/com/vaadin/tests/widgetset/client/ResizeTerrorizerControlConnector.java
+++ /dev/null
@@ -1,157 +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.widgetset.client;
-
-import com.google.gwt.animation.client.AnimationScheduler;
-import com.google.gwt.animation.client.AnimationScheduler.AnimationCallback;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.IntegerBox;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.RequiresResize;
-import com.vaadin.client.ui.AbstractComponentConnector;
-import com.vaadin.client.ui.PostLayoutListener;
-import com.vaadin.shared.AbstractComponentState;
-import com.vaadin.shared.Connector;
-import com.vaadin.shared.ui.Connect;
-import com.vaadin.tests.util.ResizeTerrorizer;
-
-@Connect(ResizeTerrorizer.ResizeTerrorizerControl.class)
-public class ResizeTerrorizerControlConnector extends
- AbstractComponentConnector implements PostLayoutListener {
-
- public static class ResizeTerorrizerState extends AbstractComponentState {
- public Connector target;
- public int defaultWidthOffset = 200;
- }
-
- public class ResizeTerrorizerControlPanel extends FlowPanel {
- private Label results = new Label("Results");
- private IntegerBox startWidth = new IntegerBox();
- private IntegerBox endWidth = new IntegerBox();
- private final Button terrorizeButton = new Button("Terrorize",
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- terrorize(startWidth.getValue(), endWidth.getValue(),
- 1000);
- }
- });
-
- public ResizeTerrorizerControlPanel() {
- add(new Label("Start width"));
- add(startWidth);
-
- add(new Label("End width"));
- add(endWidth);
-
- add(terrorizeButton);
- add(results);
-
- startWidth.getElement().setId("terror-start-width");
- endWidth.getElement().setId("terror-end-width");
- terrorizeButton.getElement().setId("terror-button");
- results.getElement().setId("terror-results");
- }
-
- private void showResults(String results) {
- Integer temp = startWidth.getValue();
- startWidth.setValue(endWidth.getValue());
- endWidth.setValue(temp);
-
- this.results.setText(results);
- }
- }
-
- private void terrorize(final double startWidth, final double endWidth,
- final double duration) {
- final AbstractComponentConnector target = getTarget();
-
- final AnimationScheduler scheduler = AnimationScheduler.get();
- AnimationCallback callback = new AnimationCallback() {
- double startTime = -1;
- int frameCount = 0;
-
- @Override
- public void execute(double timestamp) {
- frameCount++;
-
- boolean done = false;
- if (startTime == -1) {
- startTime = timestamp;
- }
-
- double time = timestamp - startTime;
- if (time > duration) {
- time = duration;
- done = true;
- }
-
- double progress = time / duration;
- double widthToSet = startWidth + (endWidth - startWidth)
- * progress;
-
- // TODO Optionally inform LayoutManager as well
- target.getWidget().setWidth(widthToSet + "px");
- if (target.getWidget() instanceof RequiresResize) {
- ((RequiresResize) target.getWidget()).onResize();
- }
-
- if (!done) {
- scheduler.requestAnimationFrame(this);
- } else {
- double fps = Math.round(frameCount / (duration / 1000));
- String results = frameCount + " frames, " + fps + " fps";
-
- getWidget().showResults(results);
- }
- }
- };
- scheduler.requestAnimationFrame(callback);
- }
-
- private AbstractComponentConnector getTarget() {
- return (AbstractComponentConnector) getState().target;
- }
-
- @Override
- public ResizeTerorrizerState getState() {
- return (ResizeTerorrizerState) super.getState();
- }
-
- @Override
- public ResizeTerrorizerControlPanel getWidget() {
- return (ResizeTerrorizerControlPanel) super.getWidget();
- }
-
- @Override
- protected ResizeTerrorizerControlPanel createWidget() {
- return new ResizeTerrorizerControlPanel();
- }
-
- @Override
- public void postLayout() {
- if (getWidget().startWidth.getValue() == null) {
- int width = getTarget().getWidget().getElement().getOffsetWidth();
- getWidget().startWidth.setValue(width);
- getWidget().endWidth
- .setValue(width + getState().defaultWidthOffset);
- }
- }
-
-}
diff --git a/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java b/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java
index c7b29e271b..1bdbba2c36 100644
--- a/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java
+++ b/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java
@@ -136,9 +136,6 @@ public class TestWidgetRegistryGenerator extends Generator {
} else if (!widgetType.getPackage().getName()
.startsWith(TestWidgetConnector.class.getPackage().getName())) {
return false;
- } else if (widgetType.getEnclosingType() != null
- && !widgetType.isStatic()) {
- return false;
}
return true;