diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-02-15 09:43:30 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-02-15 09:43:30 +0200 |
commit | 50236af1ceffec30469f2855cd4f12e66f7f1d95 (patch) | |
tree | df704856c1d4eb64871bd9a70845e75ceaa89c90 | |
parent | b2bde32434c3768123f0c683403c00fdcc1364ee (diff) | |
parent | e91601dc67ee61e44f7e5e9689890073445e2bba (diff) | |
download | vaadin-framework-50236af1ceffec30469f2855cd4f12e66f7f1d95.tar.gz vaadin-framework-50236af1ceffec30469f2855cd4f12e66f7f1d95.zip |
Merge remote branch 'origin/master' into layoutperformance
23 files changed, 664 insertions, 76 deletions
diff --git a/WebContent/release-notes.html b/WebContent/release-notes.html index 09f0df7641..1ca217bc56 100644 --- a/WebContent/release-notes.html +++ b/WebContent/release-notes.html @@ -330,11 +330,11 @@ </p> <ul> - <li>Mozilla Firefox 8</li> + <li>Mozilla Firefox 10</li> <li>Internet Explorer 8-9</li> <li>Safari 5</li> <li>Opera 11</li> - <li>Google Chrome 15</li> + <li>Google Chrome 16</li> </ul> <h2 id="vaadinontheweb">Vaadin on the Web</h2> diff --git a/src/com/vaadin/event/ListenerMethod.java b/src/com/vaadin/event/ListenerMethod.java index c11f3b1424..1f1305fa69 100644 --- a/src/com/vaadin/event/ListenerMethod.java +++ b/src/com/vaadin/event/ListenerMethod.java @@ -517,8 +517,10 @@ public class ListenerMethod implements EventListener, Serializable { } catch (final java.lang.reflect.InvocationTargetException e) { // An exception was thrown by the invocation target. Throw it // forwards. - throw new MethodException("Invocation of method " + method - + " failed.", e.getTargetException()); + throw new MethodException("Invocation of method " + + method.getName() + " in " + + target.getClass().getName() + " failed.", + e.getTargetException()); } } } @@ -617,49 +619,8 @@ public class ListenerMethod implements EventListener, Serializable { public class MethodException extends RuntimeException implements Serializable { - private final Throwable cause; - - private String message; - private MethodException(String message, Throwable cause) { - super(message); - this.cause = cause; - } - - /** - * Retrieves the cause of this throwable or <code>null</code> if the - * cause does not exist or not known. - * - * @return the cause of this throwable or <code>null</code> if the cause - * is nonexistent or unknown. - * @see java.lang.Throwable#getCause() - */ - @Override - public Throwable getCause() { - return cause; - } - - /** - * Returns the error message string of this throwable object. - * - * @return the error message. - * @see java.lang.Throwable#getMessage() - */ - @Override - public String getMessage() { - return message; - } - - /** - * @see java.lang.Throwable#toString() - */ - @Override - public String toString() { - String msg = super.toString(); - if (cause != null) { - msg += "\nCause: " + cause.toString(); - } - return msg; + super(message, cause); } } diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml index 9bc05dee2e..3d66bab0a3 100644 --- a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml +++ b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml @@ -50,6 +50,13 @@ </any> </replace-with> + <!-- Fall through to this rule for everything but IE --> + <replace-with + class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper"> + <when-type-is + class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper" /> + </replace-with> + <replace-with class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapperIE"> <when-type-is diff --git a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java index e5006f4a9c..330e4cf5de 100644 --- a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java +++ b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java @@ -64,13 +64,23 @@ public class BrowserInfo { browserDetails.setIEMode(documentMode); } } - touchDevice = detectTouchDevice(); + + if (browserDetails.isChrome()) { + touchDevice = detectChromeTouchDevice(); + } else { + touchDevice = detectTouchDevice(); + } } private native boolean detectTouchDevice() /*-{ try { document.createEvent("TouchEvent");return true;} catch(e){return false;}; }-*/; + + private native boolean detectChromeTouchDevice() + /*-{ + return ("ontouchstart" in window); + }-*/; private native int getIEDocumentMode() /*-{ diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java index 3f587358d9..a3604b6b63 100644 --- a/src/com/vaadin/terminal/gwt/client/Util.java +++ b/src/com/vaadin/terminal/gwt/client/Util.java @@ -1087,7 +1087,6 @@ public class Util { * button, false otherwise */ public static boolean isTouchEventOrLeftMouseButton(Event event) { - int eventType = event.getTypeInt(); boolean touchEvent = Util.isTouchEvent(event); return touchEvent || event.getButton() == Event.BUTTON_LEFT; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java b/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java index 320520cb39..c439163595 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java @@ -71,7 +71,10 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements public void onBrowserEvent(Event event) { if (icon != null && (event.getTypeInt() == Event.ONCLICK) && (DOM.eventGetTarget(event) == icon.getElement())) { - setValue(!getValue()); + // Click on icon should do nothing if widget is disabled + if (isEnabled()) { + setValue(!getValue()); + } } super.onBrowserEvent(event); if (event.getTypeInt() == Event.ONLOAD) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java index b54c3dd943..0083cc83c2 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java @@ -1616,14 +1616,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ int tbWidth = Util.getRequiredWidth(tb); - if (popupWidth < 0) { - /* - * Only use the first page popup width so the textbox will not - * get resized whenever the popup is resized. - */ - popupWidth = Util.getRequiredWidth(popupOpener); - } - /* * Note: iconWidth is here calculated as a negative pixel value so * you should consider this in further calculations. @@ -1632,7 +1624,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, .measureMarginLeft(tb.getElement()) - Util.measureMarginLeft(selectedItemIcon.getElement()) : 0; - int w = tbWidth + popupWidth + iconWidth; + int w = tbWidth + getPopUpOpenerWidth() + iconWidth; /* * When the select has a undefined with we need to check that we are @@ -1669,6 +1661,20 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } /** + * Only use the first page popup width so the textbox will not get resized + * whenever the popup is resized. This also resolves issue where toggling + * combo box between read only and normal state makes it grow larger. + * + * @return Width of popup opener + */ + private int getPopUpOpenerWidth() { + if (popupWidth < 0) { + popupWidth = Util.getRequiredWidth(popupOpener); + } + return popupWidth; + } + + /** * Get the width of the select in pixels where the text area and icon has * been included. * @@ -1686,10 +1692,10 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ private void setTextboxWidth(int componentWidth) { int padding = getTextboxPadding(); - int popupOpenerWidth = Util.getRequiredWidth(popupOpener); int iconWidth = selectedItemIcon.isAttached() ? Util .getRequiredWidth(selectedItemIcon) : 0; - int textboxWidth = componentWidth - padding - popupOpenerWidth + + int textboxWidth = componentWidth - padding - getPopUpOpenerWidth() - iconWidth; if (textboxWidth < 0) { textboxWidth = 0; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index c15aade66e..07d9de5f20 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -272,9 +272,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, int endOfFirstRange = row.getIndex() - 1; if (!(endOfFirstRange - startRow.getIndex() < 0)) { // create range of first part unless its length is < 1 - VScrollTableRow endOfRange = scrollBody - .getRowByRowIndex(endOfFirstRange); - ranges.add(new SelectionRange(startRow, endOfRange)); + ranges.add(new SelectionRange(startRow, endOfFirstRange + - startRow.getIndex() + 1)); } int startOfSecondRange = row.getIndex() + 1; if (!(getEndIndex() - startOfSecondRange < 0)) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java index 61fd389200..85b6e1b2e8 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java @@ -314,13 +314,16 @@ public class VTabsheet extends VTabsheetBase { } public Tab addTab() { + // Must check this before insert as insert updates the tab count + boolean firstTab = (getTabCount() == 0); + Tab t = new Tab(this); // Logical attach int spacerIndex = getTabCount(); insert(t, tr, spacerIndex, true); - if (getTabCount() == 0) { + if (firstTab) { // Set the "first" style t.setStyleNames(false, true); } diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 86f2c7a2de..705bf13346 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -1234,12 +1234,16 @@ public abstract class AbstractCommunicationManager implements try { changeVariables(source, owner, m); } catch (Exception e) { + Component errorComponent = null; if (owner instanceof Component) { - handleChangeVariablesError(app, (Component) owner, e, m); - } else { - // TODO DragDropService error handling - throw new RuntimeException(e); + errorComponent = (Component) owner; + } else if (owner instanceof DragAndDropService) { + if (m.get("dhowner") instanceof Component) { + errorComponent = (Component) m.get("dhowner"); + } } + + handleChangeVariablesError(app, errorComponent, e, m); } } else { diff --git a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java index 3115ce49c8..453aab5af8 100644 --- a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java +++ b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java @@ -134,20 +134,37 @@ public class SourceFileChecker extends TestCase { } } - class DosNewlineDetector implements FileValidator { - + abstract class FileContentsValidator implements FileValidator { public void validateFile(File f) throws Exception { - String contents = IOUtils.toString(new FileInputStream(f)); + FileInputStream fis = new FileInputStream(f); + String contents = IOUtils.toString(fis); + fis.close(); + validateContents(f, contents); + } + + protected abstract void validateContents(File f, String contents) + throws Exception; + + } + + class DosNewlineDetector extends FileContentsValidator { + + @Override + protected void validateContents(File f, String contents) + throws Exception { if (contents.contains("\r\n")) { throw new IllegalArgumentException(); } } + } - class LicenseChecker implements FileValidator { - public void validateFile(File f) throws Exception { - String contents = IOUtils.toString(new FileInputStream(f)); + class LicenseChecker extends FileContentsValidator { + + @Override + protected void validateContents(File f, String contents) + throws Exception { if (!contents.contains("@" + "VaadinApache2LicenseForJavaFiles" + "@")) { throw new IllegalArgumentException(); diff --git a/tests/test.xml b/tests/test.xml index 2baa26218a..f3233de014 100644 --- a/tests/test.xml +++ b/tests/test.xml @@ -11,7 +11,7 @@ <!-- Configuration --> <!-- ================================================================== --> <!-- Browsers to use for testing --> - <property name="browsers-windows" value="winxp-ie8,win7-ie9,winxp-firefox10,winxp-safari5,winxp-googlechrome-stable,winxp-opera11" /> + <property name="browsers-windows" value="winxp-ie8,win7-ie9,winxp-firefox10,winxp-safari5,winxp-googlechrome-17,winxp-opera11" /> <property name="browsers-linux" value="linux-firefox3,linux-opera10,linux-googlechrome8" /> <property name="browsers-mac" value="osx-firefox3,osx-opera10,osx-googlechrome8,osx-safari4,osx-safari5" /> diff --git a/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html b/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html new file mode 100644 index 0000000000..ddcdc68691 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.checkbox.CheckBoxes2?restartApplication</td> + <td></td> +</tr> +<!--add icon--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>32,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item1</td> + <td>50,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item3</td> + <td>48,6</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[2]/VMenuBar[0]#item1</td> + <td>24,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>off</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td> + <td>9,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<!--disable--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>22,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>33,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item1</td> + <td>51,9</td> +</tr> +<!--click on caption and icon and assert checked state does not change. Cannot test checkbox click due to Opera problems--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[2]</td> + <td>8,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td> + <td>5,10</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<!--enable and set to read only--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>33,14</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>30,3</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item1</td> + <td>62,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>42,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>40,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item2</td> + <td>58,14</td> +</tr> +<!--click on caption and icon and assert checked state does not change. Cannot test checkbox click due to Opera problems--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[2]</td> + <td>8,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td> + <td>5,10</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/combobox/PopUpWidth.html b/tests/testbench/com/vaadin/tests/components/combobox/PopUpWidth.html new file mode 100644 index 0000000000..35a6bcf29a --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/combobox/PopUpWidth.html @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>PopUpWidth</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">PopUpWidth</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.combobox.PopUpWidth</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxPopUpWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[1]</td> + <td>9,14</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxPopUpWidth::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td> + <td>106,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxPopUpWidth::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td> + <td>103,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxPopUpWidth::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td> + <td>103,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxPopUpWidth::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td> + <td>103,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxPopUpWidth::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td> + <td>103,5</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>combos-and-popup-with-same-width</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/combobox/PopUpWidth.java b/tests/testbench/com/vaadin/tests/components/combobox/PopUpWidth.java new file mode 100644 index 0000000000..e22482ed8b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/combobox/PopUpWidth.java @@ -0,0 +1,43 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.data.Item; +import com.vaadin.terminal.Resource; +import com.vaadin.terminal.ThemeResource; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.ComboBox; + +public class PopUpWidth extends TestBase { + + @Override + protected void setup() { + + addComponent(createComboBox("Do not touch this")); + addComponent(createComboBox("Browse this (check that width does not change)")); + } + + private ComboBox createComboBox(String caption) { + ComboBox cb = new ComboBox(caption); + cb.addContainerProperty("caption", String.class, null); + cb.addContainerProperty("icon", Resource.class, null); + for (int i = 1; i < 200 + 1; i++) { + Item item = cb.addItem(i); + item.getItemProperty("caption").setValue("Item " + i); + item.getItemProperty("icon").setValue( + new ThemeResource("../runo/icons/16/users.png")); + } + cb.setItemIconPropertyId("icon"); + cb.setItemCaptionPropertyId("caption"); + return cb; + } + + @Override + protected String getDescription() { + return "Check that width of popup or combobox does not change when paging."; + } + + @Override + protected Integer getTicketNumber() { + return 7013; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/combobox/WidthToggleReadOnly.html b/tests/testbench/com/vaadin/tests/components/combobox/WidthToggleReadOnly.html new file mode 100644 index 0000000000..b661aa2bd7 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/combobox/WidthToggleReadOnly.html @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>WidthToggleReadOnly</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">WidthToggleReadOnly</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.combobox.WidthToggleReadOnly</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxWidthToggleReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> + <td>5,7</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>both-combo-with-same-width</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java b/tests/testbench/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java new file mode 100644 index 0000000000..654f42e233 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java @@ -0,0 +1,48 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.data.util.MethodProperty; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; + +public class WidthToggleReadOnly extends TestBase { + + @Override + protected void setup() { + ComboBox combo = createNewComboBoxA("Untouched combobox"); + addComponent(combo); + + combo = createNewComboBoxA("Toggled combobox"); + addComponent(combo); + addComponent(createReadOnlyForComboBox(combo)); + } + + private ComboBox createNewComboBoxA(String caption) { + ComboBox combo = new ComboBox(caption); + combo.addItem("first"); + combo.setValue("first"); + + addComponent(combo); + + return combo; + } + + private CheckBox createReadOnlyForComboBox(ComboBox combo) { + CheckBox readonly = new CheckBox("Second combobox is read only", + new MethodProperty(combo, "readOnly")); + readonly.setImmediate(true); + addComponent(readonly); + return readonly; + } + + @Override + protected String getDescription() { + return "Check that toggling read only mode of second combobox does not change it's width."; + } + + @Override + protected Integer getTicketNumber() { + return 5833; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java index 6d64898e28..b87c458c01 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.datefield; -import java.sql.Date; +import java.util.Date; +import java.util.Locale; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.ui.Alignment; @@ -56,6 +57,7 @@ public class DateFieldPopupOffScreen extends AbstractTestCase { private DateField createDateField() { DateField df = new DateField(); + df.setLocale(new Locale("fi")); df.setResolution(Resolution.SECOND); df.setDescription("This is a long, multiline tooltip.<br/>It should always be on screen so it can be read."); df.setValue(new Date(1000000L)); diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java index 3c42d71af5..44260e9247 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java @@ -13,6 +13,7 @@ public class DatePopupStyleName extends TestBase { final DateField df = new DateField(); df.setValue(new Date(1203910239L)); + df.setResolution(DateField.RESOLUTION_SEC); df.setWidth("200px"); df.setRequired(true); df.setComponentError(new UserError("abc")); diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java index 517bf2ee76..88542751c3 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java @@ -14,6 +14,7 @@ public class WidthRecalculationOnEnableStateChange extends TestBase { final DateField df = new DateField(); df.setValue(new Date(1203910239L)); + df.setResolution(DateField.RESOLUTION_SEC); df.setWidth("200px"); df.addStyleName("enabled-readonly-styled"); addComponent(df); diff --git a/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.html b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.html new file mode 100644 index 0000000000..82778d5bac --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.html @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>LongMultiselect</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">LongMultiselect</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.LongMultiselect?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[1]</td> + <td>38,13</td> +</tr> +<tr> + <td>scroll</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td> + <td>18330</td> +</tr> +<tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<tr> + <td>scroll</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td> + <td>18330</td> +</tr> +<tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[22]/domChild[0]/domChild[0]</td> + <td>41,-1823:shift</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>selected-5-99</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[18]/domChild[1]/domChild[0]</td> + <td>updated</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[19]/domChild[1]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java new file mode 100644 index 0000000000..4db9b69070 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java @@ -0,0 +1,74 @@ +package com.vaadin.tests.components.table; + +import java.util.Collection; + +import com.vaadin.Application; +import com.vaadin.data.Property; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class LongMultiselect extends TestBase { + + private enum ItemProperty { + COLUMN1, + COLUMN2 + } + + @Override + protected void setup() { + VerticalLayout layout = generateLayout(); + addComponent(layout); + layout.setSizeFull(); + } + + private VerticalLayout generateLayout() { + VerticalLayout layout = new VerticalLayout(); + + final Table table = new Table("Ticket #8264 table"); + layout.addComponent(table); + table.setWidth("200px"); + table.setHeight("170px"); + table.setSelectable(true); + table.setMultiSelect(true); + table.setImmediate(true); + + // Create example data + table.addContainerProperty(ItemProperty.COLUMN1, String.class, null); + table.addContainerProperty(ItemProperty.COLUMN2, String.class, null); + for (int i=1;i<100;i++) { + table.addItem(new String[]{"Item " + i, null}, i); + } + + //Add action button + layout.addComponent(new Button("Do It", new Button.ClickListener() { + public void buttonClick(Button.ClickEvent event) { + // Set ItemProperty.COLUMN2 for all selected values of table + Collection selectedIds = (Collection)table.getValue(); + for (final Object itemId : selectedIds) { + final Property p = table.getItem(itemId).getItemProperty(ItemProperty.COLUMN2); + if (p.getValue() instanceof String) { + p.setValue(null); + } else { + p.setValue("updated"); + } + } + } + })); + + return layout; + } + + @Override + protected String getDescription() { + return "Multiselecting 94 rows (from \"item 5\" to \"item 98\") and modifying second column of each row selected (press Do It). This should work (update the 2nd column) and not cause JS exception."; + } + + @Override + protected Integer getTicketNumber() { + return 8264; + } +} diff --git a/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetSelectionStyles.html b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetSelectionStyles.html new file mode 100644 index 0000000000..e046cfacb4 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetSelectionStyles.html @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/TabSheetIndexOperations?restartApplication</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>tab1-selected</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>21,8</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>tab2-selected</td> +</tr> +<tr> + <td>open</td> + <td>/run/TabSheetIndexOperations</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>tab2-selected</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>14,5</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>tab1-selected</td> +</tr> +<tr> + <td>open</td> + <td>/run/TabSheetIndexOperations</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>tab1-selected</td> +</tr> + +</tbody></table> +</body> +</html> |