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
r1869 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org 24 Feb '09
by sletellier@users.labs.libre-entreprise.org 24 Feb '09
24 Feb '09
Author: sletellier
Date: 2009-02-24 11:45:48 +0000 (Tue, 24 Feb 2009)
New Revision: 1869
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
Log:
Matrix update bug fixed
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-02-24 11:37:24 UTC (rev 1868)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-02-24 11:45:48 UTC (rev 1869)
@@ -77,8 +77,7 @@
@Override
public void matrixChanged(MatrixPanelEvent arg0) {
if (getBean() != null && fieldPopulationCapturability.getMatrix() != null){
- getBean().setCapturability(fieldPopulationCapturability.getMatrix());
- System.out.println(getBean().getCapturability() + " " + fieldPopulationCapturability.getMatrix());
+ getBean().setCapturability(fieldPopulationCapturability.getMatrix().copy());
}
}
};
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2009-02-24 11:37:24 UTC (rev 1868)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2009-02-24 11:45:48 UTC (rev 1869)
@@ -136,7 +136,7 @@
public void matrixChanged(MatrixPanelEvent arg0) {
remove.setEnabled(populationMigrationEmigrationTable.getTable().getSelectedRow() != -1);
if (popInfo != null){
- popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix());
+ popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix().copy());
}
}
});
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-02-24 11:37:24 UTC (rev 1868)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-02-24 11:45:48 UTC (rev 1869)
@@ -100,7 +100,7 @@
@Override
public void matrixChanged(MatrixPanelEvent arg0) {
if (getPopInfo() != null){
- getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix());
+ getPopInfo().setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix().copy());
}
}
});
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-02-24 11:37:24 UTC (rev 1868)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-02-24 11:45:48 UTC (rev 1869)
@@ -100,7 +100,7 @@
@Override
public void matrixChanged(MatrixPanelEvent arg0) {
if (getPopInfo() != null){
- getPopInfo().setMigrationMatrix(populationMigrationMigrationTable.getMatrix());
+ getPopInfo().setMigrationMatrix(populationMigrationMigrationTable.getMatrix().copy());
}
}
};
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-02-24 11:37:24 UTC (rev 1868)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-02-24 11:45:48 UTC (rev 1869)
@@ -67,7 +67,7 @@
public void matrixChanged(MatrixPanelEvent arg0) {
if (getBean() != null){
if (fieldPopulationRecruitmentDistribution.getMatrix() != null){
- getBean().setRecruitmentDistribution(fieldPopulationRecruitmentDistribution.getMatrix());
+ getBean().setRecruitmentDistribution(fieldPopulationRecruitmentDistribution.getMatrix().copy());
}
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-02-24 11:37:24 UTC (rev 1868)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-02-24 11:45:48 UTC (rev 1869)
@@ -82,7 +82,7 @@
fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener);
}
protected void fieldPopulationMappingZoneReproZoneRecruChanged(){
- getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix());
+ getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix().copy());
}
protected void setFieldPopulationMappingZoneReproZoneRecru(){
if (getBean() != null){
1
0
Author: tchemit
Date: 2009-02-24 11:37:24 +0000 (Tue, 24 Feb 2009)
New Revision: 1868
Modified:
isis-fish/trunk/pom.xml
Log:
passage en jaxx 1.2-SNAPSHOT
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-02-24 11:34:08 UTC (rev 1867)
+++ isis-fish/trunk/pom.xml 2009-02-24 11:37:24 UTC (rev 1868)
@@ -345,7 +345,7 @@
<labs.project>isis-fish</labs.project>
<!-- Custom version -->
- <jaxx.version>1.1</jaxx.version>
+ <jaxx.version>1.2-SNAPSHOT</jaxx.version>
<topia.version>2.1.3</topia.version>
<topia.service.version>1.0.2</topia.service.version>
<lutinmatrix.version>1.2</lutinmatrix.version>
@@ -435,6 +435,10 @@
<goal>generate</goal>
</goals>
<configuration>
+ <extraImports>
+ <value>jaxx.runtime.SwingUtil</value>
+ <value>static jaxx.runtime.Util.getStringValue</value>
+ </extraImports>
<addSourcesToClassPath>true</addSourcesToClassPath>
<addProjectClassPath>true</addProjectClassPath>
</configuration>
1
0
r1867 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org 24 Feb '09
by sletellier@users.labs.libre-entreprise.org 24 Feb '09
24 Feb '09
Author: sletellier
Date: 2009-02-24 11:34:08 +0000 (Tue, 24 Feb 2009)
New Revision: 1867
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
Log:
Debug final
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-02-24 10:57:50 UTC (rev 1866)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-02-24 11:34:08 UTC (rev 1867)
@@ -55,33 +55,22 @@
protected Interval interval = null;
protected IntervalPanel ip = new IntervalPanel();
displayMetierSeason.add(ip, BorderLayout.CENTER);
- ip.addPropertyChangeListener("first", new PropertyChangeListener() {
+ ip.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- // Data extraction
- Season season = (Season) fieldMetierSeasonChoice.getSelectedItem();
- if (season != null){
- Month first = season.getFirstMonth();
- first.setMonthNumber(ip.getModel().getFirst());
- season.setFirstMonth(first);
- }
- }
- });
- ip.addPropertyChangeListener("last", new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
// Data extraction
Season season = (Season) fieldMetierSeasonChoice.getSelectedItem();
if (season != null){
+ Month first = season.getFirstMonth();
+ first.setMonthNumber(ip.getModel().getFirst());
+ getMetierSeasonInfo().setFirstMonth(first);
Month last = season.getLastMonth();
last.setMonthNumber(ip.getModel().getLast());
- season.setLastMonth(last);
+ getMetierSeasonInfo().setLastMonth(last);
}
}
});
-
create.addActionListener(new ActionListener() {
@Override
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-02-24 10:57:50 UTC (rev 1866)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-02-24 11:34:08 UTC (rev 1867)
@@ -43,17 +43,8 @@
import org.codelutin.math.matrix.gui.MatrixPanelEvent;
import org.codelutin.math.matrix.gui.MatrixPanelListener;
-MatrixPanelListener listener = new MatrixPanelListener() {
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- if (getBean() != null){
- if (fieldPopulationCapturability.getMatrix() != null){
- getBean().setCapturability(fieldPopulationCapturability.getMatrix());
- }
- }
- }
-};
+MatrixPanelListener listener = null;
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
@@ -81,6 +72,16 @@
fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy());
}
}
+ listener = new MatrixPanelListener() {
+
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ if (getBean() != null && fieldPopulationCapturability.getMatrix() != null){
+ getBean().setCapturability(fieldPopulationCapturability.getMatrix());
+ System.out.println(getBean().getCapturability() + " " + fieldPopulationCapturability.getMatrix());
+ }
+ }
+ };
fieldPopulationCapturability.addMatrixListener(listener);
}
]]>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-02-24 10:57:50 UTC (rev 1866)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-02-24 11:34:08 UTC (rev 1867)
@@ -52,7 +52,7 @@
protected IntervalPanel ip = new IntervalPanel();
protected Interval interval = new Interval();
fieldPopulationSeasonInterval.add(ip, BorderLayout.CENTER);
-ip.addPropertyChangeListener("first", new PropertyChangeListener() {
+ip.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -60,15 +60,6 @@
Month first = getPopulationSeasonInfo().getFirstMonth();
first.setMonthNumber(ip.getModel().getFirst());
getPopulationSeasonInfo().setFirstMonth(first);
- }
- }
-});
-
- ip.addPropertyChangeListener("last", new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (getPopulationSeasonInfo() != null){
Month last = getPopulationSeasonInfo().getLastMonth();
last.setMonthNumber(ip.getModel().getLast());
getPopulationSeasonInfo().setLastMonth(last);
@@ -163,12 +154,14 @@
}
}
protected void seasonGroupChanged(){
- if (getPopulationSeasonInfo() == null){
+ if (getPopulationSeasonInfo() != null){
getPopulationSeasonInfo().setGroupChange(fieldPopulationSeasonGroupChange.isSelected());
+ System.out.println("getPopulationSeasonInfo() : " + getPopulationSeasonInfo());
}
}
protected void seasonChanged(){
setPopulationSeasonInfo((PopulationSeasonInfoImpl)fieldPopulationSeasonInfoChooser.getSelectedItem());
+ System.out.println("getPopulationSeasonInfo() : " + getPopulationSeasonInfo());
getVerifier().addCurrentEntity(getPopulationSeasonInfo());
setPopSeasonInfoNotNull(getPopulationSeasonInfo() != null);
setInterval();
1
0
r1866 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors
by chatellier@users.labs.libre-entreprise.org 24 Feb '09
by chatellier@users.labs.libre-entreprise.org 24 Feb '09
24 Feb '09
Author: chatellier
Date: 2009-02-24 10:57:50 +0000 (Tue, 24 Feb 2009)
New Revision: 1866
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java
Log:
Update factors classes.
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java 2009-02-24 10:33:31 UTC (rev 1865)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java 2009-02-24 10:57:50 UTC (rev 1866)
@@ -66,6 +66,34 @@
}
/**
+ * @return the minBound
+ */
+ public E getMinBound() {
+ return minBound;
+ }
+
+ /**
+ * @param minBound the minBound to set
+ */
+ public void setMinBound(E minBound) {
+ this.minBound = minBound;
+ }
+
+ /**
+ * @return the maxBound
+ */
+ public E getMaxBound() {
+ return maxBound;
+ }
+
+ /**
+ * @param maxBound the maxBound to set
+ */
+ public void setMaxBound(E maxBound) {
+ this.maxBound = maxBound;
+ }
+
+ /**
* {@inheritDoc}.
*
* In continuous domain, just return identifier
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java 2009-02-24 10:33:31 UTC (rev 1865)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java 2009-02-24 10:57:50 UTC (rev 1866)
@@ -20,6 +20,7 @@
import java.io.Serializable;
import java.util.SortedMap;
+import java.util.TreeMap;
import org.apache.commons.lang.builder.ToStringBuilder;
@@ -52,7 +53,7 @@
* Contructor.
*/
public DiscreteDomain() {
-
+ values = new TreeMap<Serializable, E>();
}
/**
1
0
r1865 - isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors
by chatellier@users.labs.libre-entreprise.org 24 Feb '09
by chatellier@users.labs.libre-entreprise.org 24 Feb '09
24 Feb '09
Author: chatellier
Date: 2009-02-24 10:33:31 +0000 (Tue, 24 Feb 2009)
New Revision: 1865
Modified:
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java
Log:
Update factors tests
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java 2009-02-24 09:59:44 UTC (rev 1864)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java 2009-02-24 10:33:31 UTC (rev 1865)
@@ -22,9 +22,9 @@
import org.apache.commons.logging.LogFactory;
import org.codelutin.math.matrix.MatrixFactory;
import org.codelutin.math.matrix.MatrixND;
+import org.junit.Assert;
import org.junit.Test;
-
/**
* Factors test.
*
@@ -38,27 +38,28 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
private static Log log = LogFactory.getLog(FactorTest.class);
-
+
/**
* Test to build new factors with int values.
*/
@Test
public void testIntFactor() {
-
+
Factor<Integer> factor = new Factor<Integer>("testint");
- factor.getDomain().put("i1", 0);
- factor.getDomain().put("i2", 1);
- factor.getDomain().put("i3", 2);
- factor.getDomain().put("i4", 3);
- factor.getDomain().put("i5", 4);
+ ContinuousDomain<Integer> domain = new ContinuousDomain<Integer>();
+ domain.setMinBound(0);
+ domain.setMaxBound(50);
+ factor.setDomain(domain);
factor.setPath("org.codelutin.factor#1234567890#0.12242345354#name");
- factor.setValueLabel("i3");
-
+ factor.setValueForIdentifier(49);
+
+ Assert.assertEquals((Integer) 49, factor.getValue());
+
if (log.isInfoEnabled()) {
log.info("factor#toString() = " + factor);
}
}
-
+
/**
* Test factor with matrix.
*
@@ -66,32 +67,47 @@
*/
@Test
public void testMatrixFactor() {
-
+
// matrix 1
- MatrixND matrix1 = MatrixFactory.getInstance().create("test1", new int[] {3,2}, new String[]{"col1", "col2"});
- matrix1.setValue(new int[]{0,0}, 13);
- matrix1.setValue(new int[]{0,1}, -14);
- matrix1.setValue(new int[]{1,0}, 21);
- matrix1.setValue(new int[]{1,1}, 2);
- matrix1.setValue(new int[]{2,0}, 12);
- matrix1.setValue(new int[]{2,1}, -1);
-
+ MatrixND matrix1 = MatrixFactory.getInstance().create("test1",
+ new int[] { 3, 2 }, new String[] { "col1", "col2" });
+ matrix1.setValue(new int[] { 0, 0 }, 13);
+ matrix1.setValue(new int[] { 0, 1 }, -14);
+ matrix1.setValue(new int[] { 1, 0 }, 21);
+ matrix1.setValue(new int[] { 1, 1 }, 2);
+ matrix1.setValue(new int[] { 2, 0 }, 12);
+ matrix1.setValue(new int[] { 2, 1 }, -1);
+
// matrix 2
- MatrixND matrix2 = MatrixFactory.getInstance().create("test2", new int[] {2,3}, new String[]{"col1", "col2"});
- matrix2.setValue(new int[]{0,0}, 9999);
- matrix2.setValue(new int[]{0,1}, 15000);
- matrix2.setValue(new int[]{0,2}, -40000);
- matrix2.setValue(new int[]{1,0}, 21345);
- matrix2.setValue(new int[]{1,1}, 81000);
- matrix2.setValue(new int[]{1,2}, -13000);
-
+ MatrixND matrix2 = MatrixFactory.getInstance().create("test2",
+ new int[] { 2, 3 }, new String[] { "col1", "col2" });
+ matrix2.setValue(new int[] { 0, 0 }, 9999);
+ matrix2.setValue(new int[] { 0, 1 }, 15000);
+ matrix2.setValue(new int[] { 0, 2 }, -40000);
+ matrix2.setValue(new int[] { 1, 0 }, 21345);
+ matrix2.setValue(new int[] { 1, 1 }, 81000);
+ matrix2.setValue(new int[] { 1, 2 }, -13000);
+
// factor
Factor<MatrixND> factor = new Factor<MatrixND>("testmatrix");
- factor.getDomain().put("m1", matrix1);
- factor.getDomain().put("m2", matrix2);
+ DiscreteDomain<MatrixND> domain = new DiscreteDomain<MatrixND>();
+ domain.getValues().put("m1", matrix1);
+ domain.getValues().put("m2", matrix2);
+ factor.setDomain(domain);
factor.setPath("org.codelutin.math.matrix.MatrixND#563456293453#2.456347646#dim");
- factor.setValueLabel("m2");
-
+ factor.setValueForIdentifier("m2");
+
+ Assert.assertEquals(matrix2, factor.getValue());
+
+ try {
+ factor.setValueForIdentifier("blah blah");
+ Assert.fail("Can't set identifier not present in domain");
+ } catch (IllegalArgumentException e) {
+ if (log.isInfoEnabled()) {
+ log.info("Exception normally thrown");
+ }
+ }
+
if (log.isInfoEnabled()) {
log.info("factor#toString() = " + factor);
}
1
0
r1864 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors
by chatellier@users.labs.libre-entreprise.org 24 Feb '09
by chatellier@users.labs.libre-entreprise.org 24 Feb '09
24 Feb '09
Author: chatellier
Date: 2009-02-24 09:59:44 +0000 (Tue, 24 Feb 2009)
New Revision: 1864
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Domain.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityScenarios.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java
Log:
Update factors classes.
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/ContinuousDomain.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -0,0 +1,90 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.factors;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * Domaine continu.
+ *
+ * Composé d'un borne min et max.
+ *
+ * @param <E> type des valeurs gérées par le domaine
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 24 févr. 2009 $
+ * By : $Author: chatellier $
+ */
+public class ContinuousDomain<E extends Serializable> implements Domain<E> {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -2037768174807839046L;
+
+ /** Borne inférieure */
+ protected E minBound;
+
+ /** Borne supérieure */
+ protected E maxBound;
+
+ /**
+ * Empty constructor.
+ */
+ public ContinuousDomain() {
+
+ }
+
+ /**
+ * Constructor with bounds.
+ *
+ * @param minBound min bound
+ * @param maxBound max bound
+ */
+ public ContinuousDomain(E minBound, E maxBound) {
+ this();
+ this.minBound = minBound;
+ this.maxBound = maxBound;
+ }
+
+ /**
+ * {@inheritDoc}.
+ *
+ * In continuous domain, just return identifier
+ */
+ public E getValueForIdentifier(Serializable identifier) {
+ // FIXME test cast
+ return (E)identifier;
+ }
+
+ /*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ ToStringBuilder builder = new ToStringBuilder(this);
+ builder.append(minBound);
+ builder.append(minBound);
+
+ return builder.toString();
+ }
+}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java 2009-02-23 23:14:43 UTC (rev 1863)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -22,13 +22,10 @@
import java.util.List;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
/**
* Design plan contenant toutes les
* valeur de facteur possible.
- *
- * @param <E> type des valeurs gérées par le plan
*
* @author chatellier
* @version $Revision: 1.0 $
@@ -36,13 +33,13 @@
* Last update : $Date: 19 févr. 2009 $
* By : $Author: chatellier $
*/
-public class DesignPlan<E extends Serializable> implements Serializable {
+public class DesignPlan implements Serializable {
/** serialVersionUID. */
private static final long serialVersionUID = 977975461743758075L;
/** Liste des facteurs a utiliser */
- protected List<Factor<E>> factors;
+ protected List<Factor<? extends Serializable>> factors;
/**
* Constructor.
@@ -56,7 +53,7 @@
*
* @return factors list
*/
- public List<Factor<E>> getFactors() {
+ public List<Factor<? extends Serializable>> getFactors() {
return factors;
}
@@ -65,7 +62,7 @@
*
* @param factors the factors list to set
*/
- public void setFactors(List<Factor<E>> factors) {
+ public void setFactors(List<Factor<? extends Serializable>> factors) {
this.factors = factors;
}
@@ -75,7 +72,7 @@
@Override
public String toString() {
- ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ ToStringBuilder builder = new ToStringBuilder(this);
builder.append(factors);
return builder.toString();
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DiscreteDomain.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -0,0 +1,101 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.factors;
+
+import java.io.Serializable;
+import java.util.SortedMap;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * Domain discret.
+ *
+ * Ensemble de valeurs.
+ *
+ * @param <E> type des valeurs gérées par le domaine
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 24 févr. 2009 $
+ * By : $Author: chatellier $
+ */
+public class DiscreteDomain<E extends Serializable> implements Domain<E> {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -192647757737396585L;
+
+ /**
+ * Value for this domain.
+ *
+ * Each "E" values is identified by a Serializable identifier.
+ */
+ protected SortedMap<Serializable, E> values;
+
+ /**
+ * Contructor.
+ */
+ public DiscreteDomain() {
+
+ }
+
+ /**
+ * Get domaine values.
+ *
+ * @return the values
+ */
+ public SortedMap<Serializable, E> getValues() {
+ return values;
+ }
+
+ /**
+ * Set domain values.
+ *
+ * @param values the values
+ */
+ public void setValues(SortedMap<Serializable, E> values) {
+ this.values = values;
+ }
+
+ /**
+ * {@inheritDoc}.
+ *
+ * @throws IllegalArgumentException if identifier is not a valid key
+ */
+ public E getValueForIdentifier(Serializable identifier) throws IllegalArgumentException{
+
+ if( values == null || !values.containsKey(identifier)) {
+ throw new IllegalArgumentException("Can't get value for identifier " + identifier);
+ }
+
+ return values.get(identifier);
+ }
+
+ /*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ ToStringBuilder builder = new ToStringBuilder(this);
+ builder.append(values);
+
+ return builder.toString();
+ }
+}
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Domain.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Domain.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Domain.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -0,0 +1,53 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.factors;
+
+import java.io.Serializable;
+
+/**
+ * Domaine du facteur.
+ *
+ * Ensemble des valeurs possibles a prendre en compte.
+ * La clé est un label qui permet d'identifier la valeur.
+ *
+ * Le domain peut etre :
+ * - discret : i.e un ensemble de valeurs
+ * - continu : i.e, une borne min, max
+ *
+ * @param <E> type des valeurs gérées par le domaine
+ *
+ * @see DiscreteDomain
+ * @see ContinuousDomain
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 24 févr. 2009 $
+ * By : $Author: chatellier $
+ */
+public interface Domain<E extends Serializable> extends Serializable {
+
+ /**
+ * Return value associated to identifier.
+ *
+ * @param identifier
+ * @return found value or <tt>null</tt> if not found
+ */
+ E getValueForIdentifier(Serializable identifier);
+}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java 2009-02-23 23:14:43 UTC (rev 1863)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -19,11 +19,8 @@
package fr.ifremer.isisfish.simulator.factors;
import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
/**
* Facteur de variation des parametres de simulation.
@@ -50,7 +47,7 @@
protected String name;
/**
- * Domain du facteur.
+ * Domaine du facteur.
*
* Ensemble des valeurs possibles a prendre en compte.
* La clé est un label qui permet d'identifier la valeur.
@@ -58,20 +55,16 @@
* Le domain peut etre :
* - discret : i.e un ensemble de valeurs
* - continu : i.e, une borne min, max
- *
- * FIXME min et max pour un domain continu ?
- * FIXME domain.size() = 2 ?
+ *
+ * @see ContinuousDomain
+ * @see DiscreteDomain
*/
- protected Map<String, E> domain;
+ protected Domain<E> domain;
/**
- * Label de la valeur par defaut.
- *
- * Utilisation différente suivant le cas :
- * - avant envoie vers R : valeur par défaut
- * - apres, valeur a prendre en compte
+ * Factor value.
*/
- protected String valueLabel;
+ protected E value;
/**
* Path permettant d'identifier l'objet et
@@ -91,8 +84,7 @@
* Protected, name is mandatory.
*/
protected Factor() {
- // impl must be Serializable
- domain = new HashMap<String, E>();
+
}
/**
@@ -128,7 +120,7 @@
*
* @return the domain
*/
- public Map<String, E> getDomain() {
+ public Domain<E> getDomain() {
return domain;
}
@@ -137,27 +129,36 @@
*
* @param domain the domain to set
*/
- public void setDomain(Map<String, E> domain) {
+ public void setDomain(Domain<E> domain) {
this.domain = domain;
}
/**
- * Get value label.
+ * Get value.
*
- * @return the valueLabel
+ * @return the value
*/
- public String getValueLabel() {
- return valueLabel;
+ public E getValue() {
+ return value;
}
/**
- * Set value label.
+ * Set value.
*
- * @param valueLabel the valueLabel to set
+ * @param value new value
*/
- public void setValueLabel(String valueLabel) {
- this.valueLabel = valueLabel;
+ public void setValue(E value) {
+ this.value = value;
}
+
+ /**
+ * Set value for label.
+ *
+ * @param valueIdentifier new value identifier to get
+ */
+ public void setValueForIdentifier(Serializable valueIdentifier) {
+ value = domain.getValueForIdentifier(valueIdentifier);
+ }
/**
* Get path.
@@ -183,10 +184,10 @@
@Override
public String toString() {
- ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ ToStringBuilder builder = new ToStringBuilder(this);
builder.append(name);
builder.append(domain);
- builder.append(valueLabel);
+ builder.append(value);
builder.append(path);
return builder.toString();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java 2009-02-23 23:14:43 UTC (rev 1863)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -20,15 +20,11 @@
import java.io.Serializable;
import java.util.List;
-import java.util.Map;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
/**
* Scenario d'execution de simulation.
- *
- * @param <E> type des valeurs gérées par le scenario
*
* @author chatellier
* @version $Revision: 1.0 $
@@ -36,20 +32,17 @@
* Last update : $Date: 19 févr. 2009 $
* By : $Author: chatellier $
*/
-public class Scenario<E extends Serializable> implements Serializable {
+public class Scenario implements Serializable {
/** serialVersionUID. */
private static final long serialVersionUID = 4953721873692486687L;
/**
- * Ensemble des simulations a executer.
+ * Ensemble des factors a prendre en compte.
*
- * Chaque simulation a un nom, et une liste de facteur.
- *
- * Chaque facteur a la {@link fr.ifremer.isisfish.simulator.factors.Factor#valueLabel}
- * a prendre en compte pour la simulation.
+ * Chaque facteur a la {@link Factor#value} a prendre en compte pour la simulation.
*/
- protected Map<String, List<Factor<E>>> simulationsFactors;
+ protected List<Factor<? extends Serializable>> factors;
/**
* Constructeur.
@@ -63,17 +56,17 @@
*
* @return the simulations
*/
- public Map<String, List<Factor<E>>> getSimulationsFactors() {
- return simulationsFactors;
+ public List<Factor<? extends Serializable>> getFactors() {
+ return factors;
}
/**
* Set simulation factors.
*
- * @param simulationsFactors the simulations factors to set
+ * @param factors the simulations factors to set
*/
- public void setSimulationsFactors(Map<String, List<Factor<E>>> simulationsFactors) {
- this.simulationsFactors = simulationsFactors;
+ public void setSimulationsFactors(List<Factor<? extends Serializable>> factors) {
+ this.factors = factors;
}
/*
@@ -82,8 +75,8 @@
@Override
public String toString() {
- ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
- builder.append(simulationsFactors);
+ ToStringBuilder builder = new ToStringBuilder(this);
+ builder.append(factors);
return builder.toString();
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java 2009-02-23 23:14:43 UTC (rev 1863)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -18,11 +18,14 @@
package fr.ifremer.isisfish.simulator.factors;
-import java.io.Serializable;
-
/**
- * Interface vers le calculateur statistique.
+ * Interface commune à toutes implémentation
+ * de calcul de sensibilité.
*
+ * Les implémentations peuvent contenir des paramètres
+ * nommé "param_xx" (pour le paramètre xx) qui
+ * seront injecté par Isis.
+ *
* @author chatellier
* @version $Revision: 1.0 $
*
@@ -33,22 +36,27 @@
/**
* Envoi un plan a faire analyser par l'outils
- * statistique.
-
+ * d'analyse de sensibilité.
+ *
+ * Retourne un {@link SensitivityScenarios} qui
+ * représente l'ensemble des scenarios à prendre
+ * en compte pour les simulations.
+ *
* @param plan plan a analyser
- * @param <E> type des données du scenario et du plan
*
- * @return un Scenario
+ * @return un {@link SensitivityScenarios}
+ *
* @see DesignPlan
* @see Scenario
+ * @see SensitivityScenarios
*/
- <E extends Serializable> Scenario<E> getScenario(DesignPlan<E> plan);
+ SensitivityScenarios compute(DesignPlan plan);
/**
- * Ajoute un paramètre pour l'outils statistique.
+ * Permet de renvoyer les resultats de simulations
+ * à l'outils de d'analyse de sensibilité.
*
- * @param key nom du parametre
- * @param value valeur du parametre
+ * @param sensitivityScenarios résultats de scenarios
*/
- void setParameter(String key, String value);
+ void analyzeResult(SensitivityScenarios sensitivityScenarios);
}
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityScenarios.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityScenarios.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityScenarios.java 2009-02-24 09:59:44 UTC (rev 1864)
@@ -0,0 +1,80 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.factors;
+
+import java.util.List;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * Ensemble de {@link Scenario}.
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 24 févr. 2009 $
+ * By : $Author: chatellier $
+ */
+public class SensitivityScenarios {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 4953721873692486687L;
+
+ /**
+ * Ensemble des scenarios.
+ */
+ protected List<Scenario> scenarios;
+
+ /**
+ * Constructeur.
+ */
+ public SensitivityScenarios() {
+
+ }
+
+ /**
+ * Get scenarios.
+ *
+ * @return the scenarios
+ */
+ public List<Scenario> getScenarios() {
+ return scenarios;
+ }
+
+ /**
+ * Set scenarios.
+ *
+ * @param scenarios the scenarios
+ */
+ public void setScenarios(List<Scenario> scenarios) {
+ this.scenarios = scenarios;
+ }
+
+ /*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ ToStringBuilder builder = new ToStringBuilder(this);
+ builder.append(scenarios);
+
+ return builder.toString();
+ }
+}
1
0
r1863 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org 23 Feb '09
by sletellier@users.labs.libre-entreprise.org 23 Feb '09
23 Feb '09
Author: sletellier
Date: 2009-02-23 23:14:43 +0000 (Mon, 23 Feb 2009)
New Revision: 1863
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx
Log:
Debug final
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -89,9 +89,11 @@
@Override
public boolean onMouseClicked() {
for (Cell c : cellMap.getSelectedCells()){
- if (!c.getTopiaId().equals(getBean().getTopiaId())){
- jaxx.runtime.swing.Utils.fillComboBox(fieldCell,getRegion().getCell(), c);
- return true;
+ if (getBean() != null){
+ if (!c.getTopiaId().equals(getBean().getTopiaId())){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldCell,getRegion().getCell(), c);
+ return true;
+ }
}
}
return true;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -150,7 +150,7 @@
<JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionFishingOperationDuration" text='{getEffortDescription().getFishingOperationDuration() == null ? "" : getEffortDescription().getFishingOperationDuration().getHour()}' onKeyReleased='getEffortDescription().setFishingOperationDuration(new TimeUnit(Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionFishingOperationDuration" text='{getEffortDescription().getFishingOperationDuration() == null ? "" : getEffortDescription().getFishingOperationDuration().getHour()}' onKeyReleased='getEffortDescription().setFishingOperationDuration(new TimeUnit(3600 * Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' enabled='{isActif()}'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -44,7 +44,8 @@
import org.codelutin.topia.TopiaException;
import jaxx.runtime.swing.navigation.NavigationTreeModel;
import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
-
+import fr.ifremer.isisfish.types.RangeOfValues;
+boolean init = false;
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -75,10 +76,18 @@
values.add(value);
if (getBean() != null){
if (values != null){
- jaxx.runtime.swing.Utils.fillComboBox(fieldGearParamType, values, getBean().getParameterName(), true);
+ init = true;
+ jaxx.runtime.swing.Utils.fillComboBox(fieldGearParamType, values, getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getType(), true);
+ init = false;
}
}
}
+protected void paramChanged(){
+ if (fieldGearParamType.getSelectedItem() != null){
+ if (!init)
+ getBean().setPossibleValue(new RangeOfValues(fieldGearParamType.getSelectedItem().toString().concat("[" + fieldGearParamPossibleValue.getText() + "]")));
+ }
+}
]]>
</script>
<Table id='body'>
@@ -122,10 +131,10 @@
<JLabel text="isisfish.gear.rangeValues" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldGearParamType" onActionPerformed='getBean().setParameterName(fieldGearParamName.getSelectedText())' enabled='{isActif()}'/>
+ <JComboBox id="fieldGearParamType" onActionPerformed='paramChanged()' enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldGearParamPossibleValue" text='{getBean().getPossibleValue() == null ? null : getBean().getPossibleValue().getValues()}' onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearParamPossibleValue.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldGearParamPossibleValue" text='{getBean().getPossibleValue() == null ? "" : getBean().getPossibleValue().getValues()}' onKeyReleased='paramChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -50,6 +50,7 @@
import java.lang.reflect.Method;
import org.apache.commons.beanutils.MethodUtils;
import org.codelutin.topia.persistence.TopiaEntity;
+import org.codelutin.topia.TopiaContext;
import fr.ifremer.isisfish.entities.EquationDAO;
import fr.ifremer.isisfish.IsisFishDAOHelper;
import jaxx.runtime.swing.Item;
@@ -78,6 +79,7 @@
if (evt.getNewValue() != null) {
// add binding on getBean()
//jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ setComboModel();
}
}
});
@@ -101,6 +103,7 @@
}
};
}
+ setComboModel();
editor.getCurrentEditor().addDocumentListener(listener);
}
public void init(String lblText, TopiaEntity bean, String name, String methodGet, String methodSet, Class c){
@@ -155,7 +158,14 @@
editor.getCurrentEditor().addDocumentListener(listener);
}
protected void setComboModel(){
- java.util.List<Formule> formules = getAction().getFormules(getVerifier().getIsisContext(), name);
+ TopiaContext isisContext = getVerifier().getIsisContext();
+ if (isisContext == null && getBean() != null){
+ isisContext = getBean().getTopiaContext();
+ }
+ java.util.List<Formule> formules = null;
+ if (name != null){
+ formules = getAction().getFormules(isisContext, name);
+ }
if (formules != null){
java.util.List<Item> items = new ArrayList<Item>();
items.add(new Item("null", " ", null, false));
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-02-23 23:14:43 UTC (rev 1863)
@@ -154,9 +154,9 @@
boolean doDelete;
ArrayList<TopiaEntity> allWillBeRemoved = new ArrayList<TopiaEntity>();
for (TopiaEntity te : currentEntities){
- if (te.getComposite() != null){
- allWillBeRemoved.addAll(te.getComposite());
- }
+// if (te.getComposite() != null){
+// allWillBeRemoved.addAll(te.getComposite());
+// }
allWillBeRemoved.add(te);
}
if (allWillBeRemoved.size() > 0) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -217,16 +217,16 @@
<JMenuItem text="isisfish.input.menu.importRenameRegion" onActionPerformed="importRegionAndRename()" accelerator="accNew"/>
<JMenuItem text="isisfish.input.menu.importRegionV2" onActionPerformed="importV2Region()" accelerator="accNew"/>
<JMenuItem text="isisfish.input.menu.importRegionSimulation" onActionPerformed="importRegionFromSimulation()" accelerator="accImportFromSimulation"/>
- <JMenuItem text="isisfish.input.menu.exportRegion" onActionPerformed="exportRegion()" accelerator="accExport"/>
- <JMenuItem text="isisfish.input.menu.copyRegion" onActionPerformed="copyRegion()" accelerator="accExport"/>
+ <JMenuItem text="isisfish.input.menu.exportRegion" enabled='{getRegion() != null}' onActionPerformed="exportRegion()" accelerator="accExport"/>
+ <JMenuItem text="isisfish.input.menu.copyRegion" enabled='{getRegion() != null}' onActionPerformed="copyRegion()" accelerator="accExport"/>
<JSeparator/>
- <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocaly" onActionPerformed="removeRegion()" accelerator="accRemove"/>
+ <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocaly" enabled='{getRegion() != null}' onActionPerformed="removeRegion()" accelerator="accRemove"/>
</JMenu>
<JMenu text="isisfish.input.menu.server">
- <JMenuItem text="isisfish.input.menu.addRegion" onActionPerformed="commitRegionInCVS()" accelerator="accAdd"/>
- <JMenuItem text="isisfish.input.menu.commit" onActionPerformed="commitRegionInCVS()" accelerator="accCommitVCS"/>
+ <JMenuItem text="isisfish.input.menu.addRegion" enabled='{getRegion() != null}' onActionPerformed="commitRegionInCVS()" accelerator="accAdd"/>
+ <JMenuItem text="isisfish.input.menu.commit" enabled='{getRegion() != null}' onActionPerformed="commitRegionInCVS()" accelerator="accCommitVCS"/>
<JSeparator/>
- <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocalyRemotely" onActionPerformed="removeRegion()" accelerator="accRemove"/>
+ <JMenuItem name="miRemove" text="isisfish.input.menu.removeLocalyRemotely" enabled='{getRegion() != null}' onActionPerformed="removeRegion()" accelerator="accRemove"/>
</JMenu>
<!--JMenu text="isisfish.input.menu.help">
<JMenuItem name="miAbout" text="isisfish.input.menu.about" onActionPerformed="about()" accelerator="accAbout"/>
@@ -246,13 +246,11 @@
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
<JComboBox id="fieldCurrentRegion" model='{getFieldCurrentRegionModel()}' onItemStateChanged='regionChange()'/>
- <!--JComboBox id="fieldCurrentRegion" model='{getFieldCurrentRegionModel()}' onActionPerformed='regionChange()'/-->
</cell>
</row>
</Table>
<JPanel id="treePanel" name="treePanel" layout='{new BorderLayout()}'>
<JScrollPane constraints='BorderLayout.CENTER'>
- <!--JTree id="tree" name="tree" model='{getTreeModel()}'/-->
<JTree id="navigation" rootVisible="true" selectionRow='0' model='{new DefaultTreeModel(null)}'/>
</JScrollPane>
</JPanel>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -36,6 +36,8 @@
<!-- bean property -->
<fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/>
+ <Boolean id='metierSeasonSelected' javaBean='false'/>
+ <Boolean id='targetSpeciesSelected' javaBean='false'/>
<script><![CDATA[
import com.l2fprod.common.swing.renderer.BooleanCellRenderer;
@@ -70,6 +72,29 @@
}
});
+tableTargetSpecies.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ remove.setEnabled(tableTargetSpecies.getSelectedRow() != -1);
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ }
+});
public void refresh() {
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
@@ -86,7 +111,7 @@
if (fieldTargetSpecies.getSelectedIndex() <= 0){
setTargetSpeciesModel();
}
-
+ setTableTargetSpeciesModel();
// TODO : Equation selectionne
targetFactor.init(_("isisfish.metierSeasonInfoSpecies.targetFactor"), null, "TargetFactor", null, null, fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class);
}
@@ -95,6 +120,8 @@
fieldMetierSeasonInfo.setModel(seasonModel);
setTargetSpeciesModel();
}
+ remove.setEnabled(false);
+ setAddButton();
}
protected void setSeasonModel(){
DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
@@ -163,7 +190,7 @@
(Species)species,
targetFactor.getEditor().getText(),
fieldPrimaryCatch.isSelected());
- refresh();
+ setTableTargetSpeciesModel();
}
}
protected void remove(){
@@ -176,13 +203,22 @@
if (o != null){
TargetSpecies ts = (TargetSpecies)o;
getAction().removeTargetSpecies(m, ts);
- refresh();
+ setTableTargetSpeciesModel();
}
}
}
protected void metierSeasonChanged(){
- setTableTargetSpeciesModel();
+ setMetierSeasonSelected(fieldMetierSeasonInfo.getSelectedItem() != null);
+ setTargetSpeciesModel();
+ setAddButton();
}
+protected void targetSpeciesChanged(){
+ setTargetSpeciesSelected(fieldTargetSpecies.getSelectedItem() != null);
+ setAddButton();
+}
+protected void setAddButton(){
+ add.setEnabled(getMetierSeasonSelected() && getTargetSpeciesSelected());
+}
]]></script>
<Table id='body'>
<row>
@@ -201,7 +237,7 @@
<JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldTargetSpecies" enabled='{isActif()}'/>
+ <JComboBox id="fieldTargetSpecies" onActionPerformed='targetSpeciesChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -225,7 +261,7 @@
<Table>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonMetierSpeciesAddTargetSpecies" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
+ <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -237,7 +273,7 @@
</row>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonMetierSpeciesRemoveTargetSpecies" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -183,6 +183,13 @@
}
getMetierSeasonInfo().setZone(zones);
}
+ protected void seasonChanged(){
+ setMetierSeasonInfo((MetierSeasonInfoImpl)fieldMetierSeasonChoice.getSelectedItem());
+ getVerifier().addCurrentEntity(getMetierSeasonInfo());
+ setMetierSeasonInfoNotNull(getMetierSeasonInfo() != null);
+ setSeason();
+ setMetierZone();
+ }
]]></script>
<Table id='body'>
<row>
@@ -194,7 +201,7 @@
</cell>
<cell fill='horizontal' weightx='1.0'>
<JComboBox id="fieldMetierSeasonChoice"
- onActionPerformed='setMetierSeasonInfo((MetierSeasonInfoImpl)fieldMetierSeasonChoice.getSelectedItem());getVerifier().addCurrentEntity(getMetierSeasonInfo());setMetierSeasonInfoNotNull(getMetierSeasonInfo() != null);setSeason();setMetierZone();'
+ onActionPerformed='seasonChanged()'
enabled='{isActif()}'/>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -59,6 +59,7 @@
fieldPopulationBasicsNbClasses.setText("");
fieldPopulationBasicsComment.setText("");
fieldPopulationBasicsMatureClass.setSelectedItem(null);
+ tableAgeLength.setModel(new DefaultTableModel());
growthEquation.init(_("isisfish.populationBasics.growth"), null, "Growth", "Growth", "EquationGrowth", fr.ifremer.isisfish.equation.PopulationGrowth.class);
growthReverseEquation.init(_("isisfish.populationBasics.growthReverse"), null, "GrowthReverse", "GrowthReverse", "EquationGrowthReverse", fr.ifremer.isisfish.equation.PopulationGrowthReverse.class);
}
@@ -127,12 +128,6 @@
tableAgeLength.setModel(model);
}
}
-protected String getSizePopulationGroup(){
- if (getBean() != null){
- return String.valueOf(getBean().sizePopulationGroup());
- }
- return "";
-}
protected void create(){
Species species = getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getNavigationPath());
if (species == null){
@@ -174,7 +169,7 @@
<JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldPopulationBasicsNbClasses" text='{getSizePopulationGroup()}' editable="false" enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationBasicsNbClasses" text='{getBean() == null ? "" : getBean().sizePopulationGroup()}' editable="false" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" onActionPerformed='createClasses()' enabled='{isActif()}'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -43,6 +43,18 @@
import org.codelutin.math.matrix.gui.MatrixPanelEvent;
import org.codelutin.math.matrix.gui.MatrixPanelListener;
+MatrixPanelListener listener = new MatrixPanelListener() {
+
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ if (getBean() != null){
+ if (fieldPopulationCapturability.getMatrix() != null){
+ getBean().setCapturability(fieldPopulationCapturability.getMatrix());
+ }
+ }
+ }
+};
+
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -58,21 +70,18 @@
}
});
+
public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
Population population = getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
- fieldPopulationCapturability.addMatrixListener(new MatrixPanelListener() {
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- if (getBean() != null){
- if (fieldPopulationCapturability.getMatrix() != null){
- getBean().setCapturability(fieldPopulationCapturability.getMatrix());
- }
- }
- }
- });
+ if (getBean() != null){
+ if (getBean().getCapturability() != null){
+ fieldPopulationCapturability.setMatrix(getBean().getCapturability().copy());
+ }
+ }
+ fieldPopulationCapturability.addMatrixListener(listener);
}
]]>
</script>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -133,7 +133,7 @@
<JLabel text="isisfish.populationGroup.age" enabled='{isPopGroupNotNull()}'/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupAge" text='{getPopulationGroup().getAge()}' enabled='{isPopGroupNotNull()}'/>
+ <JTextField id="fieldPopulationGroupAge" text='{getPopulationGroup().getAge()}' onKeyReleased='getPopulationGroup().setAge(Double.parseDouble(fieldPopulationGroupAge.getText()))' enabled='{isPopGroupNotNull()}'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -144,21 +144,21 @@
getPopInfo().setImmigrationMatrix(mat);
remove.setEnabled(false);
}
- protected void groupChanged(){
- setGPopSelected(fieldPopulationMigrationImmigrationGroupChooser.getSelectedItem() != null);
- setAddButton();
- }
- protected void coefChanged(){
- setCoefNonVide(!fieldPopulationMigrationImmigrationCoefficient.getText().equals(""));
- setAddButton();
- }
- protected void zoneChanged(){
- setZoneDepartSelected(fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem() != null);
- setAddButton();
- }
- protected void setAddButton(){
- add.setEnabled(getGPopSelected() && getZoneDepartSelected() && getCoefNonVide());
- }
+protected void groupChanged(){
+ setGPopSelected(fieldPopulationMigrationImmigrationGroupChooser.getSelectedItem() != null);
+ setAddButton();
+}
+protected void coefChanged(){
+ setCoefNonVide(!fieldPopulationMigrationImmigrationCoefficient.getText().equals(""));
+ setAddButton();
+}
+protected void zoneChanged(){
+ setZoneDepartSelected(fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem() != null);
+ setAddButton();
+}
+protected void setAddButton(){
+ add.setEnabled(getGPopSelected() && getZoneDepartSelected() && getCoefNonVide());
+}
]]>
</script>
<Table id='body'>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -95,16 +95,15 @@
public void mouseExited(MouseEvent e) {
}
});
+MatrixPanelListener listener = new MatrixPanelListener() {
-populationMigrationMigrationTable.addMatrixListener(new MatrixPanelListener() {
-
@Override
public void matrixChanged(MatrixPanelEvent arg0) {
if (getPopInfo() != null){
getPopInfo().setMigrationMatrix(populationMigrationMigrationTable.getMatrix());
}
}
-});
+};
public void init(PopulationSeasonInfo pi){
setPopInfo((PopulationSeasonInfoImpl)pi);
@@ -117,6 +116,8 @@
setFieldPopulationMigrationMigrationDepartureZoneChooserModel();
setFieldPopulationMigrationMigrationArrivalZoneChooserModel();
+ populationMigrationMigrationTable.addMatrixListener(listener);
+
remove.setEnabled(false);
setAddButton();
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -41,6 +41,8 @@
import fr.ifremer.isisfish.entities.Formule;
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.PopulationImpl;
+import org.codelutin.math.matrix.gui.MatrixPanelEvent;
+import org.codelutin.math.matrix.gui.MatrixPanelListener;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -60,6 +62,17 @@
}
});
+MatrixPanelListener listener = new MatrixPanelListener() {
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ if (getBean() != null){
+ if (fieldPopulationRecruitmentDistribution.getMatrix() != null){
+ getBean().setRecruitmentDistribution(fieldPopulationRecruitmentDistribution.getMatrix());
+ }
+ }
+ }
+};
+
public void refresh() {
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
@@ -68,6 +81,11 @@
reproductionEquation.init(_("isisfish.populationRecruitment.reproductionEquation"), getBean(), "Reproduction", "ReproductionEquation", "EquationReproductionEquation", fr.ifremer.isisfish.equation.PopulationReproductionEquation.class);
getVerifier().addCurrentPanel(reproductionEquation);
+
+ if(getBean() != null && getBean().getRecruitmentDistribution() != null){
+ fieldPopulationRecruitmentDistribution.setMatrix(getBean().getRecruitmentDistribution().copy());
+ }
+ fieldPopulationRecruitmentDistribution.addMatrixListener(listener);
}
]]>
</script>
@@ -93,7 +111,7 @@
<JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActif()}'/>
</cell>
<cell fill='both' weightx='1.0'>
- <JTable/>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationRecruitmentDistribution' matrix='{getBean().getRecruitmentDistribution() == null ? null : getBean().getRecruitmentDistribution().copy()}' enabled='{isActif()}'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -50,6 +50,7 @@
import fr.ifremer.isisfish.ui.widget.IntervalPanel;
protected IntervalPanel ip = new IntervalPanel();
+protected Interval interval = new Interval();
fieldPopulationSeasonInterval.add(ip, BorderLayout.CENTER);
ip.addPropertyChangeListener("first", new PropertyChangeListener() {
@@ -117,13 +118,20 @@
getVerifier().setDeleteButton(remove, false);
Population population = getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
+
// Model instanciation
-
- Interval interval = new Interval();
interval.setMin(0);
interval.setMax(11);
interval.setFirst(0);
interval.setLast(2);
+
+ setInterval();
+
+ ip.setLabelRenderer(Month.MONTH);
+ ip.setModel(interval);
+ setCombo();
+}
+protected void setInterval(){
if(getPopulationSeasonInfo() != null){
try {
log.debug("************** Interval ************");
@@ -148,8 +156,6 @@
// Only trace the error and go on.
}
}
- ip.setLabelRenderer(Month.MONTH);
- ip.setModel(interval);
}
protected void setCombo(){
if (getBean() != null){
@@ -161,6 +167,12 @@
getPopulationSeasonInfo().setGroupChange(fieldPopulationSeasonGroupChange.isSelected());
}
}
+protected void seasonChanged(){
+ setPopulationSeasonInfo((PopulationSeasonInfoImpl)fieldPopulationSeasonInfoChooser.getSelectedItem());
+ getVerifier().addCurrentEntity(getPopulationSeasonInfo());
+ setPopSeasonInfoNotNull(getPopulationSeasonInfo() != null);
+ setInterval();
+}
]]>
</script>
<Table id='body'>
@@ -173,7 +185,7 @@
</cell>
<cell fill='horizontal' weightx='1.0'>
<JComboBox id="fieldPopulationSeasonInfoChooser"
- onActionPerformed='setPopulationSeasonInfo((PopulationSeasonInfoImpl)fieldPopulationSeasonInfoChooser.getSelectedItem());getVerifier().addCurrentEntity(getPopulationSeasonInfo());setPopSeasonInfoNotNull(getPopulationSeasonInfo() != null);'
+ onActionPerformed='seasonChanged()'
enabled='{isActif()}'/>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -48,6 +48,14 @@
import org.codelutin.math.matrix.gui.MatrixPanelEvent;
import org.codelutin.math.matrix.gui.MatrixPanelListener;
+MatrixPanelListener listener = new MatrixPanelListener() {
+
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ fieldPopulationMappingZoneReproZoneRecruChanged();
+ }
+};
+
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -69,14 +77,9 @@
setPopulationZonesPresenceModel();
setFieldPopulationZonesReproductionModel();
setFieldPopulationZonesRecruitmentModel();
+ fieldPopulationMappingZoneReproZoneRecru.removeMatrixPanelListener(listener);
setFieldPopulationMappingZoneReproZoneRecru();
- fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(new MatrixPanelListener() {
-
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- fieldPopulationMappingZoneReproZoneRecruChanged();
- }
- });
+ fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener);
}
protected void fieldPopulationMappingZoneReproZoneRecruChanged(){
getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix());
@@ -135,12 +138,15 @@
}
protected void presenceChanged(){
getBean().setPopulationZone(getSelectedValue(populationZonesPresence));
+ setFieldPopulationMappingZoneReproZoneRecru();
}
protected void reproductionChanged(){
getBean().setReproductionZone(getSelectedValue(fieldPopulationZonesReproduction));
+ setFieldPopulationMappingZoneReproZoneRecru();
}
protected void recruitementChanged(){
getBean().setRecruitmentZone(getSelectedValue(fieldPopulationZonesRecruitment));
+ setFieldPopulationMappingZoneReproZoneRecru();
}
protected java.util.List<Zone> getSelectedValue(JAXXList componant){
Object[] selected = componant.getSelectedValues();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -35,6 +35,8 @@
<!-- bean property -->
<fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/>
+ <Boolean id='selectivityPopulationSelected' javaBean='false'/>
+
<script>
<![CDATA[
@@ -70,6 +72,29 @@
}
});
+selectivityTable.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ remove.setEnabled(selectivityTable.getSelectedRow() != -1);
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ }
+});
public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
@@ -84,7 +109,11 @@
// TODO : Equation selection
selectivityEquation.init(_("isisfish.selectivity.equation"), null, "Selectivity", null, null, fr.ifremer.isisfish.equation.SelectivityEquation.class);
+
getVerifier().addCurrentPanel(selectivityEquation);
+
+ remove.setEnabled(false);
+ setAddButton();
}
protected void setSelectivityTableModel(){
DefaultTableModel model = new DefaultTableModel(){
@@ -130,12 +159,19 @@
}
protected void add(){
getAction().addSelectivity((Population) ((GenericCell) fieldSelectivityPopulation.getSelectedItem()).getValue(), selectivityEquation.getEditor().getText(), getBean());
- refresh();
+ setSelectivityTableModel();
}
protected void remove(){
getAction().removeSelectivity(getBean(), (Selectivity) getBean().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0)));
- refresh();
+ setSelectivityTableModel();
}
+protected void selectivityChanged(){
+ setSelectivityPopulationSelected(fieldSelectivityPopulation.getSelectedItem() != null);
+ setAddButton();
+}
+protected void setAddButton(){
+ add.setEnabled(getSelectivityPopulationSelected());
+}
]]>
</script>
<Table id='body'>
@@ -147,7 +183,7 @@
<JLabel text="isisfish.selectivity.selectPopulation" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSelectivityPopulation" enabled='{isActif()}'/>
+ <JComboBox id="fieldSelectivityPopulation" onActionPerformed='selectivityChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -163,7 +199,7 @@
<Table>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonAddSelectivity" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
+ <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -175,7 +211,7 @@
</row>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonSelectivityRemove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -40,10 +40,9 @@
import fr.ifremer.isisfish.entities.VesselType;
import fr.ifremer.isisfish.entities.VesselTypeImpl;
import fr.ifremer.isisfish.entities.TripType;
+import jaxx.runtime.swing.Item;
import fr.ifremer.isisfish.types.TimeUnit;
-boolean init = false;
-
setButtonTitle(_("isisfish.input.continueSetOfVessels"));
setNextPath("$root/$setOfVessels");
addPropertyChangeListener("bean", new PropertyChangeListener() {
@@ -75,20 +74,23 @@
VesselType vesselType = getVerifier().getEntity(VesselType.class);
setBean((VesselTypeImpl) vesselType);
if (getBean() != null){
- init = true;
- vesselTypeTripType.fillList(getRegion().getTripType(), getBean().getTripType());
- init = false;
+ setListModel();
}
}
+protected void setListModel(){
+ java.util.List<Item> items = new java.util.ArrayList<Item>();
+ for (TripType tt : getRegion().getTripType()){
+ items.add(new Item(tt.getTopiaId(), tt.getName(), tt, false));
+ }
+ vesselTypeTripType.setItems(items);
+ vesselTypeTripType.setSelectedValues(getBean().getTripType().toArray());
+}
protected void tripTypeChanged(){
- if (!init){
- Object[] values = vesselTypeTripType.getSelectedValues();
- Collection<TripType> tripTypes = new LinkedList<TripType>();
- for (Object o : values){
- tripTypes.add((TripType)o);
- }
- getBean().setTripType(tripTypes);
+ java.util.List<TripType> tripTypes = new java.util.ArrayList<TripType>();
+ for (Object o : vesselTypeTripType.getSelectedValues()){
+ tripTypes.add((TripType)o);
}
+ getBean().setTripType(tripTypes);
}
]]></script>
<Table id='body' constraints='BorderLayout.CENTER'>
@@ -157,7 +159,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='0.7'>
<JScrollPane>
- <JList id="vesselTypeTripType" onMouseClicked='tripTypeChanged()' enabled='{isActif()}'/>
+ <JList id="vesselTypeTripType" selectedValues='{getBean().getTripType().toArray()}' onMouseClicked='tripTypeChanged()' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2009-02-23 15:42:34 UTC (rev 1862)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2009-02-23 23:14:43 UTC (rev 1863)
@@ -320,7 +320,7 @@
// ... pour pouvoir avoir la classe pour l'equation
double Lmax = pop.getLength(deltat, group);
-// pop.setMaxLength(Lmax);
+ group.setMaxLength(Lmax);
Lmin = Lmax;
}
}
1
0
r1862 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: . simulator types/hibernate ui/script/action ui/simulator
by chatellier@users.labs.libre-entreprise.org 23 Feb '09
by chatellier@users.labs.libre-entreprise.org 23 Feb '09
23 Feb '09
Author: chatellier
Date: 2009-02-23 15:42:34 +0000 (Mon, 23 Feb 2009)
New Revision: 1862
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlan.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanContext.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanIndependent.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/MetierMonitor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/RuleMonitor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/CancelAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ChooseFileAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ToolTipListModelFactory.java
Log:
Fix some doc, make some method deprecated, fixe code style
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2002-2008 Code Lutin, Benjamin Poussin
+ * Copyright (C) 2002-2009 Code Lutin, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
- *##%*/
+ * ##%*/
package fr.ifremer.isisfish;
@@ -65,7 +65,7 @@
public class IsisConfig extends ApplicationConfig {
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(IsisConfig.class);
+ private static Log log = LogFactory.getLog(IsisConfig.class);
/**
* La version du logiciel constitue de l.d.a.r
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlan.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlan.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlan.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2007
+ * Copyright (C) 2007 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,7 +17,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
+package fr.ifremer.isisfish.simulator;
+
+import fr.ifremer.isisfish.datastore.SimulationStorage;
+
+/**
* AnalysePlan.java
*
* Created: 1 mars 07 20:27:28
@@ -28,57 +32,53 @@
* Last update: $Date$
* by : $Author$
*/
-
-package fr.ifremer.isisfish.simulator;
-
-import fr.ifremer.isisfish.datastore.SimulationStorage;
-
-
-/**
- * @author poussin
- *
- */
-
public interface AnalysePlan {
/**
+ * Return plan necessary Results.
+ *
* @return the necessaryResult name
*/
public String[] getNecessaryResult();
-
+
/**
- * return plan description
+ * Return plan description.
+ *
* @return plan description
* @throws Exception
*/
public String getDescription() throws Exception;
-
+
/**
- * Use only once before first simulation. You can modified Param for all
- * simulation or put value in context.values.
- * @param context
+ * Use only once before first simulation.
+ *
+ * You can modified Param for all simulation or put value in context.values.
+ *
+ * @param context plan context
* @throws Exception
*/
public void init(AnalysePlanContext context) throws Exception;
-
+
/**
- * Call before each simulation
+ * Call before each simulation.
+ *
* @param context plan context
* @param nextSimulation storage used for next simulation
* @return true if we must do next simulation, false to stop plan
* @throws Exception
*/
- public boolean beforeSimulation(AnalysePlanContext context, SimulationStorage nextSimulation) throws Exception;
-
+ public boolean beforeSimulation(AnalysePlanContext context,
+ SimulationStorage nextSimulation) throws Exception;
+
/**
- * Call after each simulation
+ * Call after each simulation.
+ *
* @param context plan context
* @param lastSimulation storage used for simulation
* @return true if we must do next simulation, false to stop plan
* @throws Exception
*/
- public boolean afterSimulation(AnalysePlanContext context, SimulationStorage lastSimulation) throws Exception;
-
+ public boolean afterSimulation(AnalysePlanContext context,
+ SimulationStorage lastSimulation) throws Exception;
+
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanContext.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanContext.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanContext.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2007
+ * Copyright (C) 2007 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * AnalysePlanContext.java
- *
- * Created: 1 mars 07 20:19:31
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.simulator;
import java.util.HashMap;
@@ -36,77 +24,106 @@
import fr.ifremer.isisfish.datastore.SimulationStorage;
-
/**
+ * AnalysePlanContext.java
+ *
+ * Created: 1 mars 07 20:19:31
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
+public class AnalysePlanContext {
-public class AnalysePlanContext {
-
+ /** Simulation id. */
protected String id;
+
+ /** Analyse plan number. */
protected int number = 0;
+
+ /** Simulation parameters. */
protected SimulationParameter param;
+
+ /** @deprecated on 20080223 seams never used */
protected Map<String, Object> values = new HashMap<String, Object>();
-
+
public AnalysePlanContext(String id, SimulationParameter param) {
this.id = id;
this.param = param;
}
-
+
/**
- * @return Returns the id.
+ * Get id.
+ *
+ * @return the id
*/
public String getId() {
- return this.id;
+ return id;
}
-
+
/**
- * @return Returns the number.
+ * Get analyse plan number.
+ *
+ * @return the number
*/
public int getNumber() {
return number;
}
-
+
/**
- * must be call when new simulation is generated from plan
+ * Must be call when new simulation is generated from plan.
*/
public void incNumber() {
number++;
}
-
+
/**
- * @return Returns the param.
+ * Get simulation parameters.
+ *
+ * @return simulation params
+ * @deprecated on 20080223 seams never used
*/
public SimulationParameter getParam() {
- return this.param;
+ return param;
}
-
+
/**
- * Used in PlanGenerator to set parameter to parameter of the next
- * simulation
- * @param param The param to set.
+ * @param key
+ * @return value for key.
+ * @deprecated on 20080223 seams never used
*/
- public void setParam(SimulationParameter param) {
- this.param = param;
+ public Object getValue(String key) {
+ return this.values.get(key);
}
-
+
/**
- * @return Returns the values.
+ *
+ * @param key
+ * @param value
+ * @deprecated on 20080223 seams never used
*/
- public Object getValue(String key) {
- return this.values.get(key);
- }
-
public void setValue(String key, Object value) {
this.values.put(key, value);
}
-
+
+ /**
+ *
+ * @return
+ * @deprecated on 20080223 seams never used
+ */
public SimulationStorage getLastSimulation() {
- SimulationStorage result = getSimulation(getNumber()-1);
+ SimulationStorage result = getSimulation(getNumber() - 1);
return result;
}
-
+
+ /**
+ * Get {@link SimulationStorage} for specified anaylse plan number.
+ *
+ * @param number number
+ * @return {@link SimulationStorage}
+ */
public SimulationStorage getSimulation(int number) {
SimulationStorage result = null;
if (0 <= number && number <= getNumber()) {
@@ -114,7 +131,4 @@
}
return result;
}
-
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanIndependent.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanIndependent.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/AnalysePlanIndependent.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2007
+ * Copyright (C) 2007 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,8 +17,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * AnalysePlan.java
+package fr.ifremer.isisfish.simulator;
+
+/**
+ * Use for Analyse plan that don't need previous simulation to do next
+ * simulation. When Simulation use this plan type, Isis can do more than one
+ * simulation in same time.
*
* Created: 1 mars 07 20:27:28
*
@@ -28,19 +32,6 @@
* Last update: $Date: 2007-03-09 15:10:40 +0100 (ven, 09 mar 2007) $
* by : $Author: bpoussin $
*/
-
-package fr.ifremer.isisfish.simulator;
-
-/**
- * Use for Analyse plan that don't need previous simulation to do next
- * simulation. When Simulation use this plan type, Isis can do more than one
- * simulation in same time.
- *
- * author poussin
- */
public interface AnalysePlanIndependent extends AnalysePlan {
-
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/MetierMonitor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/MetierMonitor.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/MetierMonitor.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * MetierMonitor.java
- *
- * Created: 21 août 2006 15:43:19
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.simulator;
import static org.codelutin.i18n.I18n.n_;
@@ -59,19 +47,24 @@
import fr.ifremer.isisfish.types.Date;
import fr.ifremer.isisfish.types.Month;
-
/**
* ATTENTION: l'implantation de cette classe n'est peut-etre pas correct. Il faut
* absolument verifier le FIXME, mais il est difficile de le faire car
* la plupart des methodes de cette objets ne semble plus utilisé dans la
* version 2.3.x de isis
*
+ * Created: 21 août 2006 15:43:19
+ *
* @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
*/
public class MetierMonitor {
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(MetierMonitor.class);
+ private static Log log = LogFactory.getLog(MetierMonitor.class);
protected Set<Metier> forbiddenMetier = new HashSet<Metier>();
protected Set<MultiKey> forbiddenMetierMonth = new HashSet<MultiKey>();
@@ -317,7 +310,4 @@
return result;
}
-
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/RuleMonitor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/RuleMonitor.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/RuleMonitor.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006
+ * Copyright (C) 2006 - 2009
* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * RuleMonitor.java
- *
- * Created: 21 août 2006 15:45:03
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
package fr.ifremer.isisfish.simulator;
import org.apache.commons.collections.map.MultiKeyMap;
@@ -37,26 +25,28 @@
import fr.ifremer.isisfish.rule.Rule;
import fr.ifremer.isisfish.types.Date;
-
/**
- * This class keep trace of rule evalution condition for all step and all metier
+ * This class keep trace of rule evalution condition for all step and all metier.
*
+ * Created: 21 août 2006 15:45:03
+ *
* @author poussin
+ * @version $Revision$
*
+ * Last update: $Date$
+ * by : $Author$
*/
public class RuleMonitor {
protected MultiKeyMap evalutionCondition = new MultiKeyMap();
public boolean getEvalutionCondition(Date date, Rule rule, Metier metier) {
- return (Boolean)this.evalutionCondition.get(date, rule, metier);
+ return (Boolean) this.evalutionCondition.get(date, rule, metier);
}
- public void setEvaluationCondition(Date date, Rule rule, Metier metier, boolean evalutionCondition) {
+ public void setEvaluationCondition(Date date, Rule rule, Metier metier,
+ boolean evalutionCondition) {
this.evalutionCondition.put(date, rule, metier, evalutionCondition);
}
-
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2002-2005 Code Lutin, Cédric Pineau,
+ * Copyright (C) 2002 - 2009 Code Lutin, Cédric Pineau,
Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,18 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * SimulationControl.java
- *
- * Created: Fri Oct 6 2000
- *
- * @author POUSSIN Benjamin <poussin at codelutin.com>
- * @version $Revision$
- *
- * Mise a jour: $Date$
- * par : $Author$
- */
-
package fr.ifremer.isisfish.simulator;
import java.beans.PropertyChangeEvent;
@@ -45,13 +33,20 @@
import fr.ifremer.isisfish.types.Date;
/**
- * Permit to communicate with user interface from simulation thread
- * @author poussin
+ * Permit to communicate with user interface from simulation thread.
+ *
+ * Created: Fri Oct 6 2000
+ *
+ * @author POUSSIN Benjamin <poussin at codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
*/
public class SimulationControl implements PropertyChangeListener { // SimulationControl
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(SimulationControl.class);
+ private static Log log = LogFactory.getLog(SimulationControl.class);
protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
protected boolean inUpdateFromHashtable = false;
@@ -385,7 +380,7 @@
}
}
- /* (non-Javadoc)
+ /*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent e) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,4 @@
-/*
- * *##% Copyright (C) 2006 Code Lutin, C?dric Pineau, Benjamin Poussin
+/* *##% Copyright (C) 2006 - 2009 Code Lutin, Cédric Pineau, Benjamin Poussin
*
* 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
@@ -16,18 +15,8 @@
* Place - Suite 330, Boston, MA 02111-1307, USA. ##%
*/
-/*******************************************************************************
- * SimulationParameter.java
- *
- * Created: 10 janv. 2006 17:03:37
- *
- * @author poussin
- *
- * @version $Revision$
- *
- * Last update: $Date$ by : $Author$
- */
+
package fr.ifremer.isisfish.simulator;
import static org.codelutin.i18n.I18n._;
@@ -71,17 +60,21 @@
/**
* Contains all parameter for one simulation
*
+ * Created: 10 janv. 2006 17:03:37
+ *
* @author poussin
+ *
+ * @version $Revision$
+ *
+ * Last update: $Date$ by : $Author$
*/
public class SimulationParameter {
- /**
- * Logger for this class
- */
- private static final Log log = LogFactory.getLog(SimulationParameter.class);
+ /** Logger for this class. */
+ private static Log log = LogFactory.getLog(SimulationParameter.class);
/** Isis-fish version that permit to do the simulation, must be set just
- * before simulation by simulator */
+ * before simulation by simulator. */
protected String isisFishVersion = IsisConfig.getVersion();
/** description de la simulation */
@@ -138,7 +131,7 @@
protected String analysePlan = "";
/** le numero de sequence de la liste des plans d'analyse, le premier
- * ?lement du plan doit etre 0. Si la simulation ne fait pas partie d'un
+ * élement du plan doit etre 0. Si la simulation ne fait pas partie d'un
* plan la valeur est -1 */
protected int analysePlanNumber = -1;
@@ -150,17 +143,17 @@
/**
* si vrai seul les exports automatiques ne sont souhaiter, la simulation
- * pourrait etre supprim?e a la fin
+ * pourrait etre supprimée a la fin
*/
protected boolean onlyExport = false;
transient protected RegionStorage region = null;
- /** le niveau de log du simulateur ? utiliser pendant la simulation , par default info */
+ /** le niveau de log du simulateur à utiliser pendant la simulation , par default info */
protected String simulLogLevel = "info";
- /** le niveau de log des scripts ? utiliser pendant la simulation , par default info */
+ /** le niveau de log des scripts à utiliser pendant la simulation , par default info */
protected String scriptLogLevel = "info";
- /** le niveau de log des librairies ? utiliser pendant la simulation , par default info */
+ /** le niveau de log des librairies à utiliser pendant la simulation , par default info */
protected String libLogLevel = "error";
/**
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/types/hibernate/MatrixType.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -38,7 +38,6 @@
import java.util.LinkedList;
import java.util.List;
-import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.ConvertUtilsBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,12 +53,7 @@
import org.hibernate.type.Type;
import org.hibernate.usertype.CompositeUserType;
-import fr.ifremer.isisfish.types.Date;
-import fr.ifremer.isisfish.types.Month;
import fr.ifremer.isisfish.util.ConverterUtil;
-import fr.ifremer.isisfish.util.DateConverter;
-import fr.ifremer.isisfish.util.MonthConverter;
-import fr.ifremer.isisfish.util.StringConverter;
import fr.ifremer.isisfish.util.TopiaEntityConverter;
public class MatrixType implements CompositeUserType {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/BackupAction.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,20 +1,49 @@
+/* *##%
+ * Copyright (C) 2005 - 2009
+ * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.ui.script.action;
-import fr.ifremer.isisfish.IsisFish;
-import fr.ifremer.isisfish.IsisFishRuntimeException;
-import fr.ifremer.isisfish.ui.util.IsisAction;
-import org.apache.commons.logging.Log;
-import static org.apache.commons.logging.LogFactory.getLog;
-import org.codelutin.util.FileUtil;
-
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.util.FileUtil;
+
+import fr.ifremer.isisfish.IsisFish;
+import fr.ifremer.isisfish.IsisFishRuntimeException;
+import fr.ifremer.isisfish.ui.util.IsisAction;
+
+/**
+ * BackupAction.
+ *
+ * @author bpoussin
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
public class BackupAction extends IsisAction {
- static private Log log = getLog(BackupAction.class);
+ private static Log log = LogFactory.getLog(BackupAction.class);
/** source root directory */
protected File src;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/CancelAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/CancelAction.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/CancelAction.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,3 +1,22 @@
+/* *##%
+ * Copyright (C) 2005 - 2009
+ * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.ui.script.action;
import fr.ifremer.isisfish.ui.util.IsisAction;
@@ -6,6 +25,7 @@
import java.awt.event.ActionEvent;
public class CancelAction extends IsisAction {
+
private static final long serialVersionUID = 2536223593370089763L;
public CancelAction(JDialog dialog) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ChooseFileAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ChooseFileAction.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/action/ChooseFileAction.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,3 +1,22 @@
+/* *##%
+ * Copyright (C) 2005 - 2009
+ * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.ui.script.action;
import static org.codelutin.i18n.I18n._;
@@ -11,12 +30,12 @@
public class ChooseFileAction extends AbstractAction {
+ private static final long serialVersionUID = -5004217809548352109L;
+
protected JTextField file;
protected JDialog dialog;
- private static final long serialVersionUID = -5004217809548352109L;
-
public ChooseFileAction(JDialog dialog, JTextField file) {
super("...");
this.dialog = dialog;
@@ -41,7 +60,9 @@
if (ret == JFileChooser.APPROVE_OPTION) {
File newFile = chooser.getSelectedFile();
String path;
- if (newFile.isFile()) path = newFile.getAbsolutePath();
+ if (newFile.isFile()) {
+ path = newFile.getAbsolutePath();
+ }
else {
path = newFile.getAbsolutePath();
if (!"".equals(name)) path += File.separator + name;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensWizard.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2002, 2003 Code Lutin
+ * Copyright (C) 2002, 2009 Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -16,8 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * SensWizard.java
+package fr.ifremer.isisfish.ui.simulator;
+
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+
+/**
+ * SensWizard.
*
* Created: 14 nov. 2005
*
@@ -27,13 +32,9 @@
*
* Mise a jour: $Date$
* par : $Author$
+ *
+ * @deprecated on 20080223 seams to be unused
*/
-package fr.ifremer.isisfish.ui.simulator;
-
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-
-
public class SensWizard {
/**
@@ -41,8 +42,8 @@
* wizard
* @return l'index de la tab a selectionner
*/
- public static int newTab(JButton prev, JButton next,
- JButton finish, JTabbedPane tabPane) {
+ public static int newTab(JButton prev, JButton next, JButton finish,
+ JTabbedPane tabPane) {
// La direction du changement de tab (+1, -1)
//int step = ((Integer)currentContext.getData("_step")).intValue();
// La nouvelle tab sélectionnée par l'utilisateur
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2005
+ * Copyright (C) 2005 - 2009
* Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -17,26 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-/* *
- * IsisFish.java
- *
- * Created: 1 aout 2005 18:37:25 CEST
- *
- * @author Benjamin POUSSIN <poussin at codelutin.com>
- * @version $Revision: 1312 $
- *
- * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $
- * by : $Author: sletellier $
- */
-
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-/**
- *
- * @author letellier
- */
package fr.ifremer.isisfish.ui.simulator;
import static org.codelutin.i18n.I18n._;
@@ -51,7 +31,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -87,10 +66,21 @@
import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
import fr.ifremer.isisfish.ui.widget.filter.FilterModel;
+/**
+ * SimulAction.
+ *
+ * Created: 1 aout 2005 18:37:25 CEST
+ *
+ * @author Benjamin POUSSIN <poussin at codelutin.com>
+ * @version $Revision: 1312 $
+ *
+ * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $
+ * by : $Author: sletellier $
+ */
public class SimulAction {
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(SimulAction.class);
+ private static Log log = LogFactory.getLog(SimulAction.class);
protected SimulationParameter param = null;
protected RegionStorage regionStorage = null;
protected SimulationStorage simulStorage = null;
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulatorListeners.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,3 +1,22 @@
+/* *##%
+ * Copyright (C) 2005 - 2009
+ * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.ui.simulator;
import fr.ifremer.isisfish.simulator.launcher.SimulationService;
@@ -13,12 +32,6 @@
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.ListModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
/**
* This class contains some listeners used in ui. Some are generics and could
@@ -33,7 +46,7 @@
public class SimulatorListeners {
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(SimulatorListeners.class);
+ private static Log log = LogFactory.getLog(SimulatorListeners.class);
public static void initAnalysePlanButtonsListener(JButton remove, JList list) {
initButtonRemoveIfItemSelected(remove, list);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ToolTipListModelFactory.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ToolTipListModelFactory.java 2009-02-23 15:26:14 UTC (rev 1861)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ToolTipListModelFactory.java 2009-02-23 15:42:34 UTC (rev 1862)
@@ -1,3 +1,22 @@
+/* *##%
+ * Copyright (C) 2005 - 2009
+ * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
package fr.ifremer.isisfish.ui.simulator;
import fr.ifremer.isisfish.datastore.AnalysePlanStorage;
@@ -31,7 +50,7 @@
public class ToolTipListModelFactory {
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(SimulAction.class);
+ private static Log log = LogFactory.getLog(SimulAction.class);
/**
* Build a new {@link ToolTipListModel} for for @Doc'field of all given
@@ -92,8 +111,7 @@
* @param names Export names to use
* @return the model builded
*/
-
- static public ToolTipListModel createExportClassDocsModel(
+ public static ToolTipListModel createExportClassDocsModel(
List<String> names) {
List<String> texts = new ArrayList<String>();
@@ -127,7 +145,7 @@
* @param names Rule names
* @return the model builded
*/
- static public ToolTipListModel createRuleDescriptionsModel(
+ public static ToolTipListModel createRuleDescriptionsModel(
List<String> names) {
List<String> texts = new ArrayList<String>();
@@ -167,7 +185,7 @@
* @param list the list containing the renderer
* @return the model builded
*/
- static public ToolTipListModel createRuleDescriptionsModel2(
+ public static ToolTipListModel createRuleDescriptionsModel2(
List<Rule> rules, JButton clearButton, JList list) {
List<String> texts = new ArrayList<String>();
@@ -206,7 +224,7 @@
* @param rules the selected rules (we only use the first one)
* @return the model builded
*/
- static public ToolTipListModel createRuleParamsModel(Collection rules) {
+ public static ToolTipListModel createRuleParamsModel(Collection rules) {
List<String> texts = new ArrayList<String>();
List<String> toolTips = new ArrayList<String>();
@@ -248,7 +266,7 @@
* @return the model builded
*/
@SuppressWarnings({"unchecked"})
- static public ToolTipListModel createAnalysePlanDescriptionsModel(
+ public static ToolTipListModel createAnalysePlanDescriptionsModel(
List<String> names) {
List<String> texts = new ArrayList<String>();
@@ -293,7 +311,7 @@
* @return the model builded
*/
@SuppressWarnings({"unchecked"})
- static public ToolTipListModel createAnalysePlanDescriptionsModel2(
+ public static ToolTipListModel createAnalysePlanDescriptionsModel2(
List<AnalysePlan> plans, JButton clearButton, JList list) {
List<String> texts = new ArrayList<String>();
@@ -333,10 +351,9 @@
* @param analysePlans the selected analyse plan (we only use the first one)
* @return the model builded
*/
- static public ToolTipListModel createAnalysePlanParamsModel(
+ public static ToolTipListModel createAnalysePlanParamsModel(
Collection analysePlans) {
-
List<String> texts = new ArrayList<String>();
List<String> toolTips = new ArrayList<String>();
if (analysePlans.size() > 0) {
@@ -344,7 +361,6 @@
analysePlans.iterator().next());
try {
-
AnalysePlanStorage storage =
AnalysePlanStorage.getAnalysePlan(name);
Map<String, Class> mapParams = storage.getParameterNames();
1
0
r1861 - in isis-fish/trunk/src: main/java/fr/ifremer/isisfish/simulator/factors test/java/fr/ifremer/isisfish/simulator test/java/fr/ifremer/isisfish/simulator/factors
by chatellier@users.labs.libre-entreprise.org 23 Feb '09
by chatellier@users.labs.libre-entreprise.org 23 Feb '09
23 Feb '09
Author: chatellier
Date: 2009-02-23 15:26:14 +0000 (Mon, 23 Feb 2009)
New Revision: 1861
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java
Removed:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/StatisticsCalculator.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java
Log:
Improve factors, add test.
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java 2009-02-23 10:30:42 UTC (rev 1860)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/DesignPlan.java 2009-02-23 15:26:14 UTC (rev 1861)
@@ -21,6 +21,9 @@
import java.io.Serializable;
import java.util.List;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
/**
* Design plan contenant toutes les
* valeur de facteur possible.
@@ -65,6 +68,16 @@
public void setFactors(List<Factor<E>> factors) {
this.factors = factors;
}
-
-
+
+ /*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ builder.append(factors);
+
+ return builder.toString();
+ }
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java 2009-02-23 10:30:42 UTC (rev 1860)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Factor.java 2009-02-23 15:26:14 UTC (rev 1861)
@@ -22,6 +22,9 @@
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
/**
* Facteur de variation des parametres de simulation.
*
@@ -101,4 +104,91 @@
this();
this.name = name;
}
+
+ /**
+ * Get name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set name.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get domain.
+ *
+ * @return the domain
+ */
+ public Map<String, E> getDomain() {
+ return domain;
+ }
+
+ /**
+ * Set domain.
+ *
+ * @param domain the domain to set
+ */
+ public void setDomain(Map<String, E> domain) {
+ this.domain = domain;
+ }
+
+ /**
+ * Get value label.
+ *
+ * @return the valueLabel
+ */
+ public String getValueLabel() {
+ return valueLabel;
+ }
+
+ /**
+ * Set value label.
+ *
+ * @param valueLabel the valueLabel to set
+ */
+ public void setValueLabel(String valueLabel) {
+ this.valueLabel = valueLabel;
+ }
+
+ /**
+ * Get path.
+ *
+ * @return the path
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * Set path.
+ *
+ * @param path the path to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ builder.append(name);
+ builder.append(domain);
+ builder.append(valueLabel);
+ builder.append(path);
+
+ return builder.toString();
+ }
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java 2009-02-23 10:30:42 UTC (rev 1860)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/Scenario.java 2009-02-23 15:26:14 UTC (rev 1861)
@@ -22,6 +22,9 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
/**
* Scenario d'execution de simulation.
*
@@ -73,4 +76,15 @@
this.simulationsFactors = simulationsFactors;
}
+ /*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+
+ ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ builder.append(simulationsFactors);
+
+ return builder.toString();
+ }
}
Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java (from rev 1857, isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/StatisticsCalculator.java)
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/SensitivityCalculator.java 2009-02-23 15:26:14 UTC (rev 1861)
@@ -0,0 +1,54 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.factors;
+
+import java.io.Serializable;
+
+/**
+ * Interface vers le calculateur statistique.
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 19 févr. 2009 $
+ * By : $Author: chatellier $
+ */
+public interface SensitivityCalculator {
+
+ /**
+ * Envoi un plan a faire analyser par l'outils
+ * statistique.
+
+ * @param plan plan a analyser
+ * @param <E> type des données du scenario et du plan
+ *
+ * @return un Scenario
+ * @see DesignPlan
+ * @see Scenario
+ */
+ <E extends Serializable> Scenario<E> getScenario(DesignPlan<E> plan);
+
+ /**
+ * Ajoute un paramètre pour l'outils statistique.
+ *
+ * @param key nom du parametre
+ * @param value valeur du parametre
+ */
+ void setParameter(String key, String value);
+}
Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/StatisticsCalculator.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/StatisticsCalculator.java 2009-02-23 10:30:42 UTC (rev 1860)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/factors/StatisticsCalculator.java 2009-02-23 15:26:14 UTC (rev 1861)
@@ -1,54 +0,0 @@
-/* *##%
- * Copyright (C) 2009 Code Lutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
-
-package fr.ifremer.isisfish.simulator.factors;
-
-import java.io.Serializable;
-
-/**
- * Interface vers le calculateur statistique.
- *
- * @author chatellier
- * @version $Revision: 1.0 $
- *
- * Last update : $Date: 19 févr. 2009 $
- * By : $Author: chatellier $
- */
-public interface StatisticsCalculator {
-
- /**
- * Envoi un plan a faire analyser par l'outils
- * statistique.
-
- * @param plan plan a analyser
- * @param <E> type des données du scenario et du plan
- *
- * @return un Scenario
- * @see DesignPlan
- * @see Scenario
- */
- <E extends Serializable> Scenario<E> getScenario(DesignPlan<E> plan);
-
- /**
- * Ajoute un paramètre pour l'outils statistique.
- *
- * @param key nom du parametre
- * @param value valeur du parametre
- */
- void setParameter(String key, String value);
-}
Added: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java (rev 0)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/factors/FactorTest.java 2009-02-23 15:26:14 UTC (rev 1861)
@@ -0,0 +1,99 @@
+/* *##%
+ * Copyright (C) 2009 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.factors;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.math.matrix.MatrixFactory;
+import org.codelutin.math.matrix.MatrixND;
+import org.junit.Test;
+
+
+/**
+ * Factors test.
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 23 févr. 2009 $
+ * By : $Author: chatellier $
+ */
+public class FactorTest {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ private static Log log = LogFactory.getLog(FactorTest.class);
+
+ /**
+ * Test to build new factors with int values.
+ */
+ @Test
+ public void testIntFactor() {
+
+ Factor<Integer> factor = new Factor<Integer>("testint");
+ factor.getDomain().put("i1", 0);
+ factor.getDomain().put("i2", 1);
+ factor.getDomain().put("i3", 2);
+ factor.getDomain().put("i4", 3);
+ factor.getDomain().put("i5", 4);
+ factor.setPath("org.codelutin.factor#1234567890#0.12242345354#name");
+ factor.setValueLabel("i3");
+
+ if (log.isInfoEnabled()) {
+ log.info("factor#toString() = " + factor);
+ }
+ }
+
+ /**
+ * Test factor with matrix.
+ *
+ * @see MatrixND
+ */
+ @Test
+ public void testMatrixFactor() {
+
+ // matrix 1
+ MatrixND matrix1 = MatrixFactory.getInstance().create("test1", new int[] {3,2}, new String[]{"col1", "col2"});
+ matrix1.setValue(new int[]{0,0}, 13);
+ matrix1.setValue(new int[]{0,1}, -14);
+ matrix1.setValue(new int[]{1,0}, 21);
+ matrix1.setValue(new int[]{1,1}, 2);
+ matrix1.setValue(new int[]{2,0}, 12);
+ matrix1.setValue(new int[]{2,1}, -1);
+
+ // matrix 2
+ MatrixND matrix2 = MatrixFactory.getInstance().create("test2", new int[] {2,3}, new String[]{"col1", "col2"});
+ matrix2.setValue(new int[]{0,0}, 9999);
+ matrix2.setValue(new int[]{0,1}, 15000);
+ matrix2.setValue(new int[]{0,2}, -40000);
+ matrix2.setValue(new int[]{1,0}, 21345);
+ matrix2.setValue(new int[]{1,1}, 81000);
+ matrix2.setValue(new int[]{1,2}, -13000);
+
+ // factor
+ Factor<MatrixND> factor = new Factor<MatrixND>("testmatrix");
+ factor.getDomain().put("m1", matrix1);
+ factor.getDomain().put("m2", matrix2);
+ factor.setPath("org.codelutin.math.matrix.MatrixND#563456293453#2.456347646#dim");
+ factor.setValueLabel("m2");
+
+ if (log.isInfoEnabled()) {
+ log.info("factor#toString() = " + factor);
+ }
+ }
+}
1
0
r1860 - in isis-fish/trunk/src/main/resources: . templates
by chatellier@users.labs.libre-entreprise.org 23 Feb '09
by chatellier@users.labs.libre-entreprise.org 23 Feb '09
23 Feb '09
Author: chatellier
Date: 2009-02-23 10:30:42 +0000 (Mon, 23 Feb 2009)
New Revision: 1860
Added:
isis-fish/trunk/src/main/resources/templates/
isis-fish/trunk/src/main/resources/templates/analyseplan.ftl
isis-fish/trunk/src/main/resources/templates/equation.ftl
isis-fish/trunk/src/main/resources/templates/export.ftl
isis-fish/trunk/src/main/resources/templates/rule.ftl
isis-fish/trunk/src/main/resources/templates/script.ftl
isis-fish/trunk/src/main/resources/templates/simulator.ftl
Log:
Begin to externalize script, analyseplan... code in ftl template.
(not used for now)
Added: isis-fish/trunk/src/main/resources/templates/analyseplan.ftl
===================================================================
--- isis-fish/trunk/src/main/resources/templates/analyseplan.ftl (rev 0)
+++ isis-fish/trunk/src/main/resources/templates/analyseplan.ftl 2009-02-23 10:30:42 UTC (rev 1860)
@@ -0,0 +1,81 @@
+package analyseplans;
+
+import static org.codelutin.i18n.I18n._;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import scripts.ResultName;
+
+import java.io.Writer;
+import org.codelutin.math.matrix.*;
+import org.codelutin.util.*;
+import org.codelutin.topia.*;
+
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.*;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+import fr.ifremer.isisfish.types.Date;
+import fr.ifremer.isisfish.entities.*;
+import fr.ifremer.isisfish.simulator.AnalysePlan;
+import fr.ifremer.isisfish.simulator.AnalysePlanContext;
+import fr.ifremer.isisfish.simulator.SimulationParameter;
+import fr.ifremer.isisfish.datastore.SimulationStorage;
+import fr.ifremer.isisfish.datastore.ResultStorage;
+
+/**
+ * ${name}.java
+ *
+ * Created: ${date}
+ *
+ * @author ${author} <${email}>
+ * @version $Revision: 1545 $
+ * Last update: $Date: 2008-10-08 16:13:44 +0200 (mer 08 oct 2008) $
+ * by : $Author: ${author} $
+ */
+public class ${name} implements AnalysePlan {
+
+ /** to use log facility, just put in your code: log.info("..."); */
+ private static Log log = LogFactory.getLog(${name}.class);
+
+ public String [] necessaryResult = {
+ // put here all necessary result for this rule
+ // example:
+ // ResultName.MATRIX_BIOMASS,
+ // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ };
+
+ public String[] getNecessaryResult() {
+ return this.necessaryResult;
+ }
+
+ /**
+ * Permet d''afficher a l''utilisateur une aide sur le plan.
+ * @return L''aide ou la description du plan
+ */
+ public String getDescription() throws Exception {
+ // TODO
+ return _("TODO description plan");
+ }
+
+ /**
+ * Appelé au démarrage de la simulation, cette méthode permet d''initialiser
+ * des valeurs
+ * @param simulation La simulation pour lequel on utilise cette regle
+ */
+ public void init(AnalysePlanContext context) throws Exception {
+ // TODO
+ }
+
+ /**
+ * Call before each simulation
+ * @param context plan context
+ * @param nextSimulation storage used for next simulation
+ * @return true if we must do next simulation, false to stop plan
+ * @throws Exception
+ */
+ public boolean next(AnalysePlanContext context, SimulationStorage nextSimulation) throws Exception {
+ return false;
+ // TODO
+ }
+}
\ No newline at end of file
Added: isis-fish/trunk/src/main/resources/templates/equation.ftl
===================================================================
--- isis-fish/trunk/src/main/resources/templates/equation.ftl (rev 0)
+++ isis-fish/trunk/src/main/resources/templates/equation.ftl 2009-02-23 10:30:42 UTC (rev 1860)
@@ -0,0 +1,12 @@
+/**
+ * ${name}.
+ *
+ * Created: ${date}
+ *
+ * @author ${author} <${email}>
+ * @version $Revision: 1545 $
+ * Last update: $Date : ${date} $
+ * by : $Author: ${author} $
+ */
+// put your code here
+
Added: isis-fish/trunk/src/main/resources/templates/export.ftl
===================================================================
--- isis-fish/trunk/src/main/resources/templates/export.ftl (rev 0)
+++ isis-fish/trunk/src/main/resources/templates/export.ftl 2009-02-23 10:30:42 UTC (rev 1860)
@@ -0,0 +1,59 @@
+package exports;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.Writer;
+
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.math.matrix.*;
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.entities.*;
+import fr.ifremer.isisfish.export.Export;
+import fr.ifremer.isisfish.datastore.SimulationStorage;
+import fr.ifremer.isisfish.datastore.ResultStorage;
+
+/**
+ * ${name}.java
+ *
+ * Created: ${date}
+ *
+ * @author ${author} <${email}>
+ * @version $Revision: 1545 $
+ *
+ * Last update: $Date: ${date} $
+ * by : $Author: ${author} $
+ */
+public class ${name} implements Export {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ private static Log log = LogFactory.getLog(${name}.class);
+
+ public String [] necessaryResult = {
+ // put here all necessary result for this rule
+ // example:
+ // ResultName.MATRIX_BIOMASS,
+ // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ };
+
+ public String[] getNecessaryResult() {
+ return this.necessaryResult;
+ }
+
+ public String getExportFilename() {
+ // remove _(...) if you don''t want translation on filename
+ return _("${name}");
+ }
+
+ public String getExtensionFilename() {
+ return ".csv";
+ }
+
+ public String getDescription() {
+ return _("TODO export description");
+ }
+
+ public void export(SimulationStorage simulation, Writer out) throws Exception {
+ // put your code here, and write export with: out.write("...")
+ }
+}
\ No newline at end of file
Added: isis-fish/trunk/src/main/resources/templates/rule.ftl
===================================================================
--- isis-fish/trunk/src/main/resources/templates/rule.ftl (rev 0)
+++ isis-fish/trunk/src/main/resources/templates/rule.ftl 2009-02-23 10:30:42 UTC (rev 1860)
@@ -0,0 +1,93 @@
+package rules;
+
+import static org.codelutin.i18n.I18n._;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import scripts.ResultName;
+
+import java.io.Writer;
+
+import org.codelutin.math.matrix.*;
+
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+import fr.ifremer.isisfish.types.Date;
+import fr.ifremer.isisfish.entities.*;
+import fr.ifremer.isisfish.rule.AbstractRule;
+import fr.ifremer.isisfish.datastore.SimulationStorage;
+import fr.ifremer.isisfish.datastore.ResultStorage;
+
+/**
+ * ${name}.java
+ *
+ * Created: ${date}
+ *
+ * @author ${author} <${email}>
+ * @version $Revision: 1545 $
+ * Last update: $Date: 2008-10-08 16:13:44 +0200 (mer 08 oct 2008) $
+ * by : $Author: ${author} $
+ */
+public class ${name} extends AbstractRule {
+
+ /** to use log facility, just put in your code: log.info("..."); */
+ private static Log log = LogFactory.getLog(${name}.class);
+
+ public String [] necessaryResult = {
+ // put here all necessary result for this rule
+ // example:
+ // ResultName.MATRIX_BIOMASS,
+ // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
+ };
+
+ public String[] getNecessaryResult() {
+ return this.necessaryResult;
+ }
+
+ /**
+ * Permet d'afficher a l'utilisateur une aide sur la regle.
+ * @return L'aide ou la description de la regle
+ */
+ public String getDescription() throws Exception {
+ // TODO
+ return _("TODO description rule");
+ }
+
+ /**
+ * Appelé au démarrage de la simulation, cette méthode permet d'initialiser
+ * des valeurs
+ * @param simulation La simulation pour lequel on utilise cette regle
+ */
+ public void init(SimulationContext context) throws Exception {
+ // TODO
+ }
+
+ /**
+ * La condition qui doit etre vrai pour faire les actions
+ * @param simulation La simulation pour lequel on utilise cette regle
+ * @return vrai si on souhaite que les actions soit faites
+ */
+ public boolean condition(SimulationContext context, Date date, Metier metier) throws Exception {
+ // TODO
+ return false;
+ }
+
+ /**
+ * Si la condition est vrai alors cette action est executée avant le pas
+ * de temps de la simulation.
+ * @param simulation La simulation pour lequel on utilise cette regle
+ */
+ public void preAction(SimulationContext context, Date date, Metier metier) throws Exception {
+ // TODO
+ }
+
+ /**
+ * Si la condition est vrai alors cette action est executée apres le pas
+ * de temps de la simulation.
+ * @param simulation La simulation pour lequel on utilise cette regle
+ */
+ public void postAction(SimulationContext context, Date date, Metier metier) throws Exception {
+ // TODO
+ }
+}
\ No newline at end of file
Added: isis-fish/trunk/src/main/resources/templates/script.ftl
===================================================================
--- isis-fish/trunk/src/main/resources/templates/script.ftl (rev 0)
+++ isis-fish/trunk/src/main/resources/templates/script.ftl 2009-02-23 10:30:42 UTC (rev 1860)
@@ -0,0 +1,28 @@
+package scripts;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.entities.*;
+import org.codelutin.math.matrix.*;
+
+/**
+ * ${name}.java
+ *
+ * Created: ${date}
+ *
+ * @author ${author} <$email}>
+ * @version $Revision: 0 $
+ *
+ * Last update: $Date: ${date} $
+ * by : $Author: ${author} $
+ */
+public class ${name} {
+
+ /** to use log facility, just put in your code: log.info("..."); */
+ private static Log log = LogFactory.getLog(${name}.class);
+
+ // add your method here
+
+}
\ No newline at end of file
Added: isis-fish/trunk/src/main/resources/templates/simulator.ftl
===================================================================
--- isis-fish/trunk/src/main/resources/templates/simulator.ftl (rev 0)
+++ isis-fish/trunk/src/main/resources/templates/simulator.ftl 2009-02-23 10:30:42 UTC (rev 1860)
@@ -0,0 +1,32 @@
+package simulators;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.codelutin.math.matrix.*;
+
+import fr.ifremer.isisfish.util.Doc;
+import fr.ifremer.isisfish.entities.*;
+import fr.ifremer.isisfish.simulator.Simulator;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+
+/**
+ * ${name}.java
+ *
+ * Created: ${date}
+ *
+ * @author ${author} <${email}>
+ * @version $Revision: 1545 $
+ *
+ * Last update $Date ${date} $
+ * by : $Author: sletellier $
+ */
+public class ${name} implements Simulator {
+
+ /** to use log facility, just put in your code: log.info("..."); */
+ private static Log log = LogFactory.getLog(${name}.class);
+
+ public void simulate(SimulationContext context) throws Exception {
+ // put your code here
+ }
+}
\ No newline at end of file
1
0