From 85c03155dc02e61dd10a9c861b064204bdeaca9f Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 1 Aug 2012 12:20:21 +0000 Subject: Remember previous row height to maintain table size when all rows are removed (#9132) svn changeset:24041/svn branch:6.8 --- .../components/table/TableRowNoHeightNoRows.html | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/table/TableRowNoHeightNoRows.html (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/table/TableRowNoHeightNoRows.html b/tests/testbench/com/vaadin/tests/components/table/TableRowNoHeightNoRows.html new file mode 100644 index 0000000000..35d64c3a0c --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TableRowNoHeightNoRows.html @@ -0,0 +1,122 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.table.Tables?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item029,11
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item540,5
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item153,9
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item04,6
mouseClickvaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item034,8
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item840,6
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item497,5
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item055,6
screenCapture1-no-rows-small
mouseClickvaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item023,5
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item526,1
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item168,10
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item118,13
screenCapture2-one-row-big
mouseClickvaadin=runcomvaadintestscomponentstableTables::PID_Smenu#item028,10
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[0]/VMenuBar[0]#item534,6
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[1]/VMenuBar[0]#item162,4
mouseClickvaadin=runcomvaadintestscomponentstableTables::Root/VOverlay[2]/VMenuBar[0]#item025,4
screenCapture3-no-rows-big
+ + -- cgit v1.2.3 From 6685816c2a548bad3d827d3064a70f35e7b69361 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 2 Aug 2012 12:11:08 +0000 Subject: Clear selectionRangeStart if the key map has been cleared (#8584, #8736) svn changeset:24045/svn branch:6.8 --- .../terminal/gwt/client/ui/VScrollTable.java | 20 +++ src/com/vaadin/ui/Table.java | 16 +++ .../table/MultiSelectWithRemovedRow.html | 150 +++++++++++++++++++++ .../table/MultiSelectWithRemovedRow.java | 90 +++++++++++++ 4 files changed, 276 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.html create mode 100644 tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java (limited to 'tests') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index c1f90b0157..e54493ca61 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -109,6 +109,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, public static final String ATTRIBUTE_PAGEBUFFER_FIRST = "pb-ft"; public static final String ATTRIBUTE_PAGEBUFFER_LAST = "pb-l"; + /** + * Tell the client that old keys are no longer valid because the server has + * cleared its key map. + */ + public static final String ATTRIBUTE_KEY_MAPPER_RESET = "clearKeyMap"; + private static final String ROW_HEADER_COLUMN_KEY = "0"; public static final String CLASSNAME = "v-table"; @@ -1051,6 +1057,20 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } } + /* + * If the server has (re)initialized the rows, our selectionRangeStart + * row will point to an index that the server knows nothing about, + * causing problems if doing multi selection with shift. The field will + * be cleared a little later when the row focus has been restored. + * (#8584) + */ + if (uidl.hasAttribute(ATTRIBUTE_KEY_MAPPER_RESET) + && uidl.getBooleanAttribute(ATTRIBUTE_KEY_MAPPER_RESET) + && selectionRangeStart != null) { + assert !selectionRangeStart.isAttached(); + selectionRangeStart = focusedRow; + } + tabIndex = uidl.hasAttribute("tabindex") ? uidl .getIntAttribute("tabindex") : 0; setProperTabIndex(); diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index e96636dd70..e56f6003ab 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -413,6 +413,13 @@ public class Table extends AbstractSelect implements Action.Container, private boolean painted = false; + /** + * Set to true if the client-side should be informed that the key mapper has + * been reset so it can avoid sending back references to keys that are no + * longer present. + */ + private boolean keyMapperReset; + /* Table constructors */ /** @@ -2772,6 +2779,11 @@ public class Table extends AbstractSelect implements Action.Container, paintVisibleColumns(target); + if (keyMapperReset) { + keyMapperReset = false; + target.addAttribute(VScrollTable.ATTRIBUTE_KEY_MAPPER_RESET, true); + } + if (dropHandler != null) { dropHandler.getAcceptCriterion().paint(target); } @@ -3923,6 +3935,10 @@ public class Table extends AbstractSelect implements Action.Container, public void containerItemSetChange(Container.ItemSetChangeEvent event) { super.containerItemSetChange(event); + // super method clears the key map, must inform client about this to + // avoid getting invalid keys back (#8584) + keyMapperReset = true; + // ensure that page still has first item in page, ignore buffer refresh // (forced in this method) setCurrentPageFirstItemIndex(getCurrentPageFirstItemIndex(), false); diff --git a/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.html b/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.html new file mode 100644 index 0000000000..c41f3fbfdd --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.html @@ -0,0 +1,150 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.table.MultiSelectWithRemovedRow?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]34,9
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::PID_SLog_row_01. Selection: [Joe]
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]19,4:shift
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::PID_SLog_row_02. Selection: [William, Jack, Averell]
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]23,13
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]26,10:shift
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::PID_SLog_row_03. Selection: [Jack, Averell, Bob]
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]34,14:shift
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::PID_SLog_row_04. Selection: [William, Averell, Bob, Grat]
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]31,15
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]36,11
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]30,6:shift
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::PID_SLog_row_05. Selection: [Bob, Emmett, Grat]
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]24,8
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]11,2
mouseClickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]30,11:shift
clickvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableMultiSelectWithRemovedRow::PID_SLog_row_06. Selection: [Grat, Emmett, Bob]
+ + diff --git a/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java b/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java new file mode 100644 index 0000000000..64b9c503c3 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java @@ -0,0 +1,90 @@ +package com.vaadin.tests.components.table; + +import java.util.Arrays; +import java.util.Collection; + +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Table; + +@SuppressWarnings("serial") +public class MultiSelectWithRemovedRow extends TestBase { + public static class Person { + private final String name; + + public Person(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public String toString() { + return name; + } + } + + @Override + protected void setup() { + final Log log = new Log(5); + addComponent(log); + + final BeanItemContainer container = new BeanItemContainer( + Person.class, Arrays.asList(new Person("Joe"), new Person( + "William"), new Person("Jack"), new Person("Averell"), + new Person("Bob"), new Person("Grat"), new Person( + "Bill"), new Person("Emmett"))); + final Table table = new Table("Table", container); + table.setSelectable(true); + table.setMultiSelect(true); + table.setImmediate(true); + addComponent(table); + + Button showButton = new Button("Show selection"); + showButton.addListener(new Button.ClickListener() { + public void buttonClick(Button.ClickEvent clickEvent) { + Collection selection = (Collection) table.getValue(); + log.log("Selection: " + selection); + } + }); + addComponent(showButton); + + Button removeButton = new Button("Remove selection"); + removeButton.addListener(new Button.ClickListener() { + public void buttonClick(Button.ClickEvent clickEvent) { + Collection selection = (Collection) table.getValue(); + for (Object selected : selection) { + container.removeItem(selected); + } + } + }); + addComponent(removeButton); + + addComponent(new Button("Remove first selected row", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Collection selection = (Collection) table + .getValue(); + if (!selection.isEmpty()) { + Object firstSelected = selection.iterator().next(); + container.removeItem(firstSelected); + } + } + })); + } + + @Override + protected String getDescription() { + return "Multi select using shift should work after removing the currently selected row"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8584); + } +} \ No newline at end of file -- cgit v1.2.3 From 3e908d6e17e3743be5b62d49010194b8ae29627c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 3 Aug 2012 07:50:35 +0000 Subject: Test using Chrome 21 (#9202) svn changeset:24047/svn branch:6.8 --- tests/test.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test.xml b/tests/test.xml index 3964573d89..76932bd75f 100644 --- a/tests/test.xml +++ b/tests/test.xml @@ -5,7 +5,7 @@ - + -- cgit v1.2.3 From bc5831f069f648fbf0d89a863b28d80dc4c2bf35 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Fri, 3 Aug 2012 10:35:51 +0000 Subject: Make LoginForm work inside iframes (#8144) Automatic test case included but not enabled because it does not currently work with IE6-8 svn changeset:24053/svn branch:6.8 --- WebContent/statictestfiles/LoginFormIframe.html | 14 +++++ src/com/vaadin/ui/LoginForm.java | 6 +-- .../loginform/LoginFormInIframe.html_disabled | 61 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 WebContent/statictestfiles/LoginFormIframe.html create mode 100644 tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled (limited to 'tests') diff --git a/WebContent/statictestfiles/LoginFormIframe.html b/WebContent/statictestfiles/LoginFormIframe.html new file mode 100644 index 0000000000..0d6ee9d86b --- /dev/null +++ b/WebContent/statictestfiles/LoginFormIframe.html @@ -0,0 +1,14 @@ + + + + +LoginForm + + + +

Tests that LoginForm can be submitted even when the Application is embedded inside an iframe

+ + + \ No newline at end of file diff --git a/src/com/vaadin/ui/LoginForm.java b/src/com/vaadin/ui/LoginForm.java index 80e002435e..eb921e1e18 100644 --- a/src/com/vaadin/ui/LoginForm.java +++ b/src/com/vaadin/ui/LoginForm.java @@ -94,8 +94,8 @@ public class LoginForm extends CustomComponent { }; private URIHandler uriHandler = new URIHandler() { - private final String responce = "Login form handeled." - + ""; public DownloadStream handleURI(URL context, String relativeUri) { @@ -104,7 +104,7 @@ public class LoginForm extends CustomComponent { window.removeURIHandler(this); } DownloadStream downloadStream = new DownloadStream( - new ByteArrayInputStream(responce.getBytes()), + new ByteArrayInputStream(response.getBytes()), "text/html", "loginSuccesfull"); downloadStream.setCacheTime(-1); return downloadStream; diff --git a/tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled b/tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled new file mode 100644 index 0000000000..075bb3c57f --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled @@ -0,0 +1,61 @@ + + + + + + +LoginFormTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LoginFormTest
open/statictestfiles/LoginFormIframe.html
selectFrameLoginForm
selectFramePID6
enterCharacterusernameusername
enterCharacterpasswordpassword
click//form[@id='loginf']/div[5]/div/span/span
selectFramerelative=top
selectFrameLoginForm
assertTextvaadin=runcomvaadintestscomponentsloginformLoginFormTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]User 'username', password='password' logged in
+ + -- cgit v1.2.3