diff options
110 files changed, 2694 insertions, 1424 deletions
diff --git a/WebContent/VAADIN/themes/base/base.scss b/WebContent/VAADIN/themes/base/base.scss index 514579830d..f22af7670e 100644 --- a/WebContent/VAADIN/themes/base/base.scss +++ b/WebContent/VAADIN/themes/base/base.scss @@ -40,6 +40,10 @@ @import "window/window.scss"; @import "debug/debug.scss"; +.v-vaadin-version:after { + content: "@version@"; +} + /* References the BODY tag generated by Vaadin application servlet */ .v-generated-body { width: 100%; diff --git a/WebContent/VAADIN/themes/base/button/button.scss b/WebContent/VAADIN/themes/base/button/button.scss index 66c7c13ce8..694e49a359 100644 --- a/WebContent/VAADIN/themes/base/button/button.scss +++ b/WebContent/VAADIN/themes/base/button/button.scss @@ -18,9 +18,11 @@ font: inherit; font-size: $font-size; line-height: normal; + -webkit-touch-callout: none; + -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; - -ie-user-select: none; + -ms-user-select: none; user-select: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; diff --git a/WebContent/VAADIN/themes/base/debug/debug.scss b/WebContent/VAADIN/themes/base/debug/debug.scss index 209c3e0469..d71575c818 100644 --- a/WebContent/VAADIN/themes/base/debug/debug.scss +++ b/WebContent/VAADIN/themes/base/debug/debug.scss @@ -254,5 +254,13 @@ .v-debugwindow-row > span.value { width: 100%; } + + /* INFO */ + .v-debugwindow-info { + .v-debugwindow-row { + display:block; + min-width: 100%; + } + } }
\ No newline at end of file diff --git a/WebContent/release-notes.html b/WebContent/release-notes.html index eef0b1de0c..7175214e82 100644 --- a/WebContent/release-notes.html +++ b/WebContent/release-notes.html @@ -1,14 +1,14 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Vaadin Framework @version@</title> - <link rel="stylesheet" type="text/css" href="css/styles.css" /> - - <!--[if lte IE 6]> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>Vaadin Framework @version@</title> +<link rel="stylesheet" type="text/css" href="css/styles.css" /> + +<!--[if lte IE 6]> <link rel="stylesheet" type="text/css" href="css/ie.css" /> <![endif]--> - <style type="text/css"> +<style type="text/css"> .nested-list ol { counter-reset: item } @@ -22,484 +22,631 @@ counter-increment: item } </style> - </head> +</head> - <body> +<body> <div id="header"> - <h1>Vaadin – thinking of U and I</h1> - <div id="version"> - <strong>Version @version@</strong> - </div> - </div> <!-- /header --> + <h1>Vaadin – thinking of U and I</h1> + <div id="version"> + <strong>Version @version@</strong> + </div> + </div> + <!-- /header --> <div id="content"> - <p>Version @version@ built on @builddate@.</p> - - <h2 id="tableofcontents">Release Notes for Vaadin Framework @version@</h2> - <ul> - <li><a href="#overview">Overview of Vaadin @version@ Release</a></li> - <li><a href="#enhancements">Enhancements in Vaadin @version-minor@</a></li> - <li><a href="#changelog">Complete change log for Vaadin @version@</a></li> - <li><a href="#limitations">Limitations in @version-minor@</a></li> - <li><a href="#vaadin">Vaadin Installation</a></li> - <li><a href="#package">Package Contents</a></li> - <li><a href="#migrating">Migrating from Vaadin 6 to Vaadin 7</a></li> - <li><a href="#dependencies">Vaadin @version@ dependencies</a></li> - <li><a href="#upgrading">Upgrading to Vaadin @version-minor@</a></li> - <li><a href="#supportedversions">Supported technologies</a></li> - <li><a href="#vaadinontheweb">Vaadin on the Web</a></li> - </ul> - - <h2 id="overview">Overview of Vaadin @version@ Release</h2> - - <p> - Vaadin @version@ is a feature release that includes a number of enhancements as - well as important bug fixes, as listed in the <a href="#changelog">change log</a> - below. You can also view the <a - href="http://dev.vaadin.com/query?status=closed&resolution=fixed&milestone=Vaadin+@version@&order=priority">list - of the closed issues</a> at the Vaadin developer's site. - </p> - - <h2 id="enhancements">Enhancements in Vaadin @version-minor@</h2> - - <p> - The @version-minor@ includes many major and minor enhancements. Below is a list of - the most notable changes: - </p> - - <ul> - <li>Server push based on Atmosphere</li> - <li>CSS injection through a <b>Styles</b> object from <tt>Page.getCurrent().getStyles()</tt></li> - <li>Enhanced Debug Window</li> - <li><b>Calendar</b> is now included in the core framework</li> - <li>The <b>VaadinServlet</b>/-<b>Portlet</b> and <b>-Service</b> have been refactored</li> - <li><b>DateField</b> can now have a range</li> - <li><b>Window</b> has Maximize/Restore controls</li> - <li>WAI-ARIA support for form fields, <b>Button</b>, and <b>Tree</b></li> - <li>The page can be reloaded programmatically with <tt>Page.reload()</tt></li> - <li>The legacy behavior of Property.toString() can be toggled using the <tt>legacyPropertyToString</tt> init parameter</li> - <li>Sass compiler now supports arithmetics</li> - <li>Sass compiler now supports <tt>@content</tt></li> - <li>Tooltip delays can be configured</li> - <li>Loading indicator delays can be configured</li> - <li>Layout components have a default alignment</li> - <li><b>DefaultFieldGroupFieldFactory</b> supports date fields</li> - - <li>Add-ons containing a theme should specify it with a <tt>Vaadin-Stylesheet</tt> - attribute in the manifest</li> - - <li>Native support for Internet Explorer 10</li> - <li>Many locking fixes</li> - <li>Java <tt>assert</tt> statements added to critical code sections. Start JVM with <tt>-ea</tt> to use.</li> - </ul> - - <p> - For enchancements introduced in Vaadin 7, see the <a - href="http://vaadin.com/download/release/7.0/7.0.0/release-notes.html">Release - Notes for Vaadin 7.0.0</a>. - </p> - - <h3 id="limitations">Limitations</h3> - <ul> - <li>It is currently not possible to specify <tt>font-size</tt> as <tt>em</tt> or - <tt>%</tt>, or layout component sizes with <tt>em</tt> (<a - href="http://dev.vaadin.com/ticket/10634">#10634</a>)</li> - <li>Push using streaming does not work in Opera (<a - href="http://dev.vaadin.com/ticket/11642">#11642</a>)</li> - <li>Some debug console features such as analyze layouts do not work when push is enabled (<a - href="http://dev.vaadin.com/ticket/11536">#11536</a>)</li> - </ul> - - <h3 id="changelog">ChangeLog</h3> - - <p> - This release includes the following closed issues: - </p> - - <ul> -@release-notes-tickets@ - </ul> - - <p> - The <a - href="http://dev.vaadin.com/query?status=closed&resolution=fixed&milestone=Vaadin+@version@&order=priority">full - list of the closed issues</a> can also be found at <tt>dev.vaadin.com</tt>. - </p> - - <h2 id="vaadin">Vaadin Installation</h2> - - <p> - <b>Vaadin</b> is a Java framework for building modern web applications that look - great, perform well and make you and your users happy. <b>Vaadin</b> is - available under the Apache License, Version 2.0 (see the <tt>license.html</tt> in - the Vaadin ZIP or JAR package). - </p> - - <p> - The easiest ways to install <b>Vaadin</b> are: - </p> - - <ul> - <li>If using Maven, define it as a dependency or use any of the available - archetypes (only <tt>vaadin-application</tt> is available for Vaadin 7 at the time - of this release) to create a new project</li> - - <li>If using Eclipse, use the Vaadin Plugin for Eclipse, which automatically - downloads the Vaadin libraries. To use this prerelease version, the plugin should be - installed from the experimental update site (<tt>http://vaadin.com/eclipse/experimental</tt>).</li> - </ul> - - <p> - It is also available as a ZIP package downloadable from <a href="http://vaadin.com/download">Vaadin Download page</a>. - </p> - - <h3 id="package">Package Contents</h3> - - <p>Inside the ZIP installation package you will find:</p> - - <ul> - <li>Separate server-side (<tt>vaadin-server</tt>) and client-side (<tt>vaadin-client</tt>, <tt>vaadin-client-compiler</tt>) development libraries</li> - <li>Precompiled widget set (<tt>vaadin-client-compiled</tt>) for server-side development</li> - <li>Shared library (<tt>vaadin-shared</tt>) for both server- and client-side libraries</li> - <li>Built-in themes (<tt>vaadin-themes</tt>) and the theme compiler (<tt>vaadin-theme-compiler</tt>)</li> - <li>Dependency libraries provided under the <tt>lib/</tt> folder</li> - </ul> - - <p> - See the <tt>README.TXT</tt> in the installation package for detailed information - about the package contents. <a href="http://vaadin.com/book">Book of Vaadin</a> - (for Vaadin 7) gives more detailed instructions. - </p> - - <p> - For server-side development, copy the <tt>vaadin-server</tt>, - <tt>vaadin-client-compiled</tt>, <tt>vaadin-shared</tt>, - <tt>vaadin-theme-compiler</tt>, and <tt>vaadin-themes</tt> from the main - folder and the dependencies from the <tt>lib</tt> folder to the - <tt>WEB-INF/lib</tt> folder of your Vaadin project. (The - <tt>vaadin-client-compiled</tt> is necessary if you do not wish to compile the - widget set by your own, which you need to do if you use almost any add-on - components.) - </p> - - <p> - For pure client-side development, you only need the <tt>vaadin-client</tt> and - <tt>vaadin-client-compiler</tt> JARs, which should be put to a non-deployed - project library folder, such as <tt>lib</tt>. You also need them if you compile - the widget set for any reason, such as using Vaadin add-ons, or create new - server-side components integrated with client-side widgets. - </p> - - <h2 id="migrating">Migrating from Vaadin 6</h2> - - <p> - All Vaadin 6 applications need some changes when migrating to Vaadin 7. The most - obvious changes are in the application/window API and require extending either - <b>UI</b> or <b>UI.LegacyApplication</b> instead of <b>Application</b>. A detailed - list of migration changes are given in the <a - href="https://vaadin.com/wiki/-/wiki/Main/Migrating+from+Vaadin+6+to+Vaadin+7">Vaadin - 7 Migration Guide</a>. - </p> - - <p> - Any custom client-side widgets need to be ported to use the new client-server - communication API, or the Vaadin 6 compatibility API. - </p> - - <p> - Vaadin 6 add-ons (ones that contain widgets) do not work in Vaadin 7 - please - check the add-ons in <a href="http://vaadin.com/directory/">Vaadin Directory</a> - for Vaadin 7 support. - </p> - - <h2 id="dependencies">Vaadin @version@ Dependencies</h2> - - <p> - When using Maven, Ivy, Gradle, or other dependency management system, all Vaadin - dependencies are downloaded automatically. This is also the case when using the - Vaadin Plugin for Eclipse. - </p> - - <p> - The Vaadin ZIP installation package includes the dependencies in the <tt>lib</tt> - subfolder. These need to be copied to the <tt>WEB-INF/lib</tt> folder of the web - application that uses Vaadin. - </p> - - <p> - The dependencies are listed in the <a href="license.html">Licensing description</a>. Some are explicit dependencies packaged and distributed as - separate JARs, while some are included inside other libraries. - </p> - - <h3>Bean Validation</h3> - - <p> - If you use the bean validation feature in Vaadin 7, you need a Bean Validation API - implementation. You need to install the implementation JAR in the - <tt>WEB-INF/lib</tt> directory of the web application that uses validation. - </p> - - <h2 id="upgrading">Upgrading to Vaadin @version-minor@</h2> - - <h3>Upgrading the Eclipse Plugin</h3> - - <p> - Vaadin 7 requires that you use a compatible version of the Vaadin Plugin for - Eclipse. The stable version of the plugin is available from the - <tt>http://vaadin.com/eclipse</tt> update site. Please see the <a - href="https://vaadin.com/book/vaadin7/-/page/getting-started.eclipse.html#getting-started.eclipse.update">section - about updating the plugin</a> in the Book of Vaadin and the <a - href="http://vaadin.com/eclipse">installation instructions at the download - site</a> for more details. - </p> - - <p> - You can also use the <i>experimental</i> Vaadin Plugin for - Eclipse. Its update site is - <tt>http://vaadin.com/eclipse/experimental</tt>. - </p> - - <h3>General Upgrading Instructions</h3> - - <p> - When upgrading from an earlier Vaadin version, you must: - </p> - - <ul> - <li>Recompile your classes using the new Vaadin version. Binary - compatibility is only guaranteed for maintenance releases of - Vaadin.</li> - - <li>Recompile any add-ons you have created using the new Vaadin</li> - - <li>Unless using the precompiled widget set, recompile your widget set using the - new Vaadin version</li> - </ul> - - <p> - Remember also to refresh the project in your IDE to ensure that the new version of - everything is in use. - </p> - - <p> - By using the "<tt>?debug</tt>" URL parameter, you can verify that the version of - the servlet, the theme, and the widget set all match. - </p> - - <p> - <b>Eclipse</b> users should always check if there is a new version of - the Eclipse Plug-in available. The Eclipse Plug-in can be used to - update the Vaadin version in the project (Project properties » - Vaadin). - </p> - - <p> - <b>Maven</b> users should update the Vaadin dependency version in the - <tt>pom.xml</tt> unless it is defined as <tt>LATEST</tt> . You must also ensure - that the GWT dependency uses the correct version and recompile your project and - your widget set. - </p> - - <p> - <b>Liferay and other portal</b> users must install the Vaadin libraries in - <t>ROOT/WEB-INF/lib/</b> in the portal (and remove a possibly obsolete older - <tt>vaadin.jar</tt>). Additionally, the contents of the - <tt>vaadin-client-compiled</tt> and <tt>vaadin-themes</tt> must be - extracted to the <tt>ROOT/html/VAADIN</tt> directory in the Liferay - installation. If your portal uses custom widgets, install the latest version of <a href="http://vaadin.com/directory#addon/vaadin-control-panel-for-liferay">Vaadin - Control Panel for Liferay</a> for easy widget set compilation - when it is - available - the add-on is not compatible with Vaadin @version@ at the time of this - Vaadin release. <!-- TODO: Remove note when done --></t> - </p> - - <h2 id="gae">Notes and Limitations for Google App Engine</h4></h2> - - <p>The following instructions and limitations apply when you run a Vaadin - application under the Google App Engine.</p> - - <ul> - <li> - <p> - Applications must use <b>GAEVaadinServlet</b> instead of - <b>VaadinServlet</b> in <tt>web.xml</tt>. - </p> - </li> - - <li> - <p> - Session support must be enabled in - <tt>appengine-web.xml</tt>: - </p> - - <pre> <sessions-enabled>true</sessions-enabled></pre> - </li> - - <li> - <p> - Avoid using the session for storage, usual App Engine limitations apply (no - synchronization, that is, unreliable). - </p> - </li> - - <li> - <p> - Vaadin uses memcache for mutex, the key is of the form - <tt>_vmutex<sessionid></tt>. - </p> - </li> - - <li> - <p> - The Vaadin <b>VaadinSession</b> class is serialized separately into - memcache and datastore; the memcache key is <tt>_vac<sessionid></tt> and - the datastore entity kind is <tt>_vac</tt> with identifiers of the type - <tt>_vac<sessionid></tt>. - </p> - </li> - - <li> - <p> - DO NOT update application state when serving an <b>ConnectorResource</b> - (such as <b>ClassResource</b>.<i>getStream()</i>). - </p> - </li> - - <li> - <p> - The application remains locked during uploads - a progress bar is not - possible - </p> - </li> - </ul> - - <p> - For other known problems, see open tickets at developer site <a href="http://dev.vaadin.com/">dev.vaadin.com</a>. - </p> - - <h2 id="supportedversions">Supported Technologies</h2> - - <p> - Vaadin 7 is compatible with <b>Java 6</b>. Vaadin 7 is especially supported on the following - <b>operating systems</b>: - </p> - - <ul> - <li>Windows</li> - <li>Linux</li> - <li>Mac OS X</li> - </ul> - - <p> - Vaadin 7 requires <b>Java Servlet API 2.4</b> but also supports later versions and - should work with any Java application server that conforms to the standard. The - following <b>application servers</b> are supported: - </p> - - <ul> - <li>Apache Tomcat, version 5.0 or newer</li> - <li>Oracle WebLogic® Server, version 10.3 or newer</li> - <li>IBM WebSphere® Application Server, version 7 or newer</li> - <li>JBoss Application Server, 4.0.0 or newer</li> - <li>Jetty, version 5.0 or newer</li> - <li>Glassfish, version 2.0 or newer</li> - </ul> - - <p> - Vaadin 7 supports the JSR-286 Portlet specification. All portals that - implement either of the portlet specifications should work. The following - <b>portals</b> are supported: - </p> - - <ul> - <li>Liferay Portal 5.2 or newer</li> - <li>GateIn Portal 3.1 or newer</li> - <li>eXo Platform 3 or newer</li> - </ul> - - <p> - Vaadin also supports <b>Google App Engine</b>. - </p> - - <p> - Vaadin supports the following <b>desktop browsers</b>: - </p> - - <ul> - <li>Mozilla Firefox 18-20</li> - <li>Mozilla Firefox 17 ESR</li> - <li>Internet Explorer 8-10</li> - <li>Safari 6</li> - <li>Opera 12</li> - <li>Google Chrome 23-26</li> - </ul> - - <p> - Additionally, Vaadin supports the built-in browsers in the following - <b>mobile operating systems</b>: - </p> - - <ul> - <li>iOS 5, 6</li> - <li>Android 2.3, 3, 4</li> - </ul> - - <p>Vaadin SQL Container supports the following databases:</p> - <ul> - <li>HSQLDB</li> - <li>MySQL</li> - <li>MSSQL</li> - <li>Oracle</li> - <li>PostgreSQL</li> - </ul> - - <h2 id="vaadinontheweb">Vaadin on the Web</h2> - - <ul> - <li><a href="http://vaadin.com">vaadin.com - The developer - portal containing everything you need to know about Vaadin</a> - </li> - <li><a href="http://vaadin.com/demo">vaadin.com/demo - A - collection of demos for Vaadin</a></li> - <li><a href="http://vaadin.com/learn">vaadin.com/learn - - Getting started with Vaadin</a></li> - <li><a href="http://vaadin.com/forum">vaadin.com/forum - - Forums for Vaadin related discussions</a> - </li> - <li><a href="http://vaadin.com/book">vaadin.com/book - Book - of Vaadin - everything you need to know about Vaadin</a> - </li> - <li><a href="http://vaadin.com/api">vaadin.com/api - Online - javadocs</a> - </li> - <li><a href="http://vaadin.com/directory">vaadin.com/directory - - Add-ons for Vaadin</a> - </li> - - <li><a href="http://vaadin.com/pro-account">vaadin.com/pro-account - - Commercial support and tools for Vaadin development </a> - </li> - <li><a href="http://vaadin.com/services">vaadin.com/services - - Expert services for Vaadin</a> - </li> - <li><a href="http://vaadin.com/company">vaadin.com/company - - Information about the company behind Vaadin</a> - </li> - - <li><a href="http://dev.vaadin.com">dev.vaadin.com - Bug tracker</a></li> - - <li><a href="http://dev.vaadin.com/wiki/Vaadin/Development/StartingVaadin7Development">How - to get the source code of Vaadin</a> - </li> - </ul> - - </div> <!-- /content--> - - <div id="footer"> - <span class="slogan"><strong>vaadin <em>}></em> </strong> - thinking of U and I<span> <a href="#top">↑ Back to - top</a> - </div> <!-- /footer --> - </body> + <p>Version @version@ built on @builddate@.</p> + + <h2 id="tableofcontents">Release Notes for Vaadin Framework + @version@</h2> + <ul> + <li><a href="#overview">Overview of Vaadin + @version@ Release</a></li> + <li><a href="#enhancements">Enhancements in Vaadin + @version-minor@</a></li> + <li><a href="#changelog">Complete change log for + Vaadin @version@</a></li> + <li><a href="#limitations">Limitations in + @version-minor@</a></li> + <li><a href="#vaadin">Vaadin Installation</a></li> + <li><a href="#package">Package Contents</a></li> + <li><a href="#migrating">Migrating from Vaadin 6 to + Vaadin 7</a></li> + <li><a href="#dependencies">Vaadin @version@ + dependencies</a></li> + <li><a href="#upgrading">Upgrading to Vaadin + @version-minor@</a></li> + <li><a href="#supportedversions">Supported + technologies</a></li> + <li><a href="#vaadinontheweb">Vaadin on the Web</a></li> + </ul> + + <h2 id="overview">Overview of Vaadin @version@ Release</h2> + + <p> + Vaadin @version@ is a feature release that includes a number + of enhancements as well as important bug fixes, as listed in + the <a href="#changelog">change log</a> below. You can also + view the <a + href="http://dev.vaadin.com/query?status=closed&resolution=fixed&milestone=Vaadin+@version@&order=priority">list + of the closed issues</a> at the Vaadin developer's site. + </p> + + <h2 id="enhancements">Enhancements in Vaadin + @version-minor@</h2> + + <p>The @version-minor@ includes many major and minor + enhancements. Below is a list of the most notable changes:</p> + + <ul> + <li>Server push (Use the <b>@Push</b> annotation to + enable push for a UI) + </li> + <li>Server polling using <b>UI</b>.<tt>setPollInterval()</tt></li> + <li>Enhanced debug window</li> + <li>Internet Explorer 10 support</li> + <li>Sass compiler improvements: arithmetics, @content</li> + <li>Dynamic CSS injection</li> + <li>Support for SCSS/CSS files in all add-ons (Use <tt>Vaadin-Stylesheet</tt> + in the manifest) + </li> + <li><b>Calendar</b> is included in the core framework</li> + <li><b>ProgressBar</b> provides progress indication + without polling (separated from <b>ProgressIndicator</b>)</li> + <li>Tooltip and loading indicator delays configurable + on server side</li> + <li>The range of a <b>DateField</b> can be limited + </li> + <li><b>Window</b> has maximize/restore controls</li> + <li><b>UI</b> and <b>VaadinSession</b> provide <tt>access()</tt> + to access the UI and session while holding the needed + lock</li> + <li>A new <b>@VaadinServletConfiguration</b> annotation + for configuring servlet parameters + </li> + <li>WAI-ARIA support for form fields, <b>Button</b>, + and <b>Tree</b></li> + <li>The behavior of <b>Property</b>.toString() can be + toggled using the <tt>legacyPropertyToString</tt> init + parameter + </li> + <li>Default alignment can be set for layout components</li> + <li><b>FieldGroup</b> supports SQL date fields and date + field creation</li> + <li><b>Converter</b>.<tt>convertToModel</tt>/<tt>convertFromModel</tt> + now gets an additional parameter describing the target + type</li> + <li>The browser page can be reloaded programmatically + using <tt>Page.reload()</tt> + </li> + <li>The <b>VaadinServlet</b>/<b>VaadinPortlet</b> and <b>VaadinService</b> + classes have been refactored + </li> + <li>Several locking related fixes</li> + <li>Client compiler dependencies are packaged as a + separate jar</li> + <li>DefaultWidgetSet is even more optimized (using + compiler parameter <tt>-XenableClosureCompiler</tt>) + </li> + <li>Java <tt>assert</tt> statements have been added to + critical code sections. Start JVM with <tt>-ea</tt> to + use. + </li> + <li><b>StateChangeEvent</b>.<tt>isInitialState()</tt> + indicates if event is the first for a connector</li> + <li><b>ClientConnector</b>.<tt>isAttached()</tt> + indicates if connector is attached</li> + <li><b>Container.Filterable</b> now contains a <tt>getContainerFilters()</tt> + method</li> + <li><b>TableQuery</b> now supports schemas and catalogs</li> + </ul> + + <p>Tools have been updated for Vaadin @vaadin-minor@ with + the following changes:</p> + + <ul> + <li>Maven + <ul> + <li>Theme compilation support using <tt>vaadin:update-theme</tt> + and <tt>vaadin:compile-theme</tt></li> + </ul> + </li> + <li>Eclipse + <ul> + <li>Theme compilation support using the + provided button</li> + <li>New projects are by default generated using + Servlet 3.0 API</li> + <li>Additional GWT compiler parameters can be + specified</li> + </ul> + </li> + </ul> + + <p> + For enchancements introduced in Vaadin 7, see the <a + href="http://vaadin.com/download/release/7.0/7.0.0/release-notes.html">Release + Notes for Vaadin 7.0.0</a>. + </p> + + <h3 id="limitations">Limitations</h3> + <ul> + <li>It is currently not possible to specify <tt>font-size</tt> + as <tt>em</tt> or <tt>%</tt>, or layout component sizes + with <tt>em</tt> (<a + href="http://dev.vaadin.com/ticket/10634">#10634</a>) + </li> + <li>Push is currently not supported in portals (See <a + href="http://dev.vaadin.com/ticket/11493">#11493</a>) + </li> + <li>HTTP session can not be invalidated while using + push (<a href="http://dev.vaadin.com/ticket/11721">#11721</a>) + </li> + <li>Cookies are not available while using push (<a + href="http://dev.vaadin.com/ticket/11808">#11808</a>) + </li> + <li>Not all proxies are compatible with websockets. If + you are using push with an incompatible proxy you might + have to force the transport mode to streaming. Some + proxies have problems with streaming also - you need to + ensure that the proxy does not buffer responses for HTTP + streaming to work.</li> + </ul> + + <h3 id="changelog">ChangeLog</h3> + + <p>This release includes the following closed issues:</p> + + <ul>@release-notes-tickets@ + </ul> + + <p> + The <a + href="http://dev.vaadin.com/query?status=closed&resolution=fixed&milestone=Vaadin+7.1.0.beta1&milestone=Vaadin+7.1.0&order=id">full + list of the closed issues</a> can also be found at + <tt>dev.vaadin.com</tt> + . + </p> + + <h2 id="vaadin">Vaadin Installation</h2> + + <p> + <b>Vaadin</b> is a Java framework for building modern web + applications that look great, perform well and make you and + your users happy. <b>Vaadin</b> is available under the + Apache License, Version 2.0 (see the + <tt>license.html</tt> + in the Vaadin ZIP or JAR package). + </p> + + <p> + The easiest ways to install <b>Vaadin</b> are: + </p> + + <ul> + <li>If using Maven, define it as a dependency or use + any of the available archetypes (only <tt>vaadin-application</tt> + is available for Vaadin 7 at the time of this release) + to create a new project + </li> + + <li>If using Eclipse, use the Vaadin Plugin for + Eclipse, which automatically downloads the Vaadin + libraries. To use this prerelease version, the plugin + should be installed from the experimental update site (<tt>http://vaadin.com/eclipse/experimental</tt>). + </li> + </ul> + + <p> + It is also available as a ZIP package downloadable from <a + href="http://vaadin.com/download">Vaadin Download + page</a>. + </p> + + <h3 id="package">Package Contents</h3> + + <p>Inside the ZIP installation package you will find:</p> + + <ul> + <li>Separate server-side (<tt>vaadin-server</tt>) and + client-side (<tt>vaadin-client</tt>, <tt>vaadin-client-compiler</tt>) + development libraries + </li> + <li>Precompiled widget set (<tt>vaadin-client-compiled</tt>) + for server-side development + </li> + <li>Shared library (<tt>vaadin-shared</tt>) for both + server- and client-side libraries + </li> + <li>Built-in themes (<tt>vaadin-themes</tt>) and the + theme compiler (<tt>vaadin-theme-compiler</tt>) + </li> + <li>Dependency libraries provided under the <tt>lib/</tt> + folder + </li> + </ul> + + <p> + See the + <tt>README.TXT</tt> + in the installation package for detailed information about + the package contents. <a href="http://vaadin.com/book">Book + of Vaadin</a> (for Vaadin 7) gives more detailed + instructions. + </p> + + <p> + For server-side development, copy the + <tt>vaadin-server</tt> + , + <tt>vaadin-client-compiled</tt> + , + <tt>vaadin-shared</tt> + , + <tt>vaadin-theme-compiler</tt> + , and + <tt>vaadin-themes</tt> + from the main folder and the dependencies from the + <tt>lib</tt> + folder to the + <tt>WEB-INF/lib</tt> + folder of your Vaadin project. (The + <tt>vaadin-client-compiled</tt> + is necessary if you do not wish to compile the widget set by + your own, which you need to do if you use almost any add-on + components.) + </p> + + <p> + For pure client-side development, you only need the + <tt>vaadin-client</tt> + and + <tt>vaadin-client-compiler</tt> + JARs, which should be put to a non-deployed project library + folder, such as + <tt>lib</tt> + . You also need them if you compile the widget set for any + reason, such as using Vaadin add-ons, or create new + server-side components integrated with client-side widgets. + </p> + + <h2 id="migrating">Migrating from Vaadin 6</h2> + + <p> + All Vaadin 6 applications need some changes when migrating + to Vaadin 7. The most obvious changes are in the + application/window API and require extending either <b>UI</b> + or <b>UI.LegacyApplication</b> instead of <b>Application</b>. + A detailed list of migration changes are given in the <a + href="https://vaadin.com/wiki/-/wiki/Main/Migrating+from+Vaadin+6+to+Vaadin+7">Vaadin + 7 Migration Guide</a>. + </p> + + <p>Any custom client-side widgets need to be ported to use + the new client-server communication API, or the Vaadin 6 + compatibility API.</p> + + <p> + Vaadin 6 add-ons (ones that contain widgets) do not work in + Vaadin 7 - please check the add-ons in <a + href="http://vaadin.com/directory/">Vaadin Directory</a> + for Vaadin 7 support. + </p> + + <h2 id="dependencies">Vaadin @version@ Dependencies</h2> + + <p>When using Maven, Ivy, Gradle, or other dependency + management system, all Vaadin dependencies are downloaded + automatically. This is also the case when using the Vaadin + Plugin for Eclipse.</p> + + <p> + The Vaadin ZIP installation package includes the + dependencies in the + <tt>lib</tt> + subfolder. These need to be copied to the + <tt>WEB-INF/lib</tt> + folder of the web application that uses Vaadin. + </p> + + <p> + The dependencies are listed in the <a href="license.html">Licensing + description</a>. Some are explicit dependencies packaged and + distributed as separate JARs, while some are included inside + other libraries. + </p> + + <h3>Bean Validation</h3> + + <p> + If you use the bean validation feature in Vaadin 7, you need + a Bean Validation API implementation. You need to install + the implementation JAR in the + <tt>WEB-INF/lib</tt> + directory of the web application that uses validation. + </p> + + <h2 id="upgrading">Upgrading to Vaadin @version-minor@</h2> + + <h3>Upgrading the Eclipse Plugin</h3> + + <p> + Vaadin 7 requires that you use a compatible version of the + Vaadin Plugin for Eclipse. The stable version of the plugin + is available from the + <tt>http://vaadin.com/eclipse</tt> + update site. Please see the <a + href="https://vaadin.com/book/vaadin7/-/page/getting-started.eclipse.html#getting-started.eclipse.update">section + about updating the plugin</a> in the Book of Vaadin and the + <a href="http://vaadin.com/eclipse">installation + instructions at the download site</a> for more details. + </p> + + <p> + You can also use the <i>experimental</i> Vaadin Plugin for + Eclipse. Its update site is + <tt>http://vaadin.com/eclipse/experimental</tt> + . + </p> + + <h3>General Upgrading Instructions</h3> + + <p>When upgrading from an earlier Vaadin version, you must: + </p> + + <ul> + <li>Recompile your classes using the new Vaadin + version. Binary compatibility is only guaranteed for + maintenance releases of Vaadin.</li> + + <li>Recompile any add-ons you have created using the + new Vaadin</li> + + <li>Unless using the precompiled widget set, recompile + your widget set using the new Vaadin version</li> + </ul> + + <p>Remember also to refresh the project in your IDE to + ensure that the new version of everything is in use.</p> + + <p> + By using the " + <tt>?debug</tt> + " URL parameter, you can verify that the version of the + servlet, the theme, and the widget set all match. + </p> + + <p> + <b>Eclipse</b> users should always check if there is a new + version of the Eclipse Plug-in available. The Eclipse + Plug-in can be used to update the Vaadin version in the + project (Project properties » Vaadin). + </p> + + <p> + <b>Maven</b> users should update the Vaadin dependency + version in the + <tt>pom.xml</tt> + unless it is defined as + <tt>LATEST</tt> + . You must also ensure that the GWT dependency uses the + correct version and recompile your project and your widget + set. + </p> + + <p> + <b>Liferay and other portal</b> users must install the + Vaadin libraries in + <t>ROOT/WEB-INF/lib/</b> in the portal (and remove a + possibly obsolete older <tt>vaadin.jar</tt>). Additionally, + the contents of the <tt>vaadin-client-compiled</tt> and <tt>vaadin-themes</tt> + must be extracted to the <tt>ROOT/html/VAADIN</tt> directory + in the Liferay installation. If your portal uses custom + widgets, install the latest version of <a + href="http://vaadin.com/directory#addon/vaadin-control-panel-for-liferay">Vaadin + Control Panel for Liferay</a> for easy widget set + compilation - when it is available - the add-on is not + compatible with Vaadin @version@ at the time of this Vaadin + release. <!-- TODO: Remove note when done --></t> + </p> + + <h2 id="gae"> + Notes and Limitations for Google App Engine + </h4> + </h2> + + <p>The following instructions and limitations apply when you + run a Vaadin application under the Google App Engine.</p> + + <ul> + <li> + <p> + Applications must use <b>GAEVaadinServlet</b> + instead of <b>VaadinServlet</b> in + <tt>web.xml</tt> + . + </p> + </li> + + <li> + <p> + Session support must be enabled in + <tt>appengine-web.xml</tt> + : + </p> <pre> <sessions-enabled>true</sessions-enabled></pre> + </li> + + <li> + <p>Avoid using the session for storage, usual App + Engine limitations apply (no synchronization, that + is, unreliable).</p> + </li> + + <li> + <p> + Vaadin uses memcache for mutex, the key is of the + form + <tt>_vmutex<sessionid></tt> + . + </p> + </li> + + <li> + <p> + The Vaadin <b>VaadinSession</b> class is serialized + separately into memcache and datastore; the memcache + key is + <tt>_vac<sessionid></tt> + and the datastore entity kind is + <tt>_vac</tt> + with identifiers of the type + <tt>_vac<sessionid></tt> + . + </p> + </li> + + <li> + <p> + DO NOT update application state when serving an <b>ConnectorResource</b> + (such as <b>ClassResource</b>.<i>getStream()</i>). + </p> + </li> + + <li> + <p>The application remains locked during uploads - a + progress bar is not possible</p> + </li> + </ul> + + <p> + For other known problems, see open tickets at developer site + <a href="http://dev.vaadin.com/">dev.vaadin.com</a>. + </p> + + <h2 id="supportedversions">Supported Technologies</h2> + + <p> + Vaadin 7 is compatible with <b>Java 6</b> and newer. Vaadin + 7 is especially supported on the following <b>operating + systems</b>: + </p> + + <ul> + <li>Windows</li> + <li>Linux</li> + <li>Mac OS X</li> + </ul> + + <p> + Vaadin 7 requires <b>Java Servlet API 2.4</b> but also + supports later versions and should work with any Java + application server that conforms to the standard. The + following <b>application servers</b> are supported: + </p> + + <ul> + <li>Apache Tomcat, version 5.0 or newer</li> + <li>Oracle WebLogic® Server, version 10.3 or newer</li> + <li>IBM WebSphere® Application Server, version 7 or + newer</li> + <li>JBoss Application Server, 4.0.0 or newer</li> + <li>Jetty, version 5.0 or newer</li> + <li>Glassfish, version 2.0 or newer</li> + </ul> + + <p> + Vaadin 7 supports the JSR-286 Portlet specification and all + portals that implement the specification should work. The + following <b>portals</b> are supported: + </p> + + <ul> + <li>Liferay Portal 5.2 or newer</li> + <li>GateIn Portal 3.1 or newer</li> + <li>eXo Platform 3 or newer</li> + </ul> + + <p> + Vaadin also supports <b>Google App Engine</b>. + </p> + + <p> + Vaadin supports the following <b>desktop browsers</b>: + </p> + + <ul> + <li>Mozilla Firefox 18-21</li> + <li>Mozilla Firefox 17 ESR</li> + <li>Internet Explorer 8-10</li> + <li>Safari 6</li> + <li>Opera 12</li> + <li>Google Chrome 23-27</li> + </ul> + + <p> + Additionally, Vaadin supports the built-in browsers in the + following <b>mobile operating systems</b>: + </p> + + <ul> + <li>iOS 5, 6</li> + <li>Android 2.3, 3, 4</li> + </ul> + + <p>Vaadin SQL Container supports the following databases:</p> + <ul> + <li>HSQLDB</li> + <li>MySQL</li> + <li>MSSQL</li> + <li>Oracle</li> + <li>PostgreSQL</li> + </ul> + + <h2 id="vaadinontheweb">Vaadin on the Web</h2> + + <ul> + <li><a href="http://vaadin.com">vaadin.com - The + developer portal containing everything you need to + know about Vaadin</a></li> + <li><a href="http://vaadin.com/demo">vaadin.com/demo + - A collection of demos for Vaadin</a></li> + <li><a href="http://vaadin.com/learn">vaadin.com/learn + - Getting started with Vaadin</a></li> + <li><a href="http://vaadin.com/forum">vaadin.com/forum + - Forums for Vaadin related discussions</a></li> + <li><a href="http://vaadin.com/book">vaadin.com/book + - Book of Vaadin - everything you need to know about + Vaadin</a></li> + <li><a href="http://vaadin.com/api">vaadin.com/api + - Online javadocs</a></li> + <li><a href="http://vaadin.com/directory">vaadin.com/directory + - Add-ons for Vaadin</a></li> + + <li><a href="http://vaadin.com/pro-account">vaadin.com/pro-account + - Commercial support and tools for Vaadin + development </a></li> + <li><a href="http://vaadin.com/services">vaadin.com/services + - Expert services for Vaadin</a></li> + <li><a href="http://vaadin.com/company">vaadin.com/company + - Information about the company behind Vaadin</a></li> + + <li><a href="http://dev.vaadin.com">dev.vaadin.com + - Bug tracker</a></li> + + <li><a + href="http://dev.vaadin.com/wiki/Vaadin/Development/StartingVaadin7Development">How + to get the source code of Vaadin</a></li> + </ul> + + </div> + <!-- /content--> + + <div id="footer"> + <span class="slogan"><strong>vaadin <em>}></em> + </strong> thinking of U and I<span> <a href="#top">↑ Back + to top</a> + </div> + <!-- /footer --> +</body> </html> <!-- Keep this comment at the end of the file diff --git a/all/build.xml b/all/build.xml index a83d60b382..080346403f 100644 --- a/all/build.xml +++ b/all/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-all" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib"> +<project name="vaadin-all" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib"> <description> Compiles a zip containing all jars + dependencies </description> @@ -11,13 +10,11 @@ <!-- global properties --> <property name="module.name" value="vaadin-all" /> <property name="result.dir" value="result" /> - <property name="javadoc.jar" - location="${result.dir}/lib/vaadin-all-${vaadin.version}-javadoc.jar" /> + <property name="javadoc.jar" location="${result.dir}/lib/vaadin-all-${vaadin.version}-javadoc.jar" /> <property name="temp.dir" location="${result.dir}/temp" /> <property name="temp.deps.dir" value="${temp.dir}/lib" /> <property name="javadoc.temp.dir" location="${result.dir}/javadoc-temp" /> - <property name="zip.file" - location="${result.dir}/lib/${module.name}-${vaadin.version}.zip" /> + <property name="zip.file" location="${result.dir}/lib/${module.name}-${vaadin.version}.zip" /> <path id="classpath.javadoc"> <fileset dir="${temp.deps.dir}" includes="*.jar"> @@ -26,17 +23,14 @@ <target name="fetch.module.and.dependencies"> <fail unless="module" message="No 'module' parameter given" /> - <ivy:cachepath pathid="module.and.deps" inline="true" - organisation="com.vaadin" module="vaadin-${module}" - revision="${vaadin.version}" /> + <ivy:cachepath pathid="module.and.deps" inline="true" organisation="com.vaadin" module="vaadin-${module}" revision="${vaadin.version}" /> <copy todir="${temp.dir}" flatten="true"> <path refid="module.and.deps" /> </copy> </target> <target name="unzip.to.javadoctemp"> - <property name="file" - location="${temp.dir}/vaadin-${module}-${vaadin.version}.jar" /> + <property name="file" location="${temp.dir}/vaadin-${module}-${vaadin.version}.jar" /> <unzip src="${file}" dest="${javadoc.temp.dir}" /> </target> @@ -45,14 +39,11 @@ <antcall target="common.filter.webcontent" /> <!-- Unpack all source files to javadoc.temp.dir --> - <antcontrib:foreach list="${modules.to.publish.to.maven}" - target="unzip.to.javadoctemp" param="module" /> + <antcontrib:foreach list="${modules.to.publish.to.maven}" target="unzip.to.javadoctemp" param="module" /> <property name="javadoc.dir" location="${result.dir}/javadoc" /> <property name="title" value="Vaadin ${vaadin.version} API" /> - <javadoc maxmemory="1024m" destdir="${javadoc.dir}" - author="true" version="true" use="true" windowtitle="${title}" - encoding="utf-8"> + <javadoc maxmemory="1024m" destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="${title}" encoding="utf-8"> <packageset dir="${javadoc.temp.dir}"> <!-- TODO Javadoc throws ClassCastException if this is included (#9660) --> @@ -61,11 +52,8 @@ <doctitle><h1>${title}</h1></doctitle> <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> --> <bottom>${javadoc.bottom}</bottom> - <link offline="true" - href="http://docs.oracle.com/javase/6/docs/api/" - packagelistLoc="build/javadoc/j2se-1.6.0" /> - <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" - packagelistLoc="build/javadoc/j2ee-1.4" /> + <link offline="true" href="http://docs.oracle.com/javase/6/docs/api/" packagelistLoc="build/javadoc/j2se-1.6.0" /> + <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" /> <classpath refid="classpath.javadoc" /> </javadoc> @@ -80,8 +68,7 @@ <target name="copy-jars"> <delete dir="${temp.dir}" /> - <antcontrib:foreach list="${modules.to.publish.to.maven}" - target="fetch.module.and.dependencies" param="module" /> + <antcontrib:foreach list="${modules.to.publish.to.maven}" target="fetch.module.and.dependencies" param="module" /> <!-- All jars are now in temp.dir. Still need to separate vaadin and deps --> <move todir="${temp.deps.dir}"> @@ -103,6 +90,7 @@ provided by the container --> <exclude name="**/servlet-api*" /> <exclude name="**/portlet-api*" /> + <exclude name="**/portal-service-*" /> <!-- Buildhelpers should not even get here ... --> <exclude name="*buildhelpers*" /> <!-- Zip users should not need javadoc, sources or pom files --> @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin" basedir="." default="package" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin" basedir="." default="package" xmlns:ivy="antlib:org.apache.ivy.ant"> <include file="common.xml" as="common" /> <path id="vaadin.buildhelpers.classpath" location="${vaadin.basedir}/buildhelpers/result/classes" /> @@ -9,9 +8,7 @@ <!-- ================================= target: all ================================= --> <!--<target name="all" description="Compiles all parts of the project" depends="buildhelpers,theme-compiler,shared,server,client"> --> - <target name="package" - description="Compiles and packages all modules in the project" - depends="buildorder"> + <target name="package" description="Compiles and packages all modules in the project" depends="buildorder"> <subant buildpathref="build-path" target="publish-local"> </subant> </target> @@ -47,15 +44,13 @@ <subant buildpathref="build-path" target="test" /> </target> <target name="test-all" depends="buildorder"> - <property name="war.file" - location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" /> + <property name="war.file" location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" /> <parallel> <sequential> <!-- Sleep before running integration tests so testbench tests have time to compile and start --> <sleep minutes="4" /> - <ant antfile="uitest/integration_tests.xml" target="integration-test-all" - inheritall="false" inheritrefs="false"> + <ant antfile="uitest/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false"> <property name="demo.war" value="${war.file}" /> </ant> </sequential> @@ -70,8 +65,7 @@ <condition property="java.version.matches"> <equals arg1="${ant.java.version}" arg2="${vaadin.java.version}" /> </condition> - <fail unless="java.version.matches" - message="Java version is ${ant.java.version}, but Vaadin must be compiled with genuine Java ${vaadin.java.version} compiler." /> + <fail unless="java.version.matches" message="Java version is ${ant.java.version}, but Vaadin must be compiled with genuine Java ${vaadin.java.version} compiler." /> <echo>Java version is ${ant.java.version} as required.</echo> </target> diff --git a/build/common.xml b/build/common.xml index ee60c1ff42..39f3ee7d9f 100644 --- a/build/common.xml +++ b/build/common.xml @@ -1,17 +1,13 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" - xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant" - name="common" basedir="../" default="init-deps"> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant" name="common" basedir="../" default="init-deps"> <property name="ivy.install.version" value="2.2.0" /> <property name="ivy.jar.name" value="ivy-${ivy.install.version}.jar" /> <property name="ivy.jar.dir" value="${user.home}/.ant/lib" /> <property name="ivy.jar.file" value="${ivy.jar.dir}/${ivy.jar.name}" /> - <target name="init-deps" - description="Configure Ivy dependency management and load common task definitions" - depends="init-taskdefs" unless="deps.initialized"> + <target name="init-deps" description="Configure Ivy dependency management and load common task definitions" depends="init-taskdefs" unless="deps.initialized"> <property name="deps.initialized" value="1" /> </target> @@ -23,26 +19,20 @@ <target name="ivy-download" unless="ivy.installed"> <mkdir dir="${ivy.jar.dir}" /> - <get - src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" - dest="${ivy.jar.file}" usetimestamp="true" /> + <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" /> </target> - <target name="ivy-configure" depends="check-ivy-installed" - unless="deps.initialized"> + <target name="ivy-configure" depends="check-ivy-installed" unless="deps.initialized"> <!-- Ivy task definitions --> - <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" - classpath="${ivy.jar.file}" /> + <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}" /> <!-- Ivy settings --> - <property name="ivy.settings.file" - value="${project.root}/build/ivy/ivysettings.xml" /> + <property name="ivy.settings.file" value="${project.root}/build/ivy/ivysettings.xml" /> <ivy:configure /> </target> <target name="init-taskdefs" depends="ivy-configure" unless="deps.initialized"> <echo>Loading Ant tasks</echo> - <ivy:resolve file="${project.root}/build/ivy/ivy.xml" - conf="taskdefs" /> + <ivy:resolve file="${project.root}/build/ivy/ivy.xml" conf="taskdefs" /> <ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" /> <taskdef resource="emma_ant.properties" classpathref="taskdefs.classpath" /> @@ -50,16 +40,13 @@ override) --> <!-- Note that we have to use a namespace to avoid clash when running sub-ant. --> - <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" - classpathref="taskdefs.classpath" /> + <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpathref="taskdefs.classpath" /> <!-- ant contrib for Maven integration --> - <taskdef resource="org/apache/maven/artifact/ant/antlib.xml" - uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" /> + <taskdef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" /> <!-- jarjar --> - <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" - classpathref="taskdefs.classpath" /> + <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpathref="taskdefs.classpath" /> </target> diff --git a/build/ide.xml b/build/ide.xml index 5380536e2e..45130e9d01 100755 --- a/build/ide.xml +++ b/build/ide.xml @@ -1,9 +1,6 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" - xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant" - name="Build script for IDE users" basedir=".." - default="theme-and-default-widgetset"> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant" name="Build script for IDE users" basedir=".." default="theme-and-default-widgetset"> <include file="${basedir}/gwt-files.xml" /> <property name="gwt.dev.classes" location="${gwt.eclipse.basedir}/dev/bin" /> @@ -14,9 +11,7 @@ <property name="gwt.user.super.src" location="${gwt.basedir}/user/super" /> <property name="work.dir" location="work" /> - <property name="theme-version" location="9.9.9.INTERNAL-DEBUG-BUILD" /> - <echo>Using gwt files from ${gwt.user.classes} and - ${gwt.dev.classes}</echo> + <echo>Using gwt files from ${gwt.user.classes} and ${gwt.dev.classes}</echo> <ivy:resolve file="client-compiler/ivy.xml" conf="ide" /> <ivy:cachepath pathid="client-compiler.deps" conf="ide" /> @@ -74,14 +69,11 @@ </target> <target name="compile-theme"> - <java classname="com.vaadin.buildhelpers.CompileTheme" - failonerror="yes" fork="yes"> + <java classname="com.vaadin.buildhelpers.CompileTheme" failonerror="yes" fork="yes"> <classpath refid="classpath" /> <jvmarg value="-Djava.awt.headless=true" /> <arg value="--theme" /> <arg value="${theme}" /> - <arg value="--theme-version" /> - <arg value="${theme-version}" /> <arg value="--theme-folder" /> <arg value="WebContent/VAADIN/themes" /> </java> @@ -97,8 +89,7 @@ <target name="testing-widgetset"> <antcall target="compile-widgetset"> - <param name="widgetset" - value="com.vaadin.tests.widgetset.TestingWidgetSet" /> + <param name="widgetset" value="com.vaadin.tests.widgetset.TestingWidgetSet" /> </antcall> </target> @@ -111,16 +102,13 @@ <mkdir dir="${module.output.dir}" /> - <echo>Compiling ${module} to ${module.output.dir} with - parameters -logLevel TRACE -style ${style} -localWorkers - ${localWorkers} -strict ${extraParams}</echo> + <echo>Compiling ${module} to ${module.output.dir} with parameters -logLevel TRACE -style ${style} -localWorkers ${localWorkers} -strict ${extraParams}</echo> <!--<ivy:resolve inline="true" organisation="javax.validation" module="validation-api" revision="1.0.0.GA"/> --> <!-- compile the module --> - <java classname="com.google.gwt.dev.Compiler" classpathref="classpath" - failonerror="yes" fork="yes" maxmemory="512m"> + <java classname="com.google.gwt.dev.Compiler" classpathref="classpath" failonerror="yes" fork="yes" maxmemory="512m"> <arg value="-workDir" /> <arg value="${work.dir}" /> <arg value="-logLevel" /> @@ -147,12 +135,9 @@ <target name="vaadinPush.js"> <property name="vaadinPush.js.output" location="WebContent/VAADIN/vaadinPush.js" /> - <loadfile srcfile="WebContent/VAADIN/jquery-1.7.2.js" - property="jquery.js.contents" /> - <loadfile srcfile="WebContent/VAADIN/jquery.atmosphere.js" - property="jquery.atmosphere.js.contents" /> - <loadfile srcfile="WebContent/VAADIN/vaadinPush.js.tpl" - property="vaadinPush.js.contents"> + <loadfile srcfile="WebContent/VAADIN/jquery-1.7.2.js" property="jquery.js.contents" /> + <loadfile srcfile="WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" /> + <loadfile srcfile="WebContent/VAADIN/vaadinPush.js.tpl" property="vaadinPush.js.contents"> <filterchain> <replacetokens begintoken="@" endtoken="@"> <token key="jquery.js" value="${jquery.js.contents}" /> diff --git a/buildhelpers/build.xml b/buildhelpers/build.xml index aa1eb8cb0d..7d9e23683e 100644 --- a/buildhelpers/build.xml +++ b/buildhelpers/build.xml @@ -2,7 +2,8 @@ <project name="vaadin-buildhelpers" basedir="." default="publish-local"> <description> - Compiles build helpers used when building other modules. + Compiles build helpers used when building other + modules. </description> <include file="../build.xml" as="vaadin" /> <include file="../common.xml" as="common" /> @@ -38,8 +39,7 @@ <target name="fetch-release-notes-tickets"> <antcall target="common.exec-buildhelper"> - <param name="main.class" - value="com.vaadin.buildhelpers.FetchReleaseNotesTickets" /> + <param name="main.class" value="com.vaadin.buildhelpers.FetchReleaseNotesTickets" /> <param name="output" value="${output}" /> </antcall> </target> diff --git a/client-compiled/build.xml b/client-compiled/build.xml index 01bf2fa15e..fa5ff262db 100644 --- a/client-compiled/build.xml +++ b/client-compiled/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-client-compiled" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-client-compiled" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> Compiled (JS+HTML) version of client side </description> @@ -17,10 +16,8 @@ <property name="gwtar.dir" location="${result.dir}/gwtar" /> <property name="work.dir" location="${result.dir}/work" /> <property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" /> - <property name="compiled.jar" - location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" /> - <property name="compiled-cache.jar" - location="${result.dir}/lib/${module.name}-cache-${vaadin.version}.jar" /> + <property name="compiled.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" /> + <property name="compiled-cache.jar" location="${result.dir}/lib/${module.name}-cache-${vaadin.version}.jar" /> <union id="jar.includes"> <fileset dir="${result.dir}"> @@ -42,17 +39,13 @@ <target name="compile-module-cache"> - <fail unless="module" - message="You must give the module to compile in the 'module' parameter" /> + <fail unless="module" message="You must give the module to compile in the 'module' parameter" /> <ivy:resolve resolveid="common" conf="compile-module" /> - <ivy:cachepath pathid="classpath.compile.widgetset" - conf="compile-module" /> + <ivy:cachepath pathid="classpath.compile.widgetset" conf="compile-module" /> <echo>Creating gwtar files for ${module} in ${gwtar.dir}</echo> <!-- Produce gwtar files for the separate JAR --> - <java classname="com.google.gwt.dev.CompileModule" - classpathref="classpath.compile.widgetset" failonerror="yes" - fork="yes" maxmemory="512m"> + <java classname="com.google.gwt.dev.CompileModule" classpathref="classpath.compile.widgetset" failonerror="yes" fork="yes" maxmemory="512m"> <arg value="-out" /> <arg value="${gwtar.dir}" /> <arg value="-strict" /> @@ -65,23 +58,20 @@ </target> <target name="compile-module"> - <fail unless="module" - message="You must give the module to compile in the 'module' parameter" /> + <fail unless="module" message="You must give the module to compile in the 'module' parameter" /> <property name="style" value="OBF" /> <property name="localWorkers" value="2" /> <property name="extraParams" value="" /> <ivy:resolve resolveid="common" conf="compile-module" /> - <ivy:cachepath pathid="classpath.compile.widgetset" - conf="compile-module" /> + <ivy:cachepath pathid="classpath.compile.widgetset" conf="compile-module" /> <mkdir dir="${module.output.dir}" /> <echo>Compiling ${module} to ${module.output.dir}</echo> <!-- compile the module --> - <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.widgetset" - failonerror="yes" fork="yes" maxmemory="512m"> + <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.widgetset" failonerror="yes" fork="yes" maxmemory="512m"> <classpath location="${compiled-cache.jar}" /> <arg value="-workDir" /> <arg value="${work.dir}" /> diff --git a/client-compiler/build.xml b/client-compiler/build.xml index 0ed4d7b0e3..67c3c318a7 100644 --- a/client-compiler/build.xml +++ b/client-compiler/build.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> -<project name="vaadin-client-compiler" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-client-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> - Compiles build helpers used when building other modules. + Compiles build helpers used when building other + modules. </description> <include file="../common.xml" as="common" /> <include file="../build.xml" as="vaadin" /> @@ -26,8 +26,7 @@ <target name="jar"> <!-- Get Git revision --> - <exec executable="git" outputproperty="git.revision" - failifexecutionfails="false" errorproperty=""> + <exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty=""> <arg value="describe" /> <arg value="--tags" /> <arg value="--always" /> diff --git a/client/build.xml b/client/build.xml index a027d00f60..dec8b84a18 100644 --- a/client/build.xml +++ b/client/build.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> -<project name="vaadin-client" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-client" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> - Compiles build helpers used when building other modules. + Compiles build helpers used when building other + modules. </description> <include file="../common.xml" as="common" /> <include file="../build.xml" as="vaadin" /> @@ -22,25 +22,21 @@ <path id="classpath.test.custom" /> <target name="jar"> - <property name="jar.file" - location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" /> + <property name="jar.file" location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" /> <antcall target="common.jar"> <reference refid="client.gwt.includes" torefid="extra.jar.includes" /> </antcall> <jar destfile="${jar.file}" update="true"> <manifest> - <attribute name="Vaadin-Package-Version" - value="1" /> + <attribute name="Vaadin-Package-Version" value="1" /> <attribute name="Vaadin-Widgetsets" value="com.vaadin.DefaultWidgetSet" /> </manifest> </jar> <!-- Hack to add validation dependency with source classifier --> - <property name="pom.xml" - location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" /> + <property name="pom.xml" location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" /> <copy file="${pom.xml}" tofile="${temp.pom}"> <filterchain> - <replacestring from=" </dependencies>" - to=" <dependency> + <replacestring from=" </dependencies>" to=" <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.0.0.GA</version> diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index a1f2e4f30e..86ab9455ed 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -36,6 +36,7 @@ import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Window; import com.vaadin.client.debug.internal.ErrorNotificationHandler; import com.vaadin.client.debug.internal.HierarchySection; +import com.vaadin.client.debug.internal.InfoSection; import com.vaadin.client.debug.internal.LogSection; import com.vaadin.client.debug.internal.NetworkSection; import com.vaadin.client.debug.internal.ProfilerSection; @@ -575,6 +576,7 @@ public class ApplicationConfiguration implements EntryPoint { if (LogConfiguration.loggingIsEnabled()) { window.addSection((Section) GWT.create(LogSection.class)); } + window.addSection((Section) GWT.create(InfoSection.class)); window.addSection((Section) GWT.create(HierarchySection.class)); window.addSection((Section) GWT.create(NetworkSection.class)); if (Profiler.isEnabled()) { diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index ac058b5536..4229ca0b67 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -3400,4 +3400,20 @@ public class ApplicationConnection { public void handlePushMessage(String message) { handleJSONText(message, 200); } + + /** + * Returns a human readable string representation of the method used to + * communicate with the server. + * + * @since 7.1 + * @return A string representation of the current transport type + */ + public String getCommunicationMethod() { + if (push != null) { + return "Push (" + push.getTransportType() + ")"; + } else { + return "XHR"; + } + } + } diff --git a/client/src/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/com/vaadin/client/JavaScriptConnectorHelper.java index b144603be0..52d2eeb6dc 100644 --- a/client/src/com/vaadin/client/JavaScriptConnectorHelper.java +++ b/client/src/com/vaadin/client/JavaScriptConnectorHelper.java @@ -25,11 +25,13 @@ import java.util.Set; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArray; +import com.google.gwt.dom.client.Element; import com.google.gwt.json.client.JSONArray; -import com.google.gwt.user.client.Element; import com.vaadin.client.communication.JavaScriptMethodInvocation; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler; +import com.vaadin.client.ui.layout.ElementResizeEvent; +import com.vaadin.client.ui.layout.ElementResizeListener; import com.vaadin.shared.JavaScriptConnectorState; import com.vaadin.shared.communication.MethodInvocation; @@ -42,6 +44,7 @@ public class JavaScriptConnectorHelper { private final Map<String, JavaScriptObject> rpcObjects = new HashMap<String, JavaScriptObject>(); private final Map<String, Set<String>> rpcMethods = new HashMap<String, Set<String>>(); + private final Map<Element, Map<JavaScriptObject, ElementResizeListener>> resizeListeners = new HashMap<Element, Map<JavaScriptObject, ElementResizeListener>>(); private JavaScriptObject connectorWrapper; private int tag; @@ -204,9 +207,71 @@ public class JavaScriptConnectorHelper { 'translateVaadinUri': $entry(function(uri) { return c.@com.vaadin.client.ApplicationConnection::translateVaadinUri(Ljava/lang/String;)(uri); }), + 'addResizeListener': function(element, resizeListener) { + if (!element || element.nodeType != 1) throw "element must be defined"; + if (typeof resizeListener != "function") throw "resizeListener must be defined"; + $entry(h.@com.vaadin.client.JavaScriptConnectorHelper::addResizeListener(*)).call(h, element, resizeListener); + }, + 'removeResizeListener': function(element, resizeListener) { + if (!element || element.nodeType != 1) throw "element must be defined"; + if (typeof resizeListener != "function") throw "resizeListener must be defined"; + $entry(h.@com.vaadin.client.JavaScriptConnectorHelper::removeResizeListener(*)).call(h, element, resizeListener); + } }; }-*/; + // Called from JSNI to add a listener + private void addResizeListener(Element element, + final JavaScriptObject callbackFunction) { + Map<JavaScriptObject, ElementResizeListener> elementListeners = resizeListeners + .get(element); + if (elementListeners == null) { + elementListeners = new HashMap<JavaScriptObject, ElementResizeListener>(); + resizeListeners.put(element, elementListeners); + } + + ElementResizeListener listener = elementListeners.get(callbackFunction); + if (listener == null) { + LayoutManager layoutManager = LayoutManager.get(connector + .getConnection()); + listener = new ElementResizeListener() { + @Override + public void onElementResize(ElementResizeEvent e) { + invokeElementResizeCallback(e.getElement(), + callbackFunction); + } + }; + layoutManager.addElementResizeListener(element, listener); + elementListeners.put(callbackFunction, listener); + } + } + + private static native void invokeElementResizeCallback(Element element, + JavaScriptObject callbackFunction) + /*-{ + // Call with a simple event object and 'this' pointing to the global scope + callbackFunction.call($wnd, {'element': element}); + }-*/; + + // Called from JSNI to remove a listener + private void removeResizeListener(Element element, + JavaScriptObject callbackFunction) { + Map<JavaScriptObject, ElementResizeListener> listenerMap = resizeListeners + .get(element); + if (listenerMap == null) { + return; + } + + ElementResizeListener listener = listenerMap.remove(callbackFunction); + if (listener != null) { + LayoutManager.get(connector.getConnection()) + .removeElementResizeListener(element, listener); + if (listenerMap.isEmpty()) { + resizeListeners.remove(element); + } + } + } + private native void attachRpcMethod(JavaScriptObject rpc, String iface, String method) /*-{ @@ -377,6 +442,20 @@ public class JavaScriptConnectorHelper { public void onUnregister() { invokeIfPresent(connectorWrapper, "onUnregister"); + + if (!resizeListeners.isEmpty()) { + LayoutManager layoutManager = LayoutManager.get(connector + .getConnection()); + for (Entry<Element, Map<JavaScriptObject, ElementResizeListener>> entry : resizeListeners + .entrySet()) { + Element element = entry.getKey(); + for (ElementResizeListener listener : entry.getValue().values()) { + layoutManager + .removeElementResizeListener(element, listener); + } + } + resizeListeners.clear(); + } } private static native void invokeIfPresent( diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java index f7936f8717..506716040d 100644 --- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java @@ -471,4 +471,14 @@ public class AtmospherePushConnection implements PushConnection { }); } } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.communication.PushConnection#getTransportType() + */ + @Override + public String getTransportType() { + return transport; + } } diff --git a/client/src/com/vaadin/client/communication/PushConnection.java b/client/src/com/vaadin/client/communication/PushConnection.java index bc2af98f1a..a7eba224be 100644 --- a/client/src/com/vaadin/client/communication/PushConnection.java +++ b/client/src/com/vaadin/client/communication/PushConnection.java @@ -92,4 +92,13 @@ public interface PushConnection { */ public void disconnect(Command command); + /** + * Returns a human readable string representation of the transport type used + * to communicate with the server. + * + * @since 7.1 + * @return A human readable string representation of the transport type + */ + public String getTransportType(); + }
\ No newline at end of file diff --git a/client/src/com/vaadin/client/debug/internal/InfoSection.java b/client/src/com/vaadin/client/debug/internal/InfoSection.java new file mode 100644 index 0000000000..05908c8834 --- /dev/null +++ b/client/src/com/vaadin/client/debug/internal/InfoSection.java @@ -0,0 +1,289 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.client.debug.internal; + +import java.util.logging.Level; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.ApplicationConfiguration; +import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.ValueMap; +import com.vaadin.shared.Version; +import com.vaadin.shared.util.SharedUtil; + +/** + * Information section of the debug window + * + * @since 7.1 + * @author Vaadin Ltd + */ +public class InfoSection implements Section { + + private static final String THEME_VERSION_CLASSNAME = "v-vaadin-version"; + private static final String PRIMARY_STYLE_NAME = VDebugWindow.STYLENAME + + "-info"; + private static final String ERROR_STYLE = Level.SEVERE.getName(); + private final HTML content = new HTML(); + private DebugButton tabButton = new DebugButton(Icon.INFO); + private FlowPanel controls = new FlowPanel(); + + /** + * + */ + public InfoSection() { + createContent(); + } + + /** + * @since 7.1 + */ + private void createContent() { + content.setStylePrimaryName(PRIMARY_STYLE_NAME); + refresh(); + } + + private void addRow(String parameter, String value) { + addRow(parameter, value, null); + } + + private void addRow(String parameter, String value, String className) { + Element row = DOM.createDiv(); + row.addClassName(VDebugWindow.STYLENAME + "-row"); + if (className != null) { + row.addClassName(className); + } + Element span = DOM.createSpan(); + span.setInnerText(parameter + ": " + value); + row.appendChild(span); + content.getElement().appendChild(row); + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.debug.internal.Section#getTabButton() + */ + @Override + public DebugButton getTabButton() { + return tabButton; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.debug.internal.Section#getControls() + */ + @Override + public Widget getControls() { + return controls; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.debug.internal.Section#getContent() + */ + @Override + public Widget getContent() { + return content; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.debug.internal.Section#show() + */ + @Override + public void show() { + refresh(); + } + + /** + * Updates the information for all running applications + * + * @since 7.1 + */ + private void refresh() { + clear(); + for (ApplicationConnection application : ApplicationConfiguration + .getRunningApplications()) { + refresh(application); + } + } + + /** + * Updates the information for a single running application + * + * @since 7.1 + */ + private void refresh(ApplicationConnection connection) { + clear(); + ApplicationConfiguration configuration = connection.getConfiguration(); + + addVersionInfo(configuration); + addRow("Widget set", GWT.getModuleName()); + addRow("Theme", connection.getConfiguration().getThemeName()); + + String communicationMethodInfo = connection.getCommunicationMethod(); + int pollInterval = connection.getUIConnector().getState().pollInterval; + if (pollInterval > 0) { + communicationMethodInfo += " (poll interval " + pollInterval + "s)"; + } + addRow("Communication method", communicationMethodInfo); + + String heartBeatInfo; + if (configuration.getHeartbeatInterval() < 0) { + heartBeatInfo = "Disabled"; + } else { + heartBeatInfo = configuration.getHeartbeatInterval() + "s"; + } + addRow("Heartbeat", heartBeatInfo); + } + + /** + * Logs version information for client/server/theme. + * + * @param applicationConfiguration + * @since 7.1 + */ + private void addVersionInfo( + ApplicationConfiguration applicationConfiguration) { + String clientVersion = Version.getFullVersion(); + String servletVersion = applicationConfiguration.getServletVersion(); + + String themeVersion; + boolean themeOk; + if (com.vaadin.client.BrowserInfo.get().isIE8()) { + themeVersion = "<IE8 can't detect this>"; + themeOk = true; + } else { + themeVersion = getThemeVersion(); + themeOk = equalsEither(themeVersion, clientVersion, servletVersion); + } + + boolean clientOk = equalsEither(clientVersion, servletVersion, + themeVersion); + boolean servletOk = equalsEither(servletVersion, clientVersion, + themeVersion); + addRow("Client engine version", clientVersion, clientOk ? null + : ERROR_STYLE); + addRow("Server engine version", servletVersion, servletOk ? null + : ERROR_STYLE); + addRow("Theme version", themeVersion, themeOk ? null : ERROR_STYLE); + } + + /** + * Checks if the target value equals one of the reference values + * + * @param target + * The value to compare + * @param reference1 + * A reference value + * @param reference2 + * A reference value + * @return true if target equals one of the references, false otherwise + */ + private boolean equalsEither(String target, String reference1, + String reference2) { + if (SharedUtil.equals(target, reference1)) { + return true; + } + if (SharedUtil.equals(target, reference2)) { + return true; + } + + return false; + } + + /** + * Finds out the version of the current theme (i.e. the version of Vaadin + * used to compile it) + * + * @since 7.1 + * @return The full version as a string + */ + private String getThemeVersion() { + Element div = DOM.createDiv(); + div.setClassName(THEME_VERSION_CLASSNAME); + RootPanel.get().getElement().appendChild(div); + String version = getComputedStyle(div, ":after", "content"); + div.removeFromParent(); + if (version != null) { + // String version = new ComputedStyle(div).getProperty("content"); + version = version.replace("'", ""); + version = version.replace("\"", ""); + } + return version; + } + + private native String getComputedStyle(Element elem, String pseudoElement, + String property) + /*-{ + if ($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) { + return $wnd.document.defaultView.getComputedStyle(elem, pseudoElement)[property]; + } else { + return null; + } + }-*/; + + /** + * Removes all content + * + * @since 7.1 + */ + private void clear() { + content.getElement().setInnerHTML(""); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.debug.internal.Section#hide() + */ + @Override + public void hide() { + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.debug.internal.Section#meta(com.vaadin.client. + * ApplicationConnection, com.vaadin.client.ValueMap) + */ + @Override + public void meta(ApplicationConnection ac, ValueMap meta) { + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.client.debug.internal.Section#uidl(com.vaadin.client. + * ApplicationConnection, com.vaadin.client.ValueMap) + */ + @Override + public void uidl(ApplicationConnection ac, ValueMap uidl) { + } + +} diff --git a/client/src/com/vaadin/client/debug/internal/LogSection.java b/client/src/com/vaadin/client/debug/internal/LogSection.java index 74ac3641c2..1e7524b56d 100644 --- a/client/src/com/vaadin/client/debug/internal/LogSection.java +++ b/client/src/com/vaadin/client/debug/internal/LogSection.java @@ -153,11 +153,11 @@ public class LogSection implements Section { .as(event.getNativeEvent().getEventTarget()); while (!el.getClassName().contains( VDebugWindow.STYLENAME + "-message")) { - el = el.getParentElement(); if (el == contentElement) { // clicked something else return; } + el = el.getParentElement(); } selectText(el); } diff --git a/client/src/com/vaadin/client/ui/VBrowserFrame.java b/client/src/com/vaadin/client/ui/VBrowserFrame.java index c1e131a6c5..4e13921582 100644 --- a/client/src/com/vaadin/client/ui/VBrowserFrame.java +++ b/client/src/com/vaadin/client/ui/VBrowserFrame.java @@ -19,6 +19,7 @@ import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.IFrameElement; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.BrowserInfo; public class VBrowserFrame extends Widget { @@ -134,4 +135,23 @@ public class VBrowserFrame extends Widget { iframe.setName(name); } } + + @Override + protected void onDetach() { + if (BrowserInfo.get().isIE()) { + // Force browser to fire unload event when component is detached + // from the view (IE doesn't do this automatically) + if (iframe != null) { + /* + * src was previously set to javascript:false, but this was not + * enough to overcome a bug when detaching an iframe with a pdf + * loaded in IE9. about:blank seems to cause the adobe reader + * plugin to unload properly before the iframe is removed. See + * #7855 + */ + iframe.setSrc("about:blank"); + } + } + super.onDetach(); + } } diff --git a/client/src/com/vaadin/client/ui/VButton.java b/client/src/com/vaadin/client/ui/VButton.java index c67a9f8747..e67fa6eceb 100644 --- a/client/src/com/vaadin/client/ui/VButton.java +++ b/client/src/com/vaadin/client/ui/VButton.java @@ -190,7 +190,7 @@ public class VButton extends FocusWidget implements ClickHandler { DOM.setCapture(getElement()); isCapturing = true; // Prevent dragging (on some browsers); - // DOM.eventPreventDefault(event); + event.preventDefault(); if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) { addStyleName(CLASSNAME_PRESSED); } diff --git a/client/src/com/vaadin/client/ui/VCheckBox.java b/client/src/com/vaadin/client/ui/VCheckBox.java index bb49dd7f0a..94b37f418e 100644 --- a/client/src/com/vaadin/client/ui/VCheckBox.java +++ b/client/src/com/vaadin/client/ui/VCheckBox.java @@ -16,10 +16,13 @@ package com.vaadin.client.ui; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.Util; import com.vaadin.client.VTooltip; import com.vaadin.client.ui.aria.AriaHelper; @@ -55,6 +58,17 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements (DOM.getEventsSunk(el) | VTooltip.TOOLTIP_EVENTS)); el = DOM.getNextSibling(el); } + + if (BrowserInfo.get().isWebkit()) { + // Webkit does not focus non-text input elements on click + // (#11854) + addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + setFocus(true); + } + }); + } } @Override diff --git a/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java index f23bf88969..1c1173c295 100644 --- a/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java +++ b/client/src/com/vaadin/client/ui/VDragAndDropWrapper.java @@ -80,7 +80,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements @Override public void onMouseDown(MouseDownEvent event) { - if (startDrag(event.getNativeEvent())) { + if (getConnector().isEnabled() + && startDrag(event.getNativeEvent())) { event.preventDefault(); // prevent text selection } } @@ -90,7 +91,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements @Override public void onTouchStart(TouchStartEvent event) { - if (startDrag(event.getNativeEvent())) { + if (getConnector().isEnabled() + && startDrag(event.getNativeEvent())) { /* * Dont let eg. panel start scrolling. */ @@ -112,8 +114,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements private boolean startDrag(NativeEvent event) { if (dragStartMode == WRAPPER || dragStartMode == COMPONENT) { VTransferable transferable = new VTransferable(); - transferable.setDragSource(ConnectorMap.get(client).getConnector( - VDragAndDropWrapper.this)); + transferable.setDragSource(getConnector()); ComponentConnector paintable = Util.findPaintable(client, (Element) event.getEventTarget().cast()); @@ -187,7 +188,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements private boolean uploading; - private ReadyStateChangeHandler readyStateChangeHandler = new ReadyStateChangeHandler() { + private final ReadyStateChangeHandler readyStateChangeHandler = new ReadyStateChangeHandler() { @Override public void onReadyStateChange(XMLHttpRequest xhr) { @@ -261,8 +262,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements } if (VDragAndDropManager.get().getCurrentDropHandler() != getDropHandler()) { VTransferable transferable = new VTransferable(); - transferable.setDragSource(ConnectorMap.get(client) - .getConnector(this)); + transferable.setDragSource(getConnector()); vaadinDragEvent = VDragAndDropManager.get().startDrag( transferable, event, false); @@ -458,6 +458,9 @@ public class VDragAndDropWrapper extends VCustomComponent implements @Override public void dragEnter(VDragEvent drag) { + if (!getConnector().isEnabled()) { + return; + } updateDropDetails(drag); currentlyValid = false; super.dragEnter(drag); @@ -471,6 +474,9 @@ public class VDragAndDropWrapper extends VCustomComponent implements @Override public void dragOver(final VDragEvent drag) { + if (!getConnector().isEnabled()) { + return; + } boolean detailsChanged = updateDropDetails(drag); if (detailsChanged) { currentlyValid = false; @@ -486,6 +492,9 @@ public class VDragAndDropWrapper extends VCustomComponent implements @Override public boolean drop(VDragEvent drag) { + if (!getConnector().isEnabled()) { + return false; + } deEmphasis(true); Map<String, Object> dd = drag.getDropDetails(); @@ -511,14 +520,16 @@ public class VDragAndDropWrapper extends VCustomComponent implements @Override protected void dragAccepted(VDragEvent drag) { + if (!getConnector().isEnabled()) { + return; + } currentlyValid = true; emphasis(drag); } @Override public ComponentConnector getConnector() { - return ConnectorMap.get(client).getConnector( - VDragAndDropWrapper.this); + return VDragAndDropWrapper.this.getConnector(); } @Override @@ -528,6 +539,10 @@ public class VDragAndDropWrapper extends VCustomComponent implements } + public ComponentConnector getConnector() { + return ConnectorMap.get(client).getConnector(this); + } + protected native void hookHtml5DragStart(Element el) /*-{ var me = this; @@ -594,8 +609,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements } private void notifySizePotentiallyChanged() { - LayoutManager.get(client).setNeedsMeasure( - ConnectorMap.get(client).getConnector(getElement())); + LayoutManager.get(client).setNeedsMeasure(getConnector()); } protected void emphasis(VDragEvent drag) { diff --git a/client/src/com/vaadin/client/ui/VNativeButton.java b/client/src/com/vaadin/client/ui/VNativeButton.java index 71413a76e6..67fa6f2ee3 100644 --- a/client/src/com/vaadin/client/ui/VNativeButton.java +++ b/client/src/com/vaadin/client/ui/VNativeButton.java @@ -143,8 +143,10 @@ public class VNativeButton extends Button implements ClickHandler { return; } - if (BrowserInfo.get().isSafari()) { - VNativeButton.this.setFocus(true); + if (BrowserInfo.get().isWebkit()) { + // Webkit does not focus non-text input elements on click + // (#11854) + setFocus(true); } if (disableOnClick) { setEnabled(false); diff --git a/client/src/com/vaadin/client/ui/VOptionGroup.java b/client/src/com/vaadin/client/ui/VOptionGroup.java index eed5549e39..a4c8b6733c 100644 --- a/client/src/com/vaadin/client/ui/VOptionGroup.java +++ b/client/src/com/vaadin/client/ui/VOptionGroup.java @@ -41,6 +41,7 @@ import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.UIDL; import com.vaadin.client.Util; import com.vaadin.shared.EventId; @@ -161,8 +162,16 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, public void onClick(ClickEvent event) { super.onClick(event); if (event.getSource() instanceof CheckBox) { - final boolean selected = ((CheckBox) event.getSource()).getValue(); - final String key = optionsToKeys.get(event.getSource()); + CheckBox source = (CheckBox) event.getSource(); + + if (BrowserInfo.get().isWebkit()) { + // Webkit does not focus non-text input elements on click + // (#11854) + source.setFocus(true); + } + + final boolean selected = source.getValue(); + final String key = optionsToKeys.get(source); if (!isMultiselect()) { selectedKeys.clear(); } diff --git a/client/src/com/vaadin/client/ui/VTextArea.java b/client/src/com/vaadin/client/ui/VTextArea.java index 45e0532451..2a697969df 100644 --- a/client/src/com/vaadin/client/ui/VTextArea.java +++ b/client/src/com/vaadin/client/ui/VTextArea.java @@ -22,6 +22,7 @@ import com.google.gwt.dom.client.Style.WhiteSpace; import com.google.gwt.dom.client.TextAreaElement; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; +import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.user.client.Command; @@ -285,4 +286,12 @@ public class VTextArea extends VTextField { } this.wordwrap = wordwrap; } + + @Override + public void onKeyDown(KeyDownEvent event) { + // Overridden to avoid submitting TextArea value on enter in IE. This is + // another reason why widgets should inherit a common abstract + // class instead of directly each other. + } + } diff --git a/client/src/com/vaadin/client/ui/VUpload.java b/client/src/com/vaadin/client/ui/VUpload.java index 866a6ca4cf..c08d75e9b7 100644 --- a/client/src/com/vaadin/client/ui/VUpload.java +++ b/client/src/com/vaadin/client/ui/VUpload.java @@ -270,13 +270,22 @@ public class VUpload extends SimplePanel { /* * Visit server a moment after upload has started to see possible * changes from UploadStarted event. Will be cleared on complete. + * + * Must get the id here as the upload can finish before the timer + * expires and in that case nextUploadId has been updated and is + * wrong. */ + final int thisUploadId = nextUploadId; t = new Timer() { @Override public void run() { - VConsole.log("Visiting server to see if upload started event changed UI."); - client.updateVariable(paintableId, "pollForStart", - nextUploadId, true); + // Only visit the server if the upload has not already + // finished + if (thisUploadId == nextUploadId) { + VConsole.log("Visiting server to see if upload started event changed UI."); + client.updateVariable(paintableId, "pollForStart", + thisUploadId, true); + } } }; t.schedule(800); diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java index d9eac91e2b..f91ff9e2b9 100644 --- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -50,9 +50,6 @@ public class ComboBoxConnector extends AbstractFieldConnector implements getWidget().paintableId = uidl.getId(); getWidget().readonly = isReadOnly(); - getWidget().enabled = isEnabled(); - - getWidget().tb.setEnabled(getWidget().enabled); getWidget().updateReadOnly(); if (!isRealUpdate(uidl)) { @@ -280,4 +277,11 @@ public class ComboBoxConnector extends AbstractFieldConnector implements widget.updateRootWidth(); } } + + @Override + public void setWidgetEnabled(boolean widgetEnabled) { + super.setWidgetEnabled(widgetEnabled); + getWidget().enabled = widgetEnabled; + getWidget().tb.setEnabled(widgetEnabled); + } } diff --git a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java index ffc146ad04..dd838fdeff 100644 --- a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -287,7 +287,7 @@ public class VDragAndDropManager { protected VDragAndDropManager() { } - private NativePreviewHandler defaultDragAndDropEventHandler = new DefaultDragAndDropEventHandler(); + private final NativePreviewHandler defaultDragAndDropEventHandler = new DefaultDragAndDropEventHandler(); /** * Flag to indicate if drag operation has really started or not. Null check @@ -469,7 +469,8 @@ public class VDragAndDropManager { if (w == null) { return null; } - while (!(w instanceof VHasDropHandler)) { + while (!(w instanceof VHasDropHandler) + || !isDropEnabled((VHasDropHandler) w)) { w = w.getParent(); if (w == null) { break; @@ -492,6 +493,15 @@ public class VDragAndDropManager { } /** + * Checks if the given {@link VHasDropHandler} really is able to accept + * drops. + */ + private static boolean isDropEnabled(VHasDropHandler target) { + VDropHandler dh = target.getDropHandler(); + return dh != null && dh.getConnector().isEnabled(); + } + + /** * Drag is ended (drop happened) on current drop handler. Calls drop method * on current drop handler and does appropriate cleanup. */ diff --git a/common.xml b/common.xml index e46cefd895..02473b4385 100644 --- a/common.xml +++ b/common.xml @@ -1,7 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="common" basedir="." default="" - xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" - xmlns:cs="antlib:com.puppycrawl.tools.checkstyle"> +<project name="common" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle"> <tstamp> <format property="build.date" pattern="yyyy-MM-dd" /> @@ -11,47 +9,35 @@ <property name="gwt.basedir" location="${vaadin.basedir}/../gwt" /> <property file="${vaadin.basedir}/build.properties" /> - <property name="modules.to.publish.to.maven" - value="shared,server,client,client-compiler,client-compiled,theme-compiler,themes,push" /> + <property name="modules.to.publish.to.maven" value="shared,server,client,client-compiler,client-compiled,theme-compiler,themes,push" /> <property name="modules.to.publish.to.download" value="${modules.to.publish.to.maven},all" /> <ivy:settings file="${vaadin.basedir}/ivysettings.xml" /> - <ivy:settings file="${vaadin.basedir}/ivysettings.xml" - id="ivysettings" /> - <ivy:resolve file="${vaadin.basedir}/ivy-taskdefs.xml" - conf="taskdefs" log="quiet" /> + <ivy:settings file="${vaadin.basedir}/ivysettings.xml" id="ivysettings" /> + <ivy:resolve file="${vaadin.basedir}/ivy-taskdefs.xml" conf="taskdefs" log="quiet" /> <ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" /> - <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" - classpathref="taskdefs.classpath" /> + <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpathref="taskdefs.classpath" /> <!-- ant contrib for Maven integration --> - <taskdef resource="org/apache/maven/artifact/ant/antlib.xml" - uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" /> + <taskdef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" /> <!-- FIXME These are not available in other files --> - <antcontrib:propertyregex property="vaadin.version.major" - input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" - select="\1" /> - <antcontrib:propertyregex property="vaadin.version.minor" - input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" - select="\2" /> - <antcontrib:propertyregex property="vaadin.version.revision" - input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" - select="\3" /> + <antcontrib:propertyregex property="vaadin.version.major" input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\1" /> + <antcontrib:propertyregex property="vaadin.version.minor" input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\2" /> + <antcontrib:propertyregex property="vaadin.version.revision" input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\3" /> + <filterset begintoken="@" endtoken="@" id="filter-vaadin.version"> + <filter token="version" value="${vaadin.version}" /> + </filterset> <union id="empty.reference" /> - <property name="filtered.webcontent.dir" - location="${vaadin.basedir}/result/filteredWebContent" /> - <property name="release-notes-tickets-file" - location="${vaadin.basedir}/result/release-notes-tickets.html" /> + <property name="filtered.webcontent.dir" location="${vaadin.basedir}/result/filteredWebContent" /> + <property name="release-notes-tickets-file" location="${vaadin.basedir}/result/release-notes-tickets.html" /> - <target name="filter.webcontent" unless="webcontent.filtered" - depends="fetch-release-notes-tickets"> + <target name="filter.webcontent" unless="webcontent.filtered" depends="fetch-release-notes-tickets"> <property name="webcontent.filtered" value="true" /> <!-- Running without build.release-notes will cause an error, which is ignored --> - <loadfile property="release-notes-tickets" srcFile="${release-notes-tickets-file}" - failonerror="false" /> + <loadfile property="release-notes-tickets" srcFile="${release-notes-tickets-file}" failonerror="false" /> <delete dir="${filtered.webcontent.dir}" /> <copy todir="${filtered.webcontent.dir}"> @@ -74,8 +60,7 @@ <token key="version" value="${vaadin.version}" /> </replacetokens> <replacetokens begintoken="@" endtoken="@"> - <token key="version-minor" - value="${vaadin.version.major}.${vaadin.version.minor}" /> + <token key="version-minor" value="${vaadin.version.major}.${vaadin.version.minor}" /> </replacetokens> <replacetokens begintoken="@" endtoken="@"> <token key="builddate" value="${build.date}" /> @@ -87,12 +72,9 @@ </copy> </target> - <target name="fetch-release-notes-tickets" unless="built.release-notes" - if="build.release-notes"> + <target name="fetch-release-notes-tickets" unless="built.release-notes" if="build.release-notes"> <mkdir dir="${vaadin.basedir}/result" /> - <subant buildpath="${vaadin.basedir}/buildhelpers" - target="fetch-release-notes-tickets" antfile="build.xml" - inheritall="true"> + <subant buildpath="${vaadin.basedir}/buildhelpers" target="fetch-release-notes-tickets" antfile="build.xml" inheritall="true"> <property name="output" location="${release-notes-tickets-file}" /> </subant> <property name="built.release-notes" value="1" /> @@ -109,21 +91,17 @@ </fileset> - <target name="pom.xml" - description="Generates a pom.xml based on the Ivy configuration. Either for a snapshot or a release version" - depends="pom.xml.release,pom.xml.snapshot"> + <target name="pom.xml" description="Generates a pom.xml based on the Ivy configuration. Either for a snapshot or a release version" depends="pom.xml.release,pom.xml.snapshot"> </target> <target name="pom.xml.release" if="build.release"> <fail unless="result.dir" message="No result.dir parameter given" /> <property name="ivy.xml" location="${result.dir}/../ivy.xml" /> - <property name="pom.xml" - location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" /> + <property name="pom.xml" location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" /> <property name="conf" value="build, build-provided" /> <property name="vaadin.maven.version" value="${vaadin.version}" /> - <ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml" - ivyfile="${ivy.xml}" pomfile="${pom.xml}" conf="${conf}"> + <ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml" ivyfile="${ivy.xml}" pomfile="${pom.xml}" conf="${conf}"> <mapping conf="build" scope="compile" /> <mapping conf="build-provided" scope="provided" /> </ivy:makepom> @@ -132,22 +110,18 @@ <target name="pom.xml.snapshot" unless="build.release"> <fail unless="result.dir" message="No result.dir parameter given" /> <property name="ivy.xml" location="${result.dir}/../ivy.xml" /> - <property name="pom.xml" - location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" /> + <property name="pom.xml" location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" /> <property name="temp.pom.xml" location="${pom.xml}.temp" /> <property name="conf" value="build, build-provided" /> - <property name="vaadin.maven.version" - value="${vaadin.version.major}.${vaadin.version.minor}-SNAPSHOT" /> + <property name="vaadin.maven.version" value="${vaadin.version.major}.${vaadin.version.minor}-SNAPSHOT" /> - <ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml" - ivyfile="${ivy.xml}" pomfile="${temp.pom.xml}" conf="${conf}"> + <ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml" ivyfile="${ivy.xml}" pomfile="${temp.pom.xml}" conf="${conf}"> <mapping conf="build" scope="compile" /> <mapping conf="build-provided" scope="provided" /> </ivy:makepom> <copy file="${temp.pom.xml}" tofile="${pom.xml}"> <filterchain> - <replacestring from="${vaadin.version}" - to="${vaadin.maven.version}" /> + <replacestring from="${vaadin.version}" to="${vaadin.maven.version}" /> </filterchain> </copy> <delete file="${temp.pom.xml}" /> @@ -159,8 +133,7 @@ <fail unless="module.name" message="No module.name parameter given" /> <fail unless="src" message="No src directory parameter given" /> - <property name="sources.jar" - location="${result.dir}/lib/${module.name}-${vaadin.version}-sources.jar" /> + <property name="sources.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}-sources.jar" /> <jar file="${sources.jar}" compress="true"> <fileset dir="${src}"> @@ -182,20 +155,15 @@ <fail unless="module.name" message="No module.name parameter given" /> <property name="src" location="{$result.dir}/../src" /> <property name="javadoc.dir" value="${result.dir}/javadoc" /> - <property name="javadoc.jar" - location="${result.dir}/lib/${module.name}-${vaadin.version}-javadoc.jar" /> + <property name="javadoc.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}-javadoc.jar" /> - <javadoc destdir="${javadoc.dir}" author="true" version="true" - use="true" windowtitle="${module.name}"> + <javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="${module.name}"> <packageset dir="${src}" excludes="${classes.exclude}" /> <doctitle><h1>${module.name}</h1></doctitle> <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> --> <bottom>${javadoc.bottom}</bottom> - <link offline="true" - href="http://docs.oracle.com/javase/6/docs/api/" - packagelistLoc="build/javadoc/j2se-1.6.0" /> - <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" - packagelistLoc="build/javadoc/j2ee-1.4" /> + <link offline="true" href="http://docs.oracle.com/javase/6/docs/api/" packagelistLoc="build/javadoc/j2se-1.6.0" /> + <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" /> <classpath refid="classpath.compile.dependencies" /> </javadoc> @@ -211,16 +179,13 @@ <fail unless="result.dir" message="No result.dir parameter given" /> <fail unless="module.name" message="No module.name parameter given" /> - <property name="result.jar" - location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" /> + <property name="result.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" /> <property name="classes" location="{$result.dir}/classes" /> <property name="src" location="{$result.dir}/../src" /> <union id="jar.files"> - <fileset dir="${classes}" excludes="${classes.exclude}" - erroronmissingdir="false" /> - <fileset dir="${src}" excludes="${jar.exclude}" - erroronmissingdir="false" /> + <fileset dir="${classes}" excludes="${classes.exclude}" erroronmissingdir="false" /> + <fileset dir="${src}" excludes="${jar.exclude}" erroronmissingdir="false" /> <fileset refid="common.files.for.all.jars" /> <union refid="extra.jar.includes" /> </union> @@ -229,8 +194,7 @@ <manifest> <attribute name="Implementation-Vendor" value="${vaadin.vendor}" /> <attribute name="Implementation-URL" value="${vaadin.url}" /> - <attribute name="Implementation-Version" - value="${vaadin.version}" /> + <attribute name="Implementation-Version" value="${vaadin.version}" /> </manifest> <union refid="jar.files" /> </jar> @@ -258,13 +222,11 @@ <jar file="${jar}" update="true"> <manifest> <attribute name="Bundle-Version" value="${bundle-version}" /> - <attribute name="Bundle-ManifestVersion" - value="${bundle-manifestversion}" /> + <attribute name="Bundle-ManifestVersion" value="${bundle-manifestversion}" /> <attribute name="Bundle-Name" value="${bundle-name}" /> <attribute name="Bundle-SymbolicName" value="${bundle-symbolic}" /> <attribute name="Bundle-Vendor" value="${bundle-vendor}" /> - <attribute name="Bundle-RequiredExecutionEnvironment" - value="JavaSE-${vaadin.java.version}" /> + <attribute name="Bundle-RequiredExecutionEnvironment" value="JavaSE-${vaadin.java.version}" /> </manifest> </jar> @@ -273,8 +235,7 @@ <then> <jar file="${result.jar}" update="true"> <manifest> - <attribute name="Import-Package" - value="${import-package}" /> + <attribute name="Import-Package" value="${import-package}" /> </manifest> </jar> </then> @@ -284,8 +245,7 @@ <then> <jar file="${result.jar}" update="true"> <manifest> - <attribute name="Require-Bundle" - value="${require-bundle}" /> + <attribute name="Require-Bundle" value="${require-bundle}" /> </manifest> </jar> </then> @@ -295,16 +255,14 @@ <then> <jar file="${result.jar}" update="true"> <manifest> - <attribute name="Export-Package" - value="${export-package}" /> + <attribute name="Export-Package" value="${export-package}" /> </manifest> </jar> </then> </antcontrib:if> <!-- Generate the Export-Package attribute in the manifest --> - <java classname="com.vaadin.buildhelpers.GeneratePackageExports" - failonerror="true" fork="yes"> + <java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes"> <arg value="${jar}" /> <arg line="com/vaadin com/google ${osgi.extra.package.prefixes}" /> <classpath refid="vaadin.buildhelpers.classpath" /> @@ -312,13 +270,10 @@ </java> </target> - <target name="compile" description="Compiles the module" - depends="dependencies, directories" if="src-exists"> + <target name="compile" description="Compiles the module" depends="dependencies, directories" if="src-exists"> <fail unless="module.name" message="No module name given" /> - <javac srcdir="${src}" destdir="${classes}" source="${vaadin.java.version}" - target="${vaadin.java.version}" debug="true" encoding="UTF-8" - includeantruntime="false"> + <javac srcdir="${src}" destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false"> <classpath refid="classpath.compile.dependencies" /> <classpath refid="classpath.compile.custom" /> </javac> @@ -327,8 +282,7 @@ <target name="exec-buildhelper" depends="compile"> <fail unless="main.class" message="No main class given in 'main.class'" /> <fail unless="output" message="No output file given in 'output'" /> - <java classname="${main.class}" output="${output}" - failonerror="true" fork="yes"> + <java classname="${main.class}" output="${output}" failonerror="true" fork="yes"> <classpath refid="vaadin.buildhelpers.classpath" /> <classpath refid="classpath.compile.dependencies" /> <jvmarg value="-Dvaadin.version=${vaadin.version}" /> @@ -363,6 +317,7 @@ <batchtest fork="yes"> <fileset dir="${test.src}"> <exclude name="**/Abstract*" /> + <exclude name="**/Mock*" /> <exclude name="com/vaadin/tests/data/bean/*" /> <exclude name="com/vaadin/tests/util/*" /> <exclude name="**/VaadinClasses.java" /> @@ -373,8 +328,7 @@ </junit> </target> - <target name="test.compile" description="Compiles tests" - depends="compile, dependencies.test"> + <target name="test.compile" description="Compiles tests" depends="compile, dependencies.test"> <fail unless="module.name" message="No module name given" /> <property name="result.dir" location="result" /> <property name="base.dir" location="${result.dir}/.." /> @@ -385,9 +339,7 @@ <mkdir dir="${test.classes}" /> - <javac srcdir="${test.src}" destdir="${test.classes}" - source="${vaadin.java.version}" target="${vaadin.java.version}" - debug="true" encoding="UTF-8" includeantruntime="false"> + <javac srcdir="${test.src}" destdir="${test.classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false"> <classpath refid="classpath.test.dependencies" /> <classpath location="${classes}" /> <classpath refid="classpath.test.custom" /> @@ -402,14 +354,12 @@ <target name="dependencies" description="Resolves dependencies needed by this module"> <property name='conf' value="build, build-provided" /> <ivy:resolve resolveid="common" conf="${conf}" /> - <ivy:cachepath pathid="classpath.compile.dependencies" - conf="${conf}" /> + <ivy:cachepath pathid="classpath.compile.dependencies" conf="${conf}" /> </target> <target name="dependencies.test" description="Resolves dependencies needed by test"> <ivy:resolve resolveid="common" conf="test" /> - <ivy:cachepath pathid="classpath.test.dependencies" - conf="test" /> + <ivy:cachepath pathid="classpath.test.dependencies" conf="test" /> </target> <target name="clean"> @@ -417,18 +367,15 @@ <delete dir="${result.dir}" /> </target> - <target name="publish-local" - description="Publishes the given module to the local repository"> + <target name="publish-local" description="Publishes the given module to the local repository"> <fail unless="result.dir" message="No result.dir parameter given" /> <property name="conf" value="*(public)" /> <ivy:resolve conf="${conf}" /> - <ivy:publish settingsref="ivysettings" conf="${conf}" - resolver="build-temp" overwrite="true" forcedeliver="true"> + <ivy:publish settingsref="ivysettings" conf="${conf}" resolver="build-temp" overwrite="true" forcedeliver="true"> <!-- <artifacts pattern="${result.dir}/[artifact]-[revision].[ext]" /> --> - <artifacts - pattern="${result.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" /> + <artifacts pattern="${result.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" /> </ivy:publish> </target> @@ -437,8 +384,7 @@ <property name="conf" value="*(public)" /> <ivy:resolve conf="${conf}" /> - <ivy:publish conf="${conf}" resolver="local-maven" - overwrite="true"> + <ivy:publish conf="${conf}" resolver="local-maven" overwrite="true"> </ivy:publish> </target> @@ -446,26 +392,21 @@ <property name="cs.dir" location="${vaadin.basedir}/checkstyle" /> <property name="cs.xml" location="${cs.dir}/vaadin-checkstyle.xml" /> <property name="cs.header-file" location="${cs.dir}/header" /> - <taskdef resource="checkstyletask.properties" uri="antlib:com.puppycrawl.tools.checkstyle" - classpathref="taskdefs.classpath" /> + <taskdef resource="checkstyletask.properties" uri="antlib:com.puppycrawl.tools.checkstyle" classpathref="taskdefs.classpath" /> <target name="checkstyle"> <fail unless="result.dir" message="No result.dir parameter given" /> <fail unless="cs.src" message="No cs.src parameter given" /> <property name="result.dir.full" location="${result.dir}" /> <mkdir dir="${result.dir}" /> - <echo>##teamcity[importData type='checkstyle' - path='${result.dir.full}/checkstyle-errors.xml']</echo> + <echo>##teamcity[importData type='checkstyle' path='${result.dir.full}/checkstyle-errors.xml']</echo> <cs:checkstyle config="${cs.xml}" failOnViolation="false"> <fileset dir="${cs.src}" includes="**/*.java"> <exclude name="com/vaadin/sass/internal/parser/Parser.java" /> - <exclude - name="com/vaadin/sass/internal/parser/ParserConstants.java" /> - <exclude - name="com/vaadin/sass/internal/parser/ParserTokenManager.java" /> + <exclude name="com/vaadin/sass/internal/parser/ParserConstants.java" /> + <exclude name="com/vaadin/sass/internal/parser/ParserTokenManager.java" /> </fileset> - <formatter type="xml" - toFile="${result.dir}/checkstyle-errors.xml" /> + <formatter type="xml" toFile="${result.dir}/checkstyle-errors.xml" /> <property key="checkstyle.header.file" file="${cs.header-file}" /> </cs:checkstyle> </target> diff --git a/gwt-files.xml b/gwt-files.xml index 4f9f746c99..a40d69806f 100644 --- a/gwt-files.xml +++ b/gwt-files.xml @@ -25,12 +25,9 @@ <target name="unpack.gwt"> <fail unless="gwt.dev.jar.found" message="Could not find gwt-dev.jar at ${gwt.dev.jar}" /> - <fail unless="gwt.user.jar.found" - message="Could not find gwt-user.jar at ${gwt.user.jar}" /> - <fail unless="gwt.elemental.jar.found" - message="Could not find gwt-elemental.jar at ${gwt.elemental.jar}" /> - <fail unless="gwt.codeserver.jar.found" - message="Could not find gwt-codeserver.jar at ${gwt.codeserver.jar}" /> + <fail unless="gwt.user.jar.found" message="Could not find gwt-user.jar at ${gwt.user.jar}" /> + <fail unless="gwt.elemental.jar.found" message="Could not find gwt-elemental.jar at ${gwt.elemental.jar}" /> + <fail unless="gwt.codeserver.jar.found" message="Could not find gwt-codeserver.jar at ${gwt.codeserver.jar}" /> <delete dir="${gwt.unpack.dir}" /> diff --git a/publish.xml b/publish.xml index e979ec1ca9..008451a2f8 100644 --- a/publish.xml +++ b/publish.xml @@ -1,7 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="publish" basedir="." default="" - xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" - xmlns:artifact="antlib:org.apache.maven.artifact.ant"> +<project name="publish" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> <include file="common.xml" as="common" /> <include file="build.xml" as="vaadin" /> @@ -18,17 +16,14 @@ <fail unless="ant-jsch.present" message="Please install ant-jsch.jar into ANT_HOME/lib" /> <fail unless="jsch.present" message="Please install jsch.jar into ANT_HOME/lib" /> - <target name="nightly.publish" - depends="nightly.download.publish, nightly.maven.publish"> + <target name="nightly.publish" depends="nightly.download.publish, nightly.maven.publish"> </target> <!-- Copies the nightly build artifacts to the download server. --> <target name="nightly.tests.publish" if="nightly.tests.publish"> - <property name="file.war" - location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${version}.war" /> - <property name="target" - value="${nightly.tests.publish}/${vaadin.version.major}.${vaadin.version.minor}-${build.tag}.war" /> + <property name="file.war" location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${version}.war" /> + <property name="target" value="${nightly.tests.publish}/${vaadin.version.major}.${vaadin.version.minor}-${build.tag}.war" /> <echo>Installing ${src} to ${target}</echo> @@ -37,22 +32,18 @@ </target> <target name="nightly.download.publish"> - <antcontrib:foreach list="${modules.to.publish.to.download}" - target="publish.module.to.download.site" param="module" /> + <antcontrib:foreach list="${modules.to.publish.to.download}" target="publish.module.to.download.site" param="module" /> </target> <target name="nightly.maven.publish"> - <antcontrib:foreach list="${modules.to.publish.to.maven}" - target="publish.module.to.maven" param="module" /> + <antcontrib:foreach list="${modules.to.publish.to.maven}" target="publish.module.to.maven" param="module" /> </target> <target name="publish.module.to.download.site"> <fail unless="module" message="No module to publish defined" /> <ivy:resolve file="${module}/ivy.xml" /> - <ivy:publish publishivy="false" settingsref="publish.settings" - conf="*(public)" resolver="sftp-publish"> - <artifacts - pattern="${ivy.settings.dir}/result/artifacts/[revision]/[module]/[artifact]-[revision](-[classifier]).[ext]" /> + <ivy:publish publishivy="false" settingsref="publish.settings" conf="*(public)" resolver="sftp-publish"> + <artifacts pattern="${ivy.settings.dir}/result/artifacts/[revision]/[module]/[artifact]-[revision](-[classifier]).[ext]" /> </ivy:publish> </target> @@ -65,22 +56,17 @@ publishivy="false" settingsref="publish.settings" conf="*(public)" resolver="sonatype"> <artifacts pattern="${ivy.settings.dir}/result/artifacts/${vaadin.version}/[module]/[artifact]-${vaadin.version}(-[classifier]).[ext]" /> </ivy:publish> --> - <property name="jar.file" - location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.jar" /> - <property name="pom.file" - location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.pom" /> + <property name="jar.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.jar" /> + <property name="pom.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.pom" /> <artifact:mvn failonerror="true"> <arg value="gpg:sign-and-deploy-file" /> <sysproperty key="file" value="${jar.file}" /> <sysproperty key="pomFile" value="${pom.file}" /> - <sysproperty key="repositoryId" - value="${maven.snapshot.repository.id}" /> - <sysproperty key="url" - value="${maven.snapshot.repository.url}" /> + <sysproperty key="repositoryId" value="${maven.snapshot.repository.id}" /> + <sysproperty key="url" value="${maven.snapshot.repository.url}" /> <sysproperty key="gpg.passphrase" value="${gpg.passphrase}" /> - <sysproperty key="retryFailedDeploymentCount" - value="10" /> + <sysproperty key="retryFailedDeploymentCount" value="10" /> </artifact:mvn> </target> diff --git a/push/build.xml b/push/build.xml index ad27599d36..2cd86d9ce5 100644 --- a/push/build.xml +++ b/push/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-push" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-push" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> Meta package which defines dependencies needed for push </description> @@ -14,7 +13,7 @@ <property name="vaadinPush.js" location="${result.dir}/js/VAADIN/vaadinPush.js" /> <!-- Keep the version number in sync with ivy.xml --> - <property name="atmosphere.version" value="1.0.13" /> + <property name="atmosphere.version" value="1.0.14-2" /> <property name="jquery.version" value="1.7.2" /> <path id="classpath.compile.custom" /> @@ -28,18 +27,11 @@ <target name="vaadinPush.js"> <mkdir dir="${result.dir}/js/VAADIN" /> <property name="vaadinPush.js.output" location="${result.dir}/js/VAADIN/vaadinPush.js" /> - <property name="vaadinPush.js.combined.output" - location="${result.dir}/js/VAADIN/push.combined.js" /> + <property name="vaadinPush.js.combined.output" location="${result.dir}/js/VAADIN/push.combined.js" /> - <loadfile - srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery-${jquery.version}.js" - property="jquery.js.contents" /> - <loadfile - srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery.atmosphere.js" - property="jquery.atmosphere.js.contents" /> - <loadfile - srcfile="${vaadin.basedir}/WebContent/VAADIN/vaadinPush.js.tpl" - property="vaadinPush.js.contents"> + <loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery-${jquery.version}.js" property="jquery.js.contents" /> + <loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" /> + <loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/vaadinPush.js.tpl" property="vaadinPush.js.contents"> <filterchain> <replacetokens begintoken="@" endtoken="@"> <token key="jquery.js" value="${jquery.js.contents}" /> @@ -50,9 +42,7 @@ <echo file="${vaadinPush.js.combined.output}">${vaadinPush.js.contents}</echo> <!-- Minify --> - <ivy:retrieve organisation="com.yahoo.platform.yui" - module="yuicompressor" revision="2.4.7" inline="true" type="jar" - pattern="${result.dir}/compressor.jar" /> + <ivy:retrieve organisation="com.yahoo.platform.yui" module="yuicompressor" revision="2.4.7" inline="true" type="jar" pattern="${result.dir}/compressor.jar" /> <java jar="${result.dir}/compressor.jar" fork="true"> <arg value="-v" /> <arg value="-o" /> @@ -63,8 +53,7 @@ <target name="jar" depends="vaadinPush.js"> <antcall target="common.jar"> - <param name="require-bundle" - value="org.atmosphere.atmosphere-runtime;bundle-version="${atmosphere.version}";visibility:=reexport" /> + <param name="require-bundle" value="org.atmosphere.atmosphere-runtime;bundle-version="${atmosphere.version}";visibility:=reexport" /> <reference torefid="extra.jar.includes" refid="jar.includes" /> </antcall> </target> diff --git a/push/ivy.xml b/push/ivy.xml index e2ba3a63f7..d0a60dc1c3 100644 --- a/push/ivy.xml +++ b/push/ivy.xml @@ -27,8 +27,8 @@ <!-- Atmosphere --> <!-- Keep the version number in sync with build.xml --> - <dependency org="org.atmosphere" name="atmosphere-runtime" - rev="1.0.13" conf="build,ide,test -> default"> + <dependency org="com.vaadin.external.atmosphere" name="atmosphere-runtime" + rev="1.0.14-2" conf="build,ide,test -> default"> </dependency> </dependencies> diff --git a/server/build.xml b/server/build.xml index a812404862..057f65a0d3 100644 --- a/server/build.xml +++ b/server/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-server" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-server" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> Compiles build helpers used when building other modules. </description> @@ -24,10 +23,8 @@ </union> <target name="jar"> - <property name="server.osgi.import" - value="javax.servlet;version="2.4.0",javax.servlet.http;version="2.4.0",org.jsoup;version="1.6.3",org.jsoup.parser;version="1.6.3",org.jsoup.nodes;version="1.6.3",org.jsoup.helper;version="1.6.3",org.jsoup.safety;version="1.6.3",org.json;version="0.0.20080701"" /> - <property name="server.osgi.require" - value="com.vaadin.shared;bundle-version="${vaadin.version}",com.vaadin.push;bundle-version="${vaadin.version}";resolution:=optional" /> + <property name="server.osgi.import" value="javax.servlet;version="2.4.0",javax.servlet.http;version="2.4.0",org.jsoup;version="1.6.3",org.jsoup.parser;version="1.6.3",org.jsoup.nodes;version="1.6.3",org.jsoup.helper;version="1.6.3",org.jsoup.safety;version="1.6.3",org.json;version="0.0.20080701"" /> + <property name="server.osgi.require" value="com.vaadin.shared;bundle-version="${vaadin.version}",com.vaadin.push;bundle-version="${vaadin.version}";resolution:=optional" /> <antcall target="common.jar"> <param name="require-bundle" value="${server.osgi.require}" /> <param name="import-package" value="${server.osgi.import}" /> diff --git a/server/src/com/vaadin/annotations/Push.java b/server/src/com/vaadin/annotations/Push.java index d5e42d6f60..9965d535ba 100644 --- a/server/src/com/vaadin/annotations/Push.java +++ b/server/src/com/vaadin/annotations/Push.java @@ -54,6 +54,6 @@ public @interface Push { * * @return the transport type to use */ - public Transport transport() default Transport.DEFAULT; + public Transport transport() default Transport.WEBSOCKET; } diff --git a/server/src/com/vaadin/annotations/VaadinServletConfiguration.java b/server/src/com/vaadin/annotations/VaadinServletConfiguration.java index 38e3ff2ef0..e65869c27a 100644 --- a/server/src/com/vaadin/annotations/VaadinServletConfiguration.java +++ b/server/src/com/vaadin/annotations/VaadinServletConfiguration.java @@ -84,8 +84,7 @@ public @interface VaadinServletConfiguration { /** * The time resources can be cached in the browser, in seconds. The default - * value is - * {@value DefaultDeploymentConfiguration#DEFAULT_RESOURCE_CACHE_TIME}. + * value is 3600 seconds, i.e. one hour. * * @return the resource cache time * @@ -96,8 +95,8 @@ public @interface VaadinServletConfiguration { /** * The number of seconds between heartbeat requests of a UI, or a - * non-positive number if heartbeat is disabled. The default value is - * {@value DefaultDeploymentConfiguration#DEFAULT_HEARTBEAT_INTERVAL}. + * non-positive number if heartbeat is disabled. The default value is 300 + * seconds, i.e. 5 minutes. * * @return the time between heartbeats * @@ -109,7 +108,7 @@ public @interface VaadinServletConfiguration { /** * Whether a session should be closed when all its open UIs have been idle * for longer than its configured maximum inactivity time. The default value - * is {@value DefaultDeploymentConfiguration#DEFAULT_CLOSE_IDLE_SESSIONS}. + * is <code>false</code>. * * @return true if UIs and sessions receiving only heartbeat requests are * eventually closed; false if heartbeat requests extend UI and @@ -122,7 +121,7 @@ public @interface VaadinServletConfiguration { /** * The default widgetset to use for the servlet. The default value is - * {@value VaadinServlet#DEFAULT_WIDGETSET}. + * <code>com.vaadin.DefaultWidgetSet</code>. * * @return the default widgetset name */ diff --git a/server/src/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java b/server/src/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java index 5999d850b4..237f01bb22 100644 --- a/server/src/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java +++ b/server/src/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java @@ -65,7 +65,8 @@ public abstract class AbstractStringToNumberConverter<T> implements * If there was a problem converting the value * @since 7.1 */ - protected Number convertToNumber(String value, Locale locale) + protected Number convertToNumber(String value, + Class<? extends Number> targetType, Locale locale) throws ConversionException { if (value == null) { return null; @@ -98,7 +99,8 @@ public abstract class AbstractStringToNumberConverter<T> implements * .Object, java.util.Locale) */ @Override - public String convertToPresentation(T value, Locale locale) + public String convertToPresentation(T value, + Class<? extends String> targetType, Locale locale) throws ConversionException { if (value == null) { return null; diff --git a/server/src/com/vaadin/data/util/converter/Converter.java b/server/src/com/vaadin/data/util/converter/Converter.java index ded7da7fb5..3c391af434 100644 --- a/server/src/com/vaadin/data/util/converter/Converter.java +++ b/server/src/com/vaadin/data/util/converter/Converter.java @@ -22,10 +22,10 @@ import java.util.Locale; /** * Interface that implements conversion between a model and a presentation type. * <p> - * Typically {@link #convertToPresentation(Object, Locale)} and - * {@link #convertToModel(Object, Locale)} should be symmetric so that chaining - * these together returns the original result for all input but this is not a - * requirement. + * Typically {@link #convertToPresentation(Object, Class, Locale)} and + * {@link #convertToModel(Object, Class, Locale)} should be symmetric so that + * chaining these together returns the original result for all input but this is + * not a requirement. * </p> * <p> * Converters must not have any side effects (never update UI from inside a @@ -55,19 +55,23 @@ public interface Converter<PRESENTATION, MODEL> extends Serializable { * A converter can optionally use locale to do the conversion. * </p> * A converter should in most cases be symmetric so chaining - * {@link #convertToPresentation(Object, Locale)} and - * {@link #convertToModel(Object, Locale)} should return the original value. + * {@link #convertToPresentation(Object, Class, Locale)} and + * {@link #convertToModel(Object, Class, Locale)} should return the original + * value. * * @param value * The value to convert, compatible with the target type. Can be * null + * @param targetType + * The requested type of the return value * @param locale * The locale to use for conversion. Can be null. * @return The converted value compatible with the source type * @throws ConversionException * If the value could not be converted */ - public MODEL convertToModel(PRESENTATION value, Locale locale) + public MODEL convertToModel(PRESENTATION value, + Class<? extends MODEL> targetType, Locale locale) throws ConversionException; /** @@ -76,26 +80,30 @@ public interface Converter<PRESENTATION, MODEL> extends Serializable { * A converter can optionally use locale to do the conversion. * </p> * A converter should in most cases be symmetric so chaining - * {@link #convertToPresentation(Object, Locale)} and - * {@link #convertToModel(Object, Locale)} should return the original value. + * {@link #convertToPresentation(Object, Class, Locale)} and + * {@link #convertToModel(Object, Class, Locale)} should return the original + * value. * * @param value * The value to convert, compatible with the target type. Can be * null + * @param targetType + * The requested type of the return value * @param locale * The locale to use for conversion. Can be null. * @return The converted value compatible with the source type * @throws ConversionException * If the value could not be converted */ - public PRESENTATION convertToPresentation(MODEL value, Locale locale) + public PRESENTATION convertToPresentation(MODEL value, + Class<? extends PRESENTATION> targetType, Locale locale) throws ConversionException; /** * The source type of the converter. * * Values of this type can be passed to - * {@link #convertToPresentation(Object, Locale)}. + * {@link #convertToPresentation(Object, Class, Locale)}. * * @return The source type */ @@ -105,7 +113,7 @@ public interface Converter<PRESENTATION, MODEL> extends Serializable { * The target type of the converter. * * Values of this type can be passed to - * {@link #convertToModel(Object, Locale)}. + * {@link #convertToModel(Object, Class, Locale)}. * * @return The target type */ @@ -113,8 +121,9 @@ public interface Converter<PRESENTATION, MODEL> extends Serializable { /** * An exception that signals that the value passed to - * {@link Converter#convertToPresentation(Object, Locale)} or - * {@link Converter#convertToModel(Object, Locale)} could not be converted. + * {@link Converter#convertToPresentation(Object, Class, Locale)} or + * {@link Converter#convertToModel(Object, Class, Locale)} could not be + * converted. * * @author Vaadin Ltd * @since 7.0 diff --git a/server/src/com/vaadin/data/util/converter/ConverterUtil.java b/server/src/com/vaadin/data/util/converter/ConverterUtil.java index 08d7363084..3c62a71b73 100644 --- a/server/src/com/vaadin/data/util/converter/ConverterUtil.java +++ b/server/src/com/vaadin/data/util/converter/ConverterUtil.java @@ -86,7 +86,17 @@ public class ConverterUtil implements Serializable { Converter<PRESENTATIONTYPE, MODELTYPE> converter, Locale locale) throws Converter.ConversionException { if (converter != null) { - return converter.convertToPresentation(modelValue, locale); + PRESENTATIONTYPE presentation = converter.convertToPresentation( + modelValue, presentationType, locale); + if (!presentationType.isInstance(presentation)) { + throw new Converter.ConversionException( + "Converter returned an object of type " + + presentation.getClass().getName() + + " when expecting " + + presentationType.getName()); + } + + return presentation; } if (modelValue == null) { return null; @@ -123,7 +133,17 @@ public class ConverterUtil implements Serializable { * If there is a converter, always use it. It must convert or throw * an exception. */ - return converter.convertToModel(presentationValue, locale); + MODELTYPE model = converter.convertToModel(presentationValue, + modelType, locale); + if (!modelType.isInstance(model)) { + throw new Converter.ConversionException( + "Converter returned an object of type " + + model.getClass().getName() + + " when expecting " + modelType.getName()); + } + + return model; + } if (presentationValue == null) { diff --git a/server/src/com/vaadin/data/util/converter/DateToLongConverter.java b/server/src/com/vaadin/data/util/converter/DateToLongConverter.java index 82dccdcacc..6aedc74f6d 100644 --- a/server/src/com/vaadin/data/util/converter/DateToLongConverter.java +++ b/server/src/com/vaadin/data/util/converter/DateToLongConverter.java @@ -32,10 +32,11 @@ public class DateToLongConverter implements Converter<Date, Long> { * * @see * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, - * java.util.Locale) + * java.lang.Class, java.util.Locale) */ @Override - public Long convertToModel(Date value, Locale locale) { + public Long convertToModel(Date value, Class<? extends Long> targetType, + Locale locale) { if (value == null) { return null; } @@ -48,10 +49,16 @@ public class DateToLongConverter implements Converter<Date, Long> { * * @see * com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang - * .Object, java.util.Locale) + * .Object, java.lang.Class, java.util.Locale) */ @Override - public Date convertToPresentation(Long value, Locale locale) { + public Date convertToPresentation(Long value, + Class<? extends Date> targetType, Locale locale) { + if (targetType != getPresentationType()) { + throw new ConversionException("Converter only supports " + + getPresentationType().getName() + " (targetType was " + + targetType.getName() + ")"); + } if (value == null) { return null; } diff --git a/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java b/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java index 97027cc05b..cddf2d8a42 100644 --- a/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java +++ b/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java @@ -35,14 +35,27 @@ import java.util.Locale; public class DateToSqlDateConverter implements Converter<Date, java.sql.Date> { @Override - public java.sql.Date convertToModel(Date value, Locale locale) + public java.sql.Date convertToModel(Date value, + Class<? extends java.sql.Date> targetType, Locale locale) throws ConversionException { + if (targetType != getModelType()) { + throw new ConversionException("Converter only supports " + + getModelType().getName() + " (targetType was " + + targetType.getName() + ")"); + } + return new java.sql.Date(value.getTime()); } @Override - public Date convertToPresentation(java.sql.Date value, Locale locale) + public Date convertToPresentation(java.sql.Date value, + Class<? extends Date> targetType, Locale locale) throws ConversionException { + if (targetType != getPresentationType()) { + throw new ConversionException("Converter only supports " + + getPresentationType().getName() + " (targetType was " + + targetType.getName() + ")"); + } return new Date(value.getTime()); } diff --git a/server/src/com/vaadin/data/util/converter/ReverseConverter.java b/server/src/com/vaadin/data/util/converter/ReverseConverter.java index 94f333b7f3..6fa07696db 100644 --- a/server/src/com/vaadin/data/util/converter/ReverseConverter.java +++ b/server/src/com/vaadin/data/util/converter/ReverseConverter.java @@ -53,9 +53,10 @@ public class ReverseConverter<PRESENTATION, MODEL> implements * .lang.Object, java.util.Locale) */ @Override - public MODEL convertToModel(PRESENTATION value, Locale locale) + public MODEL convertToModel(PRESENTATION value, + Class<? extends MODEL> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { - return realConverter.convertToPresentation(value, locale); + return realConverter.convertToPresentation(value, targetType, locale); } /* @@ -66,9 +67,10 @@ public class ReverseConverter<PRESENTATION, MODEL> implements * .Object, java.util.Locale) */ @Override - public PRESENTATION convertToPresentation(MODEL value, Locale locale) + public PRESENTATION convertToPresentation(MODEL value, + Class<? extends PRESENTATION> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { - return realConverter.convertToModel(value, locale); + return realConverter.convertToModel(value, targetType, locale); } /* diff --git a/server/src/com/vaadin/data/util/converter/StringToBooleanConverter.java b/server/src/com/vaadin/data/util/converter/StringToBooleanConverter.java index 1702d3808f..6af0933731 100644 --- a/server/src/com/vaadin/data/util/converter/StringToBooleanConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToBooleanConverter.java @@ -35,10 +35,11 @@ public class StringToBooleanConverter implements Converter<String, Boolean> { * * @see * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, - * java.util.Locale) + * java.lang.Class, java.util.Locale) */ @Override - public Boolean convertToModel(String value, Locale locale) + public Boolean convertToModel(String value, + Class<? extends Boolean> targetType, Locale locale) throws ConversionException { if (value == null || value.isEmpty()) { return null; @@ -80,10 +81,11 @@ public class StringToBooleanConverter implements Converter<String, Boolean> { * * @see * com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang - * .Object, java.util.Locale) + * .Object, java.lang.Class, java.util.Locale) */ @Override - public String convertToPresentation(Boolean value, Locale locale) + public String convertToPresentation(Boolean value, + Class<? extends String> targetType, Locale locale) throws ConversionException { if (value == null) { return null; diff --git a/server/src/com/vaadin/data/util/converter/StringToDateConverter.java b/server/src/com/vaadin/data/util/converter/StringToDateConverter.java index 0dcf1d4795..e3917c6a52 100644 --- a/server/src/com/vaadin/data/util/converter/StringToDateConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToDateConverter.java @@ -37,8 +37,9 @@ import java.util.Locale; public class StringToDateConverter implements Converter<String, Date> { /** - * Returns the format used by {@link #convertToPresentation(Date, Locale)} - * and {@link #convertToModel(String, Locale)}. + * Returns the format used by + * {@link #convertToPresentation(Date, Class,Locale)} and + * {@link #convertToModel(String, Class, Locale)}. * * @param locale * The locale to use @@ -60,11 +61,18 @@ public class StringToDateConverter implements Converter<String, Date> { * * @see * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, - * java.util.Locale) + * java.lang.Class, java.util.Locale) */ @Override - public Date convertToModel(String value, Locale locale) + public Date convertToModel(String value, Class<? extends Date> targetType, + Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { + if (targetType != getModelType()) { + throw new ConversionException("Converter only supports " + + getModelType().getName() + " (targetType was " + + targetType.getName() + ")"); + } + if (value == null) { return null; } @@ -87,10 +95,11 @@ public class StringToDateConverter implements Converter<String, Date> { * * @see * com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang - * .Object, java.util.Locale) + * .Object, java.lang.Class, java.util.Locale) */ @Override - public String convertToPresentation(Date value, Locale locale) + public String convertToPresentation(Date value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { return null; diff --git a/server/src/com/vaadin/data/util/converter/StringToDoubleConverter.java b/server/src/com/vaadin/data/util/converter/StringToDoubleConverter.java index 8bb82498b9..c593d256da 100644 --- a/server/src/com/vaadin/data/util/converter/StringToDoubleConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToDoubleConverter.java @@ -44,9 +44,10 @@ public class StringToDoubleConverter extends * java.util.Locale) */ @Override - public Double convertToModel(String value, Locale locale) + public Double convertToModel(String value, + Class<? extends Double> targetType, Locale locale) throws ConversionException { - Number n = convertToNumber(value, locale); + Number n = convertToNumber(value, targetType, locale); return n == null ? null : n.doubleValue(); } diff --git a/server/src/com/vaadin/data/util/converter/StringToFloatConverter.java b/server/src/com/vaadin/data/util/converter/StringToFloatConverter.java index a207654358..6fcb83a770 100644 --- a/server/src/com/vaadin/data/util/converter/StringToFloatConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToFloatConverter.java @@ -44,9 +44,10 @@ public class StringToFloatConverter extends * java.util.Locale) */ @Override - public Float convertToModel(String value, Locale locale) + public Float convertToModel(String value, + Class<? extends Float> targetType, Locale locale) throws ConversionException { - Number n = convertToNumber(value, locale); + Number n = convertToNumber(value, targetType, locale); return n == null ? null : n.floatValue(); } diff --git a/server/src/com/vaadin/data/util/converter/StringToIntegerConverter.java b/server/src/com/vaadin/data/util/converter/StringToIntegerConverter.java index 4f34cf1cd3..bc436112fe 100644 --- a/server/src/com/vaadin/data/util/converter/StringToIntegerConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToIntegerConverter.java @@ -35,8 +35,8 @@ public class StringToIntegerConverter extends /** * Returns the format used by - * {@link #convertToPresentation(Integer, Locale)} and - * {@link #convertToModel(String, Locale)}. + * {@link #convertToPresentation(Integer, Class, Locale)} and + * {@link #convertToModel(String, Class, Locale)} * * @param locale * The locale to use @@ -55,12 +55,13 @@ public class StringToIntegerConverter extends * * @see * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, - * java.util.Locale) + * java.lang.Class, java.util.Locale) */ @Override - public Integer convertToModel(String value, Locale locale) + public Integer convertToModel(String value, + Class<? extends Integer> targetType, Locale locale) throws ConversionException { - Number n = convertToNumber(value, locale); + Number n = convertToNumber(value, targetType, locale); return n == null ? null : n.intValue(); } diff --git a/server/src/com/vaadin/data/util/converter/StringToNumberConverter.java b/server/src/com/vaadin/data/util/converter/StringToNumberConverter.java index eae73e4cfa..22df42403f 100644 --- a/server/src/com/vaadin/data/util/converter/StringToNumberConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToNumberConverter.java @@ -37,12 +37,19 @@ public class StringToNumberConverter extends * * @see * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, - * java.util.Locale) + * java.lang.Class, java.util.Locale) */ @Override - public Number convertToModel(String value, Locale locale) + public Number convertToModel(String value, + Class<? extends Number> targetType, Locale locale) throws ConversionException { - return convertToNumber(value, locale); + if (targetType != getModelType()) { + throw new ConversionException("Converter only supports " + + getModelType().getName() + " (targetType was " + + targetType.getName() + ")"); + } + + return convertToNumber(value, targetType, locale); } /* diff --git a/server/src/com/vaadin/event/ActionManager.java b/server/src/com/vaadin/event/ActionManager.java index ce3e27d539..8d7a64b364 100644 --- a/server/src/com/vaadin/event/ActionManager.java +++ b/server/src/com/vaadin/event/ActionManager.java @@ -15,6 +15,7 @@ */ package com.vaadin.event; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; @@ -43,11 +44,15 @@ public class ActionManager implements Action.Container, Action.Handler, private static final long serialVersionUID = 1641868163608066491L; - /** List of action handlers */ - protected LinkedHashSet<Action> ownActions = null; + /** + * List of action handlers. Guaranteed to keep the original insertion order. + */ + protected HashSet<Action> ownActions = null; - /** List of action handlers */ - protected LinkedHashSet<Handler> actionHandlers = null; + /** + * List of action handlers. Guaranteed to keep the original insertion order. + */ + protected HashSet<Handler> actionHandlers = null; /** Action mapper */ protected KeyMapper<Action> actionMapper = null; diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index 01f7d9af42..c3101924dd 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -84,8 +84,6 @@ public abstract class AbstractClientConnector implements ClientConnector, private ArrayList<Extension> extensions = new ArrayList<Extension>(); - private ClientConnector parent; - /** * The EventRouter used for the event model. */ @@ -563,38 +561,6 @@ public abstract class AbstractClientConnector implements ClientConnector, markAsDirty(); } - @Override - public void setParent(ClientConnector parent) { - - // If the parent is not changed, don't do anything - if (parent == this.parent) { - return; - } - - if (parent != null && this.parent != null) { - throw new IllegalStateException(getClass().getName() - + " already has a parent."); - } - - // Send detach event if the component have been connected to a window - if (isAttached()) { - detach(); - } - - // Connect to new parent - this.parent = parent; - - // Send attach event if connected to an application - if (isAttached()) { - attach(); - } - } - - @Override - public ClientConnector getParent() { - return parent; - } - /* * (non-Javadoc) * diff --git a/server/src/com/vaadin/server/AbstractExtension.java b/server/src/com/vaadin/server/AbstractExtension.java index 00496aed4a..0387ad1b08 100644 --- a/server/src/com/vaadin/server/AbstractExtension.java +++ b/server/src/com/vaadin/server/AbstractExtension.java @@ -33,6 +33,8 @@ public abstract class AbstractExtension extends AbstractClientConnector implements Extension { private boolean previouslyAttached = false; + private ClientConnector parent; + /** * Gets a type that the parent must be an instance of. Override this if the * extension only support certain targets, e.g. if only TextFields can be @@ -69,7 +71,7 @@ public abstract class AbstractExtension extends AbstractClientConnector Class<? extends ClientConnector> supportedParentType = getSupportedParentType(); if (parent == null || supportedParentType.isInstance(parent)) { - super.setParent(parent); + internalSetParent(parent); previouslyAttached = true; } else { throw new IllegalArgumentException(getClass().getName() @@ -79,4 +81,33 @@ public abstract class AbstractExtension extends AbstractClientConnector } } + /** + * Actually sets the parent and calls required listeners. + * + * @since 7.1 + * @param parent + * The parent to set + */ + private void internalSetParent(ClientConnector parent) { + + // Send a detach event if the component is currently attached + if (isAttached()) { + detach(); + } + + // Connect to new parent + this.parent = parent; + + // Send attach event if the component is now attached + if (isAttached()) { + attach(); + } + + } + + @Override + public ClientConnector getParent() { + return parent; + } + } diff --git a/server/src/com/vaadin/server/ClientConnector.java b/server/src/com/vaadin/server/ClientConnector.java index 9e328bb6ef..3c06d5743c 100644 --- a/server/src/com/vaadin/server/ClientConnector.java +++ b/server/src/com/vaadin/server/ClientConnector.java @@ -27,8 +27,6 @@ import com.vaadin.event.ConnectorEvent; import com.vaadin.event.ConnectorEventListener; import com.vaadin.shared.Connector; import com.vaadin.shared.communication.SharedState; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.UI; import com.vaadin.util.ReflectTools; @@ -195,37 +193,6 @@ public interface ClientConnector extends Connector { public void markAsDirtyRecursive(); /** - * Sets the parent connector of the connector. - * - * <p> - * This method automatically calls {@link #attach()} if the connector - * becomes attached to the application, regardless of whether it was - * attached previously. Conversely, if the parent is {@code null} and the - * connector is attached to the application, {@link #detach()} is called for - * the connector. - * </p> - * <p> - * This method is rarely called directly. One of the - * {@link ComponentContainer#addComponent(Component)} or - * {@link AbstractClientConnector#addExtension(Extension)} methods are - * normally used for adding connectors to a parent and they will call this - * method implicitly. - * </p> - * - * <p> - * It is not possible to change the parent without first setting the parent - * to {@code null}. - * </p> - * - * @param parent - * the parent connector - * @throws IllegalStateException - * if a parent is given even though the connector already has a - * parent - */ - public void setParent(ClientConnector parent); - - /** * Checks if the connector is attached to a VaadinSession. * * @since 7.1 diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index 7d3201efdf..0ea9de252a 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -65,7 +65,7 @@ public interface Constants { + " Widgetset version: %s\n" + "================================================================="; - static final String REQUIRED_ATMOSPHERE_VERSION = "1.0.13"; + static final String REQUIRED_ATMOSPHERE_VERSION = "1.0.14-2"; static final String INVALID_ATMOSPHERE_VERSION_WARNING = "\n" + "=================================================================\n" diff --git a/server/src/com/vaadin/server/DragAndDropService.java b/server/src/com/vaadin/server/DragAndDropService.java index cc571853fe..cef1bb86e7 100644 --- a/server/src/com/vaadin/server/DragAndDropService.java +++ b/server/src/com/vaadin/server/DragAndDropService.java @@ -64,6 +64,16 @@ public class DragAndDropService implements VariableOwner, ClientConnector { public void changeVariables(Object source, Map<String, Object> variables) { Object owner = variables.get("dhowner"); + final Component sourceComponent = (Component) variables + .get("component"); + if (sourceComponent != null && !sourceComponent.isEnabled()) { + // source component not supposed to be enabled + getLogger().warning( + "Client dropped from " + sourceComponent + + " even though it's disabled"); + return; + } + // Validate drop handler owner if (!(owner instanceof DropTarget)) { getLogger() @@ -74,6 +84,15 @@ public class DragAndDropService implements VariableOwner, ClientConnector { // owner cannot be null here DropTarget dropTarget = (DropTarget) owner; + + if (!dropTarget.isEnabled()) { + getLogger() + .warning( + "Client dropped on " + owner + + " even though it's disabled"); + return; + } + lastVisitId = (Integer) variables.get("visitId"); // request may be dropRequest or request during drag operation (commonly @@ -296,12 +315,6 @@ public class DragAndDropService implements VariableOwner, ClientConnector { } @Override - public void setParent(ClientConnector parent) { - // TODO Auto-generated method stub - - } - - @Override public void attach() { // TODO Auto-generated method stub diff --git a/server/src/com/vaadin/server/Extension.java b/server/src/com/vaadin/server/Extension.java index 2e632fc6c9..0f3d81598e 100644 --- a/server/src/com/vaadin/server/Extension.java +++ b/server/src/com/vaadin/server/Extension.java @@ -35,4 +35,25 @@ public interface Extension extends ClientConnector { * removed, it cannot be attached again. */ void remove(); + + /** + * Sets the parent connector of the connector. + * + * This method automatically calls {@link #attach()} if the connector + * becomes attached to the session. + * <p> + * This method is rarely called directly. + * {@link AbstractClientConnector#addExtension(Extension)} is normally used + * for adding extensions to a parent and it will call this method + * implicitly. + * </p> + * + * @param parent + * the parent connector + * @throws IllegalStateException + * if a parent is given even though the connector already has a + * parent + */ + public void setParent(ClientConnector parent); + } diff --git a/server/src/com/vaadin/server/LocaleService.java b/server/src/com/vaadin/server/LocaleService.java index 347c4da5c6..031ceb433c 100644 --- a/server/src/com/vaadin/server/LocaleService.java +++ b/server/src/com/vaadin/server/LocaleService.java @@ -19,6 +19,7 @@ */ package com.vaadin.server; +import java.io.Serializable; import java.text.DateFormat; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; @@ -37,7 +38,7 @@ import com.vaadin.ui.UI; * @since 7.1 * @author Vaadin Ltd */ -public class LocaleService { +public class LocaleService implements Serializable { private UI ui; diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java index 11553527e0..4dd7d34e38 100644 --- a/server/src/com/vaadin/server/Page.java +++ b/server/src/com/vaadin/server/Page.java @@ -306,7 +306,7 @@ public class Page implements Serializable { } } - private static interface InjectedStyle { + private static interface InjectedStyle extends Serializable { public void paint(int id, PaintTarget target) throws PaintException; } diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 05e3335c00..a9eb42578e 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -44,6 +44,7 @@ import com.vaadin.annotations.VaadinServletConfiguration.InitParameterName; import com.vaadin.sass.internal.ScssStylesheet; import com.vaadin.server.communication.ServletUIInitHandler; import com.vaadin.shared.JsonConstants; +import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; @SuppressWarnings("serial") @@ -69,6 +70,8 @@ public class VaadinServlet extends HttpServlet implements Constants { super.init(servletConfig); Properties initParameters = new Properties(); + readUiFromEnclosingClass(initParameters); + readConfigurationAnnotation(initParameters); // Read default parameters from server.xml @@ -101,6 +104,15 @@ public class VaadinServlet extends HttpServlet implements Constants { CurrentInstance.clearAll(); } + private void readUiFromEnclosingClass(Properties initParameters) { + Class<?> enclosingClass = getClass().getEnclosingClass(); + + if (enclosingClass != null && UI.class.isAssignableFrom(enclosingClass)) { + initParameters.put(VaadinSession.UI_PARAMETER, + enclosingClass.getName()); + } + } + private void readConfigurationAnnotation(Properties initParameters) throws ServletException { VaadinServletConfiguration configAnnotation = UIProvider @@ -742,11 +754,6 @@ public class VaadinServlet extends HttpServlet implements Constants { private boolean serveOnTheFlyCompiledScss(String filename, HttpServletRequest request, HttpServletResponse response, ServletContext sc) throws IOException { - if (getService().getDeploymentConfiguration().isProductionMode()) { - // This is not meant for production mode. - return false; - } - if (!filename.endsWith(".css")) { return false; } @@ -766,9 +773,21 @@ public class VaadinServlet extends HttpServlet implements Constants { "Requested resource [{0}] not accessible in the VAADIN directory or access to it is forbidden.", filename); response.setStatus(HttpServletResponse.SC_FORBIDDEN); + + // Handled, return true so no further processing is done + return true; + } + if (getService().getDeploymentConfiguration().isProductionMode()) { + // This is not meant for production mode. + getLogger() + .log(Level.INFO, + "Request for {0} not handled by sass compiler while in production mode", + filename); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); // Handled, return true so no further processing is done return true; } + synchronized (SCSS_MUTEX) { String realFilename = sc.getRealPath(scssFilename); ScssStylesheet scss = ScssStylesheet.get(realFilename); diff --git a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java index 9e57ccb45d..e325550c4b 100644 --- a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java +++ b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java @@ -93,12 +93,13 @@ public class AtmospherePushConnection implements PushConnection { } private UI ui; - private transient AtmosphereResource resource; - private transient Future<String> outgoingMessage; - private transient FragmentedMessage incomingMessage; + private AtmosphereResource resource; + private Future<String> outgoingMessage; + private FragmentedMessage incomingMessage; - public AtmospherePushConnection(UI ui) { + public AtmospherePushConnection(UI ui, AtmosphereResource resource) { this.ui = ui; + this.resource = resource; } @Override @@ -176,21 +177,6 @@ public class AtmospherePushConnection implements PushConnection { } } - /** - * Associates this connection with the given AtmosphereResource. If there is - * a push pending, commits it. - * - * @param resource - * The AtmosphereResource representing the push channel. - * @throws IOException - */ - protected void connect(AtmosphereResource resource) throws IOException { - this.resource = resource; - } - - /** - * Returns whether this connection is currently open. - */ @Override public boolean isConnected() { return resource != null @@ -215,6 +201,8 @@ public class AtmospherePushConnection implements PushConnection { @Override public void disconnect() { + assert isConnected(); + if (outgoingMessage != null) { // Wait for the last message to be sent before closing the // connection (assumes that futures are completed in order) diff --git a/server/src/com/vaadin/server/communication/PushConnection.java b/server/src/com/vaadin/server/communication/PushConnection.java index bb88998402..7f78d1d48e 100644 --- a/server/src/com/vaadin/server/communication/PushConnection.java +++ b/server/src/com/vaadin/server/communication/PushConnection.java @@ -16,8 +16,6 @@ package com.vaadin.server.communication; -import java.io.Serializable; - import com.vaadin.ui.UI; /** @@ -27,18 +25,20 @@ import com.vaadin.ui.UI; * @author Vaadin Ltd * @since 7.1 */ -public interface PushConnection extends Serializable { +public interface PushConnection { /** - * Pushes pending state changes and client RPC calls to the client. It is - * NOT safe to invoke this method if not holding the session lock. + * Pushes pending state changes and client RPC calls to the client. Cannot + * be called if {@link #isConnected()} is false. It is NOT safe to invoke + * this method if not holding the session lock. * <p> * This is internal API; please use {@link UI#push()} instead. */ public void push(); /** - * Disconnects the connection. + * Closes the connection. Cannot be called if {@link #isConnected()} is + * false. */ public void disconnect(); diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java index 7efcb8fd8c..6b853063a7 100644 --- a/server/src/com/vaadin/server/communication/PushHandler.java +++ b/server/src/com/vaadin/server/communication/PushHandler.java @@ -109,8 +109,7 @@ public class PushHandler implements AtmosphereHandler { resource.suspend(); AtmospherePushConnection connection = new AtmospherePushConnection( - ui); - connection.connect(resource); + ui, resource); ui.setPushConnection(connection); } @@ -305,12 +304,9 @@ public class PushHandler implements AtmosphereHandler { private static AtmospherePushConnection getConnectionForUI(UI ui) { PushConnection pushConnection = ui.getPushConnection(); if (pushConnection instanceof AtmospherePushConnection) { - AtmospherePushConnection apc = (AtmospherePushConnection) pushConnection; - if (apc.isConnected()) { - return apc; - } + assert pushConnection.isConnected(); + return (AtmospherePushConnection) pushConnection; } - return null; } @@ -374,11 +370,14 @@ public class PushHandler implements AtmosphereHandler { */ private static void sendRefreshAndDisconnect(AtmosphereResource resource) throws IOException { - AtmospherePushConnection connection = new AtmospherePushConnection(null); - connection.connect(resource); - connection.sendMessage(VaadinService.createCriticalNotificationJSON( - null, null, null, null)); - connection.disconnect(); + AtmospherePushConnection connection = new AtmospherePushConnection( + null, resource); + try { + connection.sendMessage(VaadinService + .createCriticalNotificationJSON(null, null, null, null)); + } finally { + connection.disconnect(); + } } private static final Logger getLogger() { diff --git a/server/src/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/com/vaadin/server/communication/UidlRequestHandler.java index 3564aa65b5..d52c5e9fe0 100644 --- a/server/src/com/vaadin/server/communication/UidlRequestHandler.java +++ b/server/src/com/vaadin/server/communication/UidlRequestHandler.java @@ -75,7 +75,6 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements } checkWidgetsetVersion(request); - String requestThemeName = request.getParameter("theme"); // repaint requested or session has timed out and new one is created boolean repaintAll; @@ -114,7 +113,6 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements return true; } finally { stringWriter.close(); - requestThemeName = null; } return UIInitHandler.commitJsonResponse(request, response, diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 9ff36a42d2..0bf27435fb 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -28,7 +28,6 @@ import java.util.regex.Pattern; import com.vaadin.event.ActionManager; import com.vaadin.event.ShortcutListener; import com.vaadin.server.AbstractClientConnector; -import com.vaadin.server.ClientConnector; import com.vaadin.server.ComponentSizeValidator; import com.vaadin.server.ErrorHandler; import com.vaadin.server.ErrorMessage; @@ -94,6 +93,8 @@ public abstract class AbstractComponent extends AbstractClientConnector private boolean visible = true; + private HasComponents parent; + /* Constructor */ /** @@ -451,17 +452,32 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public HasComponents getParent() { - return (HasComponents) super.getParent(); + return parent; } @Override - public void setParent(ClientConnector parent) { - if (parent == null || parent instanceof HasComponents) { - super.setParent(parent); - } else { - throw new IllegalArgumentException( - "The parent of a Component must implement HasComponents, which " - + parent.getClass() + " doesn't do."); + public void setParent(HasComponents parent) { + // If the parent is not changed, don't do anything + if (parent == this.parent) { + return; + } + + if (parent != null && this.parent != null) { + throw new IllegalStateException(getClass().getName() + + " already has a parent."); + } + + // Send a detach event if the component is currently attached + if (isAttached()) { + detach(); + } + + // Connect to new parent + this.parent = parent; + + // Send attach event if the component is now attached + if (isAttached()) { + attach(); } } diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java index 606bf5fb21..6a52d6b849 100644 --- a/server/src/com/vaadin/ui/AbstractField.java +++ b/server/src/com/vaadin/ui/AbstractField.java @@ -740,35 +740,59 @@ public abstract class AbstractField<T> extends AbstractComponent implements */ private Object convertToModel(T fieldValue, Locale locale) throws Converter.ConversionException { - Class<?> modelType = null; - Property pd = getPropertyDataSource(); - if (pd != null) { - modelType = pd.getType(); - } else if (getConverter() != null) { - modelType = getConverter().getModelType(); - } + Class<?> modelType = getModelType(); try { return ConverterUtil.convertToModel(fieldValue, (Class<Object>) modelType, getConverter(), locale); } catch (ConversionException e) { - throw new ConversionException(getConversionError(modelType), e); + throw new ConversionException(getConversionError(modelType, e), e); + } + } + + /** + * Retrieves the type of the currently used data model. If the field has no + * data source then the model type of the converter is used. + * + * @since 7.1 + * @return The type of the currently used data model or null if no data + * source or converter is set. + */ + protected Class<?> getModelType() { + Property<?> pd = getPropertyDataSource(); + if (pd != null) { + return pd.getType(); + } else if (getConverter() != null) { + return getConverter().getModelType(); } + return null; } /** - * Returns the conversion error with {0} replaced by the data source type. + * Returns the conversion error with {0} replaced by the data source type + * and {1} replaced by the exception (localized) message. * + * @since 7.1 * @param dataSourceType - * The type of the data source + * the type of the data source + * @param e + * a conversion exception which can provide additional + * information * @return The value conversion error string with parameters replaced. */ - protected String getConversionError(Class<?> dataSourceType) { - if (dataSourceType == null) { - return getConversionError(); - } else { - return getConversionError().replace("{0}", + protected String getConversionError(Class<?> dataSourceType, + ConversionException e) { + String conversionError = getConversionError(); + + if (dataSourceType != null) { + conversionError = conversionError.replace("{0}", dataSourceType.getSimpleName()); } + if (e != null) { + conversionError = conversionError.replace("{1}", + e.getLocalizedMessage()); + } + + return conversionError; } /** @@ -923,10 +947,10 @@ public abstract class AbstractField<T> extends AbstractComponent implements if (getConverter() != null) { try { valueToValidate = getConverter().convertToModel(fieldValue, - getLocale()); - } catch (Exception e) { - throw new InvalidValueException( - getConversionError(getConverter().getModelType())); + getModelType(), getLocale()); + } catch (ConversionException e) { + throw new InvalidValueException(getConversionError( + getConverter().getModelType(), e)); } } @@ -1461,7 +1485,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements /** * Sets the error that is shown if the field value cannot be converted to * the data source type. If {0} is present in the message, it will be - * replaced by the simple name of the data source type. + * replaced by the simple name of the data source type. If {1} is present in + * the message, it will be replaced by the ConversionException message. * * @param valueConversionError * Message to be shown when conversion of the value fails diff --git a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java index 0b3da768c9..6769b6e513 100644 --- a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java +++ b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -82,6 +82,16 @@ import com.vaadin.shared.ui.JavaScriptComponentState; * <li><code>translateVaadinUri(uri)</code> - Translates a Vaadin URI to a URL * that can be used in the browser. This is just way of accessing * {@link com.vaadin.client.ApplicationConnection#translateVaadinUri(String)}</li> + * <li><code>addResizeListener(element, callbackFunction)</code> - Registers a + * listener that gets notified whenever the size of the provided element + * changes. The listener is called with one parameter: an event object with the + * <code>element</code> property pointing to the element that has been resized. + * <li><code>removeResizeListener(element, callbackFunction)</code> - + * Unregisters a combination of an element and a listener that has previously + * been registered using <code>addResizeListener</code>. All registered + * listeners are automatically unregistered when this connector is unregistered, + * but this method can be use to to unregister a listener at an earlier point in + * time. * </ul> * The connector wrapper also supports these special functions: * <ul> diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index 20958812fc..485327bb54 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -333,6 +333,32 @@ public interface Component extends ClientConnector, Sizeable, Serializable { public void setVisible(boolean visible); /** + * Sets the parent connector of the component. + * + * <p> + * This method automatically calls {@link #attach()} if the component + * becomes attached to the session, regardless of whether it was attached + * previously. Conversely, if the component currently is attached to the + * session, {@link #detach()} is called for the connector before attaching + * it to a new parent. + * </p> + * <p> + * This method is rarely called directly. + * {@link ComponentContainer#addComponent(Component)} or a + * {@link HasComponents} specific method is normally used for adding + * components to a parent and the used method will call this method + * implicitly. + * </p> + * + * @param parent + * the parent connector + * @throws IllegalStateException + * if a parent is given even though the connector already has a + * parent + */ + public void setParent(HasComponents parent); + + /** * Gets the parent component of the component. * * <p> diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 3d7cb42050..a688b2eb45 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -4011,7 +4011,8 @@ public class Table extends AbstractSelect implements Action.Container, } Object value = property.getValue(); if (converter != null) { - return converter.convertToPresentation(value, getLocale()); + return converter.convertToPresentation(value, String.class, + getLocale()); } return (null != value) ? value.toString() : ""; } diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 9f2039de72..e0811e51f7 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -411,12 +411,9 @@ public abstract class UI extends AbstractSingleComponentContainer implements } else { if (session == null) { detach(); - if (pushConnection != null && pushConnection.isConnected()) { - // Close the push connection when UI is detached. Otherwise - // the push connection and possibly VaadinSession will live - // on. - pushConnection.disconnect(); - } + // Close the push connection when UI is detached. Otherwise the + // push connection and possibly VaadinSession will live on. + setPushConnection(null); } this.session = session; } @@ -536,7 +533,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements private Navigator navigator; - private PushConnection pushConnection = null; + private transient PushConnection pushConnection = null; private boolean hasPendingPush = false; @@ -1072,7 +1069,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements boolean sessionExpired = (session == null || session.isClosing()); getRpcProxy(UIClientRpc.class).uiClosed(sessionExpired); - if (getPushConnection() != null && getPushConnection().isConnected()) { + if (getPushConnection() != null) { // Push the Rpc to the client. The connection will be closed when // the UI is detached and cleaned up. getPushConnection().push(); @@ -1342,19 +1339,24 @@ public abstract class UI extends AbstractSingleComponentContainer implements /** * Returns the internal push connection object used by this UI. This method - * should only be called by the framework. + * should only be called by the framework. If the returned PushConnection is + * not null, it is guaranteed to have {@code isConnected() == true}. */ public PushConnection getPushConnection() { + assert (pushConnection == null || pushConnection.isConnected()); return pushConnection; } /** * Sets the internal push connection object used by this UI. This method - * should only be called by the framework. + * should only be called by the framework. If {@pushConnection} is not null, + * its {@code isConnected()} must be true. */ public void setPushConnection(PushConnection pushConnection) { // If pushMode is disabled then there should never be a pushConnection - assert (getPushConfiguration().getPushMode().isEnabled() || pushConnection == null); + assert (pushConnection == null || getPushConfiguration().getPushMode() + .isEnabled()); + assert (pushConnection == null || pushConnection.isConnected()); if (pushConnection == this.pushConnection) { return; diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index 9f64c9118e..700d0eb387 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -31,7 +31,6 @@ import com.vaadin.event.ShortcutAction; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.event.ShortcutAction.ModifierKey; import com.vaadin.event.ShortcutListener; -import com.vaadin.server.ClientConnector; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.shared.MouseEventDetails; @@ -139,7 +138,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * ) */ @Override - public void setParent(ClientConnector parent) { + public void setParent(HasComponents parent) { if (parent == null || parent instanceof UI) { super.setParent(parent); } else { diff --git a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java index 2a83f5d5b2..3f940ae0a7 100644 --- a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java +++ b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java @@ -4,10 +4,8 @@ import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; -import java.lang.reflect.Field; import java.net.MalformedURLException; import java.net.URL; -import java.util.Properties; import javax.servlet.http.HttpServletRequest; @@ -24,16 +22,7 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase super.setUp(); servlet = new VaadinServlet(); - - // Workaround to avoid calling init and creating servlet config - Field f = VaadinServlet.class.getDeclaredField("servletService"); - f.setAccessible(true); - VaadinServletService service = new VaadinServletService(servlet, - new DefaultDeploymentConfiguration(servlet.getClass(), - new Properties())); - service.init(); - f.set(servlet, service); - + servlet.init(new MockServletConfig()); } public void testWidgetSetLocation() throws Exception { diff --git a/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java b/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java index 80cb1d7b0c..d347534f5c 100644 --- a/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java +++ b/server/tests/src/com/vaadin/server/VaadinServletConfigurationTest.java @@ -32,10 +32,17 @@ import org.junit.Test; import com.vaadin.annotations.VaadinServletConfiguration; import com.vaadin.server.DeploymentConfiguration.LegacyProperyToStringMode; import com.vaadin.server.VaadinServletConfigurationTest.MockUI; +import com.vaadin.server.VaadinServletConfigurationTest.MockUI.ServletInUI; import com.vaadin.ui.UI; public class VaadinServletConfigurationTest { public static class MockUI extends UI { + + public static class ServletInUI extends VaadinServlet { + // This servlet should automatically be configured to use the + // enclosing UI class + } + @Override protected void init(VaadinRequest request) { // Do nothing @@ -43,6 +50,18 @@ public class VaadinServletConfigurationTest { } @Test + public void testEnclosingUIClass() throws Exception { + ServletInUI servlet = new MockUI.ServletInUI(); + servlet.init(new MockServletConfig()); + + Class<? extends UI> uiClass = new DefaultUIProvider() + .getUIClass(new UIClassSelectionEvent(new VaadinServletRequest( + EasyMock.createMock(HttpServletRequest.class), servlet + .getService()))); + Assert.assertEquals(MockUI.class, uiClass); + } + + @Test public void testValuesFromAnnotation() throws ServletException { TestServlet servlet = new TestServlet(); servlet.init(new MockServletConfig()); diff --git a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java index 9da8406507..b53c5a930f 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java +++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java @@ -30,13 +30,15 @@ public class ConverterFactory extends TestCase { public static class ConvertTo42 implements Converter<String, Integer> { @Override - public Integer convertToModel(String value, Locale locale) + public Integer convertToModel(String value, + Class<? extends Integer> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { return 42; } @Override - public String convertToPresentation(Integer value, Locale locale) + public String convertToPresentation(Integer value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { return "42"; } diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java index c267e012e8..e21382069f 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestAnyEnumToStringConverter.java @@ -33,14 +33,12 @@ public class TestAnyEnumToStringConverter { public class AnyEnumToStringConverter implements Converter<Enum, String> { - private Class<? extends Enum>[] enumClass; - - public AnyEnumToStringConverter(Class<? extends Enum>... enumClass) { - this.enumClass = enumClass; + public AnyEnumToStringConverter() { } @Override - public String convertToModel(Enum value, Locale locale) + public String convertToModel(Enum value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { return null; @@ -50,16 +48,15 @@ public class TestAnyEnumToStringConverter { } @Override - public Enum convertToPresentation(String value, Locale locale) + public Enum convertToPresentation(String value, + Class<? extends Enum> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { return null; } - for (Class<? extends Enum> candidate : enumClass) { - for (Enum e : candidate.getEnumConstants()) { - if (e.toString().equals(value)) { - return e; - } + for (Enum e : targetType.getEnumConstants()) { + if (e.toString().equals(value)) { + return e; } } @@ -82,29 +79,29 @@ public class TestAnyEnumToStringConverter { @Before public void setup() { - converter = new AnyEnumToStringConverter(TestEnum.class, - AnotherTestEnum.class); + converter = new AnyEnumToStringConverter(); } @Test public void nullConversion() { - Assert.assertEquals(null, converter.convertToModel(null, null)); + Assert.assertEquals(null, converter.convertToModel(null, null, null)); } @Test public void enumToStringConversion() { Assert.assertEquals(TestEnum.TWO.toString(), - converter.convertToModel(TestEnum.TWO, null)); - Assert.assertEquals(AnotherTestEnum.TWO.toString(), - converter.convertToModel(AnotherTestEnum.TWO, null)); + converter.convertToModel(TestEnum.TWO, String.class, null)); + Assert.assertEquals(AnotherTestEnum.TWO.toString(), converter + .convertToModel(AnotherTestEnum.TWO, String.class, null)); } @Test public void stringToEnumConversion() { - Assert.assertEquals(TestEnum.TWO, - converter.convertToPresentation(TestEnum.TWO.toString(), null)); + Assert.assertEquals(TestEnum.TWO, converter.convertToPresentation( + TestEnum.TWO.toString(), TestEnum.class, null)); Assert.assertEquals(AnotherTestEnum.TWO, converter - .convertToPresentation(AnotherTestEnum.TWO.toString(), null)); + .convertToPresentation(AnotherTestEnum.TWO.toString(), + AnotherTestEnum.class, null)); } @Test diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestDateToLongConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestDateToLongConverter.java index aab4ae18f0..6b9fa93e27 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestDateToLongConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestDateToLongConverter.java @@ -11,11 +11,11 @@ public class TestDateToLongConverter extends TestCase { DateToLongConverter converter = new DateToLongConverter(); public void testNullConversion() { - assertEquals(null, converter.convertToModel(null, null)); + assertEquals(null, converter.convertToModel(null, Long.class, null)); } public void testValueConversion() { assertEquals(Long.valueOf(946677600000l), - converter.convertToModel(new Date(100, 0, 1), null)); + converter.convertToModel(new Date(100, 0, 1), Long.class, null)); } } diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java index 93dbe96b56..8ce7b8eab8 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestSpecificEnumToStringConverter.java @@ -41,7 +41,8 @@ public class TestSpecificEnumToStringConverter { } @Override - public String convertToModel(Enum value, Locale locale) + public String convertToModel(Enum value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { return null; @@ -51,7 +52,8 @@ public class TestSpecificEnumToStringConverter { } @Override - public Enum convertToPresentation(String value, Locale locale) + public Enum convertToPresentation(String value, + Class<? extends Enum> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { return null; @@ -90,19 +92,21 @@ public class TestSpecificEnumToStringConverter { @Test public void nullConversion() { - Assert.assertEquals(null, testEnumConverter.convertToModel(null, null)); + Assert.assertEquals(null, + testEnumConverter.convertToModel(null, null, null)); } @Test public void enumToStringConversion() { - Assert.assertEquals(TestEnum.TWO.toString(), - testEnumConverter.convertToModel(TestEnum.TWO, null)); + Assert.assertEquals(TestEnum.TWO.toString(), testEnumConverter + .convertToModel(TestEnum.TWO, String.class, null)); } @Test public void stringToEnumConversion() { Assert.assertEquals(TestEnum.TWO, testEnumConverter - .convertToPresentation(TestEnum.TWO.toString(), null)); + .convertToPresentation(TestEnum.TWO.toString(), TestEnum.class, + null)); } @Test diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToBooleanConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToBooleanConverter.java index 1c2b919db0..f236bb4000 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToBooleanConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToBooleanConverter.java @@ -9,15 +9,15 @@ public class TestStringToBooleanConverter extends TestCase { StringToBooleanConverter converter = new StringToBooleanConverter(); public void testNullConversion() { - assertEquals(null, converter.convertToModel(null, null)); + assertEquals(null, converter.convertToModel(null, null, null)); } public void testEmptyStringConversion() { - assertEquals(null, converter.convertToModel("", null)); + assertEquals(null, converter.convertToModel("", Boolean.class, null)); } public void testValueConversion() { - assertTrue(converter.convertToModel("true", null)); - assertFalse(converter.convertToModel("false", null)); + assertTrue(converter.convertToModel("true", Boolean.class, null)); + assertFalse(converter.convertToModel("false", Boolean.class, null)); } } diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToDateConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToDateConverter.java index 2961b93c89..59314bd5ee 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToDateConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToDateConverter.java @@ -12,15 +12,15 @@ public class TestStringToDateConverter extends TestCase { StringToDateConverter converter = new StringToDateConverter(); public void testNullConversion() { - assertEquals(null, converter.convertToModel(null, null)); + assertEquals(null, converter.convertToModel(null, null, null)); } public void testEmptyStringConversion() { - assertEquals(null, converter.convertToModel("", null)); + assertEquals(null, converter.convertToModel("", Date.class, null)); } public void testValueConversion() { assertEquals(new Date(100, 0, 1), converter.convertToModel( - "Jan 1, 2000 12:00:00 AM", Locale.ENGLISH)); + "Jan 1, 2000 12:00:00 AM", Date.class, Locale.ENGLISH)); } } diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToDoubleConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToDoubleConverter.java index 9903a8deaa..739f9b7d5a 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToDoubleConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToDoubleConverter.java @@ -9,14 +9,14 @@ public class TestStringToDoubleConverter extends TestCase { StringToDoubleConverter converter = new StringToDoubleConverter(); public void testNullConversion() { - assertEquals(null, converter.convertToModel(null, null)); + assertEquals(null, converter.convertToModel(null, null, null)); } public void testEmptyStringConversion() { - assertEquals(null, converter.convertToModel("", null)); + assertEquals(null, converter.convertToModel("", Double.class, null)); } public void testValueConversion() { - assertEquals(10.0, converter.convertToModel("10", null)); + assertEquals(10.0, converter.convertToModel("10", Double.class, null)); } } diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToFloatConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToFloatConverter.java index 670daec202..3bb2b3649e 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToFloatConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToFloatConverter.java @@ -9,14 +9,15 @@ public class TestStringToFloatConverter extends TestCase { StringToFloatConverter converter = new StringToFloatConverter(); public void testNullConversion() { - assertEquals(null, converter.convertToModel(null, null)); + assertEquals(null, converter.convertToModel(null, null, null)); } public void testEmptyStringConversion() { - assertEquals(null, converter.convertToModel("", null)); + assertEquals(null, converter.convertToModel("", Float.class, null)); } public void testValueConversion() { - assertEquals(Float.valueOf(10), converter.convertToModel("10", null)); + assertEquals(Float.valueOf(10), + converter.convertToModel("10", Float.class, null)); } } diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToIntegerConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToIntegerConverter.java index 80414cccaf..7f247b791f 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToIntegerConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToIntegerConverter.java @@ -9,14 +9,15 @@ public class TestStringToIntegerConverter extends TestCase { StringToIntegerConverter converter = new StringToIntegerConverter(); public void testNullConversion() { - assertEquals(null, converter.convertToModel(null, null)); + assertEquals(null, converter.convertToModel(null, null, null)); } public void testEmptyStringConversion() { - assertEquals(null, converter.convertToModel("", null)); + assertEquals(null, converter.convertToModel("", Integer.class, null)); } public void testValueConversion() { - assertEquals(Integer.valueOf(10), converter.convertToModel("10", null)); + assertEquals(Integer.valueOf(10), + converter.convertToModel("10", Integer.class, null)); } } diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToNumberConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToNumberConverter.java index d3f87d628a..9c322cd301 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/TestStringToNumberConverter.java +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToNumberConverter.java @@ -9,15 +9,16 @@ public class TestStringToNumberConverter extends TestCase { StringToNumberConverter converter = new StringToNumberConverter(); public void testNullConversion() { - assertEquals(null, converter.convertToModel(null, null)); + assertEquals(null, converter.convertToModel(null, null, null)); } public void testEmptyStringConversion() { - assertEquals(null, converter.convertToModel("", null)); + assertEquals(null, converter.convertToModel("", Number.class, null)); } public void testValueConversion() { - assertEquals(Long.valueOf(10), converter.convertToModel("10", null)); - assertEquals(10.5, converter.convertToModel("10.5", null)); + assertEquals(Long.valueOf(10), + converter.convertToModel("10", Number.class, null)); + assertEquals(10.5, converter.convertToModel("10.5", Number.class, null)); } } diff --git a/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java b/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java index af6d9ed732..63168e3c91 100644 --- a/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java +++ b/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java @@ -60,6 +60,10 @@ public class TestClassesSerializable extends TestCase { "com\\.vaadin\\.sass.*", // "com\\.vaadin\\.testbench.*", // "com\\.vaadin\\.util\\.CurrentInstance\\$1", // + "com\\.vaadin\\.server\\.communication\\.PushConnection", // + "com\\.vaadin\\.server\\.communication\\.AtmospherePushConnection", // + "com\\.vaadin\\.util\\.ConnectorHelper", // + "com\\.vaadin\\.server\\.VaadinSession$FutureAccess", // }; /** diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java index bee932a29f..fcc54a989d 100644 --- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java +++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java @@ -5,6 +5,7 @@ import junit.framework.TestCase; import org.easymock.EasyMock; import com.vaadin.server.LegacyCommunicationManager; +import com.vaadin.server.MockServletConfig; import com.vaadin.server.StreamVariable; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServlet; @@ -78,10 +79,10 @@ public class TestStreamVariableMapping extends TestCase { private LegacyCommunicationManager createCommunicationManager() throws Exception { - VaadinServletService vss = new VaadinServletService( - EasyMock.createMock(VaadinServlet.class), + VaadinServlet servlet = new VaadinServlet(); + VaadinServletService vss = new VaadinServletService(servlet, new MockDeploymentConfiguration()); - vss.init(); + servlet.init(new MockServletConfig()); return new LegacyCommunicationManager( new AlwaysLockedVaadinSession(vss)); } diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversionError.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversionError.java new file mode 100644 index 0000000000..ad762f8931 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversionError.java @@ -0,0 +1,72 @@ +package com.vaadin.tests.server.component.abstractfield; + +import junit.framework.TestCase; + +import org.junit.Assert; + +import com.vaadin.data.Validator.InvalidValueException; +import com.vaadin.data.util.MethodProperty; +import com.vaadin.data.util.converter.Converter.ConversionException; +import com.vaadin.data.util.converter.StringToIntegerConverter; +import com.vaadin.tests.data.bean.Address; +import com.vaadin.tests.data.bean.Country; +import com.vaadin.tests.data.bean.Person; +import com.vaadin.tests.data.bean.Sex; +import com.vaadin.ui.TextField; + +public class AbsFieldValueConversionError extends TestCase { + + Person paulaBean = new Person("Paula", "Brilliant", "paula@brilliant.com", + 34, Sex.FEMALE, new Address("Paula street 1", 12345, "P-town", + Country.FINLAND)); + + public void testValidateConversionErrorParameters() { + TextField tf = new TextField(); + tf.setConverter(new StringToIntegerConverter()); + tf.setPropertyDataSource(new MethodProperty<String>(paulaBean, "age")); + tf.setConversionError("(Type: {0}) Converter exception message: {1}"); + tf.setValue("abc"); + try { + tf.validate(); + fail(); + } catch (InvalidValueException e) { + Assert.assertEquals( + "(Type: Integer) Converter exception message: Could not convert 'abc' to java.lang.Integer", + e.getMessage()); + } + + } + + public void testConvertToModelConversionErrorParameters() { + TextField tf = new TextField(); + tf.setConverter(new StringToIntegerConverter()); + tf.setPropertyDataSource(new MethodProperty<String>(paulaBean, "age")); + tf.setConversionError("(Type: {0}) Converter exception message: {1}"); + tf.setValue("abc"); + try { + tf.getConvertedValue(); + fail(); + } catch (ConversionException e) { + Assert.assertEquals( + "(Type: Integer) Converter exception message: Could not convert 'abc' to java.lang.Integer", + e.getMessage()); + } + + } + + public void testDefaultConversionErrorMessage() { + TextField tf = new TextField(); + tf.setConverter(new StringToIntegerConverter()); + tf.setPropertyDataSource(new MethodProperty<String>(paulaBean, "age")); + tf.setValue("abc"); + + try { + tf.validate(); + fail(); + } catch (InvalidValueException e) { + Assert.assertEquals("Could not convert value to Integer", + e.getMessage()); + } + + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java index b5e937f27d..9854296538 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbsFieldValueConversions.java @@ -85,12 +85,14 @@ public class AbsFieldValueConversions extends TestCase { tf.setConverter(new Converter<String, String>() { @Override - public String convertToModel(String value, Locale locale) { + public String convertToModel(String value, + Class<? extends String> targetType, Locale locale) { return value; } @Override - public String convertToPresentation(String value, Locale locale) { + public String convertToPresentation(String value, + Class<? extends String> targetType, Locale locale) { return value; } @@ -150,7 +152,8 @@ public class AbsFieldValueConversions extends TestCase { cb.setConverter(new Converter<Boolean, Boolean>() { @Override - public Boolean convertToModel(Boolean value, Locale locale) { + public Boolean convertToModel(Boolean value, + Class<? extends Boolean> targetType, Locale locale) { // value from a CheckBox should never be null as long as it is // not set to null (handled by conversion below). assertNotNull(value); @@ -158,7 +161,8 @@ public class AbsFieldValueConversions extends TestCase { } @Override - public Boolean convertToPresentation(Boolean value, Locale locale) { + public Boolean convertToPresentation(Boolean value, + Class<? extends Boolean> targetType, Locale locale) { // Datamodel -> field if (value == null) { return false; @@ -184,7 +188,7 @@ public class AbsFieldValueConversions extends TestCase { assertEquals(Boolean.FALSE, property.getValue()); assertEquals(Boolean.FALSE, cb.getValue()); Boolean newDmValue = cb.getConverter().convertToPresentation( - cb.getValue(), new Locale("fi", "FI")); + cb.getValue(), Boolean.class, new Locale("fi", "FI")); assertEquals(Boolean.FALSE, newDmValue); // FIXME: Should be able to set to false here to cause datamodel to be diff --git a/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java b/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java index acea0a84c7..55d5771f80 100644 --- a/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java +++ b/server/tests/src/com/vaadin/ui/AbsFieldDataSourceLocaleChange.java @@ -11,6 +11,7 @@ import org.junit.Test; import com.vaadin.data.util.converter.StringToIntegerConverter; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinSession; +import com.vaadin.tests.util.AlwaysLockedVaadinSession; public class AbsFieldDataSourceLocaleChange { @@ -19,7 +20,7 @@ public class AbsFieldDataSourceLocaleChange { @Before public void setup() { - vaadinSession = new VaadinSession(null); + vaadinSession = new AlwaysLockedVaadinSession(null); VaadinSession.setCurrent(vaadinSession); ui = new UI() { diff --git a/shared/build.xml b/shared/build.xml index 67dd3e9843..b0533550d4 100644 --- a/shared/build.xml +++ b/shared/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-shared" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-shared" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> Compiles build helpers used when building other modules. </description> @@ -19,8 +18,7 @@ <target name="jar"> - <property name="shared.osgi.import" - value="org.json;version="0.0.20080701", com.google.gwt.thirdparty.guava.common.annotations;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.base;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.base.internal;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.cache;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.collect;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.eventbus;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.io;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.net;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.primitives;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.util.concurrent;version="10.0.1.rebased", com.google.gwt.thirdparty.streamhtmlparser;version="0.1.5.r10-rebased", com.google.gwt.thirdparty.streamhtmlparser.impl;version="0.1.5.r10-rebased", com.google.gwt.thirdparty.streamhtmlparser.util;version="0.1.5.r10-rebased", org.w3c.flute.parser;version="1.3.0.gg2", org.w3c.flute.parser.selectors;version="1.3.0.gg2", org.w3c.flute.util;version="1.3.0.gg2"" /> + <property name="shared.osgi.import" value="org.json;version="0.0.20080701", com.google.gwt.thirdparty.guava.common.annotations;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.base;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.base.internal;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.cache;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.collect;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.eventbus;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.io;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.net;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.primitives;version="10.0.1.rebased", com.google.gwt.thirdparty.guava.common.util.concurrent;version="10.0.1.rebased", com.google.gwt.thirdparty.streamhtmlparser;version="0.1.5.r10-rebased", com.google.gwt.thirdparty.streamhtmlparser.impl;version="0.1.5.r10-rebased", com.google.gwt.thirdparty.streamhtmlparser.util;version="0.1.5.r10-rebased", org.w3c.flute.parser;version="1.3.0.gg2", org.w3c.flute.parser.selectors;version="1.3.0.gg2", org.w3c.flute.util;version="1.3.0.gg2"" /> <delete dir="${src.filtered}" /> <!-- Update version in Version.java --> <copy todir="${src.filtered}"> diff --git a/shared/src/com/vaadin/shared/ui/ui/Transport.java b/shared/src/com/vaadin/shared/ui/ui/Transport.java index 69d713bcca..ea641c0a3c 100644 --- a/shared/src/com/vaadin/shared/ui/ui/Transport.java +++ b/shared/src/com/vaadin/shared/ui/ui/Transport.java @@ -32,16 +32,6 @@ public enum Transport { */ STREAMING("streaming"); - /** - * The default transport mechanism for push - */ - public static final Transport DEFAULT = Transport.WEBSOCKET; - - /** - * The default fallback transport mechanism for push - */ - public static final Transport DEFAULT_FALLBACK = Transport.STREAMING; - private String identifier; private Transport(String identifier) { diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java index e19a87ada9..8d042a835f 100644 --- a/shared/src/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java @@ -55,9 +55,10 @@ public class UIState extends TabIndexState { public PushMode mode = PushMode.DISABLED; public Map<String, String> parameters = new HashMap<String, String>(); { - parameters.put(TRANSPORT_PARAM, Transport.DEFAULT.getIdentifier()); + parameters + .put(TRANSPORT_PARAM, Transport.WEBSOCKET.getIdentifier()); parameters.put(FALLBACK_TRANSPORT_PARAM, - Transport.DEFAULT_FALLBACK.getIdentifier()); + Transport.STREAMING.getIdentifier()); } } diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml index b28eca8cf7..1fd78209c3 100644 --- a/theme-compiler/build.xml +++ b/theme-compiler/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-theme-compiler" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-theme-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> Compiles build helpers used when building other modules. </description> @@ -13,8 +12,7 @@ <property name="module.name" value="vaadin-theme-compiler" /> <property name="module.symbolic" value="com.vaadin.theme-compiler" /> <property name="result.dir" value="result" /> - <property name="sass.parser.jj" - location="src/com/vaadin/sass/internal/parser/Parser.jj" /> + <property name="sass.parser.jj" location="src/com/vaadin/sass/internal/parser/Parser.jj" /> <path id="classpath.compile.custom"> </path> <path id="classpath.test.custom" /> @@ -26,9 +24,7 @@ <!-- Copy javacc-5.0.jar to ${result.dir}/javacc/javacc.jar as the javacc task requires the jar to be named javacc.jar --> <property name="javacc.home" location="${result.dir}/javacc" /> - <ivy:retrieve organisation="net.java.dev.javacc" - module="javacc" revision="5.0" inline="true" type="jar" - pattern="${javacc.home}/[artifact].[ext]" /> + <ivy:retrieve organisation="net.java.dev.javacc" module="javacc" revision="5.0" inline="true" type="jar" pattern="${javacc.home}/[artifact].[ext]" /> <javacc target="${sass.parser.jj}" javacchome="${javacc.home}"> </javacc> </target> diff --git a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java b/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java index 3cd08c4abc..dece1691f0 100644 --- a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java +++ b/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java @@ -29,6 +29,7 @@ import org.apache.commons.cli.ParseException; import org.apache.commons.cli.PosixParser; import com.vaadin.sass.internal.ScssStylesheet; +import com.vaadin.shared.Version; /** * Helper to combine css divided into separate per component dirs into one to @@ -44,8 +45,6 @@ public class CompileTheme { public static void main(String[] args) throws IOException, ParseException { Options options = new Options(); options.addOption("t", "theme", true, "the theme to compile"); - options.addOption("v", "theme-version", true, - "the version to add to the compiled theme"); options.addOption("f", "theme-folder", true, "the folder containing the theme"); CommandLineParser parser = new PosixParser(); @@ -58,11 +57,11 @@ public class CompileTheme { } String themeName = params.getOptionValue("theme"); String themeFolder = params.getOptionValue("theme-folder"); - String themeVersion = params.getOptionValue("theme-version"); // Regular theme try { - processSassTheme(themeFolder, themeName, "styles", themeVersion); + processSassTheme(themeFolder, themeName, "styles", + Version.getFullVersion()); System.out.println("Compiling theme " + themeName + " styles successful"); } catch (Exception e) { @@ -73,7 +72,7 @@ public class CompileTheme { // Legacy theme w/o .themename{} wrapping try { processSassTheme(themeFolder, themeName, "legacy-styles", - themeVersion); + Version.getFullVersion()); System.out.println("Compiling theme " + themeName + " legacy-styles successful"); } catch (Exception e) { @@ -88,11 +87,6 @@ public class CompileTheme { StringBuffer cssHeader = new StringBuffer(); - version = version.replaceAll("\\.", "_"); - cssHeader.append(".v-theme-version:after {content:\"" + version - + "\";}\n"); - cssHeader.append(".v-theme-version-" + version + " {display: none;}\n"); - String stylesCssDir = themeFolder + File.separator + themeName + File.separator; @@ -107,10 +101,9 @@ public class CompileTheme { + " not found"); } scss.compile(); - BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName)); out.write(cssHeader.toString()); - out.write(scss.toString()); + out.write(scss.toString().replace("@version@", version)); out.close(); System.out.println("Compiled CSS to " + stylesCssName + " (" diff --git a/themes/build.xml b/themes/build.xml index 5bca50e5f5..5ee7ec4ec7 100644 --- a/themes/build.xml +++ b/themes/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-themes" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-themes" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> Themes compiled to CSS </description> @@ -24,8 +23,7 @@ <target name="compile-themes"> <ivy:resolve resolveid="common" conf="build" /> - <ivy:cachepath pathid="classpath.compile.theme" - conf="build" /> + <ivy:cachepath pathid="classpath.compile.theme" conf="build" /> <antcall target="compile-theme"> <param name="theme" value="base" /> @@ -52,40 +50,38 @@ </target> <target name="copy-theme"> - <fail unless="theme" - message="You must give the theme name to copy n the 'theme' parameter" /> + <fail unless="theme" message="You must give the theme name to copy n the 'theme' parameter" /> <property name="theme.source.dir" location="../WebContent/VAADIN/themes" /> <copy todir="${theme.result.dir}"> <fileset dir="${theme.source.dir}"> - <include name="${theme}/**" /> + <include name="${theme}/**/*.scss" /> + </fileset> + <filterset refid="filter-vaadin.version" /> + </copy> + <copy todir="${theme.result.dir}"> + <fileset dir="${theme.source.dir}"> + <exclude name="${theme}/**/*.scss" /> </fileset> </copy> </target> <target name="compile-theme" depends="copy-theme"> - <fail unless="theme" - message="You must give the theme name to compile in the 'theme' parameter" /> + <fail unless="theme" message="You must give the theme name to compile in the 'theme' parameter" /> <ivy:resolve resolveid="common" conf="compile-theme" /> - <ivy:cachepath pathid="classpath.compile.theme" - conf="compile-theme" /> - <ivy:cachepath pathid="classpath.runtime.theme" - conf="build" /> + <ivy:cachepath pathid="classpath.compile.theme" conf="compile-theme" /> + <ivy:cachepath pathid="classpath.runtime.theme" conf="build" /> <echo>Compiling ${theme}</echo> <mkdir dir="${theme.result.dir}" /> <!-- compile the theme --> - <java classname="com.vaadin.buildhelpers.CompileTheme" - classpathref="classpath.compile.theme" failonerror="yes" - fork="yes" maxmemory="512m"> + <java classname="com.vaadin.buildhelpers.CompileTheme" classpathref="classpath.compile.theme" failonerror="yes" fork="yes" maxmemory="512m"> <arg value="--theme" /> <arg value="${theme}" /> <arg value="--theme-folder" /> <arg value="${theme.result.dir}" /> - <arg value="--theme-version" /> - <arg value="${vaadin.version}" /> <jvmarg value="-Xss8M" /> <jvmarg value="-XX:MaxPermSize=256M" /> <jvmarg value="-Djava.awt.headless=true" /> diff --git a/uitest/build.xml b/uitest/build.xml index dc9258a807..aaf891925e 100644 --- a/uitest/build.xml +++ b/uitest/build.xml @@ -1,7 +1,6 @@ <?xml version="1.0"?> -<project name="vaadin-uitest" basedir="." default="publish-local" - xmlns:ivy="antlib:org.apache.ivy.ant"> +<project name="vaadin-uitest" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> <description> Provides a uitest WAR containing Vaadin UI tests </description> @@ -11,8 +10,7 @@ <!-- global properties --> <property name="module.name" value="vaadin-uitest" /> <property name="result.dir" value="result" /> - <property name="result.war" - location="${result.dir}/lib/${module.name}-${vaadin.version}.war" /> + <property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" /> <path id="classpath.compile.custom"> </path> @@ -22,12 +20,10 @@ to the source path --> <ivy:resolve resolveid="common" conf="build, build-provided" /> - <ivy:cachepath pathid="classpath.compile.dependencies" - conf="build, build-provided" /> + <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" /> </target> - <target name="compile" description="Compiles the module" - depends="dependencies"> + <target name="compile" description="Compiles the module" depends="dependencies"> <fail unless="module.name" message="No module name given" /> <property name="result.dir" location="result" /> @@ -37,21 +33,16 @@ <mkdir dir="${classes}" /> <!-- TODO: Get rid of this --> - <javac destdir="${classes}" source="${vaadin.java.version}" - target="${vaadin.java.version}" debug="true" encoding="UTF-8" - includeantruntime="false"> + <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false"> <src path="${server.test.sources}" /> <include name="com/vaadin/tests/data/bean/**" /> <include name="com/vaadin/tests/VaadinClasses.java" /> - <include - name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" /> + <include name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" /> <classpath refid="classpath.compile.dependencies" /> <classpath refid="classpath.compile.custom" /> </javac> - <javac destdir="${classes}" source="${vaadin.java.version}" - target="${vaadin.java.version}" debug="true" encoding="UTF-8" - includeantruntime="false"> + <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false"> <src path="${src}" /> <classpath location="${classes}" /> <classpath refid="classpath.compile.dependencies" /> @@ -60,8 +51,7 @@ </target> <target name="testing-widgetset" depends="dependencies,compile"> - <property name="module" - value="com.vaadin.tests.widgetset.TestingWidgetSet" /> + <property name="module" value="com.vaadin.tests.widgetset.TestingWidgetSet" /> <property name="style" value="OBF" /> <property name="localWorkers" value="2" /> <property name="extraParams" value="" /> @@ -73,8 +63,7 @@ <echo>Compiling ${module} to ${module.output.dir}</echo> <!-- compile the module --> - <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.dependencies" - failonerror="yes" fork="yes" maxmemory="512m"> + <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.dependencies" failonerror="yes" fork="yes" maxmemory="512m"> <classpath location="src" /> <classpath location="${classes}" /> <arg value="-workDir" /> @@ -109,8 +98,7 @@ <property name="src" location="${result.dir}/../src" /> <ivy:resolve resolveid="common" conf="build" /> - <ivy:cachepath pathid="classpath.runtime.dependencies" - conf="build" /> + <ivy:cachepath pathid="classpath.runtime.dependencies" conf="build" /> <delete dir="${deps.dir}" /> <mkdir dir="${deps.dir}" /> @@ -133,6 +121,7 @@ <include name="VAADIN/themes/tests-*/**" /> <include name="VAADIN/themes/reindeer-tests/**" /> <include name="WEB-INF/*.xml" /> + <include name="WEB-INF/web.xml.2.4" /> </fileset> <classes dir="${classes}" /> <classes dir="${src}" /> @@ -158,4 +147,4 @@ <echo>WHAT? No JUnit tests for ${module.name}!</echo> </target> -</project>
\ No newline at end of file +</project> diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml index ba353dbdbb..7497bb752e 100644 --- a/uitest/integration_tests.xml +++ b/uitest/integration_tests.xml @@ -1,21 +1,16 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" name="Vaadin Integration Tests" - basedir="." default="integration-test-all"> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" name="Vaadin Integration Tests" basedir="." default="integration-test-all"> <!-- Import common targets --> <import file="../common.xml" /> - <dirname file="${ant.file.Vaadin Integration Tests}" - property="integration_test.dir" /> + <dirname file="${ant.file.Vaadin Integration Tests}" property="integration_test.dir" /> <!-- Target deploying demo.war --> - <fail unless="test.integration.server" - message="test.integration.server must be set for integration tests to run" /> + <fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" /> - <fail unless="test.integration.user" - message="test.integration.user must be set for integration tests to run" /> - <fail unless="test.integration.antfile" - message="test.integration.antfile must be set for integration tests to run" /> + <fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run" /> + <fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run" /> <!-- Test with these browsers --> <property name="test_browsers" value="winxp-firefox17-esr" /> @@ -39,28 +34,21 @@ <!-- Upload war to deploy to ssh host --> <target name="integration-test-upload-demo"> - <scp file="${demo.war}" - todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" - keyfile="${sshkey.file}" passphrase="${passphrase}" /> + <scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" /> </target> <!-- Run basic integration test test --> <target name="integration-test-servlet"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="integration-test-${server-name}-servlet.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="integration-test-${server-name}-servlet.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <subant target="run-tests" failonerror="false" antfile="test.xml"> - <property name="com.vaadin.testbench.lib.dir" - value="${com.vaadin.testbench.lib.dir}" /> - <property name="com.vaadin.testbench.tester.host" - value="${com.vaadin.testbench.tester.host}" /> - <property name="com.vaadin.testbench.deployment.url" - value="${deployment.url}" /> + <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" /> + <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" /> + <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" /> <property name="server.start.succeeded" value="1" /> <property name="browsers" value="${test_browsers}" /> <property name="testfiles" value="${testfiles}" /> - <property name="test-output-dir" - value="${integration_test.dir}/result/integration-test-output/${server-name}" /> + <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" /> <property name="retries" value="0" /> <fileset dir="." includes="test.xml" /> @@ -68,21 +56,16 @@ </target> <target name="integration-test-push-servlet"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="integration-test-${server-name}-push-servlet.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="integration-test-${server-name}-push-servlet.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <subant target="run-tests" failonerror="false" antfile="test.xml"> - <property name="com.vaadin.testbench.lib.dir" - value="${com.vaadin.testbench.lib.dir}" /> - <property name="com.vaadin.testbench.tester.host" - value="${com.vaadin.testbench.tester.host}" /> - <property name="com.vaadin.testbench.deployment.url" - value="${deployment.url}" /> + <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" /> + <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" /> + <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" /> <property name="server.start.succeeded" value="1" /> <property name="browsers" value="${test_browsers}" /> <property name="testfiles" value="${testfiles}" /> - <property name="test-output-dir" - value="${integration_test.dir}/result/integration-test-output/${server-name}" /> + <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" /> <property name="retries" value="0" /> <fileset dir="." includes="test.xml" /> @@ -91,16 +74,12 @@ <target name="integration-test-theme"> <subant target="run-tests" failonerror="false" antfile="test.xml"> - <property name="com.vaadin.testbench.lib.dir" - value="${com.vaadin.testbench.lib.dir}" /> - <property name="com.vaadin.testbench.tester.host" - value="${com.vaadin.testbench.tester.host}" /> - <property name="com.vaadin.testbench.deployment.url" - value="${deployment.url}" /> + <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" /> + <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" /> + <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" /> <property name="server.start.succeeded" value="1" /> <property name="testfiles" value="${testfiles-theme}" /> - <property name="test-output-dir" - value="${integration_test.dir}/result/integration-test-output/${server-name}" /> + <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" /> <fileset dir="." includes="test.xml" /> </subant> @@ -108,30 +87,24 @@ <!-- Run integration test on GAE --> <target name="integration-test-test-GAE"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="GoogleAppEngine/integration-test-GAE.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="GoogleAppEngine/integration-test-GAE.html" /> <pathconvert pathsep=" " property="test-GAE" refid="html-test-files" /> <subant target="run-tests" failonerror="false" antfile="test.xml"> - <property name="com.vaadin.testbench.lib.dir" - value="${com.vaadin.testbench.lib.dir}" /> - <property name="com.vaadin.testbench.tester.host" - value="${com.vaadin.testbench.tester.host}" /> - <property name="com.vaadin.testbench.deployment.url" - value="http://vaadin-integration-test.appspot.com/" /> + <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" /> + <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" /> + <property name="com.vaadin.testbench.deployment.url" value="http://vaadin-integration-test.appspot.com/" /> <property name="server.start.succeeded" value="1" /> <property name="browsers" value="${test_browsers}" /> <property name="testfiles" value="${test-GAE}" /> - <property name="test-output-dir" - value="../build/integration-test-gae-output" /> + <property name="test-output-dir" value="../build/integration-test-gae-output" /> <fileset dir="." includes="test.xml" /> </subant> </target> <target name="integration-test-deploy-to-GAE"> - <sshexec host="${test.integration.server}" username="${user}" - keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" /> + <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" /> </target> @@ -224,8 +197,7 @@ <target name="integration-test-liferay6"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="Liferay-6/integration-test-liferay-6.0.5.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <antcall target="run-generic-integration-test"> @@ -236,14 +208,11 @@ </target> <target name="integration-test-liferay6-theme"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> - <fileset dir="integration-testscripts" id="html-theme-files" - includes="Liferay-6/Liferay6-theme.html" /> - <pathconvert pathsep=" " property="testfiles-theme" - refid="html-theme-files" /> + <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" /> + <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" /> <antcall target="run-generic-integration-test"> @@ -254,8 +223,7 @@ </target> <target name="integration-test-liferay5"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <antcall target="run-generic-integration-test"> @@ -266,8 +234,7 @@ </target> <target name="integration-test-liferay6ee"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="Liferay-6EE/integration-test-liferay-6ee.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <antcall target="run-generic-integration-test"> @@ -278,14 +245,11 @@ </target> <target name="integration-test-liferay6ee-theme"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> - <fileset dir="integration-testscripts" id="html-theme-files" - includes="Liferay-6EE/Liferay6EE-theme.html" /> - <pathconvert pathsep=" " property="testfiles-theme" - refid="html-theme-files" /> + <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" /> + <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" /> <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> @@ -295,8 +259,7 @@ </target> <target name="integration-test-gatein3"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> @@ -306,8 +269,7 @@ </target> <target name="integration-test-exo3"> - <fileset dir="integration-testscripts" id="html-test-files" - includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" /> + <fileset dir="integration-testscripts" id="html-test-files" includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> @@ -342,8 +304,7 @@ <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" /> + <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" /> <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> @@ -362,8 +323,7 @@ <target name="integration-test-all"> <property name="passphrase" value="${passphrase}" /> <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" /> - <fail unless="com.vaadin.testbench.screenshot.directory" - message="You must define a com.vaadin.testbench.screenshot.directory parameter" /> + <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" /> <parallel> <antcontrib:trycatch property="tried"> <try> @@ -423,8 +383,7 @@ <antcontrib:if> <isset property="startDelay" /> <then> - <antcontrib:math result="sleepTime" - datatype="int"> + <antcontrib:math result="sleepTime" datatype="int"> <op op="rint"> <op op="*"> <num value="${startDelay}" /> @@ -432,14 +391,12 @@ </op> </op> </antcontrib:math> - <echo>Delaying startup of ${target-server} with - ${sleepTime} seconds</echo> + <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo> <sleep seconds="${sleepTime}" /> </then> </antcontrib:if> - <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" - trust="yes" passphrase="${passphrase}"> + <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}"> <fileset dir="integration_base_files"> <include name="*" /> </fileset> @@ -451,22 +408,16 @@ <try> <!-- timeout in one hour (remote end should timeout in 55 minutes) --> - <sshexec host="${target-host}" outputproperty="lock-output" - timeout="3600000" username="${user}" keyfile="${sshkey.file}" - trust="yes" command="chmod +x *.sh; ant -f deploy.xml get-lock" /> + <sshexec host="${target-host}" outputproperty="lock-output" timeout="3600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="chmod +x *.sh; ant -f deploy.xml get-lock" /> <antcall target="echo-prefix"> <param name="prefix" value="${target-server}: " /> <param name="message" value="${lock-output}" /> </antcall> - <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" - keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" /> + <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" /> <!-- timeout in 15 minutes --> - <sshexec host="${target-host}" outputproperty="start-output" - timeout="900000" username="${user}" keyfile="${sshkey.file}" - trust="yes" command="ant -f deploy.xml startup-and-deploy" - failonerror="false" /> + <sshexec host="${target-host}" outputproperty="start-output" timeout="900000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml startup-and-deploy" failonerror="false" /> <antcall target="echo-prefix"> <param name="prefix" value="${target-server}: " /> <param name="message" value="${start-output}" /> @@ -475,20 +426,15 @@ <fail message="${start-output}"> <condition> <not> - <contains string="${start-output}" - substring="Demo deployed successfully" /> + <contains string="${start-output}" substring="Demo deployed successfully" /> </not> </condition> </fail> - <copy - file="integration-testscripts/common/integration_test.tpl" - tofile="integration-testscripts/integration-test-${target-server}-servlet.html" - overwrite="true" /> + <copy file="integration-testscripts/common/integration_test.tpl" tofile="integration-testscripts/integration-test-${target-server}-servlet.html" overwrite="true" /> <antcall target="integration-test-servlet"> <param name="server-name" value="${target-server}" /> - <param name="deployment.url" - value="http://${target-host}:${target-port}" /> + <param name="deployment.url" value="http://${target-host}:${target-port}" /> </antcall> <!-- Run theme tests in all browsers if there's a property @@ -498,21 +444,16 @@ <antcontrib:then> <antcall target="integration-test-theme"> <param name="server-name" value="${target-server}" /> - <param name="deployment.url" - value="http://${target-host}:${target-port}" /> + <param name="deployment.url" value="http://${target-host}:${target-port}" /> </antcall> </antcontrib:then> </antcontrib:if> <!-- Run integration tests with push --> - <copy - file="integration-testscripts/common/integration_push_test.tpl" - tofile="integration-testscripts/integration-test-${target-server}-push-servlet.html" - overwrite="true" /> + <copy file="integration-testscripts/common/integration_push_test.tpl" tofile="integration-testscripts/integration-test-${target-server}-push-servlet.html" overwrite="true" /> <antcall target="integration-test-push-servlet"> <param name="server-name" value="${target-server}" /> - <param name="deployment.url" - value="http://${target-host}:${target-port}" /> + <param name="deployment.url" value="http://${target-host}:${target-port}" /> </antcall> <!-- Run theme tests in all browsers if there's a property @@ -522,17 +463,13 @@ <antcontrib:then> <antcall target="integration-test-theme"> <param name="server-name" value="${target-server}" /> - <param name="deployment.url" - value="http://${target-host}:${target-port}" /> + <param name="deployment.url" value="http://${target-host}:${target-port}" /> </antcall> </antcontrib:then> </antcontrib:if> <!-- timeout in five minutes --> - <sshexec host="${target-host}" outputproperty="stop-output" - timeout="600000" username="${user}" keyfile="${sshkey.file}" - trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" - failonerror="false" /> + <sshexec host="${target-host}" outputproperty="stop-output" timeout="600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" /> <antcall target="echo-prefix"> <param name="prefix" value="${target-server}: " /> <param name="message" value="${stop-output}" /> @@ -545,33 +482,25 @@ </target> <target name="echo-prefix"> - <antcontrib:propertyregex property="message-prefixed" - input="${prefix}${message}" regexp="\n" replace="\0${prefix}" - global="true" defaultValue="${prefix}${message}" /> + <antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" /> <echo message="${message-prefixed}" /> </target> <target name="run-generic-integration-test"> - <concat>##teamcity[testStarted name='${target-server}' - flowId='${target-server}']</concat> + <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat> <antcontrib:trycatch property="tried"> <try> <antcall target="do-run-generic-test" /> </try> <catch> - <antcontrib:antcallback target="teamcity-escape" - return="tried-escaped"> + <antcontrib:antcallback target="teamcity-escape" return="tried-escaped"> <param name="returnTo" value="tried-escaped" /> <param name="message" value="${tried}" /> </antcontrib:antcallback> - <concat>##teamcity[testFailed name='${target-server}' - flowId='${target-server}' message='Integration test - for ${target-server} failed.' - details='${tried-escaped}']</concat> + <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat> </catch> </antcontrib:trycatch> - <concat>##teamcity[testFinished name='${target-server}' - flowId='${target-server}']"</concat> + <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat> </target> <target name="teamcity-escape"> @@ -580,55 +509,40 @@ <!-- Should also perform other escaping (\u0085, \u2028 and \u2029) - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity --> <!-- Immutable properties -> needs to create a new one every time --> - <antcontrib:propertyregex property="details-escaped1" - input="${message}" regexp="['|\[\]]" replace="|\0" global="true" - defaultValue="${message}" /> - <antcontrib:propertyregex property="details-escaped2" - input="${details-escaped1}" regexp="\n" replace="|n" global="true" - defaultValue="${details-escaped1}" /> - <antcontrib:propertyregex property="details-escaped3" - input="${details-escaped2}" regexp="\r" replace="|r" global="true" - defaultValue="${details-escaped2}" /> + <antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" /> + <antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" /> + <antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" /> <property name="${returnTo}" value="${details-escaped3}" /> </target> <target name="run-integration-test"> - <concat>##teamcity[testStarted name='${target-server}' - flowId='${target-server}']</concat> + <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat> <antcontrib:trycatch property="tried"> <try> <antcall target="integration-test-${target-server}" /> </try> <catch> - <antcallback target="teamcity-escape" - return="tried-escaped"> + <antcallback target="teamcity-escape" return="tried-escaped"> <param name="returnTo" value="tried-escaped" /> <param name="message" value="${tried}" /> </antcallback> - <concat>##teamcity[testFailed name='${target-server}' - flowId='${target-server}' message='Integration test - for ${target-server} failed.' - details='${tried-escaped}']"</concat> + <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat> </catch> </antcontrib:trycatch> - <concat>##teamcity[testFinished name='${target-server}' - flowId='${target-server}']"</concat> + <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat> </target> <target name="integration-test-get-lock"> - <sshexec host="${test.integration.server}" username="${user}" - keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" /> + <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" /> </target> <target name="integration-test-release-lock"> - <sshexec host="${test.integration.server}" username="${user}" - keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" /> + <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" /> </target> <!-- Remove demo.war --> <target name="integration-test-clean"> - <sshexec host="${test.integration.server}" username="${user}" - keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" /> + <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" /> </target> </project> diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/FieldFocusOnClick.java b/uitest/src/com/vaadin/tests/components/abstractfield/FieldFocusOnClick.java new file mode 100644 index 0000000000..161f9cd520 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/abstractfield/FieldFocusOnClick.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.components.abstractfield; + +import java.util.Arrays; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.OptionGroup; +import com.vaadin.ui.TextField; + +public class FieldFocusOnClick extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + addComponent(new TextField(null, "TextField")); + addComponent(new CheckBox("CheckBox")); + addComponent(new OptionGroup(null, + Arrays.asList("Option 1", "Option 2"))); + addComponent(new NativeButton("NativeButton")); + } + + @Override + protected String getTestDescription() { + return "Webkit doesn't focus non-text input elements when clicked"; + } + + @Override + protected Integer getTicketNumber() { + return 11854; + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java b/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java index a9aa4d2a43..33359cc2c6 100644 --- a/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java +++ b/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java @@ -8,7 +8,8 @@ public class Vaadin6ImplicitDoubleConverter implements Converter<String, Double> { @Override - public Double convertToModel(String value, Locale locale) + public Double convertToModel(String value, + Class<? extends Double> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (null == value) { return null; @@ -17,7 +18,8 @@ public class Vaadin6ImplicitDoubleConverter implements } @Override - public String convertToPresentation(Double value, Locale locale) + public String convertToPresentation(Double value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { return null; diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.html new file mode 100644 index 0000000000..ab8c4f81d0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.html @@ -0,0 +1,125 @@ +<?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.combobox.ComboBoxParentDisable?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td> + <td>6,16</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td/span</td> + <td>Item 1</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/domChild[1]</td> + <td>371,22</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td> + <td>Item 1</td> +</tr> +<!--Disable combobox--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td> + <td>8,12</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td> + <td>Item 1</td> +</tr> +<!--Enable combobox--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td></td> + <td>100</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td> + <td>8,12</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td> + <td>Item 1</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/domChild[1]</td> + <td>371,22</td> +</tr> +<!--Disable parent--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td> + <td>8,12</td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td> + <td>Item 1</td> +</tr> +<!--Enable parent--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td></td> + <td>100</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/Slot[1]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td> + <td>8,12</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']</td> + <td>Item 1</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxParentDisable::/VVerticalLayout[0]/domChild[1]</td> + <td>371,22</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java new file mode 100644 index 0000000000..84355c4d89 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxParentDisable.java @@ -0,0 +1,81 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.data.Property; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.VerticalLayout; + +/** + * The Application's "main" class + */ +@SuppressWarnings("serial") +public class ComboBoxParentDisable extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + final VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + setContent(layout); + + final FormLayout formLayout = new FormLayout(); + + final ComboBox combo = new ComboBox("Item:"); + combo.addItem("Item 1"); + combo.addItem("Item 2"); + combo.addItem("Item 3"); + combo.addItem("Item 4"); + combo.addValueChangeListener(new MyValueChangeListener()); + combo.setImmediate(true); + + Button btn1 = new Button("Click me"); + btn1.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log.log("you clicked me"); + } + }); + + formLayout.addComponent(combo); + formLayout.addComponent(btn1); + + layout.addComponent(formLayout); + + Button btn = new Button("Enable/Disable combobox", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + combo.setEnabled(!combo.isEnabled()); + } + }); + layout.addComponent(btn); + btn = new Button("Enable/Disable parent", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + formLayout.setEnabled(!formLayout.isEnabled()); + } + }); + layout.addComponent(btn); + + } + + private class MyValueChangeListener implements Property.ValueChangeListener { + @Override + public void valueChange(Property.ValueChangeEvent event) { + log.log("you made a selection change"); + } + } + + @Override + protected String getTestDescription() { + return "Test for ensuring that disabling a parent properly disables the combobox"; + } + + @Override + protected Integer getTicketNumber() { + return 10734; + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html new file mode 100644 index 0000000000..1565e5eb96 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html @@ -0,0 +1,77 @@ +<?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>DragAndDropDisable</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">DragAndDropDisable</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/DragAndDropDisable?restartApplication</td> + <td></td> +</tr> +<tr> + <td>drag</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td> + <td>18,25</td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td> + <td>34,51</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>7,4</td> +</tr> +<tr> + <td>drag</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td> + <td>20,32</td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td> + <td>37,59</td> +</tr> +<tr> + <td>drag</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VLabel[0]</td> + <td>59,10</td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td> + <td>68,15</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VLabel[0]</td> + <td>68,160</td> +</tr> +<tr> + <td>drag</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>82,9</td> +</tr> +<tr> + <td>drop</td> + <td>vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]</td> + <td>118,50</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java new file mode 100644 index 0000000000..fb7ed92967 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java @@ -0,0 +1,142 @@ +package com.vaadin.tests.components.draganddropwrapper; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.event.dd.DragAndDropEvent; +import com.vaadin.event.dd.DropHandler; +import com.vaadin.event.dd.acceptcriteria.AcceptAll; +import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.DragAndDropWrapper; +import com.vaadin.ui.DragAndDropWrapper.DragStartMode; +import com.vaadin.ui.Label; +import com.vaadin.ui.Panel; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.TableDragMode; + +public class DragAndDropDisable extends AbstractTestUI { + + @Override + protected Integer getTicketNumber() { + return 11801; + } + + @Override + protected void setup(VaadinRequest request) { + { + final Panel p = new Panel("Drag here"); + addComponent(p); + + final CssLayout layout = new CssLayout(); + layout.setHeight("100px"); + + final DragAndDropWrapper dnd = new DragAndDropWrapper(layout); + p.setContent(dnd); + + final CheckBox enabled = new CheckBox("Enabled", true); + addComponent(enabled); + enabled.setImmediate(true); + enabled.addListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + dnd.setEnabled(enabled.booleanValue()); + } + }); + + dnd.setDropHandler(new DropHandler() { + + @Override + public AcceptCriterion getAcceptCriterion() { + return AcceptAll.get(); + } + + @Override + public void drop(DragAndDropEvent event) { + layout.addComponent(new Label("You dropped something!")); + } + }); + + dnd.setDragStartMode(DragStartMode.COMPONENT); + } + + { + final Panel p = new Panel("Drag here"); + addComponent(p); + + final CssLayout layout = new CssLayout(); + layout.setHeight("100px"); + + final DragAndDropWrapper dnd = new DragAndDropWrapper(layout); + p.setContent(dnd); + + final CheckBox enabled = new CheckBox("Enabled", true); + addComponent(enabled); + enabled.setImmediate(true); + enabled.addListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + dnd.setEnabled(enabled.booleanValue()); + } + }); + + dnd.setDropHandler(new DropHandler() { + + @Override + public AcceptCriterion getAcceptCriterion() { + return AcceptAll.get(); + } + + @Override + public void drop(DragAndDropEvent event) { + layout.addComponent(new Label("You dropped something!")); + } + }); + + dnd.setDragStartMode(DragStartMode.COMPONENT); + } + + { + final Table tbl = new Table(); + tbl.addContainerProperty("column", String.class, + "drag/drop to/from here"); + for (int i = 0; i < 5; i++) { + tbl.addItem(); + } + addComponent(tbl); + tbl.setDragMode(TableDragMode.ROW); + tbl.setDropHandler(new DropHandler() { + + @Override + public AcceptCriterion getAcceptCriterion() { + return AcceptAll.get(); + } + + @Override + public void drop(DragAndDropEvent event) { + tbl.getItem(tbl.addItem()).getItemProperty("column") + .setValue("You dropped something"); + } + }); + final CheckBox enabled = new CheckBox("Enabled", true); + addComponent(enabled); + enabled.setImmediate(true); + enabled.addListener(new ValueChangeListener() { + + @Override + public void valueChange(ValueChangeEvent event) { + tbl.setEnabled(enabled.booleanValue()); + } + }); + } + } + + @Override + protected String getTestDescription() { + return "DragAndDropWrapper must be disableable"; + } +} diff --git a/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.html b/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.html new file mode 100644 index 0000000000..53af1d4ceb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.html @@ -0,0 +1,81 @@ +<?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/com.vaadin.tests.components.javascriptcomponent.JavaScriptResizeListener?restartApplication&debug</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VCssLayout[0]/JavaScriptWidget[0]</td> + <td>Initial state</td> +</tr> +<!--Changing size has no effect without listener--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VCssLayout[0]/JavaScriptWidget[0]</td> + <td>Initial state</td> +</tr> +<!--Reports the size when the listener is added--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>52,4</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VCssLayout[0]/JavaScriptWidget[0]</td> + <td>Current size is 200 x 50</td> +</tr> +<!--Size change is detected when listener is active--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VCssLayout[0]/JavaScriptWidget[0]</td> + <td>Current size is 100 x 100</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>69,2</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VCssLayout[0]/JavaScriptWidget[0]</td> + <td>Listener disabled</td> +</tr> +<!--Nothing happens when changing size after removing listener--> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentJavaScriptResizeListener::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VCssLayout[0]/JavaScriptWidget[0]</td> + <td>Listener disabled</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java b/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java new file mode 100644 index 0000000000..9d0094b833 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java @@ -0,0 +1,96 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.components.javascriptcomponent; + +import com.vaadin.annotations.JavaScript; +import com.vaadin.data.Property; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.AbstractJavaScriptComponent; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.CssLayout; + +public class JavaScriptResizeListener extends AbstractTestUI { + + @JavaScript("ResizeJsConnector.js") + public class ResizeJsComponent extends AbstractJavaScriptComponent { + public void setListenerEnabled(boolean enabled) { + callFunction("setListenerEnabled", Boolean.valueOf(enabled)); + } + } + + private final ResizeJsComponent resizeJsComponent = new ResizeJsComponent(); + + private final CssLayout holder = new CssLayout(); + + @Override + protected void setup(VaadinRequest request) { + + addComponent(new Button("Change holder size", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + updateHolderSize(); + } + })); + addComponent(new CheckBox("Listener active") { + { + setImmediate(true); + addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(Property.ValueChangeEvent event) { + resizeJsComponent.setListenerEnabled(event + .getProperty().getValue() == Boolean.TRUE); + } + }); + } + }); + + updateHolderSize(); + addComponent(holder); + + resizeJsComponent.setSizeFull(); + holder.addComponent(resizeJsComponent); + } + + private void updateHolderSize() { + if (holder.getHeight() == 100) { + holder.setHeight("50px"); + } else { + holder.setHeight("100px"); + } + + if (holder.getWidth() == 100) { + holder.setWidth("200px"); + } else { + holder.setWidth("100px"); + } + } + + @Override + protected String getTestDescription() { + return "Test for getting resize events for javascript components"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(11996); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/javascriptcomponent/ResizeJsConnector.js b/uitest/src/com/vaadin/tests/components/javascriptcomponent/ResizeJsConnector.js new file mode 100644 index 0000000000..4e871aa1b7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/javascriptcomponent/ResizeJsConnector.js @@ -0,0 +1,23 @@ +function com_vaadin_tests_components_javascriptcomponent_JavaScriptResizeListener_ResizeJsComponent() { + var self = this; + var e = this.getElement(); + + var setText = function(text) { + e.innerHTML = text; + } + setText('Initial state'); + + var resizeListener = function(event) { + setText('Current size is ' + event.element.offsetWidth + " x " + event.element.offsetHeight); + }; + + this.setListenerEnabled = function(enabled) { + if (enabled) { + setText("Listener enabled"); + self.addResizeListener(e, resizeListener); + } else { + setText("Listener disabled"); + self.removeResizeListener(e, resizeListener); + } + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java b/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java index 920ccc2038..355cd43d37 100644 --- a/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java +++ b/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java @@ -150,14 +150,16 @@ public class DoublesInTable extends TestBase { t.setConverter("sex", new Converter<String, Sex>() { @Override - public Sex convertToModel(String value, Locale locale) + public Sex convertToModel(String value, + Class<? extends Sex> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { // not used in this test - Table only converts to presentation return null; } @Override - public String convertToPresentation(Sex value, Locale locale) + public String convertToPresentation(Sex value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { value = Sex.UNKNOWN; @@ -178,14 +180,16 @@ public class DoublesInTable extends TestBase { t.setConverter("deceased", new Converter<String, Boolean>() { @Override - public Boolean convertToModel(String value, Locale locale) { + public Boolean convertToModel(String value, + Class<? extends Boolean> targetType, Locale locale) { // not used in this test - Table only converts from source to // target return null; } @Override - public String convertToPresentation(Boolean value, Locale locale) { + public String convertToPresentation(Boolean value, + Class<? extends String> targetType, Locale locale) { if (value == null || value) { return "YES, DEAD!"; } else { @@ -206,7 +210,8 @@ public class DoublesInTable extends TestBase { t.setConverter("age", new Converter<String, Integer>() { @Override - public Integer convertToModel(String value, Locale locale) + public Integer convertToModel(String value, + Class<? extends Integer> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { // not used in this test - Table only converts from source to // target @@ -214,7 +219,8 @@ public class DoublesInTable extends TestBase { } @Override - public String convertToPresentation(Integer value, Locale locale) + public String convertToPresentation(Integer value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { if (value == null) { return null; @@ -243,14 +249,16 @@ public class DoublesInTable extends TestBase { t.setConverter("address", new Converter<String, Address>() { @Override - public Address convertToModel(String value, Locale locale) + public Address convertToModel(String value, + Class<? extends Address> targetType, Locale locale) throws ConversionException { // not used in this test - Table only converts to presentation return null; } @Override - public String convertToPresentation(Address value, Locale locale) + public String convertToPresentation(Address value, + Class<? extends String> targetType, Locale locale) throws ConversionException { return value.getStreetAddress() + ", " + value.getCity() + " (" + value.getCountry() + ")"; diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java b/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java index 60be786e8b..a3f0ce2f13 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java +++ b/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java @@ -29,14 +29,16 @@ public class TableWithCustomConverterFactory extends AbstractTestUI { Converter<String, Integer> { @Override - public Integer convertToModel(String value, Locale locale) + public Integer convertToModel(String value, + Class<? extends Integer> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { // TODO Auto-generated method stub return null; } @Override - public String convertToPresentation(Integer value, Locale locale) + public String convertToPresentation(Integer value, + Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { return "Integer: " + value; } diff --git a/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java index 6158092591..a37aa521ba 100644 --- a/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java +++ b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java @@ -28,7 +28,8 @@ public class ConverterThatEnforcesAFormat extends TestBase { + "). Two-way conversion gives: " + tf.getConverter().convertToPresentation( tf.getConverter().convertToModel(tf.getValue(), - tf.getLocale()), tf.getLocale()) + ")"); + Double.class, tf.getLocale()), + String.class, tf.getLocale()) + ")"); } }); tf.setImmediate(true); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java index 9ec7a82580..8197cd82ae 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java @@ -52,8 +52,8 @@ public class StringMyTypeConverter extends AbstractTestUI { class StringToNameConverter implements Converter<String, Name> { @Override - public Name convertToModel(String text, Locale locale) - throws ConversionException { + public Name convertToModel(String text, Class<? extends Name> targetType, + Locale locale) throws ConversionException { if (text == null) { return null; } @@ -66,7 +66,8 @@ class StringToNameConverter implements Converter<String, Name> { } @Override - public String convertToPresentation(Name name, Locale locale) + public String convertToPresentation(Name name, + Class<? extends String> targetType, Locale locale) throws ConversionException { if (name == null) { return null; diff --git a/uitest/test.xml b/uitest/test.xml index 44dac13d90..3baccb4117 100644 --- a/uitest/test.xml +++ b/uitest/test.xml @@ -1,6 +1,5 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" - name="Run Vaadin Testbench Tests" basedir="." default="run-and-clean-up"> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="Run Vaadin Testbench Tests" basedir="." default="run-and-clean-up"> <include file="../common.xml" /> <dirname property="test.xml.dir" file="${ant.file.Run Vaadin Testbench Tests}" /> @@ -9,12 +8,9 @@ <!-- Configuration --> <!-- ================================================================== --> <!-- Browsers to use for testing --> - <property name="browsers-windows" - value="winxp-ie8,win7-ie9,win7-ie10,winxp-firefox17-esr,winxp-safari5,winxp-googlechrome21,winxp-opera12" /> - <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" /> + <property name="browsers-windows" value="winxp-ie8,win7-ie9,win7-ie10,winxp-firefox17-esr,winxp-safari5,winxp-googlechrome21,winxp-opera12" /> + <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" /> <property name="browsers" value="${browsers-windows}" /> @@ -22,26 +18,22 @@ <property name="retries" value="2" /> <!-- Screen shot base directory --> - <fail unless="com.vaadin.testbench.screenshot.directory" - message="The 'com.vaadin.testbench.screenshot.directory' property must be defined." /> + <fail unless="com.vaadin.testbench.screenshot.directory" message="The 'com.vaadin.testbench.screenshot.directory' property must be defined." /> <!-- Screen shot resolution --> - <property name="com.vaadin.testbench.screenshot.resolution" - value="1500x850" /> + <property name="com.vaadin.testbench.screenshot.resolution" value="1500x850" /> <!-- Host running Testbench Hub --> <property name="com.vaadin.testbench.tester.host" value="testbench-hub.intra.itmill.com" /> - <property name="com.vaadin.testbench.screenshot.block.error" - value="0.025" /> + <property name="com.vaadin.testbench.screenshot.block.error" value="0.025" /> <property name="com.vaadin.testbench.debug" value="false" /> <target name="initialize"> <!-- classpath must include test bench jar and its dependencies --> <path id="classpath"> - <fileset dir="${com.vaadin.testbench.lib.dir}" - includes="**/*.jar" /> + <fileset dir="${com.vaadin.testbench.lib.dir}" includes="**/*.jar" /> </path> </target> @@ -55,16 +47,13 @@ file for each browser is created. --> <target name="create-tests" depends="initialize, remove-temp-testclasses"> <!-- Temporary output directory, created and removed by this script --> - <fail unless="test-output-dir" - message="The 'test-output-dir' property must be defined." /> + <fail unless="test-output-dir" message="The 'test-output-dir' property must be defined." /> <property name="class-dir" value="${test-output-dir}/classes" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> - <java classname="com.vaadin.testbench.util.TestConverter" - classpathref="classpath" fork="true"> - <sysproperty key="com.vaadin.testbench.test.retries" - value="${retries}" /> + <java classname="com.vaadin.testbench.util.TestConverter" classpathref="classpath" fork="true"> + <sysproperty key="com.vaadin.testbench.test.retries" value="${retries}" /> <jvmarg value="-Duser.language=en" /> <jvmarg value="-Duser.country=US" /> <arg value="${test-output-dir}" /> @@ -77,9 +66,7 @@ <!-- This target complies the generated java junit tests. --> <target name="compile-tests" depends="create-tests"> <mkdir dir="${class-dir}" /> - <javac includeantruntime="false" srcdir="${test-output-dir}" - destdir="${class-dir}" debug="on" fork="yes" failonerror="false" - encoding="UTF8"> + <javac includeantruntime="false" srcdir="${test-output-dir}" destdir="${class-dir}" debug="on" fork="yes" failonerror="false" encoding="UTF8"> <classpath> <path refid="classpath" /> </classpath> @@ -91,12 +78,9 @@ <!-- ================================================================== --> <target name="check-parameters"> - <fail unless="com.vaadin.testbench.lib.dir" - message="The 'com.vaadin.testbench.lib.dir' property must be defined." /> - <fail unless="com.vaadin.testbench.tester.host" - message="The 'com.vaadin.testbench.tester.host' property must be defined." /> - <fail unless="com.vaadin.testbench.deployment.url" - message="The 'com.vaadin.testbench.deployment.url' property must be defined." /> + <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined." /> + <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined." /> + <fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined." /> </target> <target name="run-tests" depends="compile-tests"> @@ -104,8 +88,7 @@ <include name="**/**.java" /> </fileset> - <antcontrib:for threadCount="30" parallel="true" - keepgoing="true" param="target"> + <antcontrib:for threadCount="30" parallel="true" keepgoing="true" param="target"> <path> <fileset refid="tests-fileset" /> </path> @@ -128,32 +111,23 @@ <formatter usefile="false" type="plain" /> - <jvmarg - value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" /> - <jvmarg - value="-Dcom.vaadin.testbench.deployment.url=${com.vaadin.testbench.deployment.url}" /> + <jvmarg value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" /> + <jvmarg value="-Dcom.vaadin.testbench.deployment.url=${com.vaadin.testbench.deployment.url}" /> <!-- Define where the reference screenshots and diff files are saved --> - <jvmarg - value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" /> + <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" /> <!-- Resolution for screenshots --> - <jvmarg - value="-Dcom.vaadin.testbench.screenshot.resolution=${com.vaadin.testbench.screenshot.resolution}" /> - <jvmarg - value="-Dcom.vaadin.testbench.debug=${com.vaadin.testbench.debug}" /> - <jvmarg - value="-Dcom.vaadin.testbench.screenshot.block.error=${com.vaadin.testbench.screenshot.block.error}" /> + <jvmarg value="-Dcom.vaadin.testbench.screenshot.resolution=${com.vaadin.testbench.screenshot.resolution}" /> + <jvmarg value="-Dcom.vaadin.testbench.debug=${com.vaadin.testbench.debug}" /> + <jvmarg value="-Dcom.vaadin.testbench.screenshot.block.error=${com.vaadin.testbench.screenshot.block.error}" /> <jvmarg value="-Djava.awt.headless=true" /> <!-- true/false system arguments --> - <jvmarg - value="-Dcom.vaadin.testbench.screenshot.softfail=${com.vaadin.testbench.screenshot.softfail}" /> - <jvmarg - value="-Dcom.vaadin.testbench.screenshot.reference.debug=${com.vaadin.testbench.screenshot.reference.debug}" /> - <jvmarg - value="-Dcom.vaadin.testbench.screenshot.cursor=${com.vaadin.testbench.screenshot.cursor}" /> + <jvmarg value="-Dcom.vaadin.testbench.screenshot.softfail=${com.vaadin.testbench.screenshot.softfail}" /> + <jvmarg value="-Dcom.vaadin.testbench.screenshot.reference.debug=${com.vaadin.testbench.screenshot.reference.debug}" /> + <jvmarg value="-Dcom.vaadin.testbench.screenshot.cursor=${com.vaadin.testbench.screenshot.cursor}" /> <batchtest> <filelist dir="${test-output-dir}" files="${target}" /> @@ -176,8 +150,7 @@ <target name="remove-error-screens"> <mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" /> <delete> - <fileset - dir="${com.vaadin.testbench.screenshot.directory}/errors"> + <fileset dir="${com.vaadin.testbench.screenshot.directory}/errors"> <include name="**/**.*" /> </fileset> </delete> @@ -188,38 +161,29 @@ <!-- ================================================================== --> <!-- The default target. --> - <target name="run-and-clean-up" - depends="check-parameters,remove-error-screens,run-tests" /> + <target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tests" /> <!-- Starts the server and runs all TestBench tests --> <target name="test-package"> <fail unless="war.file" message="No 'war.file' parameter given." /> - <property name="test-output-dir" - location="${test.xml.dir}/result/testbench-junit-classes" /> + <property name="test-output-dir" location="${test.xml.dir}/result/testbench-junit-classes" /> <property name="retries" value="2" /> <!-- Parameters for the test.xml script. --> - <fail unless="com.vaadin.testbench.tester.host" - message="The 'com.vaadin.testbench.tester.host' property must be defined." /> - <fail unless="com.vaadin.testbench.deployment.url" - message="The 'com.vaadin.testbench.deployment.url' property must be defined." /> - <fail unless="com.vaadin.testbench.lib.dir" - message="The 'com.vaadin.testbench.lib.dir' property must be defined." /> - <property name="com.vaadin.testbench.screenshot.block.error" - value="0.025" /> + <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined." /> + <fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined." /> + <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined." /> + <property name="com.vaadin.testbench.screenshot.block.error" value="0.025" /> <property name="com.vaadin.testbench.debug" value="false" /> <parallel> <daemons> - <ant antfile="${test.xml.dir}/vaadin-server.xml" - inheritall="true" inheritrefs="true" target="deploy-and-start" /> + <ant antfile="${test.xml.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" /> </daemons> <sequential> - <ant antfile="${test.xml.dir}/vaadin-server.xml" - target="wait-for-startup" /> - <antcall inheritall="true" inheritrefs="true" - target="run-and-clean-up" /> + <ant antfile="${test.xml.dir}/vaadin-server.xml" target="wait-for-startup" /> + <antcall inheritall="true" inheritrefs="true" target="run-and-clean-up" /> <echo message="All TestBench tests have been run" /> </sequential> </parallel> diff --git a/uitest/vaadin-server.xml b/uitest/vaadin-server.xml index 4b32cebe26..f2c3c60959 100644 --- a/uitest/vaadin-server.xml +++ b/uitest/vaadin-server.xml @@ -1,6 +1,5 @@ <?xml version="1.0"?> -<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" - name="vaadin-server" default="deploy-and-start" basedir="."> +<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="vaadin-server" default="deploy-and-start" basedir="."> <include file="../common.xml" /> <dirname property="dir" file="${ant.file.vaadin-server}" /> @@ -9,9 +8,7 @@ <ivy:resolve file="${dir}/ivy.xml" /> <ivy:cachepath pathid="classpath.jetty" conf="jetty-run" /> - <java classname="org.mortbay.jetty.runner.Runner" fork="yes" - output="${vaadin.basedir}/result/jetty.java.out" - resultproperty="resultCode"> + <java classname="org.mortbay.jetty.runner.Runner" fork="yes" output="${vaadin.basedir}/result/jetty.java.out" resultproperty="resultCode"> <arg value="--port" /> <arg value="8888" /> <arg value="--out" /> @@ -28,8 +25,7 @@ <target name="wait-for-startup"> <echo>Waiting for Servlet Container to start up.</echo> - <waitfor maxwait="60" maxwaitunit="second" checkevery="5" - checkeveryunit="second" timeoutproperty="server.start.failed"> + <waitfor maxwait="60" maxwaitunit="second" checkevery="5" checkeveryunit="second" timeoutproperty="server.start.failed"> <http url="http://localhost:8888" /> </waitfor> <fail if="server.start.failed" message="Server startup failed" /> |