r916 - in lutinjaxx/trunk: . jaxx-example-pom maven-jaxx-plugin/src/examples maven-jaxx-plugin/src/examples/Calculator maven-jaxx-plugin/src/examples/Components maven-jaxx-plugin/src/examples/Counter maven-jaxx-plugin/src/examples/LabelStyle maven-jaxx-plugin/src/examples/LabelStyle2 maven-jaxx-plugin/src/examples/LabelStyle2/src maven-jaxx-plugin/src/examples/LabelStyle2/src/main maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java
Author: tchemit Date: 2008-10-15 13:56:48 +0000 (Wed, 15 Oct 2008) New Revision: 916 Added: lutinjaxx/trunk/jaxx-example-pom/ lutinjaxx/trunk/jaxx-example-pom/LICENSE.txt lutinjaxx/trunk/jaxx-example-pom/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/BeanValidator.java lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.css lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.jaxx lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto-validation.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto.java lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/sun.jnlp lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/template.vm Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml lutinjaxx/trunk/pom.xml Log: improve example pom + integrate xwork validation Added: lutinjaxx/trunk/jaxx-example-pom/LICENSE.txt =================================================================== --- lutinjaxx/trunk/jaxx-example-pom/LICENSE.txt (rev 0) +++ lutinjaxx/trunk/jaxx-example-pom/LICENSE.txt 2008-10-15 13:56:48 UTC (rev 916) @@ -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. + Copied: lutinjaxx/trunk/jaxx-example-pom/pom.xml (from rev 910, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml) =================================================================== --- lutinjaxx/trunk/jaxx-example-pom/pom.xml (rev 0) +++ lutinjaxx/trunk/jaxx-example-pom/pom.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinjaxx</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <artifactId>jaxx-example-pom</artifactId> + + <dependencies> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>jaxx-core</artifactId> + <scope>compile</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>jaxx example pom</name> + <version>0.5-SNAPSHOT</version> + <inceptionYear>2008</inceptionYear> + <description>Jaxx Example super pom</description> + <url>${example.home.url}</url> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>pom</packaging> + + <properties> + + <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + + <example.home.url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</example.home.url> + + <!-- jnlp --> + <keystorepath>${keystorepath}</keystorepath> + <keystorealias>CodeLutin</keystorealias> + <keystorepass>codelutin</keystorepass> + + </properties> + + <build> + + <pluginManagement> + <plugins> + + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <version>0.5-SNAPSHOT</version> + <configuration> + <src>${basedir}/src/main/java</src> + <force>true</force> + </configuration> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>${maven.jar.main.class}</mainClass> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> + <execution> + <id>JnlpSun</id> + <phase>package</phase> + <configuration> + <tasks> + <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" + todir="${project.basedir}/target/jnlp" failonerror="false"> + <filterset> + <filter token="help" value="javahelp-2.0.02.jar"/> + <filter token="url" value="${project.url}"/> + </filterset> + </copy> + <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" + todir="${project.basedir}/target/jnlp/lib" failonerror="false"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo.webstart</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jnlp</goal> + </goals> + </execution> + </executions> + <configuration> + <dependencies> + <excludes> + <exclude>javax.help:javahelp</exclude> + </excludes> + </dependencies> + <libPath>lib</libPath> + <jnlp> + <outputFile>launch-${project.artifactId}.jnlp</outputFile> + <mainClass>${maven.jar.main.class}</mainClass> + </jnlp> + + <sign> + <keystore>${keystorepath}</keystore> + <keypass/> + <storepass>${keystorepass}</storepass> + <storetype/> + <alias>${keystorealias}</alias> + <validity/> + <dnameCn/> + <dnameOu/> + <dnameO/> + <dnameL/> + <dnameSt/> + <dnameC/> + <verify>false</verify> + <keystoreConfig> + <delete>false</delete> + <gen>false</gen> + </keystoreConfig> + </sign> + + + <pack200>false</pack200> + <gzip>true</gzip> + <verbose>false</verbose> + </configuration> + </plugin> + + </plugins> + </pluginManagement> + + </build> +</project> \ No newline at end of file Property changes on: lutinjaxx/trunk/jaxx-example-pom/pom.xml ___________________________________________________________________ Name: svn:mergeinfo + Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator ___________________________________________________________________ Name: svn:ignore + target LICENSE.txt Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml 2008-10-15 13:47:54 UTC (rev 915) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -11,22 +11,12 @@ <parent> <groupId>org.codelutin</groupId> - <artifactId>lutinjaxx</artifactId> + <artifactId>jaxx-example-pom</artifactId> <version>0.5-SNAPSHOT</version> </parent> <artifactId>Calculator</artifactId> - <dependencies> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>jaxx-core</artifactId> - <scope>compile</scope> - </dependency> - - </dependencies> - <!-- ************************************************************* --> <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> @@ -34,130 +24,41 @@ <version>0.5-SNAPSHOT</version> <inceptionYear>2008</inceptionYear> <description>Jaxx Calculator example</description> - <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + <url>${example.home.url}</url> - <properties> - <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> - <!-- jnlp --> - <keystorepath>${keystorepath}</keystorepath> - <keystorealias>CodeLutin</keystorealias> - <keystorepass>codelutin</keystorepass> + <packaging>jar</packaging> - </properties> - <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.codelutin</groupId> - <artifactId>maven-jaxx-plugin</artifactId> - <configuration> - <src>${basedir}/src/main/java</src> - <force>true</force> - </configuration> + <artifactId>maven-jaxx-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <mainClass>${maven.jar.main.class}</mainClass> - <classpathPrefix>lib/</classpathPrefix> - </manifest> - </archive> - </configuration> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> - <executions> - <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> - <execution> - <id>JnlpSun</id> - <phase>package</phase> - <configuration> - <tasks> - <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" - todir="${project.basedir}/target/jnlp"> - <filterset> - <filter token="help" value="javahelp-2.0.02.jar"/> - <filter token="url" value="${project.url}"/> - </filterset> - </copy> - <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" - todir="${project.basedir}/target/jnlp/lib"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> </plugin> <plugin> <groupId>org.codehaus.mojo.webstart</groupId> <artifactId>webstart-maven-plugin</artifactId> - <version>1.0-alpha-2</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>jnlp</goal> - </goals> - </execution> - </executions> - <configuration> - <dependencies> - <excludes> - <exclude>javax.help:javahelp</exclude> - </excludes> - </dependencies> - <libPath>lib</libPath> - <jnlp> - <outputFile>launch-${project.artifactId}.jnlp</outputFile> - <mainClass>${maven.jar.main.class}</mainClass> - </jnlp> - - <sign> - <keystore>${keystorepath}</keystore> - <keypass/> - <storepass>${keystorepass}</storepass> - <storetype/> - <alias>${keystorealias}</alias> - <validity/> - <dnameCn/> - <dnameOu/> - <dnameO/> - <dnameL/> - <dnameSt/> - <dnameC/> - <verify>false</verify> - <keystoreConfig> - <delete>false</delete> - <gen>false</gen> - </keystoreConfig> - </sign> - - - <pack200>false</pack200> - <gzip>true</gzip> - <verbose>false</verbose> - </configuration> </plugin> </plugins> Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components ___________________________________________________________________ Name: svn:ignore + target LICENSE.txt Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml 2008-10-15 13:47:54 UTC (rev 915) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/pom.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -11,41 +11,27 @@ <parent> <groupId>org.codelutin</groupId> - <artifactId>lutinjaxx</artifactId> + <artifactId>jaxx-example-pom</artifactId> <version>0.5-SNAPSHOT</version> </parent> <artifactId>Components</artifactId> - <dependencies> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>jaxx-core</artifactId> - <scope>compile</scope> - </dependency> - - </dependencies> - <!-- ************************************************************* --> <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> <name>Components example</name> <version>0.5-SNAPSHOT</version> <inceptionYear>2008</inceptionYear> - <description>Jaxx Calculator example</description> - <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + <description>Jaxx Components example</description> + <url>${example.home.url}</url> - <properties> - <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> - <!-- jnlp --> - <keystorepath>${keystorepath}</keystorepath> - <keystorealias>CodeLutin</keystorealias> - <keystorepass>codelutin</keystorepass> + <packaging>jar</packaging> - </properties> - <build> <finalName>${project.artifactId}</finalName> <plugins> @@ -53,111 +39,26 @@ <plugin> <groupId>org.codelutin</groupId> <artifactId>maven-jaxx-plugin</artifactId> - <configuration> - <src>${basedir}/src/main/java</src> - <force>true</force> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <mainClass>${maven.jar.main.class}</mainClass> - <classpathPrefix>lib/</classpathPrefix> - </manifest> - </archive> - </configuration> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> - <executions> - <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> - <execution> - <id>JnlpSun</id> - <phase>package</phase> - <configuration> - <tasks> - <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" - todir="${project.basedir}/target/jnlp"> - <filterset> - <filter token="help" value="javahelp-2.0.02.jar"/> - <filter token="url" value="${project.url}"/> - </filterset> - </copy> - <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" - todir="${project.basedir}/target/jnlp/lib"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> </plugin> <plugin> <groupId>org.codehaus.mojo.webstart</groupId> <artifactId>webstart-maven-plugin</artifactId> - <version>1.0-alpha-2</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>jnlp</goal> - </goals> - </execution> - </executions> - <configuration> - <dependencies> - <excludes> - <exclude>javax.help:javahelp</exclude> - </excludes> - </dependencies> - <libPath>lib</libPath> - <jnlp> - <outputFile>launch-${project.artifactId}.jnlp</outputFile> - <mainClass>${maven.jar.main.class}</mainClass> - </jnlp> - - <sign> - <keystore>${keystorepath}</keystore> - <keypass/> - <storepass>${keystorepass}</storepass> - <storetype/> - <alias>${keystorealias}</alias> - <validity/> - <dnameCn/> - <dnameOu/> - <dnameO/> - <dnameL/> - <dnameSt/> - <dnameC/> - <verify>false</verify> - <keystoreConfig> - <delete>false</delete> - <gen>false</gen> - </keystoreConfig> - </sign> - - - <pack200>false</pack200> - <gzip>true</gzip> - <verbose>false</verbose> - </configuration> </plugin> </plugins> Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter ___________________________________________________________________ Name: svn:ignore + target LICENSE.txt Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml 2008-10-15 13:47:54 UTC (rev 915) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -11,41 +11,27 @@ <parent> <groupId>org.codelutin</groupId> - <artifactId>lutinjaxx</artifactId> + <artifactId>jaxx-example-pom</artifactId> <version>0.5-SNAPSHOT</version> </parent> <artifactId>Counter</artifactId> - <dependencies> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>jaxx-core</artifactId> - <scope>compile</scope> - </dependency> - - </dependencies> - <!-- ************************************************************* --> <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> <name>Counter example</name> <version>0.5-SNAPSHOT</version> <inceptionYear>2008</inceptionYear> - <description>Jaxx Calculator example</description> - <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + <description>Jaxx Counter example</description> + <url>${example.home.url}</url> - <properties> - <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> - <!-- jnlp --> - <keystorepath>${keystorepath}</keystorepath> - <keystorealias>CodeLutin</keystorealias> - <keystorepass>codelutin</keystorepass> + <packaging>jar</packaging> - </properties> - <build> <finalName>${project.artifactId}</finalName> <plugins> @@ -53,111 +39,26 @@ <plugin> <groupId>org.codelutin</groupId> <artifactId>maven-jaxx-plugin</artifactId> - <configuration> - <src>${basedir}/src/main/java</src> - <force>true</force> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <mainClass>${maven.jar.main.class}</mainClass> - <classpathPrefix>lib/</classpathPrefix> - </manifest> - </archive> - </configuration> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> - <executions> - <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> - <execution> - <id>JnlpSun</id> - <phase>package</phase> - <configuration> - <tasks> - <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" - todir="${project.basedir}/target/jnlp"> - <filterset> - <filter token="help" value="javahelp-2.0.02.jar"/> - <filter token="url" value="${project.url}"/> - </filterset> - </copy> - <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" - todir="${project.basedir}/target/jnlp/lib"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> </plugin> <plugin> <groupId>org.codehaus.mojo.webstart</groupId> <artifactId>webstart-maven-plugin</artifactId> - <version>1.0-alpha-2</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>jnlp</goal> - </goals> - </execution> - </executions> - <configuration> - <dependencies> - <excludes> - <exclude>javax.help:javahelp</exclude> - </excludes> - </dependencies> - <libPath>lib</libPath> - <jnlp> - <outputFile>launch-${project.artifactId}.jnlp</outputFile> - <mainClass>${maven.jar.main.class}</mainClass> - </jnlp> - - <sign> - <keystore>${keystorepath}</keystore> - <keypass/> - <storepass>${keystorepass}</storepass> - <storetype/> - <alias>${keystorealias}</alias> - <validity/> - <dnameCn/> - <dnameOu/> - <dnameO/> - <dnameL/> - <dnameSt/> - <dnameC/> - <verify>false</verify> - <keystoreConfig> - <delete>false</delete> - <gen>false</gen> - </keystoreConfig> - </sign> - - - <pack200>false</pack200> - <gzip>true</gzip> - <verbose>false</verbose> - </configuration> </plugin> </plugins> Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle ___________________________________________________________________ Name: svn:ignore + target LICENSE.txt Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml 2008-10-15 13:47:54 UTC (rev 915) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -11,41 +11,27 @@ <parent> <groupId>org.codelutin</groupId> - <artifactId>lutinjaxx</artifactId> + <artifactId>jaxx-example-pom</artifactId> <version>0.5-SNAPSHOT</version> </parent> <artifactId>LabelStyle</artifactId> - <dependencies> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>jaxx-core</artifactId> - <scope>compile</scope> - </dependency> - - </dependencies> - <!-- ************************************************************* --> <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> <name>LabelStyle example</name> <version>0.5-SNAPSHOT</version> <inceptionYear>2008</inceptionYear> - <description>Jaxx Calculator example</description> - <url>${site.home.url}/lutinjaxx/maven-jaxx-plugin/examples</url> + <description>Jaxx LabelStyle example</description> + <url>${example.home.url}</url> - <properties> - <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class> + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> - <!-- jnlp --> - <keystorepath>${keystorepath}</keystorepath> - <keystorealias>CodeLutin</keystorealias> - <keystorepass>codelutin</keystorepass> + <packaging>jar</packaging> - </properties> - <build> <finalName>${project.artifactId}</finalName> <plugins> @@ -53,111 +39,26 @@ <plugin> <groupId>org.codelutin</groupId> <artifactId>maven-jaxx-plugin</artifactId> - <configuration> - <src>${basedir}/src/main/java</src> - <force>true</force> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <mainClass>${maven.jar.main.class}</mainClass> - <classpathPrefix>lib/</classpathPrefix> - </manifest> - </archive> - </configuration> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> - <executions> - <!-- Ajout des libs signe par Sun dans un fichier jnlp separe --> - <execution> - <id>JnlpSun</id> - <phase>package</phase> - <configuration> - <tasks> - <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" - todir="${project.basedir}/target/jnlp"> - <filterset> - <filter token="help" value="javahelp-2.0.02.jar"/> - <filter token="url" value="${project.url}"/> - </filterset> - </copy> - <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" - todir="${project.basedir}/target/jnlp/lib"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> </plugin> <plugin> <groupId>org.codehaus.mojo.webstart</groupId> <artifactId>webstart-maven-plugin</artifactId> - <version>1.0-alpha-2</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>jnlp</goal> - </goals> - </execution> - </executions> - <configuration> - <dependencies> - <excludes> - <exclude>javax.help:javahelp</exclude> - </excludes> - </dependencies> - <libPath>lib</libPath> - <jnlp> - <outputFile>launch-${project.artifactId}.jnlp</outputFile> - <mainClass>${maven.jar.main.class}</mainClass> - </jnlp> - - <sign> - <keystore>${keystorepath}</keystore> - <keypass/> - <storepass>${keystorepass}</storepass> - <storetype/> - <alias>${keystorealias}</alias> - <validity/> - <dnameCn/> - <dnameOu/> - <dnameO/> - <dnameL/> - <dnameSt/> - <dnameC/> - <verify>false</verify> - <keystoreConfig> - <delete>false</delete> - <gen>false</gen> - </keystoreConfig> - </sign> - - - <pack200>false</pack200> - <gzip>true</gzip> - <verbose>false</verbose> - </configuration> </plugin> </plugins> Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2 ___________________________________________________________________ Name: svn:ignore + target LICENSE.txt Copied: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml (from rev 910, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/pom.xml) =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>jaxx-example-pom</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <artifactId>LabelStyle2</artifactId> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>LabelStyle2 example</name> + <version>0.5-SNAPSHOT</version> + <inceptionYear>2008</inceptionYear> + <description>Jaxx LabelStyle2 (with xwork validation) example</description> + <url>${example.home.url}</url> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>jar</packaging> + + <build> + <finalName>${project.artifactId}</finalName> + <plugins> + + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + </plugin> + + <plugin> + + <artifactId>maven-antrun-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo.webstart</groupId> + <artifactId>webstart-maven-plugin</artifactId> + </plugin> + + </plugins> + </build> +</project> \ No newline at end of file Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml ___________________________________________________________________ Name: svn:mergeinfo + Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/BeanValidator.java =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/BeanValidator.java (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/BeanValidator.java 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,497 @@ +/* *##% + * Copyright (C) 2002-2008 Code Lutin, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + *##%*/ + +package examples.LabelStyle; + + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ValidationAwareSupport; +import com.opensymphony.xwork2.config.Configuration; +import com.opensymphony.xwork2.config.ConfigurationManager; +import com.opensymphony.xwork2.util.ValueStack; +import com.opensymphony.xwork2.util.ValueStackFactory; +import com.opensymphony.xwork2.validator.ActionValidatorManager; +import com.opensymphony.xwork2.validator.DelegatingValidatorContext; +import com.opensymphony.xwork2.validator.ValidationException; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.beans.BeanDescriptor; +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.ListModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.jxlayer.JXLayer; +import org.jdesktop.jxlayer.plaf.AbstractLayerUI; + +/** + * <p> + * Permet d'ajouter facilement le support de la validation des champs d'un + * bean et de le relier a une interface graphique. + * Utilise xwork pour la validation et JXLayer pour la visualisation. + * + * <p> + * Le mieux pour son integration dans Jaxx est de faire de la generation pour + * force la compilation du code suivant: + * + * <pre> + * myValidor.getBean().get<field>(); + * </pre> + * + * et ceci pour chaque field ajoute a la map fieldRepresentation. De cette + * facon meme si le champs field est en texte on a une verification de son + * existance a la compilation. + * + * <p> + * La representation en tag pourrait etre + * <pre> + * + * <validator id="myValidator" beanClass="{Personne.class}" errorList="$list"> + * <field name="name" component="$name"/> + * <field name="firstName" component="$firstName"/> + * <field name="birthDate" component="$birthDate"/> + * </validator> + * + * <validator beanClass="{Personne.class}" autoField="true" errorList="$list"> + * <fieldRepresentation name="name" component="$lastName"/> + * </validator> + * + * </pre> + * + * dans le premier exemple on fait un mapping explicite des champs, mais on voit + * que le nom du composant graphique est le meme que celui du champs. Pour eviter + * de longue saisie, il est possible d'utiliser le flag <b>autoField</b> + * qui pour chaque champs du ayant une methode get du bean recherche un composant + * avec cet Id. Il est aussi possible de surcharge un champs explicitement + * comme ici name, dans le cas ou le composant qui porterait ce nom serait + * utilise pour autre chose. + * + * <p> + * Il faut un handler particulier pour ce composant car les attributs + * <b>beanClass</b> et <b>autoField</b> ne sont present que dans le XML jaxx et + * servent a la generation. Il faut aussi prendre en compte les elements + * fieldRepresentation fils du tag validator. + * + * <p> + * Voici ce que pourrait etre le code genere par jaxx + * <pre> + * // declaration du bean + * BeanValidator<beanClass> $myValidator; + * + * // init du bean + * protected void createMyValidator() { + * $myValidator = new BeanValidator<beanClass>(); + * + * // genere seulement si autoField = true + * for (Method m : beanClass.getMethod()) { + * if (m.getName().startsWith("get")) { + * String fieldName = m.getName().substring(3).toLowerCase(); + * $myValidator.setFieldRepresentation(fieldName, $objectMap.get(fieldName)); + * } + * } + * + * // pour chaque tag fieldRepresentation + * myValidator.setFieldRepresentation("name", $lastName); + * + * // si beanClass est specifie et n'est pas Object, on force l'acces au champs + * // pour validation a la compilation + * $myValidator.getBean().getName(); + * + * $objectMap.put("myValidator", $myValidator); + * } + * </pre> + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class BeanValidator<T> { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(BeanValidator.class); + + protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + protected ValidationAwareSupport validationSupport = new ValidationAwareSupport(); + protected DelegatingValidatorContext validationContext = + new DelegatingValidatorContext(validationSupport); + + protected transient ActionValidatorManager validator = null; + + /** indique si le bean a ete modifie depuis sont arrive */ + protected boolean changed = false; + /** le bean a surveiller */ + protected T bean = null; + /** l'objet qui recoit les notifications de modification du bean */ + protected Listener l = new Listener(); + /** permet de faire le lien en un champs du bean et l'objet qui permet de l'editer */ + protected Map<String, JComponent> fieldRepresentation = new HashMap<String, JComponent>(); + /** Objet servant a afficher toutes les erreurs */ + protected JList errorList = null; + + public BeanValidator() { + } + + /** + * Permet de modifier l'objet permettant d'afficher toutes les errors + * @param errorList si null arrete d'afficher les errors + */ + public void setErrorList(JList errorList) { + this.errorList = errorList; + } + + public JList getErrorList() { + return errorList; + } + + /** + * Permet d'indiquer le composant graphique responsable de l'affichage + * d'un attribut du bean + * @param fieldname + * @param c + */ + public void setFieldRepresentation(String fieldname, JComponent c) { + JComponent old = fieldRepresentation.put(fieldname, c); + setErrorRepresentation(fieldname, old, c); + } + + public void setFieldRepresentation(Map<String, JComponent> fieldRepresentation) { + for(Map.Entry<String, JComponent> e : fieldRepresentation.entrySet()) { + setFieldRepresentation(e.getKey(), e.getValue()); + } + } + + + + public JComponent getFieldRepresentation(String fieldname) { + return fieldRepresentation.get(fieldname); + } + + + /** + * Retourne vrai si l'objet bean a ete modifie depuis le dernier + * {@link #setBean} + * @return + */ + public boolean isChanged() { + return changed; + } + + /** + * Permet de force la remise a false de l'etat de changement du bean + * @param changed + */ + public void setChanged(boolean changed) { + boolean oldChanged = this.changed; + this.changed = changed; + pcs.firePropertyChange("changed", oldChanged, changed); + } + + public T getBean() { + return bean; + } + + public void setBean(T bean) { + T oldBean = this.bean; + if (this.bean != null) { + try { + Method method = this.bean.getClass().getMethod("removePropertyChangeListener", PropertyChangeListener.class); + method.invoke(this.bean, l); + } catch (Exception eee) { + log.info("Can't register as listener", eee); + } + } + this.bean = bean; + if (this.bean != null) { + try { + Method method = this.bean.getClass().getMethod("addPropertyChangeListener", PropertyChangeListener.class); + method.invoke(this.bean, l); + } catch (Exception eee) { + log.info("Can't register as listener", eee); + } + } + validate(); + pcs.firePropertyChange("bean", oldBean, bean); + } + + protected ActionValidatorManager getValidator() { + if (validator == null) { + ConfigurationManager confManager = new ConfigurationManager(); + Configuration conf = confManager.getConfiguration(); + + ValueStackFactory vsf = conf.getContainer().getInstance( + ValueStackFactory.class); + ValueStack vs = vsf.createValueStack(); + ActionContext context = new ActionContext(vs.getContext()); + ActionContext.setContext(context); + + validator = conf.getContainer().getInstance( + ActionValidatorManager.class, "no-annotations"); + } + return validator; + } + + /** + * il faut eviter le code re-intrant (durant une validation, une autre est + * demandee). Pour cela on fait la validation dans un thread, et tant + * que la premiere validation n'est pas fini, on ne repond pas aux + * solicitations. + * Cette method est public pour permettre de force une validation par + * programmation, ce qui est utile par exemple si le bean ne supporte + * pas les {@link PropertyChangeListener} + */ + public void validate() { + // on ne valide que si il y a un bean et que le resultat de la validation + // pourra etre affiche quelque part + if (bean != null && (getErrorList() != null || fieldRepresentation.size() != 0)) { + try { + + validationSupport.clearErrorsAndMessages(); + getValidator().validate(bean, null, validationContext); + + if(log.isDebugEnabled()) { + log.debug("Action errors: " + validationContext.getActionErrors()); + log.debug("Action messages: " + validationContext.getActionMessages()); + log.debug("Field errors: " + validationContext.getFieldErrors()); + } + + System.out.println(validationContext.getFieldErrors()); + + // TODO: trouver autre chose + // On est obliger de le refaire ici car avec jaxx, lors du + // setFieldRepresentation le composant n'a pas encore de pere :( + for (String fieldname : fieldRepresentation.keySet()) { + JComponent c = fieldRepresentation.get(fieldname); + setErrorRepresentation(fieldname, null, c); + } + } catch (ValidationException eee) { + log.warn("Error during validation", eee); + } + } + } + + protected void setErrorRepresentation(String fieldname, JComponent old, JComponent c) { + if (old != c) { + if (old != null) { + // suppression du jxlayer sous l'ancien composant + Container container = old.getParent(); + if (container instanceof JXLayer) { + JXLayer<JComponent> jx = (JXLayer<JComponent>)container; + jx.setUI(null); + } + } + if (c != null) { + // ajout du jxlayer sous ce composant + Container container = c.getParent(); + if (container instanceof JXLayer) { + IconValidationUI ui = new IconValidationUI(fieldname, validationSupport.getFieldErrors()); +// TranslucentValidationUI ui = new TranslucentValidationUI(fieldname, validationSupport.getFieldErrors()); + ui.setEnabled(true); + + JXLayer<JComponent> jx = (JXLayer<JComponent>)container; + jx.setUI(ui); + } + } + } + } + + /** + * Permet d'afficher les messages d'error dans L'ui + */ + protected ListModel getListModel() { + // FIXME a implanter + return null; + } + + protected class Listener implements PropertyChangeListener { + + public void propertyChange(PropertyChangeEvent evt) { + validate(); + setChanged(true); + } + + } + + /** + * recherche les composants portant le meme nom que les champs de la classe + * clazz. Cette methode est statique pour pouvoir eventuellement l'utiliser + * dans un autre context (je pense par exemple a la generation jaxx). + * + * <p> + * Si la recherche echoue pour quelque raison que se soit, aucune exception + * n'est leve, et la map retournee est tout simplement vide ou incomplete + * + * @param clazz la classe ou recherche les champs + * @param container le container ou rechercher les composants d'edition + * @return + */ + public static Map<String, JComponent> lookingForEditor(Class clazz, Container container) { + Map<String, JComponent> result = new HashMap<String, JComponent>(); + try { + // looking for all component with name set + Map<String, JComponent> allNamedComponent = new HashMap<String, JComponent>(); + List<Container> todo = new LinkedList<Container>(); + todo.add(container); + while (todo.size() > 0) { + for (ListIterator<Container> i = todo.listIterator(); i.hasNext();) { + Container parent = i.next(); + i.remove(); + for (Component c : parent.getComponents()) { + if (c instanceof Container) { + i.add((Container) c); + String name = c.getName(); + if (c instanceof JComponent && + name != null && !"".equals(name)) { + allNamedComponent.put(name, (JComponent)c); + } + } + } + } + } + + // looking for all properties on class + BeanInfo info = Introspector.getBeanInfo(clazz); + PropertyDescriptor[] props = info.getPropertyDescriptors(); + + // find if one properties have same name that component + for (PropertyDescriptor prop : props) { + String name = prop.getName(); + if (allNamedComponent.containsKey(name)) { + result.put(name, allNamedComponent.get(name)); + } + } + + } catch (IntrospectionException eee) { + log.warn("Can't introspect bean", eee); + } + + System.out.println("Result: " + result); + + return result; + } + + public static class TranslucentValidationUI extends AbstractLayerUI<JComponent> { + + protected String field = null; + protected Map resultValidation = null; + public TranslucentValidationUI(String field, Map resultValidation) { + this.field = field; + this.resultValidation = resultValidation; + } + + @Override + protected void paintLayer(Graphics2D g2, JXLayer<JComponent> l) { + // paints the layer as is + super.paintLayer(g2, l); + + // to be in sync with the view if the layer has a border + Insets layerInsets = l.getInsets(); + g2.translate(layerInsets.left, layerInsets.top); + + JComponent view = l.getView(); + // To prevent painting on view's border + Insets insets = view.getInsets(); + g2.clip(new Rectangle(insets.left, insets.top, + view.getWidth() - insets.left - insets.right, + view.getHeight() - insets.top - insets.bottom)); + + g2.setColor(!resultValidation.containsKey(field) ? + Color.GREEN : Color.RED); + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .2f)); + g2.fillRect(0, 0, l.getWidth(), l.getHeight()); + } + } + + public static class IconValidationUI extends AbstractLayerUI<JComponent> { + + // The red icon to be shown at the layer's corner + private final static BufferedImage INVALID_ICON; + + static { + int width = 7; + int height = 8; + INVALID_ICON = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = (Graphics2D) INVALID_ICON.getGraphics(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); + g2.setColor(Color.RED); + g2.fillRect(0, 0, width, height); + g2.setColor(Color.WHITE); + g2.drawLine(0, 0, width, height); + g2.drawLine(0, height, width, 0); + g2.dispose(); + } + + protected String field = null; + protected Map resultValidation = null; + public IconValidationUI(String field, Map resultValidation) { + this.field = field; + this.resultValidation = resultValidation; + } + + @Override + public void installUI(JComponent c) { + super.installUI(c); + c.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 3)); + } + + @Override + public void uninstallUI(JComponent c) { + super.uninstallUI(c); + c.setBorder(null); + } + + @Override + protected void paintLayer(Graphics2D g2, JXLayer<JComponent> l) { + super.paintLayer(g2, l); + + // There is no need to take insets into account for this painter + if (resultValidation.containsKey(field)) { + g2.drawImage(INVALID_ICON, l.getWidth() - INVALID_ICON.getWidth() - 1, 0, null); +// g2.drawImage(INVALID_ICON, 0, 0, null); + } + } + } + +} Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.css =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.css (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.css 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,34 @@ +JSlider { + paintTicks: true; +} + +JSlider.color { + minorTickSpacing: 10; + majorTickSpacing: 50; + border: { BorderFactory.createEmptyBorder(1, 1, 1, 1) }; +} + +JSlider.color:focused { + border: { BorderFactory.createLineBorder(Color.BLACK, 1) }; +} + +JSlider#red:focused { + background: #E7ADAD; +} + +JSlider#green:focused { + background: #B2E7AD; +} + +JSlider#blue:focused { + background: #ADB2E7; +} + +JSlider#csize { + minorTickSpacing: 2; + majorTickSpacing: 6; +} + +JRadioButton { + enabled: { backgroundCheckbox.isSelected() }; +} \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.jaxx =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.jaxx (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/LabelStyle.jaxx 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,80 @@ +<Application title="LabelStyle.jaxx"> + <style source="LabelStyle.css"/> + +<script> +//import org.jdesktop.jxlayer.JXLayer; + +Toto toto = new Toto(); + +BeanValidator validator = new BeanValidator(); +validator.setFieldRepresentation("text", text); +validator.setBean(toto); +</script> + + <Table anchor='north' fill='both'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <Table anchor='west' fill='both'> + <row> + <cell><JLabel text='Text:'/></cell> + <cell weightx='1'> + <!--org.jdesktop.jxlayer.JXLayer--> + <JTextField id='text' text='{toto.getText()}' + onKeyReleased='toto.setText(text.getText())'/> + <!--/org.jdesktop.jxlayer.JXLayer--> + </cell> + </row> + + <row> + <cell><JLabel text='Red:'/></cell> + <cell><JSlider id='red' value='128' maximum='255' styleClass='color'/></cell> + </row> + + <row> + <cell><JLabel text='Green:'/></cell> + <cell><JSlider id='green' value='0' maximum='255' styleClass='color'/></cell> + </row> + + <row> + <cell><JLabel text='Blue:'/></cell> + <cell><JSlider id='blue' value='255' maximum='255' styleClass='color'/></cell> + </row> + + <row> + <cell><JLabel text='Size:'/></cell> + <cell><JSlider id='csize' value='36' minimum='6' maximum='60'/></cell> + </row> + + <row> + <cell columns='2' fill='both' weighty='1'> + <JPanel border='{BorderFactory.createTitledBorder("Preview")}' + height='90' + layout='{new BorderLayout()}'> + <VBox background='{backgroundCheckbox.isSelected() ? backgroundColor.getSelectedValue() : null}' + margin='0' + horizontalAlignment='center' + verticalAlignment='middle'> + <JLabel text='{toto.getText()}' font-size='{csize.getValue()}' foreground='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> + </VBox> + </JPanel> + </cell> + </row> + </Table> + </cell> + + <cell> + <VBox spacing='0' border='{BorderFactory.createTitledBorder("Background")}'> + <JCheckBox id='backgroundCheckbox' text='Show Background'/> + <JRadioButton text='Red' buttonGroup='backgroundColor' value='{Color.RED}' selected='true'/> + <JRadioButton text='Orange' buttonGroup='backgroundColor' value='{Color.ORANGE}'/> + <JRadioButton text='Yellow' buttonGroup='backgroundColor' value='{Color.YELLOW}'/> + <JRadioButton text='Green' buttonGroup='backgroundColor' value='{Color.GREEN}'/> + <JRadioButton text='Cyan' buttonGroup='backgroundColor' value='{Color.CYAN}'/> + <JRadioButton text='Blue' buttonGroup='backgroundColor' value='{Color.BLUE}'/> + <JRadioButton text='Purple' buttonGroup='backgroundColor' value='{new Color(160, 30, 255)}'/> + </VBox> + </cell> + </row> + </Table> + +</Application> Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto-validation.xml =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto-validation.xml (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto-validation.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,19 @@ +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> + <validators> + <!-- Field Validators for email field --> + <field name="text"> + <field-validator type="required" short-circuit="true"> + <message>You must enter a value for text.</message> + </field-validator> + <field-validator type="email" short-circuit="true"> + <message>Not a valid e-mail.</message> + </field-validator> + </field> + <!-- Plain Validator 1 --> + <validator type="expression"> + <param name="expression">text.startsWith("poussin")</param> + <message>Email not starts with poussin</message> + </validator> + </validators> \ No newline at end of file Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto.java =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto.java (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/LabelStyle/Toto.java 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,41 @@ +package examples.LabelStyle; + +import java.beans.*; + +class Toto { + + String text = "initial"; + + PropertyChangeSupport p; + + public Toto() { + p = new PropertyChangeSupport(this); + } + + 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); + } + + + public String getText() { + return text; + } + + public void setText(String text) { + String oldText = this.text; + this.text = text; + p.firePropertyChange("text", oldText, text); + } +} Copied: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/sun.jnlp (from rev 910, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/sun.jnlp) =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/sun.jnlp (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/sun.jnlp 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp spec="1.0+" codebase="@url@" href="sun.jnlp"> + <information> + <title>Sun MicroSystems</title> + <vendor>Sun MicroSystems, Inc.</vendor> + <offline-allowed/> + </information> + <resources> + <jar href="lib/@help@"/> + </resources> + <component-desc/> +</jnlp> \ No newline at end of file Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/sun.jnlp ___________________________________________________________________ Name: svn:mergeinfo + Copied: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/template.vm (from rev 910, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/src/main/jnlp/template.vm) =================================================================== --- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/template.vm (rev 0) +++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/template.vm 2008-10-15 13:56:48 UTC (rev 916) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp + spec="1.0+" + codebase="$project.Url" href="$outputFile"> + <information> + <title>$informationTitle</title> + <vendor>$informationVendor</vendor> + <homepage href="$informationHomepage" /> + <description>$informationDescription</description> + <offline-allowed /> + </information> + <resources> + <j2se version="1.5+" max-heap-size="512m"/> + $dependencies + <extension name="sun" href="sun.jnlp"/> + </resources> + <security> + <all-permissions /> + </security> + <application-desc main-class="$mainClass" /> +</jnlp> Property changes on: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/jnlp/template.vm ___________________________________________________________________ Name: svn:mergeinfo + Modified: lutinjaxx/trunk/pom.xml =================================================================== --- lutinjaxx/trunk/pom.xml 2008-10-15 13:47:54 UTC (rev 915) +++ lutinjaxx/trunk/pom.xml 2008-10-15 13:56:48 UTC (rev 916) @@ -21,6 +21,7 @@ <module>jaxx-util</module> <module>jaxx-core</module> <module>jaxx-swing-action</module> + <module>jaxx-example-pom</module> <module>maven-jaxx-plugin</module> </modules> @@ -47,6 +48,8 @@ <properties> + <license-switcher.version>0.5-SNAPSHOT</license-switcher.version> + <!-- current version --> <current.version>0.5-SNAPSHOT</current.version>
participants (1)
-
tchemit@users.labs.libre-entreprise.org