Author: tchemit Date: 2011-01-25 12:58:22 +0100 (Tue, 25 Jan 2011) New Revision: 2163 Url: http://nuiton.org/repositories/revision/jaxx/2163 Log: Evolution #1178: Use nuiton-validator 2.0 Evolution #1240: Review the validation api Evolution #1239: Add a validation tutorial Added: trunk/jaxx-tutorial-validation/ trunk/jaxx-tutorial-validation/LICENSE.txt trunk/jaxx-tutorial-validation/README.txt trunk/jaxx-tutorial-validation/changelog.txt trunk/jaxx-tutorial-validation/pom.xml trunk/jaxx-tutorial-validation/src/ trunk/jaxx-tutorial-validation/src/license/ trunk/jaxx-tutorial-validation/src/license/THIRD-PARTY.properties trunk/jaxx-tutorial-validation/src/main/ trunk/jaxx-tutorial-validation/src/main/filters/ trunk/jaxx-tutorial-validation/src/main/filters/jaxx-demo.properties trunk/jaxx-tutorial-validation/src/main/java/ trunk/jaxx-tutorial-validation/src/main/java/jaxx/ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/DemoConfig.java trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/RunDemo.java trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/AbstractDemoBean.java trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/Movie.java trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/People.java trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.css trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.jaxx trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUIHandler.java trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/ValidationTableDemo.jaxx trunk/jaxx-tutorial-validation/src/main/resources/ trunk/jaxx-tutorial-validation/src/main/resources/i18n/ trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_en_GB.properties trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_fr_FR.properties trunk/jaxx-tutorial-validation/src/main/resources/icons/ trunk/jaxx-tutorial-validation/src/main/resources/icons/action-about.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-accept.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-block.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-close.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-config.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-exit.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-fullscreen.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-help.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-i18n-fr.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-i18n-uk.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-leave-fullscreen.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-reload-application.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-reload-ui.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-show-help.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-site.png trunk/jaxx-tutorial-validation/src/main/resources/icons/action-translate.png trunk/jaxx-tutorial-validation/src/main/resources/icons/jaxx.png trunk/jaxx-tutorial-validation/src/main/resources/jaxx/ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-error-validation.xml trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-warning-validation.xml trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-error-validation.xml trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-info-validation.xml trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-warning-validation.xml trunk/jaxx-tutorial-validation/src/main/resources/log4j.properties trunk/jaxx-tutorial-validation/src/site/ trunk/jaxx-tutorial-validation/src/site/rst/ trunk/jaxx-tutorial-validation/src/site/rst/images/ trunk/jaxx-tutorial-validation/src/site/rst/images/webstart.gif trunk/jaxx-tutorial-validation/src/site/rst/index.rst trunk/jaxx-tutorial-validation/src/site/site_fr.xml Modified: trunk/jaxx-demo/pom.xml trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java trunk/jaxx-tutorial/pom.xml Modified: trunk/jaxx-demo/pom.xml =================================================================== --- trunk/jaxx-demo/pom.xml 2011-01-25 11:57:12 UTC (rev 2162) +++ trunk/jaxx-demo/pom.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -101,9 +101,8 @@ <!-- test dependencies --> <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-validator</artifactId> - <version>${project.version}</version> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> <scope>test</scope> <classifier>tests</classifier> </dependency> Modified: trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java =================================================================== --- trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java 2011-01-25 11:57:12 UTC (rev 2162) +++ trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java 2011-01-25 11:58:22 UTC (rev 2163) @@ -27,37 +27,57 @@ import jaxx.demo.entities.Identity; import jaxx.demo.entities.Model; +import org.junit.Assert; +import org.junit.Test; +import org.nuiton.validator.AbstractValidatorDetectorTest; +import org.nuiton.validator.NuitonValidator; +import org.nuiton.validator.NuitonValidatorScope; +import org.nuiton.validator.ValidatorTestHelper; +import org.nuiton.validator.xwork2.XWork2NuitonValidatorProvider; import java.io.File; import java.util.Iterator; import java.util.SortedSet; -import jaxx.runtime.validator.AbstractBeanValidatorDetectorTest; -import jaxx.runtime.validator.BeanValidator; -import org.junit.BeforeClass; -import static org.junit.Assert.*; -/** - * - * @author tchemit <chemit@codelutin.com> - */ -public class BeanValidatorDetectorTest extends AbstractBeanValidatorDetectorTest { +/** @author tchemit <chemit@codelutin.com> */ +public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest { - @BeforeClass - public static void setUpClass() throws Exception { - AbstractBeanValidatorDetectorTest.setUpClass(); - } - public BeanValidatorDetectorTest() { // prefer do tests on target copy instead of original files - super(new File(basedir, "target" + File.separator + "classes"), Identity.class, Model.class); + super(XWork2NuitonValidatorProvider.PROVIDER_NAME); } + @Test + public void detectAllValidators() { + SortedSet<NuitonValidator<?>> result; + NuitonValidator<?> validator; + Iterator<NuitonValidator<?>> iterator; + + // test with all context and all scopes : 2 validators (Identity+ Model) + + result = detectValidators(Identity.class, Model.class); + + Assert.assertNotNull(result); + Assert.assertEquals(2, result.size()); + + + iterator = result.iterator(); + validator = iterator.next(); + + ValidatorTestHelper.assertValidatorModel(validator, null, Identity.class, NuitonValidatorScope.values()); + ValidatorTestHelper.assertValidatorEffectiveScopes(validator, NuitonValidatorScope.ERROR, NuitonValidatorScope.WARNING, NuitonValidatorScope.INFO); +// ValidatorTestHelper.assertValidatorEffectiveFields(validator, NuitonValidatorScope.ERROR, Person.PROPERTY_NAME, Person.PROPERTY_FIRSTNAME); +// ValidatorTestHelper.assertValidatorEffectiveFields(validator, NuitonValidatorScope.WARNING, Person.PROPERTY_PET); + + validator = iterator.next(); + ValidatorTestHelper.assertValidatorModel(validator, null, Model.class, NuitonValidatorScope.values()); + ValidatorTestHelper.assertValidatorEffectiveScopes(validator, NuitonValidatorScope.ERROR, NuitonValidatorScope.WARNING, NuitonValidatorScope.INFO); +// ValidatorTestHelper.assertValidatorEffectiveFields(validator, NuitonValidatorScope.ERROR, Pet.PROPERTY_NAME); + + } + @Override - protected void assertDetect(SortedSet<BeanValidator<?>> validators) { - assertFalse(validators.isEmpty()); - assertEquals(2, validators.size()); - Iterator<BeanValidator<?>> itrV = validators.iterator(); - assertValidator(Identity.class, null, itrV.next()); - assertValidator(Model.class, null, itrV.next()); + protected File getRootDirectory(File basedir) { + return new File(basedir, "target" + File.separator + "classes"); } } Modified: trunk/jaxx-tutorial/pom.xml =================================================================== --- trunk/jaxx-tutorial/pom.xml 2011-01-25 11:57:12 UTC (rev 2162) +++ trunk/jaxx-tutorial/pom.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -47,6 +47,7 @@ <module>../jaxx-tutorial-css</module> <module>../jaxx-tutorial-databinding</module> <module>../jaxx-tutorial-config</module> + <module>../jaxx-tutorial-validation</module> </modules> <!-- ************************************************************* --> @@ -111,7 +112,7 @@ <plugin> <groupId>org.nuiton.i18n</groupId> <artifactId>maven-i18n-plugin</artifactId> - <version>2.0.1</version> + <version>2.1</version> </plugin> </plugins> Property changes on: trunk/jaxx-tutorial-validation ___________________________________________________________________ Added: svn:ignore + target *.ipr *.iml *.iws .project .classpath .settings *.log Added: trunk/jaxx-tutorial-validation/LICENSE.txt =================================================================== --- trunk/jaxx-tutorial-validation/LICENSE.txt (rev 0) +++ trunk/jaxx-tutorial-validation/LICENSE.txt 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + Property changes on: trunk/jaxx-tutorial-validation/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/README.txt =================================================================== --- trunk/jaxx-tutorial-validation/README.txt (rev 0) +++ trunk/jaxx-tutorial-validation/README.txt 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Property changes on: trunk/jaxx-tutorial-validation/README.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/changelog.txt =================================================================== --- trunk/jaxx-tutorial-validation/changelog.txt (rev 0) +++ trunk/jaxx-tutorial-validation/changelog.txt 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,2 @@ +1.7.2 + * 20091003 [chemit] - initial release (insparated from obsolote jaxx-example module) Property changes on: trunk/jaxx-tutorial-validation/changelog.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/pom.xml =================================================================== --- trunk/jaxx-tutorial-validation/pom.xml (rev 0) +++ trunk/jaxx-tutorial-validation/pom.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,326 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JAXX :: Demo + + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-tutorial</artifactId> + <version>2.3-SNAPSHOT</version> + <relativePath>../jaxx-tutorial</relativePath> + </parent> + + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-tutorial-validation</artifactId> + + <dependencies> + + <!-- JAXX dependencies --> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jaxx-runtime</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jaxx-validator</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jaxx-widgets</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>JAXX :: Tutorial Validation</name> + <description>JAXX Tutorial Validation</description> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>jar</packaging> + + <properties> + + <!-- Jaxx version --> + + <jaxxVersion>${project.version}</jaxxVersion> + + <jaxx.addProjectClassPath>true</jaxx.addProjectClassPath> + <jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath> + <jaxx.autoImportCss>true</jaxx.autoImportCss> + + <!-- main class to run --> + + <maven.jar.main.class>jaxx.demo.validation.RunDemo</maven.jar.main.class> + + <!-- compiler configuration --> + + <maven.compiler.source>1.6</maven.compiler.source> + <maven.compiler.source>1.6</maven.compiler.source> + + <!-- default encoding --> + + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + + <!-- to generate jnlp launcher while releasing jaxx --> + <jnlp.skip>false</jnlp.skip> + + <!-- extra files to include in release --> + <redmine.releaseFiles>${redmine.libReleaseFiles}</redmine.releaseFiles> + + <!-- generate license bundled files --> + <license.generateBundle>true</license.generateBundle> + + </properties> + + <build> + + <resources> + <resource> + <directory>src/main/filters</directory> + <filtering>true</filtering> + <includes> + <include>jaxx-demo.properties</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + <resource> + <directory>src/main/java</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + </resources> + + <plugins> + + <plugin> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>maven-i18n-plugin</artifactId> + <configuration> + <treateDefaultEntry>true</treateDefaultEntry> + <entries> + <entry> + <basedir>${maven.gen.dir}/java/</basedir> + </entry> + </entries> + </configuration> + <executions> + <execution> + <goals> + <goal>parserJava</goal> + <goal>gen</goal> + <goal>bundle</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <outputDirectory>target/lib</outputDirectory> + <silent>true</silent> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <executions> + <execution> + <id>attach-licenses</id> + <goals> + <goal>update-project-license</goal> + <goal>add-third-party</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + </build> + + <profiles> + <!-- by default jnlp is only perform on a release stage when using the maven-release-plugin --> + <profile> + <id>release-jnlp-profile</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + <build> + <plugins> + <!-- key store secrets availables --> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-helper-plugin</artifactId> + <executions> + <execution> + <id>get-keystore</id> + <goals> + <goal>share-server-secret</goal> + </goals> + <phase>package</phase> + <configuration> + <serverId>codelutin-keystore</serverId> + <privateKeyOut>keystorepath</privateKeyOut> + <passwordOut>keystorepass</passwordOut> + <usernameOut>keyalias</usernameOut> + <passphraseOut>keypass</passphraseOut> + </configuration> + </execution> + </executions> + </plugin> + + <!-- make webstart --> + <plugin> + <groupId>org.nuiton.thirdparty</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-jnlp</id> + <phase>package</phase> + <goals> + <goal>jnlp-inline</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + + <!-- by default jnlp is only perform on a release stage when using the maven-release-plugin --> + <profile> + <id>reporting</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + + <reporting> + <plugins> + <plugin> + <groupId>org.nuiton.thirdparty</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <version>${webstartPluginVersion}</version> + </plugin> + </plugins> + </reporting> + + </profile> + + <profile> + <id>staging-site-profile</id> + <activation> + <property> + <name>stagingSite</name> + <value>true</value> + </property> + </activation> + <properties> + <jnlp.codebase> + http://maven-site.liosalfar/jaxx/jaxx-demo/jnlp + </jnlp.codebase> + </properties> + </profile> + + </profiles> + +</project> Property changes on: trunk/jaxx-tutorial-validation/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/license/THIRD-PARTY.properties =================================================================== --- trunk/jaxx-tutorial-validation/src/license/THIRD-PARTY.properties (rev 0) +++ trunk/jaxx-tutorial-validation/src/license/THIRD-PARTY.properties 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,17 @@ +# Generated by org.nuiton.license.plugin.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - BSD License +# - Lesser General Public License (LGPL) +# - Lesser General Public License (LGPL) v 3.0 +# - Sun Microsystems, Inc. Binary Code License Agreement for the JDK 5.0 +# - The Apache Software License, Version 2.0 +# - The OpenSymphony Software License 1.1 +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Thu Dec 30 09:35:11 CET 2010 +commons-primitives--commons-primitives--1.0--jar=The Apache Software License, Version 2.0 +javax.help--javahelp--2.0.02--jar=Sun Microsystems, Inc. Binary Code License Agreement for the JDK 5.0 +opensymphony--ognl--2.6.11--jar=The OpenSymphony Software License 1.1 Property changes on: trunk/jaxx-tutorial-validation/src/license/THIRD-PARTY.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/jaxx-tutorial-validation/src/main/filters/jaxx-demo.properties (from rev 2156, trunk/jaxx-demo/src/main/filters/jaxx-demo.properties) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/filters/jaxx-demo.properties (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/filters/jaxx-demo.properties 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,34 @@ +### +# #%L +# JAXX :: Demo +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2008 - 2010 CodeLutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Lesser Public License for more details. +# +# You should have received a copy of the GNU General Lesser Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/lgpl-3.0.html>. +# #L% +### +application.name=${project.name} +application.version=${project.version} +application.site.url=http://maven-site.nuiton.org/jaxx/jaxx-demo +application.icon.path=/icons/jaxx.png +application.license.path=META-INF/${project.artifactId}-LICENSE.txt +application.third-party.path=META-INF/${project.artifactId}-THIRD-PARTY.txt +#licence.name=${project.licenses[0].license.name} +#licence.url=${project.licenses.0.url} +application.organisation.name=${project.organization.name} +application.organisation.url=${project.organization.url} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/DemoConfig.java (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/DemoConfig.java (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/DemoConfig.java 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,296 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package jaxx.demo.validation; + +import jaxx.runtime.JAXXUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.ApplicationConfig; +import org.nuiton.util.Version; +import org.nuiton.util.VersionUtil; + +import java.beans.PropertyChangeListener; +import java.io.IOException; +import java.io.InputStream; +import java.util.Locale; +import java.util.Properties; + +import static org.nuiton.i18n.I18n._; + +/** + * La configuration de l'application. + * <p/> + * Il s'agit de l'objet partagé par toutes les démos. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.7.2 + */ +public class DemoConfig extends ApplicationConfig { + + /** Logger */ + static private Log log = LogFactory.getLog(DemoConfig.class); + + /** + * le fichier de configuration de l'application avec les informations sur + * le projet (version, license,...) et la configuration des ui (icons, ...) + */ + public static final String APPLICATION_PROPERTIES = "/jaxx-demo.properties"; + + public static final String PROPERTY_FULLSCREEN = "fullscreen"; + + public static final String PROPERTY_LOCALE = "locale"; + + public static final String PROPERTY_FONT_SIZE = "fontSize"; + + public DemoConfig() { + + setConfigFileName(Option.CONFIG_FILE.defaultValue); + + // chargement de la configuration interne + + InputStream stream = + getClass().getResourceAsStream(APPLICATION_PROPERTIES); + + Properties p = new Properties(); + try { + p.load(stream); + for (Object k : p.keySet()) { + String key = k + ""; + Object value = p.get(k); + if (log.isDebugEnabled()) { + log.debug("install properties " + k + " : " + value); + } + setDefaultOption(key, "" + value); + } + } catch (IOException ex) { + throw new RuntimeException(ex); + } + + for (Option o : Option.values()) { + setDefaultOption(o.key, o.defaultValue); + } + + // on supprime le stamp de snapshot s'il existe + String sVersion = VersionUtil.removeSnapshot( + getOption("application.version")); + Version version = VersionUtil.valueOf(sVersion); + setDefaultOption("version", version.getVersion()); + + installSaveUserAction(PROPERTY_FULLSCREEN, + PROPERTY_FONT_SIZE, + PROPERTY_LOCALE); + } + + public String getCopyrightText() { + return "Version " + getVersion() + " Codelutin @ 2008-2009"; + } + + /** @return la version de l'application. */ + public Version getVersion() { + Version option = getOption(Version.class, "version"); + return option; + } + + public boolean isFullScreen() { + Boolean result = getOptionAsBoolean(Option.FULL_SCREEN.key); + return result != null && result; + } + + public Locale getLocale() { + Locale result = getOption(Locale.class, Option.LOCALE.key); + return result; + } + + public Float getFontSize() { + Float result = getOption(Float.class, Option.FONT_SIZE.key); + return result; + } + + public void setFullscreen(boolean fullscreen) { + Object oldValue = null; + setOption(Option.FULL_SCREEN.key, fullscreen + ""); + firePropertyChange(PROPERTY_FULLSCREEN, oldValue, fullscreen); + } + + public void setLocale(Locale newLocale) { + setOption(Option.LOCALE.key, newLocale.toString()); + firePropertyChange(PROPERTY_LOCALE, null, newLocale); + } + + public void setFontSize(Float newFontSize) { + Float oldValue = getFontSize(); + if (log.isDebugEnabled()) { + log.debug("changing font-size to " + newFontSize); + } + setOption(Option.FONT_SIZE.key, newFontSize.toString()); + firePropertyChange(PROPERTY_FONT_SIZE, oldValue, newFontSize); + } + + /** + * Save configuration, in user home directory using the + * {@link #getConfigFileName}. Default, env and commande line note saved + */ + public void saveForUser() { + // shoudl we never save any conf ? + super.saveForUser(); + } + + public static final String[] DEFAULT_JAXX_PCS = { + PROPERTY_FULLSCREEN, + PROPERTY_LOCALE, + PROPERTY_FONT_SIZE, + ADJUSTING_PROPERTY + }; + + public void removeJaxxPropertyChangeListener() { + PropertyChangeListener[] toRemove; + toRemove = JAXXUtil.findJaxxPropertyChangeListener( + DEFAULT_JAXX_PCS, + getPropertyChangeListeners()); + if (toRemove == null || toRemove.length == 0) { + return; + } + if (log.isDebugEnabled()) { + log.debug("before remove : " + getPropertyChangeListeners().length); + log.debug("toRemove : " + toRemove.length); + } + for (PropertyChangeListener listener : toRemove) { + removePropertyChangeListener(listener); + } + if (log.isDebugEnabled()) { + log.debug("after remove : " + getPropertyChangeListeners().length); + } + } + + ////////////////////////////////////////////////// + // Toutes les options disponibles + ////////////////////////////////////////////////// + + public enum Option implements OptionDef { + + CONFIG_FILE( + CONFIG_FILE_NAME, + _("jaxxdemo.config.configFileName.description"), + "jaxxdemo", + String.class, + true, + true), + FULL_SCREEN( + "ui.fullscreen", + _("jaxxdemo.config.ui.fullscreen"), + "false", + Boolean.class, + false, + false), + LOCALE( + "ui." + PROPERTY_LOCALE, + _("jaxxdemo.config.ui.locale"), + Locale.FRANCE.toString(), + Locale.class, + false, + false), + FONT_SIZE( + "ui." + PROPERTY_FONT_SIZE, + _("jaxxdemo.config.ui.fontSize"), + "10f", + Float.class, + false, + false); + + public final String key; + + public final String description; + + public String defaultValue; + + public final Class<?> type; + + public boolean _transient; + + public boolean _final; + + Option(String key, + String description, + String defaultValue, + Class<?> type, + boolean _transient, + boolean _final) { + this.key = key; + this.description = description; + this.defaultValue = defaultValue; + this.type = type; + this._final = _final; + this._transient = _transient; + } + + @Override + public boolean isFinal() { + return _final; + } + + @Override + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public void setTransient(boolean _transient) { + this._transient = _transient; + } + + @Override + public void setFinal(boolean _final) { + this._final = _final; + } + + @Override + public boolean isTransient() { + return _transient; + } + + @Override + public String getDefaultValue() { + return defaultValue; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String getKey() { + return key; + } + + @Override + public Class<?> getType() { + return type; + } + + + } +} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/RunDemo.java (from rev 2156, trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/RunDemo.java) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/RunDemo.java (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/RunDemo.java 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,270 @@ +/* + * #%L + * JAXX :: Tutorial Config + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package jaxx.demo.validation; + +import jaxx.demo.validation.ui.DemoUI; +import jaxx.demo.validation.ui.DemoUIHandler; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.context.DefaultApplicationContext; +import jaxx.runtime.context.JAXXInitialContext; +import jaxx.runtime.swing.ErrorDialogUI; +import jaxx.runtime.swing.editor.config.ConfigUIHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.i18n.I18n; +import org.nuiton.i18n.init.DefaultI18nInitializer; +import org.nuiton.util.StringUtil; + +import javax.swing.JOptionPane; +import java.util.Arrays; +import java.util.Date; + +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 2.0.2 + */ +public class RunDemo { + + /** Logger */ + private static Log log = LogFactory.getLog(RunDemo.class); + + /** The singleton instance of the main context */ + protected static DefaultApplicationContext context; + + public static void main(String[] args) { + + long startingTime = System.nanoTime(); + log.info("JAXX Demo start at " + new Date() + " args: " + Arrays.toString(args)); + + try { + + // init root context + // to enable javassist on webstart, must remove any securityManager, + // see if this can be dangerous (should not be since jnlp is signed ?) + // moreover it speeds up the loading :) + System.setSecurityManager(null); + + long t0 = System.nanoTime(); + + I18n.init(new DefaultI18nInitializer("jaxx-tutorial-validation-i18n"), null); + + Runtime.getRuntime().addShutdownHook(new ShutdownHook()); + + // init root context + DefaultApplicationContext rootContext = init(); + + // share a tree helper +// rootContext.setContextValue(new DemoTreeHelper(new DemoDataProvider())); + + // init config + DemoConfig config = new DemoConfig(); + config.parse(args); + + // share the config + rootContext.setContextValue(config); + + // init decorator provider +// DecoratorProvider p = new DemoDecoratorProvider(); + + // share the decorator provider +// rootContext.setContextValue(p); + + long t00 = System.nanoTime(); + + // init i18n + I18n.setDefaultLocale(config.getLocale()); + + log.info("language : " + config.getLocale()); + + if (log.isDebugEnabled()) { + log.debug("i18n loading time : " + StringUtil.convertTime(t00, System.nanoTime())); + } + + log.info(_("jaxxdemo.message.config.loaded", config.getVersion())); + + // prepare ui look&feel and load ui properties + + try { + SwingUtil.initNimbusLoookAndFeel(); + } catch (Exception e) { + // could not find nimbus look-and-feel + log.warn(_("jaxxdemo.warning.nimbus.landf")); + } catch (Throwable e) { + log.warn(_("jaxxdemo.warning.no.ui")); + + } + + if (log.isDebugEnabled()) { + log.debug("init done in " + StringUtil.convertTime(t0, System.nanoTime())); + } + + log.info(_("jaxxdemo.init.context.done", StringUtil.convertTime(startingTime, System.nanoTime()))); + + // on affiche l'ui principale + DemoUIHandler handler = new DemoUIHandler(); + + DemoUI ui = handler.initUI(rootContext, config); + + log.info(_("jaxxdemo.init.ui.done")); + + handler.displayUI(ui); + + } catch (Exception e) { + log.error(e.getMessage(), e); + ErrorDialogUI.showError(e); + System.exit(1); + } + } + + public static void buildConfigUI(ConfigUIHelper helper) { + + Runnable reloadUICallback = new Runnable() { + + @Override + public void run() { + if (log.isInfoEnabled()) { + log.info("will say Hello world"); + } + JOptionPane.showMessageDialog(null, "Hello World!"); + } + }; + + Runnable reloadApplicationCallback = new Runnable() { + + @Override + public void run() { + if (log.isInfoEnabled()) { + log.info("will reload appplication"); + } + if (log.isInfoEnabled()) { + log.info("will say Good Bye world"); + } + JOptionPane.showMessageDialog(null, "Good Bye World!"); + } + }; + + helper.registerCallBack("ui", + n_("demo.action.reload.ui"), + SwingUtil.createActionIcon("reload-ui"), + reloadUICallback); + + helper.registerCallBack("application", + n_("demo.action.reload.application"), + SwingUtil.createActionIcon("reload-application"), + reloadApplicationCallback); + + // categorie repertoires + + helper.addCategory(n_("jaxxdemo.config.category.directories"), + n_("jaxxdemo.config.category.directories.description")); + + helper.addOption(DemoConfig.Option.CONFIG_FILE); + + // others + helper.addCategory(n_("jaxxdemo.config.category.other"), + n_("jaxxdemo.config.category.other.description")); + + helper.addOption(DemoConfig.Option.FULL_SCREEN); + helper.setOptionPropertyName(DemoConfig.PROPERTY_FULLSCREEN); + helper.setOptionCallBack("ui"); + + helper.addOption(DemoConfig.Option.FONT_SIZE); + helper.setOptionPropertyName(DemoConfig.PROPERTY_FONT_SIZE); + helper.setOptionCallBack("application"); + + helper.addOption(DemoConfig.Option.LOCALE); + helper.setOptionPropertyName(DemoConfig.PROPERTY_LOCALE); + helper.setOptionCallBack("ui"); + + helper.buildUI(new JAXXInitialContext(), + "jaxxdemo.config.category.other"); + + } + + /** + * @return <code>true</code> si le context a été initialisé via la méthode + * {@link #init()}, <ocde>false</code> autrement. + */ + protected static boolean isInit() { + return context != null; + } + + /** + * Permet l'initialisation du contexte applicatif et positionne + * l'context partagée. + * <p/> + * Note : Cette méthode ne peut être appelée qu'une seule fois. + * + * @return l'context partagée + * @throws IllegalStateException si un contexte applicatif a déja été positionné. + */ + protected static synchronized DefaultApplicationContext init() throws IllegalStateException { + if (isInit()) { + throw new IllegalStateException("there is an already application context registred."); + } + context = new DefaultApplicationContext(); + return context; + } + + /** + * Récupération du contexte applicatif. + * + * @return l'context partagé du contexte. + * @throws IllegalStateException si le contexte n'a pas été initialisé via + * la méthode {@link #init()} + */ + public static DefaultApplicationContext get() throws IllegalStateException { + if (!isInit()) { + throw new IllegalStateException("no application context registred."); + } + return context; + } + + protected static class ShutdownHook extends Thread { + + public ShutdownHook() { + super("shutdown JAXXDemo"); + } + + @Override + public void run() { + try { + super.run(); + + // force to kill main thread + + log.info(_("jaxxdemo.init.closed", new Date())); + Runtime.getRuntime().halt(0); + } catch (Exception ex) { + log.error("error while closing " + ex.getMessage(), ex); + Runtime.getRuntime().halt(1); + } + } + } + +} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/AbstractDemoBean.java (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/entities/AbstractDemoBean.java) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/AbstractDemoBean.java (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/AbstractDemoBean.java 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,106 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package jaxx.demo.validation.model; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; + +import static org.nuiton.i18n.I18n.n_; + +/** + * Abstract demo bean. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.2 + */ +public abstract class AbstractDemoBean implements Serializable { + + static { + n_("jaxxdemo.common.id"); + n_("jaxxdemo.common.image"); + } + + public static final String PROPERTY_ID = "id"; + + public static final String PROPERTY_IMAGE = "image"; + + protected String id; + + protected String image; + + protected final PropertyChangeSupport p; + + public AbstractDemoBean() { + p = new PropertyChangeSupport(this); + } + + protected AbstractDemoBean(String id, String image) { + this(); + this.id = id; + this.image = image; + } + + public String getId() { + return id; + } + + public String getImage() { + return image; + } + + public void setId(String id) { + String old = this.id; + this.id = id; + firePropertyChange(PROPERTY_ID, old, id); + } + + + public void setImage(String image) { + Object oldValue = this.image; + this.image = image; + firePropertyChange(PROPERTY_IMAGE, oldValue, image); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + p.addPropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + p.removePropertyChangeListener(listener); + } + + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.removePropertyChangeListener(propertyName, listener); + } + + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + p.firePropertyChange(propertyName, oldValue, newValue); + } +} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/Movie.java (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/entities/Movie.java) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/Movie.java (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/Movie.java 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,141 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package jaxx.demo.validation.model; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +import java.util.ArrayList; +import java.util.List; + +import static org.nuiton.i18n.I18n.n_; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.7.2 + */ +public class Movie extends AbstractDemoBean { + + static { + n_("jaxxdemo.common.movie"); + n_("jaxxdemo.common.title"); + n_("jaxxdemo.common.year"); + n_("jaxxdemo.common.actors"); + } + + protected String title; + + protected int year; + + protected List<People> actors; + + private static final long serialVersionUID = 1L; + + private static final String PROPERTY_ACTORS = "actors"; + + private static final String PROPERTY_TITLE = "title"; + + private static final String PROPERTY_YEAR = "year"; + + private static final String PROPERTY_IMAGE = "image"; + + public Movie(String id, String title, int year, String image) { + super(id, image); + this.title = title; + this.year = year; + actors = new ArrayList<People>(); + } + + public Movie() { + actors = new ArrayList<People>(); + } + + public List<People> getActors() { + return actors; + } + + public String getTitle() { + return title; + } + + public int getYear() { + return year; + } + + public void setActors(List<People> actors) { + Object oldValue = this.actors; + this.actors = actors; + firePropertyChange(PROPERTY_ACTORS, null, actors); + } + + public void setTitle(String title) { + Object oldValue = this.title; + this.title = title; + firePropertyChange(PROPERTY_TITLE, oldValue, title); + } + + public void setYear(int year) { + Object oldValue = this.year; + this.year = year; + firePropertyChange(PROPERTY_YEAR, oldValue, year); + } + + + public void addActor(People actor) { + actors.add(actor); + firePropertyChange(PROPERTY_ACTORS, null, actors); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Movie other = (Movie) obj; + return !(id == null ? other.id != null : !id.equals(other.id)); + } + + @Override + public int hashCode() { + int hash = 5; + hash = 41 * hash + (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); + b.append(PROPERTY_ID, id); + b.append(PROPERTY_TITLE, title); + b.append(PROPERTY_IMAGE, image); + b.append(PROPERTY_YEAR, year); + b.append(PROPERTY_ACTORS, actors); + return b.toString(); + } +} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/People.java (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/entities/People.java) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/People.java (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/model/People.java 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,137 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package jaxx.demo.validation.model; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +import static org.nuiton.i18n.I18n.n_; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.7.2 + */ +public class People extends AbstractDemoBean { + + static { + n_("jaxxdemo.common.people"); + n_("jaxxdemo.common.firstName"); + n_("jaxxdemo.common.lastName"); + n_("jaxxdemo.common.age"); + } + + public static final String PROPERTY_FIRST_NAME = "firstName"; + + public static final String PROPERTY_LAST_NAME = "lastName"; + + public static final String PROPERTY_AGE = "age"; + + protected String firstName; + + protected String lastName; + + protected int age; + + private static final long serialVersionUID = 1L; + + public People() { + } + + public People(String id, + String firstName, + String lastName, + int age, + String image) { + super(id, image); + this.firstName = firstName; + this.lastName = lastName; + this.age = age; + } + + public int getAge() { + return age; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public String getImage() { + return image; + } + + public void setAge(int age) { + int old = this.age; + this.age = age; + firePropertyChange(PROPERTY_AGE, old, age); + } + + public void setFirstName(String firstName) { + String old = this.firstName; + this.firstName = firstName; + firePropertyChange(PROPERTY_FIRST_NAME, old, firstName); + } + + public void setLastName(String lastName) { + String old = this.lastName; + this.lastName = lastName; + firePropertyChange(PROPERTY_LAST_NAME, old, lastName); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + People other = (People) obj; + return !(id == null ? other.id != null : !id.equals(other.id)); + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); + b.append(PROPERTY_ID, id); + b.append(PROPERTY_FIRST_NAME, firstName); + b.append(PROPERTY_LAST_NAME, lastName); + b.append(PROPERTY_IMAGE, image); + b.append(PROPERTY_AGE, age); + return b.toString(); + } +} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.css (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.css (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.css 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,144 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +JToolBar { + borderPainted:false; + floatable:false; + opaque:false; +} + +#mainFrame { + title:"JAXX Demo"; + iconImage:{jaxx.runtime.SwingUtil.createIcon(getConfig().getOption("application.icon.path")).getImage()}; + undecorated:{getConfig().isFullScreen()}; +} + +#menu { + _help:{"ui.main.menu"}; +} + +#menuFile { + text:"jaxxdemo.menu.file"; + mnemonic:F; + _help:{"ui.main.menu.file"}; +} + +#menuFileConfiguration { + text:"jaxxdemo.action.configuration"; + toolTipText:"jaxxdemo.action.configuration.tip"; + actionIcon:"config"; + mnemonic:C; + _help:{"ui.main.menu.file.configuration"}; +} + +#menuFileLanguage { + text:"jaxxdemo.menu.file.locale"; + toolTipText:"jaxxdemo.menu.file.locale"; + actionIcon:"translate"; + mnemonic:C; + _help:{"ui.main.menu.file.locale"}; +} + + +#menuFileLanguageFR { + text:"jaxxdemo.action.locale.fr"; + toolTipText:"jaxxdemo.action.locale.fr.tip"; + actionIcon:"i18n-fr"; + enabled:{!acceptLocale(getConfig().getLocale(), "fr_FR")}; + mnemonic:F; + _help:{"ui.main.menu.file.locale.fr"}; +} + +#menuFileLanguageUK { + text:"jaxxdemo.action.locale.uk"; + toolTipText:"jaxxdemo.action.locale.uk.tip"; + actionIcon:"i18n-uk"; + enabled:{!acceptLocale(getConfig().getLocale(), "en_GB")}; + mnemonic:U; + _help:{"ui.main.menu.file.locale.uk"}; +} + +#menuFileFullscreen { + text:"jaxxdemo.action.fullscreen"; + toolTipText:"jaxxdemo.action.fullscreen.tip"; + actionIcon:"fullscreen"; + mnemonic:P; + visible:{!isUndecorated()}; + _help:{"ui.main.menu.file.fullscreen"}; +} + +#menuFileNormalscreen { + text:"jaxxdemo.action.normalscreen"; + toolTipText:"jaxxdemo.action.normalscreen.tip"; + actionIcon:"leave-fullscreen"; + mnemonic:N; + visible:{isUndecorated()}; +_help:{"ui.main.menu.file.leave-fullscreen"}; +} + +#menuFileExit { + text:"jaxxdemo.action.exit"; + toolTipText:"jaxxdemo.action.exit.tip"; + actionIcon:"exit"; + mnemonic:X; + _help:{"ui.main.menu.file.exit"}; +} + +#menuHelp { + text:"jaxxdemo.menu.help"; + mnemonic:e; + _help:{"ui.main.menu.help"}; +} + +#menuHelpHelp { + text:"jaxxdemo.action.help"; + toolTipText:"jaxxdemo.action.help.tip"; + actionIcon:"help"; + mnemonic:e; + _help:{"ui.main.menu.help.help"}; +} + +#menuHelpSite { + text:"jaxxdemo.action.site"; + toolTipText:"jaxxdemo.action.site.tip"; + actionIcon:"site"; + mnemonic:s; + _help:{"ui.main.menu.help.site"}; +} + +#menuHelpAbout { + text:"jaxxdemo.action.about"; + toolTipText:"jaxxdemo.action.about.tip"; + actionIcon:"about"; + mnemonic:A; + _help:{"ui.main.menu.help.about"}; +} + +#showHelp { + toolTipText:"jaxxdemo.action.showHelp.tip"; + actionIcon:"show-help"; + borderPainted:false; + visible:true; +} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.jaxx (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.jaxx (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUI.jaxx 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,97 @@ +<!-- + #%L + JAXX :: Demo + + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + + +<JFrame id='mainFrame' width='1024' height='800' + decorator='help' + onWindowClosing='getHandler().close(mainFrame)'> + + <import> + jaxx.demo.validation.*; + jaxx.runtime.swing.CardLayout2 + jaxx.runtime.swing.StatusMessagePanel + + java.util.Locale + </import> + + <CardLayout2 id='contentLayout'/> + + <DemoConfig id='config' initializer='getContextValue(DemoConfig.class)'/> + + <DemoUIHandler id='handler' + initializer='getContextValue(DemoUIHandler.class)'/> + + <script><![CDATA[ + +public boolean acceptLocale(Locale l, String expected) { + return l !=null && l.toString().equals(expected); +} + +private void $afterCompleteSetup() { + getHandler().initUI(this); +} +]]> + </script> + + <JMenuBar id='menu'> + + <JMenu id='menuFile'> + <JMenuItem id='menuFileConfiguration' + onActionPerformed="getHandler().showConfig(this)"/> + <JMenu id='menuFileLanguage'> + <JMenuItem id='menuFileLanguageFR' + onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/> + <JMenuItem id='menuFileLanguageUK' + onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/> + </JMenu> + <JSeparator/> + <JMenuItem id='menuFileFullscreen' + onActionPerformed="getHandler().changeScreen(this, true)"/> + <JMenuItem id='menuFileNormalscreen' + onActionPerformed="getHandler().changeScreen(this, false)"/> + <JSeparator/> + <JMenuItem id='menuFileExit' + onActionPerformed="getHandler().close(this)"/> + </JMenu> + + <JMenu id='menuHelp'> + <JMenuItem id='menuHelpHelp' + onActionPerformed="getHandler().showHelp(this, null)"/> + <JMenuItem id='menuHelpSite' + onActionPerformed="getHandler().gotoSite(this)"/> + <JMenuItem id='menuHelpAbout' + onActionPerformed="getHandler().showAbout(this)"/> + </JMenu> + + </JMenuBar> + + <JPanel id='mainPane' layout='{new BorderLayout()}'> + + <ValidationTableDemo id='tableDemo' constraints='BorderLayout.CENTER'/> + + <StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> + + </JPanel> +</JFrame> Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUIHandler.java (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUIHandler.java (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/DemoUIHandler.java 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,450 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +/** + * *##% + * JAXX Demo + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.demo.validation.ui; + +import jaxx.demo.validation.DemoConfig; +import jaxx.demo.validation.RunDemo; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXUtil; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.context.DefaultApplicationContext; +import jaxx.runtime.context.JAXXContextEntryDef; +import jaxx.runtime.context.JAXXInitialContext; +import jaxx.runtime.swing.AboutPanel; +import jaxx.runtime.swing.ErrorDialogUI; +import jaxx.runtime.swing.editor.config.ConfigUIHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.i18n.I18n; + +import javax.swing.SwingUtilities; +import java.awt.Desktop; +import java.net.URL; +import java.util.Locale; + +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +/** + * Le handler de l'ui principale. + * + * @author tchemit <chemit@codelutin.com> + * @see DemoUI + */ +public class DemoUIHandler { //implements JAXXHelp { + + /** Logger */ + static private Log log = LogFactory.getLog(DemoUIHandler.class); + + static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainui", DemoUI.class); + + /** + * Methode pour initialiser l'ui principale sans l'afficher. + * + * @param rootContext le context applicatif + * @param config la configuration a utiliser + * @return l'ui instancie et initialisee mais non visible encore + */ + public DemoUI initUI(DefaultApplicationContext rootContext, DemoConfig config) { + + if (log.isDebugEnabled()) { + log.debug("fullscreen ? " + config.isFullScreen()); + } + +// DecoratorProvider decoratorProvider = rootContext.getContextValue(DecoratorProvider.class); + + if (!config.getLocale().equals(I18n.getDefaultLocale())) { + if (log.isInfoEnabled()) { + log.info("re-init I18n with locale " + config.getLocale()); + } + // change i18n language + I18n.setDefaultLocale(config.getLocale()); + // reload decorators +// decoratorProvider.reload(); + } + + // create restrict context for ui + JAXXInitialContext context = new JAXXInitialContext(); + + // share handler + context.add(this); + + // share config + context.add(rootContext.getContextValue(DemoConfig.class)); + + // share a unique DecoratorProvider +// context.add(decoratorProvider); + + // share a unique DecoratorProviderListCellRenderer +// context.add(new DecoratorProviderListCellRenderer(decoratorProvider)); + + // instanciate ui + DemoUI ui = new DemoUI(context); + + // keep it in root context + MAIN_UI_ENTRY_DEF.setContextValue(rootContext, ui); + + // synch to error dialog + ErrorDialogUI.init(ui); + + // set fullscreen propery on main ui + ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null); + + return ui; + } + + public void initUI(final DemoUI ui) { +// +// // Creation of selection listener to open ui when tree selection change +// TreeSelectionListener listener = new TreeSelectionListener() { +// @Override +// public void valueChanged(TreeSelectionEvent event) { +// TreePath path = event.getPath(); +// DemoNode node = (DemoNode) path.getLastPathComponent(); +// +// if (log.isDebugEnabled()) { +// log.debug("Select node " + node); +// } +// +// if (node == null || node.isStringNode()) { +// +// // noeud de présentation, rien a faire +// return; +// } +// showUI(ui, node.getInternalClass()); +// } +// }; +// +// JTree tree = ui.getNavigation(); +// +// ui.getTreeHelper().setUI(tree, true, listener); +// +// // auto-expand node when selected +// SwingUtil.addExpandOnClickListener(tree); + + } + +// protected void showUI(DemoUI ui, Class<?> type) { +// +// JPanel content = ui.getContent(); +// +// String constraints = type.getName(); +// +// log.info("Show for " + constraints); +// +// // Verify if instance is existing +// DemoTab demoContent = getContentIfExist(ui, constraints); +// +// if (demoContent == null) { +// +// log.info("Will instanciate a new " + constraints); +// try { +// // Get constructor +// Constructor<?> constructor = +// type.getConstructor(JAXXContext.class); +// +// JAXXInitialContext tx = +// new JAXXInitialContext().add(ui.getDelegateContext()); +// +// DemoPanel panel = (DemoPanel) constructor.newInstance(tx); +// +// log.info("Demo panel to use : " + panel); +// +// demoContent = new DemoTab(tx.add("content", panel)); +// +// } catch (Exception eee) { +// log.error(eee, eee); +// ErrorDialogUI.showError(eee); +// } +// +// // Add to content panel +// content.add(demoContent, constraints); +// } +// +// // show ui +// ui.getContentLayout().show(content, constraints); +// } + +// Get content if exist in content, else return null + +// protected <E extends Component> E getContentIfExist(DemoUI ui, String constraints) { +// if (log.isDebugEnabled()) { +// log.debug("Get content if exist " + constraints); +// } +// if (!ui.getContentLayout().contains(constraints)) { +// return null; +// } +// return (E) ui.getContentLayout().getComponent(ui.getContent(), constraints); +// } + + public void displayUI(final DemoUI ui) { + + // show ui after all (in another invocation, tu avoid layout adjustement + // to be seen). + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + // show ui + ui.setVisible(true); + } + }); + } + + /** + * Permet de recharger l'ui principale et de changer de le mode d'affichage. + * + * @param rootContext le contexte applicatif + * @param config la configuration a utiliser + */ + public void reloadUI(DefaultApplicationContext rootContext, + DemoConfig config) { + + // scan main ui + DemoUI ui = getUI(rootContext); + + if (ui != null) { + + ui.getConfig().removeJaxxPropertyChangeListener(); + + + ErrorDialogUI.init(null); + + ui.dispose(); + + ui.setVisible(false); + + MAIN_UI_ENTRY_DEF.removeContextValue(rootContext); + } + + ui = initUI(rootContext, config); + + displayUI(ui); + } + + /** + * Méthode pour changer de mode d'affichage. + * <p/> + * Si <code>fullscreen</code> est à <code>true</code> alors on passe en + * mode console (c'est à dire en mode plein écran exclusif), sinon on + * passe en mode fenetré normal. + * + * @param context l'ui principale de l'application + * @param fullscreen le nouvel état requis. + */ + public void changeScreen(JAXXContext context, boolean fullscreen) { + + DemoUI ui = getUI(context); + + // sauvegarde de l'état dans la configuration + DemoConfig config = ui.getConfig(); + config.setFullscreen(fullscreen); + + // rechargement de l'ui + reloadUI(RunDemo.get(), config); + } + + public void changeLanguage(JAXXContext context, Locale newLocale) { + + DemoUI ui = getUI(context); + + DemoConfig config = ui.getConfig(); + + // sauvegarde de la nouvelle locale + config.setLocale(newLocale); + + // rechargement de l'ui + reloadUI(RunDemo.get(), config); + } + + /** + * Ferme l'application. + * + * @param context l'ui principale de l'application + */ + public void close(JAXXContext context) { + log.info("JAXX Demo quitting..."); + try { + + DemoUI ui = getUI(context); + ui.dispose(); + } finally { + System.exit(0); + } + } + + final Runnable reloadUICallback = new Runnable() { + + @Override + public void run() { + if (log.isInfoEnabled()) { + log.info("will reload ui"); + } + DefaultApplicationContext context = RunDemo.get(); + DemoUI ui = getUI(context); + DemoConfig config = ui.getConfig(); + reloadUI(context, config); + } + }; + + final Runnable reloadApplicationCallback = new Runnable() { + + @Override + public void run() { + if (log.isInfoEnabled()) { + log.info("will reload appplication"); + } + close(RunDemo.get()); + } + }; + + public void showConfig(JAXXContext context) { + DemoUI ui = getUI(context); + DemoConfig config = ui.getConfig(); + + ConfigUIHelper helper = new ConfigUIHelper(config); + + helper.registerCallBack("ui", + n_("demo.action.reload.ui"), + SwingUtil.createActionIcon("reload-ui"), + reloadUICallback); + + helper.registerCallBack("application", + n_("demo.action.reload.application"), + SwingUtil.createActionIcon("reload-application"), + reloadApplicationCallback); + + // categorie repertoires + + helper.addCategory(n_("jaxxdemo.config.category.directories"), + n_("jaxxdemo.config.category.directories.description")); + + helper.addOption(DemoConfig.Option.CONFIG_FILE); + + // others + helper.addCategory(n_("jaxxdemo.config.category.other"), + n_("jaxxdemo.config.category.other.description")); + + helper.addOption(DemoConfig.Option.FULL_SCREEN); + helper.setOptionPropertyName(DemoConfig.PROPERTY_FULLSCREEN); + helper.setOptionCallBack("ui"); + + helper.addOption(DemoConfig.Option.FONT_SIZE); + helper.setOptionPropertyName(DemoConfig.PROPERTY_FONT_SIZE); + helper.setOptionCallBack("application"); + + helper.addOption(DemoConfig.Option.LOCALE); + helper.setOptionPropertyName(DemoConfig.PROPERTY_LOCALE); + helper.setOptionCallBack("ui"); + + helper.buildUI(context, "jaxxdemo.config.category.other"); + + helper.displayUI(ui, false); + } + + public void showHelp(JAXXContext context, String helpId) { + log.info(context + " :: " + helpId); +// DemoUI mainUI = getUI(context); +// ObserveHelpBroker helpBroker = context.getContextValue(ObserveHelpBroker.class); +// +// if (helpId == null) { +// helpId = helpBroker.getDefaultID(); +// } +// log.debug("show help " + helpId); +// mainUI.getHelp().setCurrentID(helpId); + } + + public void gotoSite(JAXXContext context) { + + DemoUI ui = getUI(context); + DemoConfig config = ui.getConfig(); + + URL siteURL = config.getOptionAsURL("application.site.url"); + + log.info(_("jaxxdemo.message.goto.site", siteURL)); + + if (log.isDebugEnabled()) { + log.debug("goto " + siteURL); + } + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + try { + Desktop.getDesktop().browse(siteURL.toURI()); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + ErrorDialogUI.showError(ex); + } + } + } + + public void showAbout(DemoUI ui) { + + DemoConfig config = ui.getConfig(); + + String iconPath = config.getOption("application.icon.path"); + String licensePath = config.getOption("application.license.path"); + String thirdPartyPath = config.getOption("application.third-party.path"); + + AboutPanel about = new AboutPanel(); + about.setTitle(_("jaxxdemo.title.about")); + about.setAboutText(_("jaxxdemo.about.message")); + about.setBottomText(ui.getConfig().getCopyrightText()); + about.setIconPath(iconPath); + about.setLicenseFile(licensePath); + about.setThirdpartyFile(thirdPartyPath); + about.buildTopPanel(); + about.init(); + about.showInDialog(ui, true); + } + + DemoUI getUI(JAXXContext context) { + if (context instanceof DemoUI) { + return (DemoUI) context; + } + DemoUI ui = MAIN_UI_ENTRY_DEF.getContextValue(context); + return ui; + } +} Copied: trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/ValidationTableDemo.jaxx (from rev 2156, trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx) =================================================================== --- trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/ValidationTableDemo.jaxx (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/java/jaxx/demo/validation/ui/ValidationTableDemo.jaxx 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,173 @@ +<!-- + #%L + JAXX :: Demo + + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<JPanel> + <!--<style source="Validation.css"/>--> + + <script><![CDATA[ +import static org.nuiton.i18n.I18n.n_; +import jaxx.runtime.validator.swing.SwingValidatorUtil; +import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; +import jaxx.runtime.validator.swing.SwingValidatorMessageTableModel; +import jaxx.demo.validation.model.Movie; + +void $afterCompleteSetup() { + SwingValidatorUtil.installUI(errorTable, new SwingValidatorMessageTableRenderer()); +} + +protected void changeContext(String context) { + if (context==null) { return; } + validator.setContext(context); + validator.setBean(movie); + SwingValidatorUtil.installUI(this); +} + +/*protected String[] getSources() { + return new String[]{ getDefaultSource(), "Validation.css", + "Identity.java", "Identity-error-validation.xml", "Identity-info-validation.xml", "Identity-warning-validation.xml", + "Model.java", "Model-error-validation.xml", "Model-info-validation.xml", "Model-warning-validation.xml" + }; +}*/ +]]></script> + + <!-- models --> + <Movie id='movie'/> + + <!-- errors model --> + <SwingValidatorMessageTableModel id='errors2' + onTableChanged='ok.setEnabled(errors2.getRowCount()==0)'/> + + <!-- validators --> + <BeanValidator id='validator' bean='movie' autoField='true' + contextName='create' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </BeanValidator> + + <Table fill='both'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0' columns="2"> + <JPanel border='{BorderFactory.createTitledBorder("Configuration")}' + layout='{new GridLayout()}'> + <JAXXComboBox id='contexts' editable='false' onActionPerformed='changeContext(String.valueOf(contexts.getSelectedItem()))'> + <item value='create' selected='true'/> + <item value='update'/> + </JAXXComboBox> + </JPanel> + </cell> + </row> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Movie")}' + layout='{new GridLayout()}'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Title :'/> + </cell> + <cell weightx='1'> + <JTextField id='title' text='{movie.getTitle()}' + onKeyReleased='movie.setTitle(title.getText())' + _validatorLabel='{n_("movie.title")}' + /> + </cell> + </row> + <row> + <cell> + <JLabel text='Year:'/> + </cell> + <cell weightx='1'> + <JTextField id='year' text='{movie.getYear() + ""}' + onKeyReleased='movie.setYear(Integer.valueOf(year.getText()))' + _validatorLabel='{n_("movie.year")}' + /> + </cell> + </row> + + <!--row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='ratio' minimum='0' maximum='100' + value='{model1.getRatio()}' + _validatorLabel='{n_("form.ratio")}' + onStateChanged='model1.setRatio(ratio.getValue())'/> + </cell> + </row--> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Movie")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Title:'/> + </cell> + <cell weightx='1'> + <JLabel text='{movie.getTitle()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Year:'/> + </cell> + <cell weightx='1'> + <JLabel text='{movie.getYear() + ""}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + + <row> + <cell columns='2' fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Messages")}' + layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> + <JTable id='errorTable' model='{errors2}' rowSelectionAllowed='true' + autoCreateRowSorter='true' + autoResizeMode='2' cellSelectionEnabled='false' + selectionMode='0'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JButton id='cancel' text='cancel' + onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + <JButton id='ok' text='valid' + onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + </JPanel> + </cell> + </row> + </Table> + +</JPanel> Added: trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_en_GB.properties =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_en_GB.properties (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_en_GB.properties 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,58 @@ +JAXX\ Demo= +Title\ \:= +Title\:= +Year\:= +cancel= +demo.action.reload.application=Reload application +demo.action.reload.ui=Reload UI +jaxxdemo.about.message=<h3>JAXX Validator Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-tutorial/jaxx-tutorial-validation">website of the project</a>. +jaxxdemo.action.about=About... +jaxxdemo.action.about.tip=About JAXXDemo... +jaxxdemo.action.configuration=Preferences +jaxxdemo.action.configuration.tip=Change the preferences of the application +jaxxdemo.action.exit=Quit +jaxxdemo.action.exit.tip=Quit JAXXDemo +jaxxdemo.action.fullscreen=Full screen +jaxxdemo.action.fullscreen.tip=Change to full screen mode +jaxxdemo.action.help= +jaxxdemo.action.help.tip=Display help +jaxxdemo.action.locale.fr=French +jaxxdemo.action.locale.fr.tip=Change to french language +jaxxdemo.action.locale.uk=English +jaxxdemo.action.locale.uk.tip=Change to english language +jaxxdemo.action.normalscreen=Normal screen +jaxxdemo.action.normalscreen.tip=Change to normal screen mode +jaxxdemo.action.site=Web site +jaxxdemo.action.site.tip=Go to the web site +jaxxdemo.common.actors=Actors +jaxxdemo.common.age=Age +jaxxdemo.common.firstName=First name +jaxxdemo.common.id=Id +jaxxdemo.common.image=Image +jaxxdemo.common.lastName=Last name +jaxxdemo.common.movie=Movie +jaxxdemo.common.people=People +jaxxdemo.common.title=Title +jaxxdemo.common.year=Year +jaxxdemo.config.category.directories=Files +jaxxdemo.config.category.directories.description=Files used by application +jaxxdemo.config.category.other=Others +jaxxdemo.config.category.other.description=Others preferences +jaxxdemo.config.configFileName.description=Configuration file name +jaxxdemo.config.ui.fontSize=default font size to use in sources +jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen) +jaxxdemo.config.ui.locale=Language used in application +jaxxdemo.init.closed=JAXXDemo was closed at %1$s +jaxxdemo.init.context.done=Context initialized in %1$s +jaxxdemo.init.ui.done=UI initialized. +jaxxdemo.menu.file=File +jaxxdemo.menu.file.locale=Languages +jaxxdemo.menu.help= +jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded. +jaxxdemo.message.goto.site=Go to JAXXDemo Web site +jaxxdemo.title.about=About JAXXDemo... +jaxxdemo.warning.nimbus.landf=Could not init nymbus look and feel, you need at leasr version 1.6u10 of java. +jaxxdemo.warning.no.ui=No ui environnement detected +movie.title= +movie.year= +valid= Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_en_GB.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_fr_FR.properties =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_fr_FR.properties (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_fr_FR.properties 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,58 @@ +JAXX\ Demo= +Title\ \:= +Title\:= +Year\:= +cancel=Annuler +demo.action.reload.application=Redemarrer l'application +demo.action.reload.ui=Recharger l'interface graphique +jaxxdemo.about.message=<h3>JAXX Validation Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx-tutorial/jaxx-tutorial-validation">site du projet</a>. +jaxxdemo.action.about=A propos +jaxxdemo.action.about.tip=A propos de JAXX Demo... +jaxxdemo.action.configuration=Configuration +jaxxdemo.action.configuration.tip=Modifier la configuration +jaxxdemo.action.exit=Quitter +jaxxdemo.action.exit.tip=Quitter JAXX Demo +jaxxdemo.action.fullscreen=Plein \u00E9cran +jaxxdemo.action.fullscreen.tip=Passer en mode pleine \u00E9cran +jaxxdemo.action.help=Aide +jaxxdemo.action.help.tip=Affichier l'aide +jaxxdemo.action.locale.fr=Fran\u00E7ais +jaxxdemo.action.locale.fr.tip=Changer la langue en fran\u00E7ais +jaxxdemo.action.locale.uk=Anglais +jaxxdemo.action.locale.uk.tip=Changer la langue en anglais +jaxxdemo.action.normalscreen=Ecran normal +jaxxdemo.action.normalscreen.tip=Revenir en mode normal +jaxxdemo.action.site=Site internet +jaxxdemo.action.site.tip=Acc\u00E9der au site de l'application sur internet +jaxxdemo.common.actors=Acteurs +jaxxdemo.common.age=Age +jaxxdemo.common.firstName=Pr\u00E9nom +jaxxdemo.common.id=Identifiant +jaxxdemo.common.image=Image +jaxxdemo.common.lastName=Nom +jaxxdemo.common.movie=Film +jaxxdemo.common.people=Acteur +jaxxdemo.common.title=Titre +jaxxdemo.common.year=Ann\u00E9e +jaxxdemo.config.category.directories=R\u00E9pertoires +jaxxdemo.config.category.directories.description=R\u00E9pertoires de l'application +jaxxdemo.config.category.other=Autre +jaxxdemo.config.category.other.description=Autres options +jaxxdemo.config.configFileName.description=Le nom du fichier de configuration +jaxxdemo.config.ui.fontSize=La taille de la police \u00E0 utiliser pour visualiser dans les sources +jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran +jaxxdemo.config.ui.locale=La langue utilis\u00E9e par l'application +jaxxdemo.init.closed=JAXX Demo a \u00E9t\u00E9 ferm\u00E9 \u00E0 %1$s +jaxxdemo.init.context.done=Initialisation du contexte termin\u00E9e en %1$s. +jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00E9e. +jaxxdemo.menu.file=Fichier +jaxxdemo.menu.file.locale=Langues +jaxxdemo.menu.help=Aide +jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00E9e. +jaxxdemo.message.goto.site=Acc\u00E9der au site de JAXX Demo (%1$s) +jaxxdemo.title.about=A propos de JAXX Demo... +jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00E9t\u00E9 trouv\u00E9, il faut au moins la version 1.6u10 de java. +jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9 +movie.title= +movie.year= +valid=valide Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/i18n/jaxx-tutorial-validation_fr_FR.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-about.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-about.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-accept.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-accept.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-block.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-block.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-close.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-close.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-config.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-config.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-exit.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-exit.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-fullscreen.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-fullscreen.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-help.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-help.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-i18n-fr.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-i18n-fr.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-i18n-uk.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-i18n-uk.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-leave-fullscreen.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-leave-fullscreen.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-reload-application.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-reload-application.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-reload-ui.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-reload-ui.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-show-help.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-show-help.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-site.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-site.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-translate.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/action-translate.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/icons/jaxx.png =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/icons/jaxx.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-error-validation.xml =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-error-validation.xml (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-error-validation.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,20 @@ + +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="title"> + <field-validator type="requiredstring" short-circuit="true"> + <message>You must enter a title.</message> + </field-validator> + </field> + <field name="year"> + <field-validator type="required" short-circuit="true"> + <message>You must enter a year.</message> + </field-validator> + <field-validator type="int"> + <param name="min">1900</param> + <message>Year must be after 1900</message> + </field-validator> + </field> +</validators> \ No newline at end of file Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-error-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-warning-validation.xml =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-warning-validation.xml (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-warning-validation.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,18 @@ +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="title"> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ title != null && title.length() > 1]]></param> + <message>Title should be more than One caracter.</message> + </field-validator> + </field> + <field name="year"> + <field-validator type="int"> + <param name="min">1920</param> + <message>Year should be after 1920</message> + </field-validator> + </field> +</validators> \ No newline at end of file Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-create-warning-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-error-validation.xml =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-error-validation.xml (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-error-validation.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,20 @@ + +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <!--field name="title"> + <field-validator type="requiredstring" short-circuit="true"> + <message>You must enter a title.</message> + </field-validator> + </field--> + <field name="year"> + <field-validator type="required" short-circuit="true"> + <message>You must enter a year.</message> + </field-validator> + <field-validator type="int"> + <param name="min">1900</param> + <message>Year must be after 1900</message> + </field-validator> + </field> +</validators> \ No newline at end of file Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-error-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-info-validation.xml =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-info-validation.xml (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-info-validation.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,12 @@ +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="title"> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ title == null]]></param> + <message>Title is filled.</message> + </field-validator> + </field> +</validators> \ No newline at end of file Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-info-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-warning-validation.xml =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-warning-validation.xml (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-warning-validation.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,18 @@ +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="title"> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ title != null && title.length() > 1]]></param> + <message>Title should be more than One caracter.</message> + </field-validator> + </field> + <field name="year"> + <field-validator type="int"> + <param name="min">1920</param> + <message>Year should be after 1920</message> + </field-validator> + </field> +</validators> \ No newline at end of file Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/jaxx/demo/validation/model/Movie-update-warning-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/main/resources/log4j.properties =================================================================== --- trunk/jaxx-tutorial-validation/src/main/resources/log4j.properties (rev 0) +++ trunk/jaxx-tutorial-validation/src/main/resources/log4j.properties 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,38 @@ +### +# #%L +# JAXX :: Tutorial Config +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2008 - 2010 CodeLutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Lesser Public License for more details. +# +# You should have received a copy of the GNU General Lesser Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/lgpl-3.0.html>. +# #L% +### +# Global logging configuration +log4j.rootLogger=ERROR, stdout +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n + +log4j.logger.jaxx.demo=INFO +#log4j.logger.jaxx.demo.config.DemoConfig=DEBUG +log4j.logger.jaxx.runtime.swing.editor.config=INFO +#log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG +log4j.logger.org.nuiton=WARN +log4j.logger.org.nuiton.validator=INFO +log4j.logger.jaxx.runtime.validator=DEBUG Property changes on: trunk/jaxx-tutorial-validation/src/main/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/jaxx-tutorial-validation/src/site/rst/images/webstart.gif =================================================================== (Binary files differ) Property changes on: trunk/jaxx-tutorial-validation/src/site/rst/images/webstart.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/site/rst/index.rst =================================================================== --- trunk/jaxx-tutorial-validation/src/site/rst/index.rst (rev 0) +++ trunk/jaxx-tutorial-validation/src/site/rst/index.rst 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,46 @@ +.. - +.. * #%L +.. * JAXX :: Tutorial Config +.. * +.. * $Id$ +.. * $HeadURL$ +.. * %% +.. * Copyright (C) 2008 - 2010 CodeLutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU Lesser General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Lesser Public License for more details. +.. * +.. * You should have received a copy of the GNU General Lesser Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/lgpl-3.0.html>. +.. * #L% +.. - +=============== +Tutorial Config +=============== + +TODO + +Set it in action +---------------- + +|webstart| + +To run this example in `Java Web Start`_, click the `following link`_. + +For more details about the `Jaxx Demo webstart`_. + +.. _Java Web Start: http://java.sun.com/products/javawebstart/ + +.. |webstart| image:: images/webstart.gif + +.. _following link: ./jnlp/launch.jnlp + +.. _Jaxx Demo webstart: jnlp-report.html Property changes on: trunk/jaxx-tutorial-validation/src/site/rst/index.rst ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/jaxx-tutorial-validation/src/site/site_fr.xml =================================================================== --- trunk/jaxx-tutorial-validation/src/site/site_fr.xml (rev 0) +++ trunk/jaxx-tutorial-validation/src/site/site_fr.xml 2011-01-25 11:58:22 UTC (rev 2163) @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JAXX :: Tutorial Config + + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <src>${site.home.url}/jaxx.png</src> + <href>index.html</href> + </bannerLeft> + + <body> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <menu ref="parent"/> + + <menu name="Utilisateur" inherited="top"> + <item name="Accueil" href="index.html"/> + <item name="Lancer la démo" href="jnlp/launch.jnlp"/> + </menu> + + </body> +</project> Property changes on: trunk/jaxx-tutorial-validation/src/site/site_fr.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native