Author: tchemit
Date: 2010-03-10 13:07:05 +0100 (Wed, 10 Mar 2010)
New Revision: 1764
Log:
- Evolution #349: Use nuiton-utils 1.2 and nuiton-i18n 1.1
- reformat mojo
- use new I18n api
- clean i18n in widgets
Modified:
trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx
trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java
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/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java
trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java
trunk/pom.xml
Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx
===================================================================
--- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx 2010-03-10 12:07:05 UTC (rev 1764)
@@ -175,7 +175,8 @@
@Override
public void actionPerformed(ActionEvent event) {
- Locale value = (Locale) ((JComponent)event.getSource()).getClientProperty("locale");
+ Locale value = (Locale)
+ ((JComponent)event.getSource()).getClientProperty("locale");
if (log.isDebugEnabled()) {
log.debug("new locale : " + value);
}
@@ -183,8 +184,8 @@
}
public void loadI18nBundles() {
- Locale[] locales = org.nuiton.i18n.I18n.getLoader().getLocales();
- setLocales(java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales()));
+ Locale[] locales = org.nuiton.i18n.I18n.getStore().getLocales();
+ setLocales(java.util.Arrays.asList(locales));
}
protected void rebuildPopup() {
Modified: trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties
===================================================================
--- trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties 2010-03-10 12:07:05 UTC (rev 1764)
@@ -9,8 +9,8 @@
config.action.reset.tip=Cancel the modifications for the category
config.action.save=Save
config.action.save.tip=Save the modifications for the category
-config.category.needReloadApplication=
-config.category.needReloadUI=
+config.category.needReloadApplication=Category '%1$s' \:
+config.category.needReloadUI=Category '%1$s' \:
config.category.saved=The category '%1$s' was modified \:
config.choice.cancel=Cancel
config.choice.continue=Continue
@@ -29,8 +29,8 @@
config.launch.callBack.tip=Perform necessary actions
config.message.quit.invalid.category=The category '%1$s' is not valid\!
config.message.quit.valid.and.modified.category=The category '%1$s' has some modified options \:
-config.model.needReloadApplication=
-config.model.needReloadUI=
+config.model.needReloadApplication=Some options were modified and need to reload application.\n
+config.model.needReloadUI=Some options were modified and need to reload GUI.\n
config.modified=Option was modified (previous value \: %1$s)
config.no.option.selected=< No selected option >
config.option.final=This option can not be modified
Modified: trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java
===================================================================
--- trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/jaxx-widgets/src/test/java/jaxx/runtime/swing/editor/config/model/ConfigUIModelBuilderTest.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -1,11 +1,13 @@
package jaxx.runtime.swing.editor.config.model;
+import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.editor.MyDefaultCellEditor;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import javax.swing.*;
import javax.swing.table.TableCellEditor;
/**
@@ -51,49 +53,45 @@
ConfigUIModel configModel = builder.flushModel();
Assert.assertNotNull(configModel);
Assert.assertNotNull(configModel.getConfig());
-
}
@Test(expected = IllegalStateException.class)
- public void testSetReloadApplicationCallbackLimitCase0() throws Exception {
- builder.setReloadApplicationCallback(null);
+ public void testRegisterCallbackLimitCase() throws Exception {
+ builder.registerCallBack(null, null, null, null);
}
@Test(expected = NullPointerException.class)
- public void testSetReloadApplicationCallbackLimitCase1() throws Exception {
+ public void testRegisterCallbackLimitCase0() throws Exception {
builder.createModel(config);
- builder.setReloadApplicationCallback(null);
+ builder.registerCallBack(null, null, null, null);
}
- @Test
- public void testSetReloadApplicationCallback() throws Exception {
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase1() throws Exception {
builder.createModel(config);
+ builder.registerCallBack("yo", null, null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase2() throws Exception {
+ builder.createModel(config);
+ builder.registerCallBack("yo", "yo description", null, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRegisterCallbackLimitCase4() throws Exception {
+ builder.createModel(config);
Runnable callback = new Runnable() {
@Override
public void run() {
}
};
- builder.setReloadApplicationCallback(callback);
- ConfigUIModel configModel = builder.flushModel();
- Assert.assertNotNull(configModel);
- Assert.assertNotNull(configModel.getConfig());
- Assert.assertEquals(callback, configModel.getReloadApplicationCallback());
+ builder.registerCallBack("yo", "yo description", null, callback);
}
- @Test(expected = IllegalStateException.class)
- public void testSetReloadUICallbackLimitCase0() throws Exception {
- builder.setReloadUICallback(null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testSetReloadUICallbackLimitCase1() throws Exception {
- builder.createModel(config);
- builder.setReloadUICallback(null);
- }
-
@Test
- public void testSetReloadUICallback() throws Exception {
+ public void testRegisterCallback() throws Exception {
builder.createModel(config);
Runnable callback = new Runnable() {
@@ -101,11 +99,16 @@
public void run() {
}
};
- builder.setReloadUICallback(callback);
+ ImageIcon icon = SwingUtil.createActionIcon("add");
+ builder.registerCallBack("yo","yo description", icon, callback);
ConfigUIModel configModel = builder.flushModel();
Assert.assertNotNull(configModel);
Assert.assertNotNull(configModel.getConfig());
- Assert.assertEquals(callback, configModel.getReloadUICallback());
+ CallBackEntry callBackEntry =
+ configModel.getCallBacksManager().getCallBack("yo");
+ Assert.assertNotNull(callBackEntry );
+
+ Assert.assertEquals(callback, callBackEntry.getAction());
}
@Test(expected = IllegalStateException.class)
@@ -189,7 +192,6 @@
builder.setOptionPropertyName(null);
}
-
@Test(expected = NullPointerException.class)
public void testSetOptionPropertyNameLimitCase3() throws Exception {
builder.createModel(config);
@@ -208,7 +210,7 @@
Assert.assertNotNull(optionModel);
Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def);
Assert.assertEquals(MyConfig.PROPERTY_LOCALE, optionModel.propertyName);
- Assert.assertEquals(false, optionModel.needReloadUI);
+// Assert.assertEquals(false, optionModel.needReloadUI);
Assert.assertNull(optionModel.editor);
}
@@ -250,76 +252,11 @@
Assert.assertNotNull(optionModel);
Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def);
Assert.assertNull(optionModel.propertyName);
- Assert.assertEquals(false, optionModel.needReloadUI);
+// Assert.assertEquals(false, optionModel.needReloadUI);
Assert.assertEquals(cellEditor, optionModel.editor);
}
- @Test(expected = IllegalStateException.class)
- public void testSetOptionNeedReloadUILimitCase0() throws Exception {
- builder.setOptionNeedReloadUI(false);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionNeedReloadUILimitCase1() throws Exception {
- builder.createModel(config);
- builder.setOptionNeedReloadUI(true);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionNeedReloadUILimitCase2() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.setOptionNeedReloadUI(false);
- }
-
@Test
- public void testSetOptionNeedReloadUI() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(MyConfig.Option.LOCALE);
- builder.setOptionNeedReloadUI(true);
- OptionModel optionModel = builder.flushOption();
- Assert.assertNotNull(optionModel);
- Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def);
- Assert.assertEquals(true, optionModel.needReloadUI);
- Assert.assertNull(optionModel.propertyName);
- Assert.assertNull(optionModel.editor);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionNeedReloadApplicationLimitCase0() throws Exception {
- builder.setOptionNeedReloadApplication(false);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionNeedReloadApplicationLimitCase1() throws Exception {
- builder.createModel(config);
- builder.setOptionNeedReloadApplication(true);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testSetOptionNeedReloadApplicationLimitCase2() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.setOptionNeedReloadApplication(false);
- }
-
- @Test
- public void testSetOptionNeedReloadApplication() throws Exception {
- builder.createModel(config);
- builder.addCategory("cat0", "cat0 label");
- builder.addOption(MyConfig.Option.LOCALE);
- builder.setOptionNeedReloadApplication(true);
- OptionModel optionModel = builder.flushOption();
- Assert.assertNotNull(optionModel);
- Assert.assertEquals(MyConfig.Option.LOCALE, optionModel.def);
- Assert.assertEquals(true, optionModel.needReloadApplication);
- Assert.assertNull(optionModel.propertyName);
- Assert.assertNull(optionModel.editor);
- }
-
-
- @Test
public void testFlushModel() throws Exception {
builder.createModel(config);
ConfigUIModel configModel = builder.flushModel();
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 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -20,7 +20,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.maven.plugin.MojoFailureException;
-import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.I18nUtil;
import java.io.*;
import java.util.*;
@@ -61,8 +61,8 @@
*/
private String helpIdsFilename;
/**
- * The store of cumulate helpIds generated by the goal {@link GenerateMojo} and then
- * used by the goal {@link GenerateHelpMojo}.
+ * 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
@@ -90,15 +90,18 @@
* 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 isDefaultLocale {@code true} if given locale is de the default
+ * 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).
+ * @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 source,
- 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
@@ -109,22 +112,26 @@
protected void init() throws Exception {
if (StringUtils.isEmpty(locales)) {
- throw new MojoFailureException("You must set the 'locales' property properly (was " + locales + ").");
+ throw new MojoFailureException(
+ "You must set the 'locales' property properly (was " +
+ locales + ").");
}
// check there is a outHelp
if (getTargetDirectory() == null) {
- throw new MojoFailureException("You must set the 'outputHelpXXX' property.");
+ throw new MojoFailureException(
+ "You must set the 'outputHelpXXX' property.");
}
List<Locale> tmp = new ArrayList<Locale>();
for (String loc : locales.split(",")) {
- Locale l = I18n.newLocale(loc);
+ Locale l = I18nUtil.newLocale(loc);
tmp.add(l);
}
if (tmp.isEmpty()) {
- throw new MojoFailureException("No locale to react, 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()]);
@@ -147,11 +154,11 @@
for (Locale locale : localesToTreate) {
- boolean isDefaultLocale = locale == defaultLocale;
+ boolean isDefaultLocale = defaultLocale.equals(locale);
String language = locale.getLanguage();
- String localePath = (isDefaultLocale ? "default" : language);
+ String localePath = isDefaultLocale ? "default" : language;
File source = new File(getTargetDirectory(), localePath);
@@ -173,11 +180,13 @@
}
public File getHelpIdsStoreFile() {
- return outputHelpIds == null ? null : new File(outputHelpIds, helpIdsFilename);
+ return outputHelpIds == null ? null :
+ new File(outputHelpIds, helpIdsFilename);
}
public File getMergeHelpIdsStoreFile() {
- return outputHelpIds == null ? null : new File(outputHelpIds, mergeHelpIdsFilename);
+ return outputHelpIds == null ? null :
+ new File(outputHelpIds, mergeHelpIdsFilename);
}
public String getHelpIdsFilename() {
@@ -213,20 +222,20 @@
BufferedReader reader = null;
Set<String> result = new HashSet<String>();
+ reader = new BufferedReader(new InputStreamReader(
+ new FileInputStream(file), getEncoding()));
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);
+ getLog().info("load " + result.size() +
+ " help ids from file " + file);
}
return result;
} finally {
- if (reader != null) {
- reader.close();
- }
+ reader.close();
}
}
@@ -255,4 +264,4 @@
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 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -145,7 +145,8 @@
if (!dir.exists()) {
return null;
}
- GetLastModifiedFileAction fileAction = new GetLastModifiedFileAction(dir);
+ GetLastModifiedFileAction fileAction =
+ new GetLastModifiedFileAction(dir);
FileUtil.walkAfter(dir, fileAction);
return fileAction.getLastFile().lastModified();
}
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 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -42,7 +42,8 @@
*/
public class GenerateHelpFilesMojo extends AbstractGenerateHelpMojo {
- protected static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE";
+ protected static final String AUTOREMOVE_LINE =
+ "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE";
/**
* The directory where to create or update help files.
@@ -129,7 +130,7 @@
@Override
public void setTargetDirectory(File targetDirectory) {
- this.outputHelp = targetDirectory;
+ outputHelp = targetDirectory;
}
@Override
@@ -183,7 +184,8 @@
if (!idsFile.exists()) {
// pas de fichier a traiter
if (isForce()) {
- getLog().info("Force flag is on, but no helpIdStore-all to react at " + idsFile);
+ getLog().info("Force flag is on, but no helpIdStore-all" +
+ " to react at " + idsFile);
} else {
getLog().info("no helpIdStore to react at " + idsFile);
}
@@ -197,11 +199,16 @@
return b;
}
+ @Override
protected void postDoAction() {
getLog().info(touchedFiles + " file(s) treated.");
}
- protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
+ @Override
+ protected void doActionForLocale(Locale locale,
+ boolean isDefaultLocale,
+ File localizedTarget,
+ String localePath) throws Exception {
String language = locale.getLanguage();
@@ -274,7 +281,9 @@
touchedFiles += generateContentFiles(localizedTarget, env, localePath);
}
- protected int generateContentFiles(File localizedTarget, Properties env, String localePath) throws Exception {
+ protected int generateContentFiles(File localizedTarget,
+ Properties env,
+ String localePath) throws Exception {
int touchedFiles = 0;
VelocityTemplateGenerator gen = prepareGenerator(contentTemplate);
@@ -312,7 +321,8 @@
return touchedFiles;
}
- protected boolean generateHelpsetFile(File file, Properties env) throws Exception {
+ protected boolean generateHelpsetFile(File file,
+ Properties env) throws Exception {
if (file.exists()) {
// check the autoremove line presence
@@ -337,7 +347,8 @@
return true;
}
- protected Properties generateMapFile(File file, Properties env) throws Exception {
+ protected Properties generateMapFile(File file,
+ Properties env) throws Exception {
boolean create;
@@ -350,7 +361,8 @@
getLog().info("loading existing helpset map file " + file);
}
- mergedHelpIds = XmlHelper.getExistingHelpIds(file, isVerbose(), getLog());
+ mergedHelpIds = XmlHelper.getExistingHelpIds(file, isVerbose(),
+ getLog());
create = false;
} else {
@@ -391,7 +403,8 @@
return mergedHelpIds;
}
- protected NodeItem generateIndexFile(File file, Properties env) throws Exception {
+ protected NodeItem generateIndexFile(File file,
+ Properties env) throws Exception {
NodeItem rootItem = null;
boolean create;
@@ -432,7 +445,8 @@
return rootItem;
}
- protected NodeItem generateTocFile(File file, Properties env) throws Exception {
+ protected NodeItem generateTocFile(File file,
+ Properties env) throws Exception {
NodeItem rootItem = null;
boolean create;
@@ -473,19 +487,22 @@
}
- protected void doGen(File template, File f, Properties env) throws Exception {
+ 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 {
+ protected VelocityTemplateGenerator prepareGenerator(
+ File template) throws Exception {
URL templateURL = getTemplate(template);
if (isVerbose()) {
getLog().info("using template " + templateURL);
}
- VelocityTemplateGenerator gen = new VelocityTemplateGenerator(getProject(), templateURL);
+ VelocityTemplateGenerator gen =
+ new VelocityTemplateGenerator(getProject(), templateURL);
return gen;
}
-}
\ No newline at end of file
+}
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 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -41,10 +41,12 @@
// check there is some bundle
if (getHelpIdsFilename() == null) {
- throw new MojoFailureException("you must set the 'helpIdStore' property.");
+ throw new MojoFailureException(
+ "you must set the 'helpIdStore' property.");
}
if (getMergeHelpIdsFilename() == null) {
- throw new MojoFailureException("you must set the 'helpIdStoreAll' property.");
+ throw new MojoFailureException(
+ "you must set the 'helpIdStoreAll' property.");
}
helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
@@ -99,7 +101,10 @@
}
@Override
- protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File source, String localePath) throws Exception {
+ protected void doActionForLocale(Locale locale,
+ boolean isDefaultLocale,
+ File source,
+ String localePath) throws Exception {
// nothing to do specific to locale
}
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 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -53,7 +53,10 @@
protected void postDoAction() {
}
- protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
+ protected void doActionForLocale(Locale locale,
+ boolean isDefaultLocale,
+ File localizedTarget,
+ String localePath) 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 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -83,7 +83,7 @@
@Override
public void setTargetDirectory(File targetDirectory) {
- this.outputHelpSearch = targetDirectory;
+ outputHelpSearch = targetDirectory;
}
@Override
@@ -99,7 +99,10 @@
}
@Override
- protected void doActionForLocale(Locale locale, boolean isDefaultLocale, File localizedTarget, String localePath) throws Exception {
+ protected void doActionForLocale(Locale locale,
+ boolean isDefaultLocale,
+ File localizedTarget,
+ String localePath) throws Exception {
String language = locale.getLanguage();
@@ -135,7 +138,8 @@
getLog().info("lastModified of target : " + targetLast);
}
- if (targetLast == null || sourceLast == null || targetLast < sourceLast) {
+ if (targetLast == null || sourceLast == null ||
+ targetLast < sourceLast) {
// something is newer in source than in target
@@ -145,7 +149,8 @@
}
if (!generate) {
- getLog().info("Nothing to generate for language " + language + " - all files are up to date.");
+ getLog().info("Nothing to generate for language " + language +
+ " - all files are up to date.");
return;
}
@@ -174,7 +179,9 @@
addResourceDir(getTargetDirectory(), "**/*");
}
- protected void generateSearchIndex(File source, File target, Locale locale) throws Exception {
+ protected void generateSearchIndex(File source,
+ File target,
+ Locale locale) throws Exception {
long t0 = System.nanoTime();
@@ -211,8 +218,10 @@
System.setErr(err);
}
if (isVerbose()) {
- getLog().info("Search Index generated for " + locale + " in " + PluginHelper.convertTime(System.nanoTime() - t0));
+ 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 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -20,21 +20,27 @@
import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.CompilerConfiguration;
+import jaxx.compiler.I18nHelper;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.JAXXEngine;
import jaxx.compiler.beans.BeanInfoUtil;
import jaxx.compiler.binding.DataBindingHelper;
+import jaxx.compiler.spi.DefaultInitializer;
import jaxx.compiler.tags.TagManager;
import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXObject;
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.nuiton.i18n.I18n;
import org.nuiton.io.FileUpdaterHelper;
import org.nuiton.io.MirroredFileUpdater;
import org.nuiton.plugin.PluginHelper;
+import java.beans.Introspector;
import java.io.File;
+import java.lang.String;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -92,8 +98,8 @@
*/
protected String validatorFQN;
/**
- * the name of implementation of {@link jaxx.runtime.JAXXContext}
- * to be used on {@link jaxx.runtime.JAXXObject}.
+ * the name of implementation of {@link JAXXContext}to be used on
+ * {@link JAXXObject}.
* <p/>
* Must not be abstract.
*
@@ -115,11 +121,12 @@
* If not given, will use the one defined in validator
*
* @parameter expression="${jaxx.defaultDecoratorFQN}" default-value="jaxx.compiler.decorators.DefaultCompiledObjectDecorator"
- * @see jaxx.compiler.CompiledObjectDecorator
+ * @see CompiledObjectDecorator
*/
protected String defaultDecoratorFQN;
/**
- * flag to include in compiler classpath the java sources directories (src and outJava).
+ * flag to include in compiler classpath the java sources directories
+ * (src and outJava).
* <p/>
* By default, false.
*
@@ -127,7 +134,8 @@
*/
protected boolean addSourcesToClassPath;
/**
- * flag to include in compiler classpath the java resources directories (src and outJava).
+ * flag to include in compiler classpath the java resources directories
+ * (src and outJava).
* <p/>
* By default, false.
*
@@ -136,7 +144,8 @@
*/
protected boolean addResourcesToClassPath;
/**
- * flag to include in compiler classpath the compile class-path (can only be used in a test phase).
+ * flag to include in compiler classpath the compile class-path
+ * (can only be used in a test phase).
* <p/>
* By default, false.
*
@@ -153,18 +162,20 @@
*/
protected boolean addProjectClassPath;
/**
- * A flag to mark themojo to be used in a test phase. This will permits to add generated sources in test compile roots.
+ * 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"
* @since 1.6.0
*/
protected boolean testPhase;
/**
- * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object...)} method
- * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes.
+ * to make compiler i18nable, says add the
+ * {@link I18n#_(String, Object...)} method invocation on
+ * {@link I18nHelper#I18N_ATTRIBUTES} attributes.
*
* @parameter expression="${jaxx.i18nable}" default-value="true"
- * @see jaxx.compiler.I18nHelper
+ * @see I18nHelper
*/
protected boolean i18nable;
/**
@@ -190,11 +201,12 @@
*/
protected boolean resetAfterCompile;
/**
- * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(java.lang.String[])}.
+ * extra path to be added in {@link Introspector#setBeanInfoSearchPath(String[])}.
* <p/>
- * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(java.lang.String...)}
+ * add beanInfoSearchPath to be registred by
+ * {@link BeanInfoUtil#addJaxxBeanInfoPath(String...)}
* <p/>
- * and then will be use by {@link jaxx.compiler.spi.DefaultInitializer#initialize()}.
+ * and then will be use by {@link DefaultInitializer#initialize()}.
* <p/>
* <p/>
* This permit to use real beanInfo of imported graphic libraries.
@@ -300,9 +312,14 @@
updater = FileUpdaterHelper.newJaxxFileUpdater(src, outJava);
Map<File, String[]> result = new HashMap<File, String[]>();
- getFilesToTreateForRoots(includes, excludes, Arrays.asList(src.getAbsolutePath()), result, isForce() ? null : updater);
+ getFilesToTreateForRoots(
+ includes,
+ excludes,
+ Arrays.asList(src.getAbsolutePath()),
+ result,
+ isForce() ? null : updater);
- this.files = result.get(src);
+ files = result.get(src);
nofiles = files == null || files.length == 0;
if (nofiles) {
@@ -319,11 +336,16 @@
Thread.currentThread().setContextClassLoader(cl);
- compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN, false, cl);
- defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN, false, cl);
- jaxxContextClass = (Class<? extends JAXXContext>) Class.forName(jaxxContextFQN, false, cl);
+ compilerClass = (Class<? extends JAXXCompiler>)
+ Class.forName(compilerFQN, false, cl);
+ defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>)
+ Class.forName(defaultDecoratorFQN, false, cl);
+ jaxxContextClass = (Class<? extends JAXXContext>)
+ Class.forName(jaxxContextFQN, false, cl);
if (!JAXXContext.class.isAssignableFrom(jaxxContextClass)) {
- throw new MojoExecutionException("jaxxContextFQN must be an implementation of " + JAXXContext.class + " but was : " + jaxxContextClass);
+ throw new MojoExecutionException(
+ "jaxxContextFQN must be an implementation of " +
+ JAXXContext.class + " but was : " + jaxxContextClass);
}
validatorClass = Class.forName(validatorFQN, false, cl);
@@ -347,7 +369,7 @@
imports[i++] = importS.trim();
}
if (isVerbose()) {
- getLog().info("extra imports " + java.util.Arrays.toString(imports));
+ getLog().info("extra imports " + Arrays.toString(imports));
}
extraImports = imports;
}
@@ -388,9 +410,11 @@
int nbFiles = engine.run();
report(engine);
if (nbFiles == -1) {
- throw new MojoExecutionException("Aborting due to errors reported by jaxxc");
+ throw new MojoExecutionException(
+ "Aborting due to errors reported by jaxxc");
}
- getLog().info("Generated " + nbFiles + " file(s) in " + PluginHelper.convertTime(System.nanoTime() - t0));
+ getLog().info("Generated " + nbFiles + " file(s) in " +
+ PluginHelper.convertTime(System.nanoTime() - t0));
} catch (MojoExecutionException e) {
getLog().error(e);
@@ -416,7 +440,7 @@
@Override
public void setTargetDirectory(File targetDirectory) {
- this.outJava = targetDirectory;
+ outJava = targetDirectory;
}
@Override
@@ -505,7 +529,8 @@
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ return ToStringBuilder.reflectionToString(
+ this, ToStringStyle.MULTI_LINE_STYLE);
}
protected void fixCompileSourceRoots() {
@@ -515,7 +540,7 @@
// no project defined, can not fix anything
// this case could appear if we wanted to do some tests of the plugin
return;
- }
+ }
if (testPhase) {
addTestCompileSourceRoots(getTargetDirectory());
@@ -527,7 +552,10 @@
protected void report(JAXXEngine engine) {
List<String> warnings = engine.getWarnings();
if (!warnings.isEmpty()) {
- StringBuilder buffer = new StringBuilder("JAXX detects " + (warnings.size() == 1 ? "1 warning" : warnings.size() + " warnings"));
+ StringBuilder buffer = new StringBuilder(
+ "JAXX detects " +
+ (warnings.size() == 1 ? "1 warning" :
+ warnings.size() + " warnings"));
buffer.append(" :");
for (String s : warnings) {
buffer.append("\n").append(s);
@@ -536,7 +564,10 @@
}
List<String> errors = engine.getErrors();
if (!errors.isEmpty()) {
- StringBuilder buffer = new StringBuilder("JAXX detects " + (errors.size() == 1 ? "1 error" : errors.size() + " errors"));
+ StringBuilder buffer = new StringBuilder(
+ "JAXX detects " +
+ (errors.size() == 1 ? "1 error" :
+ errors.size() + " errors"));
buffer.append(" :");
for (String s : errors) {
buffer.append("\n").append(s);
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -156,6 +156,7 @@
@Override
public String toString() {
- return super.toString() + "<target:" + target + ", text:" + text + ", nbChilds:" + (isLeaf() ? 0 : childs.size()) + ">";
+ return super.toString() + "<target:" + target + ", text:" + text +
+ ", nbChilds:" + (isLeaf() ? 0 : childs.size()) + ">";
}
}
Modified: trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java
===================================================================
--- trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java 2010-03-10 12:07:05 UTC (rev 1764)
@@ -44,7 +44,10 @@
*/
public class XmlHelper {
- public static Properties getExistingHelpIds(File file, final boolean verbose, final Log log) throws SAXException, IOException {
+ public static Properties getExistingHelpIds(File file,
+ final boolean verbose,
+ final Log log)
+ throws SAXException, IOException {
final Properties result = new SortedProperties();
@@ -56,7 +59,10 @@
String url;
@Override
- public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+ public void startElement(String uri,
+ String localName,
+ String qName,
+ Attributes atts) throws SAXException {
if ("mapID".equals(localName)) {
target = atts.getValue("target");
url = atts.getValue("url");
@@ -68,19 +74,18 @@
}
});
- InputStream s=null;
+ InputStream s = new FileInputStream(file);
try {
- s = new FileInputStream(file);
parser.parse(new InputSource(s));
} finally {
- if (s != null) {
- s.close();
- }
+ s.close();
}
return result;
}
- public static NodeItem getExistingItems(String tagName, File file) throws SAXException, IOException {
+ public static NodeItem getExistingItems(String tagName,
+ File file)
+ throws SAXException, IOException {
XMLReader parser = XMLReaderFactory.createXMLReader();
NodeItemHandler handler = new NodeItemHandler(tagName);
@@ -107,7 +112,7 @@
public NodeItemHandler(String tagName) {
this.tagName = tagName;
- this.stack = new Stack<NodeItem>();
+ stack = new Stack<NodeItem>();
}
@Override
@@ -116,7 +121,10 @@
}
@Override
- public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+ public void startElement(String uri,
+ String localName,
+ String qName,
+ Attributes atts) throws SAXException {
if (tagName.equals(localName)) {
String target = atts.getValue("target");
@@ -148,7 +156,9 @@
}
@Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
+ public void endElement(String uri,
+ String localName,
+ String qName) throws SAXException {
if (tagName.equals(localName)) {
// fin d'un item
stack.pop();
@@ -174,7 +184,8 @@
}
@Override
- public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ public void startPrefixMapping(String prefix,
+ String uri) throws SAXException {
}
@Override
@@ -182,23 +193,33 @@
}
@Override
- public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+ public void startElement(String uri,
+ String localName,
+ String qName,
+ Attributes atts) throws SAXException {
}
@Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
+ public void endElement(String uri,
+ String localName,
+ String qName) throws SAXException {
}
@Override
- public void characters(char[] ch, int start, int length) throws SAXException {
+ public void characters(char[] ch,
+ int start,
+ int length) throws SAXException {
}
@Override
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ public void ignorableWhitespace(char[] ch,
+ int start,
+ int length) throws SAXException {
}
@Override
- public void processingInstruction(String target, String data) throws SAXException {
+ public void processingInstruction(String target,
+ String data) throws SAXException {
}
@Override
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-08 16:23:17 UTC (rev 1763)
+++ trunk/pom.xml 2010-03-10 12:07:05 UTC (rev 1764)
@@ -362,8 +362,8 @@
<!-- pour un muli module on doit fixer le projectId -->
<projectId>jaxx</projectId>
- <lutinutil.version>1.2-SNAPSHOT</lutinutil.version>
- <i18n.version>1.1-SNAPSHOT</i18n.version>
+ <lutinutil.version>1.2</lutinutil.version>
+ <i18n.version>1.1</i18n.version>
<jxlayer.version>3.0.3</jxlayer.version>