Simexplorer-si-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
February 2008
- 2 participants
- 701 discussions
r1155 - trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 23:06:46 +0000 (Wed, 20 Feb 2008)
New Revision: 1155
Removed:
trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java
Log:
suppression mock inutilise
Deleted: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java 2008-02-20 21:15:45 UTC (rev 1154)
+++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/MockAuthenticationServiceImpl.java 2008-02-20 23:06:46 UTC (rev 1155)
@@ -1,231 +0,0 @@
-/*
-* ##% Copyright (C) 2008 Code Lutin, Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.service;
-
-import fr.cemagref.simexplorer.is.security.entities.Group;
-import fr.cemagref.simexplorer.is.security.entities.Permission;
-import fr.cemagref.simexplorer.is.security.entities.User;
-
-/**
- * The Class MockAuthenticationServiceImpl.
- */
-public class MockAuthenticationServiceImpl implements AuthenticationService {
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#loginUser(java.lang.String, java.lang.String)
- */
- public String loginUser(String login, String password) {
- return (String) checkImplemented();
- }
-
- /**
- * Close session timer.
- *
- * @param token
- * the token
- */
- public void closeSessionTimer(String token) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#requestAccount(java.lang.String, java.lang.String)
- */
- public void requestAccount(String login, String mail) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveUser(java.lang.String, java.lang.String, java.lang.String)
- */
- public User saveUser(String token, String login, String mail) {
- return (User) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#resetPassword(java.lang.String, java.lang.String)
- */
- public void resetPassword(String token, String login) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.Integer)
- */
- public User getUser(String token, Integer id) {
- return (User) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUser(java.lang.String, java.lang.String)
- */
- public User getUser(String token, String login) {
- return (User) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User)
- */
- public User updateUser(String token, User user) {
- return (User) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteUser(java.lang.String, java.lang.Integer)
- */
- public void deleteUser(String token, Integer id) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsers(java.lang.String)
- */
- public User[] getUsers(String token) {
- return (User[]) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group)
- */
- public User[] getUsersOfGroup(String token, Group group) {
- return (User[]) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setUsersOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[])
- */
- public void setUsersOfGroup(String token, Group group,
- Integer[] usersInGroup) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group, java.lang.Integer[])
- */
- public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User)
- */
- public Group[] getGroupsOfUser(String token, User user) {
- return (Group[]) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOfGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group)
- */
- public Group[] getGroupsOfGroup(String token, Group group) {
- return (Group[]) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setGroupsOfUser(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User, java.lang.Integer[])
- */
- public void setGroupsOfUser(String token, User user, Integer[] groupsIds) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#saveGroup(java.lang.String, java.lang.String)
- */
- public Group saveGroup(String token, String name) {
- return (Group) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.Integer)
- */
- public Group getGroup(String token, Integer id) {
- return (Group) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroup(java.lang.String, java.lang.String)
- */
- public Group getGroup(String token, String name) {
- return (Group) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#updateGroup(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Group)
- */
- public Group updateGroup(String token, Group group) {
- return (Group) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#deleteGroup(java.lang.String, java.lang.Integer)
- */
- public void deleteGroup(String token, Integer id) {
- checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroups(java.lang.String)
- */
- public Group[] getGroups(String token) {
- return (Group[]) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getGroupsOwnedBy(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User)
- */
- public Group[] getGroupsOwnedBy(String token, User user) {
- return (Group[]) checkImplemented();
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getLoggedUser(java.lang.String)
- */
- public User getLoggedUser(String token) {
- return (User) checkImplemented();
- }
-
- /**
- * Check implemented.
- *
- * @return the object
- */
- private Object checkImplemented() {
- throw new IllegalStateException("not implemented");
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getPermissions(java.lang.String)
- */
- public Permission[] getPermissions(String uuid) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see fr.cemagref.simexplorer.is.service.AuthenticationService#setPermissions(java.lang.String, fr.cemagref.simexplorer.is.security.entities.Permission[])
- */
- public void setPermissions(String uuid, Permission[] permissions) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public String[] getElementsOwnedBy(String token, User user) {
- checkImplemented();
- return null;
- }
-}
\ No newline at end of file
1
0
r1154 - in trunk/simexplorer-is/simexplorer-is-swing: . src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 21:15:45 +0000 (Wed, 20 Feb 2008)
New Revision: 1154
Modified:
trunk/simexplorer-is/simexplorer-is-swing/pom.xml
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java
Log:
unused import
refactor pom :
** use maven.gen.dir and maven.vcs.src.dir
** suppress lutin-processor
Modified: trunk/simexplorer-is/simexplorer-is-swing/pom.xml
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/pom.xml 2008-02-20 19:18:44 UTC (rev 1153)
+++ trunk/simexplorer-is/simexplorer-is-swing/pom.xml 2008-02-20 21:15:45 UTC (rev 1154)
@@ -25,8 +25,13 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
+ <maven.verbose>false</maven.verbose>
+ <!-- Vcs base dir-->
+ <maven.vcs.src.dir>${basedir}/src</maven.vcs.src.dir>
<!--Source base dir-->
<maven.src.dir>${basedir}/target/src-build</maven.src.dir>
+ <!--Generate base dir-->
+ <maven.gen.dir>${basedir}/target/gen</maven.gen.dir>
<!--Main class in JAR -->
<maven.jar.main.class>fr.cemagref.simexplorer.is.ui.swing.SimExplorer</maven.jar.main.class>
</properties>
@@ -35,35 +40,8 @@
<build>
<plugins>
- <!--Attaching processor plugin to the Build Lifecycle-->
<plugin>
<groupId>lutinplugin</groupId>
- <artifactId>maven-processor-plugin</artifactId>
- <version>0.12</version>
- <executions>
- <execution>
- <id>Processor</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>process</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <srcDir>${basedir}/src</srcDir>
- <destDir>${maven.src.dir}</destDir>
- <includes>
- <include>**/*.java</include>
- </includes>
- <filters>
- org.codelutin.processor.filters.GeneratorTemplatesFilter,
- org.codelutin.processor.filters.ActiveLogsCodeFilter
- </filters>
- <verbose>${maven.verbose}</verbose>
- </configuration>
- </plugin>
- <plugin>
- <groupId>lutinplugin</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<version>0.2-SNAPSHOT</version>
<executions>
@@ -84,7 +62,7 @@
<configuration>
<tasks>
<!-- make sure the directory exists (should be in parent) -->
- <mkdir dir="${basedir}/target/gen/java"/>
+ <mkdir dir="${maven.gen.dir}/java"/>
</tasks>
</configuration>
<goals>
@@ -92,16 +70,17 @@
</goals>
</execution>
<execution>
- <id>CopyGenJavaVersSrcBuild</id>
- <!-- recopie des fichiers java generes vers src-build/java -->
+ <id>CopyJavaVersSrcBuild</id>
+ <!-- recopie des fichiers java sources et generes vers src-build/java -->
<phase>process-sources</phase>
<configuration>
<tasks>
- <copy todir="${maven.src.dir}/java"
- verbose="${maven.verbose}"
- overwrite="true">
- <fileset dir="${basedir}/target/gen/java"/>
+ <copy todir="${maven.src.dir}/java" verbose="${maven.verbose}" overwrite="true">
+ <fileset dir="${maven.gen.dir}/java"/>
</copy>
+ <copy todir="${maven.src.dir}/java" verbose="${maven.verbose}" overwrite="true">
+ <fileset dir="${maven.vcs.src.dir}/java"/>
+ </copy>
</tasks>
</configuration>
<goals>
@@ -124,11 +103,9 @@
<configuration>
<prefix>SimExplorer</prefix>
<i18nPrefix>simexplorer</i18nPrefix>
- <source>${basedir}/src/resources/commandline.properties</source>
+ <source>${maven.src.dir}/resources/commandline.properties</source>
<parserPackageName>fr.cemagref.simexplorer.is.ui.swing.commandline</parserPackageName>
- <actionSuperClass>
- fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionAction
- </actionSuperClass>
+ <actionSuperClass>fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionAction</actionSuperClass>
</configuration>
</execution>
</executions>
@@ -145,7 +122,7 @@
</configuration>
<executions>
<execution>
- <phase>generate-sources</phase>
+ <phase>compile</phase>
<id>JavaActionConfig</id>
<goals>
<goal>parserJavaActionConfig</goal>
@@ -154,7 +131,7 @@
<treateDefaultEntry>false</treateDefaultEntry>
<entries>
<entry>
- <basedir>${basedir}/src/java/fr/cemagref/simexplorer/is/ui/swing/actions</basedir>
+ <basedir>${maven.vcs.src.dir}/java/fr/cemagref/simexplorer/is/ui/swing/actions</basedir>
<includes>
<param>**\/*Action.java</param>
</includes>
@@ -163,7 +140,7 @@
</excludes>
</entry>
<entry>
- <basedir>${basedir}/src/java/fr/cemagref/simexplorer/is/ui/swing/ui</basedir>
+ <basedir>${maven.vcs.src.dir}/java/fr/cemagref/simexplorer/is/ui/swing/ui</basedir>
<includes>
<param>SimExplorerTab.java</param>
</includes>
@@ -183,7 +160,7 @@
<entries>
<entry>
<specificGoal>parserJava</specificGoal>
- <basedir>${basedir}/target/gen/java/fr/cemagref/simexplorer/is/ui/swing</basedir>
+ <basedir>${maven.gen.dir}/java/fr/cemagref/simexplorer/is/ui/swing/commandline</basedir>
<includes>
<param>**\/*Option*.java</param>
<param>**\/*Config*.java</param>
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java 2008-02-20 19:18:44 UTC (rev 1153)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java 2008-02-20 21:15:45 UTC (rev 1154)
@@ -19,7 +19,6 @@
package fr.cemagref.simexplorer.is.ui.swing.commandline.configs;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerAbstractConfigMain;
import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfig;
import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfigFile;
import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
1
0
r1153 - in trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing: . commandline/configs
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 19:18:44 +0000 (Wed, 20 Feb 2008)
New Revision: 1153
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
Log:
move to commandline package
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java 2008-02-20 19:17:59 UTC (rev 1152)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorer.java 2008-02-20 19:18:44 UTC (rev 1153)
@@ -23,6 +23,7 @@
import fr.cemagref.simexplorer.is.ui.swing.ui.SimExplorerMainUI;
import fr.cemagref.simexplorer.is.ui.swing.ui.SimExplorerTab;
import fr.cemagref.simexplorer.is.ui.swing.ui.util.ErrorDialog;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerConfig;
import org.codelutin.i18n.I18n;
import org.codelutin.option.ui.ConfigTableModel;
import org.codelutin.option.ui.ConfigUI;
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java 2008-02-20 19:17:59 UTC (rev 1152)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java 2008-02-20 19:18:44 UTC (rev 1153)
@@ -1,133 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing;
-
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfig;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfigFile;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
-import org.codelutin.i18n.CountryEnum;
-import org.codelutin.i18n.I18n;
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.i18n.LanguageEnum;
-import org.codelutin.option.ConfigPropertyKey;
-import org.codelutin.option.OptionParser;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * L'implantation concrete de la config principale
- *
- * @author chemit
- */
-public class SimExplorerConfig extends SimExplorerAbstractConfigMain {
-
- public SimExplorerConfig() {
- super();
- String home = System.getProperty("user.home");
- if (home == null) {
- // this is a serious fatal error
- throw new SimExplorerRuntimeException("simexplorer.error.user.home");
- }
- doInit();
- }
-
- public void init() throws IOException {
- log.info("start for category [" + category + "] -------------------------");
-
- SimExplorerOptionParser parser = SimExplorer.getContext().getParser();
- initConfigFile(parser);
- log.info("config file : " + getSource());
- // chargement des valeurs par défaut
- loadFromDefaultValue();
- // après le chargement des valeurs par défaut
- // la configuration n'est pas modifiée
- clearModified();
- // surcharge à partir du fichier de configuration de l'utilisateur
- loadFromSource();
- // surcharge à partir des propriétés système
- loadFromSystem();
- // surcharge à partir des propriétés de la jvm
- loadFromJvm();
- // surcharge à partir de l'option config de la ligne de commande
- loadFromOptions(parser);
- clearModified();
- for (String s : this.toString().split("\n")) {
- log.debug(s);
- }
- log.info("end for category [" + category + "] ---------------------------");
- }
-
- protected void initConfigFile(OptionParser parser) {
- File file;
- if (parser.isOptionEnabled(SimExplorerOptionParser.CONFIG_FILE_OPTION_KEY)) {
- // surcharge config file
- SimExplorerOptionConfigFile option = SimExplorerOptionParser.CONFIG_FILE_OPTION_KEY.getOptions().get(0);
-
- file = option.getConfigFile();
- } else {
- String home = System.getProperty("user.home", "");
- File root = new File(home);
- file = new File(root, SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY.getDefaultValue().getName());
- if (!file.exists()) {
- SimExplorer.getContext().setFirstLaunch(true);
- try {
- file.createNewFile();
- } catch (IOException e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
- }
- if (containsKey(SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY)) {
- setProperty(SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY, file);
- }
- setSource(file);
- }
-
- public void initI18n() {
- I18n.initISO88591(getUserLanguage().name(), getUserCountry().name());
- }
-
- protected void loadFromOptions(SimExplorerOptionParser parser) {
- if (!parser.isOptionEnabled(SimExplorerOptionParser.CONFIG_OPTION_KEY)) {
- return;
- }
- // surcharge config file
- for (SimExplorerOptionConfig option : SimExplorerOptionParser.CONFIG_OPTION_KEY.getOptions()) {
- if (getCategory().equals(SimExplorerOptionParser.MAIN_CONFIG_KEY.getCategory())) {
- ConfigPropertyKey<?> propKey = getPropertyKey(option.getKey());
- if (propKey == null) {
- // fatal error , could not found a matching configuration property
- throw new SimExplorerRuntimeException(_("simexplorer.error.unfound.config.property", category, option.getKey()));
- }
- Object oldVal = propKey.getCurrentValue();
- setProperty(propKey, option.getValue());
- Object newVal = propKey.getCurrentValue();
- log.info(_("simexplorer.change.config.property", category, propKey, oldVal, newVal));
- }
- }
- }
-
- public void setI18n(LanguageEnum language, CountryEnum country) {
- setUserLanguage(language);
- setUserCountry(country);
- }
-}
\ No newline at end of file
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 19:17:59 UTC (rev 1152)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 19:18:44 UTC (rev 1153)
@@ -21,6 +21,7 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerCommonActions;
import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.option.ParserException;
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java (from rev 1150, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/SimExplorerConfig.java 2008-02-20 19:18:44 UTC (rev 1153)
@@ -0,0 +1,134 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
+* Tony Chemit, Gabriel Landais
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.commandline.configs;
+
+import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerAbstractConfigMain;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfigFile;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorer;
+import org.codelutin.i18n.CountryEnum;
+import org.codelutin.i18n.I18n;
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.i18n.LanguageEnum;
+import org.codelutin.option.ConfigPropertyKey;
+import org.codelutin.option.OptionParser;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * L'implantation concrete de la config principale
+ *
+ * @author chemit
+ */
+public class SimExplorerConfig extends SimExplorerAbstractConfigMain {
+
+ public SimExplorerConfig() {
+ super();
+ String home = System.getProperty("user.home");
+ if (home == null) {
+ // this is a serious fatal error
+ throw new SimExplorerRuntimeException("simexplorer.error.user.home");
+ }
+ doInit();
+ }
+
+ public void init() throws IOException {
+ log.info("start for category [" + category + "] -------------------------");
+
+ SimExplorerOptionParser parser = SimExplorer.getContext().getParser();
+ initConfigFile(parser);
+ log.info("config file : " + getSource());
+ // chargement des valeurs par défaut
+ loadFromDefaultValue();
+ // après le chargement des valeurs par défaut
+ // la configuration n'est pas modifiée
+ clearModified();
+ // surcharge à partir du fichier de configuration de l'utilisateur
+ loadFromSource();
+ // surcharge à partir des propriétés système
+ loadFromSystem();
+ // surcharge à partir des propriétés de la jvm
+ loadFromJvm();
+ // surcharge à partir de l'option config de la ligne de commande
+ loadFromOptions(parser);
+ clearModified();
+ for (String s : this.toString().split("\n")) {
+ log.debug(s);
+ }
+ log.info("end for category [" + category + "] ---------------------------");
+ }
+
+ protected void initConfigFile(OptionParser parser) {
+ File file;
+ if (parser.isOptionEnabled(SimExplorerOptionParser.CONFIG_FILE_OPTION_KEY)) {
+ // surcharge config file
+ SimExplorerOptionConfigFile option = SimExplorerOptionParser.CONFIG_FILE_OPTION_KEY.getOptions().get(0);
+
+ file = option.getConfigFile();
+ } else {
+ String home = System.getProperty("user.home", "");
+ File root = new File(home);
+ file = new File(root, SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY.getDefaultValue().getName());
+ if (!file.exists()) {
+ SimExplorer.getContext().setFirstLaunch(true);
+ try {
+ file.createNewFile();
+ } catch (IOException e) {
+ throw new SimExplorerRuntimeException(e);
+ }
+ }
+ }
+ if (containsKey(SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY)) {
+ setProperty(SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY, file);
+ }
+ setSource(file);
+ }
+
+ public void initI18n() {
+ I18n.initISO88591(getUserLanguage().name(), getUserCountry().name());
+ }
+
+ protected void loadFromOptions(SimExplorerOptionParser parser) {
+ if (!parser.isOptionEnabled(SimExplorerOptionParser.CONFIG_OPTION_KEY)) {
+ return;
+ }
+ // surcharge config file
+ for (SimExplorerOptionConfig option : SimExplorerOptionParser.CONFIG_OPTION_KEY.getOptions()) {
+ if (getCategory().equals(SimExplorerOptionParser.MAIN_CONFIG_KEY.getCategory())) {
+ ConfigPropertyKey<?> propKey = getPropertyKey(option.getKey());
+ if (propKey == null) {
+ // fatal error , could not found a matching configuration property
+ throw new SimExplorerRuntimeException(_("simexplorer.error.unfound.config.property", category, option.getKey()));
+ }
+ Object oldVal = propKey.getCurrentValue();
+ setProperty(propKey, option.getValue());
+ Object newVal = propKey.getCurrentValue();
+ log.info(_("simexplorer.change.config.property", category, propKey, oldVal, newVal));
+ }
+ }
+ }
+
+ public void setI18n(LanguageEnum language, CountryEnum country) {
+ setUserLanguage(language);
+ setUserCountry(country);
+ }
+}
\ No newline at end of file
1
0
r1152 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 19:17:59 +0000 (Wed, 20 Feb 2008)
New Revision: 1152
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/configs/
Log:
move to commandline package
1
0
r1151 - in trunk/simexplorer-is/simexplorer-is-swing: . src/java/fr/cemagref/simexplorer/is/ui/swing src/java/fr/cemagref/simexplorer/is/ui/swing/actions src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 19:15:32 +0000 (Wed, 20 Feb 2008)
New Revision: 1151
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerAbstractOptionAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerCommonActions.java
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/pom.xml
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
Log:
move to commandline package
Modified: trunk/simexplorer-is/simexplorer-is-swing/pom.xml
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/pom.xml 2008-02-20 19:14:54 UTC (rev 1150)
+++ trunk/simexplorer-is/simexplorer-is-swing/pom.xml 2008-02-20 19:15:32 UTC (rev 1151)
@@ -125,8 +125,10 @@
<prefix>SimExplorer</prefix>
<i18nPrefix>simexplorer</i18nPrefix>
<source>${basedir}/src/resources/commandline.properties</source>
- <parserPackageName>fr.cemagref.simexplorer.is.ui.swing</parserPackageName>
- <actionSuperClass>fr.cemagref.simexplorer.is.ui.swing.actions.SimExplorerAbstractOptionAction</actionSuperClass>
+ <parserPackageName>fr.cemagref.simexplorer.is.ui.swing.commandline</parserPackageName>
+ <actionSuperClass>
+ fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionAction
+ </actionSuperClass>
</configuration>
</execution>
</executions>
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 19:14:54 UTC (rev 1150)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 19:15:32 UTC (rev 1151)
@@ -19,7 +19,7 @@
package fr.cemagref.simexplorer.is.ui.swing;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.ui.swing.actions.SimExplorerCommonActions;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerCommonActions;
import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java 2008-02-20 19:14:54 UTC (rev 1150)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java 2008-02-20 19:15:32 UTC (rev 1151)
@@ -1,47 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007,2008 Code Lutin.
-*
-* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorer;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerContext;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
-import org.codelutin.option.Option;
-import org.codelutin.option.OptionAction;
-
-/**
- * Implantation de base des actions spécifiques au parseur <b><code>SimExplorerOptionParser</code></b>.
- *
- * @author chemit
- * @see OptionAction
- */
-public abstract class SimExplorerAbstractOptionAction<O extends Option> extends org.codelutin.option.OptionAction<O, SimExplorerOptionParser> {
-
- protected SimExplorerContext context;
-
- public SimExplorerAbstractOptionAction() {
- super(SimExplorer.getContext().getParser());
- }
-
- public SimExplorerContext getContext() {
- if (context == null) {
- context = SimExplorer.getContext();
- }
- return context;
- }
-}
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java 2008-02-20 19:14:54 UTC (rev 1150)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java 2008-02-20 19:15:32 UTC (rev 1151)
@@ -1,148 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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 fr.cemagref.simexplorer.is.ui.swing.actions;
-
-import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionEditConfig;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionShowConfig;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionConfig;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionEditConfig;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionHelp;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionResetConfig;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionShowConfig;
-import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionUi;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.option.Config;
-import org.codelutin.option.ui.ConfigTableModel;
-import org.codelutin.option.ui.ConfigUI;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-/**
- * The class to define all common actions that IsisFish can launch at init time.
- *
- * @author chemit
- */
-public class SimExplorerCommonActions {
-
- private static final Log log = LogFactory.getLog(SimExplorerCommonActions.class);
-
- static void printConfig(StringWriter writer, Config config) throws IOException {
- writer.append('\n').append(config.toString());
- writer.flush();
- }
-
- public static class HelpAction extends SimExplorerAbstractOptionActionHelp {
-
- protected void run() throws Exception {
- log.info("required help action");
- StringWriter writer = new StringWriter();
- getParser().printUsage(writer, "SimExplorer SI v " + getContext().getConfig().getVersion());
- printConfig(writer, getParser().getMainConfig());
- writer.append('\n');
- log.info(writer);
- getContext().setQuit(true);
- }
- }
-
- public static class ConfigAction extends SimExplorerAbstractOptionActionConfig {
-
- protected void run() throws Exception {
- // Do nothing, this action is treated while init of config files
- }
- }
-
- public static class ShowConfigAction extends SimExplorerAbstractOptionActionShowConfig {
- @Override
- protected void beforeAll(SimExplorerOptionShowConfig... options) {
- super.beforeAll(options);
- // check we have not twice config
- }
-
- public void run() throws Exception {
- SimExplorerAbstractConfigMain conf;
- conf = getParser().getMainConfig();
-
- String category = option.getConstantArgumentValue(0);
- if (conf == null) {
- throw new IllegalArgumentException("could not found a configuration with category " + category);
- }
- log.info("required showConfig pour category [" + category + "]");
- StringWriter writer = new StringWriter();
- printConfig(writer, conf);
- log.info(writer);
- getContext().setQuit(true);
- }
- }
-
- public static class EditConfigAction extends SimExplorerAbstractOptionActionEditConfig {
- @Override
- protected void beforeAll(SimExplorerOptionEditConfig... options) {
- super.beforeAll(options);
- // check we have not twice config
- }
-
- public void run() throws Exception {
- SimExplorerAbstractConfigMain conf;
- conf = getParser().getMainConfig();
- if (isAll()) {
- ConfigUI.showUI(conf, ConfigTableModel.TypeModel.all);
- } else if (isTec()) {
- ConfigUI.showTechnicalUI(conf);
- } else {
- ConfigUI.showUI(conf);
- }
-
- StringWriter writer = new StringWriter();
- printConfig(writer, conf);
- log.info("required editConfig pour category [" + conf.getCategory() + "]" + writer);
- }
- }
-
- public static class ResetConfigAction extends SimExplorerAbstractOptionActionResetConfig {
-
- public void run() throws Exception {
- //IsisFish.firstLaunch = true;
- //IsisFish.resetConfig = true;
- getContext().getConfig().getConfigFileName().delete();
- log.info(_("simexplorer.message.reset.user.configuration"));
- getContext().setFirstLaunch(true);
- }
-
- }
-
- public static class UiAction extends SimExplorerAbstractOptionActionUi {
- protected boolean init = false;
-
- public void run() throws Exception {
- Boolean bool = isValue();
- boolean launchUI = bool != null && bool;
- log.info(option.getUsedAlias() + ", value:" + bool);
- getContext().setLaunchUI(launchUI);
- if (init) {
- getContext().setQuit(true);
- }
- init = true;
- }
- }
-}
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerAbstractOptionAction.java (from rev 1150, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerAbstractOptionAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerAbstractOptionAction.java 2008-02-20 19:15:32 UTC (rev 1151)
@@ -0,0 +1,47 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007,2008 Code Lutin.
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.commandline.actions;
+
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorer;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorerContext;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
+import org.codelutin.option.Option;
+import org.codelutin.option.OptionAction;
+
+/**
+ * Implantation de base des actions spécifiques au parseur <b><code>SimExplorerOptionParser</code></b>.
+ *
+ * @author chemit
+ * @see OptionAction
+ */
+public abstract class SimExplorerAbstractOptionAction<O extends Option> extends org.codelutin.option.OptionAction<O, SimExplorerOptionParser> {
+
+ protected SimExplorerContext context;
+
+ public SimExplorerAbstractOptionAction() {
+ super(SimExplorer.getContext().getParser());
+ }
+
+ public SimExplorerContext getContext() {
+ if (context == null) {
+ context = SimExplorer.getContext();
+ }
+ return context;
+ }
+}
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerCommonActions.java (from rev 1150, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerCommonActions.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/SimExplorerCommonActions.java 2008-02-20 19:15:32 UTC (rev 1151)
@@ -0,0 +1,148 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
+* Benjamin Poussin, 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 fr.cemagref.simexplorer.is.ui.swing.commandline.actions;
+
+import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerAbstractConfigMain;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionEditConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionShowConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionEditConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionHelp;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionResetConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionShowConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionUi;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.option.Config;
+import org.codelutin.option.ui.ConfigTableModel;
+import org.codelutin.option.ui.ConfigUI;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * The class to define all common actions that IsisFish can launch at init time.
+ *
+ * @author chemit
+ */
+public class SimExplorerCommonActions {
+
+ private static final Log log = LogFactory.getLog(SimExplorerCommonActions.class);
+
+ static void printConfig(StringWriter writer, Config config) throws IOException {
+ writer.append('\n').append(config.toString());
+ writer.flush();
+ }
+
+ public static class HelpAction extends SimExplorerAbstractOptionActionHelp {
+
+ protected void run() throws Exception {
+ log.info("required help action");
+ StringWriter writer = new StringWriter();
+ getParser().printUsage(writer, "SimExplorer SI v " + getContext().getConfig().getVersion());
+ printConfig(writer, getParser().getMainConfig());
+ writer.append('\n');
+ log.info(writer);
+ getContext().setQuit(true);
+ }
+ }
+
+ public static class ConfigAction extends SimExplorerAbstractOptionActionConfig {
+
+ protected void run() throws Exception {
+ // Do nothing, this action is treated while init of config files
+ }
+ }
+
+ public static class ShowConfigAction extends SimExplorerAbstractOptionActionShowConfig {
+ @Override
+ protected void beforeAll(SimExplorerOptionShowConfig... options) {
+ super.beforeAll(options);
+ // check we have not twice config
+ }
+
+ public void run() throws Exception {
+ SimExplorerAbstractConfigMain conf;
+ conf = getParser().getMainConfig();
+
+ String category = option.getConstantArgumentValue(0);
+ if (conf == null) {
+ throw new IllegalArgumentException("could not found a configuration with category " + category);
+ }
+ log.info("required showConfig pour category [" + category + "]");
+ StringWriter writer = new StringWriter();
+ printConfig(writer, conf);
+ log.info(writer);
+ getContext().setQuit(true);
+ }
+ }
+
+ public static class EditConfigAction extends SimExplorerAbstractOptionActionEditConfig {
+ @Override
+ protected void beforeAll(SimExplorerOptionEditConfig... options) {
+ super.beforeAll(options);
+ // check we have not twice config
+ }
+
+ public void run() throws Exception {
+ SimExplorerAbstractConfigMain conf;
+ conf = getParser().getMainConfig();
+ if (isAll()) {
+ ConfigUI.showUI(conf, ConfigTableModel.TypeModel.all);
+ } else if (isTec()) {
+ ConfigUI.showTechnicalUI(conf);
+ } else {
+ ConfigUI.showUI(conf);
+ }
+
+ StringWriter writer = new StringWriter();
+ printConfig(writer, conf);
+ log.info("required editConfig pour category [" + conf.getCategory() + "]" + writer);
+ }
+ }
+
+ public static class ResetConfigAction extends SimExplorerAbstractOptionActionResetConfig {
+
+ public void run() throws Exception {
+ //IsisFish.firstLaunch = true;
+ //IsisFish.resetConfig = true;
+ getContext().getConfig().getConfigFileName().delete();
+ log.info(_("simexplorer.message.reset.user.configuration"));
+ getContext().setFirstLaunch(true);
+ }
+
+ }
+
+ public static class UiAction extends SimExplorerAbstractOptionActionUi {
+ protected boolean init = false;
+
+ public void run() throws Exception {
+ Boolean bool = isValue();
+ boolean launchUI = bool != null && bool;
+ log.info(option.getUsedAlias() + ", value:" + bool);
+ getContext().setLaunchUI(launchUI);
+ if (init) {
+ getContext().setQuit(true);
+ }
+ init = true;
+ }
+ }
+}
1
0
r1150 - in trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing: . actions commandline
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 19:14:54 +0000 (Wed, 20 Feb 2008)
New Revision: 1150
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/commandline/actions/
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java
Log:
move to commandline package
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java 2008-02-20 19:07:59 UTC (rev 1149)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java 2008-02-20 19:14:54 UTC (rev 1150)
@@ -19,9 +19,10 @@
package fr.cemagref.simexplorer.is.ui.swing;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.ui.swing.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionConfig;
-import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionConfigFile;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerAbstractConfigMain;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionConfigFile;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
import org.codelutin.i18n.CountryEnum;
import org.codelutin.i18n.I18n;
import static org.codelutin.i18n.I18n._;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 19:07:59 UTC (rev 1149)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 19:14:54 UTC (rev 1150)
@@ -20,6 +20,7 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.swing.actions.SimExplorerCommonActions;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.option.ParserException;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java 2008-02-20 19:07:59 UTC (rev 1149)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java 2008-02-20 19:14:54 UTC (rev 1150)
@@ -20,7 +20,7 @@
import fr.cemagref.simexplorer.is.ui.swing.SimExplorer;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerContext;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerOptionParser;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.SimExplorerOptionParser;
import org.codelutin.option.Option;
import org.codelutin.option.OptionAction;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java 2008-02-20 19:07:59 UTC (rev 1149)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java 2008-02-20 19:14:54 UTC (rev 1150)
@@ -19,9 +19,15 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.ui.swing.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionEditConfig;
-import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionShowConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.configs.SimExplorerAbstractConfigMain;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionEditConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.options.SimExplorerOptionShowConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionEditConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionHelp;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionResetConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionShowConfig;
+import fr.cemagref.simexplorer.is.ui.swing.commandline.actions.SimExplorerAbstractOptionActionUi;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.codelutin.i18n.I18n._;
1
0
r1149 - in trunk/simexplorer-is/simexplorer-is-swing: . src/java/fr/cemagref/simexplorer/is/ui/swing src/java/fr/cemagref/simexplorer/is/ui/swing/actions src/resources src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ui/util
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 19:07:59 +0000 (Wed, 20 Feb 2008)
New Revision: 1149
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/resources/myjaxx.rules
Modified:
trunk/simexplorer-is/simexplorer-is-swing/go.sh
trunk/simexplorer-is/simexplorer-is-swing/pom.xml
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java
trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ui/util/ChooseFile.jaxx
Log:
move to swing package + remove unused stuff
Modified: trunk/simexplorer-is/simexplorer-is-swing/go.sh
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/go.sh 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/go.sh 2008-02-20 19:07:59 UTC (rev 1149)
@@ -66,7 +66,7 @@
VER=$(xmlstarlet sel -N "p=http://maven.apache.org/POM/4.0.0" -t -v "/p:project/p:version" pom.xml)
RELEASE="simexplorer-is-swing-$VER"
-MAIN_CLASS="fr.cemagref.simexplorer.is.ui.SimExplorer"
+MAIN_CLASS="fr.cemagref.simexplorer.is.ui.swing.SimExplorer"
MX=512M
rep=`dirname $0`
Modified: trunk/simexplorer-is/simexplorer-is-swing/pom.xml
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/pom.xml 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/pom.xml 2008-02-20 19:07:59 UTC (rev 1149)
@@ -28,9 +28,7 @@
<!--Source base dir-->
<maven.src.dir>${basedir}/target/src-build</maven.src.dir>
<!--Main class in JAR -->
- <maven.jar.main.class>
- fr.cemagref.simexplorer.is.ui.SimExplorer
- </maven.jar.main.class>
+ <maven.jar.main.class>fr.cemagref.simexplorer.is.ui.swing.SimExplorer</maven.jar.main.class>
</properties>
</profile>
</profiles>
@@ -99,9 +97,9 @@
<phase>process-sources</phase>
<configuration>
<tasks>
- <copy todir="${basedir}/target/src-build/java"
+ <copy todir="${maven.src.dir}/java"
verbose="${maven.verbose}"
- overwrite="false">
+ overwrite="true">
<fileset dir="${basedir}/target/gen/java"/>
</copy>
</tasks>
@@ -127,8 +125,8 @@
<prefix>SimExplorer</prefix>
<i18nPrefix>simexplorer</i18nPrefix>
<source>${basedir}/src/resources/commandline.properties</source>
- <parserPackageName>fr.cemagref.simexplorer.is.ui</parserPackageName>
- <actionSuperClass>fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionAction</actionSuperClass>
+ <parserPackageName>fr.cemagref.simexplorer.is.ui.swing</parserPackageName>
+ <actionSuperClass>fr.cemagref.simexplorer.is.ui.swing.actions.SimExplorerAbstractOptionAction</actionSuperClass>
</configuration>
</execution>
</executions>
@@ -163,7 +161,7 @@
</excludes>
</entry>
<entry>
- <basedir>${basedir}/src/java/fr/cemagref/simexplorer/is/ui/swing/</basedir>
+ <basedir>${basedir}/src/java/fr/cemagref/simexplorer/is/ui/swing/ui</basedir>
<includes>
<param>SimExplorerTab.java</param>
</includes>
@@ -179,12 +177,11 @@
<goal>parserJava</goal>
<goal>gen</goal>
</goals>
- <configuration>
- <!--rulesJaxx>${basedir}/src/resources/myjaxx.rules</rulesJaxx-->
+ <configuration>
<entries>
<entry>
<specificGoal>parserJava</specificGoal>
- <basedir>${basedir}/target/gen/java/</basedir>
+ <basedir>${basedir}/target/gen/java/fr/cemagref/simexplorer/is/ui/swing</basedir>
<includes>
<param>**\/*Option*.java</param>
<param>**\/*Config*.java</param>
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerConfig.java 2008-02-20 19:07:59 UTC (rev 1149)
@@ -19,10 +19,9 @@
package fr.cemagref.simexplorer.is.ui.swing;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.ui.SimExplorerOptionParser;
-import fr.cemagref.simexplorer.is.ui.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionConfig;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionConfigFile;
+import fr.cemagref.simexplorer.is.ui.swing.configs.SimExplorerAbstractConfigMain;
+import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionConfig;
+import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionConfigFile;
import org.codelutin.i18n.CountryEnum;
import org.codelutin.i18n.I18n;
import static org.codelutin.i18n.I18n._;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 19:07:59 UTC (rev 1149)
@@ -19,7 +19,6 @@
package fr.cemagref.simexplorer.is.ui.swing;
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.ui.SimExplorerOptionParser;
import fr.cemagref.simexplorer.is.ui.swing.actions.SimExplorerCommonActions;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java 2008-02-20 19:07:59 UTC (rev 1149)
@@ -18,9 +18,9 @@
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.ui.SimExplorerOptionParser;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorer;
import fr.cemagref.simexplorer.is.ui.swing.SimExplorerContext;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorerOptionParser;
import org.codelutin.option.Option;
import org.codelutin.option.OptionAction;
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java 2008-02-20 19:07:59 UTC (rev 1149)
@@ -19,15 +19,9 @@
* ##% */
package fr.cemagref.simexplorer.is.ui.swing.actions;
-import fr.cemagref.simexplorer.is.ui.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionEditConfig;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionShowConfig;
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionHelp;
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionConfig;
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionShowConfig;
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionEditConfig;
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionResetConfig;
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionUi;
+import fr.cemagref.simexplorer.is.ui.swing.configs.SimExplorerAbstractConfigMain;
+import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionEditConfig;
+import fr.cemagref.simexplorer.is.ui.swing.options.SimExplorerOptionShowConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.codelutin.i18n.I18n._;
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/resources/myjaxx.rules
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/resources/myjaxx.rules 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/resources/myjaxx.rules 2008-02-20 19:07:59 UTC (rev 1149)
@@ -1,6 +0,0 @@
-# Règles pour JAXX
-
-//jaxx.runtime.swing.JAXXToggleButton/@normalText
-//jaxx.runtime.swing.JAXXToggleButton/@glueText
-//jaxx.runtime.swing.JAXXToggleButton/@normalTooltipText
-//jaxx.runtime.swing.JAXXToggleButton/@glueTooltipText
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ui/util/ChooseFile.jaxx
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ui/util/ChooseFile.jaxx 2008-02-20 18:53:49 UTC (rev 1148)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/ui/util/ChooseFile.jaxx 2008-02-20 19:07:59 UTC (rev 1149)
@@ -17,7 +17,7 @@
<Table>
<row fill='both' weightx="1">
<cell>
- <fr.cemagref.simexplorer.is.ui.swing.util.ChooseFilePanel />
+ <fr.cemagref.simexplorer.is.ui.swing.ui.util.ChooseFilePanel />
</cell>
</row>
<row fill='both' weightx='1' weighty='1'>
1
0
r1148 - in trunk/simexplorer-is/simexplorer-is-swing/src: java/fr/cemagref/simexplorer/is/ui uimodel/fr/cemagref/simexplorer/is/ui/swing
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 18:53:49 +0000 (Wed, 20 Feb 2008)
New Revision: 1148
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/
trunk/simexplorer-is/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/util/
Log:
move to swing package
1
0
r1147 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 18:51:53 +0000 (Wed, 20 Feb 2008)
New Revision: 1147
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
Log:
move to swing package
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-02-20 18:51:21 UTC (rev 1146)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-02-20 18:51:53 UTC (rev 1147)
@@ -1,194 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui;
-
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerMainUI;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerTab;
-import fr.cemagref.simexplorer.is.ui.swing.actions.util.SimExplorerAbstractAction;
-import fr.cemagref.simexplorer.is.ui.swing.util.ErrorDialog;
-import org.codelutin.i18n.I18n;
-import org.codelutin.option.ui.ConfigTableModel;
-import org.codelutin.option.ui.ConfigUI;
-
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-/**
- * L'application principale
- *
- * @author chemit
- */
-public class SimExplorer {
-
- /** le context principal de l'application */
- protected static SimExplorerContext context;
-
- /** l'ui principale de l'application */
- protected static SimExplorerMainUI ui;
-
- /** le dialogue pour afficher les erreurs */
- protected static ErrorDialog errorDialog;
-
- public static SimExplorerContext getContext() {
- checkInitContext();
- return context;
- }
-
- public static SimExplorerMainUI getUI() {
- checkInitContext();
- if (ui == null) {
- ui = new SimExplorerMainUI();
- }
- return ui;
- }
-
- public static void showError(Exception e) {
- if (errorDialog == null) {
- errorDialog = new ErrorDialog();
- }
- errorDialog.getErrorMessage().setText(e.getMessage());
- StringWriter w = new StringWriter();
- e.printStackTrace(new PrintWriter(w));
- errorDialog.getErrorStack().setText(w.toString());
- errorDialog.getErrorStack().setCaretPosition(0);
- errorDialog.pack();
- errorDialog.setVisible(true);
- }
-
- public static void disposeUI() {
- ui = null;
- SimExplorerActionManager.resetCache();
- ConfigUI.reloadUI();
- errorDialog = null;
- SimExplorerTab.getFactory().resetCache();
- // remove listeners on detail tab model
- for (SimExplorerTab tab : SimExplorerTab.values()) {
- tab.removePropertyChangeListeners();
- }
- // on nettoye les ui cachees dans les actions
- SimExplorerActionManager.disposeUI();
- }
-
- /**
- * initialisation de l'application :
- * <p/>
- * chargement du context
- *
- * @param args les arguments passés à l'application
- */
- public static void init(String... args) {
-
- // init context
- context = new SimExplorerContext();
-
- // init i18n
- I18n.initISO88591();
-
- // init parser
- context.initParser(args);
-
- // init config
- context.initConfig();
-
- // save config
- try {
- context.save();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- /** Lancement de l'ui après init de l'application. */
- public static void launch() {
-
- // init ui
- SimExplorerMainUI mainUI = getUI();
-
- SimExplorerConfig conf = getContext().getConfig();
-
- if (conf.isShowLocalTab()) {
- // show local tab
- mainUI.getToggleTab_local().doClick();
- }
- if (conf.isAutoConnect()) {
- try {
- // try to connect
- mainUI.getConnect().getAction().actionPerformed(new ActionEvent(mainUI, 0, "connect"));
- // action will update ui if everything is correct
- if (context.isConnected() && conf.isShowRemoteTab()) {
- // show remote tab
- mainUI.getToggleTab_remote().doClick();
- }
- } catch (Exception e) {
- // ignore ?
- System.err.println(e.getMessage());
- }
- }
-
- // refresh ui accessibles actions
- if (!context.isConnected()) {
- getConnectAction(false).updateUI();
- }
-
-
- mainUI.setVisible(true);
- }
-
- public static SimExplorerAbstractAction getConnectAction(boolean isConnected) {
- if (isConnected) {
- return (SimExplorerAbstractAction) getUI().getConnect().getAction();
- } else {
- return (SimExplorerAbstractAction) getUI().getUnconnect().getAction();
- }
- }
-
- public static void main(String... args) throws Exception {
-
- // init application (parser,config,i18n,...)
- init(args);
-
- // launch actions required
- context.getParser().doAllActions();
-
- // show edit config if first launch
- if (SimExplorer.context.isFirstLaunch()) {
- ConfigUI.showUI(context.getConfig(), ConfigTableModel.TypeModel.all);
- }
-
- // launch ui only if required
- if (!context.isQuit() && context.isLaunchUI()) {
- launch();
- }
-
- }
-
- protected static void checkInitContext() {
- if (context == null) {
- throw new SimExplorerRuntimeException("context is null, you must init first the " + SimExplorer.class.getName() + " class via init method");
- }
- }
-
- protected SimExplorer() {
- // protected restricted access
- }
-}
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java 2008-02-20 18:51:21 UTC (rev 1146)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java 2008-02-20 18:51:53 UTC (rev 1147)
@@ -1,132 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui;
-
-import fr.cemagref.simexplorer.is.ui.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionConfig;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionConfigFile;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import org.codelutin.i18n.CountryEnum;
-import org.codelutin.i18n.I18n;
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.i18n.LanguageEnum;
-import org.codelutin.option.ConfigPropertyKey;
-import org.codelutin.option.OptionParser;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * L'implantation concrete de la config principale
- *
- * @author chemit
- */
-public class SimExplorerConfig extends SimExplorerAbstractConfigMain {
-
- public SimExplorerConfig() {
- super();
- String home = System.getProperty("user.home");
- if (home == null) {
- // this is a serious fatal error
- throw new SimExplorerRuntimeException("simexplorer.error.user.home");
- }
- doInit();
- }
-
- public void init() throws IOException {
- log.info("start for category [" + category + "] -------------------------");
-
- SimExplorerOptionParser parser = SimExplorer.getContext().getParser();
- initConfigFile(parser);
- log.info("config file : " + getSource());
- // chargement des valeurs par défaut
- loadFromDefaultValue();
- // après le chargement des valeurs par défaut
- // la configuration n'est pas modifiée
- clearModified();
- // surcharge à partir du fichier de configuration de l'utilisateur
- loadFromSource();
- // surcharge à partir des propriétés système
- loadFromSystem();
- // surcharge à partir des propriétés de la jvm
- loadFromJvm();
- // surcharge à partir de l'option config de la ligne de commande
- loadFromOptions(parser);
- clearModified();
- for (String s : this.toString().split("\n")) {
- log.debug(s);
- }
- log.info("end for category [" + category + "] ---------------------------");
- }
-
- protected void initConfigFile(OptionParser parser) {
- File file;
- if (parser.isOptionEnabled(SimExplorerOptionParser.CONFIG_FILE_OPTION_KEY)) {
- // surcharge config file
- SimExplorerOptionConfigFile option = SimExplorerOptionParser.CONFIG_FILE_OPTION_KEY.getOptions().get(0);
-
- file = option.getConfigFile();
- } else {
- String home = System.getProperty("user.home", "");
- File root = new File(home);
- file = new File(root, SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY.getDefaultValue().getName());
- if (!file.exists()) {
- SimExplorer.getContext().setFirstLaunch(true);
- try {
- file.createNewFile();
- } catch (IOException e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
- }
- if (containsKey(SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY)) {
- setProperty(SimExplorerConfig.CONFIG_FILE_NAME_PROPERTY_KEY, file);
- }
- setSource(file);
- }
-
- public void initI18n() {
- I18n.initISO88591(getUserLanguage().name(), getUserCountry().name());
- }
-
- protected void loadFromOptions(SimExplorerOptionParser parser) {
- if (!parser.isOptionEnabled(SimExplorerOptionParser.CONFIG_OPTION_KEY)) {
- return;
- }
- // surcharge config file
- for (SimExplorerOptionConfig option : SimExplorerOptionParser.CONFIG_OPTION_KEY.getOptions()) {
- if (getCategory().equals(SimExplorerOptionParser.MAIN_CONFIG_KEY.getCategory())) {
- ConfigPropertyKey<?> propKey = getPropertyKey(option.getKey());
- if (propKey == null) {
- // fatal error , could not found a matching configuration property
- throw new SimExplorerRuntimeException(_("simexplorer.error.unfound.config.property", category, option.getKey()));
- }
- Object oldVal = propKey.getCurrentValue();
- setProperty(propKey, option.getValue());
- Object newVal = propKey.getCurrentValue();
- log.info(_("simexplorer.change.config.property", category, propKey, oldVal, newVal));
- }
- }
- }
-
- public void setI18n(LanguageEnum language, CountryEnum country) {
- setUserLanguage(language);
- setUserCountry(country);
- }
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java 2008-02-20 18:51:21 UTC (rev 1146)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java 2008-02-20 18:51:53 UTC (rev 1147)
@@ -1,197 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui;
-
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerCommonActions;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.option.ParserException;
-
-import java.io.BufferedOutputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-/**
- * Le context de l'application, implanté en singleton.
- * <p/>
- * Contient la configuration de l'application, le parseur d'options,...
- *
- * @author chemit
- */
-public class SimExplorerContext {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(SimExplorerContext.class);
-
- /**
- * le parseur utilisé au démarrage pour récupérer les options passées
- * par l'utilisateur.
- */
- protected SimExplorerOptionParser parser;
-
- /** flag pour indiquer si 'lon veut quitter l'appli après les options */
- protected boolean quit;
-
- /** flag pour indiquer si l'on affiche ou non l'ui principale */
- protected boolean launchUI = true;
-
- /**
- * flag pour indiquer une première utilisation de l'application (pas de
- * fichier de configuration)
- */
- protected boolean firstLaunch;
-
- /** le token pour la connexion au serveur distant */
- protected String token;
-
- /**
- * @return le parseur utilisé pour parser les options de la ligne de
- * commande.
- */
- public SimExplorerOptionParser getParser() {
- if (parser == null) {
- // creation du parseur
- parser = new SimExplorerOptionParser();
- // enregistrement des actions concretes
- parser.registerActions(SimExplorerCommonActions.class);
- // enregistrement des configs concretes
- parser.registerConfig(SimExplorerConfig.class);
- }
- return parser;
- }
-
- /** @return la configuration de l'application */
- public SimExplorerConfig getConfig() {
- return (SimExplorerConfig) getParser().getMainConfig();
- }
-
- /**
- * @return <code>true</code> si l'utilisateur est connecté,
- * <code>false</code> sinon.
- */
- public boolean isConnected() {
- return !(token == null || token.isEmpty());
- }
-
- /**
- * Sauvegarde la configuration courante de l'utilisateur.
- *
- * @throws IOException si problème lors de l'écriture du fichier de configuration
- */
- public void save() throws IOException {
- if (getConfig().getSource() == null) {
- return;
- }
- BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(getConfig().getSource()));
- try {
- getConfig().save(out);
- } finally {
- out.flush();
- out.close();
- }
- }
-
- /**
- * Sauvegarde la configuration de l'utilisateur sans soulever d'exception
- * si un problème est survenu lors de l'opération.
- */
- public void saveSafely() {
- try {
- save();
- } catch (Exception e) {
- log.warn("simexplorer.error.unsafe.save.config" + e.getMessage(), e);
- }
- }
-
- /**
- * @return <code>true</code> si on doit quitter l'application (uniquement utilisé
- * lors du démarrage de l'application lors de l'exécution des options
- * utilisateurs)
- */
- public boolean isQuit() {
- return quit;
- }
-
- /**
- * @return <code>true</code> si on doit lancer l'ui au démarrage de
- * l'application, après avoir traité toutes les options utilisateurs
- */
- public boolean isLaunchUI() {
- return launchUI;
- }
-
- /**
- * @return <code>true</code> s'il s'agit de la première utilisation de
- * l'application (aucun de fichier de configuration trouvé)
- */
- public boolean isFirstLaunch() {
- return firstLaunch;
- }
-
- /**
- * @return le token utilisé pour identifié l'utilisateur sur le serveur distant.
- * <p/>
- * <b>Si est null ou vide cela veut que l'utilisateur n'est pas connecté.</b>
- */
- public String getToken() {
- return token;
- }
-
- public void setQuit(boolean quit) {
- this.quit = quit;
- }
-
- public void setLaunchUI(boolean launchUI) {
- this.launchUI = launchUI;
- }
-
- public void setFirstLaunch(boolean firstLaunch) {
- this.firstLaunch = firstLaunch;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- /** restricted access constructor */
- SimExplorerContext() {
-
- }
-
- /**
- * Initialisation du parseur d'options.
- *
- * @param args les arguments passés au démarrage de l'application
- */
- void initParser(String... args) {
- try {
- getParser().doParse(args);
- } catch (ParserException e) {
- throw new SimExplorerRuntimeException(e);
- } catch (IOException e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
-
- /** Initialisation de la configuration utilisateur */
- void initConfig() {
- getConfig().initI18n();
- }
-}
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-20 18:51:21 UTC (rev 1146)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/StorageServiceHelper.java 2008-02-20 18:51:53 UTC (rev 1147)
@@ -1,248 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gabriel Landais
-*
-* 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 fr.cemagref.simexplorer.is.ui;
-
-import com.healthmarketscience.rmiio.SerializableInputStream;
-import fr.cemagref.simexplorer.is.entities.attachment.Attachment;
-import fr.cemagref.simexplorer.is.entities.data.LoggableElement;
-import fr.cemagref.simexplorer.is.entities.metadata.MetaData;
-import fr.cemagref.simexplorer.is.entities.metadata.Version;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerException;
-import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
-import fr.cemagref.simexplorer.is.exceptions.UnreachableServiceException;
-import fr.cemagref.simexplorer.is.service.MockStorageServiceImpl;
-import fr.cemagref.simexplorer.is.service.StorageService;
-import fr.cemagref.simexplorer.is.service.StorageServiceClient;
-import static fr.cemagref.simexplorer.is.service.StorageServiceHelper.STORAGE_SERVICE_LOOKUP_NAME;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Properties;
-
-/**
- * Une classe pour encapsuler les appels aux services Storage et leur initialisation.
- *
- * @author chemit
- */
-public class StorageServiceHelper {
-
- private final static boolean mock = false;
-
- private final static String PROVIDER_URL = "java.naming.provider.url";
- private final static String FACTORY_INITIAL = "java.naming.factory.initial";
- private final static String FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
-
- /** le service de données distant */
- protected static StorageService remoteStorageService;
-
- /** le service de données local */
- protected static StorageService storageService;
-
- /**
- * @param context le context de l'application
- * @param remote flag pour indiquer le type de service recherché (local ou remote)
- * @return le service instancié et initialisé
- * @throws UnreachableServiceException si service non joignable
- */
- public static StorageService getService(SimExplorerContext context, boolean remote) throws UnreachableServiceException {
- StorageService service;
- service = remote ? getRemoteStorageService(context) : getLocalStorageService();
- if (service == null) {
- throw new UnreachableServiceException("could not find service " + (remote ? "remote" : "local"));
- }
- return service;
- }
-
- public static int getCount(SimExplorerContext context, boolean remote, String query, boolean onlyLatest) {
- StorageService service = getService(context, remote);
- String token = context.getToken();
- int size;
- try {
- if (query == null || query.isEmpty()) {
- size = service.findApplicationsCount(token, onlyLatest);
- } else {
- size = service.findFullTextCount(token, query, onlyLatest);
- }
- return size;
- } catch (SimExplorerException e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
-
- public static String loginUser(SimExplorerContext context, boolean remote, String login, String hashPassword) throws UnreachableServiceException {
- StorageService service = getService(context, remote);
- try {
- /*if (service == null) {
- throw new UnreachableServiceException("could not find service " + (remote ? "remote" : "local"));
- }*/
- String token;
- token = service.loginUser(login, hashPassword);
- return token;
- } catch (SimExplorerException e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
-
- public static MetaData[] getData(SimExplorerContext context, boolean remote, boolean onlyLatest, String query, long newFirstIndex, int width, int rowOrder) {
- StorageService service = getService(context, remote);
- String token = context.getToken();
- try {
- MetaData[] data;
- if (query == null || query.isEmpty()) {
- data = service.findApplications(token, onlyLatest, (int) newFirstIndex, width, rowOrder);
- } else {
- data = service.findFullText(token, query, onlyLatest, (int) newFirstIndex, width, rowOrder);
- }
- return data;
- } catch (SimExplorerException e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
-
-
- public static LoggableElement getElement(SimExplorerContext context, boolean remote, String uuid, String version) {
- try {
- LoggableElement data;
- data = getService(context, remote).getLoggableElement(context.getToken(), uuid, version);
- return data;
- } catch (SimExplorerException e1) {
- throw new SimExplorerRuntimeException(e1);
- }
- }
-
- public static void deleteElement(SimExplorerContext context, boolean remote, String uuid, String version) {
- try {
- getService(context, remote).deleteElement(context.getToken(), uuid, version);
- } catch (SimExplorerException e1) {
- throw new SimExplorerRuntimeException(e1);
- }
- }
-
- public static MetaData getMetaData(SimExplorerContext context, boolean remote, String uuid, String version) {
- try {
- MetaData metas;
- metas = getService(context, remote).getMetadata(context.getToken(), uuid, version);
- return metas;
- } catch (SimExplorerException e1) {
- throw new SimExplorerRuntimeException(e1);
- }
- }
-
-
- public static BufferedInputStream retrieveElementFull(SimExplorerContext context, boolean remote, String uuid, String version) {
- try {
- InputStream stream = getService(context, remote).retrieveElementFull(context.getToken(), uuid, version);
- BufferedInputStream bis;
- bis = new BufferedInputStream(stream);
- return bis;
- } catch (SimExplorerException e1) {
- throw new SimExplorerRuntimeException(e1);
- }
- }
-
- public static BufferedInputStream retrieveElementData(SimExplorerContext context, boolean remote, String uuid, String version, Attachment attachment) {
- try {
- InputStream stream = getService(context, remote).retrieveElementData(context.getToken(), uuid, version, attachment);
- BufferedInputStream bis;
- bis = new BufferedInputStream(stream);
- return bis;
- } catch (SimExplorerException e1) {
- throw new SimExplorerRuntimeException(e1);
- }
- }
-
- public static void importElement(SimExplorerContext context, boolean remote, File file) {
- try {
- SerializableInputStream zipStream;
- zipStream = new SerializableInputStream(new FileInputStream(file));
- getService(context, remote).saveElement(context.getToken(), zipStream);
- } catch (Exception e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
-
- public static Version[] getVersions(SimExplorerContext context, boolean remote, String uuid) {
- try {
- Version[] result;
- result = getService(context, remote).getVersions(context.getToken(), uuid);
- return result;
- } catch (SimExplorerException e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
-
- /** @return le service de storage locale */
- protected static StorageService getLocalStorageService() {
- if (storageService == null) {
- if (mock) {
- return storageService = new MockStorageServiceImpl(false);
- }
- try {
- storageService = new StorageServiceClient();
- } catch (Exception e) {
- throw new SimExplorerRuntimeException(e);
- }
- }
- return storageService;
- }
-
- /**
- * @param context le context de l'application
- * @return le service de storage distant
- */
- protected static StorageService getRemoteStorageService(SimExplorerContext context) {
- if (remoteStorageService == null) {
- if (mock) {
- return remoteStorageService = new MockStorageServiceImpl(true);
- }
- try {
- Properties props = initProperties(context.getConfig().getRemoteURI());
- Context context2;
- try {
- context2 = new InitialContext(props);
- } catch (Exception e) {
- context2 = new InitialContext();
- }
- remoteStorageService = (StorageService) context2.lookup(STORAGE_SERVICE_LOOKUP_NAME);
- } catch (NamingException e) {
- // no remote service available
- remoteStorageService = null;
- }
- }
- return remoteStorageService;
- }
-
- protected static Properties initProperties(URI uri) {
- Properties props = (Properties) System.getProperties().clone();
- props.put(PROVIDER_URL, uri.toString());
- props.put(FACTORY_INITIAL, "org.jnp.interfaces.NamingContextFactory");
- props.put(FACTORY_URL_PKGS, "org.jnp.interfaces");
- return props;
- }
-
- protected StorageServiceHelper() {
- // no instance
- }
-}
1
0
r1146 - in trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui: actions swing swing/actions
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
by tchemit@users.labs.libre-entreprise.org 20 Feb '08
20 Feb '08
Author: tchemit
Date: 2008-02-20 18:51:21 +0000 (Wed, 20 Feb 2008)
New Revision: 1146
Added:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java
Removed:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerAbstractOptionAction.java
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerCommonActions.java
Modified:
trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
Log:
move to swing package
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerAbstractOptionAction.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerAbstractOptionAction.java 2008-02-20 18:46:01 UTC (rev 1145)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerAbstractOptionAction.java 2008-02-20 18:51:21 UTC (rev 1146)
@@ -1,47 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007,2008 Code Lutin.
-*
-* 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 fr.cemagref.simexplorer.is.ui.actions;
-
-import fr.cemagref.simexplorer.is.ui.SimExplorerOptionParser;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorer;
-import fr.cemagref.simexplorer.is.ui.swing.SimExplorerContext;
-import org.codelutin.option.Option;
-import org.codelutin.option.OptionAction;
-
-/**
- * Implantation de base des actions spécifiques au parseur <b><code>SimExplorerOptionParser</code></b>.
- *
- * @author chemit
- * @see OptionAction
- */
-public abstract class SimExplorerAbstractOptionAction<O extends Option> extends org.codelutin.option.OptionAction<O, SimExplorerOptionParser> {
-
- protected SimExplorerContext context;
-
- public SimExplorerAbstractOptionAction() {
- super(SimExplorer.getContext().getParser());
- }
-
- public SimExplorerContext getContext() {
- if (context == null) {
- context = SimExplorer.getContext();
- }
- return context;
- }
-}
Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerCommonActions.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerCommonActions.java 2008-02-20 18:46:01 UTC (rev 1145)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerCommonActions.java 2008-02-20 18:51:21 UTC (rev 1146)
@@ -1,142 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
-* Benjamin Poussin, 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 fr.cemagref.simexplorer.is.ui.actions;
-
-import fr.cemagref.simexplorer.is.ui.configs.SimExplorerAbstractConfigMain;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionEditConfig;
-import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionShowConfig;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.option.Config;
-import org.codelutin.option.ui.ConfigTableModel;
-import org.codelutin.option.ui.ConfigUI;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-/**
- * The class to define all common actions that IsisFish can launch at init time.
- *
- * @author chemit
- */
-public class SimExplorerCommonActions {
-
- private static final Log log = LogFactory.getLog(SimExplorerCommonActions.class);
-
- static void printConfig(StringWriter writer, Config config) throws IOException {
- writer.append('\n').append(config.toString());
- writer.flush();
- }
-
- public static class HelpAction extends SimExplorerAbstractOptionActionHelp {
-
- protected void run() throws Exception {
- log.info("required help action");
- StringWriter writer = new StringWriter();
- getParser().printUsage(writer, "SimExplorer SI v " + getContext().getConfig().getVersion());
- printConfig(writer, getParser().getMainConfig());
- writer.append('\n');
- log.info(writer);
- getContext().setQuit(true);
- }
- }
-
- public static class ConfigAction extends SimExplorerAbstractOptionActionConfig {
-
- protected void run() throws Exception {
- // Do nothing, this action is treated while init of config files
- }
- }
-
- public static class ShowConfigAction extends SimExplorerAbstractOptionActionShowConfig {
- @Override
- protected void beforeAll(SimExplorerOptionShowConfig... options) {
- super.beforeAll(options);
- // check we have not twice config
- }
-
- public void run() throws Exception {
- SimExplorerAbstractConfigMain conf;
- conf = getParser().getMainConfig();
-
- String category = option.getConstantArgumentValue(0);
- if (conf == null) {
- throw new IllegalArgumentException("could not found a configuration with category " + category);
- }
- log.info("required showConfig pour category [" + category + "]");
- StringWriter writer = new StringWriter();
- printConfig(writer, conf);
- log.info(writer);
- getContext().setQuit(true);
- }
- }
-
- public static class EditConfigAction extends SimExplorerAbstractOptionActionEditConfig {
- @Override
- protected void beforeAll(SimExplorerOptionEditConfig... options) {
- super.beforeAll(options);
- // check we have not twice config
- }
-
- public void run() throws Exception {
- SimExplorerAbstractConfigMain conf;
- conf = getParser().getMainConfig();
- if (isAll()) {
- ConfigUI.showUI(conf, ConfigTableModel.TypeModel.all);
- } else if (isTec()) {
- ConfigUI.showTechnicalUI(conf);
- } else {
- ConfigUI.showUI(conf);
- }
-
- StringWriter writer = new StringWriter();
- printConfig(writer, conf);
- log.info("required editConfig pour category [" + conf.getCategory() + "]" + writer);
- }
- }
-
- public static class ResetConfigAction extends SimExplorerAbstractOptionActionResetConfig {
-
- public void run() throws Exception {
- //IsisFish.firstLaunch = true;
- //IsisFish.resetConfig = true;
- getContext().getConfig().getConfigFileName().delete();
- log.info(_("simexplorer.message.reset.user.configuration"));
- getContext().setFirstLaunch(true);
- }
-
- }
-
- public static class UiAction extends SimExplorerAbstractOptionActionUi {
- protected boolean init = false;
-
- public void run() throws Exception {
- Boolean bool = isValue();
- boolean launchUI = bool != null && bool;
- log.info(option.getUsedAlias() + ", value:" + bool);
- getContext().setLaunchUI(launchUI);
- if (init) {
- getContext().setQuit(true);
- }
- init = true;
- }
- }
-}
Modified: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 18:46:01 UTC (rev 1145)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerContext.java 2008-02-20 18:51:21 UTC (rev 1146)
@@ -20,7 +20,7 @@
import fr.cemagref.simexplorer.is.exceptions.SimExplorerRuntimeException;
import fr.cemagref.simexplorer.is.ui.SimExplorerOptionParser;
-import fr.cemagref.simexplorer.is.ui.actions.SimExplorerCommonActions;
+import fr.cemagref.simexplorer.is.ui.swing.actions.SimExplorerCommonActions;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.option.ParserException;
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java (from rev 1145, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerAbstractOptionAction.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerAbstractOptionAction.java 2008-02-20 18:51:21 UTC (rev 1146)
@@ -0,0 +1,47 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007,2008 Code Lutin.
+*
+* 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 fr.cemagref.simexplorer.is.ui.swing.actions;
+
+import fr.cemagref.simexplorer.is.ui.SimExplorerOptionParser;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorer;
+import fr.cemagref.simexplorer.is.ui.swing.SimExplorerContext;
+import org.codelutin.option.Option;
+import org.codelutin.option.OptionAction;
+
+/**
+ * Implantation de base des actions spécifiques au parseur <b><code>SimExplorerOptionParser</code></b>.
+ *
+ * @author chemit
+ * @see OptionAction
+ */
+public abstract class SimExplorerAbstractOptionAction<O extends Option> extends org.codelutin.option.OptionAction<O, SimExplorerOptionParser> {
+
+ protected SimExplorerContext context;
+
+ public SimExplorerAbstractOptionAction() {
+ super(SimExplorer.getContext().getParser());
+ }
+
+ public SimExplorerContext getContext() {
+ if (context == null) {
+ context = SimExplorer.getContext();
+ }
+ return context;
+ }
+}
Copied: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java (from rev 1132, trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/actions/SimExplorerCommonActions.java)
===================================================================
--- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java (rev 0)
+++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/actions/SimExplorerCommonActions.java 2008-02-20 18:51:21 UTC (rev 1146)
@@ -0,0 +1,148 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
+* Benjamin Poussin, 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 fr.cemagref.simexplorer.is.ui.swing.actions;
+
+import fr.cemagref.simexplorer.is.ui.configs.SimExplorerAbstractConfigMain;
+import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionEditConfig;
+import fr.cemagref.simexplorer.is.ui.options.SimExplorerOptionShowConfig;
+import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionHelp;
+import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionConfig;
+import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionShowConfig;
+import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionEditConfig;
+import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionResetConfig;
+import fr.cemagref.simexplorer.is.ui.actions.SimExplorerAbstractOptionActionUi;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.option.Config;
+import org.codelutin.option.ui.ConfigTableModel;
+import org.codelutin.option.ui.ConfigUI;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * The class to define all common actions that IsisFish can launch at init time.
+ *
+ * @author chemit
+ */
+public class SimExplorerCommonActions {
+
+ private static final Log log = LogFactory.getLog(SimExplorerCommonActions.class);
+
+ static void printConfig(StringWriter writer, Config config) throws IOException {
+ writer.append('\n').append(config.toString());
+ writer.flush();
+ }
+
+ public static class HelpAction extends SimExplorerAbstractOptionActionHelp {
+
+ protected void run() throws Exception {
+ log.info("required help action");
+ StringWriter writer = new StringWriter();
+ getParser().printUsage(writer, "SimExplorer SI v " + getContext().getConfig().getVersion());
+ printConfig(writer, getParser().getMainConfig());
+ writer.append('\n');
+ log.info(writer);
+ getContext().setQuit(true);
+ }
+ }
+
+ public static class ConfigAction extends SimExplorerAbstractOptionActionConfig {
+
+ protected void run() throws Exception {
+ // Do nothing, this action is treated while init of config files
+ }
+ }
+
+ public static class ShowConfigAction extends SimExplorerAbstractOptionActionShowConfig {
+ @Override
+ protected void beforeAll(SimExplorerOptionShowConfig... options) {
+ super.beforeAll(options);
+ // check we have not twice config
+ }
+
+ public void run() throws Exception {
+ SimExplorerAbstractConfigMain conf;
+ conf = getParser().getMainConfig();
+
+ String category = option.getConstantArgumentValue(0);
+ if (conf == null) {
+ throw new IllegalArgumentException("could not found a configuration with category " + category);
+ }
+ log.info("required showConfig pour category [" + category + "]");
+ StringWriter writer = new StringWriter();
+ printConfig(writer, conf);
+ log.info(writer);
+ getContext().setQuit(true);
+ }
+ }
+
+ public static class EditConfigAction extends SimExplorerAbstractOptionActionEditConfig {
+ @Override
+ protected void beforeAll(SimExplorerOptionEditConfig... options) {
+ super.beforeAll(options);
+ // check we have not twice config
+ }
+
+ public void run() throws Exception {
+ SimExplorerAbstractConfigMain conf;
+ conf = getParser().getMainConfig();
+ if (isAll()) {
+ ConfigUI.showUI(conf, ConfigTableModel.TypeModel.all);
+ } else if (isTec()) {
+ ConfigUI.showTechnicalUI(conf);
+ } else {
+ ConfigUI.showUI(conf);
+ }
+
+ StringWriter writer = new StringWriter();
+ printConfig(writer, conf);
+ log.info("required editConfig pour category [" + conf.getCategory() + "]" + writer);
+ }
+ }
+
+ public static class ResetConfigAction extends SimExplorerAbstractOptionActionResetConfig {
+
+ public void run() throws Exception {
+ //IsisFish.firstLaunch = true;
+ //IsisFish.resetConfig = true;
+ getContext().getConfig().getConfigFileName().delete();
+ log.info(_("simexplorer.message.reset.user.configuration"));
+ getContext().setFirstLaunch(true);
+ }
+
+ }
+
+ public static class UiAction extends SimExplorerAbstractOptionActionUi {
+ protected boolean init = false;
+
+ public void run() throws Exception {
+ Boolean bool = isValue();
+ boolean launchUI = bool != null && bool;
+ log.info(option.getUsedAlias() + ", value:" + bool);
+ getContext().setLaunchUI(launchUI);
+ if (init) {
+ getContext().setQuit(true);
+ }
+ init = true;
+ }
+ }
+}
1
0