Isis-fish-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
- 3175 discussions
r3169 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
17 Mar '11
Author: chatellier
Date: 2011-03-17 10:30:25 +0000 (Thu, 17 Mar 2011)
New Revision: 3169
Log:
Update nuiton-utils (Version)
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java 2011-03-17 10:29:39 UTC (rev 3168)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/ImportFromV2.java 2011-03-17 10:30:25 UTC (rev 3169)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -53,6 +53,10 @@
import org.apache.commons.lang.time.DurationFormatUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.io.SAXReader;
import org.nuiton.math.matrix.MatrixFactory;
import org.nuiton.math.matrix.MatrixHelper;
import org.nuiton.math.matrix.MatrixND;
@@ -61,11 +65,7 @@
import org.nuiton.util.ArrayUtil;
import org.nuiton.util.FileUtil;
import org.nuiton.util.Resource;
-import org.nuiton.util.VersionNumberUtil;
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.Node;
-import org.dom4j.io.SAXReader;
+import org.nuiton.util.VersionUtil;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.IsisFishDAOHelper;
@@ -191,9 +191,9 @@
* @throws Exception
*/
private File convertXML(File file, String versionStart, String versionEnd) throws Exception {
- if(VersionNumberUtil.greaterThan(versionStart, versionEnd)){
+ if(VersionUtil.greaterThan(versionStart, versionEnd)){
throw new Exception(_("isisfish.error.import.recent.files"));
- }else if(VersionNumberUtil.smallerThan(versionStart, versionEnd)){
+ }else if(VersionUtil.smallerThan(versionStart, versionEnd)){
// upgrate du fichier
try{
// recherche des fichiers XSL de conversion
@@ -228,7 +228,7 @@
URL xsl = (URL)xslurl.get(0);
result.add(xsl);
String end = getVersionEnd(xsl);
- if(VersionNumberUtil.equals(versionEnd, end)){
+ if(VersionUtil.equals(versionEnd, end)){
return result.toArray(new URL[result.size()]);
}
xslurl = Resource.getURLs(".*?" + XSL_DIRECTORY + "/isis-fish-"+end+"_.*.xsl$");
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java 2011-03-17 10:29:39 UTC (rev 3168)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/update/package-info.java 2011-03-17 10:30:25 UTC (rev 3169)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 1999 - 2010 Ifremer, CodeLutin
+ * Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -23,7 +23,7 @@
* #L%
*/
/**
- * Database storage migration.
+ * IsisFish V2 import.
*/
package fr.ifremer.isisfish.datastore.update;
1
0
r3168 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/map
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
17 Mar '11
Author: chatellier
Date: 2011-03-17 10:29:39 +0000 (Thu, 17 Mar 2011)
New Revision: 3168
Log:
Fix layer initialisation (was not working if setter was called in a different order)
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2011-03-17 10:28:42 UTC (rev 3167)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2011-03-17 10:29:39 UTC (rev 3168)
@@ -643,6 +643,10 @@
*/
public void setSelectionMode(int v) {
this.selectionMode = v;
+
+ if (activeSelectionLayer != null) {
+ activeSelectionLayer.setSelectionMode(v);
+ }
}
public void addSelectionLayer() {
1
0
17 Mar '11
Author: chatellier
Date: 2011-03-17 10:28:42 +0000 (Thu, 17 Mar 2011)
New Revision: 3167
Log:
Use new topia migration service
Modified:
isis-fish/branches/3.3.1/pom.xml
Modified: isis-fish/branches/3.3.1/pom.xml
===================================================================
--- isis-fish/branches/3.3.1/pom.xml 2011-03-17 10:28:18 UTC (rev 3166)
+++ isis-fish/branches/3.3.1/pom.xml 2011-03-17 10:28:42 UTC (rev 3167)
@@ -589,28 +589,13 @@
<inputs>zargo</inputs>
<fullPackagePath>fr.ifremer.isisfish</fullPackagePath>
<defaultPackage>fr.ifremer.isisfish</defaultPackage>
- <!--<extractedPackages>fr.ifremer.isisfish</extractedPackages>-->
- <templates>
- org.nuiton.topia.generator.TopiaMetaTransformer
- </templates>
+ <extractedPackages>fr.ifremer.isisfish</extractedPackages>
+ <templates>org.nuiton.topia.generator.TopiaMetaTransformer</templates>
</configuration>
<goals>
<goal>smart-generate</goal>
</goals>
</execution>
- <!-- <execution>
- <id>copyVersionFiles</id>
- <phase>generate-sources</phase>
- <configuration>
- <includes>**/*.objectmodel</includes>
- <copyVersionDir>${basedir}/src/main/resources/oldmappings/%MODELNAME%</copyVersionDir>
- <copyVersionFiles>**/*.hbm.xml</copyVersionFiles>
- <overwrite>true</overwrite>
- </configuration>
- <goals>
- <goal>copyVersionFiles</goal>
- </goals>
- </execution> -->
</executions>
<dependencies>
<dependency>
1
0
r3166 - in isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore: . migration
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
17 Mar '11
Author: chatellier
Date: 2011-03-17 10:28:18 +0000 (Thu, 17 Mar 2011)
New Revision: 3166
Log:
Use new topia migration service
Added:
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java
Removed:
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java
Copied: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java (from rev 3148, isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java)
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java (rev 0)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/AutoMigrationIsisH2Config.java 2011-03-17 10:28:18 UTC (rev 3166)
@@ -0,0 +1,47 @@
+/*
+ * #%L
+ * IsisFish
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ * %%
+ * 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, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.datastore;
+
+import fr.ifremer.isisfish.datastore.migration.AutoDatabaseMigrationClass;
+
+/**
+ * Empty class used to access inherited static field.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class AutoMigrationIsisH2Config extends IsisH2Config {
+
+ /**
+ * Override default migration with test one.
+ */
+ public static void setTestMigrationCallBack() {
+ databaseMigrationClass = AutoDatabaseMigrationClass.class;
+ }
+}
Deleted: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java 2011-03-17 10:27:55 UTC (rev 3165)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/TestIsisH2Config.java 2011-03-17 10:28:18 UTC (rev 3166)
@@ -1,50 +0,0 @@
-/*
- * #%L
- * IsisFish
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2010 Ifremer, CodeLutin
- * %%
- * 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, see
- * <http://www.gnu.org/licenses/gpl-2.0.html>.
- * #L%
- */
-
-package fr.ifremer.isisfish.datastore;
-
-import org.junit.Ignore;
-
-import fr.ifremer.isisfish.datastore.migration.TestMigrationCallbackHandler;
-
-/**
- * Empty class used to access inherited static field.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
- at Ignore
-public class TestIsisH2Config extends IsisH2Config {
-
- /**
- * Override default migration with test one.
- */
- public static void setTestMigrationCallBack() {
- databaseMigrationClass = TestMigrationCallbackHandler.class;
- }
-}
Copied: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java (from rev 3148, isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java)
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java (rev 0)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/AutoDatabaseMigrationClass.java 2011-03-17 10:28:18 UTC (rev 3166)
@@ -0,0 +1,51 @@
+/*
+ * #%L
+ * IsisFish
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2007 - 2011 Ifremer, CodeLutin, Chatellier Eric
+ * %%
+ * 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, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.datastore.migration;
+
+import java.util.List;
+
+import org.nuiton.util.Version;
+
+/**
+ * Test migration callback for topia migration service.
+ * But for test purpose, don't ask user, always do migration.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author: chatellier $
+ */
+public class AutoDatabaseMigrationClass extends DatabaseMigrationClass {
+
+ /*
+ * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#askUser(org.nuiton.util.Version, java.util.List)
+ */
+ @Override
+ public boolean askUser(Version dbVersion, List<Version> versions) {
+ return true;
+ }
+}
Deleted: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java 2011-03-17 10:27:55 UTC (rev 3165)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/datastore/migration/TestMigrationCallbackHandler.java 2011-03-17 10:28:18 UTC (rev 3166)
@@ -1,55 +0,0 @@
-/*
- * #%L
- * IsisFish
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2007 - 2010 Ifremer, CodeLutin
- * %%
- * 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, see
- * <http://www.gnu.org/licenses/gpl-2.0.html>.
- * #L%
- */
-
-package fr.ifremer.isisfish.datastore.migration;
-
-import org.junit.Ignore;
-import org.nuiton.topia.migration.DatabaseManager;
-
-/**
- * Test migration callback for topia migration service.
- * But for test purpose, don't ask user, always do migration.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author: chatellier $
- */
- at Ignore
-public class TestMigrationCallbackHandler extends SwingMigrationCallbackHandler {
-
- /*
- * @see org.nuiton.topia.migration.callback.MigrationCallbackHandler#doMigration(java.lang.String, java.lang.String)
- */
- @Override
- public MigrationChoice doMigration(DatabaseManager dbManager,
- String dbVersion, String applicationVersion) {
-
- // test always perform migration without ask user
- MigrationChoice result = migrate(dbManager, dbVersion, applicationVersion);
- return result;
- }
-}
1
0
r3165 - isis-fish/branches/3.3.1/src/main/resources
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
17 Mar '11
Author: chatellier
Date: 2011-03-17 10:27:55 +0000 (Thu, 17 Mar 2011)
New Revision: 3165
Log:
Move loglevel to warn (i18n to verbose)
Modified:
isis-fish/branches/3.3.1/src/main/resources/log4j.properties
Modified: isis-fish/branches/3.3.1/src/main/resources/log4j.properties
===================================================================
--- isis-fish/branches/3.3.1/src/main/resources/log4j.properties 2011-03-17 10:27:19 UTC (rev 3164)
+++ isis-fish/branches/3.3.1/src/main/resources/log4j.properties 2011-03-17 10:27:55 UTC (rev 3165)
@@ -5,7 +5,7 @@
# $Id$
# $HeadURL$
# %%
-# Copyright (C) 2005 - 2010 Ifremer, CodeLutin
+# Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric
# %%
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
@@ -31,7 +31,7 @@
# package level
log4j.logger.fr.ifremer.isisfish=INFO
-log4j.logger.org.nuiton=INFO
+log4j.logger.org.nuiton=WARN
log4j.logger.analyseplans=INFO
log4j.logger.exports=INFO
log4j.logger.formules=INFO
1
0
r3164 - in isis-fish/branches/3.3.1/src/main: java/fr/ifremer/isisfish/datastore/migration resources
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
by chatellier@users.labs.libre-entreprise.org 17 Mar '11
17 Mar '11
Author: chatellier
Date: 2011-03-17 10:27:19 +0000 (Thu, 17 Mar 2011)
New Revision: 3164
Log:
Use new topia migration service
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java
Removed:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java
isis-fish/branches/3.3.1/src/main/resources/oldmappings/
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2011-03-17 10:27:19 UTC (rev 3164)
@@ -0,0 +1,113 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.datastore.migration;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.util.Version;
+
+import fr.ifremer.isisfish.IsisFishDAOHelper;
+
+/**
+ * Migration callback by class for all isis database migration.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class DatabaseMigrationClass extends TopiaMigrationCallbackByClass {
+
+ protected static final Version VERSION_32 = new Version("3.2");
+ protected static final Version VERSION_33 = new Version("3.3");
+
+ public DatabaseMigrationClass() {
+ super(new MigrationResolver());
+ }
+
+ protected static class MigrationResolver implements MigrationCallBackForVersionResolver {
+ /*
+ * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersionResolver#getCallBack(org.nuiton.util.Version)
+ */
+ @Override
+ public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
+ Class<? extends MigrationCallBackForVersion> result = null;
+
+ if (version.equals(VERSION_32)) {
+ result = MigrationV0V32.class;
+ }
+ else if (version.equals(VERSION_33)) {
+ result = MigrationV32V33.class;
+ }
+ return result;
+ }
+
+ }
+
+ /*
+ * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#getAvailableVersions()
+ */
+ @Override
+ public Version[] getAvailableVersions() {
+ Version[] result = new Version[] { VERSION_32, VERSION_33 };
+ return result;
+ }
+
+ /*
+ * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#getApplicationVersion()
+ */
+ @Override
+ public Version getApplicationVersion() {
+ Version appVersion = new Version(IsisFishDAOHelper.getModelVersion());
+ return appVersion;
+ }
+
+ /*
+ * @see org.nuiton.topia.migration.AbstractTopiaMigrationCallback#askUser(org.nuiton.util.Version, java.util.List)
+ */
+ @Override
+ public boolean askUser(Version dbVersion, List<Version> versions) {
+ boolean result = false;
+
+ int answer = JOptionPane.showConfirmDialog(
+ null, _("isisfish.misc.databasemigration.question", dbVersion, versions.get(versions.size() - 1)),
+ _("isisfish.misc.databasemigration.title"),
+ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+
+ if (answer == JOptionPane.YES_OPTION) {
+ result = true;
+ }
+
+ return result;
+ }
+
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java 2011-03-17 10:27:19 UTC (rev 3164)
@@ -0,0 +1,70 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.datastore.migration;
+
+import java.util.List;
+
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion;
+import org.nuiton.util.Version;
+
+/**
+ * Migration between version 0 and 3.2.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class MigrationV0V32 extends MigrationCallBackForVersion {
+
+ /**
+ * Constructor.
+ *
+ * @param version version
+ * @param callBack callback
+ */
+ public MigrationV0V32(Version version, TopiaMigrationCallbackByClass callBack) {
+ super(version, callBack);
+ }
+
+ /*
+ * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion#prepareMigrationScript(org.nuiton.topia.framework.TopiaContextImplementor, java.util.List, boolean, boolean)
+ */
+ @Override
+ protected void prepareMigrationScript(TopiaContextImplementor tx,
+ List<String> queries, boolean showSql, boolean showProgression)
+ throws TopiaException {
+ queries.add("alter table SETOFVESSELS add column TECHNICALEFFICIENCYEQUATION VARCHAR(255);");
+ queries.add("alter table STRATEGY add column INACTIVITYEQUATIONUSED BIT default false;");
+ queries.add("alter table STRATEGY add column INACTIVITYEQUATION VARCHAR(255);");
+ queries.add("alter table STRATEGYMONTHINFO alter NUMBEROFTRIPS double;");
+ queries.add("alter table STRATEGYMONTHINFO alter MININACTIVITYDAYS double;");
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV0V32.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java 2011-03-17 10:27:19 UTC (rev 3164)
@@ -0,0 +1,80 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.datastore.migration;
+
+import java.util.List;
+
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion;
+import org.nuiton.util.Version;
+
+/**
+ * Migration between version 3.2 and 3.3.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class MigrationV32V33 extends MigrationCallBackForVersion {
+
+ /**
+ * Constructor.
+ *
+ * @param version version
+ * @param callback callback
+ */
+ public MigrationV32V33(Version version, TopiaMigrationCallbackByClass callback) {
+ super(version, callback);
+ }
+
+ /*
+ * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion#prepareMigrationScript(org.nuiton.topia.framework.TopiaContextImplementor, java.util.List, boolean, boolean)
+ */
+ @Override
+ protected void prepareMigrationScript(TopiaContextImplementor tx,
+ List<String> queries, boolean showSql, boolean showProgression)
+ throws TopiaException {
+ // replace in equation
+ queries.add("update EQUATION set content = replace(content, 'org.codelutin.', 'org.nuiton.');");
+ // replace in matrix semantics
+ queries.add("update POPULATION set recruitmentDistribution_semantics = replace(recruitmentDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where recruitmentDistribution_semantics IS NOT null;");
+ queries.add("update POPULATION set mappingZoneReproZoneRecru_semantics = replace(mappingZoneReproZoneRecru_semantics, 'org.codelutin.', 'org.nuiton.') where mappingZoneReproZoneRecru_semantics IS NOT null;");
+ queries.add("update POPULATION set capturability_semantics = replace(capturability_semantics, 'org.codelutin.', 'org.nuiton.') where capturability_semantics IS NOT null;");
+ queries.add("update POPULATIONSEASONINFO set reproductionDistribution_semantics = replace(reproductionDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where reproductionDistribution_semantics IS NOT null;");
+ queries.add("update POPULATIONSEASONINFO set lengthChangeMatrix_semantics = replace(lengthChangeMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where lengthChangeMatrix_semantics IS NOT null;");
+ queries.add("update POPULATIONSEASONINFO set migrationMatrix_semantics = replace(migrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where migrationMatrix_semantics IS NOT null;");
+ queries.add("update POPULATIONSEASONINFO set emigrationMatrix_semantics = replace(emigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where emigrationMatrix_semantics IS NOT null;");
+ queries.add("update POPULATIONSEASONINFO set immigrationMatrix_semantics = replace(immigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where immigrationMatrix_semantics IS NOT null;");
+ queries.add("update RESULT set matrix_semantics = replace(matrix_semantics, 'org.codelutin.', 'org.nuiton.') where matrix_semantics IS NOT null;");
+ queries.add("update STRATEGYMONTHINFO set proportionMetier_semantics = replace(proportionMetier_semantics, 'org.codelutin.', 'org.nuiton.') where proportionMetier_semantics IS NOT null;");
+ // add .shp default extension
+ queries.add("update FISHERYREGION set MAPFILES = regexp_replace(MAPFILES, '(,|$)', '.shp$1') where MAPFILES IS NOT null AND LENGTH(TRIM(MAPFILES)) > 0;");
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV32V33.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java 2011-03-16 17:00:05 UTC (rev 3163)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/SwingMigrationCallbackHandler.java 2011-03-17 10:27:19 UTC (rev 3164)
@@ -1,179 +0,0 @@
-/*
- * #%L
- * IsisFish
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2007 - 2010 Ifremer, CodeLutin
- * %%
- * 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, see
- * <http://www.gnu.org/licenses/gpl-2.0.html>.
- * #L%
- */
-
-package fr.ifremer.isisfish.datastore.migration;
-
-import static org.nuiton.i18n.I18n._;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-import javax.swing.JOptionPane;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.migration.DatabaseManager;
-import org.nuiton.topia.migration.callback.MigrationCallbackHandler;
-import org.nuiton.util.VersionNumberUtil;
-
-/**
- * MigrationCallbackHandler.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class SwingMigrationCallbackHandler implements MigrationCallbackHandler {
-
- /** to use log facility, just put in your code: log.info("..."); */
- static private Log log = LogFactory
- .getLog(SwingMigrationCallbackHandler.class);
-
- /*
- * @see org.nuiton.topia.migration.callback.MigrationCallbackHandler#doMigration(java.lang.String, java.lang.String)
- */
- @Override
- public MigrationChoice doMigration(DatabaseManager dbManager,
- String dbVersion, String applicationVersion) {
-
- int answer = JOptionPane.showConfirmDialog(
- null, _("isisfish.misc.databasemigration.question", dbVersion, applicationVersion),
- _("isisfish.misc.databasemigration.title"),
- JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
-
- MigrationChoice result = (answer == JOptionPane.YES_OPTION) ? MigrationChoice.MIGRATION
- : MigrationChoice.NO_MIGRATION;
-
- if (result == MigrationChoice.MIGRATION) {
- result = migrate(dbManager, dbVersion, applicationVersion);
- }
- return result;
- }
-
- /**
- * Perform real migration.
- *
- * @param dbManager database manager
- * @param dbVersion database version
- * @param applicationVersion application version
- * @return {@code MigrationChoice.CUSTOM_MIGRATION} if success, {@code MigrationChoice.NO_MIGRATION} otherwise.
- */
- protected MigrationChoice migrate(DatabaseManager dbManager,
- String dbVersion, String applicationVersion) {
- // migration manuel sans l'aide de topia-service
- // tant que c pas fait on dit non
- MigrationChoice result = MigrationChoice.NO_MIGRATION;
- // ouverture d'une connexion direct JDBC sur la base
- try {
- Connection conn = dbManager.getConnection();
- try {
- conn.setAutoCommit(false);
- if (VersionNumberUtil.smallerThan(dbVersion, "3.2")) {
- // on fait une migration vers 3.2
- migrateTo3_2(conn);
- }
-
- // do same thing for other version
- if (VersionNumberUtil.smallerThan(dbVersion, "3.3")) {
- // on fait une migration vers 3.2
- migrateTo3_3(conn);
- }
-
- // commit des modifs
- conn.commit();
- // la migration a reussi, on dit que c fait
- result = MigrationChoice.CUSTOM_MIGRATION;
- } catch (Exception eee) {
- // en cas d'erreur
- log.error("Migration impossible de la base", eee);
- // rollback du travail en cours
- conn.rollback();
- } finally {
- // close database connexion
- conn.close();
- }
- } catch (Exception eee) {
- log.error("Error lors de la tentative de migration", eee);
- }
-
- return result;
- }
-
- protected void migrateTo3_2(Connection conn) throws SQLException {
- if (log.isInfoEnabled()) {
- log.info("Migrate to version 3.2");
- }
-
- //alteration du schema
- // nouvelles equations dans les tables
-
- String[] sqls = new String[] {
- "alter table SETOFVESSELS add column TECHNICALEFFICIENCYEQUATION VARCHAR(255);",
- "alter table STRATEGY add column INACTIVITYEQUATIONUSED BIT default false;",
- "alter table STRATEGY add column INACTIVITYEQUATION VARCHAR(255);",
- "alter table STRATEGYMONTHINFO alter NUMBEROFTRIPS double;",
- "alter table STRATEGYMONTHINFO alter MININACTIVITYDAYS double;" };
- for (String sql : sqls) {
- log.info("try " + sql);
- PreparedStatement sta = conn.prepareStatement(sql);
- sta.executeUpdate();
- log.info("done " + sql);
- }
- }
-
- protected void migrateTo3_3(Connection conn) throws SQLException {
- if (log.isInfoEnabled()) {
- log.info("Migrate to version 3.3");
- }
-
- String[] sqls = new String[] {
- // replace in equation
- "update EQUATION set content = replace(content, 'org.codelutin.', 'org.nuiton.');",
- // replace in matrix semantics
- "update POPULATION set recruitmentDistribution_semantics = replace(recruitmentDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where recruitmentDistribution_semantics IS NOT null;",
- "update POPULATION set mappingZoneReproZoneRecru_semantics = replace(mappingZoneReproZoneRecru_semantics, 'org.codelutin.', 'org.nuiton.') where mappingZoneReproZoneRecru_semantics IS NOT null;",
- "update POPULATION set capturability_semantics = replace(capturability_semantics, 'org.codelutin.', 'org.nuiton.') where capturability_semantics IS NOT null;",
- "update POPULATIONSEASONINFO set reproductionDistribution_semantics = replace(reproductionDistribution_semantics, 'org.codelutin.', 'org.nuiton.') where reproductionDistribution_semantics IS NOT null;",
- "update POPULATIONSEASONINFO set lengthChangeMatrix_semantics = replace(lengthChangeMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where lengthChangeMatrix_semantics IS NOT null;",
- "update POPULATIONSEASONINFO set migrationMatrix_semantics = replace(migrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where migrationMatrix_semantics IS NOT null;",
- "update POPULATIONSEASONINFO set emigrationMatrix_semantics = replace(emigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where emigrationMatrix_semantics IS NOT null;",
- "update POPULATIONSEASONINFO set immigrationMatrix_semantics = replace(immigrationMatrix_semantics, 'org.codelutin.', 'org.nuiton.') where immigrationMatrix_semantics IS NOT null;",
- "update RESULT set matrix_semantics = replace(matrix_semantics, 'org.codelutin.', 'org.nuiton.') where matrix_semantics IS NOT null;",
- "update STRATEGYMONTHINFO set proportionMetier_semantics = replace(proportionMetier_semantics, 'org.codelutin.', 'org.nuiton.') where proportionMetier_semantics IS NOT null;",
- // add .shp default extension
- "update FISHERYREGION set MAPFILES = regexp_replace(MAPFILES, '(,|$)', '.shp$1') where MAPFILES IS NOT null AND LENGTH(TRIM(MAPFILES)) > 0;"
- };
- for (String sql : sqls) {
- log.info("try " + sql);
- PreparedStatement sta = conn.prepareStatement(sql);
- sta.executeUpdate();
- log.info("done " + sql);
- }
- }
-
-}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java 2011-03-16 17:00:05 UTC (rev 3163)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/package-info.java 2011-03-17 10:27:19 UTC (rev 3164)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 1999 - 2010 Ifremer, CodeLutin
+ * Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -23,7 +23,7 @@
* #L%
*/
/**
- * IsisFish V2 import.
+ * Database storage migration.
*/
package fr.ifremer.isisfish.datastore.migration;
1
0
r3163 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
16 Mar '11
Author: chatellier
Date: 2011-03-16 17:00:05 +0000 (Wed, 16 Mar 2011)
New Revision: 3163
Log:
Update nuiton-utils (MD5)
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2011-03-16 16:59:34 UTC (rev 3162)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2011-03-16 17:00:05 UTC (rev 3163)
@@ -27,6 +27,7 @@
import static org.nuiton.i18n.I18n._;
+import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -44,7 +45,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.FileUtil;
-import org.nuiton.util.MD5;
+import org.nuiton.util.MD5InputStream;
+import org.nuiton.util.MD5OutputStream;
+import org.nuiton.util.StringUtil;
import org.nuiton.util.ZipUtil;
import com.jcraft.jsch.JSch;
@@ -764,7 +767,7 @@
}
if (!StringUtils.isEmpty(md5sum)) {
- String localMd5 = MD5.asHex(MD5.getHash(localFile));
+ String localMd5 = StringUtil.asHex(MD5InputStream.hash(new BufferedInputStream(new FileInputStream(localFile))));
if (!localMd5.equals(md5sum)) {
if (log.isWarnEnabled()) {
log.warn("Warning md5 checksum failed (got " + localMd5 + ", expected : " + md5sum + ")");
1
0
r3162 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
16 Mar '11
Author: chatellier
Date: 2011-03-16 16:59:34 +0000 (Wed, 16 Mar 2011)
New Revision: 3162
Log:
Begin simulator and sensitivity simulation launching
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx 2011-03-16 16:58:55 UTC (rev 3161)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx 2011-03-16 16:59:34 UTC (rev 3162)
@@ -19,13 +19,29 @@
-->
<JPanel layout='{new BorderLayout()}' abstract="true">
+ <fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null" />
+
<script><![CDATA[
-
import fr.ifremer.isisfish.ui.simulator.SimulAction;
+ import java.beans.PropertyChangeEvent;
+ import java.beans.PropertyChangeListener;
+ protected void $afterCompleteSetup() {
+ addPropertyChangeListener(PROPERTY_REGION_STORAGE, new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ regionStorageChanged();
+ }
+ });
+ }
+
/**
* Refresh all simulation launch UI.
*/
+ protected abstract void regionStorageChanged();
+
+ /**
+ * Refresh all simulation launch UI.
+ */
protected abstract void refresh();
/**
1
0
r3161 - isis-fish/branches/3.3.1/src/main/xmi
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
16 Mar '11
Author: chatellier
Date: 2011-03-16 16:58:55 +0000 (Wed, 16 Mar 2011)
New Revision: 3161
Log:
add contexable tag value (to extends TopiaEntityContextable)
Modified:
isis-fish/branches/3.3.1/src/main/xmi/isis-fish.properties
Modified: isis-fish/branches/3.3.1/src/main/xmi/isis-fish.properties
===================================================================
--- isis-fish/branches/3.3.1/src/main/xmi/isis-fish.properties 2011-03-16 16:57:13 UTC (rev 3160)
+++ isis-fish/branches/3.3.1/src/main/xmi/isis-fish.properties 2011-03-16 16:58:55 UTC (rev 3161)
@@ -31,3 +31,26 @@
model.tagvalue.java.lang.String=text
model.tagvalue.hibernateProxyInterface=none
model.tagvalue.constantPrefix=PROPERTY_
+fr.ifremer.isisfish.entities.ActiveRule.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Cell.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.EffortDescription.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Equation.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.FisheryRegion.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Gear.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Metier.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.MetierSeasonInfo.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Population.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.PopulationGroup.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.PopulationSeasonInfo.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Port.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Result.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Selectivity.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Season.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.SetOfVessels.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Species.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Strategy.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.StrategyMonthInfo.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.TargetSpecies.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.TripType.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.VesselType.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Zone.class.tagvalue.contextable=true
\ No newline at end of file
1
0
r3160 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui: sensitivity simulator
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
by chatellier@users.labs.libre-entreprise.org 16 Mar '11
16 Mar '11
Author: chatellier
Date: 2011-03-16 16:57:13 +0000 (Wed, 16 Mar 2011)
New Revision: 3160
Log:
Begin simulator and sensitivity simulation launching
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java
Removed:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityAction.java 2011-03-16 16:57:13 UTC (rev 3160)
@@ -27,12 +27,11 @@
import static org.nuiton.i18n.I18n._;
-import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain;
-import fr.ifremer.isisfish.ui.simulator.SimulAction;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+
import javax.swing.JComponent;
import javax.swing.JOptionPane;
@@ -40,8 +39,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.math.matrix.MatrixND;
+import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaEntityAbstract;
+import org.nuiton.topia.persistence.TopiaEntityContextable;
+import fr.ifremer.isisfish.IsisFishDAOHelper;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.EquationDAO;
+import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain;
+import fr.ifremer.isisfish.ui.simulator.SimulAction;
+
/**
* Action for sensitivity package.
*
@@ -73,7 +81,7 @@
try {
EquationContinuousPanelUI equationPanel = (EquationContinuousPanelUI) panel;
- TopiaEntity bean = equationPanel.getBean();
+ TopiaEntityContextable bean = (TopiaEntityContextable)equationPanel.getBean();
//String methodSet = equationPanel.getMethodSet();
String property = equationPanel.getBeanProperty();
property = StringUtils.capitalize(property) + "Content";
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-03-16 16:57:13 UTC (rev 3160)
@@ -0,0 +1,149 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.ui.sensitivity;
+
+import java.awt.BorderLayout;
+
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.persistence.TopiaEntityContextable;
+
+import fr.ifremer.isisfish.IsisFishRuntimeException;
+import fr.ifremer.isisfish.entities.FisheryRegion;
+import fr.ifremer.isisfish.ui.input.InputContentUI;
+import fr.ifremer.isisfish.ui.input.InputHandler;
+import fr.ifremer.isisfish.ui.input.InputUI;
+import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider;
+import fr.ifremer.isisfish.ui.input.tree.FisheryTreeHelper;
+import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode;
+import fr.ifremer.isisfish.ui.input.tree.FisheryTreeRenderer;
+
+/**
+ * Handler for sensitivity tab ui (fishery region factors).
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class SensitivityInputHandler extends InputHandler {
+
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(SensitivityInputHandler.class);
+
+ /**
+ *
+ * @param sensitivityTabUI
+ */
+ public void loadFisheryRegionTree(SensitivityTabUI sensitivityTabUI) {
+ FisheryRegion fisheryRegion = sensitivityTabUI.getFisheryRegion();
+
+ if (fisheryRegion == null) {
+ // show empty region ui
+ sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(),"none");
+ TreeModel model = new DefaultTreeModel(null);
+ sensitivityTabUI.getFisheryRegionTree().setModel(model);
+ }
+ else {
+ // init tree model loader with fishery region
+ FisheryTreeHelper treeHelper = new FisheryTreeHelper();
+ FisheryDataProvider dataProvider = new FisheryDataProvider(fisheryRegion);
+ treeHelper.setDataProvider(dataProvider);
+ TreeModel model = treeHelper.createTreeModel(fisheryRegion);
+ sensitivityTabUI.getFisheryRegionTree().setModel(model);
+ sensitivityTabUI.getFisheryRegionTree().setCellRenderer(new FisheryTreeRenderer(dataProvider));
+ treeHelper.setUI(sensitivityTabUI.getFisheryRegionTree(), true, false, null);
+
+ // global context value : fisheryRegion, regionStorage, treeHelper
+ sensitivityTabUI.setContextValue(treeHelper);
+ sensitivityTabUI.setContextValue(model);
+
+ sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(),"normale");
+ }
+ }
+
+ /**
+ * Changement de selection dans l'arbre de la pecherie.
+ *
+ * @param sensitivityTabUI
+ * @param event
+ */
+ public void nodeSelectionChanged(SensitivityTabUI sensitivityTabUI, TreeSelectionEvent event) {
+
+ TreePath newTreePath = event.getNewLeadSelectionPath();
+
+ if (newTreePath != null) {
+ Object lastTreePath = newTreePath.getLastPathComponent();
+ if (lastTreePath instanceof FisheryTreeNode) {
+ FisheryTreeNode isisTreeNode = (FisheryTreeNode)lastTreePath;
+
+ Class<?> internalClass = isisTreeNode.getInternalClass();
+
+ // noeud qui n'en charge pas d'autres (= un bean)
+ TopiaEntityContextable topiaEntity = null;
+ String topiaId = isisTreeNode.getId();
+
+ try {
+ if (isisTreeNode.isStaticNode()) {
+ FisheryRegion fisheryRegion = sensitivityTabUI.getContextValue(FisheryRegion.class);
+ TopiaContext topiaContext = fisheryRegion.getTopiaContext();
+ topiaEntity = (TopiaEntityContextable)topiaContext.findByTopiaId(topiaId);
+ }
+
+ InputContentUI inputContentUI = getUIInstanceForBeanClass(internalClass, sensitivityTabUI);
+
+ // mandatory set
+ inputContentUI.getVerifier().reset(); // before set bean !!!
+ if (topiaEntity != null) {
+ inputContentUI.getVerifier().addCurrentEntity(topiaEntity);
+ inputContentUI.getVerifier().setInputContentUI(inputContentUI);
+ }
+
+ inputContentUI.setBean((TopiaEntityContextable)topiaEntity);
+ inputContentUI.setActive(topiaEntity != null);
+ inputContentUI.setActionButtons();
+ inputContentUI.setLayer(true);
+
+ // add initialized ui to panel
+ sensitivityTabUI.getCardlayoutPrincipal().show(sensitivityTabUI.getInputPanePrincipal(), "normale");
+ sensitivityTabUI.getInputPane().removeAll();
+ sensitivityTabUI.getInputPane().add(inputContentUI, BorderLayout.CENTER);
+ sensitivityTabUI.getInputPane().repaint();
+ sensitivityTabUI.getInputPane().validate();
+ } catch (Exception ex) {
+ throw new IsisFishRuntimeException("Can't display bean " + topiaId, ex);
+ }
+ }
+ }
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityNavigationTreeSelectionAdapter.java 2011-03-16 16:57:13 UTC (rev 3160)
@@ -1,231 +0,0 @@
-/*
- * #%L
- * IsisFish
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2010 Ifremer, CodeLutin
- * %%
- * 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, see
- * <http://www.gnu.org/licenses/gpl-2.0.html>.
- * #L%
- */
-
-package fr.ifremer.isisfish.ui.sensitivity;
-
-import static org.nuiton.i18n.I18n._;
-import fr.ifremer.isisfish.entities.Cell;
-import fr.ifremer.isisfish.entities.FisheryRegion;
-import fr.ifremer.isisfish.entities.Gear;
-import fr.ifremer.isisfish.entities.Metier;
-import fr.ifremer.isisfish.entities.Population;
-import fr.ifremer.isisfish.entities.Port;
-import fr.ifremer.isisfish.entities.SetOfVessels;
-import fr.ifremer.isisfish.entities.Species;
-import fr.ifremer.isisfish.entities.TripType;
-import fr.ifremer.isisfish.entities.VesselType;
-import fr.ifremer.isisfish.entities.Zone;
-import fr.ifremer.isisfish.ui.input.*;
-import jaxx.runtime.Decorator;
-import jaxx.runtime.JAXXContextEntryDef;
-import jaxx.runtime.swing.CardLayout2;
-import jaxx.runtime.swing.JAXXTree;
-import jaxx.runtime.swing.navigation.NavigationTreeModel;
-import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
-import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder;
-import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder.ChildBuilder;
-import jaxx.runtime.swing.navigation.NavigationTreeSelectionAdapterWithCardLayout;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-import javax.swing.JPanel;
-import javax.swing.event.TreeSelectionEvent;
-import java.awt.Component;
-import jaxx.runtime.PropertyDecorator;
-
-/** @author letellier */
-public class SensitivityNavigationTreeSelectionAdapter extends NavigationTreeSelectionAdapterWithCardLayout {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private final Log log = LogFactory.getLog(SensitivityNavigationTreeSelectionAdapter.class);
-
- protected NavigationTreeNode currentNode = null;
- protected InputContentUI currentUI = null;
- protected TopiaEntity currentEntity = null;
-
- public SensitivityNavigationTreeSelectionAdapter(SensitivityTabUI context) {
- super(SensitivityTabUI.class, null, context, Strategy.PER_UI_TYPE);
-
- if (context.getNavigation() == null) {
- throw new IllegalArgumentException("could not have a null 'navigation' in ui " + context);
- }
-
- // register in tree this listener
- context.getNavigation().addTreeSelectionListener(this);
- }
-
- @Override
- protected JPanel getContentContainer() {
- return ((SensitivityTabUI) context).getInputPane();
- }
-
- @Override
- protected CardLayout2 getContentLayout() {
- return ((SensitivityTabUI) context).getCardlayout();
- }
-
- @Override
- protected NavigationTreeModel getNavigationTreeModel() {
- return (NavigationTreeModel) ((SensitivityTabUI) context).getNavigation().getModel();
- }
-
- @Override
- protected void goBackToPreviousNode(TreeSelectionEvent event, Exception e) {
- if (e != null) {
- if (log.isErrorEnabled()) {
- log.error("Go bak to previous node", e);
- }
- }
- // go back to previous node
- // returnToPreviousNode(getNavigationTree(), event);
- }
-
-
- protected JAXXTree getNavigationTree() {
- return ((SensitivityTabUI) context).getNavigation();
- }
-
- @Override
- protected void openUI(Component newUI, NavigationTreeNode node) throws Exception {
- super.openUI(newUI, node);
- // apply refresh method (should a contract for all this ui with a method refresh...)
- try {
- currentUI = (InputContentUI) newUI;
- if (currentUI != null){
- currentUI.setSensitivity(true);
- context.getContextValue(InputSaveVerifier.class).addCurrentPanel(currentUI);
- currentUI.setLayer(true);
- // tabbed ui hack
- currentUI.setActionButtons();
- }
- currentNode = node;
- } catch (Exception e) {
- log.debug(e.getMessage(), e);
- }
- }
-
- @Override
- protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception {
- boolean exit = true;
- return exit;
- }
-
- @Override
- protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) {
- if (log.isDebugEnabled()) {
- log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass()));
- }
- InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
- verif.removeAllEntity();
- if (TopiaEntity.class.isInstance(data)){
- verif.addCurrentEntity((TopiaEntity) data);
- }
- else{
- verif.addCurrentEntity(null);
- }
-// verif.refreshAll();
- verif.setCurrentNode(node);
- }
-
- public static NavigationTreeModel getTreeModel(String regionName, FisheryRegion fisheryRegion) {
-
- NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/");
-
- if (regionName == null) {
- return null;
- }
-
- ChildBuilder<TopiaEntity> childBuilder = new ChildBuilder<TopiaEntity>(builder) {
-
- Decorator<? extends TopiaEntity> decorator;
-
- @Override
- public void init(Class<? extends TopiaEntity> klass) {
- decorator = jaxx.runtime.PropertyDecorator.newDecorator(klass, "name");
- }
-
- @Override
- public Decorator<? extends TopiaEntity> getDecorator(TopiaEntity child) {
- return decorator;
- }
-
- @Override
- public String getJXPath(TopiaEntity child) {
- return "..[@topiaId=\"" + child.getTopiaId() + "\"]";
- }
-
- @Override
- public String getNavigationPath(TopiaEntity child) {
- return child.getTopiaId();
- }
- };
-
- try {
-
- NavigationTreeNode root = builder.build(null, regionName, JAXXContextEntryDef.newDef(FisheryRegion.class), "$root", FisheryRegionUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.cells"), "../cell", "$cells", CellUI.class, null),
- true, Cell.class, fisheryRegion.getCell(), CellUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.zones"), "../zone", "$zones", ZoneUI.class, null),
- true, Zone.class, fisheryRegion.getZone(), ZoneUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.ports"), "../port", "$ports", PortUI.class, null),
- true, Port.class, fisheryRegion.getPort(), PortUI.class, null);
-
- NavigationTreeNode species = builder.build(root, _("isisfish.input.tree.species"), "../species", "$species", SpeciesUI.class, null);
-
- for (Species specie : fisheryRegion.getSpecies()) {
- NavigationTreeNode speciesChild = builder.build(species, PropertyDecorator.newDecorator(Species.class, "name"), "..[@topiaId=\"" + specie.getTopiaId() + "\"]", specie.getTopiaId(), SpeciesUI.class, null);
- NavigationTreeNode populations = builder.build(speciesChild, _("isisfish.input.tree.populations"), "../population", "$populations", PopulationUI.class, null);
- childBuilder.build(populations, true, Population.class, specie.getPopulation(), PopulationUI.class, null);
- }
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.gears"), "../gear", "$gears", GearUI.class, null),
- true, Gear.class, fisheryRegion.getGear(), GearUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.metiers"), "../metier", "$metiers", MetierUI.class, null),
- true, Metier.class, fisheryRegion.getMetier(), MetierUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.triptypes"), "../tripType", "$tripTypes", TripTypeUI.class, null),
- true, TripType.class, fisheryRegion.getTripType(), TripTypeUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.vesseltypes"), "../vesselType", "$vesselTypes", VesselTypeUI.class, null),
- true, VesselType.class, fisheryRegion.getVesselType(), VesselTypeUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.setofvessels"), "../setOfVessels", "$setOfVessels", SetOfVesselsUI.class, null),
- true, SetOfVessels.class, fisheryRegion.getSetOfVessels(), SetOfVesselsUI.class, null);
-
- childBuilder.build(builder.build(root, _("isisfish.input.tree.strategies"), "../strategy", "$strategies", StrategyUI.class, null),
- true, fr.ifremer.isisfish.entities.Strategy.class, fisheryRegion.getStrategy(), StrategyUI.class, null);
-
- } catch (Exception ex) {
- log.error(ex.getMessage(), ex);
- }
- return builder.getModel();
- }
-
-}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,18 +22,12 @@
<http://www.gnu.org/licenses/gpl-2.0.html>.
#L%
-->
-<JPanel layout='{new BorderLayout()}'>
+<fr.ifremer.isisfish.ui.NavigationUI>
- <javax.swing.tree.DefaultTreeSelectionModel id='navigationSelectionModel' selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/>
+ <SensitivityInputHandler id="handler" />
- <fr.ifremer.isisfish.ui.input.InputNavigationTreeCellRenderer id='navigationTreeCellRenderer' constructorParams='this'/>
+ <fr.ifremer.isisfish.entities.FisheryRegion id='fisheryRegion' javaBean='null'/>
- <jaxx.runtime.swing.CardLayout2 id='cardlayout'/>
-
- <java.awt.CardLayout id='cardlayoutPrincipal'/>
-
- <fr.ifremer.isisfish.entities.FisheryRegionImpl id='region' javaBean='null'/>
-
<script><![CDATA[
import javax.swing.JPopupMenu;
import javax.swing.tree.DefaultTreeModel;
@@ -50,37 +44,12 @@
import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup;
import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeModel;
import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeCellRenderer;
-import jaxx.runtime.swing.navigation.NavigationTreeModel;
-import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
-import jaxx.runtime.swing.navigation.NavigationUtil;
-// end code constructor
-getVerifier().setSensPanel(this);
-new fr.ifremer.isisfish.ui.sensitivity.SensitivityNavigationTreeSelectionAdapter(this);
+protected void $afterCompleteSetup() {
+ // end code constructor
+ getVerifier().setSensPanel(this);
+}
-factorsTree.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- // clic droit
- if (e.getButton() == MouseEvent.BUTTON3) {
- JPopupMenu menu = new JPopupMenu();
- JMenuItem menuItemDelete = new JMenuItem(_("isisfish.common.delete"));
- menuItemDelete.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- deleteSelectedFactors();
- }
- });
- menu.add(menuItemDelete);
- menu.show(e.getComponent(), e.getX(), e.getY());
- }
- else {
- // autre clic
- factorSelected();
- }
- }
-});
-
protected InputAction getInputAction() {
return getContextValue(InputAction.class);
}
@@ -97,6 +66,34 @@
return getContextValue(RegionStorage.class);
}
+/**
+ * Mouse click on factors tree.
+ *
+ * <ul>
+ * <li>normal click : factor edit</li>
+ * <li>right click : popup menu</li>
+ * </ul>
+ */
+public void factorsTreeMouseClicked(MouseEvent e) {
+ // clic droit
+ if (e.getButton() == MouseEvent.BUTTON3) {
+ JPopupMenu menu = new JPopupMenu();
+ JMenuItem menuItemDelete = new JMenuItem(_("isisfish.common.delete"));
+ menuItemDelete.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ deleteSelectedFactors();
+ }
+ });
+ menu.add(menuItemDelete);
+ menu.show(e.getComponent(), e.getX(), e.getY());
+ }
+ else {
+ // autre clic
+ factorSelected();
+ }
+}
+
protected void factorSelected() {
Object selectedObject = factorsTree.getSelectionValue();
if (selectedObject != null) {
@@ -112,7 +109,7 @@
else {
// method 2
- JComponent component2 = EditorHelper.getEditorForFactor(selectedFactor, getRegion().getTopiaContext());
+ JComponent component2 = EditorHelper.getEditorForFactor(selectedFactor, getFisheryRegion().getTopiaContext());
if (component2 != null) {
if (log.isDebugEnabled()) {
log.debug("Component found is " + component2);
@@ -131,48 +128,13 @@
}
}
public void setTreeModel() {
- if (getRegion() != null) {
+ if (getFisheryRegion() != null) {
getCardlayoutPrincipal().show(inputPanePrincipal,"normale");
- String regionName = getRegion().getName();
- setContextValue(getRegion());
- NavigationTreeModel model = SensitivityNavigationTreeSelectionAdapter.getTreeModel(regionName, getRegion());
-
- setContextValue(model);
- navigation.setModel(model);
- setTreeSelection("$root");
-
- /*TC-20090702 Fix bug #1772
- EC-20090706 no working solution found
- model.nodeChanged(model.getRoot());
- java.util.Enumeration<?> e = model.getRoot().children();
- while (e.hasMoreElements()) {
- NavigationTreeNode n = (NavigationTreeNode) e.nextElement();
- String contextPath = n.getContextPath();
- if (contextPath.equals("$root/$cells")) {
- //TC-20090702 : ce noeud est trop long a recharger
- continue;
- }
- log.debug("reload node " + contextPath);
- model.nodeChanged(n);
- java.util.Enumeration<?> e2 = n.children();
- while (e2.hasMoreElements()) {
- NavigationTreeNode n2 = (NavigationTreeNode) e2.nextElement();
- n2.getJAXXContextValue(SensitivityTabUI.this);
- }
- }*/
+ String regionName = getFisheryRegion().getName();
+ setContextValue(getFisheryRegion());
+ getHandler().loadFisheryRegionTree(this);
}
}
-public void repaintNode(String path) {
- NavigationTreeModel model = getContextValue(NavigationTreeModel.class);
- NavigationTreeNode currentNode = model.findNode(path);
- model.nodeChanged(currentNode);
-}
-public void setTreeSelection(String path) {
- NavigationTreeNode node = NavigationUtil.findNode(this, null, path);
- TreePath pathToRoot = new TreePath(getContextValue(NavigationTreeModel.class).getPathToRoot(node));
- navigation.setSelectionPath(pathToRoot);
- navigation.scrollPathToVisible(pathToRoot);
-}
protected void setInfoText(String s) {
WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
root.setStatusMessage(s);
@@ -180,7 +142,7 @@
protected void regionNull() {
getCardlayoutPrincipal().show(inputPanePrincipal,"none");
DefaultTreeModel model = new DefaultTreeModel(null);
- navigation.setModel(model);
+ fisheryRegionTree.setModel(model);
}
public void setFactorModel() {
FactorGroup factorGroup = getSimulAction().getFactorGroup();
@@ -209,20 +171,16 @@
<JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL" constraints='BorderLayout.CENTER'>
<JPanel layout='{new BorderLayout()}'>
<JSplitPane oneTouchExpandable="true" dividerLocation="400" orientation="VERTICAL" constraints='BorderLayout.CENTER'>
+ <JScrollPane>
+ <javax.swing.tree.DefaultTreeSelectionModel id='fisheryRegionTreeSelectionModel'
+ selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/>
+ <JTree id="fisheryRegionTree" rootVisible="true" selectionRow='0'
+ selectionModel='{getFisheryRegionTreeSelectionModel()}'
+ model='{new DefaultTreeModel(null)}'
+ onValueChanged="getHandler().nodeSelectionChanged(this, event)" />
+ </JScrollPane>
<Table>
<row>
- <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JTree id="navigation" rootVisible="true" selectionRow='0'
- selectionModel='{getNavigationSelectionModel()}'
- cellRenderer='{getNavigationTreeCellRenderer()}'
- model='{new DefaultTreeModel(null)}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- <Table>
- <row>
<cell>
<JButton icon="table.png" />
</cell>
@@ -233,17 +191,23 @@
<row>
<cell columns='2' fill="both" weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JTree id="factorsTree" rootVisible="true" selectionRow='0'
- model='{new DefaultTreeModel(null)}' cellRenderer='{new FactorTreeCellRenderer()}'/>
+ <JAXXTree id="factorsTree" rootVisible="true" selectionRow='0'
+ model='{new DefaultTreeModel(null)}'
+ cellRenderer='{new FactorTreeCellRenderer()}'
+ onMouseClicked='factorsTreeMouseClicked(event)'/>
</JScrollPane>
</cell>
</row>
</Table>
</JSplitPane>
</JPanel>
+ <java.awt.CardLayout id='cardlayoutPrincipal'/>
<JPanel id='inputPanePrincipal' layout='{getCardlayoutPrincipal()}'>
- <fr.ifremer.isisfish.ui.input.NoneUI id='noneUI' constraints='"none"'/>
+ <JPanel layout='{new BorderLayout()}' constraints='"none"'>
+ <JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectRegion" constraints='BorderLayout.CENTER'/>
+ </JPanel>
+ <jaxx.runtime.swing.CardLayout2 id='cardlayout'/>
<JPanel id="inputPane" layout='{getCardlayout()}' constraints='"normale"'/>
</JPanel>
</JSplitPane>
-</JPanel>
\ No newline at end of file
+</fr.ifremer.isisfish.ui.NavigationUI>
\ No newline at end of file
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -23,53 +23,63 @@
#L%
-->
<fr.ifremer.isisfish.ui.SimulationUI>
+
<script><![CDATA[
- import jaxx.runtime.JAXXInitialContext;
- import fr.ifremer.isisfish.ui.input.InputAction;
- import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
+ import fr.ifremer.isisfish.ui.input.InputAction;
+ import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
+ import jaxx.runtime.context.JAXXInitialContext;
- @Override
- public void refresh() {
- paramsUI.refresh();
- }
+ /**
+ * Refresh all simulation launch UI.
+ */
+ @Override
+ protected void regionStorageChanged() {
+ boolean enabled = getRegionStorage() != null;
+ bodyTabbedPane.setEnabledAt(1, enabled);
+ bodyTabbedPane.setEnabledAt(2, enabled);
+ }
- @Override
- public void selectParametersTab() {
- bodyTabbedPane.setSelectedIndex(0);
- }
+ @Override
+ public void refresh() {
+ paramsUI.refresh();
+ }
- @Override
- public void setEnabledPrescriptTab(boolean selected) {
- // no prescript in AS
- }
+ @Override
+ public void selectParametersTab() {
+ bodyTabbedPane.setSelectedIndex(0);
+ }
- @Override
- public void setEnabledAnalysePlanTab(boolean selected) {
- // no analyse plan in AS
- }
- ]]>
- </script>
+ @Override
+ public void setEnabledPrescriptTab(boolean selected) {
+ // no prescript in AS
+ }
+
+ @Override
+ public void setEnabledAnalysePlanTab(boolean selected) {
+ // no analyse plan in AS
+ }
+ ]]></script>
<JTabbedPane id="bodyTabbedPane">
<tab title='isisfish.params.title'>
- <fr.ifremer.isisfish.ui.simulator.ParamsUI id='paramsUI' sensitivity='{true}' constructorParams='this'/>
+ <fr.ifremer.isisfish.ui.simulator.ParamsUI id='paramsUI' sensitivity='{true}' regionStorage="{getRegionStorage()}" constructorParams='this'/>
</tab>
- <tab title='isisfish.sensitivity.title'>
+ <tab title='isisfish.sensitivity.title' enabled="false">
<fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI id="sensitivityTabUI"
constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivityAction()).add(new InputSaveVerifier()).add(this)'/>
</tab>
- <tab title='isisfish.sensitivityChooser.title'>
+ <tab title='isisfish.sensitivityChooser.title' enabled="false">
<SensitivityChooserUI id="sensitivityChooserUI" constructorParams='this'/>
</tab>
- <tab id="exportUITab" title='isisfish.export.title'>
+ <tab title='isisfish.export.title'>
<fr.ifremer.isisfish.ui.simulator.ExportUI id="exportUI" constructorParams='this'/>
</tab>
- <tab id="resultChoiceUITab" title='isisfish.resultChoice.title'>
+ <tab title='isisfish.resultChoice.title'>
<fr.ifremer.isisfish.ui.simulator.ResultChoiceUI id="resultChoiceUI" constructorParams='this'/>
</tab>
- <tab id="advancedParamsUITab" title='isisfish.advancedParameters.title'>
+ <tab title='isisfish.advancedParameters.title'>
<fr.ifremer.isisfish.ui.simulator.AdvancedParamsUI id="advancedParamsUI" constructorParams='this'/>
</tab>
- <tab id="secondPassUITab" title='isisfish.sensitivity.secondpass.title'>
+ <tab title='isisfish.sensitivity.secondpass.title'>
<SensitivitySecondPassUI id="sensitivitySecondPassUI" constructorParams='this'/>
</tab>
</JTabbedPane>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -31,17 +31,19 @@
import javax.swing.table.DefaultTableModel;
import java.util.Map.Entry;
- /**
- * Listener to enable/disable remove button.
- */
- tableTagValues.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- @Override
- public void valueChanged(ListSelectionEvent e) {
- setRemove(tableTagValues.getSelectedRow() != -1);
- }
- });
+ protected void $afterCompleteSetup() {
+ /**
+ * Listener to enable/disable remove button.
+ */
+ tableTagValues.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ setRemove(tableTagValues.getSelectedRow() != -1);
+ }
+ });
- refresh();
+ refresh();
+ }
public void refresh() {
setTableTagValues();
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2005 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -28,7 +28,9 @@
import fr.ifremer.isisfish.ui.models.export.ExportNameListModel;
import javax.swing.event.ListSelectionEvent;
- refresh();
+ protected void $afterCompleteSetup() {
+ refresh();
+ }
protected SimulAction getSimulAction() {
return getContextValue(SimulAction.class);
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -1,32 +1,18 @@
-<!--
- #%L
- IsisFish
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2010 Ifremer, CodeLutin
- %%
- 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, see
- <http://www.gnu.org/licenses/gpl-2.0.html>.
- #L%
- -->
+<!-- #%L IsisFish $Id$ $HeadURL$ %% Copyright (C) 2009 - 2011 Ifremer, CodeLutin,
+ Chatellier Eric %% 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, see <http://www.gnu.org/licenses/gpl-2.0.html>.
+ #L% -->
<Table>
- <Boolean id="regionLoaded" javaBean="false" />
+ <fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null" />
<!-- ui state when editing -->
- <Boolean id='sensitivity' javaBean='false'/>
+ <Boolean id='sensitivity' javaBean='false' />
<script><![CDATA[
import java.util.EventObject;
@@ -38,7 +24,6 @@
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.Strategy;
import fr.ifremer.isisfish.entities.FisheryRegion;
-import fr.ifremer.isisfish.entities.FisheryRegionImpl;
import fr.ifremer.isisfish.ui.SimulationUI;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import fr.ifremer.isisfish.ui.WelcomeTabUI;
@@ -49,15 +34,18 @@
import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel;
import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor;
import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer;
+import fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI;
import fr.ifremer.isisfish.ui.sensitivity.SensitivityUI;
import fr.ifremer.isisfish.rule.Rule;
import fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher;
import fr.ifremer.isisfish.simulator.launcher.SimulationService;
import fr.ifremer.isisfish.simulator.launcher.SimulationJob;
import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener;
+import fr.ifremer.isisfish.simulator.sensitivity.Factor;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaContext;
import org.nuiton.math.matrix.MatrixND;
+import org.nuiton.math.matrix.gui.MatrixPanelEditor;
import org.apache.commons.lang.ArrayUtils;
// instances variables déclaration
@@ -74,10 +62,10 @@
};
RegionStorage.addStorageChangeListener(regionStorageListener);
-// end constructor code
simulationListener = new SimulationServiceListener() {
@Override
public void simulationStart(SimulationService simService, SimulationJob job) {
+
}
@Override
@@ -87,6 +75,7 @@
@Override
public void clearJobDone(SimulationService simService) {
+
}
}
@@ -97,6 +86,8 @@
fieldSimulParamsDesc.setText(simulAction.getSimulationParameter().getDescription());
setListSimulParamsStrategiesItems();
setListSimulParamsPopulationsItems();
+
+ // rule component
ruleChooser.setRegionStorage(simulAction.getRegionStorage());
}
@@ -114,9 +105,7 @@
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
- simulAction.regionChange(selected);
- // not sure that setRegionLoaded is at the better place
- setRegionLoaded(true);
+ simulAction.regionChange(ParamsUI.this, selected);
refresh();
setSensitivityTabRegion();
getParentContainer(WelcomePanelUI.class).setStatusMessage(_("isisfish.message.region.loaded"));
@@ -143,7 +132,7 @@
// FIXME this transation in nerver closed
TopiaContext tx = simulAction.getRegionStorage().getStorage().beginTransaction();
FisheryRegion fisheryRegion = RegionStorage.getFisheryRegion(tx);
- getParentContainer(SensitivityUI.class).getSensitivityTabUI().setRegion((FisheryRegionImpl) fisheryRegion);
+ getParentContainer(SensitivityUI.class).getSensitivityTabUI().setFisheryRegion(fisheryRegion);
getParentContainer(SensitivityUI.class).getSensitivityTabUI().setTreeModel();
} catch (StorageException ex) {
if (log.isErrorEnabled()) {
@@ -189,7 +178,6 @@
fieldSimulParamsNbAnnees.setText(String.valueOf(simulAction.getNumberOfYear()));
setPreScript();
setAnalysePlan();
- //setFactorRegion();
setExportSens();
setSensitivityCalculator();
setFactor();
@@ -286,10 +274,30 @@
for (Object selectedPopulationValue : selectedPopulationsValues) {
Population selectedPopulation = (Population)selectedPopulationValue;
- org.nuiton.math.matrix.gui.MatrixPanelEditor matrixPanel = new org.nuiton.math.matrix.gui.MatrixPanelEditor();
+ // TODO add change listener on matrix panel !!!
+ final MatrixPanelEditor matrixPanel = new MatrixPanelEditor();
MatrixND populationEffectives = simulAction.getSimulationParameter().getNumberOf(selectedPopulation);
matrixPanel.setMatrix(populationEffectives);
- populationEffectivesTabbedPane.add(matrixPanel, _("isisfish.params.populationEffectives", selectedPopulation.getName()));
+
+ JPanel matrixPanelComponent = new JPanel(new BorderLayout());
+ matrixPanelComponent.add(matrixPanel, BorderLayout.CENTER);
+
+ // add addFactorButton with matrixPanel (just in sensitivity cas)
+ if (isSensitivity()) {
+ // TODO choose another name than "id"
+ matrixPanel.putClientProperty("id", selectedPopulation.getName());
+ // TODO add another thing that action
+ JButton addFactorButton = new JButton();
+ addFactorButton.setAction(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ addFactorWithComponent(matrixPanel);
+ }
+ });
+ addFactorButton.setIcon(SwingUtil.createImageIcon("building_add.png"));
+ matrixPanelComponent.add(addFactorButton, BorderLayout.EAST);
+ }
+
+ populationEffectivesTabbedPane.add(matrixPanelComponent, _("isisfish.params.populationEffectives", selectedPopulation.getName()));
}
layout.show(populationEffectivesPanel, "specific");
@@ -340,6 +348,47 @@
simulAction.resetOldSimulatorNames();
fieldSimulParamsSelect.setModel(getSimulParamsSelectModel(false));
}
+
+/**
+ * Action appelée lors du clic sur les boutons a coté des composants factorisables.
+ *
+ * Contrairement à l'interface 'input', on edite ici des facteurs existants,
+ * (créé à la première demande).
+ *
+ * @param e l'event initial intersepté par le layer
+ */
+protected void addFactorWithComponent(JComponent source) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Event intercepted on " + source);
+ }
+
+ // redo this, here manage just two case
+ Factor selectedFactor = null;
+ if (source instanceof RuleChooser) {
+ selectedFactor = simulAction.getFactors().get("parameters.rules");
+ if (selectedFactor == null) {
+ selectedFactor = new Factor("parameters.rules");
+ selectedFactor.setPath("parameters.rules");
+ }
+ }
+ else {
+ if (source instanceof MatrixPanelEditor) {
+ // id here is not coherent with all other attributes (bean, beanID, method)
+ String property = (String)source.getClientProperty("id");
+ selectedFactor = simulAction.getFactors().get("parameters.population." + property);
+ selectedFactor.setPath("parameters.population." + property);
+ }
+ }
+
+ if (selectedFactor != null) {
+ FactorWizardUI wizard = new FactorWizardUI(this);
+ wizard.initExisting(source, selectedFactor);
+ wizard.pack();
+ SwingUtil.center(this, wizard);
+ wizard.setVisible(true);
+ }
+}
]]>
</script>
<row>
@@ -347,16 +396,22 @@
<Table>
<row>
<cell fill="horizontal">
- <JLabel text="isisfish.params.loadOldSimulation"/>
+ <JLabel text="isisfish.params.loadOldSimulation" />
</cell>
<cell fill="horizontal" weightx="1.0">
- <JComboBox id="fieldSimulParamsSelect" model='{getSimulParamsSelectModel()}' onActionPerformed='loadOldSimulation()'/>
+ <JComboBox id="fieldSimulParamsSelect"
+ model='{getSimulParamsSelectModel()}'
+ onActionPerformed='loadOldSimulation()' />
</cell>
<cell>
- <JButton text="isisfish.params.filter" id="buttonSimulParamsSelectFilter" onActionPerformed='selectFilter()' enabled="false"/>
+ <JButton text="isisfish.params.filter"
+ id="buttonSimulParamsSelectFilter"
+ onActionPerformed='selectFilter()' enabled="false" />
</cell>
<cell>
- <JButton text="isisfish.params.clearFilter" id="buttonSimulParamsSelectClearFilter" onActionPerformed='resetFilter()' enabled="false"/>
+ <JButton text="isisfish.params.clearFilter"
+ id="buttonSimulParamsSelectClearFilter"
+ onActionPerformed='resetFilter()' enabled="false" />
</cell>
</row>
</Table>
@@ -375,12 +430,15 @@
<Table>
<row>
<cell fill="horizontal">
- <JLabel id='lblName' text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}'
- minimumSize='{new Dimension(195,25)}' preferredSize='{new Dimension(195,25)}' />
+ <JLabel id='lblName'
+ text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}'
+ minimumSize='{new Dimension(195,25)}'
+ preferredSize='{new Dimension(195,25)}' />
</cell>
- <cell fill="both" weightx="1.0">
- <JTextField id="fieldSimulParamsName"/>
- <javax.swing.text.Document javaBean="fieldSimulParamsName.getDocument()"
+ <cell fill="both" weightx="1.0">
+ <JTextField id="fieldSimulParamsName" />
+ <javax.swing.text.Document
+ javaBean="fieldSimulParamsName.getDocument()"
onInsertUpdate='simulAction.setName(fieldSimulParamsName.getText())'
onRemoveUpdate='simulAction.setName(fieldSimulParamsName.getText())' />
</cell>
@@ -391,11 +449,13 @@
<Table>
<row>
<cell columns="2" fill="horizontal">
- <JLabel text="isisfish.common.region"/>
+ <JLabel text="isisfish.common.region" />
</cell>
- <cell fill="horizontal" weightx="1.0">
- <JComboBox id="fieldSimulParamsRegion" model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'
- selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}' onActionPerformed='regionChange()'/>
+ <cell fill="horizontal" weightx="1.0">
+ <JComboBox id="fieldSimulParamsRegion"
+ model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'
+ selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}'
+ onActionPerformed='regionChange()' />
</cell>
</row>
</Table>
@@ -403,16 +463,19 @@
</row>
<row>
<cell columns="4" fill="horizontal" weightx="1.0">
- <JLabel text="isisfish.params.description"/>
+ <JLabel text="isisfish.params.description" />
</cell>
</row>
<row>
- <cell columns="4" fill="both" weightx="1.0" weighty="0.3">
+ <cell columns="4" fill="both" weightx="1.0"
+ weighty="0.3">
<JScrollPane>
- <JTextArea id="fieldSimulParamsDesc" text='{simulAction.getSimulationParameter().getDescription()}'/>
- <javax.swing.text.Document javaBean="fieldSimulParamsDesc.getDocument()"
- onInsertUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())'
- onRemoveUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' />
+ <JTextArea id="fieldSimulParamsDesc"
+ text='{simulAction.getSimulationParameter().getDescription()}' />
+ <javax.swing.text.Document
+ javaBean="fieldSimulParamsDesc.getDocument()"
+ onInsertUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())'
+ onRemoveUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' />
</JScrollPane>
</cell>
</row>
@@ -421,11 +484,16 @@
<Table>
<row>
<cell fill="horizontal">
- <JLabel text="isisfish.params.numberYear" minimumSize='{new Dimension(140,25)}' preferredSize='{new Dimension(140,25)}'/>
+ <JLabel text="isisfish.params.numberYear"
+ minimumSize='{new Dimension(140,25)}'
+ preferredSize='{new Dimension(140,25)}' />
</cell>
<cell fill="both" weightx="1.0">
- <JTextField id="fieldSimulParamsNbAnnees" text='{simulAction.getSimulationParameter().getNumberOfYear()}'/>
- <javax.swing.text.Document javaBean="fieldSimulParamsNbAnnees.getDocument()"
+ <JTextField
+ id="fieldSimulParamsNbAnnees"
+ text='{String.valueOf(simulAction.getSimulationParameter().getNumberOfYear())}' />
+ <javax.swing.text.Document
+ javaBean="fieldSimulParamsNbAnnees.getDocument()"
onInsertUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())'
onRemoveUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())' />
</cell>
@@ -433,49 +501,81 @@
</Table>
</cell>
<cell columns="2" fill="horizontal" weightx="0.5">
- <JPanel/>
+ <JPanel />
</cell>
</row>
<row>
- <cell columns="4" fill="both" weightx="1.0" weighty="0.6">
- <JTabbedPane id="parametersTabbedPane" enabled="{isRegionLoaded()}">
- <tab title='{_("isisfish.params.stategiesAndPopulations")}'>
+ <cell columns="4" fill="both" weightx="1.0"
+ weighty="0.6">
+ <JTabbedPane id="parametersTabbedPane" enabled="{getRegionStorage() != null}">
+ <tab
+ title='{_("isisfish.params.stategiesAndPopulations")}'>
<Table>
<row>
<cell fill="horizontal">
- <JLabel text="isisfish.common.strategies" enabled="{isRegionLoaded()}"/>
+ <JLabel text="isisfish.common.strategies" enabled="{getRegionStorage() != null}" />
</cell>
<cell fill="horizontal">
- <JLabel text="isisfish.common.populations" enabled="{isRegionLoaded()}"/>
+ <JLabel text="isisfish.common.populations" enabled="{getRegionStorage() != null}" />
</cell>
</row>
<row>
- <cell fill="both" weightx="1" weighty="1">
+ <cell fill="both" weightx="1"
+ weighty="1">
<JScrollPane>
- <JList id="listSimulParamsStrategies" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
- onValueChanged='strategySelected()' enabled="{isRegionLoaded()}"/>
+ <JList id="listSimulParamsStrategies"
+ selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ onValueChanged='strategySelected()'
+ enabled="{getRegionStorage() != null}" />
</JScrollPane>
</cell>
- <cell fill="both" weightx="1" weighty="1">
+ <cell fill="both" weightx="1"
+ weighty="1">
<JScrollPane>
- <JList id="listSimulParamsPopulations" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
- onValueChanged='populationSelected()' enabled="{isRegionLoaded()}"/>
+ <JList id="listSimulParamsPopulations"
+ selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ onValueChanged='populationSelected()'
+ enabled="{getRegionStorage() != null}" />
</JScrollPane>
</cell>
</row>
<row>
- <cell fill="both" weighty="1" columns="2">
- <JPanel id="populationEffectivesPanel" layout="{new CardLayout()}">
- <JLabel text="isisfish.params.nopopulation" horizontalAlignment="center" border="{BorderFactory.createEtchedBorder()}"
- font-style="italic" constraints='"default"' enabled="{isRegionLoaded()}"/>
- <JTabbedPane id="populationEffectivesTabbedPane" constraints='"specific"' enabled="{isRegionLoaded()}"/>
+ <cell fill="both" weighty="1"
+ columns="2">
+ <JPanel
+ id="populationEffectivesPanel"
+ layout="{new CardLayout()}">
+ <JLabel text="isisfish.params.nopopulation"
+ horizontalAlignment="center"
+ border="{BorderFactory.createEtchedBorder()}"
+ font-style="italic"
+ constraints='"default"'
+ enabled="{getRegionStorage() != null}" />
+ <JTabbedPane id="populationEffectivesTabbedPane"
+ constraints='"specific"'
+ enabled="{getRegionStorage() != null}" />
</JPanel>
</cell>
</row>
</Table>
</tab>
<tab title='{_("isisfish.params.rules")}'>
- <RuleChooser id="ruleChooser" active="{isRegionLoaded()}" decorator="boxed"/>
+ <Table>
+ <row>
+ <cell fill="both" weightx="1"
+ weighty="1">
+ <RuleChooser id="ruleChooser"
+ active="{getRegionStorage() != null}" />
+ </cell>
+ <cell>
+ <JButton
+ id="addRuleFactorButton"
+ icon='{SwingUtil.createImageIcon("building_add.png")}'
+ onActionPerformed="addFactorWithComponent(ruleChooser)"
+ visible="{isSensitivity()}" />
+ </cell>
+ </row>
+ </Table>
</tab>
</JTabbedPane>
</cell>
@@ -488,15 +588,20 @@
<Table>
<row>
<cell fill="horizontal" weightx="0.3">
- <JCheckBox text="isisfish.params.usePreSimulationScript" id="fieldUseSimulPreScripts"
- selected='{simulAction.getSimulationParameter().getUsePreScript()}'
- visible='{!isSensitivity()}' onItemStateChanged='enablePreScript()'/>
+ <JCheckBox
+ text="isisfish.params.usePreSimulationScript"
+ id="fieldUseSimulPreScripts"
+ selected='{simulAction.getSimulationParameter().getUsePreScript()}'
+ visible='{!isSensitivity()}'
+ onItemStateChanged='enablePreScript()' />
</cell>
<cell fill="horizontal" weightx="0.3">
- <JCheckBox text="isisfish.params.useAnalysePlan" id="fieldSimulUseAnalysePlan"
- selected='{simulAction.getSimulationParameter().getUseAnalysePlan()}'
- visible='{!isSensitivity()}' onItemStateChanged='enableAnalysePlan()'
- enabled="{isRegionLoaded()}" />
+ <JCheckBox text="isisfish.params.useAnalysePlan"
+ id="fieldSimulUseAnalysePlan"
+ selected='{simulAction.getSimulationParameter().getUseAnalysePlan()}'
+ visible='{!isSensitivity()}'
+ onItemStateChanged='enableAnalysePlan()'
+ enabled="{getRegionStorage() != null}" />
</cell>
</row>
</Table>
@@ -507,19 +612,23 @@
<Table>
<row>
<cell>
- <JLabel text="isisfish.params.simulationLauncher"/>
+ <JLabel text="isisfish.params.simulationLauncher" />
</cell>
<cell fill="horizontal" weightx="0.4">
- <JComboBox id="comboSelLauncher" model='{new DefaultComboBoxModel(simulAction.getSimulationLauncher().toArray())}'/>
+ <JComboBox id="comboSelLauncher"
+ model='{new DefaultComboBoxModel(simulAction.getSimulationLauncher().toArray())}' />
</cell>
<cell fill="horizontal" weightx="0.4">
- <JButton id="buttonSimulParamsSimulate" text="isisfish.common.simulate"
- onActionPerformed='launchSimulation()' enabled="{isRegionLoaded()}"/>
+ <JButton id="buttonSimulParamsSimulate"
+ text="isisfish.common.simulate"
+ onActionPerformed='launchSimulation()'
+ enabled="{getRegionStorage() != null}" />
</cell>
<cell fill="horizontal" weightx="0.2">
- <JButton id="saveSimul" text="isisfish.simulation.menu.save"
+ <JButton id="saveSimul"
+ text="isisfish.simulation.menu.save"
onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).saveSimulation()'
- enabled="{isRegionLoaded()}"/>
+ enabled="{getRegionStorage() != null}" />
</cell>
</row>
</Table>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2005 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2005 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -28,7 +28,9 @@
import fr.ifremer.isisfish.ui.models.result.ResultListModel;
import javax.swing.event.ListSelectionEvent;
- refresh();
+ protected void $afterCompleteSetup() {
+ refresh();
+ }
public void refresh() {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -1,23 +1,27 @@
<!--
-/* *##%
- * Copyright (C) 2010 Ifremer, Code Lutin, Eric Chatellier
- *
- * 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.
- *##%*/
- -->
-
+ #%L
+ IsisFish
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric
+ %%
+ 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, see
+ <http://www.gnu.org/licenses/gpl-2.0.html>.
+ #L%
+ -->
<Table>
<!-- Rules collection managed by current ui instance. -->
<java.util.List genericType='fr.ifremer.isisfish.rule.Rule' id="rulesList" javaBean='new java.util.ArrayList<fr.ifremer.isisfish.rule.Rule>()'/>
@@ -29,15 +33,18 @@
<fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null"/>
<script><![CDATA[
- import fr.ifremer.isisfish.IsisFishException;
- import fr.ifremer.isisfish.datastore.RuleStorage;
- import fr.ifremer.isisfish.rule.Rule;
- import fr.ifremer.isisfish.ui.models.rule.RuleListModel;
- import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel;
- import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor;
- import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer;
- import fr.ifremer.isisfish.ui.util.ErrorHelper;
+ import fr.ifremer.isisfish.IsisFishException;
+ import fr.ifremer.isisfish.datastore.RuleStorage;
+ import fr.ifremer.isisfish.rule.Rule;
+ import fr.ifremer.isisfish.ui.models.rule.RuleListModel;
+ import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel;
+ import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor;
+ import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer;
+ import fr.ifremer.isisfish.ui.util.ErrorHelper;
+ import java.beans.PropertyChangeEvent;
+ import java.beans.PropertyChangeListener;
+ protected void $afterCompleteSetup() {
// Manage rule list change
addPropertyChangeListener("rulesList", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
@@ -50,69 +57,70 @@
}
}
});
+ }
- /**
- * Get new instance for selected rules names and add it to {@link rulesList} list.
- */
- protected void addSelectedRules() {
- Object[] availableRuleValues = availableRuleList.getSelectedValues();
- for (Object availableRuleValue : availableRuleValues) {
- String availableRuleName = (String)availableRuleValue;
- try {
- RuleStorage ruleStorage = RuleStorage.getRule(availableRuleName);
- Rule ruleTmp = ruleStorage.getNewRuleInstance();
- rulesList.add(ruleTmp);
- } catch (IsisFishException e) {
- if (log.isErrorEnabled()) {
- log.error("Can't add rule", e);
- }
- ErrorHelper.showErrorDialog(_("isisfish.error.simulation.addrule"), e);
+ /**
+ * Get new instance for selected rules names and add it to {@link rulesList} list.
+ */
+ protected void addSelectedRules() {
+ Object[] availableRuleValues = availableRuleList.getSelectedValues();
+ for (Object availableRuleValue : availableRuleValues) {
+ String availableRuleName = (String)availableRuleValue;
+ try {
+ RuleStorage ruleStorage = RuleStorage.getRule(availableRuleName);
+ Rule ruleTmp = ruleStorage.getNewRuleInstance();
+ rulesList.add(ruleTmp);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add rule", e);
}
+ ErrorHelper.showErrorDialog(_("isisfish.error.simulation.addrule"), e);
}
-
- //TODO replace this by a better fire() event
- selectedRulesList.setModel(new RuleListModel(rulesList));
}
- /**
- * Remove selected rules for selected rules list.
- */
- protected void removeSelectedRules() {
- Object[] selectedRuleValues = selectedRulesList.getSelectedValues();
- for (Object selectedRuleValue : selectedRuleValues) {
- rulesList.remove(selectedRuleValue);
- }
- //TODO replace this by a better fire() event
- selectedRulesList.setModel(new RuleListModel(rulesList));
+ //TODO replace this by a better fire() event
+ selectedRulesList.setModel(new RuleListModel(rulesList));
+ }
+
+ /**
+ * Remove selected rules for selected rules list.
+ */
+ protected void removeSelectedRules() {
+ Object[] selectedRuleValues = selectedRulesList.getSelectedValues();
+ for (Object selectedRuleValue : selectedRuleValues) {
+ rulesList.remove(selectedRuleValue);
}
-
- /**
- * Clear selected rule list.
- */
- protected void clearAllRules() {
- rulesList.clear();
- //TODO replace this by a better fire() event
- selectedRulesList.setModel(new RuleListModel(rulesList));
+ //TODO replace this by a better fire() event
+ selectedRulesList.setModel(new RuleListModel(rulesList));
+ }
+
+ /**
+ * Clear selected rule list.
+ */
+ protected void clearAllRules() {
+ rulesList.clear();
+ //TODO replace this by a better fire() event
+ selectedRulesList.setModel(new RuleListModel(rulesList));
+ }
+
+ /**
+ * Display paramters table form single selected list.
+ */
+ protected void displayRuleParameters() {
+ Rule selectedRule = (Rule)selectedRulesList.getSelectedValue();
+ if (selectedRule != null) {
+ RuleParametersTableModel model = new RuleParametersTableModel(selectedRule);
+ selectedRuleParameterTable.setModel(model);
+ RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule);
+ cellEditor.setRegion(getRegionStorage());
+ RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule);
+ selectedRuleParameterTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer);
+ selectedRuleParameterTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
}
-
- /**
- * Display paramters table form single selected list.
- */
- protected void displayRuleParameters() {
- Rule selectedRule = (Rule)selectedRulesList.getSelectedValue();
- if (selectedRule != null) {
- RuleParametersTableModel model = new RuleParametersTableModel(selectedRule);
- selectedRuleParameterTable.setModel(model);
- RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule);
- cellEditor.setRegion(getRegionStorage());
- RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule);
- selectedRuleParameterTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer);
- selectedRuleParameterTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
- }
- else {
- selectedRuleParameterTable.setModel(new RuleParametersTableModel());
- }
+ else {
+ selectedRuleParameterTable.setModel(new RuleParametersTableModel());
}
+ }
]]></script>
<row>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -41,13 +41,16 @@
// to be notified of storage change event
StorageChangeListener analyzePlanStorageListener;
- analyzePlanStorageListener = new StorageChangeListener() {
- @Override
- public void versionDataChanged(StorageChangeEvent e) {
- refresh();
- }
- };
- AnalysePlanStorage.addStorageChangeListener(analyzePlanStorageListener);
+
+ protected void $afterCompleteSetup() {
+ analyzePlanStorageListener = new StorageChangeListener() {
+ @Override
+ public void versionDataChanged(StorageChangeEvent e) {
+ refresh();
+ }
+ };
+ AnalysePlanStorage.addStorageChangeListener(analyzePlanStorageListener);
+ }
public void refresh() {
// analyse plans names list
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-03-16 16:57:13 UTC (rev 3160)
@@ -52,6 +52,7 @@
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.IsisFishException;
+import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.AnalysePlanStorage;
import fr.ifremer.isisfish.datastore.ExportStorage;
import fr.ifremer.isisfish.datastore.RegionStorage;
@@ -61,6 +62,7 @@
import fr.ifremer.isisfish.datastore.SensitivityStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.datastore.SimulatorStorage;
+import fr.ifremer.isisfish.datastore.StorageException;
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.Species;
import fr.ifremer.isisfish.entities.Strategy;
@@ -82,6 +84,7 @@
import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain;
import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup;
+import fr.ifremer.isisfish.ui.SimulationUI;
import fr.ifremer.isisfish.ui.util.ErrorHelper;
/**
@@ -255,28 +258,14 @@
/**
* Change region in simulation launcher
- *
+ *
+ * @param paramsUI paramsUI
* @param regionName region name
*/
- public void regionChange(String regionName) {
- try {
- regionStorage = RegionStorage.getRegion(regionName);
-
- // chatellier, on ne peut pas le reinitialiser, on
- // perd toutes les info apres un rechergement d'une anciennes simulation
- //init(); // reinitialise param pour le vider
- param.setRegionName(regionName);
-
- // poussin 20090519 quel est l'interet de faire ca ? et encore plus maintenant qu'on reinitialise
- // for (Rule r : param.getRules()) {
- // rules.put(r, RuleStorage.getName(r));
- // }
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("Can't change region", e);
- }
- ErrorHelper.showErrorDialog(_("isisfish.error.simulation.openregion"), e);
- }
+ public void regionChange(ParamsUI paramsUI, String regionName) {
+ regionStorage = RegionStorage.getRegion(regionName);
+ paramsUI.getParentContainer(SimulationUI.class).setRegionStorage(regionStorage);
+ param.setRegionName(regionName);
}
/**
@@ -309,13 +298,6 @@
param.setAnalysePlanNumber(-1);
regionStorage = param.getRegion();
- // Chargement des exports de sensibilites
- /* not used anymore
- * sensitivityExports.clear();
- for (SensitivityExport ex : param.getSensitivityExport()){
- sensitivityExports.put(ex, ex.getExportFilename());
- }*/
-
// Chargement des facteurs
// clear list even if mexico file doesn't exists
factors.clear();
@@ -339,10 +321,7 @@
}
}
} catch (Exception eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't load old Simulation: " + simulName, eee);
- }
- ErrorHelper.showErrorDialog(_("isisfish.error.simulation.loadoldsimulation"), eee);
+ throw new IsisFishRuntimeException(_("isisfish.error.simulation.loadoldsimulation"), eee);
}
}
@@ -860,6 +839,10 @@
return result;
}
+ public SortedMap<String, Factor> getFactors() {
+ return factors;
+ }
+
public void addFactor(Factor f, JComponent c) {
if (log.isDebugEnabled()) {
log.debug("Add factor (" + f.getName() + ") : " +f.getPath());
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2011-03-16 16:55:59 UTC (rev 3159)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2011-03-16 16:57:13 UTC (rev 3160)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2005 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2005 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -25,55 +25,62 @@
<fr.ifremer.isisfish.ui.SimulationUI>
<script><![CDATA[
- @Override
- public void refresh() {
- paramsUI.refresh();
- preScriptUI.refresh();
- sensUI.refresh();
- exportUI.refresh();
- resultChoiceUI.refresh();
- advancedParamsUI.refresh();
- }
+ @Override
+ public void refresh() {
+ paramsUI.refresh();
+ preScriptUI.refresh();
+ sensUI.refresh();
+ exportUI.refresh();
+ resultChoiceUI.refresh();
+ advancedParamsUI.refresh();
+ }
+
+ /**
+ * Refresh all simulation launch UI.
+ */
+ @Override
+ protected void regionStorageChanged() {
+
+ }
+
+ @Override
+ public void selectParametersTab() {
+ bodyTabbedPane.setSelectedIndex(0);
+ }
- @Override
- public void selectParametersTab() {
- bodyTabbedPane.setSelectedIndex(0);
+ @Override
+ public void setEnabledPrescriptTab(boolean selected) {
+ bodyTabbedPane.setEnabledAt(1, selected);
+ if (selected) {
+ bodyTabbedPane.setSelectedIndex(1);
}
-
- @Override
- public void setEnabledPrescriptTab(boolean selected) {
- bodyTabbedPane.setEnabledAt(1, selected);
- if (selected) {
- bodyTabbedPane.setSelectedIndex(1);
- }
+ }
+
+ @Override
+ public void setEnabledAnalysePlanTab(boolean selected) {
+ bodyTabbedPane.setEnabledAt(2, selected);
+ if (selected) {
+ bodyTabbedPane.setSelectedIndex(2);
}
-
- @Override
- public void setEnabledAnalysePlanTab(boolean selected) {
- bodyTabbedPane.setEnabledAt(2, selected);
- if (selected) {
- bodyTabbedPane.setSelectedIndex(2);
- }
- }
- ]]>
- </script>
+ }
+ ]]></script>
<JTabbedPane id="bodyTabbedPane">
- <tab id="paramsUITab" title='isisfish.params.title'>
- <ParamsUI id="paramsUI" constructorParams='this' />
+ <tab title='isisfish.params.title'>
+ <ParamsUI id="paramsUI" constructorParams='this' regionStorage="{getRegionStorage()}"/>
</tab>
- <tab id="preScriptUITab" title='isisfish.preScript.title' enabled='false'>
+ <tab title='isisfish.preScript.title' enabled='false'>
<PreScriptsUI id="preScriptUI" constructorParams='this' />
</tab>
- <tab id="sensUITab" title='isisfish.sens.title' enabled='false'>
+ <tab title='isisfish.sens.title' enabled='false'>
<SensUI id="sensUI" constructorParams='this' />
</tab>
- <tab id="exportUITab" title='isisfish.export.title'>
+ <tab title='isisfish.export.title'>
<ExportUI id="exportUI" constructorParams='this' />
</tab>
- <tab id="resultChoiceUITab" title='isisfish.resultChoice.title'>
+ <tab title='isisfish.resultChoice.title'>
<ResultChoiceUI id="resultChoiceUI" constructorParams='this' />
</tab>
- <tab id="advancedParamsUITab" title='isisfish.advancedParameters.title'>
+ <tab title='isisfish.advancedParameters.title'>
<AdvancedParamsUI id="advancedParamsUI" constructorParams='this' />
</tab>
</JTabbedPane>
1
0