Author: tchemit
Date: 2008-01-20 22:44:14 +0000 (Sun, 20 Jan 2008)
New Revision: 308
Added:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ChangeI18nAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ShowTabAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ToggleTabAction.java
Removed:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowTabAction.java
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ToggleTabAction.java
Modified:
trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java
Log:
paquetage help actions
Copied: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ChangeI18nAction.java (from rev 285, trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nAction.java)
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ChangeI18nAction.java (rev 0)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ChangeI18nAction.java 2008-01-20 22:44:14 UTC (rev 308)
@@ -0,0 +1,88 @@
+/*
+* ##% 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.swing.action;
+
+import fr.cemagref.simexplorer.is.ui.SimExplorer;
+import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
+import org.apache.commons.beanutils.Converter;
+import org.codelutin.i18n.CountryEnum;
+import org.codelutin.i18n.I18n;
+import org.codelutin.i18n.LanguageEnum;
+import org.codelutin.util.ConverterUtil;
+
+import java.awt.event.ActionEvent;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Une action pour recharger la locale.
+ * <p/>
+ * Le nom de l'action doit etre de la forme i18n_XX_YY où XX est la langue
+ * et YY le pays de la locale à charger.
+ *
+ * @author chemit
+ * @see LanguageEnum
+ * @see CountryEnum
+ */
+public abstract class ChangeI18nAction extends SimExplorerAbstractAction {
+
+ public static final Pattern PATTERN_NAME = Pattern.compile("i18n_(\\w\\w)_(\\w\\w)");
+
+ protected LanguageEnum language;
+
+ protected CountryEnum country;
+ private static final long serialVersionUID = 4180668477670765253L;
+
+ public ChangeI18nAction(String name) {
+ super(name);
+ Matcher matcher = PATTERN_NAME.matcher(name);
+ if (!matcher.matches()) {
+ throw new IllegalArgumentException(I18n._(getClass().getName() + " should have a nmae like this 'i18n_XX_YY', but was {0}", name));
+ }
+ Converter convertorLanguage = ConverterUtil.getConverter(LanguageEnum.class);
+ language = (LanguageEnum) convertorLanguage.convert(LanguageEnum.class, matcher.group(1));
+
+ convertorLanguage = ConverterUtil.getConverter(CountryEnum.class);
+ country = (CountryEnum) convertorLanguage.convert(CountryEnum.class, matcher.group(2));
+ }
+
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent e) {
+ super.actionPerformed(e);
+ //TODO Should ask confirm from user since it will close ui, and re instanciate ui
+
+ getMainUI().getQuit().getAction().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_FIRST, "cancel"));
+ SimExplorer.reloadUI();
+ getContext().getConfig().setI18n(language, country);
+ getContext().getConfig().initI18n();
+
+ SimExplorer.launch();
+
+ SimExplorer.getContext().saveSafely();
+ }
+
+ public boolean equalsLocale(LanguageEnum lang, CountryEnum countr) {
+ return language == lang && country == countr;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " Language " + language + " Country " + country;
+ }
+}
\ No newline at end of file
Copied: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ShowTabAction.java (from rev 303, trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowTabAction.java)
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ShowTabAction.java (rev 0)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ShowTabAction.java 2008-01-20 22:44:14 UTC (rev 308)
@@ -0,0 +1,57 @@
+/*
+* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
+* Tony Chemit, Gariel 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.action;
+
+import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
+
+import java.awt.event.ActionEvent;
+
+/**
+ * Action pour afficher une tab
+ *
+ * @author chemit
+ */
+public abstract class ShowTabAction extends SimExplorerAbstractTabAction {
+
+ private static final long serialVersionUID = -4030583314708934811L;
+
+ protected ShowTabAction(String name) {
+ super(name, "showTab");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ initAction();
+
+ // load ui
+ super.actionPerformed(e);
+
+ // set model
+ afterAction();
+ }
+
+ protected void afterAction() {
+
+ }
+
+ protected void initAction() {
+
+ }
+}
Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java 2008-01-20 22:44:00 UTC (rev 307)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/SimExplorerAbstractTabAction.java 2008-01-20 22:44:14 UTC (rev 308)
@@ -34,7 +34,7 @@
*
* @author chemit
*/
-public class SimExplorerAbstractTabAction extends SimExplorerAbstractAction implements ActionParameter {
+public abstract class SimExplorerAbstractTabAction extends SimExplorerAbstractAction implements ActionParameter {
protected SimExplorerTabManager.Tab tab;
Copied: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ToggleTabAction.java (from rev 303, trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ToggleTabAction.java)
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ToggleTabAction.java (rev 0)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/ToggleTabAction.java 2008-01-20 22:44:14 UTC (rev 308)
@@ -0,0 +1,42 @@
+/*
+* ##% 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.swing.action;
+
+import java.awt.event.ActionEvent;
+
+/**
+ * Action pour siwtcher un tab
+ *
+ * @author chemit
+ */
+public abstract class ToggleTabAction extends SimExplorerAbstractTabAction {
+
+ private static final long serialVersionUID = -5457476021698351850L;
+
+
+ public ToggleTabAction(String name) {
+ super(name, "toggleTab");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ //TODO
+ }
+}
Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nAction.java 2008-01-20 22:44:00 UTC (rev 307)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/common/ChangeI18nAction.java 2008-01-20 22:44:14 UTC (rev 308)
@@ -1,88 +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.swing.action.common;
-
-import fr.cemagref.simexplorer.is.ui.SimExplorer;
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction;
-import org.apache.commons.beanutils.Converter;
-import org.codelutin.i18n.CountryEnum;
-import org.codelutin.i18n.I18n;
-import org.codelutin.i18n.LanguageEnum;
-import org.codelutin.util.ConverterUtil;
-
-import java.awt.event.ActionEvent;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Une action pour recharger la locale.
- * <p/>
- * Le nom de l'action doit etre de la forme i18n_XX_YY où XX est la langue
- * et YY le pays de la locale à charger.
- *
- * @author chemit
- * @see LanguageEnum
- * @see CountryEnum
- */
-public class ChangeI18nAction extends SimExplorerAbstractAction {
-
- public static final Pattern PATTERN_NAME = Pattern.compile("i18n_(\\w\\w)_(\\w\\w)");
-
- protected LanguageEnum language;
-
- protected CountryEnum country;
- private static final long serialVersionUID = 4180668477670765253L;
-
- public ChangeI18nAction(String name) {
- super(name);
- Matcher matcher = PATTERN_NAME.matcher(name);
- if (!matcher.matches()) {
- throw new IllegalArgumentException(I18n._(getClass().getName() + " should have a nmae like this 'i18n_XX_YY', but was {0}", name));
- }
- Converter convertorLanguage = ConverterUtil.getConverter(LanguageEnum.class);
- language = (LanguageEnum) convertorLanguage.convert(LanguageEnum.class, matcher.group(1));
-
- convertorLanguage = ConverterUtil.getConverter(CountryEnum.class);
- country = (CountryEnum) convertorLanguage.convert(CountryEnum.class, matcher.group(2));
- }
-
- @Override
- public void actionPerformed(java.awt.event.ActionEvent e) {
- super.actionPerformed(e);
- //TODO Should ask confirm from user since it will close ui, and re instanciate ui
-
- getMainUI().getQuit().getAction().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_FIRST, "cancel"));
- SimExplorer.reloadUI();
- getContext().getConfig().setI18n(language, country);
- getContext().getConfig().initI18n();
-
- SimExplorer.launch();
-
- SimExplorer.getContext().saveSafely();
- }
-
- public boolean equalsLocale(LanguageEnum lang, CountryEnum countr) {
- return language == lang && country == countr;
- }
-
- @Override
- public String toString() {
- return super.toString() + " Language " + language + " Country " + country;
- }
-}
\ No newline at end of file
Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowTabAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowTabAction.java 2008-01-20 22:44:00 UTC (rev 307)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ShowTabAction.java 2008-01-20 22:44:14 UTC (rev 308)
@@ -1,57 +0,0 @@
-/*
-* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin,
-* Tony Chemit, Gariel 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.action.tab;
-
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
-
-import java.awt.event.ActionEvent;
-
-/**
- * Action pour afficher une tab
- *
- * @author chemit
- */
-public class ShowTabAction extends SimExplorerAbstractTabAction {
-
- private static final long serialVersionUID = -4030583314708934811L;
-
- protected ShowTabAction(String name) {
- super(name, "showTab");
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- initAction();
-
- // load ui
- super.actionPerformed(e);
-
- // set model
- afterAction();
- }
-
- protected void afterAction() {
-
- }
-
- protected void initAction() {
-
- }
-}
Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ToggleTabAction.java
===================================================================
--- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ToggleTabAction.java 2008-01-20 22:44:00 UTC (rev 307)
+++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/action/tab/ToggleTabAction.java 2008-01-20 22:44:14 UTC (rev 308)
@@ -1,51 +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.swing.action.tab;
-
-import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractTabAction;
-import fr.cemagref.simexplorer.is.ui.swing.toolbar.JSimExplorerToolbar;
-import fr.cemagref.simexplorer.is.ui.swing.util.ActionConfig;
-
-import java.awt.event.ActionEvent;
-
-/**
- * Action pour siwtcher un tab
- *
- * @author chemit
- */
- at ActionConfig(
- actionCommand = "toggleTab",
- container = JSimExplorerToolbar.class,
- hideActionText = false
-)
-public class ToggleTabAction extends SimExplorerAbstractTabAction {
-
- private static final long serialVersionUID = -5457476021698351850L;
-
-
- public ToggleTabAction(String name) {
- super(name, "toggleTab");
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- super.actionPerformed(e);
- //TODO
- }
-}