Browse Source

Merge remote branch 'origin/master' into windowing

tags/7.0.0.alpha1
Leif Åstrand 12 years ago
parent
commit
d4be34e7bf
35 changed files with 911 additions and 455 deletions
  1. 1
    2
      .gitignore
  2. 0
    5
      WebContent/VAADIN/themes/base/progressindicator/progressindicator.css
  3. 0
    4
      WebContent/VAADIN/themes/base/splitpanel/splitpanel.css
  4. 0
    4
      WebContent/VAADIN/themes/runo/splitpanel/splitpanel.css
  5. 1
    1
      build/bin/package-diff.py
  6. 53
    91
      build/build.xml
  7. 55
    0
      build/common.xml
  8. 13
    0
      build/ivy/buildhelpers-ivy.xml
  9. 43
    0
      build/ivy/ivy.xml
  10. 24
    0
      build/ivy/ivysettings.xml
  11. 38
    0
      build/ivy/module/smartsprites-ivy-0.2.3-itmill.xml
  12. 11
    18
      src/com/vaadin/data/Buffered.java
  13. 3
    3
      src/com/vaadin/data/Validator.java
  14. 12
    8
      src/com/vaadin/data/util/PropertyFormatter.java
  15. 38
    33
      src/com/vaadin/data/validator/CompositeValidator.java
  16. 7
    19
      src/com/vaadin/terminal/CompositeErrorMessage.java
  17. 72
    11
      src/com/vaadin/terminal/ErrorMessage.java
  18. 0
    54
      src/com/vaadin/terminal/Sizeable.java
  19. 3
    3
      src/com/vaadin/terminal/SystemError.java
  20. 42
    48
      src/com/vaadin/terminal/UserError.java
  21. 8
    0
      src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
  22. 30
    18
      src/com/vaadin/terminal/gwt/client/ui/VWindow.java
  23. 0
    40
      src/com/vaadin/ui/AbstractComponent.java
  24. 28
    2
      src/com/vaadin/ui/Form.java
  25. 34
    12
      src/com/vaadin/ui/Table.java
  26. 5
    9
      tests/integration_tests.xml
  27. 16
    0
      tests/ivy.xml
  28. 69
    0
      tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java
  29. 39
    66
      tests/test.xml
  30. 90
    0
      tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java
  31. 52
    0
      tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html
  32. 64
    0
      tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java
  33. 2
    2
      tests/testbench/com/vaadin/tests/tickets/Ticket20.java
  34. 3
    2
      tests/testbench/com/vaadin/tests/validation/TestValidators.java
  35. 55
    0
      tests/vaadin-server.xml

+ 1
- 2
.gitignore View File

@@ -48,6 +48,5 @@
/build/test-output
/build/integration-test-output

# /build/buildhelpers/com/vaadin/buildhelpers/
/build/buildhelpers/com/vaadin/buildhelpers/*.class
# /bin/
/bin

+ 0
- 5
WebContent/VAADIN/themes/base/progressindicator/progressindicator.css View File

@@ -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;
}

+ 0
- 4
WebContent/VAADIN/themes/base/splitpanel/splitpanel.css View File

@@ -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;

+ 0
- 4
WebContent/VAADIN/themes/runo/splitpanel/splitpanel.css View File

@@ -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;

+ 1
- 1
build/bin/package-diff.py View File

@@ -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)

+ 53
- 91
build/build.xml View File

@@ -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>

+ 55
- 0
build/common.xml View File

@@ -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>

+ 13
- 0
build/ivy/buildhelpers-ivy.xml View File

@@ -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>

+ 43
- 0
build/ivy/ivy.xml View File

@@ -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>

+ 24
- 0
build/ivy/ivysettings.xml View File

@@ -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>

+ 38
- 0
build/ivy/module/smartsprites-ivy-0.2.3-itmill.xml View File

@@ -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>

+ 11
- 18
src/com/vaadin/data/Buffered.java View File

@@ -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++) {

+ 3
- 3
src/com/vaadin/data/Validator.java View File

@@ -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();

+ 12
- 8
src/com/vaadin/data/util/PropertyFormatter.java View File

@@ -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);
}
}
}

+ 38
- 33
src/com/vaadin/data/validator/CompositeValidator.java View File

@@ -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;
}

+ 7
- 19
src/com/vaadin/terminal/CompositeErrorMessage.java View File

@@ -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

+ 72
- 11
src/com/vaadin/terminal/ErrorMessage.java View File

@@ -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

+ 0
- 54
src/com/vaadin/terminal/Sizeable.java View File

@@ -92,21 +92,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).
@@ -115,21 +100,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.
*
@@ -137,18 +107,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.
*
@@ -156,18 +114,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.
*

+ 3
- 3
src/com/vaadin/terminal/SystemError.java View File

@@ -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();


+ 42
- 48
src/com/vaadin/terminal/UserError.java View File

@@ -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");
}


+ 8
- 0
src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java View File

@@ -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)) {

+ 30
- 18
src/com/vaadin/terminal/gwt/client/ui/VWindow.java View File

@@ -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;

+ 0
- 40
src/com/vaadin/ui/AbstractComponent.java View File

@@ -1319,26 +1319,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
return widthUnit;
}

/*
* (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)
*
@@ -1371,26 +1351,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
setHeight(-1, UNITS_PIXELS);
}

/*
* (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)
*

+ 28
- 2
src/com/vaadin/ui/Form.java View File

@@ -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,13 +755,39 @@ 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);
}
}
}
}

/**
* 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.
*

+ 34
- 12
src/com/vaadin/ui/Table.java View File

@@ -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;
}
}
@@ -3413,6 +3413,33 @@ public class Table extends AbstractSelect implements Action.Container,
return formatPropertyValue(rowId, colId, property);
}

/**
* 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());
}

+ 5
- 9
tests/integration_tests.xml View File

@@ -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">

+ 16
- 0
tests/ivy.xml View File

@@ -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>

+ 69
- 0
tests/server-side/com/vaadin/tests/server/TestPropertyFormatter.java View File

@@ -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
}

}
}

+ 39
- 66
tests/test.xml View File

@@ -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>

+ 90
- 0
tests/testbench/com/vaadin/tests/components/form/FormWithPropertyFormatterConnected.java View File

@@ -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;
}
}

+ 52
- 0
tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.html View File

@@ -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>

+ 64
- 0
tests/testbench/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java View File

@@ -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);
}
}

+ 2
- 2
tests/testbench/com/vaadin/tests/tickets/Ticket20.java View File

@@ -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() {


+ 3
- 2
tests/testbench/com/vaadin/tests/validation/TestValidators.java View File

@@ -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));

+ 55
- 0
tests/vaadin-server.xml View File

@@ -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>

Loading…
Cancel
Save