diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-12-08 16:26:32 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-12-08 16:26:32 +0200 |
commit | d4be34e7bf6a17db29acba8c12652b3117983554 (patch) | |
tree | 764af2f47259a1d67c7732afa1c5d87015ca209b | |
parent | 8aae0e9bb57bc737a5f7fcc6cf08fdde3aee2de5 (diff) | |
parent | 8f95be653356e45692680d595bd96b77df3f949f (diff) | |
download | vaadin-framework-d4be34e7bf6a17db29acba8c12652b3117983554.tar.gz vaadin-framework-d4be34e7bf6a17db29acba8c12652b3117983554.zip |
Merge remote branch 'origin/master' into windowing
35 files changed, 911 insertions, 455 deletions
diff --git a/.gitignore b/.gitignore index 9f652e633f..71f41f939d 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,5 @@ /build/test-output /build/integration-test-output -# /build/buildhelpers/com/vaadin/buildhelpers/ -/build/buildhelpers/com/vaadin/buildhelpers/*.class +# /bin/ /bin diff --git a/WebContent/VAADIN/themes/base/progressindicator/progressindicator.css b/WebContent/VAADIN/themes/base/progressindicator/progressindicator.css index a9a90c4b06..4037802cf2 100644 --- a/WebContent/VAADIN/themes/base/progressindicator/progressindicator.css +++ b/WebContent/VAADIN/themes/base/progressindicator/progressindicator.css @@ -1,21 +1,17 @@ .v-progressindicator { - overflow: hidden; /* for IE6 */ width: 150px; } .v-progressindicator-wrapper { - overflow: hidden; /* for IE6 */ height: 7px; border: 1px solid #ddd; } .v-progressindicator-indicator { height: 7px; - overflow: hidden; /* for IE6 */ background: #ddd; } div.v-progressindicator-indeterminate { height: 20px; width: 20px; - overflow: hidden; /* for IE6 */ background: #fff url(../common/img/ajax-loader-medium.gif) no-repeat 50%; border-radius: 4px; -webkit-border-radius: 4px; @@ -31,6 +27,5 @@ div.v-progressindicator-indeterminate { div.v-progressindicator-indeterminate-disabled { height: 20px; width: 20px; - overflow: hidden; /* for IE6 */ background: transparent; }
\ No newline at end of file diff --git a/WebContent/VAADIN/themes/base/splitpanel/splitpanel.css b/WebContent/VAADIN/themes/base/splitpanel/splitpanel.css index c24e2df06b..7831a8d9ce 100644 --- a/WebContent/VAADIN/themes/base/splitpanel/splitpanel.css +++ b/WebContent/VAADIN/themes/base/splitpanel/splitpanel.css @@ -4,11 +4,9 @@ } .v-splitpanel-hsplitter { width: 6px; - font-size: 1px; /* for IE6 */ } .v-splitpanel-hsplitter div { width: 6px; - font-size: 1px; /* for IE6 */ position: absolute; top: 0; bottom: 0; @@ -21,11 +19,9 @@ } .v-splitpanel-vsplitter { height: 6px; - font-size: 1px; /* for IE6 */ } .v-splitpanel-vsplitter div { height: 6px; - font-size: 1px; /* for IE6 */ background: #ddd; cursor: s-resize; cursor: row-resize; diff --git a/WebContent/VAADIN/themes/runo/splitpanel/splitpanel.css b/WebContent/VAADIN/themes/runo/splitpanel/splitpanel.css index ff46127e16..d7851c27e6 100644 --- a/WebContent/VAADIN/themes/runo/splitpanel/splitpanel.css +++ b/WebContent/VAADIN/themes/runo/splitpanel/splitpanel.css @@ -6,13 +6,11 @@ .v-splitpanel-hsplitter, .v-splitpanel-hsplitter-locked { width: 6px; - font-size: 1px; /* for IE6 */ } .v-splitpanel-hsplitter div, .v-splitpanel-hsplitter-locked div { width: 6px; - font-size: 1px; /* for IE6 */ position: absolute; top: 0; bottom: 0; @@ -24,13 +22,11 @@ .v-splitpanel-vsplitter, .v-splitpanel-vsplitter-locked { height: 6px; - font-size: 1px; /* for IE6 */ } .v-splitpanel-vsplitter div, .v-splitpanel-vsplitter-locked div { height: 6px; - font-size: 1px; /* for IE6 */ background: #ccd2d0 url(img/bg_ver.png); border: 1px solid #b6bbbc; margin: -1px 0; diff --git a/build/bin/package-diff.py b/build/bin/package-diff.py index f3b0d59562..a9f29e40a9 100644 --- a/build/bin/package-diff.py +++ b/build/bin/package-diff.py @@ -56,7 +56,7 @@ def listJarFiles(jarfile): # JAPI - Java API Differences ################################################################################ def japize(version, jarfile): - cmd = "%s as %s apis %s +com.vaadin, $JAVA_HOME/jre/lib/rt.jar lib/core/**/*.jar 2>/dev/null" % (JAPIZE, version, jarfile) + cmd = "%s as %s apis %s +com.vaadin, $JAVA_HOME/jre/lib/rt.jar 2>/dev/null" % (JAPIZE, version, jarfile) command (cmd) return "%s.japi.gz" % (version) diff --git a/build/build.xml b/build/build.xml index 6b23f7f31d..c63a46ac51 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,11 +2,15 @@ <project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant" + xmlns:ivy="antlib:org.apache.ivy.ant" name="Vaadin" basedir="../" default="package-all"> + <!-- Import common targets --> + <import file="./common.xml" /> + <!--Call one of package-* targets unless you understand what you are doing. --> - <target name="package-all" depends="clean-all, init, build, javadoc, internal-package-war, internal-package-liferay, differences, internal-package-liferay" description="Build public packages."> + <target name="package-all" depends="clean-all, init, build, javadoc, internal-package-war, internal-package-liferay, differences" description="Build public packages."> </target> <target name="package-jar" depends="clean-result, init, vaadin.jar" description="Create vaadin-x.y.z.jar file."> @@ -17,31 +21,14 @@ <target name="package-liferay-zip" depends="clean-result, init, build, internal-package-liferay"> </target> - - <!-- Locations of Ant task JARs - build properties not yet read at this point --> - <property name="ant.task.jar.antcontrib" value="build/lib/ant-contrib-1.0b3.jar" /> - <property name="ant.task.jar.maven" value="build/lib/maven-ant-tasks-2.0.10.jar" /> - - <path id="emma.lib" > - <pathelement location="build/lib/emma_ant.jar" /> - <pathelement location="build/lib/emma-2.0.5312-patched.jar" /> - </path> - <taskdef resource="emma_ant.properties" classpathref="emma.lib" /> - - <!-- ant contrib required for flow control (for loop, if, property 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"> - <classpath> - <pathelement location="${ant.task.jar.antcontrib}" /> - </classpath> - </taskdef> - - <!-- ant contrib for Maven integration --> - <path id="maven-ant-tasks.classpath" path="${ant.task.jar.maven}" /> - <typedef resource="org/apache/maven/artifact/ant/antlib.xml" - uri="antlib:org.apache.maven.artifact.ant" - classpathref="maven-ant-tasks.classpath" /> + <target name="init-deps" depends="common.init-deps" > + <property name="ivy.resolved" value="1" /> + <ivy:resolve file="build/ivy/ivy.xml" resolveid="common" conf="ss.compile, cs.compile, ss.test.runtime"/> + <ivy:cachepath pathid="compile.classpath" conf="ss.compile"/> + <ivy:cachepath pathid="client-side.compile.classpath" conf="cs.compile"/> + <ivy:cachepath pathid="test.runtime.classpath" conf="ss.test.runtime"/> + </target> <!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - --> <target name="clean-result" depends=""> @@ -74,7 +61,7 @@ <!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- ================================================================== --> - <target name="init"> + <target name="init" depends="init-deps"> <!-- Current timestamp in different formats. --> <tstamp> <format property="build.date" pattern="yyyy-MM-dd"/> @@ -131,6 +118,9 @@ <!-- init-nonpackage target before calling this main init target. --> <property name="widgetsets-output-dir" value="${output-dir}/WebContent/VAADIN/widgetsets" /> + <!-- Build helpers --> + <property name="buildhelpers-src" value="build/buildhelpers" /> + <property name="buildhelpers-classes" value="${result-path}/buildhelpers/classes" /> <!-- Create Output Directory Hierarchy --> <mkdir dir="${output-dir}/WebContent" /> @@ -141,29 +131,6 @@ <mkdir dir="${output-dir}/WebContent/WEB-INF" /> <mkdir dir="${output-dir}/WebContent/WEB-INF/lib" /> <mkdir dir="${output-dir}/WebContent/WEB-INF/classes" /> - - <!-- Construct classpath used by java and javadoc compilation --> - <path id="compile.classpath"> - <pathelement path="build/lib/servlet.jar" /> - <fileset dir="lib/core"> - <include name="**/*.jar"/> - - <!-- Exclude these as they contain Servlet API 2.4. --> - <!-- The gwt-*-noservlet.jar are then used instead. --> - <exclude name="**/servlet-api*.jar"/> - </fileset> - <fileset dir="lib/tests"> - <include name="**/*.jar"/> - </fileset> - </path> - <path id="compile.classpath.server-side"> - <path refid="compile.classpath"/> - </path> - <path id="compile.classpath.client-side"> - <path refid="compile.classpath"/> - <pathelement path="${lib-gwt-user}" /> - <pathelement path="${lib-gwt-dev}" /> - </path> </target> <target name="internal-package-war"> @@ -356,24 +323,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <target name="webcontent" depends="preprocess-src,defaulttheme"> - <!-- copy 3rd part libraries used by tests --> - <copy todir="${output-dir}/WebContent/tests/lib"> - <fileset dir="lib/core"> - <include name="jetty/**/*" /> - </fileset> - <fileset dir="build/lib"> - <include name="emma-2.0.5312-patched.jar" /> - </fileset> - </copy> - <!-- Add WebContent --> - <echo>Adding VAADIN/themes, demo and hsqldb.jar files.</echo> + <echo>Adding VAADIN/themes and demo files.</echo> <copy todir="${output-dir}/WebContent"> <fileset dir="WebContent"> <exclude name="**/.svn" /> <!-- TODO check what is necessary --> <include name="demo/**/*" /> - <include name="WEB-INF/lib/hsqldb.jar" /> <include name="VAADIN/themes/**/*" /> <include name="VAADIN/vaadinBootstrap.js" /> <include name="META-INF/**/*" /> @@ -421,7 +377,11 @@ <!-- Compile all sources at the same time as they depend on each other --> <mkdir dir="${result-path}/classes" /> - <javac source="1.5" target="1.5" classpathref="compile.classpath.server-side" destdir="${result-path}/classes" debug="true" encoding="UTF-8"> + <javac source="1.5" target="1.5" includeantruntime="false" destdir="${result-path}/classes" debug="true" encoding="UTF-8"> + <classpath> + <path refid="compile.classpath" /> + <path refid="test.runtime.classpath" /> + </classpath> <src path="${result-path}/src/core"/> <src path="${result-path}/src/tests"/> <src path="${result-path}/src/junit"/> @@ -429,7 +389,10 @@ </target> <target name="compile-helpers" depends="init"> - <javac source="1.5" target="1.5" srcdir="build/buildhelpers" classpath="build/smartsprites/lib/smartsprites-0.2.3-itmill.jar"/> + <mkdir dir="${buildhelpers-classes}" /> + <ivy:cachepath pathid="buildhelpers.dependencies" resolveId="buildhelpers" conf="compile" file="build/ivy/buildhelpers-ivy.xml"/> + <javac source="1.5" target="1.5" includeantruntime="false" srcdir="${buildhelpers-src}" + classpathref="buildhelpers.dependencies" destdir="${buildhelpers-classes}" debug="true" encoding="UTF-8" /> </target> <target name="defaulttheme" depends="init, compile-helpers"> @@ -438,10 +401,8 @@ <arg value="-version" /> <arg value="${version.full}"/> <classpath> - <pathelement location="build/buildhelpers" /> - <fileset dir="build/smartsprites/lib"> - <include name="*.jar"/> - </fileset> + <path location="${buildhelpers-classes}" /> + <path refid="buildhelpers.dependencies" /> </classpath> <jvmarg value="-Djava.awt.headless=true"/> </java> @@ -474,23 +435,17 @@ <!-- The widgetset generator is currently compiled along with rest of server-side Java. --> <target name="compile-widgetset-generator" depends="init, preprocess-src, compile-java"/> - - - <path id="widgetset-compile-classpath"> - <pathelement location="${lib-gwt-user}" /> - <pathelement location="${lib-gwt-dev}" /> - <pathelement location="${lib-gwt-validation}" /> - <pathelement location="${lib-gwt-validation-src}" /> - <pathelement location="${result-path}/classes" /> - <pathelement location="${result-path}/src/core" /> - </path> - <target name="compile-widgetset" description="Compiles the widgetset given as the first parameter"> + <target name="compile-widgetset" depends="init-deps" description="Compiles the widgetset given as the first parameter"> <fail unless="widgetset" message="No widgetset parameter set"/> <echo>Compiling widgetset ${widgetset}. Output directory: ${widgetsets-output-dir}</echo> + <mkdir dir="${widgetsets-output-dir}"/> <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="512m"> - <classpath refid="widgetset-compile-classpath"/> - + <classpath> + <path refid="client-side.compile.classpath" /> + <pathelement location="${result-path}/classes" /> + <pathelement location="${result-path}/src/core" /> + </classpath> <arg value="-war" /> <arg value="${widgetsets-output-dir}" /> <arg value="-style" /> @@ -510,12 +465,14 @@ <target name="compile-widgetset-default"> <antcall target="compile-widgetset"> + <reference refid="client-side.compile.classpath" /> <param name="widgetset" value="com.vaadin.terminal.gwt.DefaultWidgetSet"/> </antcall> </target> <target name="compile-widgetset-portal-default" unless="compile.only.default-widgetset"> <antcall target="compile-widgetset"> + <reference refid="client-side.compile.classpath" /> <param name="widgetset" value="com.vaadin.portal.gwt.PortalDefaultWidgetSet"/> </antcall> </target> @@ -526,8 +483,8 @@ <target name="compile-client-side" depends="compile-server-side"> <echo>Compiling widget sets in parallel.</echo> <parallel threadsperprocessor="1"> - <antcall target="compile-widgetset-default"/> - <antcall target="compile-widgetset-portal-default"/> + <antcall inheritrefs="true" target="compile-widgetset-default"/> + <antcall inheritrefs="true" target="compile-widgetset-portal-default"/> </parallel> </target> @@ -638,7 +595,7 @@ <java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes"> <arg value="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}"/> <classpath> - <pathelement location="build/buildhelpers" /> + <pathelement location="${buildhelpers-classes}" /> </classpath> </java> @@ -674,7 +631,7 @@ <target name="javadoc" depends="init, preprocess-src"> <property name="javadoc.destdir" value="${output-dir}/WebContent/docs/api"/> - <javadoc destdir="${javadoc.destdir}" author="true" version="true" use="true" windowtitle="${product-name}" classpathref="compile.classpath.client-side"> + <javadoc destdir="${javadoc.destdir}" author="true" version="true" use="true" windowtitle="${product-name}" classpathref="compile.classpath"> <packageset dir="${result-path}/src/core"> <include name="${toolkit-package}/**" /> </packageset> @@ -940,7 +897,7 @@ </target> <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task--> - <target name="server-side-tests" unless="tests.serverside.skip"> + <target name="server-side-tests" depends="init-deps" unless="tests.serverside.skip"> <emma enabled="${emma.enabled}" > <instr instrpath="${result-path}/classes" mode="copy" @@ -959,9 +916,9 @@ <junit printsummary="yes"> <classpath> <pathelement path="${result-path}/junit_emma_classes" /> - <pathelement path="${result-path}/classes" /> - <path refid="emma.lib" /> - <path refid="compile.classpath"/> + <pathelement path="${result-path}/classes" /> + <path refid="test.runtime.classpath"></path> + <path refid="compile.classpath"></path> </classpath> <jvmarg value="-Demma.coverage.out.file=../${result-path}/unittests.ec" /> @@ -1010,8 +967,8 @@ <!-- Convert tests to run multiple times if failed. --> <property name="retries" value="2"/> - - <property name="package.filename" value="${package.filename}"/> + + <property name="package.filename" value="${basedir}/${package.filename}"/> <property name="testing.testarea" value="/tmp/testarea"/> <property name="package.name" value="${package.name}"/> <property name="test-output-dir" value="../build/test-output" /> @@ -1020,6 +977,9 @@ <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}"/> <property name="com.vaadin.testbench.debug" value="${com.vaadin.testbench.debug}"/> <property name="com.vaadin.testbench.screenshot.block.error" value="${com.vaadin.testbench.screenshot.block.error}"/> + + <property name="deps.initialized" value="${deps.initialized}"/> + </ant> <emma enabled="${emma.enabled}" > @@ -1036,7 +996,7 @@ </target> <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task--> - <target name="integration-tests" unless="tests.integration.skip"> + <target name="integration-tests" depends="init-deps" unless="tests.integration.skip"> <!-- 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.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined."/> @@ -1057,6 +1017,8 @@ <property name="sshkey.file" value="${sshkey.file}" /> <property name="passphrase" value="${passphrase}" /> <property name="demo.war" value="${tests.war}"/> + + <property name="deps.initialized" value="${deps.initialized}"/> </ant> </target> </project> diff --git a/build/common.xml b/build/common.xml new file mode 100644 index 0000000000..aff5c36cb3 --- /dev/null +++ b/build/common.xml @@ -0,0 +1,55 @@ +<?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" > + + <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"> + <property name="deps.initialized" value="1" /> + </target> + + <target name="check-ivy-installed"> + <available property="ivy.installed" file="${ivy.jar.file}"/> + <available property="ivy.installed" classname="org.apache.ivy.ant.IvyConfigure" /> + <antcall target="common.ivy-download" /> + </target> + + <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"/> + </target> + + <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}" /> + <!-- Ivy settings --> + <property name="ivy.settings.file" value="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="build/ivy/ivy.xml" conf="taskdefs" /> + <ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" /> + <taskdef resource="emma_ant.properties" classpathref="taskdefs.classpath" /> + + <!-- ant contrib required for flow control (for loop, if, property 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" /> + + <!-- ant contrib for Maven integration --> + <taskdef resource="org/apache/maven/artifact/ant/antlib.xml" + uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" /> + </target> + +</project> diff --git a/build/ivy/buildhelpers-ivy.xml b/build/ivy/buildhelpers-ivy.xml new file mode 100644 index 0000000000..afccd85973 --- /dev/null +++ b/build/ivy/buildhelpers-ivy.xml @@ -0,0 +1,13 @@ +<ivy-module version="2.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd"> + + <info organisation="com.vaadin" module="buildhelpers"/> + <configurations> + <conf name="compile" visibility="private"/> + </configurations> + <publications /> + <dependencies> + <dependency org="com.carrotsearch" name="smartsprites" rev="0.2.3-itmill" conf="compile->compile(*),master(*)"/> + </dependencies> +</ivy-module>
\ No newline at end of file diff --git a/build/ivy/ivy.xml b/build/ivy/ivy.xml new file mode 100644 index 0000000000..9dd69e1abe --- /dev/null +++ b/build/ivy/ivy.xml @@ -0,0 +1,43 @@ +<ivy-module version="2.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd"> + + <info organisation="com.vaadin" module="vaadin"/> + <configurations > + <conf name="ss.compile" extends="cs.compile" description="Server side compilation dependencies" visibility="private"/> + <conf name="cs.compile" description="Client side compilation dependencies" visibility="private"/> + <conf name="ss.test.runtime" description="Test runtime dependencies" visibility="private"/> + <conf name="taskdefs" description="Ant task definitions" visibility="private" /> + </configurations> + <publications /> + <dependencies defaultconf="ss.compile" defaultconfmapping="ss.compile->master"> + + <!-- Liferay Portal Service --> + <dependency org="com.liferay.portal" name="portal-service" rev="6.0.2" /> + <!--Portlet API version 2.0 (JSR-286) --> + <dependency org="javax.portlet" name="portlet-api" rev="2.0" /> + <!-- Google App Engine --> + <dependency org="com.google.appengine" name="appengine-api-1.0-sdk" rev="1.2.1" /> + + <!-- GWT user with dependencies (validation-api) --> + <dependency org="com.google.gwt" name="gwt-user" rev="2.4.0" conf="cs.compile->master" /> + <dependency org="javax.validation" name="validation-api" rev="1.0.0.GA" conf="cs.compile->master,sources" /> + <!-- GWT dev (incl. servlet-api 2.4 classes) --> + <dependency org="com.google.gwt" name="gwt-dev" rev="2.4.0" conf="cs.compile->master" /> + + <!-- Test frameworks & related --> + <dependency org="junit" name="junit" rev="4.5" conf="ss.test.runtime -> master"/> + <dependency org="org.easymock" name="easymock" rev="3.0" conf="ss.test.runtime -> master, runtime(*)"/> + <dependency org="org.hsqldb" name="hsqldb" rev="2.2.6" conf="ss.test.runtime -> master, runtime(*)"/> + + <!-- Ant tasks --> + <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="taskdefs ->master"/> + <dependency org="org.apache.maven" name="maven-ant-tasks" rev="2.0.10" conf="taskdefs ->master"/> + + <!-- Emma --> + <dependency org="emma" name="emma_ant" rev="2.0.5312" conf="ss.test.runtime,taskdefs ->master"/> + <dependency org="emma" name="emma" rev="2.0.5312-patched" conf="ss.test.runtime,taskdefs ->*"/> + + </dependencies> + +</ivy-module>
\ No newline at end of file diff --git a/build/ivy/ivysettings.xml b/build/ivy/ivysettings.xml new file mode 100644 index 0000000000..613b8d9ffe --- /dev/null +++ b/build/ivy/ivysettings.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ivysettings> + <settings defaultResolver="public" /> + <resolvers> + <ibiblio name="public" m2compatible="true"/> + <url name="gwt-redist"> + <artifact pattern="http://google-web-toolkit.googlecode.com/svn/tools/redist/[organisation]/[artifact](-[revision]).[ext]" /> + </url> + <dual name="custom-smartsprites"> + <filesystem name="smartsprites-ivy"> + <ivy pattern="${basedir}/build/ivy/module/[module]-ivy-[revision].xml" /> + </filesystem> + <url name="smartsprites-artifact"> + <artifact pattern="http://dev.vaadin.com/svn/versions/6.8/build/smartsprites/lib/[artifact](-[revision]).[ext]" /> + </url> + </dual> + </resolvers> + <modules> + <!-- GWT patched Emma --> + <module organisation="emma" name="emma" resolver="gwt-redist"/> + <!-- IT Mill patched SmartSprites --> + <module organisation="com.carrotsearch" name="smartsprites" revision="0.2.3-itmill" resolver="custom-smartsprites"/> + </modules> +</ivysettings>
\ No newline at end of file diff --git a/build/ivy/module/smartsprites-ivy-0.2.3-itmill.xml b/build/ivy/module/smartsprites-ivy-0.2.3-itmill.xml new file mode 100644 index 0000000000..495b6d00c9 --- /dev/null +++ b/build/ivy/module/smartsprites-ivy-0.2.3-itmill.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven"> + <info organisation="com.carrotsearch" + module="smartsprites" + revision="0.2.3-itmill" + status="release" + publication="20111130000000"> + <license name="BSD license" url="http://csssprites.org/smartsprites.LICENSE" /> + <description homepage="http://csssprites.org"> + CSS Sprites Generator Done Right. SmartSprites maintains CSS sprites in your designs, + fully automatically. No tedious copying and pasting to your CSS when adding or changing + sprited images. + </description> + </info> + <configurations> + <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/> + <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/> + <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/> + <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/> + <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/> + <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/> + <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/> + <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/> + <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/> + <conf name="optional" visibility="public" description="contains all optional dependencies"/> + </configurations> + <publications> + <artifact name="smartsprites" type="jar" ext="jar" conf="master"/> + </publications> + <dependencies> + <dependency org="com.google.collections" name="google-collections" rev="0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> + <dependency org="args4j" name="args4j" rev="2.0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> + <dependency org="commons-math" name="commons-math" rev="1.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> + <dependency org="commons-io" name="commons-io" rev="1.4" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> + <dependency org="commons-lang" name="commons-lang" rev="2.3" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> + <dependency org="junit" name="junit" rev="4.4" force="true" conf="test->runtime(*),master(*)"/> + </dependencies> +</ivy-module> diff --git a/src/com/vaadin/data/Buffered.java b/src/com/vaadin/data/Buffered.java index 13844c1101..b818781145 100644 --- a/src/com/vaadin/data/Buffered.java +++ b/src/com/vaadin/data/Buffered.java @@ -241,36 +241,29 @@ public interface Buffered extends Serializable { * * @see com.vaadin.terminal.ErrorMessage#getErrorLevel() */ - public int getErrorLevel() { + public ErrorLevel getErrorLevel() { - int level = Integer.MIN_VALUE; + ErrorLevel level = null; for (int i = 0; i < causes.length; i++) { - final int causeLevel = (causes[i] instanceof ErrorMessage) ? ((ErrorMessage) causes[i]) - .getErrorLevel() : ErrorMessage.ERROR; - if (causeLevel > level) { + final ErrorLevel causeLevel = (causes[i] instanceof ErrorMessage) ? ((ErrorMessage) causes[i]) + .getErrorLevel() : ErrorLevel.ERROR; + if (level == null) { level = causeLevel; + } else { + if (causeLevel.intValue() > level.intValue()) { + level = causeLevel; + } } } - return level == Integer.MIN_VALUE ? ErrorMessage.ERROR : level; + return level == null ? ErrorLevel.ERROR : level; } /* Documented in super interface */ public void paint(PaintTarget target) throws PaintException { target.startTag("error"); - final int level = getErrorLevel(); - if (level > 0 && level <= ErrorMessage.INFORMATION) { - target.addAttribute("level", "info"); - } else if (level <= ErrorMessage.WARNING) { - target.addAttribute("level", "warning"); - } else if (level <= ErrorMessage.ERROR) { - target.addAttribute("level", "error"); - } else if (level <= ErrorMessage.CRITICAL) { - target.addAttribute("level", "critical"); - } else { - target.addAttribute("level", "system"); - } + target.addAttribute("level", getErrorLevel().getText()); // Paint all the exceptions for (int i = 0; i < causes.length; i++) { diff --git a/src/com/vaadin/data/Validator.java b/src/com/vaadin/data/Validator.java index b1dc5ffc14..573fce10cd 100644 --- a/src/com/vaadin/data/Validator.java +++ b/src/com/vaadin/data/Validator.java @@ -146,8 +146,8 @@ public interface Validator extends Serializable { * * @see com.vaadin.terminal.ErrorMessage#getErrorLevel() */ - public final int getErrorLevel() { - return ErrorMessage.ERROR; + public final ErrorLevel getErrorLevel() { + return ErrorLevel.ERROR; } /* @@ -158,7 +158,7 @@ public interface Validator extends Serializable { */ public void paint(PaintTarget target) throws PaintException { target.startTag("error"); - target.addAttribute("level", "error"); + target.addAttribute("level", ErrorLevel.ERROR.getText()); // Error message final String message = getHtmlMessage(); diff --git a/src/com/vaadin/data/util/PropertyFormatter.java b/src/com/vaadin/data/util/PropertyFormatter.java index c43a4771dc..ae9b0d40d1 100644 --- a/src/com/vaadin/data/util/PropertyFormatter.java +++ b/src/com/vaadin/data/util/PropertyFormatter.java @@ -34,7 +34,8 @@ import com.vaadin.data.Property; */ @SuppressWarnings("serial") public abstract class PropertyFormatter extends AbstractProperty implements - Property.ValueChangeListener, Property.ReadOnlyStatusChangeListener { + Property.Viewer, Property.ValueChangeListener, + Property.ReadOnlyStatusChangeListener { /** Datasource that stores the actual value. */ Property dataSource; @@ -146,7 +147,10 @@ public abstract class PropertyFormatter extends AbstractProperty implements */ @Override public String toString() { - Object value = dataSource == null ? false : dataSource.getValue(); + if (dataSource == null) { + return null; + } + Object value = dataSource.getValue(); if (value == null) { return null; } @@ -154,6 +158,7 @@ public abstract class PropertyFormatter extends AbstractProperty implements } /** Reflects the read-only status of the datasource. */ + @Override public boolean isReadOnly() { return dataSource == null ? false : dataSource.isReadOnly(); } @@ -190,6 +195,7 @@ public abstract class PropertyFormatter extends AbstractProperty implements * @param newStatus * the new read-only status of the Property. */ + @Override public void setReadOnly(boolean newStatus) { if (dataSource != null) { dataSource.setReadOnly(newStatus); @@ -208,16 +214,14 @@ public abstract class PropertyFormatter extends AbstractProperty implements } } else { try { - dataSource.setValue(parse((String) newValue)); + dataSource.setValue(parse(newValue.toString())); if (!newValue.equals(toString())) { fireValueChange(); } + } catch (ConversionException e) { + throw e; } catch (Exception e) { - if (e instanceof ConversionException) { - throw (ConversionException) e; - } else { - throw new ConversionException(e); - } + throw new ConversionException(e); } } } diff --git a/src/com/vaadin/data/validator/CompositeValidator.java b/src/com/vaadin/data/validator/CompositeValidator.java index 8fa01affba..f672258978 100644 --- a/src/com/vaadin/data/validator/CompositeValidator.java +++ b/src/com/vaadin/data/validator/CompositeValidator.java @@ -26,30 +26,36 @@ import com.vaadin.data.Validator; @SuppressWarnings("serial") public class CompositeValidator extends AbstractValidator { - /** - * The validators are combined with <code>AND</code> clause: validity of the - * composite implies validity of the all validators it is composed of must - * be valid. - */ - public static final int MODE_AND = 0; + public enum CombinationMode { + /** + * The validators are combined with <code>AND</code> clause: validity of + * the composite implies validity of the all validators it is composed + * of must be valid. + */ + AND, + /** + * The validators are combined with <code>OR</code> clause: validity of + * the composite implies that some of validators it is composed of must + * be valid. + */ + OR; + } /** - * The validators are combined with <code>OR</code> clause: validity of the - * composite implies that some of validators it is composed of must be - * valid. + * @deprecated from 7.0, use {@link CombinationMode#AND} instead */ - public static final int MODE_OR = 1; - + @Deprecated + public static final CombinationMode MODE_AND = CombinationMode.AND; /** - * The validators are combined with and clause: validity of the composite - * implies validity of the all validators it is composed of + * @deprecated from 7.0, use {@link CombinationMode#OR} instead */ - public static final int MODE_DEFAULT = MODE_AND; + @Deprecated + public static final CombinationMode MODE_OR = CombinationMode.OR; /** * Operation mode. */ - private int mode = MODE_DEFAULT; + private CombinationMode mode = CombinationMode.AND; /** * List of contained validators. @@ -67,7 +73,7 @@ public class CompositeValidator extends AbstractValidator { /** * Constructs a composite validator in given mode. */ - public CompositeValidator(int mode, String errorMessage) { + public CompositeValidator(CombinationMode mode, String errorMessage) { super(errorMessage); setMode(mode); } @@ -94,13 +100,13 @@ public class CompositeValidator extends AbstractValidator { @Override public void validate(Object value) throws Validator.InvalidValueException { switch (mode) { - case MODE_AND: + case AND: for (Validator validator : validators) { validator.validate(value); } return; - case MODE_OR: + case OR: Validator.InvalidValueException first = null; for (Validator v : validators) { try { @@ -122,15 +128,13 @@ public class CompositeValidator extends AbstractValidator { throw first; } } - throw new IllegalStateException( - "The validator is in unsupported operation mode"); } /** * Checks the validity of the the given value. The value is valid, if: * <ul> - * <li><code>MODE_AND</code>: All of the sub-validators are valid - * <li><code>MODE_OR</code>: Any of the sub-validators are valid + * <li>{@link CombinationMode.AND}: All of the sub-validators are valid + * <li>{@link CombinationMode.OR}: Any of the sub-validators are valid * </ul> * * @param value @@ -138,7 +142,7 @@ public class CompositeValidator extends AbstractValidator { */ public boolean isValid(Object value) { switch (mode) { - case MODE_AND: + case AND: for (Validator v : validators) { if (!v.isValid(value)) { return false; @@ -146,7 +150,7 @@ public class CompositeValidator extends AbstractValidator { } return true; - case MODE_OR: + case OR: for (Validator v : validators) { if (v.isValid(value)) { return true; @@ -155,32 +159,33 @@ public class CompositeValidator extends AbstractValidator { return false; } throw new IllegalStateException( - "The valitor is in unsupported operation mode"); + "The validator is in unsupported operation mode"); } /** * Gets the mode of the validator. * - * @return Operation mode of the validator: <code>MODE_AND</code> or - * <code>MODE_OR</code>. + * @return Operation mode of the validator: {@link CombinationMode.AND} or + * {@link CombinationMode.OR}. */ - public final int getMode() { + public final CombinationMode getMode() { return mode; } /** * Sets the mode of the validator. The valid modes are: * <ul> - * <li><code>MODE_AND</code> (default) - * <li><code>MODE_OR</code> + * <li>{@link CombinationMode.AND} (default) + * <li>{@link CombinationMode.OR} * </ul> * * @param mode * the mode to set. */ - public void setMode(int mode) { - if (mode != MODE_AND && mode != MODE_OR) { - throw new IllegalArgumentException("Mode " + mode + " unsupported"); + public void setMode(CombinationMode mode) { + if (mode == null) { + throw new IllegalStateException( + "The validator can't be set to null"); } this.mode = mode; } diff --git a/src/com/vaadin/terminal/CompositeErrorMessage.java b/src/com/vaadin/terminal/CompositeErrorMessage.java index bd70008523..f44454294e 100644 --- a/src/com/vaadin/terminal/CompositeErrorMessage.java +++ b/src/com/vaadin/terminal/CompositeErrorMessage.java @@ -29,7 +29,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { /** * Level of the error. */ - private int level; + private ErrorLevel level; /** * Constructor for CompositeErrorMessage. @@ -40,7 +40,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { */ public CompositeErrorMessage(ErrorMessage[] errorMessages) { errors = new ArrayList<ErrorMessage>(errorMessages.length); - level = Integer.MIN_VALUE; + level = ErrorLevel.INFORMATION; for (int i = 0; i < errorMessages.length; i++) { addErrorMessage(errorMessages[i]); @@ -63,7 +63,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { public CompositeErrorMessage( Collection<? extends ErrorMessage> errorMessages) { errors = new ArrayList<ErrorMessage>(errorMessages.size()); - level = Integer.MIN_VALUE; + level = ErrorLevel.INFORMATION; for (final Iterator<? extends ErrorMessage> i = errorMessages .iterator(); i.hasNext();) { @@ -81,7 +81,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { * * @see com.vaadin.terminal.ErrorMessage#getErrorLevel() */ - public final int getErrorLevel() { + public final ErrorLevel getErrorLevel() { return level; } @@ -95,9 +95,8 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { private void addErrorMessage(ErrorMessage error) { if (error != null && !errors.contains(error)) { errors.add(error); - final int l = error.getErrorLevel(); - if (l > level) { - level = l; + if (error.getErrorLevel().intValue() > level.intValue()) { + level = error.getErrorLevel(); } } } @@ -120,18 +119,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { (errors.iterator().next()).paint(target); } else { target.startTag("error"); - - if (level > 0 && level <= ErrorMessage.INFORMATION) { - target.addAttribute("level", "info"); - } else if (level <= ErrorMessage.WARNING) { - target.addAttribute("level", "warning"); - } else if (level <= ErrorMessage.ERROR) { - target.addAttribute("level", "error"); - } else if (level <= ErrorMessage.CRITICAL) { - target.addAttribute("level", "critical"); - } else { - target.addAttribute("level", "system"); - } + target.addAttribute("level", level.getText()); // Paint all the exceptions for (final Iterator<ErrorMessage> i = errors.iterator(); i diff --git a/src/com/vaadin/terminal/ErrorMessage.java b/src/com/vaadin/terminal/ErrorMessage.java index 428a3016df..6436b0b472 100644 --- a/src/com/vaadin/terminal/ErrorMessage.java +++ b/src/com/vaadin/terminal/ErrorMessage.java @@ -17,37 +17,98 @@ import java.io.Serializable; */ public interface ErrorMessage extends Paintable, Serializable { + public enum ErrorLevel { + /** + * Error code for informational messages. + */ + INFORMATION("info", 0), + /** + * Error code for warning messages. + */ + WARNING("warning", 1), + /** + * Error code for regular error messages. + */ + ERROR("error", 2), + /** + * Error code for critical error messages. + */ + CRITICAL("critical", 3), + /** + * Error code for system errors and bugs. + */ + SYSTEMERROR("system", 4); + + String text; + int errorLevel; + + private ErrorLevel(String text, int errorLevel) { + this.text = text; + this.errorLevel = errorLevel; + } + + /** + * Textual representation for server-client communication of level + * + * @return String for error severity + */ + public String getText() { + return text; + } + + /** + * Integer representation of error severity for comparison + * + * @return integer for error severity + */ + public int intValue() { + return errorLevel; + } + + @Override + public String toString() { + return text; + } + + } + /** - * Error code for system errors and bugs. + * @deprecated from 7.0, use {@link ErrorLevel#SYSTEMERROR} instead */ - public static final int SYSTEMERROR = 5000; + @Deprecated + public static final ErrorLevel SYSTEMERROR = ErrorLevel.SYSTEMERROR; /** - * Error code for critical error messages. + * @deprecated from 7.0, use {@link ErrorLevel#CRITICAL} instead */ - public static final int CRITICAL = 4000; + @Deprecated + public static final ErrorLevel CRITICAL = ErrorLevel.CRITICAL; /** - * Error code for regular error messages. + * @deprecated from 7.0, use {@link ErrorLevel#ERROR} instead */ - public static final int ERROR = 3000; + + @Deprecated + public static final ErrorLevel ERROR = ErrorLevel.ERROR; /** - * Error code for warning messages. + * @deprecated from 7.0, use {@link ErrorLevel#WARNING} instead */ - public static final int WARNING = 2000; + @Deprecated + public static final ErrorLevel WARNING = ErrorLevel.WARNING; /** - * Error code for informational messages. + * @deprecated from 7.0, use {@link ErrorLevel#INFORMATION} instead */ - public static final int INFORMATION = 1000; + @Deprecated + public static final ErrorLevel INFORMATION = ErrorLevel.INFORMATION; /** * Gets the errors level. * * @return the level of error as an integer. */ - public int getErrorLevel(); + public ErrorLevel getErrorLevel(); /** * Error messages are inmodifiable and thus listeners are not needed. This diff --git a/src/com/vaadin/terminal/Sizeable.java b/src/com/vaadin/terminal/Sizeable.java index c3e8ee4e9b..32e0cfd2d6 100644 --- a/src/com/vaadin/terminal/Sizeable.java +++ b/src/com/vaadin/terminal/Sizeable.java @@ -93,21 +93,6 @@ public interface Sizeable extends Serializable { public float getWidth(); /** - * Sets the width of the object. Negative number implies unspecified size - * (terminal is free to set the size). - * - * @param width - * the width of the object in units specified by widthUnits - * property. - * @deprecated Consider using {@link #setWidth(String)} instead. This method - * works, but is error-prone since the unit must be set - * separately (and components might have different default - * unit). - */ - @Deprecated - public void setWidth(float width); - - /** * Gets the height of the object. Negative number implies unspecified size * (terminal is free to set the size). * @@ -116,21 +101,6 @@ public interface Sizeable extends Serializable { public float getHeight(); /** - * Sets the height of the object. Negative number implies unspecified size - * (terminal is free to set the size). - * - * @param height - * the height of the object in units specified by heightUnits - * property. - * @deprecated Consider using {@link #setHeight(String)} or - * {@link #setHeight(float, int)} instead. This method works, - * but is error-prone since the unit must be set separately (and - * components might have different default unit). - */ - @Deprecated - public void setHeight(float height); - - /** * Gets the width property units. * * @return units used in width property. @@ -138,18 +108,6 @@ public interface Sizeable extends Serializable { public int getWidthUnits(); /** - * Sets the width property units. - * - * @param units - * the units used in width property. - * @deprecated Consider setting width and unit simultaneously using - * {@link #setWidth(String)} or {@link #setWidth(float, int)}, - * which is less error-prone. - */ - @Deprecated - public void setWidthUnits(int units); - - /** * Gets the height property units. * * @return units used in height property. @@ -157,18 +115,6 @@ public interface Sizeable extends Serializable { public int getHeightUnits(); /** - * Sets the height property units. - * - * @param units - * the units used in height property. - * @deprecated Consider setting height and unit simultaneously using - * {@link #setHeight(String)} or {@link #setHeight(float, int)}, - * which is less error-prone. - */ - @Deprecated - public void setHeightUnits(int units); - - /** * Sets the height of the component using String presentation. * * String presentation is similar to what is used in Cascading Style Sheets. diff --git a/src/com/vaadin/terminal/SystemError.java b/src/com/vaadin/terminal/SystemError.java index fb1de0c494..7f9aebac17 100644 --- a/src/com/vaadin/terminal/SystemError.java +++ b/src/com/vaadin/terminal/SystemError.java @@ -69,8 +69,8 @@ public class SystemError extends RuntimeException implements ErrorMessage { /** * @see com.vaadin.terminal.ErrorMessage#getErrorLevel() */ - public final int getErrorLevel() { - return ErrorMessage.SYSTEMERROR; + public final ErrorLevel getErrorLevel() { + return ErrorLevel.SYSTEMERROR; } /** @@ -79,7 +79,7 @@ public class SystemError extends RuntimeException implements ErrorMessage { public void paint(PaintTarget target) throws PaintException { target.startTag("error"); - target.addAttribute("level", "system"); + target.addAttribute("level", ErrorLevel.SYSTEMERROR.getText()); String message = getHtmlMessage(); diff --git a/src/com/vaadin/terminal/UserError.java b/src/com/vaadin/terminal/UserError.java index d33c02d144..7cf46dad46 100644 --- a/src/com/vaadin/terminal/UserError.java +++ b/src/com/vaadin/terminal/UserError.java @@ -18,31 +18,54 @@ import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; @SuppressWarnings("serial") public class UserError implements ErrorMessage { + public enum ContentMode { + /** + * Content mode, where the error contains only plain text. + */ + TEXT, + /** + * Content mode, where the error contains preformatted text. + */ + PREFORMATTED, + /** + * Formatted content mode, where the contents is XML restricted to the + * UIDL 1.0 formatting markups. + */ + UIDL, + /** + * Content mode, where the error contains XHTML. + */ + XHTML; + } + /** - * Content mode, where the error contains only plain text. + * @deprecated from 7.0, use {@link ContentMode#TEXT} instead */ - public static final int CONTENT_TEXT = 0; + @Deprecated + public static final ContentMode CONTENT_TEXT = ContentMode.TEXT; /** - * Content mode, where the error contains preformatted text. + * @deprecated from 7.0, use {@link ContentMode#PREFORMATTED} instead */ - public static final int CONTENT_PREFORMATTED = 1; + @Deprecated + public static final ContentMode CONTENT_PREFORMATTED = ContentMode.PREFORMATTED; /** - * Formatted content mode, where the contents is XML restricted to the UIDL - * 1.0 formatting markups. + * @deprecated from 7.0, use {@link ContentMode#UIDL} instead */ - public static final int CONTENT_UIDL = 2; + @Deprecated + public static final ContentMode CONTENT_UIDL = ContentMode.UIDL; /** - * Content mode, where the error contains XHTML. + * @deprecated from 7.0, use {@link ContentMode#XHTML} instead */ - public static final int CONTENT_XHTML = 3; + @Deprecated + public static final ContentMode CONTENT_XHTML = ContentMode.XHTML; /** * Content mode. */ - private int mode = CONTENT_TEXT; + private ContentMode mode = ContentMode.TEXT; /** * Message in content mode. @@ -52,7 +75,7 @@ public class UserError implements ErrorMessage { /** * Error level. */ - private int level = ErrorMessage.ERROR; + private ErrorLevel level = ErrorLevel.ERROR; /** * Creates a textual error message of level ERROR. @@ -64,31 +87,15 @@ public class UserError implements ErrorMessage { msg = textErrorMessage; } - /** - * Creates a error message with level and content mode. - * - * @param message - * the error message. - * @param contentMode - * the content Mode. - * @param errorLevel - * the level of error. - */ - public UserError(String message, int contentMode, int errorLevel) { - - // Check the parameters - if (contentMode < 0 || contentMode > 2) { - throw new java.lang.IllegalArgumentException( - "Unsupported content mode: " + contentMode); - } - + public UserError(String message, ContentMode contentMode, + ErrorLevel errorLevel) { msg = message; mode = contentMode; level = errorLevel; } /* Documented in interface */ - public int getErrorLevel() { + public ErrorLevel getErrorLevel() { return level; } @@ -108,38 +115,25 @@ public class UserError implements ErrorMessage { public void paint(PaintTarget target) throws PaintException { target.startTag("error"); - - // Error level - if (level >= ErrorMessage.SYSTEMERROR) { - target.addAttribute("level", "system"); - } else if (level >= ErrorMessage.CRITICAL) { - target.addAttribute("level", "critical"); - } else if (level >= ErrorMessage.ERROR) { - target.addAttribute("level", "error"); - } else if (level >= ErrorMessage.WARNING) { - target.addAttribute("level", "warning"); - } else { - target.addAttribute("level", "info"); - } + target.addAttribute("level", level.getText()); // Paint the message switch (mode) { - case CONTENT_TEXT: + case TEXT: target.addText(AbstractApplicationServlet.safeEscapeForHtml(msg)); break; - case CONTENT_UIDL: + case UIDL: target.addUIDL(msg); break; - case CONTENT_PREFORMATTED: + case PREFORMATTED: target.addText("<pre>" + AbstractApplicationServlet.safeEscapeForHtml(msg) + "</pre>"); break; - case CONTENT_XHTML: + case XHTML: target.addText(msg); break; } - target.endTag("error"); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index 850e481cd5..7575a84fee 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -5693,6 +5693,14 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, if (this.width.equals(width)) { return; } + if (!isVisible()) { + /* + * Do not update size when the table is hidden as all column widths + * will be set to zero and they won't be recalculated when the table + * is set visible again (until the size changes again) + */ + return; + } this.width = width; if (width != null && !"".equals(width)) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java index 7f9f1edb4a..80ad712fa1 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java @@ -955,7 +955,7 @@ public class VWindow extends VOverlay implements Container, } @Override - /* + /** * Width is set to the out-most element (v-window). * * This function should never be called with percentage values (it will @@ -1004,33 +1004,45 @@ public class VWindow extends VOverlay implements Container, } @Override - /* + /** * Height is set to the out-most element (v-window). * * This function should never be called with percentage values (it will * throw an exception) + * + * @param height A CSS string specifying the new height of the window. + * An empty string or null clears the height and lets + * the browser to compute it based on the window contents. */ public void setHeight(String height) { - this.height = height; - if (!isAttached()) { + if (!isAttached() || (height == null + ? this.height == null + : height.equals(this.height))) { return; } - if (height != null && !"".equals(height)) { - DOM.setStyleAttribute(getElement(), "height", height); - int pixels = getElement().getOffsetHeight() - getExtraHeight(); - if (pixels < MIN_CONTENT_AREA_HEIGHT) { - pixels = MIN_CONTENT_AREA_HEIGHT; - int rootHeight = pixels + getExtraHeight(); - DOM.setStyleAttribute(getElement(), "height", (rootHeight) - + "px"); - + if (height == null || "".equals(height)) { + getElement().getStyle().clearHeight(); + contentPanel.getElement().getStyle().clearHeight(); + // Reset to default, the exact value does not actually + // matter as an undefined-height parent should not have + // a relative-height child anyway. + renderSpace.setHeight(MIN_CONTENT_AREA_HEIGHT); + } else { + getElement().getStyle().setProperty("height", height); + int contentHeight = + getElement().getOffsetHeight() - getExtraHeight(); + if (contentHeight < MIN_CONTENT_AREA_HEIGHT) { + contentHeight = MIN_CONTENT_AREA_HEIGHT; + int rootHeight = contentHeight + getExtraHeight(); + getElement().getStyle().setProperty( + "height", rootHeight + "px"); } - renderSpace.setHeight(pixels); - height = pixels + "px"; - contentPanel.getElement().getStyle().setProperty("height", height); - updateShadowSizeAndPosition(); - + renderSpace.setHeight(contentHeight); + contentPanel.getElement().getStyle().setProperty( + "height", contentHeight + "px"); } + this.height = height; + updateShadowSizeAndPosition(); } private int extraH = 0; diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java index e91511ae39..8c1d6db524 100644 --- a/src/com/vaadin/ui/AbstractComponent.java +++ b/src/com/vaadin/ui/AbstractComponent.java @@ -1322,26 +1322,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource /* * (non-Javadoc) * - * @see com.vaadin.terminal.Sizeable#setHeight(float) - */ - @Deprecated - public void setHeight(float height) { - setHeight(height, getHeightUnits()); - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.terminal.Sizeable#setHeightUnits(int) - */ - @Deprecated - public void setHeightUnits(int unit) { - setHeight(getHeight(), unit); - } - - /* - * (non-Javadoc) - * * @see com.vaadin.terminal.Sizeable#setHeight(float, int) */ public void setHeight(float height, int unit) { @@ -1374,26 +1354,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource /* * (non-Javadoc) * - * @see com.vaadin.terminal.Sizeable#setWidth(float) - */ - @Deprecated - public void setWidth(float width) { - setWidth(width, getWidthUnits()); - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.terminal.Sizeable#setWidthUnits(int) - */ - @Deprecated - public void setWidthUnits(int unit) { - setWidth(getWidth(), unit); - } - - /* - * (non-Javadoc) - * * @see com.vaadin.terminal.Sizeable#setWidth(float, int) */ public void setWidth(float width, int unit) { diff --git a/src/com/vaadin/ui/Form.java b/src/com/vaadin/ui/Form.java index 8ee702bbb4..1a28c679f9 100644 --- a/src/com/vaadin/ui/Form.java +++ b/src/com/vaadin/ui/Form.java @@ -491,7 +491,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, } // Configures the field - field.setPropertyDataSource(property); + bindPropertyToField(id, property, field); // Register and attach the created field addField(id, field); @@ -755,7 +755,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, final Field f = fieldFactory.createField(itemDatasource, id, this); if (f != null) { - f.setPropertyDataSource(property); + bindPropertyToField(id, property, f); addField(id, f); } } @@ -763,6 +763,32 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item, } /** + * Binds an item property to a field. The default behavior is to bind + * property straight to Field. If Property.Viewer type property (e.g. + * PropertyFormatter) is already set for field, the property is bound to + * that Property.Viewer. + * + * @param propertyId + * @param property + * @param field + * @since 6.7.3 + */ + protected void bindPropertyToField(final Object propertyId, + final Property property, final Field field) { + // check if field has a property that is Viewer set. In that case we + // expect developer has e.g. PropertyFormatter that he wishes to use and + // assign the property to the Viewer instead. + boolean hasFilterProperty = field.getPropertyDataSource() != null + && (field.getPropertyDataSource() instanceof Property.Viewer); + if (hasFilterProperty) { + ((Property.Viewer) field.getPropertyDataSource()) + .setPropertyDataSource(property); + } else { + field.setPropertyDataSource(property); + } + } + + /** * Gets the layout of the form. * * <p> diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index 5efb2545e0..b95d738157 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -3405,7 +3405,7 @@ public class Table extends AbstractSelect implements Action.Container, // Remember that we have made this association so we can remove // it when the component is removed associatedProperties.put(f, property); - f.setPropertyDataSource(property); + bindPropertyToField(rowId, colId, property, f); return f; } } @@ -3414,6 +3414,33 @@ public class Table extends AbstractSelect implements Action.Container, } /** + * Binds an item property to a field generated by TableFieldFactory. The + * default behavior is to bind property straight to Field. If + * Property.Viewer type property (e.g. PropertyFormatter) is already set for + * field, the property is bound to that Property.Viewer. + * + * @param rowId + * @param colId + * @param property + * @param field + * @since 6.7.3 + */ + protected void bindPropertyToField(Object rowId, Object colId, + Property property, Field field) { + // check if field has a property that is Viewer set. In that case we + // expect developer has e.g. PropertyFormatter that he wishes to use and + // assign the property to the Viewer instead. + boolean hasFilterProperty = field.getPropertyDataSource() != null + && (field.getPropertyDataSource() instanceof Property.Viewer); + if (hasFilterProperty) { + ((Property.Viewer) field.getPropertyDataSource()) + .setPropertyDataSource(property); + } else { + field.setPropertyDataSource(property); + } + } + + /** * Formats table cell property values. By default the property.toString() * and return a empty string for null properties. * @@ -3775,8 +3802,8 @@ public class Table extends AbstractSelect implements Action.Container, * <p> * Note, that some due to historical reasons the name of the method is bit * misleading. Some items may be partly or totally out of the viewport of - * the table's scrollable area. Actully detecting rows which can be actually - * seen by the end user may be problematic due to the client server + * the table's scrollable area. Actually detecting rows which can be + * actually seen by the end user may be problematic due to the client server * architecture. Using {@link #getCurrentPageFirstItemId()} combined with * {@link #getPageLength()} may produce good enough estimates in some * situations. @@ -4507,19 +4534,14 @@ public class Table extends AbstractSelect implements Action.Container, * com.vaadin.event.dd.acceptcriteria.AcceptCriterion#accepts(com.vaadin * .event.dd.DragAndDropEvent) */ + @SuppressWarnings("unchecked") public boolean accept(DragAndDropEvent dragEvent) { AbstractSelectTargetDetails dropTargetData = (AbstractSelectTargetDetails) dragEvent .getTargetDetails(); table = (Table) dragEvent.getTargetDetails().getTarget(); - ArrayList<Object> visibleItemIds = new ArrayList<Object>( - table.getPageLength()); - visibleItemIds.size(); - Object id = table.getCurrentPageFirstItemId(); - for (int i = 0; i < table.getPageLength() && id != null; i++) { - visibleItemIds.add(id); - id = table.nextItemId(id); - } - allowedItemIds = getAllowedItemIds(dragEvent, table, visibleItemIds); + Collection<?> visibleItemIds = table.getVisibleItemIds(); + allowedItemIds = getAllowedItemIds(dragEvent, table, + (Collection<Object>) visibleItemIds); return allowedItemIds.contains(dropTargetData.getItemIdOver()); } diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 2f10394ee0..c96c93bbe4 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -2,6 +2,9 @@ <project name="Vaadin Integration Tests" basedir="." default="integration-test-all">
+ <!-- Import common targets -->
+ <import file="../build/common.xml" />
+
<!-- Target deploying demo.war -->
<fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run"/>
@@ -27,14 +30,7 @@ <property name="ant.hub" value="${test.integration.antfile}" />
<property name="user" value="${test.integration.user}" />
<property name="passphrase" value="" />
-
- <!-- add ant contrib -->
- <taskdef resource="net/sf/antcontrib/antcontrib.properties">
- <classpath>
- <pathelement location="../build/lib/ant-contrib-1.0b3.jar"/>
- </classpath>
- </taskdef>
-
+
<!-- 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}" />
@@ -261,7 +257,7 @@ </target>
<!-- Upload demo, clean error screenshots and test deployment on all servers -->
- <target name="integration-test-all">
+ <target name="integration-test-all" depends="common.init-deps">
<parallel>
<trycatch property="tried">
diff --git a/tests/ivy.xml b/tests/ivy.xml new file mode 100644 index 0000000000..6c7171166b --- /dev/null +++ b/tests/ivy.xml @@ -0,0 +1,16 @@ +<ivy-module version="2.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd"> + + <info organisation="com.vaadin" module="tests"/> + <configurations> + <conf name="jetty" visibility="private" /> + <conf name="emma" visibility="private" /> + <conf name="server" visibility="private" /> + </configurations> + <publications /> + <dependencies> + <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.7" conf="server,jetty->default(*)" /> + <dependency org="emma" name="emma" rev="2.0.5312-patched" conf="server,emma -> default(*)"/> + </dependencies> +</ivy-module>
\ No newline at end of file diff --git a/tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java b/tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java new file mode 100644 index 0000000000..91e36b5caa --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java @@ -0,0 +1,69 @@ +package com.vaadin.tests.server; + +import java.util.Date; + +import junit.framework.TestCase; + +import org.junit.Test; + +import com.vaadin.data.util.ObjectProperty; +import com.vaadin.data.util.PropertyFormatter; + +@SuppressWarnings("unchecked") +public class TestPropertyFormatter extends TestCase { + + class TestFormatter extends PropertyFormatter { + + @Override + public String format(Object value) { + boolean isCorrectType = getExpectedClass().isAssignableFrom( + value.getClass()); + assertTrue(isCorrectType); + return "FOO"; + } + + @Override + public Object parse(String formattedValue) throws Exception { + return getExpectedClass().newInstance(); + } + }; + @SuppressWarnings("rawtypes") + private Class expectedClass; + + @SuppressWarnings("rawtypes") + private Class getExpectedClass() { + return expectedClass; + } + + /** + * The object passed to format should be same as property's type. + * @throws IllegalAccessException + * @throws InstantiationException + */ + @Test + @SuppressWarnings({ "rawtypes" }) + public void testCorrectTypeForFormat() throws InstantiationException, IllegalAccessException { + Class[] testedTypes = new Class[] {Integer.class, Boolean.class, Double.class, String.class, Date.class}; + Object[] testValues = new Object[] {new Integer(3), Boolean.FALSE, new Double(3.3), "bar", new Date()}; + + int i = 0; + for (Class class1 : testedTypes) { + expectedClass = class1; + + TestFormatter formatter = new TestFormatter(); + + // Should just return null, without formatting + Object value = formatter.getValue(); + + // test with property which value is null + formatter.setPropertyDataSource(new ObjectProperty(null, expectedClass)); + formatter.getValue(); // calls format + + // test with a value + formatter.setPropertyDataSource(new ObjectProperty(testValues[i++], expectedClass)); + formatter.getValue(); // calls format + } + + + } +} diff --git a/tests/test.xml b/tests/test.xml index e0f9f3af39..6b5e27bebf 100644 --- a/tests/test.xml +++ b/tests/test.xml @@ -1,6 +1,11 @@ <?xml version="1.0"?> - -<project 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"> + + <!-- Import common targets --> + <import file="../build/common.xml" /> + <!-- ================================================================== --> <!-- Configuration --> <!-- ================================================================== --> @@ -27,21 +32,19 @@ <property name="com.vaadin.testbench.debug" value="false"/> <!-- Temporary output directory, created and removed by this script --> - <!-- <property name="test-output-dir" value="../build/test-output" /> --> - <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" /> - <taskdef resource="net/sf/antcontrib/antlib.xml"> - <classpath> - <pathelement location="../build/lib/ant-contrib-1.0b3.jar" /> - </classpath> - </taskdef> - - <!-- classpath must include test bench jar and its dependencies --> - <path id="classpath"> - <fileset dir="${com.vaadin.testbench.lib.dir}" includes="**/*.jar" /> - <fileset dir="../build/lib" includes="emma*.jar" /> - </path> + + <target name="initialize" depends="common.init-deps"> + <ivy:resolve conf="emma"/> + <ivy:cachepath pathid="emma.lib" conf="emma" /> + <!-- classpath must include test bench jar and its dependencies --> + <path id="classpath"> + <fileset dir="${com.vaadin.testbench.lib.dir}" includes="**/*.jar" /> + <path refid="emma.lib" /> + </path> + </target> <!-- fileset containing all TestBench tests to run --> <fileset dir=".." id="html-test-files"> @@ -51,7 +54,7 @@ </fileset> <!-- This target converts HTML tests files to java junit tests. One test file for each browser is created. --> - <target name="create-tests" depends="remove-temp-testclasses" if="server.start.succeeded"> + <target name="create-tests" depends="initialize, remove-temp-testclasses"> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <java classname="com.vaadin.testbench.util.TestConverter" classpathref="classpath" fork="true"> @@ -68,51 +71,13 @@ <!-- This target complies the generated java junit tests. --> <target name="compile-tests" depends="create-tests"> <mkdir dir="${class-dir}" /> - <javac 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> </javac> </target> - - <!-- ================================================================== --> - <!-- Vaadin Server Management --> - <!-- ================================================================== --> - - <target name="server-start"> - <fail unless="output-dir" message="The 'output-dir' (usually build/result/vaadin-xxx) should be given to test script." /> - <fail unless="package.name" message="The 'package.name' property must be defined." /> - <fail unless="package.filename" message="The 'package.filename' property must be defined." /> - <fail unless="testing.testarea" message="The 'testing.testarea' property must be defined." /> - - <echo>Package name: ${package.name}</echo> - <echo>Package filename: ${package.filename}</echo> - <echo>Testing area: ${testing.testarea}</echo> - - <exec executable="python" searchpath="true" dir=".." resultproperty="server.start.result"> - <arg value="build/testing/vaadin-server.py" /> - <arg value="start" /> - <arg value="${package.name}" /> - <arg value="${package.filename}" /> - <arg value="${output-dir}" /> - <arg value="${testing.testarea}" /> - </exec> - - <condition property="server.start.succeeded"> - <equals arg1="${server.start.result}" arg2="0" /> - </condition> - </target> - - <target name="server-stop"> - <sleep seconds="5" /> - <exec executable="python" dir=".." searchpath="true" resultproperty="server.stop.result"> - <arg value="build/testing/vaadin-server.py" /> - <arg value="stop" /> - </exec> - <move file="${testing.testarea}/${package.name}/war.ec" todir="../build/result" failonerror="false" /> - </target> - <!-- ================================================================== --> <!-- Running Tests --> <!-- ================================================================== --> @@ -123,22 +88,22 @@ <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" if="server.start.succeeded"> + <target name="run-tests" depends="compile-tests"> <fileset dir="${test-output-dir}" id="tests-fileset"> <include name="**/**.java" /> </fileset> - - - <for threadCount="40" parallel="true" keepgoing="true" param="target"> + + <antcontrib:for threadCount="40" parallel="true" keepgoing="true" param="target"> <path> <fileset refid="tests-fileset" /> </path> <sequential> <antcall target="execute-tests"> <param name="target" value="@{target}" /> + <reference refid="classpath" /> </antcall> </sequential> - </for> + </antcontrib:for> </target> <!-- This target runs the generated and compiled junit tests --> @@ -198,11 +163,19 @@ <!-- ================================================================== --> <!-- The default target. --> - <target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tests" if="server.start.succeeded"> - </target> + <target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tests" /> <!-- Also starts the server. --> - <target name="test-package" depends="server-start, run-and-clean-up, server-stop"> - </target> - + <target name="test-package"> + <parallel> + <daemons> + <ant antfile="vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" /> + </daemons> + <sequential> + <ant antfile="vaadin-server.xml" target="wait-for-startup" /> + <antcall inheritall="true" inheritrefs="true" target="run-and-clean-up" /> + <move file="${testing.testarea}/${package.name}/war.ec" todir="../build/result" failonerror="false" /> + </sequential> + </parallel> + </target> </project> diff --git a/tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java b/tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java new file mode 100644 index 0000000000..116dd5bcc7 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java @@ -0,0 +1,90 @@ +package com.vaadin.tests.components.form;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.data.util.PropertyFormatter;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.DefaultFieldFactory;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.FormFieldFactory;
+
+public class FormWithPropertyFormatterConnected extends TestBase {
+ @Override
+ protected void setup() {
+ Form form2 = new Form();
+ form2.setFormFieldFactory(new FormFieldFactory() {
+
+ public Field createField(Item item, Object propertyId,
+ Component uiContext) {
+ AbstractField f = (AbstractField) DefaultFieldFactory.get()
+ .createField(item, propertyId, uiContext);
+ if (propertyId.equals("age")) {
+ f.setPropertyDataSource(new PropertyFormatter() {
+
+ @Override
+ public Object parse(String formattedValue)
+ throws Exception {
+ String str = formattedValue
+ .replaceAll("[^0-9.]", "");
+ if (formattedValue.toLowerCase().contains("months")) {
+ return Double.parseDouble(str) / 12;
+ }
+ return Double.parseDouble(str);
+ }
+
+ @Override
+ public String format(Object value) {
+ Double dValue = (Double) value;
+ if (dValue < 1) {
+ return ((int)(dValue * 12)) + " months";
+ }
+ return dValue + " years";
+ }
+ });
+ f.setImmediate(true);
+ }
+ return f;
+ }
+ });
+ form2.setItemDataSource(createItem());
+
+ addComponent(form2);
+ addComponent(new Button("B"));
+ }
+
+ private Item createItem() {
+ return new BeanItem<Person>(new Person(0.5));
+ }
+
+ public class Person {
+ public Person(double age) {
+ super();
+ this.age = age;
+ }
+
+ public double getAge() {
+ return age;
+ }
+
+ public void setAge(double age) {
+ this.age = age;
+ }
+
+ private double age;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "It should be possible to inject PropertyFormatter and similar classses to fields in form. The test app hooks formatter that displays age in years or months and also accepts value in both (years by default, months if mentioned in the field)";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html b/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html new file mode 100644 index 0000000000..2c3f651e41 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html @@ -0,0 +1,52 @@ +<?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>SubWindowWithUndefinedHeight</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">SubWindowWithUndefinedHeight</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.window.SubWindowWithUndefinedHeight?restartApplication</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowWithUndefinedHeight::/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>initial-tab1</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowWithUndefinedHeight::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> + <td>17,13</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>select-tab2</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowWithUndefinedHeight::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> + <td>8,9</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>select-tab1</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java b/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java new file mode 100644 index 0000000000..dbe5eda9af --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java @@ -0,0 +1,64 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Window; +import com.vaadin.ui.Button; +import com.vaadin.ui.Table; +import com.vaadin.ui.TabSheet; + +public class SubWindowWithUndefinedHeight extends TestBase { + + @Override + protected String getDescription() { + return "Setting subwindow height to undefined after initial rendering does not update visual height"; + } + + @Override + protected Integer getTicketNumber() { + return 7916; + } + + @Override + protected void setup() { + final Window subwindow = new Window("subwindow"); + subwindow.center(); + subwindow.setSizeUndefined(); + subwindow.getContent().setSizeUndefined(); + + final Button tabButton = new Button("A button"); + tabButton.setCaption("Tab 1"); + tabButton.setWidth("200px"); + + final Table table = new Table(); + table.setCaption("tab 2"); + table.setWidth("100%"); + table.setHeight("100%"); + + final TabSheet tabsheet = new TabSheet(); + tabsheet.addComponent(tabButton); + tabsheet.addComponent(table); + tabsheet.addListener(new TabSheet.SelectedTabChangeListener() { + public void selectedTabChange( + TabSheet.SelectedTabChangeEvent event) { + if (tabsheet.getSelectedTab() == tabButton) { + tabsheet.setSizeUndefined(); + subwindow.getContent().setSizeUndefined(); + subwindow.setSizeUndefined(); + } else if (tabsheet.getSelectedTab() == table) { + subwindow.setWidth("500px"); + subwindow.setHeight("500px"); + subwindow.getContent().setSizeFull(); + tabsheet.setSizeFull(); + } + } + }); + subwindow.addComponent(tabsheet); + + Button button = new Button("click me", new Button.ClickListener() { + public void buttonClick(Button.ClickEvent event) { + getMainWindow().addWindow(subwindow); + } + }); + getMainWindow().addComponent(button); + } +} diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket20.java b/tests/testbench/com/vaadin/tests/tickets/Ticket20.java index 348720e030..f6d153ccaa 100644 --- a/tests/testbench/com/vaadin/tests/tickets/Ticket20.java +++ b/tests/testbench/com/vaadin/tests/tickets/Ticket20.java @@ -4,6 +4,7 @@ import com.vaadin.Application; import com.vaadin.data.Validator; import com.vaadin.data.util.MethodProperty; import com.vaadin.data.validator.CompositeValidator; +import com.vaadin.data.validator.CompositeValidator.CombinationMode; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Root; @@ -59,8 +60,7 @@ public class Ticket20 extends Application.LegacyApplication { } } }); - CompositeValidator v2 = new CompositeValidator( - CompositeValidator.MODE_OR, null); + CompositeValidator v2 = new CompositeValidator(CombinationMode.OR, null); v2.addValidator(v); v2.addValidator(new Validator() { diff --git a/tests/testbench/com/vaadin/tests/validation/TestValidators.java b/tests/testbench/com/vaadin/tests/validation/TestValidators.java index 23114393b2..9523ff96b0 100644 --- a/tests/testbench/com/vaadin/tests/validation/TestValidators.java +++ b/tests/testbench/com/vaadin/tests/validation/TestValidators.java @@ -8,6 +8,7 @@ import com.vaadin.data.validator.EmailValidator; import com.vaadin.data.validator.IntegerValidator; import com.vaadin.data.validator.RegexpValidator; import com.vaadin.data.validator.StringLengthValidator; +import com.vaadin.data.validator.CompositeValidator.CombinationMode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -97,7 +98,7 @@ public class TestValidators extends TestBase { tf = new TextField( "A field, must be a floating point number with 4-5 chars"); CompositeValidator cv = new CompositeValidator( - CompositeValidator.MODE_AND, + CombinationMode.AND, "The field must contain a floating point number with 4-5 characters"); cv.addValidator(new StringLengthValidator( "String length of '{0}' should be 4-5 characters", 4, 5, false)); @@ -109,7 +110,7 @@ public class TestValidators extends TestBase { tf = new TextField( "A field, must be a floating point number or 4-5 chars"); - cv = new CompositeValidator(CompositeValidator.MODE_OR, + cv = new CompositeValidator(CombinationMode.OR, "The field must contain a floating point or with 4-5 characters"); cv.addValidator(new StringLengthValidator( "String length of '{0}' should be 4-5 characters", 4, 5, false)); diff --git a/tests/vaadin-server.xml b/tests/vaadin-server.xml new file mode 100644 index 0000000000..d4d23581ec --- /dev/null +++ b/tests/vaadin-server.xml @@ -0,0 +1,55 @@ +<?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="."> + + <!-- Import common targets --> + <import file="../build/common.xml" /> + + <target name="check-params"> + <fail unless="output-dir" message="The 'output-dir' (usually build/result/vaadin-xxx) should be given to test script." /> + <fail unless="package.name" message="The 'package.name' property must be defined." /> + <fail unless="package.filename" message="The 'package.filename' property must be defined." /> + <fail unless="testing.testarea" message="The 'testing.testarea' property must be defined." /> + <property name="webroot" value="${testing.testarea}/${package.name}/WebContent" /> + </target> + + <target name="prepare-testing-area" depends="check-params"> + <echo> Package name: ${package.name}</echo> + <echo> Package filename: ${package.filename}</echo> + <echo> Testing area: ${testing.testarea}</echo> + <echo> test-output-dir: ${test-output-dir}</echo> + + <delete dir="${testing.testarea}/${package.name}" /> + <mkdir dir="${testing.testarea}/${package.name}/WebContent" /> + <echo>Extracting Vaadin package ${package.filename} to testing area ${testing.testarea}</echo> + <unzip src="${package.filename}" dest="${testing.testarea}/${package.name}/WebContent" /> + </target> + + <target name="deploy-and-start" depends="init-deps, prepare-testing-area"> + <property name="webroot" value="${testing.testarea}/${package.name}/WebContent"></property> + + <ivy:resolve file="ivy.xml"/> + <ivy:cachepath pathid="server" conf="server" /> + <java classname="com.vaadin.launcher.DemoLauncher" fork="yes" dir="${testing.testarea}/${package.name}" resultproperty="server.start.result"> + <arg value="--nogui=1" /> + <classpath> + <path location="${webroot}/WEB-INF/classes" /> + <fileset dir="${webroot}/WEB-INF/lib/" includes="*.jar" /> + <path refid="server" /> + </classpath> + <jvmarg value="-Demma.coverage.out.file=${testing.testarea}/${package.name}/war.ec"/> + <jvmarg value="-Djava.awt.headless=true"/> + </java> + </target> + + <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"> + <http url="http://localhost:8888"/> + </waitfor> + <fail if="server.start.failed" message="Server startup failed" /> + </target> + +</project> |