Conflicts: WebContent/VAADIN/themes/base/table/table.css WebContent/release-notes.html build/build.xml src/com/vaadin/terminal/gwt/client/ApplicationConnection.java src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java src/com/vaadin/terminal/gwt/client/ui/VSlider.java src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java src/com/vaadin/terminal/gwt/client/ui/VWindow.java src/com/vaadin/ui/Table.java tests/integration_tests.xml tests/test.xml tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.javatags/7.0.0.alpha2
@@ -60,6 +60,9 @@ | |||
.v-datefield-calendarpanel-day-focused { | |||
outline: 1px dotted black; | |||
} | |||
.v-datefield-calendarpanel-day-offmonth { | |||
color: #666; | |||
} | |||
.v-datefield-time { | |||
white-space: nowrap; |
@@ -49,6 +49,12 @@ | |||
cursor: pointer; | |||
} | |||
.v-table.v-disabled .v-table-header-cell, | |||
.v-table.v-disabled .v-table-header-cell-asc, | |||
.v-table.v-disabled .v-table-header-cell-desc { | |||
cursor: default; | |||
} | |||
.v-table-footer-wrap { | |||
overflow: hidden; | |||
border: 1px solid #aaa; | |||
@@ -85,6 +91,9 @@ | |||
width: 1px; | |||
overflow: hidden; | |||
} | |||
.v-table.v-disabled .v-table-resizer { | |||
cursor: default; | |||
} | |||
.v-table-caption-container { | |||
overflow: hidden; | |||
white-space: nowrap; | |||
@@ -174,6 +183,9 @@ | |||
position: relative; /* hide this from IE, it works without it */ | |||
cursor: pointer; | |||
} | |||
.v-table.v-disabled .v-table-column-selector { | |||
cursor: default; | |||
} | |||
.v-table-focus-slot-left { | |||
border-left: 2px solid #999; | |||
float: none; |
@@ -88,7 +88,11 @@ | |||
padding: 0.2em 0.5em; | |||
} | |||
.v-tabsheet-tabitem .v-caption { | |||
cursor: pointer; | |||
cursor: inherit; | |||
} | |||
.v-tabsheet.v-disabled .v-tabsheet-tabitem, | |||
.v-tabsheet-tabitemcell-disabled .v-tabsheet-tabitem { | |||
cursor: default; | |||
} | |||
.v-tabsheet-tabitem-selected { | |||
cursor: default; |
@@ -2,6 +2,7 @@ | |||
text-align: left /* Force default alignment */ | |||
} | |||
.v-textarea { | |||
resize: none; | |||
} | |||
.v-textfield-focus, | |||
.v-textarea-focus { |
@@ -2,10 +2,15 @@ | |||
background: #fff; | |||
} | |||
.v-window-outerheader { | |||
cursor: move; | |||
padding: 0.3em 1em; | |||
height: 1em; | |||
} | |||
.v-window-outerheader, | |||
.v-window-draggingCurtain { | |||
cursor: move; | |||
} | |||
.v-window-header { | |||
font-weight: bold; | |||
} | |||
@@ -37,16 +42,22 @@ div.v-window-header { | |||
zoom: 1; | |||
height: 10px; | |||
position: relative; | |||
cursor: move; | |||
} | |||
.v-window-resizebox { | |||
width: 10px; | |||
height: 10px; | |||
cursor: se-resize; | |||
background: #ddd; | |||
overflow: hidden; | |||
position: absolute; | |||
right: 0; | |||
} | |||
.v-window-resizebox, | |||
.v-window-resizingCurtain { | |||
cursor: se-resize; | |||
} | |||
.v-window div.v-window-footer-noresize { | |||
height: 0; | |||
} |
@@ -93,7 +93,6 @@ | |||
width: 16px; | |||
height: 14px; | |||
overflow: hidden; | |||
cursor: default; | |||
opacity: .5; | |||
filter: alpha(opacity=50); | |||
} |
@@ -1,4 +1,29 @@ | |||
@import url(../reindeer/styles.css); | |||
.table-equal-rowheight .v-table-row {height: 30px;} | |||
.table-equal-rowheight .v-table-row-odd {height: 30px;} | |||
.table-equal-rowheight .v-table-row-odd {height: 30px;} | |||
.v-datefield-enabled-readonly-styled { | |||
background: #ddd; | |||
} | |||
.v-datefield-enabled-readonly-styled input.v-datefield-textfield { | |||
border: 1px solid black; | |||
} | |||
.v-datefield-enabled-readonly-styled .v-datefield.v-disabled { | |||
opacity: 1; | |||
} | |||
.v-disabled.v-datefield-enabled-readonly-styled .v-datefield-button, | |||
.v-readonly.v-datefield-enabled-readonly-styled .v-datefield-button { | |||
display: none; | |||
} | |||
.popup-style .v-datefield-calendarpanel-header, | |||
.v-datefield-popup-popup-style .v-datefield-calendarpanel-time { | |||
background: red; | |||
} | |||
.popup-style .v-datefield-calendarpanel-body { | |||
background: yellow; | |||
} |
@@ -24,7 +24,6 @@ | |||
width: 18px; | |||
height: 17px; | |||
overflow: hidden; | |||
cursor: default; | |||
} | |||
.v-tabsheet-scroller button::-moz-focus-inner { | |||
border: none; |
@@ -2,7 +2,7 @@ result-path=build/result | |||
checkout-path=build/checkout | |||
product-file=vaadin | |||
product-name=Vaadin | |||
toolkit-package=com/vaadin | |||
vaadin-package=com/vaadin | |||
gwt-dir=lib/core/gwt | |||
# repository into which Maven snapshots should be published |
@@ -32,13 +32,30 @@ | |||
</target> | |||
<!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - --> | |||
<target name="clean-result" depends=""> | |||
<property file="build/build.properties" /> | |||
<target name="clean-result" depends="build.properties"> | |||
<!-- Clean build result directory. --> | |||
<delete dir="${result-path}" includes="**/*" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false"/> | |||
</target> | |||
<target name="build.properties"> | |||
<property file="build/build.properties" /> | |||
<property file="build/VERSION.properties" /> | |||
<property file="build/GWT-VERSION.properties" /> | |||
<!-- result source and classes folders --> | |||
<property name="result-src-core" value="${result-path}/src/core"/> | |||
<property name="result-src-junit" value="${result-path}/src/junit"/> | |||
<property name="result-src-testbench" value="${result-path}/src/testbench"/> | |||
<property name="result-classes-core" value="${result-path}/classes/core"/> | |||
<property name="result-classes-junit" value="${result-path}/classes/junit"/> | |||
<property name="result-classes-testbench" value="${result-path}/classes/testbench"/> | |||
<!-- Folder where Emma instrumented classes are placed (if Emma is used)--> | |||
<property name="result-classes-core-for-emma-war" value="${result-path}/classes/emma-war"/> | |||
<property name="result-classes-core-for-emma-junit" value="${result-path}/classes/emma-junit"/> | |||
</target> | |||
<target name="clean-all" depends="clean-result"> | |||
</target> | |||
@@ -62,7 +79,7 @@ | |||
<!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |||
<!-- ================================================================== --> | |||
<target name="init" depends="init-deps"> | |||
<target name="init" depends="init-deps, build.properties"> | |||
<!-- Current timestamp in different formats. --> | |||
<tstamp> | |||
<format property="build.date" pattern="yyyy-MM-dd"/> | |||
@@ -71,9 +88,6 @@ | |||
<format property="build.date.compact" pattern="yyyyMMdd"/> | |||
</tstamp> | |||
<property file="build/VERSION.properties" /> | |||
<property file="build/GWT-VERSION.properties" /> | |||
<antcontrib:propertyregex property="version.major" input="${version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\1"/> | |||
<antcontrib:propertyregex property="version.minor" input="${version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\2"/> | |||
<antcontrib:propertyregex property="version.revision" input="${version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\3"/> | |||
@@ -85,17 +99,16 @@ | |||
<echo>Full Version: ${version.full}</echo> | |||
<!-- Other properties --> | |||
<property file="build/build.properties" /> | |||
<property file="build/html-style.properties" /> | |||
<echo>Vaadin package is: ${toolkit-package}</echo> | |||
<echo>Vaadin package is: ${vaadin-package}</echo> | |||
<!-- Create result dir unless already exists --> | |||
<mkdir dir="${result-path}" /> | |||
<!-- Create dirs that might be used by the test coverage generation --> | |||
<mkdir dir="${result-path}/war_emma_classes" /> | |||
<mkdir dir="${result-path}/junit_emma_classes" /> | |||
<mkdir dir="${result-classes-core-for-emma-war}" /> | |||
<mkdir dir="${result-classes-core-for-emma-junit}" /> | |||
<mkdir dir="${result-path}/coverage" /> | |||
<echo>We are using gwt version ${gwt-version}.</echo> | |||
@@ -139,13 +152,17 @@ | |||
<echo>Adding test class files and resources and launcher configuration.</echo> | |||
<copy todir="${output-dir}/WebContent/WEB-INF/classes"> | |||
<fileset dir="${result-path}/classes"> | |||
<include name="${toolkit-package}/tests/**/*" /> | |||
<include name="${toolkit-package}/launcher/**" /> | |||
<fileset dir="${result-classes-testbench}"> | |||
<include name="${vaadin-package}/tests/**/*" /> | |||
<include name="${vaadin-package}/launcher/**" /> | |||
</fileset> | |||
<fileset dir="${result-classes-junit}"> | |||
<!-- VaadinClasses is used by both JUnit and TestBench tests --> | |||
<include name="**/VaadinClasses*.class" /> | |||
</fileset> | |||
<!-- test resources --> | |||
<fileset dir="tests/testbench"> | |||
<include name="${toolkit-package}/tests/**/*" /> | |||
<include name="${vaadin-package}/tests/**/*" /> | |||
<!-- Pre-processed versions of these copied above --> | |||
<exclude name="**/*.java" /> | |||
<exclude name="**/*.html" /> | |||
@@ -155,8 +172,8 @@ | |||
<!-- Include files required by the DemoLauncher/DevelopmentServerLauncher --> | |||
<fileset dir="tests/testbench"> | |||
<include name="${toolkit-package}/launcher/jetty-webdefault.xml" /> | |||
<include name="${toolkit-package}/launcher/keystore" /> | |||
<include name="${vaadin-package}/launcher/jetty-webdefault.xml" /> | |||
<include name="${vaadin-package}/launcher/keystore" /> | |||
</fileset> | |||
</copy> | |||
@@ -216,11 +233,11 @@ | |||
<!-- However, since compiling the server-side is required by the client-side --> | |||
<!-- compilation, the server-side will actually be built before it. --> | |||
<target name="build" | |||
depends="compile-server-side, compile-client-side, vaadin.jar, vaadin-sources.jar" | |||
depends="compile-server-side, compile-tests, compile-client-side, vaadin.jar, vaadin-sources.jar" | |||
description="Build package required files, without packing them."> | |||
</target> | |||
<target name="compile-server-side" depends="compile-java, webcontent"/> | |||
<target name="compile-server-side" depends="compile-core, webcontent"/> | |||
<!-- Copy and preprocess sources for packaging | |||
NOTE: Replaces <version></version> tags with build version tag for some "textual" files | |||
@@ -234,20 +251,25 @@ | |||
* tests/client-side (Client-side JUnit test cases) | |||
These are copied to | |||
* {$result-path}/src/core | |||
* {$result-path}/src/tests | |||
* {$result-path}/src/junit | |||
* ${result-path}/src/core | |||
* ${result-path}/src/tests | |||
* ${result-path}/src/junit | |||
And compiled to | |||
* ${result-path}/classes/core | |||
* ${result-path}/classes/tests | |||
* ${result-path}/classes/junit | |||
Java/HTML/CSS/XML files are filtered so the license is added and the version is set. | |||
Other files are just copied. | |||
--> | |||
<loadfile property="VaadinApache2LicenseForJavaFiles" srcFile="build/VaadinApache2LicenseForJavaFiles.txt" /> | |||
<mkdir dir="${result-path}/src" /> | |||
<mkdir dir="${result-path}/src/core" /> | |||
<mkdir dir="${result-path}/src/tests" /> | |||
<mkdir dir="${result-path}/src/junit" /> | |||
<mkdir dir="${result-path}/src" /> | |||
<mkdir dir="${result-src-core}" /> | |||
<mkdir dir="${result-src-testbench}" /> | |||
<mkdir dir="${result-src-junit}" /> | |||
<patternset id="preprocessable-files"> | |||
<include name="**/*.java" /> | |||
@@ -274,7 +296,7 @@ | |||
<echo>Copying src directory and processing copied files.</echo> | |||
<echo>Replacing <version> tag with build version for java/html/css/xml files.</echo> | |||
<copy todir="${result-path}/src/core" overwrite="yes"> | |||
<copy todir="${result-src-core}" overwrite="yes"> | |||
<filterset refid="version-and-license"/> | |||
<filterset refid="pre-css-style"/> | |||
<fileset dir="src"> | |||
@@ -282,13 +304,13 @@ | |||
</fileset> | |||
</copy> | |||
<copy todir="${result-path}/src/tests"> | |||
<copy todir="${result-src-testbench}"> | |||
<filterset refid="version-and-license"/> | |||
<fileset dir="tests/testbench"> | |||
<patternset refid="preprocessable-files" /> | |||
</fileset> | |||
</copy> | |||
<copy todir="${result-path}/src/junit"> | |||
<copy todir="${result-src-junit}"> | |||
<filterset refid="version-and-license"/> | |||
<fileset dir="tests/server-side"> | |||
<patternset refid="preprocessable-files" /> | |||
@@ -304,17 +326,17 @@ | |||
<!-- Add other files such as images, these are not filtered or processed by fixcrlf task --> | |||
<echo>Copying non java/html/css/xml files such as images.</echo> | |||
<copy todir="${result-path}/src/core"> | |||
<copy todir="${result-src-core}"> | |||
<fileset dir="src"> | |||
<patternset refid="non-preprocessable-files" /> | |||
</fileset> | |||
</copy> | |||
<copy todir="${result-path}/src/tests"> | |||
<copy todir="${result-src-testbench}"> | |||
<fileset dir="tests/testbench"> | |||
<patternset refid="non-preprocessable-files" /> | |||
</fileset> | |||
</copy> | |||
<copy todir="${result-path}/src/junit"> | |||
<copy todir="${result-src-junit}"> | |||
<fileset dir="tests/server-side"> | |||
<patternset refid="non-preprocessable-files" /> | |||
</fileset> | |||
@@ -331,12 +353,11 @@ | |||
<target name="webcontent" depends="preprocess-src,defaulttheme"> | |||
<!-- Add WebContent --> | |||
<echo>Adding VAADIN/themes and demo files.</echo> | |||
<echo>Adding VAADIN/themes and META-INF</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/**/*" /> | |||
@@ -379,27 +400,40 @@ | |||
</copy> | |||
</target> | |||
<target name="compile-java" depends="init, webcontent"> | |||
<target name="compile-core" depends="init, preprocess-src"> | |||
<echo>Compiling src (server-side)</echo> | |||
<!-- 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" 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"/> | |||
<!-- Compile core sources first as the other sources depend on these --> | |||
<mkdir dir="${result-classes-core}" /> | |||
<javac source="1.5" target="1.5" classpathref="compile.classpath.server-side" destdir="${result-classes-core}" debug="true" encoding="UTF-8" includeantruntime="false"> | |||
<src path="${result-src-core}"/> | |||
</javac> | |||
</target> | |||
<target name="compile-tests" depends="compile-core"> | |||
<echo>Compiling src (Server and client side JUnit tests)</echo> | |||
<!-- Compile server and client side JUnit tests --> | |||
<mkdir dir="${result-classes-junit}" /> | |||
<javac source="1.5" target="1.5" classpathref="compile.classpath.server-side" destdir="${result-classes-junit}" debug="true" encoding="UTF-8" includeantruntime="false"> | |||
<classpath path="${result-classes-core}"></classpath> | |||
<src path="${result-src-junit}"/> | |||
</javac> | |||
<echo>Compiling src (TestBench tests)</echo> | |||
<!-- Compile TestBench tests --> | |||
<mkdir dir="${result-classes-testbench}" /> | |||
<javac source="1.5" target="1.5" classpathref="compile.classpath.server-side" destdir="${result-classes-testbench}" debug="true" encoding="UTF-8" includeantruntime="false"> | |||
<classpath path="${result-classes-junit}"></classpath> | |||
<classpath path="${result-classes-core}"></classpath> | |||
<src path="${result-src-testbench}"/> | |||
</javac> | |||
</target> | |||
<target name="compile-helpers" depends="init"> | |||
<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" /> | |||
classpathref="buildhelpers.dependencies" destdir="${buildhelpers-classes}" debug="true" encoding="UTF-8" /> | |||
</target> | |||
<target name="defaulttheme" depends="init, compile-helpers"> | |||
@@ -441,8 +475,8 @@ | |||
</target> | |||
<!-- The widgetset generator is currently compiled along with rest of server-side Java. --> | |||
<target name="compile-widgetset-generator" depends="init, preprocess-src, compile-java"/> | |||
<target name="compile-widgetset-generator" depends="compile-core"/> | |||
<target name="compile-widgetset" depends="init-deps" description="Compiles the widgetset given as the first parameter"> | |||
<fail unless="widgetset" message="No widgetset parameter set"/> | |||
<property name="widgetset-style" value="OBF" /> | |||
@@ -500,12 +534,7 @@ | |||
</target> | |||
<!-- Definitions for building local components, i.e., not for an installation package. --> | |||
<target name="init-nonpackage"> | |||
<property file="build/VERSION.properties" /> | |||
<property file="build/GWT-VERSION.properties" /> | |||
<property file="build/build.properties" /> | |||
<target name="init-nonpackage" depends="build.properties"> | |||
<!-- Definitions for building the client-side. --> | |||
<property name="widgetsets-output-dir" value="WebContent/VAADIN/widgetsets" /> | |||
@@ -537,18 +566,14 @@ | |||
<echo file="${output-dir}/META-INF/GWT-VERSION">${gwt-version}</echo> | |||
<emma enabled="${emma.enabled}" > | |||
<instr instrpath="${result-path}/classes" | |||
destdir="${result-path}/war_emma_classes" | |||
<instr instrpath="${result-classes-core}" | |||
destdir="${result-classes-core-for-emma-war}" | |||
mode="copy" | |||
metadatafile="${result-path}/war.es" | |||
merge="false" | |||
> | |||
<filter includes="com.vaadin.*" /> | |||
<filter excludes="com.vaadin.terminal.gwt.*" /> | |||
<filter excludes="com.vaadin.tests.*" /> | |||
<filter excludes="*Test*" /> | |||
<filter excludes="com.vaadin.launcher.*" /> | |||
<filter excludes="com.vaadin.data.util.sqlcontainer.*" /> | |||
</instr> | |||
</emma> | |||
@@ -566,24 +591,10 @@ | |||
<attribute name="Bundle-Version" value="${version.full}" /> | |||
</manifest> | |||
<!-- Include any instrumented class files before the normal classes --> | |||
<fileset dir="${result-path}/war_emma_classes"> | |||
<patternset> | |||
<exclude name="${toolkit-package}/tests/**"/> | |||
<exclude name="${toolkit-package}/launcher/**" /> | |||
</patternset> | |||
</fileset> | |||
<fileset dir="${result-path}/classes"> | |||
<patternset> | |||
<exclude name="${toolkit-package}/tests/**"/> | |||
<exclude name="${toolkit-package}/launcher/**" /> | |||
</patternset> | |||
</fileset> | |||
<fileset dir="${result-classes-core-for-emma-war}" /> | |||
<fileset dir="${result-classes-core}"/> | |||
<!-- add sources --> | |||
<fileset dir="${result-path}/src/core"> | |||
<patternset> | |||
<exclude name="${toolkit-package}/launcher/**" /> | |||
</patternset> | |||
</fileset> | |||
<fileset dir="${result-src-core}"/> | |||
<fileset dir="${output-dir}/WebContent"> | |||
<patternset> | |||
<include name="VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/**/*" /> | |||
@@ -615,7 +626,7 @@ | |||
<target name="vaadin-sources.jar" depends="init"> | |||
<jar file="${result-path}/${lib-sources-jar-name}" compress="true"> | |||
<fileset dir="${result-path}/src/core"> | |||
<fileset dir="${result-src-core}"> | |||
<patternset> | |||
<include name="**/*.java" /> | |||
</patternset> | |||
@@ -641,10 +652,8 @@ | |||
<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"> | |||
<packageset dir="${result-path}/src/core"> | |||
<include name="${toolkit-package}/**" /> | |||
</packageset> | |||
<javadoc destdir="${javadoc.destdir}" author="true" version="true" use="true" windowtitle="${product-name}" classpathref="compile.classpath.client-side"> | |||
<packageset dir="${result-src-core}"/> | |||
<doctitle>${javadoc.doctitle}</doctitle> | |||
<!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> --> | |||
<bottom>${javadoc.bottom}</bottom> | |||
@@ -734,7 +743,7 @@ | |||
<!-- Initialize a nightly build. --> | |||
<target name="nightly-init"> | |||
<target name="nightly-init" depends="build.properties"> | |||
<!-- Mandatory parameters. --> | |||
<fail unless="build.number" message="The build.number property must be defined."/> | |||
@@ -743,8 +752,6 @@ | |||
<!-- Optional parameters. --> | |||
<property name="build.tag" value="dev"/> | |||
<property file="build/VERSION.properties" /> | |||
<echo>Base version: ${version}</echo> | |||
<echo>Build number: ${build.number}</echo> | |||
<echo>Build tag: ${build.tag}</echo> | |||
@@ -870,7 +877,7 @@ | |||
<!-- Automated tests. --> | |||
<!-- ================================================================== --> | |||
<target name="tests" depends="compile-java, internal-package-war"> | |||
<target name="tests" depends="compile-tests, internal-package-war"> | |||
<!-- Run all different types of tests in parallel to decrease testing time --> | |||
<parallel threadcount="3"> | |||
<sequential> | |||
@@ -890,7 +897,7 @@ | |||
<include name="*.em" /> | |||
</fileset> | |||
</merge> | |||
<report sourcepath="${result-path}/src/core" > | |||
<report sourcepath="${result-src-core}" > | |||
<fileset dir="${result-path}" > | |||
<include name="combined.es" /> | |||
</fileset> | |||
@@ -903,38 +910,34 @@ | |||
</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" depends="init-deps" unless="tests.serverside.skip"> | |||
<target name="server-side-tests" unless="tests.serverside.skip" depends="compile-tests"> | |||
<emma enabled="${emma.enabled}" > | |||
<instr instrpath="${result-path}/classes" | |||
<instr instrpath="${result-classes-core}" | |||
destdir="${result-classes-core-for-emma-junit}" | |||
mode="copy" | |||
destdir="${result-path}/junit_emma_classes" | |||
metadatafile="${result-path}/unittests.em" | |||
merge="false" | |||
> | |||
merge="false" | |||
> | |||
<filter includes="com.vaadin.*" /> | |||
<filter excludes="com.vaadin.tests.*" /> | |||
<filter excludes="com.vaadin.terminal.gwt.client.*" /> | |||
<filter excludes="com.vaadin.terminal.gwt.widgetsetutils.*" /> | |||
<filter excludes="*Test*" /> | |||
<filter excludes="com.vaadin.launcher.*" /> | |||
<filter excludes="com.vaadin.terminal.gwt.*" /> | |||
</instr> | |||
</emma> | |||
<junit printsummary="yes"> | |||
<classpath> | |||
<pathelement path="${result-path}/junit_emma_classes" /> | |||
<pathelement path="${result-path}/classes" /> | |||
<pathelement path="${result-classes-core-for-emma-junit}" /> | |||
<pathelement path="${result-classes-core}" /> | |||
<pathelement path="${result-classes-junit}" /> | |||
<path refid="test.runtime.classpath"></path> | |||
<path refid="compile.classpath"></path> | |||
</classpath> | |||
<jvmarg value="-Demma.coverage.out.file=../${result-path}/unittests.ec" /> | |||
<batchtest fork="yes"> | |||
<fileset dir="tests/server-side" includes="**/*.java" excludes="**/Abstract*.java,com/vaadin/tests/data/bean/*.java,com/vaadin/tests/util/*.java" /> | |||
<fileset dir="tests/server-side" includes="**/*.java" excludes="**/Abstract*.java,com/vaadin/tests/data/bean/*.java,com/vaadin/tests/util/*.java,**/VaadinClasses.java" /> | |||
<fileset dir="tests/client-side" includes="**/*.java" excludes="**/Abstract*.java" /> | |||
</batchtest> | |||
</junit> | |||
<emma enabled="${emma.enabled}" > | |||
<report sourcepath="${result-path}/src/core" > | |||
<report sourcepath="${result-src-core}" > | |||
<fileset dir="${result-path}" > | |||
<include name="unittests.*" /> | |||
</fileset> | |||
@@ -989,7 +992,7 @@ | |||
</ant> | |||
<emma enabled="${emma.enabled}" > | |||
<report sourcepath="${result-path}/src/core" > | |||
<report sourcepath="${result-src-core}" > | |||
<fileset dir="${result-path}" > | |||
<include name="war.*" /> | |||
</fileset> |
@@ -22,6 +22,8 @@ import com.google.gwt.http.client.RequestBuilder; | |||
import com.google.gwt.http.client.RequestCallback; | |||
import com.google.gwt.http.client.RequestException; | |||
import com.google.gwt.http.client.Response; | |||
import com.google.gwt.regexp.shared.MatchResult; | |||
import com.google.gwt.regexp.shared.RegExp; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
@@ -101,6 +103,27 @@ public class ApplicationConnection { | |||
public static final String ATTRIBUTE_DESCRIPTION = "description"; | |||
public static final String ATTRIBUTE_ERROR = "error"; | |||
/** | |||
* A string that, if found in a non-JSON response to a UIDL request, will | |||
* cause the browser to refresh the page. If followed by a colon, optional | |||
* whitespace, and a URI, causes the browser to synchronously load the URI. | |||
* | |||
* <p> | |||
* This allows, for instance, a servlet filter to redirect the application | |||
* to a custom login page when the session expires. For example: | |||
* </p> | |||
* | |||
* <pre> | |||
* if (sessionExpired) { | |||
* response.setHeader("Content-Type", "text/html"); | |||
* response.getWriter().write( | |||
* myLoginPageHtml + "<!-- Vaadin-Refresh: " | |||
* + request.getContextPath() + " -->"); | |||
* } | |||
* </pre> | |||
*/ | |||
public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh"; | |||
// will hold the UIDL security key (for XSS protection) once received | |||
private String uidlSecurityKey = "init"; | |||
@@ -525,6 +548,25 @@ public class ApplicationConnection { | |||
return; | |||
} | |||
String contentType = response.getHeader("Content-Type"); | |||
if (contentType == null | |||
|| !contentType.startsWith("application/json")) { | |||
/* | |||
* A servlet filter or equivalent may have intercepted | |||
* the request and served non-UIDL content (for | |||
* instance, a login page if the session has expired.) | |||
* If the response contains a magic substring, do a | |||
* synchronous refresh. See #8241. | |||
*/ | |||
MatchResult refreshToken = RegExp.compile( | |||
UIDL_REFRESH_TOKEN + "(:\\s*(.*?))?(\\s|$)") | |||
.exec(response.getText()); | |||
if (refreshToken != null) { | |||
redirect(refreshToken.getGroup(2)); | |||
return; | |||
} | |||
} | |||
// for(;;);[realjson] | |||
final String jsonText = response.getText().substring(9, | |||
response.getText().length() - 1); | |||
@@ -1651,9 +1693,68 @@ public class ApplicationConnection { | |||
fw.setEnabled(enabled); | |||
} | |||
// Style names | |||
component.setStyleName(getStyleName(component.getStylePrimaryName(), | |||
uidl, component instanceof Field)); | |||
TooltipInfo tooltipInfo = paintableMap.getTooltipInfo(paintable, null); | |||
// Update tooltip | |||
if (uidl.hasAttribute(ATTRIBUTE_DESCRIPTION)) { | |||
tooltipInfo | |||
.setTitle(uidl.getStringAttribute(ATTRIBUTE_DESCRIPTION)); | |||
} else { | |||
tooltipInfo.setTitle(null); | |||
} | |||
// Set captions | |||
if (manageCaption) { | |||
final Container parent = Util.getLayout(component); | |||
if (parent != null) { | |||
parent.updateCaption(paintable, uidl); | |||
} | |||
} | |||
// add error classname to components w/ error | |||
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { | |||
tooltipInfo.setErrorUidl(uidl.getErrors()); | |||
} else { | |||
tooltipInfo.setErrorUidl(null); | |||
} | |||
// Set captions | |||
if (manageCaption) { | |||
final Container parent = Util.getLayout(component); | |||
if (parent != null) { | |||
parent.updateCaption(paintable, uidl); | |||
} | |||
} | |||
/* | |||
* updateComponentSize need to be after caption update so caption can be | |||
* taken into account | |||
*/ | |||
updateComponentSize(paintable, uidl); | |||
return false; | |||
} | |||
/** | |||
* Generates the style name for the widget based on the given primary style | |||
* name (typically returned by Widget.getPrimaryStyleName()) and the UIDL. | |||
* An additional "modified" style name can be added if the field parameter | |||
* is set to true. | |||
* | |||
* @param primaryStyleName | |||
* @param uidl | |||
* @param isField | |||
* @return | |||
*/ | |||
public static String getStyleName(String primaryStyleName, UIDL uidl, | |||
boolean field) { | |||
boolean enabled = !uidl.getBooleanAttribute("disabled"); | |||
StringBuffer styleBuf = new StringBuffer(); | |||
final String primaryName = component.getStylePrimaryName(); | |||
styleBuf.append(primaryName); | |||
styleBuf.append(primaryStyleName); | |||
// first disabling and read-only status | |||
if (!enabled) { | |||
@@ -1671,7 +1772,7 @@ public class ApplicationConnection { | |||
final String[] styles = uidl.getStringAttribute("style").split(" "); | |||
for (int i = 0; i < styles.length; i++) { | |||
styleBuf.append(" "); | |||
styleBuf.append(primaryName); | |||
styleBuf.append(primaryStyleName); | |||
styleBuf.append("-"); | |||
styleBuf.append(styles[i]); | |||
styleBuf.append(" "); | |||
@@ -1680,55 +1781,25 @@ public class ApplicationConnection { | |||
} | |||
// add modified classname to Fields | |||
if (uidl.hasAttribute("modified") && component instanceof Field) { | |||
if (field && uidl.hasAttribute("modified")) { | |||
styleBuf.append(" "); | |||
styleBuf.append(MODIFIED_CLASSNAME); | |||
} | |||
TooltipInfo tooltipInfo = paintableMap.getTooltipInfo(paintable, null); | |||
// Update tooltip | |||
if (uidl.hasAttribute(ATTRIBUTE_DESCRIPTION)) { | |||
tooltipInfo | |||
.setTitle(uidl.getStringAttribute(ATTRIBUTE_DESCRIPTION)); | |||
} else { | |||
tooltipInfo.setTitle(null); | |||
} | |||
// add error classname to components w/ error | |||
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { | |||
tooltipInfo.setErrorUidl(uidl.getErrors()); | |||
styleBuf.append(" "); | |||
styleBuf.append(primaryName); | |||
styleBuf.append(primaryStyleName); | |||
styleBuf.append(ERROR_CLASSNAME_EXT); | |||
} else { | |||
tooltipInfo.setErrorUidl(null); | |||
} | |||
// add required style to required components | |||
if (uidl.hasAttribute("required")) { | |||
styleBuf.append(" "); | |||
styleBuf.append(primaryName); | |||
styleBuf.append(primaryStyleName); | |||
styleBuf.append(REQUIRED_CLASSNAME_EXT); | |||
} | |||
// Styles + disabled & readonly | |||
component.setStyleName(styleBuf.toString()); | |||
// Set captions | |||
if (manageCaption) { | |||
final Container parent = Util.getLayout(component); | |||
if (parent != null) { | |||
parent.updateCaption(paintable, uidl); | |||
} | |||
} | |||
/* | |||
* updateComponentSize need to be after caption update so caption can be | |||
* taken into account | |||
*/ | |||
updateComponentSize(paintable, uidl); | |||
return false; | |||
return styleBuf.toString(); | |||
} | |||
private void updateComponentSize(VPaintableWidget paintable, UIDL uidl) { |
@@ -964,6 +964,8 @@ public class Util { | |||
VConsole.log("\t\t" + var[1] + " (" + var[2] + ")" + " : " | |||
+ var[0]); | |||
} | |||
} else { | |||
VConsole.log("\t" + id + ": Warning: no corresponding paintable!"); | |||
} | |||
} | |||
@@ -734,8 +734,10 @@ public class VDebugConsole extends VOverlay implements Console { | |||
forceLayout.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
// TODO for each client in appconf force layout | |||
// VDebugConsole.this.client.forceLayout(); | |||
for (ApplicationConnection applicationConnection : ApplicationConfiguration | |||
.getRunningApplications()) { | |||
applicationConnection.forceLayout(); | |||
} | |||
} | |||
}); | |||
@@ -104,6 +104,8 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
private static final String CN_SELECTED = "selected"; | |||
private static final String CN_OFFMONTH = "offmonth"; | |||
/** | |||
* Represents a click handler for when a user selects a value by using the | |||
* mouse | |||
@@ -118,7 +120,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
*/ | |||
public void onClick(ClickEvent event) { | |||
Day day = (Day) event.getSource(); | |||
focusDay(day.getDay()); | |||
focusDay(day.getDate()); | |||
selectFocused(); | |||
onSubmit(); | |||
} | |||
@@ -152,6 +154,8 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
private boolean showISOWeekNumbers; | |||
private Date displayedMonth; | |||
private Date focusedDate; | |||
private Day selectedDay; | |||
@@ -191,18 +195,18 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
* Sets the focus to given day of current time. Used when moving in the | |||
* calender with the keyboard. | |||
* | |||
* @param day | |||
* @param date | |||
* The day number from by Date.getDate() | |||
*/ | |||
private void focusDay(int day) { | |||
private void focusDay(Date day) { | |||
// Only used when calender body is present | |||
if (resolution > VDateField.RESOLUTION_MONTH) { | |||
if (focusedDay != null) { | |||
focusedDay.removeStyleDependentName(CN_FOCUSED); | |||
} | |||
if (day > 0 && focusedDate != null) { | |||
focusedDate.setDate(day); | |||
if (day != null && focusedDate != null) { | |||
focusedDate.setTime(day.getTime()); | |||
int rowCount = days.getRowCount(); | |||
for (int i = 0; i < rowCount; i++) { | |||
int cellCount = days.getCellCount(i); | |||
@@ -210,7 +214,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
Widget widget = days.getWidget(i, j); | |||
if (widget != null && widget instanceof Day) { | |||
Day curday = (Day) widget; | |||
if (curday.getDay() == day) { | |||
if (curday.getDate().equals(day)) { | |||
curday.addStyleDependentName(CN_FOCUSED); | |||
focusedDay = curday; | |||
focusedRow = i; | |||
@@ -226,9 +230,9 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
/** | |||
* Sets the selection hightlight to a given date of current time | |||
* | |||
* @param day | |||
* @param date | |||
*/ | |||
private void selectDate(int day) { | |||
private void selectDate(Date date) { | |||
if (selectedDay != null) { | |||
selectedDay.removeStyleDependentName(CN_SELECTED); | |||
} | |||
@@ -240,7 +244,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
Widget widget = days.getWidget(i, j); | |||
if (widget != null && widget instanceof Day) { | |||
Day curday = (Day) widget; | |||
if (curday.getDay() == day) { | |||
if (curday.getDate().equals(date)) { | |||
curday.addStyleDependentName(CN_SELECTED); | |||
selectedDay = curday; | |||
return; | |||
@@ -279,7 +283,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
// it was forced to 1 above. | |||
value.setDate(focusedDate.getDate()); | |||
selectDate(focusedDate.getDate()); | |||
selectDate(focusedDate); | |||
} else { | |||
VConsole.log("Trying to select a the focused date which is NULL!"); | |||
} | |||
@@ -468,97 +472,62 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
} | |||
} | |||
// The day of month that is selected, -1 if no day of this month is | |||
// selected (i.e, showing another month/year than selected or nothing is | |||
// selected) | |||
int dayOfMonthSelected = -1; | |||
// The day of month that is today, -1 if no day of this month is today | |||
// (i.e., showing another month/year than current) | |||
int dayOfMonthToday = -1; | |||
boolean initiallyNull = value == null; | |||
if (!initiallyNull && value.getMonth() == focusedDate.getMonth() | |||
&& value.getYear() == focusedDate.getYear()) { | |||
dayOfMonthSelected = value.getDate(); | |||
} | |||
final Date today = new Date(); | |||
if (today.getMonth() == focusedDate.getMonth() | |||
&& today.getYear() == focusedDate.getYear()) { | |||
dayOfMonthToday = today.getDate(); | |||
} | |||
// today must have zeroed hours, minutes, seconds, and milliseconds | |||
final Date tmp = new Date(); | |||
final Date today = new Date(tmp.getYear(), tmp.getMonth(), | |||
tmp.getDate()); | |||
final int startWeekDay = getDateTimeService().getStartWeekDay( | |||
focusedDate); | |||
final int daysInMonth = DateTimeService | |||
.getNumberOfDaysInMonth(focusedDate); | |||
int dayCount = 0; | |||
final Date curr = new Date(focusedDate.getTime()); | |||
final Date curr = (Date) focusedDate.clone(); | |||
// Start from the first day of the week that at least partially belongs | |||
// to the current month | |||
curr.setDate(-startWeekDay); | |||
// No month has more than 6 weeks so 6 is a safe maximum for rows. | |||
for (int weekOfMonth = 1; weekOfMonth < 7; weekOfMonth++) { | |||
boolean weekNumberProcessed[] = new boolean[] { false, false, | |||
false, false, false, false, false }; | |||
for (int dayOfWeek = 0; dayOfWeek < 7; dayOfWeek++) { | |||
if (!(weekOfMonth == 1 && dayOfWeek < startWeekDay)) { | |||
if (dayCount >= daysInMonth) { | |||
// All days printed and we are done | |||
break; | |||
} | |||
final int dayOfMonth = ++dayCount; | |||
curr.setDate(dayCount); | |||
// Actually write the day of month | |||
Day day = new Day(dayOfMonth); | |||
// Actually write the day of month | |||
Day day = new Day((Date) curr.clone()); | |||
if (dayOfMonthSelected == dayOfMonth) { | |||
day.addStyleDependentName(CN_SELECTED); | |||
selectedDay = day; | |||
if (curr.equals(value)) { | |||
day.addStyleDependentName(CN_SELECTED); | |||
selectedDay = day; | |||
} | |||
if (curr.equals(today)) { | |||
day.addStyleDependentName(CN_TODAY); | |||
} | |||
if (curr.equals(focusedDate)) { | |||
focusedDay = day; | |||
focusedRow = weekOfMonth; | |||
if (hasFocus) { | |||
day.addStyleDependentName(CN_FOCUSED); | |||
} | |||
} | |||
if (curr.getMonth() != focusedDate.getMonth()) { | |||
day.addStyleDependentName(CN_OFFMONTH); | |||
} | |||
if (dayOfMonthToday == dayOfMonth) { | |||
day.addStyleDependentName(CN_TODAY); | |||
} | |||
days.setWidget(weekOfMonth, firstWeekdayColumn + dayOfWeek, day); | |||
if (dayOfMonth == focusedDate.getDate()) { | |||
focusedDay = day; | |||
focusedRow = weekOfMonth; | |||
if (hasFocus) { | |||
day.addStyleDependentName(CN_FOCUSED); | |||
} | |||
} | |||
// ISO week numbers if requested | |||
days.getCellFormatter().setVisible(weekOfMonth, weekColumn, | |||
isShowISOWeekNumbers()); | |||
if (isShowISOWeekNumbers()) { | |||
final String baseCssClass = VDateField.CLASSNAME | |||
+ "-calendarpanel-weeknumber"; | |||
String weekCssClass = baseCssClass; | |||
days.setWidget(weekOfMonth, firstWeekdayColumn + dayOfWeek, | |||
day); | |||
// ISO week numbers if requested | |||
if (!weekNumberProcessed[weekOfMonth]) { | |||
days.getCellFormatter().setVisible(weekOfMonth, | |||
weekColumn, isShowISOWeekNumbers()); | |||
if (isShowISOWeekNumbers()) { | |||
final String baseCssClass = VDateField.CLASSNAME | |||
+ "-calendarpanel-weeknumber"; | |||
String weekCssClass = baseCssClass; | |||
int weekNumber = DateTimeService | |||
.getISOWeekNumber(curr); | |||
days.setHTML(weekOfMonth, 0, "<span class=\"" | |||
+ weekCssClass + "\"" + ">" + weekNumber | |||
+ "</span>"); | |||
weekNumberProcessed[weekOfMonth] = true; | |||
} | |||
int weekNumber = DateTimeService.getISOWeekNumber(curr); | |||
} | |||
days.setHTML(weekOfMonth, 0, "<span class=\"" | |||
+ weekCssClass + "\"" + ">" + weekNumber | |||
+ "</span>"); | |||
} | |||
curr.setDate(curr.getDate() + 1); | |||
} | |||
} | |||
} | |||
/** | |||
@@ -622,6 +591,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
while (focusedDate.getMonth() != requestedMonth) { | |||
focusedDate.setDate(focusedDate.getDate() - 1); | |||
} | |||
displayedMonth.setMonth(displayedMonth.getMonth() + 1); | |||
renderCalendar(); | |||
} | |||
@@ -641,6 +611,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
while (focusedDate.getMonth() == currentMonth) { | |||
focusedDate.setDate(focusedDate.getDate() - 1); | |||
} | |||
displayedMonth.setMonth(displayedMonth.getMonth() - 1); | |||
renderCalendar(); | |||
} | |||
@@ -650,6 +621,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
*/ | |||
private void focusPreviousYear(int years) { | |||
focusedDate.setYear(focusedDate.getYear() - years); | |||
displayedMonth.setYear(displayedMonth.getYear() - years); | |||
renderCalendar(); | |||
} | |||
@@ -658,6 +630,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
*/ | |||
private void focusNextYear(int years) { | |||
focusedDate.setYear(focusedDate.getYear() + years); | |||
displayedMonth.setYear(displayedMonth.getYear() + years); | |||
renderCalendar(); | |||
} | |||
@@ -906,7 +879,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
if (newCurrentDate.getMonth() == focusedDate.getMonth()) { | |||
// Month did not change, only move the selection | |||
focusDay(focusedDate.getDate() + 1); | |||
focusDay(newCurrentDate); | |||
} else { | |||
// If the month changed we need to re-render the calendar | |||
focusedDate.setDate(focusedDate.getDate() + 1); | |||
@@ -925,7 +898,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
if (newCurrentDate.getMonth() == focusedDate.getMonth()) { | |||
// Month did not change, only move the selection | |||
focusDay(focusedDate.getDate() - 1); | |||
focusDay(newCurrentDate); | |||
} else { | |||
// If the month changed we need to re-render the calendar | |||
focusedDate.setDate(focusedDate.getDate() - 1); | |||
@@ -945,10 +918,10 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
if (newCurrentDate.getMonth() == focusedDate.getMonth() | |||
&& focusedRow > 1) { | |||
// Month did not change, only move the selection | |||
focusDay(focusedDate.getDate() - 7); | |||
focusDay(newCurrentDate); | |||
} else { | |||
// If the month changed we need to re-render the calendar | |||
focusedDate.setDate(focusedDate.getDate() - 7); | |||
focusedDate = newCurrentDate; | |||
renderCalendar(); | |||
} | |||
@@ -964,10 +937,10 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
if (newCurrentDate.getMonth() == focusedDate.getMonth()) { | |||
// Month did not change, only move the selection | |||
focusDay(focusedDate.getDate() + 7); | |||
focusDay(newCurrentDate); | |||
} else { | |||
// If the month changed we need to re-render the calendar | |||
focusedDate.setDate(focusedDate.getDate() + 7); | |||
focusedDate = newCurrentDate; | |||
renderCalendar(); | |||
} | |||
@@ -1211,27 +1184,28 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
return; | |||
} | |||
Date oldFocusedValue = focusedDate; | |||
Date oldDisplayedMonth = displayedMonth; | |||
value = currentDate; | |||
if (value == null) { | |||
focusedDate = null; | |||
focusedDate = displayedMonth = null; | |||
} else { | |||
focusedDate = (Date) value.clone(); | |||
displayedMonth = (Date) value.clone(); | |||
} | |||
// Re-render calendar if month or year of focused date has changed | |||
if (oldFocusedValue == null || value == null | |||
|| oldFocusedValue.getYear() != value.getYear() | |||
|| oldFocusedValue.getMonth() != value.getMonth()) { | |||
if (oldDisplayedMonth == null || value == null | |||
|| oldDisplayedMonth.getYear() != value.getYear() | |||
|| oldDisplayedMonth.getMonth() != value.getMonth()) { | |||
renderCalendar(); | |||
} else { | |||
focusDay(currentDate.getDate()); | |||
focusDay(currentDate); | |||
selectFocused(); | |||
} | |||
if (!hasFocus) { | |||
focusDay(-1); | |||
focusDay((Date) null); | |||
} | |||
} | |||
@@ -1512,17 +1486,17 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
private class Day extends InlineHTML { | |||
private static final String BASECLASS = VDateField.CLASSNAME | |||
+ "-calendarpanel-day"; | |||
private final int day; | |||
private final Date date; | |||
Day(int dayOfMonth) { | |||
super("" + dayOfMonth); | |||
Day(Date date) { | |||
super("" + date.getDate()); | |||
setStyleName(BASECLASS); | |||
day = dayOfMonth; | |||
this.date = date; | |||
addClickHandler(dayClickHandler); | |||
} | |||
public int getDay() { | |||
return day; | |||
public Date getDate() { | |||
return date; | |||
} | |||
} | |||
@@ -1605,7 +1579,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
public void onBlur(final BlurEvent event) { | |||
if (event.getSource() instanceof VCalendarPanel) { | |||
hasFocus = false; | |||
focusDay(-1); | |||
focusDay(null); | |||
} | |||
} | |||
@@ -1622,7 +1596,7 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
// Focuses the current day if the calendar shows the days | |||
if (focusedDay != null) { | |||
focusDay(focusedDay.getDay()); | |||
focusDay(focusedDate); | |||
} | |||
} | |||
} | |||
@@ -1653,7 +1627,15 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
// Day, find out which dayOfMonth and use that as the identifier | |||
Day day = Util.findWidget(subElement, Day.class); | |||
if (day != null) { | |||
return SUBPART_DAY + day.getDay(); | |||
Date date = day.getDate(); | |||
int id = date.getDate(); | |||
if (date.getMonth() < displayedMonth.getMonth()) { | |||
id -= DateTimeService.getNumberOfDaysInMonth(date); | |||
} else if (date.getMonth() > displayedMonth.getMonth()) { | |||
id += DateTimeService | |||
.getNumberOfDaysInMonth(displayedMonth); | |||
} | |||
return SUBPART_DAY + id; | |||
} | |||
} else if (time != null) { | |||
if (contains(time.hours, subElement)) { | |||
@@ -1714,14 +1696,18 @@ public class VCalendarPanel extends FocusableFlexTable implements | |||
return time.ampm.getElement(); | |||
} | |||
if (subPart.startsWith(SUBPART_DAY)) { | |||
// can be less than 1 or greater than the number of days in the current month | |||
// these map to the "off-month" days | |||
int dayOfMonth = Integer.parseInt(subPart.substring(SUBPART_DAY | |||
.length())); | |||
Date date = new Date(displayedMonth.getYear(), | |||
displayedMonth.getMonth(), dayOfMonth); | |||
Iterator<Widget> iter = days.iterator(); | |||
while (iter.hasNext()) { | |||
Widget w = iter.next(); | |||
if (w instanceof Day) { | |||
Day day = (Day) w; | |||
if (day.getDay() == dayOfMonth) { | |||
if (day.getDate().equals(date)) { | |||
return day.getElement(); | |||
} | |||
} |
@@ -117,8 +117,7 @@ public class VFormLayout extends SimplePanel implements Container { | |||
Widget childWidget = childPaintable.getWidgetForPaintable(); | |||
Caption caption = widgetToCaption.get(childWidget); | |||
if (caption == null) { | |||
caption = new Caption(childPaintable, client, | |||
getStylesFromUIDL(childUidl)); | |||
caption = new Caption(childPaintable, client); | |||
caption.addClickHandler(this); | |||
widgetToCaption.put(childWidget, caption); | |||
} | |||
@@ -208,8 +207,7 @@ public class VFormLayout extends SimplePanel implements Container { | |||
VPaintableWidget newPaintable = paintableMap | |||
.getPaintable(newComponent); | |||
Caption oldCap = widgetToCaption.get(oldComponent); | |||
final Caption newCap = new Caption(newPaintable, client, | |||
null); | |||
final Caption newCap = new Caption(newPaintable, client); | |||
newCap.addClickHandler(this); | |||
newCap.setStyleName(oldCap.getStyleName()); | |||
widgetToCaption.put(newComponent, newCap); | |||
@@ -333,29 +331,37 @@ public class VFormLayout extends SimplePanel implements Container { | |||
* return null | |||
* @param client | |||
*/ | |||
public Caption(VPaintableWidget component, | |||
ApplicationConnection client, String[] styles) { | |||
public Caption(VPaintableWidget component, ApplicationConnection client) { | |||
super(); | |||
this.client = client; | |||
owner = component; | |||
String style = CLASSNAME; | |||
sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
} | |||
private void setStyles(String[] styles) { | |||
String styleName = CLASSNAME; | |||
if (styles != null) { | |||
for (int i = 0; i < styles.length; i++) { | |||
style += " " + CLASSNAME + "-" + styles[i]; | |||
for (String style : styles) { | |||
if (ApplicationConnection.DISABLED_CLASSNAME.equals(style)) { | |||
// Add v-disabled also without classname prefix so | |||
// generic v-disabled CSS rules work | |||
styleName += " " + style; | |||
} | |||
styleName += " " + CLASSNAME + "-" + style; | |||
} | |||
} | |||
setStyleName(style); | |||
sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
setStyleName(styleName); | |||
} | |||
public void updateCaption(UIDL uidl) { | |||
setVisible(!uidl.getBooleanAttribute("invisible")); | |||
setStyleName(getElement(), | |||
ApplicationConnection.DISABLED_CLASSNAME, | |||
uidl.hasAttribute("disabled")); | |||
// Update styles as they might have changed when the caption changed | |||
setStyles(getStylesFromUIDL(uidl)); | |||
boolean isEmpty = true; | |||
@@ -1,462 +1,474 @@ | |||
/* | |||
@VaadinApache2LicenseForJavaFiles@ | |||
*/ | |||
package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.Date; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.DomEvent; | |||
import com.google.gwt.event.dom.client.KeyCodes; | |||
import com.google.gwt.event.logical.shared.CloseEvent; | |||
import com.google.gwt.event.logical.shared.CloseHandler; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.Button; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.DateTimeService; | |||
import com.vaadin.terminal.gwt.client.VPaintableWidget; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusChangeListener; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusOutListener; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.SubmitListener; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.TimeChangeListener; | |||
/** | |||
* Represents a date selection component with a text field and a popup date | |||
* selector. | |||
* | |||
* <b>Note:</b> To change the keyboard assignments used in the popup dialog you | |||
* should extend <code>com.vaadin.terminal.gwt.client.ui.VCalendarPanel</code> | |||
* and then pass set it by calling the | |||
* <code>setCalendarPanel(VCalendarPanel panel)</code> method. | |||
* | |||
*/ | |||
public class VPopupCalendar extends VTextualDate implements VPaintableWidget, | |||
Field, ClickHandler, CloseHandler<PopupPanel>, SubPartAware { | |||
private final Button calendarToggle; | |||
private VCalendarPanel calendar; | |||
private final VOverlay popup; | |||
private boolean open = false; | |||
private boolean parsable = true; | |||
public VPopupCalendar() { | |||
super(); | |||
calendarToggle = new Button(); | |||
calendarToggle.setStyleName(CLASSNAME + "-button"); | |||
calendarToggle.setText(""); | |||
calendarToggle.addClickHandler(this); | |||
// -2 instead of -1 to avoid FocusWidget.onAttach to reset it | |||
calendarToggle.getElement().setTabIndex(-2); | |||
add(calendarToggle); | |||
calendar = GWT.create(VCalendarPanel.class); | |||
calendar.setFocusOutListener(new FocusOutListener() { | |||
public boolean onFocusOut(DomEvent<?> event) { | |||
event.preventDefault(); | |||
closeCalendarPanel(); | |||
return true; | |||
} | |||
}); | |||
calendar.setSubmitListener(new SubmitListener() { | |||
public void onSubmit() { | |||
// Update internal value and send valuechange event if immediate | |||
updateValue(calendar.getDate()); | |||
// Update text field (a must when not immediate). | |||
buildDate(true); | |||
closeCalendarPanel(); | |||
} | |||
public void onCancel() { | |||
closeCalendarPanel(); | |||
} | |||
}); | |||
popup = new VOverlay(true, true, true); | |||
popup.setStyleName(VDateField.CLASSNAME + "-popup"); | |||
popup.setWidget(calendar); | |||
popup.addCloseHandler(this); | |||
DOM.setElementProperty(calendar.getElement(), "id", | |||
"PID_VAADIN_POPUPCAL"); | |||
sinkEvents(Event.ONKEYDOWN); | |||
} | |||
@SuppressWarnings("deprecation") | |||
private void updateValue(Date newDate) { | |||
Date currentDate = getCurrentDate(); | |||
if (currentDate == null || newDate.getTime() != currentDate.getTime()) { | |||
setCurrentDate((Date) newDate.clone()); | |||
getClient().updateVariable(getId(), "year", | |||
newDate.getYear() + 1900, false); | |||
if (getCurrentResolution() > VDateField.RESOLUTION_YEAR) { | |||
getClient().updateVariable(getId(), "month", | |||
newDate.getMonth() + 1, false); | |||
if (getCurrentResolution() > RESOLUTION_MONTH) { | |||
getClient().updateVariable(getId(), "day", | |||
newDate.getDate(), false); | |||
if (getCurrentResolution() > RESOLUTION_DAY) { | |||
getClient().updateVariable(getId(), "hour", | |||
newDate.getHours(), false); | |||
if (getCurrentResolution() > RESOLUTION_HOUR) { | |||
getClient().updateVariable(getId(), "min", | |||
newDate.getMinutes(), false); | |||
if (getCurrentResolution() > RESOLUTION_MIN) { | |||
getClient().updateVariable(getId(), "sec", | |||
newDate.getSeconds(), false); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
if (isImmediate()) { | |||
getClient().sendPendingVariableChanges(); | |||
} | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.vaadin.terminal.gwt.client.ui.VTextualDate#updateFromUIDL(com.vaadin | |||
* .terminal.gwt.client.UIDL, | |||
* com.vaadin.terminal.gwt.client.ApplicationConnection) | |||
*/ | |||
@Override | |||
@SuppressWarnings("deprecation") | |||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | |||
boolean lastReadOnlyState = readonly; | |||
parsable = uidl.getBooleanAttribute("parsable"); | |||
super.updateFromUIDL(uidl, client); | |||
popup.setStyleName(VDateField.CLASSNAME + "-popup " | |||
+ VDateField.CLASSNAME + "-" | |||
+ resolutionToString(currentResolution)); | |||
calendar.setDateTimeService(getDateTimeService()); | |||
calendar.setShowISOWeekNumbers(isShowISOWeekNumbers()); | |||
if (calendar.getResolution() != currentResolution) { | |||
calendar.setResolution(currentResolution); | |||
if (calendar.getDate() != null) { | |||
calendar.setDate((Date) getCurrentDate().clone()); | |||
// force re-render when changing resolution only | |||
calendar.renderCalendar(); | |||
} | |||
} | |||
calendarToggle.setEnabled(enabled); | |||
if (currentResolution <= RESOLUTION_MONTH) { | |||
calendar.setFocusChangeListener(new FocusChangeListener() { | |||
public void focusChanged(Date date) { | |||
updateValue(date); | |||
buildDate(); | |||
Date date2 = calendar.getDate(); | |||
date2.setYear(date.getYear()); | |||
date2.setMonth(date.getMonth()); | |||
} | |||
}); | |||
} else { | |||
calendar.setFocusChangeListener(null); | |||
} | |||
if (currentResolution > RESOLUTION_DAY) { | |||
calendar.setTimeChangeListener(new TimeChangeListener() { | |||
public void changed(int hour, int min, int sec, int msec) { | |||
Date d = getDate(); | |||
if (d == null) { | |||
// date currently null, use the value from calendarPanel | |||
// (~ client time at the init of the widget) | |||
d = (Date) calendar.getDate().clone(); | |||
} | |||
d.setHours(hour); | |||
d.setMinutes(min); | |||
d.setSeconds(sec); | |||
DateTimeService.setMilliseconds(d, msec); | |||
// Always update time changes to the server | |||
updateValue(d); | |||
// Update text field | |||
buildDate(); | |||
} | |||
}); | |||
} | |||
if (readonly) { | |||
calendarToggle.addStyleName(CLASSNAME + "-button-readonly"); | |||
} else { | |||
calendarToggle.removeStyleName(CLASSNAME + "-button-readonly"); | |||
} | |||
if (lastReadOnlyState != readonly) { | |||
updateWidth(); | |||
} | |||
calendarToggle.setEnabled(true); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.google.gwt.user.client.ui.UIObject#setStyleName(java.lang.String) | |||
*/ | |||
@Override | |||
public void setStyleName(String style) { | |||
// make sure the style is there before size calculation | |||
super.setStyleName(style + " " + CLASSNAME + "-popupcalendar"); | |||
} | |||
/** | |||
* Opens the calendar panel popup | |||
*/ | |||
public void openCalendarPanel() { | |||
if (!open && !readonly) { | |||
open = true; | |||
if (getCurrentDate() != null) { | |||
calendar.setDate((Date) getCurrentDate().clone()); | |||
} else { | |||
calendar.setDate(new Date()); | |||
} | |||
// clear previous values | |||
popup.setWidth(""); | |||
popup.setHeight(""); | |||
popup.setPopupPositionAndShow(new PositionCallback() { | |||
public void setPosition(int offsetWidth, int offsetHeight) { | |||
final int w = offsetWidth; | |||
final int h = offsetHeight; | |||
final int browserWindowWidth = Window.getClientWidth() | |||
+ Window.getScrollLeft(); | |||
final int browserWindowHeight = Window.getClientHeight() | |||
+ Window.getScrollTop(); | |||
int t = calendarToggle.getAbsoluteTop(); | |||
int l = calendarToggle.getAbsoluteLeft(); | |||
// Add a little extra space to the right to avoid | |||
// problems with IE7 scrollbars and to make it look | |||
// nicer. | |||
int extraSpace = 30; | |||
boolean overflowRight = false; | |||
if (l + +w + extraSpace > browserWindowWidth) { | |||
overflowRight = true; | |||
// Part of the popup is outside the browser window | |||
// (to the right) | |||
l = browserWindowWidth - w - extraSpace; | |||
} | |||
if (t + h + calendarToggle.getOffsetHeight() + 30 > browserWindowHeight) { | |||
// Part of the popup is outside the browser window | |||
// (below) | |||
t = browserWindowHeight - h | |||
- calendarToggle.getOffsetHeight() - 30; | |||
if (!overflowRight) { | |||
// Show to the right of the popup button unless we | |||
// are in the lower right corner of the screen | |||
l += calendarToggle.getOffsetWidth(); | |||
} | |||
} | |||
// fix size | |||
popup.setWidth(w + "px"); | |||
popup.setHeight(h + "px"); | |||
popup.setPopupPosition(l, | |||
t + calendarToggle.getOffsetHeight() + 2); | |||
/* | |||
* We have to wait a while before focusing since the popup | |||
* needs to be opened before we can focus | |||
*/ | |||
Timer focusTimer = new Timer() { | |||
@Override | |||
public void run() { | |||
setFocus(true); | |||
} | |||
}; | |||
focusTimer.schedule(100); | |||
} | |||
}); | |||
} else { | |||
VConsole.error("Cannot reopen popup, it is already open!"); | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event | |||
* .dom.client.ClickEvent) | |||
*/ | |||
public void onClick(ClickEvent event) { | |||
if (event.getSource() == calendarToggle && isEnabled()) { | |||
openCalendarPanel(); | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google.gwt | |||
* .event.logical.shared.CloseEvent) | |||
*/ | |||
public void onClose(CloseEvent<PopupPanel> event) { | |||
if (event.getSource() == popup) { | |||
buildDate(); | |||
if (!BrowserInfo.get().isTouchDevice()) { | |||
/* | |||
* Move focus to textbox, unless on touch device (avoids opening | |||
* virtual keyboard). | |||
*/ | |||
focus(); | |||
} | |||
// TODO resolve what the "Sigh." is all about and document it here | |||
// Sigh. | |||
Timer t = new Timer() { | |||
@Override | |||
public void run() { | |||
open = false; | |||
} | |||
}; | |||
t.schedule(100); | |||
} | |||
} | |||
/** | |||
* Sets focus to Calendar panel. | |||
* | |||
* @param focus | |||
*/ | |||
public void setFocus(boolean focus) { | |||
calendar.setFocus(focus); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.terminal.gwt.client.ui.VTextualDate#getFieldExtraWidth() | |||
*/ | |||
@Override | |||
protected int getFieldExtraWidth() { | |||
if (fieldExtraWidth < 0) { | |||
fieldExtraWidth = super.getFieldExtraWidth(); | |||
fieldExtraWidth += calendarToggle.getOffsetWidth(); | |||
} | |||
return fieldExtraWidth; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.terminal.gwt.client.ui.VTextualDate#buildDate() | |||
*/ | |||
@Override | |||
protected void buildDate() { | |||
// Save previous value | |||
String previousValue = getText(); | |||
super.buildDate(); | |||
// Restore previous value if the input could not be parsed | |||
if (!parsable) { | |||
setText(previousValue); | |||
} | |||
} | |||
/** | |||
* Update the text field contents from the date. See {@link #buildDate()}. | |||
* | |||
* @param forceValid | |||
* true to force the text field to be updated, false to only | |||
* update if the parsable flag is true. | |||
*/ | |||
protected void buildDate(boolean forceValid) { | |||
if (forceValid) { | |||
parsable = true; | |||
} | |||
buildDate(); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.vaadin.terminal.gwt.client.ui.VDateField#onBrowserEvent(com.google | |||
* .gwt.user.client.Event) | |||
*/ | |||
@Override | |||
public void onBrowserEvent(com.google.gwt.user.client.Event event) { | |||
super.onBrowserEvent(event); | |||
if (DOM.eventGetType(event) == Event.ONKEYDOWN | |||
&& event.getKeyCode() == getOpenCalenderPanelKey()) { | |||
openCalendarPanel(); | |||
event.preventDefault(); | |||
} | |||
} | |||
/** | |||
* Get the key code that opens the calendar panel. By default it is the down | |||
* key but you can override this to be whatever you like | |||
* | |||
* @return | |||
*/ | |||
protected int getOpenCalenderPanelKey() { | |||
return KeyCodes.KEY_DOWN; | |||
} | |||
/** | |||
* Closes the open popup panel | |||
*/ | |||
public void closeCalendarPanel() { | |||
if (open) { | |||
popup.hide(true); | |||
} | |||
} | |||
private final String CALENDAR_TOGGLE_ID = "popupButton"; | |||
@Override | |||
public Element getSubPartElement(String subPart) { | |||
if (subPart.equals(CALENDAR_TOGGLE_ID)) { | |||
return calendarToggle.getElement(); | |||
} | |||
return super.getSubPartElement(subPart); | |||
} | |||
@Override | |||
public String getSubPartName(Element subElement) { | |||
if (calendarToggle.getElement().isOrHasChild(subElement)) { | |||
return CALENDAR_TOGGLE_ID; | |||
} | |||
return super.getSubPartName(subElement); | |||
} | |||
} | |||
/* | |||
@VaadinApache2LicenseForJavaFiles@ | |||
*/ | |||
package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.Date; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.DomEvent; | |||
import com.google.gwt.event.dom.client.KeyCodes; | |||
import com.google.gwt.event.logical.shared.CloseEvent; | |||
import com.google.gwt.event.logical.shared.CloseHandler; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.Button; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.DateTimeService; | |||
import com.vaadin.terminal.gwt.client.VPaintableWidget; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusChangeListener; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusOutListener; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.SubmitListener; | |||
import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.TimeChangeListener; | |||
/** | |||
* Represents a date selection component with a text field and a popup date | |||
* selector. | |||
* | |||
* <b>Note:</b> To change the keyboard assignments used in the popup dialog you | |||
* should extend <code>com.vaadin.terminal.gwt.client.ui.VCalendarPanel</code> | |||
* and then pass set it by calling the | |||
* <code>setCalendarPanel(VCalendarPanel panel)</code> method. | |||
* | |||
*/ | |||
public class VPopupCalendar extends VTextualDate implements VPaintableWidget, | |||
Field, ClickHandler, CloseHandler<PopupPanel>, SubPartAware { | |||
private static final String POPUP_PRIMARY_STYLE_NAME = VDateField.CLASSNAME | |||
+ "-popup"; | |||
private final Button calendarToggle; | |||
private VCalendarPanel calendar; | |||
private final VOverlay popup; | |||
private boolean open = false; | |||
private boolean parsable = true; | |||
public VPopupCalendar() { | |||
super(); | |||
calendarToggle = new Button(); | |||
calendarToggle.setStyleName(CLASSNAME + "-button"); | |||
calendarToggle.setText(""); | |||
calendarToggle.addClickHandler(this); | |||
// -2 instead of -1 to avoid FocusWidget.onAttach to reset it | |||
calendarToggle.getElement().setTabIndex(-2); | |||
add(calendarToggle); | |||
calendar = GWT.create(VCalendarPanel.class); | |||
calendar.setFocusOutListener(new FocusOutListener() { | |||
public boolean onFocusOut(DomEvent<?> event) { | |||
event.preventDefault(); | |||
closeCalendarPanel(); | |||
return true; | |||
} | |||
}); | |||
calendar.setSubmitListener(new SubmitListener() { | |||
public void onSubmit() { | |||
// Update internal value and send valuechange event if immediate | |||
updateValue(calendar.getDate()); | |||
// Update text field (a must when not immediate). | |||
buildDate(true); | |||
closeCalendarPanel(); | |||
} | |||
public void onCancel() { | |||
closeCalendarPanel(); | |||
} | |||
}); | |||
popup = new VOverlay(true, true, true); | |||
popup.setStyleName(POPUP_PRIMARY_STYLE_NAME); | |||
popup.setWidget(calendar); | |||
popup.addCloseHandler(this); | |||
DOM.setElementProperty(calendar.getElement(), "id", | |||
"PID_VAADIN_POPUPCAL"); | |||
sinkEvents(Event.ONKEYDOWN); | |||
} | |||
@SuppressWarnings("deprecation") | |||
private void updateValue(Date newDate) { | |||
Date currentDate = getCurrentDate(); | |||
if (currentDate == null || newDate.getTime() != currentDate.getTime()) { | |||
setCurrentDate((Date) newDate.clone()); | |||
getClient().updateVariable(getId(), "year", | |||
newDate.getYear() + 1900, false); | |||
if (getCurrentResolution() > VDateField.RESOLUTION_YEAR) { | |||
getClient().updateVariable(getId(), "month", | |||
newDate.getMonth() + 1, false); | |||
if (getCurrentResolution() > RESOLUTION_MONTH) { | |||
getClient().updateVariable(getId(), "day", | |||
newDate.getDate(), false); | |||
if (getCurrentResolution() > RESOLUTION_DAY) { | |||
getClient().updateVariable(getId(), "hour", | |||
newDate.getHours(), false); | |||
if (getCurrentResolution() > RESOLUTION_HOUR) { | |||
getClient().updateVariable(getId(), "min", | |||
newDate.getMinutes(), false); | |||
if (getCurrentResolution() > RESOLUTION_MIN) { | |||
getClient().updateVariable(getId(), "sec", | |||
newDate.getSeconds(), false); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
if (isImmediate()) { | |||
getClient().sendPendingVariableChanges(); | |||
} | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.vaadin.terminal.gwt.client.ui.VTextualDate#updateFromUIDL(com.vaadin | |||
* .terminal.gwt.client.UIDL, | |||
* com.vaadin.terminal.gwt.client.ApplicationConnection) | |||
*/ | |||
@Override | |||
@SuppressWarnings("deprecation") | |||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | |||
boolean lastReadOnlyState = readonly; | |||
boolean lastEnabledState = isEnabled(); | |||
parsable = uidl.getBooleanAttribute("parsable"); | |||
super.updateFromUIDL(uidl, client); | |||
String popupStyleNames = ApplicationConnection.getStyleName( | |||
POPUP_PRIMARY_STYLE_NAME, uidl, false); | |||
popupStyleNames += " " + VDateField.CLASSNAME + "-" | |||
+ resolutionToString(currentResolution); | |||
popup.setStyleName(popupStyleNames); | |||
calendar.setDateTimeService(getDateTimeService()); | |||
calendar.setShowISOWeekNumbers(isShowISOWeekNumbers()); | |||
if (calendar.getResolution() != currentResolution) { | |||
calendar.setResolution(currentResolution); | |||
if (calendar.getDate() != null) { | |||
calendar.setDate((Date) getCurrentDate().clone()); | |||
// force re-render when changing resolution only | |||
calendar.renderCalendar(); | |||
} | |||
} | |||
calendarToggle.setEnabled(enabled); | |||
if (currentResolution <= RESOLUTION_MONTH) { | |||
calendar.setFocusChangeListener(new FocusChangeListener() { | |||
public void focusChanged(Date date) { | |||
updateValue(date); | |||
buildDate(); | |||
Date date2 = calendar.getDate(); | |||
date2.setYear(date.getYear()); | |||
date2.setMonth(date.getMonth()); | |||
} | |||
}); | |||
} else { | |||
calendar.setFocusChangeListener(null); | |||
} | |||
if (currentResolution > RESOLUTION_DAY) { | |||
calendar.setTimeChangeListener(new TimeChangeListener() { | |||
public void changed(int hour, int min, int sec, int msec) { | |||
Date d = getDate(); | |||
if (d == null) { | |||
// date currently null, use the value from calendarPanel | |||
// (~ client time at the init of the widget) | |||
d = (Date) calendar.getDate().clone(); | |||
} | |||
d.setHours(hour); | |||
d.setMinutes(min); | |||
d.setSeconds(sec); | |||
DateTimeService.setMilliseconds(d, msec); | |||
// Always update time changes to the server | |||
updateValue(d); | |||
// Update text field | |||
buildDate(); | |||
} | |||
}); | |||
} | |||
if (readonly) { | |||
calendarToggle.addStyleName(CLASSNAME + "-button-readonly"); | |||
} else { | |||
calendarToggle.removeStyleName(CLASSNAME + "-button-readonly"); | |||
} | |||
if (lastReadOnlyState != readonly || lastEnabledState != isEnabled()) { | |||
// Enabled or readonly state changed. Differences in theming might | |||
// affect the width (for instance if the popup button is hidden) so | |||
// we have to recalculate the width (IF the width of the field is | |||
// fixed) | |||
updateWidth(); | |||
} | |||
calendarToggle.setEnabled(true); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.google.gwt.user.client.ui.UIObject#setStyleName(java.lang.String) | |||
*/ | |||
@Override | |||
public void setStyleName(String style) { | |||
// make sure the style is there before size calculation | |||
super.setStyleName(style + " " + CLASSNAME + "-popupcalendar"); | |||
} | |||
/** | |||
* Opens the calendar panel popup | |||
*/ | |||
public void openCalendarPanel() { | |||
if (!open && !readonly) { | |||
open = true; | |||
if (getCurrentDate() != null) { | |||
calendar.setDate((Date) getCurrentDate().clone()); | |||
} else { | |||
calendar.setDate(new Date()); | |||
} | |||
// clear previous values | |||
popup.setWidth(""); | |||
popup.setHeight(""); | |||
popup.setPopupPositionAndShow(new PositionCallback() { | |||
public void setPosition(int offsetWidth, int offsetHeight) { | |||
final int w = offsetWidth; | |||
final int h = offsetHeight; | |||
final int browserWindowWidth = Window.getClientWidth() | |||
+ Window.getScrollLeft(); | |||
final int browserWindowHeight = Window.getClientHeight() | |||
+ Window.getScrollTop(); | |||
int t = calendarToggle.getAbsoluteTop(); | |||
int l = calendarToggle.getAbsoluteLeft(); | |||
// Add a little extra space to the right to avoid | |||
// problems with IE7 scrollbars and to make it look | |||
// nicer. | |||
int extraSpace = 30; | |||
boolean overflowRight = false; | |||
if (l + +w + extraSpace > browserWindowWidth) { | |||
overflowRight = true; | |||
// Part of the popup is outside the browser window | |||
// (to the right) | |||
l = browserWindowWidth - w - extraSpace; | |||
} | |||
if (t + h + calendarToggle.getOffsetHeight() + 30 > browserWindowHeight) { | |||
// Part of the popup is outside the browser window | |||
// (below) | |||
t = browserWindowHeight - h | |||
- calendarToggle.getOffsetHeight() - 30; | |||
if (!overflowRight) { | |||
// Show to the right of the popup button unless we | |||
// are in the lower right corner of the screen | |||
l += calendarToggle.getOffsetWidth(); | |||
} | |||
} | |||
// fix size | |||
popup.setWidth(w + "px"); | |||
popup.setHeight(h + "px"); | |||
popup.setPopupPosition(l, | |||
t + calendarToggle.getOffsetHeight() + 2); | |||
/* | |||
* We have to wait a while before focusing since the popup | |||
* needs to be opened before we can focus | |||
*/ | |||
Timer focusTimer = new Timer() { | |||
@Override | |||
public void run() { | |||
setFocus(true); | |||
} | |||
}; | |||
focusTimer.schedule(100); | |||
} | |||
}); | |||
} else { | |||
VConsole.error("Cannot reopen popup, it is already open!"); | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event | |||
* .dom.client.ClickEvent) | |||
*/ | |||
public void onClick(ClickEvent event) { | |||
if (event.getSource() == calendarToggle && isEnabled()) { | |||
openCalendarPanel(); | |||
} | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google.gwt | |||
* .event.logical.shared.CloseEvent) | |||
*/ | |||
public void onClose(CloseEvent<PopupPanel> event) { | |||
if (event.getSource() == popup) { | |||
buildDate(); | |||
if (!BrowserInfo.get().isTouchDevice()) { | |||
/* | |||
* Move focus to textbox, unless on touch device (avoids opening | |||
* virtual keyboard). | |||
*/ | |||
focus(); | |||
} | |||
// TODO resolve what the "Sigh." is all about and document it here | |||
// Sigh. | |||
Timer t = new Timer() { | |||
@Override | |||
public void run() { | |||
open = false; | |||
} | |||
}; | |||
t.schedule(100); | |||
} | |||
} | |||
/** | |||
* Sets focus to Calendar panel. | |||
* | |||
* @param focus | |||
*/ | |||
public void setFocus(boolean focus) { | |||
calendar.setFocus(focus); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.terminal.gwt.client.ui.VTextualDate#getFieldExtraWidth() | |||
*/ | |||
@Override | |||
protected int getFieldExtraWidth() { | |||
if (fieldExtraWidth < 0) { | |||
fieldExtraWidth = super.getFieldExtraWidth(); | |||
fieldExtraWidth += calendarToggle.getOffsetWidth(); | |||
} | |||
return fieldExtraWidth; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.terminal.gwt.client.ui.VTextualDate#buildDate() | |||
*/ | |||
@Override | |||
protected void buildDate() { | |||
// Save previous value | |||
String previousValue = getText(); | |||
super.buildDate(); | |||
// Restore previous value if the input could not be parsed | |||
if (!parsable) { | |||
setText(previousValue); | |||
} | |||
} | |||
/** | |||
* Update the text field contents from the date. See {@link #buildDate()}. | |||
* | |||
* @param forceValid | |||
* true to force the text field to be updated, false to only | |||
* update if the parsable flag is true. | |||
*/ | |||
protected void buildDate(boolean forceValid) { | |||
if (forceValid) { | |||
parsable = true; | |||
} | |||
buildDate(); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.vaadin.terminal.gwt.client.ui.VDateField#onBrowserEvent(com.google | |||
* .gwt.user.client.Event) | |||
*/ | |||
@Override | |||
public void onBrowserEvent(com.google.gwt.user.client.Event event) { | |||
super.onBrowserEvent(event); | |||
if (DOM.eventGetType(event) == Event.ONKEYDOWN | |||
&& event.getKeyCode() == getOpenCalenderPanelKey()) { | |||
openCalendarPanel(); | |||
event.preventDefault(); | |||
} | |||
} | |||
/** | |||
* Get the key code that opens the calendar panel. By default it is the down | |||
* key but you can override this to be whatever you like | |||
* | |||
* @return | |||
*/ | |||
protected int getOpenCalenderPanelKey() { | |||
return KeyCodes.KEY_DOWN; | |||
} | |||
/** | |||
* Closes the open popup panel | |||
*/ | |||
public void closeCalendarPanel() { | |||
if (open) { | |||
popup.hide(true); | |||
} | |||
} | |||
private final String CALENDAR_TOGGLE_ID = "popupButton"; | |||
@Override | |||
public Element getSubPartElement(String subPart) { | |||
if (subPart.equals(CALENDAR_TOGGLE_ID)) { | |||
return calendarToggle.getElement(); | |||
} | |||
return super.getSubPartElement(subPart); | |||
} | |||
@Override | |||
public String getSubPartName(Element subElement) { | |||
if (calendarToggle.getElement().isOrHasChild(subElement)) { | |||
return CALENDAR_TOGGLE_ID; | |||
} | |||
return super.getSubPartName(subElement); | |||
} | |||
} |
@@ -2105,26 +2105,16 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
* of the caption container element by the correct amount | |||
*/ | |||
public void resizeCaptionContainer(int rightSpacing) { | |||
int captionContainerWidth = width | |||
- colResizeWidget.getOffsetWidth() - rightSpacing; | |||
if (td.getClassName().contains("-asc") | |||
|| td.getClassName().contains("-desc")) { | |||
/* | |||
* Room for the sort indicator is made by subtracting the styled | |||
* margin and width of the resizer from the width of the caption | |||
* container. | |||
*/ | |||
int captionContainerWidth = width | |||
- sortIndicator.getOffsetWidth() | |||
- colResizeWidget.getOffsetWidth() - rightSpacing; | |||
captionContainer.getStyle().setPropertyPx("width", | |||
captionContainerWidth); | |||
} else { | |||
/* | |||
* Set the caption container element as wide as possible when | |||
* the sorting indicator is not visible. | |||
*/ | |||
captionContainer.getStyle().setPropertyPx("width", | |||
width - rightSpacing); | |||
// Leave room for the sort indicator | |||
captionContainerWidth -= sortIndicator.getOffsetWidth(); | |||
} | |||
captionContainer.getStyle().setPropertyPx("width", | |||
captionContainerWidth); | |||
// Apply/Remove spacing if defined | |||
if (rightSpacing > 0) { | |||
@@ -5882,7 +5872,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
public void onScroll(ScrollEvent event) { | |||
scrollLeft = scrollBodyPanel.getElement().getScrollLeft(); | |||
scrollTop = scrollBodyPanel.getScrollPosition(); | |||
if (!initializedAndAttached) { | |||
/* | |||
* #6970 - IE sometimes fires scroll events for a detached table. | |||
* | |||
* FIXME initializedAndAttached should probably be renamed - its name | |||
* doesn't seem to reflect its semantics. onDetach() doesn't set it to | |||
* false, and changing that might break something else, so we need to | |||
* check isAttached() separately. | |||
*/ | |||
if (!initializedAndAttached || !isAttached()) { | |||
return; | |||
} | |||
if (!enabled) { |
@@ -54,7 +54,7 @@ public class VTabsheet extends VTabsheetBase { | |||
/** | |||
* Representation of a single "tab" shown in the TabBar | |||
* | |||
* | |||
*/ | |||
private static class Tab extends SimplePanel { | |||
private static final String TD_CLASSNAME = CLASSNAME + "-tabitemcell"; | |||
@@ -64,6 +64,8 @@ public class VTabsheet extends VTabsheetBase { | |||
+ "-selected"; | |||
private static final String TD_SELECTED_FIRST_CLASSNAME = TD_SELECTED_CLASSNAME | |||
+ "-first"; | |||
private static final String TD_DISABLED_CLASSNAME = TD_CLASSNAME | |||
+ "-disabled"; | |||
private static final String DIV_CLASSNAME = CLASSNAME + "-tabitem"; | |||
private static final String DIV_SELECTED_CLASSNAME = DIV_CLASSNAME | |||
@@ -116,6 +118,7 @@ public class VTabsheet extends VTabsheetBase { | |||
public void setEnabledOnServer(boolean enabled) { | |||
enabledOnServer = enabled; | |||
setStyleName(td, TD_DISABLED_CLASSNAME, !enabled); | |||
} | |||
public void addClickHandler(ClickHandler handler) { |
@@ -69,4 +69,11 @@ public class VTextArea extends VTextField { | |||
super.onBrowserEvent(event); | |||
} | |||
@Override | |||
public int getCursorPos() { | |||
// This is needed so that TextBoxImplIE6 is used to return the correct | |||
// position for old Internet Explorer versions where it has to be | |||
// detected in a different way. | |||
return getImpl().getTextAreaCursorPos(getElement()); | |||
} | |||
} |
@@ -20,12 +20,12 @@ import com.vaadin.terminal.gwt.client.EventId; | |||
import com.vaadin.terminal.gwt.client.Focusable; | |||
import com.vaadin.terminal.gwt.client.LocaleNotLoadedException; | |||
import com.vaadin.terminal.gwt.client.LocaleService; | |||
import com.vaadin.terminal.gwt.client.VPaintableWidget; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.VPaintableWidget; | |||
public class VTextualDate extends VDateField implements VPaintableWidget, Field, | |||
ChangeHandler, ContainerResizedListener, Focusable, SubPartAware { | |||
public class VTextualDate extends VDateField implements VPaintableWidget, | |||
Field, ChangeHandler, ContainerResizedListener, Focusable, SubPartAware { | |||
private static final String PARSE_ERROR_CLASSNAME = CLASSNAME | |||
+ "-parseerror"; | |||
@@ -331,7 +331,8 @@ public class VTextualDate extends VDateField implements VPaintableWidget, Field, | |||
@Override | |||
public void setWidth(String newWidth) { | |||
if (!"".equals(newWidth) && (width == null || !newWidth.equals(width))) { | |||
if (!"".equals(newWidth) | |||
&& (isUndefinedWidth() || !newWidth.equals(width))) { | |||
needLayout = true; | |||
width = newWidth; | |||
super.setWidth(width); | |||
@@ -340,16 +341,18 @@ public class VTextualDate extends VDateField implements VPaintableWidget, Field, | |||
needLayout = false; | |||
} | |||
} else { | |||
if ("".equals(newWidth) && width != null && !"".equals(width)) { | |||
if ("".equals(newWidth) && !isUndefinedWidth()) { | |||
super.setWidth(""); | |||
needLayout = true; | |||
iLayout(); | |||
needLayout = false; | |||
iLayout(true); | |||
width = null; | |||
} | |||
} | |||
} | |||
protected boolean isUndefinedWidth() { | |||
return width == null || "".equals(width); | |||
} | |||
/** | |||
* Returns pixels in x-axis reserved for other than textfield content. | |||
* | |||
@@ -363,14 +366,26 @@ public class VTextualDate extends VDateField implements VPaintableWidget, Field, | |||
return fieldExtraWidth; | |||
} | |||
/** | |||
* Force an recalculation of the width of the component IF the width has | |||
* been defined. Does nothing if width is undefined as the width will be | |||
* automatically adjusted by the browser. | |||
*/ | |||
public void updateWidth() { | |||
if (isUndefinedWidth()) { | |||
return; | |||
} | |||
needLayout = true; | |||
fieldExtraWidth = -1; | |||
iLayout(); | |||
iLayout(true); | |||
} | |||
public void iLayout() { | |||
if (needLayout) { | |||
iLayout(false); | |||
} | |||
public void iLayout(boolean force) { | |||
if (needLayout || force) { | |||
int textFieldWidth = getOffsetWidth() - getFieldExtraWidth(); | |||
if (textFieldWidth < 0) { | |||
// Field can never be smaller than 0 (causes exception in IE) |
@@ -640,6 +640,11 @@ public class VView extends SimplePanel implements Container, ResizeHandler, | |||
String ownAppId = connection.getConfiguration().getRootPanelId(); | |||
// Hiding elements causes browser to forget scroll position -> must | |||
// save values and restore when the elements are visible again #7976 | |||
int originalScrollTop = Window.getScrollTop(); | |||
int originalScrollLeft = Window.getScrollLeft(); | |||
// Set display: none for all Vaadin apps | |||
for (int i = 0; i < vaadinApps.size(); i++) { | |||
String appId = vaadinApps.get(i); | |||
@@ -678,6 +683,9 @@ public class VView extends SimplePanel implements Container, ResizeHandler, | |||
} | |||
} | |||
// Scroll back to original location | |||
Window.scrollTo(originalScrollLeft, originalScrollTop); | |||
return w; | |||
} | |||
@@ -140,6 +140,7 @@ public class VWindow extends VOverlay implements Container, | |||
private Element modalityCurtain; | |||
private Element draggingCurtain; | |||
private Element resizingCurtain; | |||
private Element headerText; | |||
@@ -568,12 +569,17 @@ public class VWindow extends VOverlay implements Container, | |||
this.draggable = draggable; | |||
setCursorProperties(); | |||
} | |||
private void setCursorProperties() { | |||
if (!this.draggable) { | |||
header.getStyle().setProperty("cursor", "default"); | |||
footer.getStyle().setProperty("cursor", "default"); | |||
} else { | |||
header.getStyle().setProperty("cursor", ""); | |||
footer.getStyle().setProperty("cursor", ""); | |||
} | |||
} | |||
private void setNaturalWidth() { | |||
@@ -703,28 +709,62 @@ public class VWindow extends VOverlay implements Container, | |||
} | |||
/* | |||
* Shows (or hides) an empty div on top of all other content; used when | |||
* resizing or moving, so that iframes (etc) do not steal event. | |||
* Shows an empty div on top of all other content; used when moving, so that | |||
* iframes (etc) do not steal event. | |||
*/ | |||
private void showDraggingCurtain(boolean show) { | |||
if (show && draggingCurtain == null) { | |||
private void showDraggingCurtain() { | |||
DOM.appendChild(RootPanel.getBodyElement(), getDraggingCurtain()); | |||
} | |||
draggingCurtain = DOM.createDiv(); | |||
DOM.setStyleAttribute(draggingCurtain, "position", "absolute"); | |||
DOM.setStyleAttribute(draggingCurtain, "top", "0px"); | |||
DOM.setStyleAttribute(draggingCurtain, "left", "0px"); | |||
DOM.setStyleAttribute(draggingCurtain, "width", "100%"); | |||
DOM.setStyleAttribute(draggingCurtain, "height", "100%"); | |||
DOM.setStyleAttribute(draggingCurtain, "zIndex", "" | |||
+ VOverlay.Z_INDEX); | |||
private void hideDraggingCurtain() { | |||
if (draggingCurtain != null) { | |||
DOM.removeChild(RootPanel.getBodyElement(), draggingCurtain); | |||
} | |||
} | |||
DOM.appendChild(RootPanel.getBodyElement(), draggingCurtain); | |||
} else if (!show && draggingCurtain != null) { | |||
/* | |||
* Shows an empty div on top of all other content; used when resizing, so | |||
* that iframes (etc) do not steal event. | |||
*/ | |||
private void showResizingCurtain() { | |||
DOM.appendChild(RootPanel.getBodyElement(), getResizingCurtain()); | |||
} | |||
DOM.removeChild(RootPanel.getBodyElement(), draggingCurtain); | |||
draggingCurtain = null; | |||
private void hideResizingCurtain() { | |||
if (resizingCurtain != null) { | |||
DOM.removeChild(RootPanel.getBodyElement(), resizingCurtain); | |||
} | |||
} | |||
private Element getDraggingCurtain() { | |||
if (draggingCurtain == null) { | |||
draggingCurtain = createCurtain(); | |||
draggingCurtain.setClassName(CLASSNAME + "-draggingCurtain"); | |||
} | |||
return draggingCurtain; | |||
} | |||
private Element getResizingCurtain() { | |||
if (resizingCurtain == null) { | |||
resizingCurtain = createCurtain(); | |||
resizingCurtain.setClassName(CLASSNAME + "-resizingCurtain"); | |||
} | |||
return resizingCurtain; | |||
} | |||
private Element createCurtain() { | |||
Element curtain = DOM.createDiv(); | |||
DOM.setStyleAttribute(curtain, "position", "absolute"); | |||
DOM.setStyleAttribute(curtain, "top", "0px"); | |||
DOM.setStyleAttribute(curtain, "left", "0px"); | |||
DOM.setStyleAttribute(curtain, "width", "100%"); | |||
DOM.setStyleAttribute(curtain, "height", "100%"); | |||
DOM.setStyleAttribute(curtain, "zIndex", "" + VOverlay.Z_INDEX); | |||
return curtain; | |||
} | |||
private void setResizable(boolean resizability) { | |||
@@ -844,7 +884,7 @@ public class VWindow extends VOverlay implements Container, | |||
if (!isActive()) { | |||
bringToFront(); | |||
} | |||
showDraggingCurtain(true); | |||
showResizingCurtain(); | |||
if (BrowserInfo.get().isIE()) { | |||
DOM.setStyleAttribute(resizeBox, "visibility", "hidden"); | |||
} | |||
@@ -862,7 +902,7 @@ public class VWindow extends VOverlay implements Container, | |||
case Event.ONTOUCHCANCEL: | |||
DOM.releaseCapture(getElement()); | |||
case Event.ONLOSECAPTURE: | |||
showDraggingCurtain(false); | |||
hideResizingCurtain(); | |||
if (BrowserInfo.get().isIE()) { | |||
DOM.setStyleAttribute(resizeBox, "visibility", ""); | |||
} | |||
@@ -1097,7 +1137,7 @@ public class VWindow extends VOverlay implements Container, | |||
private void beginMovingWindow(Event event) { | |||
if (draggable) { | |||
showDraggingCurtain(true); | |||
showDraggingCurtain(); | |||
dragging = true; | |||
startX = Util.getTouchOrMouseClientX(event); | |||
startY = Util.getTouchOrMouseClientY(event); | |||
@@ -1110,7 +1150,7 @@ public class VWindow extends VOverlay implements Container, | |||
private void stopMovingWindow() { | |||
dragging = false; | |||
showDraggingCurtain(false); | |||
hideDraggingCurtain(); | |||
DOM.releaseCapture(getElement()); | |||
} | |||
@@ -11,7 +11,6 @@ import java.util.EventObject; | |||
import java.util.Locale; | |||
import com.vaadin.Application; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.event.FieldEvents; | |||
import com.vaadin.terminal.ErrorMessage; | |||
import com.vaadin.terminal.Paintable; | |||
@@ -363,12 +362,6 @@ public interface Component extends Paintable, VariableOwner, Sizeable, | |||
* </p> | |||
* | |||
* <p> | |||
* The read-only status affects only the user; the value can still be | |||
* changed programmatically, for example, with | |||
* {@link Property#setValue(Object)}. | |||
* </p> | |||
* | |||
* <p> | |||
* The method will return {@code true} if the component or any of its | |||
* parents is in the read-only mode. | |||
* </p> | |||
@@ -396,12 +389,6 @@ public interface Component extends Paintable, VariableOwner, Sizeable, | |||
* </p> | |||
* | |||
* <p> | |||
* The read-only status affects only the user; the value can still be | |||
* changed programmatically, for example, with | |||
* {@link Property#setValue(Object)}. | |||
* </p> | |||
* | |||
* <p> | |||
* This method will trigger a | |||
* {@link com.vaadin.terminal.Paintable.RepaintRequestEvent | |||
* RepaintRequestEvent}. |
@@ -125,7 +125,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { | |||
// see ticket #7668 | |||
if (c.getParent() == this) { | |||
// When c is removed, all components after it are shifted down | |||
if (index > components.indexOf(c)) { | |||
if (index > getComponentIndex(c)) { | |||
index--; | |||
} | |||
removeComponent(c); | |||
@@ -275,4 +275,28 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { | |||
removeListener(CLICK_EVENT, LayoutClickEvent.class, listener); | |||
} | |||
/** | |||
* Returns the index of the given component. | |||
* | |||
* @param component | |||
* The component to look up. | |||
* @return The index of the component or -1 if the component is not a child. | |||
*/ | |||
public int getComponentIndex(Component component) { | |||
return components.indexOf(component); | |||
} | |||
/** | |||
* Returns the component at the given position. | |||
* | |||
* @param index | |||
* The position of the component. | |||
* @return The component at the given index. | |||
* @throws IndexOutOfBoundsException | |||
* If the index is out of range. | |||
*/ | |||
public Component getComponent(int index) throws IndexOutOfBoundsException { | |||
return components.get(index); | |||
} | |||
} |
@@ -3052,6 +3052,9 @@ public class Table extends AbstractSelect implements Action.Container, | |||
if (start > cells[CELL_ITEMID].length || start < 0) { | |||
start = 0; | |||
} | |||
if (end > cells[CELL_ITEMID].length) { | |||
end = cells[CELL_ITEMID].length; | |||
} | |||
for (int indexInRowbuffer = start; indexInRowbuffer < end; indexInRowbuffer++) { | |||
final Object itemId = cells[CELL_ITEMID][indexInRowbuffer]; | |||
@@ -5188,4 +5191,13 @@ public class Table extends AbstractSelect implements Action.Container, | |||
return propertyValueConverters.get(propertyId); | |||
} | |||
@Override | |||
public void setVisible(boolean visible) { | |||
if (!isVisible() && visible) { | |||
// We need to ensure that the rows are sent to the client when the | |||
// Table is made visible if it has been rendered as invisible. | |||
setRowCacheInvalidated(true); | |||
} | |||
super.setVisible(visible); | |||
} | |||
} |
@@ -8,7 +8,7 @@ if lockfile -r0 -! /home/integration/deploy/lock.file &> /dev/null | |||
AGE=$[($DATE - $LOCK_AGE)/60] | |||
if [ "$AGE" -gt "15" ] | |||
if [ "$AGE" -gt "20" ] | |||
then | |||
echo lock.file is $AGE min old. | |||
./cleanup.sh |
@@ -7,20 +7,20 @@ | |||
<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"/> | |||
<fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run"/> | |||
<fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run"/> | |||
<fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" /> | |||
<fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run" /> | |||
<fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run" /> | |||
<!-- Test with these browsers --> | |||
<property name="test_browsers" value="winxp-firefox9" /> | |||
<!-- Path to key file. Default value --> | |||
<property name="sshkey.file" value="id_dsa" /> | |||
<!-- path and name for demo.war to be deployed --> | |||
<property name="demo.war" value="demo.war"/> | |||
<property name="demo.war" value="demo.war" /> | |||
<!-- Host running Testbench RC or Testbench Hub. Default value --> | |||
<property name="com.vaadin.testbench.tester.host" value="127.0.0.1" /> | |||
@@ -36,7 +36,7 @@ | |||
<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}" /> | |||
</target> | |||
<!-- Run basic integration test test --> | |||
<target name="integration-test-servlet"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="integration-test-${server-name}-servlet.html" /> | |||
@@ -50,11 +50,11 @@ | |||
<property name="testfiles" value="${testfiles}" /> | |||
<property name="test-output-dir" value="../build/integration-test-output/${server-name}" /> | |||
<property name="retries" value="0" /> | |||
<fileset dir="." includes="test.xml" /> | |||
</subant> | |||
</target> | |||
<target name="integration-test-theme"> | |||
<subant target="run-tests" failonerror="false" antfile="test.xml"> | |||
<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" /> | |||
@@ -63,16 +63,16 @@ | |||
<property name="server.start.succeeded" value="1" /> | |||
<property name="testfiles" value="${testfiles-theme}" /> | |||
<property name="test-output-dir" value="../build/integration-test-output/${server-name}" /> | |||
<fileset dir="." includes="test.xml" /> | |||
</subant> | |||
</target> | |||
<!-- Run integration test on GAE --> | |||
<target name="integration-test-test-GAE"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="GoogleAppEngine/integration-test-GAE.html" /> | |||
<pathconvert pathsep=" " property="test-GAE" refid="html-test-files" /> | |||
<subant target="run-tests" failonerror="false" antfile="test.xml"> | |||
<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" /> | |||
<property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" /> | |||
@@ -81,119 +81,123 @@ | |||
<property name="browsers" value="${test_browsers}" /> | |||
<property name="testfiles" value="${test-GAE}" /> | |||
<property name="test-output-dir" value="../build/integration-test-gae-output" /> | |||
<fileset dir="." includes="test.xml" /> | |||
</subant> | |||
</target> | |||
<target name="integration-test-deploy-to-GAE"> | |||
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" /> | |||
</target> | |||
<target name="integration-test-tomcat7"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="tomcat7" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-tomcat5"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="tomcat5" /> | |||
</antcall> | |||
</target> | |||
</target> | |||
<target name="integration-test-tomcat6"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="tomcat6" /> | |||
</antcall> | |||
</target> | |||
</target> | |||
<target name="integration-test-jetty5"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="target-server" value="jetty5" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-jetty6"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="target-server" value="jetty6" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-jetty7"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="target-server" value="jetty7" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-jetty8"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="target-server" value="jetty8" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-jboss4"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="jboss4" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-jboss5"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="jboss5" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-jboss6"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="jboss6" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-jboss7"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="jboss7" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-glassfish2"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="glassfish2" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-glassfish3"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="300" /> | |||
<param name="startDelay" value="10" /> | |||
<param name="target-server" value="glassfish3" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-liferay6"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" /> | |||
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> | |||
<fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" /> | |||
<pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" /> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="target-server" value="liferay6" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-liferay5"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" /> | |||
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="target-server" value="liferay5" /> | |||
</antcall> | |||
</target> | |||
@@ -201,65 +205,77 @@ | |||
<target name="integration-test-liferay6ee"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" /> | |||
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> | |||
<fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" /> | |||
<pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" /> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="target-server" value="liferay6ee" /> | |||
</antcall> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-gatein3"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" /> | |||
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="test_browsers" value="winxp-firefox36" /> | |||
<param name="target-server" value="gatein3" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-exo3"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" /> | |||
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="test_browsers" value="winxp-firefox36" /> | |||
<param name="target-server" value="exo3" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-weblogic9"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="target-port" value="7001" /> | |||
<param name="target-server" value="weblogic9" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-weblogic10"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="target-port" value="7001" /> | |||
<param name="target-server" value="weblogic10" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-weblogic12"> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="target-port" value="7001" /> | |||
<param name="target-server" value="weblogic12" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-weblogicPortal"> | |||
<fileset dir="integration-testscripts" id="html-test-files" includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" /> | |||
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> | |||
<antcall target="run-generic-integration-test"> | |||
<param name="startDelay" value="600" /> | |||
<param name="target-port" value="7001" /> | |||
<param name="target-server" value="weblogicportal" /> | |||
</antcall> | |||
</target> | |||
<target name="integration-test-GAE"> | |||
<antcall target="integration-test-deploy-to-GAE"/> | |||
<antcall target="integration-test-deploy-to-GAE" /> | |||
<antcall target="integration-test-test-GAE" /> | |||
</target> | |||
<!-- Upload demo, clean error screenshots and test deployment on all servers --> | |||
<target name="integration-test-all" depends="common.init-deps"> | |||
<parallel> | |||
<antcontrib:trycatch property="tried"> | |||
<try> | |||
@@ -268,22 +284,21 @@ | |||
<antcall target="integration-test-get-lock" /> | |||
<echo message="Got lock" /> | |||
<antcall target="integration-test-upload-demo" /> | |||
<antcall target="run-integration-test"> | |||
<param name="target-server" value="GAE"/> | |||
<param name="target-server" value="GAE" /> | |||
</antcall> | |||
<antcall target="integration-test-clean" /> | |||
<echo message="Getting lock" /> | |||
<antcall target="integration-test-release-lock" /> | |||
<echo message="Lock released" /> | |||
</try> | |||
<catch> | |||
<echo message="Uploading of demo.war failed. ${tried}" /> | |||
</catch> | |||
</antcontrib:trycatch> | |||
<antcall target="integration-test-liferay6" /> | |||
<antcall target="integration-test-liferay6ee" /> | |||
<antcall target="integration-test-exo3" /> | |||
@@ -291,6 +306,7 @@ | |||
<antcall target="integration-test-liferay5" /> | |||
<antcall target="integration-test-weblogic9" /> | |||
<antcall target="integration-test-weblogic10" /> | |||
<antcall target="integration-test-weblogic12" /> | |||
<antcall target="integration-test-gatein3" /> | |||
<antcall target="integration-test-glassfish2" /> | |||
<antcall target="integration-test-glassfish3" /> | |||
@@ -301,26 +317,26 @@ | |||
<antcall target="integration-test-jetty5" /> | |||
<antcall target="integration-test-jetty6" /> | |||
<antcall target="integration-test-jetty7" /> | |||
<antcall target="integration-test-jetty8" /> | |||
<antcall target="integration-test-tomcat5" /> | |||
<antcall target="integration-test-tomcat6" /> | |||
<antcall target="integration-test-tomcat7" /> | |||
</parallel> | |||
</target> | |||
<target name="do-run-generic-test"> | |||
<property name="target-host" value="${target-server}.devnet.vaadin.com" /> | |||
<property name="target-port" value="8080" /> | |||
<antcontrib:if> | |||
<isset property="startDelay" /> | |||
<then> | |||
<antcontrib:math result="sleepTime" datatype="int"> | |||
<op op="rint"> | |||
<op op="*"> | |||
<num value="${startDelay}"/> | |||
<op op="random"/> | |||
<num value="${startDelay}" /> | |||
<op op="random" /> | |||
</op> | |||
</op> | |||
</antcontrib:math> | |||
@@ -334,7 +350,7 @@ | |||
<include name="*" /> | |||
</fileset> | |||
</scp> | |||
<!-- trycatch probably not needed any more as it just fails with the original message and doesn't do anything in the finally block --> | |||
<antcontrib:trycatch property="error_message"> | |||
<try> | |||
@@ -346,14 +362,14 @@ | |||
</antcall> | |||
<scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" /> | |||
<!-- timeout in 15 minutes --> | |||
<sshexec host="${target-host}" outputproperty="start-output" timeout="900000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml startup-and-deploy" failonerror="false" /> | |||
<antcall target="echo-prefix"> | |||
<param name="prefix" value="${target-server}: " /> | |||
<param name="message" value="${start-output}" /> | |||
</antcall> | |||
<fail message="${start-output}"> | |||
<condition> | |||
<not> | |||
@@ -367,7 +383,7 @@ | |||
<param name="server-name" value="${target-server}" /> | |||
<param name="deployment.url" value="http://${target-host}:${target-port}" /> | |||
</antcall> | |||
<!-- Run theme tests in all browsers if there's a property with the test files --> | |||
<antcontrib:if> | |||
<isset property="testfiles-theme" /> | |||
@@ -380,7 +396,7 @@ | |||
</antcontrib:if> | |||
<!-- timeout in five minutes --> | |||
<sshexec host="${target-host}" outputproperty="stop-output" timeout="300000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" /> | |||
<sshexec host="${target-host}" outputproperty="stop-output" timeout="600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" /> | |||
<antcall target="echo-prefix"> | |||
<param name="prefix" value="${target-server}: " /> | |||
<param name="message" value="${stop-output}" /> | |||
@@ -391,12 +407,12 @@ | |||
</catch> | |||
</antcontrib:trycatch> | |||
</target> | |||
<target name="echo-prefix"> | |||
<antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" /> | |||
<echo message="${message-prefixed}" /> | |||
</target> | |||
<target name="run-generic-integration-test"> | |||
<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat> | |||
<antcontrib:trycatch property="tried"> | |||
@@ -412,20 +428,20 @@ | |||
</catch> | |||
</antcontrib:trycatch> | |||
<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat> | |||
</target> | |||
</target> | |||
<target name="teamcity-escape"> | |||
<property name="returnTo" value="return" /> | |||
<!-- Should also perform other escaping (\u0085, \u2028 and \u2029) - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity --> | |||
<!-- Immutable properties -> needs to create a new one every time --> | |||
<antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" /> | |||
<antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" /> | |||
<antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" /> | |||
<property name="${returnTo}" value="${details-escaped3}" /> | |||
</target> | |||
<target name="run-integration-test"> | |||
<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat> | |||
<antcontrib:trycatch property="tried"> | |||
@@ -442,15 +458,15 @@ | |||
</antcontrib:trycatch> | |||
<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat> | |||
</target> | |||
<target name="integration-test-get-lock"> | |||
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" /> | |||
</target> | |||
<target name="integration-test-release-lock"> | |||
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" /> | |||
</target> | |||
<!-- Remove demo.war --> | |||
<target name="integration-test-clean"> | |||
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" /> |
@@ -18,7 +18,6 @@ import java.util.jar.JarEntry; | |||
import org.junit.Test; | |||
import com.vaadin.Application; | |||
import com.vaadin.tests.components.AbstractComponentTest; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.ComponentContainer; | |||
import com.vaadin.ui.CustomComponent; | |||
@@ -115,11 +114,13 @@ public class VaadinClasses { | |||
} | |||
@SuppressWarnings({ "unchecked", "rawtypes" }) | |||
public static List<Class<? extends AbstractComponentTest<?>>> getBasicComponentTests() { | |||
public static List<Class<?>> getBasicComponentTests() { | |||
try { | |||
return (List) findClasses(AbstractComponentTest.class, | |||
// Given as name to avoid dependencies on testbench source folder | |||
return (List) findClasses( | |||
Class.forName("com.vaadin.tests.components.AbstractComponentTest"), | |||
"com.vaadin.tests.components"); | |||
} catch (IOException e) { | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return null; | |||
} |
@@ -0,0 +1,84 @@ | |||
package com.vaadin.tests.server.componentcontainer; | |||
import junit.framework.TestCase; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.Label; | |||
import com.vaadin.ui.Layout; | |||
public abstract class AbstractIndexedLayoutTest extends TestCase { | |||
private Layout layout; | |||
protected abstract Layout createLayout(); | |||
@Override | |||
protected void setUp() throws Exception { | |||
layout = createLayout(); | |||
} | |||
public Layout getLayout() { | |||
return layout; | |||
} | |||
public void testAddRemoveComponent() { | |||
Label c1 = new Label(); | |||
Label c2 = new Label(); | |||
layout.addComponent(c1); | |||
assertEquals(c1, getComponent(0)); | |||
assertEquals(1, getComponentCount()); | |||
layout.addComponent(c2); | |||
assertEquals(c1, getComponent(0)); | |||
assertEquals(c2, getComponent(1)); | |||
assertEquals(2, getComponentCount()); | |||
layout.removeComponent(c1); | |||
assertEquals(c2, getComponent(0)); | |||
assertEquals(1, getComponentCount()); | |||
layout.removeComponent(c2); | |||
assertEquals(0, getComponentCount()); | |||
} | |||
protected abstract int getComponentCount(); | |||
protected abstract Component getComponent(int index); | |||
protected abstract int getComponentIndex(Component c); | |||
public void testGetComponentIndex() { | |||
Label c1 = new Label(); | |||
Label c2 = new Label(); | |||
layout.addComponent(c1); | |||
assertEquals(0, getComponentIndex(c1)); | |||
layout.addComponent(c2); | |||
assertEquals(0, getComponentIndex(c1)); | |||
assertEquals(1, getComponentIndex(c2)); | |||
layout.removeComponent(c1); | |||
assertEquals(0, getComponentIndex(c2)); | |||
layout.removeComponent(c2); | |||
assertEquals(-1, getComponentIndex(c2)); | |||
assertEquals(-1, getComponentIndex(c1)); | |||
} | |||
public void testGetComponent() { | |||
Label c1 = new Label(); | |||
Label c2 = new Label(); | |||
layout.addComponent(c1); | |||
assertEquals(c1, getComponent(0)); | |||
layout.addComponent(c2); | |||
assertEquals(c1, getComponent(0)); | |||
assertEquals(c2, getComponent(1)); | |||
layout.removeComponent(c1); | |||
assertEquals(c2, getComponent(0)); | |||
layout.removeComponent(c2); | |||
try { | |||
getComponent(0); | |||
fail(); | |||
} catch (IndexOutOfBoundsException e) { | |||
// Expected | |||
} | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.vaadin.tests.server.componentcontainer; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.CssLayout; | |||
import com.vaadin.ui.Layout; | |||
public class CssLayoutTest extends AbstractIndexedLayoutTest { | |||
@Override | |||
protected Layout createLayout() { | |||
return new CssLayout(); | |||
} | |||
@Override | |||
public CssLayout getLayout() { | |||
return (CssLayout) super.getLayout(); | |||
} | |||
@Override | |||
protected Component getComponent(int index) { | |||
return getLayout().getComponent(index); | |||
} | |||
@Override | |||
protected int getComponentIndex(Component c) { | |||
return getLayout().getComponentIndex(c); | |||
} | |||
@Override | |||
protected int getComponentCount() { | |||
return getLayout().getComponentCount(); | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.vaadin.tests.server.componentcontainer; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.FormLayout; | |||
import com.vaadin.ui.Layout; | |||
public class FormLayoutTest extends AbstractIndexedLayoutTest { | |||
@Override | |||
protected Layout createLayout() { | |||
return new FormLayout(); | |||
} | |||
@Override | |||
public FormLayout getLayout() { | |||
return (FormLayout) super.getLayout(); | |||
} | |||
@Override | |||
protected Component getComponent(int index) { | |||
return getLayout().getComponent(index); | |||
} | |||
@Override | |||
protected int getComponentIndex(Component c) { | |||
return getLayout().getComponentIndex(c); | |||
} | |||
@Override | |||
protected int getComponentCount() { | |||
return getLayout().getComponentCount(); | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.vaadin.tests.server.componentcontainer; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.Layout; | |||
import com.vaadin.ui.VerticalLayout; | |||
public class VerticalLayoutTest extends AbstractIndexedLayoutTest { | |||
@Override | |||
protected Layout createLayout() { | |||
return new VerticalLayout(); | |||
} | |||
@Override | |||
public VerticalLayout getLayout() { | |||
return (VerticalLayout) super.getLayout(); | |||
} | |||
@Override | |||
protected Component getComponent(int index) { | |||
return getLayout().getComponent(index); | |||
} | |||
@Override | |||
protected int getComponentIndex(Component c) { | |||
return getLayout().getComponentIndex(c); | |||
} | |||
@Override | |||
protected int getComponentCount() { | |||
return getLayout().getComponentCount(); | |||
} | |||
} |
@@ -94,7 +94,7 @@ | |||
<include name="**/**.java" /> | |||
</fileset> | |||
<antcontrib:for threadCount="40" parallel="true" keepgoing="true" param="target"> | |||
<antcontrib:for threadCount="30" parallel="true" keepgoing="true" param="target"> | |||
<path> | |||
<fileset refid="tests-fileset" /> | |||
</path> |
@@ -33,7 +33,7 @@ import com.vaadin.ui.VerticalLayout; | |||
public class Components extends Application.LegacyApplication { | |||
private static final Object CAPTION = "c"; | |||
private Map<Class<? extends AbstractComponentTest<?>>, String> tests = new HashMap<Class<? extends AbstractComponentTest<?>>, String>(); | |||
private Map<Class<? extends AbstractComponentTest>, String> tests = new HashMap<Class<? extends AbstractComponentTest>, String>(); | |||
private Tree naviTree; | |||
private HorizontalSplitPanel sp; | |||
private LegacyWindow mainWindow; | |||
@@ -42,10 +42,9 @@ public class Components extends Application.LegacyApplication { | |||
private List<Class<? extends Component>> componentsWithoutTests = new ArrayList<Class<? extends Component>>(); | |||
{ | |||
for (Class<? extends AbstractComponentTest<?>> c : VaadinClasses | |||
.getBasicComponentTests()) { | |||
for (Class<?> c : VaadinClasses.getBasicComponentTests()) { | |||
String testClass = c.getSimpleName(); | |||
tests.put(c, testClass); | |||
tests.put((Class<? extends AbstractComponentTest>) c, testClass); | |||
} | |||
List<Class<? extends Component>> componentsWithoutTest = VaadinClasses | |||
@@ -172,7 +171,7 @@ public class Components extends Application.LegacyApplication { | |||
hc.setItemSorter(sorter); | |||
naviTree.addContainerProperty(CAPTION, String.class, ""); | |||
naviTree.setItemCaptionPropertyId(CAPTION); | |||
for (Class<? extends AbstractComponentTest<?>> cls : tests.keySet()) { | |||
for (Class<? extends AbstractComponentTest> cls : tests.keySet()) { | |||
addTreeItem(cls); | |||
} | |||
hc.sort(new Object[] { CAPTION }, new boolean[] { true }); | |||
@@ -227,13 +226,13 @@ public class Components extends Application.LegacyApplication { | |||
} | |||
@SuppressWarnings("unchecked") | |||
private void addTreeItem(Class<? extends AbstractComponentTest<?>> cls) { | |||
private void addTreeItem(Class<? extends AbstractComponentTest> cls) { | |||
String name = tests.get(cls); | |||
if (name == null) { | |||
name = cls.getSimpleName(); | |||
} | |||
Class<? extends AbstractComponentTest<?>> superClass = (Class<? extends AbstractComponentTest<?>>) cls | |||
Class<? extends AbstractComponentTest> superClass = (Class<? extends AbstractComponentTest>) cls | |||
.getSuperclass(); | |||
// This cast is needed only to make compilation through Ant work .. | |||
@@ -250,9 +249,9 @@ public class Components extends Application.LegacyApplication { | |||
} | |||
protected Component createTestComponent( | |||
Class<? extends AbstractComponentTest<?>> cls) { | |||
Class<? extends AbstractComponentTest> cls) { | |||
try { | |||
AbstractComponentTest<?> t = cls.newInstance(); | |||
AbstractComponentTest t = cls.newInstance(); | |||
t.init(); | |||
ComponentContainer c = t.getMainWindow().getContent(); | |||
t.getMainWindow().setContent(null); |
@@ -101,12 +101,16 @@ | |||
<td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td> | |||
<td>enter</td> | |||
</tr> | |||
<tr> | |||
<td>pause</td> | |||
<td>100</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>assertText</td> | |||
<td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_0</td> | |||
<td>4. Item one-1 selected</td> | |||
</tr> | |||
</tbody></table> | |||
</body> | |||
</html> |
@@ -0,0 +1,32 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |||
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> | |||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |||
<link rel="selenium.base" href="" /> | |||
<title>New Test</title> | |||
</head> | |||
<body> | |||
<table cellpadding="1" cellspacing="1" border="1"> | |||
<thead> | |||
<tr><td rowspan="1" colspan="3">New Test</td></tr> | |||
</thead><tbody> | |||
<tr> | |||
<td>open</td> | |||
<td>/run/com.vaadin.tests.components.datefield.DatePopupStyleName?&restartApplication</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsdatefieldDatePopupStyleName::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td> | |||
<td>4,10</td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>styled-popup</td> | |||
</tr> | |||
</tbody></table> | |||
</body> | |||
</html> |
@@ -0,0 +1,33 @@ | |||
package com.vaadin.tests.components.datefield; | |||
import java.util.Date; | |||
import com.vaadin.terminal.UserError; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.DateField; | |||
public class DatePopupStyleName extends TestBase { | |||
@Override | |||
public void setup() { | |||
setTheme("reindeer-tests"); | |||
final DateField df = new DateField(); | |||
df.setValue(new Date(1203910239L)); | |||
df.setWidth("200px"); | |||
df.setRequired(true); | |||
df.setComponentError(new UserError("abc")); | |||
df.addStyleName("popup-style"); | |||
addComponent(df); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "The DateField is given a style name 'test', but that style isn't applied on the calendar popup element."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 8083; | |||
} | |||
} |
@@ -0,0 +1,51 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |||
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> | |||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |||
<link rel="selenium.base" href="" /> | |||
<title>New Test</title> | |||
</head> | |||
<body> | |||
<table cellpadding="1" cellspacing="1" border="1"> | |||
<thead> | |||
<tr><td rowspan="1" colspan="3">New Test</td></tr> | |||
</thead><tbody> | |||
<tr> | |||
<td>open</td> | |||
<td>/run/com.vaadin.tests.components.datefield.WidthRecalculationOnEnableStateChange?restartApplication</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>disabled</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>enabled</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>readonly</td> | |||
</tr> | |||
</tbody></table> | |||
</body> | |||
</html> |
@@ -0,0 +1,44 @@ | |||
package com.vaadin.tests.components.datefield; | |||
import java.util.Date; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.DateField; | |||
public class WidthRecalculationOnEnableStateChange extends TestBase { | |||
@Override | |||
public void setup() { | |||
setTheme("reindeer-tests"); | |||
final DateField df = new DateField(); | |||
df.setValue(new Date(1203910239L)); | |||
df.setWidth("200px"); | |||
df.addStyleName("enabled-readonly-styled"); | |||
addComponent(df); | |||
addComponent(new Button("Toggle disabled for date field", | |||
new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
df.setEnabled(!df.isEnabled()); | |||
} | |||
})); | |||
addComponent(new Button("Toggle read only for date field", | |||
new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
df.setReadOnly(!df.isReadOnly()); | |||
} | |||
})); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "Setting the disabled state doesn't recalculate the input element width. Setting the read-only state instead recalculates the width. In both cases, the popup button is hidden using CSS.<br><br>The DateField is also given a style name 'test', but that style isn't applied on the calendar popup element."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 8085; | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |||
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> | |||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |||
<link rel="selenium.base" href="" /> | |||
<title>New Test</title> | |||
</head> | |||
<body> | |||
<table cellpadding="1" cellspacing="1" border="1"> | |||
<thead> | |||
<tr><td rowspan="1" colspan="3">New Test</td></tr> | |||
</thead><tbody> | |||
<tr> | |||
<td>open</td> | |||
<td>/run/com.vaadin.tests.components.formlayout.FormLayoutCaptionStyles?restartApplication</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>assertCSSClass</td> | |||
<td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> | |||
<td>v-caption-bold</td> | |||
</tr> | |||
<tr> | |||
<td>assertCSSClass</td> | |||
<td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td> | |||
<td>bold</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>assertNotCSSClass</td> | |||
<td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td> | |||
<td>bold</td> | |||
</tr> | |||
<tr> | |||
<td>assertNotCSSClass</td> | |||
<td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td> | |||
<td>v-caption-bold</td> | |||
</tr> | |||
</tbody></table> | |||
</body> | |||
</html> |
@@ -0,0 +1,55 @@ | |||
package com.vaadin.tests.components.formlayout; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.FormLayout; | |||
import com.vaadin.ui.TextField; | |||
public class FormLayoutCaptionStyles extends TestBase { | |||
@Override | |||
protected void setup() { | |||
setTheme("reindeer-tests"); | |||
FormLayout fl = new FormLayout(); | |||
TextField f1 = createTextField("Text field 1", ""); | |||
final TextField f2 = createTextField("Text field 2", "bold"); | |||
fl.addComponent(f1); | |||
fl.addComponent(new Button("Toggle Text field 2 bold style", | |||
new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if ("bold".equals(f2.getStyleName())) { | |||
f2.setStyleName(""); | |||
} else { | |||
f2.setStyleName("bold"); | |||
} | |||
} | |||
})); | |||
fl.addComponent(f2); | |||
addComponent(fl); | |||
} | |||
private TextField createTextField(String caption, String style) { | |||
TextField tf = new TextField(caption); | |||
tf.setStyleName(style); | |||
return tf; | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "The component style should be copied to the caption element. Changing the component style should update the caption style also"; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 5982; | |||
} | |||
} |
@@ -0,0 +1,102 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |||
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> | |||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |||
<link rel="selenium.base" href="" /> | |||
<title>New Test</title> | |||
</head> | |||
<body> | |||
<table cellpadding="1" cellspacing="1" border="1"> | |||
<thead> | |||
<tr><td rowspan="1" colspan="3">New Test</td></tr> | |||
</thead><tbody> | |||
<tr> | |||
<td>open</td> | |||
<td>/run/com.vaadin.tests.components.orderedlayout.OrderedLayoutCases?restartApplication</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>1-undefined-without-relative</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>2-undefined-with-relative</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>3-fixed-with-overflow</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>4-fixed-with-extra-space</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[7]/VButton[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<!-- Going in the reverse direction from here to avoid some bugs where state is not properly updated --> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>8-undefined-relative-height</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[6]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>7-fixed-relative-height</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>6-multiple-expands</td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>5-expand-with-alignment</td> | |||
</tr> | |||
</tbody></table> | |||
</body> | |||
</html> |
@@ -12,17 +12,21 @@ import com.vaadin.tests.components.AbstractTestRoot; | |||
import com.vaadin.tests.util.TestUtils; | |||
import com.vaadin.ui.AbstractOrderedLayout; | |||
import com.vaadin.ui.Alignment; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.Button.ClickListener; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.NativeSelect; | |||
import com.vaadin.ui.VerticalLayout; | |||
public class OrderedLayoutCases extends AbstractTestRoot { | |||
private static final String[] dimensionValues = { "-1px", "5px", "300px", | |||
private static final String[] dimensionValues = { "-1px", "5px", "350px", | |||
"800px", "100%", "50%" }; | |||
private static class SampleChild extends VerticalLayout { | |||
public SampleChild() { | |||
setStyleName("showBorders"); | |||
setStyleName("sampleChild"); | |||
addComponent(createSimpleSelector("Child width", | |||
new ValueChangeListener() { | |||
public void valueChange(ValueChangeEvent event) { | |||
@@ -102,18 +106,24 @@ public class OrderedLayoutCases extends AbstractTestRoot { | |||
} | |||
private AbstractOrderedLayout currentLayout; | |||
private HorizontalLayout sizeBar; | |||
@Override | |||
protected void setup(WrappedRequest request) { | |||
TestUtils.injectCSS(getRoot(), | |||
".showBorders {border: 1px solid black};"); | |||
TestUtils | |||
.injectCSS( | |||
getRoot(), | |||
".sampleChild, .theLayout {border: 1px solid black;}" | |||
+ ".theLayout > div > div:first-child {background: aqua;}" | |||
+ ".theLayout > div > div:first-child + div {background: yellow;}" | |||
+ ".theLayout > div > div:first-child + div + div {background: lightgrey;}"); | |||
currentLayout = new HorizontalLayout(); | |||
for (int i = 0; i < 3; i++) { | |||
currentLayout.addComponent(new SampleChild()); | |||
} | |||
HorizontalLayout sizeBar = new HorizontalLayout(); | |||
sizeBar = new HorizontalLayout(); | |||
sizeBar.setSpacing(true); | |||
sizeBar.addComponent(createSimpleSelector("Layout width", | |||
@@ -130,6 +140,20 @@ public class OrderedLayoutCases extends AbstractTestRoot { | |||
.toString()); | |||
} | |||
}, dimensionValues)); | |||
sizeBar.addComponent(createSimpleSelector("Spacing", | |||
new ValueChangeListener() { | |||
public void valueChange(ValueChangeEvent event) { | |||
currentLayout.setSpacing(Boolean.parseBoolean(event | |||
.getProperty().getValue().toString())); | |||
} | |||
}, "false", "true")); | |||
sizeBar.addComponent(createSimpleSelector("Margin", | |||
new ValueChangeListener() { | |||
public void valueChange(ValueChangeEvent event) { | |||
currentLayout.setMargin(Boolean.parseBoolean(event | |||
.getProperty().getValue().toString())); | |||
} | |||
}, "false", "true")); | |||
sizeBar.addComponent(createSimpleSelector("Direction", | |||
new ValueChangeListener() { | |||
public void valueChange(ValueChangeEvent event) { | |||
@@ -146,7 +170,7 @@ public class OrderedLayoutCases extends AbstractTestRoot { | |||
newLayout.addComponent(currentLayout | |||
.getComponent(0)); | |||
} | |||
newLayout.setStyleName("showBorders"); | |||
newLayout.setStyleName("theLayout"); | |||
newLayout.setHeight(currentLayout.getHeight(), | |||
currentLayout.getHeightUnits()); | |||
@@ -158,6 +182,112 @@ public class OrderedLayoutCases extends AbstractTestRoot { | |||
} | |||
}, "Horizontal", "Vertical")); | |||
HorizontalLayout caseBar = new HorizontalLayout(); | |||
caseBar.addComponent(new Button("Undefined without relative", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// width: 350px to middle child | |||
setChildState(1, 0, 2); | |||
} | |||
})); | |||
caseBar.addComponent(new Button("Undefined with relative", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// width: 100% to middle child | |||
setChildState(1, 0, 4); | |||
} | |||
})); | |||
caseBar.addComponent(new Button("Fixed with overflow", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// layout width: 350px | |||
setState(sizeBar, 0, 2); | |||
// layout margin enabled | |||
setState(sizeBar, 3, 1); | |||
} | |||
})); | |||
caseBar.addComponent(new Button("Fixed with extra space", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// Layout width: 800px | |||
setState(sizeBar, 0, 3); | |||
// layout margin enabled | |||
setState(sizeBar, 3, 1); | |||
// width: 350px to middle child | |||
setChildState(1, 0, 2); | |||
} | |||
})); | |||
caseBar.addComponent(new Button("Expand with alignment", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// Layout width: 800px | |||
setState(sizeBar, 0, 3); | |||
// Layout height: 350px | |||
setState(sizeBar, 1, 2); | |||
// Expand: 1 to middle child | |||
setChildState(1, 3, 1); | |||
// Align bottom left to middle child | |||
setChildState(1, 4, 6); | |||
} | |||
})); | |||
caseBar.addComponent(new Button("Multiple expands", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// Layout width: 800px | |||
setState(sizeBar, 0, 3); | |||
// Layout height: 350px | |||
setState(sizeBar, 1, 2); | |||
// Width 350px to middle child | |||
setChildState(1, 0, 2); | |||
// Apply to left and middle child | |||
for (int i = 0; i < 2; i++) { | |||
// Expand: 1 | |||
setChildState(i, 3, 1); | |||
// Align: middle center | |||
setChildState(i, 4, 5); | |||
} | |||
} | |||
})); | |||
caseBar.addComponent(new Button("Fixed + relative height", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// Layout height: 100% | |||
setState(sizeBar, 1, 4); | |||
// Height: 350px to left child | |||
setChildState(0, 1, 2); | |||
// Height: 100% to middle child | |||
setChildState(1, 1, 4); | |||
// Alignment: bottom left to right child | |||
setChildState(2, 4, 7); | |||
} | |||
})); | |||
caseBar.addComponent(new Button("Undefined + relative height", | |||
new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
resetState(); | |||
// Height: 350px to left child | |||
setChildState(0, 1, 2); | |||
// Height: 100% to middle child | |||
setChildState(1, 1, 4); | |||
// Alignment: bottom left to right child | |||
setChildState(2, 4, 7); | |||
} | |||
})); | |||
caseBar.setSpacing(true); | |||
addComponent(caseBar); | |||
addComponent(sizeBar); | |||
addComponent(currentLayout); | |||
@@ -167,6 +297,34 @@ public class OrderedLayoutCases extends AbstractTestRoot { | |||
getLayout().setExpandRatio(currentLayout, 1); | |||
} | |||
private void resetState() { | |||
for (int i = 0; i < sizeBar.getComponentCount(); i++) { | |||
setState(sizeBar, i, 0); | |||
} | |||
for (int i = 0; i < 3; i++) { | |||
// Child width and height -> -1px | |||
SampleChild child = (SampleChild) currentLayout.getComponent(i); | |||
for (int j = 0; j < child.getComponentCount(); j++) { | |||
if (j == 4) { | |||
setState(child, j, 1); | |||
} else { | |||
setState(child, j, 0); | |||
} | |||
} | |||
} | |||
} | |||
private void setChildState(int childIndex, int selectIndex, int valueIndex) { | |||
Component child = currentLayout.getComponent(childIndex); | |||
setState(child, selectIndex, valueIndex); | |||
} | |||
private static void setState(Component container, int selectIndex, int value) { | |||
NativeSelect select = (NativeSelect) ((AbstractOrderedLayout) container) | |||
.getComponent(selectIndex); | |||
select.setValue(new ArrayList<Object>(select.getItemIds()).get(value)); | |||
} | |||
private static NativeSelect createSimpleSelector(String caption, | |||
ValueChangeListener listener, String... values) { | |||
return createSimpleSelector(caption, listener, Arrays.asList(values), | |||
@@ -185,14 +343,13 @@ public class OrderedLayoutCases extends AbstractTestRoot { | |||
} | |||
@Override | |||
protected String getTestDescription() { | |||
return "Tester application for exploring how Horizontal/VerticalLayout reacts to various settings "; | |||
protected Integer getTicketNumber() { | |||
return null; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
protected String getTestDescription() { | |||
return "Tester application for exploring how Horizontal/VerticalLayout reacts to various settings "; | |||
} | |||
} |
@@ -0,0 +1,211 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |||
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> | |||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |||
<link rel="selenium.base" href="" /> | |||
<title>New Test</title> | |||
</head> | |||
<body> | |||
<table cellpadding="1" cellspacing="1" border="1"> | |||
<thead> | |||
<tr><td rowspan="1" colspan="3">New Test</td></tr> | |||
</thead><tbody> | |||
<tr> | |||
<td>open</td> | |||
<td>/run/com.vaadin.tests.components.orderedlayout.VerticalLayoutTest?restartApplication</td> | |||
<td></td> | |||
</tr> | |||
<!--Hide event log--> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item1</td> | |||
<td>28,5</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item0</td> | |||
<td>30,8</td> | |||
</tr> | |||
<!--Add components--> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td> | |||
<td>41,8</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> | |||
<td>84,6</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item0</td> | |||
<td>43,6</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td> | |||
<td>68,8</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td> | |||
<td>30,11</td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>auto-auto-one-button</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td> | |||
<td>35,11</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> | |||
<td>85,5</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item0</td> | |||
<td>83,3</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td> | |||
<td>28,7</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item1</td> | |||
<td>40,10</td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>auto-auto-two-buttons</td> | |||
</tr> | |||
<!--Component 0 -> 100%--> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td> | |||
<td>42,6</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> | |||
<td>77,6</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2</td> | |||
<td>115,7</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td> | |||
<td>72,8</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item4</td> | |||
<td>14,2</td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>auto-auto-two-buttons-equal-width</td> | |||
</tr> | |||
<!--Component 1 -> 200px height--> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td> | |||
<td>22,9</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> | |||
<td>117,9</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item3</td> | |||
<td>104,8</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td> | |||
<td>74,12</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item2</td> | |||
<td>23,8</td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>auto-auto-two-buttons-lower-higher</td> | |||
</tr> | |||
<!--Back to what we had before--> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td> | |||
<td>24,11</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> | |||
<td>104,12</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2</td> | |||
<td>114,10</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td> | |||
<td>87,11</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td> | |||
<td>17,8</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td> | |||
<td>28,3</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> | |||
<td>77,8</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item3</td> | |||
<td>96,6</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td> | |||
<td>75,10</td> | |||
</tr> | |||
<tr> | |||
<td>mouseClick</td> | |||
<td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td> | |||
<td>19,3</td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>auto-auto-two-buttons</td> | |||
</tr> | |||
</tbody></table> | |||
</body> | |||
</html> |
@@ -0,0 +1,88 @@ | |||
package com.vaadin.tests.components.table; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.Layout; | |||
import com.vaadin.ui.Table; | |||
import com.vaadin.ui.VerticalLayout; | |||
public class ScrollDetachSynchronization extends TestBase { | |||
@Override | |||
public void setup() { | |||
getMainWindow().setContent(buildLayout()); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "Scrolling, then detaching, a table causes out of sync on IE"; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 6970; | |||
} | |||
private Layout buildLayout() { | |||
final VerticalLayout mainLayout = new VerticalLayout(); | |||
mainLayout.setSizeFull(); | |||
HorizontalLayout buttonBar = new HorizontalLayout(); | |||
buttonBar.setSizeUndefined(); | |||
Button first = new Button("First layout"); | |||
Button second = new Button("Second layout"); | |||
first.setDebugId("FirstButton"); | |||
second.setDebugId("SecondButton"); | |||
buttonBar.addComponent(first); | |||
buttonBar.addComponent(second); | |||
mainLayout.addComponent(buttonBar); | |||
final HorizontalLayout firstLayout = buildTestLayout(true); | |||
final HorizontalLayout secondLayout = buildTestLayout(false); | |||
mainLayout.addComponent(firstLayout); | |||
mainLayout.setExpandRatio(firstLayout, 1); | |||
first.addListener(new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if (mainLayout.getComponent(1).equals(secondLayout)) { | |||
mainLayout.replaceComponent(secondLayout, firstLayout); | |||
mainLayout.setExpandRatio(firstLayout, 1); | |||
} | |||
} | |||
}); | |||
second.addListener(new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
if (mainLayout.getComponent(1).equals(firstLayout)) { | |||
mainLayout.replaceComponent(firstLayout, secondLayout); | |||
mainLayout.setExpandRatio(secondLayout, 1); | |||
} | |||
} | |||
}); | |||
return mainLayout; | |||
} | |||
private HorizontalLayout buildTestLayout(boolean first) { | |||
String which = first ? "First" : "Second"; | |||
HorizontalLayout hl = new HorizontalLayout(); | |||
hl.setSizeFull(); | |||
hl.setDebugId(which + "Layout"); | |||
Table t = new Table(); | |||
t.addContainerProperty("name", String.class, null); | |||
for (int i = 0; i < 10; i++) { | |||
String id = which + " " + i; | |||
t.addItem(new String[] { id }, id); | |||
} | |||
t.setDebugId(which + "Table"); | |||
t.setItemCaptionPropertyId("name"); | |||
t.setSizeFull(); | |||
hl.addComponent(t); | |||
return hl; | |||
} | |||
} |
@@ -10,10 +10,14 @@ public class TableHeaderZoom extends TestBase { | |||
@Override | |||
protected void setup() { | |||
Table table = new Table(); | |||
table.setHeight("100px"); | |||
table.setWidth("200px"); | |||
table.setEnabled(false); | |||
table.setHeight("400px"); | |||
table.setWidth("400px"); | |||
table.addContainerProperty("Column 1", String.class, ""); | |||
table.addContainerProperty("Column 2", String.class, ""); | |||
for (int i = 0; i < 100; ++i) { | |||
table.addItem(new Object[] { "" + i, "foo" }, i); | |||
} | |||
LegacyWindow main = getMainWindow(); | |||
main.setContent(new CssLayout()); |
@@ -0,0 +1,43 @@ | |||
package com.vaadin.tests.components.table; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.Button.ClickListener; | |||
import com.vaadin.ui.Table; | |||
public class TableRepaintWhenMadeVisibile extends TestBase { | |||
@Override | |||
public void setup() { | |||
final Table table = new Table(); | |||
table.addContainerProperty("sth", String.class, null); | |||
table.addItem(new Object[] { "something" }, 1); | |||
addComponent(table); | |||
Button show = new Button("show", new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
table.setVisible(true); | |||
} | |||
}); | |||
addComponent(show); | |||
Button hide = new Button("hide", new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
table.setVisible(false); | |||
} | |||
}); | |||
addComponent(hide); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "A Table should be rendered correctly when made visible again after being initially rendered invisible. Click 'hide', refresh the application and then click 'show'"; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 7986; | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |||
<head profile="http://selenium-ide.openqa.org/profiles/test-case"> | |||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |||
<link rel="selenium.base" href="" /> | |||
<title>New Test</title> | |||
</head> | |||
<body> | |||
<table cellpadding="1" cellspacing="1" border="1"> | |||
<thead> | |||
<tr><td rowspan="1" colspan="3">New Test</td></tr> | |||
</thead><tbody> | |||
<tr> | |||
<td>open</td> | |||
<td>/run/com.vaadin.tests.components.table.TableRepaintWhenMadeVisibile?restartApplication</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentstableTableRepaintWhenMadeVisibile::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>open</td> | |||
<td>/run/com.vaadin.tests.components.table.TableRepaintWhenMadeVisibile</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>click</td> | |||
<td>vaadin=runcomvaadintestscomponentstableTableRepaintWhenMadeVisibile::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td>screenCapture</td> | |||
<td></td> | |||
<td>hidden-then-shown</td> | |||
</tr> | |||
</tbody></table> | |||
</body> | |||
</html> |
@@ -0,0 +1,42 @@ | |||
package com.vaadin.tests.components.tabsheet; | |||
import com.vaadin.Application; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.ComponentContainer; | |||
import com.vaadin.ui.Label; | |||
import com.vaadin.ui.TabSheet; | |||
import com.vaadin.ui.VerticalLayout; | |||
import com.vaadin.ui.Window; | |||
public class WrapTabSheetInTabSheet extends TestBase { | |||
@Override | |||
protected void setup() { | |||
final VerticalLayout mainLayout = new VerticalLayout(); | |||
mainLayout.addComponent(new Label("This is main layout")); | |||
addComponent(mainLayout); | |||
Button b = new Button("Wrap main layout in a TabSheet"); | |||
b.addListener(new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
TabSheet tabsheet = new TabSheet(); | |||
ComponentContainer mainParent = (ComponentContainer) mainLayout | |||
.getParent(); | |||
mainParent.replaceComponent(mainLayout, tabsheet); | |||
tabsheet.addTab(mainLayout, "Default tab"); | |||
} | |||
}); | |||
mainLayout.addComponent(b); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "Click the button to add a TabSheet and move the window content into the TabSheet. Every click should wrap the contents with a new TabSheet and the contents should remain visible."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 8238; | |||
} | |||
} |
@@ -0,0 +1,54 @@ | |||
package com.vaadin.tests.components.textarea; | |||
import com.vaadin.event.FieldEvents.TextChangeEvent; | |||
import com.vaadin.event.FieldEvents.TextChangeListener; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.AbstractField; | |||
import com.vaadin.ui.AbstractTextField; | |||
import com.vaadin.ui.AbstractTextField.TextChangeEventMode; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Label; | |||
import com.vaadin.ui.TextArea; | |||
import com.vaadin.ui.TextField; | |||
public class TextAreaCursorPosition extends TestBase { | |||
private TextField cursorPosition = new TextField("Cursor position"); | |||
@Override | |||
public void setup() { | |||
Label label = new Label( | |||
"Test of calculation of cursor position of TextArea"); | |||
TextArea textArea = new TextArea(); | |||
addListener(textArea); | |||
addComponent(label); | |||
addComponent(textArea); | |||
addComponent(cursorPosition); | |||
cursorPosition.setValue("?"); | |||
addComponent(new Button("Force position update")); | |||
} | |||
public void addListener(AbstractField newField) { | |||
AbstractTextField newTextField = (AbstractTextField) newField; | |||
newTextField.setTextChangeEventMode(TextChangeEventMode.EAGER); | |||
newTextField.addListener(new TextChangeListener() { | |||
public void textChange(TextChangeEvent event) { | |||
AbstractTextField component = (AbstractTextField) event | |||
.getComponent(); | |||
cursorPosition.setValue(component.getCursorPosition()); | |||
} | |||
}); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "Writing something in the field updates the cursor position field. The position field can also be updated using the button."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 7726; | |||
} | |||
} |
@@ -0,0 +1,59 @@ | |||
package com.vaadin.tests.components.textfield; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.event.ShortcutAction.KeyCode; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.tests.util.Log; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.Button.ClickListener; | |||
import com.vaadin.ui.CheckBox; | |||
import com.vaadin.ui.TextField; | |||
public class TextFieldInputPromptAndClickShortcut extends TestBase { | |||
@Override | |||
protected void setup() { | |||
final Log log = new Log(5); | |||
final TextField textField = new TextField(); | |||
Button button = new Button("Show Text", new ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
log.log("Field value: " + textField.getValue()); | |||
} | |||
}); | |||
button.setClickShortcut(KeyCode.ESCAPE); | |||
final CheckBox inputPromptSelection = new CheckBox("Input prompt"); | |||
inputPromptSelection.setImmediate(true); | |||
inputPromptSelection.addListener(new ValueChangeListener() { | |||
public void valueChange(ValueChangeEvent event) { | |||
if (event.getProperty().getValue() == Boolean.TRUE) { | |||
textField.setInputPrompt("Input prompt"); | |||
} else { | |||
textField.setInputPrompt(null); | |||
} | |||
log.log("Set input prompt: " + textField.getInputPrompt()); | |||
} | |||
}); | |||
inputPromptSelection.setImmediate(true); | |||
addComponent(textField); | |||
addComponent(button); | |||
addComponent(inputPromptSelection); | |||
addComponent(log); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "With the input propmpt enabled, enter something into the field, press enter, remove the entered text and press the button. The previous text is still reported as the value. Without the input prompt, the new value is instead reported as blank."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
} |