Nuiton-utils-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
July 2008
- 3 participants
- 152 discussions
[Lutinutil-commits] r936 - in trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo: . ui
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
28 Jul '08
Author: tchemit
Date: 2008-07-28 17:35:12 +0000 (Mon, 28 Jul 2008)
New Revision: 936
Modified:
trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoContext.java
trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java
trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java
Log:
reformat
Modified: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoContext.java
===================================================================
--- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoContext.java 2008-07-28 17:28:49 UTC (rev 935)
+++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoContext.java 2008-07-28 17:35:12 UTC (rev 936)
@@ -56,7 +56,6 @@
if (reload) {
DemoMain.launch();
}
-
}
public JDemoMainUI getMainUI() {
Modified: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java
===================================================================
--- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java 2008-07-28 17:28:49 UTC (rev 935)
+++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java 2008-07-28 17:35:12 UTC (rev 936)
@@ -67,9 +67,7 @@
/** Lancement de l'ui apr�s init de l'application. */
public static void launch() {
-
getContext().getMainUI().setVisible(true);
-
}
@@ -94,7 +92,6 @@
}
launch();
-
}
}
Modified: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java
===================================================================
--- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java 2008-07-28 17:28:49 UTC (rev 935)
+++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java 2008-07-28 17:35:12 UTC (rev 936)
@@ -22,28 +22,21 @@
import javax.swing.KeyStroke;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
import java.awt.event.WindowEvent;
/** @author chemit */
public class DemoMainUI extends JDemoMainUI {
public DemoMainUI() {
-
super();
-
finalizeInit(DemoMain.getContext());
-
}
-
protected void finalizeInit(final DemoContext context) {
// chargement dans l'ui des actions
context.getActionFactory().loadActions(this);
- addMouseListener(new MouseAdapter() {
- });
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK), "quit");
getRootPane().getActionMap().put("quit", context.getActionFactory().newAction("quit", null));
1
0
[Lutinutil-commits] r935 - trunk/commandline/commandline-ui-action/src/main/resources/i18n
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
28 Jul '08
Author: tchemit
Date: 2008-07-28 17:28:49 +0000 (Mon, 28 Jul 2008)
New Revision: 935
Modified:
trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties
trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties
Log:
i18n
Modified: trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties 2008-07-28 12:22:21 UTC (rev 934)
+++ trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties 2008-07-28 17:28:49 UTC (rev 935)
@@ -20,4 +20,3 @@
commandline.no=No
commandline.question=Quit
commandline.yes=Yes
-lutinutil.about=
Modified: trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties 2008-07-28 12:22:21 UTC (rev 934)
+++ trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties 2008-07-28 17:28:49 UTC (rev 935)
@@ -20,4 +20,3 @@
commandline.no=Non
commandline.question=Quitter
commandline.yes=Oui
-lutinutil.about=
1
0
[Lutinutil-commits] r934 - in trunk/commandline: commandline-ui/src/test/java/org/codelutin/option/ui maven-plugin/src/main/java/org/codelutin/option/def maven-plugin/src/main/java/org/codelutin/option/generate
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
28 Jul '08
Author: tchemit
Date: 2008-07-28 12:22:21 +0000 (Mon, 28 Jul 2008)
New Revision: 934
Modified:
trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/MandatoryConfigProperty.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorContext.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java
Log:
mise en place action About
ajout de proprietes obligatoires supplementaires
fix bug sur l'action Quit
Modified: trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java
===================================================================
--- trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java 2008-07-28 12:22:08 UTC (rev 933)
+++ trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java 2008-07-28 12:22:21 UTC (rev 934)
@@ -40,6 +40,7 @@
public static void main(String[] args) throws Exception {
I18n.init();
+ new JLoginUI().setVisible(true);
new ConfigUI().init(null,
new MyConfig(),
new MyConfigLocal(),
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/MandatoryConfigProperty.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/MandatoryConfigProperty.java 2008-07-28 12:22:08 UTC (rev 933)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/MandatoryConfigProperty.java 2008-07-28 12:22:21 UTC (rev 934)
@@ -37,9 +37,21 @@
/** le nom du projet */
projectName("java.lang.String", "mandatory,static,final"),
+ /** le website du projet */
+ projectURL("java.net.URL", "mandatory,static,final"),
+
+ /** le nom de l'oganisation */
+ organisationName("java.lang.String", "mandatory,static,final"),
+
+ /** le website de l'organisation */
+ organisationURL("java.net.URL", "mandatory,static,final"),
+
/** la version du projet */
- version("org.codelutin.util.VersionNumber", "mandatory,static,final");
+ version("org.codelutin.util.VersionNumber", "mandatory,static,final"),
+ /** la version du projet */
+ copyright("java.lang.String", "mandatory,static,final");
+
private final String type;
private final String modifiers;
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorContext.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorContext.java 2008-07-28 12:22:08 UTC (rev 933)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorContext.java 2008-07-28 12:22:21 UTC (rev 934)
@@ -256,6 +256,11 @@
injects.put(MandatoryConfigProperty.configFileName.name(), goal._configFileName);
injects.put(MandatoryConfigProperty.projectName.name(), goal._projectName);
+ injects.put(MandatoryConfigProperty.projectURL.name(), goal._projectURL);
+ injects.put(MandatoryConfigProperty.organisationName.name(), goal._organisationName);
+ injects.put(MandatoryConfigProperty.organisationURL.name(), goal._organisationURL);
+ injects.put(MandatoryConfigProperty.copyright.name(), goal._copyright);
+
injects.put(MandatoryConfigProperty.encoding.name(), goal._encoding);
injects.put(MandatoryConfigProperty.locale.name(), goal._locale);
injects.put(MandatoryConfigProperty.version.name(), goal._version.endsWith("-SNAPSHOT") ? goal._version.substring(0, goal._version.indexOf("-SNAPSHOT")) : goal._version);
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java 2008-07-28 12:22:08 UTC (rev 933)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java 2008-07-28 12:22:21 UTC (rev 934)
@@ -145,12 +145,34 @@
protected String _configFileName;
/**
- * @description le nom du fichier de configuration dans la configuration genere
+ * @description le nom du projet
* @parameter expression="${commandline._projectName}" default-value="${project.artifactId}"
* @required
*/
protected String _projectName;
+
/**
+ * @description l'url de l'application
+ * @parameter expression="${commandline._projectURL}"
+ * @required
+ */
+ protected String _projectURL;
+
+ /**
+ * @description le nom du projet
+ * @parameter expression="${commandline.__organisationName}"
+ * @required
+ */
+ protected String _organisationName;
+
+ /**
+ * @description l'url de l'application
+ * @parameter expression="${commandline._organisationURL}"
+ * @required
+ */
+ protected String _organisationURL;
+
+ /**
* @description l'encoding par default dans la configuration genere
* @parameter expression="${commandline._encoding}" default-value="UTF-8"
* @required
@@ -168,7 +190,14 @@
* @required
*/
protected String _version;
+ /**
+ * @description la version dans la configuration genere
+ * @parameter expression="${commandline._copyright}"
+ * @required
+ */
+ protected String _copyright;
+
public JavaGeneratorGoal() {
super(JavaGeneratorContext.class);
}
1
0
[Lutinutil-commits] r933 - in trunk/commandline/commandline-demo: . src/main/java/org/codelutin/commandline/demo/ui src/main/java/org/codelutin/commandline/demo/ui/actions src/main/resources src/main/resources/i18n src/main/uimodel/org/codelutin/commandline/demo/ui src/site/en/rst/user src/site/fr/rst/user
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
28 Jul '08
Author: tchemit
Date: 2008-07-28 12:22:08 +0000 (Mon, 28 Jul 2008)
New Revision: 933
Modified:
trunk/commandline/commandline-demo/pom.xml
trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java
trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/CommandLineDemoBaseAction.java
trunk/commandline/commandline-demo/src/main/resources/commandline.properties
trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties
trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties
trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JDemoMainUI.jaxx
trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst
trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst
Log:
mise en place action About
ajout de proprietes obligatoires supplementaires
fix bug sur l'action Quit
Modified: trunk/commandline/commandline-demo/pom.xml
===================================================================
--- trunk/commandline/commandline-demo/pom.xml 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/pom.xml 2008-07-28 12:22:08 UTC (rev 933)
@@ -139,8 +139,12 @@
<concreteConfig>true</concreteConfig>
<concreteContextFQN>org.codelutin.commandline.demo.DemoContext</concreteContextFQN>
<_projectName>CommandlineDemo</_projectName>
+ <_projectURL>http://commandline.labs.libre-entreprise.org</_projectURL>
<_configFileName>.commandlineDemo-1</_configFileName>
<_version>${current.version}</_version>
+ <_organisationName>Codelutin</_organisationName>
+ <_organisationURL>http://codelutin.com</_organisationURL>
+ <_copyright>Copyright Codelutin 2008</_copyright>
</configuration>
</execution>
<execution>
@@ -204,7 +208,6 @@
</plugin>
-
<!-- Package phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Modified: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java
===================================================================
--- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java 2008-07-28 12:22:08 UTC (rev 933)
@@ -22,6 +22,8 @@
import javax.swing.KeyStroke;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.WindowEvent;
/** @author chemit */
public class DemoMainUI extends JDemoMainUI {
@@ -34,16 +36,25 @@
}
- protected void finalizeInit(DemoContext context) {
+ protected void finalizeInit(final DemoContext context) {
+
// chargement dans l'ui des actions
context.getActionFactory().loadActions(this);
+ addMouseListener(new MouseAdapter() {
+ });
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK), "quit");
getRootPane().getActionMap().put("quit", context.getActionFactory().newAction("quit", null));
+ addWindowListener(new java.awt.event.WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ context.getActionFactory().fireAction("quit", this);
+ }
+ });
// repaint i18n actions
- ActionHelper.refreshI18nActions(context, context.getActionFactory(), this);
+ ActionHelper.refreshI18nActions(context, context.getActionFactory(), get$JFrame0());
}
}
Modified: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/CommandLineDemoBaseAction.java
===================================================================
--- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/CommandLineDemoBaseAction.java 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/actions/CommandLineDemoBaseAction.java 2008-07-28 12:22:08 UTC (rev 933)
@@ -18,15 +18,11 @@
import org.codelutin.commandline.demo.DemoMain;
import org.codelutin.jaxx.action.MyAbstractAction;
-import java.awt.event.ActionEvent;
-
/** @author chemit */
public class CommandLineDemoBaseAction extends MyAbstractAction {
private static final long serialVersionUID = -810023044364620841L;
- protected ActionEvent e;
-
protected String getPrefix() {
return "commandlinedemo";
}
Modified: trunk/commandline/commandline-demo/src/main/resources/commandline.properties
===================================================================
--- trunk/commandline/commandline-demo/src/main/resources/commandline.properties 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/main/resources/commandline.properties 2008-07-28 12:22:08 UTC (rev 933)
@@ -16,9 +16,6 @@
main.config.definition.debugMode=java.lang.Boolean:false
main.config.modifiers.debugMode=mandatory
-main.config.definition.siteURL=java.net.URL:http://commandline.labs.libre-entreprise.org
-main.config.modifiers.siteURL=final,static,mandatory
-
###
### user properties
###
Modified: trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties
===================================================================
--- trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-en_GB.properties 2008-07-28 12:22:08 UTC (rev 933)
@@ -1,10 +1,13 @@
commandlinedemo.config.main.configFileName.description=
+commandlinedemo.config.main.copyright.description=
commandlinedemo.config.main.debugMode.description=
commandlinedemo.config.main.description=
commandlinedemo.config.main.encoding.description=
commandlinedemo.config.main.locale.description=
+commandlinedemo.config.main.organisationName.description=
+commandlinedemo.config.main.organisationURL.description=
commandlinedemo.config.main.projectName.description=
-commandlinedemo.config.main.siteURL.description=
+commandlinedemo.config.main.projectURL.description=
commandlinedemo.config.main.userFirstName.description=
commandlinedemo.config.main.userLastName.description=
commandlinedemo.config.main.userMail.description=
Modified: trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties
===================================================================
--- trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/main/resources/i18n/commandline-demo-fr_FR.properties 2008-07-28 12:22:08 UTC (rev 933)
@@ -1,10 +1,13 @@
commandlinedemo.config.main.configFileName.description=
+commandlinedemo.config.main.copyright.description=
commandlinedemo.config.main.debugMode.description=
commandlinedemo.config.main.description=
commandlinedemo.config.main.encoding.description=
commandlinedemo.config.main.locale.description=
+commandlinedemo.config.main.organisationName.description=
+commandlinedemo.config.main.organisationURL.description=
commandlinedemo.config.main.projectName.description=
-commandlinedemo.config.main.siteURL.description=
+commandlinedemo.config.main.projectURL.description=
commandlinedemo.config.main.userFirstName.description=
commandlinedemo.config.main.userLastName.description=
commandlinedemo.config.main.userMail.description=
Modified: trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JDemoMainUI.jaxx
===================================================================
--- trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JDemoMainUI.jaxx 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/main/uimodel/org/codelutin/commandline/demo/ui/JDemoMainUI.jaxx 2008-07-28 12:22:08 UTC (rev 933)
@@ -1,11 +1,11 @@
-<JFrame title="mainui.title" width="1024" height="768" defaultCloseOperation="dispose_on_close">
+<JFrame title="mainui.title" width="1024" height="768" defaultCloseOperation="do_nothing_on_close">
<JMenuBar>
- <JMenu text="mainui.menu.file">
+ <JMenu text="mainui.menu.file">
<JMenuItem id="quit"/>
</JMenu>
<JMenu text="mainui.menu.edit">
<JMenuItem id="config"/>
- </JMenu>
+ </JMenu>
<JMenu text="mainui.menu.help" mnemonic="{'H'}">
<JMenuItem id="help"/>
<JMenuItem id="site"/>
Modified: trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst
===================================================================
--- trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/site/en/rst/user/CommandLineDemoUsage.rst 2008-07-28 12:22:08 UTC (rev 933)
@@ -46,6 +46,10 @@
commandlinedemo.config.main.configFileName.description
+#. copyright (String) <defaultValue:Copyright Codelutin 2008>
+ commandlinedemo.config.main.copyright.description
+
+
#. debugMode (Boolean) <defaultValue:false>
commandlinedemo.config.main.debugMode.description
@@ -58,12 +62,20 @@
commandlinedemo.config.main.locale.description
+#. organisationName (String) <defaultValue:Codelutin>
+ commandlinedemo.config.main.organisationName.description
+
+
+#. organisationURL (URL) <defaultValue:http://codelutin.com>
+ commandlinedemo.config.main.organisationURL.description
+
+
#. projectName (String) <defaultValue:CommandlineDemo>
commandlinedemo.config.main.projectName.description
-#. siteURL (URL) <defaultValue:http://commandline.labs.libre-entreprise.org>
- commandlinedemo.config.main.siteURL.description
+#. projectURL (URL) <defaultValue:http://commandline.labs.libre-entreprise.org>
+ commandlinedemo.config.main.projectURL.description
#. userFirstName (String)
Modified: trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst
===================================================================
--- trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst 2008-07-28 12:21:47 UTC (rev 932)
+++ trunk/commandline/commandline-demo/src/site/fr/rst/user/CommandLineDemoUsage.rst 2008-07-28 12:22:08 UTC (rev 933)
@@ -46,6 +46,10 @@
commandlinedemo.config.main.configFileName.description
+#. copyright (String) <defaultValue:Copyright Codelutin 2008>
+ commandlinedemo.config.main.copyright.description
+
+
#. debugMode (Boolean) <defaultValue:false>
commandlinedemo.config.main.debugMode.description
@@ -58,12 +62,20 @@
commandlinedemo.config.main.locale.description
+#. organisationName (String) <defaultValue:Codelutin>
+ commandlinedemo.config.main.organisationName.description
+
+
+#. organisationURL (URL) <defaultValue:http://codelutin.com>
+ commandlinedemo.config.main.organisationURL.description
+
+
#. projectName (String) <defaultValue:CommandlineDemo>
commandlinedemo.config.main.projectName.description
-#. siteURL (URL) <defaultValue:http://commandline.labs.libre-entreprise.org>
- commandlinedemo.config.main.siteURL.description
+#. projectURL (URL) <defaultValue:http://commandline.labs.libre-entreprise.org>
+ commandlinedemo.config.main.projectURL.description
#. userFirstName (String)
1
0
[Lutinutil-commits] r932 - in trunk/commandline/commandline-ui-action: . src/main src/main/java/org/codelutin/option/ui src/main/java/org/codelutin/option/ui/actions src/main/resources/i18n src/main/uimodel src/main/uimodel/org src/main/uimodel/org/codelutin src/main/uimodel/org/codelutin/option src/main/uimodel/org/codelutin/option/ui
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
28 Jul '08
Author: tchemit
Date: 2008-07-28 12:21:47 +0000 (Mon, 28 Jul 2008)
New Revision: 932
Added:
trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/AboutUI.java
trunk/commandline/commandline-ui-action/src/main/uimodel/
trunk/commandline/commandline-ui-action/src/main/uimodel/org/
trunk/commandline/commandline-ui-action/src/main/uimodel/org/codelutin/
trunk/commandline/commandline-ui-action/src/main/uimodel/org/codelutin/option/
trunk/commandline/commandline-ui-action/src/main/uimodel/org/codelutin/option/ui/
trunk/commandline/commandline-ui-action/src/main/uimodel/org/codelutin/option/ui/JAboutUI.jaxx
Modified:
trunk/commandline/commandline-ui-action/pom.xml
trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/AboutAction.java
trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/QuitAction.java
trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/SiteAction.java
trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties
trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties
Log:
mise en place action About
ajout de proprietes obligatoires supplementaires
fix bug sur l'action Quit
Modified: trunk/commandline/commandline-ui-action/pom.xml
===================================================================
--- trunk/commandline/commandline-ui-action/pom.xml 2008-07-28 12:19:43 UTC (rev 931)
+++ trunk/commandline/commandline-ui-action/pom.xml 2008-07-28 12:21:47 UTC (rev 932)
@@ -100,6 +100,8 @@
</execution>
</executions>
</plugin>
+
+ <!-- jaxx -->
<plugin>
<groupId>org.codelutin.jaxx</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
@@ -109,6 +111,14 @@
</configuration>
<executions>
<execution>
+ <id>jaxx-generate</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+
+ </execution>
+
+ <execution>
<id>jaxx-generate-actions-provider</id>
<goals>
<goal>generate-actions-provider</goal>
@@ -138,6 +148,14 @@
</configuration>
</execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.codelutin.jaxx</groupId>
+ <artifactId>jaxx-swing</artifactId>
+ <scope>compile</scope>
+ <version>${jaxx.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</build>
Added: trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/AboutUI.java
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/AboutUI.java (rev 0)
+++ trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/AboutUI.java 2008-07-28 12:21:47 UTC (rev 932)
@@ -0,0 +1,91 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.option.ui;
+
+import org.codelutin.util.VersionNumber;
+
+import javax.swing.JEditorPane;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.HTMLFrameHyperlinkEvent;
+import java.awt.Desktop;
+import java.net.URL;
+
+/** @author chemit */
+public class AboutUI extends JAboutUI {
+
+ public AboutUI() {
+ super();
+ getApplicationWebsite().setEditorKit(new HTMLEditorKit());
+ getApplicationWebsite().addHyperlinkListener(createHyperLinkListener(getApplicationWebsite()));
+
+ getOrganisationWebsite().setEditorKit(new HTMLEditorKit());
+ getOrganisationWebsite().addHyperlinkListener(createHyperLinkListener(getOrganisationWebsite()));
+ }
+
+ public void init(javax.swing.JFrame frame, org.codelutin.option.Context c) {
+ if (frame != null) {
+ setLocationRelativeTo(frame);
+ }
+ org.codelutin.option.Config config = c.getMainConfig();
+ String applicationName = (String) config.getProperty("projectName");
+
+ VersionNumber applicationVersion = (VersionNumber) config.getProperty("version");
+
+ getApplicationName().setText(applicationName + " v" + applicationVersion);
+
+ URL applicationURL = (URL) config.getProperty("projectURL");
+ getApplicationWebsite().setText("<a href=\"" + applicationURL + "\">" + applicationURL + "</a>");
+
+ String organisationName = (String) config.getProperty("organisationName");
+ getOrganisationName().setText(organisationName);
+
+ URL organisationURL = (URL) config.getProperty("organisationURL");
+ getOrganisationWebsite().setText("<a href=\"" + organisationURL + "\">" + organisationURL + "</a>");
+
+ String copyright = (String) config.getProperty("copyright");
+ getCopyright().setText(copyright);
+ pack();
+
+ }
+
+ public HyperlinkListener createHyperLinkListener(final JEditorPane doc) {
+ return new HyperlinkListener() {
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ if (e instanceof HTMLFrameHyperlinkEvent) {
+ ((HTMLDocument) doc.getDocument()).processHTMLFrameHyperlinkEvent(
+ (HTMLFrameHyperlinkEvent) e);
+ } else {
+ try {
+ if (
+ Desktop.isDesktopSupported() &&
+ Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ Desktop.getDesktop().browse(e.getURL().toURI());
+ } else {
+ doc.setPage(e.getURL());
+ }
+ } catch (Exception eee) {
+ System.out.println("Error for : " + e.getURL());
+ eee.printStackTrace();
+ }
+ }
+ }
+ }
+ };
+ }
+}
Modified: trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/AboutAction.java
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/AboutAction.java 2008-07-28 12:19:43 UTC (rev 931)
+++ trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/AboutAction.java 2008-07-28 12:21:47 UTC (rev 932)
@@ -14,6 +14,8 @@
*/
package org.codelutin.option.ui.actions;
+import org.codelutin.option.ui.AboutUI;
+
/**
* Action pour afficher la dialogue de modification de configuration
*
@@ -31,6 +33,7 @@
public class AboutAction extends CommandLineBaseAction {
private static final long serialVersionUID = 9050439968144935986L;
+ AboutUI aboutUI;
public AboutAction(String name) {
super(name);
@@ -38,12 +41,22 @@
@Override
public void doAction(java.awt.event.ActionEvent e) {
- log.info("To be done!");
+ getAboutUI().setVisible(true);
}
@Override
public void disposeUI() {
super.disposeUI();
+ if (aboutUI != null) {
+ aboutUI = null;
+ }
}
+ public AboutUI getAboutUI() {
+ if (aboutUI == null) {
+ aboutUI = new AboutUI();
+ aboutUI.init(null, getContext());
+ }
+ return aboutUI;
+ }
}
\ No newline at end of file
Modified: trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/QuitAction.java
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/QuitAction.java 2008-07-28 12:19:43 UTC (rev 931)
+++ trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/QuitAction.java 2008-07-28 12:21:47 UTC (rev 932)
@@ -60,7 +60,7 @@
result = n == JOptionPane.YES_OPTION;
}
-
+ log.info("to treate ? " + result);
return result;
}
Modified: trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/SiteAction.java
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/SiteAction.java 2008-07-28 12:19:43 UTC (rev 931)
+++ trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/SiteAction.java 2008-07-28 12:21:47 UTC (rev 932)
@@ -47,7 +47,7 @@
if (!super.beforeAction(e) && !Desktop.isDesktopSupported() && !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
return false;
}
- siteUrl = (URL) getContext().getMainConfig().getProperty("siteURL");
+ siteUrl = (URL) getContext().getMainConfig().getProperty("projectURL");
return siteUrl != null;
}
Modified: trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties 2008-07-28 12:19:43 UTC (rev 931)
+++ trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-en_GB.properties 2008-07-28 12:21:47 UTC (rev 932)
@@ -20,3 +20,4 @@
commandline.no=No
commandline.question=Quit
commandline.yes=Yes
+lutinutil.about=
Modified: trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties 2008-07-28 12:19:43 UTC (rev 931)
+++ trunk/commandline/commandline-ui-action/src/main/resources/i18n/commandline-ui-action-fr_FR.properties 2008-07-28 12:21:47 UTC (rev 932)
@@ -20,3 +20,4 @@
commandline.no=Non
commandline.question=Quitter
commandline.yes=Oui
+lutinutil.about=
Added: trunk/commandline/commandline-ui-action/src/main/uimodel/org/codelutin/option/ui/JAboutUI.jaxx
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/uimodel/org/codelutin/option/ui/JAboutUI.jaxx (rev 0)
+++ trunk/commandline/commandline-ui-action/src/main/uimodel/org/codelutin/option/ui/JAboutUI.jaxx 2008-07-28 12:21:47 UTC (rev 932)
@@ -0,0 +1,43 @@
+<JDialog title="commandline.action.about" undecorated='false' resizable='false' modal='true' locationRelativeTo="{null}"
+ defaultCloseOperation="dispose_on_close"
+ width="300" height="300">
+ <!--onMouseClicked="dispose()"-->
+
+ <Table insets='5,5,5,5'>
+ <row>
+ <cell>
+ <JLabel id="applicationName"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JEditorPane id="applicationWebsite" contentType="text/html" editable='false' opaque='false'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JSeparator orientation='horizontal'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id="organisationName"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JEditorPane id="organisationWebsite" contentType="text/html" editable='false'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JSeparator orientation='horizontal'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id="copyright"/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
1
0
[Lutinutil-commits] r931 - trunk/commandline/commandline-core/src/main/java/org/codelutin/option
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
by tchemit@users.labs.libre-entreprise.org 28 Jul '08
28 Jul '08
Author: tchemit
Date: 2008-07-28 12:19:43 +0000 (Mon, 28 Jul 2008)
New Revision: 931
Added:
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKey.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKeyImpl.java
Modified:
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java
Log:
javadoc
mise en place d'un context dynamique
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java 2008-07-27 10:36:26 UTC (rev 930)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java 2008-07-28 12:19:43 UTC (rev 931)
@@ -73,6 +73,9 @@
/** le timestamp de d�marrage de l'application */
protected final long startingTime;
+ /** le dictionnaire de valeurs suppl�mentaires */
+ protected final java.util.Map<String, Object> extraValues;
+
protected AbstractContext(Class<P> parserClass, Class<? extends Config>... configs) throws Exception {
startingTime = System.nanoTime();
String home = System.getProperty("user.home");
@@ -98,6 +101,9 @@
for (ConfigKey configKey : getConfigKeys()) {
this.configs[i++] = configKey.instanciateConfig();
}
+
+ extraValues = new java.util.TreeMap<String, Object>();
+
}
protected AbstractContext(Class<P> parserClass) throws Exception {
@@ -122,6 +128,7 @@
for (ConfigKey configKey : getConfigKeys()) {
this.configs[i++] = configKey.instanciateConfig();
}
+ extraValues = new java.util.TreeMap<String, Object>();
}
public void init(String[] args) throws Exception {
@@ -380,4 +387,36 @@
visitor.enterConfig(configKey);
}
}
+
+ public <T> void addContextValue(ContextKey<T> key, T value) {
+ String strKey = key.getKey();
+ if (!extraValues.containsKey(strKey)) {
+ extraValues.put(strKey, value);
+ }
+ if (log.isWarnEnabled()) {
+ log.warn("on existing value for key " + key);
+ }
+ extraValues.put(strKey, value);
+ }
+
+ public <T> void removeContextValue(ContextKey<T> key) {
+ String strKey = key.getKey();
+ if (extraValues.containsKey(strKey)) {
+ extraValues.remove(strKey);
+ }
+ }
+
+ public void removeAllContextValues() {
+ extraValues.clear();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public <T> T getContextValue(ContextKey<T> key) {
+ String strKey = key.getKey();
+ if (!extraValues.containsKey(strKey)) {
+ //TODO Should throw an exception
+ return null;
+ }
+ return (T) extraValues.get(strKey);
+ }
}
\ No newline at end of file
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java 2008-07-27 10:36:26 UTC (rev 930)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java 2008-07-28 12:19:43 UTC (rev 931)
@@ -18,60 +18,233 @@
import java.io.IOException;
import java.util.List;
-/** @author chemit */
+/**
+ * Contract of an application context.
+ * <p/>
+ * The context box an {@link OptionParser}, some {@link Config}.
+ * <p/>
+ * A context can also have dynamic entries (see the XXXContextValue(s) method).
+ *
+ * @author chemit
+ */
public interface Context<P extends OptionParser> extends ContextVisitable {
+ /**
+ * Init the context (says init the parser and the config)
+ *
+ * @param args arguments passed to application
+ * @throws Exception if any pb while initialisation.
+ */
void init(String[] args) throws Exception;
+ /** @return the starting time of the context (says when the context is instanciated) */
long getStartingTime();
+ /** @return the delay elasped from {@link #getStartingTime()} to now */
long getElapsedTime();
+ /** @return the delay elasped from {@link #getStartingTime()} to now as a String representation */
String getElapsedTimeAsString();
/** initialisation i18n apr�s init du parser et des configs. */
void initI18n();
- /** @return la configuration principale de l'application */
+ /**
+ * Accessor of the main configuration of context.
+ *
+ * @return la configuration principale de l'application
+ */
Config getMainConfig();
+ /** @return the boxed {@link OptionParser} */
P getParser();
+ /**
+ * @param key the given key of config
+ * @return the config registred given his key
+ */
<C extends Config> C getConfig(ConfigKey<C> key);
+ /**
+ * Accessor of the flag <code>quit</code>.
+ * <p/>
+ * The <code>quit</code> is computed while firing the options given to application.
+ *
+ * @return <ocde>true</code> if we should stop application, <code>false</code> otherwise.
+ */
boolean isQuit();
+ /**
+ * Accessor of the flag <code>useUI</code>.
+ * <p/>
+ * The <code>useUI</code> flag tells us if we can use UI in the application.
+ *
+ * @return <code>true</code> if we can use UI in the application, <code>false</code> otherwise.
+ */
boolean isUseUI();
+ /**
+ * Accessor of the flag <code>launchUI</code>.
+ * <p/>
+ * The <code>launchUI</code> flag tells us if we should launch the main UI of the application, after the init.
+ * <p/>
+ * This flag can be changed by options fired
+ *
+ * @return <code>true</code> if we should launch main UI after init, <code>false</code> otherwise.
+ */
boolean isLaunchUI();
+ /**
+ * Accessor of the flag <code>firstLaunch</code>.
+ * <p/>
+ * The <code>firstLaunch</code> determines if this is the first time the application is launched (says no
+ * configuration file was found)
+ *
+ * @return <code>true</code> if no config file was found, <code>false</code> otheriwse.
+ */
boolean isFirstLaunch();
+ /**
+ * Mutator of the flag <code>quit</code>
+ *
+ * @param quit the new value of the flag <code>quit</code>
+ */
void setQuit(boolean quit);
+ /**
+ * Mutator of the flag <code>launchUI</code>
+ *
+ * @param launchUI the new value of the flag <code>launchUI</code>
+ */
void setLaunchUI(boolean launchUI);
+ /**
+ * Mutator of the flag <code>firstLaunch</code>
+ *
+ * @param firstLaunch the new value of the flag <code>firstLaunch</code>
+ */
void setFirstLaunch(boolean firstLaunch);
+ /**
+ * Try to save the configurations boxed by context.
+ * <p/>
+ * All configuration are saved in the same file given by the method {@link #getSource()}.
+ *
+ * @throws IOException if IO pb while saving
+ * @throws IllegalStateException TODO
+ */
void save() throws IOException, IllegalStateException;
+ /**
+ * Try to save the configurations boxed by the context.
+ * <p/>
+ * If any problem appears, no exception will be trhown.
+ * <p/>
+ * <b>Note : this is a weak method, since no exception is thrown...</b>
+ */
void saveSafely();
+ /**
+ * Mutator of the configuration file
+ *
+ * @param source the new file to use to store on disk the configurations boxed by context.
+ */
void setSource(File source);
+ /**
+ * Accessor of the configuration file to store configurations
+ *
+ * @return the file where configurations boxed by context are stored.
+ */
File getSource();
+ /**
+ * Accessor of all configuration's key known by the context.
+ *
+ * @return the list of {@link org.codelutin.option.ConfigKey} known by the context.
+ */
List<ConfigKey<?>> getConfigKeys();
+ /**
+ * Accessor of all configurations boxed by the context.
+ *
+ * @return the list of all configurations boxed by the context.
+ */
Config[] getConfigs();
+ /**
+ * Accessor of a typed configuration's key given his string representation key.
+ * <p/>
+ * This method is used when we do not knwon the real implementation of a configuration key.
+ * <p/>
+ * For example, there is always a <code>main</code> config in a context, so we can access the configKey using this
+ * method in a generic code.
+ * <p/>
+ * <b>Note : Use this code as less as possible, when you don't have access to real implementation of the context.</b>
+ *
+ * @param key the string representation of a key of configuration
+ * @return the typed configuration key given his string representation
+ */
ConfigKey<?> getConfigKey(String key);
+ /**
+ * Accessor of a boxed configuration using the configuration key (as a string representation).
+ * <p/>
+ * The configuration is searched via his method {@link org.codelutin.option.Config#getCategory()}
+ * <p/>
+ * <b>Note : use this method only if you do not know the real implementation of context (for example in a
+ * generic code)</b>
+ *
+ * @param key the string representaiotn of a key configuration researched
+ * @return the configuration boxed in context, or <code>null</code> if no matching configuration is found.
+ */
Config getConfig(String key);
- @SuppressWarnings({"unchecked"})
- <C extends Config> void registerConfig(Class<? extends C> aClass);
+ /**
+ * Register in the context a new configuration, given his implementation class.
+ *
+ * @param aClass the config class implementation
+ */
+ <C extends Config> void registerConfig(Class<? extends C> aClass);
+ @Override
void accept(ContextVisitor visitor);
+ /**
+ * Dispose the context (says dispose the application), with possibility to reload it when <code>reload</code> has
+ * <code>true</code> value.
+ * <p/>
+ * For example, when we wants to change langue of an application, all uis has to be dispose then reloead, so you
+ * can use this method for the purpose.
+ *
+ * @param reload <code>true</code> if context is reload after disposing it, <ocde>false</code> otherwise.
+ */
void dispose(boolean reload);
+
+ /**
+ * Add to the context a dynamic entry given his typed key and his real value.
+ * <p/>
+ * <b>Note : if an previously entry was in context, it will be override by the new value.</b>
+ *
+ * @param key the context typed entry key
+ * @param value the context entry value
+ */
+ <T> void addContextValue(ContextKey<T> key, T value);
+
+ /**
+ * Remove ffrom the context the dynamic entry
+ *
+ * @param key the context typed entry key
+ */
+ <T> void removeContextValue(ContextKey<T> key);
+
+ /** Remove from context, all dynamic entries. */
+ void removeAllContextValues();
+
+ /**
+ * Accessor of a dynamic entry in the context given his type entry key.
+ *
+ * @param key the given typed entry key
+ * @return the value of the dynamic entry
+ */
+ <T> T getContextValue(ContextKey<T> key);
}
Added: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKey.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKey.java (rev 0)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKey.java 2008-07-28 12:19:43 UTC (rev 931)
@@ -0,0 +1,34 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.option;
+
+/**
+ * Contract of a key in the context.
+ * <p/>
+ * The {@link #getKey()} returns the string value of the key.
+ * <p/>
+ * The {link #getValueType()} returns the type of the value.
+ * <p/>
+ * To obtain the real value of this key for a given context, use the method {@link Context#getContextValue(ContextKey)}
+ *
+ * @author chemit
+ */
+public interface ContextKey<T> {
+
+ String getKey();
+
+ Class<T> getValueType();
+
+}
Added: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKeyImpl.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKeyImpl.java (rev 0)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/ContextKeyImpl.java 2008-07-28 12:19:43 UTC (rev 931)
@@ -0,0 +1,57 @@
+/**
+ * # #% Copyright (C) 2008 Code Lutin, Tony Chemit
+ * This program is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. This program is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place
+ * - Suite 330, Boston, MA 02111-1307, USA.
+ * # #%
+ */
+package org.codelutin.option;
+
+/**
+ * A simple implementation of {@link ContextKey}.
+ * <p/>
+ * This object has an invariant {@link #key} which defines the {@link #equals(Object)} methods (and of course the
+ * {@link #hashCode()} one too!).
+ *
+ * @author chemit
+ */
+public class ContextKeyImpl<T> implements ContextKey<T> {
+
+ final protected String key;
+ final protected Class<T> valueType;
+
+ public ContextKeyImpl(String key, Class<T> valueType) {
+ this.key = key;
+ this.valueType = valueType;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public Class<T> getValueType() {
+ return valueType;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "<key:" + key + ", type:" + valueType + ">";
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return this == o || o instanceof ContextKeyImpl && key.equals(((ContextKeyImpl) o).key);
+ }
+
+ @Override
+ public int hashCode() {
+ return key.hashCode();
+ }
+}
1
0
27 Jul '08
Author: tchemit
Date: 2008-07-27 10:36:26 +0000 (Sun, 27 Jul 2008)
New Revision: 930
Modified:
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionActionRunnable.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionParserContexts.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionChangeConfigRunnable.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionEditConfigRunnable.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpConfigRunnable.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpRunnable.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionResetConfigRunnable.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionShowConfigRunnable.java
trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionUiRunnable.java
trunk/commandline/commandline-core/src/site/site_fr.xml
trunk/commandline/commandline-ui/pom.xml
trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ClassCellEditor.java
trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableModel.java
trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableRenderer.java
trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigUIHandler.java
trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/ConfigTab.jaxx
trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JConfigUI.jaxx
trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JLoginUI.jaxx
trunk/commandline/commandline-ui/src/site/site_fr.xml
trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java
trunk/commandline/maven-plugin/pom.xml
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/AbsractDefinitionContext.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefaultOptionAction.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserContexts.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserUtil.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigLoader.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoader.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoaderEntry.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/Loader.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoader.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoaderEntry.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/AbstractJavaGenerator.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/DefaultOptionActionJavaGenerator.java
trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/util/AbstractGeneratorGoal.java
trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser.java
trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser1.java
trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserTest.java
trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserUtilForTest.java
trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/PropertiesLoaderTest.java
trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/generate/GenerateJavaTest.java
Log:
reformat
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -375,7 +375,7 @@
}
public void accept(ContextVisitor visitor) {
- visitor.enterParser(getParser());
+ visitor.enterParser(getParser());
for (ConfigKey<?> configKey : configKeys) {
visitor.enterConfig(configKey);
}
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionActionRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionActionRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionActionRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,9 +1,10 @@
package org.codelutin.option;
/**
- * Action wrapper for OptionAction
+ * Action wrapper for OptionAction
*
- * @author chemit */
+ * @author chemit
+ */
public interface OptionActionRunnable<O extends Option, P extends OptionParser, C extends AbstractContext<P>, A extends OptionAction<O, P, C>> {
void run(A action) throws Exception;
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionParserContexts.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionParserContexts.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/OptionParserContexts.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -276,7 +276,7 @@
// instanciate real options from safe contexts
for (OptionContext context : getContexts()) {
OptionKey key = context.getKey();
- result.registerOption(key,context.instanciate(key));
+ result.registerOption(key, context.instanciate(key));
}
// transfert unused arguments
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionChangeConfigRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionChangeConfigRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionChangeConfigRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -19,10 +19,10 @@
import org.codelutin.option.Config;
import org.codelutin.option.ConfigKey;
import org.codelutin.option.ConfigPropertyKey;
+import org.codelutin.option.Context;
import org.codelutin.option.Option;
import org.codelutin.option.OptionAction;
import org.codelutin.option.OptionActionRunnable;
-import org.codelutin.option.Context;
/**
* OptionAction to change a property in a config.
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionEditConfigRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionEditConfigRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionEditConfigRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -18,9 +18,9 @@
import org.codelutin.option.AbstractContext;
import org.codelutin.option.Config;
import org.codelutin.option.ConfigKey;
+import org.codelutin.option.Context;
import org.codelutin.option.OptionAction;
import org.codelutin.option.OptionActionRunnable;
-import org.codelutin.option.Context;
/** @author chemit */
public class OptionActionEditConfigRunnable implements OptionActionRunnable {
@@ -39,7 +39,7 @@
configs[i++] = context.getConfig(o);
}
javax.swing.JDialog ui = (javax.swing.JDialog) Class.forName(UI_FQN).newInstance();
- ui.getClass().getMethod("init", AbstractContext.class, Config[].class).invoke(ui, context,configs);
+ ui.getClass().getMethod("init", AbstractContext.class, Config[].class).invoke(ui, context, configs);
ui.setVisible(true);
}
}
\ No newline at end of file
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpConfigRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpConfigRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpConfigRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -18,9 +18,9 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.option.ConfigKey;
import org.codelutin.option.ConfigPropertyKey;
+import org.codelutin.option.Context;
import org.codelutin.option.OptionAction;
import org.codelutin.option.OptionActionRunnable;
-import org.codelutin.option.Context;
import static org.codelutin.option.ParserUtil.addTitle;
import org.codelutin.util.ReflectUtil;
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionHelpRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -18,10 +18,10 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.option.ConfigKey;
import org.codelutin.option.ConfigPropertyKey;
+import org.codelutin.option.Context;
import org.codelutin.option.OptionAction;
import org.codelutin.option.OptionActionRunnable;
import org.codelutin.option.OptionKey;
-import org.codelutin.option.Context;
import static org.codelutin.option.ParserUtil.addTitle;
import org.codelutin.option.def.OptionDefinition;
import org.codelutin.util.ReflectUtil;
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionResetConfigRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionResetConfigRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionResetConfigRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -16,9 +16,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.codelutin.i18n.I18n._;
+import org.codelutin.option.Context;
import org.codelutin.option.OptionAction;
import org.codelutin.option.OptionActionRunnable;
-import org.codelutin.option.Context;
import java.io.File;
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionShowConfigRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionShowConfigRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionShowConfigRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -16,10 +16,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.option.ConfigKey;
+import org.codelutin.option.Context;
import org.codelutin.option.OptionAction;
import org.codelutin.option.OptionActionRunnable;
import org.codelutin.option.ParserUtil;
-import org.codelutin.option.Context;
import java.io.StringWriter;
@@ -37,7 +37,7 @@
if (category.equals("all")) {
for (ConfigKey<?> configKey : context.getConfigKeys()) {
- ParserUtil.printConfig(writer, context.getConfig(configKey));
+ ParserUtil.printConfig(writer, context.getConfig(configKey));
}
log.info(writer);
} else {
Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionUiRunnable.java
===================================================================
--- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionUiRunnable.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/actions/OptionActionUiRunnable.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -15,9 +15,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.codelutin.option.Context;
import org.codelutin.option.OptionAction;
import org.codelutin.option.OptionActionRunnable;
-import org.codelutin.option.Context;
/** @author chemit */
public class OptionActionUiRunnable implements OptionActionRunnable {
Modified: trunk/commandline/commandline-core/src/site/site_fr.xml
===================================================================
--- trunk/commandline/commandline-core/src/site/site_fr.xml 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-core/src/site/site_fr.xml 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,45 +1,47 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="LutinCommndline">
- <skin>
- <groupId>lutinlib</groupId>
- <artifactId>lutin-site-skin</artifactId>
- <version>0.1</version>
- </skin>
-
- <bannerLeft>
- <name>Lutin CommandLine</name>
- </bannerLeft>
-
- <bannerRight>
- <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
- <href>http://www.codelutin.com</href>
- </bannerRight>
+ <skin>
+ <groupId>lutinlib</groupId>
+ <artifactId>lutin-site-skin</artifactId>
+ <version>0.1</version>
+ </skin>
+ <bannerLeft>
+ <name>Lutin CommandLine</name>
+ </bannerLeft>
+
+ <bannerRight>
+ <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
+ <href>http://www.codelutin.com</href>
+ </bannerRight>
+
<poweredBy>
- <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/>
- <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/>
- <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="images/restructuredtext-logo.png"/>
- </poweredBy>
+ <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/>
+ <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/>
+ <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText"
+ img="images/restructuredtext-logo.png"/>
+ </poweredBy>
- <body>
- <links>
- <item name="Labs" href="http://labs.libre-entreprise.org/"/>
- <item name="Code Lutin" href="http://www.codelutin.com/"/>
- </links>
+ <body>
+ <links>
+ <item name="Labs" href="http://labs.libre-entreprise.org/"/>
+ <item name="Code Lutin" href="http://www.codelutin.com/"/>
+ </links>
- <menu name="Utilisateur">
- <item name="Accueil" href="index.html"/>
- <item name="R�aliser sa premi�re application" href="firstusage.html"/>
- <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinlib/lutincommandl…" name="T�l�chargement"/>
- </menu>
+ <menu name="Utilisateur">
+ <item name="Accueil" href="index.html"/>
+ <item name="R�aliser sa premi�re application" href="firstusage.html"/>
+ <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinlib/lutincommandl…"
+ name="T�l�chargement"/>
+ </menu>
- <menu name="D�veloppeur">
- <item name="Implantation" href="devel/implementation.html"/>
- <item name="A faire" href="Todo.html"/>
- </menu>
+ <menu name="D�veloppeur">
+ <item name="Implantation" href="devel/implementation.html"/>
+ <item name="A faire" href="Todo.html"/>
+ </menu>
- ${reports}
+ ${reports}
- </body>
+ </body>
</project>
Modified: trunk/commandline/commandline-ui/pom.xml
===================================================================
--- trunk/commandline/commandline-ui/pom.xml 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/pom.xml 2008-07-27 10:36:26 UTC (rev 930)
@@ -48,7 +48,7 @@
<packaging>jar</packaging>
<build>
-
+
<plugins>
<!-- jaxx -->
Modified: trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ClassCellEditor.java
===================================================================
--- trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ClassCellEditor.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ClassCellEditor.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -62,9 +62,9 @@
if (converter != null) {
return converter.convert(Class.class, o);
}
- o =Class.forName(o+"");
+ o = Class.forName(o + "");
} catch (Exception e) {
- o=null;
+ o = null;
}
return o;
}
Modified: trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableModel.java
===================================================================
--- trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableModel.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableModel.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -212,7 +212,7 @@
ConfigPropertyKey<?> key = getKey(row);
Object val;
- if (aValue==null || key.getType() ==aValue.getClass()) {
+ if (aValue == null || key.getType() == aValue.getClass()) {
// we have directly the value, no conversion need
val = aValue;
} else {
@@ -227,7 +227,7 @@
} catch (Exception e) {
val = null;
}
- }
+ }
props.put(key, val);
fireTableRowsUpdated(row, row);
}
Modified: trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableRenderer.java
===================================================================
--- trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableRenderer.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigTableRenderer.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -69,7 +69,7 @@
}
if (cellRenderer == null) {
throw new IllegalStateException("no renderer find for column " + column);
- }
+ }
cellRenderer.setEnabled(!isFinal);
cellRenderer.setFont(isModified ? font2 : font);
return cellRenderer;
Modified: trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigUIHandler.java
===================================================================
--- trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigUIHandler.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/main/java/org/codelutin/option/ui/ConfigUIHandler.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -21,7 +21,7 @@
import org.codelutin.option.Config;
import org.codelutin.option.Context;
-import javax.swing.*;
+import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
Modified: trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/ConfigTab.jaxx
===================================================================
--- trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/ConfigTab.jaxx 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/ConfigTab.jaxx 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,44 +1,50 @@
<Table weightx="1">
<script>
-protected ConfigUIHandler handler;
+ protected ConfigUIHandler handler;
-public ConfigUIHandler getHandler() {
- if (handler == null) handler = new ConfigUIHandler(this);
- return handler;
-}
+ public ConfigUIHandler getHandler() {
+ if (handler == null) handler = new ConfigUIHandler(this);
+ return handler;
+ }
-public void dispose() {
- getHandler().dispose();
-}
+ public void dispose() {
+ getHandler().dispose();
+ }
-protected void doSave() { getHandler().doSave(); }
-protected void doReset() { getHandler().doReset(); }
-protected void doSelectNormal() { if (normal.isSelected()) getHandler().getTableModel().setType(ConfigTableModel.TypeModel.nontech); }
-protected void doSelectAll() { if (all.isSelected()) getHandler().getTableModel().setType(ConfigTableModel.TypeModel.all); }
-protected void doSelectTechnical() { if (onlytech.isSelected()) getHandler().getTableModel().setType(ConfigTableModel.TypeModel.tech); }
+ protected void doSave() { getHandler().doSave(); }
+ protected void doReset() { getHandler().doReset(); }
+ protected void doSelectNormal() { if (normal.isSelected())
+ getHandler().getTableModel().setType(ConfigTableModel.TypeModel.nontech); }
+ protected void doSelectAll() { if (all.isSelected())
+ getHandler().getTableModel().setType(ConfigTableModel.TypeModel.all); }
+ protected void doSelectTechnical() { if (onlytech.isSelected())
+ getHandler().getTableModel().setType(ConfigTableModel.TypeModel.tech); }
</script>
- <row>
- <cell weighty="1" weightx='1' fill='both'>
- <JScrollPane id='scroll' verticalScrollBarPolicy='20' horizontalScrollBarPolicy='31' >
- <JTable id="main" rowSelectionAllowed="false" autoResizeMode='auto_resize_last_column'/>
- </JScrollPane>
- </cell>
- </row>
<row>
+ <cell weighty="1" weightx='1' fill='both'>
+ <JScrollPane id='scroll' verticalScrollBarPolicy='20' horizontalScrollBarPolicy='31'>
+ <JTable id="main" rowSelectionAllowed="false" autoResizeMode='auto_resize_last_column'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
<cell columns='2' fill='both'>
<JPanel layout='{new GridLayout(0, 3, 2, 2)}'>
- <JRadioButton id='normal' selected='true' buttonGroup='type' text='lutinutil.common.toggle.normal' onActionPerformed='doSelectNormal()'/>
- <JRadioButton id='onlytech' selected='false' buttonGroup='type' text='lutinutil.common.toggle.technical' onActionPerformed='doSelectTechnical()'/>
- <JRadioButton id='all' selected='false' buttonGroup='type' text='lutinutil.common.toggle.all' onActionPerformed='doSelectAll()'/>
+ <JRadioButton id='normal' selected='true' buttonGroup='type' text='lutinutil.common.toggle.normal'
+ onActionPerformed='doSelectNormal()'/>
+ <JRadioButton id='onlytech' selected='false' buttonGroup='type' text='lutinutil.common.toggle.technical'
+ onActionPerformed='doSelectTechnical()'/>
+ <JRadioButton id='all' selected='false' buttonGroup='type' text='lutinutil.common.toggle.all'
+ onActionPerformed='doSelectAll()'/>
</JPanel>
</cell>
</row>
- <row fill='horizontal'>
- <cell>
- <JPanel layout='{new GridLayout(0, 2, 2, 2)}'>
- <JButton id='save' text='lutinutil.common.save' onActionPerformed='doSave()'/>
- <JButton id='reset' text='lutinutil.common.reset' onActionPerformed='doReset()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
+ <row fill='horizontal'>
+ <cell>
+ <JPanel layout='{new GridLayout(0, 2, 2, 2)}'>
+ <JButton id='save' text='lutinutil.common.save' onActionPerformed='doSave()'/>
+ <JButton id='reset' text='lutinutil.common.reset' onActionPerformed='doReset()'/>
+ </JPanel>
+ </cell>
+ </row>
+</Table>
Modified: trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JConfigUI.jaxx
===================================================================
--- trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JConfigUI.jaxx 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JConfigUI.jaxx 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,22 +1,22 @@
<JDialog title='lutinutil.config.title' modal='true'
defaultCloseOperation='DISPOSE_ON_CLOSE' width='500' height='300'>
<script>
-public ListCellRenderer getListener() { return null; }
+ public ListCellRenderer getListener() { return null; }
-public void onValueChanged() {}
+ public void onValueChanged() {}
-Action quitAction ;
+ Action quitAction ;
-JRootPane rootPane = getRootPane();
-rootPane.setDefaultButton(quit);
-quitAction = new AbstractAction(quit.getText()) {
- private static final long serialVersionUID = -869095664995763057L;
- public void actionPerformed(ActionEvent e) {
+ JRootPane rootPane = getRootPane();
+ rootPane.setDefaultButton(quit);
+ quitAction = new AbstractAction(quit.getText()) {
+ private static final long serialVersionUID = -869095664995763057L;
+ public void actionPerformed(ActionEvent e) {
dispose();
- }
-};
-rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),"quit");
-rootPane.getActionMap().put("quit", quitAction);
+ }
+ };
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),"quit");
+ rootPane.getActionMap().put("quit", quitAction);
</script>
<DefaultListModel id='listModel'/>
<java.awt.CardLayout id='cardLayout'/>
@@ -27,7 +27,8 @@
<row>
<cell weighty='1' fill='both' weightx='1'>
<JScrollPane>
- <JList id='list' onValueChanged='onValueChanged()' cellRenderer='{getListener()}' model='{listModel}'/>
+ <JList id='list' onValueChanged='onValueChanged()' cellRenderer='{getListener()}'
+ model='{listModel}'/>
</JScrollPane>
</cell>
</row>
Modified: trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JLoginUI.jaxx
===================================================================
--- trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JLoginUI.jaxx 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/main/uimodel/org/codelutin/option/ui/JLoginUI.jaxx 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,20 +1,20 @@
<JDialog title="lutinutil.connexion" modal='true' locationRelativeTo="{null}" defaultCloseOperation="dispose_on_close">
- <script>
- protected LoginUIHandler handler;
+ <script>
+ protected LoginUIHandler handler;
- public boolean launch(String login,String password) {
+ public boolean launch(String login,String password) {
if (login != null) {
- this.getLogin().setText(login);
+ this.getLogin().setText(login);
}
if (password!=null) {
- this.getPassword().setText(password);
+ this.getPassword().setText(password);
}
check();
setVisible(true);
return !handler.cancel;
- }
+ }
- public JLoginUI(JFrame instance, LoginUIHandler handler) {
+ public JLoginUI(JFrame instance, LoginUIHandler handler) {
super(instance);
this.handler = handler;
this.handler.setUi(this);
@@ -22,23 +22,23 @@
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
JRootPane rootPane = getRootPane();
rootPane.setDefaultButton(ok);
- }
+ }
- protected void doConnect() {
+ protected void doConnect() {
handler.doConnect();
if (handler.isCancel()) {
- doCancel();
+ doCancel();
}
- }
+ }
- protected void doCancel() {
+ protected void doCancel() {
handler.doCancel();
dispose();
- }
+ }
- protected void check() {
+ protected void check() {
ok.setEnabled(login.getText().trim().length()>0 && password.getPassword().length>0);
- }
+ }
</script>
Modified: trunk/commandline/commandline-ui/src/site/site_fr.xml
===================================================================
--- trunk/commandline/commandline-ui/src/site/site_fr.xml 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/site/site_fr.xml 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,45 +1,47 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="LutinCommndline">
- <skin>
- <groupId>lutinlib</groupId>
- <artifactId>lutin-site-skin</artifactId>
- <version>0.1</version>
- </skin>
-
- <bannerLeft>
- <name>Lutin CommandLine</name>
- </bannerLeft>
-
- <bannerRight>
- <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
- <href>http://www.codelutin.com</href>
- </bannerRight>
+ <skin>
+ <groupId>lutinlib</groupId>
+ <artifactId>lutin-site-skin</artifactId>
+ <version>0.1</version>
+ </skin>
+ <bannerLeft>
+ <name>Lutin CommandLine</name>
+ </bannerLeft>
+
+ <bannerRight>
+ <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src>
+ <href>http://www.codelutin.com</href>
+ </bannerRight>
+
<poweredBy>
- <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/>
- <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/>
- <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="images/restructuredtext-logo.png"/>
- </poweredBy>
+ <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/>
+ <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/>
+ <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText"
+ img="images/restructuredtext-logo.png"/>
+ </poweredBy>
- <body>
- <links>
- <item name="Labs" href="http://labs.libre-entreprise.org/"/>
- <item name="Code Lutin" href="http://www.codelutin.com/"/>
- </links>
+ <body>
+ <links>
+ <item name="Labs" href="http://labs.libre-entreprise.org/"/>
+ <item name="Code Lutin" href="http://www.codelutin.com/"/>
+ </links>
- <menu name="Utilisateur">
- <item name="Accueil" href="index.html"/>
- <item name="R�aliser sa premi�re application" href="firstusage.html"/>
- <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinlib/lutincommandl…" name="T�l�chargement"/>
- </menu>
+ <menu name="Utilisateur">
+ <item name="Accueil" href="index.html"/>
+ <item name="R�aliser sa premi�re application" href="firstusage.html"/>
+ <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinlib/lutincommandl…"
+ name="T�l�chargement"/>
+ </menu>
- <menu name="D�veloppeur">
- <item name="Implantation" href="devel/implementation.html"/>
- <item name="A faire" href="Todo.html"/>
- </menu>
+ <menu name="D�veloppeur">
+ <item name="Implantation" href="devel/implementation.html"/>
+ <item name="A faire" href="Todo.html"/>
+ </menu>
- ${reports}
+ ${reports}
- </body>
+ </body>
</project>
Modified: trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java
===================================================================
--- trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/commandline-ui/src/test/java/org/codelutin/option/ui/UITest.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -21,16 +21,15 @@
import org.codelutin.i18n.LanguageEnum;
import org.codelutin.option.Config;
import org.codelutin.option.ConfigPropertyKey;
+import static org.codelutin.option.ConfigPropertyKey.newConfigPropertyKey;
import org.codelutin.option.OptionKey;
-import static org.codelutin.option.ConfigPropertyKey.newConfigPropertyKey;
import static org.codelutin.option.def.ConfigPropertyModifier.MANDATORY;
+import org.codelutin.util.SimplePaginationEnum;
import java.io.File;
import java.net.URL;
import java.util.Locale;
-import org.codelutin.util.SimplePaginationEnum;
-
/**
* TODO javadoc
*
@@ -63,6 +62,7 @@
super("main", "main description");
init();
}
+
protected void init() throws Exception {
loadFromDefaultValue();
clearModified();
@@ -94,6 +94,7 @@
super("local", "local description");
init();
}
+
protected void init() throws Exception {
loadFromDefaultValue();
clearModified();
@@ -124,6 +125,7 @@
super("remote", "remote description");
init();
}
+
protected void init() throws Exception {
loadFromDefaultValue();
clearModified();
Modified: trunk/commandline/maven-plugin/pom.xml
===================================================================
--- trunk/commandline/maven-plugin/pom.xml 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/pom.xml 2008-07-27 10:36:26 UTC (rev 930)
@@ -24,7 +24,7 @@
<artifactId>commandline-core</artifactId>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
@@ -37,7 +37,7 @@
<artifactId>maven-plugin-api</artifactId>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
@@ -53,9 +53,9 @@
<version>0.7-SNAPSHOT</version>
<description>
- Plugin maven 2 pour la generation du parser d'options, des
- configurations et du context d'application en se basant sur
- la librairie commandline.
+ Plugin maven 2 pour la generation du parser d'options, des
+ configurations et du context d'application en se basant sur
+ la librairie commandline.
</description>
<inceptionYear>2008</inceptionYear>
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/AbsractDefinitionContext.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/AbsractDefinitionContext.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/AbsractDefinitionContext.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -17,7 +17,7 @@
import org.codelutin.option.ParserUtil;
/**
- * Classe abstraite d�finissant un context de parser de d�finitions.
+ * Classe abstraite d�finissant un context de parser de d�finitions.
*
* @author tony
*/
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefaultOptionAction.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefaultOptionAction.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefaultOptionAction.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -35,11 +35,11 @@
changeConfig("--config * <key:String> <value:String> [@categories@] "),
help("--help|-h"),
-
+
helpConfig("--help-config * <all|@categories@>"),
resetConfig("--reset-config"),
-
+
ui("--ui <flag:Boolean>");
private final String def;
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserContexts.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserContexts.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserContexts.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -578,7 +578,7 @@
public static class ConfigsContext extends AbsractDefinitionContext<ParserContext, ConfigContext> {
protected final List<ConfigLoaderEntry> source;
-
+
protected List<String> safeCategories;
public ConfigsContext(ParserContext parent, List<ConfigLoaderEntry> configs) {
@@ -674,9 +674,9 @@
String value = sourceP.getModifiers().trim();
String[] mods = value.split(",");
- if (value.length()==0 || mods.length == 0) {
+ if (value.length() == 0 || mods.length == 0) {
_mods.put(key, 0);
- mods =new String[0];
+ mods = new String[0];
}
List<Integer> modifiers = new ArrayList<Integer>();
for (String mod : mods) {
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserUtil.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserUtil.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/DefinitionParserUtil.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -44,7 +44,7 @@
final static String ODEFINITION_KEY_SUFFIX = ".option.definition";
final static String CDEFINITION_KEY_FACTOR = ".config.definition.";
final static String CMODIFIERS_KEY_FACTOR = ".config.modifiers.";
-
+
static class ConfigDefEntry extends AbstractMap.SimpleEntry<String, String> {
private static final long serialVersionUID = -5430904379928407190L;
String def;
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigLoader.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigLoader.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigLoader.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -39,7 +39,7 @@
public ConfigLoader(Map<String, String> injects) {
super(CONFIG_DEFINITION_PATTERN, ConfigLoaderEntry.class);
- this.injects=injects;
+ this.injects = injects;
this.defaultProperties = MandatoryConfigProperty.getConfigPropertyKeys();
}
@@ -55,7 +55,7 @@
configs.add(detectMainConfig);
}
- if (detectMainConfig!=null) {
+ if (detectMainConfig != null) {
for (MandatoryConfigProperty configProperty : MandatoryConfigProperty.values()) {
ConfigPropertyLoaderEntry loaderEntry = new ConfigPropertyLoaderEntry(configProperty.getEntryKey(), configProperty.name());
loaderEntry.setModifiers(configProperty.getModifiers());
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoader.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoader.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoader.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -37,7 +37,7 @@
log.warn("detected generic config property key " + key + ", will use the generic one...");
// clean source
source.remove(key);
- source.remove("main.config.modifiers."+value);
+ source.remove("main.config.modifiers." + value);
return false;
}
return true;
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoaderEntry.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoaderEntry.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/ConfigPropertyLoaderEntry.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -32,7 +32,7 @@
}
public void load(Properties source, List<ConfigPropertyLoaderEntry> result) {
- definition = source.get(getFullKey())+"";
+ definition = source.get(getFullKey()) + "";
source.remove(getFullKey());
String modifiersKey = getModifierFullKey();
Object cv = source.get(modifiersKey);
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/Loader.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/Loader.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/Loader.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -58,7 +58,7 @@
for (Map.Entry<String, String> entry : keys.entrySet()) {
String key = entry.getKey();
- if (needLoad(key, entry.getValue(), result,source)) {
+ if (needLoad(key, entry.getValue(), result, source)) {
// found a entry to treate
E e = eConstructor.newInstance(key, entry.getValue());
e.load(source, result);
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoader.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoader.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoader.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -30,9 +30,9 @@
public OptionLoader() {
super(OPTION_PATTERN, OptionLoaderEntry.class);
- this.defaultOptions = DefaultOptionAction.getConfigKeys();
+ this.defaultOptions = DefaultOptionAction.getConfigKeys();
}
-
+
public OptionLoader(String categoriesStr) {
super(OPTION_PATTERN, OptionLoaderEntry.class);
this.defaultOptions = DefaultOptionAction.getConfigKeys();
@@ -72,7 +72,7 @@
boolean need = true;
if (defaultOptions.contains(key)) {
// do not add this, this is a generated option
- log.warn("generic option detected '" + value+ "', will use generic version instead...");
+ log.warn("generic option detected '" + value + "', will use generic version instead...");
need = false;
source.remove(key);
}
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoaderEntry.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoaderEntry.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/def/loader/OptionLoaderEntry.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -27,7 +27,7 @@
}
public void load(Properties source, List<OptionLoaderEntry> result) {
- this.definition = source.get(getFullKey())+"";
+ this.definition = source.get(getFullKey()) + "";
source.remove(getFullKey());
}
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/JavaGeneratorGoal.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -66,7 +66,7 @@
* @parameter expression="${jaxx.copyToCP}" default-value="true"
*/
protected boolean copyToCP;
-
+
/**
* @description Chemin du fichier de propriétés contenant les définitions d'options à utiliser pour générer la factory de définitions d'options.
* @parameter expression="${commandline.source}"
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/AbstractJavaGenerator.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/AbstractJavaGenerator.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/AbstractJavaGenerator.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -21,9 +21,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.codelutin.option.generate.JavaGeneratorContext;
import org.codelutin.util.FileUtil;
import org.codelutin.util.StringUtil;
-import org.codelutin.option.generate.JavaGeneratorContext;
import java.io.File;
import java.io.IOException;
@@ -137,20 +137,20 @@
this.userName = System.getProperty("user.name", getClass().getSimpleName());
}
- protected AbstractJavaGenerator(JavaGeneratorContext context,int modifiers, String pack, String simpleName, String superClass, String... interfaceClass) {
+ protected AbstractJavaGenerator(JavaGeneratorContext context, int modifiers, String pack, String simpleName, String superClass, String... interfaceClass) {
this.context = context;
this.out = context.getOut();
- this.timestamp = context.getTimestamp();
- this.i18nPrefix = context.getI18nPrefix();
- this.pack = pack;
- this.simpleName = simpleName;
- this.simpleNameWithNoType = getNameWithNoType(simpleName);
- this.superClass = superClass;
- this.superClassWithNoType = getNameWithNoType(superClass);
- this.interfaceClass = interfaceClass;
- this.modifiers = modifiers;
- this.userName = System.getProperty("user.name", getClass().getSimpleName());
- }
+ this.timestamp = context.getTimestamp();
+ this.i18nPrefix = context.getI18nPrefix();
+ this.pack = pack;
+ this.simpleName = simpleName;
+ this.simpleNameWithNoType = getNameWithNoType(simpleName);
+ this.superClass = superClass;
+ this.superClassWithNoType = getNameWithNoType(superClass);
+ this.interfaceClass = interfaceClass;
+ this.modifiers = modifiers;
+ this.userName = System.getProperty("user.name", getClass().getSimpleName());
+ }
protected String getNameWithNoType(String simpleName) {
int pos = simpleName.indexOf('<');
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/DefaultOptionActionJavaGenerator.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/DefaultOptionActionJavaGenerator.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/java/DefaultOptionActionJavaGenerator.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,9 +1,9 @@
package org.codelutin.option.generate.java;
+import org.apache.commons.lang.StringUtils;
import org.codelutin.option.def.DefaultOptionAction;
import org.codelutin.option.def.DefinitionParserContexts.OptionContext;
import org.codelutin.option.generate.JavaGeneratorContext;
-import org.apache.commons.lang.StringUtils;
import java.lang.reflect.Modifier;
@@ -20,7 +20,7 @@
String runnable;
if (option == null) {
runnable = getFQN();
- } else {
+ } else {
runnable = "org.codelutin.option.actions.OptionAction" + StringUtils.capitalize(context.getKey());
}
addConstructor(null, Modifier.PUBLIC, "super(\"" + runnable + "Runnable\");", new String[]{Exception.class.getSimpleName()});
Modified: trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/util/AbstractGeneratorGoal.java
===================================================================
--- trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/util/AbstractGeneratorGoal.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/main/java/org/codelutin/option/generate/util/AbstractGeneratorGoal.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -22,8 +22,8 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
+import org.codelutin.i18n.I18n;
import org.codelutin.util.StringUtil;
-import org.codelutin.i18n.I18n;
import java.io.File;
@@ -110,7 +110,7 @@
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
} finally {
- getLog().info(getClass().getSimpleName()+" - total time " + StringUtil.convertTime(timestamp,System.nanoTime()));
+ getLog().info(getClass().getSimpleName() + " - total time " + StringUtil.convertTime(timestamp, System.nanoTime()));
}
}
@@ -175,6 +175,7 @@
/**
* permet d'ajout le r�pertoire de g�n�ration des fichiers java dans les r�pertoires
* de compilation du projet Maven.
+ *
* @param dirGen le repertoire de generation des fichiers java
*/
public void fixCompileSourceRoots(File dirGen) {
Modified: trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser.java
===================================================================
--- trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,11 +1,9 @@
package org.codelutin.option;
-import org.codelutin.option.def.ParserTest.AbstractHelpAction;
-import org.codelutin.option.def.ParserTest.OptionHelp;
import org.codelutin.option.def.OptionDefinition;
import org.codelutin.option.def.OptionDefinitionBuilder;
-import org.codelutin.option.OptionParser;
-import org.codelutin.option.OptionKey;
+import org.codelutin.option.def.ParserTest.AbstractHelpAction;
+import org.codelutin.option.def.ParserTest.OptionHelp;
/** @author chemit */
public class MyParser extends OptionParser {
Modified: trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser1.java
===================================================================
--- trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser1.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/MyParser1.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,17 +1,14 @@
package org.codelutin.option;
+import org.codelutin.option.def.ArgumentType;
+import org.codelutin.option.def.OptionDefinition;
+import org.codelutin.option.def.OptionDefinitionBuilder;
import org.codelutin.option.def.ParserTest.AbstractHelp1Action;
import org.codelutin.option.def.ParserTest.AbstractMandatory1Action;
import org.codelutin.option.def.ParserTest.AbstractMandatory2Action;
import org.codelutin.option.def.ParserTest.AbstractOptional1Action;
import org.codelutin.option.def.ParserTest.AbstractOptional2Action;
import org.codelutin.option.def.ParserTest.OptionHelp1;
-import org.codelutin.option.def.OptionDefinition;
-import org.codelutin.option.def.OptionDefinitionBuilder;
-import org.codelutin.option.def.ArgumentType;
-import org.codelutin.option.OptionParser;
-import org.codelutin.option.OptionKey;
-import org.codelutin.option.Option;
/** @author chemit */
public class MyParser1 extends OptionParser {
Modified: trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserTest.java
===================================================================
--- trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserTest.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserTest.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -1,21 +1,20 @@
package org.codelutin.option.def;
import junit.framework.TestCase;
-
-import java.io.IOException;
-import java.util.Arrays;
-
import org.codelutin.i18n.I18n;
import org.codelutin.log.LutinLogFactory;
-import org.codelutin.option.Option;
import org.codelutin.option.Argument;
-import org.codelutin.option.OptionAction;
-import org.codelutin.option.OptionParser;
import org.codelutin.option.MyContext;
import org.codelutin.option.MyContext1;
import org.codelutin.option.MyParser;
import org.codelutin.option.MyParser1;
+import org.codelutin.option.Option;
+import org.codelutin.option.OptionAction;
+import org.codelutin.option.OptionParser;
+import java.io.IOException;
+import java.util.Arrays;
+
/**
* OptionParser Tester.
*
@@ -26,14 +25,14 @@
public class ParserTest extends TestCase {
static boolean first;
-
+
static {
if (!first) {
I18n.init();
System.setProperty("org.apache.commons.logging.LogFactory", LutinLogFactory.class.getName());
first = true;
- }
+ }
}
static int counter = 0;
Modified: trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserUtilForTest.java
===================================================================
--- trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserUtilForTest.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/ParserUtilForTest.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -15,7 +15,6 @@
import junit.framework.Assert;
import org.codelutin.i18n.I18n;
import org.codelutin.log.LutinLogFactory;
-import org.codelutin.option.def.DefinitionParser;
import org.codelutin.option.OptionParser;
import org.codelutin.option.OptionParserResult;
import org.codelutin.option.ParserFailedException;
@@ -76,7 +75,7 @@
assertEquals(nbOptions, result.size());
assertEquals(nbErrors, e == null ? 0 : e.getNbErrors());
- assertEquals(nbUnused, result.getNbUnsued());
+ assertEquals(nbUnused, result.getNbUnsued());
}
Modified: trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/PropertiesLoaderTest.java
===================================================================
--- trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/PropertiesLoaderTest.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/def/PropertiesLoaderTest.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -25,10 +25,10 @@
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
-import java.util.Map;
-import java.util.HashMap;
/** @author chemit */
public class PropertiesLoaderTest extends TestCase {
@@ -48,10 +48,10 @@
}
public void testConfigCategory() throws Exception {
- Map<String, String> injects =new HashMap<String, String>();
+ Map<String, String> injects = new HashMap<String, String>();
- injects.put(MandatoryConfigProperty.encoding.name(),"UTF-8");
-
+ injects.put(MandatoryConfigProperty.encoding.name(), "UTF-8");
+
ConfigLoader configLoader = new ConfigLoader(injects);
File f;
@@ -84,9 +84,9 @@
currentSize = currentSize - result2.size() * 2;
}
// we have 2 mandatories value,
- int nbMandatories = MandatoryConfigProperty.values().length-2;
- currentSize+= nbMandatories*2;
-
+ int nbMandatories = MandatoryConfigProperty.values().length - 2;
+ currentSize += nbMandatories * 2;
+
assertEquals(currentSize, p.size());
OptionLoader optionLoader = new OptionLoader(configLoader.getCategoriesStr());
Modified: trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/generate/GenerateJavaTest.java
===================================================================
--- trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/generate/GenerateJavaTest.java 2008-07-27 10:35:17 UTC (rev 929)
+++ trunk/commandline/maven-plugin/src/test/java/org/codelutin/option/generate/GenerateJavaTest.java 2008-07-27 10:36:26 UTC (rev 930)
@@ -18,6 +18,8 @@
package org.codelutin.option.generate;
import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.codelutin.i18n.I18n;
import org.codelutin.option.Config;
import org.codelutin.option.Option;
@@ -25,8 +27,6 @@
import org.codelutin.option.OptionParser;
import org.codelutin.option.def.DefaultOptionAction;
import org.codelutin.option.def.DefinitionParserFromProperties;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.io.File;
@@ -57,7 +57,7 @@
goal.setPrefix("Test");
goal.setVerbose(false);
goal.setSource(new File(HERE + "/src/test/testOptions.properties"));
-
+
goal.setPackageName("org.codelutin.option.test1");
goal._version = "0.0.1";
goal.setParserSuperClass(OptionParser.class.getName());
1
0
[Lutinutil-commits] r929 - in trunk/commandline/commandline-ui-action: . src/main/java/org/codelutin/option/ui/actions
by tchemit@users.labs.libre-entreprise.org 27 Jul '08
by tchemit@users.labs.libre-entreprise.org 27 Jul '08
27 Jul '08
Author: tchemit
Date: 2008-07-27 10:35:17 +0000 (Sun, 27 Jul 2008)
New Revision: 929
Modified:
trunk/commandline/commandline-ui-action/pom.xml
trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/ChangeLocaleAction.java
Log:
reformat
Modified: trunk/commandline/commandline-ui-action/pom.xml
===================================================================
--- trunk/commandline/commandline-ui-action/pom.xml 2008-07-27 10:03:21 UTC (rev 928)
+++ trunk/commandline/commandline-ui-action/pom.xml 2008-07-27 10:35:17 UTC (rev 929)
@@ -45,7 +45,7 @@
<packaging>jar</packaging>
<build>
-
+
<resources>
<resource>
<directory>src/main/resources</directory>
@@ -56,7 +56,7 @@
</resources>
<plugins>
-
+
<!-- Compile phase -->
<plugin>
<groupId>lutinplugin</groupId>
Modified: trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/ChangeLocaleAction.java
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/ChangeLocaleAction.java 2008-07-27 10:03:21 UTC (rev 928)
+++ trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/ChangeLocaleAction.java 2008-07-27 10:35:17 UTC (rev 929)
@@ -92,7 +92,7 @@
// save config
getContext().saveSafely();
// dispose then reload application
- getContext().dispose(true);
+ getContext().dispose(true);
}
@Override
1
0
[Lutinutil-commits] r928 - in trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo: . ui
by tchemit@users.labs.libre-entreprise.org 27 Jul '08
by tchemit@users.labs.libre-entreprise.org 27 Jul '08
27 Jul '08
Author: tchemit
Date: 2008-07-27 10:03:21 +0000 (Sun, 27 Jul 2008)
New Revision: 928
Modified:
trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java
trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java
Log:
use ContextProvider + ActionHelper
Modified: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java
===================================================================
--- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java 2008-07-27 10:02:45 UTC (rev 927)
+++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/DemoMain.java 2008-07-27 10:03:21 UTC (rev 928)
@@ -16,9 +16,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.codelutin.option.ContextProvider;
import org.codelutin.option.OptionParserResult;
import org.codelutin.option.ParserFailedException;
-import org.codelutin.option.ContextProvider;
import java.io.IOException;
@@ -27,18 +27,15 @@
private static final Log log = LogFactory.getLog(DemoMain.class);
- /** le context principal de l'application */
- protected static DemoContext context;
-
+ /** @return le context applicatif. */
public static DemoContext getContext() {
- checkInitContext();
- return context;
+ return (DemoContext) ContextProvider.get();
}
/**
* initialisation de l'application :
* <p/>
- * chargement du context
+ * chargement du context applicatif
*
* @param args les arguments pass�s � l'application
*/
@@ -46,7 +43,7 @@
try {
// instanciate context, parser and configs
- context = (DemoContext) ContextProvider.getContext();
+ DemoContext context = (DemoContext) ContextProvider.init();
// init context
context.init(args);
@@ -100,10 +97,4 @@
}
- public static void checkInitContext() {
- if (context == null) {
- throw new RuntimeException("context is null, you must init first the " + DemoContext.class.getName() + " class via init method");
- }
- }
-
}
Modified: trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java
===================================================================
--- trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java 2008-07-27 10:02:45 UTC (rev 927)
+++ trunk/commandline/commandline-demo/src/main/java/org/codelutin/commandline/demo/ui/DemoMainUI.java 2008-07-27 10:03:21 UTC (rev 928)
@@ -14,32 +14,22 @@
*/
package org.codelutin.commandline.demo.ui;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.codelutin.commandline.demo.DemoContext;
import org.codelutin.commandline.demo.DemoMain;
-import org.codelutin.commandline.demo.ui.actions.CommandLineDemoBaseAction;
-import static org.codelutin.i18n.I18n._;
+import org.codelutin.option.ui.actions.ActionHelper;
-import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
-import java.util.Locale;
-import java.util.regex.Matcher;
/** @author chemit */
public class DemoMainUI extends JDemoMainUI {
- /** log */
- private static final Log log = LogFactory.getLog(DemoMainUI.class);
-
public DemoMainUI() {
+
super();
- DemoMain.checkInitContext();
-
finalizeInit(DemoMain.getContext());
}
@@ -53,55 +43,7 @@
getRootPane().getActionMap().put("quit", context.getActionFactory().newAction("quit", null));
// repaint i18n actions
- refreshI18nActions(context);
-
+ ActionHelper.refreshI18nActions(context, context.getActionFactory(), this);
}
- /**
- * Rafraichit les actions i18n dans le menu en fonction de la locale
- * actuellement utilis�e.
- *
- * @param context application context
- */
- public void refreshI18nActions(DemoContext context) {
-
- Locale locale = context.getMainConfig().getLocale();
- //CountryEnum country = context.getConfig().getUserCountry();
- String[] actions = context.getActionFactory().getActionNames();
- for (String actionName : actions) {
- Matcher matcher = org.codelutin.option.ui.actions.ChangeLocaleAction.PATTERN_NAME.matcher(actionName);
- if (!matcher.matches()) {
- continue;
- }
- AbstractButton button = (AbstractButton) getObjectById(actionName);
- CommandLineDemoBaseAction action1 = (CommandLineDemoBaseAction) button.getAction();
- org.codelutin.option.ui.actions.ChangeLocaleAction action = (org.codelutin.option.ui.actions.ChangeLocaleAction) action1.getDelegate();
- boolean enable = !action.equalsLocale(locale);
- log.debug("incoming locale : " + locale);
- log.debug("load i18n action " + action + " is enable ? " + enable);
- UpdateButton(button, enable, enable ? action.getLocale() : null);
- button.setEnabled(enable);
- }
- }
-
- public static void DisableButton(AbstractButton... buttons) {
- for (AbstractButton button : buttons) {
- UpdateButton(button, false);
- }
- }
-
- public static void EnableButton(AbstractButton button, Object... params) {
- UpdateButton(button, true, params);
- }
-
- public static void UpdateButton(AbstractButton button, boolean enabled, Object... params) {
- button.setEnabled(enabled);
- if (!enabled) {
- button.setToolTipText(null);
- } else {
- CommandLineDemoBaseAction action = (CommandLineDemoBaseAction) button.getAction();
- String t = _(action.getI18nToolTipText(), params);
- button.setToolTipText(t);
- }
- }
}
1
0
[Lutinutil-commits] r927 - trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions
by tchemit@users.labs.libre-entreprise.org 27 Jul '08
by tchemit@users.labs.libre-entreprise.org 27 Jul '08
27 Jul '08
Author: tchemit
Date: 2008-07-27 10:02:45 +0000 (Sun, 27 Jul 2008)
New Revision: 927
Modified:
trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/CommandLineBaseAction.java
Log:
use ContextProvider
Modified: trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/CommandLineBaseAction.java
===================================================================
--- trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/CommandLineBaseAction.java 2008-07-27 10:02:12 UTC (rev 926)
+++ trunk/commandline/commandline-ui-action/src/main/java/org/codelutin/option/ui/actions/CommandLineBaseAction.java 2008-07-27 10:02:45 UTC (rev 927)
@@ -38,11 +38,11 @@
}
protected String getPrefix() {
- return "jaxx";
+ return "commandline";
}
- protected Context getContext() {
- return ContextProvider.getContext();
+ protected Context getContext() throws IllegalStateException {
+ return ContextProvider.get();
}
}
1
0