Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
December 2009
- 2 participants
- 44 discussions
r1704 - in trunk: . jaxx-demo jaxx-demo/src/main/resources/i18n jaxx-widgets/src/main/resources/i18n maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin
by tchemit@users.nuiton.org 29 Dec '09
by tchemit@users.nuiton.org 29 Dec '09
29 Dec '09
Author: tchemit
Date: 2009-12-29 18:45:48 +0100 (Tue, 29 Dec 2009)
New Revision: 1704
Modified:
trunk/jaxx-demo/pom.xml
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
trunk/pom.xml
Log:
use last version of mavenpom and i18n
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/jaxx-demo/pom.xml 2009-12-29 17:45:48 UTC (rev 1704)
@@ -179,6 +179,7 @@
<execution>
<goals>
<goal>parserJava</goal>
+ <goal>gen</goal>
<goal>bundle</goal>
</goals>
</execution>
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-12-29 17:45:48 UTC (rev 1704)
@@ -34,7 +34,6 @@
Editable=
Email\ Address\:=
Email\:=
-Empty\ I18n\ editor\:=
Enabled=
EnumEditor\ (country)\ \:=
EnumEditor\ (language)\ \:=
@@ -49,9 +48,6 @@
Green\:=
Greet=
Help=
-I18n\ editor\ with\ no\ icon\ \:=
-I18n\ editor\ with\ no\ text\ \:=
-I18n\ editor\:=
Inc\ (+)=
Italic=
JAXX\ Demo=
@@ -111,7 +107,6 @@
edit=Edit
edit2=Edit 2
edit3=Edit 3
-editor.getSelectedLocale()=
f0=
f1=
file...=
@@ -167,9 +162,7 @@
jaxxdemo.config.configFileName.description=Configuration file name
jaxxdemo.config.ui.=
jaxxdemo.config.ui.demo.path=
-jaxxdemo.config.ui.fontSize=
jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
-jaxxdemo.config.ui.locale=Locale of the application
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Popup title
jaxxdemo.i18neditor.selected.locale=Selected Language
@@ -230,19 +223,9 @@
model1.isF0()\ ||\ model1.isF1()=
model1.isF1()=
movies=Movies
-numbereditor.normal.float=Signed float
-numbereditor.normal.int=Signed integer
-numbereditor.positive.float=Positive float
-numbereditor.positive.int=Positive integer
-numbereditor.type=Type
-numbereditor.with.auto.popup=With auto popup
-numbereditor.without.auto.popup=Without auto popup
-show/hide\ label1=
-show/hide\ label2=
t0.isSelected()=
t0.isSelected()\ &&\ t1.isSelected()=
t0.isSelected()\ ||\ t1.isSelected()=
t1.isSelected()=
-test=
valid=
x=
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-12-29 17:45:48 UTC (rev 1704)
@@ -34,7 +34,6 @@
Editable=Editable
Email\ Address\:=Courriel
Email\:=Courriel
-Empty\ I18n\ editor\:=Editeur I18n vide
Enabled=Activ\u00E9
EnumEditor\ (country)\ \:=Editeur de pays
EnumEditor\ (language)\ \:=Editeur de langue
@@ -49,9 +48,6 @@
Green\:=Vert \:
Greet=
Help=
-I18n\ editor\ with\ no\ icon\ \:=Editeur I18n sans icone \:
-I18n\ editor\ with\ no\ text\ \:=Editeur I18n sans texte \:
-I18n\ editor\:=Editeur I18n
Inc\ (+)=Incr\u00E9menter (+)
Italic=Italique
JAXX\ Demo=
@@ -111,7 +107,6 @@
edit=Editer
edit2=Editer 2
edit3=Editer 3
-editor.getSelectedLocale()=
f0=
f1=
file...=
@@ -167,9 +162,7 @@
jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
jaxxdemo.config.ui.=
jaxxdemo.config.ui.demo.path=
-jaxxdemo.config.ui.fontSize=
jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
-jaxxdemo.config.ui.locale=Langue utilis\u00E9e par l'application (fr_FR, en_GB ou es_ES)
jaxxdemo.i18neditor.configuration=Configuration
jaxxdemo.i18neditor.popupBorderText=Titre de la popup
jaxxdemo.i18neditor.selected.locale=Langue s\u00E9lectionn\u00E9e
@@ -230,19 +223,9 @@
model1.isF0()\ ||\ model1.isF1()=
model1.isF1()=
movies=Films
-numbereditor.normal.float=D\u00E9cimal primitif \: [%1$s]
-numbereditor.normal.int=Entier primitif \: [%1$s]
-numbereditor.positive.float=D\u00E9cimal primitif positif \: [%1$s]
-numbereditor.positive.int=Entier primitif positif \: [%1$s]
-numbereditor.type=Type d'\u00E9diteur
-numbereditor.with.auto.popup=Avec popup auto
-numbereditor.without.auto.popup=Sans popup auto
-show/hide\ label1=
-show/hide\ label2=
t0.isSelected()=
t0.isSelected()\ &&\ t1.isSelected()=
t0.isSelected()\ ||\ t1.isSelected()=
t1.isSelected()=
-test=
valid=valide
x=x
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2009-12-29 17:45:48 UTC (rev 1704)
@@ -1,64 +1,64 @@
-aboutframe.about=\u00c0 propos
+aboutframe.about=\u00C0 propos
aboutframe.license=Licence
aboutframe.ok=OK
aboutframe.thirdparty=Tierce partie
-columnselector.action.tip=S\u00e9lectionner les colonnes
+columnselector.action.tip=S\u00E9lectionner les colonnes
config.action.quit=Quitter
-config.action.quit.tip=Quitter l'\u00e9diteur de configuration
+config.action.quit.tip=Quitter l'\u00E9diteur de configuration
config.action.reset=Annuler
-config.action.reset.tip=Annuler les modifications de cette cat\u00e9gorie
+config.action.reset.tip=Annuler les modifications de cette cat\u00E9gorie
config.action.save=Enregistrer
-config.action.save.tip=Sauver les modifications de cette cat\u00e9gorie
-config.category.needReloadApplication=Cat\u00e9gorie '%1$s' \:
-config.category.needReloadUI=Cat\u00e9gorie '%1$s' \:
-config.category.saved=La cat\u00e9gorie '%1$s' a \u00e9t\u00e9 modifi\u00e9e \:
+config.action.save.tip=Sauver les modifications de cette cat\u00E9gorie
+config.category.needReloadApplication=Cat\u00E9gorie '%1$s' \:
+config.category.needReloadUI=Cat\u00E9gorie '%1$s' \:
+config.category.saved=La cat\u00E9gorie '%1$s' a \u00E9t\u00E9 modifi\u00E9e \:
config.choice.cancel=Annuler
config.choice.continue=Continuer
config.choice.doNotSave=Ne pas enregistrer
config.choice.ok=Ok
config.choice.save=Enregistrer
-config.defaultValue=Valeur par d\u00e9faut
-config.defaultValue.tip=Valeur par d\u00e9faut de l'option
+config.defaultValue=Valeur par d\u00E9faut
+config.defaultValue.tip=Valeur par d\u00E9faut de l'option
config.descrition=Description
-config.error.category.already.exists=La cat\u00e9gorie de nom '%1$s' existe d\u00e9j\u00e0\!
-config.error.category.not.found=La cat\u00e9gorie de nom '%1$s' n'existe pas\!
+config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\!
+config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\!
config.key=Clef
config.key.tip=Clef de l'option
-config.message.quit.invalid.category=La cat\u00e9gorie '%1$s' n'est pas valide\!
-config.message.quit.valid.and.modified.category=La cat\u00e9gorie '%1$s' poss\u00e8dent des options modifi\u00e9es \:
-config.model.needReloadApplication=Des options ont \u00e9t\u00e9 modifi\u00e9es qui n\u00e9cessitent le red\u00e9marrage de l'application.\n
-config.model.needReloadUI=Des options ont \u00e9t\u00e9 modifi\u00e9es qui n\u00e9cessitent le red\u00e9marrage de l'interface graphique.\n
-config.modified=Option modifi\u00e9e (valeur originale \: %1$s)
-config.no.option.selected=< Pas d'option s\u00e9lectionn\u00e9e >
+config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\!
+config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \:
+config.model.needReloadApplication=Des options ont \u00E9t\u00E9 modifi\u00E9es qui n\u00E9cessitent le red\u00E9marrage de l'application.\n
+config.model.needReloadUI=Des options ont \u00E9t\u00E9 modifi\u00E9es qui n\u00E9cessitent le red\u00E9marrage de l'interface graphique.\n
+config.modified=Option modifi\u00E9e (valeur originale \: %1$s)
+config.no.option.selected=< Pas d'option s\u00E9lectionn\u00E9e >
config.option.final=Option non modifiable
config.option.label=Option '%1$s' (%2$s)
-config.option.modified=Valeur modifi\u00e9e < ancienne valeur \: '%1$s' - nouvelle valeur \: '%2$s' >
-config.title=Pr\u00e9f\u00e9rences
+config.option.modified=Valeur modifi\u00E9e < ancienne valeur \: '%1$s' - nouvelle valeur \: '%2$s' >
+config.title=Pr\u00E9f\u00E9rences
config.title.need.confirm=Une confirmation de votre part est requise...
-config.title.will.reload.application=L'application doit \u00eatre red\u00e9marrer...
-config.title.will.reload.ui=L'interface graphique doit \u00eatre relancer...
-config.unmodifiable=Ne peut pas \u00eatre modifi\u00e9
+config.title.will.reload.application=L'application doit \u00EAtre red\u00E9marrer...
+config.title.will.reload.ui=L'interface graphique doit \u00EAtre relancer...
+config.unmodifiable=Ne peut pas \u00EAtre modifi\u00E9
config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s)
config.value=Valeur
config.value.tip=Valeur de l'option
-entitycombobox.action.reset.tip=R\u00e9initialiser la valeur de la liste d\u00e9roulante
-entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00e9roulante
+entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante
+entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante
entitycombobox.popup.label=Objet '%1$s'
entitycombobox.popup.title=Modifier le tri
-entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00e9t\u00e9 '%1$s'
-entitycombobox.sort.on=Le tri est effectu\u00e9 sur la propri\u00e9t\u00e9 '%1$s'
+entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s'
+entitycombobox.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s'
entitycombobox.unknown.type=Objet de type inconnu
errorUI.action.close=Fermer
errorUI.message=Une erreur est survenue \!
errorUI.title=Erreur...
-fontsize.action.default.tip=Retour sur la taille par d\u00e9faut
+fontsize.action.default.tip=Retour sur la taille par d\u00E9faut
fontsize.action.down.tip=Diminuer la taille de la police
fontsize.action.up.tip=Augmenter la taille de la police
hidor.hideTip=Cacher
hidor.showTip=Voir
-i18neditor.empty.locales=< Aucune locale \u00e0 s\u00e9lectionner >
+i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner >
i18neditor.popup.title=Changer de langue
-i18neditor.selected=Langue actuellement utilis\u00e9e \: %1$s
+i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s
i18neditor.unselected=Pour utiliser cette langue \: %1$s
listSelector.hideList=Cacher la liste
listSelector.showList=Afficher la liste
@@ -74,8 +74,8 @@
numbereditor.7=7
numbereditor.8=8
numbereditor.9=9
-numbereditor.action.reset.tip=R\u00e9initialiser
-numbereditor.action.show.tip=Afficher le pav\u00e9 num\u00e9rique
+numbereditor.action.reset.tip=R\u00E9initialiser
+numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique
numbereditor.clearAll=C
numbereditor.clearOne=CE
numbereditor.toggleSign=+/-
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java 2009-12-29 17:45:48 UTC (rev 1704)
@@ -18,6 +18,7 @@
* ##%*/
package org.nuiton.jaxx.plugin;
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.plugin.MojoFailureException;
import org.nuiton.i18n.I18n;
@@ -105,9 +106,10 @@
protected abstract void postDoAction();
@Override
- protected boolean init() throws Exception {
+ protected void init() throws Exception {
+// protected boolean init() throws Exception {
- if (locales == null || locales.trim().isEmpty()) {
+ if (StringUtils.isEmpty(locales)) {
throw new MojoFailureException("You must set the 'locales' property properly (was " + locales + ").");
}
@@ -123,7 +125,7 @@
}
if (tmp.isEmpty()) {
- throw new MojoFailureException("you must set the 'locales' property.");
+ throw new MojoFailureException("No locale to react, you must set the 'locales' property.");
}
localesToTreate = tmp.toArray(new Locale[tmp.size()]);
@@ -131,15 +133,24 @@
createDirectoryIfNecessary(getTargetDirectory());
+// return true;
+ }
+
+ @Override
+ protected boolean checkSkip() {
+ if (!generateHelp) {
+ getLog().info("generateHelp flag is off, will skip goal.");
+ return false;
+ }
return true;
}
@Override
protected void doAction() throws Exception {
- if (skipAction()) {
- return;
- }
+// if (skipAction()) {
+// return;
+// }
for (Locale locale : localesToTreate) {
@@ -160,13 +171,13 @@
postDoAction();
}
- protected boolean skipAction() {
- if (!generateHelp) {
- getLog().info("generateHelp flag is off, generate nothing.");
- return true;
- }
- return false;
- }
+// protected boolean skipAction() {
+// if (!generateHelp) {
+// getLog().info("generateHelp flag is off, will skip goal.");
+// return true;
+// }
+// return false;
+// }
public File getOutputHelpIds() {
return outputHelpIds;
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java 2009-12-29 17:45:48 UTC (rev 1704)
@@ -18,14 +18,11 @@
* ##%*/
package org.nuiton.jaxx.plugin;
-import org.apache.maven.model.Resource;
import org.apache.maven.project.MavenProject;
import org.nuiton.plugin.AbstractPlugin;
import org.nuiton.util.FileUtil;
import java.io.File;
-import java.io.IOException;
-import java.util.List;
/**
* Abstract Jaxx Mojo.
@@ -82,7 +79,9 @@
@Override
protected boolean checkPackaging() {
- return project != null && !"pom".equals(project.getPackaging()) && !"site".equals(project.getPackaging());
+ // not accept pom modules
+ return !acceptPackaging(Packaging.pom);
+// return project != null && !"pom".equals(project.getPackaging()) && !"site".equals(project.getPackaging());
}
@Override
@@ -121,78 +120,12 @@
this.force = force;
}
- /**
- * TODO-TC20091221 Should move this to AbstractPlugin
- * Create the directory if necessary.
- *
- * @param dir the directory to create if not already existing
- * @throws IOException if could not create the directory
- */
- protected void createDirectoryIfNecessary(File dir) throws IOException {
- if (!dir.exists()) {
- if (verbose) {
- getLog().info("mkdir " + dir);
- }
- boolean b = dir.mkdirs();
- if (!b) {
- throw new IOException("could not create directory " + dir);
- }
- }
- }
-
- //TODO-TC20091221 move this api to PluginHelper
- public static boolean addResourceDir(File dir, MavenProject project, String... includes) {
- List<?> resources = project.getResources();
- boolean added = addResourceDir(dir, project, resources, includes);
- return added;
- }
-
- //TODO-TC20091221 move this api to PluginHelper
- public static boolean addTestResourceDir(File newresourceDir, MavenProject project, String... includes) {
- List<?> resources = project.getTestResources();
- boolean added = addResourceDir(newresourceDir, project, resources, includes);
- return added;
- }
-
- //TODO-TC20091221 move this api to PluginHelper
- public static boolean addResourceDir(File dir, MavenProject project, List<?> resources, String... includes) {
- String newresourceDir = dir.getAbsolutePath();
- boolean shouldAdd = true;
- for (Object o : resources) {
- Resource r = (Resource) o;
- if (!r.getDirectory().equals(newresourceDir)) {
- continue;
- }
-
- for (String i : includes) {
- if (!r.getIncludes().contains(i)) {
- r.addInclude(i);
- }
- }
- shouldAdd = false;
- break;
- }
- if (shouldAdd) {
- Resource r = new Resource();
- r.setDirectory(newresourceDir);
- for (String i : includes) {
- if (!r.getIncludes().contains(i)) {
- r.addInclude(i);
- }
- }
- project.addResource(r);
- }
- return shouldAdd;
- }
-
-
class GetLastModifiedFileAction implements FileUtil.FileAction {
protected File lastFile;
public GetLastModifiedFileAction(File lastFile) {
this.lastFile = lastFile;
-
}
@Override
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2009-12-29 17:45:48 UTC (rev 1704)
@@ -31,7 +31,7 @@
/**
* Mojo to generate javax help files for your project.
- *
+ *
* @author chemit
* @goal generate-help-files
* @phase process-sources
@@ -115,6 +115,7 @@
protected String indexFileName;
protected String tocFileName;
protected int touchedFiles;
+ protected File idsFile;
/**
* The help ids discovered.
@@ -132,11 +133,13 @@
}
@Override
- public boolean init() throws Exception {
+ public void init() throws Exception {
+// public boolean init() throws Exception {
if (!generateHelp) {
+ return;
+// return true;
+ }
- return true;
- }
// check ressources
checkResource(helpsetTemplate);
checkResource(mapTemplate);
@@ -149,68 +152,96 @@
tocFileName = helpsetName + "TOC.xml";
touchedFiles = 0;
- boolean b = super.init();
- if (!b) {
- return false;
- }
+ super.init();
+// boolean b = super.init();
+// if (!b) {
+// return false;
+// }
+
// load ids from idsStore file
- File idsFile;
+// File idsFile;
if (isForce()) {
idsFile = getMergeHelpIdsStoreFile();
- if (!idsFile.exists()) {
- if (isVerbose()) {
- getLog().info("Force flag is on, but no helpIdStore-all to react at " + idsFile);
- }
- return true;
- }
+// if (!idsFile.exists()) {
+// if (isVerbose()) {
+// getLog().info("Force flag is on, but no helpIdStore-all to react at " + idsFile);
+// }
+// return true;
+// }
} else {
idsFile = getHelpIdsStoreFile();
- if (!idsFile.exists()) {
- if (isVerbose()) {
- getLog().info("no helpIdStore to react at " + idsFile);
- }
- return true;
- }
+// if (!idsFile.exists()) {
+// if (isVerbose()) {
+// getLog().info("no helpIdStore to react at " + idsFile);
+// }
+// return true;
+// }
}
+ if (!idsFile.exists()) {
+ return;
+ }
+
helpIds = new SortedProperties();
// loading all ids
Set<String> ids = loadHelpIds(idsFile);
- if (ids.isEmpty()) {
+// if (ids.isEmpty()) {
+//
+// // no ids detected
+// if (isVerbose()) {
+// getLog().info("No helpIds detected, will skip.");
+// }
+// return true;
+// }
- // no ids detected
- if (isVerbose()) {
- getLog().info("No helpIds detected, will skip.");
- }
- return true;
- }
-
for (String id : ids) {
String path = id.replaceAll("\\.", File.separator) + ".html";
helpIds.put(id, path);
}
- return true;
+// return true;
}
@Override
- protected boolean skipAction() {
- boolean b = super.skipAction();
- if (!b) {
+ protected boolean checkSkip() {
+ boolean b = super.checkSkip();
+ if (b) {
+
+ if (!idsFile.exists()) {
+ // pas de fichier a traiter
+ if (isForce()) {
+ getLog().info("Force flag is on, but no helpIdStore-all to react at " + idsFile);
+ } else {
+ getLog().info("no helpIdStore to react at " + idsFile);
+ }
+ return false;
+ }
if (helpIds == null || helpIds.isEmpty()) {
getLog().info("No help ids to treate.");
- return true;
+ return false;
}
}
- return false;
+ return b;
}
// @Override
+// protected boolean skipAction() {
+// boolean b = super.skipAction();
+// if (!b) {
+// if (helpIds == null || helpIds.isEmpty()) {
+// getLog().info("No help ids to treate.");
+// return true;
+// }
+// }
+// return false;
+// }
+
+// @Override
// public void doAction() throws Exception {
//
// if (skipAction()) {
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java 2009-12-29 17:45:48 UTC (rev 1704)
@@ -9,7 +9,7 @@
/**
* Generate the help ids files from the previous jaxx generation.
- *
+ * <p/>
* Created: 22 déc. 2009
*
* @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
@@ -25,17 +25,26 @@
*/
public class GenerateHelpIdsMojo extends AbstractGenerateHelpMojo {
+ /**
+ * help ids to react.
+ */
+ protected Set<String> helpIds;
+
@Override
- public boolean init() throws Exception {
+ public void init() throws Exception {
+// public boolean init() throws Exception {
if (!generateHelp) {
- return true;
+ return;
+// return true;
}
- if (!super.init()) {
- return false;
- }
+ super.init();
+// if (!super.init()) {
+// return false;
+// }
+
// check there is some bundle
if (getHelpIdsFilename() == null) {
throw new MojoFailureException("you must set the 'helpIdStore' property.");
@@ -44,27 +53,48 @@
throw new MojoFailureException("you must set the 'helpIdStoreAll' property.");
}
- return true;
+ helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
+
+ // always clean helpIdsStore before all
+ cleanHelpIdsStore();
+
+// return true;
}
@Override
- public void doAction() throws Exception {
+ protected boolean checkSkip() {
+ boolean b = super.checkSkip();
+ if (b) {
- if (skipAction()) {
- return;
- }
-
- Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
-
- if (helpIds.isEmpty()) {
+ if (helpIds.isEmpty()) {
// if (isVerbose()) {
- // no ids detected in this compilation round
- getLog().info("No helpIds detected.");
+ // no ids detected in this compilation round
+ getLog().info("No help ids to treate, will skip goal.");
// }
- cleanHelpIdsStore();
- return;
+ return false;
+ }
}
+ return b;
+ }
+ @Override
+ public void doAction() throws Exception {
+
+// if (skipAction()) {
+// return;
+// }
+
+// Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
+//
+// if (helpIds.isEmpty()) {
+//// if (isVerbose()) {
+// // no ids detected in this compilation round
+// getLog().info("No helpIds detected.");
+//// }
+// cleanHelpIdsStore();
+// return;
+// }
+
// store current jaxx session detected help ids
File idsStore = getHelpIdsStoreFile();
@@ -92,6 +122,7 @@
@Override
protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File source, String localePath) throws Exception {
+ // nothing to do specific to locale
}
@Override
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java 2009-12-29 17:45:48 UTC (rev 1704)
@@ -45,12 +45,12 @@
public void setTargetDirectory(File targetDirectory) {
}
- @Override
- public boolean init() throws Exception {
+// @Override
+// public boolean init() throws Exception {
+//
+// return true;
+// }
- return true;
- }
-
@Override
public void doAction() throws Exception {
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java 2009-12-29 17:45:48 UTC (rev 1704)
@@ -59,19 +59,22 @@
protected String timestamp;
@Override
- public boolean init() throws Exception {
- if (!generateHelp) {
+ public void init() throws Exception {
+// public boolean init() throws Exception {
+ if (!generateHelp || !generateSearch) {
- return true;
+ return;
+// return true;
}
- if (!generateSearch) {
-// getLog().info("Do not generate search.");
- return true;
- }
+// if (!generateSearch) {
+//// getLog().info("Do not generate search.");
+// return true;
+// }
timestamp = "-" + System.currentTimeMillis();
- return super.init();
+ super.init();
+// return super.init();
}
@Override
@@ -84,18 +87,30 @@
this.outputHelpSearch = targetDirectory;
}
- protected boolean skipAction() {
- if (!generateHelp) {
- getLog().info("generateHelp flag is off, generate nothing.");
- return true;
+ @Override
+ protected boolean checkSkip() {
+ boolean b = super.checkSkip();
+ if (b) {
+ if (!generateSearch) {
+ getLog().info("generateHelpsearch flag is off, will skip goal.");
+ return false;
+ }
}
- if (!generateSearch) {
- getLog().info("generateHelpsearch flag is off, generate nothing.");
- return true;
- }
- return false;
+ return b;
}
+// protected boolean skipAction() {
+// if (!generateHelp) {
+// getLog().info("generateHelp flag is off, generate nothing.");
+// return true;
+// }
+// if (!generateSearch) {
+// getLog().info("generateHelpsearch flag is off, generate nothing.");
+// return true;
+// }
+// return false;
+// }
+
@Override
protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File source, String localePath) throws Exception {
@@ -165,7 +180,7 @@
protected void postDoAction() {
// add resources to the project
- addResourceDir(getTargetDirectory(), getProject(), "**/*");
+ addResourceDir(getTargetDirectory(), "**/*");
}
protected void generateSearchIndex(File source, File target, Locale locale) throws Exception {
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-12-29 17:45:48 UTC (rev 1704)
@@ -289,7 +289,8 @@
@SuppressWarnings("unchecked")
@Override
- public boolean init() throws Exception {
+ public void init() throws Exception {
+// public boolean init() throws Exception {
fixCompileSourceRoots();
@@ -306,7 +307,8 @@
nofiles = files == null || files.length == 0;
if (nofiles) {
- return true;
+ return;
+// return true;
}
cl = initClassLoader(getProject(),
@@ -359,16 +361,25 @@
getLog().info("will parse " + file);
}
}
+// return true;
+ }
+
+ @Override
+ protected boolean checkSkip() {
+ if (nofiles) {
+ getLog().info("Nothing to generate - all files are up to date.");
+ return false;
+ }
return true;
}
@Override
public void doAction() throws Exception {
- if (nofiles) {
- getLog().info("Nothing to generate - all files are uo to date.");
- return;
- }
+// if (nofiles) {
+// getLog().info("Nothing to generate - all files are uo to date.");
+// return;
+// }
getLog().info("Detects " + files.length + " modified jaxx file(s). ");
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
+++ trunk/pom.xml 2009-12-29 17:45:48 UTC (rev 1704)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom</artifactId>
- <version>1.1.3</version>
+ <version>1.1.4-SNAPSHOT</version>
</parent>
<artifactId>jaxx</artifactId>
@@ -355,7 +355,7 @@
<projectId>jaxx</projectId>
<lutinutil.version>1.1.0</lutinutil.version>
- <i18n.version>1.0.1</i18n.version>
+ <i18n.version>1.0.2-SNAPSHOT</i18n.version>
<jxlayer.version>3.0.3</jxlayer.version>
1
0
r1703 - in trunk: . jaxx-compiler jaxx-demo jaxx-runtime jaxx-swing-action jaxx-widgets maven-jaxx-plugin
by tchemit@users.nuiton.org 23 Dec '09
by tchemit@users.nuiton.org 23 Dec '09
23 Dec '09
Author: tchemit
Date: 2009-12-23 10:14:47 +0100 (Wed, 23 Dec 2009)
New Revision: 1703
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2009-12-23 09:14:42 UTC (rev 1702)
+++ trunk/jaxx-compiler/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3</version>
+ <version>2.0.0-beta-4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2009-12-23 09:14:42 UTC (rev 1702)
+++ trunk/jaxx-demo/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3</version>
+ <version>2.0.0-beta-4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2009-12-23 09:14:42 UTC (rev 1702)
+++ trunk/jaxx-runtime/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3</version>
+ <version>2.0.0-beta-4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2009-12-23 09:14:42 UTC (rev 1702)
+++ trunk/jaxx-swing-action/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3</version>
+ <version>2.0.0-beta-4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2009-12-23 09:14:42 UTC (rev 1702)
+++ trunk/jaxx-widgets/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3</version>
+ <version>2.0.0-beta-4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2009-12-23 09:14:42 UTC (rev 1702)
+++ trunk/maven-jaxx-plugin/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3</version>
+ <version>2.0.0-beta-4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-23 09:14:42 UTC (rev 1702)
+++ trunk/pom.xml 2009-12-23 09:14:47 UTC (rev 1703)
@@ -13,7 +13,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3</version>
+ <version>2.0.0-beta-4-SNAPSHOT</version>
<modules>
<module>jaxx-runtime</module>
@@ -401,9 +401,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-3</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-3</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-3</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
</scm>
</project>
1
0
Author: tchemit
Date: 2009-12-23 10:14:42 +0100 (Wed, 23 Dec 2009)
New Revision: 1702
Added:
tags/jaxx-2.0.0-beta-3/
Log:
[maven-scm] copy for tag jaxx-2.0.0-beta-3
1
0
r1701 - in trunk: . jaxx-compiler jaxx-demo jaxx-runtime jaxx-swing-action jaxx-widgets maven-jaxx-plugin
by tchemit@users.nuiton.org 23 Dec '09
by tchemit@users.nuiton.org 23 Dec '09
23 Dec '09
Author: tchemit
Date: 2009-12-23 10:14:38 +0100 (Wed, 23 Dec 2009)
New Revision: 1701
Modified:
trunk/jaxx-compiler/pom.xml
trunk/jaxx-demo/pom.xml
trunk/jaxx-runtime/pom.xml
trunk/jaxx-swing-action/pom.xml
trunk/jaxx-widgets/pom.xml
trunk/maven-jaxx-plugin/pom.xml
trunk/pom.xml
Log:
[maven-release-plugin] prepare release jaxx-2.0.0-beta-3
Modified: trunk/jaxx-compiler/pom.xml
===================================================================
--- trunk/jaxx-compiler/pom.xml 2009-12-23 08:58:25 UTC (rev 1700)
+++ trunk/jaxx-compiler/pom.xml 2009-12-23 09:14:38 UTC (rev 1701)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3-SNAPSHOT</version>
+ <version>2.0.0-beta-3</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-demo/pom.xml
===================================================================
--- trunk/jaxx-demo/pom.xml 2009-12-23 08:58:25 UTC (rev 1700)
+++ trunk/jaxx-demo/pom.xml 2009-12-23 09:14:38 UTC (rev 1701)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3-SNAPSHOT</version>
+ <version>2.0.0-beta-3</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-runtime/pom.xml
===================================================================
--- trunk/jaxx-runtime/pom.xml 2009-12-23 08:58:25 UTC (rev 1700)
+++ trunk/jaxx-runtime/pom.xml 2009-12-23 09:14:38 UTC (rev 1701)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3-SNAPSHOT</version>
+ <version>2.0.0-beta-3</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-swing-action/pom.xml
===================================================================
--- trunk/jaxx-swing-action/pom.xml 2009-12-23 08:58:25 UTC (rev 1700)
+++ trunk/jaxx-swing-action/pom.xml 2009-12-23 09:14:38 UTC (rev 1701)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3-SNAPSHOT</version>
+ <version>2.0.0-beta-3</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/jaxx-widgets/pom.xml
===================================================================
--- trunk/jaxx-widgets/pom.xml 2009-12-23 08:58:25 UTC (rev 1700)
+++ trunk/jaxx-widgets/pom.xml 2009-12-23 09:14:38 UTC (rev 1701)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3-SNAPSHOT</version>
+ <version>2.0.0-beta-3</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- trunk/maven-jaxx-plugin/pom.xml 2009-12-23 08:58:25 UTC (rev 1700)
+++ trunk/maven-jaxx-plugin/pom.xml 2009-12-23 09:14:38 UTC (rev 1701)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3-SNAPSHOT</version>
+ <version>2.0.0-beta-3</version>
</parent>
<groupId>org.nuiton.jaxx</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-23 08:58:25 UTC (rev 1700)
+++ trunk/pom.xml 2009-12-23 09:14:38 UTC (rev 1701)
@@ -1,5 +1,4 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -14,7 +13,7 @@
</parent>
<artifactId>jaxx</artifactId>
- <version>2.0.0-beta-3-SNAPSHOT</version>
+ <version>2.0.0-beta-3</version>
<modules>
<module>jaxx-runtime</module>
@@ -402,9 +401,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-3</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-3</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-3</url>
</scm>
</project>
1
0
23 Dec '09
Author: tchemit
Date: 2009-12-23 09:58:25 +0100 (Wed, 23 Dec 2009)
New Revision: 1700
Modified:
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
Log:
i18n
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2009-12-23 08:58:07 UTC (rev 1699)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties 2009-12-23 08:58:25 UTC (rev 1700)
@@ -1,64 +1,64 @@
-aboutframe.about=\u00C0 propos
+aboutframe.about=\u00c0 propos
aboutframe.license=Licence
aboutframe.ok=OK
aboutframe.thirdparty=Tierce partie
-columnselector.action.tip=S\u00E9lectionner les colonnes
+columnselector.action.tip=S\u00e9lectionner les colonnes
config.action.quit=Quitter
-config.action.quit.tip=Quitter l'\u00E9diteur de configuration
+config.action.quit.tip=Quitter l'\u00e9diteur de configuration
config.action.reset=Annuler
-config.action.reset.tip=Annuler les modifications de cette cat\u00E9gorie
+config.action.reset.tip=Annuler les modifications de cette cat\u00e9gorie
config.action.save=Enregistrer
-config.action.save.tip=Sauver les modifications de cette cat\u00E9gorie
-config.category.needReloadApplication=Cat\u00E9gorie '%1$s' \:
-config.category.needReloadUI=Cat\u00E9gorie '%1$s' \:
-config.category.saved=La cat\u00E9gorie '%1$s' a \u00E9t\u00E9 modifi\u00E9e \:
+config.action.save.tip=Sauver les modifications de cette cat\u00e9gorie
+config.category.needReloadApplication=Cat\u00e9gorie '%1$s' \:
+config.category.needReloadUI=Cat\u00e9gorie '%1$s' \:
+config.category.saved=La cat\u00e9gorie '%1$s' a \u00e9t\u00e9 modifi\u00e9e \:
config.choice.cancel=Annuler
config.choice.continue=Continuer
config.choice.doNotSave=Ne pas enregistrer
config.choice.ok=Ok
config.choice.save=Enregistrer
-config.defaultValue=Valeur par d\u00E9faut
-config.defaultValue.tip=Valeur par d\u00E9faut de l'option
+config.defaultValue=Valeur par d\u00e9faut
+config.defaultValue.tip=Valeur par d\u00e9faut de l'option
config.descrition=Description
-config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\!
-config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\!
+config.error.category.already.exists=La cat\u00e9gorie de nom '%1$s' existe d\u00e9j\u00e0\!
+config.error.category.not.found=La cat\u00e9gorie de nom '%1$s' n'existe pas\!
config.key=Clef
config.key.tip=Clef de l'option
-config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\!
-config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \:
-config.model.needReloadApplication=Des options ont \u00E9t\u00E9 modifi\u00E9s qui n\u00E9cessitent le red\u00E9marrage de l'application.\n
-config.model.needReloadUI=Des options ont \u00E9t\u00E9 modifi\u00E9s qui n\u00E9cessitent le red\u00E9marrage de l'interface graphique.\n
-config.modified=Option modifi\u00E9e (valeur originale \: %1$s)
-config.no.option.selected=< Pas d'option s\u00E9lectionn\u00E9e >
+config.message.quit.invalid.category=La cat\u00e9gorie '%1$s' n'est pas valide\!
+config.message.quit.valid.and.modified.category=La cat\u00e9gorie '%1$s' poss\u00e8dent des options modifi\u00e9es \:
+config.model.needReloadApplication=Des options ont \u00e9t\u00e9 modifi\u00e9es qui n\u00e9cessitent le red\u00e9marrage de l'application.\n
+config.model.needReloadUI=Des options ont \u00e9t\u00e9 modifi\u00e9es qui n\u00e9cessitent le red\u00e9marrage de l'interface graphique.\n
+config.modified=Option modifi\u00e9e (valeur originale \: %1$s)
+config.no.option.selected=< Pas d'option s\u00e9lectionn\u00e9e >
config.option.final=Option non modifiable
config.option.label=Option '%1$s' (%2$s)
-config.option.modified=Valeur modifi\u00E9e < ancienne valeur \: '%1$s' - nouvelle valeur \: '%2$s' >
-config.title=Pr\u00E9f\u00E9rences
+config.option.modified=Valeur modifi\u00e9e < ancienne valeur \: '%1$s' - nouvelle valeur \: '%2$s' >
+config.title=Pr\u00e9f\u00e9rences
config.title.need.confirm=Une confirmation de votre part est requise...
-config.title.will.reload.application=L'application doit \u00EAtre red\u00E9marrer...
-config.title.will.reload.ui=L'interface graphique doit \u00EAtre relancer...
-config.unmodifiable=Ne peut pas \u00EAtre modifi\u00E9
+config.title.will.reload.application=L'application doit \u00eatre red\u00e9marrer...
+config.title.will.reload.ui=L'interface graphique doit \u00eatre relancer...
+config.unmodifiable=Ne peut pas \u00eatre modifi\u00e9
config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s)
config.value=Valeur
config.value.tip=Valeur de l'option
-entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante
-entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante
+entitycombobox.action.reset.tip=R\u00e9initialiser la valeur de la liste d\u00e9roulante
+entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00e9roulante
entitycombobox.popup.label=Objet '%1$s'
entitycombobox.popup.title=Modifier le tri
-entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s'
-entitycombobox.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s'
+entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00e9t\u00e9 '%1$s'
+entitycombobox.sort.on=Le tri est effectu\u00e9 sur la propri\u00e9t\u00e9 '%1$s'
entitycombobox.unknown.type=Objet de type inconnu
errorUI.action.close=Fermer
errorUI.message=Une erreur est survenue \!
errorUI.title=Erreur...
-fontsize.action.default.tip=Retour sur la taille par d\u00E9faut
+fontsize.action.default.tip=Retour sur la taille par d\u00e9faut
fontsize.action.down.tip=Diminuer la taille de la police
fontsize.action.up.tip=Augmenter la taille de la police
hidor.hideTip=Cacher
hidor.showTip=Voir
-i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner >
+i18neditor.empty.locales=< Aucune locale \u00e0 s\u00e9lectionner >
i18neditor.popup.title=Changer de langue
-i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s
+i18neditor.selected=Langue actuellement utilis\u00e9e \: %1$s
i18neditor.unselected=Pour utiliser cette langue \: %1$s
listSelector.hideList=Cacher la liste
listSelector.showList=Afficher la liste
@@ -74,8 +74,8 @@
numbereditor.7=7
numbereditor.8=8
numbereditor.9=9
-numbereditor.action.reset.tip=R\u00E9initialiser
-numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique
+numbereditor.action.reset.tip=R\u00e9initialiser
+numbereditor.action.show.tip=Afficher le pav\u00e9 num\u00e9rique
numbereditor.clearAll=C
numbereditor.clearOne=CE
numbereditor.toggleSign=+/-
1
0
r1699 - trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin
by tchemit@users.nuiton.org 23 Dec '09
by tchemit@users.nuiton.org 23 Dec '09
23 Dec '09
Author: tchemit
Date: 2009-12-23 09:58:07 +0100 (Wed, 23 Dec 2009)
New Revision: 1699
Added:
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java
Modified:
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
Log:
improve help mojo (dettach it from the jaxx generate mojo)
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java 2009-12-23 08:49:38 UTC (rev 1698)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java 2009-12-23 08:58:07 UTC (rev 1699)
@@ -20,18 +20,9 @@
import org.apache.maven.plugin.MojoFailureException;
import org.nuiton.i18n.I18n;
-import org.nuiton.plugin.VelocityTemplateGenerator;
-import org.nuiton.util.SortedProperties;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Properties;
+import java.io.*;
+import java.util.*;
/**
* Abstract Mojo to generate help stuff.
@@ -41,16 +32,7 @@
*/
public abstract class AbstractGenerateHelpMojo extends AbstractJaxxMojo {
- protected static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE";
/**
- * The directory where to create or update help files.
- *
- * @parameter expression="${jaxx.outHelp}" default-value="${project.basedir}/src/main/help"
- * @required
- * @since 1.3
- */
- protected File outHelp;
- /**
* The locales to generate for help, separeted by comma.
* <p/>
* The first locale given is the default locale.
@@ -61,14 +43,32 @@
*/
protected String locales;
/**
- * The name of the helpset to generate.
+ * Where to generate helpIds files.
*
- * @parameter expression="${jaxx.helpsetName}" default-value="${project.artifactId}"
+ * @parameter expression="${jaxx.outputHelpIds}" default-value="target/generated-sources/jaxx"
* @required
* @since 1.3
*/
- protected String helpsetName;
+ private File outputHelpIds;
/**
+ * The store of helpIds generated by the goal {@link GenerateMojo} and then
+ * used by the goal {@link GenerateHelpMojo}.
+ *
+ * @parameter expression="${jaxx.helpIdsFilename}" default-value="helpIds.properties"
+ * @required
+ * @since 1.3
+ */
+ private String helpIdsFilename;
+ /**
+ * The store of cumulate helpIds generated by the goal {@link GenerateMojo} and then
+ * used by the goal {@link GenerateHelpMojo}.
+ *
+ * @parameter expression="${jaxx.mergeHelpIdsFilename}" default-value="helpIds-all.properties"
+ * @required
+ * @since 1.3
+ */
+ private String mergeHelpIdsFilename;
+ /**
* Flag to generate the search index.
*
* @parameter expression="${jaxx.generateSearch}" default-value="true"
@@ -77,28 +77,27 @@
*/
protected boolean generateSearch;
/**
- * The help ids discovered in {@link #helpIdsStore} files.
- */
- protected static Properties helpIds;
- /**
* Default locale (the first locale in {@link #localesToTreate}.
*/
- protected Locale defaultLocale;
+ private Locale defaultLocale;
/**
* Locales to treate
*/
- protected Locale[] localesToTreate;
+ private Locale[] localesToTreate;
/**
* Do the action for the given locale.
*
* @param locale the locale to treate
* @param isDefaultLocale {@code true} if given locale is de the default locale
- * @param localizedTarget where are stored help files for the given locale
+ * @param source where are stored help files for the given locale
* @param localePath the locale path to use (is {@code default} if given locale is default).
* @throws Exception if any pb
*/
- protected abstract void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception;
+ protected abstract void doActionForLocale(Locale locale,
+ boolean isDefaultLocale,
+ File source,
+ String localePath) throws Exception;
/**
* Call back after doing all stuff for all locales declared
@@ -106,22 +105,15 @@
protected abstract void postDoAction();
@Override
- public boolean init() throws Exception {
+ protected boolean init() throws Exception {
- File idsStore = getHelpIdsStore();
-
- if (!idsStore.exists()) {
- getLog().info("no helpIdStore to react at " + idsStore);
- return false;
- }
-
if (locales == null || locales.trim().isEmpty()) {
throw new MojoFailureException("You must set the 'locales' property properly (was " + locales + ").");
}
// check there is a outHelp
- if (outHelp == null) {
- throw new MojoFailureException("You must set the 'outHelp' property.");
+ if (getTargetDirectory() == null) {
+ throw new MojoFailureException("You must set the 'outputHelpXXX' property.");
}
List<Locale> tmp = new ArrayList<Locale>();
@@ -139,32 +131,16 @@
createDirectoryIfNecessary(getTargetDirectory());
- // load ids from idsStore file (only once by session)
-
- if (helpIds == null) {
- helpIds = new SortedProperties();
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(idsStore), getEncoding()));
- String id;
- while ((id = reader.readLine()) != null) {
- id = id.trim();
- String path = id.replaceAll("\\.", File.separator) + ".html";
- helpIds.put(id, path);
- }
-
- if (helpIds.isEmpty()) {
-
- // no ids detected
- getLog().warn("No helpIds detected, will skip.");
- return false;
- }
- }
return true;
}
@Override
- public final void doAction() throws Exception {
+ protected void doAction() throws Exception {
+ if (skipAction()) {
+ return;
+ }
+
for (Locale locale : localesToTreate) {
boolean isDefaultLocale = locale == defaultLocale;
@@ -173,39 +149,114 @@
String localePath = (isDefaultLocale ? "default" : language);
- File localizedTarget = new File(outHelp, localePath);
+ File source = new File(getTargetDirectory(), localePath);
- createDirectoryIfNecessary(localizedTarget);
+ createDirectoryIfNecessary(source);
- doActionForLocale(locale, isDefaultLocale, localizedTarget, localePath);
+ doActionForLocale(locale, isDefaultLocale, source, localePath);
}
postDoAction();
}
- @Override
- public File getTargetDirectory() {
- return outHelp;
+ protected boolean skipAction() {
+ if (!generateHelp) {
+ getLog().info("generateHelp flag is off, generate nothing.");
+ return true;
+ }
+ return false;
}
- @Override
- public void setTargetDirectory(File targetDirectory) {
- this.outHelp = targetDirectory;
+ public File getOutputHelpIds() {
+ return outputHelpIds;
}
- protected void doGen(File template, File f, Properties env) throws Exception {
- VelocityTemplateGenerator gen = prepareGenerator(template);
- gen.generate(env, f);
+ public void setOutputHelpIds(File outputHelpIds) {
+ this.outputHelpIds = outputHelpIds;
}
- protected VelocityTemplateGenerator prepareGenerator(File template) throws Exception {
- URL templateURL = getTemplate(template);
+ public File getHelpIdsStoreFile() {
+ return outputHelpIds == null ? null : new File(outputHelpIds, helpIdsFilename);
+ }
- if (verbose) {
- getLog().info("using template " + templateURL);
+ public File getMergeHelpIdsStoreFile() {
+ return outputHelpIds == null ? null : new File(outputHelpIds, mergeHelpIdsFilename);
+ }
+
+ public String getHelpIdsFilename() {
+ return helpIdsFilename;
+ }
+
+ public void setHelpIdsFilename(String helpIdsFilename) {
+ this.helpIdsFilename = helpIdsFilename;
+ }
+
+ public String getMergeHelpIdsFilename() {
+ return mergeHelpIdsFilename;
+ }
+
+ public void setMergeHelpIdsFilename(String mergeHelpIdsFilename) {
+ this.mergeHelpIdsFilename = mergeHelpIdsFilename;
+ }
+
+ protected void cleanHelpIdsStore() throws IOException {
+ File idsStore = getHelpIdsStoreFile();
+ if (idsStore.exists()) {
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("delete id store " + idsStore);
+ }
+ boolean b = idsStore.delete();
+ if (!b) {
+ throw new IOException("could not delete file " + idsStore);
+ }
}
- VelocityTemplateGenerator gen = new VelocityTemplateGenerator(project, templateURL);
- return gen;
}
+
+ protected Set<String> loadHelpIds(File file) throws IOException {
+
+ BufferedReader reader = null;
+ Set<String> result = new HashSet<String>();
+ try {
+ reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), getEncoding()));
+ String id;
+ while ((id = reader.readLine()) != null) {
+ result.add(id.trim());
+ }
+ if (isVerbose()) {
+ getLog().info("load " + result.size() + " help ids from file " + file);
+ }
+ return result;
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+
+ protected void storeHelpIds(File file, Set<String> ids) throws IOException {
+
+ createDirectoryIfNecessary(file.getParentFile());
+
+ StringBuilder buffer = new StringBuilder();
+
+ for (String helpId : ids) {
+ buffer.append(removeQuote(helpId)).append('\n');
+ }
+ writeFile(file, buffer.toString(), getEncoding());
+ if (isVerbose()) {
+ getLog().info("stored " + ids.size() + " help ids in " + file);
+ }
+ }
+
+ protected String removeQuote(String txt) {
+ if (txt.startsWith("\"")) {
+ txt = txt.substring(1);
+ }
+ if (txt.endsWith("\"")) {
+ txt = txt.substring(0, txt.length() - 1);
+ }
+ return txt;
+ }
+
}
\ No newline at end of file
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java 2009-12-23 08:49:38 UTC (rev 1698)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java 2009-12-23 08:58:07 UTC (rev 1699)
@@ -20,18 +20,17 @@
import org.apache.maven.model.Resource;
import org.apache.maven.project.MavenProject;
+import org.nuiton.plugin.AbstractPlugin;
+import org.nuiton.util.FileUtil;
import java.io.File;
import java.io.IOException;
import java.util.List;
-import org.nuiton.plugin.AbstractPlugin;
-
/**
- * Abract Jaxx Mojo.
+ * Abstract Jaxx Mojo.
*
* @author chemit
- *
* @since 1.3
*/
public abstract class AbstractJaxxMojo extends AbstractPlugin {
@@ -39,6 +38,7 @@
public abstract File getTargetDirectory();
public abstract void setTargetDirectory(File targetDirectory);
+
/**
* Dépendance du projet.
*
@@ -46,32 +46,39 @@
* @required
* @readonly
*/
- protected MavenProject project;
+ private MavenProject project;
/**
* Encoding pour la generation des fichiers
*
* @parameter expression="${jaxx.encoding}" default-value="${project.build.sourceEncoding}"
* @since 2.0.0
*/
- protected String encoding;
+ private String encoding;
/**
* verbose flag
*
* @parameter expression="${jaxx.verbose}" default-value="false"
- *
* @since 1.3
*/
- protected boolean verbose;
+ private boolean verbose;
+
/**
- * The store of helpIds generated by the goal {@link GenerateMojo} and then
- * used by the goal {@link GenerateHelpMojo}.
- *
- * @parameter expression="${jaxx.helpIdsStore}" default-value="target/generated-sources/jaxx/helpIds.properties"
- * @required
+ * to force generation of java source for any jaxx files with no timestamp checking.
+ * <p/>
+ * By default, never force generation.
*
+ * @parameter expression="${jaxx.force}" default-value="false"
+ */
+ private boolean force;
+ /**
+ * Flag to activate help id detection while parsing jaxx files.
+ * <p/>
+ * By default, not active.
+ *
+ * @parameter expression="${jaxx.generateHelp}" default-value="false"
* @since 1.3
*/
- protected File helpIdsStore;
+ protected boolean generateHelp;
@Override
protected boolean checkPackaging() {
@@ -98,14 +105,6 @@
this.verbose = verbose;
}
- public File getHelpIdsStore() {
- return helpIdsStore;
- }
-
- public void setHelpIdsStore(File helpIdsStore) {
- this.helpIdsStore = helpIdsStore;
- }
-
public String getEncoding() {
return encoding;
}
@@ -114,6 +113,14 @@
this.encoding = encoding;
}
+ public boolean isForce() {
+ return force;
+ }
+
+ public void setForce(boolean force) {
+ this.force = force;
+ }
+
/**
* TODO-TC20091221 Should move this to AbstractPlugin
* Create the directory if necessary.
@@ -128,7 +135,7 @@
}
boolean b = dir.mkdirs();
if (!b) {
- throw new IOException("could not create directory "+dir);
+ throw new IOException("could not create directory " + dir);
}
}
}
@@ -177,4 +184,37 @@
}
return shouldAdd;
}
+
+
+ class GetLastModifiedFileAction implements FileUtil.FileAction {
+
+ protected File lastFile;
+
+ public GetLastModifiedFileAction(File lastFile) {
+ this.lastFile = lastFile;
+
+ }
+
+ @Override
+ public boolean doAction(File f) {
+
+ if (f.lastModified() > lastFile.lastModified()) {
+ lastFile = f;
+ }
+ return true;
+ }
+
+ public File getLastFile() {
+ return lastFile;
+ }
+ }
+
+ protected Long getLastModified(File dir) {
+ if (!dir.exists()) {
+ return null;
+ }
+ GetLastModifiedFileAction fileAction = new GetLastModifiedFileAction(dir);
+ FileUtil.walkAfter(dir, fileAction);
+ return fileAction.getLastFile().lastModified();
+ }
}
Copied: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java (from rev 1687, trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java)
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java (rev 0)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2009-12-23 08:58:07 UTC (rev 1699)
@@ -0,0 +1,519 @@
+/* *##%
+ * JAXX Maven plugin
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*/
+package org.nuiton.jaxx.plugin;
+
+import org.nuiton.plugin.VelocityTemplateGenerator;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.SortedProperties;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * Mojo to generate javax help files for your project.
+ *
+ * @author chemit
+ * @goal generate-help-files
+ * @phase process-sources
+ * @requiresProject
+ * @requiresDependencyResolution compile
+ * @execute goal=generate-help-ids
+ * @since 2.0.0
+ */
+public class GenerateHelpFilesMojo extends AbstractGenerateHelpMojo {
+
+ protected static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE";
+
+ /**
+ * The directory where to create or update help files.
+ *
+ * @parameter expression="${jaxx.outuptHelp}" default-value="${project.basedir}/src/main/help"
+ * @required
+ * @since 2.0.0
+ */
+ protected File outputHelp;
+ /**
+ * The name of the helpset to generate.
+ *
+ * @parameter expression="${jaxx.helpsetName}" default-value="${project.artifactId}"
+ * @required
+ * @since 1.3
+ */
+ protected String helpsetName;
+ /**
+ * The template used to generate helpset file.
+ * <p/>
+ * Must be an existing file or a ressource in class-path
+ *
+ * @parameter expression="${jaxx.helpsetTemplate}" default-value="/defaultHelpSet.hs.vm"
+ * @required
+ * @since 1.3
+ */
+ protected File helpsetTemplate;
+ /**
+ * The template used to generate helpset map file.
+ * <p/>
+ * Must be an existing file or a ressource in class-path
+ *
+ * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm"
+ * @required
+ * @since 1.3
+ */
+ protected File mapTemplate;
+ /**
+ * The template used to generate helpset index file.
+ * <p/>
+ * Must be an existing file or a ressource in class-path
+ *
+ * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm"
+ * @required
+ * @since 1.3
+ */
+ protected File indexTemplate;
+ /**
+ * The template used to generate helpset toc file.
+ * <p/>
+ * Must be an existing file or a ressource in class-path
+ *
+ * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm"
+ * @required
+ * @since 1.3
+ */
+ protected File tocTemplate;
+ /**
+ * The template used to generate helpset content file.
+ * <p/>
+ * Must be an existing file or a ressource in class-path
+ *
+ * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm"
+ * @required
+ * @since 1.3
+ */
+ protected File contentTemplate;
+
+ protected String mapFileName;
+ protected String indexFileName;
+ protected String tocFileName;
+ protected int touchedFiles;
+
+ /**
+ * The help ids discovered.
+ */
+ protected Properties helpIds;
+
+ @Override
+ public File getTargetDirectory() {
+ return outputHelp;
+ }
+
+ @Override
+ public void setTargetDirectory(File targetDirectory) {
+ this.outputHelp = targetDirectory;
+ }
+
+ @Override
+ public boolean init() throws Exception {
+ if (!generateHelp) {
+
+ return true;
+ }
+ // check ressources
+ checkResource(helpsetTemplate);
+ checkResource(mapTemplate);
+ checkResource(indexTemplate);
+ checkResource(tocTemplate);
+ checkResource(contentTemplate);
+
+ mapFileName = helpsetName + "Map.jhm";
+ indexFileName = helpsetName + "Index.xml";
+ tocFileName = helpsetName + "TOC.xml";
+ touchedFiles = 0;
+
+ boolean b = super.init();
+ if (!b) {
+ return false;
+ }
+
+ // load ids from idsStore file
+
+ File idsFile;
+
+ if (isForce()) {
+ idsFile = getMergeHelpIdsStoreFile();
+ if (!idsFile.exists()) {
+ if (isVerbose()) {
+ getLog().info("Force flag is on, but no helpIdStore-all to react at " + idsFile);
+ }
+ return true;
+ }
+ } else {
+ idsFile = getHelpIdsStoreFile();
+ if (!idsFile.exists()) {
+ if (isVerbose()) {
+ getLog().info("no helpIdStore to react at " + idsFile);
+ }
+ return true;
+ }
+ }
+
+ helpIds = new SortedProperties();
+
+ // loading all ids
+ Set<String> ids = loadHelpIds(idsFile);
+
+ if (ids.isEmpty()) {
+
+ // no ids detected
+ if (isVerbose()) {
+ getLog().info("No helpIds detected, will skip.");
+ }
+ return true;
+ }
+
+ for (String id : ids) {
+ String path = id.replaceAll("\\.", File.separator) + ".html";
+ helpIds.put(id, path);
+ }
+
+ return true;
+ }
+
+ @Override
+ protected boolean skipAction() {
+ boolean b = super.skipAction();
+ if (!b) {
+ if (helpIds == null || helpIds.isEmpty()) {
+ getLog().info("No help ids to treate.");
+ return true;
+ }
+ }
+ return false;
+ }
+
+// @Override
+// public void doAction() throws Exception {
+//
+// if (skipAction()) {
+// return;
+// }
+//
+// if (helpIds == null || helpIds.isEmpty()) {
+// getLog().info("No help ids to treate.");
+// return;
+// }
+//
+// super.doAction();
+// }
+
+ protected void postDoAction() {
+ getLog().info(touchedFiles + " file(s) treated.");
+ }
+
+ protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
+
+ String language = locale.getLanguage();
+
+ getLog().info("Generate help for language " + language);
+ if (isVerbose()) {
+ getLog().info(" Localized target : " + localizedTarget);
+ }
+
+ Properties env = new Properties();
+
+ env.put("helpSetName", helpsetName);
+ env.put("locale", language);
+ env.put("localePath", localePath);
+ env.put("separator", " ");
+ env.put("autoremoveLine", AUTOREMOVE_LINE);
+
+ String localeSuffix = isDefaultLocale ? "" : "_" + language;
+ String helpsetFileName = helpsetName + localeSuffix + ".hs";
+
+ env.put("helpSetFileName", helpsetFileName);
+
+ env.put("mapFileName", mapFileName);
+ env.put("indexFileName", indexFileName);
+ env.put("tocFileName", tocFileName);
+ env.put("generateSearch", generateSearch);
+
+ // ---------------------------------------------------------------
+ // --- main helpset file -----------------------------------------
+ // ---------------------------------------------------------------
+
+ File file = new File(getTargetDirectory(), helpsetFileName);
+
+ boolean doCreate = generateHelpsetFile(file, env);
+
+ if (doCreate) {
+ touchedFiles++;
+ }
+
+ // ---------------------------------------------------------------
+ // --- helpset map file ------------------------------------------
+ // ---------------------------------------------------------------
+
+ file = new File(localizedTarget, mapFileName);
+
+ generateMapFile(file, env);
+ touchedFiles++;
+
+ // ---------------------------------------------------------------
+ // --- helpset index file ----------------------------------------
+ // ---------------------------------------------------------------
+
+ file = new File(localizedTarget, indexFileName);
+
+ generateIndexFile(file, env);
+ touchedFiles++;
+
+ // ---------------------------------------------------------------
+ // --- helpset toc file ------------------------------------------
+ // ---------------------------------------------------------------
+
+ file = new File(localizedTarget, tocFileName);
+
+ generateTocFile(file, env);
+ touchedFiles++;
+
+ // ---------------------------------------------------------------
+ // --- helpset content files -------------------------------------
+ // ---------------------------------------------------------------
+
+ touchedFiles += generateContentFiles(localizedTarget, env, localePath);
+ }
+
+ protected int generateContentFiles(File localizedTarget, Properties env, String localePath) throws Exception {
+
+ int touchedFiles = 0;
+ VelocityTemplateGenerator gen = prepareGenerator(contentTemplate);
+ Enumeration<?> keys = helpIds.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ String url = (String) helpIds.get(key);
+ url = helpsetName + File.separator + url;
+ File f = new File(localizedTarget, url);
+ boolean exist = f.exists();
+ if (exist) {
+ // check if there is a autoremoveLine in content
+ String content = FileUtil.readAsString(f);
+ if (!content.contains(AUTOREMOVE_LINE)) {
+ // no regenerate marker detected, so skip this file
+ if (isVerbose()) {
+ getLog().debug("skip existing file " + f);
+ }
+ continue;
+ }
+ }
+ createDirectoryIfNecessary(f.getParentFile());
+ if (isVerbose()) {
+ if (exist) {
+ getLog().info("regenerate content file " + f);
+ } else {
+ getLog().info("generate content file " + f);
+ }
+ }
+ env.put("helpId", key);
+ env.put("helpIdUrl", localePath + "/" + url);
+ gen.generate(env, f);
+ touchedFiles++;
+ }
+ return touchedFiles;
+ }
+
+ protected boolean generateHelpsetFile(File file, Properties env) throws Exception {
+
+ if (file.exists()) {
+ // check the autoremove line presence
+ String content = FileUtil.readAsString(file);
+ if (!content.contains(AUTOREMOVE_LINE)) {
+ // no regenerate marker detected, so skip this file
+ if (isVerbose()) {
+ getLog().info("skip existing helpset main file " + file);
+ }
+ return false;
+ }
+ }
+
+ if (isVerbose()) {
+ if (file.exists()) {
+ getLog().info("regenerate helpset main file " + file);
+ } else {
+ getLog().info("generate helpset main file " + file);
+ }
+ }
+ doGen(helpsetTemplate, file, env);
+ return true;
+ }
+
+ protected Properties generateMapFile(File file, Properties env) throws Exception {
+
+ boolean create;
+
+ Properties mergedHelpIds;
+ if (file.exists()) {
+
+ // get back the exisiting data and merge it with incoming ones
+
+ if (isVerbose()) {
+ getLog().info("loading existing helpset map file " + file);
+ }
+
+ mergedHelpIds = XmlHelper.getExistingHelpIds(file, isVerbose(), getLog());
+ create = false;
+
+ } else {
+
+ mergedHelpIds = new SortedProperties();
+ create = true;
+ }
+
+ // inject new helpIds
+
+ for (Object k : helpIds.keySet()) {
+ mergedHelpIds.put(k, helpsetName + "/" + helpIds.get(k));
+ }
+
+ if (!mergedHelpIds.contains("top")) {
+
+ // on ajoute une entree vers le root du helpset
+
+ String topUrl = helpsetName + ".html";
+ helpIds.put("top", topUrl);
+ mergedHelpIds.put("top", helpsetName + "/" + topUrl);
+ if (isVerbose()) {
+ getLog().debug("add top entry with url " + topUrl);
+ }
+ }
+
+ if (isVerbose()) {
+ if (create) {
+ getLog().info("generate helpset map file " + file);
+ } else {
+ getLog().info("udpate helpset map file " + file);
+ }
+ }
+
+ env.put("helpIds", mergedHelpIds);
+ doGen(mapTemplate, file, env);
+ env.remove("helpIds");
+ return mergedHelpIds;
+ }
+
+ protected NodeItem generateIndexFile(File file, Properties env) throws Exception {
+ NodeItem rootItem = null;
+
+ boolean create;
+
+ if (file.exists()) {
+
+ create = false;
+
+ rootItem = XmlHelper.getExistingItems("indexitem", file);
+ } else {
+ create = true;
+ }
+
+ if (rootItem == null) {
+ rootItem = new NodeItem("top", helpsetName);
+ }
+
+ // inject new index entries
+
+ for (Object k : helpIds.keySet()) {
+ NodeItem toc = rootItem.findChild(k + "");
+ if (isVerbose()) {
+ getLog().debug("index " + k + " : " + toc);
+ }
+ }
+
+ if (isVerbose()) {
+ if (create) {
+ getLog().info("generate helpset index file " + file);
+ } else {
+ getLog().info("udpate helpset index file " + file);
+ }
+ }
+
+ env.put("rootItem", rootItem);
+ doGen(indexTemplate, file, env);
+ env.remove("rootItem");
+ return rootItem;
+ }
+
+ protected NodeItem generateTocFile(File file, Properties env) throws Exception {
+ NodeItem rootItem = null;
+
+ boolean create;
+
+ if (file.exists()) {
+
+ create = false;
+
+ rootItem = XmlHelper.getExistingItems("tocitem", file);
+ } else {
+ create = true;
+ }
+
+ if (rootItem == null) {
+ rootItem = new NodeItem("top", helpsetName);
+ }
+ // inject new toc entries
+
+ for (Object k : helpIds.keySet()) {
+ NodeItem toc = rootItem.findChild(k + "");
+ if (isVerbose()) {
+ getLog().debug("toc " + k + " : " + toc);
+ }
+ }
+
+ if (isVerbose()) {
+ if (create) {
+ getLog().info("generate helpset toc file " + file);
+ } else {
+ getLog().info("udpate helpset toc file " + file);
+ }
+ }
+
+ env.put("rootItem", rootItem);
+ doGen(tocTemplate, file, env);
+ env.remove("rootItem");
+ return rootItem;
+ }
+
+
+ protected void doGen(File template, File f, Properties env) throws Exception {
+ VelocityTemplateGenerator gen = prepareGenerator(template);
+ gen.generate(env, f);
+ }
+
+ protected VelocityTemplateGenerator prepareGenerator(File template) throws Exception {
+ URL templateURL = getTemplate(template);
+
+ if (isVerbose()) {
+ getLog().info("using template " + templateURL);
+ }
+ VelocityTemplateGenerator gen = new VelocityTemplateGenerator(getProject(), templateURL);
+ return gen;
+ }
+
+}
\ No newline at end of file
Added: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java (rev 0)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java 2009-12-23 08:58:07 UTC (rev 1699)
@@ -0,0 +1,110 @@
+package org.nuiton.jaxx.plugin;
+
+import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.util.Locale;
+import java.util.Set;
+
+/**
+ * Generate the help ids files from the previous jaxx generation.
+ *
+ * Created: 22 déc. 2009
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
+ * @author chemit
+ * @version $Revision$
+ * <p/>
+ * Mise a jour: $Date$ par :
+ * $Author: tchemit $
+ * @goal generate-help-ids
+ * @phase process-sources
+ * @requiresProject
+ * @since 2.0.0
+ */
+public class GenerateHelpIdsMojo extends AbstractGenerateHelpMojo {
+
+ @Override
+ public boolean init() throws Exception {
+ if (!generateHelp) {
+
+ return true;
+ }
+
+ if (!super.init()) {
+ return false;
+ }
+
+ // check there is some bundle
+ if (getHelpIdsFilename() == null) {
+ throw new MojoFailureException("you must set the 'helpIdStore' property.");
+ }
+ if (getMergeHelpIdsFilename() == null) {
+ throw new MojoFailureException("you must set the 'helpIdStoreAll' property.");
+ }
+
+ return true;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ if (skipAction()) {
+ return;
+ }
+
+ Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
+
+ if (helpIds.isEmpty()) {
+// if (isVerbose()) {
+ // no ids detected in this compilation round
+ getLog().info("No helpIds detected.");
+// }
+ cleanHelpIdsStore();
+ return;
+ }
+
+ // store current jaxx session detected help ids
+
+ File idsStore = getHelpIdsStoreFile();
+ getLog().info("Store detected help ids to " + idsStore);
+
+ storeHelpIds(idsStore, helpIds);
+
+ // store merged help ids (to make possible a force on help generation)
+
+
+ File idsStoreAll = getMergeHelpIdsStoreFile();
+ getLog().info("Merge help ids to " + idsStoreAll);
+
+ if (idsStoreAll.exists()) {
+ Set<String> allIds = loadHelpIds(idsStoreAll);
+ helpIds.addAll(allIds);
+ allIds.clear();
+ }
+
+ storeHelpIds(idsStoreAll, helpIds);
+
+ helpIds.clear();
+
+ }
+
+ @Override
+ protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File source, String localePath) throws Exception {
+ }
+
+ @Override
+ protected void postDoAction() {
+ }
+
+ @Override
+ public File getTargetDirectory() {
+ return getOutputHelpIds();
+ }
+
+ @Override
+ public void setTargetDirectory(File targetDirectory) {
+ setOutputHelpIds(targetDirectory);
+ }
+}
Property changes on: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java 2009-12-23 08:49:38 UTC (rev 1698)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java 2009-12-23 08:58:07 UTC (rev 1699)
@@ -18,376 +18,50 @@
* ##%*/
package org.nuiton.jaxx.plugin;
-import org.nuiton.plugin.VelocityTemplateGenerator;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.SortedProperties;
-
import java.io.File;
-import java.util.Enumeration;
import java.util.Locale;
-import java.util.Properties;
/**
- * Mojo to generate javax help stuff for your project.
+ * Mojo to generate all the javax help stuff for your project.
* <p/>
- * HelpIds should have been discovered by the JaxxMojo.
+ * This mojo will chain all others help mojo required.
*
* @author chemit
* @goal generate-help
* @phase process-sources
* @requiresProject
* @requiresDependencyResolution compile
+ * @execute goal=generate-help-search
* @since 1.3
*/
public class GenerateHelpMojo extends AbstractGenerateHelpMojo {
-
- /**
- * The template used to generate helpset file.
- * <p/>
- * Must be an existing file or a ressource in class-path
- *
- * @parameter expression="${jaxx.helpsetTemplate}" default-value="/defaultHelpSet.hs.vm"
- * @required
- * @since 1.3
- */
- protected File helpsetTemplate;
- /**
- * The template used to generate helpset map file.
- * <p/>
- * Must be an existing file or a ressource in class-path
- *
- * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm"
- * @required
- * @since 1.3
- */
- protected File mapTemplate;
- /**
- * The template used to generate helpset index file.
- * <p/>
- * Must be an existing file or a ressource in class-path
- *
- * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm"
- * @required
- * @since 1.3
- */
- protected File indexTemplate;
- /**
- * The template used to generate helpset toc file.
- * <p/>
- * Must be an existing file or a ressource in class-path
- *
- * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm"
- * @required
- * @since 1.3
- */
- protected File tocTemplate;
- /**
- * The template used to generate helpset content file.
- * <p/>
- * Must be an existing file or a ressource in class-path
- *
- * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm"
- * @required
- * @since 1.3
- */
- protected File contentTemplate;
-
- protected String mapFileName;
- protected String indexFileName;
- protected String tocFileName;
- protected int touchedFiles;
-
@Override
- public boolean init() throws Exception {
-
- // check ressources
- checkResource(helpsetTemplate);
- checkResource(mapTemplate);
- checkResource(indexTemplate);
- checkResource(tocTemplate);
- checkResource(contentTemplate);
-
- mapFileName = helpsetName + "Map.jhm";
- indexFileName = helpsetName + "Index.xml";
- tocFileName = helpsetName + "TOC.xml";
- touchedFiles=0;
- return super.init();
+ public File getTargetDirectory() {
+ return null;
}
- protected void postDoAction() {
- getLog().info(touchedFiles + " file(s) treated.");
+ @Override
+ public void setTargetDirectory(File targetDirectory) {
}
- protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
+ @Override
+ public boolean init() throws Exception {
- String language = locale.getLanguage();
-
- getLog().info("Generate help for language " + language);
- if (isVerbose()) {
- getLog().info(" Localized target : " + localizedTarget);
- }
-
- Properties env = new Properties();
-
- env.put("helpSetName", helpsetName);
- env.put("locale", language);
- env.put("localePath", localePath);
- env.put("separator", " ");
- env.put("autoremoveLine", AUTOREMOVE_LINE);
-
- String localeSuffix = isDefaultLocale ? "" : "_" + language;
- String helpsetFileName = helpsetName + localeSuffix + ".hs";
-
- env.put("helpSetFileName", helpsetFileName);
-
- env.put("mapFileName", mapFileName);
- env.put("indexFileName", indexFileName);
- env.put("tocFileName", tocFileName);
- env.put("generateSearch", generateSearch);
-
- // ---------------------------------------------------------------
- // --- main helpset file -----------------------------------------
- // ---------------------------------------------------------------
-
- File file = new File(outHelp, helpsetFileName);
-
- boolean doCreate = generateHelpsetFile(file, env);
-
- if (doCreate) {
- touchedFiles++;
- }
-
- // ---------------------------------------------------------------
- // --- helpset map file ------------------------------------------
- // ---------------------------------------------------------------
-
- file = new File(localizedTarget, mapFileName);
-
- generateMapFile(file, env);
- touchedFiles++;
-
- // ---------------------------------------------------------------
- // --- helpset index file ----------------------------------------
- // ---------------------------------------------------------------
-
- file = new File(localizedTarget, indexFileName);
-
- generateIndexFile(file, env);
- touchedFiles++;
-
- // ---------------------------------------------------------------
- // --- helpset toc file ------------------------------------------
- // ---------------------------------------------------------------
-
- file = new File(localizedTarget, tocFileName);
-
- generateTocFile(file, env);
- touchedFiles++;
-
- // ---------------------------------------------------------------
- // --- helpset content files -------------------------------------
- // ---------------------------------------------------------------
-
- touchedFiles += generateContentFiles(localizedTarget, env, localePath);
- }
-
- protected int generateContentFiles(File localizedTarget, Properties env, String localePath) throws Exception {
-
- int touchedFiles = 0;
- VelocityTemplateGenerator gen = prepareGenerator(contentTemplate);
- Enumeration<?> keys = helpIds.keys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- String url = (String) helpIds.get(key);
- url = helpsetName + File.separator + url;
- File f = new File(localizedTarget, url);
- boolean exist = f.exists();
- if (exist) {
- // check if there is a autoremoveLine in content
- String content = FileUtil.readAsString(f);
- if (!content.contains(AUTOREMOVE_LINE)) {
- // no regenerate marker detected, so skip this file
- if (verbose) {
- getLog().debug("skip existing file " + f);
- }
- continue;
- }
- }
- createDirectoryIfNecessary(f.getParentFile());
- if (verbose) {
- if (exist) {
- getLog().info("regenerate content file " + f);
- } else {
- getLog().info("generate content file " + f);
- }
- }
- env.put("helpId", key);
- env.put("helpIdUrl", localePath + "/" + url);
- gen.generate(env, f);
- touchedFiles++;
- }
- return touchedFiles;
- }
-
- protected boolean generateHelpsetFile(File file, Properties env) throws Exception {
-
- if (file.exists()) {
- // check the autoremove line presence
- String content = FileUtil.readAsString(file);
- if (!content.contains(AUTOREMOVE_LINE)) {
- // no regenerate marker detected, so skip this file
- if (verbose) {
- getLog().info("skip existing helpset main file " + file);
- }
- return false;
- }
- }
-
- if (verbose) {
- if (file.exists()) {
- getLog().info("regenerate helpset main file " + file);
- } else {
- getLog().info("generate helpset main file " + file);
- }
- }
- doGen(helpsetTemplate, file, env);
return true;
}
- protected Properties generateMapFile(File file, Properties env) throws Exception {
+ @Override
+ public void doAction() throws Exception {
- boolean create;
-
- Properties mergedHelpIds;
- if (file.exists()) {
-
- // get back the exisiting data and merge it with incoming ones
-
- if (verbose) {
- getLog().info("loading existing helpset map file " + file);
- }
-
- mergedHelpIds = XmlHelper.getExistingHelpIds(file, verbose, getLog());
- create = false;
-
- } else {
-
- mergedHelpIds = new SortedProperties();
- create = true;
- }
-
- // inject new helpIds
-
- for (Object k : helpIds.keySet()) {
- mergedHelpIds.put(k, helpsetName + "/" + helpIds.get(k));
- }
-
- if (!mergedHelpIds.contains("top")) {
-
- // on ajoute une entree vers le root du helpset
-
- String topUrl = helpsetName + ".html";
- helpIds.put("top", topUrl);
- mergedHelpIds.put("top", helpsetName + "/" + topUrl);
- if (verbose) {
- getLog().debug("add top entry with url " + topUrl);
- }
- }
-
- if (verbose) {
- if (create) {
- getLog().info("generate helpset map file " + file);
- } else {
- getLog().info("udpate helpset map file " + file);
- }
- }
-
- env.put("helpIds", mergedHelpIds);
- doGen(mapTemplate, file, env);
- env.remove("helpIds");
- return mergedHelpIds;
}
- protected NodeItem generateIndexFile(File file, Properties env) throws Exception {
- NodeItem rootItem = null;
-
- boolean create;
-
- if (file.exists()) {
-
- create = false;
-
- rootItem = XmlHelper.getExistingItems("indexitem", file);
- } else {
- create = true;
- }
-
- if (rootItem == null) {
- rootItem = new NodeItem("top", helpsetName);
- }
-
- // inject new index entries
-
- for (Object k : helpIds.keySet()) {
- NodeItem toc = rootItem.findChild(k + "");
- if (verbose) {
- getLog().debug("index " + k + " : " + toc);
- }
- }
-
- if (verbose) {
- if (create) {
- getLog().info("generate helpset index file " + file);
- } else {
- getLog().info("udpate helpset index file " + file);
- }
- }
-
- env.put("rootItem", rootItem);
- doGen(indexTemplate, file, env);
- env.remove("rootItem");
- return rootItem;
+ protected void postDoAction() {
+ //getLog().info(touchedFiles + " file(s) treated.");
}
- protected NodeItem generateTocFile(File file, Properties env) throws Exception {
- NodeItem rootItem = null;
+ protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
- boolean create;
-
- if (file.exists()) {
-
- create = false;
-
- rootItem = XmlHelper.getExistingItems("tocitem", file);
- } else {
- create = true;
- }
-
- if (rootItem == null) {
- rootItem = new NodeItem("top", helpsetName);
- }
- // inject new toc entries
-
- for (Object k : helpIds.keySet()) {
- NodeItem toc = rootItem.findChild(k + "");
- if (verbose) {
- getLog().debug("toc " + k + " : " + toc);
- }
- }
-
- if (verbose) {
- if (create) {
- getLog().info("generate helpset toc file " + file);
- } else {
- getLog().info("udpate helpset toc file " + file);
- }
- }
-
- env.put("rootItem", rootItem);
- doGen(tocTemplate, file, env);
- env.remove("rootItem");
- return rootItem;
}
}
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java 2009-12-23 08:49:38 UTC (rev 1698)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java 2009-12-23 08:58:07 UTC (rev 1699)
@@ -22,6 +22,7 @@
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
+import org.nuiton.plugin.PluginHelper;
import java.io.File;
import java.io.PrintStream;
@@ -31,7 +32,7 @@
import java.util.Locale;
/**
- * Mojo to generate javax search index help stuff for your project.
+ * Generate the javax search index help for your project.
* <p/>
* The current files should be generated always in a generated directory and not in
* your src directories (this is mainly binary files not to be stored in scm system)...
@@ -41,58 +42,136 @@
* @phase process-sources
* @requiresProject
* @requiresDependencyResolution compile
+ * @execute goal=generate-help-files
* @since 2.0.0
*/
public class GenerateHelpSearchMojo extends AbstractGenerateHelpMojo {
- protected File targetRoot;
+ /**
+ * The directory where to create or update help search index files.
+ *
+ * @parameter expression="${jaxx.outputHelpSearch}" default-value="${project.basedir}/target/generated-sources/help"
+ * @required
+ * @since 2.0.0
+ */
+ protected File outputHelpSearch;
+
protected String timestamp;
@Override
public boolean init() throws Exception {
+ if (!generateHelp) {
+
+ return true;
+ }
+
if (!generateSearch) {
- getLog().info("Do not generate search.");
- return false;
+// getLog().info("Do not generate search.");
+ return true;
}
- targetRoot = getFileFromBasedir("target", "generated-sources", "help");
- createDirectoryIfNecessary(targetRoot);
timestamp = "-" + System.currentTimeMillis();
return super.init();
}
@Override
- protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
+ public File getTargetDirectory() {
+ return outputHelpSearch;
+ }
+ @Override
+ public void setTargetDirectory(File targetDirectory) {
+ this.outputHelpSearch = targetDirectory;
+ }
+
+ protected boolean skipAction() {
+ if (!generateHelp) {
+ getLog().info("generateHelp flag is off, generate nothing.");
+ return true;
+ }
+ if (!generateSearch) {
+ getLog().info("generateHelpsearch flag is off, generate nothing.");
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File source, String localePath) throws Exception {
+
String language = locale.getLanguage();
- File target = new File(targetRoot, localePath + File.separator + "JavaHelpSearch");
+ File target = new File(getTargetDirectory(), localePath + File.separator + "JavaHelpSearch");
- createDirectoryIfNecessary(localizedTarget);
- createDirectoryIfNecessary(target);
+ // detect if need to generate
+ boolean generate = false;
+
+ if (isForce()) {
+
+ // always generate if force flag is no
+ generate = true;
+
+ } else if (!target.exists()) {
+
+ // target does not exist, must generate it
+ generate = true;
+
+ } else {
+
+ // see if there is something new in source
+
+ Long sourceLast = getLastModified(source);
+ Long targetLast = getLastModified(target);
+
+ if (isVerbose()) {
+
+ getLog().info("lastModified of source : " + sourceLast);
+ getLog().info("lastModified of target : " + targetLast);
+ }
+
+ if (targetLast == null || sourceLast == null || targetLast < sourceLast) {
+
+ // something is newer in source than in target
+
+ generate = true;
+ }
+
+ }
+
+ if (!generate) {
+ getLog().info("Nothing to generate for language " + language + " - all files are up to date.");
+ return;
+ }
+
getLog().info("Generate help search index for language " + language);
+
if (isVerbose()) {
- getLog().info(" Localized source : " + localizedTarget);
- getLog().info(" Localized target : " + target);
+ getLog().info(" from " + source);
+ getLog().info(" to " + target);
}
+ createDirectoryIfNecessary(source);
+ createDirectoryIfNecessary(target);
+
// ---------------------------------------------------------------
// --- generate search index -------------------------------------
// ---------------------------------------------------------------
- generateSearchIndex(localizedTarget, target, locale);
+ generateSearchIndex(source, target, locale);
}
@Override
protected void postDoAction() {
// add resources to the project
- addResourceDir(targetRoot, getProject(), "**/*");
+ addResourceDir(getTargetDirectory(), getProject(), "**/*");
}
protected void generateSearchIndex(File source, File target, Locale locale) throws Exception {
+ long t0 = System.nanoTime();
+
Method m = Indexer.class.getDeclaredMethod("main", String[].class);
// remove old index
@@ -100,7 +179,9 @@
//copy resources to a tmp dir (without any VCS infos)
File tmpDir = getFileFromBasedir("target", "jaxx-tmp", "indexer-" + locale + timestamp);
- getLog().info("copy files to " + tmpDir + " for indexing them");
+ if (isVerbose()) {
+ getLog().info("copy files to " + tmpDir + " for indexing them.");
+ }
FileUtils.copyDirectory(source, tmpDir, "**/*", StringUtils.join(DirectoryScanner.DEFAULTEXCLUDES, ","));
// prepare arguments of Indexer.main calling
@@ -122,7 +203,9 @@
System.setOut(out);
System.setErr(err);
}
- getLog().info("Search Index generated for " + locale);
+ if (isVerbose()) {
+ getLog().info("Search Index generated for " + locale + " in " + PluginHelper.convertTime(System.nanoTime() - t0));
+ }
}
}
\ No newline at end of file
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-12-23 08:49:38 UTC (rev 1698)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-12-23 08:58:07 UTC (rev 1699)
@@ -18,35 +18,28 @@
* ##%*/
package org.nuiton.jaxx.plugin;
-import java.util.List;
-
+import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.CompilerConfiguration;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.JAXXEngine;
import jaxx.compiler.beans.BeanInfoUtil;
-import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.binding.DataBindingHelper;
-import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator;
import jaxx.compiler.tags.TagManager;
import jaxx.runtime.JAXXContext;
-
+import jaxx.runtime.swing.help.JAXXHelpBroker;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-
import org.nuiton.io.FileUpdaterHelper;
import org.nuiton.io.MirroredFileUpdater;
+import org.nuiton.plugin.PluginHelper;
import java.io.File;
-import java.io.IOException;
-import java.util.Map;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.Set;
+import java.util.List;
+import java.util.Map;
-import jaxx.runtime.swing.help.JAXXHelpBroker;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
/**
* Generates some java code from jaxx files.
*
@@ -160,14 +153,6 @@
*/
protected boolean addProjectClassPath;
/**
- * to force generation of java source for any jaxx files with no timestamp checking.
- * <p/>
- * By default, never force generation.
- *
- * @parameter expression="${jaxx.force}" default-value="false"
- */
- protected boolean force;
- /**
* A flag to mark themojo to be used in a test phase. This will permits to add generated sources in test compile roots.
*
* @parameter expression="${jaxx.testPhase}" default-value="false"
@@ -247,15 +232,6 @@
*/
protected boolean showBinding;
/**
- * flag to activate help generation process.
- * <p/>
- * By default, not active.
- *
- * @parameter expression="${jaxx.generateHelp}" default-value="false"
- * @since 1.3
- */
- protected boolean generateHelp;
- /**
* the FQN of help broker
* <p/>
* By default, use the JAXX implementation {@link JAXXHelpBroker}.
@@ -315,13 +291,6 @@
@Override
public boolean init() throws Exception {
- if (generateHelp) {
- // check there is some bundle
- if (getHelpIdsStore() == null) {
- throw new MojoFailureException("you must set the 'helpIdStore' property.");
- }
- }
-
fixCompileSourceRoots();
if (includes == null || includes.length == 0) {
@@ -331,7 +300,7 @@
updater = FileUpdaterHelper.newJaxxFileUpdater(src, outJava);
Map<File, String[]> result = new HashMap<File, String[]>();
- getFilesToTreateForRoots(includes, excludes, Arrays.asList(src.getAbsolutePath()), result, force ? null : updater);
+ getFilesToTreateForRoots(includes, excludes, Arrays.asList(src.getAbsolutePath()), result, isForce() ? null : updater);
this.files = result.get(src);
@@ -340,7 +309,7 @@
return true;
}
- cl = initClassLoader(project,
+ cl = initClassLoader(getProject(),
src,
addSourcesToClassPath,
testPhase,
@@ -377,13 +346,13 @@
for (String importS : imports) {
imports[i++] = importS.trim();
}
- if (verbose) {
+ if (isVerbose()) {
getLog().info("extra imports " + java.util.Arrays.toString(imports));
}
extraImports = imports;
}
- if (verbose) {
+ if (isVerbose()) {
getLog().info(toString());
getLog().info("includes : " + Arrays.toString(includes));
for (String file : files) {
@@ -394,10 +363,10 @@
}
@Override
- public void doAction() throws MojoExecutionException {
+ public void doAction() throws Exception {
if (nofiles) {
- getLog().info("No files to treate.");
+ getLog().info("Nothing to generate - all files are uo to date.");
return;
}
@@ -407,9 +376,10 @@
DataBindingHelper.SHOW_LOG = showBinding;
}
try {
+ long t0 = System.nanoTime();
// force compiler init from here, not in a static block
- TagManager.reset(verbose);
+ TagManager.reset(isVerbose());
engine = JAXXEngine.newLaunchor(src, files, this);
int nbFiles = engine.run();
@@ -417,13 +387,8 @@
if (nbFiles == -1) {
throw new MojoExecutionException("Aborting due to errors reported by jaxxc");
}
- getLog().info("Generated " + nbFiles + " file(s). ");
+ getLog().info("Generated " + nbFiles + " file(s) in " + PluginHelper.convertTime(System.nanoTime() - t0));
- if (generateHelp) {
- // generate help
- generateHelp();
- }
-
} catch (MojoExecutionException e) {
getLog().error(e);
throw e;
@@ -541,7 +506,9 @@
}
protected void fixCompileSourceRoots() {
- if (project == null) {
+ //FIXME TC20091222 : why this test ? should always have a project ?
+ // even in tests...
+ if (getProject() == null) {
// no project defined, can not fix anything
// this case could appear if we wanted to do some tests of the plugin
return;
@@ -554,41 +521,6 @@
}
}
- protected void generateHelp() throws IOException {
- Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
- if (helpIds.isEmpty()) {
- if (verbose) {
- // no ids detected in this compilation round
- getLog().info("no helpIds detected.");
- }
- return;
- }
- File idsStore = getHelpIdsStore();
-
- createDirectoryIfNecessary(idsStore.getParentFile());
-
- StringBuilder buffer = new StringBuilder();
-
- for (String helpId : helpIds) {
- buffer.append(removeQuote(helpId)).append('\n');
- }
- writeFile(idsStore, buffer.toString(), encoding);
-
- getLog().info("helpIdStore generated in " + idsStore);
-
- helpIds.clear();
- }
-
- protected String removeQuote(String txt) {
- if (txt.startsWith("\"")) {
- txt = txt.substring(1);
- }
- if (txt.endsWith("\"")) {
- txt = txt.substring(0, txt.length() - 1);
- }
- return txt;
- }
-
protected void report(JAXXEngine engine) {
List<String> warnings = engine.getWarnings();
if (!warnings.isEmpty()) {
1
0
r1698 - trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin
by tchemit@users.nuiton.org 23 Dec '09
by tchemit@users.nuiton.org 23 Dec '09
23 Dec '09
Author: tchemit
Date: 2009-12-23 09:49:38 +0100 (Wed, 23 Dec 2009)
New Revision: 1698
Modified:
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java
Log:
use getter from mojo
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-12-23 08:48:34 UTC (rev 1697)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-12-23 08:49:38 UTC (rev 1698)
@@ -228,7 +228,7 @@
long oldTime = dstFile.lastModified();
// second round, no force so will not the file
- mojo.force = false;
+ mojo.setForce(false);
executeMojo();
assertNumberJaxxFiles(0);
@@ -246,7 +246,7 @@
assertTrue(mojo.updater.getMirrorFile(srcFile).lastModified() > oldTime);
// last round, reforce file generation for an no modify source
- mojo.force = true;
+ mojo.setForce(true);
executeMojo();
assertNumberJaxxFiles(1);
assertTrue(mojo.updater.getMirrorFile(srcFile).lastModified() > oldTime);
Modified: trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java
===================================================================
--- trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java 2009-12-23 08:48:34 UTC (rev 1697)
+++ trunk/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java 2009-12-23 08:49:38 UTC (rev 1698)
@@ -67,7 +67,7 @@
for (String file : files) {
// check we have a the required/forbidden pattern
File f = new File(mojo.outJava, file.substring(0, file.length() - 4) + "java");
- if (mojo.verbose) {
+ if (mojo.isVerbose()) {
log.info("check generated file " + f);
}
1
0
r1697 - trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators
by tchemit@users.nuiton.org 23 Dec '09
by tchemit@users.nuiton.org 23 Dec '09
23 Dec '09
Author: tchemit
Date: 2009-12-23 09:48:34 +0100 (Wed, 23 Dec 2009)
New Revision: 1697
Modified:
trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
Log:
always return a copy of the help ids
Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
===================================================================
--- trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2009-12-22 17:36:00 UTC (rev 1696)
+++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2009-12-23 08:48:34 UTC (rev 1697)
@@ -28,12 +28,13 @@
import jaxx.compiler.java.JavaFileGenerator;
import java.lang.reflect.Modifier;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* A decorator to place on a root compiled object to process javaHelp on the file.
- *
+ *
* @author tony
* @since 1.2
*/
@@ -121,6 +122,6 @@
}
public static Set<String> getHelpIds() {
- return helpIds;
+ return new HashSet<String>(helpIds);
}
}
1
0
Author: tchemit
Date: 2009-12-22 18:36:00 +0100 (Tue, 22 Dec 2009)
New Revision: 1696
Modified:
trunk/jaxx-demo/src/main/resources/log4j.properties
Log:
restore log levels
Modified: trunk/jaxx-demo/src/main/resources/log4j.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/log4j.properties 2009-12-22 17:35:06 UTC (rev 1695)
+++ trunk/jaxx-demo/src/main/resources/log4j.properties 2009-12-22 17:36:00 UTC (rev 1696)
@@ -6,7 +6,7 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
log4j.logger.jaxx.demo=INFO
-log4j.logger.jaxx.demo.DemoConfig=DEBUG
+#log4j.logger.jaxx.demo.DemoConfig=DEBUG
log4j.logger.jaxx.runtime.swing.editor.config=INFO
-log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG
+#log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG
log4j.logger.org.nuiton=WARN
1
0
r1695 - in trunk/jaxx-demo/src/main: java/jaxx/demo resources resources/i18n
by tchemit@users.nuiton.org 22 Dec '09
by tchemit@users.nuiton.org 22 Dec '09
22 Dec '09
Author: tchemit
Date: 2009-12-22 18:35:06 +0100 (Tue, 22 Dec 2009)
New Revision: 1695
Modified:
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoSources.jaxx
trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
trunk/jaxx-demo/src/main/resources/log4j.properties
Log:
use ConfigModelBuilder api + improve application design
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2009-12-22 17:34:34 UTC (rev 1694)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2009-12-22 17:35:06 UTC (rev 1695)
@@ -20,9 +20,11 @@
*/
package jaxx.demo;
+import java.beans.PropertyChangeEvent;
import java.io.IOException;
import java.io.InputStream;
import java.beans.PropertyChangeListener;
+import java.util.Date;
import java.util.Locale;
import java.util.Properties;
@@ -53,11 +55,34 @@
* le projet (version, license,...) et la configuration des ui (icons, ...)
*/
public static final String APPLICATION_PROPERTIES = "/jaxx-demo.properties";
+
+ public static final String PROPERTY_FULLSCREEN = "fullscreen";
+ public static final String PROPERTY_LOCALE = "locale";
+ public static final String PROPERTY_FONT_SIZE = "fontSize";
+ public static final String PROPERTY_ADJUSTING = "adjusting";
+
/**
- * un drapeau pour savoir si on est en mode pleine écran
+ * un drapeau pour bloquer la sauvegarde lors de la modification en masse des options
+ * via les setter.
*/
- protected boolean fullscreen;
+ protected boolean adjusting;
+ protected final PropertyChangeListener saveAction = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (adjusting) {
+ if (log.isDebugEnabled()) {
+ log.debug("skip save while adjusting");
+ }
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Saving configuration at " + new Date());
+ }
+ saveForUser();
+ }
+ };
+
public DemoConfig() {
setConfigFileName(Option.CONFIG_FILE.defaultValue);
@@ -89,12 +114,27 @@
String sVersion = VersionUtil.removeSnapshot(getOption("application.version"));
Version version = VersionUtil.valueOf(sVersion);
setDefaultOption("version", version.getVersion());
+
+ adjusting = true;
+ addPropertyChangeListener(PROPERTY_FULLSCREEN, saveAction);
+ addPropertyChangeListener(PROPERTY_FONT_SIZE, saveAction);
+ addPropertyChangeListener(PROPERTY_LOCALE, saveAction);
+ adjusting = false;
}
public String getCopyrightText() {
return "Version " + getVersion() + " Codelutin @ 2008-2009";
}
+ @Override
+ public void setOption(String key, String value) {
+ if (key.equals(PROPERTY_ADJUSTING)) {
+ setAdjusting(Boolean.valueOf(value));
+ return;
+ }
+ super.setOption(key, value);
+ }
+
/**
* @return la version de l'application.
*/
@@ -126,23 +166,39 @@
public void setFullscreen(boolean fullscreen) {
Object oldValue = null;
setOption(Option.FULL_SCREEN.key, fullscreen + "");
- saveForUser();
- firePropertyChange("fullscreen", oldValue, fullscreen);
+// saveForUser();
+ firePropertyChange(PROPERTY_FULLSCREEN, oldValue, fullscreen);
}
public void setLocale(Locale newLocale) {
setOption(Option.LOCALE.key, newLocale.toString());
- saveForUser();
- firePropertyChange("locale", null, newLocale);
+// saveForUser();
+ firePropertyChange(PROPERTY_LOCALE, null, newLocale);
}
public void setFontSize(Float newFontSize) {
Float oldValue = getFontSize();
+ if (log.isDebugEnabled()) {
+ log.debug("changing font-size to " + newFontSize);
+ }
setOption(Option.FONT_SIZE.key, newFontSize.toString());
- saveForUser();
- firePropertyChange("fontSize", oldValue, newFontSize);
+// saveForUser();
+ firePropertyChange(PROPERTY_FONT_SIZE, oldValue, newFontSize);
}
+ public boolean isAdjusting() {
+ return adjusting;
+ }
+
+ public void setAdjusting(boolean adjusting) {
+ if (log.isDebugEnabled()) {
+ log.debug("changing adjusting to " + adjusting);
+ }
+ boolean oldValue = this.adjusting;
+ this.adjusting = adjusting;
+ firePropertyChange(PROPERTY_ADJUSTING, oldValue, adjusting);
+ }
+
/**
* Save configuration, in user home directory using the
* {@link #getConfigFileName}. Default, env and commande line note saved
@@ -153,7 +209,7 @@
}
public static final String[] DEFAULT_JAXX_PCS = {
- "fullScreen", "locale", "fontSize"
+ PROPERTY_FULLSCREEN, PROPERTY_LOCALE, PROPERTY_FONT_SIZE, PROPERTY_ADJUSTING
};
public void removeJaxxPropertyChangeListener() {
@@ -180,8 +236,8 @@
CONFIG_FILE(CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true),
FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false),
- LOCALE("ui.locale", _("jaxxdemo.config.ui.locale"), Locale.FRANCE.toString(), Locale.class, false, false),
- FONT_SIZE("ui.fontSize", _("jaxxdemo.config.ui.fontSize"), "10f", Float.class, false, false),
+ LOCALE("ui." + PROPERTY_LOCALE, _("jaxxdemo.config.ui." + PROPERTY_LOCALE), Locale.FRANCE.toString(), Locale.class, false, false),
+ FONT_SIZE("ui." + PROPERTY_FONT_SIZE, _("jaxxdemo.config.ui." + PROPERTY_FONT_SIZE), "10f", Float.class, false, false),
DEMO_PATH("ui.demo.path", _("jaxxdemo.config.ui.demo.path"), "$root/jaxxdemo.tree.component.jaxx/jaxxdemo.tree.component.jaxx.tree.navigation/" + FullNavigationTreeDemo.class.getSimpleName(), String.class, false, false);
public final String key;
public final String description;
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoSources.jaxx
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoSources.jaxx 2009-12-22 17:34:34 UTC (rev 1694)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoSources.jaxx 2009-12-22 17:35:06 UTC (rev 1695)
@@ -70,7 +70,7 @@
onItemStateChanged='if(event.getStateChange() == ItemEvent.SELECTED) { updateSource(event); }'/>
<javax.swing.Box.Filler
constructorParams='SwingUtil.newMinDimension(), SwingUtil.newMinDimension(), SwingUtil.newMaxXDimension()'/>
- <FontSizor id='fontSizor' opaque='false' showFontSize='true' defaultFontSize='{getConfig().getFontSize()}'/>
+ <FontSizor id='fontSizor' opaque='false' showFontSize='true' fontSize='{getConfig().getFontSize()}'/>
<!--defaultFontSize='{getConfig().getFontSize()}' fontSize='{getConfig().getFontSize()}'/>-->
</JToolBar>
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2009-12-22 17:34:34 UTC (rev 1694)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2009-12-22 17:35:06 UTC (rev 1695)
@@ -30,6 +30,7 @@
import jaxx.runtime.swing.editor.config.ConfigUI;
import jaxx.runtime.swing.editor.config.ConfigUIBuilder;
import jaxx.runtime.swing.editor.config.model.ConfigUIModel;
+import jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder;
import jaxx.runtime.swing.navigation.NavigationTreeNode;
import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer;
import org.apache.commons.logging.Log;
@@ -61,15 +62,26 @@
* Methode pour initialiser l'ui principale sans l'afficher.
*
* @param rootContext le context applicatif
- * @param fullscreen flag pour indiquer si on doit ouvrir l'ui en model console (pleine ecran).
+ * @param config la configuration a utiliser
* @return l'ui instancie et initialisee mais non visible encore
*/
- public DemoUI initUI(DefaultApplicationContext rootContext, boolean fullscreen) {
+ public DemoUI initUI(DefaultApplicationContext rootContext, DemoConfig config) {
if (log.isDebugEnabled()) {
- log.debug("fullscreen ? " + fullscreen);
+ log.debug("fullscreen ? " + config.isFullScreen());
}
+ DecoratorProvider decoratorProvider = rootContext.getContextValue(DecoratorProvider.class);
+ if (!config.getLocale().equals(I18n.getLoader().getLanguage().getLocale())) {
+ if (log.isInfoEnabled()) {
+ log.info("re-init I18n with locale " + config.getLocale());
+ }
+ // change i18n language
+ I18n.init(config.getLocale());
+ // reload decorators
+ decoratorProvider.reload();
+ }
+
// create restrict context for ui
JAXXInitialContext context = new JAXXInitialContext();
@@ -82,11 +94,10 @@
// share config
context.add(rootContext.getContextValue(DemoConfig.class));
+ // share a unique DecoratorProvider
+ context.add(decoratorProvider);
+
// share a unique DecoratorProviderListCellRenderer
- DecoratorProvider decoratorProvider = rootContext.getContextValue(DecoratorProvider.class);
-
- context.add(decoratorProvider);
-
context.add(new DecoratorProviderListCellRenderer(decoratorProvider));
// instanciate ui
@@ -99,7 +110,7 @@
ErrorDialogUI.init(ui);
// set fullscreen propery on main ui
- ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(fullscreen ? ui : null);
+ ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
return ui;
}
@@ -149,9 +160,9 @@
* Permet de recharger l'ui principale et de changer de le mode d'affichage.
*
* @param rootContext le contexte applicatif
- * @param fullscreen le type de fenetre à reouvrir
+ * @param config la configuration a utiliser
*/
- public void reloadUI(DefaultApplicationContext rootContext, boolean fullscreen) {
+ public void reloadUI(DefaultApplicationContext rootContext, DemoConfig config) {
// scan main ui
DemoUI ui = getUI(rootContext);
@@ -167,7 +178,9 @@
if (node != null) {
nodePath = node.getFullPath();
- log.info("selected node " + nodePath);
+ if (log.isDebugEnabled()) {
+ log.debug("selected node " + nodePath);
+ }
}
ErrorDialogUI.init(null);
@@ -177,10 +190,9 @@
ui.setVisible(false);
MAIN_UI_ENTRY_DEF.removeContextValue(rootContext);
-
}
- ui = initUI(rootContext, fullscreen);
+ ui = initUI(rootContext, config);
displayUI(ui, nodePath);
}
@@ -200,10 +212,11 @@
DemoUI ui = getUI(context);
// sauvegarde de l'état dans la configuration
- ui.getConfig().setFullscreen(fullscreen);
+ DemoConfig config = ui.getConfig();
+ config.setFullscreen(fullscreen);
// rechargement de l'ui
- reloadUI(RunDemo.get(), fullscreen);
+ reloadUI(RunDemo.get(), config);
}
public void changeLanguage(JAXXContext context, Locale newLocale) {
@@ -215,11 +228,8 @@
// sauvegarde de la nouvelle locale
config.setLocale(newLocale);
- // chargement de la nouvelle locale dans le système i18n
- I18n.init(newLocale);
-
// rechargement de l'ui
- reloadUI(RunDemo.get(), config.isFullScreen());
+ reloadUI(RunDemo.get(), config);
}
/**
@@ -240,23 +250,49 @@
public void showConfig(JAXXContext context) {
DemoUI ui = getUI(context);
- DemoConfig config = ui.getConfig();
- ConfigUIModel model = new ConfigUIModel(config);
+ final DemoConfig config = ui.getConfig();
+ ConfigUIModelBuilder builder = new ConfigUIModelBuilder();
+
+ builder.createModel(config);
+
+ builder.setReloadUICallback(new Runnable() {
+
+ @Override
+ public void run() {
+ if (log.isInfoEnabled()) {
+ log.info("will reload ui");
+ }
+ DefaultApplicationContext context = RunDemo.get();
+ DemoUI ui = getUI(context);
+ DemoConfig config = ui.getConfig();
+ reloadUI(context, config);
+ }
+ });
+
// categorie repertoires
- model.addCategory(
- n_("jaxxdemo.config.category.directories"),
- n_("jaxxdemo.config.category.directories.description"),
- DemoConfig.Option.CONFIG_FILE);
+ builder.addCategory(n_("jaxxdemo.config.category.directories"),
+ n_("jaxxdemo.config.category.directories.description"));
+
+ builder.addOption(DemoConfig.Option.CONFIG_FILE);
+
// others
- model.addCategory(
- n_("jaxxdemo.config.category.other"),
- n_("jaxxdemo.config.category.other.description"),
- DemoConfig.Option.FULL_SCREEN,
- DemoConfig.Option.FONT_SIZE,
- DemoConfig.Option.LOCALE);
+ builder.addCategory(n_("jaxxdemo.config.category.other"),
+ n_("jaxxdemo.config.category.other.description"));
+ builder.addOption(DemoConfig.Option.FULL_SCREEN);
+ builder.setOptionPropertyName(DemoConfig.PROPERTY_FULLSCREEN);
+ builder.setOptionNeedReloadUI(true);
+
+ builder.addOption(DemoConfig.Option.FONT_SIZE);
+ builder.setOptionPropertyName(DemoConfig.PROPERTY_FONT_SIZE);
+
+ builder.addOption(DemoConfig.Option.LOCALE);
+ builder.setOptionPropertyName(DemoConfig.PROPERTY_LOCALE);
+ builder.setOptionNeedReloadUI(true);
+
+ ConfigUIModel model = builder.flushModel();
ConfigUI configUI = ConfigUIBuilder.newConfigUI(context, model, "jaxxdemo.config.category.directories");
ConfigUIBuilder.showConfigUI(configUI, ui, false);
Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java
===================================================================
--- trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2009-12-22 17:34:34 UTC (rev 1694)
+++ trunk/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2009-12-22 17:35:06 UTC (rev 1695)
@@ -126,7 +126,7 @@
// on affiche l'ui principale
DemoUIHandler handler = new DemoUIHandler();
- DemoUI ui = handler.initUI(rootContext, config.isFullScreen());
+ DemoUI ui = handler.initUI(rootContext, config);
log.info(_("jaxxdemo.init.ui.done"));
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-12-22 17:34:34 UTC (rev 1694)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties 2009-12-22 17:35:06 UTC (rev 1695)
@@ -165,6 +165,7 @@
jaxxdemo.config.category.other=Others
jaxxdemo.config.category.other.description=Others preferences
jaxxdemo.config.configFileName.description=Configuration file name
+jaxxdemo.config.ui.=
jaxxdemo.config.ui.demo.path=
jaxxdemo.config.ui.fontSize=
jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen)
Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-12-22 17:34:34 UTC (rev 1694)
+++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties 2009-12-22 17:35:06 UTC (rev 1695)
@@ -165,6 +165,7 @@
jaxxdemo.config.category.other=Autre
jaxxdemo.config.category.other.description=Autres options
jaxxdemo.config.configFileName.description=Le nom du fichier de configuration
+jaxxdemo.config.ui.=
jaxxdemo.config.ui.demo.path=
jaxxdemo.config.ui.fontSize=
jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran
Modified: trunk/jaxx-demo/src/main/resources/log4j.properties
===================================================================
--- trunk/jaxx-demo/src/main/resources/log4j.properties 2009-12-22 17:34:34 UTC (rev 1694)
+++ trunk/jaxx-demo/src/main/resources/log4j.properties 2009-12-22 17:35:06 UTC (rev 1695)
@@ -6,8 +6,7 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
log4j.logger.jaxx.demo=INFO
-log4j.logger.jaxx.runtime.swing.editor.I18nEditor=INFO
-#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeCellRenderer=DEBUG
-#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeNodeRenderer=DEBUG
-#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeModel=DEBUG
+log4j.logger.jaxx.demo.DemoConfig=DEBUG
+log4j.logger.jaxx.runtime.swing.editor.config=INFO
+log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG
log4j.logger.org.nuiton=WARN
1
0