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
June 2010
- 2 participants
- 74 discussions
Author: tchemit
Date: 2010-06-19 20:55:40 +0200 (Sat, 19 Jun 2010)
New Revision: 1975
Url: http://nuiton.org/repositories/revision/jaxx/1975
Log:
Utilisation de mavenpom4redmine 2.2
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-19 00:58:36 UTC (rev 1974)
+++ trunk/pom.xml 2010-06-19 18:55:40 UTC (rev 1975)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.2-SNAPSHOT</version>
+ <version>2.2</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -536,6 +536,7 @@
</properties>
<build>
+ <defaultGoal>validate</defaultGoal>
<plugins>
<plugin>
<groupId>org.nuiton</groupId>
@@ -545,14 +546,17 @@
<id>check-central-safe</id>
<inherited>true</inherited>
<goals>
- <goal>check-central-safe</goal>
+ <goal>check-auto-container</goal>
</goals>
<configuration>
- <extraRepositories>
+ ${nuiton.central.release.repository}
+ <addMavenCentral>true</addMavenCentral>
+ <failIfNotSafe>true</failIfNotSafe>
+ <repositories>
<nuiton-central-releases>
http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases
</nuiton-central-releases>
- </extraRepositories>
+ </repositories>
</configuration>
</execution>
</executions>
1
0
r1974 - in trunk: jaxx-tutorial-css jaxx-tutorial-databinding
by tchemit@users.nuiton.org 19 Jun '10
by tchemit@users.nuiton.org 19 Jun '10
19 Jun '10
Author: tchemit
Date: 2010-06-19 02:58:36 +0200 (Sat, 19 Jun 2010)
New Revision: 1974
Url: http://nuiton.org/repositories/revision/jaxx/1974
Log:
fix svn ignore
Modified:
trunk/jaxx-tutorial-css/
trunk/jaxx-tutorial-databinding/
Property changes on: trunk/jaxx-tutorial-css
___________________________________________________________________
Modified: svn:ignore
- target
+ target
*.iml
*.ipr
*.iws
Property changes on: trunk/jaxx-tutorial-databinding
___________________________________________________________________
Modified: svn:ignore
- target
+ target
*.ipr
*.iml
*.iws
1
0
r1973 - in trunk: . jaxx-demo jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard jaxx-tutorial jaxx-tutorial-config jaxx-tutorial-css jaxx-tutorial-databinding jaxx-tutorial-helloworld jaxx-tutorial-helloworld2
by tchemit@users.nuiton.org 19 Jun '10
by tchemit@users.nuiton.org 19 Jun '10
19 Jun '10
Author: tchemit
Date: 2010-06-19 02:50:37 +0200 (Sat, 19 Jun 2010)
New Revision: 1973
Url: http://nuiton.org/repositories/revision/jaxx/1973
Log:
use mavenpom 2.2 and central-safe profile + fix some mistakes in tutorial and demo
Modified:
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java
trunk/jaxx-tutorial-config/pom.xml
trunk/jaxx-tutorial-css/pom.xml
trunk/jaxx-tutorial-databinding/pom.xml
trunk/jaxx-tutorial-helloworld/pom.xml
trunk/jaxx-tutorial-helloworld2/pom.xml
trunk/jaxx-tutorial/pom.xml
trunk/pom.xml
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-demo/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -151,6 +151,11 @@
</manifest>
</archive>
</configuration>
+ <executions>
+ <execution>
+ <goals><goal>jar</goal></goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java 2010-06-19 00:50:37 UTC (rev 1973)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * JAXX :: Runtime
+ *
+ * $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.runtime.swing.wizard;
import org.apache.commons.logging.Log;
Modified: trunk/jaxx-tutorial/pom.xml
===================================================================
--- trunk/jaxx-tutorial/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-tutorial/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -186,20 +186,6 @@
</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>
Modified: trunk/jaxx-tutorial-config/pom.xml
===================================================================
--- trunk/jaxx-tutorial-config/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-tutorial-config/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -90,7 +90,7 @@
<!-- main class to run -->
- <main.class>jaxx.demo.config.RunDemo</main.class>
+ <maven.jar.main.class>jaxx.demo.config.RunDemo</maven.jar.main.class>
<!-- compiler configuration -->
@@ -123,7 +123,7 @@
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
- <mainClass>${main.class}</mainClass>
+ <mainClass>${maven.jar.main.class}</mainClass>
</manifest>
</archive>
</configuration>
@@ -131,7 +131,7 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3.1</version>
</plugin>
<plugin>
Modified: trunk/jaxx-tutorial-css/pom.xml
===================================================================
--- trunk/jaxx-tutorial-css/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-tutorial-css/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -53,7 +53,7 @@
<!-- main class to run -->
- <main.class>org.nuiton.jaxx.tutorials.css.css</main.class>
+ <maven.jar.main.class>org.nuiton.jaxx.tutorials.css.css</maven.jar.main.class>
<!-- compiler configuration -->
@@ -79,14 +79,14 @@
<plugin>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3.1</version>
<configuration>
<archive>
<manifest>
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
- <mainClass>${main.class}</mainClass>
+ <mainClass>${maven.jar.main.class}</mainClass>
</manifest>
</archive>
</configuration>
@@ -94,7 +94,7 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3.1</version>
</plugin>
<plugin>
Modified: trunk/jaxx-tutorial-databinding/pom.xml
===================================================================
--- trunk/jaxx-tutorial-databinding/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-tutorial-databinding/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -53,7 +53,7 @@
<!-- main class to run -->
- <main.class>org.nuiton.jaxx.tutorials.databinding.databinding</main.class>
+ <maven.jar.main.class>org.nuiton.jaxx.tutorials.databinding.databinding</maven.jar.main.class>
<!-- compiler configuration -->
@@ -86,7 +86,7 @@
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
- <mainClass>${main.class}</mainClass>
+ <mainClass>${maven.jar.main.class}</mainClass>
</manifest>
</archive>
</configuration>
Modified: trunk/jaxx-tutorial-helloworld/pom.xml
===================================================================
--- trunk/jaxx-tutorial-helloworld/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-tutorial-helloworld/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -61,7 +61,7 @@
<!-- main class to run -->
- <main.class>org.nuiton.jaxx.tutorials.helloworld.helloworld</main.class>
+ <maven.jar.main.class>org.nuiton.jaxx.tutorials.helloworld.helloworld</maven.jar.main.class>
<!-- compiler configuration -->
@@ -87,14 +87,14 @@
<plugin>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3.1</version>
<configuration>
<archive>
<manifest>
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
- <mainClass>${main.class}</mainClass>
+ <mainClass>${maven.jar.main.class}</mainClass>
</manifest>
</archive>
</configuration>
@@ -102,7 +102,7 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3.1</version>
</plugin>
<plugin>
Modified: trunk/jaxx-tutorial-helloworld2/pom.xml
===================================================================
--- trunk/jaxx-tutorial-helloworld2/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/jaxx-tutorial-helloworld2/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -60,7 +60,7 @@
<!-- main class to run -->
- <main.class>org.nuiton.jaxx.tutorials.helloworld.helloworld</main.class>
+ <maven.jar.main.class>org.nuiton.jaxx.tutorials.helloworld.helloworld</maven.jar.main.class>
<!-- compiler configuration -->
@@ -86,14 +86,14 @@
<plugin>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3.1</version>
<configuration>
<archive>
<manifest>
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
- <mainClass>${main.class}</mainClass>
+ <mainClass>${maven.jar.main.class}</mainClass>
</manifest>
</archive>
</configuration>
@@ -101,7 +101,7 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3</version>
+ <version>2.3.1</version>
</plugin>
<plugin>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-14 16:33:04 UTC (rev 1972)
+++ trunk/pom.xml 2010-06-19 00:50:37 UTC (rev 1973)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.1.5</version>
+ <version>2.2-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -433,7 +433,7 @@
<version>${jnlp.version}</version>
<configuration>
<jnlp>
- <mainClass>${main.class}</mainClass>
+ <mainClass>${maven.jar.main.class}</mainClass>
<allPermissions>true</allPermissions>
<offlineAllowed>true</offlineAllowed>
</jnlp>
@@ -481,8 +481,7 @@
<!-- Source control management. -->
<scm>
<connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk
- </developerConnection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
<url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
</scm>
@@ -520,6 +519,48 @@
</profile>
+ <profile>
+ <id>central-safe</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <properties>
+
+ <!-- deploy releases on nuiton-central-releases repository -->
+ <release.repository>${nuiton.central.release.repository}</release.repository>
+
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>check-central-safe</id>
+ <inherited>true</inherited>
+ <goals>
+ <goal>check-central-safe</goal>
+ </goals>
+ <configuration>
+ <extraRepositories>
+ <nuiton-central-releases>
+ http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases
+ </nuiton-central-releases>
+ </extraRepositories>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
1
0
r1972 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree
by tchemit@users.nuiton.org 14 Jun '10
by tchemit@users.nuiton.org 14 Jun '10
14 Jun '10
Author: tchemit
Date: 2010-06-14 18:33:04 +0200 (Mon, 14 Jun 2010)
New Revision: 1972
Url: http://nuiton.org/repositories/revision/jaxx/1972
Log:
Anomalie #674: ClassCastException when using navigation tree filtred by a simple TreeModel
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/JaxxTreeHelper.java
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/JaxxTreeHelper.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/JaxxTreeHelper.java 2010-06-14 16:15:35 UTC (rev 1971)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/JaxxTreeHelper.java 2010-06-14 16:33:04 UTC (rev 1972)
@@ -126,9 +126,13 @@
@Override
public void treeWillExpand(TreeExpansionEvent event) {
- DefaultTreeModel model = (DefaultTreeModel)
- ((JTree) event.getSource()).getModel();
+ if (model == null) {
+ // no model set,
+ log.warn("No model set in " + this);
+ return;
+ }
+
JaxxNode<?> source = (JaxxNode<?>)
event.getPath().getLastPathComponent();
if (log.isDebugEnabled()) {
@@ -153,8 +157,14 @@
treeModelListener = new TreeModelListener() {
@Override
public void treeNodesChanged(TreeModelEvent e) {
- JaxxNode<?> source = (JaxxNode<?>) e.getTreePath().getLastPathComponent();
- DefaultTreeModel model = (DefaultTreeModel) e.getSource();
+ if (model == null) {
+
+ // no model set,
+ log.warn("No model set in " + this);
+ return;
+ }
+
+ JaxxNode<?> source = getNode(e);
DataProvider dataProvider = getDataProvider();
source.populateNode(model, dataProvider, false);
if (log.isDebugEnabled()) {
@@ -172,8 +182,13 @@
@Override
public void treeNodesInserted(TreeModelEvent e) {
- JaxxNode<?> source = (JaxxNode<?>) e.getTreePath().getLastPathComponent();
- DefaultTreeModel model = (DefaultTreeModel) e.getSource();
+ if (model == null) {
+
+ // no model set,
+ log.warn("No model set in " + this);
+ return;
+ }
+ JaxxNode<?> source = getNode(e);
DataProvider dataProvider = getDataProvider();
source.populateNode(model, dataProvider, false);
if (log.isDebugEnabled()) {
@@ -191,7 +206,13 @@
@Override
public void treeNodesRemoved(TreeModelEvent e) {
- JaxxNode<?> source = (JaxxNode<?>) e.getTreePath().getLastPathComponent();
+ if (model == null) {
+
+ // no model set,
+ log.warn("No model set in " + this);
+ return;
+ }
+ JaxxNode<?> source = getNode(e);
if (log.isDebugEnabled()) {
String message = getLogMessage(e, source);
log.debug(message);
@@ -200,8 +221,13 @@
@Override
public void treeStructureChanged(TreeModelEvent e) {
- JaxxNode<?> source = (JaxxNode<?>) e.getTreePath().getLastPathComponent();
- DefaultTreeModel model = (DefaultTreeModel) e.getSource();
+ if (model == null) {
+
+ // no model set,
+ log.warn("No model set in " + this);
+ return;
+ }
+ JaxxNode<?> source = getNode(e);
DataProvider dataProvider = getDataProvider();
source.populateNode(model, dataProvider, false);
if (log.isDebugEnabled()) {
@@ -224,6 +250,12 @@
Arrays.toString(e.getChildIndices());
return message;
}
+
+
+ protected JaxxNode<?> getNode(TreeModelEvent e) {
+ JaxxNode<?> source = (JaxxNode<?>) e.getTreePath().getLastPathComponent();
+ return source;
+ }
};
}
@@ -250,8 +282,10 @@
return null;
}
TreeCellRenderer r = t.getCellRenderer();
- return (AbstractJaxxTreeCellRenderer<N>)
- (r instanceof AbstractJaxxTreeCellRenderer ? r : null);
+ if (r instanceof AbstractJaxxTreeCellRenderer<?>) {
+ return (AbstractJaxxTreeCellRenderer<N>) r;
+ }
+ return null;
}
public DefaultTreeModel getModel() {
1
0
r1971 - in trunk/jaxx-demo: . src/main/java/jaxx/demo/component/jaxx/tree src/main/java/jaxx/demo/component/jaxx/tree/content
by tchemit@users.nuiton.org 14 Jun '10
by tchemit@users.nuiton.org 14 Jun '10
14 Jun '10
Author: tchemit
Date: 2010-06-14 18:15:35 +0200 (Mon, 14 Jun 2010)
New Revision: 1971
Url: http://nuiton.org/repositories/revision/jaxx/1971
Log:
improve demo (use import tag :))
Added:
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/AbstractContentUI.jaxx
Removed:
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx
Modified:
trunk/jaxx-demo/pom.xml
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx
trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2010-06-14 15:47:37 UTC (rev 1970)
+++ trunk/jaxx-demo/pom.xml 2010-06-14 16:15:35 UTC (rev 1971)
@@ -101,7 +101,7 @@
<properties>
- <main.class>jaxx.demo.RunDemo</main.class>
+ <maven.jar.main.class>jaxx.demo.RunDemo</maven.jar.main.class>
<jaxx.addProjectClassPath>true</jaxx.addProjectClassPath>
<jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath>
@@ -144,7 +144,7 @@
<configuration>
<archive>
<manifest>
- <mainClass>${main.class}</mainClass>
+ <!--<mainClass>${maven.jar.main.class}</mainClass>-->
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx 2010-06-14 15:47:37 UTC (rev 1970)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/JaxxTreeDemo.jaxx 2010-06-14 16:15:35 UTC (rev 1971)
@@ -24,21 +24,22 @@
<jaxx.demo.DemoPanel>
- <CardLayout2 id='contentLayout'/>
+ <import>
+ jaxx.runtime.decorator.DecoratorProvider
+ jaxx.demo.component.jaxx.tree.content.ActorContentUI
+ jaxx.demo.component.jaxx.tree.content.ActorsContentUI
+ jaxx.demo.component.jaxx.tree.content.MovieContentUI
+ jaxx.demo.component.jaxx.tree.content.MoviesContentUI
+ jaxx.demo.entities.Movie
+ jaxx.demo.entities.People
+ javax.swing.tree.TreePath
+ java.lang.reflect.Constructor
+ jaxx.demo.component.jaxx.tree.content.AbstractContentUI
+ </import>
+
+ <CardLayout2 id='contentLayout'/>
- <script><![CDATA[
-
-import jaxx.runtime.decorator.DecoratorProvider;
-import jaxx.demo.component.jaxx.tree.content.ActorContentUI;
-import jaxx.demo.component.jaxx.tree.content.ActorsContentUI;
-import jaxx.demo.component.jaxx.tree.content.MovieContentUI;
-import jaxx.demo.component.jaxx.tree.content.MoviesContentUI;
-import jaxx.demo.entities.Movie;
-import jaxx.demo.entities.People;
-import javax.swing.tree.TreePath;
-import java.lang.reflect.Constructor;
-import jaxx.demo.component.jaxx.tree.content.ContentUI;
-
+ <script><![CDATA[
private JaxxTreeDemoDataProvider dataProvider = new JaxxTreeDemoDataProvider();
private JaxxTreeDemoHelper helper = new JaxxTreeDemoHelper(dataProvider);
@@ -135,10 +136,10 @@
}
// Create by introspection content ui
-protected <B> void showUI(B bean, Class<? extends ContentUI> uiClass) {
+protected <B> void showUI(B bean, Class<? extends AbstractContentUI> uiClass) {
// Verify if instance is existing
- ContentUI ui = getContentIfExist(uiClass);
+ AbstractContentUI ui = getContentIfExist(uiClass);
// Get layout identifier
String contentName = uiClass.getName();
@@ -146,7 +147,7 @@
if (ui == null) {
try {
// Get constructor
- Constructor<? extends ContentUI> constructor =
+ Constructor<? extends AbstractContentUI> constructor =
uiClass.getConstructor(JAXXContext.class);
// Invoke instance creation
@@ -176,33 +177,33 @@
if (!contentLayout.contains(contentName)) {
return null;
}
- return (E)contentLayout.getComponent(content, contentName);
+ return (E) contentLayout.getComponent(content, contentName);
}
]]>
- </script>
+ </script>
- <JPanel id='demoPanel' layout='{new BorderLayout()}'>
+ <JPanel id='demoPanel' layout='{new BorderLayout()}'>
- <JSplitPane id='splitPane'
- constraints='BorderLayout.CENTER'
- oneTouchExpandable='true'>
+ <JSplitPane id='splitPane'
+ constraints='BorderLayout.CENTER'
+ oneTouchExpandable='true'>
- <JScrollPane border='{null}'
- horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}'
- verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_NEVER}'>
+ <JScrollPane border='{null}'
+ horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}'
+ verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_NEVER}'>
- <JTree id="navigation"
- font-size='11'
- rootVisible='false'
- showsRootHandles='false'
- model='{helper.createTreeModel()}'/>
-
- </JScrollPane>
+ <JTree id="navigation"
+ font-size='11'
+ rootVisible='false'
+ showsRootHandles='false'
+ model='{helper.createTreeModel()}'/>
- <JPanel id="content" layout="{contentLayout}" />
+ </JScrollPane>
- </JSplitPane>
+ <JPanel id="content" layout="{contentLayout}"/>
- </JPanel>
+ </JSplitPane>
+ </JPanel>
+
</jaxx.demo.DemoPanel>
Copied: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/AbstractContentUI.jaxx (from rev 1970, trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx)
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/AbstractContentUI.jaxx (rev 0)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/AbstractContentUI.jaxx 2010-06-14 16:15:35 UTC (rev 1971)
@@ -0,0 +1,42 @@
+<!--
+ #%L
+ JAXX :: Demo
+ $Id: AbstractContentUI.jaxx 1861 2010-04-29 14:16:39Z tchemit $
+ $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/comp… $
+ %%
+ Copyright (C) 2008 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+<JPanel abstract='true'
+ layout='{new BorderLayout()}'
+ genericType='B extends Object'>
+
+ <script><![CDATA[
+import jaxx.demo.component.jaxx.tree.JaxxTreeDemoHelper;
+
+// Get helper in context
+JaxxTreeDemoHelper getHelper() {
+ return getContextValue(JaxxTreeDemoHelper.class);
+}
+
+public abstract B getData();
+
+public abstract void setData(B data);
+ ]]>
+ </script>
+</JPanel>
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx 2010-06-14 15:47:37 UTC (rev 1970)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorContentUI.jaxx 2010-06-14 16:15:35 UTC (rev 1971)
@@ -22,8 +22,11 @@
#L%
-->
-<ContentUI superGenericType='People'>
+<AbstractContentUI superGenericType='People'>
+ <import>
+ jaxx.demo.entities.*
+ </import>
<script><![CDATA[
import jaxx.demo.entities.*;
@@ -71,4 +74,4 @@
</JScrollPane>
</JSplitPane>
-</ContentUI>
\ No newline at end of file
+</AbstractContentUI>
\ No newline at end of file
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx 2010-06-14 15:47:37 UTC (rev 1970)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ActorsContentUI.jaxx 2010-06-14 16:15:35 UTC (rev 1971)
@@ -22,7 +22,7 @@
#L%
-->
-<ContentUI superGenericType='java.util.List<People>'>
+<AbstractContentUI superGenericType='java.util.List<People>'>
<script><![CDATA[
import jaxx.demo.entities.*;
@@ -82,4 +82,4 @@
</JToolBar>
</JPanel>
-</ContentUI>
\ No newline at end of file
+</AbstractContentUI>
\ No newline at end of file
Deleted: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx 2010-06-14 15:47:37 UTC (rev 1970)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/ContentUI.jaxx 2010-06-14 16:15:35 UTC (rev 1971)
@@ -1,42 +0,0 @@
-<!--
- #%L
- JAXX :: Demo
- $Id: ContentUI.jaxx 1861 2010-04-29 14:16:39Z tchemit $
- $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/comp… $
- %%
- Copyright (C) 2008 - 2010 CodeLutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Lesser Public License for more details.
-
- You should have received a copy of the GNU General Lesser Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/lgpl-3.0.html>.
- #L%
- -->
-
-<JPanel abstract='true'
- layout='{new BorderLayout()}'
- genericType='B extends Object'>
-
- <script><![CDATA[
-import jaxx.demo.component.jaxx.tree.JaxxTreeDemoHelper;
-
-// Get helper in context
-JaxxTreeDemoHelper getHelper() {
- return getContextValue(JaxxTreeDemoHelper.class);
-}
-
-public abstract B getData();
-
-public abstract void setData(B data);
- ]]>
- </script>
-</JPanel>
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx 2010-06-14 15:47:37 UTC (rev 1970)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MovieContentUI.jaxx 2010-06-14 16:15:35 UTC (rev 1971)
@@ -22,7 +22,7 @@
#L%
-->
-<ContentUI superGenericType='Movie'>
+<AbstractContentUI superGenericType='Movie'>
<script><![CDATA[
import jaxx.demo.entities.*;
@@ -70,4 +70,4 @@
</JScrollPane>
</JSplitPane>
-</ContentUI>
\ No newline at end of file
+</AbstractContentUI>
\ No newline at end of file
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx 2010-06-14 15:47:37 UTC (rev 1970)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/content/MoviesContentUI.jaxx 2010-06-14 16:15:35 UTC (rev 1971)
@@ -22,15 +22,18 @@
#L%
-->
-<ContentUI superGenericType='java.util.List<Movie>'>
+<AbstractContentUI
+ superGenericType='java.util.List<Movie>'>
- <script><![CDATA[
-import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer;
-import jaxx.demo.entities.*;
-import jaxx.runtime.binding.SimpleJAXXObjectBinding;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import jaxx.demo.component.jaxx.tree.JaxxTreeDemoHelper;
+ <import>
+ jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer
+ jaxx.demo.entities.*
+ jaxx.runtime.binding.SimpleJAXXObjectBinding
+ java.beans.PropertyChangeEvent
+ java.beans.PropertyChangeListener
+ jaxx.demo.component.jaxx.tree.JaxxTreeDemoHelper
+ </import>
+ <script><![CDATA[
private void $afterCompleteSetup() {
@@ -59,31 +62,34 @@
}
]]></script>
- <java.util.List id='data' genericType='Movie' javaBean='null'/>
+ <java.util.List id='data' genericType='Movie' javaBean='null'/>
- <JPanel layout='{new BorderLayout()}'>
+ <JPanel layout='{new BorderLayout()}'>
- <JScrollPane border='{new TitledBorder(_("jaxxdemo.navigation.movies.title"))}'
- constraints='BorderLayout.CENTER'
- columnHeaderView='{toolbar}'
- horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}'
- verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'>
+ <JScrollPane
+ border='{new TitledBorder(_("jaxxdemo.navigation.movies.title"))}'
+ constraints='BorderLayout.CENTER'
+ columnHeaderView='{toolbar}'
+ horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}'
+ verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'>
- <JList id='list' model='{new DefaultListModel()}'
- cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/>
+ <JList id='list' model='{new DefaultListModel()}'
+ cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/>
- </JScrollPane>
+ </JScrollPane>
- <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH'
- floatable='false'>
+ <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH'
+ floatable='false'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}'
- onActionPerformed='selectChild()'/>
- <JButton text='jaxxdemo.action.add'/>
- <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/>
- </JPanel>
- </JToolBar>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton text='jaxxdemo.action.show'
+ enabled='{list.getSelectedIndex()!=-1}'
+ onActionPerformed='selectChild()'/>
+ <JButton text='jaxxdemo.action.add'/>
+ <JButton text='jaxxdemo.action.remove'
+ enabled='{list.getSelectedIndex()!=-1}'/>
+ </JPanel>
+ </JToolBar>
- </JPanel>
-</ContentUI>
\ No newline at end of file
+ </JPanel>
+</AbstractContentUI>
\ No newline at end of file
1
0
Author: tchemit
Date: 2010-06-14 17:47:37 +0200 (Mon, 14 Jun 2010)
New Revision: 1970
Url: http://nuiton.org/repositories/revision/jaxx/1970
Log:
update doc
Modified:
trunk/src/site/rst/index.rst
trunk/src/site/rst/old-compiler-doc/JAXXContext.rst
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-06-14 15:18:39 UTC (rev 1969)
+++ trunk/src/site/rst/index.rst 2010-06-14 15:47:37 UTC (rev 1970)
@@ -34,9 +34,90 @@
JAXX documentation is in French, we are planning to update it and make an
english translation at the same time. To help you wait, you can have a look to
-the demo_ .
+the demo_.
+Nouveautés de la version 2.1
+----------------------------
+Introduction d'un nouveau tag **import**
+________________________________________
+
+Ce tag simplifie la gestion des imports.
+
+Chaque ligne correspond à un import à effectuer.
+
+Exemple :
+
+::
+ <import>
+ java.io.File
+ static java.io.File.separatorChar
+ </import>
+
+Voir http://nuiton.org/issues/show/685
+
+Meilleure gestion de l'héritage
+_______________________________
+
+La gestion de l'héritage a été amélioré.
+
+On peut désormais surcharger un tag dans un fichier jaxx fils, le getter surchargé
+sera bien généré.
+
+Si aucun initializer n'est renseigné (constructorParams, javabean, initializer)
+alors rien de plus ne sera généré.
+
+De plus pour les bindings, on doit utiliser la propriété surchargée et non pas
+l'accesseur sur la propriété.
+
+Lors de la génération, l'accesseur sera utilisé à la place de la propriété.
+
+WARNING::
+ Cette évolution admet une restriction : si on veut surcharger un
+ component swing, on DOIT alors toujours lui préciser un initializer, sinon le
+ component surchargé ne sera pas généré et à l'exécution on risque d'avoir un
+ *ClassCastException* si le type n'est pas le même.
+
+Une documentation plus détaillée sur le mécanisme d'héritage sera écrite pour la
+version 2.2.
+
+
+Voir
+
+ * http://nuiton.org/issues/show/625
+ * http://nuiton.org/issues/show/626
+
+Nouvelle api d'arbre
+____________________
+
+Le package *jaxx.runtime.swing.tree** contient une api simplifié pour créer des
+arbres qui savent se charger tout seul.
+
+Cette api remplace celle du package **jaxx.runtime.swing.navigation**.
+
+Voir http://nuiton.org/issues/show/666
+
+Nouvelle api d'assistant
+________________________
+
+Le package *jaxx.runtime.swing.wizard.ext** contient une nouvelle api simplifié
+pour créer des assitants avec des modèles attachés aux étapes.
+
+Cette api remplace celle du **jaxx.runtime.swing.wizard.WizardOperationXXX**.
+
+Voir http://nuiton.org/issues/show/665
+
+Ajout de tutoriaux
+__________________
+
+JAXX intègre désormais des tutoriaux.
+
+Voir
+
+ * http://nuiton.org/issues/show/640
+ * http://nuiton.org/issues/show/641
+ * http://nuiton.org/issues/show/642
+
Présentation
------------
@@ -45,8 +126,6 @@
En attendant la mise à jour de la documentation (en cours), vous pouvez vous
reporter à la demo_ .
-.. _demo::jaxx-demo/index.html
-
.. TODO A faire car plus a jour...
Le projet JAXX ...
@@ -72,8 +151,8 @@
Pour plus de détail consulter la page `Migration`_.
-Nouvelles fonctionnalités
--------------------------
+Nouvelles fonctionnalités 2.0
+-----------------------------
* Core_
@@ -114,14 +193,16 @@
.. _Vradi: http://vradi.labs.libre-entreprise.org/vradi/index.html
-.. _Migration: migration.html
+.. _Migration: ./migration.html
-.. _Core: Core.html
+.. _Core: ./Core.html
-.. _I18n: I18n.html
+.. _demo: ./jaxx-demo/index.html
-.. _JAXXContext: JAXXContext.html
+.. _I18n: ./I18n.html
-.. _BeanValidator: BeanValidator.html
+.. _JAXXContext: ./JAXXContext.html
-.. _NavigationModel: NavigationModel.html
+.. _BeanValidator: ./BeanValidator.html
+
+.. _NavigationModel: ./NavigationModel.html
Modified: trunk/src/site/rst/old-compiler-doc/JAXXContext.rst
===================================================================
--- trunk/src/site/rst/old-compiler-doc/JAXXContext.rst 2010-06-14 15:18:39 UTC (rev 1969)
+++ trunk/src/site/rst/old-compiler-doc/JAXXContext.rst 2010-06-14 15:47:37 UTC (rev 1970)
@@ -112,7 +112,7 @@
restitution.
jaxx.runtime.context.JAXXInitialContext
-*******************************
+***************************************
On a implanté un second type de context qui lui peut servir à l'initialisation des JAXXObject.
1
0
14 Jun '10
Author: tchemit
Date: 2010-06-14 17:18:39 +0200 (Mon, 14 Jun 2010)
New Revision: 1969
Url: http://nuiton.org/repositories/revision/jaxx/1969
Log:
Evolution #685: Add import tag
Added:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ImportHandler.java
Added: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ImportHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ImportHandler.java (rev 0)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ImportHandler.java 2010-06-14 15:18:39 UTC (rev 1969)
@@ -0,0 +1,104 @@
+/*
+ * #%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.tags;
+
+import jaxx.compiler.JAXXCompiler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.StringReader;
+
+/**
+ * Handles the <code><import></code> tag.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @version $Id$
+ * @since 2.1
+ */
+public class ImportHandler implements TagHandler {
+
+ /** Logger */
+ protected static final Log log = LogFactory.getLog(ImportHandler.class);
+
+ public static final String TAG_NAME = "import";
+
+ @Override
+ public void compileFirstPass(Element tag,
+ JAXXCompiler compiler) throws IOException {
+
+ StringBuffer script = new StringBuffer();
+ NodeList children = tag.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ switch (child.getNodeType()) {
+ case Node.ELEMENT_NODE:
+ compiler.reportError(
+ "<import> tag may not contain child elements: " +
+ tag);
+ case Node.TEXT_NODE: // fall through
+ case Node.CDATA_SECTION_NODE:
+ String txt = ((Text) child).getData();
+ if (log.isDebugEnabled()) {
+ log.debug("Will treate imports :[\n" + txt + "\n]");
+ }
+ String eol = JAXXCompiler.getLineSeparator();
+ LineNumberReader reader = new LineNumberReader(new StringReader(txt.trim()));
+ try {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.isEmpty()) {
+ continue;
+ }
+ script.append("import ").append(line);
+ if (!line.endsWith(";")) {
+ script.append(';');
+ }
+ script.append(eol);
+ }
+ } finally {
+ reader.close();
+ }
+ }
+ }
+
+ String scriptString = script.toString().trim();
+ if (!scriptString.isEmpty()) {
+ compiler.registerScript(script.toString());
+ }
+ }
+
+ @Override
+ public void compileSecondPass(Element tag, JAXXCompiler compiler) {
+ // nothing to do
+ }
+}
\ No newline at end of file
Property changes on: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ImportHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
r1968 - in trunk/maven-jaxx-plugin/src/test: java/org/nuiton/jaxx/plugin resources/org/nuiton/jaxx/plugin/compilerTest resources/org/nuiton/jaxx/plugin/compilerTest/importTag
by tchemit@users.nuiton.org 14 Jun '10
by tchemit@users.nuiton.org 14 Jun '10
14 Jun '10
Author: tchemit
Date: 2010-06-14 17:17:01 +0200 (Mon, 14 Jun 2010)
New Revision: 1968
Url: http://nuiton.org/repositories/revision/jaxx/1968
Log:
Evolution #685: Add import tag
Added:
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/importTag/
trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/importTag/ImportTag.jaxx
Modified:
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2010-06-14 15:16:22 UTC (rev 1967)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2010-06-14 15:17:01 UTC (rev 1968)
@@ -29,12 +29,13 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.SystemStreamLog;
-import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
public class CompilerTest extends JaxxBaseTest {
@@ -210,7 +211,14 @@
assertNumberJaxxFiles(1);
}
+
@Test
+ public void ImportTag() throws Exception {
+ executeMojo();
+ assertNumberJaxxFiles(1);
+ }
+
+ @Test
public void ErrorJaxxContextImplementorClass() throws Exception {
GenerateMojo mojo = getMojo();
mojo.jaxxContextFQN = null;
Added: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml 2010-06-14 15:17:01 UTC (rev 1968)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.nuiton.jaxx.test</groupId>
+ <artifactId>test</artifactId>
+ <version>0</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-jaxx-plugin</artifactId>
+ <configuration>
+ <src>${basedir}/target/test-classes</src>
+ <outJava>${basedir}/target/generated-sources/test-java</outJava>
+ <force>true</force>
+ <includes>
+ <value>**/compilerTest/importTag/*.jaxx</value>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/importTag/ImportTag.jaxx
===================================================================
--- trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/importTag/ImportTag.jaxx (rev 0)
+++ trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/importTag/ImportTag.jaxx 2010-06-14 15:17:01 UTC (rev 1968)
@@ -0,0 +1,8 @@
+<JPanel>
+
+ <import>
+ java.io.File
+ </import>
+
+ <File id="file"/>
+</JPanel>
\ No newline at end of file
Property changes on: trunk/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/importTag/ImportTag.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
r1967 - in trunk/jaxx-compiler/src/main/java/jaxx/compiler: spi tags tags/swing types
by tchemit@users.nuiton.org 14 Jun '10
by tchemit@users.nuiton.org 14 Jun '10
14 Jun '10
Author: tchemit
Date: 2010-06-14 17:16:22 +0200 (Mon, 14 Jun 2010)
New Revision: 1967
Url: http://nuiton.org/repositories/revision/jaxx/1967
Log:
- Evolution #685: Add import tag
- improve tag handlers code (use constants, remove redundant initializers, ...)
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.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/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/types/ColorConverter.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java
trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -25,44 +25,13 @@
package jaxx.compiler.spi;
-import java.awt.Component;
-import javax.swing.JCheckBox;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JComboBox;
-import javax.swing.JDialog;
-import javax.swing.JEditorPane;
-import javax.swing.JFormattedTextField;
-import javax.swing.JFrame;
-import javax.swing.JInternalFrame;
-import javax.swing.JList;
-import javax.swing.JMenu;
-import javax.swing.JPasswordField;
-import javax.swing.JPopupMenu;
-import javax.swing.JProgressBar;
-import javax.swing.JRadioButton;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JScrollPane;
-import javax.swing.JSlider;
-import javax.swing.JSpinner;
-import javax.swing.JSplitPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.JTextPane;
-import javax.swing.JToggleButton;
-import javax.swing.JToolBar;
-import javax.swing.JTree;
-import javax.swing.JWindow;
-import javax.swing.text.JTextComponent;
-
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.beans.BeanInfoUtil;
-
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorHelper;
-
import jaxx.compiler.tags.DefaultComponentHandler;
import jaxx.compiler.tags.DefaultObjectHandler;
+import jaxx.compiler.tags.ImportHandler;
import jaxx.compiler.tags.ScriptHandler;
import jaxx.compiler.tags.StyleHandler;
import jaxx.compiler.tags.TagHandler;
@@ -98,8 +67,6 @@
import jaxx.compiler.tags.validator.BeanValidatorHandler;
import jaxx.compiler.tags.validator.ExcludeFieldValidatorHandler;
import jaxx.compiler.tags.validator.FieldValidatorHandler;
-
-
import jaxx.runtime.swing.Application;
import jaxx.runtime.swing.JAXXButtonGroup;
import jaxx.runtime.swing.JAXXComboBox;
@@ -111,7 +78,37 @@
import jaxx.runtime.swing.editor.LocaleEditor;
import jaxx.runtime.validator.swing.SwingValidator;
-/**
+import javax.swing.JCheckBox;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JFormattedTextField;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JPasswordField;
+import javax.swing.JPopupMenu;
+import javax.swing.JProgressBar;
+import javax.swing.JRadioButton;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JScrollPane;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.JSplitPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JTextPane;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.JTree;
+import javax.swing.JWindow;
+import javax.swing.text.JTextComponent;
+import java.awt.Component;
+
+/**
* Initializes support provided from JAXX (java, swing and validation).
*
* @plexus.component role-hint="default" role="jaxx.compiler.spi.Initializer"
@@ -124,28 +121,30 @@
BeanInfoUtil.addJaxxBeanInfoPath("jaxx.runtime.swing");
registerDefaultNamespace("javax.swing.*",
- JEditorPane.class,
- JFormattedTextField.class,
- JPasswordField.class,
- JTextArea.class,
- JTextField.class,
- JTextPane.class);
+ JEditorPane.class,
+ JFormattedTextField.class,
+ JPasswordField.class,
+ JTextArea.class,
+ JTextField.class,
+ JTextPane.class
+ );
//
// Register tags
//
- registerTag(JAXXCompiler.JAXX_NAMESPACE, "script", new ScriptHandler());
- registerTag(JAXXCompiler.JAXX_NAMESPACE, "style", new StyleHandler());
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, ScriptHandler.TAG_NAME, new ScriptHandler());
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, StyleHandler.TAG_NAME, new StyleHandler());
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, ImportHandler.TAG_NAME, new ImportHandler());
//TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing
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());
- registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler());
- registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler());
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, TabHandler.TAG_NAME, new TabHandler());
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, RowHandler.TAG_NAME, new RowHandler());
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, CellHandler.TAG_NAME, new CellHandler());
+ registerTag(JAXXCompiler.JAXX_NAMESPACE, ItemHandler.TAG_NAME, new ItemHandler());
registerTag(JAXXCompiler.JAXX_NAMESPACE, BeanValidatorHandler.TAG, new BeanValidatorHandler(ClassDescriptorHelper.getClassDescriptor(SwingValidator.class)));
@@ -213,7 +212,7 @@
Class<? extends TagHandler> handlerClass) {
ClassDescriptor classDescriptor =
ClassDescriptorHelper.getClassDescriptor(beanClass);
-
+
TagManager.registerBean(classDescriptor, handlerClass);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -45,6 +45,8 @@
*/
public class ScriptHandler implements TagHandler {
+ public static final String TAG_NAME = "script";
+
public static final String SOURCE_ATTRIBUTE = "source";
@Override
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -26,8 +26,8 @@
package jaxx.compiler.tags;
import jaxx.compiler.CompilerException;
+import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.UnsupportedAttributeException;
-import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.css.StylesheetHelper;
import jaxx.runtime.css.Stylesheet;
import org.w3c.dom.Attr;
@@ -39,7 +39,6 @@
import java.io.File;
import java.io.IOException;
-import java.io.StringWriter;
/**
* Handles the <code><style></code> tag.
@@ -47,6 +46,9 @@
* @author Ethan Nicholas
*/
public class StyleHandler implements TagHandler {
+
+ public static final String TAG_NAME = "style";
+
public static final String SOURCE_ATTRIBUTE = "source";
@Override
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -37,7 +37,10 @@
import javax.swing.WindowConstants;
public class ApplicationHandler extends JWindowHandler {
+ public static final String ATTRIBUTE_LOOK_AND_FEEL = "lookAndFeel";
+ public static final String ATTRIBUTE_DEFAULT_CLOSE_OPERATION = "defaultCloseOperation";
+
public ApplicationHandler(ClassDescriptor beanClass) {
super(beanClass);
ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, Application.class);
@@ -45,7 +48,7 @@
@Override
public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) throws CompilerException {
- if (propertyName.equals("lookAndFeel") && stringValue != null && !stringValue.trim().startsWith("{")) {
+ if (propertyName.equals(ATTRIBUTE_LOOK_AND_FEEL) && stringValue != null && !stringValue.trim().startsWith("{")) {
compiler.appendBodyCode("{ " + object.getJavaCode() + ".setLookAndFeel(" + TypeManager.getJavaCode(stringValue) + "); }" + JAXXCompiler.getLineSeparator());
} else {
super.setAttribute(object, propertyName, stringValue, inline, compiler);
@@ -55,6 +58,6 @@
@Override
protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException {
super.setDefaults(object, tag, compiler);
- setAttribute(object, "defaultCloseOperation", String.valueOf(WindowConstants.EXIT_ON_CLOSE), false, compiler);
+ setAttribute(object, ATTRIBUTE_DEFAULT_CLOSE_OPERATION, String.valueOf(WindowConstants.EXIT_ON_CLOSE), false, compiler);
}
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -26,8 +26,8 @@
package jaxx.compiler.tags.swing;
import jaxx.compiler.CompilerException;
+import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.UnsupportedAttributeException;
-import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.tags.TagHandler;
import jaxx.compiler.types.TypeManager;
import org.w3c.dom.Attr;
@@ -43,6 +43,61 @@
public class CellHandler implements TagHandler {
+ public static final String TAG_NAME = "cell";
+
+ public static final String ATTRIBUTE_INSETS = "insets";
+
+ public static final String ATTRIBUTE_WEIGHTX = "weightx";
+
+ public static final String ATTRIBUTE_WEIGHTY = "weighty";
+
+ public static final String ATTRIBUTE_COLUMNS = "columns";
+
+ public static final String ATTRIBUTE_ROWS = "rows";
+
+ public static final String ATTRIBUTE_FILL = "fill";
+
+ enum Fill {
+ none(GridBagConstraints.NONE),
+ horizontal(GridBagConstraints.HORIZONTAL),
+ vertical(GridBagConstraints.VERTICAL),
+ both(GridBagConstraints.BOTH);
+
+ private final int intValue;
+
+ Fill(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+ }
+
+ public static final String ATTRIBUTE_ANCHOR = "anchor";
+
+ enum Anchor {
+ north(GridBagConstraints.NORTH),
+ northeast(GridBagConstraints.NORTHEAST),
+ east(GridBagConstraints.EAST),
+ southeast(GridBagConstraints.SOUTHEAST),
+ south(GridBagConstraints.SOUTH),
+ southwest(GridBagConstraints.SOUTHEAST),
+ west(GridBagConstraints.WEST),
+ northwest(GridBagConstraints.NORTHWEST),
+ center(GridBagConstraints.CENTER);
+
+ private final int intValue;
+
+ Anchor(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+ }
+
@Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
compileChildrenFirstPass(tag, compiler);
@@ -65,51 +120,49 @@
public static void setAttribute(GridBagConstraints c, String name, String value) throws CompilerException {
value = value.trim();
- if (name.equals("insets")) {
+ if (name.equals(ATTRIBUTE_INSETS)) {
c.insets = (Insets) TypeManager.convertFromString(value, Insets.class);
- } else if (name.equals("weightx")) {
+ } else if (name.equals(ATTRIBUTE_WEIGHTX)) {
c.weightx = Double.parseDouble(value);
- } else if (name.equals("weighty")) {
+ } else if (name.equals(ATTRIBUTE_WEIGHTY)) {
c.weighty = Double.parseDouble(value);
- } else if (name.equals("columns")) {
+ } else if (name.equals(ATTRIBUTE_COLUMNS)) {
c.gridwidth = Integer.parseInt(value);
- } else if (name.equals("rows")) {
+ } else if (name.equals(ATTRIBUTE_ROWS)) {
c.gridheight = Integer.parseInt(value);
- } else if (name.equals("fill")) {
- if (value.equals("none")) {
- c.fill = GridBagConstraints.NONE;
- } else if (value.equals("horizontal")) {
- c.fill = GridBagConstraints.HORIZONTAL;
- } else if (value.equals("vertical")) {
- c.fill = GridBagConstraints.VERTICAL;
- } else if (value.equals("both")) {
- c.fill = GridBagConstraints.BOTH;
- } else {
- throw new IllegalArgumentException("invalid value for fill attribute: '" + value + "'");
+ } else if (name.equals(ATTRIBUTE_FILL)) {
+ Fill fill = Fill.valueOf(value);
+ if (fill == null) {
+ throw new CompilerException("invalid value for fill attribute: '" + value + "'");
}
- } else if (name.equals("anchor")) {
- //todo use a converter
- if (value.equals("north")) {
- c.anchor = GridBagConstraints.NORTH;
- } else if (value.equals("northeast")) {
- c.anchor = GridBagConstraints.NORTHEAST;
- } else if (value.equals("east")) {
- c.anchor = GridBagConstraints.EAST;
- } else if (value.equals("southeast")) {
- c.anchor = GridBagConstraints.SOUTHEAST;
- } else if (value.equals("south")) {
- c.anchor = GridBagConstraints.SOUTH;
- } else if (value.equals("southwest")) {
- c.anchor = GridBagConstraints.SOUTHWEST;
- } else if (value.equals("west")) {
- c.anchor = GridBagConstraints.WEST;
- } else if (value.equals("northwest")) {
- c.anchor = GridBagConstraints.NORTHWEST;
- } else if (value.equals("center")) {
- c.anchor = GridBagConstraints.CENTER;
- } else {
- throw new IllegalArgumentException("invalid value for anchor attribute: '" + value + "'");
+ c.fill = fill.getIntValue();
+ } else if (name.equals(ATTRIBUTE_ANCHOR)) {
+ Anchor anchor = Anchor.valueOf(value);
+ if (anchor == null) {
+ throw new CompilerException("invalid value for anchor attribute: '" + value + "'");
}
+ c.anchor = anchor.getIntValue();
+// if (value.equals(ANCHOR_VALUE_NORTH)) {
+// c.anchor = GridBagConstraints.NORTH;
+// } else if (value.equals(ANCHOR_VALUE_NORTHEAST)) {
+// c.anchor = GridBagConstraints.NORTHEAST;
+// } else if (value.equals(ANCHOR_VALUE_EAST)) {
+// c.anchor = GridBagConstraints.EAST;
+// } else if (value.equals(ANCHOR_VALUE_SOUTHEAST)) {
+// c.anchor = GridBagConstraints.SOUTHEAST;
+// } else if (value.equals(ANCHOR_VALUE_SOUTH)) {
+// c.anchor = GridBagConstraints.SOUTH;
+// } else if (value.equals(ANCHOR_VALUE_SOUTHWEST)) {
+// c.anchor = GridBagConstraints.SOUTHWEST;
+// } else if (value.equals(ANCHOR_VALUE_WEST)) {
+// c.anchor = GridBagConstraints.WEST;
+// } else if (value.equals(ANCHOR_VALUE_NORTHWEST)) {
+// c.anchor = GridBagConstraints.NORTHWEST;
+// } else if (value.equals(ANCHOR_VALUE_CENTER)) {
+// c.anchor = GridBagConstraints.CENTER;
+// } else {
+// throw new IllegalArgumentException("invalid value for anchor attribute: '" + value + "'");
+// }
} else {
throw new UnsupportedAttributeException(name);
}
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -56,7 +56,7 @@
}
public void closeItem(Item item) {
- if (openNodes.pop() != item) {
+ if (!item.equals(openNodes.pop())) {
throw new IllegalArgumentException(item + " was not at the top of the item stack");
}
}
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -44,8 +44,12 @@
public class ItemHandler implements TagHandler {
+ public static final String TAG_NAME = "item";
+
private String DATA_BINDING = "<data binding has not been processed yet>";
+ public static final String ATTRIBUTE_ID = "id";
+
@Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
compileChildrenFirstPass(tag, compiler);
@@ -53,7 +57,7 @@
@Override
public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
- String id = tag.getAttribute("id");
+ String id = tag.getAttribute(ATTRIBUTE_ID);
if (id == null || id.length() == 0) {
id = compiler.getAutoId(Item.class.getSimpleName());
// id = compiler.getAutoId(ClassDescriptorHelper.getClassDescriptor(Item.class));
@@ -67,7 +71,7 @@
Attr attribute = (Attr) children.item(i);
String name = attribute.getName();
String attrValue = attribute.getValue();
- if (name.equals("id")) {
+ if (name.equals(ATTRIBUTE_ID)) {
// already handled
continue;
}
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -38,6 +38,7 @@
import javax.swing.event.ChangeListener;
public class JSliderHandler extends DefaultComponentHandler {
+ public static final String ATTRIBUTE_VALUE = "value";
public JSliderHandler(ClassDescriptor beanClass) {
super(beanClass);
@@ -48,7 +49,7 @@
@Override
protected int getAttributeOrdering(Attr attr) {
- if (attr.getName().equals("value")) {
+ if (attr.getName().equals(ATTRIBUTE_VALUE)) {
return 1;
} else {
return super.getAttributeOrdering(attr);
@@ -58,7 +59,7 @@
@Override
protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException {
super.setDefaults(object, tag, compiler);
- setAttribute(object, "value", "0", false, compiler);
+ setAttribute(object, ATTRIBUTE_VALUE, "0", false, compiler);
}
@Override
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -49,9 +49,9 @@
public static class CompiledSpinner extends CompiledObject {
- Integer minimum = null;
- Integer maximum = null;
- Integer value = null;
+ Integer minimum;
+ Integer maximum;
+ Integer value;
public CompiledSpinner(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException {
super(id, objectClass, compiler);
@@ -99,7 +99,7 @@
compiler.reportError("constructorParams and minimum/maximum may not both be specified for the same JSpinner");
}
if (spinner.minimum == null) {
- spinner.minimum = Math.min(0, spinner.maximum != null ? spinner.maximum.intValue() : 0);
+ spinner.minimum = Math.min(0, spinner.maximum != null ? spinner.maximum : 0);
}
if (spinner.maximum == null) {
spinner.maximum = Math.max(100, spinner.minimum.intValue());
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -25,27 +25,35 @@
package jaxx.compiler.tags.swing;
+import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompilerException;
-import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
-import org.w3c.dom.Element;
import javax.swing.JSplitPane;
-import java.awt.Component;
public class JSplitPaneHandler extends DefaultComponentHandler {
+ public static final String ATTRIBUTE_ORIENTATION = "orientation";
+
+ public static final String ORIENTATION_VALUE_HORIZONTAL = "horizontal";
+
+ public static final String ORIENTATION_VALUE_VERTICAL = "vertical";
+
+ public static final String ORIENTATION_VALUE_VERTICAL_SPLIT = "vertical_split";
+
+ public static final String ORIENTATION_VALUE_HORIZONTAL_SPLIT = "horizontal_split";
+
public JSplitPaneHandler(ClassDescriptor beanClass) {
super(beanClass);
ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JSplitPane.class);
}
- protected Component createRawComponent(Element tag) {
- return new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
- }
+// protected Component createRawComponent(Element tag) {
+// return new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+// }
/**
* Add support for <code>orientation="vertical"</code> and <code>orientation="horizontal"</code>. The
@@ -54,12 +62,12 @@
*/
@Override
protected int constantValue(String key, String value) {
- if (key.equals("orientation")) {
+ if (key.equals(ATTRIBUTE_ORIENTATION)) {
value = value.trim().toLowerCase();
- if (value.equals("horizontal") || value.equals("horizontal_split")) {
+ if (value.equals(ORIENTATION_VALUE_HORIZONTAL) || value.equals(ORIENTATION_VALUE_HORIZONTAL_SPLIT)) {
return JSplitPane.HORIZONTAL_SPLIT;
}
- if (value.equals("vertical") || value.equals("vertical_split")) {
+ if (value.equals(ORIENTATION_VALUE_VERTICAL) || value.equals(ORIENTATION_VALUE_VERTICAL_SPLIT)) {
return JSplitPane.VERTICAL_SPLIT;
}
throw new IllegalArgumentException("orientation must be 'horizontal' or 'vertical', found '" + value + "'");
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -25,8 +25,8 @@
package jaxx.compiler.tags.swing;
+import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompilerException;
-import jaxx.compiler.CompiledObject;
import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
@@ -43,6 +43,10 @@
public class JTabbedPaneHandler extends DefaultComponentHandler {
+ public static final String ATTRIBUTE_TITLE = "title";
+
+ public static final String ATTRIBUTE_TOOL_TIP_TEXT = "toolTipText";
+
public JTabbedPaneHandler(ClassDescriptor beanClass) {
super(beanClass);
ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JTabbedPane.class);
@@ -51,9 +55,12 @@
public static class CompiledTabbedPane extends CompiledObject {
private static final TabInfo USED = new TabInfo("ALREADY USED");
+
int tabCount;
+
TabInfo tabInfo;
+
public CompiledTabbedPane(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException {
super(id, objectClass, compiler);
}
@@ -69,7 +76,7 @@
if (tabInfo == null) {
compiler.reportError("JTabbedPaneHandler may only have 'tab' tags as children (found " + child.getObjectClass() + ")");
return;
- } else if (tabInfo == USED) {
+ } else if (USED.equals(tabInfo)) {
compiler.reportError("<tab> tags may only have one child component");
return;
}
@@ -79,10 +86,10 @@
String title = tabInfo.getTitle();
if (title != null) {
- if (I18nHelper.isI18nAttribute("title")) {
+ if (I18nHelper.isI18nAttribute(ATTRIBUTE_TITLE)) {
if (!title.startsWith("_(\"")) {
// we did not have the invocation code, add it
- title = I18nHelper.addI18nInvocation(getId(), "title", TypeManager.getJavaCode(title), compiler);
+ title = I18nHelper.addI18nInvocation(getId(), ATTRIBUTE_TITLE, TypeManager.getJavaCode(title), compiler);
}
} else {
title = TypeManager.getJavaCode(title);
@@ -92,10 +99,10 @@
String toolTipText = tabInfo.getToolTipText();
if (toolTipText != null) {
- if (I18nHelper.isI18nAttribute("toolTipText")) {
+ if (I18nHelper.isI18nAttribute(ATTRIBUTE_TOOL_TIP_TEXT)) {
if (!toolTipText.startsWith("_(\"")) {
// we did not have the invocation code, add it
- toolTipText = I18nHelper.addI18nInvocation(getId(), "toolTipText", TypeManager.getJavaCode(toolTipText), compiler);
+ toolTipText = I18nHelper.addI18nInvocation(getId(), ATTRIBUTE_TOOL_TIP_TEXT, TypeManager.getJavaCode(toolTipText), compiler);
}
} else {
toolTipText = TypeManager.getJavaCode(toolTipText);
@@ -138,7 +145,7 @@
appendAdditionCode(getId() + ".setDisabledIconAt(" + tabIndex + ", " + disabledIcon + ");");
}
- String tabComponent= tabInfo.getTabComponentStr();
+ String tabComponent = tabInfo.getTabComponentStr();
if (tabComponent != null) {
appendAdditionCode(getId() + ".setTabComponentAt(" + tabIndex + ", " + tabComponent + ");");
}
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -25,8 +25,8 @@
package jaxx.compiler.tags.swing;
+import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompilerException;
-import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorHelper;
@@ -43,6 +43,14 @@
private static final int DEFAULT_COLUMNS = 15;
+ public static final String ATTRIBUTE_LINE_WRAP = "lineWrap";
+
+ public static final String ATTRIBUTE_WRAP_STYLE_WORD = "wrapStyleWord";
+
+ public static final String ATTRIBUTE_COLUMNS = "columns";
+
+ public static final String ATTRIBUTE_TEXT = "text";
+
public JTextComponentHandler(ClassDescriptor beanClass) {
super(beanClass);
ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JTextComponent.class);
@@ -53,20 +61,20 @@
super.setDefaults(object, tag, compiler);
try {
object.getObjectClass().getMethodDescriptor("setColumns", ClassDescriptorHelper.getClassDescriptor(int.class));
- setAttribute(object, "columns", String.valueOf(DEFAULT_COLUMNS), false, compiler);
+ setAttribute(object, ATTRIBUTE_COLUMNS, String.valueOf(DEFAULT_COLUMNS), false, compiler);
} catch (NoSuchMethodException e) {
// ignore ?
}
if (ClassDescriptorHelper.getClassDescriptor(JTextArea.class).isAssignableFrom(object.getObjectClass())) {
- setAttribute(object, "lineWrap", "true", false, compiler);
- setAttribute(object, "wrapStyleWord", "true", false, compiler);
+ setAttribute(object, ATTRIBUTE_LINE_WRAP, "true", false, compiler);
+ setAttribute(object, ATTRIBUTE_WRAP_STYLE_WORD, "true", false, compiler);
}
}
@Override
public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException {
- if (name.equals("text")) {
+ if (name.equals(ATTRIBUTE_TEXT)) {
return SwingUtil.class.getName() + ".setText(" + id + ", " + valueCode + ");\n";
//return "jaxx.runtime.swing.Utils.setText(" + id + ", " + valueCode + ");\n";
}
@@ -77,7 +85,7 @@
protected int getAttributeOrdering(Attr attr) {
// delay text in case other attributes affect how it's processed, as is the case
// with JEditorPane's contentType
- if (attr.getName().equals("text")) {
+ if (attr.getName().equals(ATTRIBUTE_TEXT)) {
return 1;
}
return super.getAttributeOrdering(attr);
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -25,6 +25,7 @@
package jaxx.compiler.tags.swing;
+import jaxx.compiler.CompilerException;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorHelper;
import jaxx.compiler.tags.DefaultComponentHandler;
@@ -32,7 +33,24 @@
import javax.swing.JToolBar;
public class JToolBarHandler extends DefaultComponentHandler {
+ public static final String ATTRIBUTE_ORIENTATION = "orientation";
+
+ enum Orientation {
+ horizontal(JToolBar.HORIZONTAL),
+ vertical(JToolBar.VERTICAL);
+
+ private final int intValue;
+
+ Orientation(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+ }
+
public JToolBarHandler(ClassDescriptor beanClass) {
super(beanClass);
ClassDescriptorHelper.checkSupportClass(getClass(), beanClass, JToolBar.class);
@@ -45,15 +63,13 @@
*/
@Override
protected int constantValue(String key, String value) {
- if (key.equals("orientation")) {
+ if (key.equals(ATTRIBUTE_ORIENTATION)) {
value = value.trim().toLowerCase();
- if (value.equals("horizontal")) {
- return JToolBar.HORIZONTAL;
+ Orientation fill = Orientation.valueOf(value);
+ if (fill == null) {
+ throw new CompilerException("invalid value for orientation attribute: '" + value + "'");
}
- if (value.equals("vertical")) {
- return JToolBar.VERTICAL;
- }
- throw new IllegalArgumentException("orientation must be 'horizontal' or 'vertical', found '" + value + "'");
+ return fill.getIntValue();
}
return super.constantValue(key, value);
}
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -40,6 +40,8 @@
public class RowHandler implements TagHandler {
+ public static final String TAG_NAME = "row";
+
@Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
compileChildrenFirstPass(tag, compiler);
@@ -66,7 +68,7 @@
int nodeType = node.getNodeType();
if (nodeType == Node.ELEMENT_NODE) {
Element child = (Element) node;
- if (!child.getLocalName().equals("cell")) {
+ if (!child.getLocalName().equals(CellHandler.TAG_NAME)) {
compiler.reportError("tag '" + tag.getLocalName() + "' may only contain cell tags as children");
}
compileChildTagFirstPass(child, compiler);
@@ -86,7 +88,7 @@
int nodeType = node.getNodeType();
if (nodeType == Node.ELEMENT_NODE) {
Element child = (Element) node;
- if (!child.getLocalName().equals("cell")) {
+ if (!child.getLocalName().equals(CellHandler.TAG_NAME)) {
compiler.reportError("tag '" + tag.getLocalName() + "' may only contain cell tags as children");
}
compileChildTagSecondPass(child, compiler);
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -25,8 +25,8 @@
package jaxx.compiler.tags.swing;
+import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompilerException;
-import jaxx.compiler.CompiledObject;
import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.binding.DataBindingHelper;
@@ -49,6 +49,30 @@
public class TabHandler implements TagHandler {
+ public static final String TAG_NAME = "tab";
+
+ public static final String ATTRIBUTE_ID = "id";
+
+ public static final String ATTRIBUTE_TITLE = "title";
+
+ public static final String ATTRIBUTE_TOOL_TIP_TEXT = "toolTipText";
+
+ public static final String ATTRIBUTE_ICON = "icon";
+
+ public static final String ATTRIBUTE_ENABLED = "enabled";
+
+ public static final String ATTRIBUTE_DISABLED_ICON = "disabledIcon";
+
+ public static final String ATTRIBUTE_MNEMONIC = "mnemonic";
+
+ public static final String ATTRIBUTE_DISPLAYED_MNEMONIC_INDEX = "displayedMnemonicIndex";
+
+ public static final String ATTRIBUTE_FOREGROUND = "foreground";
+
+ public static final String ATTRIBUTE_BACKGROUND = "background";
+
+ public static final String ATTRIBUTE_TAB_COMPONENT = "tabComponent";
+
@Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
compileChildrenFirstPass(tag, compiler);
@@ -63,7 +87,7 @@
JTabbedPaneHandler.CompiledTabbedPane tabs = (JTabbedPaneHandler.CompiledTabbedPane) compiler.getOpenComponent();
- String id = tag.getAttribute("id");
+ String id = tag.getAttribute(ATTRIBUTE_ID);
if (id == null || id.length() == 0) {
id = compiler.getAutoId(TabInfo.class.getSimpleName());
// id = compiler.getAutoId(ClassDescriptorHelper.getClassDescriptor(TabInfo.class));
@@ -95,45 +119,45 @@
if (I18nHelper.isI18nableAttribute(name, compiler)) {
value = valueCode = I18nHelper.addI18nInvocation(id, name, valueCode, compiler);
}
- if (name.equals("id")) {
+ if (name.equals(ATTRIBUTE_ID)) {
// ignore, already handled
- } else if (name.equals("title")) {
+ } else if (name.equals(ATTRIBUTE_TITLE)) {
tabInfo.setTitle(value);
compiledTabInfo.appendInitializationCode(id + ".setTitle(" + valueCode + ");");
//compiledTabInfo.appendInitializationCode(id + ".setTitle(" + TypeManager.getJavaCode(value) + ");");
- } else if (name.equals("toolTipText")) {
+ } else if (name.equals(ATTRIBUTE_TOOL_TIP_TEXT)) {
tabInfo.setToolTipText(value);
compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + valueCode + ");");
//compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + TypeManager.getJavaCode(value) + ");");
- } else if (name.equals("icon")) {
+ } else if (name.equals(ATTRIBUTE_ICON)) {
Icon icon = (Icon) TypeManager.convertFromString(value, Icon.class);
tabInfo.setIcon(icon);
compiledTabInfo.appendInitializationCode(id + ".setIcon(" + TypeManager.getJavaCode(icon) + ");");
- } else if (name.equals("enabled")) {
+ } else if (name.equals(ATTRIBUTE_ENABLED)) {
boolean enabled = (Boolean) TypeManager.convertFromString(value, Boolean.class);
tabInfo.setEnabled(enabled);
compiledTabInfo.appendInitializationCode(id + ".setEnabled(" + enabled + ");");
- } else if (name.equals("disabledIcon")) {
+ } else if (name.equals(ATTRIBUTE_DISABLED_ICON)) {
Icon disabledIcon = (Icon) TypeManager.convertFromString(value, Icon.class);
tabInfo.setDisabledIcon(disabledIcon);
compiledTabInfo.appendInitializationCode(id + ".setDisabledIcon(" + TypeManager.getJavaCode(disabledIcon) + ");");
- } else if (name.equals("mnemonic")) {
+ } else if (name.equals(ATTRIBUTE_MNEMONIC)) {
int mnemonic = (Character) TypeManager.convertFromString(value, char.class);
tabInfo.setMnemonic(mnemonic);
compiledTabInfo.appendInitializationCode(id + ".setMnemonic(" + mnemonic + ");");
- } else if (name.equals("displayedMnemonicIndex")) {
+ } else if (name.equals(ATTRIBUTE_DISPLAYED_MNEMONIC_INDEX)) {
int displayedMnemonicIndex = (Integer) TypeManager.convertFromString(value, int.class);
tabInfo.setDisplayedMnemonicIndex(displayedMnemonicIndex);
compiledTabInfo.appendInitializationCode(id + ".setDisplayedMnemonicIndex(" + displayedMnemonicIndex + ");");
- } else if (name.equals("foreground")) {
+ } else if (name.equals(ATTRIBUTE_FOREGROUND)) {
Color foreground = (Color) TypeManager.convertFromString(value, Color.class);
tabInfo.setForeground(foreground);
compiledTabInfo.appendInitializationCode(id + ".setForeground(" + TypeManager.getJavaCode(foreground) + ");");
- } else if (name.equals("background")) {
+ } else if (name.equals(ATTRIBUTE_BACKGROUND)) {
Color background = (Color) TypeManager.convertFromString(value, Color.class);
tabInfo.setBackground(background);
compiledTabInfo.appendInitializationCode(id + ".setBackground(" + TypeManager.getJavaCode(background) + ");");
- } else if (name.equals("tabComponent")) {
+ } else if (name.equals(ATTRIBUTE_TAB_COMPONENT)) {
tabInfo.setTabComponentStr(TypeManager.getJavaCode(value));
compiledTabInfo.appendInitializationCode(id + ".setTabComponent(" + TypeManager.getJavaCode(value) + ");");
} else {
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-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -66,8 +66,8 @@
private List<Integer> rowSpans = new ArrayList<Integer>();
private GridBagConstraints tableConstraints;
- private GridBagConstraints rowConstraints = null;
- private GridBagConstraints cellConstraints = null;
+ private GridBagConstraints rowConstraints;
+ private GridBagConstraints cellConstraints;
private boolean emptyCell;
public CompiledTable(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException {
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -45,7 +45,7 @@
@Override
public Object convertFromString(String string, Class<?> type) {
- if (type != Color.class) {
+ if (!Color.class.equals(type)) {
throw new IllegalArgumentException("unsupported type: " + type);
}
if (string.length() == 7 && string.charAt(0) == '#') {
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -43,7 +43,7 @@
@Override
public Object convertFromString(String string, Class<?> type) {
- if (type != Insets.class) {
+ if (!Insets.class.equals(type)) {
throw new IllegalArgumentException("unsupported type: " + type);
}
StringTokenizer tokenizer = new StringTokenizer(string, ",");
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -41,7 +41,7 @@
@Override
public Object convertFromString(String string, Class<?> type) {
- if (type != KeyStroke.class) {
+ if (!KeyStroke.class.equals(type)) {
throw new IllegalArgumentException("unsupported type: " + type);
}
return KeyStroke.getKeyStroke(string);
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java 2010-06-14 12:07:18 UTC (rev 1966)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java 2010-06-14 15:16:22 UTC (rev 1967)
@@ -84,13 +84,13 @@
@Override
public Object convertFromString(String string, Class<?> type) {
- if (type == String.class || type == Object.class || type == null) {
+ if (String.class.equals(type) || Object.class.equals(type) || type == null) {
return string;
}
- if (type == int.class || type == Integer.class) {
+ if (int.class.equals(type) || Integer.class.equals(type)) {
return Integer.valueOf(string);
}
- if (type == boolean.class || type == Boolean.class) {
+ if (boolean.class.equals(type) || Boolean.class.equals(type)) {
if (string.toLowerCase().equals("true")) {
return Boolean.TRUE;
}
@@ -99,22 +99,22 @@
}
throw new IllegalArgumentException("expected 'true' or 'false', found '" + string + "'");
}
- if (type == byte.class || type == Byte.class) {
+ if (byte.class.equals(type) || Byte.class.equals(type)) {
return Byte.valueOf(string);
}
- if (type == short.class || type == Short.class) {
+ if (short.class.equals(type) || Short.class.equals(type)) {
return Short.valueOf(string);
}
- if (type == long.class || type == Long.class) {
+ if (long.class.equals(type) || Long.class.equals(type)) {
return Long.valueOf(string);
}
- if (type == float.class || type == Float.class) {
+ if (float.class.equals(type) || Float.class.equals(type)) {
return Float.valueOf(string);
}
- if (type == double.class || type == Double.class) {
+ if (double.class.equals(type) || Double.class.equals(type)) {
return Double.valueOf(string);
}
- if (type == char.class || type == Character.class) {
+ if (char.class.equals(type) || Character.class.equals(type)) {
if (string.length() == 1) {
return string.charAt(0);
}
1
0
r1966 - in trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard: . ext
by tchemit@users.nuiton.org 14 Jun '10
by tchemit@users.nuiton.org 14 Jun '10
14 Jun '10
Author: tchemit
Date: 2010-06-14 14:07:18 +0200 (Mon, 14 Jun 2010)
New Revision: 1966
Url: http://nuiton.org/repositories/revision/jaxx/1966
Log:
share busy state for all models
introduce a busy state listener to update cursor of container
Added:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java
Modified:
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java
trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/ext/WizardExtModel.java
Added: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java (rev 0)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java 2010-06-14 12:07:18 UTC (rev 1966)
@@ -0,0 +1,72 @@
+package jaxx.runtime.swing.wizard;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.Component;
+import java.awt.Cursor;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * To listen the busy state of a {@link WizardModel}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+public class BusyChangeListener implements PropertyChangeListener {
+
+ /** Logger */
+ private static final Log log = LogFactory.getLog(BusyChangeListener.class);
+
+ protected Cursor busyCursor;
+
+ protected Cursor defaultCursor;
+
+ protected final Component ui;
+
+ public BusyChangeListener(Component ui) {
+ this.ui = ui;
+ }
+
+ public Component getUi() {
+ return ui;
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Boolean value = (Boolean) evt.getNewValue();
+ if (log.isDebugEnabled()) {
+ log.debug("busy state changed to " + value);
+ }
+ if (value != null && value) {
+ setBusy(ui, getBusyCursor());
+
+
+ } else {
+ setUnBusy(ui, getDefaultCursor());
+ }
+ }
+
+ protected void setBusy(Component ui, Cursor busyCursor) {
+ ui.setCursor(busyCursor);
+ }
+
+ protected void setUnBusy(Component ui, Cursor unbusyCursor) {
+ ui.setCursor(unbusyCursor);
+ }
+
+ protected Cursor getBusyCursor() {
+ if (busyCursor == null) {
+ busyCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
+ }
+ return busyCursor;
+ }
+
+ protected Cursor getDefaultCursor() {
+ if (defaultCursor == null) {
+ defaultCursor = Cursor.getDefaultCursor();
+ }
+ return defaultCursor;
+ }
+}
Property changes on: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java 2010-06-12 14:22:33 UTC (rev 1965)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java 2010-06-14 12:07:18 UTC (rev 1966)
@@ -57,6 +57,8 @@
public static final String VALID_STEP_PROPERTY_NAME = "validStep";
+ public static final String BUSY_PROPERTY_NAME = "busy";
+
/** le type d'une etape du model (doit etre une enumeration) */
protected final Class<E> stepClass;
@@ -72,6 +74,9 @@
/** drapeau pour valider l'état de l'étape courante */
protected boolean validStep;
+ /** un drapeau pour savoir si le modèle est occupé. */
+ private boolean busy;
+
/**
* drapeau lorsque le modele effectue des operations de transformation de
* modele mais que les écouteurs ne devraient pas tenir compte des
@@ -193,6 +198,16 @@
return valueAdjusting;
}
+ public boolean isBusy() {
+ return busy;
+ }
+
+ public void setBusy(boolean busy) {
+ boolean oldValue = this.busy;
+ this.busy = busy;
+ firePropertyChange(BUSY_PROPERTY_NAME, oldValue, busy);
+ }
+
/**
* Change l'univers des etapes.
* <p/>
Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/ext/WizardExtModel.java
===================================================================
--- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/ext/WizardExtModel.java 2010-06-12 14:22:33 UTC (rev 1965)
+++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/ext/WizardExtModel.java 2010-06-14 12:07:18 UTC (rev 1966)
@@ -49,8 +49,6 @@
/** Logger */
private static final Log log = LogFactory.getLog(WizardExtModel.class);
- public static final String BUSY_PROPERTY_NAME = "busy";
-
public static final String OPERATIONS_PROPERTY_NAME = "operations";
public static final String STEP_STATE_PROPERTY_NAME = "stepState";
@@ -74,9 +72,6 @@
/** un drapeau pour savoir siune opération a été lancée */
protected boolean wasStarted;
- /** un drapeau pour savoir si le modèle est occupé. */
- protected boolean busy;
-
@SuppressWarnings("unchecked")
public <T extends Enum<T>> WizardExtModel(Class<E> stepClass, E... steps) {
super(stepClass, steps);
@@ -98,16 +93,6 @@
return wasStarted;
}
- public boolean isBusy() {
- return busy;
- }
-
- public void setBusy(boolean busy) {
- boolean oldValue = this.busy;
- this.busy = busy;
- firePropertyChange(BUSY_PROPERTY_NAME, oldValue, busy);
- }
-
public boolean containsOperation(E step) {
return getOperations().contains(step);
}
1
0