From aaf134a39bbc2ed6ff33d2478f72cfa62700d18a Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 8 Dec 2011 13:16:30 +0000 Subject: [PATCH] Merged tests, fixes and javadoc updates from 6.7 svn changeset:22323/svn branch:6.8 --- build/build.xml | 8 +- src/com/vaadin/Application.java | 16 +- .../data/util/AbstractBeanContainer.java | 5 + .../terminal/gwt/client/ui/VScrollTable.java | 107 ++++-- .../terminal/gwt/client/ui/VTextField.java | 25 +- .../ui/layout/ChildComponentContainer.java | 32 ++ src/com/vaadin/ui/AbstractSelect.java | 2 +- src/com/vaadin/ui/LoginForm.java | 2 - src/com/vaadin/ui/Slider.java | 102 +++-- src/com/vaadin/ui/Table.java | 3 + src/com/vaadin/ui/Window.java | 4 +- .../components/table/AddNonRenderedRow.java | 48 +++ .../table/ProgrammaticUnselectInRange.html | 57 +++ .../table/ProgrammaticUnselectInRange.java | 67 ++++ .../TableClickValueChangeInteraction.html | 362 ++++++++++++++++++ .../TableClickValueChangeInteraction.java | 86 +++++ .../textfield/MultipleTextChangeEvents.java | 57 +++ .../treetable/AddNodesOnExpand.html | 37 ++ .../treetable/AddNodesOnExpand.java | 55 +++ 19 files changed, 973 insertions(+), 102 deletions(-) create mode 100644 tests/testbench/com/vaadin/tests/components/table/AddNonRenderedRow.java create mode 100644 tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html create mode 100644 tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java create mode 100644 tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.html create mode 100644 tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java create mode 100644 tests/testbench/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java create mode 100644 tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html create mode 100644 tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java diff --git a/build/build.xml b/build/build.xml index a038edb139..046392fe57 100644 --- a/build/build.xml +++ b/build/build.xml @@ -502,6 +502,9 @@ + + + Compiling widgetset ${widgetset}. Output directory: ${widgetsets-output-dir} @@ -509,9 +512,10 @@ - + - + + diff --git a/src/com/vaadin/Application.java b/src/com/vaadin/Application.java index 39a70fe27f..cd1da8f9fd 100644 --- a/src/com/vaadin/Application.java +++ b/src/com/vaadin/Application.java @@ -209,11 +209,11 @@ public abstract class Application implements URIHandler, * *

* If for some reason user opens another window with same url that is - * already open, name is modified by adding "_12345678" postfix to the name, - * where 12345678 is a random number. One can decide to create another - * window-object for those windows (recommended) or to discard the postfix. - * If the user has two browser windows pointing to the same window-object on - * server, synchronization errors are likely to occur. + * already open, the name is modified by adding a "_N" postfix to the name, + * where N is a running number starting from 1. One can decide to create + * another window-object for those windows (recommended) or to discard the + * postfix. If the user has two browser windows pointing to the same + * window-object on server, synchronization errors are likely to occur. *

* *

