Buix-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
- 1440 discussions
r1245 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org 25 Feb '09
by sletellier@users.labs.libre-entreprise.org 25 Feb '09
25 Feb '09
Author: sletellier
Date: 2009-02-25 09:55:32 +0000 (Wed, 25 Feb 2009)
New Revision: 1245
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-1.2
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -45,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-api</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-api</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -51,8 +50,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-swing</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -57,8 +56,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-validator</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,5 +1,4 @@
-<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">
+<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>
@@ -10,7 +9,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -148,9 +147,9 @@
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-example</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-example</developerConnection>
</scm>
<profiles>
@@ -175,29 +174,21 @@
<phase>verify</phase>
<configuration>
<tasks>
- <mkdir dir="${jnlp.build.directory}"/>
- <copy file="${project.basedir}/src/main/jnlp/sun.jnlp"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}"
- failonerror="false">
+ <mkdir dir="${jnlp.build.directory}" />
+ <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" verbose="${maven.verbose}" todir="${jnlp.build.directory}" failonerror="false">
<filterset>
- <filter token="lib" value="javahelp-2.0.02.jar"/>
- <filter token="url" value="${project.url}"/>
+ <filter token="lib" value="javahelp-2.0.02.jar" />
+ <filter token="url" value="${project.url}" />
</filterset>
</copy>
- <copy file="${project.basedir}/src/main/jnlp/jxlayer.jnlp"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}"
- failonerror="false">
+ <copy file="${project.basedir}/src/main/jnlp/jxlayer.jnlp" verbose="${maven.verbose}" todir="${jnlp.build.directory}" failonerror="false">
<filterset>
- <filter token="lib" value="jxlayer-3.0.1.jar"/>
- <filter token="url" value="${project.url}"/>
+ <filter token="lib" value="jxlayer-3.0.1.jar" />
+ <filter token="url" value="${project.url}" />
</filterset>
</copy>
- <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib"
- failonerror="false"/>
- <copy file="${project.build.directory}/lib/jxlayer-3.0.1.jar"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib"
- failonerror="false"/>
+ <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib" failonerror="false" />
+ <copy file="${project.build.directory}/lib/jxlayer-3.0.1.jar" verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib" failonerror="false" />
</tasks>
</configuration>
<goals>
@@ -210,11 +201,10 @@
<phase>pre-site</phase>
<configuration>
<tasks>
- <mkdir dir="${maven.site.gen.dir}/resources"/>
- <copy todir="${maven.site.gen.dir}/resources" verbose="${maven.verbose}"
- failonerror="false" overwrite="false">
+ <mkdir dir="${maven.site.gen.dir}/resources" />
+ <copy todir="${maven.site.gen.dir}/resources" verbose="${maven.verbose}" failonerror="false" overwrite="false">
<fileset dir="${jnlp.build.directory}">
- <include name="**"/>
+ <include name="**" />
</fileset>
</copy>
</tasks>
@@ -259,17 +249,17 @@
<sign>
<keystore>${keystorepath}</keystore>
- <keypass/>
+ <keypass />
<storepass>${keystorepass}</storepass>
- <storetype/>
+ <storetype />
<alias>${keystorealias}</alias>
- <validity/>
- <dnameCn/>
- <dnameOu/>
- <dnameO/>
- <dnameL/>
- <dnameSt/>
- <dnameC/>
+ <validity />
+ <dnameCn />
+ <dnameOu />
+ <dnameO />
+ <dnameL />
+ <dnameSt />
+ <dnameC />
<verify>true</verify>
<keystoreConfig>
<delete>false</delete>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -58,8 +57,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-api</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-api</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -45,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-swing</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -52,8 +51,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -45,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator-swing</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -12,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -82,9 +81,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-swing-action</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-swing-action</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,5 +1,4 @@
-<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">
+<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>
@@ -10,7 +9,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -135,9 +134,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/maven-jaxx-plugin</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/maven-jaxx-plugin</developerConnection>
</scm>
</project>
\ No newline at end of file
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
+++ jaxx/trunk/pom.xml 2009-02-25 09:55:32 UTC (rev 1245)
@@ -1,5 +1,4 @@
-<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">
+<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>
@@ -15,7 +14,7 @@
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -203,9 +202,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2</connection>
+ <developerConnection>scm:svn:svn+ssh://sletellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
<!-- Maven Environment : Repositories -->
1
0
r1244 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org 25 Feb '09
by sletellier@users.labs.libre-entreprise.org 25 Feb '09
25 Feb '09
Author: sletellier
Date: 2009-02-25 09:53:24 +0000 (Wed, 25 Feb 2009)
New Revision: 1244
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] rollback the release of jaxx-1.2
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -10,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -44,8 +45,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-api</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-api</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -10,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -50,8 +51,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-swing</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-swing</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -10,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -56,8 +57,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-validator</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-validator</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,4 +1,5 @@
-<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">
+<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>
@@ -9,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -147,9 +148,9 @@
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-example</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-example</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
<profiles>
@@ -174,21 +175,29 @@
<phase>verify</phase>
<configuration>
<tasks>
- <mkdir dir="${jnlp.build.directory}" />
- <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" verbose="${maven.verbose}" todir="${jnlp.build.directory}" failonerror="false">
+ <mkdir dir="${jnlp.build.directory}"/>
+ <copy file="${project.basedir}/src/main/jnlp/sun.jnlp"
+ verbose="${maven.verbose}" todir="${jnlp.build.directory}"
+ failonerror="false">
<filterset>
- <filter token="lib" value="javahelp-2.0.02.jar" />
- <filter token="url" value="${project.url}" />
+ <filter token="lib" value="javahelp-2.0.02.jar"/>
+ <filter token="url" value="${project.url}"/>
</filterset>
</copy>
- <copy file="${project.basedir}/src/main/jnlp/jxlayer.jnlp" verbose="${maven.verbose}" todir="${jnlp.build.directory}" failonerror="false">
+ <copy file="${project.basedir}/src/main/jnlp/jxlayer.jnlp"
+ verbose="${maven.verbose}" todir="${jnlp.build.directory}"
+ failonerror="false">
<filterset>
- <filter token="lib" value="jxlayer-3.0.1.jar" />
- <filter token="url" value="${project.url}" />
+ <filter token="lib" value="jxlayer-3.0.1.jar"/>
+ <filter token="url" value="${project.url}"/>
</filterset>
</copy>
- <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib" failonerror="false" />
- <copy file="${project.build.directory}/lib/jxlayer-3.0.1.jar" verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib" failonerror="false" />
+ <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar"
+ verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib"
+ failonerror="false"/>
+ <copy file="${project.build.directory}/lib/jxlayer-3.0.1.jar"
+ verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib"
+ failonerror="false"/>
</tasks>
</configuration>
<goals>
@@ -201,10 +210,11 @@
<phase>pre-site</phase>
<configuration>
<tasks>
- <mkdir dir="${maven.site.gen.dir}/resources" />
- <copy todir="${maven.site.gen.dir}/resources" verbose="${maven.verbose}" failonerror="false" overwrite="false">
+ <mkdir dir="${maven.site.gen.dir}/resources"/>
+ <copy todir="${maven.site.gen.dir}/resources" verbose="${maven.verbose}"
+ failonerror="false" overwrite="false">
<fileset dir="${jnlp.build.directory}">
- <include name="**" />
+ <include name="**"/>
</fileset>
</copy>
</tasks>
@@ -249,17 +259,17 @@
<sign>
<keystore>${keystorepath}</keystore>
- <keypass />
+ <keypass/>
<storepass>${keystorepass}</storepass>
- <storetype />
+ <storetype/>
<alias>${keystorealias}</alias>
- <validity />
- <dnameCn />
- <dnameOu />
- <dnameO />
- <dnameL />
- <dnameSt />
- <dnameC />
+ <validity/>
+ <dnameCn/>
+ <dnameOu/>
+ <dnameO/>
+ <dnameL/>
+ <dnameSt/>
+ <dnameC/>
<verify>true</verify>
<keystoreConfig>
<delete>false</delete>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -10,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -57,8 +58,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-api</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-api</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -10,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -44,8 +45,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-swing</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-swing</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -10,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -51,8 +52,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -10,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -44,8 +45,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator-swing</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator-swing</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,5 +1,6 @@
<?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">
+<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>
@@ -11,7 +12,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -81,9 +82,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-swing-action</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-swing-action</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,4 +1,5 @@
-<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">
+<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>
@@ -9,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -134,9 +135,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/maven-jaxx-plugin</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/maven-jaxx-plugin</developerConnection>
+ <url>${maven.scm.url.child}</url>
+ <connection>${maven.scm.connection.child}</connection>
+ <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
</scm>
</project>
\ No newline at end of file
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
+++ jaxx/trunk/pom.xml 2009-02-25 09:53:24 UTC (rev 1244)
@@ -1,4 +1,5 @@
-<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">
+<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>
@@ -14,7 +15,7 @@
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2</version>
+ <version>1.2-SNAPSHOT</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -202,9 +203,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2</connection>
- <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>${maven.scm.connection}</connection>
+ <developerConnection>${maven.scm.developerConnection}</developerConnection>
+ <url>${maven.scm.url}</url>
</scm>
<!-- Maven Environment : Repositories -->
1
0
r1243 - in jaxx/trunk: . jaxx-compiler-api jaxx-compiler-swing jaxx-compiler-validator jaxx-example jaxx-runtime-api jaxx-runtime-swing jaxx-runtime-validator jaxx-runtime-validator-swing jaxx-swing-action maven-jaxx-plugin
by sletellier@users.labs.libre-entreprise.org 25 Feb '09
by sletellier@users.labs.libre-entreprise.org 25 Feb '09
25 Feb '09
Author: sletellier
Date: 2009-02-25 09:47:34 +0000 (Wed, 25 Feb 2009)
New Revision: 1243
Modified:
jaxx/trunk/jaxx-compiler-api/pom.xml
jaxx/trunk/jaxx-compiler-swing/pom.xml
jaxx/trunk/jaxx-compiler-validator/pom.xml
jaxx/trunk/jaxx-example/pom.xml
jaxx/trunk/jaxx-runtime-api/pom.xml
jaxx/trunk/jaxx-runtime-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
jaxx/trunk/jaxx-runtime-validator/pom.xml
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/maven-jaxx-plugin/pom.xml
jaxx/trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-1.2
Modified: jaxx/trunk/jaxx-compiler-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-api/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-compiler-api/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -45,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-api</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-api</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-compiler-swing/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -51,8 +50,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-swing</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-compiler-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-compiler-validator/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -57,8 +56,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-compiler-validator</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,5 +1,4 @@
-<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">
+<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>
@@ -10,7 +9,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -148,9 +147,9 @@
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-example</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-example</developerConnection>
</scm>
<profiles>
@@ -175,29 +174,21 @@
<phase>verify</phase>
<configuration>
<tasks>
- <mkdir dir="${jnlp.build.directory}"/>
- <copy file="${project.basedir}/src/main/jnlp/sun.jnlp"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}"
- failonerror="false">
+ <mkdir dir="${jnlp.build.directory}" />
+ <copy file="${project.basedir}/src/main/jnlp/sun.jnlp" verbose="${maven.verbose}" todir="${jnlp.build.directory}" failonerror="false">
<filterset>
- <filter token="lib" value="javahelp-2.0.02.jar"/>
- <filter token="url" value="${project.url}"/>
+ <filter token="lib" value="javahelp-2.0.02.jar" />
+ <filter token="url" value="${project.url}" />
</filterset>
</copy>
- <copy file="${project.basedir}/src/main/jnlp/jxlayer.jnlp"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}"
- failonerror="false">
+ <copy file="${project.basedir}/src/main/jnlp/jxlayer.jnlp" verbose="${maven.verbose}" todir="${jnlp.build.directory}" failonerror="false">
<filterset>
- <filter token="lib" value="jxlayer-3.0.1.jar"/>
- <filter token="url" value="${project.url}"/>
+ <filter token="lib" value="jxlayer-3.0.1.jar" />
+ <filter token="url" value="${project.url}" />
</filterset>
</copy>
- <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib"
- failonerror="false"/>
- <copy file="${project.build.directory}/lib/jxlayer-3.0.1.jar"
- verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib"
- failonerror="false"/>
+ <copy file="${project.build.directory}/lib/javahelp-2.0.02.jar" verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib" failonerror="false" />
+ <copy file="${project.build.directory}/lib/jxlayer-3.0.1.jar" verbose="${maven.verbose}" todir="${jnlp.build.directory}/lib" failonerror="false" />
</tasks>
</configuration>
<goals>
@@ -210,11 +201,10 @@
<phase>pre-site</phase>
<configuration>
<tasks>
- <mkdir dir="${maven.site.gen.dir}/resources"/>
- <copy todir="${maven.site.gen.dir}/resources" verbose="${maven.verbose}"
- failonerror="false" overwrite="false">
+ <mkdir dir="${maven.site.gen.dir}/resources" />
+ <copy todir="${maven.site.gen.dir}/resources" verbose="${maven.verbose}" failonerror="false" overwrite="false">
<fileset dir="${jnlp.build.directory}">
- <include name="**"/>
+ <include name="**" />
</fileset>
</copy>
</tasks>
@@ -259,17 +249,17 @@
<sign>
<keystore>${keystorepath}</keystore>
- <keypass/>
+ <keypass />
<storepass>${keystorepass}</storepass>
- <storetype/>
+ <storetype />
<alias>${keystorealias}</alias>
- <validity/>
- <dnameCn/>
- <dnameOu/>
- <dnameO/>
- <dnameL/>
- <dnameSt/>
- <dnameC/>
+ <validity />
+ <dnameCn />
+ <dnameOu />
+ <dnameO />
+ <dnameL />
+ <dnameSt />
+ <dnameC />
<verify>true</verify>
<keystoreConfig>
<delete>false</delete>
Modified: jaxx/trunk/jaxx-runtime-api/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-api/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-runtime-api/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -58,8 +57,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-api</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-api</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-runtime-swing/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -45,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-swing</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-runtime-validator/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -52,8 +51,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-runtime-validator-swing/pom.xml
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-runtime-validator-swing/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -11,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -45,8 +44,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator-swing</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-runtime-validator-swing</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,6 +1,5 @@
<?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">
+<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>
@@ -12,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -82,9 +81,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-swing-action</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/jaxx-swing-action</developerConnection>
</scm>
</project>
Modified: jaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/maven-jaxx-plugin/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,5 +1,4 @@
-<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">
+<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>
@@ -10,7 +9,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>org.codelutin.jaxx</groupId>
@@ -135,9 +134,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <url>${maven.scm.url.child}</url>
- <connection>${maven.scm.connection.child}</connection>
- <developerConnection>${maven.scm.developerConnection.child}</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/maven-jaxx-plugin</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2/maven-jaxx-plugin</developerConnection>
</scm>
</project>
\ No newline at end of file
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-02-24 11:21:33 UTC (rev 1242)
+++ jaxx/trunk/pom.xml 2009-02-25 09:47:34 UTC (rev 1243)
@@ -1,5 +1,4 @@
-<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">
+<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>
@@ -15,7 +14,7 @@
<groupId>org.codelutin</groupId>
<artifactId>jaxx</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
<modules>
<module>jaxx-runtime-api</module>
@@ -203,9 +202,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2</connection>
+ <developerConnection>scm:svn:svn+ssh://letellier@labs.libre-entreprise.org/svnroot/buix/jaxx/tags/jaxx-1.2</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/jaxx/tags/jaxx-…</url>
</scm>
<!-- Maven Environment : Repositories -->
1
0
r1242 - jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 24 Feb '09
by tchemit@users.labs.libre-entreprise.org 24 Feb '09
24 Feb '09
Author: tchemit
Date: 2009-02-24 11:21:33 +0000 (Tue, 24 Feb 2009)
New Revision: 1242
Modified:
jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java
Log:
implantation initMethod
Modified: jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java
===================================================================
--- jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java 2009-02-23 13:06:52 UTC (rev 1241)
+++ jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java 2009-02-24 11:21:33 UTC (rev 1242)
@@ -123,6 +123,10 @@
throw new IllegalArgumentException("an " + AutoLoad.class.getName() + " can not have a named context but was call with this one : " + name);
}
value = newInstance(clazz);
+ if (!anno.initMethod().trim().isEmpty()){
+ // apply method on class
+ newAccess(clazz, value, anno.initMethod().trim());
+ }
if (log.isDebugEnabled()) {
log.debug("new instance " + clazz + " : " + value);
}
@@ -219,4 +223,21 @@
throw new IllegalArgumentException(ex);
}
}
+
+ protected Object newAccess(Class<?> clazz, Object parent, String methodName) throws IllegalArgumentException {
+ Object value;
+ try {
+ Method m = clazz.getMethod(methodName);
+ value = m.invoke(parent);
+ return value;
+ } catch (NoSuchMethodException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (SecurityException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (IllegalAccessException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (InvocationTargetException ex) {
+ throw new IllegalArgumentException(ex);
+ }
+ }
}
1
0
23 Feb '09
Author: tchemit
Date: 2009-02-23 13:06:52 +0000 (Mon, 23 Feb 2009)
New Revision: 1241
Added:
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIProvider.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java
jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java
Removed:
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUI.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FormElement.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIFactory.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIHelper.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIProvider.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java
jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java
Modified:
jaxx/trunk/changelog.txt
jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/JTextComponentHandler.java
jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx
jaxx/trunk/jaxx-runtime-swing/changelog.txt
jaxx/trunk/jaxx-swing-action/pom.xml
jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-en_GB.properties
jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-fr_FR.properties
jaxx/trunk/pom.xml
Log:
- move sources from jaxx-util to jaxx-swing-action module
- delete jaxx-util module
- rename jaxx.runtime.swing.Utils to jaxx.runtime.SwingUtil
Modified: jaxx/trunk/changelog.txt
===================================================================
--- jaxx/trunk/changelog.txt 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/changelog.txt 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,3 +1,7 @@
+1.2 ??? 2009????
+ * 20090223 [chemit] - move sources from jaxx-util to jaxx-swing-action module
+ - delete jaxx-util module
+
1.1 chemit 20090220
* 20090203 [chemit] - use i18n 0.9 (zeroConf)
* 20090203 [chemit] - use lutinproject 3.4
Modified: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/JTextComponentHandler.java
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/JTextComponentHandler.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/JTextComponentHandler.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -16,6 +16,7 @@
import javax.swing.JTextArea;
import javax.swing.event.DocumentListener;
import javax.swing.text.JTextComponent;
+import jaxx.runtime.SwingUtil;
public class JTextComponentHandler extends DefaultComponentHandler {
private static final int DEFAULT_COLUMNS = 15;
@@ -45,7 +46,8 @@
@Override
public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException {
if (name.equals("text")) {
- return "jaxx.runtime.swing.Utils.setText(" + id + ", " + valueCode + ");\n";
+ return SwingUtil.class.getName()+".setText(" + id + ", " + valueCode + ");\n";
+ //return "jaxx.runtime.swing.Utils.setText(" + id + ", " + valueCode + ");\n";
}
return super.getSetPropertyCode(id, name, valueCode, compiler);
}
Modified: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx
===================================================================
--- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx 2009-02-23 13:06:52 UTC (rev 1241)
@@ -28,15 +28,15 @@
<script><![CDATA[
import static org.codelutin.i18n.I18n.n_;
-import jaxx.runtime.swing.Utils;
+import jaxx.runtime.SwingUtil;
static boolean wasinit=false;
errorTable.setDefaultRenderer(Object.class, new jaxx.runtime.validator.swing.SwingValidatorErrorTableRenderer());
-Utils.setI18nTableHeaderRenderer(errorTable, n_("validator.scope"), n_("validator.scope.tip"), n_("validator.field"), n_("validator.field.tip"), n_("validator.message"), n_("validator.message.tip"));
+SwingUtil.setI18nTableHeaderRenderer(errorTable, n_("validator.scope"), n_("validator.scope.tip"), n_("validator.field"), n_("validator.field.tip"), n_("validator.message"), n_("validator.message.tip"));
public void setVisible(boolean value) {
if (!wasinit) {
- Utils.fixTableColumnWidth(errorTable, 0, 20);
+ SwingUtil.fixTableColumnWidth(errorTable, 0, 20);
wasinit=true;
}
super.setVisible(value);
Modified: jaxx/trunk/jaxx-runtime-swing/changelog.txt
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/changelog.txt 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-runtime-swing/changelog.txt 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,3 +1,6 @@
+1.2 ??? 2009????
+ * 20090223 [chemit] - rename jaxx.runtime.swing.Utils to jaxx.runtime.SwingUtil
+
1.1 chemit 20090220
* 20090124 [chemit] - add a cache on context path to improve performance on NavigationTreeNode
- improve I18nTableCellRenderer to display toolTipText
Deleted: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,143 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime.swing;
-
-import java.util.List;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.SwingUtilities;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.text.AbstractDocument;
-import javax.swing.text.JTextComponent;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- *
- * @author tony
- * @deprecatedwill remove in release 1.2, prefer use the {@link jaxx.runtime.SwingUtil} class.
- *
- */
-public class Utils {
- private static Field numReaders;
- private static Field notifyingListeners;
-
- @Deprecated
- public static void setText(final JTextComponent c, final String text) {
- try {
- // AbstractDocument deadlocks if we try to acquire a write lock while a read lock is held by the current thread
- // If there are any readers, dispatch an invokeLater. This should only happen in the event of circular bindings.
- // Similarly, circular bindings can result in an "Attempt to mutate in notification" error, which we deal with
- // by checking for the 'notifyingListeners' property.
- AbstractDocument document = (AbstractDocument) c.getDocument();
- if (numReaders == null) {
- numReaders = AbstractDocument.class.getDeclaredField("numReaders");
- numReaders.setAccessible(true);
- }
- if (notifyingListeners == null) {
- notifyingListeners = AbstractDocument.class.getDeclaredField("notifyingListeners");
- notifyingListeners.setAccessible(true);
- }
-
- if (notifyingListeners.get(document).equals(Boolean.TRUE)) {
- return;
- }
-
- if ((Integer) numReaders.get(document) > 0) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- if (!c.getText().equals(text)) {
- c.setText(text);
- }
- }
- });
- return;
- }
-
- String oldText = c.getText();
- if (oldText == null || !oldText.equals(text)) {
- c.setText(text);
- }
- }
- catch (NoSuchFieldException e) {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- catch (SecurityException e) {
- c.setText(text);
- }
- }
-
- /**
- * Fill a combo box model with some datas, and select after all the given object
- *
- * @param combo the combo to fill
- * @param data data ot inject in combo
- * @param select the object to select in combo after reflling his model
- */
- @Deprecated
- public static void fillComboBox(JComboBox combo, Collection<?> data, Object select) {
- if (!(combo.getModel() instanceof DefaultComboBoxModel)) {
- throw new IllegalArgumentException("this method need a DefaultComboBoxModel for this model but was " + combo.getModel().getClass());
- }
- DefaultComboBoxModel model = (DefaultComboBoxModel) combo.getModel();
- // evince the model
- model.removeListDataListener(combo);
- model.removeAllElements();
- for (Object o : data) {
- model.addElement(o);
- }
- // attach the model
- model.addListDataListener(combo);
- model.setSelectedItem(select);
- }
-
- /**
- * Fill a combo box model with some datas, and select after all the given object
- *
- * @param combo the combo to fill
- * @param data data ot inject in combo
- * @param select the object to select in combo after reflling his model
- * @param firstNull add a first null element
- */
- @Deprecated
- public static void fillComboBox(JAXXComboBox combo, Collection<?> data, Object select, boolean firstNull) {
- List<Item> items = new ArrayList<Item>();
- if (firstNull)
- items.add(new Item("null", " ", null, false));
- for (Object d : data){
- items.add(new Item(d.toString(), d.toString(), d, d.equals(select)));
- }
- combo.setItems(items);
- }
- @Deprecated
- public static void fixTableColumnWidth(JTable table, int columnIndex, int width) {
- TableColumn column = table.getColumnModel().getColumn(columnIndex);
- column.setMaxWidth(width);
- column.setMinWidth(width);
- column.setWidth(width);
- column.setPreferredWidth(width);
- }
- @Deprecated
- public static void setTableColumnEditor(JTable table, int columnIndex, TableCellEditor editor) {
- TableColumn column = table.getColumnModel().getColumn(columnIndex);
- column.setCellEditor(editor);
- }
- @Deprecated
- public static void setTableColumnRenderer(JTable table, int columnIndex, TableCellRenderer editor) {
- TableColumn column = table.getColumnModel().getColumn(columnIndex);
- column.setCellRenderer(editor);
- }
- @Deprecated
- public static void setI18nTableHeaderRenderer(JTable table, String... libelles) {
- table.getTableHeader().setDefaultRenderer(new I18nTableCellRenderer(table.getTableHeader().getDefaultRenderer(), libelles));
- }
-}
Modified: jaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-swing-action/pom.xml 2009-02-23 13:06:52 UTC (rev 1241)
@@ -22,12 +22,6 @@
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>jaxx-util</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>jaxx-runtime-swing</artifactId>
<version>${project.version}</version>
</dependency>
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,53 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/** @author chemit */
+public abstract class AbstractUIAction<H extends DialogUIHandler<?, ?>> extends javax.swing.AbstractAction {
+
+ protected static Log log = LogFactory.getLog(AbstractUIAction.class);
+
+ protected transient DialogUI<? extends H> ui;
+
+ private static final long serialVersionUID = 1L;
+
+ protected AbstractUIAction(String name, javax.swing.Icon icon, DialogUI<? extends H> ui) {
+ super(name, icon);
+ this.ui = ui;
+ }
+
+ protected H getHandler() {
+ checkInit();
+ return ui.getHandler();
+ }
+
+ protected void setUi(DialogUI<? extends H> ui) {
+ this.ui = ui;
+ }
+
+ public DialogUI<? extends H> getUi() {
+ return ui;
+ }
+
+ protected void checkInit() throws IllegalStateException {
+ /*if (ui == null) {
+ throw new IllegalStateException("no handler, nor ui referenced in " + this);
+ } */
+ }
+
+}
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUI.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,129 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractButton;
+import javax.swing.ImageIcon;
+import javax.swing.JDialog;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.lang.reflect.Constructor;
+
+/**
+ * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
+ * <p/>
+ * TODO : make jaxx authorized implementing interface for root tag :)
+ *
+ * @author chemit
+ */
+public abstract class DialogUI<H extends DialogUIHandler> extends JDialog implements WindowListener {
+
+ protected static Log log = LogFactory.getLog(DialogUI.class);
+
+ public javax.swing.AbstractAction newAction(Class<?> actionClass, Object... params) {
+ Constructor<?> constructor = null;
+ for (Constructor<?> cons : actionClass.getConstructors()) {
+ Class<?>[] prototype = cons.getParameterTypes();
+ if (prototype.length > 0 && DialogUI.class.isAssignableFrom(prototype[0])) {
+ // use this constructor
+ constructor = cons;
+ break;
+ }
+ }
+ if (constructor == null) {
+ throw new IllegalStateException("could not find a matching constructor for " + actionClass);
+ }
+
+ // wrap params
+ Object[] parameters = new Object[1 + params.length];
+ parameters[0] = this;
+ System.arraycopy(params, 0, parameters, 1, params.length);
+ try {
+ AbstractAction action = (AbstractAction) constructor.newInstance(parameters);
+ if (log.isInfoEnabled()) {
+ log.info(action);
+ }
+ return action;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not init the action " + actionClass + " for reason : " + e.getMessage());
+ }
+ }
+
+ private H handler;
+
+ public abstract AbstractButton getHelp();
+
+ public abstract Object getObjectById(java.lang.String s);
+
+ protected DialogUI() {
+ UIHelper.setQuitAction(this);
+ addWindowListener(this);
+ //TODO will be handled by jaxx with javax.help...
+ //getHelp().setAction(newAction(HelpAction.class));
+ }
+
+ public H getHandler() {
+ return handler;
+ }
+
+ public void setHandler(H handler) {
+ this.handler = handler;
+ }
+
+ protected ImageIcon createActionIcon(String name) {
+ return UIHelper.createActionIcon(name);
+ }
+
+ public void windowOpened(WindowEvent e) {
+ }
+
+ public void windowClosed(WindowEvent e) {
+ }
+
+ public void windowClosing(WindowEvent e) {
+ }
+
+ public void windowIconified(WindowEvent e) {
+ }
+
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ public void windowActivated(WindowEvent e) {
+ }
+
+ public void windowDeactivated(WindowEvent e) {
+ }
+
+ @Override
+ public synchronized void addWindowListener(WindowListener l) {
+ super.addWindowListener(l);
+ if (log.isDebugEnabled()) {
+ log.debug("after added (" + getWindowListeners().length + ") : " + l);
+ }
+ }
+
+ @Override
+ public synchronized void removeWindowListener(WindowListener l) {
+ super.removeWindowListener(l);
+ if (log.isDebugEnabled()) {
+ log.debug("after removed (" + getWindowListeners().length + ") : " + l);
+ }
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUI.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,235 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import static org.codelutin.i18n.I18n._;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.ImageIcon;
+import java.lang.reflect.Constructor;
+
+/**
+ * Definition of an ui, with his model, handler and ui class definitions.
+ * <p/>
+ * The class contains also a shared instace of concrete ui.
+ *
+ * @author chemit
+ */
+public class DialogUIDef<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> implements java.io.Serializable {
+
+ static protected final Log log = LogFactory.getLog(DialogUIDef.class);
+
+ public static <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> DialogUIDef<M, U, H> newDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass, String showActionLibelle, String showActionTip, String uiTitle) {
+ DialogUIDef<M, U, H> result;
+ result = new DialogUIDef<M, U, H>(handlerClass, uiClass, modelClass, showActionLibelle, showActionTip, uiTitle);
+ return result;
+ }
+
+ /**
+ * model class
+ */
+ private final Class<M> modelClass;
+
+ /**
+ * handler class
+ */
+ private final Class<H> handlerClass;
+
+ /**
+ * abstract ui class
+ */
+ private final Class<U> uiClass;
+
+ /**
+ * concrete lookup ui class
+ */
+ private Class<? extends U> uiImplClass;
+
+ /**
+ * shared instance of ui
+ */
+ protected U uiInstance;
+
+ /**
+ * unique name of ui def
+ */
+ protected final String name;
+
+ protected final String uiTitle;
+ protected final String showActionLibelle;
+ protected final String showActionTip;
+
+ protected ImageIcon showUIActionIcon;
+
+
+ private static final long serialVersionUID = 1L;
+
+ private DialogUIDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass,
+ String showActionLibelle, String showActionTip, String uiTitle) {
+ this.handlerClass = handlerClass;
+ this.uiClass = uiClass;
+ this.modelClass = modelClass;
+ this.showActionLibelle = showActionLibelle;
+ this.name = uiClass.getSimpleName().toLowerCase();
+ this.showActionTip = showActionTip;
+ this.uiTitle = uiTitle;
+ }
+
+ public Class<U> getUiClass() {
+ return uiClass;
+ }
+
+ public Class<H> getHandlerClass() {
+ return handlerClass;
+ }
+
+ public Class<M> getModelClass() {
+ return modelClass;
+ }
+
+ public Class<? extends U> getUiImplClass() {
+ return uiImplClass;
+ }
+
+ public String getUiTitle() {
+ return _(uiTitle);
+ }
+
+ public String getShowActionLibelle() {
+ return _(showActionLibelle);
+ }
+
+ public String getShowActionTip() {
+ return _(showActionTip);
+ }
+
+ public ImageIcon getShowUIActionIcon() {
+ if (showUIActionIcon == null) {
+ showUIActionIcon = UIHelper.createActionIcon("show-" + name);
+ }
+ return showUIActionIcon;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void setUiImplClass(Class<?> uiImplClass) {
+ this.uiImplClass = (Class<? extends U>) uiImplClass;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return this == o || o instanceof DialogUIDef && uiClass.equals(((DialogUIDef) o).uiClass);
+ }
+
+ @Override
+ public int hashCode() {
+ return uiClass.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(super.toString()).append('<');
+ sb.append(printClass("handler", handlerClass, true));
+ sb.append(printClass("model", modelClass, true));
+ sb.append(printClass("ui", uiClass, true));
+ sb.append(printClass("uiImpl", uiImplClass, false));
+ return sb.toString();
+ }
+
+ protected U getUiInstance() {
+ // no lazy instanciation, to control ui instanciation...
+ /*if (uiInstance == null) {
+ if (uiImplClass == null) {
+ throw new IllegalStateException("no concrete ui impl found in " + this);
+ }
+ synchronized (this) {
+ try {
+ uiInstance = uiImplClass.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this,e);
+ }
+ }
+ }*/
+ return uiInstance;
+ }
+
+ protected void setUiInstance(U uiInstance) {
+ this.uiInstance = uiInstance;
+ }
+
+ protected U newUI() {
+ if (uiImplClass == null) {
+ throw new IllegalStateException("no concrete ui impl found in " + this);
+ }
+ try {
+ U result = uiImplClass.newInstance();
+ log.info(result);
+ return result;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this, e);
+ }
+ }
+
+ protected M newModel() {
+ if (modelClass == null) {
+ throw new IllegalStateException("no model impl found in " + this);
+ }
+ try {
+ M model = modelClass.newInstance();
+ log.info(model);
+ return model;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this, e);
+ }
+ }
+
+ protected H newHandler(U ui, M model, Object... params) {
+ if (handlerClass == null) {
+ throw new IllegalStateException("no handler impl found in " + this);
+ }
+ try {
+ Class[] prototype = getHandlerPrototype(params);
+ Object[] parameters = getHandlerParameters(ui, model, params);
+ H result = handlerClass.getConstructor(prototype).newInstance(parameters);
+ log.info(result);
+ return result;
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui " + this, e);
+ }
+ }
+
+ protected Object[] getHandlerParameters(U ui, M model, Object[] params) {
+ Object[] result = new Object[2 + params.length];
+ result[0] = ui;
+ result[1] = model;
+ System.arraycopy(params, 0, result, 2, params.length);
+ return result;
+ }
+
+ protected Class[] getHandlerPrototype(Object[] params) {
+ int length = params.length;
+ for (Constructor<?> constructor : handlerClass.getConstructors()) {
+ Class<?>[] prototype = constructor.getParameterTypes();
+ if (prototype.length == 2 + length && prototype[0] == uiClass && prototype[1] == modelClass) {
+ return prototype;
+ }
+ }
+ throw new IllegalStateException("could not find a matching constructor in " + handlerClass);
+ }
+
+ protected String printClass(String s, Class<?> aClass, boolean notLast) {
+ return s + ':' + (aClass == null ? null : aClass.getSimpleName()) + (notLast ? ", " : ">");
+ }
+}
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,70 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.event.WindowListener;
+import java.beans.PropertyChangeListener;
+
+/**
+ * DialogUI handler
+ *
+ * @author chemit
+ */
+public abstract class DialogUIHandler<M extends DialogUIModel, U extends DialogUI<? extends DialogUIHandler>> implements PropertyChangeListener {
+
+ protected static Log log = LogFactory.getLog(DialogUIHandler.class);
+
+ /** ui handled */
+ private U ui;
+
+ /** model handled */
+ private M model;
+
+ protected DialogUIHandler(U ui, M model) {
+ this.ui = ui;
+ this.model = model;
+ }
+
+ public U getUi() {
+ return ui;
+ }
+
+ public M getModel() {
+ return model;
+ }
+
+ public void init() {
+ if (model == null) {
+ throw new IllegalStateException("no model was defined for " + this);
+ }
+ model.addPropertyChangeListener(this);
+ }
+
+ public void dispose() {
+ model.dispose();
+ for (WindowListener windowListener : getUi().getWindowListeners()) {
+ getUi().removeWindowListener(windowListener);
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ dispose();
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,97 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * Abstract ui model, with property change support.
+ *
+ * @author chemit
+ */
+public abstract class DialogUIModel {
+
+ static protected final Log log = LogFactory.getLog(DialogUIModel.class);
+
+ /** support for change properties support */
+ protected PropertyChangeSupport changeSupport;
+
+ public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ if (listener == null) {
+ return;
+ }
+ if (changeSupport == null) {
+ changeSupport = new PropertyChangeSupport(this);
+ }
+ changeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
+ if (listener == null) {
+ return;
+ }
+ if (changeSupport == null) {
+ changeSupport = new PropertyChangeSupport(this);
+ }
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
+ if (listener == null || changeSupport == null) {
+ return;
+ }
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ public synchronized void removePropertyChangeListeners() {
+ if (changeSupport == null) {
+ return;
+ }
+ for (PropertyChangeListener listener : getPropertyChangeListeners()) {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+ }
+
+ public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
+ if (changeSupport == null) {
+ return new PropertyChangeListener[0];
+ }
+ return changeSupport.getPropertyChangeListeners();
+ }
+
+ public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ if (changeSupport == null || (oldValue == null && newValue == null) ||
+ (oldValue != null && oldValue.equals(newValue))) {
+ return;
+ }
+ changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ public void dispose() {
+ for (PropertyChangeListener listener : changeSupport.getPropertyChangeListeners()) {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ dispose();
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,84 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+/**
+ * A windowListenr for ui managed by {@link org.codelutin.jaxx.util.UIFactory}.
+ * <p/>
+ * To be used when all ui from factory are closed, via {@link #allWindowsClosed(java.awt.event.WindowEvent)} method.
+ *
+ * @author chemit
+ */
+public abstract class FactoryWindowListener extends WindowAdapter {
+
+ /**
+ * method to be invoked when all ui registred in factory are really disposed.
+ *
+ * @param e event
+ */
+ public abstract void allWindowsClosed(WindowEvent e);
+
+ /** underlying factory of ui */
+ private UIFactory factory;
+
+ /** flag to make sure {@link #allWindowsClosed(java.awt.event.WindowEvent)} is called only once. */
+ private boolean wasClosed;
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ if (UIFactory.log.isDebugEnabled()) {
+ UIFactory.log.debug(this + " : " + e);
+ }
+ if (e.getWindow().isVisible()) {
+ // only deal with real closed and none visible windows...
+ return;
+ }
+ for (DialogUIDef def : factory.getDefs()) {
+ DialogUI ui = def.uiInstance;
+ if (ui != null && ui.isVisible()) {
+ // at least one ui visible, do not close all
+ return;
+ }
+ }
+
+ if (wasClosed) {
+ // make sure to process only once
+ return;
+ }
+ if (UIFactory.log.isInfoEnabled()) {
+ UIFactory.log.info("closing factory listener " + this);
+ }
+
+ synchronized (this) {
+ try {
+ allWindowsClosed(e);
+ } finally {
+ wasClosed = true;
+ factory.removeFactoryWindowListener(this);
+ }
+ }
+ }
+
+ protected UIFactory getFactory() {
+ return factory;
+ }
+
+ protected void setFactory(UIFactory factory) {
+ this.factory = factory;
+ }
+}
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FormElement.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,29 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+/** @author chemit */
+public interface FormElement<U extends DialogUI> {
+
+ String name();
+
+ int ordinal();
+
+ Object getValue(U ui);
+
+ void setValue(U ui, String value);
+
+ javax.swing.JLabel getLabel(U ui);
+}
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/FormElement.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,135 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public abstract class ShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> extends javax.swing.AbstractAction {
+
+ protected static Log log = LogFactory.getLog(AbstractUIAction.class);
+
+ protected transient DialogUI<?> ui;
+
+ private static final long serialVersionUID = 1L;
+
+ protected DialogUIDef<M, U, H> uiDef;
+
+ protected transient UIFactory factory;
+
+ protected String position;
+
+ protected boolean undecorated = true;
+
+ protected U initUI(ActionEvent e) {
+ return getFactory().getUI(uiDef);
+ }
+
+ public ShowUIAction(DialogUI<?> ui, DialogUIDef<M, U, H> uiDef, UIFactory factory, boolean showText) {
+ super(uiDef.getShowActionLibelle(), uiDef.getShowUIActionIcon());
+ this.ui = ui;
+ this.uiDef = uiDef;
+ String name = (String) getValue(NAME);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
+ putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1));
+ if (!showText) {
+ putValue(NAME, null);
+ }
+ putValue(SHORT_DESCRIPTION, uiDef.getShowActionTip());
+ this.factory = factory;
+ }
+
+ public DialogUI<?> getUi() {
+ return ui;
+ }
+
+ public DialogUIDef<M, U, H> getUiDef() {
+ return uiDef;
+ }
+
+ public UIFactory getFactory() {
+ return factory;
+ }
+
+ public void setUiDef(DialogUIDef<M, U, H> uiDef) {
+ this.uiDef = uiDef;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public void setUndecorated(boolean undecorated) {
+ this.undecorated = undecorated;
+ }
+
+ public void actionPerformed(java.awt.event.ActionEvent e) {
+ checkInit();
+ U ui = initUI(e);
+ ui.setTitle(uiDef.getUiTitle());
+ log.info(ui.getTitle());
+ //TODO ui.setUndecorated(undecorated);
+ setPosition(this.getUi(), ui, position);
+
+ ui.setVisible(true);
+ }
+
+ protected void setPosition(javax.swing.JDialog parentUI, javax.swing.JDialog ui, String position) {
+ if (position == null || parentUI == null) {
+ return;
+ }
+ Point parentLocation = parentUI.getLocationOnScreen();
+ Dimension parentSize = parentUI.getSize();
+
+ if (position.equals("bottom-left")) {
+ int top = (int) (parentLocation.getY() + parentSize.getHeight());
+ int left = (int) (parentLocation.getX());
+ Point newLocation = new Point(left, top);
+ newLocation.setLocation(left, top);
+ ui.setLocation(newLocation);
+ return;
+ }
+ if (position.equals("top-left")) {
+ int top = (int) (parentLocation.getY());
+ int left = (int) (parentLocation.getX());
+ Point newLocation = new Point(left, top);
+ newLocation.setLocation(left, top);
+ ui.setLocation(newLocation);
+ return;
+ }
+ if (position.equals("top-right")) {
+ int top = (int) (parentLocation.getY());
+ int left = (int) (parentLocation.getX() + parentSize.getWidth());
+ Point newLocation = new Point(left, top);
+ newLocation.setLocation(left, top);
+ ui.setLocation(newLocation);
+ return;
+ }
+ if (position.equals(("center"))) {
+ //TODO
+ }
+ }
+
+ protected void checkInit() throws IllegalStateException {
+ if (factory == null) {
+ throw new IllegalStateException("no factory found in " + this);
+ }
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIFactory.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,184 @@
+/**
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.util.StringUtil;
+
+import javax.swing.event.EventListenerList;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ServiceLoader;
+
+/**
+ * Factory for UI, using a cache and a provider to find ui implementations.
+ *
+ * @author chemit
+ */
+public class UIFactory {
+
+ static protected final Log log = LogFactory.getLog(UIFactory.class);
+
+ private final String applicationName;
+
+ private final DialogUIDef[] defs;
+
+ private final EventListenerList listeners;
+
+ public UIFactory(String applicationName, DialogUIDef[] defs, FactoryWindowListener... listeners) {
+ this.applicationName = applicationName;
+ this.listeners = new EventListenerList();
+ for (FactoryWindowListener listener : listeners) {
+ listener.setFactory(this);
+ addFactoryWindowListener(listener);
+ }
+ this.defs = defs;
+ long t0 = System.nanoTime();
+ if (log.isDebugEnabled()) {
+ log.debug("start at " + new java.util.Date());
+ }
+ try {
+ init();
+ } catch (Exception e) {
+ log.error(e);
+ throw new RuntimeException(e);
+ } finally {
+ if (log.isDebugEnabled()) {
+ log.info("end in " + StringUtil.convertTime(t0, System.nanoTime()));
+ }
+ }
+ }
+
+ public void addFactoryWindowListener(FactoryWindowListener l) {
+ listeners.add(FactoryWindowListener.class, l);
+ if (log.isDebugEnabled()) {
+ log.debug("after added (" + listeners.getListenerCount() + ") : " + l);
+ }
+ }
+
+ public void removeFactoryWindowListener(FactoryWindowListener l) {
+ listeners.remove(FactoryWindowListener.class, l);
+ for (DialogUIDef def : getDefs()) {
+ if (def.uiInstance != null) {
+ def.uiInstance.removeWindowListener(l);
+ }
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(" after removed (" + listeners.getListenerCount() + ") : " + l);
+ }
+ if (listeners.getListenerCount(FactoryWindowListener.class) == 0) {
+ // close for real factory
+ close();
+ }
+ }
+
+ public void close() {
+ log.info(this + " at " + new java.util.Date());
+ for (DialogUIDef<?, ?, ?> def : defs) {
+ DialogUI<?> ui = def.uiInstance;
+ if (ui != null) {
+ ui.getHandler().dispose();
+ def.uiInstance = null;
+ }
+ }
+ if (listeners.getListenerCount(FactoryWindowListener.class) > 0) {
+ log.warn("some listeners where not properly removed, force deletion...");
+ for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
+ removeFactoryWindowListener(listener);
+ }
+ }
+
+ }
+
+ protected void init() {
+
+ UIProvider[] providers = detectProviders();
+
+ for (DialogUIDef<?, ?, ?> def : defs) {
+ initDef(providers, def);
+ if (def.getUiImplClass() == null) {
+ throw new IllegalStateException("could not find implementation for ui def " + def);
+ }
+ }
+ }
+
+ protected void initDef(UIProvider[] providers, DialogUIDef<?, ?, ?> def) {
+ for (UIProvider provider : providers) {
+ Class<?> uiImplClass = provider.findUIImplementation(def);
+ if (uiImplClass != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("init done for " + def);
+ }
+ // ui implementation was found
+ break;
+ }
+ }
+ }
+
+ protected UIProvider[] detectProviders() {
+ long t0 = System.nanoTime();
+ List<UIProvider> providers = new ArrayList<UIProvider>();
+ for (UIProvider provider : ServiceLoader.load(UIProvider.class)) {
+ if (applicationName.equals(provider.getApplicationName())) {
+ if (log.isDebugEnabled()) {
+ log.debug("provider detected [" + provider + ']');
+ }
+ providers.add(provider);
+ }
+ }
+ log.info("found " + providers.size() + " ui provider(s) in " + StringUtil.convertTime(t0, System.nanoTime()) + " : " + providers);
+ return providers.toArray(new UIProvider[providers.size()]);
+ }
+
+ protected DialogUIDef[] getDefs() {
+ return defs;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ close();
+ }
+
+ public <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> U getUI(DialogUIDef<M, U, H> uiType, Object... params) {
+ U ui = uiType.uiInstance;
+ if (ui == null) {
+ try {
+ ui = uiType.newUI();
+ M model = uiType.newModel();
+ H handler = uiType.newHandler(ui, model, params);
+ registerUI(uiType, ui, handler);
+ } catch (Exception e) {
+ throw new IllegalStateException("could not instanciate ui handler " + uiType + " for reason : " + e.getMessage(), e);
+ }
+ }
+ return ui;
+ }
+
+ protected <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> void registerUI(DialogUIDef<M, U, H> uiType, U ui, H handler) {
+ ui.setHandler(handler);
+ handler.init();
+ uiType.setUiInstance(ui);
+ for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
+ if (log.isDebugEnabled()) {
+ log.debug("----- addFactoryWindowListener " + listener + " to " + ui);
+ }
+ ui.addWindowListener(listener);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIFactory.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIHelper.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,70 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit
+*
+* 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 org.codelutin.jaxx.util;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.ImageIcon;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JRootPane;
+import javax.swing.KeyStroke;
+import java.awt.event.ActionEvent;
+
+/**
+ * Ui helper class.
+ *
+ * @author tony
+ */
+public class UIHelper {
+
+ public static ImageIcon createImageIcon(String path) {
+ java.net.URL imgURL = UIHelper.class.getResource("/icons/" + path);
+ if (imgURL != null) {
+ return new ImageIcon(imgURL);
+ } else {
+ throw new IllegalArgumentException("could not find icon " + path);
+ }
+ }
+
+ /**
+ * Attach to <code>ui</code> an abort action,accessible by <code>ESC</code> key.
+ *
+ * @param ui ui
+ */
+ public static void setQuitAction(final JDialog ui) {
+ JRootPane rootPane = ui.getRootPane();
+
+ Action quitAction = new AbstractAction("quit") {
+ private static final long serialVersionUID = -869095664995763057L;
+
+ public void actionPerformed(ActionEvent e) {
+ ui.dispose();
+ }
+ };
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
+ rootPane.getActionMap().put("quit", quitAction);
+ ui.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ }
+
+ public static ImageIcon createActionIcon(String name) {
+ return createImageIcon("action-" + name + ".png");
+ }
+
+}
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIHelper.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIProvider.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIProvider.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIProvider.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIProvider.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,86 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util;
+
+/** @author chemit */
+public abstract class UIProvider {
+
+ /** the name of application using this provider */
+ protected String applicationName;
+
+ /** the name of ui implementation used by this provider */
+ protected String providerName;
+
+ /** array of ui implementations */
+ protected Class<?>[] implementations;
+
+ protected UIProvider(String applicationName, String providerName, Class<?>... implementations) {
+ this.applicationName = applicationName;
+ this.providerName = providerName;
+ this.implementations = implementations;
+ }
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+ public String getApplicationName() {
+ return applicationName;
+ }
+
+ public Class<?>[] getImplementations() {
+ return implementations;
+ }
+
+ public Class<?> findUIImplementation(DialogUIDef<?, ?, ?> def) {
+ Class<? extends DialogUI<?>> uiClass = def.getUiClass();
+ for (Class<?> klass : implementations) {
+ if (uiClass.isAssignableFrom(klass)) {
+ def.setUiImplClass(klass);
+ return klass;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(super.toString()).append('<');
+ sb.append(printClass("application", applicationName, true));
+ sb.append(printClass("provider", providerName, true));
+ sb.append(printClass("uis", implementations.length, false));
+ return sb.toString();
+ }
+
+ protected String printClass(String s, Object aClass, boolean notLast) {
+ return s + ':' + (aClass == null ? null : aClass) + (notLast ? ", " : ">");
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof UIProvider)) return false;
+
+ UIProvider that = (UIProvider) o;
+ return applicationName.equals(that.applicationName) && providerName.equals(that.providerName);
+
+ }
+
+ @Override
+ public int hashCode() {
+ return (31 * applicationName.hashCode()) + providerName.hashCode();
+ }
+
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/UIProvider.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,43 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util.config;
+
+import org.codelutin.jaxx.util.AbstractUIAction;
+import org.codelutin.jaxx.util.DialogUI;
+import org.codelutin.jaxx.util.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class CancelAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public CancelAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("cancel-config"), dialogUI);
+ if (showLabel) {
+ String text = org.codelutin.i18n.I18n._("lutinui.config.cancel");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.codelutin.i18n.I18n._("lutinui.config.cancel.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ getUi().dispose();
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,105 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util.config;
+
+import org.codelutin.jaxx.util.DialogUI;
+
+import javax.swing.AbstractButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+
+/**
+ * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
+ * <p/>
+ * TODO : make jaxx authorized implementing interface for root tag :)
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUI<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends DialogUI<H> {
+
+ public abstract AbstractButton getOk();
+
+ public abstract AbstractButton getReset();
+
+ public abstract AbstractButton getCancel();
+
+ public JComponent getElement(E key) {
+ Object id = getObjectById(key.name());
+ if (id == null) {
+ log.error(new NullPointerException("no widget for key "+key));
+ return null;
+ }
+ if (!(id instanceof JComponent)) {
+ throw new IllegalArgumentException(id + " is not a JComponent");
+ }
+ return (JComponent) id;
+ }
+
+ public Object getElementValue(E key) {
+ JComponent o = getElement(key);
+ if (o instanceof JPasswordField) {
+ return new String(((JPasswordField) o).getPassword());
+ }
+ if (o instanceof JTextField) {
+ return ((JTextField) o).getText();
+ }
+ if (o instanceof JRadioButton) {
+ return ((JRadioButton) o).isSelected();
+ }
+ if (o instanceof JCheckBox) {
+ return ((JCheckBox) o).isSelected();
+ }
+
+ if (o instanceof JComboBox) {
+ return ((JComboBox) o).getSelectedItem();
+ }
+ return "";
+ }
+
+ public void setElementValue(E key, Object value) {
+ JComponent o = getElement(key);
+
+ String strValue = value == null ? "" : String.valueOf(value);
+ if (o instanceof JPasswordField) {
+ ((JPasswordField) o).setText(strValue);
+ }
+ if (o instanceof JTextField) {
+ ((JTextField) o).setText(strValue);
+ }
+ if (o instanceof JRadioButton) {
+ ((JRadioButton) o).setSelected(Boolean.valueOf(strValue.isEmpty() ? "false" : strValue));
+ }
+ if (o instanceof JCheckBox) {
+ ((JCheckBox) o).setSelected(Boolean.valueOf(strValue.isEmpty() ? "false" : strValue));
+ }
+ if (o instanceof JComboBox) {
+ ((JComboBox) o).setSelectedItem(value);
+ }
+ }
+
+ public JLabel getElementLabel(E key) {
+ return (JLabel) getObjectById(key.name() + "Label");
+ }
+
+ public void doCheck(E key) {
+ getHandler().doCheck(key);
+ }
+
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,156 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util.config;
+
+import org.codelutin.jaxx.util.DialogUIHandler;
+import org.codelutin.util.ConverterUtil;
+import org.codelutin.util.config.Config;
+import org.codelutin.util.config.Property;
+
+import javax.swing.JComponent;
+import java.awt.Color;
+import java.beans.PropertyChangeEvent;
+import java.util.EnumMap;
+import java.util.EnumSet;
+
+/**
+ * DialogUI handler
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E, ?>, U extends DialogConfigUI<E, ?>> extends DialogUIHandler<M, U> {
+
+ protected DialogConfigUIHandler(U ui, M model) {
+ super(ui, model);
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ String action = evt.getPropertyName();
+
+ if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ // update ui with model values,
+ populateUI();
+ // revalidate form
+ doCheckAll();
+ return;
+ }
+
+ if (DialogConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ boolean modified = newValue != null && newValue;
+ getUi().getReset().setEnabled(modified);
+ getUi().getOk().setEnabled(modified && getModel().isConfigValid());
+ return;
+ }
+
+ if (DialogConfigUIModel.UNVALID_PROPERTY_CHANGED.equals(action)) {
+ updateUI();
+ return;
+ }
+
+ throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
+ }
+
+ public void doCheck(E key) {
+ Object uiValue = getUi().getElementValue(key);
+ DialogConfigUIModel<E, ?> model = getModel();
+ Object currentValue = model.getCurrent().getProperty(key);
+ if (currentValue == null) {
+ currentValue = "";
+ } else {
+ currentValue = String.valueOf(currentValue);
+ }
+
+ model.validateProperty(key, uiValue);
+ model.changeModifiedState(key, uiValue, currentValue);
+ }
+
+ public void doCheckAll() {
+ DialogConfigUIModel<E, ?> model = getModel();
+ EnumSet<E> unvalids = EnumSet.noneOf(model.klass);
+ for (E e : model.getCheckedKeysSet()) {
+ Object uiValue = getUi().getElementValue(e);
+ if (!model.isValid(e, uiValue)) {
+ unvalids.add(e);
+ }
+ }
+ model.setUnvalids(unvalids);
+ unvalids.clear();
+ }
+
+ protected boolean prepareSave() {
+ DialogConfigUI<E, ?> ui = getUi();
+ DialogConfigUIModel<E, ?> model = getModel();
+
+ Config<E> current = model.getCurrent();
+
+ if (!model.isConfigValid()) {
+ log.warn("do not save a unvalid config : " + model.getUnvalids());
+ return false;
+ }
+
+ if (!model.isModified()) {
+ log.warn("nothing to save");
+ return false;
+ }
+ EnumSet<E> toTreate = model.getCheckedKeysSet();
+ // transfert checkable values from ui to model
+ for (E key : model.getModifieds()) {
+ if (!toTreate.contains(key)) {
+ continue;
+ }
+ Object value = ui.getElementValue(key);
+ Class<?> type = ((Property) key).getType();
+ Object newValue = ConverterUtil.convert(type, value);
+ current.setProperty(key, newValue);
+ }
+
+ return true;
+ }
+
+ protected void populateUI() {
+ U ui = getUi();
+ EnumMap<E, Object> map = getModel().getCurrent().getProperties();
+ for (E e : getModel().getCheckedKeysSet()) {
+ Object value = map.get(e);
+ populateUI(ui, e, value);
+ }
+ }
+
+ protected void populateUI(U ui, E key, Object value) {
+ ui.setElementValue(key, value);
+ }
+
+ protected void updateUI() {
+ EnumSet<E> unvalids = getModel().getUnvalids();
+ for (E key : unvalids) {
+ setLabelColor(key, false);
+ }
+ for (E key : EnumSet.complementOf(unvalids)) {
+ setLabelColor(key, true);
+ }
+ }
+
+ protected void setLabelColor(E key, boolean valid) {
+ JComponent component = getUi().getElementLabel(key);
+ if (component != null && component.isVisible()) {
+ component.setForeground(valid ? Color.black : Color.red);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,220 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util.config;
+
+import org.codelutin.jaxx.util.DialogUIModel;
+import org.codelutin.util.config.Config;
+
+import java.util.EnumSet;
+
+/**
+ * Abstract config ui model.
+ *
+ * @author chemit
+ */
+public abstract class DialogConfigUIModel<E extends Enum<E>, C extends Config<E>> extends DialogUIModel {
+
+ public static final String CONFIG_PROPERTY_CHANGED = "config";
+ public static final String MODIFIED_PROPERTY_CHANGED = "modify";
+ public static final String UNVALID_PROPERTY_CHANGED = "unvalid";
+
+ /** @return a empty config */
+ protected abstract C newConfig();
+
+ /**
+ * @param key property key
+ * @param value value to validate
+ * @return <code>true</code> if given value is valid for property, <code>false>/code> otherwise
+ */
+ protected abstract boolean isValid(E key, Object value);
+
+ /**
+ * object used to init model and save model, this is an external object.
+ * <p/>
+ * The object must have bean read-write properties for each value of E
+ */
+ protected Object src;
+
+ /** current config used in model */
+ protected C current;
+
+ /** set of modified properties */
+ protected EnumSet<E> modifieds;
+
+ /** set of unvalid properties */
+ protected EnumSet<E> unvalids;
+
+ /** enum class */
+ protected Class<E> klass;
+
+ /** set of key not to check */
+ protected EnumSet<E> uncheckedKeys;
+
+ /** set of all keys checkable */
+ protected EnumSet<E> checkedKeysSet;
+
+ protected DialogConfigUIModel(Class<E> klass) {
+ this.klass = klass;
+ this.current = newConfig();
+ this.modifieds = EnumSet.noneOf(klass);
+ this.unvalids = EnumSet.noneOf(klass);
+ }
+
+ public EnumSet<E> getCheckedKeysSet() {
+ if (checkedKeysSet == null) {
+ if (uncheckedKeys != null) {
+ checkedKeysSet = EnumSet.complementOf(uncheckedKeys);
+ } else {
+ checkedKeysSet = EnumSet.allOf(klass);
+ }
+ }
+ return checkedKeysSet;
+ }
+
+ public Object getSrc() {
+ return src;
+ }
+
+ public C getCurrent() {
+ return current;
+ }
+
+ public EnumSet<E> getUnivserse() {
+ return getCurrent().getUniverse();
+ }
+
+ public EnumSet<E> getModifieds() {
+ return modifieds;
+ }
+
+ public EnumSet<E> getUnvalids() {
+ return unvalids;
+ }
+
+ public boolean isModified() {
+ return !modifieds.isEmpty();
+ }
+
+ public boolean isConfigValid() {
+ return unvalids.isEmpty();
+ }
+
+ public void populate(Object src) {
+ this.src = src;
+ this.current = newConfig();
+ if (src != null) {
+ this.current.copyFrom(src);
+ }
+ this.modifieds.clear();
+ this.unvalids.clear();
+ setModified(false);
+ firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ }
+
+ public void reset() {
+ populate(src);
+ }
+
+ public void setModified(boolean modified) {
+ firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
+ }
+
+ public void setUnvalid(boolean unvalid) {
+ firePropertyChange(UNVALID_PROPERTY_CHANGED, null, unvalid);
+ }
+
+ public void addModified(E key) {
+ if (!modifieds.contains(key)) {
+ modifieds.add(key);
+ log.debug(key);
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void removeModified(E key) {
+
+ if (modifieds.contains(key)) {
+ modifieds.remove(key);
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void removeModified(EnumSet<E> keys) {
+ for (E key : keys) {
+ if (modifieds.contains(key)) {
+ modifieds.remove(key);
+ }
+ }
+ setModified(!modifieds.isEmpty());
+ }
+
+ public void setUnvalids(EnumSet<E> keys) {
+ for (E key : keys) {
+ if (!unvalids.contains(key)) {
+ unvalids.add(key);
+ }
+ }
+ for (E key : EnumSet.complementOf(keys)) {
+ if (unvalids.contains(key)) {
+ unvalids.remove(key);
+ }
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+
+ public void addUnvalid(E key) {
+ if (!unvalids.contains(key)) {
+ unvalids.add(key);
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+ public void removeUnvalid(E key) {
+ if (unvalids.contains(key)) {
+ unvalids.remove(key);
+ }
+ setUnvalid(!unvalids.isEmpty());
+ }
+
+ public void save() {
+ current.copyTo(src, modifieds);
+ modifieds.clear();
+ // redisplay config
+ firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
+ }
+
+ public void changeModifiedState(E key, Object uiValue, Object currentValue) {
+ if (uiValue!=null && uiValue.equals(currentValue)) {
+ removeModified(key);
+ } else {
+ addModified(key);
+ }
+ }
+
+ public void clear(E key) {
+ log.info(key);
+ modifieds.remove(key);
+ unvalids.remove(key);
+ }
+
+ protected void validateProperty(E key, Object uiValue) {
+ if (isValid(key, uiValue)) {
+ removeUnvalid(key);
+ } else {
+ addUnvalid(key);
+ }
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,43 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util.config;
+
+import org.codelutin.jaxx.util.AbstractUIAction;
+import org.codelutin.jaxx.util.DialogUI;
+import org.codelutin.jaxx.util.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class ResetAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public ResetAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("reset-config"), dialogUI);
+ if (showLabel) {
+ String text = org.codelutin.i18n.I18n._("lutinui.config.reset");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.codelutin.i18n.I18n._("lutinui.config.reset.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ getHandler().getModel().reset();
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java (from rev 1237, jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java)
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java (rev 0)
+++ jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -0,0 +1,50 @@
+/**
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * 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 org.codelutin.jaxx.util.config;
+
+import org.codelutin.jaxx.util.AbstractUIAction;
+import org.codelutin.jaxx.util.DialogUI;
+import org.codelutin.jaxx.util.UIHelper;
+
+import java.awt.event.ActionEvent;
+
+/** @author chemit */
+public class SaveAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
+ private static final long serialVersionUID = 1L;
+
+ public SaveAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
+ super(null, UIHelper.createActionIcon("save-config"), dialogUI);
+ if (showLabel) {
+ String text = org.codelutin.i18n.I18n._("lutinui.config.save");
+ putValue(NAME, text);
+ putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
+ putValue(MNEMONIC_KEY, (int) text.charAt(0));
+ }
+ String libelle = org.codelutin.i18n.I18n._("lutinui.config.save.tooltip");
+ putValue(SHORT_DESCRIPTION, libelle);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ if (getHandler().prepareSave()) {
+
+ // save model to src
+ getHandler().getModel().save();
+
+ // close ui
+ getUi().dispose();
+ }
+ }
+}
Property changes on: jaxx/trunk/jaxx-swing-action/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-en_GB.properties
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-en_GB.properties 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-en_GB.properties 2009-02-23 13:06:52 UTC (rev 1241)
@@ -2,3 +2,9 @@
jaxx.error.close.actions.file=Error while closing file of actions
jaxx.error.load.actions.class=Error while loading actions
jaxx.error.load.actions.file=Error while loading file of actions
+lutinui.config.cancel=Cancel
+lutinui.config.cancel.tooltip=Cancel and quit
+lutinui.config.reset=Reset
+lutinui.config.reset.tooltip=Reset configuration
+lutinui.config.save=Save
+lutinui.config.save.tooltip=Save configuration and quit
Modified: jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-fr_FR.properties
===================================================================
--- jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-fr_FR.properties 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-swing-action/src/main/resources/i18n/jaxx-swing-action-fr_FR.properties 2009-02-23 13:06:52 UTC (rev 1241)
@@ -2,3 +2,9 @@
jaxx.error.close.actions.file=Erreur lors de la fermeture du fichier d'actions
jaxx.error.load.actions.class=Erreur lors du chargement des actions
jaxx.error.load.actions.file=Erreur lors du chargement du fchier d'actions
+lutinui.config.cancel=Annuler
+lutinui.config.cancel.tooltip=Annuler les modification et quitter
+lutinui.config.reset=R\u00E9initialiser
+lutinui.config.reset.tooltip=R\u00E9initialiser la configuration
+lutinui.config.save=Sauver
+lutinui.config.save.tooltip=Sauver la configuration et quitter
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,53 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/** @author chemit */
-public abstract class AbstractUIAction<H extends DialogUIHandler<?, ?>> extends javax.swing.AbstractAction {
-
- protected static Log log = LogFactory.getLog(AbstractUIAction.class);
-
- protected transient DialogUI<? extends H> ui;
-
- private static final long serialVersionUID = 1L;
-
- protected AbstractUIAction(String name, javax.swing.Icon icon, DialogUI<? extends H> ui) {
- super(name, icon);
- this.ui = ui;
- }
-
- protected H getHandler() {
- checkInit();
- return ui.getHandler();
- }
-
- protected void setUi(DialogUI<? extends H> ui) {
- this.ui = ui;
- }
-
- public DialogUI<? extends H> getUi() {
- return ui;
- }
-
- protected void checkInit() throws IllegalStateException {
- /*if (ui == null) {
- throw new IllegalStateException("no handler, nor ui referenced in " + this);
- } */
- }
-
-}
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUI.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUI.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUI.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,129 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractButton;
-import javax.swing.ImageIcon;
-import javax.swing.JDialog;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.lang.reflect.Constructor;
-
-/**
- * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
- * <p/>
- * TODO : make jaxx authorized implementing interface for root tag :)
- *
- * @author chemit
- */
-public abstract class DialogUI<H extends DialogUIHandler> extends JDialog implements WindowListener {
-
- protected static Log log = LogFactory.getLog(DialogUI.class);
-
- public javax.swing.AbstractAction newAction(Class<?> actionClass, Object... params) {
- Constructor<?> constructor = null;
- for (Constructor<?> cons : actionClass.getConstructors()) {
- Class<?>[] prototype = cons.getParameterTypes();
- if (prototype.length > 0 && DialogUI.class.isAssignableFrom(prototype[0])) {
- // use this constructor
- constructor = cons;
- break;
- }
- }
- if (constructor == null) {
- throw new IllegalStateException("could not find a matching constructor for " + actionClass);
- }
-
- // wrap params
- Object[] parameters = new Object[1 + params.length];
- parameters[0] = this;
- System.arraycopy(params, 0, parameters, 1, params.length);
- try {
- AbstractAction action = (AbstractAction) constructor.newInstance(parameters);
- if (log.isInfoEnabled()) {
- log.info(action);
- }
- return action;
- } catch (Exception e) {
- throw new IllegalStateException("could not init the action " + actionClass + " for reason : " + e.getMessage());
- }
- }
-
- private H handler;
-
- public abstract AbstractButton getHelp();
-
- public abstract Object getObjectById(java.lang.String s);
-
- protected DialogUI() {
- UIHelper.setQuitAction(this);
- addWindowListener(this);
- //TODO will be handled by jaxx with javax.help...
- //getHelp().setAction(newAction(HelpAction.class));
- }
-
- public H getHandler() {
- return handler;
- }
-
- public void setHandler(H handler) {
- this.handler = handler;
- }
-
- protected ImageIcon createActionIcon(String name) {
- return UIHelper.createActionIcon(name);
- }
-
- public void windowOpened(WindowEvent e) {
- }
-
- public void windowClosed(WindowEvent e) {
- }
-
- public void windowClosing(WindowEvent e) {
- }
-
- public void windowIconified(WindowEvent e) {
- }
-
- public void windowDeiconified(WindowEvent e) {
- }
-
- public void windowActivated(WindowEvent e) {
- }
-
- public void windowDeactivated(WindowEvent e) {
- }
-
- @Override
- public synchronized void addWindowListener(WindowListener l) {
- super.addWindowListener(l);
- if (log.isDebugEnabled()) {
- log.debug("after added (" + getWindowListeners().length + ") : " + l);
- }
- }
-
- @Override
- public synchronized void removeWindowListener(WindowListener l) {
- super.removeWindowListener(l);
- if (log.isDebugEnabled()) {
- log.debug("after removed (" + getWindowListeners().length + ") : " + l);
- }
- }
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIDef.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,235 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import static org.codelutin.i18n.I18n._;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.ImageIcon;
-import java.lang.reflect.Constructor;
-
-/**
- * Definition of an ui, with his model, handler and ui class definitions.
- * <p/>
- * The class contains also a shared instace of concrete ui.
- *
- * @author chemit
- */
-public class DialogUIDef<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> implements java.io.Serializable {
-
- static protected final Log log = LogFactory.getLog(DialogUIDef.class);
-
- public static <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> DialogUIDef<M, U, H> newDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass, String showActionLibelle, String showActionTip, String uiTitle) {
- DialogUIDef<M, U, H> result;
- result = new DialogUIDef<M, U, H>(handlerClass, uiClass, modelClass, showActionLibelle, showActionTip, uiTitle);
- return result;
- }
-
- /**
- * model class
- */
- private final Class<M> modelClass;
-
- /**
- * handler class
- */
- private final Class<H> handlerClass;
-
- /**
- * abstract ui class
- */
- private final Class<U> uiClass;
-
- /**
- * concrete lookup ui class
- */
- private Class<? extends U> uiImplClass;
-
- /**
- * shared instance of ui
- */
- protected U uiInstance;
-
- /**
- * unique name of ui def
- */
- protected final String name;
-
- protected final String uiTitle;
- protected final String showActionLibelle;
- protected final String showActionTip;
-
- protected ImageIcon showUIActionIcon;
-
-
- private static final long serialVersionUID = 1L;
-
- private DialogUIDef(Class<H> handlerClass, Class<U> uiClass, Class<M> modelClass,
- String showActionLibelle, String showActionTip, String uiTitle) {
- this.handlerClass = handlerClass;
- this.uiClass = uiClass;
- this.modelClass = modelClass;
- this.showActionLibelle = showActionLibelle;
- this.name = uiClass.getSimpleName().toLowerCase();
- this.showActionTip = showActionTip;
- this.uiTitle = uiTitle;
- }
-
- public Class<U> getUiClass() {
- return uiClass;
- }
-
- public Class<H> getHandlerClass() {
- return handlerClass;
- }
-
- public Class<M> getModelClass() {
- return modelClass;
- }
-
- public Class<? extends U> getUiImplClass() {
- return uiImplClass;
- }
-
- public String getUiTitle() {
- return _(uiTitle);
- }
-
- public String getShowActionLibelle() {
- return _(showActionLibelle);
- }
-
- public String getShowActionTip() {
- return _(showActionTip);
- }
-
- public ImageIcon getShowUIActionIcon() {
- if (showUIActionIcon == null) {
- showUIActionIcon = UIHelper.createActionIcon("show-" + name);
- }
- return showUIActionIcon;
- }
-
- @SuppressWarnings({"unchecked"})
- public void setUiImplClass(Class<?> uiImplClass) {
- this.uiImplClass = (Class<? extends U>) uiImplClass;
- }
-
- @Override
- public boolean equals(Object o) {
- return this == o || o instanceof DialogUIDef && uiClass.equals(((DialogUIDef) o).uiClass);
- }
-
- @Override
- public int hashCode() {
- return uiClass.hashCode();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(super.toString()).append('<');
- sb.append(printClass("handler", handlerClass, true));
- sb.append(printClass("model", modelClass, true));
- sb.append(printClass("ui", uiClass, true));
- sb.append(printClass("uiImpl", uiImplClass, false));
- return sb.toString();
- }
-
- protected U getUiInstance() {
- // no lazy instanciation, to control ui instanciation...
- /*if (uiInstance == null) {
- if (uiImplClass == null) {
- throw new IllegalStateException("no concrete ui impl found in " + this);
- }
- synchronized (this) {
- try {
- uiInstance = uiImplClass.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this,e);
- }
- }
- }*/
- return uiInstance;
- }
-
- protected void setUiInstance(U uiInstance) {
- this.uiInstance = uiInstance;
- }
-
- protected U newUI() {
- if (uiImplClass == null) {
- throw new IllegalStateException("no concrete ui impl found in " + this);
- }
- try {
- U result = uiImplClass.newInstance();
- log.info(result);
- return result;
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this, e);
- }
- }
-
- protected M newModel() {
- if (modelClass == null) {
- throw new IllegalStateException("no model impl found in " + this);
- }
- try {
- M model = modelClass.newInstance();
- log.info(model);
- return model;
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this, e);
- }
- }
-
- protected H newHandler(U ui, M model, Object... params) {
- if (handlerClass == null) {
- throw new IllegalStateException("no handler impl found in " + this);
- }
- try {
- Class[] prototype = getHandlerPrototype(params);
- Object[] parameters = getHandlerParameters(ui, model, params);
- H result = handlerClass.getConstructor(prototype).newInstance(parameters);
- log.info(result);
- return result;
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui " + this, e);
- }
- }
-
- protected Object[] getHandlerParameters(U ui, M model, Object[] params) {
- Object[] result = new Object[2 + params.length];
- result[0] = ui;
- result[1] = model;
- System.arraycopy(params, 0, result, 2, params.length);
- return result;
- }
-
- protected Class[] getHandlerPrototype(Object[] params) {
- int length = params.length;
- for (Constructor<?> constructor : handlerClass.getConstructors()) {
- Class<?>[] prototype = constructor.getParameterTypes();
- if (prototype.length == 2 + length && prototype[0] == uiClass && prototype[1] == modelClass) {
- return prototype;
- }
- }
- throw new IllegalStateException("could not find a matching constructor in " + handlerClass);
- }
-
- protected String printClass(String s, Class<?> aClass, boolean notLast) {
- return s + ':' + (aClass == null ? null : aClass.getSimpleName()) + (notLast ? ", " : ">");
- }
-}
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIHandler.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,70 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.awt.event.WindowListener;
-import java.beans.PropertyChangeListener;
-
-/**
- * DialogUI handler
- *
- * @author chemit
- */
-public abstract class DialogUIHandler<M extends DialogUIModel, U extends DialogUI<? extends DialogUIHandler>> implements PropertyChangeListener {
-
- protected static Log log = LogFactory.getLog(DialogUIHandler.class);
-
- /** ui handled */
- private U ui;
-
- /** model handled */
- private M model;
-
- protected DialogUIHandler(U ui, M model) {
- this.ui = ui;
- this.model = model;
- }
-
- public U getUi() {
- return ui;
- }
-
- public M getModel() {
- return model;
- }
-
- public void init() {
- if (model == null) {
- throw new IllegalStateException("no model was defined for " + this);
- }
- model.addPropertyChangeListener(this);
- }
-
- public void dispose() {
- model.dispose();
- for (WindowListener windowListener : getUi().getWindowListeners()) {
- getUi().removeWindowListener(windowListener);
- }
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- dispose();
- }
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/DialogUIModel.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,97 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-/**
- * Abstract ui model, with property change support.
- *
- * @author chemit
- */
-public abstract class DialogUIModel {
-
- static protected final Log log = LogFactory.getLog(DialogUIModel.class);
-
- /** support for change properties support */
- protected PropertyChangeSupport changeSupport;
-
- public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- if (listener == null) {
- return;
- }
- if (changeSupport == null) {
- changeSupport = new PropertyChangeSupport(this);
- }
- changeSupport.addPropertyChangeListener(propertyName, listener);
- }
-
- public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null) {
- return;
- }
- if (changeSupport == null) {
- changeSupport = new PropertyChangeSupport(this);
- }
- changeSupport.addPropertyChangeListener(listener);
- }
-
- public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null || changeSupport == null) {
- return;
- }
- changeSupport.removePropertyChangeListener(listener);
- }
-
- public synchronized void removePropertyChangeListeners() {
- if (changeSupport == null) {
- return;
- }
- for (PropertyChangeListener listener : getPropertyChangeListeners()) {
- changeSupport.removePropertyChangeListener(listener);
- }
- }
-
- public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
- if (changeSupport == null) {
- return new PropertyChangeListener[0];
- }
- return changeSupport.getPropertyChangeListeners();
- }
-
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
- if (changeSupport == null || (oldValue == null && newValue == null) ||
- (oldValue != null && oldValue.equals(newValue))) {
- return;
- }
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
- }
-
- public void dispose() {
- for (PropertyChangeListener listener : changeSupport.getPropertyChangeListeners()) {
- changeSupport.removePropertyChangeListener(listener);
- }
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- dispose();
- }
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,84 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-/**
- * A windowListenr for ui managed by {@link org.codelutin.jaxx.util.UIFactory}.
- * <p/>
- * To be used when all ui from factory are closed, via {@link #allWindowsClosed(java.awt.event.WindowEvent)} method.
- *
- * @author chemit
- */
-public abstract class FactoryWindowListener extends WindowAdapter {
-
- /**
- * method to be invoked when all ui registred in factory are really disposed.
- *
- * @param e event
- */
- public abstract void allWindowsClosed(WindowEvent e);
-
- /** underlying factory of ui */
- private UIFactory factory;
-
- /** flag to make sure {@link #allWindowsClosed(java.awt.event.WindowEvent)} is called only once. */
- private boolean wasClosed;
-
- @Override
- public void windowClosed(WindowEvent e) {
- if (UIFactory.log.isDebugEnabled()) {
- UIFactory.log.debug(this + " : " + e);
- }
- if (e.getWindow().isVisible()) {
- // only deal with real closed and none visible windows...
- return;
- }
- for (DialogUIDef def : factory.getDefs()) {
- DialogUI ui = def.uiInstance;
- if (ui != null && ui.isVisible()) {
- // at least one ui visible, do not close all
- return;
- }
- }
-
- if (wasClosed) {
- // make sure to process only once
- return;
- }
- if (UIFactory.log.isInfoEnabled()) {
- UIFactory.log.info("closing factory listener " + this);
- }
-
- synchronized (this) {
- try {
- allWindowsClosed(e);
- } finally {
- wasClosed = true;
- factory.removeFactoryWindowListener(this);
- }
- }
- }
-
- protected UIFactory getFactory() {
- return factory;
- }
-
- protected void setFactory(UIFactory factory) {
- this.factory = factory;
- }
-}
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FormElement.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FormElement.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/FormElement.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,29 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-/** @author chemit */
-public interface FormElement<U extends DialogUI> {
-
- String name();
-
- int ordinal();
-
- Object getValue(U ui);
-
- void setValue(U ui, String value);
-
- javax.swing.JLabel getLabel(U ui);
-}
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,135 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public abstract class ShowUIAction<M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> extends javax.swing.AbstractAction {
-
- protected static Log log = LogFactory.getLog(AbstractUIAction.class);
-
- protected transient DialogUI<?> ui;
-
- private static final long serialVersionUID = 1L;
-
- protected DialogUIDef<M, U, H> uiDef;
-
- protected transient UIFactory factory;
-
- protected String position;
-
- protected boolean undecorated = true;
-
- protected U initUI(ActionEvent e) {
- return getFactory().getUI(uiDef);
- }
-
- public ShowUIAction(DialogUI<?> ui, DialogUIDef<M, U, H> uiDef, UIFactory factory, boolean showText) {
- super(uiDef.getShowActionLibelle(), uiDef.getShowUIActionIcon());
- this.ui = ui;
- this.uiDef = uiDef;
- String name = (String) getValue(NAME);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, name.length() - 1);
- putValue(ACCELERATOR_KEY, (int) name.charAt(name.length() - 1));
- if (!showText) {
- putValue(NAME, null);
- }
- putValue(SHORT_DESCRIPTION, uiDef.getShowActionTip());
- this.factory = factory;
- }
-
- public DialogUI<?> getUi() {
- return ui;
- }
-
- public DialogUIDef<M, U, H> getUiDef() {
- return uiDef;
- }
-
- public UIFactory getFactory() {
- return factory;
- }
-
- public void setUiDef(DialogUIDef<M, U, H> uiDef) {
- this.uiDef = uiDef;
- }
-
- public void setPosition(String position) {
- this.position = position;
- }
-
- public void setUndecorated(boolean undecorated) {
- this.undecorated = undecorated;
- }
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- checkInit();
- U ui = initUI(e);
- ui.setTitle(uiDef.getUiTitle());
- log.info(ui.getTitle());
- //TODO ui.setUndecorated(undecorated);
- setPosition(this.getUi(), ui, position);
-
- ui.setVisible(true);
- }
-
- protected void setPosition(javax.swing.JDialog parentUI, javax.swing.JDialog ui, String position) {
- if (position == null || parentUI == null) {
- return;
- }
- Point parentLocation = parentUI.getLocationOnScreen();
- Dimension parentSize = parentUI.getSize();
-
- if (position.equals("bottom-left")) {
- int top = (int) (parentLocation.getY() + parentSize.getHeight());
- int left = (int) (parentLocation.getX());
- Point newLocation = new Point(left, top);
- newLocation.setLocation(left, top);
- ui.setLocation(newLocation);
- return;
- }
- if (position.equals("top-left")) {
- int top = (int) (parentLocation.getY());
- int left = (int) (parentLocation.getX());
- Point newLocation = new Point(left, top);
- newLocation.setLocation(left, top);
- ui.setLocation(newLocation);
- return;
- }
- if (position.equals("top-right")) {
- int top = (int) (parentLocation.getY());
- int left = (int) (parentLocation.getX() + parentSize.getWidth());
- Point newLocation = new Point(left, top);
- newLocation.setLocation(left, top);
- ui.setLocation(newLocation);
- return;
- }
- if (position.equals(("center"))) {
- //TODO
- }
- }
-
- protected void checkInit() throws IllegalStateException {
- if (factory == null) {
- throw new IllegalStateException("no factory found in " + this);
- }
- }
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIFactory.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIFactory.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIFactory.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,184 +0,0 @@
-/**
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.StringUtil;
-
-import javax.swing.event.EventListenerList;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ServiceLoader;
-
-/**
- * Factory for UI, using a cache and a provider to find ui implementations.
- *
- * @author chemit
- */
-public class UIFactory {
-
- static protected final Log log = LogFactory.getLog(UIFactory.class);
-
- private final String applicationName;
-
- private final DialogUIDef[] defs;
-
- private final EventListenerList listeners;
-
- public UIFactory(String applicationName, DialogUIDef[] defs, FactoryWindowListener... listeners) {
- this.applicationName = applicationName;
- this.listeners = new EventListenerList();
- for (FactoryWindowListener listener : listeners) {
- listener.setFactory(this);
- addFactoryWindowListener(listener);
- }
- this.defs = defs;
- long t0 = System.nanoTime();
- if (log.isDebugEnabled()) {
- log.debug("start at " + new java.util.Date());
- }
- try {
- init();
- } catch (Exception e) {
- log.error(e);
- throw new RuntimeException(e);
- } finally {
- if (log.isDebugEnabled()) {
- log.info("end in " + StringUtil.convertTime(t0, System.nanoTime()));
- }
- }
- }
-
- public void addFactoryWindowListener(FactoryWindowListener l) {
- listeners.add(FactoryWindowListener.class, l);
- if (log.isDebugEnabled()) {
- log.debug("after added (" + listeners.getListenerCount() + ") : " + l);
- }
- }
-
- public void removeFactoryWindowListener(FactoryWindowListener l) {
- listeners.remove(FactoryWindowListener.class, l);
- for (DialogUIDef def : getDefs()) {
- if (def.uiInstance != null) {
- def.uiInstance.removeWindowListener(l);
- }
- }
- if (log.isDebugEnabled()) {
- log.debug(" after removed (" + listeners.getListenerCount() + ") : " + l);
- }
- if (listeners.getListenerCount(FactoryWindowListener.class) == 0) {
- // close for real factory
- close();
- }
- }
-
- public void close() {
- log.info(this + " at " + new java.util.Date());
- for (DialogUIDef<?, ?, ?> def : defs) {
- DialogUI<?> ui = def.uiInstance;
- if (ui != null) {
- ui.getHandler().dispose();
- def.uiInstance = null;
- }
- }
- if (listeners.getListenerCount(FactoryWindowListener.class) > 0) {
- log.warn("some listeners where not properly removed, force deletion...");
- for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
- removeFactoryWindowListener(listener);
- }
- }
-
- }
-
- protected void init() {
-
- UIProvider[] providers = detectProviders();
-
- for (DialogUIDef<?, ?, ?> def : defs) {
- initDef(providers, def);
- if (def.getUiImplClass() == null) {
- throw new IllegalStateException("could not find implementation for ui def " + def);
- }
- }
- }
-
- protected void initDef(UIProvider[] providers, DialogUIDef<?, ?, ?> def) {
- for (UIProvider provider : providers) {
- Class<?> uiImplClass = provider.findUIImplementation(def);
- if (uiImplClass != null) {
- if (log.isDebugEnabled()) {
- log.debug("init done for " + def);
- }
- // ui implementation was found
- break;
- }
- }
- }
-
- protected UIProvider[] detectProviders() {
- long t0 = System.nanoTime();
- List<UIProvider> providers = new ArrayList<UIProvider>();
- for (UIProvider provider : ServiceLoader.load(UIProvider.class)) {
- if (applicationName.equals(provider.getApplicationName())) {
- if (log.isDebugEnabled()) {
- log.debug("provider detected [" + provider + ']');
- }
- providers.add(provider);
- }
- }
- log.info("found " + providers.size() + " ui provider(s) in " + StringUtil.convertTime(t0, System.nanoTime()) + " : " + providers);
- return providers.toArray(new UIProvider[providers.size()]);
- }
-
- protected DialogUIDef[] getDefs() {
- return defs;
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- close();
- }
-
- public <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> U getUI(DialogUIDef<M, U, H> uiType, Object... params) {
- U ui = uiType.uiInstance;
- if (ui == null) {
- try {
- ui = uiType.newUI();
- M model = uiType.newModel();
- H handler = uiType.newHandler(ui, model, params);
- registerUI(uiType, ui, handler);
- } catch (Exception e) {
- throw new IllegalStateException("could not instanciate ui handler " + uiType + " for reason : " + e.getMessage(), e);
- }
- }
- return ui;
- }
-
- protected <M extends DialogUIModel, U extends DialogUI<H>, H extends DialogUIHandler<M, U>> void registerUI(DialogUIDef<M, U, H> uiType, U ui, H handler) {
- ui.setHandler(handler);
- handler.init();
- uiType.setUiInstance(ui);
- for (FactoryWindowListener listener : listeners.getListeners(FactoryWindowListener.class)) {
- if (log.isDebugEnabled()) {
- log.debug("----- addFactoryWindowListener " + listener + " to " + ui);
- }
- ui.addWindowListener(listener);
- }
- }
-
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIHelper.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIHelper.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIHelper.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,70 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit
-*
-* 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 org.codelutin.jaxx.util;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.ImageIcon;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JRootPane;
-import javax.swing.KeyStroke;
-import java.awt.event.ActionEvent;
-
-/**
- * Ui helper class.
- *
- * @author tony
- */
-public class UIHelper {
-
- public static ImageIcon createImageIcon(String path) {
- java.net.URL imgURL = UIHelper.class.getResource("/icons/" + path);
- if (imgURL != null) {
- return new ImageIcon(imgURL);
- } else {
- throw new IllegalArgumentException("could not find icon " + path);
- }
- }
-
- /**
- * Attach to <code>ui</code> an abort action,accessible by <code>ESC</code> key.
- *
- * @param ui ui
- */
- public static void setQuitAction(final JDialog ui) {
- JRootPane rootPane = ui.getRootPane();
-
- Action quitAction = new AbstractAction("quit") {
- private static final long serialVersionUID = -869095664995763057L;
-
- public void actionPerformed(ActionEvent e) {
- ui.dispose();
- }
- };
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
- rootPane.getActionMap().put("quit", quitAction);
- ui.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
- }
-
- public static ImageIcon createActionIcon(String name) {
- return createImageIcon("action-" + name + ".png");
- }
-
-}
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIProvider.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIProvider.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/UIProvider.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,86 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util;
-
-/** @author chemit */
-public abstract class UIProvider {
-
- /** the name of application using this provider */
- protected String applicationName;
-
- /** the name of ui implementation used by this provider */
- protected String providerName;
-
- /** array of ui implementations */
- protected Class<?>[] implementations;
-
- protected UIProvider(String applicationName, String providerName, Class<?>... implementations) {
- this.applicationName = applicationName;
- this.providerName = providerName;
- this.implementations = implementations;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public String getApplicationName() {
- return applicationName;
- }
-
- public Class<?>[] getImplementations() {
- return implementations;
- }
-
- public Class<?> findUIImplementation(DialogUIDef<?, ?, ?> def) {
- Class<? extends DialogUI<?>> uiClass = def.getUiClass();
- for (Class<?> klass : implementations) {
- if (uiClass.isAssignableFrom(klass)) {
- def.setUiImplClass(klass);
- return klass;
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(super.toString()).append('<');
- sb.append(printClass("application", applicationName, true));
- sb.append(printClass("provider", providerName, true));
- sb.append(printClass("uis", implementations.length, false));
- return sb.toString();
- }
-
- protected String printClass(String s, Object aClass, boolean notLast) {
- return s + ':' + (aClass == null ? null : aClass) + (notLast ? ", " : ">");
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof UIProvider)) return false;
-
- UIProvider that = (UIProvider) o;
- return applicationName.equals(that.applicationName) && providerName.equals(that.providerName);
-
- }
-
- @Override
- public int hashCode() {
- return (31 * applicationName.hashCode()) + providerName.hashCode();
- }
-
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/CancelAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,43 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.AbstractUIAction;
-import org.codelutin.jaxx.util.DialogUI;
-import org.codelutin.jaxx.util.UIHelper;
-
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public class CancelAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
- private static final long serialVersionUID = 1L;
-
- public CancelAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
- super(null, UIHelper.createActionIcon("cancel-config"), dialogUI);
- if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.cancel");
- putValue(NAME, text);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
- putValue(MNEMONIC_KEY, (int) text.charAt(0));
- }
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.cancel.tooltip");
- putValue(SHORT_DESCRIPTION, libelle);
-
- }
-
- public void actionPerformed(ActionEvent e) {
- getUi().dispose();
- }
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUI.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,105 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.DialogUI;
-
-import javax.swing.AbstractButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPasswordField;
-import javax.swing.JRadioButton;
-import javax.swing.JTextField;
-
-/**
- * A abstract dialog contract to be realised by a dialogUI (WindowEvent adapter)
- * <p/>
- * TODO : make jaxx authorized implementing interface for root tag :)
- *
- * @author chemit
- */
-public abstract class DialogConfigUI<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends DialogUI<H> {
-
- public abstract AbstractButton getOk();
-
- public abstract AbstractButton getReset();
-
- public abstract AbstractButton getCancel();
-
- public JComponent getElement(E key) {
- Object id = getObjectById(key.name());
- if (id == null) {
- log.error(new NullPointerException("no widget for key "+key));
- return null;
- }
- if (!(id instanceof JComponent)) {
- throw new IllegalArgumentException(id + " is not a JComponent");
- }
- return (JComponent) id;
- }
-
- public Object getElementValue(E key) {
- JComponent o = getElement(key);
- if (o instanceof JPasswordField) {
- return new String(((JPasswordField) o).getPassword());
- }
- if (o instanceof JTextField) {
- return ((JTextField) o).getText();
- }
- if (o instanceof JRadioButton) {
- return ((JRadioButton) o).isSelected();
- }
- if (o instanceof JCheckBox) {
- return ((JCheckBox) o).isSelected();
- }
-
- if (o instanceof JComboBox) {
- return ((JComboBox) o).getSelectedItem();
- }
- return "";
- }
-
- public void setElementValue(E key, Object value) {
- JComponent o = getElement(key);
-
- String strValue = value == null ? "" : String.valueOf(value);
- if (o instanceof JPasswordField) {
- ((JPasswordField) o).setText(strValue);
- }
- if (o instanceof JTextField) {
- ((JTextField) o).setText(strValue);
- }
- if (o instanceof JRadioButton) {
- ((JRadioButton) o).setSelected(Boolean.valueOf(strValue.isEmpty() ? "false" : strValue));
- }
- if (o instanceof JCheckBox) {
- ((JCheckBox) o).setSelected(Boolean.valueOf(strValue.isEmpty() ? "false" : strValue));
- }
- if (o instanceof JComboBox) {
- ((JComboBox) o).setSelectedItem(value);
- }
- }
-
- public JLabel getElementLabel(E key) {
- return (JLabel) getObjectById(key.name() + "Label");
- }
-
- public void doCheck(E key) {
- getHandler().doCheck(key);
- }
-
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIHandler.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,156 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.DialogUIHandler;
-import org.codelutin.util.ConverterUtil;
-import org.codelutin.util.config.Config;
-import org.codelutin.util.config.Property;
-
-import javax.swing.JComponent;
-import java.awt.Color;
-import java.beans.PropertyChangeEvent;
-import java.util.EnumMap;
-import java.util.EnumSet;
-
-/**
- * DialogUI handler
- *
- * @author chemit
- */
-public abstract class DialogConfigUIHandler<E extends Enum<E>, M extends DialogConfigUIModel<E, ?>, U extends DialogConfigUI<E, ?>> extends DialogUIHandler<M, U> {
-
- protected DialogConfigUIHandler(U ui, M model) {
- super(ui, model);
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- String action = evt.getPropertyName();
-
- if (DialogConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
- // update ui with model values,
- populateUI();
- // revalidate form
- doCheckAll();
- return;
- }
-
- if (DialogConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
- Boolean newValue = (Boolean) evt.getNewValue();
- boolean modified = newValue != null && newValue;
- getUi().getReset().setEnabled(modified);
- getUi().getOk().setEnabled(modified && getModel().isConfigValid());
- return;
- }
-
- if (DialogConfigUIModel.UNVALID_PROPERTY_CHANGED.equals(action)) {
- updateUI();
- return;
- }
-
- throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
- }
-
- public void doCheck(E key) {
- Object uiValue = getUi().getElementValue(key);
- DialogConfigUIModel<E, ?> model = getModel();
- Object currentValue = model.getCurrent().getProperty(key);
- if (currentValue == null) {
- currentValue = "";
- } else {
- currentValue = String.valueOf(currentValue);
- }
-
- model.validateProperty(key, uiValue);
- model.changeModifiedState(key, uiValue, currentValue);
- }
-
- public void doCheckAll() {
- DialogConfigUIModel<E, ?> model = getModel();
- EnumSet<E> unvalids = EnumSet.noneOf(model.klass);
- for (E e : model.getCheckedKeysSet()) {
- Object uiValue = getUi().getElementValue(e);
- if (!model.isValid(e, uiValue)) {
- unvalids.add(e);
- }
- }
- model.setUnvalids(unvalids);
- unvalids.clear();
- }
-
- protected boolean prepareSave() {
- DialogConfigUI<E, ?> ui = getUi();
- DialogConfigUIModel<E, ?> model = getModel();
-
- Config<E> current = model.getCurrent();
-
- if (!model.isConfigValid()) {
- log.warn("do not save a unvalid config : " + model.getUnvalids());
- return false;
- }
-
- if (!model.isModified()) {
- log.warn("nothing to save");
- return false;
- }
- EnumSet<E> toTreate = model.getCheckedKeysSet();
- // transfert checkable values from ui to model
- for (E key : model.getModifieds()) {
- if (!toTreate.contains(key)) {
- continue;
- }
- Object value = ui.getElementValue(key);
- Class<?> type = ((Property) key).getType();
- Object newValue = ConverterUtil.convert(type, value);
- current.setProperty(key, newValue);
- }
-
- return true;
- }
-
- protected void populateUI() {
- U ui = getUi();
- EnumMap<E, Object> map = getModel().getCurrent().getProperties();
- for (E e : getModel().getCheckedKeysSet()) {
- Object value = map.get(e);
- populateUI(ui, e, value);
- }
- }
-
- protected void populateUI(U ui, E key, Object value) {
- ui.setElementValue(key, value);
- }
-
- protected void updateUI() {
- EnumSet<E> unvalids = getModel().getUnvalids();
- for (E key : unvalids) {
- setLabelColor(key, false);
- }
- for (E key : EnumSet.complementOf(unvalids)) {
- setLabelColor(key, true);
- }
- }
-
- protected void setLabelColor(E key, boolean valid) {
- JComponent component = getUi().getElementLabel(key);
- if (component != null && component.isVisible()) {
- component.setForeground(valid ? Color.black : Color.red);
- }
- }
-
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/DialogConfigUIModel.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,220 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.DialogUIModel;
-import org.codelutin.util.config.Config;
-
-import java.util.EnumSet;
-
-/**
- * Abstract config ui model.
- *
- * @author chemit
- */
-public abstract class DialogConfigUIModel<E extends Enum<E>, C extends Config<E>> extends DialogUIModel {
-
- public static final String CONFIG_PROPERTY_CHANGED = "config";
- public static final String MODIFIED_PROPERTY_CHANGED = "modify";
- public static final String UNVALID_PROPERTY_CHANGED = "unvalid";
-
- /** @return a empty config */
- protected abstract C newConfig();
-
- /**
- * @param key property key
- * @param value value to validate
- * @return <code>true</code> if given value is valid for property, <code>false>/code> otherwise
- */
- protected abstract boolean isValid(E key, Object value);
-
- /**
- * object used to init model and save model, this is an external object.
- * <p/>
- * The object must have bean read-write properties for each value of E
- */
- protected Object src;
-
- /** current config used in model */
- protected C current;
-
- /** set of modified properties */
- protected EnumSet<E> modifieds;
-
- /** set of unvalid properties */
- protected EnumSet<E> unvalids;
-
- /** enum class */
- protected Class<E> klass;
-
- /** set of key not to check */
- protected EnumSet<E> uncheckedKeys;
-
- /** set of all keys checkable */
- protected EnumSet<E> checkedKeysSet;
-
- protected DialogConfigUIModel(Class<E> klass) {
- this.klass = klass;
- this.current = newConfig();
- this.modifieds = EnumSet.noneOf(klass);
- this.unvalids = EnumSet.noneOf(klass);
- }
-
- public EnumSet<E> getCheckedKeysSet() {
- if (checkedKeysSet == null) {
- if (uncheckedKeys != null) {
- checkedKeysSet = EnumSet.complementOf(uncheckedKeys);
- } else {
- checkedKeysSet = EnumSet.allOf(klass);
- }
- }
- return checkedKeysSet;
- }
-
- public Object getSrc() {
- return src;
- }
-
- public C getCurrent() {
- return current;
- }
-
- public EnumSet<E> getUnivserse() {
- return getCurrent().getUniverse();
- }
-
- public EnumSet<E> getModifieds() {
- return modifieds;
- }
-
- public EnumSet<E> getUnvalids() {
- return unvalids;
- }
-
- public boolean isModified() {
- return !modifieds.isEmpty();
- }
-
- public boolean isConfigValid() {
- return unvalids.isEmpty();
- }
-
- public void populate(Object src) {
- this.src = src;
- this.current = newConfig();
- if (src != null) {
- this.current.copyFrom(src);
- }
- this.modifieds.clear();
- this.unvalids.clear();
- setModified(false);
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
- }
-
- public void reset() {
- populate(src);
- }
-
- public void setModified(boolean modified) {
- firePropertyChange(MODIFIED_PROPERTY_CHANGED, null, modified);
- }
-
- public void setUnvalid(boolean unvalid) {
- firePropertyChange(UNVALID_PROPERTY_CHANGED, null, unvalid);
- }
-
- public void addModified(E key) {
- if (!modifieds.contains(key)) {
- modifieds.add(key);
- log.debug(key);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(E key) {
-
- if (modifieds.contains(key)) {
- modifieds.remove(key);
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void removeModified(EnumSet<E> keys) {
- for (E key : keys) {
- if (modifieds.contains(key)) {
- modifieds.remove(key);
- }
- }
- setModified(!modifieds.isEmpty());
- }
-
- public void setUnvalids(EnumSet<E> keys) {
- for (E key : keys) {
- if (!unvalids.contains(key)) {
- unvalids.add(key);
- }
- }
- for (E key : EnumSet.complementOf(keys)) {
- if (unvalids.contains(key)) {
- unvalids.remove(key);
- }
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
-
- public void addUnvalid(E key) {
- if (!unvalids.contains(key)) {
- unvalids.add(key);
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
- public void removeUnvalid(E key) {
- if (unvalids.contains(key)) {
- unvalids.remove(key);
- }
- setUnvalid(!unvalids.isEmpty());
- }
-
- public void save() {
- current.copyTo(src, modifieds);
- modifieds.clear();
- // redisplay config
- firePropertyChange(CONFIG_PROPERTY_CHANGED, null, this);
- }
-
- public void changeModifiedState(E key, Object uiValue, Object currentValue) {
- if (uiValue!=null && uiValue.equals(currentValue)) {
- removeModified(key);
- } else {
- addModified(key);
- }
- }
-
- public void clear(E key) {
- log.info(key);
- modifieds.remove(key);
- unvalids.remove(key);
- }
-
- protected void validateProperty(E key, Object uiValue) {
- if (isValid(key, uiValue)) {
- removeUnvalid(key);
- } else {
- addUnvalid(key);
- }
- }
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/ResetAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,43 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.AbstractUIAction;
-import org.codelutin.jaxx.util.DialogUI;
-import org.codelutin.jaxx.util.UIHelper;
-
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public class ResetAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
- private static final long serialVersionUID = 1L;
-
- public ResetAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
- super(null, UIHelper.createActionIcon("reset-config"), dialogUI);
- if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.reset");
- putValue(NAME, text);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
- putValue(MNEMONIC_KEY, (int) text.charAt(0));
- }
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.reset.tooltip");
- putValue(SHORT_DESCRIPTION, libelle);
-
- }
-
- public void actionPerformed(ActionEvent e) {
- getHandler().getModel().reset();
- }
-}
\ No newline at end of file
Deleted: jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java
===================================================================
--- jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/jaxx-util/src/main/java/org/codelutin/jaxx/util/config/SaveAction.java 2009-02-23 13:06:52 UTC (rev 1241)
@@ -1,50 +0,0 @@
-/**
- * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
- * 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 org.codelutin.jaxx.util.config;
-
-import org.codelutin.jaxx.util.AbstractUIAction;
-import org.codelutin.jaxx.util.DialogUI;
-import org.codelutin.jaxx.util.UIHelper;
-
-import java.awt.event.ActionEvent;
-
-/** @author chemit */
-public class SaveAction<E extends Enum<E>, H extends DialogConfigUIHandler<E, ?, ?>> extends AbstractUIAction<H> {
- private static final long serialVersionUID = 1L;
-
- public SaveAction(DialogUI<? extends H> dialogUI, boolean showLabel) {
- super(null, UIHelper.createActionIcon("save-config"), dialogUI);
- if (showLabel) {
- String text = org.codelutin.i18n.I18n._("lutinui.config.save");
- putValue(NAME, text);
- putValue(DISPLAYED_MNEMONIC_INDEX_KEY, 0);
- putValue(MNEMONIC_KEY, (int) text.charAt(0));
- }
- String libelle = org.codelutin.i18n.I18n._("lutinui.config.save.tooltip");
- putValue(SHORT_DESCRIPTION, libelle);
- }
-
- public void actionPerformed(ActionEvent e) {
-
- if (getHandler().prepareSave()) {
-
- // save model to src
- getHandler().getModel().save();
-
- // close ui
- getUi().dispose();
- }
- }
-}
Modified: jaxx/trunk/pom.xml
===================================================================
--- jaxx/trunk/pom.xml 2009-02-23 13:06:47 UTC (rev 1240)
+++ jaxx/trunk/pom.xml 2009-02-23 13:06:52 UTC (rev 1241)
@@ -18,7 +18,6 @@
<version>1.2-SNAPSHOT</version>
<modules>
- <module>jaxx-util</module>
<module>jaxx-runtime-api</module>
<module>jaxx-runtime-swing</module>
<module>jaxx-runtime-validator</module>
1
0
r1240 - in jaxx/trunk/jaxx-util/src: main/resources site
by tchemit@users.labs.libre-entreprise.org 23 Feb '09
by tchemit@users.labs.libre-entreprise.org 23 Feb '09
23 Feb '09
Author: tchemit
Date: 2009-02-23 13:06:47 +0000 (Mon, 23 Feb 2009)
New Revision: 1240
Removed:
jaxx/trunk/jaxx-util/src/main/resources/i18n/
jaxx/trunk/jaxx-util/src/main/resources/icons/
jaxx/trunk/jaxx-util/src/site/fr/
Log:
- move sources from jaxx-util to jaxx-swing-action module
- delete jaxx-util module
- rename jaxx.runtime.swing.Utils to jaxx.runtime.SwingUtil
1
0
23 Feb '09
Author: tchemit
Date: 2009-02-23 02:06:29 +0000 (Mon, 23 Feb 2009)
New Revision: 1239
Added:
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java
jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java
jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java
jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx
jaxx/trunk/jaxx-example/src/main/resources/icons/
jaxx/trunk/jaxx-example/src/main/resources/icons/action-accept.png
jaxx/trunk/jaxx-example/src/main/resources/icons/action-block.png
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx
Removed:
jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java
Modified:
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java
jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java
jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer
jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java
jaxx/trunk/jaxx-example/
jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx
jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties
jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties
jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java
jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java
jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java
jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java
jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java
jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java
jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml
jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml
Log:
introduce CompiledObjectDecorator.
offer the default implementation, and a boxed one.
refactor plugin tests
begin nromalisation of classnames (should remove Util, Utils and other to have JaxxUtil, SwingUtil,...)
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/DefaultInitializer.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -15,6 +15,8 @@
import jaxx.types.TypeManager;
import java.awt.Component;
+import jaxx.compiler.CompiledObjectDecorator;
+import jaxx.compiler.DefaultCompiledObjectDecorator;
/** Initializes support for java. */
public class DefaultInitializer implements jaxx.spi.Initializer {
@@ -44,5 +46,7 @@
TypeManager.registerTypeConverter(char.class, primitiveConverter);
TypeManager.registerTypeConverter(Character.class, primitiveConverter);
TypeManager.registerTypeConverter(String.class, primitiveConverter);
+
+ CompiledObjectDecorator.registerDecorator("default", DefaultCompiledObjectDecorator.class);
}
}
\ No newline at end of file
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObject.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -83,6 +83,11 @@
/** the type of the override object (can be null if no oveeride) */
private ClassDescriptor overrideType;
+ /**
+ * the decorator (if null will use {@link DefaultCompiledObjectDecorator}).
+ */
+ private CompiledObjectDecorator decorator;
+
public class ChildRef {
CompiledObject child;
String constraints;
@@ -556,24 +561,8 @@
String delegateCode = containerDelegate != null ? "." + containerDelegate + "()" : "";
child.setParent(this);
- /*String javaCode = child.getJavaCode();
- if (compiler.hasValidator()) {
- // some validators are defined on this object
- boolean found = compiler.isComponentUsedByValidator(child.getId());
- if (found) {
- // box the child component in a JxLayer
- javaCode = "jaxx.runtime.Util.boxComponentWithJxLayer(" + javaCode + ")";
- }
- }*/
-
+
childs.add(new ChildRef(child, constraints, child.getJavaCode(), delegateCode));
- /*if (constraints != null) {
- appendAdditionCode(this.javaCode + delegateCode + ".add(" + javaCode + ", " + constraints + ");");
- //appendAdditionCode(getJavaCode() + delegateCode + ".add(" + javaCode + ", " + constraints + ");");
- } else {
- appendAdditionCode(this.javaCode + delegateCode + ".add(" + javaCode + ");");
- //appendAdditionCode(getJavaCode() + delegateCode + ".add(" + javaCode + ");");
- }*/
}
}
@@ -636,6 +625,14 @@
return childs;
}
+ public CompiledObjectDecorator getDecorator() {
+ return decorator;
+ }
+
+ public void setDecorator(CompiledObjectDecorator decorator) {
+ this.decorator = decorator;
+ }
+
public void finalizeCompiler() {
StringBuffer buffer = new StringBuffer();
Added: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java (rev 0)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompiledObjectDecorator.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,76 @@
+package jaxx.compiler;
+
+import java.util.Map;
+import java.util.TreeMap;
+import jaxx.CompilerException;
+
+/**
+ *
+ * A class to decorate a compiled object at generation time.
+ *
+ * Contains also a cache of decorator in a dictonnary indexed by fqn of decorator.
+ *
+ * Use the {@link #getDecorator(java.lang.String)} to obtain the cached decorator.
+ *
+ * Note : The implementation of this class must be stateless.
+ *
+ * @author tony
+ * @since 1.2
+ */
+public abstract class CompiledObjectDecorator {
+
+ protected static Map<String, CompiledObjectDecorator> cache;
+
+ public static void registerDecorator(String key, Class<? extends CompiledObjectDecorator> klass) {
+ synchronized (getCache()) {
+ if (getCache().containsKey(key)) {
+ throw new IllegalArgumentException("the decorator with key [" + key + "] is already registred! use another key name");
+ }
+ try {
+ getCache().put(key, klass.newInstance());
+ } catch (InstantiationException ex) {
+ throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex);
+ } catch (IllegalAccessException ex) {
+ throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex);
+ }
+ }
+ }
+
+ public static CompiledObjectDecorator getDecorator(String name) {
+ CompiledObjectDecorator decorator = getCache().get(name);
+ if (decorator == null) {
+ throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getCache().keySet());
+ }
+ return decorator;
+ }
+
+ public static CompiledObjectDecorator getDecorator(Class<?> type) {
+ for (CompiledObjectDecorator decorator : getCache().values()) {
+ if (type == decorator.getClass()) {
+ return decorator;
+ }
+ }
+ return null;
+ }
+
+ protected static synchronized Map<String, CompiledObjectDecorator> getCache() {
+ if (cache == null) {
+ cache = new TreeMap<String, CompiledObjectDecorator>();
+ }
+ return cache;
+ }
+
+ public static void reset() {
+ if (cache != null) {
+ cache.clear();
+ }
+ }
+
+ public abstract void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName);
+
+ public abstract String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException;
+
+ public abstract boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall);
+
+ public abstract String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings);
+}
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/CompilerOptions.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -43,6 +43,9 @@
/** a flag to use {@link javax.swing.UIManager} to retreave icons. */
private boolean useUIManagerForIcon;
+ /** the default compiled object decorator to use if none specifed via decorator attribute */
+ private Class<? extends CompiledObjectDecorator> defaultDecoratorClass;
+
/**
* Returns the target directory, generally specified with the "-d" option on the command line.
*
@@ -270,4 +273,13 @@
public void setValidatorFQN(String validatorFQN) {
this.validatorFQN = validatorFQN;
}
+
+ public Class<? extends CompiledObjectDecorator> getDefaultDecoratorClass() {
+ return defaultDecoratorClass;
+ }
+
+ public void setDefaultDecoratorClass(Class<? extends CompiledObjectDecorator> defaultDecoratorClass) {
+ this.defaultDecoratorClass = defaultDecoratorClass;
+ }
+
}
Added: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java (rev 0)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,112 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package jaxx.compiler;
+
+import java.lang.reflect.Modifier;
+import jaxx.CompilerException;
+import jaxx.types.TypeManager;
+
+/**
+ * The default compiledObjectDecorator.
+ *
+ * @author tony
+ * @since 1.2
+ */
+public class DefaultCompiledObjectDecorator extends CompiledObjectDecorator {
+
+ @Override
+ public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) {
+
+ if (!object.isOverride() && !(object instanceof ScriptInitializer)) {
+ String id = object.getId();
+ int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED;
+ if (object == root) {
+ javaFile.addField(new JavaField(access, fullClassName, id, "this"));
+ } else {
+ //TC -20081017 can have generic on compiled Object
+ javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean());
+ }
+ }
+
+ if (!compiler.inlineCreation(object) && object != root) {
+ javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object)));
+ }
+ }
+
+ @Override
+ public String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException {
+ if (object instanceof ScriptInitializer) {
+ return object.getInitializationCode(compiler);
+ }
+ StringBuffer result = new StringBuffer();
+ result.append(object.getId());
+ result.append(" = ");
+ if (object.isJavaBean() && object.getJavaBeanInitCode() != null) {
+ result.append(object.getJavaBeanInitCode()).append(";");
+ } else {
+ String constructorParams = object.getConstructorParams();
+ if (constructorParams != null) {
+ //TC - 20081017 compiledObject can have generics
+ result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");");
+ //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");");
+ } else {
+ //TC - 20081017 compiledObject can have generics
+ result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();");
+ }
+ }
+ result.append(JAXXCompiler.getLineSeparator());
+ String initCode = object.getInitializationCode(compiler);
+ if (initCode != null && initCode.length() > 0) {
+ result.append(initCode);
+ }
+ result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");");
+ return result.toString();
+ }
+
+ @Override
+ public String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings) {
+ StringBuffer code = new StringBuffer();
+ //TC - 20081017 only generate the method if not empty ?
+ if (object.getId().startsWith("$")) {
+ code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator());
+ } else {
+ String additionCode = object.getAdditionCode();
+ if (additionCode.length() > 0) {
+ code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator());
+ additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode;
+ javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode));
+ }
+ }
+ //code.append(getLineSeparator());
+ return code.toString();
+ }
+
+ @Override
+ public boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall) {
+ if (object == root) {
+ String rootCode = root.getInitializationCode(compiler);
+ if (rootCode != null && rootCode.length() > 0) {
+ code.append(rootCode);
+ code.append(JAXXCompiler.getLineSeparator());
+ }
+ } else {
+ if (!object.isOverride()) {
+ if (compiler.inlineCreation(object)) {
+ if (lastWasMethodCall) {
+ lastWasMethodCall = false;
+ code.append(JAXXCompiler.getLineSeparator());
+ }
+ code.append(getCreationCode(compiler, object));
+ code.append(JAXXCompiler.getLineSeparator());
+ } else {
+ code.append(object.getCreationMethodName()).append("();");
+ code.append(JAXXCompiler.getLineSeparator());
+ lastWasMethodCall = true;
+ }
+ }
+ }
+ return lastWasMethodCall;
+ }
+}
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -222,6 +222,8 @@
/** Maps objects to their ID strings. These are created during the second compilation pass. */
protected Map<CompiledObject, String> ids = new LinkedHashMap<CompiledObject, String>();
+ protected CompiledObjectDecorator defaultDecorator;
+
/*---------------------------------------------------------------------------------*/
/*-- Constructor methods ----------------------------------------------------------*/
/*---------------------------------------------------------------------------------*/
@@ -268,6 +270,11 @@
addImport(extraImport);
}
}
+ defaultDecorator = CompiledObjectDecorator.getDecorator(options.getDefaultDecoratorClass());
+ if (defaultDecorator == null) {
+ log.error("could not find default decorator : "+options.getDefaultDecoratorClass());
+ throw new IllegalArgumentException("could not find default decorator : " + options.getDefaultDecoratorClass());
+ }
}
/*---------------------------------------------------------------------------------*/
@@ -484,6 +491,10 @@
}
objects.put(id, object);
ids.put(object, id);
+ if (object.getDecorator() == null) {
+ // use compiler decorator
+ object.setDecorator(defaultDecorator);
+ }
}
public CompiledObject getCompiledObject(String id) {
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -23,7 +23,7 @@
/** log */
protected static final Log log = LogFactory.getLog(JAXXCompilerLaunchor.class);
- enum LifeCycle {
+ protected enum LifeCycle {
init,// state before compilation
compile_first_pass, // state when first pass of compilation
compile_second_pass, // state when second pass of compilation
@@ -174,6 +174,7 @@
jaxxFileClassNames.clear();
symbolTables.clear();
compilers.clear();
+ //CompiledObjectDecorator.reset();
}
public String getVersion() {
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JAXXObjectGenerator.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -147,7 +147,10 @@
javaFile.setSuperGenericType(compiler.getSuperGenericType());
for (CompiledObject object : compiler.getObjects().values()) {
- if (!object.isOverride() && !(object instanceof ScriptInitializer)) {
+ CompiledObjectDecorator decorator = object.getDecorator();
+ decorator.finalizeCompiler(compiler, root, object,javaFile, packageName, className,fullClassName);
+
+ /*if (!object.isOverride() && !(object instanceof ScriptInitializer)) {
String id = object.getId();
int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED;
if (object == root) {
@@ -160,7 +163,7 @@
if (!compiler.inlineCreation(object) && object != root) {
javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object)));
- }
+ }*/
}
// DataBinding
@@ -283,15 +286,6 @@
addEventHandlers(compiler, javaFile);
- /*//TODO : move this to jaxx-compiler-swing generator
- if (ClassDescriptorLoader.getClassDescriptor("jaxx.runtime.swing.Application").isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) {
- // TODO: check for existing main method first
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC | Modifier.STATIC, "void", "main",
- "SwingUtilities.invokeLater(new Runnable() { public void run() { new " + className + "().setVisible(true); } });",
- new JavaArgument("String[]", "arg"))
- );
- }*/
-
}
@@ -451,7 +445,12 @@
boolean lastWasMethodCall = false;
while (i.hasNext()) {
CompiledObject object = i.next();
- if (object != root && !object.isOverride()) {
+ if (object == root) {
+ continue;
+ }
+ CompiledObjectDecorator decorator = object.getDecorator();
+ lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall);
+ /*if (object != root && !object.isOverride()) {
if (compiler.inlineCreation(object)) {
if (lastWasMethodCall) {
lastWasMethodCall = false;
@@ -464,13 +463,14 @@
code.append(JAXXCompiler.getLineSeparator());
lastWasMethodCall = true;
}
- }
+ }*/
}
- String rootCode = root.getInitializationCode(compiler);
+ root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall);
+ /*String rootCode = root.getInitializationCode(compiler);
if (rootCode != null && rootCode.length() > 0) {
code.append(rootCode);
code.append(JAXXCompiler.getLineSeparator());
- }
+ }*/
code.append(JAXXCompiler.getLineSeparator());
if (compiler.getInitializer().length() > 0) {
code.append(compiler.getInitializer());
@@ -487,7 +487,10 @@
code.append("allComponentsCreated = true;");
code.append(JAXXCompiler.getLineSeparator());
for (CompiledObject object : compiler.getObjects().values()) {
- //TC - 20081017 only generate the method if not empty ?
+ CompiledObjectDecorator decorator = object.getDecorator();
+ code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings));
+
+ /*//TC - 20081017 only generate the method if not empty ?
if (object.getId().startsWith("$")) {
code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator());
} else {
@@ -497,7 +500,7 @@
additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode;
javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode));
}
- }
+ }*/
//code.append(getLineSeparator());
}
@@ -559,11 +562,14 @@
/*-- Create methods code ----------------------------------------------------------*/
/*---------------------------------------------------------------------------------*/
- protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException {
+/* protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException {
if (object instanceof ScriptInitializer) {
return object.getInitializationCode(compiler);
}
- StringBuffer result = new StringBuffer();
+ CompiledObjectDecorator decorator = object.getDecorator();
+ String result = decorator.getCreationCode(compiler, object);
+ return result;*/
+ /*StringBuffer result = new StringBuffer();
result.append(object.getId());
result.append(" = ");
if (object.isJavaBean() && object.getJavaBeanInitCode() != null) {
@@ -586,7 +592,7 @@
}
result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");");
- return result.toString();
- }
+ return result.toString();*/
+// }
}
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/compiler/JavaFile.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -226,16 +226,6 @@
result.append(lineSeparator).append(lineSeparator);
}
- /*
- java.util.Collections.sort(methods); // sort methods
-
- for (JavaMethod method : methods) {
- result.append(addIndentation(method.toString(), 4));
- result.append(lineSeparator);
- result.append(lineSeparator);
- }
- */
-
EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(methods);
for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) {
List<JavaMethod> list = entry.getValue();
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/DefaultObjectHandler.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -43,6 +43,7 @@
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
+import jaxx.compiler.CompiledObjectDecorator;
/**
* Default handler for class tags. Class tags are tags which represent instances of Java classes,
@@ -512,12 +513,14 @@
}
+ @Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
scanAttributesForDependencies(tag, compiler);
compileChildrenFirstPass(tag, compiler);
}
+ @Override
public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
try {
init();
@@ -654,7 +657,7 @@
attributes.add((Attr) children.item(i));
}
Collections.sort(attributes, getAttributeComparator());
-
+
for (Attr attribute : attributes) {
String name = attribute.getName();
String value = attribute.getValue().trim();
@@ -711,6 +714,14 @@
continue;
}
+ if (name.equals("decorator")) {
+ if (!value.isEmpty()) {
+ CompiledObjectDecorator decorator = CompiledObjectDecorator.getDecorator(value);
+ object.setDecorator(decorator);
+ }
+ continue;
+ }
+
if (isEventHandlerName(name)) {
// event handler
if (!value.endsWith(";")) {
@@ -733,6 +744,7 @@
*/
protected Comparator<Attr> getAttributeComparator() {
return new Comparator<Attr>() {
+ @Override
public int compare(Attr a, Attr b) {
int aOrder = getAttributeOrdering(a);
int bOrder = getAttributeOrdering(b);
Modified: jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java
===================================================================
--- jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-api/src/main/java/jaxx/tags/TagManager.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -91,6 +91,7 @@
registeredBeans.clear();
registeredTags.clear();
defaultNamespaces.clear();
+ CompiledObjectDecorator.reset();
JAXXCompilerLaunchor.loadLibraries(verbose);
}
Copied: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java (from rev 1237, jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java)
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java (rev 0)
+++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx;
+
+import jaxx.tags.swing.*;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.reflect.ClassDescriptorLoader;
+import jaxx.runtime.swing.Application;
+import jaxx.runtime.swing.JAXXButtonGroup;
+import jaxx.runtime.swing.JAXXComboBox;
+import jaxx.runtime.swing.JAXXList;
+import jaxx.runtime.swing.JAXXTab;
+import jaxx.runtime.swing.JAXXTree;
+import jaxx.runtime.swing.Table;
+import jaxx.spi.Initializer;
+import jaxx.tags.DefaultObjectHandler;
+import jaxx.tags.TagManager;
+import jaxx.types.ColorConverter;
+import jaxx.types.GridBagConstraintsConverter;
+import jaxx.types.InsetsConverter;
+import jaxx.types.KeyStrokeConverter;
+import jaxx.types.TypeManager;
+import jaxx.beaninfos.BeanInfoUtil;
+
+import javax.swing.*;
+import javax.swing.text.JTextComponent;
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
+import jaxx.compiler.BoxedCompiledObjectDecorator;
+import jaxx.compiler.CompiledObjectDecorator;
+
+public class SwingInitializer implements Initializer {
+
+ public void initialize() {
+
+ BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos");
+
+ TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class)));
+
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class);
+ TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class)));
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JListHandler.class);
+ TagManager.registerTag("javax.swing.*", "JList", new JListHandler(ClassDescriptorLoader.getClassDescriptor(JAXXList.class)));
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JMenu.class), JMenuHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPasswordField.class), JPasswordFieldHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPopupMenu.class), JPopupMenuHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JProgressBar.class), JProgressBarHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JScrollPane.class), JScrollPaneHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSlider.class), JSliderHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSpinner.class), JSpinnerHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSplitPane.class), JSplitPaneHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), JTabbedPaneHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTextComponent.class), JTextComponentHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToolBar.class), JToolBarHandler.class);
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JTreeHandler.class);
+ TagManager.registerTag("javax.swing.*", "JTree", new JTreeHandler(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class)));
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class);
+
+ TagManager.registerDefaultNamespace("JEditorPane", "javax.swing.*");
+ TagManager.registerDefaultNamespace("JFormattedTextField", "javax.swing.*");
+ TagManager.registerDefaultNamespace("JPasswordField", "javax.swing.*");
+ TagManager.registerDefaultNamespace("JTextArea", "javax.swing.*");
+ TagManager.registerDefaultNamespace("JTextField", "javax.swing.*");
+ TagManager.registerDefaultNamespace("JTextPane", "javax.swing.*");
+
+ TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler());
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Table.class), TableHandler.class);
+ TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler());
+ TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler());
+ TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler());
+
+ TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTab.class), JAXXTabHandler.class);
+
+ TypeManager.registerTypeConverter(Color.class, new ColorConverter());
+ TypeManager.registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter());
+ TypeManager.registerTypeConverter(Insets.class, new InsetsConverter());
+ TypeManager.registerTypeConverter(KeyStroke.class, new KeyStrokeConverter());
+
+ CompiledObjectDecorator.registerDecorator("boxed", BoxedCompiledObjectDecorator.class);
+ }
+}
\ No newline at end of file
Property changes on: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/SwingInitializer.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java (rev 0)
+++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,26 @@
+package jaxx.compiler;
+
+import jaxx.compiler.CompiledObject.ChildRef;
+
+/**
+ * A decorator to surround a compiled object (should be a component at least)
+ * with a JXLayer.
+ *
+ * @author tony
+ * @since 1.2
+ */
+public class BoxedCompiledObjectDecorator extends DefaultCompiledObjectDecorator {
+
+ @Override
+ public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) {
+ CompiledObject parent = object.getParent();
+ for (ChildRef child : parent.getChilds()) {
+ if (child.getChild() == object) {
+ String javaCode = child.getChildJavaCode();
+ child.setChildJavaCode("jaxx.runtime.SwingUtil.boxComponentWithJxLayer(" + javaCode + ")");
+ break;
+ }
+ }
+ super.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName);
+ }
+}
Deleted: jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-swing/src/main/java/jaxx/tags/swing/SwingInitializer.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -1,88 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.tags.swing;
-
-import jaxx.compiler.JAXXCompiler;
-import jaxx.reflect.ClassDescriptorLoader;
-import jaxx.runtime.swing.Application;
-import jaxx.runtime.swing.JAXXButtonGroup;
-import jaxx.runtime.swing.JAXXComboBox;
-import jaxx.runtime.swing.JAXXList;
-import jaxx.runtime.swing.JAXXTab;
-import jaxx.runtime.swing.JAXXTree;
-import jaxx.runtime.swing.Table;
-import jaxx.spi.Initializer;
-import jaxx.tags.DefaultObjectHandler;
-import jaxx.tags.TagManager;
-import jaxx.types.ColorConverter;
-import jaxx.types.GridBagConstraintsConverter;
-import jaxx.types.InsetsConverter;
-import jaxx.types.KeyStrokeConverter;
-import jaxx.types.TypeManager;
-import jaxx.beaninfos.BeanInfoUtil;
-
-import javax.swing.*;
-import javax.swing.text.JTextComponent;
-import java.awt.Color;
-import java.awt.GridBagConstraints;
-import java.awt.Insets;
-
-public class SwingInitializer implements Initializer {
-
- public void initialize() {
-
- BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos");
-
- TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class)));
-
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class);
- TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class)));
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JListHandler.class);
- TagManager.registerTag("javax.swing.*", "JList", new JListHandler(ClassDescriptorLoader.getClassDescriptor(JAXXList.class)));
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JMenu.class), JMenuHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPasswordField.class), JPasswordFieldHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPopupMenu.class), JPopupMenuHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JProgressBar.class), JProgressBarHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JScrollPane.class), JScrollPaneHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSlider.class), JSliderHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSpinner.class), JSpinnerHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSplitPane.class), JSplitPaneHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), JTabbedPaneHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTextComponent.class), JTextComponentHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToolBar.class), JToolBarHandler.class);
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JTreeHandler.class);
- TagManager.registerTag("javax.swing.*", "JTree", new JTreeHandler(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class)));
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class);
-
- TagManager.registerDefaultNamespace("JEditorPane", "javax.swing.*");
- TagManager.registerDefaultNamespace("JFormattedTextField", "javax.swing.*");
- TagManager.registerDefaultNamespace("JPasswordField", "javax.swing.*");
- TagManager.registerDefaultNamespace("JTextArea", "javax.swing.*");
- TagManager.registerDefaultNamespace("JTextField", "javax.swing.*");
- TagManager.registerDefaultNamespace("JTextPane", "javax.swing.*");
-
- TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler());
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Table.class), TableHandler.class);
- TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler());
- TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler());
- TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler());
-
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTab.class), JAXXTabHandler.class);
-
- TypeManager.registerTypeConverter(Color.class, new ColorConverter());
- TypeManager.registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter());
- TypeManager.registerTypeConverter(Insets.class, new InsetsConverter());
- TypeManager.registerTypeConverter(KeyStroke.class, new KeyStrokeConverter());
- }
-}
\ No newline at end of file
Modified: jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer
===================================================================
--- jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-swing/src/main/resources/META-INF/services/jaxx.spi.Initializer 2009-02-23 02:06:29 UTC (rev 1239)
@@ -1 +1 @@
-jaxx.tags.swing.SwingInitializer
\ No newline at end of file
+jaxx.SwingInitializer
\ No newline at end of file
Modified: jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java
===================================================================
--- jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-compiler-validator/src/main/java/jaxx/compiler/ValidatorGenerator.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -34,7 +34,7 @@
boolean found = BeanValidatorHandler.isComponentUsedByValidator(compiler, child.getChild().getId());
if (found) {
// box the child component in a JxLayer
- child.setChildJavaCode("jaxx.runtime.Util.boxComponentWithJxLayer(" + javaCode + ")");
+ child.setChildJavaCode("jaxx.runtime.SwingUtil.boxComponentWithJxLayer(" + javaCode + ")");
}
}
}
Property changes on: jaxx/trunk/jaxx-example
___________________________________________________________________
Name: svn:ignore
- target
velocity.log
+ velocity.log
target
nbactions.xml
Added: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx
===================================================================
--- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx (rev 0)
+++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,56 @@
+
+<DemoPanel>
+ <jaxx.runtime.swing.BlockingLayerUI id='layerUI'
+ blockIcon='{SwingUtil.createImageIcon("action-block.png")}'
+ acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}'
+ acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L;
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ accept(e, "from icon of layer");
+ }
+ }}' />
+ <script><![CDATA[
+import jaxx.runtime.SwingUtil;
+
+public void setLayer(boolean active) {
+ for (JComponent boxed : SwingUtil.getLayeredComponents(this)) {
+ jaxx.runtime.swing.BlockingLayerUI ui = active ? layerUI.clone() : null;
+ SwingUtil.getLayer(boxed).setUI(ui);
+ }
+}
+
+protected void accept(ActionEvent e, String suffix) {
+ JButton source = (JButton) e.getSource();
+ String msg = "'" + source.getText() + "' clicked - " + suffix;
+ ((DefaultListModel)messages.getModel()).addElement(msg);
+}]]>
+ </script>
+ <Table id='demoPanel' fill='both' weightx='1'>
+ <row>
+ <cell>
+ <JCheckBox id='toggle' selected='true'
+ text='{toggle.isSelected() ? "Active layer" : "No layer"}'
+ onActionPerformed='setLayer(toggle.isSelected());'/>
+ </cell>
+ </row>
+ <row>
+ <cell weighty='0.5'>
+ <JPanel layout='{new GridLayout(1,3,3,3)}'>
+ <JButton text='button A' decorator='boxed'
+ onActionPerformed='accept(event, "from button (no layer)")'/>
+ <JButton text='button B' decorator='boxed'
+ onActionPerformed='accept(event, "from button (no layer)")'/>
+ <JButton text='button C' decorator='boxed'
+ onActionPerformed='accept(event, "from button (no layer)");'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell weighty='0.5'>
+ <JScrollPane>
+ <JList id='messages' model='{new DefaultListModel()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+</DemoPanel>
\ No newline at end of file
Modified: jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx
===================================================================
--- jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,7 +9,7 @@
// init i18n
org.codelutin.i18n.I18n.init();
-
+boxedDecoratorDemo.setLayer(true);
]]></script>
<JSplitPane>
<!--JSplitPane dividerLocation='200'-->
@@ -73,6 +73,7 @@
<item value='{validationDemo2}'/>
</item>
<item value='{dataBindingDemo}'/>
+ <item value='{boxedDecoratorDemo}'/>
</item>
</JTree>
</JScrollPane>
@@ -103,6 +104,7 @@
<LabelStyleDemo id='labelStyleDemo' constraints='labelStyleDemo.getLabel()'/>
<CounterDemo id='counterDemo' constraints='counterDemo.getLabel()'/>
<CalculatorDemo id='calculatorDemo' constraints='calculatorDemo.getLabel()'/>
+ <BoxedDecoratorDemo id='boxedDecoratorDemo' constraints='boxedDecoratorDemo.getLabel()'/>
</JPanel>
</JSplitPane>
</Application>
\ No newline at end of file
Modified: jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties
===================================================================
--- jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties 2009-02-23 02:06:29 UTC (rev 1239)
@@ -24,6 +24,7 @@
C=
CE=
Cancel=
+Change\ layer\ state=
Comments\:=
Config\ file\ \:=
Config\ file\:=
@@ -84,6 +85,10 @@
\\u00f7=
adjust\ the\ spacing=
between\ these\ lines=
+button\ A=
+button\ B=
+button\ C=
+button\ with\ layer=
cancel=
close=
close2=
@@ -91,6 +96,7 @@
edit=
edit2=
edit3=
+no\ layer=
valid=
validator.field=Champ
validator.field.tip=
@@ -98,4 +104,5 @@
validator.message.tip=
validator.scope=...
validator.scope.tip=
+with\ layer=
x=
Modified: jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties
===================================================================
--- jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties 2009-02-23 02:06:29 UTC (rev 1239)
@@ -24,6 +24,7 @@
C=
CE=
Cancel=
+Change\ layer\ state=
Comments\:=
Config\ file\ \:=
Config\ file\:=
@@ -84,6 +85,10 @@
\\u00f7=
adjust\ the\ spacing=
between\ these\ lines=
+button\ A=
+button\ B=
+button\ C=
+button\ with\ layer=
cancel=
close=
close2=
@@ -91,6 +96,7 @@
edit=
edit2=
edit3=
+no\ layer=
valid=
validator.field=Champ
validator.field.tip=
@@ -98,4 +104,5 @@
validator.message.tip=
validator.scope=...
validator.scope.tip=
+with\ layer=
x=
Added: jaxx/trunk/jaxx-example/src/main/resources/icons/action-accept.png
===================================================================
(Binary files differ)
Property changes on: jaxx/trunk/jaxx-example/src/main/resources/icons/action-accept.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jaxx/trunk/jaxx-example/src/main/resources/icons/action-block.png
===================================================================
(Binary files differ)
Property changes on: jaxx/trunk/jaxx-example/src/main/resources/icons/action-block.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java
===================================================================
--- jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -3,7 +3,6 @@
import jaxx.Base64Coder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jdesktop.jxlayer.JXLayer;
import javax.swing.DefaultListCellRenderer;
import javax.swing.Icon;
@@ -12,12 +11,7 @@
import javax.swing.JList;
import javax.swing.UIManager;
import java.awt.Component;
-import java.awt.Container;
import java.awt.Dimension;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationHandler;
@@ -27,10 +21,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EventListener;
-import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.WeakHashMap;
@@ -282,78 +273,6 @@
}
/**
- * 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/>
- * <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 le dictionnaire des composants recherches.
- */
- 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);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Result: " + result);
- }
-
- return result;
- }
-
- /**
- * Box a component in a {@link org.jdesktop.jxlayer.JXLayer}.
- *
- * @param component the component to box
- * @return the {@link org.jdesktop.jxlayer.JXLayer} boxing the component
- */
- public static JXLayer boxComponentWithJxLayer(JComponent component) {
- JXLayer layer = new org.jdesktop.jxlayer.JXLayer();
- layer.add(component);
- return layer;
- }
-
- /**
* Compute the string representation of an object.
* <p/>
* Return empty string if given object is null
@@ -372,6 +291,7 @@
* <p/>
* If entry is found, return his value in context.
*
+ * @param <T> the type of required data
* @param context the context to test
* @param def the definition of the entry to seek in context
* @return the value from the context
@@ -426,6 +346,9 @@
public static <O> DefaultListCellRenderer newDecoratedListCellRenderer(final Decorator<O> decorator) {
return new DefaultListCellRenderer() {
+
+ private static final long serialVersionUID = 1L;
+
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
String decorated;
Added: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java (rev 0)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,260 @@
+package jaxx.runtime;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.List;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.JTextComponent;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import javax.swing.JComponent;
+import jaxx.runtime.swing.I18nTableCellRenderer;
+import jaxx.runtime.swing.Item;
+import jaxx.runtime.swing.JAXXComboBox;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.jxlayer.JXLayer;
+
+/**
+ * The runtime swing util class with some nice stuff.
+ *
+ * Note : Replace previous class jaxx.runtime.swing.Utils in previous versions.
+ *
+ * @author tony
+ * @since 1.2
+ */
+public class SwingUtil extends Util {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private final Log log = LogFactory.getLog(SwingUtil.class);
+ private static Field numReaders;
+ private static Field notifyingListeners;
+
+ public static void setText(final JTextComponent c, final String text) {
+ try {
+ // AbstractDocument deadlocks if we try to acquire a write lock while a read lock is held by the current thread
+ // If there are any readers, dispatch an invokeLater. This should only happen in the event of circular bindings.
+ // Similarly, circular bindings can result in an "Attempt to mutate in notification" error, which we deal with
+ // by checking for the 'notifyingListeners' property.
+ AbstractDocument document = (AbstractDocument) c.getDocument();
+ if (numReaders == null) {
+ numReaders = AbstractDocument.class.getDeclaredField("numReaders");
+ numReaders.setAccessible(true);
+ }
+ if (notifyingListeners == null) {
+ notifyingListeners = AbstractDocument.class.getDeclaredField("notifyingListeners");
+ notifyingListeners.setAccessible(true);
+ }
+
+ if (notifyingListeners.get(document).equals(Boolean.TRUE)) {
+ return;
+ }
+
+ if ((Integer) numReaders.get(document) > 0) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ if (!c.getText().equals(text)) {
+ c.setText(text);
+ }
+ }
+ });
+ return;
+ }
+
+ String oldText = c.getText();
+ if (oldText == null || !oldText.equals(text)) {
+ c.setText(text);
+ }
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (SecurityException e) {
+ c.setText(text);
+ }
+ }
+
+ /**
+ * Fill a combo box model with some datas, and select after all the given object
+ *
+ * @param combo the combo to fill
+ * @param data data ot inject in combo
+ * @param select the object to select in combo after reflling his model
+ */
+ public static void fillComboBox(JComboBox combo, Collection<?> data, Object select) {
+ if (!(combo.getModel() instanceof DefaultComboBoxModel)) {
+ throw new IllegalArgumentException("this method need a DefaultComboBoxModel for this model but was " + combo.getModel().getClass());
+ }
+ DefaultComboBoxModel model = (DefaultComboBoxModel) combo.getModel();
+ // evince the model
+ model.removeListDataListener(combo);
+ model.removeAllElements();
+ for (Object o : data) {
+ model.addElement(o);
+ }
+ // attach the model
+ model.addListDataListener(combo);
+ model.setSelectedItem(select);
+ }
+
+ /**
+ * Fill a combo box model with some datas, and select after all the given object
+ *
+ * @param combo the combo to fill
+ * @param data data ot inject in combo
+ * @param select the object to select in combo after reflling his model
+ * @param firstNull add a first null element
+ */
+ public static void fillComboBox(JAXXComboBox combo, Collection<?> data, Object select, boolean firstNull) {
+ List<Item> items = new ArrayList<Item>();
+ if (firstNull) {
+ items.add(new Item("null", " ", null, false));
+ }
+ for (Object d : data) {
+ items.add(new Item(d.toString(), d.toString(), d, d.equals(select)));
+ }
+ combo.setItems(items);
+ }
+
+ public static void fixTableColumnWidth(JTable table, int columnIndex, int width) {
+ TableColumn column = table.getColumnModel().getColumn(columnIndex);
+ column.setMaxWidth(width);
+ column.setMinWidth(width);
+ column.setWidth(width);
+ column.setPreferredWidth(width);
+ }
+
+ public static void setTableColumnEditor(JTable table, int columnIndex, TableCellEditor editor) {
+ TableColumn column = table.getColumnModel().getColumn(columnIndex);
+ column.setCellEditor(editor);
+ }
+
+ public static void setTableColumnRenderer(JTable table, int columnIndex, TableCellRenderer editor) {
+ TableColumn column = table.getColumnModel().getColumn(columnIndex);
+ column.setCellRenderer(editor);
+ }
+
+ public static void setI18nTableHeaderRenderer(JTable table, String... libelles) {
+ table.getTableHeader().setDefaultRenderer(new I18nTableCellRenderer(table.getTableHeader().getDefaultRenderer(), libelles));
+ }
+
+ /**
+ * Box a component in a {@link org.jdesktop.jxlayer.JXLayer}.
+ *
+ * @param component the component to box
+ * @return the {@link org.jdesktop.jxlayer.JXLayer} boxing the component
+ */
+ public static JXLayer boxComponentWithJxLayer(JComponent component) {
+ JXLayer layer = getLayer(component);
+ if (layer != null) {
+ return layer;
+ }
+ layer = new org.jdesktop.jxlayer.JXLayer();
+ layer.add(component);
+ return layer;
+ }
+
+ public static List<JComponent> getLayeredComponents(JAXXObject object) {
+ List<JComponent> result = new ArrayList<JComponent>();
+ for (Entry<String, Object> child : object.get$objectMap().entrySet()) {
+ if (JComponent.class.isAssignableFrom(child.getValue().getClass())) {
+ JComponent comp = (JComponent) child.getValue();
+ if (isLayered(comp)) {
+ result.add(comp);
+ }
+ }
+ }
+ return result;
+ }
+
+ public static JXLayer<JComponent> getLayer(JComponent comp) {
+ if (!isLayered(comp)) {
+ return null;
+ }
+ return (JXLayer<JComponent>) comp.getParent();
+ }
+
+ public static boolean isLayered(JComponent comp) {
+ Container parent = comp.getParent();
+ return parent != null && parent instanceof JXLayer;
+ }
+
+ /**
+ * 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/>
+ * <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 le dictionnaire des composants recherches.
+ */
+ 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);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Result: " + result);
+ }
+
+ return result;
+ }
+}
Added: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java (rev 0)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,179 @@
+package jaxx.runtime.swing;
+
+import java.awt.Component;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.RenderingHints;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
+import javax.swing.Action;
+import javax.swing.ImageIcon;
+import javax.swing.JComponent;
+import org.jdesktop.jxlayer.JXLayer;
+
+/**
+ *
+ * A JXLayer ui implementation that permits to block a component but still
+ * allow an action when clicking on the right-top icon painted on the layer.
+ *
+ * You can change the blocking and accepting icon.
+ *
+ * To hook an click on the layer's icon, you can :
+ *
+ * <ul><li>pass an Action via method {@link #setAcceptAction(Action)}</li>
+ * <li>override the method {@link #acceptEvent(java.awt.event.MouseEvent, org.jdesktop.jxlayer.JXLayer)}</li>
+ * </ul>
+ *
+ * @author tony
+ * @since 1.2
+ */
+public class BlockingLayerUI extends org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent> {
+
+ public static final String CAN_CLICK_PROPERTY = "canClick";
+ public static final String ACCEPT_ICON_PROPERTY = "acceptIcon";
+ public static final String BLOCK_ICON_PROPERTY = "blockIcon";
+ private static final long serialVersionUID = 1L;
+ /**
+ * Action to be treated when click on icon
+ */
+ protected Action acceptAction;
+ /**
+ * Icon when you can not click
+ */
+ protected BufferedImage blockIcon;
+ /**
+ * Icon when you can click
+ */
+ protected BufferedImage acceptIcon;
+ /**
+ * Internal state to known when we can accept click
+ */
+ protected boolean canClick;
+
+ public void setAcceptAction(Action acceptAction) {
+ this.acceptAction = acceptAction;
+ }
+
+ public void setAcceptIcon(ImageIcon acceptIcon) {
+ this.acceptIcon = prepareIcon(acceptIcon);
+ firePropertyChange(ACCEPT_ICON_PROPERTY, null, acceptIcon);
+ setDirty(true);
+ }
+
+ public void setBlockIcon(ImageIcon blockIcon) {
+ this.blockIcon = prepareIcon(blockIcon);
+ firePropertyChange(BLOCK_ICON_PROPERTY, null, blockIcon);
+ setDirty(true);
+ }
+
+ public void setCanClick(boolean canClick) {
+ boolean oldvalue = this.canClick;
+ this.canClick = canClick;
+ firePropertyChange(CAN_CLICK_PROPERTY, oldvalue, canClick);
+ if (oldvalue != canClick) {
+ setDirty(true);
+ }
+ }
+
+ public BufferedImage getBlockIcon() {
+ return blockIcon;
+ }
+
+ protected BufferedImage getAcceptIcon() {
+ return acceptIcon;
+ }
+
+ public boolean isCanClick() {
+ return canClick;
+ }
+
+ @Override
+ public BlockingLayerUI clone() {
+ BlockingLayerUI clone = new BlockingLayerUI();
+ clone.acceptAction = acceptAction;
+ clone.acceptIcon = acceptIcon;
+ clone.blockIcon = blockIcon;
+ clone.setCanClick(false);
+ return clone;
+ }
+
+ @Override
+ protected void processKeyEvent(KeyEvent e, JXLayer<JComponent> l) {
+ e.consume();
+ }
+
+ @Override
+ protected void processMouseMotionEvent(MouseEvent e, JXLayer<JComponent> l) {
+ updateCanClickState(l, e);
+ e.consume();
+ }
+
+ @Override
+ protected void processMouseEvent(MouseEvent e, JXLayer<JComponent> l) {
+
+ switch (e.getID()) {
+ case MouseEvent.MOUSE_ENTERED:
+ updateCanClickState(l, e);
+ break;
+ case MouseEvent.MOUSE_EXITED:
+ setCanClick(false);
+ break;
+ case MouseEvent.MOUSE_CLICKED:
+ if (canClick) {
+ acceptEvent(e, l);
+ }
+ break;
+ }
+ e.consume();
+ }
+
+ @Override
+ protected void paintLayer(Graphics2D g2, JXLayer<JComponent> l) {
+ super.paintLayer(g2, l);
+ if (getCurrentIcon() != null) {
+ g2.drawImage(getCurrentIcon(), l.getWidth() - getCurrentIcon().getWidth() - 1, 0, null);
+ }
+ }
+
+ protected void acceptEvent(MouseEvent e, JXLayer<JComponent> l) {
+ if (acceptAction != null) {
+ acceptAction.putValue("layer", l);
+ Component source = l.getView();
+ acceptAction.actionPerformed(new ActionEvent(source, 0, "accept"));
+ }
+ }
+
+ protected BufferedImage getCurrentIcon() {
+ return canClick ? acceptIcon : blockIcon;
+ }
+
+ protected BufferedImage prepareIcon(ImageIcon image) {
+ BufferedImage icon = new BufferedImage(image.getIconWidth(), image.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g2 = (Graphics2D) icon.getGraphics();
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
+ g2.drawImage(image.getImage(), 0, 0, null);
+ g2.dispose();
+ return icon;
+ }
+
+ protected void updateCanClickState(JXLayer<JComponent> l, MouseEvent e) {
+ // udpate toolTipText
+ Point layerLocation = l.getView().getLocation();
+ Point mousePoint = e.getPoint();
+ BufferedImage currentIcon = getCurrentIcon();
+ if (currentIcon == null) {
+ setCanClick(false);
+ return;
+ }
+ int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth();
+ int maxX = (int) layerLocation.getX() + l.getWidth();
+ int minY = 0;
+ int maxY = currentIcon.getHeight();
+ boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX;
+ accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY;
+ setCanClick(accept);
+ }
+}
Modified: jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java
===================================================================
--- jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Utils.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -6,7 +6,6 @@
import java.util.List;
import javax.swing.DefaultComboBoxModel;
-import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
@@ -18,13 +17,18 @@
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
-import jaxx.runtime.swing.Item;
-
+/**
+ *
+ * @author tony
+ * @deprecatedwill remove in release 1.2, prefer use the {@link jaxx.runtime.SwingUtil} class.
+ *
+ */
public class Utils {
private static Field numReaders;
private static Field notifyingListeners;
+ @Deprecated
public static void setText(final JTextComponent c, final String text) {
try {
// AbstractDocument deadlocks if we try to acquire a write lock while a read lock is held by the current thread
@@ -73,47 +77,13 @@
}
/**
- * @param path icones from path /icons
- * @return the icone
- * @deprecated prefer use {@link jaxx.runtime.Util#createImageIcon(String)}
- */
- @Deprecated
- public static ImageIcon createImageIcon(String path) {
- java.net.URL imgURL = Utils.class.getResource("/icons/" + path);
- if (imgURL != null) {
- return new ImageIcon(imgURL);
- } else {
- throw new IllegalArgumentException("could not find icon " + path);
- }
- }
-
- /**
- * @param name icones from path /icons/action-xx.png
- * @return the icone
- * @deprecated prefer use {@link jaxx.runtime.Util#createActionIcon(String)}
- */
- @Deprecated
- public static ImageIcon createActionIcon(String name) {
- return createImageIcon("action-" + name + ".png");
- }
-
- /**
- * @param name icones from path /icons/i18n/xx-.png icones
- * @return the icone
- * @deprecated prefer use {@link jaxx.runtime.Util#createI18nIcon(String)}
- */
- @Deprecated
- public static ImageIcon createI18nIcon(String name) {
- return createImageIcon("i18n/" + name + ".png");
- }
-
- /**
* Fill a combo box model with some datas, and select after all the given object
*
* @param combo the combo to fill
* @param data data ot inject in combo
* @param select the object to select in combo after reflling his model
*/
+ @Deprecated
public static void fillComboBox(JComboBox combo, Collection<?> data, Object select) {
if (!(combo.getModel() instanceof DefaultComboBoxModel)) {
throw new IllegalArgumentException("this method need a DefaultComboBoxModel for this model but was " + combo.getModel().getClass());
@@ -138,6 +108,7 @@
* @param select the object to select in combo after reflling his model
* @param firstNull add a first null element
*/
+ @Deprecated
public static void fillComboBox(JAXXComboBox combo, Collection<?> data, Object select, boolean firstNull) {
List<Item> items = new ArrayList<Item>();
if (firstNull)
@@ -147,7 +118,7 @@
}
combo.setItems(items);
}
-
+ @Deprecated
public static void fixTableColumnWidth(JTable table, int columnIndex, int width) {
TableColumn column = table.getColumnModel().getColumn(columnIndex);
column.setMaxWidth(width);
@@ -155,17 +126,17 @@
column.setWidth(width);
column.setPreferredWidth(width);
}
-
+ @Deprecated
public static void setTableColumnEditor(JTable table, int columnIndex, TableCellEditor editor) {
TableColumn column = table.getColumnModel().getColumn(columnIndex);
column.setCellEditor(editor);
}
-
+ @Deprecated
public static void setTableColumnRenderer(JTable table, int columnIndex, TableCellRenderer editor) {
TableColumn column = table.getColumnModel().getColumn(columnIndex);
column.setCellRenderer(editor);
}
-
+ @Deprecated
public static void setI18nTableHeaderRenderer(JTable table, String... libelles) {
table.getTableHeader().setDefaultRenderer(new I18nTableCellRenderer(table.getTableHeader().getDefaultRenderer(), libelles));
}
Modified: jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-runtime-validator/src/test/java/jaxx/runtime/validator/AbstractValidatorTest.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -1,7 +1,5 @@
package jaxx.runtime.validator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -14,9 +12,6 @@
*/
public abstract class AbstractValidatorTest extends Assert {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private final Log log = LogFactory.getLog(AbstractValidatorTest.class);
-
static protected BeanValidator<ValidatorBean> validator;
static protected File basedir;
Modified: jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -217,6 +217,7 @@
/** install ui on required components */
public void installUIs() {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
if (uiClass == null) {
// use the default one
Modified: jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java
===================================================================
--- jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/jaxx-runtime-validator-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -22,8 +22,8 @@
public AbstractBeanValidatorUI(ValidatorField field) {
this.field = field;
- if (log.isInfoEnabled()) {
- log.info("install " + this + "<field:" + field + ">");
+ if (log.isDebugEnabled()) {
+ log.debug("install " + this + "<field:" + field + ">");
}
}
Modified: jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/main/java/org/codelutin/jaxx/JaxxGeneratorMojo.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -45,6 +45,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Set;
+import jaxx.compiler.CompiledObjectDecorator;
/**
* Classe permettant de transformer des sources jaxx vers du source java.
@@ -237,6 +238,18 @@
* @see jaxx.runtime.validator.swing.SwingValidator#DEFAULT_UI_CLASS
*/
protected String defaultErrorUIFQN;
+
+ /**
+ * the FQN of the ui to use for error notification.
+ * <p/>
+ * If not given, will use the one defined in validator
+ *
+ * @parameter expression="${jaxx.defaultDecorator}" default-value="jaxx.compiler.DefaultCompiledObjectDecorator"
+ *
+ * @see jaxx.compiler.CompiledObjectDecorator
+ */
+ protected String defaultDecoratorFQN;
+
/**
* a flag to use UIManager to retreave icons.
*
@@ -255,6 +268,7 @@
protected boolean skip = true;
private Class<?> defaultErrorUIClass;
+ private Class<? extends CompiledObjectDecorator> defaultDecoratorClass;
protected ClassLoader cl;
private Class<? extends JAXXCompiler> compilerClass;
@@ -269,10 +283,11 @@
}
compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN);
-
+ defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN);
+
// check the validator class is correct
Class.forName(validatorFQN);
-
+
if (defaultErrorUIFQN != null && !defaultErrorUIFQN.trim().isEmpty()) {
defaultErrorUIClass = Class.forName(defaultErrorUIFQN);
}
@@ -309,21 +324,21 @@
}
ds.scan();
- String[] files = ds.getIncludedFiles();
+ String[] filesFind = ds.getIncludedFiles();
if (verbose) {
- getLog().info("jaxx - discover " + files.length + " jaxx file(s). ");
+ getLog().info("jaxx - discover " + filesFind.length + " jaxx file(s). ");
}
updater = (MirroredFileUpdater) FileUpdaterHelper.newJaxxFileUpdater(src, outJava);
if (force) {
// we will regenerate all files
- this.files = files;
+ this.files = filesFind;
} else {
// filter files
List<String> listFiles = new ArrayList<String>();
- for (String file : files) {
+ for (String file : filesFind) {
if (updater.isFileUpToDate(new File(src, file))) {
if (verbose) {
getLog().info("jaxx - skip file [" + file + "].");
@@ -367,12 +382,14 @@
result.setExtraImports(extraImports);
result.setDefaultErrorUI(defaultErrorUIClass);
result.setUseUIManagerForIcon(useUIManagerForIcon);
+ result.setDefaultDecoratorClass(defaultDecoratorClass);
if (cl != null) {
result.setClassLoader(cl);
}
return result;
}
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
@@ -492,13 +509,13 @@
getLog().info("will generate " + file);
}
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- getLog().info(cl.toString());
- if (cl.getClass().getSimpleName().equals("RealmClassLoader")) {
+ ClassLoader threadLoader = Thread.currentThread().getContextClassLoader();
+ getLog().info(threadLoader.toString());
+ if (threadLoader.getClass().getSimpleName().equals("RealmClassLoader")) {
try {
- java.lang.reflect.Method m = cl.getClass().getDeclaredMethod("getURLs");
+ java.lang.reflect.Method m = threadLoader.getClass().getDeclaredMethod("getURLs");
m.setAccessible(true);
- URL[] urls = (URL[]) m.invoke(cl);
+ URL[] urls = (URL[]) m.invoke(threadLoader);
for (URL url : urls) {
getLog().info("url in class loader " + url);
Added: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/DecoratorTest.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,11 @@
+package org.codelutin.jaxx;
+
+public class DecoratorTest extends JaxxBaseTest {
+
+ public void testDecorator() throws Exception {
+ mojo.execute();
+ assertNumberJaxxFiles(1);
+ checkPattern(mojo, "root.add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true);
+ }
+
+}
\ No newline at end of file
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/JaxxBaseTest.java 2009-02-23 02:06:29 UTC (rev 1239)
@@ -34,6 +34,7 @@
mojo.jaxxContextImplementorClass = DefaultJAXXContext.class.getName();
mojo.compilerFQN = jaxx.compiler.SwingCompiler.class.getName();
mojo.validatorFQN = jaxx.runtime.validator.swing.SwingValidator.class.getName();
+ mojo.defaultDecoratorFQN = jaxx.compiler.DefaultCompiledObjectDecorator.class.getName();
assertNotNull(mojo);
}
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1722.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<verbose>true</verbose>
<includes>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1750.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<verbose>true</verbose>
<resetAfterCompile>false</resetAfterCompile>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Bug_1751.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/it-1751/java</outJava>
- <outResource>${basedir}/target/it-generated-source/it-1751/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<i18nable>true</i18nable>
<force>true</force>
<verbose>true</verbose>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/CSSTests.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<i18nable>false</i18nable>
<includes>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ClassReferences.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/ClassReferences/*.jaxx</value>
Added: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Decorator.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,23 @@
+<?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">
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codelutin</groupId>
+ <artifactId>maven-jaxx-plugin</artifactId>
+ <configuration>
+ <src>${basedir}/src/test/resources</src>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
+ <force>true</force>
+ <addLogger>false</addLogger>
+ <includes>
+ <value>**/decorator/*.jaxx</value>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ErrorJaxxContextImplementorClass.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<jaxxContextImplementorClass>java.lang.String</jaxxContextImplementorClass>
<force>true</force>
</configuration>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Errors.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/errors/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Force.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/force/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nText.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<i18nable>true</i18nable>
<includes>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nTitle.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<i18nable>true</i18nable>
<includes>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/I18nToolTipText.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<i18nable>true</i18nable>
<includes>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Initializers.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/Initializers/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/InnerClasses.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/InnerClasses/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/NoLog.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<addLogger>false</addLogger>
<includes>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/OverridingDataBindings.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/OverridingDataBindings/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/Script.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/Script/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/SpecialSubclassing.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/SpecialSubclassing/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorErrors.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/validator/errors/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/ValidatorOk.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<includes>
<value>**/validator/ok/*.jaxx</value>
Modified: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml 2009-02-21 18:17:21 UTC (rev 1238)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/WithLog.xml 2009-02-23 02:06:29 UTC (rev 1239)
@@ -9,8 +9,8 @@
<artifactId>maven-jaxx-plugin</artifactId>
<configuration>
<src>${basedir}/src/test/resources</src>
- <outJava>${basedir}/target/it-generated-source/java</outJava>
- <outResource>${basedir}/target/it-generated-source/resources</outResource>
+ <outJava>${basedir}/target/it-generated-sources/java</outJava>
+ <outResource>${basedir}/target/it-generated-sources/resources</outResource>
<force>true</force>
<addLogger>true</addLogger>
<includes>
Added: jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx
===================================================================
--- jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx (rev 0)
+++ jaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/decorator/BoxedDecorator.jaxx 2009-02-23 02:06:29 UTC (rev 1239)
@@ -0,0 +1,3 @@
+<JPanel id='root'>
+ <JButton id='boxedButton' decorator='boxed'/>
+</JPanel>
1
0
r1238 - in jaxx/trunk/jaxx-runtime-api: . src/main/java/jaxx/runtime src/test/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 21 Feb '09
by tchemit@users.labs.libre-entreprise.org 21 Feb '09
21 Feb '09
Author: tchemit
Date: 2009-02-21 18:17:21 +0000 (Sat, 21 Feb 2009)
New Revision: 1238
Added:
jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java
jaxx/trunk/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java
Modified:
jaxx/trunk/jaxx-runtime-api/changelog.txt
Log:
introduce DefaultApplicationContext iwth annotation system.
Modified: jaxx/trunk/jaxx-runtime-api/changelog.txt
===================================================================
--- jaxx/trunk/jaxx-runtime-api/changelog.txt 2009-02-20 14:33:52 UTC (rev 1237)
+++ jaxx/trunk/jaxx-runtime-api/changelog.txt 2009-02-21 18:17:21 UTC (rev 1238)
@@ -1,3 +1,6 @@
+1.2 ??? 2009????
+ * 2009021 [chemit] - introduce DefaultApplicationContext iwth annotation system.
+
1.1 chemit 20090220
* 20090124 [chemit] - add methods to retreave icons from UIManager in Util class
* 20090123 [chemit] - add a simple createIcon method in Util classe (to create an icon with no path prefix)
Added: jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java
===================================================================
--- jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java (rev 0)
+++ jaxx/trunk/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java 2009-02-21 18:17:21 UTC (rev 1238)
@@ -0,0 +1,222 @@
+package jaxx.runtime;
+
+import java.lang.annotation.*;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The default context to be used for an application.
+ *
+ * This extends the {@link DefaultJAXXContext} and add a possibility to auto-instanciate
+ * some classes asked via {@link #getContextValue(java.lang.Class)} and
+ * {@link #getContextValue(java.lang.Class, java.lang.String)} methods.
+ *
+ * To registred a such class, just annotate your class with {@link AutoLoad}.
+ *
+ * @author chemit
+ * @since 1.2
+ * @see DefaultJAXXContext
+ */
+public class DefaultApplicationContext extends DefaultJAXXContext {
+
+ /**
+ * A class annotated @AutoLoad is used by context to auto
+ * instanciate the class when required.
+ *
+ * Note : A such class always have a public default constructor.
+ *
+ * @author chemit
+ * @version 1.0, 21/02/09
+ * @since 1.2
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ public static @interface AutoLoad {
+ //TODO use this to add a method to init
+
+ String initMethod() default "";
+ }
+
+ /**
+ * A class annotated @MethodAccess is used by context to obtain the value
+ * of an entry via a declared method.
+ *
+ * Note : A such class must have a method called {@link #methodName()} with
+ * a single String parameter.
+ *
+ * @author chemit
+ * @version 1.0, 21/02/09
+ * @since 1.2
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ public static @interface MethodAccess {
+
+ /**
+ * Define a forward to a target class. When the target class
+ * will be asked with method {@link #getContextValue(java.lang.Class, java.lang.String)}
+ * it will be delegating to this class.
+ *
+ * @return the forwarded class
+ */
+ Class<?> target() default Object.class;
+
+ /**
+ * @return the name of the method to access data
+ */
+ String methodName();
+ }
+ /**
+ * Map of forwarded classes (key) to classes (values).
+ */
+ protected Map<Class, Class> forwards;
+
+ public DefaultApplicationContext() {
+ super();
+ forwards = new HashMap<Class, Class>();
+ }
+
+ public DefaultApplicationContext(JAXXObject ui) {
+ super(ui);
+ }
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private final Log log = LogFactory.getLog(DefaultApplicationContext.class);
+
+ @SuppressWarnings({"unchecked"})
+ @Override
+ public <T> T getContextValue(Class<T> clazz, String name) {
+ Object value = null;
+ MethodAccess access;
+
+ Class<?> realClass;
+
+ if (forwards.containsKey(clazz)) {
+ // this is a forward class
+ realClass = forwards.get(clazz);
+ // always call the forwarder with no name
+ value = getContextValue(realClass, null);
+ if (log.isDebugEnabled()) {
+ log.debug("detect forward from " + clazz + " to " + realClass + " (" + value + ")");
+ }
+
+ } else {
+ realClass = clazz;
+ value = super.getContextValue(realClass, name);
+ }
+
+ if (value == null) {
+ AutoLoad anno = clazz.getAnnotation(AutoLoad.class);
+
+ if (anno == null) {
+ // no annotation, so do nothing
+ return null;
+ }
+
+ if (name != null) {
+ throw new IllegalArgumentException("an " + AutoLoad.class.getName() + " can not have a named context but was call with this one : " + name);
+ }
+ value = newInstance(clazz);
+ if (log.isDebugEnabled()) {
+ log.debug("new instance " + clazz + " : " + value);
+ }
+ // save new instance
+ setContextValue(value, null);
+ }
+
+ access = realClass.getAnnotation(MethodAccess.class);
+
+ if (access != null) {
+ if (name == null) {
+ if (access.target() != Object.class) {
+ // register forward
+ Class<?> targetClass = access.target();
+ if (!forwards.containsKey(targetClass)) {
+ // register forward
+ forwards.put(targetClass, clazz);
+ if (log.isDebugEnabled()) {
+ log.debug("register forward from " + targetClass + " to " + clazz);
+ }
+ }
+ }
+ } else {
+ // specialized access
+ value = newAccess(realClass, value, access.methodName(), name);
+ }
+ }
+ return (T) value;
+ }
+
+ @Override
+ public <T> void removeContextValue(Class<T> klazz, String name) {
+ Entry<Class, Class> entry;
+ if (name == null && forwards.containsValue(klazz)) {
+ // remove forward
+ Iterator<Entry<Class, Class>> itr = forwards.entrySet().iterator();
+ while (itr.hasNext()) {
+ entry = itr.next();
+ if (entry.getValue().equals(klazz)) {
+ itr.remove();
+ if (log.isDebugEnabled()) {
+ log.debug("removed forward from " + entry.getKey() + " to " + klazz);
+ }
+ break;
+ }
+ }
+ }
+ //FIXME should update forwards state
+ super.removeContextValue(klazz, name);
+ }
+
+ protected Object newInstance(Class<?> clazz) throws IllegalArgumentException {
+
+ Object value = null;
+
+ Constructor<?> constructor = null;
+ try {
+ constructor = clazz.getConstructor();
+ // auto instanciate the class
+ if (constructor == null) {
+ throw new IllegalArgumentException(clazz + " has no public constructor");
+ }
+ } catch (NoSuchMethodException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (SecurityException ex) {
+ throw new IllegalArgumentException(ex);
+ }
+ try {
+ value = constructor.newInstance();
+
+ } catch (InstantiationException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (IllegalAccessException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (InvocationTargetException ex) {
+ throw new IllegalArgumentException(ex);
+ }
+ return value;
+ }
+
+ protected Object newAccess(Class<?> clazz, Object parent, String methodName, String name) throws IllegalArgumentException {
+ Object value;
+ try {
+ Method m = clazz.getMethod(methodName, String.class);
+ value = m.invoke(parent, name);
+ return value;
+ } catch (NoSuchMethodException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (SecurityException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (IllegalAccessException ex) {
+ throw new IllegalArgumentException(ex);
+ } catch (InvocationTargetException ex) {
+ throw new IllegalArgumentException(ex);
+ }
+ }
+}
Added: jaxx/trunk/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java
===================================================================
--- jaxx/trunk/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java (rev 0)
+++ jaxx/trunk/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java 2009-02-21 18:17:21 UTC (rev 1238)
@@ -0,0 +1,117 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package jaxx.runtime;
+
+import jaxx.runtime.DefaultApplicationContext.AutoLoad;
+import jaxx.runtime.DefaultApplicationContext.MethodAccess;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author tony
+ */
+public class DefaultApplicationContextTest {
+
+ static int helloCount;
+ static int helloGetCount;
+
+ @AutoLoad
+ @MethodAccess(methodName = "hello", target = String.class)
+ public static class Hello {
+
+ public Hello() {
+ helloCount++;
+ }
+
+ public String hello(String name) {
+ helloGetCount++;
+ return "hello " + name;
+ }
+ }
+ DefaultApplicationContext context;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ helloCount = 0;
+ helloGetCount = 0;
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ context = new DefaultApplicationContext();
+ assertEquals(0, helloCount);
+ assertEquals(0, helloGetCount);
+ }
+
+ @After
+ public void tearDown() {
+ context = null;
+ helloCount = helloGetCount = 0;
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testAutoLoadNamed() {
+ context.getContextValue(Hello.class, "fakeName");
+ }
+
+ @Test
+ public void testAutoLoad() {
+ Hello hello = context.getContextValue(Hello.class);
+ assertNotNull(hello);
+ assertEquals(1, helloCount);
+
+ Hello hello2 = context.getContextValue(Hello.class);
+ assertNotNull(hello2);
+ assertEquals(1, helloCount);
+ assertEquals(hello, hello2);
+ }
+
+ @Test
+ public void testForward() {
+ context.getContextValue(Hello.class);
+ assertEquals(1, helloCount);
+ String response = context.getContextValue(String.class, "John");
+ assertNotNull(response);
+ assertEquals(1, helloGetCount);
+ assertEquals(new Hello().hello("John"), response);
+ }
+
+ @Test
+ public void testRemove() {
+ String response;
+
+ context.getContextValue(Hello.class);
+ assertEquals(1, helloCount);
+ assertEquals(1, context.forwards.size());
+ response = context.getContextValue(String.class, "John");
+ assertNotNull(response);
+
+ context.removeContextValue(Hello.class);
+ assertEquals(0, context.forwards.size());
+ response = context.getContextValue(String.class, "John");
+ assertEquals(1, helloCount);
+ assertNull(response);
+
+ // reinstanciate the service
+ context.getContextValue(Hello.class);
+ assertEquals(2, helloCount);
+ assertEquals(1, context.forwards.size());
+
+ // no effect with a name
+ context.removeContextValue(Hello.class, "fake");
+ assertEquals(1, context.forwards.size());
+ context.getContextValue(Hello.class);
+ assertEquals(2, helloCount);
+ }
+}
\ No newline at end of file
1
0
Author: tchemit
Date: 2009-02-20 14:33:52 +0000 (Fri, 20 Feb 2009)
New Revision: 1237
Modified:
jaxx/tags/1.1/jaxx-example/pom.xml
Log:
fix bug on jnlp site (wrong phase)
Modified: jaxx/tags/1.1/jaxx-example/pom.xml
===================================================================
--- jaxx/tags/1.1/jaxx-example/pom.xml 2009-02-20 14:29:45 UTC (rev 1236)
+++ jaxx/tags/1.1/jaxx-example/pom.xml 2009-02-20 14:33:52 UTC (rev 1237)
@@ -171,7 +171,7 @@
<!-- Ajout des libs signe par Sun dans un fichier jnlp separe -->
<execution>
<id>JnlpSun</id>
- <phase>compile</phase>
+ <phase>verify</phase>
<configuration>
<tasks>
<mkdir dir="${jnlp.build.directory}" />
1
0
Author: tchemit
Date: 2009-02-20 14:29:45 +0000 (Fri, 20 Feb 2009)
New Revision: 1236
Modified:
jaxx/trunk/jaxx-example/pom.xml
Log:
fix jnlp site bug (wrong phase)
Modified: jaxx/trunk/jaxx-example/pom.xml
===================================================================
--- jaxx/trunk/jaxx-example/pom.xml 2009-02-20 14:03:57 UTC (rev 1235)
+++ jaxx/trunk/jaxx-example/pom.xml 2009-02-20 14:29:45 UTC (rev 1236)
@@ -172,7 +172,7 @@
<!-- Ajout des libs signe par Sun dans un fichier jnlp separe -->
<execution>
<id>JnlpSun</id>
- <phase>compile</phase>
+ <phase>verify</phase>
<configuration>
<tasks>
<mkdir dir="${jnlp.build.directory}"/>
1
0