Buix-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1440 discussions
Author: tchemit
Date: 2008-08-11 10:04:09 +0000 (Mon, 11 Aug 2008)
New Revision: 832
Modified:
trunk/lutinjaxx/pom.xml
Log:
passage en version 0.4 (version stable int?\195?\169grant les derni?\195?\168re corrections sur le processor d'annotation) : resources en UTF-8
Modified: trunk/lutinjaxx/pom.xml
===================================================================
--- trunk/lutinjaxx/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
+++ trunk/lutinjaxx/pom.xml 2008-08-11 10:04:09 UTC (rev 832)
@@ -65,7 +65,7 @@
<properties>
<!-- current version -->
- <current.version>0.3</current.version>
+ <current.version>0.4</current.version>
<!-- id du projet du labs -->
<labs.id>38</labs.id>
@@ -77,7 +77,7 @@
<!-- compile with ? -->
<maven.compile.source>1.6</maven.compile.source>
<maven.compile.target>1.6</maven.compile.target>
- <maven.compile.compile>UTF-8</maven.compile.compile>
+ <maven.compile.encoding>UTF-8</maven.compile.encoding>
<!-- Lists URL -->
<labs.lists>
@@ -131,7 +131,25 @@
<build>
<plugins>
+
<plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${maven.compile.source}</source>
+ <target>${maven.compile.target}</target>
+ <encoding>${maven.compile.encoding}</encoding>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <encoding>${maven.compile.encoding}</encoding>
+ </configuration>
+ </plugin>
+
+ <plugin>
<groupId>lutinplugin</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<configuration>
1
0
r831 - in trunk/lutinjaxx: . core jaxx-swing jaxx-swing-action jaxx-swing-tab maven runtime util
by tchemit@users.labs.libre-entreprise.org 11 Aug '08
by tchemit@users.labs.libre-entreprise.org 11 Aug '08
11 Aug '08
Author: tchemit
Date: 2008-08-11 09:52:40 +0000 (Mon, 11 Aug 2008)
New Revision: 831
Modified:
trunk/lutinjaxx/core/pom.xml
trunk/lutinjaxx/jaxx-swing-action/pom.xml
trunk/lutinjaxx/jaxx-swing-tab/pom.xml
trunk/lutinjaxx/jaxx-swing/pom.xml
trunk/lutinjaxx/maven/pom.xml
trunk/lutinjaxx/pom.xml
trunk/lutinjaxx/runtime/pom.xml
trunk/lutinjaxx/util/pom.xml
Log:
passage en version 0.4 (version stable int?\195?\169grant les derni?\195?\168re corrections sur le processor d'annotation)
Modified: trunk/lutinjaxx/core/pom.xml
===================================================================
--- trunk/lutinjaxx/core/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/core/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -7,14 +7,14 @@
<parent>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>pom</artifactId>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
</parent>
<artifactId>core</artifactId>
<name>core</name>
<packaging>jar</packaging>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>Jaxx lutin library core</description>
<build>
Modified: trunk/lutinjaxx/jaxx-swing/pom.xml
===================================================================
--- trunk/lutinjaxx/jaxx-swing/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/jaxx-swing/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -7,14 +7,14 @@
<parent>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>pom</artifactId>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
</parent>
<artifactId>jaxx-swing</artifactId>
<name>jaxx-swing</name>
<packaging>jar</packaging>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>Jaxx library swing extension</description>
<dependencies>
Modified: trunk/lutinjaxx/jaxx-swing-action/pom.xml
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/jaxx-swing-action/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -7,14 +7,14 @@
<parent>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>pom</artifactId>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
</parent>
<artifactId>jaxx-swing-action</artifactId>
<name>jaxx-swing-action</name>
<packaging>jar</packaging>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>Jaxx lutin library swing actions extension</description>
<build>
Modified: trunk/lutinjaxx/jaxx-swing-tab/pom.xml
===================================================================
--- trunk/lutinjaxx/jaxx-swing-tab/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/jaxx-swing-tab/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -7,14 +7,14 @@
<parent>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>pom</artifactId>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
</parent>
<artifactId>jaxx-swing-tab</artifactId>
<name>jaxx-swing-tab</name>
<packaging>jar</packaging>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>Jaxx lutin library swing tab extension</description>
<build>
Modified: trunk/lutinjaxx/maven/pom.xml
===================================================================
--- trunk/lutinjaxx/maven/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/maven/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>pom</artifactId>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
</parent>
<artifactId>maven-jaxx-plugin</artifactId>
@@ -63,7 +63,7 @@
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>
Maven 2 plugin to generate java source from ui interface definitions
Modified: trunk/lutinjaxx/pom.xml
===================================================================
--- trunk/lutinjaxx/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -39,7 +39,7 @@
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
<name>pom</name>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>Jaxx lutin library main pom</description>
<inceptionYear>2008</inceptionYear>
Modified: trunk/lutinjaxx/runtime/pom.xml
===================================================================
--- trunk/lutinjaxx/runtime/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/runtime/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -7,14 +7,14 @@
<parent>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>pom</artifactId>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
</parent>
<artifactId>runtime</artifactId>
<name>runtime</name>
<packaging>jar</packaging>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>Jaxx lutin library runtime</description>
<build>
Modified: trunk/lutinjaxx/util/pom.xml
===================================================================
--- trunk/lutinjaxx/util/pom.xml 2008-08-11 09:51:33 UTC (rev 830)
+++ trunk/lutinjaxx/util/pom.xml 2008-08-11 09:52:40 UTC (rev 831)
@@ -7,14 +7,14 @@
<parent>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>pom</artifactId>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
</parent>
<artifactId>util</artifactId>
<name>util</name>
<packaging>jar</packaging>
- <version>0.3-SNAPSHOT</version>
+ <version>0.4</version>
<description>Jaxx lutin library utility</description>
<build>
1
0
r830 - trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action
by tchemit@users.labs.libre-entreprise.org 11 Aug '08
by tchemit@users.labs.libre-entreprise.org 11 Aug '08
11 Aug '08
Author: tchemit
Date: 2008-08-11 09:51:33 +0000 (Mon, 11 Aug 2008)
New Revision: 830
Modified:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
Log:
javadoc
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-11 08:43:07 UTC (rev 829)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-11 09:51:33 UTC (rev 830)
@@ -64,24 +64,31 @@
* @author chemit */
public class ActionAnnotationProcessing extends AbstractProcessor {
- //protected ActionProviderAnnotation providerConfig;
-
+ /** the {@link ActionProvider} service declaration relative path */
protected String providerDeclarationLocation = "META-INF/services/" + ActionProvider.class.getName();
+ /** the relative path where to store actions mapping, will be complete with the name of base action to use */
protected String actionsFileLocation = ActionProviderFromProperties.actionsFileLocation;
+ /** verbose flag (can be activated by passing an annotation parameter to compiler via <code>-Ai18n.verbose</code>) */
protected boolean verbose;
+ /** the list of class processed by the processor */
protected java.util.List<String> processedClass;
+ /** the map of actions processed, keys are the action commaned and values are fqn of implementations */
protected Properties actions;
+ /** Extractor of values of annotations found */
protected AnnotationValueVisitor<Object, Void> annotationValueExtractor;
+ /** the type element of the base action to be used by {@link ActionProvider} */
protected TypeElement baseActionElement;
+ /** the fqn of the action provider to generate */
protected String providerFQN;
+ /** the fqn of the base action class to be used */
protected String baseFQN;
@Override
@@ -108,18 +115,16 @@
baseActionElement = (TypeElement) annotatedWith.iterator().next();
- //fixme CheckbaseActionElement is assigned from MyAbstractAction
- //if (!baseActionElement.getSuperclass()) ...
+ //fixme it is not possible to know if baseActionElement is assigned from MyAbstractAction, since we
+ // can NOT garanted at this stage thaht the class was compiled...
- //providerConfig = baseActionElement.getAnnotation(ActionProviderAnnotation.class);
-
baseFQN = baseActionElement.asType().toString();
- int index = baseFQN.lastIndexOf(".");
- String baseSimpleName = baseFQN.substring(index + 1);
- String packageName = baseFQN.substring(0, index + 1);
+ int index = baseFQN.lastIndexOf(".") + 1;
+ String baseSimpleName = baseFQN.substring(index);
+ String packageName = baseFQN.substring(0, index);
providerFQN = packageName + baseSimpleName + "Provider";
- printInfo("providerFQN " + packageName + "," + baseSimpleName + "," + providerFQN);
+ printDebug("providerFQN " + providerFQN);
actionsFileLocation = String.format(actionsFileLocation, baseSimpleName);
continue;
}
1
0
r829 - in trunk/lutinjaxx: jaxx-swing-action/src/main/java/org/codelutin/jaxx/action util/src/main/java/org/codelutin/jaxx/util
by tchemit@users.labs.libre-entreprise.org 11 Aug '08
by tchemit@users.labs.libre-entreprise.org 11 Aug '08
11 Aug '08
Author: tchemit
Date: 2008-08-11 08:43:07 +0000 (Mon, 11 Aug 2008)
New Revision: 829
Modified:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionNameProvider.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java
trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FormElement.java
trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/UIProvider.java
Log:
preparation pour changement de licence + javadoc
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
@@ -81,7 +81,7 @@
protected TypeElement baseActionElement;
protected String providerFQN;
-
+
protected String baseFQN;
@Override
@@ -115,11 +115,11 @@
baseFQN = baseActionElement.asType().toString();
int index = baseFQN.lastIndexOf(".");
- String baseSimpleName = baseFQN.substring(index+1);
- String packageName = baseFQN.substring(0, index+1);
+ String baseSimpleName = baseFQN.substring(index + 1);
+ String packageName = baseFQN.substring(0, index + 1);
providerFQN = packageName + baseSimpleName + "Provider";
- printInfo("providerFQN "+packageName+","+baseSimpleName+","+providerFQN);
+ printInfo("providerFQN " + packageName + "," + baseSimpleName + "," + providerFQN);
actionsFileLocation = String.format(actionsFileLocation, baseSimpleName);
continue;
}
@@ -220,7 +220,7 @@
protected void writeProviderClass() throws IOException, NotFoundException, CannotCompileException, ClassNotFoundException {
OutputStream outputStream = null;
try {
-
+
ClassPool pool = ClassPool.getDefault();
pool.appendClassPath(new LoaderClassPath(ActionProviderFromProperties.class.getClassLoader()));
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactory.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
@@ -22,14 +22,29 @@
import java.util.Set;
/**
- * Action factory using the ActionConfig annotations to configure the action.
+ * Action factory using the <code>ActionConfig-like</code> annotations to configure actions.
* <p/>
- * Use after the {@link #loadActions(jaxx.runtime.JAXXObject)} to instanciate
- * actions in ui with id equals a known action...
* <p/>
- * TODO Finish doc
+ * An {@link ActionFactory} builds actions always on a same type <code>A</code> and obtain them from some
+ * {@link ActionProvider} via methods {@link #newAction(String, JComponent)} and {@link #newAction(String)} .
+ * <p/>
+ * If the action coming from the provider is not on the same type <code>A</code>, then the action is boxed in a *
+ * action <code>A</code> and use the generic mecanism of delegation provided by {@link MyAbstractAction}.
+ * <p/>
+ * Use after the {@link #loadActions(jaxx.runtime.JAXXObject)} to instanciate actions in ui with id equals a known
+ * action...
+ * <p/>
+ * All actions instanciated are stored in a cache that you can request via method {@link #getActionFromCache(String)},
+ * {@link #cacheEntrySet()} and {@link #resetCache()}.
+ * <p/>
+ * You can also from this factory fires some action via the methods {@link #fireAction(String, Object, JComponent)} ,
+ * {@link #fireAction(String, Object)} , {@link #fireAction0(String, Object, MyAbstractAction)}.
+ * <p/>
+ * Finally, a {@link #dispose()} method is there to shut down all instanciated action when you want to dispose all uis.
*
* @author chemit
+ * @see ActionProvider
+ * @see MyAbstractAction
*/
public interface ActionFactory<A extends MyAbstractAction> {
@@ -41,8 +56,23 @@
Map<String, Class<? extends MyAbstractAction>> init();
/** @return the class of the base action of the factory. */
- Class<A> getBaseImpl();
+ Class<A> getBaseClass();
+ /** @return the set of all the action's classes known by the factory. */
+ Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet();
+
+ /** @return the array of names of all actions known by the factory */
+ String[] getActionNames();
+
+ /** @return the set of all actions cached in factory indexed by their name */
+ Set<Entry<String, A>> cacheEntrySet();
+
+ /**
+ * @param actionKey the action's key
+ * @return the action in cache or <code>null</code> if action is not in cache
+ */
+ MyAbstractAction getActionFromCache(String actionKey);
+
/** clear the cache of instanciated actions. */
void resetCache();
@@ -50,8 +80,9 @@
* @param actionKey the key of an action
* @return the action with this key from cache, or <code>null</code> if this action is not in cache
*/
- A get(String actionKey);
+ //A get(String actionKey);
+
/**
* For a given ui, load all actions registred in factory.
* <p/>
@@ -71,7 +102,7 @@
A newAction(String actionKey, JComponent component);
/**
- * Obtain an action instance given his key (should call {@link #newAction(String, javax.swing.JComponent)}
+ * Obtain an action instance given his key (should call {@link #newAction(String, JComponent)}
* <p/>
* This is a convinient method when you want to obtain an action with no attached widget.
*
@@ -80,15 +111,7 @@
*/
A newAction(String actionKey);
- /** @return the array of names of all actions known by the factory */
- String[] getActionNames();
- /** @return the set of all the action's classes known by the factory. */
- Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet();
-
- /** @return the set of all actions cached in factory indexed by their name */
- Set<Entry<String, A>> cacheEntrySet();
-
/**
* Fire an action given his key, his source and tthe widget responsible of action
*
@@ -117,14 +140,9 @@
*/
void fireAction0(String actionKey, Object source, A action);
- /**
- * @param actionKey the action's key
- * @return the action in cache or <code>null</code> if action is not in cache
- */
- MyAbstractAction getActionFromCache(String actionKey);
/**
- * dispose all actions in cache using {@link org.codelutin.jaxx.action.MyAbstractAction#disposeUI()} on each
+ * dispose all actions in cache using {@link MyAbstractAction#disposeUI()} on each
* action, then {@link #resetCache()}
*/
void dispose();
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -85,7 +85,7 @@
this.selectActionConfigInitializer = registerInitializer(SelectActionConfigConfigurationResolver.class);
}
- public Class<A> getBaseImpl() {
+ public Class<A> getBaseClass() {
return baseImpl;
}
@@ -93,9 +93,9 @@
cache.clear();
}
- public A get(String actionKey) {
+ /*public A get(String actionKey) {
return cache.get(actionKey);
- }
+ }*/
public void loadActions(JAXXObject ui) {
if (log.isDebugEnabled()) {
@@ -246,16 +246,16 @@
// on vérifie que l'action existe bien
checkRegistredAction(actionKey);
+ A action = null;
// try in cache
if (cache.containsKey(actionKey)) {
// use cached action
- A action = cache.get(actionKey);
+ action = cache.get(actionKey);
if (log.isDebugEnabled()) {
log.debug("use cache action " + action);
}
- return action;
}
- return null;
+ return action;
}
public void dispose() {
@@ -377,9 +377,9 @@
MyAbstractAction result;
result = klazz.getConstructor(String.class).newInstance(actionKey);
result.putValue(Action.ACTION_COMMAND_KEY, actionKey);
- if (!getBaseImpl().isAssignableFrom(klazz)) {
+ if (!getBaseClass().isAssignableFrom(klazz)) {
// the instanciated action must be boxed in the base Action of the factory
- result = getBaseImpl().getConstructor(MyAbstractAction.class).newInstance(result);
+ result = getBaseClass().getConstructor(MyAbstractAction.class).newInstance(result);
}
return (A) result;
}
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionNameProvider.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionNameProvider.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionNameProvider.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,19 +10,19 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
/**
- * Contrat pour obtenir les noms d'une action de manière dynamique.
+ * Contrat pour obtenir les noms d'une action de maniere dynamique.
* <p/>
- * Cette méthode sera appelé par un {@link ActionProvider} lorsque la clef dans le
- * fichier de mapping est :fqn (où fqn correspond à une implantation de ce contrat).
+ * Cette méthode sera appelee par un {@link ActionProvider} lorsque la clef dans le
+ * fichier de mapping est <code>:fqn</code> (où fqn correspond à une implantation de ce contrat).
* <p/>
- * Ainsi on peut associer à une action donnée plusieurs instances avec des noms différents mais avec le même comportement.
+ * Ainsi on peut associer à une action donnee plusieurs instances avec des noms différents mais de le meme comportement.
* <p/>
- * Par exemple, une changement de locale où seule la locale varie (et elle sera retrouvée à partir du nom de l'action).
+ * Par exemple, une changement de locale ou seule la locale varie (et elle sera retrouvee a partir du nom de l'action).
*
* @author chemit
*/
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,16 +10,19 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
/**
* Contract to be realized by a provider of Actions.
* <p/>
- * A provider of actions
+ * A provider of actions is based on a certain type of {@link MyAbstractAction} (<code>A</code>) with an accessor
+ * {@link #getBaseClass()} and deliver some implementations of such actions indexed by their logical names via the
+ * method {#link #getClasses()}.
*
* @author chemit
+ * @see MyAbstractAction
*/
public interface ActionProvider<A extends MyAbstractAction> {
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/MyAbstractAction.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.action;
Modified: trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java
===================================================================
--- trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/AbstractUIAction.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.util;
Modified: trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java
===================================================================
--- trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FactoryWindowListener.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.util;
Modified: trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FormElement.java
===================================================================
--- trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FormElement.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/FormElement.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.util;
Modified: trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java
===================================================================
--- trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/ShowUIAction.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.util;
Modified: trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/UIProvider.java
===================================================================
--- trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/UIProvider.java 2008-08-10 16:40:49 UTC (rev 828)
+++ trunk/lutinjaxx/util/src/main/java/org/codelutin/jaxx/util/UIProvider.java 2008-08-11 08:43:07 UTC (rev 829)
@@ -1,5 +1,5 @@
/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * ##% Copyright (C) 2008 Code Lutin, Tony Chemit
* This program is free software; you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation; either version 2
@@ -10,7 +10,7 @@
* should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
+ * ##%
*/
package org.codelutin.jaxx.util;
1
0
r828 - trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action
by tchemit@users.labs.libre-entreprise.org 10 Aug '08
by tchemit@users.labs.libre-entreprise.org 10 Aug '08
10 Aug '08
Author: tchemit
Date: 2008-08-10 16:40:49 +0000 (Sun, 10 Aug 2008)
New Revision: 828
Modified:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java
Log:
simplify code : all is fully generated now : nothing has to be configured via the annotation. just placed it :)
suppression name field in ActionProvider
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-10 15:18:09 UTC (rev 827)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-10 16:40:49 UTC (rev 828)
@@ -64,11 +64,11 @@
* @author chemit */
public class ActionAnnotationProcessing extends AbstractProcessor {
- protected ActionProviderAnnotation providerConfig;
+ //protected ActionProviderAnnotation providerConfig;
protected String providerDeclarationLocation = "META-INF/services/" + ActionProvider.class.getName();
- protected String actionsFileLocation = "META-INF/jaxx-%1$s-actions.properties";
+ protected String actionsFileLocation = ActionProviderFromProperties.actionsFileLocation;
protected boolean verbose;
@@ -80,6 +80,10 @@
protected TypeElement baseActionElement;
+ protected String providerFQN;
+
+ protected String baseFQN;
+
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
@@ -107,9 +111,16 @@
//fixme CheckbaseActionElement is assigned from MyAbstractAction
//if (!baseActionElement.getSuperclass()) ...
- providerConfig = baseActionElement.getAnnotation(ActionProviderAnnotation.class);
+ //providerConfig = baseActionElement.getAnnotation(ActionProviderAnnotation.class);
- actionsFileLocation = String.format(actionsFileLocation, providerConfig.name());
+ baseFQN = baseActionElement.asType().toString();
+ int index = baseFQN.lastIndexOf(".");
+ String baseSimpleName = baseFQN.substring(index+1);
+ String packageName = baseFQN.substring(0, index+1);
+
+ providerFQN = packageName + baseSimpleName + "Provider";
+ printInfo("providerFQN "+packageName+","+baseSimpleName+","+providerFQN);
+ actionsFileLocation = String.format(actionsFileLocation, baseSimpleName);
continue;
}
@@ -135,7 +146,7 @@
if ((roundEnv.processingOver())) {
printDebug("round is over " + roundEnv);
try {
- if (providerConfig != null) {
+ if (baseActionElement != null) {
// found the base action class to be compiled, so we have to write provider things...
writeProviderClass();
writeProviderServiceDeclaration();
@@ -184,25 +195,6 @@
return f.getAbsolutePath().substring(index);
}
- /**
- * @throws ClassNotFoundException ifclass not find
- * @deprecated Can not use anylonger this class, beacause at compile time we are not garanted to have
- * some actions classes compiled, so can not use {@link Class#forName(String)} method.
- */
- @Deprecated
- protected void findProviderConfigFromCompiledClass() throws ClassNotFoundException {
- if (!actions.isEmpty()) {
- Class<?> klazz = Class.forName(processedClass.get(0));
- providerConfig = klazz.getAnnotation(ActionProviderAnnotation.class);
- while (klazz != null && providerConfig == null) {
- klazz = klazz.getSuperclass();
- if (klazz != null) {
- providerConfig = klazz.getAnnotation(ActionProviderAnnotation.class);
- }
- }
- }
- }
-
protected boolean registerActionsForClass(TypeMirror annotationType, Element e) {
boolean doTreate = false;
for (AnnotationMirror mirror : e.getAnnotationMirrors()) {
@@ -228,24 +220,23 @@
protected void writeProviderClass() throws IOException, NotFoundException, CannotCompileException, ClassNotFoundException {
OutputStream outputStream = null;
try {
- String fqn = providerConfig.fqn();
-
+
ClassPool pool = ClassPool.getDefault();
pool.appendClassPath(new LoaderClassPath(ActionProviderFromProperties.class.getClassLoader()));
CtClass superClass = pool.get(ActionProviderFromProperties.class.getName());
- CtClass clazz = pool.makeClass(fqn);
+ CtClass clazz = pool.makeClass(providerFQN);
// define the base action class in javassist pool to make possible compilation
- pool.makeClass(baseActionElement.asType().toString());
+ pool.makeClass(baseFQN);
clazz.setSuperclass(superClass);
// add constructor
CtConstructor constructor = new CtConstructor(null, clazz);
- constructor.setBody("super(\"" + providerConfig.name() + "\"," + baseActionElement.asType().toString() + ".class,\"/" + actionsFileLocation + "\");");
+ constructor.setBody("super( " + baseFQN + ".class);");
clazz.addConstructor(constructor);
byte[] byteCode = clazz.toBytecode();
- JavaFileObject fo = processingEnv.getFiler().createClassFile(fqn);
+ JavaFileObject fo = processingEnv.getFiler().createClassFile(providerFQN);
printInfo("writing " + fo.toUri());
outputStream = fo.openOutputStream();
outputStream.write(byteCode);
@@ -264,7 +255,7 @@
w = new BufferedWriter(fo.openWriter());
w.append("# generated by ").append(getClass().getName()).append("\n").toString();
w.append("#").append(new java.util.Date().toString()).append("\n").toString();
- w.append(providerConfig.fqn());
+ w.append(providerFQN);
} finally {
if (w != null)
w.close();
@@ -345,23 +336,9 @@
continue;
}
- /*Class<ActionNameHelper.ActionNameProvider> klazz = (Class<ActionNameHelper.ActionNameProvider>) entry.getValue().accept(getAnnotationValueExtractor(), null);
- if (ActionNameHelper.CompileActionNameProvider.class.isAssignableFrom(klazz)) {
- // means there is a compile time names provider
- try {
- result = klazz.newInstance().getActionCommands();
- break;
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
- if (ActionNameHelper.RuntimeActionNameProvider.class.isAssignableFrom(klazz)) {*/
// means there is a runtime names provider
result = new String[]{":" + classname};
break;
- //}
}
if ("actionCommand".equals(name)) {
result = new String[]{(String) entry.getValue().accept(getAnnotationValueExtractor(), null)};
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java 2008-08-10 15:18:09 UTC (rev 827)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProvider.java 2008-08-10 16:40:49 UTC (rev 828)
@@ -23,9 +23,6 @@
*/
public interface ActionProvider<A extends MyAbstractAction> {
- /** @return the name of the provider */
- String getName();
-
/** @return the base classe of provided actions */
Class<A> getBaseClass();
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java 2008-08-10 15:18:09 UTC (rev 827)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderAnnotation.java 2008-08-10 16:40:49 UTC (rev 828)
@@ -31,11 +31,4 @@
@Target(ElementType.TYPE)
public @interface ActionProviderAnnotation {
-
- /** @return le nom du provider */
- String name();
-
- /** @return le nom qualifie duprovider a generer */
- String fqn();
-
}
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java 2008-08-10 15:18:09 UTC (rev 827)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionProviderFromProperties.java 2008-08-10 16:40:49 UTC (rev 828)
@@ -30,30 +30,24 @@
/** default prefix for an entryin mapping file. */
protected static final String ACTION_KEY_PREFIX = "action.";
+ protected static final String actionsFileLocation = "META-INF/jaxx-%1$s-actions.properties";
+
protected String propertiesPath;
protected static Log log = LogFactory.getLog(ActionProviderFromProperties.class);
- protected String name;
-
protected Class<A> baseClass;
protected Map<String, Class<? extends A>> actions;
- protected ActionProviderFromProperties(String name, Class<A> baseClass, String propertiesPath) {
+ protected ActionProviderFromProperties(Class<A> baseClass) {
- this.name = name;
this.baseClass = baseClass;
-
- this.propertiesPath = propertiesPath;
+ this.propertiesPath = "/" + String.format(actionsFileLocation, baseClass.getSimpleName());
this.actions = initCache();
}
- public String getName() {
- return name;
- }
-
public Class<A> getBaseClass() {
return baseClass;
}
@@ -64,7 +58,7 @@
@Override
public String toString() {
- return super.toString() + "<name:" + name + ", baseClass:" + baseClass.getSimpleName() + ">";
+ return super.toString() + "<baseClass:" + baseClass.getSimpleName() + ">";
}
protected void clearCache() {
@@ -90,13 +84,16 @@
try {
inputStream = getClass().getResourceAsStream(propertiesPath);
if (inputStream == null) {
- throw new NullPointerException("could not find action file " + propertiesPath);
+ //throw new NullPointerException("could not find action file " + propertiesPath);
+ // actually, there is nothing to load, this is not an error
+ } else {
+ log.info("load " + propertiesPath);
+ properties.load(inputStream);
}
- log.info("load " + propertiesPath);
- properties.load(inputStream);
} catch (IOException e) {
- log.warn(_("jaxx.error.load.actions.file", e.getMessage()));
- throw new RuntimeException(_("jaxx.error.load.actions.file", e.getMessage()));
+ String message = _("jaxx.error.load.actions.file", e.getMessage());
+ log.warn(message);
+ throw new RuntimeException(message);
} finally {
if (inputStream != null) {
try {
@@ -128,12 +125,8 @@
}
log.debug("found action <" + actionKey + " : " + implCass + ">");
cache.put(actionKey, implCass);
- } catch (ClassNotFoundException e) {
+ } catch (Exception e) {
throw new RuntimeException(_("jaxx.error.load.actions.class", key, qfn), e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(_("jaxx.error.load.actions.class", key, qfn), e);
- } catch (InstantiationException e) {
- throw new RuntimeException(_("jaxx.error.load.actions.class", key, qfn), e);
}
}
1
0
r827 - trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action
by tchemit@users.labs.libre-entreprise.org 10 Aug '08
by tchemit@users.labs.libre-entreprise.org 10 Aug '08
10 Aug '08
Author: tchemit
Date: 2008-08-10 15:18:09 +0000 (Sun, 10 Aug 2008)
New Revision: 827
Modified:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
Log:
fix bug : can not use Class.forname on uncompiled classes
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-10 13:14:47 UTC (rev 826)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionAnnotationProcessing.java 2008-08-10 15:18:09 UTC (rev 827)
@@ -43,6 +43,8 @@
import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;
import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -133,20 +135,22 @@
if ((roundEnv.processingOver())) {
printDebug("round is over " + roundEnv);
try {
- if (providerConfig == null) {
+ if (providerConfig != null) {
+ // found the base action class to be compiled, so we have to write provider things...
+ writeProviderClass();
+ writeProviderServiceDeclaration();
+ } else {
+
// baseActionClass was not compiled at this time, must find it back
+ // this means they should have an already mapping file written
- findProviderConfigFromCompiledClass();
+ actionsFileLocation = findMappingFile();
- if (providerConfig == null) {
- throw new IllegalStateException("no provider name found, you must add on baseaction the annotation " + ActionProviderAnnotation.class);
- }
- actionsFileLocation = String.format(actionsFileLocation, providerConfig.name());
- } else {
- writeProviderClass();
- writeProviderServiceDeclaration();
+ printInfo("reused actionFilesLocation " + actionsFileLocation);
}
+
writeActionMapping();
+
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
@@ -158,8 +162,36 @@
return true;
}
+ protected String findMappingFile() throws IOException {
+ String path = String.format(actionsFileLocation, "dummy_" + System.nanoTime());
+
+
+ FileObject oldFo = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, "", path);
+ File dummyFile = new File(oldFo.toUri().toString()).getParentFile();
+ File[] files = dummyFile.listFiles(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.startsWith("jaxx-") && name.endsWith("-actions.properties");
+ }
+ });
+ if (files.length < 1) {
+ // this is not normal, should have exactly one file here
+ throw new IllegalStateException("no provider name found, you must add on baseaction the annotation " + ActionProviderAnnotation.class);
+ }
+ File f = files[0];
+ int index = f.getAbsolutePath().indexOf("META-INF");
+
+ return f.getAbsolutePath().substring(index);
+ }
+
+ /**
+ * @throws ClassNotFoundException ifclass not find
+ * @deprecated Can not use anylonger this class, beacause at compile time we are not garanted to have
+ * some actions classes compiled, so can not use {@link Class#forName(String)} method.
+ */
+ @Deprecated
protected void findProviderConfigFromCompiledClass() throws ClassNotFoundException {
- if (!processedClass.isEmpty()) {
+ if (!actions.isEmpty()) {
Class<?> klazz = Class.forName(processedClass.get(0));
providerConfig = klazz.getAnnotation(ActionProviderAnnotation.class);
while (klazz != null && providerConfig == null) {
@@ -240,11 +272,17 @@
}
protected void writeActionMapping() throws IOException {
+ if (actions.isEmpty()) {
+ // nothing to write or overwrite
+ return;
+ }
+
BufferedWriter w = null;
try {
Properties oldProps = loadOldActionMapping();
if (oldProps != null) {
- actions.putAll(oldProps);
+ oldProps.putAll(actions);
+ actions = oldProps;
}
// ecriture de toutes les actions trouvees
FileObject fo = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", actionsFileLocation);
@@ -260,11 +298,10 @@
protected Properties loadOldActionMapping() throws IOException {
// reprise sur une ancienne compilation
FileObject oldFo = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, "", actionsFileLocation);
- System.out.println("URI " + oldFo.toUri());
- if (!new java.io.File(oldFo.toUri().toString()).exists()) {
+ if (!new File(oldFo.toUri().toString()).exists()) {
return null;
}
- Properties oldProps = new Properties();
+ Properties oldProps = new SortedProperties();
InputStream inputStream = null;
try {
inputStream = oldFo.openInputStream();
1
0
r826 - trunk/lutinjaxx/core/src/main/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 10 Aug '08
by tchemit@users.labs.libre-entreprise.org 10 Aug '08
10 Aug '08
Author: tchemit
Date: 2008-08-10 13:14:47 +0000 (Sun, 10 Aug 2008)
New Revision: 826
Modified:
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java
Log:
ajout en visibilite public de la methode get$objectMap pour pouvoir utiliser de l'exterieur cet dictionnaire
Modified: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java 2008-08-09 10:27:18 UTC (rev 825)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java 2008-08-10 13:14:47 UTC (rev 826)
@@ -14,6 +14,11 @@
*/
public Object getObjectById(String id);
+ /**
+ * Pretrieves the dictonary of knwon objects indexed by their ids.
+ * @return the dictonary of objects.
+ */
+ public java.util.Map<String,Object> get$objectMap();
public void applyDataBinding(String id);
1
0
r825 - trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action
by tchemit@users.labs.libre-entreprise.org 09 Aug '08
by tchemit@users.labs.libre-entreprise.org 09 Aug '08
09 Aug '08
Author: tchemit
Date: 2008-08-09 10:27:18 +0000 (Sat, 09 Aug 2008)
New Revision: 825
Removed:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/
Log:
simplification du code : suppression du paquetage initializer
1
0
r824 - trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action
by tchemit@users.labs.libre-entreprise.org 09 Aug '08
by tchemit@users.labs.libre-entreprise.org 09 Aug '08
09 Aug '08
Author: tchemit
Date: 2008-08-09 10:26:55 +0000 (Sat, 09 Aug 2008)
New Revision: 824
Modified:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java
Log:
simplification du code : suppression du paquetage initializer
Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java 2008-08-09 10:26:44 UTC (rev 823)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionFactoryFromProvider.java 2008-08-09 10:26:55 UTC (rev 824)
@@ -21,11 +21,6 @@
import jaxx.runtime.swing.JAXXToggleButton;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codelutin.jaxx.action.initializer.AbstractActionConfigurationResolver;
-import org.codelutin.jaxx.action.initializer.ActionConfigConfigurationResolver;
-import org.codelutin.jaxx.action.initializer.ActionConfigurationResolver;
-import org.codelutin.jaxx.action.initializer.SelectActionConfigConfigurationResolver;
-import org.codelutin.jaxx.action.initializer.ToggleActionConfigConfigurationResolver;
import javax.swing.AbstractButton;
import javax.swing.Action;
1
0
r823 - in trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action: . initializer
by tchemit@users.labs.libre-entreprise.org 09 Aug '08
by tchemit@users.labs.libre-entreprise.org 09 Aug '08
09 Aug '08
Author: tchemit
Date: 2008-08-09 10:26:44 +0000 (Sat, 09 Aug 2008)
New Revision: 823
Added:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java
Removed:
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/AbstractActionConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/SelectActionConfigConfigurationResolver.java
trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ToggleActionConfigConfigurationResolver.java
Log:
simplification du code : suppression du paquetage initializer
Copied: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java (from rev 820, trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/AbstractActionConfigurationResolver.java)
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java (rev 0)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/AbstractActionConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -0,0 +1,70 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.jaxx.action;
+
+import javax.swing.JComponent;
+
+/**
+ * Common abstract class of a resolver of action configuration.
+ * <p/>
+ * The class implements the logic of research of the configuration annotation.
+ *
+ * @author chemit
+ */
+public abstract class AbstractActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> implements ActionConfigurationResolver<A, C> {
+
+ /** the type of configuration's annotation */
+ protected final Class<A> annotationImpl;
+
+ /** the type of component that can fire an action */
+ protected final Class<C> componentImpl;
+
+ /**
+ * The typed method (on component) to apply configuration on the action and component.
+ *
+ * @param component the component which fires the action
+ * @param action the given action
+ * @return the configuration's annotation
+ */
+ protected abstract A applyConfiguration0(C component, MyAbstractAction action);
+
+ protected AbstractActionConfigurationResolver(Class<A> annotationImpl, Class<C> componentImpl) {
+ this.annotationImpl = annotationImpl;
+ this.componentImpl = componentImpl;
+ }
+
+ public A resolveConfiguration(MyAbstractAction action) {
+ if (action.hasDelegate()) {
+ return resolveConfiguration(action.getDelegate());
+ }
+ return action.getClass().getAnnotation(annotationImpl);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public A applyConfiguration(JComponent component, MyAbstractAction action) {
+ if (component != null && componentImpl.isAssignableFrom(component.getClass()))
+ return applyConfiguration0((C) component, action);
+
+ return null;
+ }
+
+ public Class<A> getAnnotationImpl() {
+ return annotationImpl;
+ }
+
+ public Class<C> getComponentImpl() {
+ return componentImpl;
+ }
+}
Copied: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java (from rev 820, trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigConfigurationResolver.java)
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java (rev 0)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -0,0 +1,67 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.jaxx.action;
+
+import static org.codelutin.i18n.I18n._;
+
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+
+/**
+ * Implementation of configuration's resolver for annotation {@link ActionConfig}
+ *
+ * @author chemit
+ */
+public class ActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ActionConfig, AbstractButton> {
+
+ public ActionConfigConfigurationResolver() {
+ super(ActionConfig.class, AbstractButton.class);
+ }
+
+ protected ActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
+ ActionConfig anno = resolveConfiguration(action);
+ if (anno == null) {
+ return null;
+ }
+ // inject les données
+ if (!anno.name().isEmpty()) {
+ //System.out.println("found action with name : " + anno.name());
+ action.putValue(Action.NAME, _(anno.name()));
+ }
+ //if (!anno.shortDescription().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
+ //}
+ if (!anno.smallIcon().isEmpty()) {
+ action.putValue(Action.SMALL_ICON, org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
+ }
+ if (anno.mnemonic() != '\0') {
+ action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
+ } else if (component != null) {
+ action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
+ }
+ //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
+
+ if (component == null) {
+ action.putValue("hideActionText", anno.hideActionText());
+ } else {
+ boolean actionText = component.getHideActionText();
+ action.putValue("hideActionText", anno.hideActionText() || actionText);
+ }
+ action.putValue(Action.SELECTED_KEY, anno.selected());
+ action.setEnabled(anno.enabled());
+
+ return anno;
+ }
+}
Copied: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java (from rev 820, trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigurationResolver.java)
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java (rev 0)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ActionConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -0,0 +1,52 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.jaxx.action;
+
+import javax.swing.JComponent;
+
+/**
+ * The contract to be realized to resolve an {@link MyAbstractAction} configuration.
+ * <p/>
+ * Configuration is done by a Annotation of type {@link A} placed on the action class.
+ * <p/>
+ * If the instanciated action box the real action, we should always search on the boxed action.
+ * <p/>
+ * Moreover, a action can only be fired by a certain type of component (for example a Button or a ComboBox), the class
+ * of the component type is given by the {@link C} class.
+ *
+ * @author chemit
+ */
+public interface ActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> {
+ /**
+ * Search the annotation that configure the given action (or the boxed action).
+ *
+ * @param action current action
+ * @return the configuration of the action
+ */
+ A resolveConfiguration(MyAbstractAction action);
+
+ /**
+ * @param component widget that requires the action
+ * @param action given action
+ * @return the configuration of the action
+ */
+ A applyConfiguration(JComponent component, MyAbstractAction action);
+
+ /** @return the configuration annotation dealed by this resolver */
+ Class<A> getAnnotationImpl();
+
+ /** @return the class of the component which can fired the action */
+ Class<C> getComponentImpl();
+}
Copied: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java (from rev 820, trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/SelectActionConfigConfigurationResolver.java)
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java (rev 0)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/SelectActionConfigConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -0,0 +1,53 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.jaxx.action;
+
+import static org.codelutin.i18n.I18n._;
+
+import javax.swing.Action;
+import javax.swing.JComboBox;
+
+/**
+ * Implementation of configuration's resolver for annotation {@link SelectActionConfig}
+ *
+ * @author chemit
+ */
+public class SelectActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<SelectActionConfig, JComboBox> {
+
+ public SelectActionConfigConfigurationResolver() {
+ super(SelectActionConfig.class, JComboBox.class);
+ }
+
+ protected SelectActionConfig applyConfiguration0(JComboBox component, MyAbstractAction action) {
+ SelectActionConfig anno = resolveConfiguration(action);
+ if (anno == null) {
+ return null;
+ }
+ // inject les données
+ if (!anno.name().isEmpty()) {
+ action.putValue(Action.NAME, _(anno.name()));
+ }
+ if (!anno.shortDescription().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
+ } else {
+ action.putValue(Action.SHORT_DESCRIPTION, _(component.getToolTipText()));
+ }
+ action.putValue("selectedIndex", anno.selectedIndex());
+ //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
+ action.setEnabled(anno.enabled());
+
+ return anno;
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java (from rev 820, trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ToggleActionConfigConfigurationResolver.java)
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java (rev 0)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/ToggleActionConfigConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -0,0 +1,79 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.jaxx.action;
+
+import static org.codelutin.i18n.I18n._;
+
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+
+/**
+ * Implementation of configuration's resolver for annotation {@link ToggleActionConfig}
+ *
+ * @author chemit
+ */
+public class ToggleActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ToggleActionConfig, AbstractButton> {
+
+ public ToggleActionConfigConfigurationResolver() {
+ super(ToggleActionConfig.class, AbstractButton.class);
+ }
+
+ protected ToggleActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
+ ToggleActionConfig anno = resolveConfiguration(action);
+ if (anno == null) {
+ return null;
+ }
+ // inject les données
+ if (!anno.name().isEmpty()) {
+ //System.out.println("found action with name : " + anno.name());
+ action.putValue(Action.NAME, _(anno.name()));
+ }
+ if (!anno.name2().isEmpty()) {
+ //System.out.println("found action with name2 : " + anno.name2());
+ action.putValue(Action.NAME + "2", _(anno.name2()));
+ }
+
+ if (!anno.shortDescription().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
+ }
+ if (!anno.shortDescription2().isEmpty()) {
+ action.putValue(Action.SHORT_DESCRIPTION + "2", _(anno.shortDescription2()));
+ }
+
+ if (!anno.smallIcon().isEmpty()) {
+ action.putValue(Action.SMALL_ICON, org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
+ }
+ if (!anno.smallIcon2().isEmpty()) {
+ action.putValue(Action.SMALL_ICON + "2", org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon2()));
+ }
+
+ if (anno.mnemonic() != '\0') {
+ action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
+ } else if (component != null) {
+ action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
+ }
+ if (anno.mnemonic2() != '\0') {
+ action.putValue(Action.MNEMONIC_KEY + "2", anno.mnemonic2());
+ }
+ //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
+
+
+ action.putValue("hideActionText", anno.hideActionText());
+ action.putValue(Action.SELECTED_KEY, anno.selected());
+ action.setEnabled(anno.enabled());
+
+ return anno;
+ }
+}
\ No newline at end of file
Deleted: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/AbstractActionConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/AbstractActionConfigurationResolver.java 2008-08-09 10:26:02 UTC (rev 822)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/AbstractActionConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -1,72 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.jaxx.action.initializer;
-
-import org.codelutin.jaxx.action.MyAbstractAction;
-
-import javax.swing.JComponent;
-
-/**
- * Common abstract class of a resolver of action configuration.
- * <p/>
- * The class implements the logic of research of the configuration annotation.
- *
- * @author chemit
- */
-public abstract class AbstractActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> implements ActionConfigurationResolver<A, C> {
-
- /** the type of configuration's annotation */
- protected final Class<A> annotationImpl;
-
- /** the type of component that can fire an action */
- protected final Class<C> componentImpl;
-
- /**
- * The typed method (on component) to apply configuration on the action and component.
- *
- * @param component the component which fires the action
- * @param action the given action
- * @return the configuration's annotation
- */
- protected abstract A applyConfiguration0(C component, MyAbstractAction action);
-
- protected AbstractActionConfigurationResolver(Class<A> annotationImpl, Class<C> componentImpl) {
- this.annotationImpl = annotationImpl;
- this.componentImpl = componentImpl;
- }
-
- public A resolveConfiguration(MyAbstractAction action) {
- if (action.hasDelegate()) {
- return resolveConfiguration(action.getDelegate());
- }
- return action.getClass().getAnnotation(annotationImpl);
- }
-
- @SuppressWarnings({"unchecked"})
- public A applyConfiguration(JComponent component, MyAbstractAction action) {
- if (component != null && componentImpl.isAssignableFrom(component.getClass()))
- return applyConfiguration0((C) component, action);
-
- return null;
- }
-
- public Class<A> getAnnotationImpl() {
- return annotationImpl;
- }
-
- public Class<C> getComponentImpl() {
- return componentImpl;
- }
-}
Deleted: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigConfigurationResolver.java 2008-08-09 10:26:02 UTC (rev 822)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -1,69 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.jaxx.action.initializer;
-
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.jaxx.action.ActionConfig;
-import org.codelutin.jaxx.action.MyAbstractAction;
-
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-
-/**
- * Implementation of configuration's resolver for annotation {@link ActionConfig}
- *
- * @author chemit
- */
-public class ActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ActionConfig, AbstractButton> {
-
- public ActionConfigConfigurationResolver() {
- super(ActionConfig.class, AbstractButton.class);
- }
-
- protected ActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
- ActionConfig anno = resolveConfiguration(action);
- if (anno == null) {
- return null;
- }
- // inject les données
- if (!anno.name().isEmpty()) {
- //System.out.println("found action with name : " + anno.name());
- action.putValue(Action.NAME, _(anno.name()));
- }
- //if (!anno.shortDescription().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
- //}
- if (!anno.smallIcon().isEmpty()) {
- action.putValue(Action.SMALL_ICON, org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
- }
- if (anno.mnemonic() != '\0') {
- action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
- } else if (component != null) {
- action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
- }
- //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
-
- if (component == null) {
- action.putValue("hideActionText", anno.hideActionText());
- } else {
- boolean actionText = component.getHideActionText();
- action.putValue("hideActionText", anno.hideActionText() || actionText);
- }
- action.putValue(Action.SELECTED_KEY, anno.selected());
- action.setEnabled(anno.enabled());
-
- return anno;
- }
-}
Deleted: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigurationResolver.java 2008-08-09 10:26:02 UTC (rev 822)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ActionConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -1,54 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.jaxx.action.initializer;
-
-import org.codelutin.jaxx.action.MyAbstractAction;
-
-import javax.swing.JComponent;
-
-/**
- * The contract to be realized to resolve an {@link MyAbstractAction} configuration.
- * <p/>
- * Configuration is done by a Annotation of type {@link A} placed on the action class.
- * <p/>
- * If the instanciated action box the real action, we should always search on the boxed action.
- * <p/>
- * Moreover, a action can only be fired by a certain type of component (for example a Button or a ComboBox), the class
- * of the component type is given by the {@link C} class.
- *
- * @author chemit
- */
-public interface ActionConfigurationResolver<A extends java.lang.annotation.Annotation, C extends JComponent> {
- /**
- * Search the annotation that configure the given action (or the boxed action).
- *
- * @param action current action
- * @return the configuration of the action
- */
- A resolveConfiguration(MyAbstractAction action);
-
- /**
- * @param component widget that requires the action
- * @param action given action
- * @return the configuration of the action
- */
- A applyConfiguration(JComponent component, MyAbstractAction action);
-
- /** @return the configuration annotation dealed by this resolver */
- Class<A> getAnnotationImpl();
-
- /** @return the class of the component which can fired the action */
- Class<C> getComponentImpl();
-}
Deleted: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/SelectActionConfigConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/SelectActionConfigConfigurationResolver.java 2008-08-09 10:26:02 UTC (rev 822)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/SelectActionConfigConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -1,55 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.jaxx.action.initializer;
-
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.jaxx.action.MyAbstractAction;
-import org.codelutin.jaxx.action.SelectActionConfig;
-
-import javax.swing.Action;
-import javax.swing.JComboBox;
-
-/**
- * Implementation of configuration's resolver for annotation {@link SelectActionConfig}
- *
- * @author chemit
- */
-public class SelectActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<SelectActionConfig, JComboBox> {
-
- public SelectActionConfigConfigurationResolver() {
- super(SelectActionConfig.class, JComboBox.class);
- }
-
- protected SelectActionConfig applyConfiguration0(JComboBox component, MyAbstractAction action) {
- SelectActionConfig anno = resolveConfiguration(action);
- if (anno == null) {
- return null;
- }
- // inject les données
- if (!anno.name().isEmpty()) {
- action.putValue(Action.NAME, _(anno.name()));
- }
- if (!anno.shortDescription().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
- } else {
- action.putValue(Action.SHORT_DESCRIPTION, _(component.getToolTipText()));
- }
- action.putValue("selectedIndex", anno.selectedIndex());
- //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
- action.setEnabled(anno.enabled());
-
- return anno;
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ToggleActionConfigConfigurationResolver.java
===================================================================
--- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ToggleActionConfigConfigurationResolver.java 2008-08-09 10:26:02 UTC (rev 822)
+++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/initializer/ToggleActionConfigConfigurationResolver.java 2008-08-09 10:26:44 UTC (rev 823)
@@ -1,81 +0,0 @@
-/**
- * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
- * This program is free software; you
- * can redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. This program is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
- * should have received a copy of the GNU General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
- * - Suite 330, Boston, MA 02111-1307, USA.
- * # #%
- */
-package org.codelutin.jaxx.action.initializer;
-
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.jaxx.action.MyAbstractAction;
-import org.codelutin.jaxx.action.ToggleActionConfig;
-
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-
-/**
- * Implementation of configuration's resolver for annotation {@link ToggleActionConfig}
- *
- * @author chemit
- */
-public class ToggleActionConfigConfigurationResolver extends AbstractActionConfigurationResolver<ToggleActionConfig, AbstractButton> {
-
- public ToggleActionConfigConfigurationResolver() {
- super(ToggleActionConfig.class, AbstractButton.class);
- }
-
- protected ToggleActionConfig applyConfiguration0(AbstractButton component, MyAbstractAction action) {
- ToggleActionConfig anno = resolveConfiguration(action);
- if (anno == null) {
- return null;
- }
- // inject les données
- if (!anno.name().isEmpty()) {
- //System.out.println("found action with name : " + anno.name());
- action.putValue(Action.NAME, _(anno.name()));
- }
- if (!anno.name2().isEmpty()) {
- //System.out.println("found action with name2 : " + anno.name2());
- action.putValue(Action.NAME + "2", _(anno.name2()));
- }
-
- if (!anno.shortDescription().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION, _(anno.shortDescription()));
- }
- if (!anno.shortDescription2().isEmpty()) {
- action.putValue(Action.SHORT_DESCRIPTION + "2", _(anno.shortDescription2()));
- }
-
- if (!anno.smallIcon().isEmpty()) {
- action.putValue(Action.SMALL_ICON, org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon()));
- }
- if (!anno.smallIcon2().isEmpty()) {
- action.putValue(Action.SMALL_ICON + "2", org.codelutin.jaxx.util.UIHelper.createImageIcon(anno.smallIcon2()));
- }
-
- if (anno.mnemonic() != '\0') {
- action.putValue(Action.MNEMONIC_KEY, anno.mnemonic());
- } else if (component != null) {
- action.putValue(Action.MNEMONIC_KEY, component.getMnemonic());
- }
- if (anno.mnemonic2() != '\0') {
- action.putValue(Action.MNEMONIC_KEY + "2", anno.mnemonic2());
- }
- //TODO Convert it from String action.putValue(Action.ACCELERATOR_KEY, anno.accelerator());
-
-
- action.putValue("hideActionText", anno.hideActionText());
- action.putValue(Action.SELECTED_KEY, anno.selected());
- action.setEnabled(anno.enabled());
-
- return anno;
- }
-}
\ No newline at end of file
1
0