@@ -1384,7 +1384,7 @@ public abstract class Application implements URIHandler, } /** - * @return + * @return * "Take note of any unsaved data, and click here to continue." */ public String getSessionExpiredMessage() { @@ -1416,7 +1416,7 @@ public abstract class Application implements URIHandler, } /** - * @return + * @return * "Take note of any unsaved data, and click here to continue." */ public String getCommunicationErrorMessage() { @@ -1448,7 +1448,7 @@ public abstract class Application implements URIHandler, } /** - * @return + * @return * "Take note of any unsaved data, and click here to continue." */ public String getAuthenticationErrorMessage() { diff --git a/src/com/vaadin/data/util/AbstractBeanContainer.java b/src/com/vaadin/data/util/AbstractBeanContainer.java index b1d0b0672b..1b297d6a88 100644 --- a/src/com/vaadin/data/util/AbstractBeanContainer.java +++ b/src/com/vaadin/data/util/AbstractBeanContainer.java @@ -637,6 +637,11 @@ public abstract class AbstractBeanContainer extends continue; } IDTYPE itemId = resolveBeanId(bean); + if (itemId == null) { + throw new IllegalArgumentException( + "Resolved identifier for a bean must not be null"); + } + if (internalAddItemAtEnd(itemId, createBeanItem(bean), false) != null) { modified = true; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index c919d82923..38872c73a1 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -1094,6 +1094,11 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } if (selected != row.isSelected()) { row.toggleSelection(); + if (!isSingleSelectMode() && !selected) { + // Update selection range in case a row is + // unselected from the middle of a range - #8076 + removeRowFromUnsentSelectionRanges(row); + } } } } @@ -4132,7 +4137,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, VScrollTableRow r = (VScrollTableRow) renderedRows.get(ix); r.setIndex(r.getIndex() + rows); } - fixSpacers(); + setContainerHeight(); return inserted; } @@ -4140,6 +4145,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, int rows) { unlinkAllRowsStartingAt(firstIndex); insertRows(rowData, firstIndex, rows); + setContainerHeight(); } /** @@ -4258,7 +4264,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, VScrollTableRow r = (VScrollTableRow) renderedRows.get(ix); r.setIndex(r.getIndex() - count); } - fixSpacers(); + setContainerHeight(); } protected void unlinkAllRowsStartingAt(int index) { @@ -4851,44 +4857,44 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } } - private void handleClickEvent(Event event, Element targetTdOrTr) { - if (client.hasEventListeners(VScrollTable.this, + /** + * If there are registered click listeners, sends a click event and + * returns true. Otherwise, does nothing and returns false. + * + * @param event + * @param targetTdOrTr + * @param immediate + * Whether the event is sent immediately + * @return Whether a click event was sent + */ + private boolean handleClickEvent(Event event, Element targetTdOrTr, + boolean immediate) { + if (!client.hasEventListeners(VScrollTable.this, ITEM_CLICK_EVENT_ID)) { - boolean doubleClick = (DOM.eventGetType(event) == Event.ONDBLCLICK); - - /* This row was clicked */ - client.updateVariable(paintableId, "clickedKey", "" - + rowKey, false); - - if (getElement() == targetTdOrTr.getParentElement()) { - /* A specific column was clicked */ - int childIndex = DOM.getChildIndex(getElement(), - targetTdOrTr); - String colKey = null; - colKey = tHead.getHeaderCell(childIndex).getColKey(); - client.updateVariable(paintableId, "clickedColKey", - colKey, false); - } - - MouseEventDetails details = new MouseEventDetails(event); + // Don't send an event if nobody is listening + return false; + } - boolean imm = true; - if (immediate && event.getButton() == Event.BUTTON_LEFT - && !doubleClick && isSelectable() && !isSelected()) { - /* - * A left click when the table is selectable and in - * immediate mode on a row that is not currently - * selected will cause a selection event to be fired - * after this click event. By making the click event - * non-immediate we avoid sending two separate messages - * to the server. - */ - imm = false; - } + // This row was clicked + client.updateVariable(paintableId, "clickedKey", "" + rowKey, + false); - client.updateVariable(paintableId, "clickEvent", - details.toString(), imm); + if (getElement() == targetTdOrTr.getParentElement()) { + // A specific column was clicked + int childIndex = DOM.getChildIndex(getElement(), + targetTdOrTr); + String colKey = null; + colKey = tHead.getHeaderCell(childIndex).getColKey(); + client.updateVariable(paintableId, "clickedColKey", colKey, + false); } + + MouseEventDetails details = new MouseEventDetails(event); + + client.updateVariable(paintableId, "clickEvent", + details.toString(), immediate); + + return true; } private void handleTooltips(final Event event, Element target) { @@ -4940,9 +4946,11 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, && (actionKeys != null || client .hasEventListeners(VScrollTable.this, ITEM_CLICK_EVENT_ID))) { - // Prevent browser context menu only if there are - // action handlers or item click listeners - // registered + /* + * Prevent browser context menu only if there are + * action handlers or item click listeners + * registered + */ event.stopPropagation(); event.preventDefault(); } @@ -4957,13 +4965,19 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, switch (type) { case Event.ONDBLCLICK: if (targetCellOrRowFound) { - handleClickEvent(event, targetTdOrTr); + handleClickEvent(event, targetTdOrTr, true); } break; case Event.ONMOUSEUP: if (targetCellOrRowFound) { mDown = false; - handleClickEvent(event, targetTdOrTr); + /* + * Queue here, send at the same time as the + * corresponding value change event - see #7127 + */ + boolean clickEventSent = handleClickEvent(event, + targetTdOrTr, false); + if (event.getButton() == Event.BUTTON_LEFT && isSelectable()) { @@ -5052,7 +5066,16 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, .setPropertyJSO("onselectstart", null); } - sendSelectedRows(); + // Queue value change + sendSelectedRows(false); + } + /* + * Send queued click and value change events if any + * If a click event is sent, send value change with + * it regardless of the immediate flag, see #7127 + */ + if (immediate || clickEventSent) { + client.sendPendingVariableChanges(); } } break; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java index 41d48041fc..5894e00349 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java @@ -249,15 +249,15 @@ public class VTextField extends TextBoxBase implements Paintable, Field, final String text = uidl.getStringVariable("text"); /* - * We skip the text content update if field has been repainted, but text has - * not been changed. Additional sanity check verifies there is no change - * in the que (in which case we count more on the server side value). + * We skip the text content update if field has been repainted, but text + * has not been changed. Additional sanity check verifies there is no + * change in the que (in which case we count more on the server side + * value). */ - if (!(uidl.getBooleanAttribute(ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) && valueBeforeEdit != null && text - .equals(valueBeforeEdit))) { + if (!(uidl.getBooleanAttribute(ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) + && valueBeforeEdit != null && text.equals(valueBeforeEdit))) { updateFieldContent(text); } - if (uidl.hasAttribute("selpos")) { final int pos = uidl.getIntAttribute("selpos"); @@ -587,7 +587,20 @@ public class VTextField extends TextBoxBase implements Paintable, Field, } public void onBeforeShortcutAction(Event e) { + // Remember current value to detect changes + String oldValue = valueBeforeEdit; + valueChange(false); + + /* + * The valueChange method updates valueBeforeEdit when a "text" variable + * is sent. This will cause a text change event to be simulated on the + * server. In that case, we should avoid sending the same text as a + * normal text change event. (#8035) + */ + if (oldValue != valueBeforeEdit) { + lastTextChangeString = valueBeforeEdit; + } } // Here for backward compatibility; to be moved to TextArea diff --git a/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java b/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java index bcb972ca6a..5786dc421a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java +++ b/src/com/vaadin/terminal/gwt/client/ui/layout/ChildComponentContainer.java @@ -9,6 +9,8 @@ import java.util.NoSuchElementException; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Style; +import com.google.gwt.dom.client.Style.BorderStyle; import com.google.gwt.dom.client.TableElement; import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.Widget; @@ -222,6 +224,36 @@ public class ChildComponentContainer extends Panel { * does not include */ int w = Util.getRequiredWidth(widgetDIV); + + // IE7 ignores the width of the content if there's a border (#3915) + if (BrowserInfo.get().isIE7()) { + // Also read the inner width of the target element + int clientWidth = widget.getElement().getClientWidth(); + + // If the widths are different, there might be a border involved and + // then the width should be calculated without borders + if (w != clientWidth) { + // Remember old border style and remove current border + Style style = widget.getElement().getStyle(); + String oldBorderStyle = style.getBorderStyle(); + style.setBorderStyle(BorderStyle.NONE); + + // Calculate width without borders + int newWidth = Util.getRequiredWidth(widgetDIV); + + // Restore old border style + style.setProperty("borderStyle", oldBorderStyle); + + // Borders triggered the bug if the element is wider without + // borders + if (newWidth > w) { + // Use new measured width + the border width calculated as + // the difference between previous inner and outer widths + w = newWidth + (w - clientWidth); + } + } + } + int h = Util.getRequiredHeight(widgetDIV); widgetSize.setWidth(w); diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java index 646d898a54..9cf0849075 100644 --- a/src/com/vaadin/ui/AbstractSelect.java +++ b/src/com/vaadin/ui/AbstractSelect.java @@ -1624,7 +1624,7 @@ public abstract class AbstractSelect extends AbstractField implements * *

* Data interface does not support nulls as item ids. Selecting the item - * idetified by this id is the same as selecting no items at all. This + * identified by this id is the same as selecting no items at all. This * setting only affects the single select mode. *

* diff --git a/src/com/vaadin/ui/LoginForm.java b/src/com/vaadin/ui/LoginForm.java index 509a072c27..3004504b9d 100644 --- a/src/com/vaadin/ui/LoginForm.java +++ b/src/com/vaadin/ui/LoginForm.java @@ -34,8 +34,6 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection; * Login page html can be overridden by replacing protected getLoginHTML method. * As the login page is actually an iframe, styles must be handled manually. By * default component tries to guess the right place for theme css. - *

- * Note, this is a new Ajax terminal specific component and is likely to change. * * @since 5.3 */ diff --git a/src/com/vaadin/ui/Slider.java b/src/com/vaadin/ui/Slider.java index c07913d5fe..74dbcd99bb 100644 --- a/src/com/vaadin/ui/Slider.java +++ b/src/com/vaadin/ui/Slider.java @@ -46,7 +46,6 @@ import com.vaadin.terminal.gwt.client.ui.VSlider; * * @author IT Mill Ltd. */ -@SuppressWarnings("serial") @ClientWidget(VSlider.class) public class Slider extends AbstractField { @@ -110,7 +109,7 @@ public class Slider extends AbstractField { private final boolean arrows = false; /** - * Default Slider constructor. Sets all values to defaults and the slide + * Default slider constructor. Sets all values to defaults and the slide * handle at minimum value. * */ @@ -120,11 +119,13 @@ public class Slider extends AbstractField { } /** - * Create a new slider with the caption given as parameter. All slider - * values set to defaults. + * Create a new slider with the caption given as parameter. + * + * The range of the slider is set to 0-100 and only integer values are + * allowed. * * @param caption - * The caption for this Slider (e.g. "Volume"). + * The caption for this slider (e.g. "Volume"). */ public Slider(String caption) { this(); @@ -132,11 +133,14 @@ public class Slider extends AbstractField { } /** - * Create a new slider with given range and resolution + * Create a new slider with the given range and resolution. * * @param min + * The minimum value of the slider * @param max + * The maximum value of the slider * @param resolution + * The number of digits after the decimal point. */ public Slider(double min, double max, int resolution) { this(); @@ -146,10 +150,12 @@ public class Slider extends AbstractField { } /** - * Create a new slider with given range + * Create a new slider with the given range that only allows integer values. * * @param min + * The minimum value of the slider * @param max + * The maximum value of the slider */ public Slider(int min, int max) { this(); @@ -159,11 +165,15 @@ public class Slider extends AbstractField { } /** - * Create a new slider with given caption and range + * Create a new slider with the given caption and range that only allows + * integer values. * * @param caption + * The caption for the slider * @param min + * The minimum value of the slider * @param max + * The maximum value of the slider */ public Slider(String caption, int min, int max) { this(min, max); @@ -171,20 +181,20 @@ public class Slider extends AbstractField { } /** - * Gets the biggest possible value in Sliders range. + * Gets the maximum slider value * - * @return the biggest value slider can have + * @return the largest value the slider can have */ public double getMax() { return max; } /** - * Set the maximum value of the Slider. If the current value of the Slider - * is out of new bounds, the value is set to new minimum. + * Set the maximum slider value. If the current value of the slider is + * larger than this, the value is set to the new maximum. * * @param max - * New maximum value of the Slider. + * The new maximum slider value */ public void setMax(double max) { this.max = max; @@ -204,20 +214,20 @@ public class Slider extends AbstractField { } /** - * Gets the minimum value in Sliders range. + * Gets the minimum slider value * - * @return the smalles value slider can have + * @return the smallest value the slider can have */ public double getMin() { return min; } /** - * Set the minimum value of the Slider. If the current value of the Slider - * is out of new bounds, the value is set to new minimum. + * Set the minimum slider value. If the current value of the slider is + * smaller than this, the value is set to the new minimum. * - * @param min - * New minimum value of the Slider. + * @param max + * The new minimum slider value */ public void setMin(double min) { this.min = min; @@ -237,18 +247,21 @@ public class Slider extends AbstractField { } /** - * Get the current orientation of the Slider (horizontal or vertical). + * Get the current orientation of the slider (horizontal or vertical). * - * @return orientation + * @return {@link #ORIENTATION_HORIZONTAL} or + * {@link #ORIENTATION_HORIZONTAL} */ public int getOrientation() { return orientation; } /** - * Set the orientation of the Slider. + * Set the orientation of the slider. * - * @param int new orientation + * @param The + * new orientation, either {@link #ORIENTATION_HORIZONTAL} or + * {@link #ORIENTATION_VERTICAL} */ public void setOrientation(int orientation) { this.orientation = orientation; @@ -256,7 +269,8 @@ public class Slider extends AbstractField { } /** - * Get the current resolution of the Slider. + * Get the current resolution of the slider. The resolution is the number of + * digits after the decimal point. * * @return resolution */ @@ -265,7 +279,8 @@ public class Slider extends AbstractField { } /** - * Set a new resolution for the Slider. + * Set a new resolution for the slider. The resolution is the number of + * digits after the decimal point. * * @param resolution */ @@ -278,14 +293,15 @@ public class Slider extends AbstractField { } /** - * Set the value of this Slider. + * Sets the value of the slider. * * @param value - * New value of Slider. Must be within Sliders range (min - max), - * otherwise throws an exception. + * The new value of the slider. * @param repaintIsNotNeeded * If true, client-side is not requested to repaint itself. * @throws ValueOutOfBoundsException + * If the given value is not inside the range of the slider. + * @see #setMin(double) {@link #setMax(double)} */ public void setValue(Double value, boolean repaintIsNotNeeded) throws ValueOutOfBoundsException { @@ -308,31 +324,33 @@ public class Slider extends AbstractField { } /** - * Set the value of this Slider. + * Sets the value of the slider. * * @param value - * New value of Slider. Must be within Sliders range (min - max), - * otherwise throws an exception. + * The new value of the slider. * @throws ValueOutOfBoundsException + * If the given value is not inside the range of the slider. + * @see #setMin(double) {@link #setMax(double)} */ public void setValue(Double value) throws ValueOutOfBoundsException { setValue(value, false); } /** - * Set the value of this Slider. + * Sets the value of the slider. * * @param value - * New value of Slider. Must be within Sliders range (min - max), - * otherwise throws an exception. + * The new value of the slider. * @throws ValueOutOfBoundsException + * If the given value is not inside the range of the slider. + * @see #setMin(double) {@link #setMax(double)} */ public void setValue(double value) throws ValueOutOfBoundsException { setValue(new Double(value), false); } /** - * Get the current Slider size. + * Get the current slider size. * * @return size in pixels or -1 for auto sizing. * @deprecated use standard getWidth/getHeight instead @@ -343,7 +361,7 @@ public class Slider extends AbstractField { } /** - * Set the size for this Slider. + * Set the size for this slider. * * @param size * in pixels, or -1 auto sizing. @@ -364,7 +382,7 @@ public class Slider extends AbstractField { } /** - * Get the handle size of this Slider. + * Get the handle size of this slider. * * @return handle size in percentages. * @deprecated The size is dictated by the current theme. @@ -375,7 +393,7 @@ public class Slider extends AbstractField { } /** - * Set the handle size of this Slider. + * Set the handle size of this slider. * * @param handleSize * in percentages relative to slider base size. @@ -467,7 +485,8 @@ public class Slider extends AbstractField { } /** - * ValueOutOfBoundsException + * Thrown when the value of the slider is about to be set to a value that is + * outside the valid range of the slider. * * @author IT Mill Ltd. * @@ -486,6 +505,11 @@ public class Slider extends AbstractField { value = valueOutOfBounds; } + /** + * Gets the value that is outside the valid range of the slider. + * + * @return the value that is out of bounds + */ public Double getValue() { return value; } diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index cd07465d07..26a56a8f4d 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -4013,6 +4013,9 @@ public class Table extends AbstractSelect implements Action.Container, */ public void setTableFieldFactory(TableFieldFactory fieldFactory) { this.fieldFactory = fieldFactory; + + // Assure visual refresh + refreshRowCache(); } /** diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java index ddd1f6fc3b..d8d23b8b47 100644 --- a/src/com/vaadin/ui/Window.java +++ b/src/com/vaadin/ui/Window.java @@ -1281,8 +1281,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler, * user closes the window. * *

- * Since Vaadin 6.5, removing windows using {@link #removeWindow(Window)} - * does fire the CloseListener. + * Since Vaadin 6.5, removing a window using {@link #removeWindow(Window)} + * fires the CloseListener. *

*/ public interface CloseListener extends Serializable { diff --git a/tests/testbench/com/vaadin/tests/components/table/AddNonRenderedRow.java b/tests/testbench/com/vaadin/tests/components/table/AddNonRenderedRow.java new file mode 100644 index 0000000000..5486d6248d --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/AddNonRenderedRow.java @@ -0,0 +1,48 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Table; + +public class AddNonRenderedRow extends TestBase { + int index = 0; + + private final Table table = new Table(); + + @Override + public void setup() { + + table.setPageLength(5); + table.addContainerProperty("rowID", Integer.class, null); + for (int i = 0; i < 4; i++) { + addRow(); + } + + Button addrowButton = new Button("Add row"); + addrowButton.addListener(new ClickListener() { + public void buttonClick(ClickEvent pEvent) { + addRow(); + } + }); + + addComponent(table); + addComponent(addrowButton); + } + + private void addRow() { + table.addItem(new Object[] { Integer.valueOf(++index) }, null); + // table.refreshRowCache(); + } + + @Override + protected String getDescription() { + return "Adding a row to the table should work even when the added rows are not visible."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8077); + } +} \ No newline at end of file diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html new file mode 100644 index 0000000000..8d185b6219 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.html @@ -0,0 +1,57 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.table.ProgrammaticUnselectInRange?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]23,5
mouseClickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]24,3:shift
assertTextvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]Item 2 is selected
clickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]Item 2 is not selected
mouseClickvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[0]32,8:ctrl
assertTextvaadin=runcomvaadintestscomponentstableProgrammaticUnselectInRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]Item 2 is not selected
+ + diff --git a/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java new file mode 100644 index 0000000000..758fa4bf1a --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/ProgrammaticUnselectInRange.java @@ -0,0 +1,67 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; + +public class ProgrammaticUnselectInRange extends TestBase { + + private static final String PROPERTY = "property"; + + final Label selectionLabel = new Label(); + final Table table = new Table(); + + @Override + protected void setup() { + table.addContainerProperty(PROPERTY, Integer.class, ""); + + table.setMultiSelect(true); + table.setSelectable(true); + table.setImmediate(true); + table.setPageLength(5); + + for (int i = 0; i < 5; i++) { + Integer value = Integer.valueOf(i + 1); + table.addItem(new Object[] { value }, value); + } + table.addListener(new Property.ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + updateSelectionLabel(); + } + }); + + addComponent(table); + addComponent(selectionLabel); + addComponent(new Button("Deselect item 2", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.unselect(Integer.valueOf(2)); + } + })); + + updateSelectionLabel(); + } + + private void updateSelectionLabel() { + if (table.isSelected(Integer.valueOf(2))) { + selectionLabel.setValue("Item 2 is selected"); + } else { + selectionLabel.setValue("Item 2 is not selected"); + } + } + + @Override + protected String getDescription() { + return "Selecting items 1 - 3 using shift click, deselecting item 2 using the button and selecting item 5 using ctrl should keep item 2 deselected according to the server"; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.html b/tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.html new file mode 100644 index 0000000000..83a02ec44b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.html @@ -0,0 +1,362 @@ + + + + + + +TableClickValueChangeInteraction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TableClickValueChangeInteraction
open/run/com.vaadin.tests.components.table.TableClickValueChangeInteraction?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]38,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]35,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]24,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]39,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]37,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[5]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]51,16
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[6]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]19,10
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[7]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]43,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[8]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]36,7
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[9]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]27,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[10]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]13,7
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[11]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]43,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[12]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]27,9
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[13]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]53,16
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[14]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]40,9
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[15]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]45,10
screenCaptureClickedItem0
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]39,7
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]37,6
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]33,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]17,9
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]49,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[5]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]53,9
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[6]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]21,12
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[7]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]32,13
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[8]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]45,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[9]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,10
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[10]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]28,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[11]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]15,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[12]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]35,5
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[13]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]26,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[14]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]55,13
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[15]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,7
screenCaptureClickedItem1
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]41,12
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]28,9
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]16,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]38,12
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]47,6
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[5]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]30,7
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[6]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]16,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[7]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]68,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[8]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]36,10
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[9]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]48,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[10]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]27,12
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[11]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]19,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[12]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]22,10
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[13]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]39,13
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[14]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]35,15
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[15]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]19,15
screenCaptureClickedItem1Again
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]30,8
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]20,13
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]19,15
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]43,15
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[4]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]44,15
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[5]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]62,12
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[6]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]29,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[7]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]25,13
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[8]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]22,9
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[9]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]30,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[10]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]21,6
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[11]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]32,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[12]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]34,14
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[13]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]45,11
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[14]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]31,6
mouseClickvaadin=runcomvaadintestscomponentstableTableClickValueChangeInteraction::/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[15]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]45,10
screenCaptureClickedItem2
+ + diff --git a/tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java b/tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java new file mode 100644 index 0000000000..e0449dea8b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TableClickValueChangeInteraction.java @@ -0,0 +1,86 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.event.ItemClickEvent; +import com.vaadin.event.ItemClickEvent.ItemClickListener; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Component; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Layout; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class TableClickValueChangeInteraction extends TestBase { + + final Window mainWindow = new Window(); + + @Override + public void setup() { + setMainWindow(mainWindow); + + GridLayout layout = new GridLayout(4, 4); + layout.setSpacing(true); + layout.setMargin(true); + mainWindow.setContent(layout); + + for (int i = 0; i < 16; ++i) { + mainWindow.addComponent(makeTable((i & 8) > 0, (i & 4) > 0, + (i & 2) > 0, (i & 1) > 0)); + } + + } + + @Override + protected String getDescription() { + return "Table selection breaks if ItemClickListener requests repaint"; + } + + @Override + protected Integer getTicketNumber() { + return 7127; + } + + private Component makeTable(boolean immediate, boolean selectable, + boolean listenClicks, boolean listenValueChanges) { + + final Table table = new Table((immediate ? "I" : "i") + + (selectable ? "S" : "s") + (listenClicks ? "C" : "c") + + (listenValueChanges ? "V" : "v")); + final Label clickLabel = new Label("Click?"); + final Label valueChangeLabel = new Label("Value?"); + + table.addContainerProperty("foo", String.class, null); + for (int i = 0; i < 3; i++) { + table.addItem("item" + i).getItemProperty("foo") + .setValue("An item " + i); + } + table.setImmediate(immediate); + table.setSelectable(selectable); + table.setWidth("100px"); + table.setHeight("100px"); + if (listenClicks) { + table.addListener(new ItemClickListener() { + public void itemClick(ItemClickEvent event) { + table.requestRepaint(); + clickLabel.setValue("Click " + event.getItemId()); + } + }); + } + if (listenValueChanges) { + table.addListener(new ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + valueChangeLabel.setValue("Value " + event.getProperty()); + } + }); + } + + Layout result = new VerticalLayout(); + result.addComponent(table); + result.addComponent(clickLabel); + result.addComponent(valueChangeLabel); + return result; + } +} \ No newline at end of file diff --git a/tests/testbench/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java b/tests/testbench/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java new file mode 100644 index 0000000000..62d3a1679a --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java @@ -0,0 +1,57 @@ +package com.vaadin.tests.components.textfield; + +import com.vaadin.event.Action; +import com.vaadin.event.Action.Handler; +import com.vaadin.event.FieldEvents.TextChangeEvent; +import com.vaadin.event.FieldEvents.TextChangeListener; +import com.vaadin.event.ShortcutAction; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.AbstractTextField.TextChangeEventMode; +import com.vaadin.ui.TextField; + +public class MultipleTextChangeEvents extends TestBase { + + private final Log log = new Log(5); + + @Override + public void setup() { + TextField tf = new TextField(); + tf.setTextChangeEventMode(TextChangeEventMode.TIMEOUT); + tf.setTextChangeTimeout(500); + tf.addListener(new TextChangeListener() { + public void textChange(TextChangeEvent event) { + log.log("TextChangeEvent: " + event.getText()); + } + }); + getMainWindow().addActionHandler(new MyHandler()); + + addComponent(log); + addComponent(tf); + } + + class MyHandler implements Handler { + private static final long serialVersionUID = 1L; + Action actionenter = new ShortcutAction("Enter", + ShortcutAction.KeyCode.ENTER, null); + + public Action[] getActions(Object theTarget, Object theSender) { + return new Action[] { actionenter }; + } + + public void handleAction(Action theAction, Object theSender, + Object theTarget) { + log.log("Enter"); + } + } + + @Override + protected String getDescription() { + return "Entering something into the textfield and quickly pressing enter should only send one TextChangeEvent"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8035); + } +} \ No newline at end of file diff --git a/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html new file mode 100644 index 0000000000..efcbded1d5 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html @@ -0,0 +1,37 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.treetable.AddNodesOnExpand?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstreetableAddNodesOnExpand::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]11,7
mouseClickvaadin=runcomvaadintestscomponentstreetableAddNodesOnExpand::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]11,7
screenCapturecollapsed
+ + diff --git a/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java new file mode 100644 index 0000000000..5bf0370bab --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.treetable; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Tree; +import com.vaadin.ui.Tree.CollapseEvent; +import com.vaadin.ui.Tree.ExpandEvent; +import com.vaadin.ui.TreeTable; + +public class AddNodesOnExpand extends TestBase { + private TreeTable treetable; + + @Override + public void setup() { + treetable = new TreeTable(); + treetable.setImmediate(true); + treetable.setWidth("100%"); + treetable.setHeight(null); + treetable.setPageLength(0); + treetable.addContainerProperty("foo", String.class, ""); + treetable.addListener(new Tree.ExpandListener() { + public void nodeExpand(ExpandEvent event) { + Object openedItemId = event.getItemId(); + if (!treetable.hasChildren(openedItemId)) { + for (int j = 0; j < 3; j++) { + treetable.addItem(openedItemId + "-" + j); + treetable.setParent(openedItemId + "-" + j, + openedItemId); + } + } + } + }); + treetable.addListener(new Tree.CollapseListener() { + public void nodeCollapse(CollapseEvent event) { + /* Uncomment this to "fix" the TreeTable */ + // orgTree.refreshRowCache(); + } + }); + + for (int i = 0; i < 3; i++) { + treetable.addItem(Integer.valueOf(i)); + } + + addComponent(treetable); + } + + @Override + protected String getDescription() { + return "Expanding a node and then collapsing it should not cause scrollbars to appear"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8041); + } +} \ No newline at end of file -- 2.39.5