From acbeb93752c30f3b1d1fbebbd646306d97c7953b Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 19 Apr 2011 16:06:31 +0000 Subject: [PATCH] merged last table related changes from 6.5 svn changeset:18401/svn branch:6.6 --- .../components/table/TableScrollOnFocus.html | 47 ++++++++++++++++++ .../components/table/TableScrollOnFocus.java | 49 +++++++++++++++++++ .../table/TableScrollsOnSelection.html | 6 +-- .../components/table/WideSelectableTable.java | 45 +++++++++++++++++ 4 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.html create mode 100644 tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.java create mode 100644 tests/src/com/vaadin/tests/components/table/WideSelectableTable.java diff --git a/tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.html b/tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.html new file mode 100644 index 0000000000..1a91211040 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.html @@ -0,0 +1,47 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.table.TableScrollOnFocus?restartApplication
scrollvaadin=runcomvaadintestscomponentstableTableScrollOnFocus::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]3864
pause300
mouseClickvaadin=runcomvaadintestscomponentstableTableScrollOnFocus::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[1]391,141
mouseClickvaadin=runcomvaadintestscomponentstableTableScrollOnFocus::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VScrollTable[0]/domChild[1]3234
screenCapturevisible-185-199
+ + diff --git a/tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.java b/tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.java new file mode 100644 index 0000000000..05e101a5f9 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableScrollOnFocus.java @@ -0,0 +1,49 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.Table; + +public class TableScrollOnFocus extends TestBase { + @Override + protected void setup() { + final Table table = new Table(); + final CheckBox chkSelectable = new CheckBox("selectable"); + + chkSelectable.setImmediate(true); + chkSelectable.addListener(new ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + table.setSelectable(chkSelectable.booleanValue()); + } + }); + + table.addContainerProperty("row #", String.class, "-"); + table.setColumnWidth("row #", 150); + for (int i = 1; i < 200; i++) { + table.addItem(new String[] { "" + i }, null); + } + table.setSortDisabled(true); + + chkSelectable.setValue(true); + + addComponent(chkSelectable); + addComponent(table); + } + + @Override + protected String getDescription() { + return "The table scrolls up 2 pages after loosing and regaining the focus!

" + + "Drag scrollbar to top then to the bottom of the table.
" + + "Click somewhere beside the table to take away the focus,
" + + "then click back on the table (header or scrollbar) to give back the focus
" + + "(Pressing Tab and Shift-Tab does the same job).

" + + "If the table is set to non-selectable-mode, no self-scrolling occurs."; + } + + @Override + protected Integer getTicketNumber() { + return 6774; + } +} \ No newline at end of file diff --git a/tests/src/com/vaadin/tests/components/table/TableScrollsOnSelection.html b/tests/src/com/vaadin/tests/components/table/TableScrollsOnSelection.html index 7be7e3760d..dff3dcbc48 100644 --- a/tests/src/com/vaadin/tests/components/table/TableScrollsOnSelection.html +++ b/tests/src/com/vaadin/tests/components/table/TableScrollsOnSelection.html @@ -29,9 +29,9 @@ - mouseClick - vaadin=runcomvaadintestscomponentstableTableScrollsOnSelection::/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[79]/domChild[0]/domChild[0] - 38,-892 + mouseClick + vaadin=runcomvaadintestscomponentstableTableScrollsOnSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[79]/domChild[0]/domChild[0] + 38,-892 diff --git a/tests/src/com/vaadin/tests/components/table/WideSelectableTable.java b/tests/src/com/vaadin/tests/components/table/WideSelectableTable.java new file mode 100644 index 0000000000..c820dc08d5 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/WideSelectableTable.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; + +public class WideSelectableTable extends TestBase { + + @Override + protected void setup() { + final int NUMBER_OF_COLS = 50; + + // mainWindow.setSizeFull(); + // setMainWindow(mainWindow); + + Table ptable = new Table(); + for (int colcount = 0; colcount < NUMBER_OF_COLS; colcount++) { + String col = "COL_" + colcount + ""; + ptable.addContainerProperty(col, String.class, "--"); + ptable.addItem(colcount + "-").getItemProperty(col) + .setValue("--" + colcount + ""); + } + ptable.setSelectable(true); + ptable.setMultiSelect(true); + ptable.setColumnReorderingAllowed(false); + ptable.setImmediate(true); + + ptable.setWidth("100%"); + ptable.setPageLength(5); + + VerticalLayout vl = new VerticalLayout(); + vl.addComponent(ptable); + addComponent(vl); + } + + @Override + protected String getDescription() { + return "A wide table scrolls to the beginning when sorting a column at the beginning when sorting a column at the end"; + } + + @Override + protected Integer getTicketNumber() { + return 6788; + } +} \ No newline at end of file -- 2.39.5