Author: echatellier Date: 2012-04-03 15:31:36 +0200 (Tue, 03 Apr 2012) New Revision: 3671 Url: http://forge.codelutin.com/repositories/revision/isis-fish/3671 Log: Merge branch 4.1 Added: trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java trunk/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java trunk/src/main/java/fr/ifremer/isisfish/entities/VariableType.java trunk/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/variable/ Modified: trunk/ trunk/pom.xml trunk/src/main/assembly/isisfish.bat trunk/src/main/assembly/isisfish64.bat trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java trunk/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java trunk/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityAnalysis.java trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java trunk/src/main/java/fr/ifremer/isisfish/util/Args.java trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java trunk/src/main/java/fr/ifremer/isisfish/util/EvaluatorHelper.java trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHUtils.java trunk/src/main/resources/i18n/isis-fish_en_GB.properties trunk/src/main/resources/i18n/isis-fish_fr_FR.properties trunk/src/main/resources/sensitivity.properties trunk/src/main/xmi/isis-fish.properties trunk/src/main/xmi/isis-fish.zargo trunk/src/site/resources/images/isis-simulation.png trunk/src/test/java/fr/ifremer/isisfish/entity/PersistenceTest.java trunk/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java trunk/src/test/java/fr/ifremer/isisfish/util/EvaluateHelperTest.java Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - + /branches/4.1:3601-3670 Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/pom.xml 2012-04-03 13:31:36 UTC (rev 3671) @@ -6,12 +6,12 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>mavenpom4redmine</artifactId> - <version>3.0.7</version> + <version>3.2</version> </parent> <groupId>fr.ifremer</groupId> <artifactId>isis-fish</artifactId> - <version>4.0.0.3-SNAPSHOT</version> + <version>4.1.0.0-SNAPSHOT</version> <!-- POM Relationships : Inheritance : Dependencies --> <dependencies> @@ -96,7 +96,7 @@ <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> - <version>1.4.4</version> + <version>1.4.5</version> <scope>compile</scope> </dependency> @@ -113,6 +113,12 @@ <artifactId>jaxx-runtime</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> + <exclusions> + <exclusion> + <artifactId>swingx-core</artifactId> + <groupId>org.swinglabs</groupId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -127,6 +133,12 @@ <artifactId>jaxx-widgets</artifactId> <version>${jaxxVersion}</version> <scope>compile</scope> + <exclusions> + <exclusion> + <artifactId>swingx-core</artifactId> + <groupId>org.swinglabs</groupId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -144,11 +156,6 @@ </dependency> <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> @@ -166,7 +173,7 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.1</version> + <version>2.2</version> </dependency> <dependency> @@ -175,6 +182,13 @@ <version>2.2</version> <scope>runtime</scope> <!--script --> </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-math3</artifactId> + <version>3.0</version> + <scope>runtime</scope> <!--script --> + </dependency> <dependency> <groupId>org.apache.commons</groupId> @@ -232,7 +246,7 @@ <dependency> <groupId>com.bbn</groupId> <artifactId>openmap</artifactId> - <version>4.6.5</version> + <version>5.0</version> <scope>compile</scope> </dependency> @@ -245,14 +259,14 @@ <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> - <version>0.1.45</version> + <version>0.1.46</version> <scope>compile</scope> </dependency> <dependency> - <groupId>org.swinglabs</groupId> + <groupId>org.swinglabs.swingx</groupId> <artifactId>swingx-core</artifactId> - <version>1.6.2-2</version> + <version>1.6.3</version> <scope>compile</scope> </dependency> @@ -278,7 +292,7 @@ <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> - <version>1.3.163</version> + <version>1.3.165</version> <scope>compile</scope> </dependency> @@ -373,7 +387,7 @@ <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> - <version>2.3.18</version> + <version>2.3.19</version> <scope>compile</scope> </dependency> @@ -524,9 +538,9 @@ <!-- Dependencies version --> <jaxxVersion>2.4.2</jaxxVersion> <eugeneVersion>2.4.2</eugeneVersion> - <topiaVersion>2.6.5</topiaVersion> - <hibernateVersion>3.6.9.Final</hibernateVersion> - <nuitonUtilsVersion>2.4.2</nuitonUtilsVersion> + <topiaVersion>2.6.9</topiaVersion> + <hibernateVersion>3.6.10.Final</hibernateVersion> + <nuitonUtilsVersion>2.4.6</nuitonUtilsVersion> <nuitonI18nVersion>2.4.1</nuitonI18nVersion> <nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion> <aspectwerkzVersion>2.0</aspectwerkzVersion> @@ -717,9 +731,9 @@ <!-- *** Build Environment ************************************** --> <!-- ************************************************************* --> <scm> - <connection>scm:svn:http://svn.forge.codelutin.com/svn/isis-fish/trunk</connection> - <developerConnection>scm:svn:http://svn.forge.codelutin.com/svn/isis-fish/trunk</developerConnection> - <url>http://svn.forge.codelutin.com/svn/isis-fish/trunk</url> + <connection>scm:svn:http://svn.forge.codelutin.com/svn/isis-fish/branches/4.1</connection> + <developerConnection>scm:svn:http://svn.forge.codelutin.com/svn/isis-fish/branches/4.1</developerConnection> + <url>http://svn.forge.codelutin.com/svn/isis-fish/branches/4.1</url> </scm> <repositories> Modified: trunk/src/main/assembly/isisfish.bat =================================================================== --- trunk/src/main/assembly/isisfish.bat 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/assembly/isisfish.bat 2012-04-03 13:31:36 UTC (rev 3671) @@ -1,5 +1,8 @@ @echo off +rem Uncomment following 2 lines to easy configure R for ISIS-Fish +rem SET R_HOME=C:\Program Files\R\R-2.14.1 +rem SET PATH=%PATH%;%R_HOME%\bin\i386 + echo [Script] Isis starting... java -Xmx1024M -Djava.library.path=jri -DR.type=jni -jar ${project.build.finalName}.${project.packaging} %1 %2 %3 %4 %5 %6 %7 %8 %9 > debug.txt 2>&1 - Modified: trunk/src/main/assembly/isisfish64.bat =================================================================== --- trunk/src/main/assembly/isisfish64.bat 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/assembly/isisfish64.bat 2012-04-03 13:31:36 UTC (rev 3671) @@ -1,5 +1,8 @@ @echo off +rem Uncomment following 2 lines to easy configure R for ISIS-Fish +rem SET R_HOME=C:\Program Files\R\R-2.14.1 +rem SET PATH=%PATH%;%R_HOME%\bin\x64 + echo [Script] Isis starting... java -Xmx1024M -Djava.library.path=jri64 -DR.type=jni -jar ${project.build.finalName}.${project.packaging} %1 %2 %3 %4 %5 %6 %7 %8 %9 > debug.txt 2>&1 - Modified: trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -119,7 +119,7 @@ * migration de donnees demande automatiquement un changement de version * d'application. */ - protected final static Version version = new Version(4, 0, 0, 3); + protected final static Version version = new Version(4, 1, 0, 0); protected final static Version majorVersion = new Version(version.getNumber(0)); protected final static Version databaseVersion = new Version( Modified: trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -49,7 +49,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.AbstractFileFilter; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; @@ -60,6 +60,8 @@ import org.nuiton.util.Version; import org.nuiton.widget.SwingSession; +import com.bbn.openmap.MapBean; + import fr.ifremer.isisfish.cron.CronService; import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.datastore.FormuleStorage; @@ -652,6 +654,9 @@ // init IsisTray IsisTray.getInstance(); + // OpenMap sysout + MapBean.suppressCopyright = true; + // configure swing session // can't be in config ? getUserConfigDirectory() not static File isisConfigDirectory = new File(config.getUserConfigDirectory(), "isis-fish"); Modified: trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/datastore/CodeSourceStorage.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -27,9 +27,7 @@ import java.io.File; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; -import java.util.Iterator; import java.util.List; import org.nuiton.util.FileUtil; Modified: trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + * Copyright (C) 2011 - 2012 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 @@ -50,6 +50,7 @@ protected static final Version VERSION_32 = new Version("3.2"); protected static final Version VERSION_33 = new Version("3.3"); protected static final Version VERSION_40 = new Version("4.0"); + protected static final Version VERSION_41 = new Version("4.1"); public DatabaseMigrationClass() { super(new MigrationResolver()); @@ -65,12 +66,12 @@ if (version.equals(VERSION_32)) { result = MigrationV0V32.class; - } - else if (version.equals(VERSION_33)) { + } else if (version.equals(VERSION_33)) { result = MigrationV32V33.class; - } - else if (version.equals(VERSION_40)) { + } else if (version.equals(VERSION_40)) { result = MigrationV33V40.class; + } else if (version.equals(VERSION_41)) { + result = MigrationV40V41.class; } return result; } @@ -82,7 +83,7 @@ */ @Override public Version[] getAvailableVersions() { - Version[] result = new Version[] { VERSION_32, VERSION_33, VERSION_40 }; + Version[] result = new Version[] { VERSION_32, VERSION_33, VERSION_40, VERSION_41 }; return result; } Copied: trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java (from rev 3670, branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -0,0 +1,81 @@ +/* + * #%L + * + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 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.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.3 and 4.0. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class MigrationV40V41 extends MigrationCallBackForVersion { + + /** + * Constructor. + * + * @param version version + * @param callback callback + */ + public MigrationV40V41(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("CREATE TABLE VARIABLE( " + + "TOPIAID VARCHAR(255) NOT NULL, " + + "TOPIAVERSION BIGINT NOT NULL, " + + "TOPIACREATEDATE DATE, " + + "ENTITYID VARCHAR(255) NOT NULL, " + + "NAME LONGVARCHAR, " + + "TYPE LONGVARCHAR, " + + "DOUBLEVALUE DOUBLE, " + + "MATRIXVALUE_NAME VARCHAR(255), " + + "MATRIXVALUE_DIM VARCHAR(255), " + + "MATRIXVALUE_DIMNAMES LONGVARCHAR, " + + "MATRIXVALUE_SEMANTICS LONGVARCHAR," + + "MATRIXVALUE_DATA LONGVARCHAR, " + + "EQUATIONVALUE VARCHAR(255)) "); + + } +} Copied: trunk/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java (from rev 3670, branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -0,0 +1,137 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer, Code Lutin, 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.entities; + +import static org.nuiton.i18n.I18n._; + +import org.apache.commons.beanutils.BeanUtils; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.TopiaEntity; + +import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.IsisFishRuntimeException; +import fr.ifremer.isisfish.equation.Language; +import fr.ifremer.isisfish.equation.VariableEquation; + +public class VariableImpl extends VariableAbstract { + + private static final long serialVersionUID = 3978428224373810278L; + + /* + private static Log log = LogFactory.getLog(VariableImpl.class); */ + + public VariableImpl() { + setType(VariableType.DOUBLE); + } + + /*@Override + public void setDoubleValue(double doubleValue) { + super.setDoubleValue(doubleValue); + super.setMatrixValue(null); + + deletePreviousEquation(); + super.setEquationValue(null); + } + + /* + * Manually delete equation since topia (or hibernate) can't delete + * orphan object with many-to-one relations. + * + protected void deletePreviousEquation() { + if (super.getEquationValue() != null) { + try { + IsisFishDAOHelper.getEquationDAO(getTopiaContext()).delete(super.getEquationValue()); + } catch (TopiaException ex) { + if (log.isErrorEnabled()) { + log.error("Can't delete equation", ex); + } + } + } + } + + @Override + public void setEquationValue(Equation equationValue) { + super.setEquationValue(equationValue); + super.setDoubleValue(0); + super.setMatrixValue(null); + } + + @Override + public void setMatrixValue(MatrixND matrixValue) { + super.setMatrixValue(matrixValue); + super.setDoubleValue(0); + + deletePreviousEquation(); + super.setEquationValue(null); + }*/ + + public void setEquationValueContent(String content) { + try { + Equation eq = getEquationValue(); + + if (eq == null) { + EquationDAO dao = IsisFishDAOHelper + .getEquationDAO(getTopiaContext()); + // create Growth equation + eq = dao.create(); + eq.setCategory("Variable"); + eq.setJavaInterface(VariableEquation.class); + eq.setLanguage(Language.JAVA); + setEquationValue(eq); + } + + eq.setName(getName()); + + // Fire + String _oldValue = eq.getContent(); + fireOnPreWrite("content", _oldValue, content); + + eq.setContent(content); + eq.update(); + + fireOnPostWrite("content", _oldValue, content); + + } catch (TopiaException eee) { + throw new IsisFishRuntimeException(_("isisfish.change.equation"), eee); + } + } + + @Override + public String toString() { + + String result = null; + try { + TopiaEntity entity = getTopiaContext().findByTopiaId(getEntityId()); + result = BeanUtils.getProperty(entity, "name"); + } catch (Exception ex) { + result = entityId; + } + + result += "." + name; + return result; + } + +} //VariableImpl Copied: trunk/src/main/java/fr/ifremer/isisfish/entities/VariableType.java (from rev 3670, branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableType.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/entities/VariableType.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/entities/VariableType.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -0,0 +1,39 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 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.entities; + +/** + * Variable type. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public enum VariableType { + DOUBLE, + EQUATION, + MATRIX +} Modified: trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/equation/ImmigrationEquation.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -58,7 +58,7 @@ * d'arrivé pour le groupe passé en argument * @throws Exception */ - @Args({"context", "N", "pop", "group", "arrivalZone"}) + @Args({"context", "N", "pop", "group", "arrivalZone"}) public double compute(SimulationContext context, MatrixND N, Population pop, PopulationGroup group, Zone arrivalZone) throws Exception; Copied: trunk/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java (from rev 3670, branches/4.1/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -0,0 +1,56 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Ifremer, Code Lutin, 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.equation; + +import org.nuiton.topia.persistence.TopiaEntity; + +import fr.ifremer.isisfish.simulator.SimulationContext; +import fr.ifremer.isisfish.types.TimeStep; +import fr.ifremer.isisfish.util.Args; + +/** + * Generic equation signature used in variable values. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public interface VariableEquation { + + /** + * Compute target factor. + * + * @param context simulation context + * @param entity l'entity sur laquelle la variable a été ajoutée + * @param step le pas de temps courant + * @return equation result + * @throws Exception + */ + @Args({"context", "entity", "step"}) + public double compute(SimulationContext context, TopiaEntity entity, TimeStep step) throws Exception; +} Modified: trunk/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -32,13 +32,13 @@ import org.nuiton.topia.TopiaException; -import com.bbn.openmap.LatLonPoint; import com.bbn.openmap.event.MapMouseListener; import com.bbn.openmap.event.NavMouseMode; import com.bbn.openmap.event.NullMouseMode; import com.bbn.openmap.event.SelectMouseMode; import com.bbn.openmap.omGraphics.OMGraphic; import com.bbn.openmap.omGraphics.OMRect; +import com.bbn.openmap.proj.coords.LatLonPoint; import fr.ifremer.isisfish.entities.FisheryRegion; @@ -100,12 +100,13 @@ * @param pt le point pour lequel on cherche le carre correspondant * @return le carre correspondant au point donne sinon renvoie null. */ - public OMGraphic findXY(LatLonPoint pt) { + public OMRect findXY(LatLonPoint pt) { // Recupere le vecteur de tous les carres possibles. - List<OMRect> allRect = graphics.getTargets(); + List<OMGraphic> allRect = graphics.getTargets(); // Parcours le vecteur, et cherche le carre, et le renvoie si il existe - for (OMRect rect : allRect) { + for (OMGraphic rectg : allRect) { + OMRect rect = (OMRect)rectg; if (pt.getLatitude() >= rect.getSouthLat() && pt.getLatitude() < rect.getNorthLat() && pt.getLongitude() >= rect.getWestLon() @@ -123,16 +124,17 @@ */ public List<LatLonPoint> getSelected() { // Recupere le vecteur de tous les carres possibles. - List<OMRect> allRect = graphics.getTargets(); + List<OMGraphic> allRect = graphics.getTargets(); List<LatLonPoint> result = new ArrayList<LatLonPoint>(); // Parcours le vecteur de tous les carres possibles. - for (OMRect rect : allRect) { + for (OMGraphic rectg : allRect) { + OMRect rect = (OMRect)rectg; // Si le carre est selectionne, on rajoute ses coordonnees au vector results if (rect.getFillPaint() != null - && !OMGraphic.isClear(rect.getFillPaint())) { - result.add(new LatLonPoint(rect.getSouthLat(), rect + && !rect.isClear(rect.getFillPaint())) { + result.add(new LatLonPoint.Double(rect.getSouthLat(), rect .getWestLon())); } } @@ -144,10 +146,11 @@ */ public void unSelectAll() { // Recupere le vecteur de tous les carres possibles. - List<OMRect> allRect = graphics.getTargets(); + List<OMGraphic> allRect = graphics.getTargets(); // Parcours le vecteur et met a null la couleur de fond de chaque carre - for (OMRect rect : allRect) { + for (OMGraphic rectg : allRect) { + OMRect rect = (OMRect)rectg; rect.setFillPaint(null); } // Rafraichit le layer @@ -161,7 +164,7 @@ */ public boolean select(LatLonPoint pt) { // Recherche le carre correspondant au point donne - OMGraphic select = findXY(pt); + OMRect select = findXY(pt); // si pas trouve on sort. if (select == null) @@ -169,7 +172,7 @@ // si trouve et pas deja selectionne if (select.getFillPaint() == null - || OMGraphic.isClear(select.getFillPaint())) { + || select.isClear(select.getFillPaint())) { // Si on est en mode SINGLE_SELECTION, on deselectionne tous les carres avant. if (getSelectionMode() == SINGLE_SELECTION) unSelectAll(); @@ -188,7 +191,7 @@ * @return true si reussi sinon false. */ public boolean select(float latitude, float longitude) { - return select(new LatLonPoint(latitude, longitude)); + return select(new LatLonPoint.Float(latitude, longitude)); } /** @@ -214,7 +217,7 @@ * @return true si reussi sinon false. */ public boolean unSelect(float latitude, float longitude) { - return unSelect(new LatLonPoint(latitude, longitude)); + return unSelect(new LatLonPoint.Float(latitude, longitude)); } /** @@ -283,7 +286,7 @@ } // on recherche le carre clique - OMGraphic select = findXY(getProjection().inverse(e.getX(), e.getY())); + OMRect select = findXY((LatLonPoint)getProjection().inverse(e.getX(), e.getY())); // si on le trouve pas,on renvoie false if (select == null) { @@ -292,7 +295,7 @@ // si le carre n est pas selectionne, on le selectionne if (select.getFillPaint() == null - || OMGraphic.isClear(select.getFillPaint())) { + || select.isClear(select.getFillPaint())) { // si on est en mode SINGLE_SELECTION, on deselectionne tous avant. if (getSelectionMode() == SINGLE_SELECTION) { unSelectAll(); Modified: trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -40,7 +40,6 @@ import org.nuiton.topia.TopiaException; import com.bbn.openmap.BufferedMapBean; -import com.bbn.openmap.LatLonPoint; import com.bbn.openmap.Layer; import com.bbn.openmap.LayerHandler; import com.bbn.openmap.MouseDelegator; @@ -55,6 +54,7 @@ import com.bbn.openmap.layer.shape.ShapeLayer; import com.bbn.openmap.layer.vpf.VPFLayer; import com.bbn.openmap.omGraphics.DrawingAttributes; +import com.bbn.openmap.proj.coords.LatLonPoint; import fr.ifremer.isisfish.IsisFish; import fr.ifremer.isisfish.IsisFishDAOHelper; @@ -595,7 +595,7 @@ // OR this one //setProjection(new CADRG(new LatLonPoint(centerLat, centerLong), SCALE, 480, 540)); - setCenter(new LatLonPoint(centerLat, centerLong)); + setCenter(new LatLonPoint.Float(centerLat, centerLong)); //setScale(SCALE); addSpecificLayer(); addGraticuleLayer(); Modified: trunk/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -42,13 +42,13 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.math.matrix.MatrixND; -import com.bbn.openmap.LatLonPoint; import com.bbn.openmap.event.MapMouseListener; import com.bbn.openmap.event.ProjectionEvent; import com.bbn.openmap.event.SelectMouseMode; import com.bbn.openmap.layer.OMGraphicHandlerLayer; import com.bbn.openmap.omGraphics.OMGraphicList; import com.bbn.openmap.proj.Projection; +import com.bbn.openmap.proj.coords.LatLonPoint; import fr.ifremer.isisfish.entities.Cell; import fr.ifremer.isisfish.entities.Zone; Modified: trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -44,9 +44,8 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.ConvertUtilsBean; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; Modified: trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -27,7 +27,7 @@ import java.util.List; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.dom4j.Element; import org.nuiton.math.matrix.MatrixND; Modified: trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2012 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 @@ -26,18 +26,28 @@ package fr.ifremer.isisfish.simulator; import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.TopiaEntity; +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.entities.Variable; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityUtils; +import fr.ifremer.isisfish.types.TimeStep; /** * Keep all information on one simulation. @@ -45,7 +55,7 @@ * <li> Launch parameter * <li> Database (TopiaContext) * <li> SimulationControl - * <li> Effectif by pop (N) + * <li> Effective by pop (N) * <li> Result * * Created: 3 juil. 2006 17:05:27 @@ -78,9 +88,12 @@ /** TopiaContext must be used to save result */ protected TopiaContext dbResult = null; + /** Cache des variables d'entités. Topia id > map of attributes. */ + protected Map<TopiaEntity, SimulationVariable> variablesCache = new HashMap<TopiaEntity, SimulationVariable>(); + /** Context value used in equation. */ protected Map<String, Double> contextEquationValue = new HashMap<String, Double>(); - + private static ThreadLocal<SimulationContext> simulationContext = new ThreadLocal<SimulationContext>() { protected synchronized SimulationContext initialValue() { return new SimulationContext(); @@ -336,7 +349,7 @@ public void setComputeValue(String key, Double value) { contextEquationValue.put(key, value); } - + /** * Return value from context. * @@ -361,7 +374,7 @@ log.trace("Found key '" + localKey + "' current value = " + value); } - // since 3.4.0.0, operator is always * + // since 4.0.0.0, operator is always * result = value; } else { @@ -373,4 +386,20 @@ return result; } + + /** + * Get object containing variable for given entity. + * + * @param entity entity + * @return map object for this class + * @since 4.1.0.0 + */ + public SimulationVariable get(TopiaEntity entity) { + SimulationVariable v = variablesCache.get(entity); + if (v == null) { + v = new SimulationVariable(this, entity); + variablesCache.put(entity, v); + } + return v; + } } Copied: trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java (from rev 3670, branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -0,0 +1,177 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 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.simulator; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.nuiton.math.matrix.MatrixND; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.persistence.TopiaEntity; + +import fr.ifremer.isisfish.entities.Equation; +import fr.ifremer.isisfish.entities.EquationImpl; +import fr.ifremer.isisfish.entities.Variable; +import fr.ifremer.isisfish.equation.VariableEquation; +import fr.ifremer.isisfish.types.TimeStep; +import fr.ifremer.isisfish.util.EvaluatorHelper; + +/** + * Object containing cached variable value for a specific entity. + * + * @author chatellier + * @version $Revision$ + * @since 4.1.0.0 + * + * Last update : $Date$ + * By : $Author$ + */ +public class SimulationVariable { + + /** Simulation context (to get db). */ + protected SimulationContext simulationContext; + + /** Managed entity id. */ + protected TopiaEntity topiaEntity; + + /** Variable name > variable entity. */ + protected Map<String, Variable> variablesCache = new HashMap<String, Variable>(); + + public SimulationVariable(SimulationContext simulationContext, TopiaEntity topiaEntity) { + this.simulationContext = simulationContext; + this.topiaEntity = topiaEntity; + } + + /** + * Return variable entity from cache or database. + * + * @param name variable name to get + * @return variable entity + * @throws TopiaException if can't restore variable from db + */ + protected Variable getVariableEntity(String name) throws TopiaException { + Variable v = variablesCache.get(name); + if (v == null) { + TopiaContext topiaContext = simulationContext.getDB(); + List<Variable> vindb = topiaContext.find("FROM " + Variable.class.getName() + + " WHERE " + Variable.PROPERTY_ENTITY_ID + " = :id" + + " AND " + Variable.PROPERTY_NAME + " = :name", + "id", topiaEntity.getTopiaId(), + "name", name); + if (!vindb.isEmpty()) { + v = vindb.get(0); + variablesCache.put(name, v); + } + } + return v; + } + + /** + * Return variable value as double. + * + * @param name variable name + * @return value as double + * @throws TopiaException if can't restore variable from db + */ + public double getAsDouble(String name) throws TopiaException { + Variable v = getVariableEntity(name); + double result = v.getDoubleValue(); + return result; + } + + /** + * Return variable value as matrix. + * + * @param name variable name + * @return value as matrix + * @throws TopiaException if can't restore variable from db + */ + public MatrixND getAsMatrix(String name) throws TopiaException { + Variable v = getVariableEntity(name); + MatrixND result = v.getMatrixValue(); + return result; + } + + /** + * Set variable value. + * + * @param name variable name + * @param value new value + * @throws TopiaException if can't restore variable from db + */ + public void set(String name, Object value) throws TopiaException { + Variable v = getVariableEntity(name); + if (double.class.isAssignableFrom(value.getClass()) || Double.class.isAssignableFrom(value.getClass())) { + v.setDoubleValue((Double)value); + } else if (value instanceof MatrixND) { + v.setMatrixValue((MatrixND)value); + } else if (value instanceof String) { + Equation eq = v.getEquationValue(); + if (eq == null) { + eq = new EquationImpl(); + eq.setContent((String)value); + } + v.setEquationValue(eq); + } + } + + /** + * Eval current variable equation. + * + * @param name variable name + * @return equation result + * @throws TopiaException if can't restore variable from db + */ + public double eval(String name) throws TopiaException { + Variable v = getVariableEntity(name); + return eval(v); + } + + /** + * Eval current variable equation. + * + * @param v variable + * @return equation result + */ + protected double eval(Variable v) { + Equation eq = v.getEquationValue(); + + Map<String, Object> args = new HashMap<String, Object>(); + args.put("context", simulationContext); + args.put("entity", topiaEntity); + args.put("step", simulationContext.getSimulationControl().getStep()); + + Object val = EvaluatorHelper.evaluate("fr.ifremer.isisfish.equation", + topiaEntity.getTopiaId() + "#" + v.getName(), VariableEquation.class, + eq.getContent(), args); + + double result = 0.0; + if (val instanceof Number) { + result = ((Number) val).doubleValue(); + } + return result; + } +} Property changes on: trunk/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityAnalysis.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx ___________________________________________________________________ Deleted: svn:mergeinfo - Copied: trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx (from rev 3670, branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx) =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx 2012-04-03 13:31:36 UTC (rev 3671) @@ -0,0 +1,206 @@ +<!-- + #%L + IsisFish + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 Ifremer, Code Lutin, 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% + --> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> + + <import> + static org.nuiton.i18n.I18n.n_ + javax.swing.event.ListSelectionEvent + fr.ifremer.isisfish.entities.Cell + fr.ifremer.isisfish.entities.Zone + fr.ifremer.isisfish.map.CellSelectionLayer + fr.ifremer.isisfish.map.CopyMapToClipboardListener + fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel + com.bbn.openmap.event.SelectMouseMode + com.bbn.openmap.gui.Tool + com.bbn.openmap.gui.OMToolSet + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + java.awt.event.MouseEvent + java.util.ArrayList + </import> + + <BeanValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Zone' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldZoneName" /> + <field name="cell" component="spZoneCells" /> + </BeanValidator> + + <script><![CDATA[ +protected OMToolSet toolSet = new OMToolSet(); + +protected void $afterCompleteSetup() { + + toolSet.setupListeners(zoneMap); + toolMap.add((Tool)toolSet); + + // add copy to clipboard support + zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap)); + new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { + @Override + public boolean mouseClicked(MouseEvent e) { + boolean result = false; + if (getBean() != null) { // impossible de desactiver la carte :( + getBean().setCell(zoneMap.getSelectedCells()); + setZoneCells(); + } + return result; + } + }; + + addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getNewValue() == null) { + fieldZoneName.setText(""); + fieldZoneComment.setText(""); + zoneMap.setSelectedCells(); + } + if (evt.getNewValue() != null) { + setZoneCells(); + } + } + }); +} + +protected void setZoneCells() { + if (getBean() != null) { + List<Cell> cells = getFisheryRegion().getCell(); + TopiaEntityListModel model = new TopiaEntityListModel(cells); + zoneCells.setModel(model); + if (getBean().getCell() != null) { + for (Cell selectedCell : getBean().getCell()) { + int index = cells.indexOf(selectedCell); + zoneCells.addSelectionInterval(index, index); + } + } + } +} + +protected void zoneCellsChange(ListSelectionEvent event) { + // sans ca, ca boucle (modification depuis la carte) + if (event.getValueIsAdjusting()) { + // pas a faie dans le cas d'une AS + if (isActive()) { + java.util.List<Cell> cells = new ArrayList<Cell>(); + for (Object o : zoneCells.getSelectedValues()) { + cells.add((Cell) o); + } + getBean().setCell(cells); + } + } +} +]]> + </script> + <JPanel id='body'> + <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> + <Table> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.name"/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JTextField id="fieldZoneName" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' + enabled='{isActive()}' decorator='boxed' + onKeyReleased='getBean().setName(fieldZoneName.getText())'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.cells"/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> + <JScrollPane id="spZoneCells"> + <JList id="zoneCells" enabled='{isActive()}' + onValueChanged='zoneCellsChange(event)' decorator='boxed'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal' weightx='1.0'> + <JLabel enabled='{isActive()}' text="isisfish.zone.comments"/> + </cell> + </row> + <row> + <cell columns='2' fill='both' weighty='0.3' weightx='1.0'> + <JScrollPane> + <JTextArea id="fieldZoneComment" + text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' + enabled='{isActive()}' + decorator='boxed' + onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Zone.class)"/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged() && getBean() != null}" + onActionPerformed="getSaveVerifier().delete()"/> + </cell> + </row> + </Table> + <JPanel id='map' layout='{new BorderLayout()}'> + <com.bbn.openmap.gui.ToolPanel id='toolMap' + javaBean='new com.bbn.openmap.gui.ToolPanel()' + decorator='boxed' constraints='BorderLayout.NORTH'/> + <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' + javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' + selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}" + fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()==null?null:bean.getCell()}' + decorator='boxed' constraints='BorderLayout.CENTER'/> + <!-- FIXME echatellier 20110429 : binding --> + </JPanel> + </JSplitPane> + </JPanel> +</fr.ifremer.isisfish.ui.input.InputContentUI> Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 Ifremer, Code Lutin + Copyright (C) 2012 Ifremer, Code Lutin, 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,187 +22,50 @@ <http://www.gnu.org/licenses/gpl-2.0.html>. #L% --> -<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'> +<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Zone'> - <!-- bean property --> <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/> <import> static org.nuiton.i18n.I18n.n_ - javax.swing.event.ListSelectionEvent - fr.ifremer.isisfish.entities.Cell - fr.ifremer.isisfish.entities.Zone - fr.ifremer.isisfish.map.CellSelectionLayer - fr.ifremer.isisfish.map.CopyMapToClipboardListener - fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel - com.bbn.openmap.event.SelectMouseMode - com.bbn.openmap.gui.Tool - com.bbn.openmap.gui.OMToolSet - java.beans.PropertyChangeEvent - java.beans.PropertyChangeListener - java.awt.event.MouseEvent - java.util.ArrayList + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; </import> - - <BeanValidator id='validator' - bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Zone' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="name" component="fieldZoneName" /> - <field name="cell" component="spZoneCells" /> - </BeanValidator> - <script><![CDATA[ -protected OMToolSet toolSet = new OMToolSet(); protected void $afterCompleteSetup() { setButtonTitle(_("isisfish.input.continuePorts")); setNextPath(n_("isisfish.input.tree.ports")); - toolSet.setupListeners(zoneMap); - toolMap.add((Tool)toolSet); - - // add copy to clipboard support - zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap)); - new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) { - @Override - public boolean mouseClicked(MouseEvent e) { - boolean result = false; - if (getBean() != null) { // impossible de desactiver la carte :( - getBean().setCell(zoneMap.getSelectedCells()); - setZoneCells(); - } - return result; - } - }; - - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() == null) { - fieldZoneName.setText(""); - fieldZoneComment.setText(""); - zoneMap.setSelectedCells(); - } - if (evt.getNewValue() != null) { - setZoneCells(); - } - } - }); + // install change listener + // (depends on sensitivity can't be done on constructor) + installChangeListener(zoneTab); } -protected void setZoneCells() { - if (getBean() != null) { - List<Cell> cells = getFisheryRegion().getCell(); - TopiaEntityListModel model = new TopiaEntityListModel(cells); - zoneCells.setModel(model); - if (getBean().getCell() != null) { - for (Cell selectedCell : getBean().getCell()) { - int index = cells.indexOf(selectedCell); - zoneCells.addSelectionInterval(index, index); - } - } - } +@Override +public void setLayer(boolean active) { + super.setLayer(active); + zoneBasicsUI.setLayer(active); + variablesUI.setLayer(active); } -protected void zoneCellsChange(ListSelectionEvent event) { - // sans ca, ca boucle (modification depuis la carte) - if (event.getValueIsAdjusting()) { - // pas a faie dans le cas d'une AS - if (isActive()) { - java.util.List<Cell> cells = new ArrayList<Cell>(); - for (Object o : zoneCells.getSelectedValues()) { - cells.add((Cell) o); - } - getBean().setCell(cells); - } - } +@Override +public void resetChangeModel() { + zoneBasicsUI.resetChangeModel(); + variablesUI.resetChangeModel(); } -]]> - </script> - <JPanel id='body'> - <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="horizontal"> - <Table> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActive()}' text="isisfish.zone.name"/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JTextField id="fieldZoneName" - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}' - enabled='{isActive()}' decorator='boxed' - onKeyReleased='getBean().setName(fieldZoneName.getText())'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActive()}' text="isisfish.zone.cells"/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.7' weightx='1.0'> - <JScrollPane id="spZoneCells"> - <JList id="zoneCells" enabled='{isActive()}' - onValueChanged='zoneCellsChange(event)' decorator='boxed'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal' weightx='1.0'> - <JLabel enabled='{isActive()}' text="isisfish.zone.comments"/> - </cell> - </row> - <row> - <cell columns='2' fill='both' weighty='0.3' weightx='1.0'> - <JScrollPane> - <JTextArea id="fieldZoneComment" - text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}' - enabled='{isActive()}' - decorator='boxed' - onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' - text="isisfish.common.save" - enabled="{validator.isValid() && validator.isChanged()}" - onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' - text="isisfish.common.cancel" - enabled="{validator.isChanged()}" - onActionPerformed="getSaveVerifier().cancel()"/> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed' - text="isisfish.common.new" - enabled="{!validator.isChanged()}" - onActionPerformed="getSaveVerifier().create(Zone.class)"/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed' - text="isisfish.common.remove" - enabled="{!validator.isChanged() && getBean() != null}" - onActionPerformed="getSaveVerifier().delete()"/> - </cell> - </row> - </Table> - <JPanel id='map' layout='{new BorderLayout()}'> - <com.bbn.openmap.gui.ToolPanel id='toolMap' - javaBean='new com.bbn.openmap.gui.ToolPanel()' - decorator='boxed' constraints='BorderLayout.NORTH'/> - <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' - javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' - selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}" - fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()==null?null:bean.getCell()}' - decorator='boxed' constraints='BorderLayout.CENTER'/> - <!-- FIXME echatellier 20110429 : binding --> - </JPanel> - </JSplitPane> + ]]></script> + <JPanel id="body"> + <JTabbedPane constraints='BorderLayout.CENTER' id="zoneTab"> + <tab title='isisfish.zone.title'> + <ZoneBasicsUI id="zoneBasicsUI" bean="{getBean()}" active="{isActive()}" + sensitivity="{isSensitivity()}" constructorParams='this' /> + </tab> + <tab title='isisfish.variables.tabtitle'> + <fr.ifremer.isisfish.ui.input.variable.EntityVariableUI id="variablesUI" + bean="{getBean()}" active="{isActive()}" + sensitivity="{isSensitivity()}" constructorParams='this'/> + </tab> + </JTabbedPane> </JPanel> -</fr.ifremer.isisfish.ui.input.InputContentUI> +</fr.ifremer.isisfish.ui.input.InputContentUI> \ No newline at end of file Modified: trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -50,15 +50,30 @@ /** Zones list */ protected List<? extends TopiaEntity> entities; + public TopiaEntityListModel() { + + } + /** * Constructor with entities list. * * @param entities entities list */ public TopiaEntityListModel(List<? extends TopiaEntity> entities) { + this(); this.entities = entities; } + /** + * Update model entities list. + * + * @param entities entities + */ + public void setEntities(List<? extends TopiaEntity> entities) { + this.entities = entities; + fireContentsChanged(this, 0, entities == null ? 0 : entities.size() - 1); + } + /* * @see javax.swing.ListModel#getElementAt(int) */ Modified: trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/util/ArgTypes.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric + * Copyright (C) 2006 - 2012 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 @@ -34,6 +34,8 @@ * Annotation utilisée pour specifier le type des parametres. * * Pour etre plus explicit que "List" en renseignant "List<Zone>" par exemple. + * + * Doit pouvoir être remplacé par l'introspection java sans problème. * * Created: 4 juil. 2006 12:40:46 * @@ -48,5 +50,3 @@ public @interface ArgTypes { String[] value(); } - - Modified: trunk/src/main/java/fr/ifremer/isisfish/util/Args.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/util/Args.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/util/Args.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric + * Copyright (C) 2006 - 2012 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 @@ -33,6 +33,8 @@ /** * Annotation pour specifier le nom des arguments car il est impossible * de les avoir par introspection. + * Même via paranamer c'est impossible car sur les interfaces les noms + * ne sont pas présent dans le bytecode. * * Created: 4 juil. 2006 12:40:46 * @@ -47,5 +49,3 @@ public @interface Args { String[] value(); } - - Modified: trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric + * Copyright (C) 2006 - 2012 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 @@ -32,6 +32,7 @@ import java.lang.reflect.Method; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; @@ -338,7 +339,6 @@ Args args = interfaceMethod.getAnnotation(Args.class); String[] names = args.value(); - String[] stringTypes = null; ArgTypes argTypes = interfaceMethod.getAnnotation(ArgTypes.class); if (argTypes != null) { @@ -346,6 +346,7 @@ } else { stringTypes = new String[names.length]; Class<?>[] types = interfaceMethod.getParameterTypes(); + System.out.println(Arrays.toString(types)); for (int i = 0; i < types.length; i++) { stringTypes[i] = types[i].getName(); } Modified: trunk/src/main/java/fr/ifremer/isisfish/util/EvaluatorHelper.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/util/EvaluatorHelper.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/java/fr/ifremer/isisfish/util/EvaluatorHelper.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * Copyright (C) 2006 - 2012 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 @@ -40,8 +40,8 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.util.FileUtil; +import fr.ifremer.isisfish.IsisFish; import fr.ifremer.isisfish.IsisFishRuntimeException; -import fr.ifremer.isisfish.IsisFish; /** @@ -232,7 +232,7 @@ Args args = interfaceMethod.getAnnotation(Args.class); String [] names = args.value(); - + String [] stringTypes; ArgTypes argTypes = interfaceMethod.getAnnotation(ArgTypes.class); if (argTypes != null) { Property changes on: trunk/src/main/java/fr/ifremer/isisfish/util/ssh/SSHUtils.java ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/src/main/resources/i18n/isis-fish_en_GB.properties =================================================================== --- trunk/src/main/resources/i18n/isis-fish_en_GB.properties 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/resources/i18n/isis-fish_en_GB.properties 2012-04-03 13:31:36 UTC (rev 3671) @@ -64,7 +64,7 @@ destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite= filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines. -isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2011.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Please, report any bug you can found.<html> +isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2012.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Please, report any bug you can found.<html> isisfish.about.licensetext=You can modify and redistribute the program under the conditions of the GNU General Public License (version 2 or later). A copy of the GPL is in the file "LICENSE.txt" provided with ISIS-Fish. All rights reserved. No guarantees are provided for use of this program. isisfish.about.title=About ISIS-Fish... isisfish.advancedParameters.title=Advanced parameters @@ -967,6 +967,18 @@ isisfish.tripType.name=Name isisfish.ui.script.communityvcs=Community VCS isisfish.ui.script.officialvcs=Official VCS +isisfish.variables.addvariable=Add +isisfish.variables.defaultname=VarName +isisfish.variables.deletevariable=Delete +isisfish.variables.double.value=Real value \: +isisfish.variables.equation.value=Equation \: +isisfish.variables.matrix.value=Matrix \: +isisfish.variables.savevariable=Save +isisfish.variables.tabtitle=Variables +isisfish.variables.variabledetail=Variable details +isisfish.variables.variablename=Variable name \: +isisfish.variables.variableslist=Variables +isisfish.variables.variabletype=Variable type isisfish.vcs.ask.passphrase=Enter your pass phrase (if your private key have one). isisfish.vcs.ask.passphrase.title=Ask your pass phrase isisfish.vcs.commit=vcs.commit @@ -1095,6 +1107,7 @@ isisfish.zone.cells=Zone cells isisfish.zone.comments=Comments isisfish.zone.name=Name +isisfish.zone.title=Zone matrixAbundance= matrixCatchPerStrategyMetPerZoneMet= matrixDiscardsPerStrMetPerZonePop= Modified: trunk/src/main/resources/i18n/isis-fish_fr_FR.properties =================================================================== --- trunk/src/main/resources/i18n/isis-fish_fr_FR.properties 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/resources/i18n/isis-fish_fr_FR.properties 2012-04-03 13:31:36 UTC (rev 3671) @@ -64,7 +64,7 @@ destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite= destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite= filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines. -isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2011.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Merci de rapporter les bugs.<html> +isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2012.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Merci de rapporter les bugs.<html> isisfish.about.licensetext=Vous pouvez modifier et redistribuer ce programme sous les conditions énoncées par la licence GNU GPL (version 2 ou ultérieure). Une copie de la licence GPL est dans le fichier « LICENSE.txt » fourni avec ISIS-Fish. Tous droits réservés. Aucune garantie n'est fournie pour l'utilisation de ce programme. isisfish.about.title=À propos de ISIS-Fish... isisfish.advancedParameters.title=Paramètres avancés @@ -967,6 +967,18 @@ isisfish.tripType.name=Nom isisfish.ui.script.communityvcs=VCS Communauté isisfish.ui.script.officialvcs=VCS Officiel +isisfish.variables.addvariable=Ajouter +isisfish.variables.defaultname=VarName +isisfish.variables.deletevariable=Supprimer +isisfish.variables.double.value=Valeur réelle \: +isisfish.variables.equation.value=Equation +isisfish.variables.matrix.value=Matrice +isisfish.variables.savevariable=Sauver +isisfish.variables.tabtitle=Variables +isisfish.variables.variabledetail=Détail +isisfish.variables.variablename=Nom de la variable \: +isisfish.variables.variableslist=Variables +isisfish.variables.variabletype=Type \: isisfish.vcs.ask.passphrase=Entrez votre passphrase (si votre clef ssh en contient une). isisfish.vcs.ask.passphrase.title=Demande de passe phrase isisfish.vcs.commit=Message de sauvegarde @@ -1095,6 +1107,7 @@ isisfish.zone.cells=Cellules de la zone isisfish.zone.comments=Commentaires isisfish.zone.name=Nom +isisfish.zone.title=Zone matrixAbundance= matrixCatchPerStrategyMetPerZoneMet= matrixDiscardsPerStrMetPerZonePop= Modified: trunk/src/main/resources/sensitivity.properties =================================================================== --- trunk/src/main/resources/sensitivity.properties 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/resources/sensitivity.properties 2012-04-03 13:31:36 UTC (rev 3671) @@ -64,6 +64,9 @@ TargetSpecies.targetFactorEquation TripType.minTimeBetweenTrip TripType.tripDuration +Variable.doubleValue +Variable.equationValue +Variable.matrixValue VesselType.activityRange VesselType.length VesselType.maxTripDuration Modified: trunk/src/main/xmi/isis-fish.properties =================================================================== --- trunk/src/main/xmi/isis-fish.properties 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/main/xmi/isis-fish.properties 2012-04-03 13:31:36 UTC (rev 3671) @@ -5,7 +5,7 @@ # $Id$ # $HeadURL$ # %% -# Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier +# Copyright (C) 1999 - 2012 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,7 +22,7 @@ # <http://www.gnu.org/licenses/gpl-2.0.html>. # #L% ### -model.tagvalue.copyright=/* Copyright (C) 1999 - 2011 Ifremer - Code Lutin */ +model.tagvalue.copyright=/* Copyright (C) 1999 - 2012 Ifremer - Code Lutin */ model.tagvalue.org.nuiton.math.matrix.MatrixND=fr.ifremer.isisfish.types.hibernate.MatrixType(name,dim,dimNames,semantics,data) model.tagvalue.fr.ifremer.isisfish.types.Month=fr.ifremer.isisfish.types.hibernate.MonthType model.tagvalue.fr.ifremer.isisfish.types.TimeStep=fr.ifremer.isisfish.types.hibernate.TimeStepType @@ -31,6 +31,7 @@ model.tagvalue.java.lang.String=text model.tagvalue.hibernateProxyInterface=none model.tagvalue.constantPrefix=PROPERTY_ +model.tagvalue.useEnumerationName=true 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 @@ -52,5 +53,7 @@ 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.Variable.class.tagvalue.contextable=true +fr.ifremer.isisfish.entities.Variable.attribute.entityId.tagvalue.notNull=true fr.ifremer.isisfish.entities.VesselType.class.tagvalue.contextable=true fr.ifremer.isisfish.entities.Zone.class.tagvalue.contextable=true Modified: trunk/src/main/xmi/isis-fish.zargo =================================================================== (Binary files differ) Property changes on: trunk/src/site/resources/images/isis-simulation.png ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/src/test/java/fr/ifremer/isisfish/entity/PersistenceTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java =================================================================== --- trunk/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -129,6 +129,12 @@ // entity part and property part must appear in factors names for (String property : SensitivityUtils.getProperties().stringPropertyNames()) { String entityPart = property.substring(0, property.indexOf('.')); + + if ("Variable".equals(entityPart)) { + // variable added since 4.1 and not yet present in test database + continue; + } + Assert.assertTrue("Entity " + entityPart + " is not present in xml export", xmlExport.indexOf(entityPart) != -1); String propertyPart = property.substring(property.indexOf('.')); Modified: trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java =================================================================== --- trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -44,6 +44,7 @@ import fr.ifremer.isisfish.AbstractIsisFishTest; import fr.ifremer.isisfish.IsisFishDAOHelper; import fr.ifremer.isisfish.datastore.IsisH2Config; +import fr.ifremer.isisfish.entities.VariableDAO; /** * Test for {@link SensitivityUtils} class. @@ -95,6 +96,12 @@ TopiaContext context = testTC.beginTransaction(); for (String factorName : factors.stringPropertyNames()) { String className = factorName.substring(0, factorName.indexOf(".")); + + if ("Variable".equals(className)) { + // test fails with Variable because of contraints integrity + continue; + } + String propertyName = StringUtils.capitalize(factorName.substring(factorName.indexOf(".") + 1)); // Simple method Modified: trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java =================================================================== --- trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/test/java/fr/ifremer/isisfish/util/CompileHelperTest.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -27,6 +27,7 @@ import java.io.File; import java.io.IOException; +import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; @@ -41,6 +42,7 @@ import org.junit.Test; import fr.ifremer.isisfish.AbstractIsisFishTest; +import fr.ifremer.isisfish.equation.PopulationReproductionEquation; /** * CompileHelperTest. @@ -238,4 +240,18 @@ nonUnicodeFile.delete(); }*/ + + /** + * Test que le contenu du fichier java correspondant à l'equation est + * corectement généré. + * Notemment suite à l'utilsation de paranamer et aux retrait des + * annotations. + */ + @Test + public void testExtractDoc() { + String content = CompileHelper.extractDoc("PopulationReproduction", "Test", PopulationReproductionEquation.class); + + Assert.assertTrue(content.contains("N : org.nuiton.math.matrix.MatrixND")); + Assert.assertTrue(content.contains("zones : java.util.List<Zone>")); + } } Modified: trunk/src/test/java/fr/ifremer/isisfish/util/EvaluateHelperTest.java =================================================================== --- trunk/src/test/java/fr/ifremer/isisfish/util/EvaluateHelperTest.java 2012-04-02 12:30:02 UTC (rev 3670) +++ trunk/src/test/java/fr/ifremer/isisfish/util/EvaluateHelperTest.java 2012-04-03 13:31:36 UTC (rev 3671) @@ -25,6 +25,7 @@ package fr.ifremer.isisfish.util; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; @@ -35,6 +36,7 @@ import fr.ifremer.isisfish.equation.EmigrationEquation; import fr.ifremer.isisfish.equation.PopulationGrowth; import fr.ifremer.isisfish.equation.PopulationGrowthReverse; +import fr.ifremer.isisfish.equation.PopulationReproductionEquation; /** * Test class for {@link EvaluatorHelper}. @@ -153,4 +155,21 @@ Assert.assertNotNull(result); Assert.assertEquals("1.0", result.toString()); } + + /** + * Test que le contenu du fichier java correspondant à l'equation est + * corectement généré. + * Notemment suite à l'utilsation de paranamer et aux retrait des + * annotations. + */ + @Test + public void testGenerateContent() { + Class clazz = PopulationReproductionEquation.class; + Method method = clazz.getDeclaredMethods()[0]; + String content = EvaluatorHelper.generateContent("fr.ifremer.isisfish.equation", + "Test", method, "return 42.0;"); + + Assert.assertTrue(content.contains("fr.ifremer.isisfish.simulator.SimulationContext context")); + Assert.assertTrue(content.contains("java.util.List<PopulationGroup> groups")); + } }