From 16d17f9824dfac7e55e3ca98444f9da3205c0336 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 6 Aug 2013 13:59:33 +0300 Subject: Fix native scrolling regression in iOS 6 homescreen apps (#12295) Change-Id: Ie225663ebc2a9ffe4b481a49e34e9dcf79b064b2 --- WebContent/VAADIN/themes/base/common/common.scss | 4 ++-- client/src/com/vaadin/client/BrowserInfo.java | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/WebContent/VAADIN/themes/base/common/common.scss b/WebContent/VAADIN/themes/base/common/common.scss index c32116cda8..cb3645c9d8 100644 --- a/WebContent/VAADIN/themes/base/common/common.scss +++ b/WebContent/VAADIN/themes/base/common/common.scss @@ -228,8 +228,8 @@ input::-ms-clear { line-height: normal; } -/* Enable kinetic scrolling on Mobile Safari 6 */ -.v-ios.v-sa6 & .v-scrollable { +/* Enable kinetic scrolling on iOS 6 */ +.v-ios6.v-webkit & .v-scrollable { -webkit-overflow-scrolling: touch; } diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java index c733f38481..5d588f6f8b 100644 --- a/client/src/com/vaadin/client/BrowserInfo.java +++ b/client/src/com/vaadin/client/BrowserInfo.java @@ -190,7 +190,7 @@ public class BrowserInfo { } String osClass = getOperatingSystemClass(); if (osClass != null) { - cssClass = cssClass + " " + prefix + osClass; + cssClass = cssClass + " " + osClass; } if (isTouchDevice()) { cssClass = cssClass + " " + prefix + UI_TOUCH; @@ -201,16 +201,22 @@ public class BrowserInfo { } private String getOperatingSystemClass() { + String prefix = "v-"; + if (browserDetails.isAndroid()) { - return OS_ANDROID; + return prefix + OS_ANDROID; } else if (browserDetails.isIOS()) { - return OS_IOS; + String iosClass = prefix + OS_IOS; + if (isIOS6()) { + iosClass += " " + prefix + OS_IOS + "6"; + } + return iosClass; } else if (browserDetails.isWindows()) { - return OS_WINDOWS; + return prefix + OS_WINDOWS; } else if (browserDetails.isLinux()) { - return OS_LINUX; + return prefix + OS_LINUX; } else if (browserDetails.isMacOSX()) { - return OS_MACOSX; + return prefix + OS_MACOSX; } // Unknown OS return null; -- cgit v1.2.3 From 7212e02a9b4eb02759f7b2195187a6e6db6bfb33 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 5 Aug 2013 15:47:16 +0300 Subject: Fix race in VaadinService.lockSession() (#12282) The session might be invalidated before lockSession() acquires the lock. Check if the session is still valid after locking and ensure SessionExpiredException is thrown if not. Change-Id: Iad716332a65b7c198427fce5198f6808140c140c --- server/src/com/vaadin/server/VaadinService.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index 17bce7ad15..c9a5f0974a 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -564,6 +564,9 @@ public abstract class VaadinService implements Serializable { * * @param wrappedSession * The session to lock + * + * @throws IllegalStateException + * if the session is invalidated before it can be locked */ protected void lockSession(WrappedSession wrappedSession) { Lock lock = getSessionLock(wrappedSession); @@ -584,6 +587,17 @@ public abstract class VaadinService implements Serializable { } } lock.lock(); + + try { + // Someone might have invalidated the session between fetching the + // lock and acquiring it. Guard for this by calling a method that's + // specified to throw IllegalStateException if invalidated + // (#12282) + wrappedSession.getAttribute(getLockAttributeName()); + } catch (IllegalStateException e) { + lock.unlock(); + throw e; + } } /** @@ -607,7 +621,12 @@ public abstract class VaadinService implements Serializable { WrappedSession wrappedSession = getWrappedSession(request, requestCanCreateSession); - lockSession(wrappedSession); + try { + lockSession(wrappedSession); + } catch (IllegalStateException e) { + throw new SessionExpiredException(); + } + try { return doFindOrCreateVaadinSession(request, requestCanCreateSession); } finally { -- cgit v1.2.3 From 2d5a10718e1ef794e223a143f387595c0ef68ca4 Mon Sep 17 00:00:00 2001 From: denisanisimov Date: Tue, 6 Aug 2013 16:19:40 +0300 Subject: Update "lastRequestedFirstvisible" field value right away (#10666). Change-Id: Idef31fa74f4720b5c55511de0545cd8ae1b77b26 --- client/src/com/vaadin/client/ui/VScrollTable.java | 19 ++-- .../table/SetCurrentPageFirstItemIndex.html | 43 ++++++++ .../table/SetCurrentPageFirstItemIndex.java | 112 +++++++++++++++++++++ 3 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html create mode 100644 uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 2d177f29b5..3733ee204a 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -1123,6 +1123,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (firstvisible != lastRequestedFirstvisible && scrollBody != null) { // received 'surprising' firstvisible from server: scroll there firstRowInViewPort = firstvisible; + // Update lastRequestedFirstvisible right away here + // (don't rely on update in the timer which could be cancelled). + lastRequestedFirstvisible = firstRowInViewPort; /* * Schedule the scrolling to be executed last so no updates to the @@ -2406,12 +2409,16 @@ public class VScrollTable extends FlowPanel implements HasWidgets, firstToBeRendered, false); client.updateVariable(paintableId, "lastToBeRendered", lastToBeRendered, false); - // remember which firstvisible we requested, in case the server - // has - // a differing opinion - lastRequestedFirstvisible = firstRowInViewPort; - client.updateVariable(paintableId, "firstvisible", - firstRowInViewPort, false); + + // don't request server to update page first index in case it + // has not been changed + if (firstRowInViewPort != firstvisible) { + // remember which firstvisible we requested, in case the + // server has a differing opinion + lastRequestedFirstvisible = firstRowInViewPort; + client.updateVariable(paintableId, "firstvisible", + firstRowInViewPort, false); + } client.updateVariable(paintableId, "reqfirstrow", reqFirstRow, false); client.updateVariable(paintableId, "reqrows", reqRows, true); diff --git a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html new file mode 100644 index 0000000000..904f3b0470 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html @@ -0,0 +1,43 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
openrun/com.vaadin.tests.components.table.SetCurrentPageFirstItemIndex?restartApplication
clickvaadin=runcomvaadintestscomponentstableSetCurrentPageFirstItemIndex::/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]
clickvaadin=runcomvaadintestscomponentstableSetCurrentPageFirstItemIndex::/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]
pause500
assertTextvaadin=runcomvaadintestscomponentstableSetCurrentPageFirstItemIndex::/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]6
+ + \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java new file mode 100644 index 0000000000..574f1d1862 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.java @@ -0,0 +1,112 @@ +/* + * Copyright 2000-2013 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.table; + +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.Table; +import com.vaadin.ui.Table.ColumnGenerator; +import com.vaadin.ui.Table.ColumnHeaderMode; +import com.vaadin.ui.VerticalLayout; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class SetCurrentPageFirstItemIndex extends AbstractTestUI { + + private int index = 5; + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + VerticalLayout vl = new VerticalLayout(); + setContent(vl); + + final Table imageTable = new Table(); + vl.addComponent(imageTable); + + imageTable.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); + imageTable.setPageLength(1); + imageTable.addGeneratedColumn("image", new ImageGenerator()); + imageTable.setWidth(500, Unit.PIXELS); + + for (int i = 1; i <= 25; i++) { + imageTable.addItem(new Integer(i)); + } + + imageTable.setCurrentPageFirstItemIndex(index); + + vl.addComponent(new Button("Click", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + } + if (index != 5) { + index = 5; + imageTable.setCurrentPageFirstItemIndex(index); + } else { + index = 20; + imageTable.setCurrentPageFirstItemIndex(index); + } + } + })); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Field lastRequestedFirstvisible should be updated out of timer."; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 10666; + } + + public class ImageGenerator implements ColumnGenerator { + + @Override + public Object generateCell(Table source, Object itemId, Object columnId) { + return "" + itemId; + } + } + +} -- cgit v1.2.3 From 325cdf92e93135df2ba1ca990223bfc507bff4b8 Mon Sep 17 00:00:00 2001 From: Patrik Lindström Date: Wed, 7 Aug 2013 11:08:13 +0300 Subject: Disable failing calendar Actions Menu Test (#12181) This test cannot be completed in a smart fashion until TestBench 3 is in use, because of differences in the DOM structure created by GWT for IE and Opera, versus Webkit and Gecko browsers. TB2 requires identical DOM structure for assertion queries to work. Change-Id: I6f5f9aac1c25e4e105459da215db080b031b2aab --- .../calendar/CalendarActionsMenuTest.htm | 71 ++++++++++++++++++++++ .../calendar/CalendarActionsMenuTest.html | 71 ---------------------- 2 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.htm delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.html diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.htm b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.htm new file mode 100644 index 0000000000..95f9137b79 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.htm @@ -0,0 +1,71 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.calendar.CalendarActionsMenuTest?restartApplication
contextmenuvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[1]
assertText//td[@class='gwt-MenuItem']/divACTION
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[2]127,5
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]155,9
contextmenuvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[34]/domChild[1]
assertText//td[@class='gwt-MenuItem']/divACTION
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[13]139,0
contextmenuvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[14]
assertText//td[@class='gwt-MenuItem']/divACTION
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[13]139,0
+ + diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.html deleted file mode 100644 index 3830faa7de..0000000000 --- a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.calendar.CalendarActionsMenuTest?restartApplication
contextmenuvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[1]
assertText//td[@id='gwt-uid-5']/divACTION
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[2]127,5
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]155,9
contextmenuvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[34]/domChild[1]
assertText//td[@id='gwt-uid-6']/divACTION
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[13]139,0
contextmenuvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[14]
assertText//td[@id='gwt-uid-14']/divACTION
mouseClickvaadin=runcomvaadintestscomponentscalendarCalendarActionsMenuTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[13]139,0
- - -- cgit v1.2.3 From 8ba41172216a98a45f82319d9a98d04a26efa52a Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 7 Aug 2013 11:22:09 +0300 Subject: Split UiAccess test (#12332) Change-Id: I231e84d84adca79549d00a88dd4ae613ff291dbc --- .../com/vaadin/tests/components/ui/UiAccess.html | 26 -------------- .../vaadin/tests/components/ui/UiAccessPush.html | 41 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html index 734b95952a..613691623c 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html +++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html @@ -161,32 +161,6 @@ vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0 3. Test value after access: Set before run pending - - - open - /run/com.vaadin.tests.components.ui.UiAccess?restartApplication&transport=websocket - - - - click - vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[7]/VButton[0]/domChild[0]/domChild[0] - - - - waitForNotText - vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0 - - - - assertText - vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0 - exact:1. Current session matches in beforeResponse? true - - - assertText - vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1 - exact:0. Current UI matches in beforeResponse? true - diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html b/uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html new file mode 100644 index 0000000000..bc29534ee4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UiAccessPush.html @@ -0,0 +1,41 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.ui.UiAccess?restartApplication&transport=websocket
clickvaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[7]/VButton[0]/domChild[0]/domChild[0]
waitForNotTextvaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0
assertTextvaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0exact:1. Current session matches in beforeResponse? true
assertTextvaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1exact:0. Current UI matches in beforeResponse? true
+ + -- cgit v1.2.3