summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebContent/VAADIN/themes/tests-tickets/styles.css13
-rw-r--r--client/src/com/vaadin/client/BrowserInfo.java9
-rw-r--r--client/src/com/vaadin/client/ui/VOverlay.java65
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java16
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java8
-rw-r--r--server/src/com/vaadin/ui/AbstractField.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.html52
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.html37
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.java79
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/window/CenteredInVisualViewport.java66
-rw-r--r--uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java34
-rw-r--r--uitest/src/com/vaadin/tests/containers/sqlcontainer/SqlcontainertableApplication.java47
14 files changed, 526 insertions, 7 deletions
diff --git a/WebContent/VAADIN/themes/tests-tickets/styles.css b/WebContent/VAADIN/themes/tests-tickets/styles.css
index c1dd89d6b8..b96fcbb23d 100644
--- a/WebContent/VAADIN/themes/tests-tickets/styles.css
+++ b/WebContent/VAADIN/themes/tests-tickets/styles.css
@@ -1,6 +1,17 @@
@import url(../runo/legacy-styles.css);
-/* DO NOT ADD GENERIC RULES LIKE .v-table IN THIS FILE */
+/* DO NOT ADD GENERIC RULES LIKE .v-table IN THIS FILE */
+/* Instead prefix with e.g .v-app-<TestClass> or other unique selectors */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* com.vaadin.tests.components.combobox.ComboBoxBorder */
+/*****************************************************************************/
+.v-slot-ComboBoxBorder .v-filterselect-error {
+ /* Ticket 11267 */
+ border: 1px solid #FF0000 ;
+ height: 25px; /* runo: 23+2, reindeer: 24+2 */
+}
/*****************************************************************************/
/* Ticket 1904 */
diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java
index 73f3a68193..b3490c3ca4 100644
--- a/client/src/com/vaadin/client/BrowserInfo.java
+++ b/client/src/com/vaadin/client/BrowserInfo.java
@@ -396,10 +396,19 @@ public class BrowserInfo {
&& (getOperatingSystemMajorVersion() == 3 || getOperatingSystemMajorVersion() == 4);
}
+ public boolean isAndroid23() {
+ return isAndroid() && getOperatingSystemMajorVersion() == 2
+ && getOperatingSystemMinorVersion() == 3;
+ }
+
private int getOperatingSystemMajorVersion() {
return browserDetails.getOperatingSystemMajorVersion();
}
+ private int getOperatingSystemMinorVersion() {
+ return browserDetails.getOperatingSystemMinorVersion();
+ }
+
/**
* Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome
* 4, 8 for Internet Explorer 8.
diff --git a/client/src/com/vaadin/client/ui/VOverlay.java b/client/src/com/vaadin/client/ui/VOverlay.java
index d35201460e..9e809758ca 100644
--- a/client/src/com/vaadin/client/ui/VOverlay.java
+++ b/client/src/com/vaadin/client/ui/VOverlay.java
@@ -27,6 +27,7 @@ import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -689,4 +690,68 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
return container;
}
+ @Override
+ public void center() {
+ super.center();
+
+ // Some devices can be zoomed in, we should center to the visual
+ // viewport for those devices
+ BrowserInfo b = BrowserInfo.get();
+ if (b.isAndroid() || b.isIOS()) {
+ int left = (getVisualViewportWidth() - getOffsetWidth()) >> 1;
+ int top = (getVisualViewportHeight() - getOffsetHeight()) >> 1;
+ setPopupPosition(Math.max(Window.getScrollLeft() + left, 0),
+ Math.max(Window.getScrollTop() + top, 0));
+ }
+
+ }
+
+ /**
+ * Gets the visual viewport width, which is useful for e.g iOS where the
+ * view can be zoomed in while keeping the layout viewport intact.
+ *
+ * Falls back to layout viewport; for those browsers/devices the difference
+ * is that the scrollbar with is included (if there is a scrollbar).
+ *
+ * @since 7.0.7
+ * @return
+ */
+ private int getVisualViewportWidth() {
+ int w = (int) getSubpixelInnerWidth();
+ if (w < 0) {
+ return Window.getClientWidth();
+ } else {
+ return w;
+ }
+ }
+
+ /**
+ * Gets the visual viewport height, which is useful for e.g iOS where the
+ * view can be zoomed in while keeping the layout viewport intact.
+ *
+ * Falls back to layout viewport; for those browsers/devices the difference
+ * is that the scrollbar with is included (if there is a scrollbar).
+ *
+ * @since 7.0.7
+ * @return
+ */
+ private int getVisualViewportHeight() {
+ int h = (int) getSubpixelInnerHeight();
+ if (h < 0) {
+ return Window.getClientHeight();
+ } else {
+ return h;
+ }
+ }
+
+ private native double getSubpixelInnerWidth()
+ /*-{
+ return $wnd.innerWidth !== undefined ? $wnd.innerWidth : -1;
+ }-*/;
+
+ private native double getSubpixelInnerHeight()
+ /*-{
+ return $wnd.innerHeight !== undefined ? $wnd.innerHeight :-1;
+ }-*/;
+
}
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index 8705a826cc..e2e82a1959 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -6692,6 +6692,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private void setContainerHeight() {
if (!isDynamicHeight()) {
+
+ /*
+ * Android 2.3 cannot measure the height of the inline-block
+ * properly, and will return the wrong offset height. So for android
+ * 2.3 we set the element to a block element while measuring and
+ * then restore it which yields the correct result. #11331
+ */
+ if (BrowserInfo.get().isAndroid23()) {
+ getElement().getStyle().setDisplay(Display.BLOCK);
+ }
+
containerHeight = getOffsetHeight();
containerHeight -= showColHeaders ? tHead.getOffsetHeight() : 0;
containerHeight -= tFoot.getOffsetHeight();
@@ -6699,7 +6710,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (containerHeight < 0) {
containerHeight = 0;
}
+
scrollBodyPanel.setHeight(containerHeight + "px");
+
+ if (BrowserInfo.get().isAndroid23()) {
+ getElement().getStyle().clearDisplay();
+ }
}
}
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
index 987466cdb7..e9a1a2d98f 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
@@ -648,23 +648,25 @@ public class SQLContainer implements Container, Container.Filterable,
getPage();
}
int size = size();
- boolean wrappedAround = false;
- while (!wrappedAround) {
+ // this protects against infinite looping
+ int counter = 0;
+ while (counter < size) {
for (Integer i : itemIndexes.keySet()) {
if (itemIndexes.get(i).equals(itemId)) {
return i;
}
+ counter++;
}
// load in the next page.
int nextIndex = (currentOffset / (pageLength * CACHE_RATIO) + 1)
* (pageLength * CACHE_RATIO);
if (nextIndex >= size) {
// Container wrapped around, start from index 0.
- wrappedAround = true;
nextIndex = 0;
}
updateOffsetAndCache(nextIndex);
}
+ // safeguard in case item not found
return -1;
}
diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java
index 6648f69ff9..3bca63a3b7 100644
--- a/server/src/com/vaadin/ui/AbstractField.java
+++ b/server/src/com/vaadin/ui/AbstractField.java
@@ -323,7 +323,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
*/
@Override
public boolean isModified() {
- return getState().modified;
+ return getState(false).modified;
}
private void setModified(boolean modified) {
@@ -1276,7 +1276,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
*/
@Override
public int getTabIndex() {
- return getState().tabIndex;
+ return getState(false).tabIndex;
}
/*
@@ -1408,7 +1408,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
*/
@Override
public boolean isRequired() {
- return getState().required;
+ return getState(false).required;
}
/**
@@ -1663,6 +1663,11 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
@Override
+ protected AbstractFieldState getState(boolean markAsDirty) {
+ return (AbstractFieldState) super.getState(markAsDirty);
+ }
+
+ @Override
public void beforeClientResponse(boolean initial) {
super.beforeClientResponse(initial);
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.html
new file mode 100644
index 0000000000..7e7bb7722d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.html
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>ComboBoxBorder</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ComboBoxBorder</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/ComboBoxBorder?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runComboBoxBorder::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]#textbox</td>
+ <td>53,10</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runComboBoxBorder::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]#textbox</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runComboBoxBorder::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]#textbox</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runComboBoxBorder::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]#textbox</td>
+ <td>down</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runComboBoxBorder::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]#textbox</td>
+ <td>enter</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.java
new file mode 100644
index 0000000000..731e23188e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxBorder.java
@@ -0,0 +1,43 @@
+package com.vaadin.tests.components.combobox;
+
+import java.util.Arrays;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.UserError;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxBorder extends TestBase {
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+
+ final ComboBox cb = new ComboBox("All errors", Arrays.asList("Error",
+ "Error 2"));
+ cb.setStyleName("ComboBoxBorder");
+ cb.setImmediate(true);
+ cb.setWidth("200px"); // must have with to reproduce
+
+ cb.addListener(new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ cb.setComponentError(new UserError("Error"));
+ }
+ });
+
+ addComponent(cb);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Adding a border as a result of styleName change should not break the ComboBox";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11267;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.html b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.html
new file mode 100644
index 0000000000..e98c8bd41c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.html
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>DragAndDropWrapperInPanel</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">DragAndDropWrapperInPanel</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.draganddropwrapper.DragAndDropWrapperInPanel?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>no-scrollbars</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperInPanel::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>resized-no-scrollbars</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.java
new file mode 100644
index 0000000000..6a680abdf0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2012 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.draganddropwrapper;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.DragAndDropWrapper;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TextArea;
+
+public class DragAndDropWrapperInPanel extends TestBase {
+
+ @Override
+ protected void setup() {
+
+ addComponent(new Button("Click to resize", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ for (int i = 1; i < getLayout().getComponentCount(); ++i) {
+ Component c = getLayout().getComponent(i);
+ c.setWidth("400px");
+ c.setHeight("200px");
+ }
+ }
+ }));
+
+ Component content;
+
+ content = new Button("Undefined-sized Button");
+ content.setSizeUndefined();
+ addDnDPanel(content);
+
+ content = new Label("Full-sized Label");
+ content.setSizeFull();
+ addDnDPanel(content);
+
+ content = new TextArea(null, "200x100px TextArea");
+ content.setWidth("200px");
+ content.setHeight("100px");
+ addDnDPanel(content);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A full-sized DragAndDropWrapper causes scrollbars inside Panel";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6880;
+ }
+
+ private void addDnDPanel(Component content) {
+ Panel panel = new Panel();
+ panel.setSizeUndefined();
+ panel.setWidth("300px");
+ panel.setHeight("150px");
+ DragAndDropWrapper dndWrapper = new DragAndDropWrapper(content);
+ dndWrapper.setSizeFull();
+ panel.setContent(dndWrapper);
+ addComponent(panel);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java
new file mode 100644
index 0000000000..8312b15ba7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutWithNonIntegerWidth.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.gridlayout;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * Main UI class
+ */
+@SuppressWarnings("serial")
+public class GridLayoutWithNonIntegerWidth extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Panel p1 = new Panel("Panel with GridLayout");
+ GridLayout grid = new GridLayout(1, 1, new Label("A"));
+ grid.setWidth(100, Unit.PERCENTAGE);
+ p1.setContent(grid);
+ p1.setWidth("354.390625px");
+
+ Panel p2 = new Panel("Panel with HorizontalLayout");
+ HorizontalLayout hl = new HorizontalLayout(new Label("A"));
+ hl.setWidth(100, Unit.PERCENTAGE);
+ p2.setContent(hl);
+ p2.setWidth("354.390625px");
+
+ setContent(new VerticalLayout(p1, p2));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Neither of the panels should contain scrollbars";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 11775;
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/CenteredInVisualViewport.java b/uitest/src/com/vaadin/tests/components/window/CenteredInVisualViewport.java
new file mode 100644
index 0000000000..428b2ae3f9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/CenteredInVisualViewport.java
@@ -0,0 +1,66 @@
+package com.vaadin.tests.components.window;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class CenteredInVisualViewport extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Should open centered, even if zoomed in on one button (e.g zoom in iOS)";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11614;
+ }
+
+ @Override
+ protected void setup() {
+ GridLayout layout = new GridLayout(3, 3);
+ layout.setWidth("1000px");
+ layout.setHeight("1000px");
+ addComponent(layout);
+
+ Button b = new Button("Open", new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Window centered = new Window("A window", new Label(
+ "Centered window"));
+ centered.center();
+ getMainWindow().addWindow(centered);
+ }
+ });
+ layout.addComponent(b, 0, 0);
+
+ b = new Button("Open", new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Window centered = new Window("A window", new Label(
+ "Centered window"));
+ centered.center();
+ getMainWindow().addWindow(centered);
+ }
+ });
+ layout.addComponent(b, 1, 1);
+
+ b = new Button("Open", new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Window centered = new Window("A window", new Label(
+ "Centered window"));
+ centered.center();
+ getMainWindow().addWindow(centered);
+ }
+ });
+ layout.addComponent(b, 2, 2);
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java
index 287d772901..7e95a41742 100644
--- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java
+++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java
@@ -15,6 +15,8 @@ class DatabaseHelper {
private JDBCConnectionPool connectionPool = null;
private SQLContainer testContainer = null;
private static final String TABLENAME = "testtable";
+ private SQLContainer largeContainer = null;
+ private static final String LARGE_TABLENAME = "largetable";
public DatabaseHelper() {
initConnectionPool();
@@ -32,24 +34,42 @@ class DatabaseHelper {
// Will fail if table doesn't exist, which is OK.
conn.rollback();
}
+ try {
+ statement.execute("drop table " + LARGE_TABLENAME);
+ } catch (SQLException e) {
+ // Will fail if table doesn't exist, which is OK.
+ conn.rollback();
+ }
switch (SQLTestsConstants.db) {
case HSQLDB:
statement
.execute("create table "
+ TABLENAME
+ " (id integer GENERATED BY DEFAULT AS IDENTITY, field1 varchar(100), field2 boolean, primary key(id))");
+ statement
+ .execute("create table "
+ + LARGE_TABLENAME
+ + " (id integer GENERATED BY DEFAULT AS IDENTITY, field1 varchar(100), primary key(id))");
break;
case MYSQL:
statement
.execute("create table "
+ TABLENAME
+ " (id integer auto_increment not null, field1 varchar(100), field2 boolean, primary key(id))");
+ statement
+ .execute("create table "
+ + LARGE_TABLENAME
+ + " (id integer auto_increment not null, field1 varchar(100), primary key(id))");
break;
case POSTGRESQL:
statement
.execute("create table "
+ TABLENAME
+ " (\"id\" serial primary key, \"field1\" varchar(100), \"field2\" boolean)");
+ statement
+ .execute("create table "
+ + LARGE_TABLENAME
+ + " (\"id\" serial primary key, \"field1\" varchar(100))");
break;
}
statement.executeUpdate("insert into " + TABLENAME
@@ -58,6 +78,12 @@ class DatabaseHelper {
+ " values(default, 'Ville', 'true')");
statement.executeUpdate("insert into " + TABLENAME
+ " values(default, 'Jussi', 'true')");
+
+ for (int i = 0; i < 400; ++i) {
+ statement.executeUpdate("insert into " + LARGE_TABLENAME
+ + " values(default, 'User " + i + "')");
+ }
+
statement.close();
conn.commit();
connectionPool.releaseConnection(conn);
@@ -71,6 +97,10 @@ class DatabaseHelper {
TableQuery q1 = new TableQuery(TABLENAME, connectionPool);
q1.setVersionColumn("id");
testContainer = new SQLContainer(q1);
+
+ TableQuery q2 = new TableQuery(LARGE_TABLENAME, connectionPool);
+ q2.setVersionColumn("id");
+ largeContainer = new SQLContainer(q2);
} catch (SQLException e) {
e.printStackTrace();
}
@@ -89,4 +119,8 @@ class DatabaseHelper {
public SQLContainer getTestContainer() {
return testContainer;
}
+
+ public SQLContainer getLargeContainer() {
+ return largeContainer;
+ }
} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/SqlcontainertableApplication.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/SqlcontainertableApplication.java
new file mode 100644
index 0000000000..8d4f1c5842
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/SqlcontainertableApplication.java
@@ -0,0 +1,47 @@
+package com.vaadin.tests.containers.sqlcontainer;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.LegacyApplication;
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.Table;
+
+public class SqlcontainertableApplication extends LegacyApplication {
+ private LegacyWindow mainWindow;
+ private Table table;
+ private HorizontalSplitPanel panel;
+ private Label label = new Label();
+
+ @Override
+ public void init() {
+ mainWindow = new LegacyWindow("SQLContainer Test");
+ setMainWindow(mainWindow);
+ mainWindow.getContent().setSizeFull();
+
+ panel = new HorizontalSplitPanel();
+ panel.setSecondComponent(label);
+
+ final DatabaseHelper helper = new DatabaseHelper();
+ table = new Table();
+ table.setSizeFull();
+ table.setContainerDataSource(helper.getLargeContainer());
+ table.setSelectable(true);
+ table.setImmediate(true);
+ table.setMultiSelect(true);
+ table.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ label.setValue(table.getValue().toString());
+ }
+ });
+
+ panel.setSizeFull();
+ panel.addComponent(table);
+
+ mainWindow.addComponent(panel);
+
+ }
+
+} \ No newline at end of file