Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
October 2008
- 2 participants
- 150 discussions
[Buix-commits] r928 - in lutinjaxx/trunk: jaxx-core/src/site/fr/rst/examples jaxx-core/src/site/fr/rst/examples/images jaxx-example jaxx-example/src jaxx-example/src/site jaxx-example/src/site/fr jaxx-example/src/site/fr/rst maven-jaxx-plugin/src/examples
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
15 Oct '08
Author: tchemit
Date: 2008-10-15 20:38:51 +0000 (Wed, 15 Oct 2008)
New Revision: 928
Added:
lutinjaxx/trunk/jaxx-example/src/site/
lutinjaxx/trunk/jaxx-example/src/site/fr/
lutinjaxx/trunk/jaxx-example/src/site/fr/rst/
lutinjaxx/trunk/jaxx-example/src/site/fr/rst/index.rst
Removed:
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Calculator.jaxx.rst
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Components.jaxx.rst
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Counter.jaxx.rst
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles.jaxx.rst
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Calculator-screenshot.gif
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Components-screenshot.gif
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Counter-screenshot.gif
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/LabelStyle-screenshot.gif
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Validation-screenshot.jaxx.png
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components/
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle/
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/
Modified:
lutinjaxx/trunk/jaxx-example/
lutinjaxx/trunk/jaxx-example/pom.xml
Log:
each example is a module
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Calculator.jaxx.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Calculator.jaxx.rst 2008-10-15 20:36:29 UTC (rev 927)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Calculator.jaxx.rst 2008-10-15 20:38:51 UTC (rev 928)
@@ -1,30 +0,0 @@
-===================
-Examples/Calculator
-===================
-
-This is an implementation of Challenge #2 from the `XUL Grand Coding Challenge 2004`_ . Because this example program
-has been implemented in so many different languages, you can easily compare JAXX's
-syntax against the competition and decide for yourself which you prefer.
-
-Screen shot
------------
-
-.. image:: images/Calculator-screenshot.gif
-
-Set it in action
-----------------
-
-|webstart|
-
-To run this example in `Java Web Start`_, click the `following link`_.
-
-Source code
------------
-
-.. _XUL Grand Coding Challenge 2004: http://xul.sourceforge.net/challenge.html
-
-.. _Java Web Start: http://java.sun.com/products/javawebstart/
-
-.. |webstart| image:: images/webstart.gif
-
-.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Components.jaxx.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Components.jaxx.rst 2008-10-15 20:36:29 UTC (rev 927)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Components.jaxx.rst 2008-10-15 20:38:51 UTC (rev 928)
@@ -1,33 +0,0 @@
-===================
-Examples/Components
-===================
-
-The Components demo displays many different Swing components being used in a variety of ways; it is JAXX's equivalent
-of the SwingSet demo. Various pages use advanced features such as data binding, scripting, event handling, and
-CSS stylesheets.
-
-Screen shot
------------
-
-.. image:: images/Components-screenshot.gif
-
-Set it in action
-----------------
-
-|webstart|
-
-To run this example in `Java Web Start`_, click the `following link`_.
-
-
-Source code
------------
-
-Unlike the other examples, the source code for Components is too big to display here. You can view it yourself by
-downloading JAXX, and you can also view the source code for the individual demos by clicking the "Source" tabs.
-
-
-.. _Java Web Start: http://java.sun.com/products/javawebstart/
-
-.. |webstart| image:: images/webstart.gif
-
-.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Counter.jaxx.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Counter.jaxx.rst 2008-10-15 20:36:29 UTC (rev 927)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Counter.jaxx.rst 2008-10-15 20:38:51 UTC (rev 928)
@@ -1,28 +0,0 @@
-================
-Examples/Counter
-================
-
-
-Screen shot
------------
-
-.. image:: images/Counter-screenshot.gif
-
-Set it in action
-----------------
-
-
-|webstart|
-
-To run this example in `Java Web Start`_, click the `following link`_.
-
-
-Source code
------------
-
-
-.. _Java Web Start: http://java.sun.com/products/javawebstart/
-
-.. |webstart| image:: images/webstart.gif
-
-.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
\ No newline at end of file
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles.jaxx.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles.jaxx.rst 2008-10-15 20:36:29 UTC (rev 927)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles.jaxx.rst 2008-10-15 20:38:51 UTC (rev 928)
@@ -1,28 +0,0 @@
-====================
-Examples/LabelStyles
-====================
-
-This example program creates a number of components which are used to control the appearance of a JLabel.
-Everything is performed through data binding; there are no script tags or explicit event handlers anywhere.
-
-Screen shot
------------
-
-.. image:: images/LabelStyle-screenshot.gif
-
-Set it in action
-----------------
-
-|webstart|
-
-To run this example in `Java Web Start`_, click the `following link`_.
-
-
-Source code
------------
-
-.. _Java Web Start: http://java.sun.com/products/javawebstart/
-
-.. |webstart| image:: images/webstart.gif
-
-.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst 2008-10-15 20:36:29 UTC (rev 927)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst 2008-10-15 20:38:51 UTC (rev 928)
@@ -1,28 +0,0 @@
-=====================
-Examples/LabelStyles2
-=====================
-
-This example program creates a number of components which are used to control the appearance of a JLabel.
-Everything is performed through data binding; there are no script tags or explicit event handlers anywhere.
-
-Screen shot
------------
-
-.. image:: images/Validation-screenshot.gif
-
-Set it in action
-----------------
-
-|webstart|
-
-To run this example in `Java Web Start`_, click the `following link`_.
-
-
-Source code
------------
-
-.. _Java Web Start: http://java.sun.com/products/javawebstart/
-
-.. |webstart| image:: images/webstart.png
-
-.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Calculator-screenshot.gif
===================================================================
(Binary files differ)
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Components-screenshot.gif
===================================================================
(Binary files differ)
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Counter-screenshot.gif
===================================================================
(Binary files differ)
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/LabelStyle-screenshot.gif
===================================================================
(Binary files differ)
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Validation-screenshot.jaxx.png
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-example
___________________________________________________________________
Name: svn:ignore
+ target
Modified: lutinjaxx/trunk/jaxx-example/pom.xml
===================================================================
--- lutinjaxx/trunk/jaxx-example/pom.xml 2008-10-15 20:36:29 UTC (rev 927)
+++ lutinjaxx/trunk/jaxx-example/pom.xml 2008-10-15 20:38:51 UTC (rev 928)
@@ -15,7 +15,7 @@
<version>0.5-SNAPSHOT</version>
</parent>
- <artifactId>jaxx-example-pom</artifactId>
+ <artifactId>jaxx-example</artifactId>
<dependencies>
@@ -27,10 +27,17 @@
</dependencies>
+ <modules>
+ <module>Calculator</module>
+ <!--module>Components</module-->
+ <module>Counter</module>
+ <module>LabelStyle</module>
+ <module>Validation</module>
+ </modules>
<!-- ************************************************************* -->
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
- <name>jaxx example pom</name>
+ <name>jaxx-example</name>
<version>0.5-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<description>Jaxx Example super pom</description>
@@ -53,6 +60,21 @@
<keystorealias>CodeLutin</keystorealias>
<keystorepass>codelutin</keystorepass>
+ <!-- override this property to define scm url property -->
+ <scm.url.example>
+ http://${labs.host}/plugins/scmsvn/viewcvs.php/lutinjaxx/trunk/jaxx-example/${pom.artifactId}/?root=${labs.project}
+ </scm.url.example>
+
+ <!-- BEWARE, will be suffixed by /${pom.artifactId} by inheritance -->
+ <scm.developerConnection.example>
+ scm:svn:svn+ssh://${username}@${labs.host}/svnroot/${labs.project}/lutinjaxx/trunk/jaxx-example/${pom.artifactId}
+ </scm.developerConnection.example>
+
+ <!-- BEWARE, will be suffixed by /${pom.artifactId} by inheritance -->
+ <scm.connection.example>
+ scm:svn:svn://anonymous@${labs.host}/svnroot/${labs.project}/lutinjaxx/trunk/jaxx-example/${pom.artifactId}
+ </scm.connection.example>
+
</properties>
<build>
@@ -106,10 +128,10 @@
<!-- Ajout des libs signe par Sun dans un fichier jnlp separe -->
<execution>
<id>JnlpSun</id>
- <phase>package</phase>
+ <phase>pre-site</phase>
<configuration>
<tasks>
- <copy file="${project.basedir}/src/main/jnlp/sun.jnlp"
+ <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"/>
@@ -119,6 +141,25 @@
<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>
+
+ <execution>
+ <id>JnlpToSite</id>
+ <phase>pre-site</phase>
+ <configuration-->
+ <tasks>
+ <mkdir dir="${maven.site.gen.dir}/resources/bin"/>
+ <copy todir="${maven.site.gen.dir}/resources/bin" verbose="${maven.verbose}"
+ failonerror="false" overwrite="false">
+ <fileset dir="${project.build.directory}/jnlp">
+ <include name="**"/>
+ </fileset>
+ </copy>
+ </tasks>
</configuration>
<goals>
<goal>run</goal>
@@ -133,7 +174,7 @@
<version>1.0-alpha-2</version>
<executions>
<execution>
- <phase>package</phase>
+ <phase>pre-site</phase>
<goals>
<goal>jnlp</goal>
</goals>
@@ -146,6 +187,7 @@
</excludes>
</dependencies>
<libPath>lib</libPath>
+ <templateDirectory>${project.basedir}/../src/main/jnlp</templateDirectory>
<jnlp>
<outputFile>launch-${project.artifactId}.jnlp</outputFile>
<mainClass>${maven.jar.main.class}</mainClass>
@@ -182,4 +224,13 @@
</pluginManagement>
</build>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+ <scm>
+ <connection>${scm.connection.son}</connection>
+ <developerConnection>${scm.developerConnection.son}</developerConnection>
+ <url>${scm.url.son}</url>
+ </scm>
</project>
\ No newline at end of file
Copied: lutinjaxx/trunk/jaxx-example/src/site/fr/rst/index.rst (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/exemples.rst)
===================================================================
--- lutinjaxx/trunk/jaxx-example/src/site/fr/rst/index.rst (rev 0)
+++ lutinjaxx/trunk/jaxx-example/src/site/fr/rst/index.rst 2008-10-15 20:38:51 UTC (rev 928)
@@ -0,0 +1,28 @@
+========
+Exemples
+========
+
+Here are some simple example programs to give you an idea of what JAXX is all about:
+
+ * JAXXEdit - A complete application written using JAXX for the GUI.
+
+ * Components_
+ Comprehensive demo which displays most of the Swing components. Demonstrates every major feature of JAXX, including data binding, scripting, and CSS stylesheets.
+
+ * LabelStyles_ - Uses data binding to edit the appearance of a JLabel. Shows off the power and usefulness of data binding well.
+
+ * Calculator_ - Four-function calculator. Based on the XUL Grand Coding Challenge.
+
+ * Counter_ - simple data binding and scripting example. Based on the XUL Grand Coding Challenge.
+
+ * Validation_ - simple data validation with xworks and jxlayer.
+
+.. _Components: Components/index.html
+
+.. _LabelStyles: LabelStyle/index.html
+
+.. _Calculator: Calculator/index.html
+
+.. _Counter: Counter/index.html
+
+.. _Validation: Validation/index.html
\ No newline at end of file
Property changes on: lutinjaxx/trunk/jaxx-example/src/site/fr/rst/index.rst
___________________________________________________________________
Name: svn:mergeinfo
+
1
0
15 Oct '08
Author: tchemit
Date: 2008-10-15 20:36:29 +0000 (Wed, 15 Oct 2008)
New Revision: 927
Added:
lutinjaxx/trunk/jaxx-example/Calculator/
lutinjaxx/trunk/jaxx-example/Calculator/src/site/
lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/
lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/
lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/images/
lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/images/Calculator-screenshot.gif
lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/index.rst
lutinjaxx/trunk/jaxx-example/Components/
lutinjaxx/trunk/jaxx-example/Components/src/site/
lutinjaxx/trunk/jaxx-example/Components/src/site/fr/
lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/
lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/images/
lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/images/Components-screenshot.gif
lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/index.rst
lutinjaxx/trunk/jaxx-example/Counter/
lutinjaxx/trunk/jaxx-example/Counter/src/site/
lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/
lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/
lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/images/
lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/images/Counter-screenshot.gif
lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/index.rst
lutinjaxx/trunk/jaxx-example/LabelStyle/
lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/
lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/
lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/
lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/images/
lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/images/LabelStyle-screenshot.gif
lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/index.rst
lutinjaxx/trunk/jaxx-example/Validation/
lutinjaxx/trunk/jaxx-example/Validation/src/main/resources/examples/Validation/Model-validation.xml
lutinjaxx/trunk/jaxx-example/Validation/src/site/
lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/
lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/
lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/Validation.jaxx.rst
lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/images/
lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/images/Validation-screenshot.jaxx.png
Removed:
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm
Modified:
lutinjaxx/trunk/jaxx-example/Calculator/src/main/jnlp/template.vm
lutinjaxx/trunk/jaxx-example/Counter/pom.xml
Log:
each example is a module (common jnlp resources)
Copied: lutinjaxx/trunk/jaxx-example/Calculator (from rev 920, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator)
Modified: lutinjaxx/trunk/jaxx-example/Calculator/src/main/jnlp/template.vm
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm 2008-10-15 18:38:36 UTC (rev 920)
+++ lutinjaxx/trunk/jaxx-example/Calculator/src/main/jnlp/template.vm 2008-10-15 20:36:29 UTC (rev 927)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
- codebase="$project.Url" href="$outputFile">
+ codebase="$project.Url/bin" href="$outputFile">
<information>
<title>$informationTitle</title>
<vendor>$informationVendor</vendor>
Copied: lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/images/Calculator-screenshot.gif (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Calculator-screenshot.gif)
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/images/Calculator-screenshot.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/index.rst (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Calculator.jaxx.rst)
===================================================================
--- lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/index.rst (rev 0)
+++ lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/index.rst 2008-10-15 20:36:29 UTC (rev 927)
@@ -0,0 +1,30 @@
+===================
+Examples/Calculator
+===================
+
+This is an implementation of Challenge #2 from the `XUL Grand Coding Challenge 2004`_ . Because this example program
+has been implemented in so many different languages, you can easily compare JAXX's
+syntax against the competition and decide for yourself which you prefer.
+
+Screen shot
+-----------
+
+.. image:: images/Calculator-screenshot.gif
+
+Set it in action
+----------------
+
+|webstart|
+
+To run this example in `Java Web Start`_, click the `following link`_.
+
+Source code
+-----------
+
+.. _XUL Grand Coding Challenge 2004: http://xul.sourceforge.net/challenge.html
+
+.. _Java Web Start: http://java.sun.com/products/javawebstart/
+
+.. |webstart| image:: images/webstart.gif
+
+.. _following link: bin/launch-Calculator.jnlp
Property changes on: lutinjaxx/trunk/jaxx-example/Calculator/src/site/fr/rst/index.rst
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: lutinjaxx/trunk/jaxx-example/Components (from rev 920, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Components)
Copied: lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/images/Components-screenshot.gif (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Components-screenshot.gif)
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/images/Components-screenshot.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/index.rst (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Components.jaxx.rst)
===================================================================
--- lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/index.rst (rev 0)
+++ lutinjaxx/trunk/jaxx-example/Components/src/site/fr/rst/index.rst 2008-10-15 20:36:29 UTC (rev 927)
@@ -0,0 +1,33 @@
+===================
+Examples/Components
+===================
+
+The Components demo displays many different Swing components being used in a variety of ways; it is JAXX's equivalent
+of the SwingSet demo. Various pages use advanced features such as data binding, scripting, event handling, and
+CSS stylesheets.
+
+Screen shot
+-----------
+
+.. image:: images/Components-screenshot.gif
+
+Set it in action
+----------------
+
+|webstart|
+
+To run this example in `Java Web Start`_, click the `following link`_.
+
+
+Source code
+-----------
+
+Unlike the other examples, the source code for Components is too big to display here. You can view it yourself by
+downloading JAXX, and you can also view the source code for the individual demos by clicking the "Source" tabs.
+
+
+.. _Java Web Start: http://java.sun.com/products/javawebstart/
+
+.. |webstart| image:: images/webstart.gif
+
+.. _following link: bin/launch-Components.jnlp
Copied: lutinjaxx/trunk/jaxx-example/Counter (from rev 920, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter)
Modified: lutinjaxx/trunk/jaxx-example/Counter/pom.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Counter/pom.xml 2008-10-15 18:38:36 UTC (rev 920)
+++ lutinjaxx/trunk/jaxx-example/Counter/pom.xml 2008-10-15 20:36:29 UTC (rev 927)
@@ -11,12 +11,22 @@
<parent>
<groupId>org.codelutin</groupId>
- <artifactId>jaxx-example-pom</artifactId>
+ <artifactId>jaxx-example</artifactId>
<version>0.5-SNAPSHOT</version>
</parent>
+ <groupId>org.codelutin.jaxx-example</groupId>
<artifactId>Counter</artifactId>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.codelutin</groupId>
+ <artifactId>jaxx-core</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
<!-- ************************************************************* -->
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
@@ -24,7 +34,7 @@
<version>0.5-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<description>Jaxx Counter example</description>
- <url>${example.home.url}</url>
+ <!--url>${example.home.url}</url-->
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
@@ -51,16 +61,25 @@
<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>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
</plugins>
</build>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+ <scm>
+ <connection>${scm.connection.example}</connection>
+ <developerConnection>${scm.developerConnection.example}</developerConnection>
+ <url>${scm.url.example}</url>
+ </scm>
</project>
\ No newline at end of file
Copied: lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/images/Counter-screenshot.gif (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Counter-screenshot.gif)
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/images/Counter-screenshot.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/index.rst (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Counter.jaxx.rst)
===================================================================
--- lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/index.rst (rev 0)
+++ lutinjaxx/trunk/jaxx-example/Counter/src/site/fr/rst/index.rst 2008-10-15 20:36:29 UTC (rev 927)
@@ -0,0 +1,28 @@
+================
+Examples/Counter
+================
+
+
+Screen shot
+-----------
+
+.. image:: images/Counter-screenshot.gif
+
+Set it in action
+----------------
+
+
+|webstart|
+
+To run this example in `Java Web Start`_, click the `following link`_.
+
+
+Source code
+-----------
+
+
+.. _Java Web Start: http://java.sun.com/products/javawebstart/
+
+.. |webstart| image:: images/webstart.gif
+
+.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
\ No newline at end of file
Copied: lutinjaxx/trunk/jaxx-example/LabelStyle (from rev 920, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle)
Copied: lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/images/LabelStyle-screenshot.gif (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/LabelStyle-screenshot.gif)
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/images/LabelStyle-screenshot.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/index.rst (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles.jaxx.rst)
===================================================================
--- lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/index.rst (rev 0)
+++ lutinjaxx/trunk/jaxx-example/LabelStyle/src/site/fr/rst/index.rst 2008-10-15 20:36:29 UTC (rev 927)
@@ -0,0 +1,28 @@
+====================
+Examples/LabelStyles
+====================
+
+This example program creates a number of components which are used to control the appearance of a JLabel.
+Everything is performed through data binding; there are no script tags or explicit event handlers anywhere.
+
+Screen shot
+-----------
+
+.. image:: images/LabelStyle-screenshot.gif
+
+Set it in action
+----------------
+
+|webstart|
+
+To run this example in `Java Web Start`_, click the `following link`_.
+
+
+Source code
+-----------
+
+.. _Java Web Start: http://java.sun.com/products/javawebstart/
+
+.. |webstart| image:: images/webstart.gif
+
+.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Copied: lutinjaxx/trunk/jaxx-example/Validation (from rev 920, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation)
Copied: lutinjaxx/trunk/jaxx-example/Validation/src/main/resources/examples/Validation/Model-validation.xml (from rev 922, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Model-validation.xml)
===================================================================
--- lutinjaxx/trunk/jaxx-example/Validation/src/main/resources/examples/Validation/Model-validation.xml (rev 0)
+++ lutinjaxx/trunk/jaxx-example/Validation/src/main/resources/examples/Validation/Model-validation.xml 2008-10-15 20:36:29 UTC (rev 927)
@@ -0,0 +1,32 @@
+<!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>
+
+ <field name="text2">
+ <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>
+ <validator type="expression">
+ <param name="expression">text2.startsWith("chemit")</param>
+ <message>Email not starts with chemit</message>
+ </validator>
+ </validators>
\ No newline at end of file
Copied: lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/Validation.jaxx.rst (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst)
===================================================================
--- lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/Validation.jaxx.rst (rev 0)
+++ lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/Validation.jaxx.rst 2008-10-15 20:36:29 UTC (rev 927)
@@ -0,0 +1,28 @@
+=====================
+Examples/LabelStyles2
+=====================
+
+This example program creates a number of components which are used to control the appearance of a JLabel.
+Everything is performed through data binding; there are no script tags or explicit event handlers anywhere.
+
+Screen shot
+-----------
+
+.. image:: images/Validation-screenshot.gif
+
+Set it in action
+----------------
+
+|webstart|
+
+To run this example in `Java Web Start`_, click the `following link`_.
+
+
+Source code
+-----------
+
+.. _Java Web Start: http://java.sun.com/products/javawebstart/
+
+.. |webstart| image:: images/webstart.png
+
+.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Property changes on: lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/Validation.jaxx.rst
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/images/Validation-screenshot.jaxx.png (from rev 920, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Validation-screenshot.jaxx.png)
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-example/Validation/src/site/fr/rst/images/Validation-screenshot.jaxx.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp 2008-10-15 20:36:12 UTC (rev 926)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp 2008-10-15 20:36:29 UTC (rev 927)
@@ -1,12 +0,0 @@
-<?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
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm 2008-10-15 20:36:12 UTC (rev 926)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm 2008-10-15 20:36:29 UTC (rev 927)
@@ -1,21 +0,0 @@
-<?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>
1
0
[Buix-commits] r926 - in lutinjaxx/trunk/jaxx-example: . src src/main src/main/jnlp
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
15 Oct '08
Author: tchemit
Date: 2008-10-15 20:36:12 +0000 (Wed, 15 Oct 2008)
New Revision: 926
Added:
lutinjaxx/trunk/jaxx-example/src/
lutinjaxx/trunk/jaxx-example/src/main/
lutinjaxx/trunk/jaxx-example/src/main/jnlp/
lutinjaxx/trunk/jaxx-example/src/main/jnlp/sun.jnlp
lutinjaxx/trunk/jaxx-example/src/main/jnlp/template.vm
Log:
each example is a module (common jnlp resources)
Copied: lutinjaxx/trunk/jaxx-example/src/main/jnlp/sun.jnlp (from rev 920, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/sun.jnlp)
===================================================================
--- lutinjaxx/trunk/jaxx-example/src/main/jnlp/sun.jnlp (rev 0)
+++ lutinjaxx/trunk/jaxx-example/src/main/jnlp/sun.jnlp 2008-10-15 20:36:12 UTC (rev 926)
@@ -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/jaxx-example/src/main/jnlp/sun.jnlp
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: lutinjaxx/trunk/jaxx-example/src/main/jnlp/template.vm (from rev 920, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/src/main/jnlp/template.vm)
===================================================================
--- lutinjaxx/trunk/jaxx-example/src/main/jnlp/template.vm (rev 0)
+++ lutinjaxx/trunk/jaxx-example/src/main/jnlp/template.vm 2008-10-15 20:36:12 UTC (rev 926)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp
+ spec="1.0+"
+ codebase="$project.Url/bin" 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/jaxx-example/src/main/jnlp/template.vm
___________________________________________________________________
Name: svn:mergeinfo
+
1
0
[Buix-commits] r925 - lutinjaxx/trunk/maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
15 Oct '08
Author: tchemit
Date: 2008-10-15 20:34:57 +0000 (Wed, 15 Oct 2008)
New Revision: 925
Modified:
lutinjaxx/trunk/maven-jaxx-plugin/pom.xml
Log:
no more profile in maven-jaxx-plugin
Modified: lutinjaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/pom.xml 2008-10-15 20:34:31 UTC (rev 924)
+++ lutinjaxx/trunk/maven-jaxx-plugin/pom.xml 2008-10-15 20:34:57 UTC (rev 925)
@@ -130,30 +130,5 @@
<url>${scm.url.son}</url>
</scm>
- <profiles>
- <profile>
- <id>example</id>
- <properties>
- <maven.test.testFailureIgnore>true</maven.test.testFailureIgnore>
- </properties>
- <build>
- <pluginManagement>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/*Test.java</include>
- <include>org/codelutin/jaxx/BuildExamples.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
-
- </pluginManagement>
- </build>
- </profile>
- </profiles>
+
</project>
1
0
15 Oct '08
Author: tchemit
Date: 2008-10-15 20:34:31 +0000 (Wed, 15 Oct 2008)
New Revision: 924
Modified:
lutinjaxx/trunk/pom.xml
Log:
do example only with specified profile since it takes a time...
Modified: lutinjaxx/trunk/pom.xml
===================================================================
--- lutinjaxx/trunk/pom.xml 2008-10-15 19:02:34 UTC (rev 923)
+++ lutinjaxx/trunk/pom.xml 2008-10-15 20:34:31 UTC (rev 924)
@@ -22,7 +22,6 @@
<module>jaxx-core</module>
<module>jaxx-swing-action</module>
<module>maven-jaxx-plugin</module>
- <module>jaxx-example</module>
</modules>
<dependencies>
@@ -201,4 +200,12 @@
<url>${maven.scm.url}</url>
</scm>
+ <profiles>
+ <profile>
+ <id>example</id>
+ <modules>
+ <module>jaxx-example</module>
+ </modules>
+ </profile>
+ </profiles>
</project>
1
0
[Buix-commits] r923 - lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
15 Oct '08
Author: tchemit
Date: 2008-10-15 19:02:34 +0000 (Wed, 15 Oct 2008)
New Revision: 923
Modified:
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml
Log:
change groupId
Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml 2008-10-15 18:42:15 UTC (rev 922)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Calculator/pom.xml 2008-10-15 19:02:34 UTC (rev 923)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
- <artifactId>jaxx-example-pom</artifactId>
+ <artifactId>jaxx-example</artifactId>
<version>0.5-SNAPSHOT</version>
</parent>
@@ -20,6 +20,7 @@
<!-- ************************************************************* -->
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
+ <groupId>org.codelutin.jaxx-example</groupId>
<name>Calculator example</name>
<version>0.5-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
1
0
[Buix-commits] r922 - lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
15 Oct '08
Author: tchemit
Date: 2008-10-15 18:42:15 +0000 (Wed, 15 Oct 2008)
New Revision: 922
Added:
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Model-validation.xml
Log:
example validation
Added: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Model-validation.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Model-validation.xml (rev 0)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Model-validation.xml 2008-10-15 18:42:15 UTC (rev 922)
@@ -0,0 +1,32 @@
+<!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>
+
+ <field name="text2">
+ <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>
+ <validator type="expression">
+ <param name="expression">text2.startsWith("chemit")</param>
+ <message>Email not starts with chemit</message>
+ </validator>
+ </validators>
\ No newline at end of file
1
0
[Buix-commits] r920 - in lutinjaxx/trunk: jaxx-core jaxx-core/src/main/java/jaxx/runtime jaxx-core/src/site/fr/rst jaxx-core/src/site/fr/rst/examples jaxx-core/src/site/fr/rst/examples/images maven-jaxx-plugin/src/examples maven-jaxx-plugin/src/test/java/org/codelutin/jaxx
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
15 Oct '08
Author: tchemit
Date: 2008-10-15 18:38:36 +0000 (Wed, 15 Oct 2008)
New Revision: 920
Added:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/BeanValidator.java
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Validation-screenshot.jaxx.png
Removed:
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles2.jaxx.rst
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/
Modified:
lutinjaxx/trunk/jaxx-core/pom.xml
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/exemples.rst
lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java
Log:
introduce BeanValidator + example for validation
Modified: lutinjaxx/trunk/jaxx-core/pom.xml
===================================================================
--- lutinjaxx/trunk/jaxx-core/pom.xml 2008-10-15 18:35:54 UTC (rev 919)
+++ lutinjaxx/trunk/jaxx-core/pom.xml 2008-10-15 18:38:36 UTC (rev 920)
@@ -43,6 +43,16 @@
<artifactId>javahelp</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.opensymphony</groupId>
+ <artifactId>xwork</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.swinglabs</groupId>
+ <artifactId>jxlayer</artifactId>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
Added: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/BeanValidator.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/BeanValidator.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/BeanValidator.java 2008-10-15 18:38:36 UTC (rev 920)
@@ -0,0 +1,494 @@
+/* *##%
+ * 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 jaxx.runtime;
+
+
+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.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 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);
+ }
+ }
+ }
+
+}
Deleted: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles2.jaxx.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles2.jaxx.rst 2008-10-15 18:35:54 UTC (rev 919)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles2.jaxx.rst 2008-10-15 18:38:36 UTC (rev 920)
@@ -1,28 +0,0 @@
-=====================
-Examples/LabelStyles2
-=====================
-
-This example program creates a number of components which are used to control the appearance of a JLabel.
-Everything is performed through data binding; there are no script tags or explicit event handlers anywhere.
-
-Screen shot
------------
-
-.. image:: images/LabelStyle-screenshot.gif
-
-Set it in action
-----------------
-
-|webstart|
-
-To run this example in `Java Web Start`_, click the `following link`_.
-
-
-Source code
------------
-
-.. _Java Web Start: http://java.sun.com/products/javawebstart/
-
-.. |webstart| image:: images/webstart.gif
-
-.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Copied: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst (from rev 915, lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/LabelStyles2.jaxx.rst)
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst 2008-10-15 18:38:36 UTC (rev 920)
@@ -0,0 +1,28 @@
+=====================
+Examples/LabelStyles2
+=====================
+
+This example program creates a number of components which are used to control the appearance of a JLabel.
+Everything is performed through data binding; there are no script tags or explicit event handlers anywhere.
+
+Screen shot
+-----------
+
+.. image:: images/Validation-screenshot.gif
+
+Set it in action
+----------------
+
+|webstart|
+
+To run this example in `Java Web Start`_, click the `following link`_.
+
+
+Source code
+-----------
+
+.. _Java Web Start: http://java.sun.com/products/javawebstart/
+
+.. |webstart| image:: images/webstart.png
+
+.. _following link: http://buix.labs.libre-entreprise.org/lutinjaxx/maven-jaxx-plugin/examples/…
Property changes on: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/Validation.jaxx.rst
___________________________________________________________________
Name: svn:mergeinfo
+
Added: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Validation-screenshot.jaxx.png
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/examples/images/Validation-screenshot.jaxx.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/exemples.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/exemples.rst 2008-10-15 18:35:54 UTC (rev 919)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/exemples.rst 2008-10-15 18:38:36 UTC (rev 920)
@@ -15,10 +15,14 @@
* Counter_ - simple data binding and scripting example. Based on the XUL Grand Coding Challenge.
+ * Validation_ - simple data validation with xworks and jxlayer.
+
.. _Components: examples/Components.jaxx.html
.. _LabelStyles: examples/LabelStyles.jaxx.html
.. _Calculator: examples/Calculator.jaxx.html
-.. _Counter: examples/Counter.jaxx.html
\ No newline at end of file
+.. _Counter: examples/Counter.jaxx.html
+
+.. _Validation: examples/Validation.jaxx.html
\ No newline at end of file
Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java 2008-10-15 18:35:54 UTC (rev 919)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/BuildExamples.java 2008-10-15 18:38:36 UTC (rev 920)
@@ -88,6 +88,10 @@
buildExample();
}
+ public void testValidation() throws Exception {
+ buildExample();
+ }
+
protected void buildExample() throws VerificationException, IOException {
verifier.executeGoals(Arrays.asList("jaxx:generate", "package"));
verifier.verifyErrorFreeLog();
1
0
[Buix-commits] r919 - in lutinjaxx/trunk/maven-jaxx-plugin/src/examples: . LabelStyle2 Validation Validation/src/main Validation/src/main/java/examples Validation/src/main/java/examples/Validation Validation/src/main/resources/examples/Validation
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
by tchemit@users.labs.libre-entreprise.org 15 Oct '08
15 Oct '08
Author: tchemit
Date: 2008-10-15 18:35:54 +0000 (Wed, 15 Oct 2008)
New Revision: 919
Added:
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/pom.xml
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/
Removed:
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/pom.xml
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/LabelStyle/
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/BeanValidator.java
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/Toto.java
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Toto-validation.xml
Modified:
lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/Validation.jaxx
Log:
introduce BeanValidator + example for validation
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml 2008-10-15 18:33:00 UTC (rev 918)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml 2008-10-15 18:35:54 UTC (rev 919)
@@ -1,148 +0,0 @@
-<?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>Validattion</artifactId>
-
- <dependencies>
-
- <dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>jaxx-core</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>com.opensymphony</groupId>
- <artifactId>xwork</artifactId>
- <version>2.1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.swinglabs</groupId>
- <artifactId>jxlayer</artifactId>
- <version>3.0.1</version>
- </dependency>
-
- </dependencies>
-
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
- <name>Validattion example</name>
- <version>0.5-SNAPSHOT</version>
- <inceptionYear>2008</inceptionYear>
- <description>Jaxx Validattion (with xwork validation) example</description>
- <url>${example.home.url}</url>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
-
- <packaging>jar</packaging>
-
- <properties>
- <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class>
- </properties>
- <build>
- <finalName>${project.artifactId}</finalName>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codelutin</groupId>
- <artifactId>maven-jaxx-plugin</artifactId>
- <configuration>
- <src>${basedir}/src/main/java</src>
- <force>true</force>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.swinglabs</groupId>
- <artifactId>jxlayer</artifactId>
- <version>3.0.1</version>
- </dependency>
- </dependencies>
- <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>
- </plugins>
- </pluginManagement>
-
- <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>
-
- <repositories>
- <repository>
- <id>dowload-javanet-repository</id>
- <name>JavaNetRepository</name>
- <url>http://download.java.net/maven/2</url>
- </repository>
- </repositories>
-</project>
\ No newline at end of file
Copied: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation (from rev 916, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2)
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/pom.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml 2008-10-15 13:56:48 UTC (rev 916)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/pom.xml 2008-10-15 18:35:54 UTC (rev 919)
@@ -1,66 +0,0 @@
-<?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
Copied: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/pom.xml (from rev 917, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/pom.xml)
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/pom.xml (rev 0)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/pom.xml 2008-10-15 18:35:54 UTC (rev 919)
@@ -0,0 +1,136 @@
+<?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>Validation</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.codelutin</groupId>
+ <artifactId>jaxx-core</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>Validattion example</name>
+ <version>0.5-SNAPSHOT</version>
+ <inceptionYear>2008</inceptionYear>
+ <description>Jaxx Validattion (with xwork validation) example</description>
+ <url>${example.home.url}</url>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <properties>
+ <maven.jar.main.class>examples.${project.artifactId}.${project.artifactId}</maven.jar.main.class>
+ </properties>
+ <build>
+ <finalName>${project.artifactId}</finalName>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codelutin</groupId>
+ <artifactId>maven-jaxx-plugin</artifactId>
+ <configuration>
+ <src>${basedir}/src/main/java</src>
+ <force>true</force>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.swinglabs</groupId>
+ <artifactId>jxlayer</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+ </dependencies>
+ <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>
+ </plugins>
+ </pluginManagement>
+
+ <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>
+
+ <repositories>
+ <repository>
+ <id>dowload-javanet-repository</id>
+ <name>JavaNetRepository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+</project>
\ No newline at end of file
Copied: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation (from rev 917, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/Validation)
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/BeanValidator.java
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/Validation/BeanValidator.java 2008-10-15 15:20:25 UTC (rev 917)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/BeanValidator.java 2008-10-15 18:35:54 UTC (rev 919)
@@ -1,494 +0,0 @@
-/* *##%
- * 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.Validation;
-
-
-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.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 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);
- }
- }
- }
-
-}
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/Toto.java
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/Validation/Toto.java 2008-10-15 15:20:25 UTC (rev 917)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/Toto.java 2008-10-15 18:35:54 UTC (rev 919)
@@ -1,41 +0,0 @@
-package examples.Validation;
-
-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);
- }
-}
Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/Validation.jaxx
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/java/examples/Validation/Validation.jaxx 2008-10-15 15:20:25 UTC (rev 917)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/java/examples/Validation/Validation.jaxx 2008-10-15 18:35:54 UTC (rev 919)
@@ -1,14 +1,14 @@
<Application title="Validation.jaxx">
<style source="Validation.css"/>
-
+ <Model id='model'/>
<script>
import org.jdesktop.jxlayer.JXLayer;
+import jaxx.runtime.BeanValidator;
-Toto toto = new Toto();
-
BeanValidator validator = new BeanValidator();
validator.setFieldRepresentation("text", text);
-validator.setBean(toto);
+validator.setFieldRepresentation("text2", text2);
+validator.setBean(model);
</script>
<Table anchor='north' fill='both'>
@@ -16,21 +16,21 @@
<cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
<Table anchor='west' fill='both'>
<row>
- <cell><JLabel text='Email:'/></cell>
+ <cell><JLabel text='Text:'/></cell>
<cell weightx='1'>
<org.jdesktop.jxlayer.JXLayer>
- <JTextField id='text' text='{toto.getText()}'
- onKeyReleased='toto.setText(text.getText())'/>
+ <JTextField id='text' text='{model.getText()}'
+ onKeyReleased='model.setText(text.getText())'/>
</org.jdesktop.jxlayer.JXLayer>
</cell>
</row>
<row>
<cell>
- <JLabel text='Email:'/>
+ <JLabel text='Text2 :'/>
</cell>
<cell weightx='1'>
<org.jdesktop.jxlayer.JXLayer>
- <JTextField id='text2' text='{toto.getText()}' onKeyReleased='toto.setText(text2.getText())'/>
+ <JTextField id='text2' text='{model.getText2()}' onKeyReleased='model.setText2(text2.getText())'/>
</org.jdesktop.jxlayer.JXLayer>
</cell>
</row>
@@ -64,7 +64,7 @@
margin='0'
horizontalAlignment='center'
verticalAlignment='middle'>
- <JLabel text='{toto.getText()}' font-size='{csize.getValue()}' foreground='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/>
+ <JLabel text='{model.getText()}' font-size='{csize.getValue()}' foreground='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/>
</VBox>
</JPanel>
</cell>
Copied: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources (from rev 917, lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/resources)
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Toto-validation.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/examples/LabelStyle2/src/main/resources/examples/Validation/Toto-validation.xml 2008-10-15 15:20:25 UTC (rev 917)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/examples/Validation/src/main/resources/examples/Validation/Toto-validation.xml 2008-10-15 18:35:54 UTC (rev 919)
@@ -1,19 +0,0 @@
-<!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
1
0
15 Oct '08
Author: tchemit
Date: 2008-10-15 18:33:00 +0000 (Wed, 15 Oct 2008)
New Revision: 918
Added:
lutinjaxx/trunk/jaxx-example/
Removed:
lutinjaxx/trunk/jaxx-example-pom/
Modified:
lutinjaxx/trunk/pom.xml
Log:
rename example pom
Copied: lutinjaxx/trunk/jaxx-example (from rev 916, lutinjaxx/trunk/jaxx-example-pom)
Modified: lutinjaxx/trunk/pom.xml
===================================================================
--- lutinjaxx/trunk/pom.xml 2008-10-15 15:20:25 UTC (rev 917)
+++ lutinjaxx/trunk/pom.xml 2008-10-15 18:33:00 UTC (rev 918)
@@ -21,8 +21,8 @@
<module>jaxx-util</module>
<module>jaxx-core</module>
<module>jaxx-swing-action</module>
- <module>jaxx-example-pom</module>
<module>maven-jaxx-plugin</module>
+ <module>jaxx-example</module>
</modules>
<dependencies>
@@ -59,7 +59,9 @@
<labs.project>buix</labs.project>
<!-- override this property to define scm url property -->
- <scm.url.son>http://${labs.host}/plugins/scmsvn/viewcvs.php/lutinjaxx/trunk/${pom.artifactId}/?root=${labs.project}</scm.url.son>
+ <scm.url.son>
+ http://${labs.host}/plugins/scmsvn/viewcvs.php/lutinjaxx/trunk/${pom.artifactId}/?root=${labs.project}
+ </scm.url.son>
<!-- BEWARE, will be suffixed by /${pom.artifactId} by inheritance -->
<scm.developerConnection.son>
@@ -133,6 +135,11 @@
<artifactId>jaxx-swing-action</artifactId>
<version>${current.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.codelutin</groupId>
+ <artifactId>jaxx-example</artifactId>
+ <version>${current.version}</version>
+ </dependency>
<dependency>
<groupId>com.sun</groupId>
@@ -169,6 +176,19 @@
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>com.opensymphony</groupId>
+ <artifactId>xwork</artifactId>
+ <version>2.1.1-cl_20081015</version>
+ <!--version>2.1.1</version-->
+ </dependency>
+
+ <dependency>
+ <groupId>org.swinglabs</groupId>
+ <artifactId>jxlayer</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
1
0