diff options
13 files changed, 549 insertions, 16 deletions
diff --git a/scripts/merge-all.sh b/scripts/merge-all.sh new file mode 100755 index 0000000000..6106770d02 --- /dev/null +++ b/scripts/merge-all.sh @@ -0,0 +1,63 @@ +#!/bin/bash +FROM=$1 +AUTOMERGE=$2 +if [ "$FROM" = "" ] +then + echo "Usage: $0 <from version> [automerge]" + exit +fi +if [ "$AUTOMERGE" = "automerge" ] +then + AUTOCOMMIT="autocommit" +fi + +svn up +localchanges=`svn stat|wc -l` +if [ "$localchanges" != "0" ] && [ "$IGNOREDIRTY" != "ignoredirty" ] +then + echo "You must have a clean working space copy" + exit +fi + +currentrepowithoutversion=`svn info|grep URL|sed "s/URL: //"|sed "s/\/[^\/]*$//"` +sourceurl="$currentrepowithoutversion/$FROM" +unmerged=`svn mergeinfo --show-revs eligible $sourceurl|sed "s/r//g"` + +if [ "$unmerged" = "" ] +then + echo "No changes to merge" + exit 0 +fi +echo "Unmerged changes" +echo "================" +for revision in $unmerged +do + echo -n "[$revision] " + svn log $sourceurl -r $revision --xml|grep "<msg>"|sed "s/<msg>//"|sed "s/<\/msg>//" +done + +cmd="" +for revision in $unmerged +do + thiscmd=`dirname $0`"/merge.sh $FROM $revision $AUTOCOMMIT $IGNOREDIRTY" + cmd="$thiscmd && " + if [ "$AUTOMERGE" = "automerge" ] + then + echo "Merging [$revision]..." + $thiscmd + if [ "$?" != "0" ] + then + echo "Merge of [$revision] failed, aborting..." + exit 1 + fi + fi +done +cmd="$cmd true" +if [ "$AUTOMERGE" != "automerge" ] +then + echo + echo "Merge command:" + echo + echo $cmd +fi + diff --git a/scripts/merge.sh b/scripts/merge.sh new file mode 100755 index 0000000000..775bc6a839 --- /dev/null +++ b/scripts/merge.sh @@ -0,0 +1,39 @@ +#!/bin/bash +FROM=$1 +REVISION=$2 +AUTOCOMMIT=$3 + +if [ "$FROM" = "" ] || [ "$REVISION" = "" ] +then + echo "Usage: $0 <from version> <changeset> [autocommit]" + exit 2 +fi + +localchanges=`svn stat|wc -l` +if [ "$localchanges" != "0" ] +then + echo "You must have a clean working space copy" + exit 2 +fi + +svn up + +msg=`svn log http://dev.vaadin.com/svn/versions/$FROM -r $REVISION --xml|grep "<msg>"|sed "s/<msg>//"|sed "s/<\/msg>//"` +svn merge http://dev.vaadin.com/svn/versions/$FROM . -c $REVISION +msg="[merge from $FROM] $msg" +if [ "$AUTOCOMMIT" = "autocommit" ] +then + echo "Trying to commit..." + svn commit -m "$msg" + RET=$? + if [ "$RET" != "0" ] + then + exit 1 + fi + exit 0 +else + echo "Run the following command to commit..." + echo svn commit -m \"$msg\" + exit 1 +fi + diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index f9be8bf019..fbf1b2c2d6 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -532,8 +532,12 @@ public class ApplicationConfiguration implements EntryPoint { // Prepare VConsole for debugging if (isDebugMode()) { Console console = GWT.create(Console.class); - console.setQuietMode(isQuietDebugMode()); - console.init(); + if (console instanceof VDebugConsole) { + // Methods from VDebugConsole not present in Console + VDebugConsole vDebugConsole = (VDebugConsole) console; + vDebugConsole.setQuietMode(isQuietDebugMode()); + vDebugConsole.init(); + } VConsole.setImplementation(console); } else { VConsole.setImplementation((Console) GWT.create(NullConsole.class)); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java index b318fe0af3..99eadc9558 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java @@ -73,7 +73,7 @@ public class VCalendarPanel extends FocusableFlexTable implements /**
* FocusChangeListener is notified when the panel changes its _focused_
- * value. It can be set with
+ * value.
*/
public interface FocusChangeListener {
void focusChanged(Date focusedDate);
@@ -192,21 +192,22 @@ public class VCalendarPanel extends FocusableFlexTable implements }
/**
- * Sets the focus to given day of current time. Used when moving in the
- * calender with the keyboard.
+ * Sets the focus to given date in the current view. Used when moving in the
+ * calendar with the keyboard.
*
* @param date
- * The day number from by Date.getDate()
+ * A Date representing the day of month to be focused. Must be
+ * one of the days currently visible.
*/
- private void focusDay(Date day) {
+ private void focusDay(Date date) {
// Only used when calender body is present
if (resolution > VDateField.RESOLUTION_MONTH) {
if (focusedDay != null) {
focusedDay.removeStyleDependentName(CN_FOCUSED);
}
- if (day != null && focusedDate != null) {
- focusedDate.setTime(day.getTime());
+ if (date != null && focusedDate != null) {
+ focusedDate.setTime(date.getTime());
int rowCount = days.getRowCount();
for (int i = 0; i < rowCount; i++) {
int cellCount = days.getCellCount(i);
@@ -214,7 +215,7 @@ public class VCalendarPanel extends FocusableFlexTable implements Widget widget = days.getWidget(i, j);
if (widget != null && widget instanceof Day) {
Day curday = (Day) widget;
- if (curday.getDate().equals(day)) {
+ if (curday.getDate().equals(date)) {
curday.addStyleDependentName(CN_FOCUSED);
focusedDay = curday;
focusedRow = i;
@@ -228,9 +229,12 @@ public class VCalendarPanel extends FocusableFlexTable implements }
/**
- * Sets the selection hightlight to a given date of current time
+ * Sets the selection highlight to a given day in the current view
*
* @param date
+ * A Date representing the day of month to be selected. Must be
+ * one of the days currently visible.
+ *
*/
private void selectDate(Date date) {
if (selectedDay != null) {
@@ -1483,6 +1487,9 @@ public class VCalendarPanel extends FocusableFlexTable implements }
+ /**
+ * A widget representing a single day in the calendar panel.
+ */
private class Day extends InlineHTML {
private static final String BASECLASS = VDateField.CLASSNAME
+ "-calendarpanel-day";
@@ -1629,6 +1636,8 @@ public class VCalendarPanel extends FocusableFlexTable implements if (day != null) {
Date date = day.getDate();
int id = date.getDate();
+ // Zero or negative ids map to days of the preceding month,
+ // past-the-end-of-month ids to days of the following month
if (date.getMonth() < displayedMonth.getMonth()) {
id -= DateTimeService.getNumberOfDaysInMonth(date);
} else if (date.getMonth() > displayedMonth.getMonth()) {
@@ -1696,8 +1705,8 @@ public class VCalendarPanel extends FocusableFlexTable implements return time.ampm.getElement();
}
if (subPart.startsWith(SUBPART_DAY)) {
- // can be less than 1 or greater than the number of days in the current month
- // these map to the "off-month" days
+ // Zero or negative ids map to days in the preceding month,
+ // past-the-end-of-month ids to days in the following month
int dayOfMonth = Integer.parseInt(subPart.substring(SUBPART_DAY
.length()));
Date date = new Date(displayedMonth.getYear(),
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index de68ae96a4..24763745e3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -2404,6 +2404,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets, break; } break; + case Event.ONCONTEXTMENU: + if (client.hasEventListeners(VScrollTable.this, + HEADER_CLICK_EVENT_ID)) { + // Prevent showing the browser's context menu when there is + // a right click listener. + event.preventDefault(); + } + break; + case Event.ONDBLCLICK: + fireHeaderClickedEvent(event); + break; case Event.ONTOUCHMOVE: case Event.ONMOUSEMOVE: if (dragging) { @@ -4540,6 +4551,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, .get(client).getPaintable(uidl.getId()); paintable.updateFromUIDL(uidl, client); } + pendingComponentPaints.clear(); } } diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java index e6c8642b84..a6cf51e80f 100644 --- a/src/com/vaadin/ui/Window.java +++ b/src/com/vaadin/ui/Window.java @@ -898,4 +898,28 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier { bringToFront(); } + /** + * Notifies the child components and subwindows that the window is attached + * to the application. + */ + @Override + public void attach() { + super.attach(); + for (Window w : subwindows) { + w.attach(); + } + } + + /** + * Notifies the child components and subwindows that the window is detached + * from the application. + */ + @Override + public void detach() { + super.detach(); + for (Window w : subwindows) { + w.detach(); + } + } + } diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 1b37347ddd..6572de59eb 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -131,6 +131,7 @@ <target name="integration-test-jetty8">
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="300" />
<param name="target-server" value="jetty8" />
</antcall>
</target>
@@ -259,6 +260,7 @@ </antcall>
</target>
+
<target name="integration-test-weblogicPortal">
<fileset dir="integration-testscripts" id="html-test-files" includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" />
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
diff --git a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java new file mode 100644 index 0000000000..91aaf131f5 --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java @@ -0,0 +1,114 @@ +package com.vaadin.tests.server; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.HashSet; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.commons.io.IOUtils; + +public class SourceFileChecker extends TestCase { + + /** + * The tests are run in the build directory. + */ + public static String baseDirectory = null; + public static final String SRC_DIR = getBaseDir() + "src"; + public static final String TESTBENCH_SRC_DIR = getBaseDir() + + "tests/testbench"; + public static final String SERVERSIDE_SRC_DIR = getBaseDir() + + "tests/server-side"; + public static final String CLIENTSIDE_SRC_DIR = getBaseDir() + + "tests/client-side"; + + public static String getBaseDir() { + if (baseDirectory != null) { + return baseDirectory; + } + // Run in the "build" directory by build, in the project root by Eclipse + for (File f : new File("..").listFiles()) { + if (f.getName().equals("buildhelpers")) { + // We are in "build" + baseDirectory = "../"; + return baseDirectory; + } + } + + baseDirectory = ""; + return baseDirectory; + } + + private static final String[] ALL_SRC_DIRS = new String[] { SRC_DIR, + TESTBENCH_SRC_DIR, SERVERSIDE_SRC_DIR, CLIENTSIDE_SRC_DIR }; + + public void testJavaFilesContainsLicense() throws IOException { + validateJavaFiles(SRC_DIR, new LicenseChecker(), + "The following files are missing license information:\n{0}"); + } + + public void testJavaFilesUseUnixNewline() throws IOException { + for (String dir : ALL_SRC_DIRS) { + validateJavaFiles(dir, new DosNewlineDetector(), + "The following files contain CRLF instead of LF:\n{0}"); + } + } + + public interface FileValidator { + void validateFile(File f) throws Exception; + } + + private void validateJavaFiles(String directory, FileValidator validator, + String errorMessage) { + File srcDir = new File(directory); + System.out.println(new File(".").getAbsolutePath()); + HashSet<String> missing = new HashSet<String>(); + validateFiles(srcDir, missing, validator, ".java"); + if (!missing.isEmpty()) { + throw new RuntimeException(errorMessage.replace("{0}", + missing.toString())); + } + + } + + private void validateFiles(File srcDir, HashSet<String> missing, + FileValidator validator, String suffix) { + Assert.assertTrue("Directory " + srcDir + " does not exist", + srcDir.exists()); + + for (File f : srcDir.listFiles()) { + if (f.isDirectory()) { + validateFiles(f, missing, validator, suffix); + } else if (f.getName().endsWith(suffix)) { + try { + validator.validateFile(f); + } catch (Throwable t) { + missing.add(f.getPath()); + } + } + } + } + + class DosNewlineDetector implements FileValidator { + + public void validateFile(File f) throws Exception { + String contents = IOUtils.toString(new FileInputStream(f)); + 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)); + if (!contents.contains("@" + "VaadinApache2LicenseForJavaFiles" + + "@")) { + throw new IllegalArgumentException(); + } + } + } +} diff --git a/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html new file mode 100644 index 0000000000..97398b4964 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html @@ -0,0 +1,142 @@ +<?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>PopupDateFieldExtendedRange</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">PopupDateFieldExtendedRange</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.datefield.PopupDateFieldExtendedRange?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td> + <td>12,18</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]#prevmon</td> + <td>11,9</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]#prevy</td> + <td>10,13</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td> + <td>18,10</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td> + <td>16,12</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td> + <td>17,10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton</td> + <td>11,8</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>left</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>left</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>up</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>up</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>shift left</td> +</tr> +<tr> + <td>pressSpecialKey</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::Root/VOverlay[0]/VCalendarPanel[0]</td> + <td>shift down</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton</td> + <td>9,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton</td> + <td>9,9</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsdatefieldExtendedRangeInMonthView::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton</td> + <td>21,4</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java new file mode 100644 index 0000000000..4fc8f87398 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java @@ -0,0 +1,69 @@ +package com.vaadin.tests.components.datefield;
+
+import java.util.Calendar;
+import java.util.Locale;
+
+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.DateField;
+import com.vaadin.ui.PopupDateField;
+
+@SuppressWarnings("serial")
+public class PopupDateFieldExtendedRange extends TestBase {
+
+ private Calendar date = Calendar.getInstance();
+
+ @Override
+ protected void setup() {
+ date.set(2011, 0, 1);
+
+ getLayout().setSpacing(true);
+
+ final PopupDateField[] fields = new PopupDateField[3];
+
+ fields[0] = makeDateField();
+ fields[0].setLocale(new Locale("fi", "FI"));
+ fields[0].setCaption("Finnish locale");
+
+ fields[1] = makeDateField();
+ fields[1].setLocale(new Locale("en", "US"));
+ fields[1].setCaption("US English locale");
+
+ fields[2] = makeDateField();
+ fields[2].setLocale(new Locale("fi", "FI"));
+ fields[2].setShowISOWeekNumbers(true);
+ fields[2].setCaption("Finnish locale with week numbers");
+
+ for (PopupDateField f : fields) {
+ addComponent(f);
+ }
+
+ addComponent(new Button("Change date", new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ date.set(2010, 1, 16);
+ for (PopupDateField f : fields) {
+ f.setValue(date.getTime());
+ }
+ }
+ }));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Show a few days of the preceding and following months in the datefield popup";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6718;
+ }
+
+ private PopupDateField makeDateField() {
+ PopupDateField pdf = new PopupDateField();
+ pdf.setResolution(DateField.RESOLUTION_DAY);
+ pdf.setValue(date.getTime());
+ return pdf;
+ }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index 447b5b4be6..2f30b623fd 100644 --- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -177,7 +177,11 @@ public class OrderedLayoutCases extends AbstractTestRoot { newLayout.setWidth(currentLayout.getWidth(), currentLayout.getWidthUnits()); + newLayout.setMargin(currentLayout.getMargin()); + newLayout.setSpacing(currentLayout.isSpacing()); + getLayout().replaceComponent(currentLayout, newLayout); + getLayout().setExpandRatio(newLayout, 1); currentLayout = newLayout; } }, "Horizontal", "Vertical")); diff --git a/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html new file mode 100644 index 0000000000..4573cf4c50 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html @@ -0,0 +1,47 @@ +<?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>TextFieldValueGoesMissing</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TextFieldValueGoesMissing</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.TextFieldValueGoesMissing?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>73,10</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>test</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>contextmenu</td>
+ <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertValue</td>
+ <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>test</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java index 254f1b0a90..f3ff5e983e 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java +++ b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java @@ -17,11 +17,15 @@ public class TextFieldValueGoesMissing extends TestBase { final Label label1 = new Label("1"); final Label label2 = new Label("2"); - Button button = new Button("Refresh"); + Button button = new Button("Replace label"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { - verticalLayout.replaceComponent(label1, label2); + if (verticalLayout.getComponentIndex(label1) > -1) { + verticalLayout.replaceComponent(label1, label2); + } else { + verticalLayout.replaceComponent(label2, label1); + } } }); verticalLayout.addComponent(button); @@ -41,7 +45,7 @@ public class TextFieldValueGoesMissing extends TestBase { @Override protected String getDescription() { - return "Enter a text in the TextField in the table and press the 'replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents"; + return "Enter a text in the TextField in the table and press the 'Replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents"; } @Override |