Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
May 2010
- 2 participants
- 78 discussions
07 May '10
Author: tchemit
Date: 2010-05-07 18:16:55 +0200 (Fri, 07 May 2010)
New Revision: 1881
Url: http://nuiton.org/repositories/revision/jaxx/1881
Log:
fix svn:ignore
Modified:
trunk/jaxx-tutorial-config/
trunk/jaxx-tutorial/
Property changes on: trunk/jaxx-tutorial
___________________________________________________________________
Added: svn:ignore
+ target
*.iml
*.ipr
*.iws
.classpath
.project
Property changes on: trunk/jaxx-tutorial-config
___________________________________________________________________
Added: svn:ignore
+ target
*.log
*.ipr
*.iws
*.iml
.classpath
.project
1
0
Author: tchemit
Date: 2010-05-07 17:48:43 +0200 (Fri, 07 May 2010)
New Revision: 1880
Url: http://nuiton.org/repositories/revision/jaxx/1880
Log:
add jaxx-tutorial + jaxx-tutorial-config modules
Added:
trunk/jaxx-tutorial-config/
trunk/jaxx-tutorial-config/LICENSE.txt
trunk/jaxx-tutorial-config/README.txt
trunk/jaxx-tutorial-config/changelog.txt
trunk/jaxx-tutorial-config/pom.xml
trunk/jaxx-tutorial-config/src/
trunk/jaxx-tutorial-config/src/main/
trunk/jaxx-tutorial-config/src/main/java/
trunk/jaxx-tutorial-config/src/main/java/jaxx/
trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/
trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/
trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/DemoConfig.java
trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/RunDemo.java
trunk/jaxx-tutorial-config/src/main/resources/
trunk/jaxx-tutorial-config/src/main/resources/i18n/
trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-en_GB.properties
trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-fr_FR.properties
trunk/jaxx-tutorial-config/src/main/resources/icons/
trunk/jaxx-tutorial-config/src/main/resources/icons/action-about.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-accept.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-block.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-close.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-config.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-exit.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-fullscreen.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-help.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-i18n-fr.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-i18n-uk.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-leave-fullscreen.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-reload-application.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-reload-ui.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-show-help.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-site.png
trunk/jaxx-tutorial-config/src/main/resources/icons/action-translate.png
trunk/jaxx-tutorial-config/src/main/resources/icons/jaxx.png
trunk/jaxx-tutorial-config/src/main/resources/log4j.properties
trunk/jaxx-tutorial-config/src/site/
trunk/jaxx-tutorial-config/src/site/rst/
trunk/jaxx-tutorial-config/src/site/rst/images/
trunk/jaxx-tutorial-config/src/site/rst/images/webstart.gif
trunk/jaxx-tutorial-config/src/site/rst/index.rst
trunk/jaxx-tutorial-config/src/site/site_fr.xml
trunk/jaxx-tutorial/
trunk/jaxx-tutorial/LICENSE.txt
trunk/jaxx-tutorial/README.txt
trunk/jaxx-tutorial/changelog.txt
trunk/jaxx-tutorial/pom.xml
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/application/
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/application/config/
Modified:
trunk/jaxx-demo/pom.xml
trunk/jaxx-demo/src/main/resources/log4j.properties
trunk/pom.xml
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-05-07 08:52:07 UTC (rev 1879)
+++ trunk/jaxx-demo/pom.xml 2010-05-07 15:48:43 UTC (rev 1880)
@@ -95,7 +95,7 @@
<properties>
- <maven.jar.main.class>jaxx.demo.RunDemo</maven.jar.main.class>
+ <maven.jar.main.class>jaxx.demo.config.RunDemo</maven.jar.main.class>
<jaxx.addProjectClassPath>true</jaxx.addProjectClassPath>
<jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath>
Modified: trunk/jaxx-demo/src/main/resources/log4j.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/log4j.properties 2010-05-07 08:52:07 UTC (rev 1879)
+++ trunk/jaxx-demo/src/main/resources/log4j.properties 2010-05-07 15:48:43 UTC (rev 1880)
@@ -6,7 +6,7 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
log4j.logger.jaxx.demo=INFO
-#log4j.logger.jaxx.demo.DemoConfig=DEBUG
+#log4j.logger.jaxx.demo.config.DemoConfig=DEBUG
log4j.logger.jaxx.runtime.swing.editor.config=INFO
#log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG
log4j.logger.org.nuiton=WARN
Property changes on: trunk/jaxx-tutorial
___________________________________________________________________
Added: svn.ignore
+ target
*.iml
*.ipr
*.iws
Added: trunk/jaxx-tutorial/LICENSE.txt
===================================================================
--- trunk/jaxx-tutorial/LICENSE.txt (rev 0)
+++ trunk/jaxx-tutorial/LICENSE.txt 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Property changes on: trunk/jaxx-tutorial/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial/README.txt
===================================================================
--- trunk/jaxx-tutorial/README.txt (rev 0)
+++ trunk/jaxx-tutorial/README.txt 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
Property changes on: trunk/jaxx-tutorial/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial/changelog.txt
===================================================================
--- trunk/jaxx-tutorial/changelog.txt (rev 0)
+++ trunk/jaxx-tutorial/changelog.txt 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,2 @@
+1.7.2
+ * 20091003 [chemit] - initial release (insparated from obsolote jaxx-example module)
Property changes on: trunk/jaxx-tutorial/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial/pom.xml
===================================================================
--- trunk/jaxx-tutorial/pom.xml (rev 0)
+++ trunk/jaxx-tutorial/pom.xml 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ JAXX :: Demo
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>jaxx</artifactId>
+ <version>2.0.2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.nuiton.jaxx</groupId>
+ <artifactId>jaxx-tutorial</artifactId>
+
+ <modules>
+ <module>../jaxx-tutorial-config</module>
+ </modules>
+
+
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>JAXX :: Tutorial</name>
+ <description>JAXX Tutorial parent pom</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>pom</packaging>
+
+ <build>
+
+ <pluginManagement>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.nuiton.thirdparty</groupId>
+ <artifactId>webstart-maven-plugin</artifactId>
+ <configuration>
+ <jnlpExtensions>
+ <jnlpExtension>
+ <name>sun</name>
+ <title>Sun MicroSystems</title>
+ <vendor>Sun MicroSystems, Inc.</vendor>
+ <includes>
+ <include>javax.help:javahelp</include>
+ </includes>
+ </jnlpExtension>
+ <jnlpExtension>
+ <name>jxlayer</name>
+ <title>Swing labs JXLayer</title>
+ <vendor>Swing Labs</vendor>
+ <includes>
+ <include>org.swinglabs:jxlayer</include>
+ </includes>
+ </jnlpExtension>
+ </jnlpExtensions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </pluginManagement>
+
+ </build>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <profiles>
+ <!-- by default jnlp is only perform on a release stage when using the maven-release-plugin -->
+ <profile>
+ <id>jnlp</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <!-- key store secrets availables -->
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>get-keystore</id>
+ <goals>
+ <goal>share-server-secret</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <serverId>codelutin-keystore</serverId>
+ <privateKeyOut>keystorepath</privateKeyOut>
+ <passwordOut>keystorepass</passwordOut>
+ <usernameOut>keyalias</usernameOut>
+ <passphraseOut>keypass</passphraseOut>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- make webstart -->
+ <plugin>
+ <groupId>org.nuiton.thirdparty</groupId>
+ <artifactId>webstart-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jnlp</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jnlp-inline</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- by default jnlp is only perform on a release stage when using the maven-release-plugin -->
+ <profile>
+ <id>reporting</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton.thirdparty</groupId>
+ <artifactId>webstart-maven-plugin</artifactId>
+ <version>1.0-alpha-2-cl_20091001</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ </profile>
+
+ <profile>
+ <id>staging-site-profile</id>
+ <activation>
+ <property>
+ <name>stagingSite</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <jnlp.codebase>http://maven-site.liosalfar/jaxx/jaxx-demo/jnlp
+ </jnlp.codebase>
+ </properties>
+ </profile>
+
+ </profiles>
+
+</project>
Property changes on: trunk/jaxx-tutorial/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/jaxx-tutorial-config
___________________________________________________________________
Added: svn.ignore
+ target
*.ipr
*.iml
*.iws
*.log
Added: trunk/jaxx-tutorial-config/LICENSE.txt
===================================================================
--- trunk/jaxx-tutorial-config/LICENSE.txt (rev 0)
+++ trunk/jaxx-tutorial-config/LICENSE.txt 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Property changes on: trunk/jaxx-tutorial-config/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/README.txt
===================================================================
--- trunk/jaxx-tutorial-config/README.txt (rev 0)
+++ trunk/jaxx-tutorial-config/README.txt 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
Property changes on: trunk/jaxx-tutorial-config/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/changelog.txt
===================================================================
--- trunk/jaxx-tutorial-config/changelog.txt (rev 0)
+++ trunk/jaxx-tutorial-config/changelog.txt 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,2 @@
+1.7.2
+ * 20091003 [chemit] - initial release (insparated from obsolote jaxx-example module)
Property changes on: trunk/jaxx-tutorial-config/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/pom.xml
===================================================================
--- trunk/jaxx-tutorial-config/pom.xml (rev 0)
+++ trunk/jaxx-tutorial-config/pom.xml 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ JAXX :: Demo
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+
+ <parent>
+ <groupId>org.nuiton.jaxx</groupId>
+ <artifactId>jaxx-tutorial</artifactId>
+ <version>2.0.2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.nuiton.jaxx</groupId>
+ <artifactId>jaxx-tutorial-config</artifactId>
+
+ <dependencies>
+
+ <!-- sibiling dependencies -->
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jaxx-runtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jaxx-widgets</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>JAXX :: Tutorial Config</name>
+ <description>JAXX Tutorial Config</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <properties>
+
+ <maven.jar.main.class>jaxx.demo.config.RunDemo</maven.jar.main.class>
+
+ <jaxx.addProjectClassPath>true</jaxx.addProjectClassPath>
+ <jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath>
+ <jaxx.autoImportCss>true</jaxx.autoImportCss>
+
+ <!-- generate license bundled files -->
+ <license.generateBundle>true</license.generateBundle>
+
+ </properties>
+
+ <build>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <pluginManagement>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <useUniqueVersions>false</useUniqueVersions>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>./lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </pluginManagement>
+
+ <plugins>
+
+ <!--plugin>
+ <groupId>org.nuiton.jaxx</groupId>
+ <artifactId>maven-jaxx-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin-->
+
+ <plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <!--configuration>
+ <treateDefaultEntry>true</treateDefaultEntry>
+ <entries>
+ <entry>
+ <basedir>${maven.gen.dir}/java/</basedir>
+ </entry>
+ </entries>
+ </configuration-->
+ <executions>
+ <execution>
+ <goals>
+ <goal>parserJava</goal>
+ <goal>gen</goal>
+ <goal>bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ <silent>true</silent>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-licenses</id>
+ <goals>
+ <goal>update-project-license</goal>
+ <goal>add-third-party</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin-->
+
+ </plugins>
+ </build>
+
+</project>
Property changes on: trunk/jaxx-tutorial-config/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/DemoConfig.java
===================================================================
--- trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/DemoConfig.java (rev 0)
+++ trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/DemoConfig.java 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,190 @@
+package jaxx.demo.config;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.ApplicationConfig;
+
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * La configuration de l'application.
+ * <p/>
+ * Il s'agit de l'objet partagé par toutes les démos.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public class DemoConfig extends ApplicationConfig {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(DemoConfig.class);
+
+ /**
+ * le fichier de configuration de l'application avec les informations sur
+ * le projet (version, license,...) et la configuration des ui (icons, ...)
+ */
+ public static final String APPLICATION_PROPERTIES = "/jaxx-demo.properties";
+
+ public static final String PROPERTY_FULLSCREEN = "fullscreen";
+
+ public static final String PROPERTY_LOCALE = "locale";
+
+ public static final String PROPERTY_FONT_SIZE = "fontSize";
+
+ public DemoConfig() {
+
+ setConfigFileName(Option.CONFIG_FILE.defaultValue);
+
+ for (Option o : Option.values()) {
+ setDefaultOption(o.key, o.defaultValue);
+ }
+
+ installSaveUserAction(PROPERTY_FULLSCREEN,
+ PROPERTY_FONT_SIZE,
+ PROPERTY_LOCALE);
+ }
+
+ public boolean isFullScreen() {
+ Boolean result = getOptionAsBoolean(Option.FULL_SCREEN.key);
+ return result != null && result;
+ }
+
+ public Locale getLocale() {
+ Locale result = getOption(Locale.class, Option.LOCALE.key);
+ return result;
+ }
+
+ public Float getFontSize() {
+ Float result = getOption(Float.class, Option.FONT_SIZE.key);
+ return result;
+ }
+
+ public void setFullscreen(boolean fullscreen) {
+ Object oldValue = null;
+ setOption(Option.FULL_SCREEN.key, fullscreen + "");
+ firePropertyChange(PROPERTY_FULLSCREEN, oldValue, fullscreen);
+ }
+
+ public void setLocale(Locale newLocale) {
+ setOption(Option.LOCALE.key, newLocale.toString());
+ firePropertyChange(PROPERTY_LOCALE, null, newLocale);
+ }
+
+ public void setFontSize(Float newFontSize) {
+ Float oldValue = getFontSize();
+ if (log.isDebugEnabled()) {
+ log.debug("changing font-size to " + newFontSize);
+ }
+ setOption(Option.FONT_SIZE.key, newFontSize.toString());
+ firePropertyChange(PROPERTY_FONT_SIZE, oldValue, newFontSize);
+ }
+
+ //////////////////////////////////////////////////
+ // Toutes les options disponibles
+ //////////////////////////////////////////////////
+
+ public enum Option implements OptionDef {
+
+ CONFIG_FILE(
+ CONFIG_FILE_NAME,
+ _("jaxxdemo.config.configFileName.description"),
+ "jaxxdemo",
+ String.class,
+ true,
+ true),
+ FULL_SCREEN(
+ "ui.fullscreen",
+ _("jaxxdemo.config.ui.fullscreen"),
+ "false",
+ Boolean.class,
+ false,
+ false),
+ LOCALE(
+ "ui." + PROPERTY_LOCALE,
+ _("jaxxdemo.config.ui.locale"),
+ Locale.FRANCE.toString(),
+ Locale.class,
+ false,
+ false),
+ FONT_SIZE(
+ "ui." + PROPERTY_FONT_SIZE,
+ _("jaxxdemo.config.ui.fontSize"),
+ "10f",
+ Float.class,
+ false,
+ false);
+
+ public final String key;
+
+ public final String description;
+
+ public String defaultValue;
+
+ public final Class<?> type;
+
+ public boolean _transient;
+
+ public boolean _final;
+
+ Option(String key,
+ String description,
+ String defaultValue,
+ Class<?> type,
+ boolean _transient,
+ boolean _final) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this._final = _final;
+ this._transient = _transient;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return _final;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public void setTransient(boolean _transient) {
+ this._transient = _transient;
+ }
+
+ @Override
+ public void setFinal(boolean _final) {
+ this._final = _final;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return _transient;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+ }
+}
Property changes on: trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/DemoConfig.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/RunDemo.java
===================================================================
--- trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/RunDemo.java (rev 0)
+++ trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/RunDemo.java 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,141 @@
+package jaxx.demo.config;
+
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.context.DefaultApplicationContext;
+import jaxx.runtime.context.JAXXInitialContext;
+import jaxx.runtime.swing.editor.config.ConfigUIHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import java.util.Arrays;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public class RunDemo {
+
+ /** Logger */
+ private static Log log = LogFactory.getLog(RunDemo.class);
+
+ /** The singleton instance of the main context */
+ protected static DefaultApplicationContext context;
+
+ public static void main(String[] args) {
+
+ log.info("JAXX Demo start at " + new Date() + " args: " + Arrays.toString(args));
+
+ try {
+
+ I18n.setInitializer(new DefaultI18nInitializer("jaxx-tutorial-config-i18n"));
+
+ // init config
+ DemoConfig config = new DemoConfig();
+
+ // init i18n
+ I18n.init(config.getLocale());
+
+ // prepare ui look&feel and load ui properties
+
+ try {
+ SwingUtil.initNimbusLoookAndFeel();
+ } catch (Exception e) {
+ // could not find nimbus look-and-feel
+ log.warn(_("jaxxdemo.warning.nimbus.landf"));
+ } catch (Throwable e) {
+ log.warn(_("jaxxdemo.warning.no.ui"));
+ }
+
+ // instanciate config helper
+ ConfigUIHelper helper = new ConfigUIHelper(config);
+
+ // build the config ui
+ buildConfigUI(helper);
+
+ // display it
+ JFrame parentUI = new JFrame();
+
+ helper.displayUI(parentUI, true);
+
+ // will force quit after quitting config ui
+ parentUI.dispose();
+
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+
+ public static void buildConfigUI(ConfigUIHelper helper) {
+
+ Runnable reloadUICallback = new Runnable() {
+
+ @Override
+ public void run() {
+ if (log.isInfoEnabled()) {
+ log.info("will say Hello world");
+ }
+ JOptionPane.showMessageDialog(null, "Hello World!");
+ }
+ };
+
+ Runnable reloadApplicationCallback = new Runnable() {
+
+ @Override
+ public void run() {
+ if (log.isInfoEnabled()) {
+ log.info("will reload appplication");
+ }
+ if (log.isInfoEnabled()) {
+ log.info("will say Good Bye world");
+ }
+ JOptionPane.showMessageDialog(null, "Good Bye World!");
+ }
+ };
+
+ helper.registerCallBack("ui",
+ n_("demo.action.reload.ui"),
+ SwingUtil.createActionIcon("reload-ui"),
+ reloadUICallback);
+
+ helper.registerCallBack("application",
+ n_("demo.action.reload.application"),
+ SwingUtil.createActionIcon("reload-application"),
+ reloadApplicationCallback);
+
+ // categorie repertoires
+
+ helper.addCategory(n_("jaxxdemo.config.category.directories"),
+ n_("jaxxdemo.config.category.directories.description"));
+
+ helper.addOption(DemoConfig.Option.CONFIG_FILE);
+
+ // others
+ helper.addCategory(n_("jaxxdemo.config.category.other"),
+ n_("jaxxdemo.config.category.other.description"));
+
+ helper.addOption(DemoConfig.Option.FULL_SCREEN);
+ helper.setOptionPropertyName(DemoConfig.PROPERTY_FULLSCREEN);
+ helper.setOptionCallBack("ui");
+
+ helper.addOption(DemoConfig.Option.FONT_SIZE);
+ helper.setOptionPropertyName(DemoConfig.PROPERTY_FONT_SIZE);
+ helper.setOptionCallBack("application");
+
+ helper.addOption(DemoConfig.Option.LOCALE);
+ helper.setOptionPropertyName(DemoConfig.PROPERTY_LOCALE);
+ helper.setOptionCallBack("ui");
+
+ helper.buildUI(new JAXXInitialContext(),
+ "jaxxdemo.config.category.other");
+
+ }
+
+}
Property changes on: trunk/jaxx-tutorial-config/src/main/java/jaxx/demo/config/RunDemo.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-en_GB.properties
===================================================================
--- trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-en_GB.properties (rev 0)
+++ trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-en_GB.properties 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,14 @@
+config.title=
+demo.action.reload.application=Reload application
+demo.action.reload.ui=Reload UI
+jaxxdemo.config.category.directories=Files
+jaxxdemo.config.category.directories.description=Files used by application
+jaxxdemo.config.category.other=Others
+jaxxdemo.config.category.other.description=Others preferences
+jaxxdemo.config.configFileName.description=Configuration file name
+jaxxdemo.config.ui.fontSize=default font size to use in sources
+jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
+jaxxdemo.config.ui.locale=Language used in application
+jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded.
+jaxxdemo.warning.nimbus.landf=Could not init nymbus look and feel, you need at leasr version 1.6u10 of java.
+jaxxdemo.warning.no.ui=No ui environnement detected
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-en_GB.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-fr_FR.properties
===================================================================
--- trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-fr_FR.properties (rev 0)
+++ trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-fr_FR.properties 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,14 @@
+config.title=
+demo.action.reload.application=Redemarrer l'application
+demo.action.reload.ui=Recharger l'interface graphique
+jaxxdemo.config.category.directories=R\u00E9pertoires
+jaxxdemo.config.category.directories.description=R\u00E9pertoires de l'application
+jaxxdemo.config.category.other=Autre
+jaxxdemo.config.category.other.description=Autres options
+jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
+jaxxdemo.config.ui.fontSize=La taille de la police \u00E0 utiliser pour visualiser dans les sources
+jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
+jaxxdemo.config.ui.locale=La langue utilis\u00E9e par l'application
+jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00E9e.
+jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00E9t\u00E9 trouv\u00E9, il faut au moins la version 1.6u10 de java.
+jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/i18n/jaxx-tutorial-config-fr_FR.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-about.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-accept.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-accept.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-block.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-block.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-close.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-close.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-config.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-exit.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-exit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-fullscreen.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-fullscreen.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-help.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-help.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-i18n-fr.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-i18n-fr.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-i18n-uk.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-i18n-uk.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-leave-fullscreen.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-leave-fullscreen.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-reload-application.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-reload-application.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-reload-ui.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-reload-ui.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-show-help.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-show-help.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-site.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-site.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/action-translate.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/action-translate.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/icons/jaxx.png
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/icons/jaxx.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/main/resources/log4j.properties
===================================================================
--- trunk/jaxx-tutorial-config/src/main/resources/log4j.properties (rev 0)
+++ trunk/jaxx-tutorial-config/src/main/resources/log4j.properties 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,12 @@
+# Global logging configuration
+log4j.rootLogger=ERROR, stdout
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
+
+log4j.logger.jaxx.demo=INFO
+#log4j.logger.jaxx.demo.config.DemoConfig=DEBUG
+log4j.logger.jaxx.runtime.swing.editor.config=INFO
+#log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG
+log4j.logger.org.nuiton=WARN
Property changes on: trunk/jaxx-tutorial-config/src/main/resources/log4j.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/site/rst/images/webstart.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jaxx-tutorial-config/src/site/rst/images/webstart.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/site/rst/index.rst
===================================================================
--- trunk/jaxx-tutorial-config/src/site/rst/index.rst (rev 0)
+++ trunk/jaxx-tutorial-config/src/site/rst/index.rst 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,22 @@
+===============
+Tutorial Config
+===============
+
+TODO
+
+Set it in action
+----------------
+
+|webstart|
+
+To run this example in `Java Web Start`_, click the `following link`_.
+
+For more details about the `Jaxx Demo webstart`_.
+
+.. _Java Web Start: http://java.sun.com/products/javawebstart/
+
+.. |webstart| image:: images/webstart.gif
+
+.. _following link: ./jnlp/launch.jnlp
+
+.. _Jaxx Demo webstart: jnlp-report.html
Property changes on: trunk/jaxx-tutorial-config/src/site/rst/index.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-tutorial-config/src/site/site_fr.xml
===================================================================
--- trunk/jaxx-tutorial-config/src/site/site_fr.xml (rev 0)
+++ trunk/jaxx-tutorial-config/src/site/site_fr.xml 2010-05-07 15:48:43 UTC (rev 1880)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <src>${site.home.url}/jaxx.png</src>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html"/>
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur" inherited="top">
+ <item name="Accueil" href="index.html"/>
+ <item name="Lancer la démo" href="jnlp/launch.jnlp"/>
+ </menu>
+
+ </body>
+</project>
Property changes on: trunk/jaxx-tutorial-config/src/site/site_fr.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-05-07 08:52:07 UTC (rev 1879)
+++ trunk/pom.xml 2010-05-07 15:48:43 UTC (rev 1880)
@@ -49,6 +49,7 @@
<module>maven-jaxx-plugin</module>
<module>jaxx-widgets</module>
+ <module>jaxx-tutorial</module>
<!--<module>jaxx-demo</module>-->
</modules>
1
0
r1879 - in trunk/src/site: . resources resources/tutos rst rst/tutos
by jcouteau@users.nuiton.org 07 May '10
by jcouteau@users.nuiton.org 07 May '10
07 May '10
Author: jcouteau
Date: 2010-05-07 10:52:07 +0200 (Fri, 07 May 2010)
New Revision: 1879
Url: http://nuiton.org/repositories/revision/jaxx/1879
Log:
Add Helloworld tutorial
Added:
trunk/src/site/resources/tutos/
trunk/src/site/resources/tutos/helloworld.png
trunk/src/site/resources/tutos/helloworld.zip
trunk/src/site/rst/tutos/
trunk/src/site/rst/tutos/helloworld.rst
Modified:
trunk/src/site/site_fr.xml
Added: trunk/src/site/resources/tutos/helloworld.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/tutos/helloworld.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/tutos/helloworld.zip
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/tutos/helloworld.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/rst/tutos/helloworld.rst
===================================================================
--- trunk/src/site/rst/tutos/helloworld.rst (rev 0)
+++ trunk/src/site/rst/tutos/helloworld.rst 2010-05-07 08:52:07 UTC (rev 1879)
@@ -0,0 +1,146 @@
+Hello World
+===========
+
+Dans ce tutoriel, nous allons créer une fenêtre qui affiche le message
+"Hello World". Jaxx s'utilise par défaut avec le gestionnaire de
+dépendances/projet Maven. Nous supposons dans la suite de ce tutoriel que vous
+savez utiliser Maven.
+
+Créer un projet Maven/configuration de JAXX
+-------------------------------------------
+
+Nous allons commencer par créer un projet Maven simple, qui aura comme unique
+source un fichier jaxx.
+
+Dans le pom.xml, il faut configurer les repository nuiton pour pouvoir
+bénéficier de JAXX et de son plugin Maven::
+
+ <repositories>
+
+ <!-- nuiton releases repository, needed to get jaxx -->
+
+ <repository>
+ <id>nuiton.release</id>
+ <name>NuitonReleaseRepository</name>
+ <url>http://maven.nuiton.org/release</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </repository>
+
+ </repositories>
+
+ <pluginRepositories>
+
+ <!-- nuiton plugin releases repository, needed to get jaxx plugin -->
+
+ <pluginRepository>
+
+ <id>nuiton.release</id>
+ <name>NuitonReleaseRepository</name>
+ <url>http://maven.nuiton.org/release</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </pluginRepository>
+
+ </pluginRepositories>
+
+Il est aussi nécessaire d'ajouter la dépendance vers la librairie JAXX pour
+la compilation et l'exécution::
+
+ <dependencies>
+
+ <!-- librairie Jaxx -->
+ <dependency>
+ <groupId>org.nuiton.jaxx</groupId>
+ <artifactId>jaxx-runtime</artifactId>
+ <version>2.0.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+Nous allons configurer aussi le plugin Maven pour la génération depuis les
+fichiers JAXX::
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.nuiton.jaxx</groupId>
+ <artifactId>maven-jaxx-plugin</artifactId>
+ <version>2.0.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+Le plugin JAXX doit être dans la même version que jaxx-runtime. Il faut
+spécifier l'exécution du goal generate du plugin pour que le fichier JAXX soit
+transformé en fichier Java.
+
+Pour les autres plugins, je vous laisse les configurer seuls, il s'agit juste
+de configurer maven-compiler plugins pour compiler les sources en version 1.5,
+et maven-jar-plugin et maven-dependency-plugin pour rendre le jar exécutable.
+Pour ceux qui ne sauraient pas comment faire cela, je vous laisse regarder un
+oeil aux sources disponibles au téléchargement en bas de cette page.
+
+Le fichier JAXX
+---------------
+
+Maintenant que le projet est configuré.Nous allons commencer par créer un
+fichier JAXX nommé helloworld.jaxx que nous placerons dans le package de notre
+choix (dans l'exemple, c'est org.nuiton.jaxx.tutos.helloworld mais libre à vous
+d'adapter) ::
+
+ <Application title='Hello World'>
+ <JLabel text='Hello World'/>
+ </Application>
+
+Ce fichier Jaxx est très simple, il va créer une Application helloworld qui
+étends une JFrame qui aura pour titre "Hello World" et placera dedans un
+JLabel "Hello World".
+
+Une fois que tout est créé, on se place à la racine du projet et on le build
+avec la commande ::
+
+ mvn compile
+
+Cela aura pour effet de créer notre jar exécutable si tous les plugins ont bien
+été configurés.
+
+On peut alors le lancer et on obtient le résultat suivant:
+
+.. image::helloworld.png
+
+Conclusion
+----------
+
+Ce tutoriel vous a appris comment créer simplement une petite application Swing,
+très simple au demeurant, en utilisant seulement 3 lignes de code Jaxx. Dans les
+tutoriels suivant vous allez découvrir comment réaliser des applications
+dynamiques beaucoup plus complexes.
+
+Sources de ce tutoriel
+----------------------
+
+Les sources de ce tutoriel sont disponibles au `telechargement ici`_.
+
+.. _telechargement ici::helloworld.zip
+
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2010-05-05 13:35:08 UTC (rev 1878)
+++ trunk/src/site/site_fr.xml 2010-05-07 08:52:07 UTC (rev 1879)
@@ -53,11 +53,14 @@
<item name="Qu'est-ce qu'un fichier JAXX ?" href="JAXXFile.html"/>
<item name="Fonctionalités de base">
<item name="Utiliser les objets Swing" href="useSwingObjects.html"/>
+ <item name="Les scripts JAXX" href="scripting.html"/>
+ <item name="Le data-binding" href="dataBinding.html"/>
<item name="Utiliser des styles" href="useStylesheets.html"/>
- <item name="Le data-binding" href="dataBinding.html"/>
- <item name="Les scripts JAXX" href="scripting.html"/>
</item>
<item name="Démo" href="demo.html"/>
+ <item name="Tutoriels">
+ <item name="Hello World" href="tutos/helloWorld.html"/>
+ </item>
</menu>
<menu name="Ancienne documentation">
1
0
Author: jcouteau
Date: 2010-05-05 15:35:08 +0200 (Wed, 05 May 2010)
New Revision: 1878
Url: http://nuiton.org/repositories/revision/jaxx/1878
Log:
Add links to jaxx user projects
Modified:
trunk/src/site/rst/index.rst
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-05-05 11:11:43 UTC (rev 1877)
+++ trunk/src/site/rst/index.rst 2010-05-05 13:35:08 UTC (rev 1878)
@@ -47,7 +47,7 @@
.. _demo::jaxx-demo/index.html
-TODO A faire car plus a jour...
+.. TODO A faire car plus a jour...
Le projet JAXX ...
@@ -60,7 +60,7 @@
Ce dont vous avez besoin dans vos dépendances sont uniquement les modules jaxx-runtime-xxx.
-TODO A finir la présentation de la nouvelle architecture (dans la version 1.2).
+.. TODO A finir la présentation de la nouvelle architecture (dans la version 1.2).
**Veuillez consulter la JavaDoc pour de plus ample détails sur les différentes
librairies.**
@@ -85,26 +85,35 @@
* NavigationModel_
-Who use JAXX ?
---------------
+Qui utilise JAXX ?
+------------------
-Here is a list of projects using JAXX :
+Voici une liste de projets utilisant JAXX :
- * Isis-fish
+ * Isis-fish_ - Logiciel de simulation de pêcheries complexes - GPL
- * simExplorer-si
+ * simExplorer-si_
- * ObServe
+ * ObServe_ - Logiciel de saisie de données concernant la pèche thonière - GPL
- * Lima
+ * Lima_ - Logiciel de comptabilité française adaptée aux PME - GPL
- * Vradi
+ * Vradi_ - Logiciel de traitement de flux XML - GPL
* Nuiton-i18n-editor
- TODO Finish this list and add icons and links to site
+.. TODO Finish this list and add icons
+.. _Isis-fish: http://isis-fish.labs.libre-entreprise.org/
+.. _simExplorer-si: http://www.simexplorer.org
+
+.. _ObServe: http://observe.labs.libre-entreprise.org/observe/
+
+.. _Lima: http://maven-site.chorem.org/lima/
+
+.. _Vradi: http://vradi.labs.libre-entreprise.org/vradi/index.html
+
.. _Migration: migration.html
.. _Core: Core.html
1
0
r1877 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing
by tchemit@users.nuiton.org 05 May '10
by tchemit@users.nuiton.org 05 May '10
05 May '10
Author: tchemit
Date: 2010-05-05 13:11:43 +0200 (Wed, 05 May 2010)
New Revision: 1877
Url: http://nuiton.org/repositories/revision/jaxx/1877
Log:
fix NPE when changing contextName before having init UI
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java 2010-05-05 11:11:18 UTC (rev 1876)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java 2010-05-05 11:11:43 UTC (rev 1877)
@@ -33,8 +33,9 @@
import org.apache.commons.logging.LogFactory;
import org.jdesktop.jxlayer.JXLayer;
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import java.awt.Container;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
@@ -145,8 +146,6 @@
/** ui renderer class */
protected Class<? extends AbstractBeanValidatorUI> uiClass;
-
-
public SwingValidator(Class<B> beanClass,
String contextName,
BeanValidatorScope... filterScopes) {
@@ -204,31 +203,14 @@
@Override
public void setContextName(String contextName) {
- /*Map<ValidatorField<B>, List<ValidatorErrorListener>> oldListeners = new HashMap<ValidatorField<B>, List<ValidatorErrorListener>>();
- for (ValidatorField<B> field : fields) {
- ValidatorErrorListener[] listeners = field.getValidatorErrorListeners();
- List<ValidatorErrorListener> toReinject = new ArrayList<ValidatorErrorListener>();
- for (ValidatorErrorListener listener : listeners) {
- if (listener instanceof AbstractBeanValidatorUI) {
- // this listener will be reinject via installUIs method
- continue;
- }
- toReinject.add(listener);
- }
- oldListeners.put(field, toReinject);
- }*/
super.setContextName(contextName);
// must reinstall ui
- installUIs();
- // reinject none ui listeners
- /*for (Entry<ValidatorField<B>, List<ValidatorErrorListener>> entry : oldListeners.entrySet()) {
- ValidatorField<B> field = getField(entry.getKey().getName());
- for (ValidatorErrorListener listener : entry.getValue()) {
- field.addValidatorErrorListener(listener);
+ if (fieldRepresentation != null) {
+
+ // can not install uis while field are not still init...
+ installUIs();
}
- }
- oldListeners.clear();*/
}
/**
@@ -246,6 +228,11 @@
"' is not defined in validator (no rules on it)");
return;
}
+ if (log.isDebugEnabled()) {
+ log.debug("register field [" + fieldname + "] with component : " +
+ c.getName()
+ );
+ }
fieldRepresentation.put(fieldname, c);
}
@@ -267,6 +254,11 @@
/** install ui on required components */
public void installUIs() {
+ if (fieldRepresentation == null) {
+ throw new NullPointerException(
+ "fieldRepresentation is null, must init before " +
+ "invoking installUIs method...");
+ }
SwingUtilities.invokeLater(new Runnable() {
@Override
@@ -298,9 +290,9 @@
JComponent c,
Class<? extends AbstractBeanValidatorUI> uiClass)
throws InvocationTargetException,
- IllegalAccessException,
- InstantiationException,
- NoSuchMethodException {
+ IllegalAccessException,
+ InstantiationException,
+ NoSuchMethodException {
if (old == c) {
// same component, nothing to do
return;
1
0
05 May '10
Author: tchemit
Date: 2010-05-05 13:11:18 +0200 (Wed, 05 May 2010)
New Revision: 1876
Url: http://nuiton.org/repositories/revision/jaxx/1876
Log:
improve code
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java 2010-05-05 10:07:39 UTC (rev 1875)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java 2010-05-05 11:11:18 UTC (rev 1876)
@@ -37,15 +37,15 @@
import java.util.List;
/**
- * An override of the awt {@link java.awt.CardLayout}.
+ * An override of the awt {@link CardLayout}.
* <p/>
* Because in the original layout is not overridable : everything is package level accessible.
* <p/>
* This new class offers to test if a constrains (as a Serializable) is actually dealed by the layout,
- * via the method {@link #contains(java.io.Serializable)}.
+ * via the method {@link #contains(Serializable)}.
* <p/>
* We had also another method to obtain the current visible component in a container layouted by the class,
- * via the method {@link #getVisibleComponent(java.awt.Container)}.
+ * via the method {@link #getVisibleComponent(Container)}.
*
* @author tchemit <chemit(a)codelutin.com>
* @version 1.0
@@ -80,7 +80,8 @@
* Test if a constrains is contained in the layout.
*
* @param constraints l'identifiant a tester
- * @return <code>true</code> si l'identifiant est deja present dans le layout, <code>false</code> autrement.
+ * @return {@code true} si l'identifiant est deja present dans le
+ * layout, {@code false} otherwise.
*/
public boolean contains(Serializable constraints) {
return contexts.contains(constraints);
@@ -93,9 +94,7 @@
* @return the component visible in the container.
*/
public Component getVisibleComponent(Container container) {
- if (container.getLayout() != this) {
- throw new IllegalArgumentException("the container is not managed by the current layout");
- }
+ checkContainer(container);
for (Component component : container.getComponents()) {
if (component.isVisible()) {
return component;
@@ -106,12 +105,8 @@
}
public Component getComponent(Container container, String constraints) {
- if (container.getLayout() != this) {
- throw new IllegalArgumentException("the container is not manage by the current layout");
- }
- if (!contexts.contains(constraints)) {
- throw new IllegalArgumentException("the constraints '" + constraints + "' is not supported by this layout : " + contexts);
- }
+ checkContainer(container);
+ checkConstraints(constraints);
int index = contexts.indexOf(constraints);
return container.getComponents()[index];
}
@@ -123,8 +118,8 @@
* @param parent the parent container in which to do the layout
* @return the preferred dimensions to lay out the subcomponents
* of the specified container
- * @see java.awt.Container#getPreferredSize
- * @see java.awt.CardLayout#minimumLayoutSize
+ * @see Container#getPreferredSize
+ * @see CardLayout#minimumLayoutSize
*/
@Override
public Dimension preferredLayoutSize(Container parent) {
@@ -147,8 +142,8 @@
* @param parent the parent container in which to do the layout
* @return the minimum dimensions required to lay out the
* subcomponents of the specified container
- * @see java.awt.Container#doLayout
- * @see java.awt.CardLayout#preferredLayoutSize
+ * @see Container#doLayout
+ * @see CardLayout#preferredLayoutSize
*/
@Override
public Dimension minimumLayoutSize(Container parent) {
@@ -170,7 +165,7 @@
* in the specified target container.
*
* @param target the component which needs to be laid out
- * @see java.awt.Container
+ * @see Container
* @see #minimumLayoutSize
* @see #preferredLayoutSize
*/
@@ -197,7 +192,7 @@
* insets, horizontal gaps, and vertical gaps.
*
* @param parent the parent container in which to do the layout
- * @see java.awt.Container#doLayout
+ * @see Container#doLayout
*/
@Override
public void layoutContainer(Container parent) {
@@ -231,9 +226,7 @@
* @param parent the parent container linked with the layout
*/
public void reset(Container parent) {
- if (parent.getLayout() != this) {
- throw new IllegalArgumentException("wrong parent for CardLayout");
- }
+ checkContainer(parent);
for (Component component : parent.getComponents()) {
removeLayoutComponent(component);
parent.remove(component);
@@ -242,4 +235,19 @@
}
+ protected void checkContainer(Container container) {
+ if (!equals(container.getLayout())) {
+ throw new IllegalArgumentException("the container is not managed by the current layout");
+ }
+ }
+
+ protected void checkConstraints(String constraints) {
+ if (!contains(constraints)) {
+ throw new IllegalArgumentException("the constraints '" + constraints + "' is not supported by this layout : " + contexts);
+ }
+ }
+
+ public Serializable[] getContexts() {
+ return contexts.toArray(new Serializable[contexts.size()]);
+ }
}
1
0
Author: jcouteau
Date: 2010-05-05 12:07:39 +0200 (Wed, 05 May 2010)
New Revision: 1875
Url: http://nuiton.org/repositories/revision/jaxx/1875
Log:
Add demo page
Added:
trunk/src/site/resources/demo1.png
trunk/src/site/resources/demo2.png
trunk/src/site/rst/demo.rst
Modified:
trunk/src/site/site_fr.xml
Added: trunk/src/site/resources/demo1.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/demo1.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/demo2.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/demo2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/rst/demo.rst
===================================================================
--- trunk/src/site/rst/demo.rst (rev 0)
+++ trunk/src/site/rst/demo.rst 2010-05-05 10:07:39 UTC (rev 1875)
@@ -0,0 +1,33 @@
+====
+Demo
+====
+
+Une démonstration de JAXX est disponible en utilisant Java Webstart.
+
+`Demonstration de JAXX`_
+
+..Fonctionne seulement si site déployé
+.. _Demonstration de JAXX::jaxx-demo/jnlp/launch.jnlp
+
+Cette démonstration a été réalisée en utilisant JAXX, et vous pouvez visionner
+tout ou partie du code source en cliquant sur l'onglet 'Sources'.
+
+Dans cette démonstration, vous pouvez observer nombre des atouts de JAXX et de
+ses composants :
+
+ * Boutons
+ * Eléments de formulaire
+ * Layouts
+ * Menus
+ * Fenêtres
+ * Editeurs
+ * Arbre de navigation
+ * Data-binding
+ * Validation
+
+.. image::demo1.png
+ :width:800px
+
+.. image::demo2.png
+ :width:800px
+
\ No newline at end of file
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2010-05-05 08:50:11 UTC (rev 1874)
+++ trunk/src/site/site_fr.xml 2010-05-05 10:07:39 UTC (rev 1875)
@@ -47,7 +47,7 @@
<item name="${project.name}" href="index.html" />
</breadcrumbs>
- <menu name="Utilisateur">
+ <menu name="Documentation">
<item name="Accueil" href="index.html"/>
<item name="Présentation/Concept" href="presentation.html"/>
<item name="Qu'est-ce qu'un fichier JAXX ?" href="JAXXFile.html"/>
@@ -57,10 +57,11 @@
<item name="Le data-binding" href="dataBinding.html"/>
<item name="Les scripts JAXX" href="scripting.html"/>
</item>
- <item name="Migration JAXX 2.0" href="migration.html"/>
+ <item name="Démo" href="demo.html"/>
</menu>
- <menu name="Développeur">
+ <menu name="Ancienne documentation">
+ <item name="Migration JAXX 2.0" href="migration.html"/>
<item name="A faire" href="Todo.html"/>
</menu>
1
0
Author: jcouteau
Date: 2010-05-05 10:50:11 +0200 (Wed, 05 May 2010)
New Revision: 1874
Url: http://nuiton.org/repositories/revision/jaxx/1874
Log:
Add doc about scripting
Added:
trunk/src/site/rst/scripting.rst
Modified:
trunk/src/site/site_fr.xml
Added: trunk/src/site/rst/scripting.rst
===================================================================
--- trunk/src/site/rst/scripting.rst (rev 0)
+++ trunk/src/site/rst/scripting.rst 2010-05-05 08:50:11 UTC (rev 1874)
@@ -0,0 +1,79 @@
+===============================================
+Utiliser des scripts pour améliorer l'ordinaire
+===============================================
+
+Dans JAXX, le scripting c'est la capacité d'embarquer du code Java directement
+dans les fichiers JAXX. Et contrairement à ce qu'on entends par script, le code
+n'est pas interprété à l'exécution, mais compilé afin de ne pas souffrir d'un
+défaut de performances.
+
+Dans JAXX, les scripts peuvent apparaitre à plein d'endroits :
+
+ * dans des balise script
+ * dans le data binding
+ * dans les gestionnaires d'évènements
+ * dans l'attribut constraints
+ * dans les paramètres des constructeurs
+
+Les balises script
+------------------
+
+Du code Java peut être embarqué n'importe où dans les fichiers JAXX en utilisant
+les balises <script>. Les balises script peuvent définir des méthodes, des
+champs, des constructeurs, et peuvent aussi exécuter directement du code Java.
+
+Exemple::
+
+ <script><![CDATA[
+ import javax.swing.table.JTableHeader;
+
+ public SearchHandler getSearchHandler() {
+ return getContextValue(SearchHandler.class);
+ }
+ ]]>
+ </script>
+
+Le data-binding
+---------------
+
+Le code Java peut être placé en valeur d'attributs XML quand il est échappé par
+des accolades ({ }). La valeur de l'attribut est ensuite calculée en utilisant
+le code Java, et recalculée quand ses dépendances (s'il y en a) changent. Cette
+utilisation des script est appelée data-binding_
+
+.. _data-binding::dataBinding.html
+
+Exemple::
+
+ <JPanel layout='{new BorderLayout()}'>
+
+Gestionnaires d'évènements
+--------------------------
+
+Dans les balises de classes, les attributs dont le nom commence par 'on' suivi
+d'une majuscule (e.g. onMousePressed, onActionPerformed) sont des gestionnaires
+d'évènement. La valeur de l'attribut est du code Java qui est exécuté lorsque
+l'évènement est lancé.
+
+Exemple::
+
+ <JButton onActionPerformed='myAction()'/>
+
+Attribut constraints
+--------------------
+
+Sur les composants, l'attribut constraints spécifie les contraintes du layout
+(e.g. BorderLayout.NORTH, GridBagConstraints) qui devraient être utilisées
+lorsque le composant est ajouté dans son conteneur parent. La valeur de cet
+attribut est du code Java qui est évalué à la création du composant.
+
+Exemple::
+
+ <JButton constraints='BorderLayout.SOUTH'/>
+
+Paramètres des constructeurs
+----------------------------
+
+Dans les balises de classe, l'attribut constructorParams spécifie les
+paramètres, séparés par des virgules, du constructeur de l'objet. Ces paramètres
+sont interprétés comme du code Java.
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2010-05-04 19:48:38 UTC (rev 1873)
+++ trunk/src/site/site_fr.xml 2010-05-05 08:50:11 UTC (rev 1874)
@@ -55,6 +55,7 @@
<item name="Utiliser les objets Swing" href="useSwingObjects.html"/>
<item name="Utiliser des styles" href="useStylesheets.html"/>
<item name="Le data-binding" href="dataBinding.html"/>
+ <item name="Les scripts JAXX" href="scripting.html"/>
</item>
<item name="Migration JAXX 2.0" href="migration.html"/>
</menu>
1
0
Author: tchemit
Date: 2010-05-04 21:48:38 +0200 (Tue, 04 May 2010)
New Revision: 1873
Url: http://nuiton.org/repositories/revision/jaxx/1873
Log:
- introduce ClassDescriptorResolver to clean the mess of ClassDescriptorLoader class
- deprecated no more use classes
Added:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorHelper.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorResolver.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/resolvers/
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFile.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBindingHelper.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/JavaFileParserTest.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyAbstractClass.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyClass.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface2.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface3.java
trunk/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -80,7 +80,7 @@
}
if (result == null && ((ClassDescriptor) key).isInterface()) {
- result = get(ClassDescriptorLoader.getClassDescriptor(Object.class));
+ result = get(ClassDescriptorHelper.getClassDescriptor(Object.class));
}
if (c != key && result != null) { // no mapping for the class itself, but found one for a superclass
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.MethodDescriptor;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.tags.TagHandler;
@@ -338,7 +338,7 @@
* @throws IllegalArgumentException if parent is not a {@link Container}
*/
public void setParent(CompiledObject parent) throws IllegalArgumentException {
- if (!ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) {
+ if (!ClassDescriptorHelper.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) {
throw new IllegalArgumentException("parent must descend from java.awt.Container");
}
this.parent = parent;
@@ -567,11 +567,11 @@
// TODO: remove this temporary method and complete switchover to MethodDescriptors
public void addEventHandler(String eventId, Method addMethod, Method listenerMethod, String code, JAXXCompiler compiler) {
try {
- ClassDescriptor descriptor = ClassDescriptorLoader.getClassDescriptor(getObjectClass().getName());
+ ClassDescriptor descriptor = ClassDescriptorHelper.getClassDescriptor(getObjectClass().getName());
String listenerClassName = addMethod.getParameterTypes()[0].getName();
- ClassDescriptor listenerDescriptor = ClassDescriptorLoader.getClassDescriptor(listenerClassName);
+ ClassDescriptor listenerDescriptor = ClassDescriptorHelper.getClassDescriptor(listenerClassName);
MethodDescriptor addMethodDescriptor = descriptor.getMethodDescriptor(addMethod.getName(), listenerDescriptor);
- MethodDescriptor listenerMethodDescriptor = listenerDescriptor.getMethodDescriptor(listenerMethod.getName(), ClassDescriptorLoader.getClassDescriptor(listenerMethod.getParameterTypes()[0].getName()));
+ MethodDescriptor listenerMethodDescriptor = listenerDescriptor.getMethodDescriptor(listenerMethod.getName(), ClassDescriptorHelper.getClassDescriptor(listenerMethod.getParameterTypes()[0].getName()));
addEventHandler(eventId, addMethodDescriptor, listenerMethodDescriptor, code, compiler);
} catch (Exception e) {
throw new RuntimeException(e);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -62,10 +62,10 @@
super(msg, initCause);
}
- @Override
- public void printStackTrace() {
- super.printStackTrace();
- System.err.println("CompilerException printed from:");
- Thread.dumpStack();
- }
+// @Override
+// public void printStackTrace() {
+// super.printStackTrace();
+// System.err.println("CompilerException printed from:");
+// Thread.dumpStack();
+// }
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -33,7 +33,7 @@
import jaxx.compiler.java.JavaMethod;
import jaxx.compiler.java.parser.ParseException;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.FieldDescriptor;
import jaxx.compiler.reflect.MethodDescriptor;
import jaxx.compiler.script.ScriptManager;
@@ -334,7 +334,7 @@
}
firstPassClassTagHandler = new DefaultObjectHandler(
- ClassDescriptorLoader.getClassDescriptor(Object.class)
+ ClassDescriptorHelper.getClassDescriptor(Object.class)
);
bindingHelper = new DataBindingHelper(this);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFile.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFile.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFile.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,6 +29,8 @@
import org.nuiton.util.FileUtil;
import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
/**
* Represents a file to be treated by the {@link JAXXCompiler}.
@@ -154,6 +156,16 @@
return jaxxFile;
}
+ public URL getJAXXFileURL() {
+ File file = getJaxxFile();
+ URL url = null;
+ try {
+ url = file.toURI().toURL();
+ return url;
+ } catch (MalformedURLException e) {
+ throw new IllegalStateException("Url of the jaxx file is malformed... "+file);
+ }
+ }
public File getCssFile() {
if (cssFile == null) {
File file = getJaxxFile();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -199,16 +199,31 @@
* @return the compiler instance which is processing the specified JAXX class.
* Each class is compiled by a different compiler instance.
*/
- public JAXXCompiler getJAXXCompiler(String className) {
+ public JAXXCompilerFile getJAXXCompilerFile(String className) {
for (JAXXCompilerFile compilingFile : compilingFiles) {
if (className.equals(compilingFile.getClassName())) {
- return compilingFile.getCompiler();
+ return compilingFile;
}
}
return null;
}
/**
+ * Obtain the jaxx compiler of the given class name.
+ *
+ * @param className the name of the class to use
+ * @return the compiler instance which is processing the specified JAXX class.
+ * Each class is compiled by a different compiler instance.
+ */
+ public JAXXCompiler getJAXXCompiler(String className) {
+ JAXXCompilerFile compilerFile = getJAXXCompilerFile(className);
+ if (compilerFile == null) {
+ return null;
+ }
+ return compilerFile.getCompiler();
+ }
+
+ /**
* Obtain the symbo table for the given class name.
*
* @param className the name of the class to use
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler.beans;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.MethodDescriptor;
import java.beans.BeanDescriptor;
@@ -92,7 +92,7 @@
Method readMethod = explicitProperty.getReadMethod();
Method writeMethod = explicitProperty.getWriteMethod();
try {
- ClassDescriptor typeDescriptor = ClassDescriptorLoader.getClassDescriptor(type.getName(), type.getClassLoader());
+ ClassDescriptor typeDescriptor = ClassDescriptorHelper.getClassDescriptor(type.getName(), type.getClassLoader());
JAXXPropertyDescriptor propertyDescriptor = new JAXXPropertyDescriptor(classDescriptor, explicitProperty.getName(),
readMethod != null ? classDescriptor.getMethodDescriptor(readMethod.getName()) : null,
writeMethod != null ? classDescriptor.getMethodDescriptor(writeMethod.getName(), typeDescriptor) : null);
@@ -115,7 +115,7 @@
// does the same)
boolean propertyChangeSource;
try {
- classDescriptor.getMethodDescriptor("addPropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class));
+ classDescriptor.getMethodDescriptor("addPropertyChangeListener", ClassDescriptorHelper.getClassDescriptor(PropertyChangeListener.class));
propertyChangeSource = true;
} catch (NoSuchMethodException e) {
propertyChangeSource = false;
@@ -141,7 +141,7 @@
}
} else if (name.startsWith("add") && name.length() > 3 && Character.isUpperCase(name.charAt(3))) {
ClassDescriptor[] parameters = method.getParameterTypes();
- if (parameters.length != 1 || !ClassDescriptorLoader.getClassDescriptor(EventListener.class).isAssignableFrom(parameters[0])) {
+ if (parameters.length != 1 || !ClassDescriptorHelper.getClassDescriptor(EventListener.class).isAssignableFrom(parameters[0])) {
continue; // not an event listener method
}
try {
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBindingHelper.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBindingHelper.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBindingHelper.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -134,7 +134,7 @@
// the fact of adding the String boxed for String type binding is not
// a good thing, since it add one more call to process in binding
// and add nothing special more ?
-// return type == ClassDescriptorLoader.getClassDescriptor(String.class) ? "String.valueOf(" + expression + ")" : expression.toString();
+// return type == ClassDescriptorHelper.getClassDescriptor(String.class) ? "String.valueOf(" + expression + ")" : expression.toString();
return expression.toString();
}
return null;
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -36,7 +36,7 @@
import jaxx.compiler.java.parser.JavaParserTreeConstants;
import jaxx.compiler.java.parser.SimpleNode;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.FieldDescriptor;
import jaxx.compiler.reflect.MethodDescriptor;
import jaxx.compiler.tags.DefaultObjectHandler;
@@ -250,7 +250,7 @@
}
switch (node.getId()) {
case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE:
- type = ClassDescriptorLoader.getClassDescriptor(Class.class);
+ type = ClassDescriptorHelper.getClassDescriptor(Class.class);
break;
case JavaParserTreeConstants.JJTPRIMARYEXPRESSION:
type = determineExpressionType(node);
@@ -390,10 +390,10 @@
if (node.jjtGetNumChildren() == 1) {
int childId = node.getChild(0).getId();
if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) {
- return ClassDescriptorLoader.getClassDescriptor(boolean.class);
+ return ClassDescriptorHelper.getClassDescriptor(boolean.class);
}
if (childId == JavaParserTreeConstants.JJTNULLLITERAL) {
- return ClassDescriptorLoader.getClassDescriptor(NULL.class);
+ return ClassDescriptorHelper.getClassDescriptor(NULL.class);
}
throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]);
}
@@ -401,18 +401,18 @@
switch (nodeId) {
case JavaParserConstants.INTEGER_LITERAL:
if (node.firstToken.image.toLowerCase().endsWith("l")) {
- return ClassDescriptorLoader.getClassDescriptor(long.class);
+ return ClassDescriptorHelper.getClassDescriptor(long.class);
}
- return ClassDescriptorLoader.getClassDescriptor(int.class);
+ return ClassDescriptorHelper.getClassDescriptor(int.class);
case JavaParserConstants.CHARACTER_LITERAL:
- return ClassDescriptorLoader.getClassDescriptor(char.class);
+ return ClassDescriptorHelper.getClassDescriptor(char.class);
case JavaParserConstants.FLOATING_POINT_LITERAL:
if (node.firstToken.image.toLowerCase().endsWith("f")) {
- return ClassDescriptorLoader.getClassDescriptor(float.class);
+ return ClassDescriptorHelper.getClassDescriptor(float.class);
}
- return ClassDescriptorLoader.getClassDescriptor(double.class);
+ return ClassDescriptorHelper.getClassDescriptor(double.class);
case JavaParserConstants.STRING_LITERAL:
- return ClassDescriptorLoader.getClassDescriptor(String.class);
+ return ClassDescriptorHelper.getClassDescriptor(String.class);
default:
throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]);
}
@@ -660,9 +660,9 @@
// try {
// // check for property-specific addPropertyChangeListener method
-//// getBeanClass().getMethodDescriptor("addPropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class),
-// handler.getBeanClass().getMethodDescriptor("addPropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class),
-// ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class));
+//// getBeanClass().getMethodDescriptor("addPropertyChangeListener", ClassDescriptorHelper.getClassDescriptor(String.class),
+// handler.getBeanClass().getMethodDescriptor("addPropertyChangeListener", ClassDescriptorHelper.getClassDescriptor(String.class),
+// ClassDescriptorHelper.getClassDescriptor(PropertyChangeListener.class));
// return prefix + "addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
// } catch (NoSuchMethodException e) {
// if (log.isInfoEnabled()) {
@@ -741,8 +741,8 @@
return prefix + "removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
// try {
// // check for property-specific removePropertyChangeListener method
-// handler.getBeanClass().getMethodDescriptor("removePropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class),
-// ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class));
+// handler.getBeanClass().getMethodDescriptor("removePropertyChangeListener", ClassDescriptorHelper.getClassDescriptor(String.class),
+// ClassDescriptorHelper.getClassDescriptor(PropertyChangeListener.class));
// return prefix + "removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
// } catch (NoSuchMethodException e) {
// // no property-specific method, use general one
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -36,7 +36,7 @@
import jaxx.compiler.css.parser.CSSParserTreeConstants;
import jaxx.compiler.css.parser.SimpleNode;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.MethodDescriptor;
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.tags.TagManager;
@@ -189,7 +189,7 @@
public static ClassDescriptor getMouseEventDescriptor() {
if (mouseEventDescriptor == null) {
mouseEventDescriptor =
- ClassDescriptorLoader.getClassDescriptor(MouseEvent.class);
+ ClassDescriptorHelper.getClassDescriptor(MouseEvent.class);
}
return mouseEventDescriptor;
}
@@ -197,7 +197,7 @@
public static ClassDescriptor getMouseListenerDescriptor() {
if (mouseListenerDescriptor == null) {
mouseListenerDescriptor =
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class);
+ ClassDescriptorHelper.getClassDescriptor(MouseListener.class);
}
return mouseListenerDescriptor;
}
@@ -295,28 +295,28 @@
}
public static String unwrap(ClassDescriptor type, String valueCode) {
- if (ClassDescriptorLoader.getClassDescriptor(boolean.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(boolean.class).equals(type)) {
return "((java.lang.Boolean) " + valueCode + ").booleanValue()";
}
- if (ClassDescriptorLoader.getClassDescriptor(byte.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(byte.class).equals(type)) {
return "((java.lang.Byte) " + valueCode + ").byteValue()";
}
- if (ClassDescriptorLoader.getClassDescriptor(short.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(short.class).equals(type)) {
return "((java.lang.Short) " + valueCode + ").shortValue()";
}
- if (ClassDescriptorLoader.getClassDescriptor(int.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(int.class).equals(type)) {
return "((java.lang.Integer) " + valueCode + ").intValue()";
}
- if (ClassDescriptorLoader.getClassDescriptor(long.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(long.class).equals(type)) {
return "((java.lang.Long) " + valueCode + ").longValue()";
}
- if (ClassDescriptorLoader.getClassDescriptor(float.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(float.class).equals(type)) {
return "((java.lang.Float) " + valueCode + ").floatValue()";
}
- if (ClassDescriptorLoader.getClassDescriptor(double.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(double.class).equals(type)) {
return "((java.lang.Double) " + valueCode + ").doubleValue()";
}
- if (ClassDescriptorLoader.getClassDescriptor(char.class).equals(type)) {
+ if (ClassDescriptorHelper.getClassDescriptor(char.class).equals(type)) {
return "((java.lang.Character) " + valueCode + ").charValue()";
}
return valueCode;
@@ -388,7 +388,7 @@
} else {
try {
Class<?> typeClass = type != null ?
- ClassDescriptorLoader.getClass(
+ ClassDescriptorHelper.getClass(
type.getName(),
type.getClassLoader()
) :
@@ -450,7 +450,7 @@
bindingHelper.registerDataBinding(binding);
} else {
try {
- Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
+ Class<?> typeClass = type != null ? ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : null;
valueCode = TypeManager.getJavaCode(TypeManager.convertFromString(e.getValue(), typeClass));
} catch (ClassNotFoundException ex) {
compiler.reportError("could not find class " + type.getName());
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -34,7 +34,7 @@
import static jaxx.compiler.java.JavaFileGenerator.newField;
import static jaxx.compiler.java.JavaFileGenerator.newMethod;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.FieldDescriptor;
import jaxx.compiler.reflect.MethodDescriptor;
import jaxx.compiler.types.TypeManager;
@@ -288,7 +288,7 @@
}
ClassDescriptor superclass = root.getObjectClass();
ClassDescriptor descriptor =
- ClassDescriptorLoader.getClassDescriptor(JAXXObject.class);
+ ClassDescriptorHelper.getClassDescriptor(JAXXObject.class);
boolean superclassIsJAXXObject =
descriptor.isAssignableFrom(superclass);
javaFile.setModifiers(PUBLIC);
@@ -563,9 +563,9 @@
MethodDescriptor firePropertyChange = null;
while (firePropertyChange == null && currentClass != null) {
try {
- firePropertyChange = currentClass.getDeclaredMethodDescriptor(METHOD_NAME_FIRE_PROPERTY_CHANGE, ClassDescriptorLoader.getClassDescriptor(String.class),
- ClassDescriptorLoader.getClassDescriptor(Object.class),
- ClassDescriptorLoader.getClassDescriptor(Object.class));
+ firePropertyChange = currentClass.getDeclaredMethodDescriptor(METHOD_NAME_FIRE_PROPERTY_CHANGE, ClassDescriptorHelper.getClassDescriptor(String.class),
+ ClassDescriptorHelper.getClassDescriptor(Object.class),
+ ClassDescriptorHelper.getClassDescriptor(Object.class));
} catch (NoSuchMethodException e) {
currentClass = currentClass.getSuperclass();
@@ -852,7 +852,7 @@
// protected JavaMethod createProcessDataBindingMethod(boolean superclassIsJAXXObject, boolean haveBinding) {
StringBuffer code = new StringBuffer();
String eol = JAXXCompiler.getLineSeparator();
- //boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(compiler.getRootObject().getObjectClass());
+ //boolean superclassIsJAXXObject = ClassDescriptorHelper.getClassDescriptor(JAXXObject.class).isAssignableFrom(compiler.getRootObject().getObjectClass());
// the force parameter forces the update to happen even if it is already in activeBindings. This
// is used on superclass invocations b/c by the time the call gets to the superclass, it is already
// marked active and would otherwise be skipped
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -31,7 +31,7 @@
import jaxx.compiler.java.JavaArgument;
import jaxx.compiler.java.JavaFile;
import jaxx.compiler.java.JavaFileGenerator;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.runtime.swing.Application;
import java.lang.reflect.Modifier;
@@ -55,7 +55,7 @@
@Override
public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException {
- if (!compiler.isMainDeclared() && ClassDescriptorLoader.getClassDescriptor(Application.class.getName()).isAssignableFrom(root.getObjectClass())) {
+ if (!compiler.isMainDeclared() && ClassDescriptorHelper.getClassDescriptor(Application.class.getName()).isAssignableFrom(root.getObjectClass())) {
javaFile.addMethod(JavaFileGenerator.newMethod(
Modifier.PUBLIC | Modifier.STATIC,
"void",
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -34,7 +34,7 @@
import jaxx.compiler.java.JavaFile;
import jaxx.compiler.java.JavaFileGenerator;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.validator.BeanValidatorHandler;
import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator;
import jaxx.compiler.types.TypeManager;
@@ -140,9 +140,9 @@
//TC-20091202 : pass this test if we want to interact with non generated code ?
// if (javaFile.isSuperclassIsJAXXObject()) {
ClassDescriptor superClass =
- ClassDescriptorLoader.getClassDescriptor(javaFile.getSuperClass());
+ ClassDescriptorHelper.getClassDescriptor(javaFile.getSuperClass());
ClassDescriptor validatorInterfaceDescriptor =
- ClassDescriptorLoader.getClassDescriptor(validatorInterface);
+ ClassDescriptorHelper.getClassDescriptor(validatorInterface);
boolean parentIsValidator =
validatorInterfaceDescriptor.isAssignableFrom(superClass);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -68,42 +68,46 @@
public abstract FieldDescriptor getDeclaredFieldDescriptor(
String name) throws NoSuchFieldException;
- ClassDescriptor(String name,
- String packageName,
- String superclass,
- String[] interfaces,
- boolean isInterface,
- boolean isArray,
- String componentType,
- JAXXObjectDescriptor jaxxObjectDescriptor,
- ClassLoader classLoader,
- MethodDescriptor[] methodDescriptors,
- FieldDescriptor[] fieldDescriptors) {
- this.name = name;
- this.packageName = packageName;
- this.superclass = superclass;
- this.interfaces = interfaces;
- this.isInterface = isInterface;
- this.isArray = isArray;
- this.componentType = componentType;
- this.jaxxObjectDescriptor = jaxxObjectDescriptor;
- this.classLoader = classLoader;
- this.methodDescriptors = methodDescriptors;
- this.fieldDescriptors = fieldDescriptors;
+ protected ClassDescriptor(String name,
+ String packageName,
+ String superclass,
+ String[] interfaces,
+ boolean isInterface,
+ boolean isArray,
+ String componentType,
+ JAXXObjectDescriptor jaxxObjectDescriptor,
+ ClassLoader classLoader,
+ MethodDescriptor[] methodDescriptors,
+ FieldDescriptor[] fieldDescriptors) {
+ this(
+ name,
+ packageName,
+ superclass,
+ interfaces,
+ isInterface,
+ isArray,
+ componentType,
+ jaxxObjectDescriptor,
+ classLoader,
+ methodDescriptors,
+ fieldDescriptors,
+ null
+ );
}
- ClassDescriptor(String name,
- String packageName,
- String superclass,
- String[] interfaces,
- boolean isInterface,
- boolean isArray,
- String componentType,
- JAXXObjectDescriptor jaxxObjectDescriptor,
- ClassLoader classLoader,
- MethodDescriptor[] methodDescriptors,
- FieldDescriptor[] fieldDescriptors,
- FieldDescriptor[] declaredFieldDescriptors) {
+ protected ClassDescriptor(
+ String name,
+ String packageName,
+ String superclass,
+ String[] interfaces,
+ boolean isInterface,
+ boolean isArray,
+ String componentType,
+ JAXXObjectDescriptor jaxxObjectDescriptor,
+ ClassLoader classLoader,
+ MethodDescriptor[] methodDescriptors,
+ FieldDescriptor[] fieldDescriptors,
+ FieldDescriptor[] declaredFieldDescriptors) {
this.name = name;
this.packageName = packageName;
this.superclass = superclass;
@@ -217,7 +221,7 @@
}
try {
- ClassDescriptor result = ClassDescriptorLoader.getClassDescriptor(
+ ClassDescriptor result = ClassDescriptorHelper.getClassDescriptor(
fqn,
getClassLoader()
);
Added: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorHelper.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorHelper.java (rev 0)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorHelper.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -0,0 +1,458 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ * *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package jaxx.compiler.reflect;
+
+import jaxx.compiler.CompilerException;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.JAXXCompilerFile;
+import jaxx.compiler.JAXXEngine;
+import jaxx.compiler.JAXXFactory;
+import jaxx.compiler.reflect.resolvers.ClassDescriptorResolverFromJavaClass;
+import jaxx.compiler.reflect.resolvers.ClassDescriptorResolverFromJavaFile;
+import jaxx.compiler.reflect.resolvers.ClassDescriptorResolverFromJaxxFile;
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.JAXXObjectDescriptor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Mirrors the class <code>java.lang.ClassLoader</code>. JAXX uses <code>ClassDescriptor</code> instead of <code>Class</code>
+ * almost everywhere so that it can handle circular dependencies (there can't be a <code>Class</code> object for an uncompiled
+ * JAXX or Java source file, and a compiler must be allow references to symbols in uncompiled source files in order to handle
+ * circular dependencies).
+ * <p/>
+ * <b>Note : </b> Was previously {@code ClassDescriptorLoader}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public class ClassDescriptorHelper {
+
+ /** Logger */
+ private static final Log log = LogFactory.getLog(ClassDescriptorHelper.class);
+
+ private static Map<String, ClassDescriptor> descriptors =
+ new HashMap<String, ClassDescriptor>();
+
+ private static Map<String, ClassDescriptorResolver> descriptorResolvers;
+
+ protected static Map<String, ClassDescriptorResolver> getDescriptorResolvers() {
+ if (descriptorResolvers == null) {
+ descriptorResolvers = new TreeMap<String, ClassDescriptorResolver>();
+ descriptorResolvers.put(ClassDescriptorResolverFromJaxxFile.class.getSimpleName(), new ClassDescriptorResolverFromJaxxFile());
+ descriptorResolvers.put(ClassDescriptorResolverFromJavaFile.class.getSimpleName(), new ClassDescriptorResolverFromJavaFile());
+ descriptorResolvers.put(ClassDescriptorResolverFromJavaClass.class.getSimpleName(), new ClassDescriptorResolverFromJavaClass());
+ }
+ return descriptorResolvers;
+ }
+
+ private ClassDescriptorHelper() {
+ // on instance
+ }
+
+ public static ClassDescriptor getClassDescriptor(String className) throws ClassNotFoundException {
+
+ ClassDescriptor descriptor = getClassDescriptor(className,
+ Thread.currentThread().getContextClassLoader());
+ return descriptor;
+ }
+
+ public static ClassDescriptor getClassDescriptor(Class<?> javaClass) {
+ try {
+ return getClassDescriptor(javaClass.getName(),
+ javaClass.getClassLoader());
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static ClassDescriptor getClassDescriptor(
+ String className,
+ ClassLoader classLoader) throws ClassNotFoundException {
+
+ if (classLoader == null) {
+ classLoader = ClassDescriptorHelper.class.getClassLoader();
+ }
+
+ ClassDescriptor result = descriptors.get(className);
+ if (result != null) {
+ return result;
+ }
+
+ JAXXEngine engine = JAXXFactory.isEngineRegistred() ?
+ JAXXFactory.getEngine() : null;
+
+ if (engine != null) {
+
+ JAXXCompilerFile file = engine.getJAXXCompilerFile(className);
+
+ if (file != null) {
+
+ // use the symbole table of this jaxx file on computation
+
+ result = getClassDescriptor0(
+ ClassDescriptorResolverFromJaxxFile.class,
+ className,
+ file.getJAXXFileURL(),
+ classLoader
+ );
+
+ return result;
+ }
+ }
+
+ // the class is not in this compile set, try to have it from java
+ // sources or classes.
+
+ String relativePath = className.replaceAll("\\.", "/");
+ String relativePathPattern = ".*";// + className + ".*"; // used to ensure that the located resource has the right character cases
+
+ // find the most recently updated source for the class -- Java source, JAXX source, or compiled class file
+ long javaLastModified = -1;
+ URL javaFile = classLoader.getResource(relativePath + ".java");
+ if (javaFile != null &&
+ javaFile.toString().startsWith("file:") &&
+ javaFile.toString().matches(relativePathPattern)) {
+ javaLastModified = JAXXCompiler.URLtoFile(javaFile).lastModified();
+ if (log.isTraceEnabled()) {
+ log.trace("[" + className + "] javaFile lastModified " + javaLastModified);
+ }
+ }
+
+ long classLastModified = -1;
+ URL classFile = classLoader.getResource(relativePath + ".class");
+ if (classFile != null &&
+ classFile.toString().startsWith("file:") &&
+ classFile.toString().matches(relativePathPattern)) {
+ classLastModified = JAXXCompiler.URLtoFile(classFile).lastModified();
+ if (log.isTraceEnabled()) {
+ log.trace("[" + className + "] class lastModified " + classLastModified);
+ }
+ }
+
+ // there is a java source and is the last modified
+ if (javaLastModified != -1 && javaLastModified > classLastModified) {
+
+ // java file exist and it is the last modified file, so use it
+
+ result = getClassDescriptor0(
+ ClassDescriptorResolverFromJavaFile.class,
+ className,
+ javaFile,
+ classLoader
+ );
+
+ return result;
+ }
+
+ // use the class ...
+
+ result = getClassDescriptor0(
+ ClassDescriptorResolverFromJavaClass.class,
+ className,
+ classFile,
+ classLoader
+ );
+
+ if (result != null) {
+ return result;
+ }
+
+
+ // can NOT come here, means could not find result...
+
+ throw new IllegalStateException(
+ "Can not find descriptor for " + className);
+ }
+
+ protected static ClassDescriptor getClassDescriptor0(
+ Class<? extends ClassDescriptorResolver> resolverType,
+ String className,
+ URL source,
+ ClassLoader classLoader) throws ClassNotFoundException {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Loading class descriptor for [" + className +
+ "] with " + resolverType.getSimpleName());
+ }
+
+ Map<String, ClassDescriptorResolver> resolvers =
+ getDescriptorResolvers();
+
+ ClassDescriptorResolver resolver =
+ resolvers.get(resolverType.getSimpleName());
+
+ resolver.setClassLoader(classLoader);
+
+ ClassDescriptor result = resolver.resolvDescriptor(className, source);
+ if (result != null) {
+ descriptors.put(className, result);
+ }
+ return result;
+ }
+
+ public static Class<?> getPrimitiveBoxedClass(String className) {
+ if (className.equals("boolean")) {
+ return Boolean.class;
+ }
+ if (className.equals("byte")) {
+ return Byte.class;
+ }
+ if (className.equals("short")) {
+ return Short.class;
+ }
+ if (className.equals("int")) {
+ return Integer.class;
+ }
+ if (className.equals("long")) {
+ return Long.class;
+ }
+ if (className.equals("float")) {
+ return Float.class;
+ }
+ if (className.equals("double")) {
+ return Double.class;
+ }
+ if (className.equals("char")) {
+ return Character.class;
+ }
+ if (className.equals("void")) {
+ return Void.class;
+ }
+ return null;
+ }
+
+ public static Class<?> getPrimitiveClass(
+ String className) throws ClassNotFoundException {
+ if (className.equals("boolean")) {
+ return boolean.class;
+ }
+ if (className.equals("byte")) {
+ return byte.class;
+ }
+ if (className.equals("short")) {
+ return short.class;
+ }
+ if (className.equals("int")) {
+ return int.class;
+ }
+ if (className.equals("long")) {
+ return long.class;
+ }
+ if (className.equals("float")) {
+ return float.class;
+ }
+ if (className.equals("double")) {
+ return double.class;
+ }
+ if (className.equals("char")) {
+ return char.class;
+ }
+ if (className.equals("void")) {
+ return void.class;
+ }
+ // detect arrays
+ int arrayCount = 0;
+ while (className.endsWith("[]")) {
+ arrayCount++;
+ className = className.substring(0, className.length() - 2);
+ }
+ Class<?> klass;
+ if (arrayCount > 0) {
+ klass = getPrimitiveClass(className);
+ if (klass == null) {
+ // none primitive array
+ return null;
+ }
+ // must take the boxed class, other it does not works
+ // to make a Class.forName("[Lchar;"); but works
+ // with Class.forName("[LCharacter;"); ...
+ klass = getPrimitiveBoxedClass(className);
+ className = klass.getName();
+
+ className = "L" + className + ";";
+ while (arrayCount > 0) {
+ className = "[" + className;
+ arrayCount--;
+ }
+ //System.out.println("primitive array class "+className);
+ return Class.forName(className);
+ }
+ return null;
+ }
+
+ public static Class<?> getClass(String className,
+ ClassLoader classLoader) throws ClassNotFoundException {
+ Class<?> klass = getPrimitiveClass(className);
+ if (klass != null) {
+ return klass;
+ }
+ // try an array of none primitive classes
+ int arrayCount = 0;
+ while (className.endsWith("[]")) {
+ arrayCount++;
+ className = className.substring(0, className.length() - 2);
+ }
+ if (arrayCount > 0) {
+ className = "L" + className + ";";
+ while (arrayCount > 0) {
+ className = "[" + className;
+ arrayCount--;
+ }
+ }
+ try {
+ return classLoader != null ?
+ Class.forName(className, true, classLoader) :
+ Class.forName(className);
+
+ } catch (ClassNotFoundException e) {
+ // perharps we are in a inner class ?
+ int dotIndex = className.lastIndexOf(".");
+ if (dotIndex > -1) {
+ String parentFQN = className.substring(0, dotIndex);
+ String simpleName = className.substring(dotIndex + 1);
+ try {
+ Class<?> parentClass = classLoader != null ? Class.forName(parentFQN, true, classLoader) : Class.forName(parentFQN);
+ for (Class<?> innerClass : parentClass.getClasses()) {
+ if (simpleName.equals(innerClass.getSimpleName())) {
+ return innerClass;
+ }
+ }
+ } catch (ClassNotFoundException e1) {
+ // no super class,so let the first exception throw...
+ }
+ }
+ throw e;
+ } catch (NoClassDefFoundError e) {
+
+ throw new ClassNotFoundException(e.toString());
+ }
+ }
+
+// private static MethodDescriptor createMethodDescriptor(Method javaMethod,
+// ClassLoader classLoader) {
+// String methodName = javaMethod.getName();
+// int modifiers = javaMethod.getModifiers();
+// String returnType = javaMethod.getReturnType().getName();
+// Class<?>[] javaParameters = javaMethod.getParameterTypes();
+// String[] parameters = new String[javaParameters.length];
+// for (int i = 0; i < parameters.length; i++) {
+// parameters[i] = javaParameters[i].getName();
+// }
+// return new MethodDescriptor(methodName, modifiers, returnType, parameters, classLoader);
+// }
+//
+// private static FieldDescriptor createFieldDescriptor(Field javaField,
+// ClassLoader classLoader) {
+// String fieldName = javaField.getName();
+// int modifiers = javaField.getModifiers();
+// String type = javaField.getType().getName();
+// return new FieldDescriptor(fieldName, modifiers, type, classLoader);
+// }
+//
+// private static JAXXObjectDescriptor getJAXXObjectDescriptor(Class<?> jaxxClass) {
+// if (!JAXXObject.class.isAssignableFrom(jaxxClass) ||
+// JAXXObject.class.equals(jaxxClass)) {
+// return null;
+// }
+// try {
+// Method getJAXXObjectDescriptor = jaxxClass.getMethod("$getJAXXObjectDescriptor");
+// return (JAXXObjectDescriptor) getJAXXObjectDescriptor.invoke(null);
+// } catch (NoSuchMethodException e) {
+// throw new CompilerException("Expected JAXXObject " + jaxxClass.getName() + " to have a static method named $getJAXXObjectDescriptor");
+// } catch (IllegalAccessException e) {
+// throw new CompilerException("Expected JAXXObject " + jaxxClass.getName() + "'s $getJAXXObjectDescriptor method to be public");
+// } catch (InvocationTargetException e) {
+// throw new RuntimeException(e);
+// }
+// }
+
+ public static void checkSupportClass(Class<?> handlerClass,
+ ClassDescriptor beanClass,
+ Class<?>... tagClasses) {
+ for (Class<?> tagClass : tagClasses) {
+ if (getClassDescriptor(tagClass).isAssignableFrom(beanClass)) {
+ return;
+ }
+ }
+ throw new IllegalArgumentException(handlerClass.getName() + " does not support the class " + beanClass.getName());
+ }
+
+ public static void reset() {
+ descriptors.clear();
+ }
+
+ public static MethodDescriptor createMethodDescriptor(Method javaMethod,
+ ClassLoader classLoader) {
+ String methodName = javaMethod.getName();
+ int modifiers = javaMethod.getModifiers();
+ String returnType = javaMethod.getReturnType().getName();
+ Class<?>[] javaParameters = javaMethod.getParameterTypes();
+ String[] parameters = new String[javaParameters.length];
+ for (int i = 0; i < parameters.length; i++) {
+ parameters[i] = javaParameters[i].getName();
+ }
+ return new MethodDescriptor(methodName,
+ modifiers,
+ returnType,
+ parameters,
+ classLoader
+ );
+ }
+
+ public static FieldDescriptor createFieldDescriptor(Field javaField,
+ ClassLoader classLoader) {
+ String fieldName = javaField.getName();
+ int modifiers = javaField.getModifiers();
+ String type = javaField.getType().getName();
+ return new FieldDescriptor(fieldName, modifiers, type, classLoader);
+ }
+
+ public static JAXXObjectDescriptor getJAXXObjectDescriptor(Class<?> jaxxClass) {
+ if (!JAXXObject.class.isAssignableFrom(jaxxClass) ||
+ JAXXObject.class.equals(jaxxClass)) {
+ return null;
+ }
+ try {
+ Method getJAXXObjectDescriptor = jaxxClass.getMethod("$getJAXXObjectDescriptor");
+ return (JAXXObjectDescriptor) getJAXXObjectDescriptor.invoke(null);
+ } catch (NoSuchMethodException e) {
+ throw new CompilerException("Expected JAXXObject " + jaxxClass.getName() + " to have a static method named $getJAXXObjectDescriptor");
+ } catch (IllegalAccessException e) {
+ throw new CompilerException("Expected JAXXObject " + jaxxClass.getName() + "'s $getJAXXObjectDescriptor method to be public");
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Property changes on: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -58,7 +58,10 @@
* almost everywhere so that it can handle circular dependencies (there can't be a <code>Class</code> object for an uncompiled
* JAXX or Java source file, and a compiler must be allow references to symbols in uncompiled source files in order to handle
* circular dependencies).
+ *
+ * @deprecated since 2.0.2, prefer use the more efficient {@link ClassDescriptorHelper}.
*/
+@Deprecated
public class ClassDescriptorLoader {
/** Logger */
@@ -202,7 +205,7 @@
// descriptors.put(className, result);
// return result;
// }
-
+
if (javaLastModified != -1) {
// there is a java source
@@ -224,7 +227,6 @@
}
-
// last fall back for class
Class<?> javaClass = getClass(className, classLoader);
@@ -269,153 +271,161 @@
// return result;
}
+ @Deprecated
public static ClassDescriptor getClassDescriptor(Class<?> javaClass) {
- try {
- return getClassDescriptor(
- javaClass.getName(),
- javaClass.getClassLoader()
- );
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
+ return ClassDescriptorHelper.getClassDescriptor(javaClass);
+// try {
+// return getClassDescriptor(
+// javaClass.getName(),
+// javaClass.getClassLoader()
+// );
+// } catch (ClassNotFoundException e) {
+// throw new RuntimeException(e);
+// }
}
+ @Deprecated
public static Class<?> getPrimitiveBoxedClass(String className) {
- if (className.equals("boolean")) {
- return Boolean.class;
- }
- if (className.equals("byte")) {
- return Byte.class;
- }
- if (className.equals("short")) {
- return Short.class;
- }
- if (className.equals("int")) {
- return Integer.class;
- }
- if (className.equals("long")) {
- return Long.class;
- }
- if (className.equals("float")) {
- return Float.class;
- }
- if (className.equals("double")) {
- return Double.class;
- }
- if (className.equals("char")) {
- return Character.class;
- }
- if (className.equals("void")) {
- return Void.class;
- }
- return null;
+ return ClassDescriptorHelper.getPrimitiveBoxedClass(className);
+// if (className.equals("boolean")) {
+// return Boolean.class;
+// }
+// if (className.equals("byte")) {
+// return Byte.class;
+// }
+// if (className.equals("short")) {
+// return Short.class;
+// }
+// if (className.equals("int")) {
+// return Integer.class;
+// }
+// if (className.equals("long")) {
+// return Long.class;
+// }
+// if (className.equals("float")) {
+// return Float.class;
+// }
+// if (className.equals("double")) {
+// return Double.class;
+// }
+// if (className.equals("char")) {
+// return Character.class;
+// }
+// if (className.equals("void")) {
+// return Void.class;
+// }
+// return null;
}
+ @Deprecated
public static Class<?> getPrimitiveClass(
String className) throws ClassNotFoundException {
- if (className.equals("boolean")) {
- return boolean.class;
- }
- if (className.equals("byte")) {
- return byte.class;
- }
- if (className.equals("short")) {
- return short.class;
- }
- if (className.equals("int")) {
- return int.class;
- }
- if (className.equals("long")) {
- return long.class;
- }
- if (className.equals("float")) {
- return float.class;
- }
- if (className.equals("double")) {
- return double.class;
- }
- if (className.equals("char")) {
- return char.class;
- }
- if (className.equals("void")) {
- return void.class;
- }
- // detect arrays
- int arrayCount = 0;
- while (className.endsWith("[]")) {
- arrayCount++;
- className = className.substring(0, className.length() - 2);
- }
- Class<?> klass;
- if (arrayCount > 0) {
- klass = getPrimitiveClass(className);
- if (klass == null) {
- // none primitive array
- return null;
- }
- // must take the boxed class, other it does not works
- // to make a Class.forName("[Lchar;"); but works
- // with Class.forName("[LCharacter;"); ...
- klass = getPrimitiveBoxedClass(className);
- className = klass.getName();
-
- className = "L" + className + ";";
- while (arrayCount > 0) {
- className = "[" + className;
- arrayCount--;
- }
- //System.out.println("primitive array class "+className);
- return Class.forName(className);
- }
- return null;
+ return ClassDescriptorHelper.getPrimitiveClass(className);
+// if (className.equals("boolean")) {
+// return boolean.class;
+// }
+// if (className.equals("byte")) {
+// return byte.class;
+// }
+// if (className.equals("short")) {
+// return short.class;
+// }
+// if (className.equals("int")) {
+// return int.class;
+// }
+// if (className.equals("long")) {
+// return long.class;
+// }
+// if (className.equals("float")) {
+// return float.class;
+// }
+// if (className.equals("double")) {
+// return double.class;
+// }
+// if (className.equals("char")) {
+// return char.class;
+// }
+// if (className.equals("void")) {
+// return void.class;
+// }
+// // detect arrays
+// int arrayCount = 0;
+// while (className.endsWith("[]")) {
+// arrayCount++;
+// className = className.substring(0, className.length() - 2);
+// }
+// Class<?> klass;
+// if (arrayCount > 0) {
+// klass = getPrimitiveClass(className);
+// if (klass == null) {
+// // none primitive array
+// return null;
+// }
+// // must take the boxed class, other it does not works
+// // to make a Class.forName("[Lchar;"); but works
+// // with Class.forName("[LCharacter;"); ...
+// klass = getPrimitiveBoxedClass(className);
+// className = klass.getName();
+//
+// className = "L" + className + ";";
+// while (arrayCount > 0) {
+// className = "[" + className;
+// arrayCount--;
+// }
+// //System.out.println("primitive array class "+className);
+// return Class.forName(className);
+// }
+// return null;
}
+ @Deprecated
public static Class<?> getClass(String className,
ClassLoader classLoader) throws ClassNotFoundException {
- Class<?> klass = getPrimitiveClass(className);
- if (klass != null) {
- return klass;
- }
- // try an array of none primitive classes
- int arrayCount = 0;
- while (className.endsWith("[]")) {
- arrayCount++;
- className = className.substring(0, className.length() - 2);
- }
- if (arrayCount > 0) {
- className = "L" + className + ";";
- while (arrayCount > 0) {
- className = "[" + className;
- arrayCount--;
- }
- }
- try {
- return classLoader != null ?
- Class.forName(className, true, classLoader) :
- Class.forName(className);
-
- } catch (ClassNotFoundException e) {
- // perharps we are in a inner class ?
- int dotIndex = className.lastIndexOf(".");
- if (dotIndex > -1) {
- String parentFQN = className.substring(0, dotIndex);
- String simpleName = className.substring(dotIndex + 1);
- try {
- Class<?> parentClass = classLoader != null ? Class.forName(parentFQN, true, classLoader) : Class.forName(parentFQN);
- for (Class<?> innerClass : parentClass.getClasses()) {
- if (simpleName.equals(innerClass.getSimpleName())) {
- return innerClass;
- }
- }
- } catch (ClassNotFoundException e1) {
- // no super class,so let the first exception throw...
- }
- }
- throw e;
- } catch (NoClassDefFoundError e) {
-
- throw new ClassNotFoundException(e.toString());
- }
+ return ClassDescriptorHelper.getClass(className, classLoader);
+// Class<?> klass = getPrimitiveClass(className);
+// if (klass != null) {
+// return klass;
+// }
+// // try an array of none primitive classes
+// int arrayCount = 0;
+// while (className.endsWith("[]")) {
+// arrayCount++;
+// className = className.substring(0, className.length() - 2);
+// }
+// if (arrayCount > 0) {
+// className = "L" + className + ";";
+// while (arrayCount > 0) {
+// className = "[" + className;
+// arrayCount--;
+// }
+// }
+// try {
+// return classLoader != null ?
+// Class.forName(className, true, classLoader) :
+// Class.forName(className);
+//
+// } catch (ClassNotFoundException e) {
+// // perharps we are in a inner class ?
+// int dotIndex = className.lastIndexOf(".");
+// if (dotIndex > -1) {
+// String parentFQN = className.substring(0, dotIndex);
+// String simpleName = className.substring(dotIndex + 1);
+// try {
+// Class<?> parentClass = classLoader != null ? Class.forName(parentFQN, true, classLoader) : Class.forName(parentFQN);
+// for (Class<?> innerClass : parentClass.getClasses()) {
+// if (simpleName.equals(innerClass.getSimpleName())) {
+// return innerClass;
+// }
+// }
+// } catch (ClassNotFoundException e1) {
+// // no super class,so let the first exception throw...
+// }
+// }
+// throw e;
+// } catch (NoClassDefFoundError e) {
+//
+// throw new ClassNotFoundException(e.toString());
+// }
}
private static MethodDescriptor createMethodDescriptor(Method javaMethod,
Added: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorResolver.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorResolver.java (rev 0)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorResolver.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -0,0 +1,60 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package jaxx.compiler.reflect;
+
+import java.net.URL;
+
+/**
+ * Contract of a resolver of class descriptor.
+ * <p/>
+ * The unique method {@link #resolvDescriptor(String,URL)} will returns the
+ * descriptor if can be found.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public abstract class ClassDescriptorResolver {
+
+ private ClassLoader classLoader;
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * @param className the fully qualified name of the class
+ * @param source the source of the class (java file, jaxx file, class)
+ * @return the descriptor of the given class
+ * @throws ClassNotFoundException if class descriptor could not be found.
+ */
+ public abstract ClassDescriptor resolvDescriptor(String className,
+ URL source) throws ClassNotFoundException;
+
+
+}
Property changes on: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorResolver.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -42,7 +42,7 @@
public ClassDescriptor getType() {
try {
- return ClassDescriptorLoader.getClassDescriptor(type, getClassLoader());
+ return ClassDescriptorHelper.getClassDescriptor(type, getClassLoader());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -47,33 +47,61 @@
import java.util.List;
import java.util.Set;
-// TODO: need to unify this implementation with the parsing in ScriptManager
-
+/**
+ * @deprecated since 2.0.2, now use the {@link ClassDescriptorHelper} to obtain
+ * descriptors from java source files.
+ */
+@Deprecated
public class JavaFileParser {
/** to use log facility, just put in your code: log.info(\"...\"); */
static private final Log log = LogFactory.getLog(JavaFileParser.class);
+ /**
+ * the compiler used (this is a dummy compiler with no link with any file).
+ * <p/>
+ * FIXME-TC20100504 We should remove this link : should not need of a
+ * compiler to parse a java files.
+ */
private JAXXCompiler compiler;
+ /** fully qualified name of the class */
private String className;
+ /** package of the class */
private String packageName;
- private String superclass = "java.lang.Object";
+ /** fully qualified name of the super class or {@code null} if no super class. */
+ private String superclass;
+ /**
+ * flag to known if we deal with an enum (the state is setted in the
+ * {@link #doParse(String, Reader)} method).
+ */
private boolean isEnum;
+ /**
+ * flag to known if we deal with an interface(the state is setted in the
+ * {@link #doParse(String, Reader)} method).
+ */
private boolean isInterface;
- private Set<String> interfaces = new HashSet<String>();
+ /** set of fully qualified names of interfaces of the class. */
+ private Set<String> interfaces;
- private List<MethodDescriptor> methods = new ArrayList<MethodDescriptor>();
+ /** public methods of the class */
+ private List<MethodDescriptor> methods;
- private List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>();
+ /** public fields of the class */
+ private List<FieldDescriptor> fields;
- private List<FieldDescriptor> declaredFields = new ArrayList<FieldDescriptor>();
+ /** none public fields of the class */
+ private List<FieldDescriptor> declaredFields;
+ /**
+ * If sets, compressed value of the $jaxxObjectDescriptor field, this means
+ * the class if a JAXXObject implementation.
+ */
private String jaxxObjectDescriptorValue;
public static final String[] EMPTY_STRING_ARRAY = new String[0];
@@ -83,6 +111,11 @@
// We could imagine just to offers to the parser a list of namespaces
// (for class resolving)...
compiler = JAXXFactory.newDummyCompiler(classLoader);
+ methods = new ArrayList<MethodDescriptor>();
+ interfaces = new HashSet<String>();
+ fields = new ArrayList<FieldDescriptor>();
+ declaredFields = new ArrayList<FieldDescriptor>();
+ superclass = Object.class.getName();
}
public static ClassDescriptor parseJavaFile(
@@ -113,8 +146,8 @@
jaxxObjectDescriptor = JAXXUtil.decodeCompressedJAXXObjectDescriptor(
parser.jaxxObjectDescriptorValue
);
+ }
- }
List<MethodDescriptor> publicMethods = parser.methods;
List<FieldDescriptor> publicFields = parser.fields;
List<FieldDescriptor> declaredFields = parser.declaredFields;
@@ -139,7 +172,7 @@
//FIXME-TC20100504 This is not good, should add nothing here
// and modify the algorithm of ClassDescriptor to go and seek
// in super classes on interfaces if required.
- ClassDescriptor superclassDescriptor = ClassDescriptorLoader.getClassDescriptor(parser.superclass, classLoader);
+ ClassDescriptor superclassDescriptor = ClassDescriptorHelper.getClassDescriptor(parser.superclass, classLoader);
publicMethods.addAll(Arrays.asList(superclassDescriptor.getMethodDescriptors()));
publicFields.addAll(Arrays.asList(superclassDescriptor.getFieldDescriptors()));
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -53,7 +53,7 @@
if (returnType == null) {
return null;
}
- return ClassDescriptorLoader.getClassDescriptor(returnType);
+ return ClassDescriptorHelper.getClassDescriptor(returnType);
} catch (ClassNotFoundException e) {
throw new RuntimeException("could not find return type " + returnType, e);
}
@@ -64,7 +64,7 @@
try {
for (int i = 0; i < result.length; i++) {
if (parameterTypes[i] != null) {
- result[i] = ClassDescriptorLoader.getClassDescriptor(parameterTypes[i], getClassLoader());
+ result[i] = ClassDescriptorHelper.getClassDescriptor(parameterTypes[i], getClassLoader());
}
}
return result;
Added: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java (rev 0)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -0,0 +1,172 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package jaxx.compiler.reflect.resolvers;
+
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
+import jaxx.compiler.reflect.ClassDescriptorResolver;
+import jaxx.compiler.reflect.FieldDescriptor;
+import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.runtime.JAXXObjectDescriptor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+/**
+ * To obtain a class descriptor from a java source file.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public class ClassDescriptorResolverFromJavaClass extends ClassDescriptorResolver {
+
+ /** Logger */
+ private static final Log log =
+ LogFactory.getLog(ClassDescriptorResolverFromJavaClass.class);
+
+ @Override
+ public ClassDescriptor resolvDescriptor(String className,
+ URL source) throws ClassNotFoundException {
+
+ if (log.isDebugEnabled()) {
+ log.debug("for source " + className);
+ }
+
+ Class<?> javaClass =
+ ClassDescriptorHelper.getClass(className, getClassLoader());
+
+ String name = javaClass.getName();
+ Package p = javaClass.getPackage();
+ String packageName = p != null ? p.getName() : null;
+ Class<?> superclass = javaClass.getSuperclass();
+ String superclassName = superclass != null ? superclass.getName() : null;
+ Class<?>[] interfaces = javaClass.getInterfaces();
+ String[] interfaceNames = new String[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++) {
+ interfaceNames[i] = interfaces[i].getName();
+ }
+ boolean isInterface = javaClass.isInterface();
+ boolean isArray = javaClass.isArray();
+ String componentTypeName = isArray ? javaClass.getComponentType().getName() : null;
+ ClassLoader classLoader = javaClass.getClassLoader();
+ Method[] javaMethods = javaClass.getMethods();
+ MethodDescriptor[] methods = new MethodDescriptor[javaMethods.length];
+ for (int i = 0; i < methods.length; i++) {
+ methods[i] = ClassDescriptorHelper.createMethodDescriptor(
+ javaMethods[i],
+ javaClass.getClassLoader()
+ );
+ }
+
+ Field[] javaFields = javaClass.getFields();
+ FieldDescriptor[] fields = new FieldDescriptor[javaFields.length];
+ for (int i = 0; i < fields.length; i++) {
+ fields[i] = ClassDescriptorHelper.createFieldDescriptor(
+ javaFields[i],
+ javaClass.getClassLoader()
+ );
+ }
+
+ JAXXObjectDescriptor jaxxObjectDescriptor =
+ ClassDescriptorHelper.getJAXXObjectDescriptor(javaClass);
+
+ return new JavaClassClassDescriptor(
+ javaClass,
+ name,
+ packageName,
+ superclassName,
+ interfaceNames,
+ isInterface,
+ isArray,
+ componentTypeName,
+ jaxxObjectDescriptor,
+ classLoader,
+ methods,
+ fields
+ );
+ }
+
+
+ private static class JavaClassClassDescriptor extends ClassDescriptor {
+
+ private final Class<?> javaClass;
+
+ public JavaClassClassDescriptor(
+ Class<?> javaClass,
+ String name,
+ String packageName,
+ String superclassName,
+ String[] interfaceNames,
+ boolean anInterface,
+ boolean array,
+ String componentTypeName,
+ JAXXObjectDescriptor jaxxObjectDescriptor,
+ ClassLoader classLoader,
+ MethodDescriptor[] methods,
+ FieldDescriptor[] fields) {
+ super(
+ name,
+ packageName,
+ superclassName,
+ interfaceNames,
+ anInterface,
+ array,
+ componentTypeName,
+ jaxxObjectDescriptor,
+ classLoader,
+ methods,
+ fields
+ );
+ this.javaClass = javaClass;
+ }
+
+ @Override
+ public FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException {
+ return ClassDescriptorHelper.createFieldDescriptor(javaClass.getDeclaredField(name),
+ javaClass.getClassLoader()
+ );
+ }
+
+ @Override
+ public MethodDescriptor getDeclaredMethodDescriptor(String name,
+ ClassDescriptor... parameterTypes) throws NoSuchMethodException {
+ try {
+ Class<?>[] parameterTypeClasses = new Class[parameterTypes.length];
+ for (int i = 0; i < parameterTypes.length; i++) {
+ parameterTypeClasses[i] = Class.forName(parameterTypes[i].getName());
+ }
+ return ClassDescriptorHelper.createMethodDescriptor(javaClass.getDeclaredMethod(name, parameterTypeClasses), javaClass.getClassLoader());
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+
+}
\ No newline at end of file
Property changes on: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java (rev 0)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -0,0 +1,646 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package jaxx.compiler.reflect.resolvers;
+
+import jaxx.compiler.CompilerException;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.JAXXFactory;
+import jaxx.compiler.java.parser.JavaParser;
+import jaxx.compiler.java.parser.JavaParserTreeConstants;
+import jaxx.compiler.java.parser.ParseException;
+import jaxx.compiler.java.parser.SimpleNode;
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
+import jaxx.compiler.reflect.ClassDescriptorResolver;
+import jaxx.compiler.reflect.FieldDescriptor;
+import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.compiler.tags.TagManager;
+import jaxx.runtime.JAXXUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * To obtain a class descriptor from a java source file.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver {
+
+ /** Logger */
+ private static final Log log =
+ LogFactory.getLog(ClassDescriptorResolverFromJavaFile.class);
+
+ @Override
+ public ClassDescriptor resolvDescriptor(String className,
+ URL source) throws ClassNotFoundException {
+
+ ClassLoader classLoader = getClassLoader();
+
+ try {
+ InputStream in = source.openStream();
+ ClassDescriptor result;
+ Reader reader = new InputStreamReader(in, "utf-8");
+ try {
+
+ String displayName = source.toString();
+ if (log.isDebugEnabled()) {
+ log.debug("for source " + displayName);
+ }
+ JavaFileParser parser = new JavaFileParser(classLoader);
+ if (log.isDebugEnabled()) {
+ log.debug("starting parsing : " + displayName);
+ }
+ try {
+ parser.doParse(displayName, reader);
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ throw new RuntimeException(e);
+ }
+ result = new JavaFileClassDescriptor(parser, classLoader);
+
+ } finally {
+
+ reader.close();
+ }
+ return result;
+ } catch (IOException e) {
+ throw new ClassNotFoundException(
+ "Could not resolv descriptor from source " + source,
+ e);
+ }
+ }
+
+ private static class JavaFileClassDescriptor extends ClassDescriptor {
+
+ public JavaFileClassDescriptor(JavaFileParser parser,
+ ClassLoader classLoader) {
+ super(
+ parser.className,
+ parser.packageName,
+ parser.superclass,
+ parser.interfaces.toArray(new String[parser.interfaces.size()]),
+ parser.isInterface,
+ false,
+ null,
+ parser.jaxxObjectDescriptorValue == null ? null : JAXXUtil.decodeCompressedJAXXObjectDescriptor(parser.jaxxObjectDescriptorValue),
+ classLoader,
+ parser.methods.toArray(new MethodDescriptor[parser.methods.size()]),
+ parser.fields.toArray(new FieldDescriptor[parser.fields.size()]),
+ parser.declaredFields.toArray(new FieldDescriptor[parser.declaredFields.size()])
+ );
+
+ }
+
+ @Override
+ public FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException {
+ for (FieldDescriptor descriptor : declaredFieldDescriptors) {
+ if (name.equals(descriptor.getName())) {
+ if (log.isDebugEnabled()) {
+ log.debug("Using a declared field descriptor [" + name + "] for " + getName());
+ }
+ return descriptor;
+ }
+ }
+ throw new NoSuchFieldException(name);
+ }
+
+ @Override
+ public MethodDescriptor getDeclaredMethodDescriptor(String name, ClassDescriptor... parameterTypes) throws NoSuchMethodException {
+ throw new NoSuchMethodException(name);
+ }
+
+ }
+
+ public static class JavaFileParser {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private final Log log = LogFactory.getLog(JavaFileParser.class);
+
+ /**
+ * the compiler used (this is a dummy compiler with no link with any file).
+ * <p/>
+ * FIXME-TC20100504 We should remove this link : should not need of a
+ * compiler to parse a java files.
+ */
+ private JAXXCompiler compiler;
+
+ /** fully qualified name of the class */
+ private String className;
+
+ /** package of the class */
+ private String packageName;
+
+ /** fully qualified name of the super class or {@code null} if no super class. */
+ private String superclass;
+
+ /**
+ * flag to known if we deal with an enum (the state is setted in the
+ * {@link #doParse(String, Reader)} method).
+ */
+ private boolean isEnum;
+
+ /**
+ * flag to known if we deal with an interface(the state is setted in the
+ * {@link #doParse(String, Reader)} method).
+ */
+ private boolean isInterface;
+
+ /** set of fully qualified names of interfaces of the class. */
+ private Set<String> interfaces;
+
+ /** public methods of the class */
+ private List<MethodDescriptor> methods;
+
+ /** none public methods of the class */
+// private List<MethodDescriptor> declaredMethods;
+
+ /** public fields of the class */
+ private List<FieldDescriptor> fields;
+
+ /** none public fields of the class */
+ private List<FieldDescriptor> declaredFields;
+
+ /**
+ * If sets, compressed value of the $jaxxObjectDescriptor field, this means
+ * the class if a JAXXObject implementation.
+ */
+ private String jaxxObjectDescriptorValue;
+
+ public static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+ protected JavaFileParser(ClassLoader classLoader) {
+ //FIXME-TC-20100504 : shoudl remove this to make the parser free of jaxx :)
+ // We could imagine just to offers to the parser a list of namespaces
+ // (for class resolving)...
+ compiler = JAXXFactory.newDummyCompiler(classLoader);
+ methods = new ArrayList<MethodDescriptor>();
+// declaredMethods = new ArrayList<MethodDescriptor>();
+ interfaces = new HashSet<String>();
+ fields = new ArrayList<FieldDescriptor>();
+ declaredFields = new ArrayList<FieldDescriptor>();
+ superclass = Object.class.getName();
+ }
+
+
+ public void doParse(String className, Reader src) throws ClassNotFoundException {
+ try {
+ JavaParser p = new JavaParser(src);
+ p.CompilationUnit();
+ SimpleNode node = p.popNode();
+ if (node != null) {
+ scanCompilationUnit(node);
+ if (isInterface) {
+
+ // remove super class
+ superclass = null;
+ }
+
+ if (isEnum) {
+
+ // super class is always Enum
+
+ superclass = Enum.class.getName();
+ }
+ if (superclass != null) {
+ //FIXME-TC20100504 This is not good, should add nothing here
+ // and modify the algorithm of ClassDescriptor to go and seek
+ // in super classes on interfaces if required.
+
+ ClassDescriptor superclassDescriptor = ClassDescriptorHelper.getClassDescriptor(superclass, compiler.getClassLoader());
+ methods.addAll(Arrays.asList(superclassDescriptor.getMethodDescriptors()));
+ fields.addAll(Arrays.asList(superclassDescriptor.getFieldDescriptors()));
+ }
+ return;
+ }
+ throw new CompilerException("Internal error: null node parsing Java file from " + src);
+ } catch (ParseException e) {
+ throw new CompilerException("Error parsing Java source code " + className + ": " + e.getMessage());
+ }
+ }
+
+ private void scanCompilationUnit(SimpleNode node) {
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode child = node.getChild(i);
+ scanCompilationUnitChild(child);
+ }
+ }
+
+ private void scanCompilationUnitChild(SimpleNode child) {
+ int nodeType = child.getId();
+ switch (nodeType) {
+ case JavaParserTreeConstants.JJTPACKAGEDECLARATION:
+ packageName = child.getChild(1).getText().trim();
+ compiler.addImport(packageName + ".*");
+
+ // add implicit java.lnag namespace available
+ compiler.addImport("java.lang.*");
+ break;
+ case JavaParserTreeConstants.JJTIMPORTDECLARATION:
+ String text = child.getText().trim();
+ if (text.startsWith("import")) {
+ text = text.substring("import".length()).trim();
+ }
+ if (text.endsWith(";")) {
+ text = text.substring(0, text.length() - 1);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("import " + text);
+ }
+ compiler.addImport(text);
+ break;
+ case JavaParserTreeConstants.JJTTYPEDECLARATION:
+ scanCompilationUnit(child);
+ break;
+
+ case JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION:
+ isInterface = child.firstToken.image.equals("interface");
+ scanClass(child);
+ case JavaParserTreeConstants.JJTENUMDECLARATION:
+ isEnum = child.firstToken.image.equals("enum");
+ scanClass(child);
+ break;
+ }
+ }
+
+ // scans the main ClassOrInterfaceDeclaration
+
+ private void scanClass(SimpleNode node) {
+// boolean isInterface = node.firstToken.image.equals("interface");
+ className = node.firstToken.next.image;
+ if (packageName != null) {
+ className = packageName + "." + className;
+ }
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode child = node.getChild(i);
+ int nodeType = child.getId();
+
+ if (nodeType == JavaParserTreeConstants.JJTIMPLEMENTSLIST) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("[" + className + "] Found a implements list " + child + " :: " + child.jjtGetNumChildren());
+ }
+
+ // obtain interfaces
+ for (int j = 0; j < child.jjtGetNumChildren(); j++) {
+ String rawName = child.getChild(j).getText().trim();
+
+ addInterface(rawName);
+ }
+ continue;
+ }
+ if (nodeType == JavaParserTreeConstants.JJTEXTENDSLIST) {
+
+ if (isInterface) {
+
+ // obtain interfaces
+ for (int j = 0; j < child.jjtGetNumChildren(); j++) {
+ String rawName = child.getChild(j).getText().trim();
+
+ addInterface(rawName);
+ }
+ continue;
+ }
+
+ // this is an extends
+ assert child.jjtGetNumChildren() == 1 : "expected ExtendsList to have exactly one child for a non-interface class";
+ String rawName = child.getChild(0).getText().trim();
+ superclass = TagManager.resolveClassName(rawName, compiler);
+ if (superclass == null) {
+ throw new CompilerException("Could not find class: " + rawName);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Set superClass = " + superclass);
+ }
+ } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEBODY) {
+ scanClassNode(child);
+ }
+ }
+ }
+
+ // scans class body nodes
+
+ private void scanClassNode(SimpleNode node) {
+ int nodeType = node.getId();
+
+ switch (nodeType) {
+ case JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION:
+
+ // TODO: handle inner classes
+ break;
+
+ case JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION:
+
+ // TODO: handle constructors
+ break;
+
+ case JavaParserTreeConstants.JJTMETHODDECLARATION:
+
+ scanMethodDeclaration(node);
+ break;
+
+ case JavaParserTreeConstants.JJTFIELDDECLARATION:
+
+ scanFieldDeclaration(node);
+ break;
+
+ default:
+
+ // go throught it
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode child = node.getChild(i);
+ scanClassNode(child);
+ }
+ }
+ }
+
+
+ protected void scanFieldDeclaration(SimpleNode node) {
+ String text = node.getText();
+ String declaration = text;
+ String value = null;
+ int equals = text.indexOf("=");
+ if (equals != -1) {
+ value = declaration.substring(equals + 1).trim();
+ declaration = declaration.substring(0, equals);
+ }
+ declaration = declaration.trim();
+
+ // get modifiers of the field
+
+ int modifiers;
+ if (isInterface) {
+ modifiers = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
+ } else {
+ modifiers = getModifiers(node);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("field [" + declaration + "] modifiers == " +
+ Modifier.toString(modifiers));
+ }
+
+ String[] declarationTokens = declaration.split("\\s");
+ String name = declarationTokens[declarationTokens.length - 1];
+ if (name.endsWith(";")) {
+ name = name.substring(0, name.length() - 1).trim();
+ }
+ String cName = declarationTokens[declarationTokens.length - 2];
+ String type = TagManager.resolveClassName(cName, compiler);
+
+ FieldDescriptor descriptor = new FieldDescriptor(
+ name,
+ modifiers,
+ type,
+ compiler.getClassLoader()
+ );
+
+ if ("$jaxxObjectDescriptor".equals(name) && value != null) {
+
+ // we are in a jaxx object, save the value of the field
+
+ // value have this form : = "XXX";, we just want the XXX part
+ int firstIndex = value.indexOf("\"");
+ int lastIndex = value.lastIndexOf("\"");
+
+ jaxxObjectDescriptorValue =
+ value.substring(firstIndex + 1, lastIndex);
+
+ if (log.isDebugEnabled()) {
+ log.debug("detected a $jaxxObjectDescriptor = " +
+ jaxxObjectDescriptorValue);
+ }
+
+ }
+
+ if (Modifier.isPublic(modifiers)) {
+
+ fields.add(descriptor);
+ } else {
+
+ declaredFields.add(descriptor);
+ }
+ }
+
+ protected void scanMethodDeclaration(SimpleNode node) {
+ String returnType = null;
+ String name = null;
+ List<String> parameterTypes = new ArrayList<String>();
+ //List<String> parameterNames = new ArrayList<String>();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode child = node.getChild(i);
+ int type = child.getId();
+ if (type == JavaParserTreeConstants.JJTRESULTTYPE) {
+ returnType = TagManager.resolveClassName(child.getText().trim(), compiler);
+ } else if (type == JavaParserTreeConstants.JJTMETHODDECLARATOR) {
+ name = child.firstToken.image.trim();
+ SimpleNode formalParameters = child.getChild(0);
+ assert formalParameters.getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS;
+ for (int j = 0; j < formalParameters.jjtGetNumChildren(); j++) {
+ SimpleNode parameter = formalParameters.getChild(j);
+ String rawParameterType = parameter.getChild(1).getText().trim().replaceAll("\\.\\.\\.", "[]");
+ String parameterType = TagManager.resolveClassName(rawParameterType, compiler);
+ if (parameterType == null && JAXXCompiler.STRICT_CHECKS) {
+ throw new CompilerException("could not find class '" + rawParameterType + "'");
+ }
+ parameterTypes.add(parameterType);
+ //parameterNames.add(parameter.getChild(2).getText().trim());
+ }
+ }
+ }
+
+ // determine the actual modifiers
+
+ int modifiers = getModifiers(node);
+
+ if (log.isDebugEnabled()) {
+ log.debug("method [" + name + "] modifiers == " + Modifier.toString(modifiers));
+ }
+
+ MethodDescriptor methodDescriptor = new MethodDescriptor(
+ name,
+ modifiers,
+ returnType,
+ parameterTypes.toArray(new String[parameterTypes.size()]),
+ compiler.getClassLoader()
+ );
+
+ if (Modifier.isPublic(modifiers)) {
+
+ methods.add(methodDescriptor);
+ } else {
+
+ //TODO At the moment, do not deal with it...
+// declaredMethods.add(methodDescriptor);
+ }
+ }
+
+ protected void addInterface(String rawName) {
+ if (rawName.contains("<")) {
+
+ // generic type
+ rawName = rawName.substring(0, rawName.indexOf("<"));
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("[" + className + "] try to obtain type of interface " + rawName);
+ }
+
+ String myInterface = resolveFullyQualifiedName(rawName);
+ if (myInterface == null) {
+ throw new CompilerException("Could not find interface: " + myInterface);
+ }
+ if (!interfaces.contains(myInterface)) {
+ if (log.isDebugEnabled()) {
+ log.debug("[" + className + "] add interface " + myInterface);
+ }
+ interfaces.add(myInterface);
+ }
+ }
+
+ protected String resolveFullyQualifiedName(String rawName) {
+ String result;
+
+ String realRawName = null;
+ String realParentRawName = null;
+ if (rawName.contains(".")) {
+ // this is a inner class
+ int index = rawName.lastIndexOf(".");
+ realParentRawName = rawName.substring(0, index);
+ realRawName = rawName.substring(index + 1);
+
+ if (log.isDebugEnabled()) {
+ log.debug("inner class detected ? " + realParentRawName + "//" + realRawName);
+ }
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("try fqn = " + rawName);
+ }
+ result = TagManager.resolveClassName(rawName, compiler);
+
+ if (result != null) {
+ // interface is detected fine (fqn was used or in good package ?)
+ return result;
+ }
+
+ String suffix = "." + rawName;
+
+ if (realParentRawName != null) {
+ suffix = "." + realParentRawName;
+ }
+
+ for (String aClass : compiler.getImportedClasses()) {
+
+ if (aClass.endsWith(suffix)) {
+
+ // found the class as an already knwon class
+
+ if (realRawName != null) {
+ aClass += "." + realRawName;
+ }
+
+ return aClass;
+ }
+ }
+
+ // try on packages
+
+ Set<String> importedPackages = compiler.getImportedPackages();
+
+ for (String aClass : importedPackages) {
+ String fqn = aClass + rawName;
+
+ if (log.isDebugEnabled()) {
+ log.debug("try fqn = " + fqn);
+ }
+ result = TagManager.resolveClassName(fqn, compiler);
+ if (result != null) {
+ return result;
+ }
+ }
+
+ // nothing was found
+ return null;
+ }
+
+ protected int getModifiers(SimpleNode node) {
+ SimpleNode parentNode = node.getParent();
+ for (int i = 0; i < parentNode.jjtGetNumChildren(); i++) {
+ SimpleNode child = parentNode.getChild(i);
+ if (child.getId() == JavaParserTreeConstants.JJTMODIFIERS) {
+ String modifiersStr = child.getText().trim();
+ int modifiers = scanModifiers(modifiersStr);
+ return modifiers;
+ }
+ }
+ return 0;
+ }
+
+ protected int scanModifiers(String modifiersStr) {
+ int modifiers = 0;
+ if (modifiersStr.contains("public")) {
+ modifiers |= Modifier.PUBLIC;
+ }
+ if (modifiersStr.contains("protected")) {
+ modifiers |= Modifier.PROTECTED;
+ }
+ if (modifiersStr.contains("private")) {
+ modifiers |= Modifier.PRIVATE;
+ }
+ if (modifiersStr.contains("static")) {
+ modifiers |= Modifier.STATIC;
+ }
+ if (modifiersStr.contains("final")) {
+ modifiers |= Modifier.FINAL;
+ }
+ if (modifiersStr.contains("volatile")) {
+ modifiers |= Modifier.VOLATILE;
+ }
+ if (modifiersStr.contains("transient")) {
+ modifiers |= Modifier.TRANSIENT;
+ }
+ if (modifiersStr.contains("synchronized")) {
+ modifiers |= Modifier.SYNCHRONIZED;
+ }
+ if (modifiersStr.contains("abstract")) {
+ modifiers |= Modifier.ABSTRACT;
+ }
+ return modifiers;
+ }
+ }
+
+}
Property changes on: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java (rev 0)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -0,0 +1,184 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package jaxx.compiler.reflect.resolvers;
+
+import jaxx.compiler.CompilerException;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.JAXXEngine;
+import jaxx.compiler.JAXXFactory;
+import jaxx.compiler.SymbolTable;
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
+import jaxx.compiler.reflect.ClassDescriptorResolver;
+import jaxx.compiler.reflect.FieldDescriptor;
+import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.JAXXObjectDescriptor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * To obtain a class descriptor from a java source file.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public class ClassDescriptorResolverFromJaxxFile extends ClassDescriptorResolver {
+
+ /** Logger */
+ private static final Log log =
+ LogFactory.getLog(ClassDescriptorResolverFromJaxxFile.class);
+
+ @Override
+ public ClassDescriptor resolvDescriptor(String className, URL source) throws ClassNotFoundException {
+
+ JAXXEngine engine = JAXXFactory.getEngine();
+
+ JAXXCompiler compiler = engine.getJAXXCompiler(className);
+
+ SymbolTable symbolTable = compiler.getSymbolTable();
+
+ if (symbolTable == null) {
+ throw new CompilerException("Internal error: no symbol table was generated for class '" + className + "'");
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("for compiler " + compiler.getOutputClassName());
+ }
+
+ ClassLoader classLoader = getClassLoader();
+
+ ClassDescriptor superclass = ClassDescriptorHelper.getClassDescriptor(symbolTable.getSuperclassName(), classLoader);
+ List<MethodDescriptor> publicMethods = symbolTable.getScriptMethods();
+ List<FieldDescriptor> publicFields = symbolTable.getScriptFields();
+ //List<MethodDescriptor> declaredMethods = new ArrayList<MethodDescriptor>(publicMethods);
+ //List<FieldDescriptor> declaredFields = new ArrayList<FieldDescriptor>(publicFields);
+ Iterator<MethodDescriptor> methods = publicMethods.iterator();
+ while (methods.hasNext()) {
+ MethodDescriptor method = methods.next();
+ if (!Modifier.isPublic(method.getModifiers())) {
+ methods.remove();
+ }
+ }
+ Iterator<FieldDescriptor> fields = publicFields.iterator();
+ while (fields.hasNext()) {
+ FieldDescriptor field = fields.next();
+ if (!Modifier.isPublic(field.getModifiers())) {
+ fields.remove();
+ }
+ }
+ Set<String> interfaces = new HashSet<String>();
+ if (symbolTable.getInterfaces() != null) {
+ // having interfaces
+ for (String anInterface : symbolTable.getInterfaces()) {
+ int genericIndex = anInterface.indexOf("<");
+ if (genericIndex > -1) {
+ // remove generic type
+ anInterface = anInterface.substring(0, genericIndex);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("getting interface " + anInterface + " descriptor for class " + className);
+ }
+ interfaces.add(anInterface);
+ ClassDescriptor interfaceclass = ClassDescriptorHelper.getClassDescriptor(anInterface, classLoader);
+ publicMethods.addAll(Arrays.asList(interfaceclass.getMethodDescriptors()));
+ publicFields.addAll(Arrays.asList(interfaceclass.getFieldDescriptors()));
+ }
+ }
+ publicMethods.addAll(Arrays.asList(superclass.getMethodDescriptors()));
+ publicFields.addAll(Arrays.asList(superclass.getFieldDescriptors()));
+ int dotPos = className.lastIndexOf(".");
+ String packageName = dotPos != -1 ? className.substring(0, dotPos) : null;
+
+ ClassDescriptor[] superclassInterfaces = superclass.getInterfaces();
+ for (ClassDescriptor superclassInterface : superclassInterfaces) {
+ interfaces.add(superclassInterface.getName());
+ }
+ interfaces.add(JAXXObject.class.getName());
+ return new JaxxFileClassDescriptor(
+ compiler,
+ className,
+ packageName,
+ interfaces,
+ classLoader,
+ publicMethods.toArray(new MethodDescriptor[publicMethods.size()]),
+ publicFields.toArray(new FieldDescriptor[publicFields.size()])
+ );
+ }
+
+ private static class JaxxFileClassDescriptor extends ClassDescriptor {
+
+ private final JAXXCompiler compiler;
+
+ public JaxxFileClassDescriptor(JAXXCompiler compiler,
+ String className,
+ String packageName,
+ Set<String> interfaces,
+ ClassLoader classLoader,
+ MethodDescriptor[] publicMethods,
+ FieldDescriptor[] publicFields) {
+ super(className,
+ packageName,
+ compiler.getSymbolTable().getSuperclassName(),
+ interfaces.toArray(new String[interfaces.size()]),
+ false,
+ false,
+ null,
+ null,
+ classLoader,
+ publicMethods,
+ publicFields
+ );
+ this.compiler = compiler;
+ }
+
+ @Override
+ public FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException {
+ String type = compiler.getSymbolTable().getClassTagIds().get(name);
+ if (type != null) {
+ return new FieldDescriptor(name, Modifier.PROTECTED, type, compiler.getClassLoader());
+ }
+ throw new NoSuchFieldException(name);
+ }
+
+ @Override
+ public MethodDescriptor getDeclaredMethodDescriptor(String name, ClassDescriptor... parameterTypes) throws NoSuchMethodException {
+ throw new NoSuchMethodException(name);
+ }
+
+ @Override
+ public JAXXObjectDescriptor getJAXXObjectDescriptor() {
+ return compiler.getJAXXObjectDescriptor();
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -27,7 +27,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
/**
* A dummy CompiledObject which serves to initialize scripted field. This is handled by
@@ -37,9 +37,9 @@
public class ScriptInitializer extends CompiledObject {
public ScriptInitializer(String initializer, JAXXCompiler compiler) {
-// super(compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class)),
+// super(compiler.getAutoId(ClassDescriptorHelper.getClassDescriptor(ScriptInitializer.class)),
super(compiler.getAutoId(ScriptInitializer.class.getSimpleName()),
- ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class), compiler, false);
+ ClassDescriptorHelper.getClassDescriptor(ScriptInitializer.class), compiler, false);
appendInitializationCode(initializer);
}
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -59,7 +59,7 @@
import jaxx.compiler.beans.BeanInfoUtil;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.tags.DefaultObjectHandler;
@@ -139,8 +139,8 @@
registerTag(JAXXCompiler.JAXX_NAMESPACE, "style", new StyleHandler());
//TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing
- registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class)));
-// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class)));
+ registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorHelper.getClassDescriptor(JAXXButtonGroup.class)));
+// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorHelper.getClassDescriptor(JAXXButtonGroup.class)));
registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler());
registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler());
@@ -148,7 +148,7 @@
registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler());
- registerTag(JAXXCompiler.JAXX_NAMESPACE, BeanValidatorHandler.TAG, new BeanValidatorHandler(ClassDescriptorLoader.getClassDescriptor(SwingValidator.class)));
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, BeanValidatorHandler.TAG, new BeanValidatorHandler(ClassDescriptorHelper.getClassDescriptor(SwingValidator.class)));
registerTag(JAXXCompiler.JAXX_NAMESPACE, FieldValidatorHandler.TAG, new FieldValidatorHandler());
registerTag(JAXXCompiler.JAXX_NAMESPACE, ExcludeFieldValidatorHandler.TAG, new FieldValidatorHandler());
@@ -212,7 +212,7 @@
protected void registerBean(Class<?> beanClass,
Class<? extends TagHandler> handlerClass) {
ClassDescriptor classDescriptor =
- ClassDescriptorLoader.getClassDescriptor(beanClass);
+ ClassDescriptorHelper.getClassDescriptor(beanClass);
TagManager.registerBean(classDescriptor, handlerClass);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -31,7 +31,7 @@
import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -74,7 +74,7 @@
public DefaultComponentHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Component.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, Component.class);
}
@Override
@@ -83,7 +83,7 @@
super.init();
containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE);
- if (containerDelegate == null && ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass().getSuperclass())) {
+ if (containerDelegate == null && ClassDescriptorHelper.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass().getSuperclass())) {
containerDelegate = ((DefaultComponentHandler) TagManager.getTagHandler(getBeanClass().getSuperclass())).getContainerDelegate();
}
}
@@ -102,7 +102,7 @@
addProxyEventInfo("getY", ComponentListener.class);
addProxyEventInfo("getWidth", ComponentListener.class);
addProxyEventInfo("getHeight", ComponentListener.class);
- if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass())) {
+ if (ClassDescriptorHelper.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass())) {
addProxyEventInfo("getComponentCount", ContainerListener.class);
}
}
@@ -150,12 +150,12 @@
propertyName.equals(WIDTH_ATTRIBUTE) ||
propertyName.equals(HEIGHT_ATTRIBUTE) ||
FONT_SIZE_ATTRIBUTE.equals(propertyName)) {
- return ClassDescriptorLoader.getClassDescriptor(Integer.class);
+ return ClassDescriptorHelper.getClassDescriptor(Integer.class);
}
if (propertyName.equals(FONT_FACE_ATTRIBUTE) ||
propertyName.equals(FONT_STYLE_ATTRIBUTE) ||
propertyName.equals(FONT_WEIGHT_ATTRIBUTE)) {
- return ClassDescriptorLoader.getClassDescriptor(String.class);
+ return ClassDescriptorHelper.getClassDescriptor(String.class);
}
return super.getPropertyType(object, propertyName, compiler);
}
@@ -228,7 +228,7 @@
compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode);
return "";
}
- if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals(LAYOUT_ATTRIBUTE)) {
+ if (ClassDescriptorHelper.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals(LAYOUT_ATTRIBUTE)) {
// handle containerDelegate (e.g. contentPane on JFrame)
String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE);
if (cDelegate != null) {
@@ -343,7 +343,7 @@
* @return <code>true</code> if children are allowed
*/
public boolean isContainer() {
- boolean container = ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass());
+ boolean container = ClassDescriptorHelper.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass());
// if (container) {
// try {
// init();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -37,7 +37,7 @@
import jaxx.compiler.binding.DataBindingHelper;
import jaxx.compiler.css.StylesheetHelper;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.FieldDescriptor;
import jaxx.compiler.reflect.MethodDescriptor;
import jaxx.compiler.types.TypeManager;
@@ -385,7 +385,7 @@
String removeMethod) {
try {
ClassDescriptor classDescriptor =
- ClassDescriptorLoader.getClassDescriptor(
+ ClassDescriptorHelper.getClassDescriptor(
listenerClass.getName()
);
@@ -734,7 +734,7 @@
// return "";
// }
// try {
-// Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
+// Class<?> typeClass = type != null ? ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : null;
// Object value = convertFromString(propertyName, stringValue, typeClass);
// return getSetPropertyCode(object.getJavaCode(), propertyName, compiler.getJavaCode(value), compiler);
// } catch (NumberFormatException e) {
@@ -774,7 +774,7 @@
//---------------------------------------------------------------------
//FIXME TC-20091105 we should to this later when all binding are compiled
// because we don't know yet if this is a databinding
-// if (ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(object.getObjectClass())) {
+// if (ClassDescriptorHelper.getClassDescriptor(JAXXObject.class).isAssignableFrom(object.getObjectClass())) {
// // check for data binding & remove if found
// JAXXObjectDescriptor jaxxObjectDescriptor = object.getObjectClass().getJAXXObjectDescriptor();
// if (jaxxObjectDescriptor.getComponentDescriptors().length == 0) {
@@ -803,7 +803,7 @@
if (!withBinding) {
// no bindings, convert from string
try {
- Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
+ Class<?> typeClass = type != null ? ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : null;
Object value = convertFromString(propertyName, stringValue, typeClass);
setProperty(object, propertyName, value, compiler);
return;
@@ -845,7 +845,7 @@
ClassDescriptor objectClass = object.getObjectClass();
ClassDescriptor jaxxObjectClassDescriptor =
- ClassDescriptorLoader.getClassDescriptor(JAXXObject.class);
+ ClassDescriptorHelper.getClassDescriptor(JAXXObject.class);
// to apply styleSheet to a jaxx object,
// since 2.0.2, this process can be skip if configuration
@@ -877,7 +877,7 @@
jaxxObjectDescriptor.getComponentDescriptors();
for (ComponentDescriptor descriptor : descriptors) {
ClassDescriptor classDescriptor =
- ClassDescriptorLoader.getClassDescriptor(
+ ClassDescriptorHelper.getClassDescriptor(
descriptor.getJavaClassName()
);
boolean isRoot = classDescriptor != objectClass;
@@ -891,7 +891,7 @@
ComponentDescriptor parentDescriptor = descriptor.getParent();
CompiledObject currentObject = child;
while (parentDescriptor != null) {
- CompiledObject parent = new CompiledObject("internal", ClassDescriptorLoader.getClassDescriptor(parentDescriptor.getJavaClassName()), compiler);
+ CompiledObject parent = new CompiledObject("internal", ClassDescriptorHelper.getClassDescriptor(parentDescriptor.getJavaClassName()), compiler);
currentObject.setParent(parent);
currentObject = parent;
parentDescriptor = parentDescriptor.getParent();
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -250,7 +250,7 @@
*/
public static DefaultObjectHandler getTagHandler(Class<?> klass) throws CompilerException {
- ClassDescriptor beanClass = ClassDescriptorLoader.getClassDescriptor(klass);
+ ClassDescriptor beanClass = ClassDescriptorHelper.getClassDescriptor(klass);
DefaultObjectHandler tagHandler = getTagHandler(beanClass);
return tagHandler;
}
@@ -472,7 +472,7 @@
if (handler == null) {
try {
ClassDescriptor beanClass =
- ClassDescriptorLoader.getClassDescriptor(
+ ClassDescriptorHelper.getClassDescriptor(
className,
compiler.getClassLoader()
);
@@ -639,7 +639,7 @@
if (className == null) {
return null;
}
- return ClassDescriptorLoader.getClassDescriptor(
+ return ClassDescriptorHelper.getClassDescriptor(
className,
compiler.getClassLoader()
);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.runtime.swing.Application;
import jaxx.compiler.types.TypeManager;
import org.w3c.dom.Element;
@@ -40,7 +40,7 @@
public ApplicationHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Application.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, Application.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -56,7 +56,7 @@
String id = tag.getAttribute("id");
if (id == null || id.length() == 0) {
id = compiler.getAutoId(Item.class.getSimpleName());
-// id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(Item.class));
+// id = compiler.getAutoId(ClassDescriptorHelper.getClassDescriptor(Item.class));
}
String label = null;
String value = null;
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.swing.JAXXComboBox;
@@ -44,7 +44,7 @@
public JAXXComboBoxHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXComboBox.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JAXXComboBox.class);
}
@Override
@@ -69,7 +69,7 @@
list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();");
for (Item item : items) {
String id = item.getId();
- CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler);
+ CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorHelper.getClassDescriptor(Item.class), compiler);
compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected());
compiler.registerCompiledObject(compiledItem);
list.appendAdditionCode(listName + ".add(" + id + ");");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.swing.JAXXList;
@@ -44,7 +44,7 @@
public JAXXListHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXList.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JAXXList.class);
}
@Override
@@ -72,7 +72,7 @@
list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();");
for (Item item : items) {
String id = item.getId();
- CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler);
+ CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorHelper.getClassDescriptor(Item.class), compiler);
compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected());
compiler.registerCompiledObject(compiledItem);
list.appendAdditionCode(listName + ".add(" + id + ");");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.swing.Item;
@@ -44,7 +44,7 @@
public JAXXTreeHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXTree.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JAXXTree.class);
}
@Override
@@ -65,7 +65,7 @@
private void createItems(CompiledObject tree, List<Item> items, String addMethod, JAXXCompiler compiler) throws CompilerException {
for (Item item : items) {
String id = item.getId();
- CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler);
+ CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorHelper.getClassDescriptor(Item.class), compiler);
compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected());
compiler.registerCompiledObject(compiledItem);
tree.appendAdditionCode(addMethod + "(" + id + ");");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler.tags.swing;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import javax.swing.AbstractButton;
@@ -36,7 +36,7 @@
public JCheckBoxHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, AbstractButton.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, AbstractButton.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -28,7 +28,7 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -41,7 +41,7 @@
public JComboBoxHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JComboBox.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JComboBox.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
@@ -41,7 +41,7 @@
public JInternalFrameHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JInternalFrame.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JInternalFrame.class);
}
@Override
@@ -50,7 +50,7 @@
@Override
public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException {
- if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) {
+ if (ClassDescriptorHelper.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) {
appendAdditionCode(getId() + ".setJMenuBar(" + child.getId() + ");");
} else {
super.addChild(child, constraints, compiler);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -28,7 +28,7 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -41,7 +41,7 @@
public JListHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JList.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JList.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler.tags.swing;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import javax.swing.JMenu;
@@ -36,7 +36,7 @@
public JMenuHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JMenu.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JMenu.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler.tags.swing;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import javax.swing.JPasswordField;
import javax.swing.event.DocumentListener;
@@ -35,7 +35,7 @@
public JPasswordFieldHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JPasswordField.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JPasswordField.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -28,7 +28,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
@@ -38,7 +38,7 @@
public JPopupMenuHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JPopupMenu.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JPopupMenu.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler.tags.swing;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import javax.swing.JProgressBar;
@@ -36,7 +36,7 @@
public JProgressBarHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JProgressBar.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JProgressBar.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -30,7 +30,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.swing.JAXXButtonGroup;
@@ -45,7 +45,7 @@
public JRadioButtonHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, AbstractButton.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, AbstractButton.class);
}
@Override
@@ -59,7 +59,7 @@
if (name.equals(BUTTON_GROUP_PROPERTY)) {
return null; // accepts either a String or a ButtonGroup
} else if (name.equals(VALUE_PROPERTY)) {
- return ClassDescriptorLoader.getClassDescriptor(Object.class);
+ return ClassDescriptorHelper.getClassDescriptor(Object.class);
} else {
return super.getPropertyType(object, name, compiler);
}
@@ -87,7 +87,7 @@
valueCode = valueCode.substring(1, valueCode.length() - 1);
CompiledObject buttonGroup = compiler.getCompiledObject(valueCode);
if (buttonGroup == null) {
- buttonGroup = new CompiledObject(valueCode, ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class), compiler);
+ buttonGroup = new CompiledObject(valueCode, ClassDescriptorHelper.getClassDescriptor(JAXXButtonGroup.class), compiler);
compiler.registerCompiledObject(buttonGroup);
}
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import javax.swing.JScrollPane;
@@ -38,7 +38,7 @@
public JScrollPaneHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JScrollPane.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JScrollPane.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
@@ -41,7 +41,7 @@
public JSliderHandler(ClassDescriptor beanClass) {
super(beanClass);
- if (!ClassDescriptorLoader.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) {
+ if (!ClassDescriptorHelper.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) {
throw new IllegalArgumentException(getClass().getName() + " does not support the class " + beanClass.getName());
}
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
@@ -44,7 +44,7 @@
public JSpinnerHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JSpinner.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JSpinner.class);
}
public static class CompiledSpinner extends CompiledObject {
@@ -73,7 +73,7 @@
public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException {
if (propertyName.equals(MINIMUM_PROPERTY) || propertyName.equals(MAXIMUM_PROPERTY) ||
propertyName.equals(VALUE_PROPERTY)) {
- return ClassDescriptorLoader.getClassDescriptor(Integer.class);
+ return ClassDescriptorHelper.getClassDescriptor(Integer.class);
}
return super.getPropertyType(object, propertyName, compiler);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
@@ -40,7 +40,7 @@
public JSplitPaneHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JSplitPane.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JSplitPane.class);
}
protected Component createRawComponent(Element tag) {
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -30,7 +30,7 @@
import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.swing.TabInfo;
@@ -45,7 +45,7 @@
public JTabbedPaneHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTabbedPane.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JTabbedPane.class);
}
public static class CompiledTabbedPane extends CompiledObject {
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.runtime.SwingUtil;
import org.w3c.dom.Attr;
@@ -45,20 +45,20 @@
public JTextComponentHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTextComponent.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JTextComponent.class);
}
@Override
protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException {
super.setDefaults(object, tag, compiler);
try {
- object.getObjectClass().getMethodDescriptor("setColumns", ClassDescriptorLoader.getClassDescriptor(int.class));
+ object.getObjectClass().getMethodDescriptor("setColumns", ClassDescriptorHelper.getClassDescriptor(int.class));
setAttribute(object, "columns", String.valueOf(DEFAULT_COLUMNS), false, compiler);
} catch (NoSuchMethodException e) {
// ignore ?
}
- if (ClassDescriptorLoader.getClassDescriptor(JTextArea.class).isAssignableFrom(object.getObjectClass())) {
+ if (ClassDescriptorHelper.getClassDescriptor(JTextArea.class).isAssignableFrom(object.getObjectClass())) {
setAttribute(object, "lineWrap", "true", false, compiler);
setAttribute(object, "wrapStyleWord", "true", false, compiler);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -26,7 +26,7 @@
package jaxx.compiler.tags.swing;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import javax.swing.JToolBar;
@@ -35,7 +35,7 @@
public JToolBarHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JToolBar.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JToolBar.class);
}
/**
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -28,7 +28,7 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
@@ -41,7 +41,7 @@
public JTreeHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTree.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JTree.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import org.w3c.dom.Element;
@@ -44,7 +44,7 @@
public JWindowHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JWindow.class, JFrame.class, JDialog.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JWindow.class, JFrame.class, JDialog.class);
}
@Override
@@ -53,7 +53,7 @@
@Override
public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException {
- if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) {
+ if (ClassDescriptorHelper.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) {
appendAdditionCode(getId() + ".setJMenuBar(" + child.getId() + ");");
} else {
super.addChild(child, constraints, compiler);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -27,7 +27,7 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.TagHandler;
import jaxx.runtime.swing.Table;
import org.w3c.dom.Element;
@@ -47,7 +47,7 @@
@Override
public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
- if (!ClassDescriptorLoader.getClassDescriptor(Table.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) {
+ if (!ClassDescriptorHelper.getClassDescriptor(Table.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) {
compiler.reportError("row tag may only appear within Table tag");
return;
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -30,7 +30,7 @@
import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.binding.DataBindingHelper;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.TagHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.swing.TabInfo;
@@ -56,7 +56,7 @@
@Override
public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
- if (!ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) {
+ if (!ClassDescriptorHelper.getClassDescriptor(JTabbedPane.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) {
compiler.reportError("tab tag may only appear within JTabbedPane tag");
return;
}
@@ -66,10 +66,10 @@
String id = tag.getAttribute("id");
if (id == null || id.length() == 0) {
id = compiler.getAutoId(TabInfo.class.getSimpleName());
-// id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(TabInfo.class));
+// id = compiler.getAutoId(ClassDescriptorHelper.getClassDescriptor(TabInfo.class));
}
TabInfo tabInfo = new TabInfo(id);
- CompiledObject compiledTabInfo = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(TabInfo.class), compiler);
+ CompiledObject compiledTabInfo = new CompiledObject(id, ClassDescriptorHelper.getClassDescriptor(TabInfo.class), compiler);
compiler.registerCompiledObject(compiledTabInfo);
//id = tabInfo.getId();
tabs.tabInfo = tabInfo;
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -30,7 +30,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.swing.Table;
@@ -46,7 +46,7 @@
public TableHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Table.class);
+ ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, Table.class);
}
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -32,7 +32,7 @@
import jaxx.compiler.beans.JAXXPropertyDescriptor;
import jaxx.compiler.binding.DataBindingHelper;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultObjectHandler;
import jaxx.compiler.types.TypeManager;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -100,7 +100,7 @@
public BeanValidatorHandler(ClassDescriptor beanClass) {
super(beanClass);
- ClassDescriptorLoader.checkSupportClass(
+ ClassDescriptorHelper.checkSupportClass(
getClass(),
beanClass,
SwingValidator.class
@@ -258,7 +258,7 @@
Class<?> validatorClass =
compiler.getConfiguration().getValidatorClass();
ClassDescriptor result =
- ClassDescriptorLoader.getClassDescriptor(validatorClass);
+ ClassDescriptorHelper.getClassDescriptor(validatorClass);
return result;
}
@@ -417,7 +417,7 @@
}
}*/
ClassDescriptor beanClassDescriptor =
- ClassDescriptorLoader.getClassDescriptor(beanClass);
+ ClassDescriptorHelper.getClassDescriptor(beanClass);
beanDescriptor = DefaultObjectHandler.getJAXXBeanInfo(
beanClassDescriptor);
@@ -452,8 +452,8 @@
if (uiClass != null) {
try {
ClassDescriptor uiClazz =
- ClassDescriptorLoader.getClassDescriptor(uiClass);
- if (!ClassDescriptorLoader.getClassDescriptor(AbstractBeanValidatorUI.class).isAssignableFrom(uiClazz)) {
+ ClassDescriptorHelper.getClassDescriptor(uiClass);
+ if (!ClassDescriptorHelper.getClassDescriptor(AbstractBeanValidatorUI.class).isAssignableFrom(uiClazz)) {
compiler.reportError(
"attribute 'ui' :'" + uiClass +
"' is not assignable from class " +
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -27,7 +27,7 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.TagHandler;
import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -59,7 +59,7 @@
log.debug(tag);
}
- if (!ClassDescriptorLoader.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) {
+ if (!ClassDescriptorHelper.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) {
compiler.reportError(TAG + " tag may only appear within " + BeanValidatorHandler.TAG + " tag but was " + tag);
return;
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.binding.DataBindingHelper;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.TagHandler;
import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -64,7 +64,7 @@
}
ClassDescriptor descriptor =
- ClassDescriptorLoader.getClassDescriptor(SwingValidator.class);
+ ClassDescriptorHelper.getClassDescriptor(SwingValidator.class);
if (!descriptor.isAssignableFrom(
compiler.getOpenComponent().getObjectClass())) {
compiler.reportError(
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -31,7 +31,7 @@
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.beans.JAXXPropertyDescriptor;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.reflect.MethodDescriptor;
import java.io.BufferedWriter;
@@ -77,7 +77,7 @@
protected static void treateClass(BufferedWriter w, String className) throws ClassNotFoundException, IOException {
- ClassDescriptor beanClass = ClassDescriptorLoader.getClassDescriptor(className);
+ ClassDescriptor beanClass = ClassDescriptorHelper.getClassDescriptor(className);
DefaultObjectHandler handler = TagManager.getTagHandler(beanClass);
DefaultObjectHandler superHandler = TagManager.getTagHandler(beanClass.getSuperclass());
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -29,7 +29,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tools.jaxxcapture.handlers.JTabbedPaneHandler;
import jaxx.compiler.tools.jaxxcapture.handlers.ObjectHandler;
import jaxx.compiler.tools.jaxxcapture.handlers.TableHandler;
@@ -77,10 +77,10 @@
static {
//TODO make a serviceLoader mecanism to allow inter-module loading
- objectHandlers.put(ClassDescriptorLoader.getClassDescriptor(Object.class), new ObjectHandler());
- objectHandlers.put(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), new JTabbedPaneHandler());
+ objectHandlers.put(ClassDescriptorHelper.getClassDescriptor(Object.class), new ObjectHandler());
+ objectHandlers.put(ClassDescriptorHelper.getClassDescriptor(JTabbedPane.class), new JTabbedPaneHandler());
try {
- objectHandlers.put(ClassDescriptorLoader.getClassDescriptor("jaxx.runtime.swing.Table"), new TableHandler());
+ objectHandlers.put(ClassDescriptorHelper.getClassDescriptor("jaxx.runtime.swing.Table"), new TableHandler());
} catch (ClassNotFoundException e) {
System.err.println(e);
}
@@ -339,13 +339,13 @@
ObjectHandler handler;
if (className.length() > 0) {
try {
- ClassDescriptor descriptor = ClassDescriptorLoader.getClassDescriptor(className, classLoader);
+ ClassDescriptor descriptor = ClassDescriptorHelper.getClassDescriptor(className, classLoader);
handler = (ObjectHandler) objectHandlers.get(descriptor);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} else {
- handler = (ObjectHandler) objectHandlers.get(ClassDescriptorLoader.getClassDescriptor(Object.class));
+ handler = (ObjectHandler) objectHandlers.get(ClassDescriptorHelper.getClassDescriptor(Object.class));
}
return handler.processObject(objectTag, context, this);
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -33,11 +33,11 @@
/*@Test
public void testGetClassDescriptor() throws Exception {
- ClassDescriptorLoader.getClassDescriptor("jaxx.runtime.swing.navigation.tree.NavigationTreeModel.NavigationTreeNode");
+ ClassDescriptorHelper.getClassDescriptor("jaxx.runtime.swing.navigation.tree.NavigationTreeModel.NavigationTreeNode");
}*/
@Test
public void testBuiltInClassName() throws ClassNotFoundException, NoSuchMethodException {
- ClassDescriptor object = ClassDescriptorLoader.getClassDescriptor("java.lang.Object");
+ ClassDescriptor object = ClassDescriptorHelper.getClassDescriptor("java.lang.Object");
MethodDescriptor toString = object.getMethodDescriptor("toString");
assertEquals(toString.getName(), "toString");
assertEquals(toString.getParameterTypes().length, 0);
@@ -50,14 +50,14 @@
@Test
public void testBuiltInClass() throws ClassNotFoundException, NoSuchMethodException {
- ClassDescriptor object1 = ClassDescriptorLoader.getClassDescriptor("java.lang.Object");
- ClassDescriptor object2 = ClassDescriptorLoader.getClassDescriptor(Object.class);
+ ClassDescriptor object1 = ClassDescriptorHelper.getClassDescriptor("java.lang.Object");
+ ClassDescriptor object2 = ClassDescriptorHelper.getClassDescriptor(Object.class);
assertEquals(object1, object2);
}
@Test
public void testUserClassName() throws ClassNotFoundException, NoSuchMethodException {
- ClassDescriptor me = ClassDescriptorLoader.getClassDescriptor(ClassDescriptorTest.class.getName(), getClass().getClassLoader());
+ ClassDescriptor me = ClassDescriptorHelper.getClassDescriptor(ClassDescriptorTest.class.getName(), getClass().getClassLoader());
MethodDescriptor testUserClassName = me.getMethodDescriptor("testUserClassName");
assertEquals(testUserClassName.getName(), "testUserClassName");
assertEquals(testUserClassName.getParameterTypes().length, 0);
@@ -67,7 +67,7 @@
public void testWrongCase() throws ClassNotFoundException {
//try {
//ClassDescriptor object =
- ClassDescriptorLoader.getClassDescriptor("jaxx.junit.classdescriptortest", getClass().getClassLoader());
+ ClassDescriptorHelper.getClassDescriptor("jaxx.junit.classdescriptortest", getClass().getClassLoader());
// fail("Found descriptor using wrong case: " + object);
//}
//catch (ClassNotFoundException e) {
@@ -76,9 +76,9 @@
@Test
public void testArrays() throws ClassNotFoundException {
- ClassDescriptor intArray = ClassDescriptorLoader.getClassDescriptor(int[].class);
+ ClassDescriptor intArray = ClassDescriptorHelper.getClassDescriptor(int[].class);
assertNotNull(intArray);
- ClassDescriptor objectArray = ClassDescriptorLoader.getClassDescriptor(Object[].class);
+ ClassDescriptor objectArray = ClassDescriptorHelper.getClassDescriptor(Object[].class);
assertNotNull(objectArray);
}
}
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/JavaFileParserTest.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/JavaFileParserTest.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/JavaFileParserTest.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -48,7 +48,7 @@
LogFactory.getLog(JavaFileParserTest.class);
/** test source root directory */
- static File testSourceRoot;
+ public static File testSourceRoot;
@BeforeClass
public static void initBaseDir() {
@@ -173,10 +173,10 @@
}
- protected void assertField(ClassDescriptor descriptor,
- String fieldName,
- Class<?> fieldType,
- int fieldModifiers) throws NoSuchFieldException {
+ public static void assertField(ClassDescriptor descriptor,
+ String fieldName,
+ Class<?> fieldType,
+ int fieldModifiers) throws NoSuchFieldException {
FieldDescriptor fieldDescriptor =
descriptor.getFieldDescriptor(fieldName);
Assert.assertNotNull(fieldDescriptor);
@@ -187,10 +187,10 @@
Assert.assertEquals(fieldModifiers, modifiers);
}
- protected void assertDeclaredField(ClassDescriptor descriptor,
- String fieldName,
- Class<?> fieldType,
- int fieldModifiers) throws NoSuchFieldException {
+ public static void assertDeclaredField(ClassDescriptor descriptor,
+ String fieldName,
+ Class<?> fieldType,
+ int fieldModifiers) throws NoSuchFieldException {
FieldDescriptor fieldDescriptor =
descriptor.getDeclaredFieldDescriptor(fieldName);
Assert.assertNotNull(fieldDescriptor);
@@ -236,7 +236,7 @@
for (Class<?> anInterface : interfaces) {
ClassDescriptor descriptor2 =
- ClassDescriptorLoader.getClassDescriptor(anInterface);
+ ClassDescriptorHelper.getClassDescriptor(anInterface);
Assert.assertNotNull(descriptor2);
boolean value = descriptor2.isAssignableFrom(descriptor);
Assert.assertTrue(
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyAbstractClass.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyAbstractClass.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyAbstractClass.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package jaxx.compiler.reflect;
/**
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyClass.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyClass.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyClass.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package jaxx.compiler.reflect;
import java.io.Serializable;
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package jaxx.compiler.reflect;
/**
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface2.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface2.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface2.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package jaxx.compiler.reflect;
import org.nuiton.util.ApplicationConfig;
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface3.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface3.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/MyInterface3.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package jaxx.compiler.reflect;
import org.nuiton.util.ApplicationConfig.OptionDef;
Added: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java (rev 0)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -0,0 +1,208 @@
+/*
+ * #%L
+ * JAXX :: Compiler
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package jaxx.compiler.reflect.resolvers;
+
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.JavaFileParserTest;
+import jaxx.compiler.reflect.MyAbstractClass;
+import jaxx.compiler.reflect.MyClass;
+import jaxx.compiler.reflect.MyEnum;
+import jaxx.compiler.reflect.MyInterface;
+import jaxx.compiler.reflect.MyInterface2;
+import jaxx.compiler.reflect.MyInterface3;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.nuiton.util.ApplicationConfig;
+
+import java.io.File;
+import java.io.Serializable;
+import java.lang.reflect.Modifier;
+
+import static jaxx.compiler.reflect.JavaFileParserTest.assertDeclaredField;
+import static jaxx.compiler.reflect.JavaFileParserTest.assertField;
+import static jaxx.compiler.reflect.JavaFileParserTest.assertInterfaces;
+import static jaxx.compiler.reflect.JavaFileParserTest.assertIsAssignableFrom;
+import static jaxx.compiler.reflect.JavaFileParserTest.assertSuperClass;
+
+/**
+ * Tests the {@link ClassDescriptorResolverFromJavaFile} resolver.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0.2
+ */
+public class ClassDescriptorResolverFromJavaFileTest {
+
+ /** log */
+ protected static final Log log =
+ LogFactory.getLog(ClassDescriptorResolverFromJavaFileTest.class);
+
+ @BeforeClass
+ public static void initBaseDir() {
+ JavaFileParserTest.initBaseDir();
+ }
+
+ protected ClassDescriptor getDescriptor(Class<?> klass) throws Exception {
+
+ String javaFilePath =
+ klass.getName().replaceAll("\\.", File.separator) + ".java";
+ File src = new File(JavaFileParserTest.testSourceRoot, javaFilePath);
+ Assert.assertTrue(src.exists());
+
+ if (log.isInfoEnabled()) {
+ log.info("file to parse " + src);
+ }
+
+ ClassDescriptorResolverFromJavaFile resolver =
+ new ClassDescriptorResolverFromJavaFile();
+
+ ClassDescriptor descriptor =
+ resolver.resolvDescriptor(klass.getName(), src.toURI().toURL());
+
+ Assert.assertNotNull(descriptor);
+ if (log.isInfoEnabled()) {
+ log.info("loaded " + descriptor);
+ }
+ Assert.assertEquals(klass.getName(), descriptor.getName());
+ return descriptor;
+ }
+
+ @Test
+ public void parseClassDescriptorResolverFromJavaFileTest() throws Exception {
+
+ ClassDescriptor descriptor =
+ getDescriptor(ClassDescriptorResolverFromJavaFileTest.class);
+
+ assertInterfaces(descriptor);
+ assertSuperClass(descriptor, Object.class);
+ }
+
+
+ @Test
+ public void parseMyEnum() throws Exception {
+
+ ClassDescriptor descriptor = getDescriptor(MyEnum.class);
+
+ assertInterfaces(descriptor, Serializable.class, MyInterface.class);
+ assertInterfaces(descriptor, MyEnum.class.getInterfaces());
+ assertSuperClass(descriptor, Enum.class);
+
+ assertIsAssignableFrom(
+ descriptor,
+ Serializable.class,
+ MyInterface.class,
+ Enum.class
+ );
+ }
+
+ @Test
+ public void parseMyInterface() throws Exception {
+
+ ClassDescriptor descriptor = getDescriptor(MyInterface.class);
+
+ assertInterfaces(descriptor);
+ assertSuperClass(descriptor, null);
+ }
+
+ @Test
+ public void parseMyInterface2() throws Exception {
+
+ ClassDescriptor descriptor = getDescriptor(MyInterface2.class);
+
+ assertInterfaces(descriptor, MyInterface2.class.getInterfaces());
+ assertInterfaces(descriptor, ApplicationConfig.OptionDef.class);
+ assertSuperClass(descriptor, null);
+ }
+
+
+ @Test
+ public void parseMyInterface3() throws Exception {
+
+ ClassDescriptor descriptor = getDescriptor(MyInterface3.class);
+
+ assertInterfaces(descriptor, MyInterface3.class.getInterfaces());
+ assertInterfaces(descriptor, ApplicationConfig.OptionDef.class,
+ Iterable.class);
+ assertSuperClass(descriptor, null);
+ }
+
+ @Test
+ public void parseMyAbstractClass() throws Exception {
+
+ ClassDescriptor descriptor = getDescriptor(MyAbstractClass.class);
+
+ assertInterfaces(descriptor, MyAbstractClass.class.getInterfaces());
+ assertInterfaces(descriptor, MyInterface.class);
+ assertSuperClass(descriptor, Object.class);
+ assertIsAssignableFrom(descriptor, MyInterface.class, Object.class);
+ }
+
+ @Test
+ public void parseMyClass() throws Exception {
+
+ ClassDescriptor descriptor = getDescriptor(MyClass.class);
+
+ assertInterfaces(descriptor, MyClass.class.getInterfaces());
+ assertInterfaces(descriptor, Serializable.class);
+ assertSuperClass(descriptor, MyAbstractClass.class);
+ assertIsAssignableFrom(descriptor,
+ Serializable.class,
+ MyInterface.class,
+ MyAbstractClass.class
+ );
+
+ assertDeclaredField(
+ descriptor,
+ "serialVersionUID",
+ long.class,
+ Modifier.PRIVATE | Modifier.FINAL | Modifier.STATIC
+ );
+
+ assertDeclaredField(
+ descriptor,
+ "myPrivateStringField",
+ String.class,
+ Modifier.PRIVATE | Modifier.FINAL
+ );
+
+ assertDeclaredField(
+ descriptor,
+ "myProtectedStringField",
+ String.class,
+ Modifier.PROTECTED
+ );
+
+ assertField(
+ descriptor,
+ "myPublicStringField",
+ String.class,
+ Modifier.PUBLIC
+ );
+
+ }
+
+}
Property changes on: trunk/jaxx-compiler/src/test/java/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java
===================================================================
--- trunk/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java 2010-05-04 15:14:14 UTC (rev 1872)
+++ trunk/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java 2010-05-04 19:48:38 UTC (rev 1873)
@@ -30,7 +30,7 @@
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.JAXXFactory;
import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.ClassDescriptorHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -78,16 +78,16 @@
@Test
public void testRegisterBean() {
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(InputStream.class), TestHandler.class);
+ TagManager.registerBean(ClassDescriptorHelper.getClassDescriptor(InputStream.class), TestHandler.class);
- Assert.assertTrue(TagManager.getTagHandler(ClassDescriptorLoader.getClassDescriptor(InputStream.class)) instanceof TestHandler);
- Assert.assertTrue(TagManager.getTagHandler(ClassDescriptorLoader.getClassDescriptor(FileInputStream.class)) instanceof TestHandler);
+ Assert.assertTrue(TagManager.getTagHandler(ClassDescriptorHelper.getClassDescriptor(InputStream.class)) instanceof TestHandler);
+ Assert.assertTrue(TagManager.getTagHandler(ClassDescriptorHelper.getClassDescriptor(FileInputStream.class)) instanceof TestHandler);
}
@Test
public void testRegisterDefaultNamespace() {
- TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(OutputStream.class), TestHandler.class);
+ TagManager.registerBean(ClassDescriptorHelper.getClassDescriptor(OutputStream.class), TestHandler.class);
TagManager.registerDefaultNamespace("OutputStream", "java.io.*");
Assert.assertTrue("Could not find handler for OutputStream despite default namespace", TagManager.getTagHandler(null, "OutputStream", compiler) instanceof TestHandler);
1
0
r1872 - trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect
by tchemit@users.nuiton.org 04 May '10
by tchemit@users.nuiton.org 04 May '10
04 May '10
Author: tchemit
Date: 2010-05-04 17:14:14 +0200 (Tue, 04 May 2010)
New Revision: 1872
Url: http://nuiton.org/repositories/revision/jaxx/1872
Log:
add jaxxObjectDescriptor available in classDescriptor when coming from a java source
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java 2010-05-04 09:50:39 UTC (rev 1871)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java 2010-05-04 15:14:14 UTC (rev 1872)
@@ -33,6 +33,8 @@
import jaxx.compiler.java.parser.ParseException;
import jaxx.compiler.java.parser.SimpleNode;
import jaxx.compiler.tags.TagManager;
+import jaxx.runtime.JAXXObjectDescriptor;
+import jaxx.runtime.JAXXUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -72,6 +74,8 @@
private List<FieldDescriptor> declaredFields = new ArrayList<FieldDescriptor>();
+ private String jaxxObjectDescriptorValue;
+
public static final String[] EMPTY_STRING_ARRAY = new String[0];
private JavaFileParser(ClassLoader classLoader) {
@@ -100,6 +104,17 @@
throw new RuntimeException(e);
}
+ JAXXObjectDescriptor jaxxObjectDescriptor = null;
+
+ if (parser.jaxxObjectDescriptorValue != null) {
+
+ // compute the jaxx object descriptor
+
+ jaxxObjectDescriptor = JAXXUtil.decodeCompressedJAXXObjectDescriptor(
+ parser.jaxxObjectDescriptorValue
+ );
+
+ }
List<MethodDescriptor> publicMethods = parser.methods;
List<FieldDescriptor> publicFields = parser.fields;
List<FieldDescriptor> declaredFields = parser.declaredFields;
@@ -142,7 +157,7 @@
parser.isInterface,
false,
null,
- null,
+ jaxxObjectDescriptor,
classLoader,
publicMethods.toArray(new MethodDescriptor[publicMethods.size()]),
publicFields.toArray(new FieldDescriptor[publicFields.size()]),
@@ -209,6 +224,8 @@
case JavaParserTreeConstants.JJTPACKAGEDECLARATION:
packageName = child.getChild(1).getText().trim();
compiler.addImport(packageName + ".*");
+
+ // add implicit java.lnag namespace available
compiler.addImport("java.lang.*");
break;
case JavaParserTreeConstants.JJTIMPORTDECLARATION:
@@ -413,24 +430,21 @@
String text = node.getText();
String declaration = text;
+ String value = null;
int equals = text.indexOf("=");
if (equals != -1) {
+ value = declaration.substring(equals + 1).trim();
declaration = declaration.substring(0, equals);
}
declaration = declaration.trim();
- SimpleNode parentNode = node.getParent();
- int modifiers = 0;
+ // get modifiers of the field
+
+ int modifiers;
if (isInterface) {
modifiers = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
} else {
- for (int i = 0; i < parentNode.jjtGetNumChildren(); i++) {
- SimpleNode child = parentNode.getChild(i);
- if (child.getId() == JavaParserTreeConstants.JJTMODIFIERS) {
- String modifiersStr = child.getText().trim();
- modifiers = scanModifiers(modifiersStr);
- }
- }
+ modifiers = getModifiers(node);
}
log.info("field [" + declaration + "] modifiers == " + Modifier.toString(modifiers));
@@ -449,6 +463,22 @@
type,
compiler.getClassLoader()
);
+
+ if ("$jaxxObjectDescriptor".equals(name) && value != null) {
+
+ // we are in a jaxx object, save the value of the field
+
+ // value have this form : = "XXX";, we just want the XXX part
+ int firstIndex = value.indexOf("\"");
+ int lastIndex = value.lastIndexOf("\"");
+
+ jaxxObjectDescriptorValue = value.substring(firstIndex + 1, lastIndex);
+
+ log.info("detected a $jaxxObjectDescriptor = " +
+ jaxxObjectDescriptorValue);
+
+ }
+
if (Modifier.isPublic(modifiers)) {
fields.add(descriptor);
} else {
@@ -463,6 +493,19 @@
}
}
+ protected int getModifiers(SimpleNode node) {
+ SimpleNode parentNode = node.getParent();
+ for (int i = 0; i < parentNode.jjtGetNumChildren(); i++) {
+ SimpleNode child = parentNode.getChild(i);
+ if (child.getId() == JavaParserTreeConstants.JJTMODIFIERS) {
+ String modifiersStr = child.getText().trim();
+ int modifiers = scanModifiers(modifiersStr);
+ return modifiers;
+ }
+ }
+ return 0;
+ }
+
protected int scanModifiers(String modifiersStr) {
int modifiers = 0;
if (modifiersStr.contains("public")) {
1
0