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
February 2010
- 1 participants
- 40 discussions
r2986 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui: models/sensitivity models/sensitivityexport sensitivity sensitivity/model
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 16:11:09 +0000 (Thu, 04 Feb 2010)
New Revision: 2986
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorCardinalityTableModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeCellRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeModel.java
Removed:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorParametersTableModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx
Log:
Some modification on sensitivity UI due to refactoring on simulation UI and group screening
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorParametersTableModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorParametersTableModel.java 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorParametersTableModel.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListModel.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -22,6 +22,8 @@
import javax.swing.DefaultListModel;
+import fr.ifremer.isisfish.ui.models.common.StringListModel;
+
/**
* Model pour la liste des noms d'exports.
*
@@ -30,6 +32,8 @@
*
* Last update : $Date$
* By : $Author: chatellier $
+ *
+ * @deprecated use {@link StringListModel}
*/
public class SensitivityExportNameListModel extends DefaultListModel {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -315,7 +315,7 @@
* @return component copy
*/
public static ContinuousPanelContainerUI getContinuousPanelWithValue(
- JComponent component, ContinuousDomain<?, ?> domain, Factor<?, ?> factor) {
+ JComponent component, ContinuousDomain domain, Factor factor) {
ContinuousPanelContainerUI result = null;
DefaultContinuousPanelUI continuousPanel = null;
@@ -788,7 +788,7 @@
* @param context context
* @return component
*/
- public static JComponent getEditorForFactor(Factor<?, ?> factor, TopiaContext context) {
+ public static JComponent getEditorForFactor(Factor factor, TopiaContext context) {
JComponent result = null;
// we can't do it only with path maybe ?
Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -1,66 +0,0 @@
-/* *##%
- * Copyright (C) 2009 Ifremer, 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.ui.sensitivity;
-
-import static org.nuiton.i18n.I18n._;
-
-import java.awt.Component;
-import java.util.List;
-
-import javax.swing.JLabel;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-import fr.ifremer.isisfish.simulator.sensitivity.Factor;
-
-/**
- * Factor tree cell renderer.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class FactorTreeCellRenderer extends DefaultTreeCellRenderer {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 1686424876690392268L;
-
- /*
- * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)
- */
- @Override
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
-
- JLabel c = (JLabel)super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
-
- if (value instanceof List<?>) {
- c.setText(_("isisfish.sensitivity.factors") + " : ");
- }
- else if (value instanceof Factor<?, ?>) {
- Factor<? ,?> factor = (Factor<?, ?>)value;
- c.setText(factor.getName());
- }
-
- return c;
- }
-}
Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -1,149 +0,0 @@
-/* *##%
- * Copyright (C) 2009 Ifremer, 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.ui.sensitivity;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-import fr.ifremer.isisfish.simulator.sensitivity.Factor;
-
-/**
- * Cette classe gere l'affichage d'une liste de facteurs dans l'arbre.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date: 2008-06-13 11:05:57 +0200 (ven., 13 juin 2008)
- * $ By : $Author$
- */
-public class FactorTreeModel implements TreeModel {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 593284613450915826L;
-
- /** Tree model root. */
- protected List<Factor<?,?>> factorsList;
-
- /** Tree model listeners. */
- protected Collection<TreeModelListener> modelListeners;
-
- /**
- * Constructor.
- *
- * @param factorsList factors list
- */
- public FactorTreeModel(List<Factor<?,?>> factorsList) {
- this.factorsList = factorsList;
- modelListeners = new ArrayList<TreeModelListener>();
- }
-
- /*
- * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
- */
- @Override
- public Object getChild(Object parent, int index) {
-
- Object value = null;
-
- if (parent instanceof List) {
- List<Factor<?,?>> factors = (List<Factor<?,?>>)parent;
- value = factors.get(index);
- }
-
- return value;
- }
-
- /*
- * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
- */
- @Override
- public int getChildCount(Object parent) {
-
- int childCount = 0;
-
- if (parent instanceof List) {
- List<Factor<?,?>> factors = (List<Factor<?,?>>)parent;
- childCount = factors.size();
- }
-
- return childCount;
- }
-
- /*
- * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
- */
- @Override
- public int getIndexOfChild(Object parent, Object child) {
-
- int childIndex = -1;
-
- if (parent instanceof List) {
- List<Factor<?,?>> factors = (List<Factor<?,?>>)parent;
- childIndex = factors.indexOf(child);
- }
-
- return childIndex;
- }
-
- /*
- * @see javax.swing.tree.DefaultTreeModel#isLeaf(java.lang.Object)
- */
- @Override
- public boolean isLeaf(Object node) {
- return getChildCount(node) == 0;
- }
-
- /*
- * @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
- */
- @Override
- public void addTreeModelListener(TreeModelListener l) {
- modelListeners.add(l);
- }
-
- /*
- * @see javax.swing.tree.TreeModel#getRoot()
- */
- @Override
- public Object getRoot() {
- return factorsList;
- }
-
- /*
- * @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
- */
- @Override
- public void removeTreeModelListener(TreeModelListener l) {
- modelListeners.remove(l);
- }
-
- /*
- * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object)
- */
- @Override
- public void valueForPathChanged(TreePath path, Object newValue) {
- throw new RuntimeException("Not implemented");
- }
-
-}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2010-02-04 16:11:09 UTC (rev 2986)
@@ -1,6 +1,6 @@
<!--
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -20,7 +20,6 @@
<Table>
<script><![CDATA[
import javax.swing.table.DefaultTableModel;
- import javax.swing.table.TableModel;
import fr.ifremer.isisfish.ui.simulator.SimulAction;
import fr.ifremer.isisfish.simulator.sensitivity.Domain;
import fr.ifremer.isisfish.simulator.sensitivity.Factor;
@@ -44,6 +43,8 @@
import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableCellRenderer;
import fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableModel;
+ import fr.ifremer.isisfish.ui.sensitivity.model.FactorCardinalityTableModel;
+
protected SimulAction getSimulAction() {
return getContextValue(SimulAction.class);
}
@@ -86,8 +87,16 @@
getSimulAction().setSensitivityCalculator(sensivitityCalculator);
// enable/disable table (if sensivitityCalculator can manage it)
- factorCardinalityScrollPane.setVisible(!sensivitityCalculator.canManageCardinality());
- validate();
+ //factorCardinalityScrollPane.setVisible(!sensivitityCalculator.canManageCardinality());
+ //validate();
+
+ CardLayout factorPanelLayout = (CardLayout)factorCardinalityPanel.getLayout();
+ if (sensivitityCalculator.canManageCardinality()) {
+ factorPanelLayout.show(factorCardinalityPanel, "factorCardinalitySupported");
+ } else {
+ factorPanelLayout.show(factorCardinalityPanel, "factorCardinalityNotSupported");
+ }
+
// update model
//setSensitivityCalculatorParamsModel();
@@ -99,41 +108,18 @@
}
public void setFactorCardinalityTableModel() {
- DefaultTableModel model = new DefaultTableModel() {
- @Override
- public boolean isCellEditable(int row, int column) {
- boolean result = false;
- if (column > 0) {
- result = true;
- }
- return result;
- }
- };
- java.util.List<Factor<?, ?>> factors = getSimulAction().getFactors();
-
- java.util.List<Factor<?, ?>> factorsContinue = new ArrayList<Factor<?, ?>>();
- java.util.List<String> factorsContinueCardinalities = new ArrayList<String>();
- for (Factor<?, ?> f : factors) {
+ java.util.List<Factor> factors = getSimulAction().getFactorGroup().getFactors();
+ java.util.List<Factor> factorsContinue = new ArrayList<Factor>();
+ /* get sublist with only Continous factor */
+ for (Factor f : factors) {
Domain domain = f.getDomain();
if (ContinuousDomain.class.isInstance(domain)) {
ContinuousDomain continuousDomain = (ContinuousDomain)domain;
factorsContinue.add(f);
- factorsContinueCardinalities.add(continuousDomain.getCardinality() + "");
}
}
- model.addColumn(_("isisfish.sensitivity.factor"), factorsContinue.toArray());
- model.addColumn(_("isisfish.sensitivity.increment"), factorsContinueCardinalities.toArray());
-
+ FactorCardinalityTableModel model = new FactorCardinalityTableModel(factorsContinue);
factorCardinality.setModel(model);
- factorCardinality.getModel().addTableModelListener(new TableModelListener() {
- @Override
- public void tableChanged(TableModelEvent e) {
- int row = e.getFirstRow();
- TableModel model = (TableModel)e.getSource();
- Factor f = (Factor) model.getValueAt(row, 0);
- ((ContinuousDomain)f.getDomain()).setCardinality(Integer.parseInt((String)model.getValueAt(row, 1)));
- }
- });
}
protected SensitivityExportNameListModel getAvailableExportListModel() {
@@ -223,8 +209,7 @@
exportParamsTable.setModel(new DefaultTableModel());
}
}
- ]]>
- </script>
+ ]]></script>
<row>
<cell fill="horizontal">
<JLabel text="isisfish.sensitivity.select"/>
@@ -243,76 +228,21 @@
</row>
<row>
<cell columns="2" fill="both" weightx="1.0" weighty="1.0">
- <JScrollPane id="factorCardinalityScrollPane" visible="false">
- <JTable id="factorCardinality" rowHeight='24' />
- </JScrollPane>
+ <JPanel id="factorCardinalityPanel" layout="{new CardLayout()}">
+ <JLabel text="isisfish.sensitivity.methodfactornotsupported" horizontalAlignment="center"
+ border="{BorderFactory.createEtchedBorder()}" font-style="italic" constraints='"factorCardinalityNotSupported"'/>
+ <JScrollPane id="factorCardinalityScrollPane" constraints='"factorCardinalitySupported"'>
+ <JTable id="factorCardinality" model="{new FactorCardinalityTableModel()}" rowHeight='24' />
+ </JScrollPane>
+ </JPanel>
</cell>
</row>
- <!--
<row>
- <cell fill="both" columns='2' weightx="1.0" weighty="1.0">
- <Table>
- <row>
- <cell fill="both" weightx="1.0" weighty="1">
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="isisfish.sensitivity.export"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JComboBox id="exportCombo" model='{getExportTableModel()}'/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1.0" weighty="1.0">
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="exportList" selectionMode="0" onMouseClicked='exportListSelected()'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill="both" weighty="1.0">
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text=" " minimumSize='{new Dimension(2,15)}' preferredSize='{new Dimension(2,15)}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id="addExportButton" text="isisfish.common.add" onActionPerformed='addExport()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id="removeExportButton" text="isisfish.common.remove" enabled="false" onActionPerformed='removeExport()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id="clearExportsButton" text="isisfish.common.clear" enabled="false" onActionPerformed='clearExports()'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty="1.0">
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
+ <cell fill="both" columns='3' weightx="1.0">
+ <JLabel text="isisfish.sensitivity.export"/>
</cell>
- </row> -->
- <row>
- <cell fill="both" columns='3' weightx="1.0">
- <JLabel text="isisfish.sensitivity.export"/>
- </cell>
- </row>
- <row>
+ </row>
+ <row>
<cell columns='2' fill="both" weightx="1.0" weighty="1.0">
<Table>
<row>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabUI.jaxx 2010-02-04 16:11:09 UTC (rev 2986)
@@ -42,6 +42,9 @@
import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
import fr.ifremer.isisfish.ui.simulator.SimulAction;
+import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup;
+import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeModel;
+import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeCellRenderer;
import jaxx.runtime.swing.navigation.NavigationTreeModel;
import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
import jaxx.runtime.swing.navigation.NavigationUtil;
@@ -93,7 +96,7 @@
Object selectedObject = factorsTree.getSelectionValue();
if (selectedObject != null) {
if (selectedObject instanceof Factor) {
- Factor<?, ?> selectedFactor = (Factor<?, ?>)selectedObject;
+ Factor selectedFactor = (Factor)selectedObject;
FactorWizardUI wizard = new FactorWizardUI(this);
JComponent component = getSimulAction().getFactorComponent(selectedFactor);
if (component != null) {
@@ -175,8 +178,8 @@
navigation.setModel(model);
}
public void setFactorModel() {
- java.util.List<Factor<?, ?>> factors = getSimulAction().getFactors();
- FactorTreeModel model = new FactorTreeModel(factors);
+ FactorGroup factorGroup = getSimulAction().getFactorGroup();
+ FactorTreeModel model = new FactorTreeModel(factorGroup);
factorsTree.setModel(model);
factorsTree.setRootVisible(true);
getParentContainer(SensitivityUI.class).getSensitivityChooserUI().setFactorCardinalityTableModel();
@@ -187,7 +190,7 @@
if (selectedObject != null) {
if (selectedObject instanceof Factor) {
- Factor<?, ?> selectedFactor = (Factor<?, ?>)selectedObject;
+ Factor selectedFactor = (Factor)selectedObject;
if (log.isDebugEnabled()) {
log.debug("Deleting factor " + selectedFactor.getName());
}
@@ -213,12 +216,24 @@
</cell>
</row>
</Table>
- <JPanel id="factorPanel" name="factorPanel" layout='{new BorderLayout()}'>
- <JScrollPane constraints='BorderLayout.CENTER'>
- <JTree id="factorsTree" rootVisible="true" selectionRow='0'
- model='{new DefaultTreeModel(null)}' cellRenderer='{new FactorTreeCellRenderer()}'/>
- </JScrollPane>
- </JPanel>
+ <Table>
+ <row>
+ <cell>
+ <JButton icon="table.png" />
+ </cell>
+ <cell anchor='west' weightx='1.0'>
+ <JButton icon="table_multiple.png" />
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill="both" weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JTree id="factorsTree" rootVisible="true" selectionRow='0'
+ model='{new DefaultTreeModel(null)}' cellRenderer='{new FactorTreeCellRenderer()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
</JSplitPane>
</JPanel>
<JPanel id='inputPanePrincipal' layout='{getCardlayoutPrincipal()}'>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2010-02-04 16:11:09 UTC (rev 2986)
@@ -17,78 +17,55 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-->
-<JPanel layout='{new BorderLayout()}'>
+<fr.ifremer.isisfish.ui.SimulationUI>
<script><![CDATA[
- import fr.ifremer.isisfish.ui.simulator.SimulAction;
- import fr.ifremer.isisfish.ui.result.ResultAction;
import jaxx.runtime.JAXXInitialContext;
import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
- import fr.ifremer.isisfish.ui.simulator.ParamsUI;
- import fr.ifremer.isisfish.ui.simulator.ResultChoiceUI;
- import fr.ifremer.isisfish.ui.simulator.AdvancedParamsUI;
- import fr.ifremer.isisfish.ui.simulator.ExportUI;
- import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI;
-
- public void selTab(int i) {
- sensitivityTabs.setSelectedIndex(i);
- }
- public void refresh(){
+
+ @Override
+ public void refresh() {
paramsUI.refresh();
}
-
- // TODO duplicated code (simulUI, Params UI, SensitivityUI)
- protected void importSimulation() {
- JFileChooser fc = new JFileChooser();
- int returnVal = fc.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- //This is where a real application would open the file.
- getContextValue(SimulAction.class).importSimulation(file);
- refresh();
- }
+ @Override
+ public void selectParametersTab() {
+ bodyTabbedPane.setSelectedIndex(0);
}
- // TODO duplicated code (simulUI, Params UI, SensitivityUI)
- protected void saveSimulation() {
- JFileChooser fc = new JFileChooser();
- int returnVal = fc.showSaveDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- //This is where a real application would open the file.
- getContextValue(SimulAction.class).saveSimulation(file);
- }
+ @Override
+ public void setEnabledPrescriptTab(boolean selected) {
+ // no prescript in AS
}
+
+ @Override
+ public void setEnabledAnalysePlanTab(boolean selected) {
+ // no analyse plan in AS
+ }
]]>
</script>
- <JMenuBar id="simulMenuBar" constraints='BorderLayout.NORTH'>
- <JMenu id="simulMenu" text="isisfish.simulation.menu.simulation">
- <JMenuItem id="siSave" text="isisfish.simulation.menu.save" onActionPerformed="saveSimulation()"/>
- <JMenuItem id="siImport" text="isisfish.simulation.menu.import" onActionPerformed="importSimulation()"/>
- </JMenu>
- </JMenuBar>
- <JTabbedPane id="sensitivityTabs" constraints="BorderLayout.CENTER">
+ <JTabbedPane id="bodyTabbedPane">
<tab title='isisfish.params.title'>
- <ParamsUI id='paramsUI' sensitivity='{true}' constructorParams='this'/>
+ <fr.ifremer.isisfish.ui.simulator.ParamsUI id='paramsUI' sensitivity='{true}' constructorParams='this'/>
</tab>
<tab title='isisfish.sensitivity.title'>
- <SensitivityTabUI id="sensitivityTabUI" constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivityAction()).add(new InputSaveVerifier()).add(this)'/>
+ <fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI id="sensitivityTabUI"
+ constructorParams='new JAXXInitialContext().add(new InputAction()).add(new SensitivityAction()).add(new InputSaveVerifier()).add(this)'/>
</tab>
<tab title='isisfish.sensitivityChooser.title'>
<SensitivityChooserUI id="sensitivityChooserUI" constructorParams='this'/>
</tab>
<tab id="exportUITab" title='isisfish.export.title'>
- <ExportUI id="exportUI" constructorParams='this'/>
+ <fr.ifremer.isisfish.ui.simulator.ExportUI id="exportUI" constructorParams='this'/>
</tab>
<tab id="resultChoiceUITab" title='isisfish.resultChoice.title'>
- <ResultChoiceUI id="resultChoiceUI" constructorParams='this'/>
+ <fr.ifremer.isisfish.ui.simulator.ResultChoiceUI id="resultChoiceUI" constructorParams='this'/>
</tab>
<tab id="advancedParamsUITab" title='isisfish.advancedParameters.title'>
- <AdvancedParamsUI id="advancedParamsUI" constructorParams='this'/>
+ <fr.ifremer.isisfish.ui.simulator.AdvancedParamsUI id="advancedParamsUI" constructorParams='this'/>
</tab>
<tab id="secondPassUITab" title='isisfish.sensitivity.secondpass.title'>
<SensitivitySecondPassUI id="sensitivitySecondPassUI" constructorParams='this'/>
</tab>
</JTabbedPane>
-</JPanel>
+</fr.ifremer.isisfish.ui.SimulationUI>
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorCardinalityTableModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorCardinalityTableModel.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorCardinalityTableModel.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -0,0 +1,186 @@
+/* *##%
+ * Copyright (C) 2009 - 2010 Ifremer, 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.ui.sensitivity.model;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.util.List;
+
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import fr.ifremer.isisfish.simulator.sensitivity.Factor;
+import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain;
+
+/**
+ * Model de la table de definition des cadinalité de facteurs.
+ *
+ * Columns :
+ * <li>Factor name</li>
+ * <li>Cardinality</li>
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author: chatellier $
+ */
+public class FactorCardinalityTableModel extends AbstractTableModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 7739699364084480516L;
+
+ /** Log. */
+ private static Log log = LogFactory
+ .getLog(FactorCardinalityTableModel.class);
+
+ /** Columns names. */
+ public final static String[] COLUMN_NAMES = {
+ _("isisfish.sensitivity.factor"),
+ _("isisfish.sensitivity.increment") };
+
+ protected List<Factor> factors;
+
+ /**
+ * Constructor with null data.
+ */
+ public FactorCardinalityTableModel() {
+ this(null);
+ }
+
+ /**
+ * Constructor with data.
+ *
+ * @param factors factors
+ */
+ public FactorCardinalityTableModel(List<Factor> factors) {
+ super();
+ this.factors = factors;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnCount()
+ */
+ @Override
+ public int getColumnCount() {
+ return COLUMN_NAMES.length;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getRowCount()
+ */
+ @Override
+ public int getRowCount() {
+ int count = 0;
+
+ if (factors != null) {
+ count = factors.size();
+ }
+ return count;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getValueAt(int, int)
+ */
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+
+ Object result = null;
+
+ Factor factor = factors.get(rowIndex);
+ switch (columnIndex) {
+ case 0:
+ result = factor.getName();
+ break;
+ case 1:
+ ContinuousDomain domain = (ContinuousDomain) factor
+ .getDomain();
+ result = domain.getCardinality();
+ break;
+ default:
+ throw new IndexOutOfBoundsException("No such column " + columnIndex);
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnClass(int)
+ */
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
+
+ Class<?> result = null;
+
+ switch (columnIndex) {
+ case 0:
+ result = String.class;
+ break;
+ case 1:
+ result = Integer.class;
+ break;
+ default:
+ throw new IndexOutOfBoundsException("No such column " + columnIndex);
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnName(int)
+ */
+ @Override
+ public String getColumnName(int columnIndex) {
+ return COLUMN_NAMES[columnIndex];
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#isCellEditable(int, int)
+ */
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return columnIndex > 0;
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
+ */
+ @Override
+ public void setValueAt(Object value, int rowIndex, int columnIndex) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Cell edition (column " + columnIndex + ") = " + value);
+ }
+
+ Factor factor = factors.get(rowIndex);
+ switch (columnIndex) {
+ case 1:
+ Integer iValue = (Integer) value;
+ ContinuousDomain domain = (ContinuousDomain) factor
+ .getDomain();
+ domain.setCardinality(iValue);
+ break;
+ default:
+ throw new IndexOutOfBoundsException("Can't edit column "
+ + columnIndex);
+ }
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorCardinalityTableModel.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Copied: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeCellRenderer.java (from rev 2946, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java)
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeCellRenderer.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeCellRenderer.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -0,0 +1,60 @@
+/* *##%
+ * Copyright (C) 2009 - 2010 Ifremer, 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.ui.sensitivity.model;
+
+import java.awt.Component;
+
+import javax.swing.JLabel;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+import fr.ifremer.isisfish.simulator.sensitivity.Factor;
+
+/**
+ * Factor tree cell renderer.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FactorTreeCellRenderer extends DefaultTreeCellRenderer {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 1686424876690392268L;
+
+ /*
+ * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)
+ */
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean selected, boolean expanded, boolean leaf, int row,
+ boolean hasFocus) {
+
+ JLabel c = (JLabel)super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
+
+ if (value instanceof Factor) {
+ Factor factor = (Factor)value;
+ c.setText(factor.getName());
+ }
+
+ return c;
+ }
+}
Copied: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeModel.java (from rev 2946, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModel.java)
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeModel.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/FactorTreeModel.java 2010-02-04 16:11:09 UTC (rev 2986)
@@ -0,0 +1,149 @@
+/* *##%
+ * Copyright (C) 2009 - 2010 Ifremer, 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.ui.sensitivity.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+import fr.ifremer.isisfish.simulator.sensitivity.Factor;
+import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup;
+
+/**
+ * Cette classe gere l'affichage d'une liste de facteurs dans l'arbre.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date: 2008-06-13 11:05:57 +0200 (ven., 13 juin 2008)
+ * $ By : $Author$
+ */
+public class FactorTreeModel implements TreeModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 593284613450915826L;
+
+ /** Tree model root. */
+ protected Factor rootFactor;
+
+ /** Tree model listeners. */
+ protected Collection<TreeModelListener> modelListeners;
+
+ /**
+ * Constructor.
+ *
+ * @param rootFactor root factor (typically, a {@link FactorGroup})
+ */
+ public FactorTreeModel(Factor rootFactor) {
+ this.rootFactor = rootFactor;
+ modelListeners = new ArrayList<TreeModelListener>();
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
+ */
+ @Override
+ public Object getChild(Object parent, int index) {
+
+ Object value = null;
+
+ if (parent instanceof FactorGroup) {
+ FactorGroup factorGroup = (FactorGroup)parent;
+ value = factorGroup.get(index);
+ }
+
+ return value;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
+ */
+ @Override
+ public int getChildCount(Object parent) {
+
+ int childCount = 0;
+
+ if (parent instanceof FactorGroup) {
+ FactorGroup factorGroup = (FactorGroup)parent;
+ childCount = factorGroup.size();
+ }
+
+ return childCount;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int getIndexOfChild(Object parent, Object child) {
+
+ int childIndex = -1;
+
+ if (parent instanceof FactorGroup) {
+ FactorGroup factorGroup = (FactorGroup)parent;
+ childIndex = factorGroup.indexOf(child);
+ }
+
+ return childIndex;
+ }
+
+ /*
+ * @see javax.swing.tree.DefaultTreeModel#isLeaf(java.lang.Object)
+ */
+ @Override
+ public boolean isLeaf(Object node) {
+ return getChildCount(node) == 0;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
+ */
+ @Override
+ public void addTreeModelListener(TreeModelListener l) {
+ modelListeners.add(l);
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getRoot()
+ */
+ @Override
+ public Object getRoot() {
+ return rootFactor;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
+ */
+ @Override
+ public void removeTreeModelListener(TreeModelListener l) {
+ modelListeners.remove(l);
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object)
+ */
+ @Override
+ public void valueForPathChanged(TreePath path, Object newValue) {
+ throw new RuntimeException("Not implemented");
+ }
+
+}
1
0
r2985 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui: . input models models/common models/export models/result models/rule models/simulation simulator
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 16:09:42 +0000 (Thu, 04 Feb 2010)
New Revision: 2985
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx
Removed:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Common.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/simulation/SimulationNamesComboModel.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx
Log:
Refactoring on simulation launch UI.
- extract rule component factor
- add UI inheritance
- add more component activation after region loading
Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Common.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Common.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/Common.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,129 +0,0 @@
-/* *##%
- * Copyright (C) 2006 - 2010 Ifremer, 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.ui;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import fr.ifremer.isisfish.datastore.RegionStorage;
-import fr.ifremer.isisfish.datastore.RuleStorage;
-import fr.ifremer.isisfish.datastore.SimulationStorage;
-import fr.ifremer.isisfish.simulator.SimulationProperties;
-import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil;
-import fr.ifremer.isisfish.ui.widget.filter.FilterModel;
-
-/**
- * Common class containing static method to get some list (region, simulations...).
- *
- * Created: 22 août 2006 10:50:49
- *
- * @author poussin
- * @version $Revision: 1302 $
- *
- * Last update: $Date: 2008-08-18 15:42:57 +0200 (Mon, 18 Aug 2008) $
- * by : $Author: bpoussin $
- *
- * @deprecated (since 20091414) use xxxAction class instead)
- */
-public class Common {
-
- /** Class logger. */
- private static Log log = LogFactory.getLog(Common.class);
-
- /**
- * Return regions.
- *
- * @return regions
- *
- * @deprecated since 3.3.1.0, use {@link RegionStorage#getRegionNames()} instead
- */
- public static Object[] getRegionItem() {
- List<String> regionNames = new ArrayList<String>();
-
- // FIXME chatellier : Ajout d'une entrée vide pour forcer la sélection
- // et que le changement lance un evenement sur la liste
- regionNames.add(" ");
-
- regionNames.addAll(RegionStorage.getRegionNames());
- Object[] result = regionNames.toArray();
- return result;
- }
-
- /**
- * Return old simulations.
- *
- * @return old simulations
- *
- * @deprecated since 3.3.1.0, use {@link SimulationStorage#getSimulationNames()} instead
- */
- public static Object[] getOldSimulationItem() {
-
- try {
- List<String> oldSimul = new ArrayList<String>();
-
- FilterModel<SimulationProperties, String> filterModel;
- // keep in context list of old simulation names (for filter process)
- oldSimul.addAll(SimulationStorage.getSimulationNames());
- // create filter model
- filterModel = SimulationFilterUtil.createFilterModel(oldSimul);
- // to used directly model.getFilteredResult() in xml
- // we must fill filterModel result with original items
- filterModel.selectAll();
- Object[] result = oldSimul.toArray();
-
- // FIXME chatellier : Ajout d'une entrée vide pour forcer la sélection
- // et que le changement lance un evenement sur la liste
- oldSimul.add(0, " ");
-
- return result;
- } catch (ParseException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't get old simulations", ex);
- }
- } catch (IOException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't get old simulations", ex);
- }
- }
- return null;
- }
-
- /**
- * Return list with all available rules names.
- *
- * @return list with all available rules names
- *
- * @deprecated since 3.3.1.0, use {@link RuleStorage#getRuleNames()} instead
- */
- public static List<String> getAvailablesRuleNames() {
- List<String> result = new ArrayList<String>();
- for (String ruleName : RuleStorage.getRuleNames()) {
- // TODO remove last .java
- String shortRuleName = ruleName.substring(0, ruleName.length() - 5);
- result.add(shortRuleName);
- }
- return result;
- }
-
-}
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/SimulationUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -0,0 +1,83 @@
+<!--
+/* *##%
+ * Copyright (C) 2010 Ifremer, Code Lutin, Chatellier Eric
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+ -->
+<JPanel layout='{new BorderLayout()}' abstract="true">
+
+ <script><![CDATA[
+
+ import fr.ifremer.isisfish.ui.simulator.SimulAction;
+
+ /**
+ * Refresh all simulation launch UI.
+ */
+ protected abstract void refresh();
+
+ /**
+ * Set selected tab to parameters tab.
+ */
+ public abstract void selectParametersTab();
+
+ /**
+ * Change prescript tab enabled property.
+ */
+ public abstract void setEnabledPrescriptTab(boolean selected);
+
+ /**
+ * Change analyse plan tab enabled property.
+ */
+ public abstract void setEnabledAnalysePlanTab(boolean selected);
+
+ /**
+ * Open user dialog to selected a parameter file.
+ * Reload it, and call {@link refresh()}.
+ */
+ protected void importSimulation() {
+ JFileChooser fc = new JFileChooser();
+ int returnVal = fc.showOpenDialog(this);
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fc.getSelectedFile();
+ //This is where a real application would open the file.
+ getContextValue(SimulAction.class).importSimulation(file);
+ refresh();
+ }
+ }
+
+ /**
+ * Save current parameter in user selected parameter output file.
+ */
+ public void saveSimulation() {
+ JFileChooser fc = new JFileChooser();
+ int returnVal = fc.showSaveDialog(this);
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fc.getSelectedFile();
+ //This is where a real application would open the file.
+ getContextValue(SimulAction.class).saveSimulation(file);
+ }
+ }
+ ]]></script>
+ <JMenuBar constraints='BorderLayout.NORTH'>
+ <JMenu text="isisfish.simulation.menu.simulation">
+ <JMenuItem id="miSave" text="isisfish.simulation.menu.save" onActionPerformed="saveSimulation()"/>
+ <JMenuItem id="miImport" text="isisfish.simulation.menu.import" onActionPerformed="importSimulation()"/>
+ </JMenu>
+ </JMenuBar>
+ <JTabbedPane id="bodyTabbedPane" constraints='BorderLayout.CENTER'/>
+</JPanel>
\ No newline at end of file
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -35,9 +35,9 @@
import fr.ifremer.isisfish.datastore.StorageChangeEvent;
import fr.ifremer.isisfish.datastore.StorageChangeListener;
import fr.ifremer.isisfish.entities.FisheryRegionImpl;
-import fr.ifremer.isisfish.ui.Common;
import fr.ifremer.isisfish.ui.WelcomeSaveVerifier;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import fr.ifremer.isisfish.ui.models.common.StringListModel;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
@@ -68,11 +68,9 @@
return getContextValue(RegionStorage.class);
}
protected void setFieldCurrentRegionModel() {
- fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
+ StringListModel model = new StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames());
+ fieldCurrentRegion.setModel(model);
}
-protected DefaultComboBoxModel getFieldCurrentRegionModel() {
- return new DefaultComboBoxModel(Common.getRegionItem());
-}
protected void regionChange(ItemEvent e) {
// event launched twice with itemchange listener
if (e.getStateChange() == ItemEvent.SELECTED) {
@@ -253,7 +251,8 @@
</row>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldCurrentRegion" model='{getFieldCurrentRegionModel()}' onItemStateChanged='regionChange(event)' />
+ <JComboBox id="fieldCurrentRegion" onItemStateChanged='regionChange(event)'
+ model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'/>
</cell>
</row>
</Table>
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -0,0 +1,122 @@
+/* *##%
+ * Copyright (C) 2009-2010 Ifremer, 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.ui.models.common;
+
+import java.util.List;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JList;
+
+/**
+ * Model pour pour la representation d'une liste de {@link String}.
+ * Utilisation dans les {@link JList} et {@link JComboBox}.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author: chatellier $
+ */
+public class StringListModel extends AbstractListModel implements ComboBoxModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -4070846632975105788L;
+
+ /** {@link String} list. */
+ protected List<String> stringList;
+
+ /** Selected element. */
+ protected Object selectedElement;
+
+ /**
+ * Empty constructor.
+ */
+ public StringListModel() {
+ this(null);
+ }
+
+ /**
+ * Constructor with export list.
+ *
+ * @param stringList {@link String} list
+ */
+ public StringListModel(List<String> stringList) {
+ super();
+ setStringList(stringList);
+ }
+
+ /**
+ * Get {@link String} list.
+ *
+ * @return {@link String} list
+ */
+ public List<String> getStringList() {
+ return stringList;
+ }
+
+ /**
+ * Set {@link String} list.
+ *
+ * @param stringList {@link String} list to set
+ */
+ public void setStringList(List<String> stringList) {
+ this.stringList = stringList;
+ // reset selected
+ selectedElement = null;
+ }
+
+ /*
+ * @see javax.swing.ListModel#getElementAt(int)
+ */
+ @Override
+ public Object getElementAt(int index) {
+ return stringList.get(index);
+ }
+
+ /*
+ * @see javax.swing.ListModel#getSize()
+ */
+ @Override
+ public int getSize() {
+ int size = 0;
+
+ if (stringList != null) {
+ size = stringList.size();
+ }
+ return size;
+ }
+
+ /*
+ * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object)
+ */
+ @Override
+ public void setSelectedItem(Object anItem) {
+ selectedElement = anItem;
+ }
+
+ /*
+ * @see javax.swing.ComboBoxModel#getSelectedItem()
+ */
+ @Override
+ public Object getSelectedItem() {
+ return selectedElement;
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/common/StringListModel.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListModel.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -22,6 +22,8 @@
import javax.swing.DefaultListModel;
+import fr.ifremer.isisfish.ui.models.common.StringListModel;
+
/**
* Model pour la liste des noms d'exports.
*
@@ -30,6 +32,8 @@
*
* Last update : $Date$
* By : $Author$
+ *
+ * @deprecated use {@link StringListModel}
*/
public class ExportNameListModel extends DefaultListModel {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListModel.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -22,6 +22,8 @@
import javax.swing.DefaultListModel;
+import fr.ifremer.isisfish.ui.models.common.StringListModel;
+
/**
* Model pour la liste des noms de resultats de simulation.
*
@@ -30,6 +32,8 @@
*
* Last update : $Date$
* By : $Author$
+ *
+ * @deprecated use {@link StringListModel}
*/
public class ResultListModel extends DefaultListModel {
Deleted: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,93 +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.ui.models.rule;
-
-import static org.nuiton.i18n.I18n._;
-
-import java.awt.Component;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-
-import fr.ifremer.isisfish.datastore.RuleStorage;
-import fr.ifremer.isisfish.rule.Rule;
-import fr.ifremer.isisfish.ui.util.TooltipHelper;
-
-/**
- * Renderer pour la combo des noms de regles.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class RuleComboRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = -4070846632975105788L;
-
- /** Rule cache. */
- protected Map<String, Rule> ruleCache;
-
- /**
- * Empty constructor.
- */
- public RuleComboRenderer() {
- ruleCache = new HashMap<String, Rule>();
- }
-
- /*
- * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
- */
- @Override
- public Component getListCellRendererComponent(JList list, Object value,
- int index, boolean isSelected, boolean cellHasFocus) {
-
- // this must be used to have alterned highlight rows and default
- // selection color
- JLabel c = (JLabel)super.getListCellRendererComponent(list,value,index, isSelected, cellHasFocus);
-
- String ruleName = (String)value;
- c.setText(ruleName);
-
- // c'est tres couteux d'avoir une instance
- // on les met en cache
- try {
- Rule rule = ruleCache.get(ruleName);
- if (rule == null) {
- RuleStorage storage = RuleStorage.getRule(ruleName);
- rule = storage.getNewRuleInstance();
- ruleCache.put(ruleName, rule);
- }
-
- c.setToolTipText(rule.getDescription());
- } catch (Exception e) {
- String errorTooltip = TooltipHelper.getErrorTooltip(_("isisfish.error.compile.fileerror", ruleName));
- c.setToolTipText(errorTooltip);
- }
-
- return c;
- }
-}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListModel.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -18,15 +18,10 @@
package fr.ifremer.isisfish.ui.models.rule;
-import java.awt.Component;
import java.util.List;
import javax.swing.AbstractListModel;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-import fr.ifremer.isisfish.datastore.RuleStorage;
import fr.ifremer.isisfish.rule.Rule;
/**
@@ -38,8 +33,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class RuleListModel extends AbstractListModel implements
- ListCellRenderer {
+public class RuleListModel extends AbstractListModel {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
@@ -101,31 +95,4 @@
}
return size;
}
-
- /*
- * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
- */
- @Override
- public Component getListCellRendererComponent(JList list, Object value,
- int index, boolean isSelected, boolean cellHasFocus) {
-
- Rule rule = rules.get(index);
-
- JLabel label = new JLabel();
-
- try {
- label.setToolTipText(rule.getDescription());
- } catch (Exception e) {
- // can't get exception
- }
- label.setText(RuleStorage.getName(rule));
-
- if (isSelected) {
- label.setBackground(list.getSelectionBackground());
- label.setForeground(list.getSelectionForeground());
- label.setOpaque(true); // background won't work
- }
-
- return label;
- }
}
Copied: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java (from rev 2946, isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleComboRenderer.java)
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -0,0 +1,91 @@
+/* *##%
+ * Copyright (C) 2009 - 2010 Ifremer, 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.ui.models.rule;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Component;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JLabel;
+import javax.swing.JList;
+
+import fr.ifremer.isisfish.datastore.RuleStorage;
+import fr.ifremer.isisfish.rule.Rule;
+import fr.ifremer.isisfish.ui.util.TooltipHelper;
+
+/**
+ * Renderer pour les listes des noms de regles.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class RuleNamesListRenderer extends DefaultListCellRenderer {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -4070846632975105788L;
+
+ /** Rule cache. */
+ protected Map<String, Rule> ruleCache;
+
+ /**
+ * Empty constructor.
+ */
+ public RuleNamesListRenderer() {
+ ruleCache = new HashMap<String, Rule>();
+ }
+
+ /*
+ * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
+ */
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+
+ // this must be used to have alterned highlight rows and default
+ // selection color
+ JLabel c = (JLabel)super.getListCellRendererComponent(list,value,index, isSelected, cellHasFocus);
+
+ String ruleName = (String)value;
+ c.setText(ruleName);
+
+ // c'est tres couteux d'avoir une instance
+ // on les met en cache
+ try {
+ Rule rule = ruleCache.get(ruleName);
+ if (rule == null) {
+ RuleStorage storage = RuleStorage.getRule(ruleName);
+ rule = storage.getNewRuleInstance();
+ ruleCache.put(ruleName, rule);
+ }
+
+ c.setToolTipText(rule.getDescription());
+ } catch (Exception e) {
+ String errorTooltip = TooltipHelper.getErrorTooltip(_("isisfish.error.compile.fileerror", ruleName));
+ c.setToolTipText(errorTooltip);
+ }
+
+ return c;
+ }
+}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableModel.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -63,6 +63,13 @@
protected List<String> ruleParametersNames;
/**
+ * Constructor.
+ */
+ public RuleParametersTableModel() {
+ this(null);
+ }
+
+ /**
* Constructor with data.
*
* @param rule rule to edit parameters
@@ -73,10 +80,12 @@
//TODO map may be sorted
ruleParametersNames = new ArrayList<String>();
- Map<String, Class<?>> ruleParametersNamesAndTypes = RuleStorage
- .getParameterNames(rule);
- for (String names : ruleParametersNamesAndTypes.keySet()) {
- ruleParametersNames.add(names);
+ if (rule != null) {
+ Map<String, Class<?>> ruleParametersNamesAndTypes = RuleStorage
+ .getParameterNames(rule);
+ for (String names : ruleParametersNamesAndTypes.keySet()) {
+ ruleParametersNames.add(names);
+ }
}
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/simulation/SimulationNamesComboModel.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/simulation/SimulationNamesComboModel.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/simulation/SimulationNamesComboModel.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -30,6 +30,8 @@
*
* Last update : $Date$
* By : $Author$
+ *
+ * @deprecated since 3.3.1.0, use {@link StringListModel} instead
*/
public class SimulationNamesComboModel extends DefaultComboBoxModel {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,6 +1,6 @@
<!--
/* *##%
- * Copyright (C) 2005 - 2009 Ifremer, Code Lutin
+ * Copyright (C) 2005 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -18,12 +18,13 @@
*##%*/
-->
<Table>
+ <Boolean id="regionLoaded" javaBean="false" />
+
<!-- ui state when editing -->
<Boolean id='sensitivity' javaBean='false'/>
<script><![CDATA[
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.TopiaContext;
+import java.util.EventObject;
import java.text.ParseException;
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.StorageChangeEvent;
@@ -33,11 +34,12 @@
import fr.ifremer.isisfish.entities.Strategy;
import fr.ifremer.isisfish.entities.FisheryRegion;
import fr.ifremer.isisfish.entities.FisheryRegionImpl;
-import fr.ifremer.isisfish.ui.Common;
+import fr.ifremer.isisfish.ui.SimulationUI;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import fr.ifremer.isisfish.ui.WelcomeTabUI;
+import fr.ifremer.isisfish.ui.models.common.StringListModel;
import fr.ifremer.isisfish.ui.models.rule.RuleComboModel;
-import fr.ifremer.isisfish.ui.models.rule.RuleComboRenderer;
+import fr.ifremer.isisfish.ui.models.rule.RuleNamesListRenderer;
import fr.ifremer.isisfish.ui.models.rule.RuleListModel;
import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel;
import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor;
@@ -48,6 +50,10 @@
import fr.ifremer.isisfish.simulator.launcher.SimulationService;
import fr.ifremer.isisfish.simulator.launcher.SimulationJob;
import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.math.matrix.MatrixND;
+import org.apache.commons.lang.ArrayUtils;
// instances variables déclaration
SimulationServiceListener simulationListener;
@@ -57,7 +63,8 @@
regionStorageListener = new StorageChangeListener() {
@Override
public void versionDataChanged(StorageChangeEvent e) {
- fieldSimulParamsRegion.setModel(new DefaultComboBoxModel(Common.getRegionItem()));
+ StringListModel model = new StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames());
+ fieldSimulParamsRegion.setModel(model);
}
};
RegionStorage.addStorageChangeListener(regionStorageListener);
@@ -78,24 +85,14 @@
}
}
-public ParamsUI(SimulAction action) {
- setContextValue(action);
-}
-
public void refresh() {
- // TODO add comment why remove/readd ?
- // Disabled , concurrent modification exception
- // refresh is called durring listener iteration
- //SimulationService.getService().removeSimulationServiceListener(simulationListener);
- //SimulationService.getService().addSimulationServiceListener(simulationListener);
-
if (simulAction.getSimulationStorage() != null) {
fieldSimulParamsName.setText(simulAction.getSimulationStorage().getName());
}
fieldSimulParamsDesc.setText(simulAction.getSimulationParameter().getDescription());
setListSimulParamsStrategiesItems();
setListSimulParamsPopulationsItems();
- setRulesListModel();
+ ruleChooser.setRegionStorage(simulAction.getRegionStorage());
}
/**
@@ -113,6 +110,8 @@
@Override
public void run() {
simulAction.regionChange(selected);
+ // not sure that setRegionLoaded is at the better place
+ setRegionLoaded(true);
refresh();
setSensitivityTabRegion();
getParentContainer(WelcomePanelUI.class).setStatusMessage(_("isisfish.message.region.loaded"));
@@ -189,12 +188,26 @@
setExportSens();
setSensitivityCalculator();
setFactor();
+
+ // regles
+ ruleChooser.setRulesList(simulAction.getSimulationParameter().getRules());
+
getParentContainer(WelcomePanelUI.class).setStatusMessage(_("isisfish.message.old.simulation.loaded"));
}
});
}
}
+
+/**
+ * Lance la simulation.
+ */
protected void launchSimulation() {
+
+ // la gestion des regles est maintenant independante de SimulAction
+ // il faut faire le set qui va bien avant le lancement
+ simulAction.getSimulationParameter().setRules(ruleChooser.getRulesList());
+
+
if (!isSensitivity()) {
simulAction.launchSimulation(fieldSimulParamsName.getText(), (SimulatorLauncher)comboSelLauncher.getSelectedItem());
}
@@ -208,29 +221,17 @@
parent.setQueueTabSelection();
}
}
-protected void enablePreSimul() {
+protected void enablePreScript() {
simulAction.getSimulationParameter().setUsePreScript(fieldUseSimulPreScripts.isSelected());
- if (!isSensitivity()){
- SimulUI simul = getParentContainer(SimulUI.class);
- simul.enablePreSimul(fieldUseSimulPreScripts.isSelected());
- }
+ SimulationUI simulationUI = getParentContainer(SimulationUI.class);
+ simulationUI.setEnabledPrescriptTab(fieldUseSimulPreScripts.isSelected());
}
protected void enableAnalysePlan() {
simulAction.getSimulationParameter().setUseAnalysePlan(fieldSimulUseAnalysePlan.isSelected());
- if (!isSensitivity()) {
- SimulUI simul = getParentContainer(SimulUI.class);
- simul.enableAnalysePlan(fieldSimulUseAnalysePlan.isSelected());
- }
+ SimulationUI simulationUI = getParentContainer(SimulationUI.class);
+ simulationUI.setEnabledAnalysePlanTab(fieldSimulUseAnalysePlan.isSelected());
}
-protected void selTab(MouseEvent e, int i) {
- if (((JCheckBox)e.getSource()).isSelected()){
- SimulUI simul = getParentContainer(SimulUI.class);
- simul.selTab(i);
- }
-}
-protected void setNbAnnees() {
- simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText());
-}
+
protected void setListSimulParamsStrategiesItems() {
DefaultListModel listSimulParamsStrategiesModel = new DefaultListModel();
java.util.List<Strategy> strategies = simulAction.getStrategies();
@@ -264,76 +265,38 @@
populationSelected();
}
}
-protected void populationSelected(){
- if (listSimulParamsPopulations.getSelectedIndex() != -1) {
- simulAction.setPopulations(listSimulParamsPopulations.getSelectedValues());
- simulParamsNumbers.setMatrix(simulAction.getSimulationParameter().getNumberOf((Population) listSimulParamsPopulations.getSelectedValue()));
- }
-}
-protected void strategySelected(){
- simulAction.setStrategies(listSimulParamsStrategies.getSelectedValues());
-}
-protected void saveDescription() {
- simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText());
-}
-
-protected void setRulesListModel() {
- if (log.isDebugEnabled()) {
- log.debug("Set simulation rules model");
- }
- RuleListModel model = new RuleListModel(simulAction.getRules());
- listSimulParamsMesuresList.setModel(model);
- listSimulParamsMesuresList.setCellRenderer(model);
-
- onRuleSelectionChange();
-}
/**
- * Called when selection change on rule list.
+ * Population selection changed.
+ *
+ * Fill matrix panel with population effectif of selected population.
*/
-protected void onRuleSelectionChange() {
- if (simulAction.getRules().isEmpty()) {
- buttonSimulParamsMesuresClear.setEnabled(false);
- buttonSimulParamsMesuresRemove.setEnabled(false);
+protected void populationSelected() {
+ CardLayout layout = (CardLayout)populationEffectivesPanel.getLayout();
+
+ Object[] selectedPopulationsValues = listSimulParamsPopulations.getSelectedValues();
+ if (!ArrayUtils.isEmpty(selectedPopulationsValues)) {
+ populationEffectivesTabbedPane.removeAll();
+ simulAction.setPopulations(selectedPopulationsValues);
+
+ for (Object selectedPopulationValue : selectedPopulationsValues) {
+ Population selectedPopulation = (Population)selectedPopulationValue;
+ org.nuiton.math.matrix.gui.MatrixPanelEditor matrixPanel = new org.nuiton.math.matrix.gui.MatrixPanelEditor();
+ MatrixND populationEffectives = simulAction.getSimulationParameter().getNumberOf(selectedPopulation);
+ matrixPanel.setMatrix(populationEffectives);
+ populationEffectivesTabbedPane.add(matrixPanel, _("isisfish.params.populationEffectives", selectedPopulation.getName()));
+ }
+
+ layout.show(populationEffectivesPanel, "specific");
}
else {
- if (listSimulParamsMesuresList.getSelectedIndex() != -1) {
- buttonSimulParamsMesuresRemove.setEnabled(true);
- setSimulParamsRulesModel();
- }
- buttonSimulParamsMesuresClear.setEnabled(true);
+ layout.show(populationEffectivesPanel, "default");
}
}
-protected void setSimulParamsRulesModel() {
- int selectedRuleIndex = listSimulParamsMesuresList.getSelectedIndex();
- if (selectedRuleIndex != -1) {
- RuleListModel listModel = (RuleListModel)listSimulParamsMesuresList.getModel();
- Rule selectedRule = listModel.getRules().get(selectedRuleIndex);
- RuleParametersTableModel model = new RuleParametersTableModel(selectedRule);
- RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule);
- RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule);
- cellEditor.setRegion(simulAction.getRegionStorage());
- simulParamsRules.setModel(model);
- simulParamsRules.getColumnModel().getColumn(0).setCellRenderer(cellRenderer);
- simulParamsRules.getColumnModel().getColumn(1).setCellEditor(cellEditor);
- }
+protected void strategySelected(){
+ simulAction.setStrategies(listSimulParamsStrategies.getSelectedValues());
}
-protected void addRules() {
- String selectedRuleName = (String)fieldSimulParamsMesuresSelect.getSelectedItem();
- simulAction.addNewRule(selectedRuleName);
- setRulesListModel();
-}
-protected void removeRules() {
- RuleListModel listModel = (RuleListModel)listSimulParamsMesuresList.getModel();
- Rule selectedRule = listModel.getRules().get(listSimulParamsMesuresList.getSelectedIndex());
- simulAction.removeRule(selectedRule);
- setRulesListModel();
-}
-protected void clearRules() {
- simulAction.getSimulationParameter().clearRules();
- setRulesListModel();
-}
protected void selectFilter() {
try {
@@ -372,25 +335,6 @@
simulAction.resetOldSimulatorNames();
fieldSimulParamsSelect.setModel(getSimulParamsSelectModel(false));
}
-protected void saveName(){
- simulAction.setName(fieldSimulParamsName.getText());
-}
-
-/**
- * TODO : Common code with {@link SimulUI#saveSimulation()}
- * TODO duplicated code (simulUI, Params UI, SensitivityUI)
- */
-protected void saveSimulation() {
- JFileChooser fc = new JFileChooser();
- int returnVal = fc.showSaveDialog(null);
-
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- //This is where a real application would open the file.
- simulAction.saveSimulation(file);
- }
-}
-
]]>
</script>
<row>
@@ -426,10 +370,14 @@
<Table>
<row>
<cell fill="horizontal">
- <JLabel id='lblName' text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}' minimumSize='{new Dimension(195,25)}' preferredSize='{new Dimension(195,25)}'/>
+ <JLabel id='lblName' text='{isSensitivity() ? _("isisfish.params.sensitivityName") : _("isisfish.params.simulationName")}'
+ minimumSize='{new Dimension(195,25)}' preferredSize='{new Dimension(195,25)}' />
</cell>
<cell fill="both" weightx="1.0">
- <JTextField id="fieldSimulParamsName" onFocusLost='saveName()'/>
+ <JTextField id="fieldSimulParamsName"/>
+ <javax.swing.text.Document javaBean="fieldSimulParamsName.getDocument()"
+ onInsertUpdate='simulAction.setName(fieldSimulParamsName.getText())'
+ onRemoveUpdate='simulAction.setName(fieldSimulParamsName.getText())' />
</cell>
</row>
</Table>
@@ -441,7 +389,8 @@
<JLabel text="isisfish.common.region"/>
</cell>
<cell fill="horizontal" weightx="1.0">
- <JComboBox id="fieldSimulParamsRegion" model='{new DefaultComboBoxModel(Common.getRegionItem())}' selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}' onActionPerformed='regionChange()'/>
+ <JComboBox id="fieldSimulParamsRegion" model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RegionStorage.getRegionNames())}'
+ selectedItem='{getContextValue(SimulAction.class).getSimulationParameter().getRegionName()}' onActionPerformed='regionChange()'/>
</cell>
</row>
</Table>
@@ -449,22 +398,16 @@
</row>
<row>
<cell columns="4" fill="horizontal" weightx="1.0">
- <Table>
- <row>
- <cell>
- <JLabel text="isisfish.params.description"/>
- </cell>
- <cell fill="horizontal" weightx="1.0">
- <JPanel/>
- </cell>
- </row>
- </Table>
+ <JLabel text="isisfish.params.description"/>
</cell>
</row>
<row>
<cell columns="4" fill="both" weightx="1.0" weighty="0.3">
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTextArea id="fieldSimulParamsDesc" text='{simulAction.getSimulationParameter().getDescription()}' onFocusLost='saveDescription()'/>
+ <JScrollPane>
+ <JTextArea id="fieldSimulParamsDesc" text='{simulAction.getSimulationParameter().getDescription()}'/>
+ <javax.swing.text.Document javaBean="fieldSimulParamsDesc.getDocument()"
+ onInsertUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())'
+ onRemoveUpdate='simulAction.getSimulationParameter().setDescription(fieldSimulParamsDesc.getText())' />
</JScrollPane>
</cell>
</row>
@@ -476,7 +419,10 @@
<JLabel text="isisfish.params.numberYear" minimumSize='{new Dimension(140,25)}' preferredSize='{new Dimension(140,25)}'/>
</cell>
<cell fill="both" weightx="1.0">
- <JTextField id="fieldSimulParamsNbAnnees" text='{simulAction.getSimulationParameter().getNumberOfYear()}' onFocusLost='setNbAnnees()'/>
+ <JTextField id="fieldSimulParamsNbAnnees" text='{simulAction.getSimulationParameter().getNumberOfYear()}'/>
+ <javax.swing.text.Document javaBean="fieldSimulParamsNbAnnees.getDocument()"
+ onInsertUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())'
+ onRemoveUpdate='simulAction.setNumberOfYear(fieldSimulParamsNbAnnees.getText())' />
</cell>
</row>
</Table>
@@ -486,101 +432,45 @@
</cell>
</row>
<row>
- <cell fill="both" weightx="0.2" weighty="0.1">
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="isisfish.common.strategies"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1.0" weighty="1.0">
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="listSimulParamsStrategies" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" onValueChanged='strategySelected()'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill="both" weightx="0.4" weighty="0.1">
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="isisfish.common.populations"/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1.0" weighty="1.0">
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="listSimulParamsPopulations" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
- onValueChanged='populationSelected()' onFocusGained="parametersTabbedPane.setSelectedIndex(0)" />
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill="both" weightx="0.4" weighty="0.1">
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text="isisfish.common.rules"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JComboBox id="fieldSimulParamsMesuresSelect" model='{new RuleComboModel(simulAction.getAvailableRuleNames())}' renderer='{new RuleComboRenderer()}'/>
- </cell>
- </row>
- <row>
- <cell fill="both" weightx="1.0" weighty="1.0">
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="listSimulParamsMesuresList" selectionMode="{javax.swing.ListSelectionModel.SINGLE_SELECTION}"
- onValueChanged='onRuleSelectionChange()' onFocusGained="parametersTabbedPane.setSelectedIndex(1)" />
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill="both" weighty="0.1">
- <Table>
- <row>
- <cell fill="horizontal">
- <JLabel text=" " minimumSize='{new Dimension(2,15)}' preferredSize='{new Dimension(2,15)}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id="buttonSimulParamsMesuresAdd" text="isisfish.common.add" onActionPerformed='addRules()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id="buttonSimulParamsMesuresRemove" text="isisfish.common.remove" enabled="false" onActionPerformed='removeRules()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id="buttonSimulParamsMesuresClear" text="isisfish.common.clear" enabled="false" onActionPerformed='clearRules()'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty="1.0">
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell columns="4" fill="both" weightx="1.0" weighty="0.6">
- <JTabbedPane id="parametersTabbedPane" minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <tab title='{_("isisfish.params.populationNumbers")}'>
- <org.nuiton.math.matrix.gui.MatrixPanelEditor id="simulParamsNumbers" name="isisfish.params.populationNumbers"/>
+ <cell columns="4" fill="both" weightx="1.0" weighty="0.6">
+ <JTabbedPane id="parametersTabbedPane" enabled="{isRegionLoaded()}">
+ <tab title='{_("isisfish.params.stategiesAndPopulations")}'>
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="isisfish.common.strategies" enabled="{isRegionLoaded()}"/>
+ </cell>
+ <cell fill="horizontal">
+ <JLabel text="isisfish.common.populations" enabled="{isRegionLoaded()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1">
+ <JScrollPane>
+ <JList id="listSimulParamsStrategies" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ onValueChanged='strategySelected()' enabled="{isRegionLoaded()}"/>
+ </JScrollPane>
+ </cell>
+ <cell fill="both" weightx="1" weighty="1">
+ <JScrollPane>
+ <JList id="listSimulParamsPopulations" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ onValueChanged='populationSelected()' enabled="{isRegionLoaded()}"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weighty="1" columns="2">
+ <JPanel id="populationEffectivesPanel" layout="{new CardLayout()}">
+ <JLabel text="isisfish.params.nopopulation" horizontalAlignment="center" border="{BorderFactory.createEtchedBorder()}"
+ font-style="italic" constraints='"default"' enabled="{isRegionLoaded()}"/>
+ <JTabbedPane id="populationEffectivesTabbedPane" constraints='"specific"' enabled="{isRegionLoaded()}"/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
</tab>
- <tab title='{_("isisfish.params.ruleParameters")}'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTable id="simulParamsRules" rowHeight='24' name="isisfish.params.ruleParameters"/>
- </JScrollPane>
+ <tab title='{_("isisfish.params.rules")}'>
+ <RuleChooser id="ruleChooser" active="{isRegionLoaded()}" decorator="boxed"/>
</tab>
</JTabbedPane>
</cell>
@@ -595,12 +485,13 @@
<cell fill="horizontal" weightx="0.3">
<JCheckBox text="isisfish.params.usePreSimulationScript" id="fieldUseSimulPreScripts"
selected='{simulAction.getSimulationParameter().getUsePreScript()}'
- visible='{!isSensitivity()}' onItemStateChanged='enablePreSimul()' onMouseReleased='selTab(event, 1)'/>
+ visible='{!isSensitivity()}' onItemStateChanged='enablePreScript()'/>
</cell>
<cell fill="horizontal" weightx="0.3">
<JCheckBox text="isisfish.params.useAnalysePlan" id="fieldSimulUseAnalysePlan"
selected='{simulAction.getSimulationParameter().getUseAnalysePlan()}'
- visible='{!isSensitivity()}' onItemStateChanged='enableAnalysePlan()' onMouseReleased='selTab(event, 2)'/>
+ visible='{!isSensitivity()}' onItemStateChanged='enableAnalysePlan()'
+ enabled="{isRegionLoaded()}" />
</cell>
</row>
</Table>
@@ -611,16 +502,19 @@
<Table>
<row>
<cell>
- <JLabel id="lblLauncher" text="isisfish.params.lblLauncher"/>
+ <JLabel text="isisfish.params.simulationLauncher"/>
</cell>
<cell fill="horizontal" weightx="0.4">
<JComboBox id="comboSelLauncher" model='{new DefaultComboBoxModel(simulAction.getSimulationLauncher().toArray())}'/>
</cell>
<cell fill="horizontal" weightx="0.4">
- <JButton id="buttonSimulParamsSimulate" text="isisfish.common.simulate" onActionPerformed='launchSimulation()'/>
+ <JButton id="buttonSimulParamsSimulate" text="isisfish.common.simulate"
+ onActionPerformed='launchSimulation()' enabled="{isRegionLoaded()}"/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JButton id="saveSimul" text="isisfish.simulation.menu.save" onActionPerformed='saveSimulation()'/>
+ <JButton id="saveSimul" text="isisfish.simulation.menu.save"
+ onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).saveSimulation()'
+ enabled="{isRegionLoaded()}"/>
</cell>
</row>
</Table>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/PreScriptsUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,6 +1,6 @@
<!--
/* *##%
- * Copyright (C) 2005 - 2009 Ifremer, Code Lutin
+ * Copyright (C) 2005 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -31,13 +31,14 @@
}
- protected void backParameter() {
+ /*protected void backParameter() {
SimulUI simul = getParentContainer(SimulUI.class);
simul.selTab(0);
- }
+ }*/
]]></script>
<JScrollPane constraints='BorderLayout.CENTER'>
<JTextArea id="fieldSimulPreScript" onFocusLost='save()'/>
</JScrollPane>
- <JButton constraints='BorderLayout.SOUTH' text="isisfish.preScript.backParameter" onActionPerformed='backParameter()'/>
+ <JButton constraints='BorderLayout.SOUTH' text="isisfish.preScript.backParameter"
+ onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).selectParametersTab()'/>
</JPanel>
\ No newline at end of file
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,6 +1,6 @@
<!--
/* *##%
- * Copyright (C) 2005 Ifremer, Code Lutin
+ * Copyright (C) 2005 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -0,0 +1,171 @@
+<!--
+/* *##%
+ * Copyright (C) 2010 Ifremer, Code Lutin, Eric Chatellier
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+ -->
+
+<Table>
+ <!-- Rules collection managed by current ui instance. -->
+ <java.util.List genericType='fr.ifremer.isisfish.rule.Rule' id="rulesList" javaBean='new java.util.ArrayList<fr.ifremer.isisfish.rule.Rule>()'/>
+
+ <!-- Active enabled binding property -->
+ <Boolean id="active" javaBean="true"/>
+
+ <!-- Storage to edit rule parameters. -->
+ <fr.ifremer.isisfish.datastore.RegionStorage id="regionStorage" javaBean="null"/>
+
+ <script><![CDATA[
+ import fr.ifremer.isisfish.IsisFishException;
+ import fr.ifremer.isisfish.datastore.RuleStorage;
+ import fr.ifremer.isisfish.rule.Rule;
+ import fr.ifremer.isisfish.ui.models.rule.RuleListModel;
+ import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel;
+ import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor;
+ import fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer;
+ import fr.ifremer.isisfish.ui.util.ErrorHelper;
+
+ // Manage rule list change
+ addPropertyChangeListener("rulesList", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getNewValue() == null) {
+ selectedRulesList.setModel(new fr.ifremer.isisfish.ui.models.rule.RuleListModel());
+ }
+ else /*if (evt.getNewValue() != null)*/ {
+ java.util.List<fr.ifremer.isisfish.rule.Rule> rules = (java.util.List<fr.ifremer.isisfish.rule.Rule>)evt.getNewValue();
+ selectedRulesList.setModel(new fr.ifremer.isisfish.ui.models.rule.RuleListModel(rules));
+ }
+ }
+ });
+
+ /**
+ * Get new instance for selected rules names and add it to {@link rulesList} list.
+ */
+ protected void addSelectedRules() {
+ Object[] availableRuleValues = availableRuleList.getSelectedValues();
+ for (Object availableRuleValue : availableRuleValues) {
+ String availableRuleName = (String)availableRuleValue;
+ try {
+ RuleStorage ruleStorage = RuleStorage.getRule(availableRuleName);
+ Rule ruleTmp = ruleStorage.getNewRuleInstance();
+ rulesList.add(ruleTmp);
+ } catch (IsisFishException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add rule", e);
+ }
+ ErrorHelper.showErrorDialog(_("isisfish.error.simulation.addrule"), e);
+ }
+ }
+
+ //TODO replace this by a better fire() event
+ selectedRulesList.setModel(new RuleListModel(rulesList));
+ }
+
+ /**
+ * Remove selected rules for selected rules list.
+ */
+ protected void removeSelectedRules() {
+ Object[] selectedRuleValues = selectedRulesList.getSelectedValues();
+ for (Object selectedRuleValue : selectedRuleValues) {
+ rulesList.remove(selectedRuleValue);
+ }
+ //TODO replace this by a better fire() event
+ selectedRulesList.setModel(new RuleListModel(rulesList));
+ }
+
+ /**
+ * Clear selected rule list.
+ */
+ protected void clearAllRules() {
+ rulesList.clear();
+ //TODO replace this by a better fire() event
+ selectedRulesList.setModel(new RuleListModel(rulesList));
+ }
+
+ /**
+ * Display paramters table form single selected list.
+ */
+ protected void displayRuleParameters() {
+ Rule selectedRule = (Rule)selectedRulesList.getSelectedValue();
+ if (selectedRule != null) {
+ RuleParametersTableModel model = new RuleParametersTableModel(selectedRule);
+ selectedRuleParameterTable.setModel(model);
+ RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule);
+ cellEditor.setRegion(getRegionStorage());
+ RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule);
+ selectedRuleParameterTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer);
+ selectedRuleParameterTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
+ }
+ else {
+ selectedRuleParameterTable.setModel(new RuleParametersTableModel());
+ }
+ }
+ ]]></script>
+
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="isisfish.params.rules.availables" enabled="{isActive()}"/>
+ </cell>
+ <cell>
+ <JPanel />
+ </cell>
+ <cell fill="horizontal">
+ <JLabel text="isisfish.params.rules.selected" enabled="{isActive()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" rows="3" weightx="1" weighty="1">
+ <JScrollPane>
+ <JList id="availableRuleList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ model='{new fr.ifremer.isisfish.ui.models.common.StringListModel(fr.ifremer.isisfish.datastore.RuleStorage.getRuleNames())}'
+ cellRenderer='{new fr.ifremer.isisfish.ui.models.rule.RuleNamesListRenderer()}'
+ onValueChanged='addRulesButton.setEnabled(availableRuleList.getSelectedIndex() != -1)'
+ enabled="{isActive()}"/>
+ </JScrollPane>
+ </cell>
+ <cell fill='horizontal'>
+ <JButton id="addRulesButton" text="isisfish.common.add" enabled="false" onActionPerformed='addSelectedRules()'/>
+ </cell>
+ <cell fill="both" rows="3" weightx="1" weighty="1">
+ <JScrollPane>
+ <JList id="selectedRulesList" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
+ model='{new fr.ifremer.isisfish.ui.models.rule.RuleListModel(rulesList)}'
+ cellRenderer='{new fr.ifremer.isisfish.ui.models.rule.RuleListCellRenderer()}'
+ onValueChanged='removeRuleButton.setEnabled(selectedRulesList.getSelectedIndex() != -1);clearRulesButton.setEnabled(selectedRulesList.getSelectedIndex() != -1);displayRuleParameters()'
+ enabled="{isActive()}"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton id="removeRuleButton" text="isisfish.common.remove" enabled="false" onActionPerformed='removeSelectedRules()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor="north">
+ <JButton id="clearRulesButton" text="isisfish.common.clear" enabled="false" onActionPerformed='clearAllRules()'/>
+ </cell>
+ </row>
+ <row weightx="2" weighty="2" columns="3">
+ <cell fill='both'>
+ <JScrollPane>
+ <JTable id="selectedRuleParameterTable" rowHeight='24'
+ model="{new fr.ifremer.isisfish.ui.models.rule.RuleParametersTableModel()}"
+ enabled="{isActive()}" />
+ </JScrollPane>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,6 +1,6 @@
<!--
/* *##%
- * Copyright (C) 2005 - 2009 Ifremer, Code Lutin
+ * Copyright (C) 2005 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -122,11 +122,11 @@
}
}
- protected void backParameter() {
+ /*protected void backParameter() {
// TODO remove getParentContainer() use
SimulUI simul = getParentContainer(SimulUI.class);
simul.selTab(0);
- }
+ }*/
]]>
</script>
<row>
@@ -170,7 +170,7 @@
</row>
<row>
<cell columns="2" fill="horizontal" weightx="1.0">
- <JButton text="isisfish.sens.backParameter" onActionPerformed='backParameter()'/>
+ <JButton text="isisfish.sens.backParameter" onActionPerformed='getParentContainer(fr.ifremer.isisfish.ui.SimulationUI.class).selectParametersTab()'/>
</cell>
</row>
</Table>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2010-02-04 16:09:42 UTC (rev 2985)
@@ -30,8 +30,6 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -76,6 +74,7 @@
import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain;
+import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup;
import fr.ifremer.isisfish.ui.util.ErrorHelper;
/**
@@ -103,7 +102,7 @@
protected List<String> oldSimulNames = null;
protected String simulName = null;
protected SensitivityStorage sensitivityStorage = null;
- protected Map<String, Factor> factors;
+ protected SortedMap<String, Factor> factors;
protected Map<String, JComponent> factorComponent = new HashMap<String, JComponent>();
protected DesignPlan designPlan = new DesignPlan();
@@ -147,8 +146,7 @@
}
// factors has been requested to be sorted
- // TODO add factor sorting
- factors = new HashMap<String, Factor>();
+ factors = new TreeMap<String, Factor>();
}
protected void setName(String name) {
@@ -467,9 +465,21 @@
public int getNumberOfYear() {
return param.getNumberOfYear();
}
-
+
+ /**
+ * Change number of simulation year by parsing string value.
+ * Default to 1 if value is not parsable.
+ *
+ * @param years number of years to set
+ */
public void setNumberOfYear(String years) {
- param.setNumberOfYear(Integer.parseInt(years));
+ try {
+ param.setNumberOfYear(Integer.parseInt(years));
+ }
+ catch (NumberFormatException ex) {
+ // defaut to one year
+ param.setNumberOfYear(1);
+ }
}
public List<String> getSimulatorNames() {
@@ -820,36 +830,36 @@
*
* @return factor list
*/
- public List<Factor<?, ?>> getFactors() {
- List<Factor<?, ?>> result = new ArrayList<Factor<?, ?>>();
- for (Map.Entry<?, ?> entry : factors.entrySet()) {
- result.add((Factor<?, ?>) entry.getValue());
+ public FactorGroup getFactorGroup() {
+ FactorGroup result = new FactorGroup(_("isisfish.sensitivity.factors"), true);
+ for (Factor value : factors.values()) {
+ result.addFactor(value);
}
- // sort factor on name
- Collections.sort(result, new Comparator<Factor<?, ?>> (){
+ // sort factor on name (sorted on tree map now)
+ /*Collections.sort(result, new Comparator<Factor<?, ?>> (){
@Override
public int compare(Factor<?, ?> o1, Factor<?, ?> o2) {
return o1.getName().compareTo(o2.getName());
}
- });
+ });*/
return result;
}
- public void addFactor(Factor<?, ?> f, JComponent c) {
+ public void addFactor(Factor f, JComponent c) {
if (log.isDebugEnabled()) {
log.debug("Add factor (" + f.getName() + ") : " +f.getPath());
}
factors.put(f.getPath() + f.getName(), f);
factorComponent.put(f.getPath() + f.getName(), c);
- designPlan.setFactors(getFactors());
+ designPlan.setFactors(getFactorGroup().getFactors());
}
public void addContinuousFactor(String name, String comment, String path, Double min,
Double max, JComponent c, boolean exist) {
- Factor<Double, Double> f = new Factor<Double, Double>(name);
- ContinuousDomain<Double, Double> domain = new ContinuousDomain<Double, Double>();
+ Factor f = new Factor(name);
+ ContinuousDomain domain = new ContinuousDomain();
domain.setMinBound(min);
domain.setMaxBound(max);
f.setDomain(domain);
@@ -863,8 +873,8 @@
public void addDiscreteFactor(String name, String comment, String path,
List<Serializable> values, JComponent c, boolean exist) {
- Factor<Serializable, Serializable> f = new Factor<Serializable, Serializable>(name);
- DiscreteDomain<Serializable, Serializable> domain = new DiscreteDomain<Serializable, Serializable>();
+ Factor f = new Factor(name);
+ DiscreteDomain domain = new DiscreteDomain();
int i = 0;
for (Serializable value : values) {
// FIXME test when integer
@@ -886,7 +896,7 @@
EquationContinuousDomain domain, JComponent c,
boolean exist) {
// factor name need to be composed
- Factor<Double, Double> f = new Factor<Double, Double>(name + "." + domain.getVariableName());
+ Factor f = new Factor(name + "." + domain.getVariableName());
f.setDomain(domain);
f.setComment(comment);
// don't modify path, need to be valid identifier
@@ -901,7 +911,7 @@
public void addContinuousMatrixFactor(String name, String comment, String path,
Double coef, MatrixND matrix,
String operateur, JComponent c, boolean exist) {
- Factor<MatrixND, Double> f = new Factor<MatrixND, Double>(name);
+ Factor f = new Factor(name);
MatrixContinuousDomain domain = new MatrixContinuousDomain();
domain.setMatrix(matrix);
domain.setOperator(operateur);
@@ -915,14 +925,14 @@
addFactor(f, c);
}
- public JComponent getFactorComponent(Factor<?, ?> f) {
+ public JComponent getFactorComponent(Factor f) {
return factorComponent.get(f.getPath() + f.getName());
}
- public void removeFactor(Factor<?, ?> f) {
+ public void removeFactor(Factor f) {
factors.remove(f.getPath() + f.getName());
factorComponent.remove(f.getPath() + f.getName());
- designPlan.setFactors(getFactors());
+ designPlan.setFactors(getFactorGroup().getFactors());
}
/*
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2010-02-04 16:06:06 UTC (rev 2984)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2010-02-04 16:09:42 UTC (rev 2985)
@@ -1,6 +1,6 @@
<!--
/* *##%
- * Copyright (C) 2005 - 2009 Ifremer, Code Lutin
+ * Copyright (C) 2005 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -17,28 +17,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-->
-<JPanel layout='{new BorderLayout()}'>
-
- <script><![CDATA[
- import jaxx.runtime.JAXXInitialContext;
- import fr.ifremer.isisfish.ui.input.InputAction;
- import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
- import fr.ifremer.isisfish.datastore.StorageException;
- import fr.ifremer.isisfish.entities.FisheryRegionImpl;
- import javax.swing.ToolTipManager;
+<fr.ifremer.isisfish.ui.SimulationUI>
- public SimulUI(SimulAction action) {
- setContextValue(action);
- }
- protected void enablePreSimul(boolean selected) {
- simulTabs.setEnabledAt(1, selected);
- }
- protected void enableAnalysePlan(boolean selected) {
- simulTabs.setEnabledAt(2, selected);
- }
- protected void selTab(int i) {
- simulTabs.setSelectedIndex(i);
- }
+ <script><![CDATA[
+ @Override
public void refresh() {
paramsUI.refresh();
preScriptUI.refresh();
@@ -47,38 +29,30 @@
resultChoiceUI.refresh();
advancedParamsUI.refresh();
}
- // TODO duplicated code (simulUI, Params UI, SensitivityUI)
- protected void importSimulation() {
- JFileChooser fc = new JFileChooser();
- int returnVal = fc.showOpenDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- //This is where a real application would open the file.
- getContextValue(SimulAction.class).importSimulation(file);
- refresh();
- }
+ @Override
+ public void selectParametersTab() {
+ bodyTabbedPane.setSelectedIndex(0);
}
- // TODO duplicated code (simulUI, Params UI, SensitivityUI)
- protected void saveSimulation() {
- JFileChooser fc = new JFileChooser();
- int returnVal = fc.showSaveDialog(null);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- //This is where a real application would open the file.
- getContextValue(SimulAction.class).saveSimulation(file);
+ @Override
+ public void setEnabledPrescriptTab(boolean selected) {
+ bodyTabbedPane.setEnabledAt(1, selected);
+ if (selected) {
+ bodyTabbedPane.setSelectedIndex(1);
}
}
+
+ @Override
+ public void setEnabledAnalysePlanTab(boolean selected) {
+ bodyTabbedPane.setEnabledAt(2, selected);
+ if (selected) {
+ bodyTabbedPane.setSelectedIndex(2);
+ }
+ }
]]>
</script>
- <JMenuBar id="simulMenuBar" constraints='BorderLayout.NORTH'>
- <JMenu id="simulMenu" text="isisfish.simulation.menu.simulation">
- <JMenuItem id="siSave" text="isisfish.simulation.menu.save" onActionPerformed="saveSimulation()"/>
- <JMenuItem id="siImport" text="isisfish.simulation.menu.import" onActionPerformed="importSimulation()"/>
- </JMenu>
- </JMenuBar>
- <JTabbedPane id="simulTabs" constraints='BorderLayout.CENTER'>
+ <JTabbedPane id="bodyTabbedPane">
<tab id="paramsUITab" title='isisfish.params.title'>
<ParamsUI id="paramsUI" constructorParams='this' />
</tab>
@@ -98,4 +72,4 @@
<AdvancedParamsUI id="advancedParamsUI" constructorParams='this' />
</tab>
</JTabbedPane>
-</JPanel>
\ No newline at end of file
+</fr.ifremer.isisfish.ui.SimulationUI>
\ No newline at end of file
1
0
r2984 - in isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity: . domain
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 16:06:06 +0000 (Thu, 04 Feb 2010)
New Revision: 2984
Added:
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java
Log:
Add tests on clone for domain (equation & matrix)
Added: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java (rev 0)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java 2010-02-04 16:06:06 UTC (rev 2984)
@@ -0,0 +1,66 @@
+/* *##%
+ * Copyright (C) 2010 Ifremer, Code Lutin, Chatellier Eric
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.sensitivity.domain;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+/**
+ * Test on {@link EquationContinuousDomain}.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class EquationContinuousDomainTest {
+
+ /**
+ * Assert that clone do work (with inheritance).
+ */
+ @Test
+ public void testClone() {
+ EquationContinuousDomain domain = new EquationContinuousDomain();
+ // parent
+ domain.setMinBound(0.55);
+ domain.setMaxBound(0.74);
+ domain.setCardinality(5);
+ // child
+ domain.setVariableName("varname");
+ domain.setOperator("/");
+ domain.setCoefficient(0.05);
+ domain.setReferenceValue(90.0);
+ domain.setValue(89.5);
+
+ // clone
+ EquationContinuousDomain clone = domain.clone();
+
+ // test on clone
+ Assert.assertEquals(0.55, clone.minBound); // getter return 0.0
+ Assert.assertEquals(0.74, clone.maxBound); // getter return 1.0
+ Assert.assertEquals(5, clone.getCardinality());
+ Assert.assertEquals("varname", clone.getVariableName());
+ Assert.assertEquals("/", clone.getOperator());
+ Assert.assertEquals(0.05, clone.getCoefficient());
+ Assert.assertEquals(90.0, clone.getReferenceValue());
+ Assert.assertEquals(89.5, clone.getValue());
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomainTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java (rev 0)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java 2010-02-04 16:06:06 UTC (rev 2984)
@@ -0,0 +1,71 @@
+/* *##%
+ * Copyright (C) 2010 Ifremer, Code Lutin, Chatellier Eric
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.sensitivity.domain;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.nuiton.math.matrix.MatrixFactory;
+import org.nuiton.math.matrix.MatrixND;
+
+/**
+ * Test on {@link MatrixContinuousDomain}.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class MatrixContinuousDomainTest {
+
+ /**
+ * Assert that clone do work (with inheritance).
+ */
+ @Test
+ public void testClone() {
+
+ // test matrix
+ MatrixND matrix = MatrixFactory.getInstance().create("test", new int[] { 4, 5 }, new String[] {"dim1", "dim2"});
+ matrix.setValue(2, 2, 42);
+
+ MatrixContinuousDomain domain = new MatrixContinuousDomain();
+ // parent
+ domain.setMinBound(0.55);
+ domain.setMaxBound(0.74);
+ domain.setCardinality(5);
+ // child
+ domain.setMatrix(matrix);
+ domain.setOperator("/");
+ domain.setCoefficient(0.05);
+ domain.setValue(89.5);
+
+ // clone
+ MatrixContinuousDomain clone = domain.clone();
+
+ // test on clone
+ Assert.assertEquals(0.55, clone.minBound); // getter return 0.0
+ Assert.assertEquals(0.74, clone.maxBound); // getter return 1.0
+ Assert.assertEquals(5, clone.getCardinality());
+ Assert.assertEquals(matrix, clone.getMatrix());
+ Assert.assertEquals("/", clone.getOperator());
+ Assert.assertEquals(0.05, clone.getCoefficient());
+ Assert.assertEquals(89.5, clone.getValue());
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomainTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
1
0
r2983 - in isis-fish/branches/3.3.1/src: main/java/fr/ifremer/isisfish/simulator/sensitivity/domain main/java/fr/ifremer/isisfish/simulator/sensitivity/group test/java/fr/ifremer/isisfish/simulator/sensitivity test/java/fr/ifremer/isisfish/simulator/sensitivity/group
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 16:05:30 +0000 (Thu, 04 Feb 2010)
New Revision: 2983
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroup.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/group/
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroupTest.java
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDomain.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java
Log:
Add new ruledomain (for rules) and FactorGroup (for group screening)
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDomain.java 2010-02-04 16:04:31 UTC (rev 2982)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/RuleDomain.java 2010-02-04 16:05:30 UTC (rev 2983)
@@ -18,24 +18,20 @@
package fr.ifremer.isisfish.simulator.sensitivity.domain;
-import java.io.Serializable;
-import java.util.Collection;
-
import fr.ifremer.isisfish.rule.Rule;
/**
* Factor domain for {@link Rule}s.
*
- * @param <F> type des labels
- *
* @author chatellier
* @version $Revision$
- * @since 3.3.0.0
*
+ * @since 3.3.1.0
+ *
* Last update : $Date$
* By : $Author$
*/
-public class RuleDomain<F extends Serializable> extends DiscreteDomain<Collection<Rule>, F> {
+public class RuleDomain extends DiscreteDomain {
/** serialVersionUID. */
private static final long serialVersionUID = -5611785362638191719L;
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroup.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroup.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroup.java 2010-02-04 16:05:30 UTC (rev 2983)
@@ -0,0 +1,166 @@
+/* *##%
+ * Copyright (C) 2010 Ifremer, Code Lutin, Chatellier Eric
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.sensitivity.group;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import fr.ifremer.isisfish.simulator.sensitivity.Factor;
+import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain;
+import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain;
+
+/**
+ * Factor group. Used for group screening.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * @since 3.3.1.0
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FactorGroup extends Factor {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 1893573810633639712L;
+
+ /** Factors collection. */
+ protected List<Factor> factors;
+
+ /**
+ * Mixed factor composition.
+ *
+ * Default to false;
+ *
+ * To enable both {@link DiscreteDomain} and {@link ContinuousDomain} ins current group.
+ * Currently used in UI to use it as tree root and drag'n'drop.
+ */
+ protected boolean mixed;
+
+ /**
+ * Init factor group.
+ *
+ * @param name group name
+ * @param mixed property
+ */
+ public FactorGroup(String name, boolean mixed) {
+ super(name);
+ this.mixed = mixed;
+ factors = new ArrayList<Factor>();
+ }
+
+ /**
+ * Init factor group.
+ *
+ * @param name group name
+ */
+ public FactorGroup(String name) {
+ this(name, false);
+ }
+
+ /**
+ * Check factor type and add it into factor collection.
+ *
+ * @param factor
+ */
+ public void addFactor(Factor factor) {
+ // if mixed enabled, don't check
+ if (!mixed) {
+ checkFactor(factor);
+ }
+
+ addCheckedFactor(factor);
+ }
+
+ /**
+ * Check factor type with other factor collection types.
+ *
+ * @throws IllegalArgumentException if factor doesn't match other factor type
+ */
+ protected void checkFactor(Factor factor) {
+ // basiquement, il doit être du même type que le
+ // premier element
+ if (factor.getDomain() == null) {
+ throw new IllegalArgumentException("Factor domain is null");
+ }
+
+ // on va dire, que si c'est le premier, il est du meme
+ // type que lui meme
+ if (!factors.isEmpty()) {
+ Factor first = factors.get(0);
+
+ // les deux sont discret ou continue
+ if (!first.getDomain().getClass().isAssignableFrom(
+ factor.getDomain().getClass())) {
+ throw new IllegalArgumentException(
+ "Factor type is not in same type as other factor in group");
+ }
+ }
+ }
+
+ /**
+ * Add factor into factor list without check.
+ *
+ * @param factor
+ */
+ protected void addCheckedFactor(Factor factor) {
+ factors.add(factor);
+ }
+
+ /**
+ * Get groups factors.
+ *
+ * @return unmodifiable factors list
+ */
+ public List<Factor> getFactors() {
+ return Collections.unmodifiableList(factors);
+ }
+
+ /**
+ * Convenient method to access specific factor.
+ *
+ * @param index index
+ * @return factor at index
+ */
+ public Factor get(int index) {
+ return factors.get(index);
+ }
+
+ /**
+ * Get factor list size.
+ *
+ * @return factor list size
+ */
+ public int size() {
+ return factors.size();
+ }
+
+ /**
+ * Returns the index of the first occurrence of the specified element in this
+ * group.
+ * @param o element to search for
+ * @return the index of the first occurrence of the specified element in this
+ * group, or -1 if this list does not contain the element
+ */
+ public int indexOf(Object o) {
+ return factors.indexOf(o);
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroup.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java 2010-02-04 16:04:31 UTC (rev 2982)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/FactorTest.java 2010-02-04 16:05:30 UTC (rev 2983)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -56,8 +56,8 @@
@Test
public void testIntFactor() {
- Factor<Integer,Integer> factor = new Factor<Integer,Integer>("testint");
- ContinuousDomain<Integer,Integer> domain = new ContinuousDomain<Integer,Integer>();
+ Factor factor = new Factor("testint");
+ ContinuousDomain domain = new ContinuousDomain();
domain.setMinBound(0);
domain.setMaxBound(50);
factor.setDomain(domain);
@@ -100,8 +100,8 @@
matrix2.setValue(new int[] { 1, 2 }, -13000);
// factor
- Factor<MatrixND,String> factor = new Factor<MatrixND,String>("testmatrix");
- DiscreteDomain<MatrixND,String> domain = new DiscreteDomain<MatrixND,String>();
+ Factor factor = new Factor("testmatrix");
+ DiscreteDomain domain = new DiscreteDomain();
domain.getValues().put("m1", matrix1);
domain.getValues().put("m2", matrix2);
factor.setDomain(domain);
@@ -143,7 +143,7 @@
matrix1.setValue(new int[] { 2, 1 }, -1);
// factor
- Factor<MatrixND,Double> factor = new Factor<MatrixND,Double>("testmatrix");
+ Factor factor = new Factor("testmatrix");
MatrixContinuousDomain domain = new MatrixContinuousDomain ();
domain.setMatrix(matrix1);
domain.setCoefficient(0.1);
@@ -152,8 +152,8 @@
factor.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor.setValueForIdentifier(0.1);
- Assert.assertEquals(0.92, factor.getValue().getValue(new int[] { 0, 0 }),0.0000001);
- Assert.assertEquals(2.76, factor.getValue().getValue(new int[] { 2, 0 }),0.0000001);
+ Assert.assertEquals(0.92, ((MatrixND)factor.getValue()).getValue(new int[] { 0, 0 }),0.0000001);
+ Assert.assertEquals(2.76, ((MatrixND)factor.getValue()).getValue(new int[] { 2, 0 }),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
Assert.assertEquals(0.1, ((MatrixContinuousDomain)factor.getDomain()).getValue(),0);
@@ -169,7 +169,7 @@
matrix2.setValue(new int[] { 2, 1 }, -1);
// factor 2
- Factor<MatrixND,Double> factor2 = new Factor<MatrixND,Double>("testmatrix");
+ Factor factor2 = new Factor("testmatrix");
MatrixContinuousDomain domain2 = new MatrixContinuousDomain();
domain2.setMatrix(matrix2);
domain2.setCoefficient(0.1);
@@ -178,8 +178,8 @@
factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor2.setValueForIdentifier(0.1);
- Assert.assertEquals(-7.0, factor2.getValue().getValue(new int[] { 0, 0 }),0.0000001);
- Assert.assertEquals(-21.0, factor2.getValue().getValue(new int[] { 2, 0 }),0.0000001);
+ Assert.assertEquals(-7.0, ((MatrixND)factor2.getValue()).getValue(new int[] { 0, 0 }),0.0000001);
+ Assert.assertEquals(-21.0, ((MatrixND)factor2.getValue()).getValue(new int[] { 2, 0 }),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
@@ -194,7 +194,7 @@
matrix3.setValue(new int[] { 2, 1 }, -1);
// factor 3
- Factor<MatrixND,Double> factor3 = new Factor<MatrixND,Double>("testmatrix");
+ Factor factor3 = new Factor("testmatrix");
MatrixContinuousDomain domain3 = new MatrixContinuousDomain();
domain3.setMatrix(matrix3);
domain3.setCoefficient(0.1);
@@ -203,8 +203,8 @@
factor3.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor3.setValueForIdentifier(0.1);
- Assert.assertEquals(0.28, factor3.getValue().getValue(new int[] { 0, 0 }),0.0000001);
- Assert.assertEquals(0.68, factor3.getValue().getValue(new int[] { 2, 0 }),0.0000001);
+ Assert.assertEquals(0.28, ((MatrixND)factor3.getValue()).getValue(new int[] { 0, 0 }),0.0000001);
+ Assert.assertEquals(0.68, ((MatrixND)factor3.getValue()).getValue(new int[] { 2, 0 }),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
@@ -219,7 +219,7 @@
matrix4.setValue(new int[] { 2, 1 }, -1);
// factor 3
- Factor<MatrixND,Double> factor4 = new Factor<MatrixND,Double>("testmatrix");
+ Factor factor4 = new Factor("testmatrix");
MatrixContinuousDomain domain4 = new MatrixContinuousDomain();
domain4.setMatrix(matrix4);
domain4.setCoefficient(0.1);
@@ -228,8 +228,8 @@
factor4.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor4.setValueForIdentifier(0.1);
- Assert.assertEquals(0.12, factor4.getValue().getValue(new int[] { 0, 0 }),0.0000001);
- Assert.assertEquals(0.52, factor4.getValue().getValue(new int[] { 2, 0 }),0.0000001);
+ Assert.assertEquals(0.12, ((MatrixND)factor4.getValue()).getValue(new int[] { 0, 0 }),0.0000001);
+ Assert.assertEquals(0.52, ((MatrixND)factor4.getValue()).getValue(new int[] { 2, 0 }),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
@@ -247,7 +247,7 @@
public void testEquationContinuousFactor() {
// factor
- Factor<Double,Double> factor = new Factor<Double,Double>("testequation");
+ Factor factor = new Factor("testequation");
EquationContinuousDomain domain = new EquationContinuousDomain();
domain.setCoefficient(0.1);
domain.setOperator("*");
@@ -257,13 +257,13 @@
factor.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor.setValueForIdentifier(0.1);
- Assert.assertEquals(2.76, factor.getValue(),0.0000001);
+ Assert.assertEquals(2.76, (Double)factor.getValue(),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
Assert.assertEquals(0.1, ((EquationContinuousDomain)factor.getDomain()).getValue(),0);
// factor 2
- Factor<Double,Double> factor2 = new Factor<Double,Double>("testequation");
+ Factor factor2 = new Factor("testequation");
EquationContinuousDomain domain2 = new EquationContinuousDomain();
domain2.setCoefficient(0.1);
domain2.setOperator("/");
@@ -273,12 +273,12 @@
factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor2.setValueForIdentifier(0.1);
- Assert.assertEquals(-21, Double.valueOf(factor2.getValue()),0.0000001);
+ Assert.assertEquals(-21.0, (Double)factor2.getValue(),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
// factor 3
- Factor<Double,Double> factor3 = new Factor<Double,Double>("testequation");
+ Factor factor3 = new Factor("testequation");
EquationContinuousDomain domain3 = new EquationContinuousDomain();
domain3.setCoefficient(0.1);
domain3.setOperator("+");
@@ -288,12 +288,12 @@
factor3.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor3.setValueForIdentifier(0.1);
- Assert.assertEquals(0.52, Double.valueOf(factor3.getValue()),0.0000001);
+ Assert.assertEquals(0.52, (Double)factor3.getValue(),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
// factor 4
- Factor<Double,Double> factor4 = new Factor<Double,Double>("testequation");
+ Factor factor4 = new Factor("testequation");
EquationContinuousDomain domain4 = new EquationContinuousDomain();
domain4.setCoefficient(0.1);
domain4.setOperator("-");
@@ -303,7 +303,7 @@
factor4.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor4.setValueForIdentifier(0.1);
- Assert.assertEquals(0.68, Double.valueOf(factor4.getValue()),0.0000001);
+ Assert.assertEquals(0.68, (Double)factor4.getValue(),0.0000001);
Assert.assertEquals(0,((ContinuousDomain)factor.getDomain()).getMinBound(),0);
Assert.assertEquals(1,((ContinuousDomain)factor.getDomain()).getMaxBound(),0);
@@ -335,8 +335,8 @@
rules3.add(ruleC);
// factor and domain definition
- Factor<Collection<Rule>, String> factor = new Factor<Collection<Rule>, String>("testrule");
- RuleDomain<String> ruleDomain = new RuleDomain<String>();
+ Factor factor = new Factor("testrule");
+ RuleDomain ruleDomain = new RuleDomain();
ruleDomain.getValues().put("rules1", rules1);
ruleDomain.getValues().put("rules2", rules2);
ruleDomain.getValues().put("rules3", rules3);
@@ -344,4 +344,32 @@
// TODO post r operation, and some asserts
}
+
+ /**
+ * Assert that clone do work (with inheritance).
+ */
+ @Test
+ public void testClone() {
+
+ Factor factor = new Factor("testclone");
+ factor.setPath("fr.ifremer.isisfish.entities.Cell#lenght");
+ factor.setComment("answer to life");
+ factor.setValue(42.0);
+
+ ContinuousDomain domain = new ContinuousDomain();
+ domain.setMinBound(0);
+ domain.setMaxBound(50);
+ factor.setDomain(domain);
+
+ // clone
+ Factor clone = (Factor)factor.clone();
+
+ // test on clone
+ Assert.assertEquals("testclone", clone.getName());
+ Assert.assertEquals("fr.ifremer.isisfish.entities.Cell#lenght", clone.getPath());
+ Assert.assertEquals("answer to life", clone.getComment());
+ Assert.assertEquals(42.0, clone.getValue());
+ Assert.assertNotSame(domain, clone.getDomain());
+ Assert.assertEquals("id1", clone.getDomain().getValueForIdentifier("id1"));
+ }
}
Added: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroupTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroupTest.java (rev 0)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroupTest.java 2010-02-04 16:05:30 UTC (rev 2983)
@@ -0,0 +1,80 @@
+/* *##%
+ * Copyright (C) 2010 Code Lutin, Chatellier Eric
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.sensitivity.group;
+
+import org.junit.Test;
+
+import fr.ifremer.isisfish.simulator.sensitivity.Domain;
+import fr.ifremer.isisfish.simulator.sensitivity.Factor;
+import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain;
+import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain;
+
+/**
+ * Test for FactorGroup.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FactorGroupTest {
+
+ /**
+ * Test to add a factor into group (null domain).
+ */
+ @Test(expected=IllegalArgumentException.class)
+ public void testFactorGroupAddNullDomain() {
+ Factor f = new Factor("test");
+ FactorGroup g = new FactorGroup("test group");
+ g.addFactor(f);
+ }
+
+ /**
+ * Test to add a factor into group (authorized).
+ */
+ @Test
+ public void testFactorGroupAdd() {
+ Factor f1 = new Factor("test");
+ Domain d1 = new DiscreteDomain();
+ f1.setDomain(d1);
+ Factor f2 = new Factor("test 2");
+ Domain d2 = new DiscreteDomain();
+ f2.setDomain(d2);
+ FactorGroup g = new FactorGroup("test group");
+ g.addFactor(f1);
+ g.addFactor(f2);
+ }
+
+ /**
+ * Test to add a factor into group (forbidden).
+ */
+ @Test(expected=IllegalArgumentException.class)
+ public void testFactorGroupAddException() {
+ Factor f1 = new Factor("test");
+ Domain d1 = new DiscreteDomain();
+ f1.setDomain(d1);
+ Factor f2 = new Factor("test 2");
+ Domain d2 = new ContinuousDomain();
+ f2.setDomain(d2);
+ FactorGroup g = new FactorGroup("test group");
+ g.addFactor(f1);
+ g.addFactor(f2);
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/group/FactorGroupTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
1
0
r2982 - in isis-fish/branches/3.3.1/src: main/java/fr/ifremer/isisfish/mexico main/java/fr/ifremer/isisfish/mexico/xml main/java/fr/ifremer/isisfish/simulator/sensitivity main/java/fr/ifremer/isisfish/simulator/sensitivity/domain main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor test/java/fr/ifremer/isisfish/mexico test/java/fr/ifremer/isisfish/mexico/export test/java/fr/ifremer/isisfish/simulator test/java/fr/ifremer/isisfish/simulator/launcher test/java/fr/ifremer/isisfish/si
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 16:04:31 +0000 (Thu, 04 Feb 2010)
New Revision: 2982
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityException.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityScenarios.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/ScenarioVisitor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/SensitivityScenariosVisitor.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitorTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceIT.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/types/MonthTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java
Log:
Factor (and all other entities) are not generic anymore
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/MexicoHelper.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin, Chatellier Eric
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ContinuousDomainXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,8 +18,6 @@
package fr.ifremer.isisfish.mexico.xml;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.simulator.sensitivity.Domain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain;
@@ -52,8 +50,7 @@
* {@inheritDoc}
*/
@Override
- public <E, F extends Serializable> void visit(Domain<E,F> domain,
- F label, E value) {
+ public void visit(Domain domain, Object label, Object value) {
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DesignPlanXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DiscreteDomainXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,8 +18,6 @@
package fr.ifremer.isisfish.mexico.xml;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.simulator.sensitivity.Domain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain;
@@ -53,8 +51,7 @@
* {@inheritDoc}
*/
@Override
- public <E, F extends Serializable> void visit(Domain<E,F> domain,
- F label, E value) {
+ public void visit(Domain domain, Object label, Object value) {
xmlBuffer.append("<value>" + value + "</value>");
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomXMLParser.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -67,7 +67,7 @@
// double
if ("real".equals(type)) {
- Factor<Double,Integer> factor = new Factor<Double,Integer>(name);
+ Factor factor = new Factor(name);
factor.setPath(path);
Element fixedElement = factorElement.element("domain").element(
"fixed");
@@ -105,7 +105,7 @@
}
else {
// continous domain
- domain = new ContinuousDomain<Double,Double>();
+ domain = new ContinuousDomain();
}
domain.setCardinality(Integer.valueOf(fixedElement.attributeValue("cardinality")));
@@ -117,7 +117,7 @@
factor.setDomain(domain);
} else if ("discrete".equals(property)) {
- DiscreteDomain<Double,Integer> domain = new DiscreteDomain<Double,Integer>();
+ DiscreteDomain domain = new DiscreteDomain();
List<Element> valueElements = fixedElement.element(
"enumeration").elements("value");
int label = 0;
@@ -128,9 +128,9 @@
}
factor.setDomain(domain);
}
- plan.getFactors().add(factor);
+ plan.add(factor);
} else if ("integer".equals(type)) {
- Factor<Integer,Integer> factor = new Factor<Integer,Integer>(name);
+ Factor factor = new Factor(name);
factor.setPath(path);
Element fixedElement = factorElement.element("domain").element("fixed");
if ("continuous".equals(property)) {
@@ -168,7 +168,7 @@
}
else {
// continous domain
- domain = new ContinuousDomain<Integer,Integer>();
+ domain = new ContinuousDomain();
}
domain.setCardinality(Integer.valueOf(fixedElement.attributeValue("cardinality")));
@@ -180,7 +180,7 @@
factor.setDomain(domain);
} else if ("discrete".equals(property)) {
- DiscreteDomain<Integer,Integer> domain = new DiscreteDomain<Integer,Integer>();
+ DiscreteDomain domain = new DiscreteDomain();
List<Element> valueElements = fixedElement.element(
"enumeration").elements("value");
int label = 0;
@@ -191,7 +191,7 @@
}
factor.setDomain(domain);
}
- plan.getFactors().add(factor);
+ plan.add(factor);
}
}
@@ -234,7 +234,7 @@
Element fixedElement = factorElement.element("domain")
.element("fixed");
if ("continuous".equals(property)) {
- ContinuousDomain<Double> domain = new ContinuousDomain<Double>();
+ ContinuousDomain domain = new ContinuousDomain();
domain.setCardinality(Integer.valueOf(fixedElement
.attributeValue("cardinality")));
Element rangeElement = fixedElement.element("range");
@@ -244,7 +244,7 @@
.attributeValue("max")));
factor.setDomain(domain);
} else if ("discrete".equals(property)) {
- DiscreteDomain<Double> domain = new DiscreteDomain<Double>();
+ DiscreteDomain domain = new DiscreteDomain();
List<Element> valueElements = fixedElement.element(
"enumeration").elements("value");
int label = 0;
@@ -259,7 +259,7 @@
}
scenario.getFactors().add(factor);
} else if ("integer".equals(type)) {
- Factor<Integer> factor = new Factor<Integer>(name);
+ Factor factor = new Factor(name);
factor.setPath(path);
factor.setValue(Integer.valueOf(factorElement.element(
"value").getText().trim()));
@@ -267,7 +267,7 @@
Element fixedElement = factorElement.element("domain")
.element("fixed");
if ("continuous".equals(property)) {
- ContinuousDomain<Integer> domain = new ContinuousDomain<Integer>();
+ ContinuousDomain domain = new ContinuousDomain();
domain.setCardinality(Integer.valueOf(fixedElement
.attributeValue("cardinality")));
Element rangeElement = fixedElement.element("range");
@@ -277,7 +277,7 @@
.attributeValue("max")));
factor.setDomain(domain);
} else if ("discrete".equals(property)) {
- DiscreteDomain<Integer> domain = new DiscreteDomain<Integer>();
+ DiscreteDomain domain = new DiscreteDomain();
List<Element> valueElements = fixedElement.element(
"enumeration").elements("value");
int label = 0;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/DomainXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/EquationContinuousDomainXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/FactorXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/MatrixContinuousDomainXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/ScenarioXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/SensitivityScenariosXMLVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -94,7 +94,7 @@
"\"Bsup\"=Bsup)";
//Create the vectors
- List<Factor<?, ?>> factors = plan.getFactors();
+ List<Factor> factors = plan.getFactors();
for (int i = 0; i < factors.size(); i++) {
Factor factor = factors.get(i);
if (i != 0) {
@@ -276,7 +276,7 @@
return text.getText();
}
- protected void testNoDiscrete(List<Factor<?,?>> factors) throws SensitivityException{
+ protected void testNoDiscrete(List<Factor> factors) throws SensitivityException{
for (Factor factor:factors) {
if (factor.getDomain() instanceof DiscreteDomain) {
throw new SensitivityException(factor.getName() +
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/DesignPlan.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -20,6 +20,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import fr.ifremer.isisfish.simulator.sensitivity.visitor.DesignPlanVisitor;
@@ -39,30 +40,41 @@
private static final long serialVersionUID = 977975461743758075L;
/** Liste des facteurs a utiliser */
- protected List<Factor<?, ?>> factors;
+ protected List<Factor> factors;
/**
* Constructor.
*/
public DesignPlan() {
- factors = new ArrayList<Factor<?, ?>>();
+ factors = new ArrayList<Factor>();
}
/**
- * Get factors list.
+ * Get factors list (not modifiable).
*
* @return factors list
*/
- public List<Factor<?, ?>> getFactors() {
- return factors;
+ public List<Factor> getFactors() {
+ return Collections.unmodifiableList(factors);
}
/**
+ * Add factor.
+ *
+ * @param e factor to add
+ * @return {@code true} if factor has been added
+ * @see java.util.List#add(java.lang.Object)
+ */
+ public boolean add(Factor f) {
+ return factors.add(f);
+ }
+
+ /**
* Set factors list.
*
* @param factors the factors list to set
*/
- public void setFactors(List<Factor<?, ?>> factors) {
+ public void setFactors(List<Factor> factors) {
this.factors = factors;
}
@@ -73,7 +85,7 @@
*/
public void accept(DesignPlanVisitor visitor) {
visitor.start(this);
- for (Factor<?, ?> factor : factors) {
+ for (Factor factor : factors) {
visitor.visit(this, factor);
}
visitor.end(this);
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -33,9 +33,6 @@
* 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
- * @param <F> type des labels
*
* @see DiscreteDomain
* @see ContinuousDomain
@@ -46,7 +43,7 @@
* Last update : $Date: 24 févr. 2009 $
* By : $Author: chatellier $
*/
-public interface Domain<E, F extends Serializable> extends Serializable {
+public interface Domain extends Serializable, Cloneable {
/**
* Return value associated to identifier.
@@ -54,7 +51,7 @@
* @param identifier
* @return found value or <tt>null</tt> if not found
*/
- E getValueForIdentifier(F identifier);
+ Object getValueForIdentifier(Object identifier);
/**
* Accept a new visitor.
@@ -69,5 +66,5 @@
* @return the domain cloned
*/
- public Domain<E, F> clone();
+ public Domain clone();
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -38,7 +38,7 @@
*
* Last update : $Date: 19 févr. 2009 $ By : $Author: chatellier $
*/
-public class Factor<E, F extends Serializable> implements Serializable, Cloneable {
+public class Factor implements Serializable, Cloneable {
/** serialVersionUID. */
private static final long serialVersionUID = 1643804268013964453L;
@@ -68,12 +68,12 @@
* @see ContinuousDomain
* @see DiscreteDomain
*/
- protected Domain<E,F> domain;
+ protected Domain domain;
/**
* Factor value.
*/
- protected E value;
+ protected Object value;
/**
* Path permettant d'identifier l'objet et la propriete de l'objet a mettre
@@ -86,22 +86,11 @@
protected String path;
/**
- * Constructor.
- *
- * Protected, name is mandatory.
- */
- protected Factor() {
-
- }
-
- /**
* Constructor with name.
*
- * @param name
- * factor name
+ * @param name factor name
*/
public Factor(String name) {
- this();
this.name = name;
}
@@ -117,8 +106,7 @@
/**
* Set name.
*
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
@@ -147,17 +135,16 @@
*
* @return the domain
*/
- public Domain<E,F> getDomain() {
+ public Domain getDomain() {
return domain;
}
/**
* Set domain.
*
- * @param domain
- * the domain to set
+ * @param domain the domain to set
*/
- public void setDomain(Domain<E,F> domain) {
+ public void setDomain(Domain domain) {
this.domain = domain;
}
@@ -166,27 +153,25 @@
*
* @return the value
*/
- public E getValue() {
+ public Object getValue() {
return value;
}
/**
* Set value.
*
- * @param value
- * new value
+ * @param value new value
*/
- public void setValue(E value) {
+ public void setValue(Object value) {
this.value = value;
}
/**
* Set value for label.
*
- * @param valueIdentifier
- * new value identifier to get
+ * @param valueIdentifier new value identifier to get
*/
- public void setValueForIdentifier(F valueIdentifier) {
+ public void setValueForIdentifier(Object valueIdentifier) {
value = domain.getValueForIdentifier(valueIdentifier);
}
@@ -227,19 +212,23 @@
@Override
public Object clone() {
- Factor<E,F> f = new Factor<E,F>();
-
- f.domain = domain.clone();
- f.name = name;
- f.path = path;
- // FIXME make real clone() for value
- f.value = value;
+ Factor f = null;
+ try {
+ f = (Factor)super.clone();
+ f.domain = domain.clone();
+ //f.path = path;
+ // FIXME make real clone() for value
+ //f.value = value;
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException("Error on clone()", e);
+ }
+
return f;
}
@Override
public String toString() {
- return name;
+ return "Factor : " + name + "(" + comment + ")";
}
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Scenario.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculator.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityException.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityException.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityException.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityScenarios.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityScenarios.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityScenarios.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,8 +18,6 @@
package fr.ifremer.isisfish.simulator.sensitivity.domain;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.simulator.sensitivity.Domain;
import fr.ifremer.isisfish.simulator.sensitivity.visitor.DomainVisitor;
@@ -27,9 +25,6 @@
* Domaine continu.
*
* Composé d'une borne min et max et d'une cardinalité.
- *
- * @param <E> type des valeurs gérées par le domaine
- * @param <F> type des labels
*
* @author chatellier
* @version $Revision: 1.0 $
@@ -37,7 +32,7 @@
* Last update : $Date: 24 févr. 2009 $
* By : $Author: chatellier $
*/
-public class ContinuousDomain<E, F extends Serializable> implements Domain<E, F> {
+public class ContinuousDomain implements Domain {
/** serialVersionUID. */
private static final long serialVersionUID = -2037768174807839046L;
@@ -103,9 +98,8 @@
*
* In continuous domain, just return identifier
*/
- public E getValueForIdentifier(F identifier) {
- // FIXME test cast
- return (E)identifier;
+ public Object getValueForIdentifier(Object identifier) {
+ return identifier;
}
/**
@@ -137,11 +131,13 @@
}
@Override
- public ContinuousDomain<E,F> clone() {
- ContinuousDomain<E,F> cloned = new ContinuousDomain<E,F>();
- cloned.setCardinality(this.cardinality);
- cloned.setMaxBound(this.maxBound);
- cloned.setMinBound(this.minBound);
+ public ContinuousDomain clone() {
+ ContinuousDomain cloned = null;
+ try {
+ cloned = (ContinuousDomain)super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException("Error on clone()", e);
+ }
return cloned;
}
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,7 +18,6 @@
package fr.ifremer.isisfish.simulator.sensitivity.domain;
-import java.io.Serializable;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -30,9 +29,6 @@
* Domain discret.
*
* Ensemble de valeurs.
- *
- * @param <E> type des valeurs gérées par le domaine
- * @param <F> type des labels
*
* @author chatellier
* @version $Revision: 1.0 $
@@ -40,23 +36,21 @@
* Last update : $Date: 24 févr. 2009 $
* By : $Author: chatellier $
*/
-public class DiscreteDomain<E, F extends Serializable> implements Domain<E, F> {
+public class DiscreteDomain implements Domain {
/** serialVersionUID. */
private static final long serialVersionUID = -192647757737396585L;
/**
* Value for this domain.
- *
- * Each "E" values is identified by a {@link Serializable} identifier.
*/
- protected SortedMap<F, E> values;
+ protected SortedMap<Object, Object> values;
/**
* Constructor.
*/
public DiscreteDomain() {
- values = new TreeMap<F, E>();
+ values = new TreeMap<Object, Object>();
}
/**
@@ -64,7 +58,7 @@
*
* @return the values
*/
- public SortedMap<F, E> getValues() {
+ public SortedMap<Object, Object> getValues() {
return values;
}
@@ -73,7 +67,7 @@
*
* @param values the values
*/
- public void setValues(SortedMap<F, E> values) {
+ public void setValues(SortedMap<Object, Object> values) {
this.values = values;
}
@@ -82,7 +76,7 @@
*
* @throws IllegalArgumentException if identifier is not a valid key
*/
- public E getValueForIdentifier(F identifier)
+ public Object getValueForIdentifier(Object identifier)
throws IllegalArgumentException {
if (values == null || !values.containsKey(identifier)) {
@@ -100,16 +94,22 @@
*/
public void accept(DomainVisitor visitor) {
visitor.start(this);
- for (Map.Entry<F, E> value : values.entrySet()) {
+ for (Map.Entry<Object, Object> value : values.entrySet()) {
visitor.visit(this, value.getKey(), value.getValue());
}
visitor.end(this);
}
@Override
- public DiscreteDomain<E, F> clone() {
- DiscreteDomain<E, F> cloned = new DiscreteDomain<E, F>();
- cloned.setValues(this.values);
+ public DiscreteDomain clone() {
+ DiscreteDomain cloned = null;
+ try {
+ cloned = (DiscreteDomain)super.clone();
+ // special copy for values
+ cloned.setValues(new TreeMap<Object, Object>(this.values));
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException("Error on clone()", e);
+ }
return cloned;
}
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,8 +29,7 @@
*
* Last update : $Date: 24 févr. 2009 $ By : $Author: chatellier $
*/
-public class EquationContinuousDomain extends
- ContinuousDomain<Double,Double> {
+public class EquationContinuousDomain extends ContinuousDomain {
/** serialVersionUID. */
private static final long serialVersionUID = -2037768174807839046L;
@@ -51,21 +50,6 @@
protected Double value;
/**
- * Empty constructor.
- */
- public EquationContinuousDomain() {
-
- }
-
- @Override
- public String toString() {
- String result = "variableName=" + variableName + " operator=" + operator +
- " coefficient=" + coefficient + " referenceValue=" + referenceValue +
- " value=" + value;
- return result;
- }
-
- /**
* Get variable name.
*
* @return the variableName
@@ -159,13 +143,18 @@
return 1;
}
+ @Override
+ public Object getValueForIdentifier(Object identifier) {
+ return getValueForIdentifier((Double)identifier);
+ }
+
/**
- * {@inheritDoc}.
- *
* In equation continuous domain, value appear in continuous domain values
* only. Here : return identifier.
+ *
+ * @param identifier identifier
+ * @return ?
*/
- @Override
public Double getValueForIdentifier(Double identifier) {
this.value = identifier;
@@ -181,7 +170,7 @@
}
return identifier;
}
-
+
/**
* Get value used to create the equation.
*
@@ -201,8 +190,9 @@
this.value = value;
}
- public EquationContinuousDomain clone(){
- EquationContinuousDomain cloned = new EquationContinuousDomain();
+ @Override
+ public EquationContinuousDomain clone() {
+ EquationContinuousDomain cloned = (EquationContinuousDomain)super.clone();
cloned.setCardinality(this.cardinality);
cloned.setMaxBound(this.maxBound);
cloned.setMinBound(this.minBound);
@@ -214,4 +204,11 @@
return cloned;
}
+ @Override
+ public String toString() {
+ String result = "variableName=" + variableName + " operator=" + operator +
+ " coefficient=" + coefficient + " referenceValue=" + referenceValue +
+ " value=" + value;
+ return result;
+ }
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -31,7 +31,7 @@
*
* Last update : $Date: 24 févr. 2009 $ By : $Author: chatellier $
*/
-public class MatrixContinuousDomain extends ContinuousDomain<MatrixND, Double> {
+public class MatrixContinuousDomain extends ContinuousDomain {
/** serialVersionUID. */
private static final long serialVersionUID = -2037768174807839046L;
@@ -49,13 +49,6 @@
protected double value;
/**
- * Empty constructor.
- */
- public MatrixContinuousDomain() {
-
- }
-
- /**
* Get matrix.
*
* @return the matrix
@@ -67,8 +60,7 @@
/**
* Set matrix.
*
- * @param matrix
- * the matrix to set
+ * @param matrix the matrix to set
*/
public void setMatrix(MatrixND matrix) {
this.matrix = matrix;
@@ -82,8 +74,7 @@
}
/**
- * @param coefficient
- * the coefficient to set
+ * @param coefficient the coefficient to set
*/
public void setCoefficient(double coefficient) {
this.coefficient = coefficient;
@@ -101,8 +92,7 @@
/**
* Set operator.
*
- * @param operator
- * the operator to set
+ * @param operator the operator to set
*/
public void setOperator(String operator) {
this.operator = operator;
@@ -128,13 +118,20 @@
return 1;
}
+ @Override
+ public Object getValueForIdentifier(Object identifier) {
+ return getValueForIdentifier((Double)identifier);
+ }
+
/**
- * {@inheritDoc}.
+ * In matrix continuous domain, return a new matrix.
*
- * In continuous domain, just return identifier
+ * @param identifier identifier
+ * @return a new computed matrix
*/
- public MatrixND getValueForIdentifier(final Double identifier) {
- this.value = identifier;
+ public MatrixND getValueForIdentifier(Double identifier) {
+
+ this.value = (Double)identifier;
MatrixND temp = this.matrix.copy();
if (operator.equals("+")) {
temp.map(new MapFunction() {
@@ -176,28 +173,28 @@
/**
* Set value used to create the matrix.
*
- * @param value
- * the value to set
+ * @param value the value to set
*/
public void setValue(Double value) {
this.value = value;
}
+ @Override
public MatrixContinuousDomain clone() {
- MatrixContinuousDomain cloned = new MatrixContinuousDomain();
- cloned.setCardinality(this.cardinality);
+ MatrixContinuousDomain cloned = (MatrixContinuousDomain)super.clone();
+ /*cloned.setCardinality(this.cardinality);
cloned.setMaxBound(this.maxBound);
cloned.setMinBound(this.minBound);
cloned.setCoefficient(this.coefficient);
cloned.setMatrix(this.matrix);
cloned.setOperator(this.operator);
- cloned.setValue(this.value);
+ cloned.setValue(this.value);*/
return cloned;
}
/**
* Get the minimum bound of the coefficient used to create the matrix. As
- * the getMinBound for use in R always return 0.
+ * the {@link #getMinBound()} for use in R always return 0.
*
* @return the real minimum bound
*/
@@ -217,7 +214,7 @@
/**
* Get the maximal bound of the coefficient used to create the matrix. As
- * the getMaxBound for use in R always return 1.
+ * the {@link #getMaxBound()} for use in R always return 1.
*
* @return the real maximum bound
*/
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DesignPlanVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -45,7 +45,7 @@
* @param designPlan design plan
* @param factor factor
*/
- void visit(DesignPlan designPlan, Factor<?, ?> factor);
+ void visit(DesignPlan designPlan, Factor factor);
/**
* End.
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/DomainVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,8 +18,6 @@
package fr.ifremer.isisfish.simulator.sensitivity.visitor;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.simulator.sensitivity.Domain;
/**
@@ -38,24 +36,21 @@
*
* @param domain domain
*/
- void start(Domain<?, ?> domain);
+ void start(Domain domain);
/**
* Visit domain value or property.
*
- * @param <E> domain element type
- * @param <F> label element type
- *
* @param domain domain
* @param label value label or property name
* @param value value
*/
- <E, F extends Serializable> void visit(Domain<E, F> domain, F label, E value);
+ void visit(Domain domain, Object label, Object value);
/**
* End.
*
* @param domain domain
*/
- void end(Domain<?, ?> domain);
+ void end(Domain domain);
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/FactorVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,8 +18,6 @@
package fr.ifremer.isisfish.simulator.sensitivity.visitor;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.simulator.sensitivity.Domain;
import fr.ifremer.isisfish.simulator.sensitivity.Factor;
@@ -39,7 +37,7 @@
*
* @param factor factor
*/
- void start(Factor<?, ?> factor);
+ void start(Factor factor);
/**
* Visit domain.
@@ -47,7 +45,7 @@
* @param factor factor
* @param domain domain
*/
- <E, F extends Serializable> void visit(Factor<E, F> factor, Domain<E, F> domain);
+ void visit(Factor factor, Domain domain);
/**
* End.
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/ScenarioVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/ScenarioVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/ScenarioVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,8 +18,6 @@
package fr.ifremer.isisfish.simulator.sensitivity.visitor;
-import java.io.Serializable;
-
import fr.ifremer.isisfish.simulator.sensitivity.Factor;
import fr.ifremer.isisfish.simulator.sensitivity.Scenario;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/SensitivityScenariosVisitor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/SensitivityScenariosVisitor.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/visitor/SensitivityScenariosVisitor.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin, Chatellier Eric
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -41,10 +41,10 @@
* Test for MexicoHelper class.
*
* @author chatellier
- * @version $Revision: 1526 $
+ * @version $Revision$
*
- * Last update: $Date: 2008-10-07 18:46:13 +0200 (mar 07 oct 2008) $ by :
- * $Author: tchemit $
+ * Last update: $Date$ by :
+ * $Author$
*/
public class MexicoHelperTest extends AbstractIsisFishTest {
@@ -70,16 +70,16 @@
matrix1.setValue(new int[] { 2, 1 }, -1);
// factor 1
- Factor<Double, Double> factorContinuous = new Factor<Double, Double>("factor 1 (double continuous)");
- ContinuousDomain<Double, Double> domain1 = new ContinuousDomain<Double, Double>();
+ Factor factorContinuous = new Factor("factor 1 (double continuous)");
+ ContinuousDomain domain1 = new ContinuousDomain();
domain1.setMinBound(0.0);
domain1.setMaxBound(50.0);
factorContinuous.setDomain(domain1);
factorContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength");
// factor 2
- Factor<Double, Double> factorDiscrete = new Factor<Double, Double>("factor 2 (double discrete)");
- DiscreteDomain<Double, Double> domain2 = new DiscreteDomain<Double, Double>();
+ Factor factorDiscrete = new Factor("factor 2 (double discrete)");
+ DiscreteDomain domain2 = new DiscreteDomain();
domain2.getValues().put(0.0, 12.3);
domain2.getValues().put(1.0, 70.9);
domain2.getValues().put(2.0, 21.0);
@@ -90,8 +90,8 @@
factorDiscrete.setValue(3.0);
// factor 3
- Factor<Integer, Double> factorContinuous2 = new Factor<Integer, Double>("factor 3 (integer discrete)");
- DiscreteDomain<Integer, Double> domain3 = new DiscreteDomain<Integer, Double>();
+ Factor factorContinuous2 = new Factor("factor 3 (integer discrete)");
+ DiscreteDomain domain3 = new DiscreteDomain();
domain3.getValues().put(0.0, 13);
domain3.getValues().put(1.0, 14);
domain3.getValues().put(2.0, 45);
@@ -99,7 +99,7 @@
factorContinuous2.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength");
// factor 4
- Factor<MatrixND, Double> factorMatrixContinuous = new Factor<MatrixND, Double>("factor 4 (MatrixContinuous)");
+ Factor factorMatrixContinuous = new Factor("factor 4 (MatrixContinuous)");
MatrixContinuousDomain domain4 = new MatrixContinuousDomain();
domain4.setCoefficient(0.799);
domain4.setMatrix(matrix1);
@@ -108,7 +108,7 @@
factorMatrixContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength");
// factor 5
- Factor<Double, Double> factorEquationContinuous = new Factor<Double, Double>("factor 5 (EquationContinuous)");
+ Factor factorEquationContinuous = new Factor("factor 5 (EquationContinuous)");
EquationContinuousDomain domain5 = new EquationContinuousDomain();
domain5.setCoefficient(0.1);
domain5.setReferenceValue(45.0);
@@ -117,11 +117,11 @@
factorEquationContinuous.setDomain(domain5);
factorEquationContinuous.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#maxLength");
- designPlan.getFactors().add(factorContinuous);
- designPlan.getFactors().add(factorDiscrete);
- designPlan.getFactors().add(factorContinuous2);
- designPlan.getFactors().add(factorMatrixContinuous);
- designPlan.getFactors().add(factorEquationContinuous);
+ designPlan.add(factorContinuous);
+ designPlan.add(factorDiscrete);
+ designPlan.add(factorContinuous2);
+ designPlan.add(factorMatrixContinuous);
+ designPlan.add(factorEquationContinuous);
return designPlan;
}
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/MexicoHelperTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/mexico/export/RegionExplorerTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer, Code Lutin, Chatellier Eric
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -36,10 +36,10 @@
* Simulation parameter test class.
*
* @author chatellier
- * @version $Revision: 1.0 $
+ * @version $Revision$
*
- * Last update : $Date: 19 mars 2009 $
- * By : $Author: chatellier $
+ * Last update : $Date$
+ * By : $Author$
*/
public class SimulationParameterTest extends AbstractIsisFishTest {
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationParameterTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009-2010 Ifremer - Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer - Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -71,10 +71,10 @@
* Le prescript doit la changer en m2.
*
* @author chatellier
- * @version $Revision: 1.0 $
+ * @version $Revision$
*
- * Last update : $Date: 24 févr. 2009 $
- * By : $Author: chatellier $
+ * Last update : $Date$
+ * By : $Author$
*/
public class SimulationPreScriptTest extends AbstractIsisFishTest {
@@ -129,8 +129,8 @@
childStorageContext.commitTransaction();
// factor
- Factor<Integer,Integer> factor = new Factor<Integer,Integer>("testint");
- ContinuousDomain<Integer,Integer> domain = new ContinuousDomain<Integer,Integer>();
+ Factor factor = new Factor("testint");
+ ContinuousDomain domain = new ContinuousDomain();
domain.setMinBound(0);
domain.setMaxBound(50);
factor.setDomain(domain);
@@ -229,16 +229,16 @@
childStorageContext.commitTransaction();
// factor
- Factor<MatrixND,String> factor1 = new Factor<MatrixND,String>("testmatrix");
- DiscreteDomain<MatrixND,String> domain1 = new DiscreteDomain<MatrixND,String>();
+ Factor factor1 = new Factor("testmatrix");
+ DiscreteDomain domain1 = new DiscreteDomain();
domain1.getValues().put("m1", matrix1);
factor1.setDomain(domain1);
factor1.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor1.setValueForIdentifier("m1");
// factor
- Factor<MatrixND,String> factor2 = new Factor<MatrixND,String>("testmatrix");
- DiscreteDomain<MatrixND,String> domain2 = new DiscreteDomain<MatrixND,String>();
+ Factor factor2 = new Factor("testmatrix");
+ DiscreteDomain domain2 = new DiscreteDomain();
domain2.getValues().put("m2", matrix1);
factor2.setDomain(domain2);
factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
@@ -293,7 +293,7 @@
public void testFactorPreScriptEquation() throws IOException, TemplateException, StorageException, TopiaException {
// factor
- Factor<Double,Double> factorEquation = new Factor<Double,Double>("test.equation.name");
+ Factor factorEquation = new Factor("test.equation.name");
EquationContinuousDomain domain1 = new EquationContinuousDomain();
domain1.setReferenceValue(3.0);
domain1.setOperator("-");
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/SimulationPreScriptTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitorTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitorTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitorTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceIT.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceIT.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceIT.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer - Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer - Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer - Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer - Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -47,9 +47,9 @@
* Test for {@link SimulationService}.
*
* @author chatellier
- * @version $Revision: 1.0 $
+ * @version $Revision$
*
- * Last update : $Date: 24 févr. 2009 $ By : $Author: chatellier $
+ * Last update : $Date$ By : $Author$
*/
public class SimulationServiceTest extends AbstractIsisFishTest {
@@ -72,8 +72,8 @@
DesignPlan designPlan = new DesignPlan();
// factor 1
- Factor<Double,Double> factor1 = new Factor<Double,Double>("factor 1 (double)");
- ContinuousDomain<Double,Double> domain1 = new ContinuousDomain<Double,Double>();
+ Factor factor1 = new Factor("factor 1 (double)");
+ ContinuousDomain domain1 = new ContinuousDomain();
domain1.setMinBound(0.0);
domain1.setMaxBound(50.0);
domain1.setCardinality(4);
@@ -92,17 +92,17 @@
factor2.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength");*/
// factor 3
- Factor<Double,Double> factor3 = new Factor<Double,Double>("factor 3 (double)");
- ContinuousDomain<Double,Double> domain3 = new ContinuousDomain<Double,Double>();
+ Factor factor3 = new Factor("factor 3 (double)");
+ ContinuousDomain domain3 = new ContinuousDomain();
domain3.setMinBound(12.0);
domain3.setMaxBound(99.0);
domain3.setCardinality(4);
factor3.setDomain(domain3);
factor3.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521076#0.6526656643346673#minLength");
- designPlan.getFactors().add(factor1);
- //designPlan.getFactors().add(factor2);
- designPlan.getFactors().add(factor3);
+ designPlan.add(factor1);
+ //designPlan.add(factor2);
+ designPlan.add(factor3);
return designPlan;
}
@@ -136,8 +136,8 @@
matrix2.setValue(new int[] { 2, 1 }, -1);
// factor 1
- Factor<MatrixND,Double> factor1 = new Factor<MatrixND,Double>("factor 1 (matrixND)");
- DiscreteDomain<MatrixND,Double> domain1 = new DiscreteDomain<MatrixND,Double>();
+ Factor factor1 = new Factor("factor 1 (matrixND)");
+ DiscreteDomain domain1 = new DiscreteDomain();
domain1.getValues().put(0.0, matrix1);
domain1.getValues().put(1.0, matrix2);
factor1.setDomain(domain1);
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2008 - 2009 Ifremer - Code Lutin
+ * Copyright (C) 2008 - 2010 Ifremer - Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -34,10 +34,10 @@
* simulation au travers de SSH.
*
* @author chatellier
- * @version $Revision: 1.0 $
+ * @version $Revision$
*
- * Last update : $Date: 22 janv. 2009 $
- * By : $Author: chatellier $
+ * Last update : $Date$
+ * By : $Author$
*/
public class SshSimulatorLauncherTest extends AbstractIsisFishTest {
Property changes on: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncherTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/SensitivityCalculatorRandomMock.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer - Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -85,7 +85,7 @@
// return result
SensitivityScenarios sensitivityScenarios = new SensitivityScenarios();
- List<Factor<?, ?>> factors = plan.getFactors();
+ List<Factor> factors = plan.getFactors();
for (int i = 0; i < factors.size() * 2; ++i) {
Scenario scenario = new Scenario();
@@ -122,8 +122,8 @@
factor.setValueForIdentifier(maxValue);
scenario.addFactor(factor);
} else {
- DiscreteDomain<? extends Serializable,? extends Serializable> dDomain = (DiscreteDomain) domain;
- for (Serializable sValue : dDomain.getValues().keySet()) {
+ DiscreteDomain dDomain = (DiscreteDomain) domain;
+ for (Object sValue : dDomain.getValues().keySet()) {
factor.setValueForIdentifier(sValue);
scenario.addFactor(factor);
}
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/types/MonthTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/types/MonthTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/types/MonthTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,7 +29,7 @@
import org.junit.Test;
/**
- * TODO add comment here.
+ * Test on {@link Month}.
*
* @author chatellier
* @version $Revision$
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelperTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin, Chatellier Eric
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeModelTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Ifremer, Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -21,9 +21,6 @@
import static org.nuiton.i18n.I18n._;
import java.awt.HeadlessException;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JTree;
@@ -31,14 +28,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
import org.nuiton.math.matrix.MatrixFactory;
import org.nuiton.math.matrix.MatrixND;
-import org.junit.Test;
import fr.ifremer.isisfish.AbstractIsisFishTest;
import fr.ifremer.isisfish.simulator.sensitivity.Factor;
import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain;
+import fr.ifremer.isisfish.simulator.sensitivity.group.FactorGroup;
+import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeCellRenderer;
+import fr.ifremer.isisfish.ui.sensitivity.model.FactorTreeModel;
/**
* Sensitivity tree model test.
@@ -61,11 +61,11 @@
*
* @return la liste des facteur
*/
- protected List<Factor<?,?>> getFactors() {
-
- Factor<Integer, Integer> factor1 = new Factor<Integer, Integer>(
+ protected FactorGroup getFactorGroup() {
+
+ Factor factor1 = new Factor(
"testint");
- ContinuousDomain<Integer, Integer> domain1 = new ContinuousDomain<Integer, Integer>();
+ ContinuousDomain domain1 = new ContinuousDomain();
domain1.setMinBound(0);
domain1.setMaxBound(50);
factor1.setDomain(domain1);
@@ -93,20 +93,20 @@
matrix2.setValue(new int[] { 1, 2 }, -13000);
// factor
- Factor<MatrixND, String> factor2 = new Factor<MatrixND, String>(
+ Factor factor2 = new Factor(
"testmatrix");
- DiscreteDomain<MatrixND, String> domain2 = new DiscreteDomain<MatrixND, String>();
+ DiscreteDomain domain2 = new DiscreteDomain();
domain2.getValues().put("m1", matrix1);
domain2.getValues().put("m2", matrix2);
factor2.setDomain(domain2);
factor2.setPath("org.nuiton.math.matrix.MatrixND#563456293453#2.456347646#dim");
factor2.setValueForIdentifier("m2");
- List<Factor<?,?>> factors1 = new ArrayList<Factor<?,?>>();
- factors1.add(factor1);
- factors1.add(factor2);
+ FactorGroup factorGroup = new FactorGroup("test", true);
+ factorGroup.addFactor(factor1);
+ factorGroup.addFactor(factor2);
- return factors1;
+ return factorGroup;
}
/*
@@ -117,7 +117,7 @@
final JTree tree = new JTree();
tree.setRootVisible(true);
- FactorTreeModel model = new FactorTreeModel(getFactors());
+ FactorTreeModel model = new FactorTreeModel(getFactorGroup());
tree.setModel(model);
tree.setCellRenderer(new FactorTreeCellRenderer());
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java 2010-02-04 15:51:08 UTC (rev 2981)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUtilsTest.java 2010-02-04 16:04:31 UTC (rev 2982)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin, Chatellier Eric
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
1
0
r2981 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui: input/formule input/metier input/population models/analyzeplan models/export models/result models/rule models/sensitivity models/sensitivityexport
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 15:51:08 +0000 (Thu, 04 Feb 2010)
New Revision: 2981
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoComboRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonInfoComboRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java
Log:
Don't use both default implementation and interface (fix compilation issue on java7)
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/formule/FormuleComboRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.entities.Formule;
@@ -36,8 +35,7 @@
* Last update : $Date$
* By : $Author: chatellier $
*/
-public class FormuleComboRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class FormuleComboRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -8277883340386163087L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoComboRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoComboRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/metier/MetierSeasonInfoComboRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.entities.MetierSeasonInfo;
@@ -36,8 +35,7 @@
* Last update : $Date$
* By : $Author: chatellier $
*/
-public class MetierSeasonInfoComboRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class MetierSeasonInfoComboRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -8277883340386163087L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonInfoComboRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonInfoComboRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/population/PopulationSeasonInfoComboRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
@@ -36,8 +35,7 @@
* Last update : $Date: 2009-06-09 13:52:58 +0200 (mar. 09 juin 2009) $
* By : $Author: chatellier $
*/
-public class PopulationSeasonInfoComboRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class PopulationSeasonInfoComboRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -8277883340386163087L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanComboRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,7 +27,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.AnalysePlanStorage;
import fr.ifremer.isisfish.simulator.AnalysePlan;
@@ -42,8 +41,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class AnalyzePlanComboRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class AnalyzePlanComboRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/analyzeplan/AnalyzePlanListRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.AnalysePlanStorage;
import fr.ifremer.isisfish.simulator.AnalysePlan;
@@ -37,8 +36,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class AnalyzePlanListRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class AnalyzePlanListRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportListRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.ExportStorage;
import fr.ifremer.isisfish.export.Export;
@@ -37,8 +36,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class ExportListRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class ExportListRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,7 +27,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.ExportStorage;
import fr.ifremer.isisfish.export.Export;
@@ -42,8 +41,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class ExportNameListRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class ExportNameListRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -28,7 +28,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.ScriptStorage;
import fr.ifremer.isisfish.ui.util.TooltipHelper;
@@ -45,8 +44,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class ResultListRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class ResultListRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleListCellRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.RuleStorage;
import fr.ifremer.isisfish.rule.Rule;
@@ -37,8 +36,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class RuleListCellRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class RuleListCellRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -948394724922547715L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorComboRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,7 +27,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.SensitivityStorage;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator;
@@ -42,8 +41,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class SensitivityCalculatorComboRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class SensitivityCalculatorComboRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivity/SensitivityCalculatorListRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.SensitivityStorage;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator;
@@ -37,8 +36,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class SensitivityCalculatorListRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class SensitivityCalculatorListRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportListRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.SensitivityExportStorage;
import fr.ifremer.isisfish.export.SensitivityExport;
@@ -37,8 +36,7 @@
* Last update : $Date$
* By : $Author: chatellier $
*/
-public class SensitivityExportListRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class SensitivityExportListRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java 2010-02-04 15:43:02 UTC (rev 2980)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java 2010-02-04 15:51:08 UTC (rev 2981)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2009 Code Lutin
+ * Copyright (C) 2009 - 2010 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,7 +27,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
-import javax.swing.ListCellRenderer;
import fr.ifremer.isisfish.datastore.SensitivityExportStorage;
import fr.ifremer.isisfish.export.SensitivityExport;
@@ -42,8 +41,7 @@
* Last update : $Date$
* By : $Author: chatellier $
*/
-public class SensitivityExportNameListRenderer extends DefaultListCellRenderer implements
- ListCellRenderer {
+public class SensitivityExportNameListRenderer extends DefaultListCellRenderer {
/** serialVersionUID. */
private static final long serialVersionUID = -4070846632975105788L;
1
0
r2980 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish: mexico mexico/export mexico/xml simulator/sensitivity simulator/sensitivity/group ui/models ui/sensitivity ui/sensitivity/model
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 15:43:02 +0000 (Thu, 04 Feb 2010)
New Revision: 2980
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/package-info.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/package-info.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/package-info.java
Log:
Add some packages documentation
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java 2010-02-04 15:43:02 UTC (rev 2980)
@@ -0,0 +1,5 @@
+/**
+ * Set of classes used during region's factor's enabled properties export.
+ */
+package fr.ifremer.isisfish.mexico.export;
+
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/export/package-info.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/package-info.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/package-info.java 2010-02-04 15:43:02 UTC (rev 2980)
@@ -0,0 +1,5 @@
+/**
+ * Mexico file format package.
+ */
+package fr.ifremer.isisfish.mexico;
+
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/package-info.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java 2010-02-04 15:43:02 UTC (rev 2980)
@@ -0,0 +1,5 @@
+/**
+ * Design plan and scenario xml import/export.
+ */
+package fr.ifremer.isisfish.mexico.xml;
+
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/mexico/xml/package-info.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/package-info.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/package-info.java 2010-02-04 15:43:02 UTC (rev 2980)
@@ -0,0 +1,5 @@
+/**
+ * Factor group used for Group screening.
+ */
+package fr.ifremer.isisfish.simulator.sensitivity.group;
+
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/group/package-info.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java 2010-02-04 15:43:02 UTC (rev 2980)
@@ -0,0 +1,5 @@
+/**
+ * Swing models used by both plan simulation and sensitivity simulation interface.
+ */
+package fr.ifremer.isisfish.ui.models;
+
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/package-info.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/package-info.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/package-info.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/package-info.java 2010-02-04 15:43:02 UTC (rev 2980)
@@ -0,0 +1,5 @@
+/**
+ * Sensitivity specifics swing models.
+ */
+package fr.ifremer.isisfish.ui.sensitivity.model;
+
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/model/package-info.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
1
0
r2979 - in isis-fish/branches/3.3.1: . src/main/java/fr/ifremer/isisfish/ui/script src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 15:11:31 +0000 (Thu, 04 Feb 2010)
New Revision: 2979
Modified:
isis-fish/branches/3.3.1/changelog.txt
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx
isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Add new menu to check all scripts
Modified: isis-fish/branches/3.3.1/changelog.txt
===================================================================
--- isis-fish/branches/3.3.1/changelog.txt 2010-02-04 14:31:25 UTC (rev 2978)
+++ isis-fish/branches/3.3.1/changelog.txt 2010-02-04 15:11:31 UTC (rev 2979)
@@ -1,5 +1,6 @@
isis-fish (3.3.1.0-rc1) stable; urgency=low
+ * Add a new button to check all script in one action in script UI
* Improve UI to enable some fields/tabs only after region loading
* Enable to put population effectives into factors
* Enable to put rules into factor
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2010-02-04 14:31:25 UTC (rev 2978)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2010-02-04 15:11:31 UTC (rev 2979)
@@ -73,6 +73,7 @@
import fr.ifremer.isisfish.ui.util.ErrorHelper;
import fr.ifremer.isisfish.ui.vcs.UpdateDialogUI;
import fr.ifremer.isisfish.util.ClasspathTemplateLoader;
+import fr.ifremer.isisfish.util.CompileHelper;
import fr.ifremer.isisfish.util.JavadocHelper;
import fr.ifremer.isisfish.vcs.VCSException;
import freemarker.cache.TemplateLoader;
@@ -717,7 +718,54 @@
setStatusMessage(_("isisfish.message.check.finished"));
return check;
}
+
+ /**
+ * Check all scripts.
+ */
+ public void checkAllScripts() {
+ boolean allSuccess = true;
+
+ // reste previous state
+ scriptUI.getActionLogArea().setBackground(null);
+ scriptUI.getActionLogArea().setText("");
+
+ for (ScriptMapping scriptMapping : ScriptMapping.values()) {
+ // normalement ne match pas les formules
+ // le cas est différent pour les formules
+ // le fichier java ne sont pas compilable sans la formule associée
+ List<File> javaFiles = FileUtil.find(scriptMapping.getModule(), ".+\\.java$", false);
+ for (File javaFile : javaFiles) {
+ scriptUI.getActionLogArea().append(_("isisfish.script.compilingfile", javaFile));
+
+ StringWriter result = new StringWriter();
+ PrintWriter out = new PrintWriter(result);
+ int compileResult = CompileHelper.compile(IsisFish.config.getDatabaseDirectory(), javaFile, IsisFish.config.getCompileDirectory(), out);
+ out.flush();
+
+ if (compileResult == 0) {
+ scriptUI.getActionLogArea().append(_("isisfish.common.ok") + "\n");
+ }
+ else {
+ scriptUI.getActionLogArea().append(_("isisfish.common.error") + ":\n");
+ scriptUI.getActionLogArea().append(result.toString() + "\n");
+ scriptUI.getActionLogArea().setBackground(COLOR_FAILURE);
+ allSuccess = false;
+ }
+
+ // scroll down
+ scriptUI.getActionLogArea().setCaretPosition(scriptUI.getActionLogArea().getText().length());
+ }
+ }
+
+ // set final color
+ if (allSuccess) {
+ scriptUI.getActionLogArea().setBackground(COLOR_SUCCESS);
+ }
+
+ setStatusMessage(_("isisfish.message.check.finished"));
+ }
+
/**
* Call main method in current cod storage code.
* Check script before call.
@@ -1033,27 +1081,27 @@
/** enum to encapsulate a script module */
protected enum ScriptMapping {
- Script(
- ScriptStorage.getScriptDirectory(),
- ScriptStorage.SCRIPT_TEMPLATE),
- Simulator(
- SimulatorStorage.getSimulatorDirectory(),
- SimulatorStorage.SIMULATOR_TEMPLATE),
+ AnalysePlan(
+ AnalysePlanStorage.getAnalysePlanDirectory(),
+ AnalysePlanStorage.ANALYSE_PLAN_TEMPLATE),
Export(
ExportStorage.getExportDirectory(),
ExportStorage.EXPORT_TEMPLATE),
Rule(
RuleStorage.getRuleDirectory(),
RuleStorage.RULE_TEMPLATE),
- AnalysePlan(
- AnalysePlanStorage.getAnalysePlanDirectory(),
- AnalysePlanStorage.ANALYSE_PLAN_TEMPLATE),
+ Script(
+ ScriptStorage.getScriptDirectory(),
+ ScriptStorage.SCRIPT_TEMPLATE),
Sensitivity(
SensitivityStorage.getSensitivityDirectory(),
SensitivityStorage.SENSIVITY_TEMPLATE),
SensitivityExport(
SensitivityExportStorage.getSensitivityExportDirectory(),
SensitivityExportStorage.SENSITIVITY_EXPORT_TEMPLATE),
+ Simulator(
+ SimulatorStorage.getSimulatorDirectory(),
+ SimulatorStorage.SIMULATOR_TEMPLATE),
EquationModel(
FormuleStorage.getFormuleDirectory(),
FormuleStorage.FORMULE_TEMPLATE);
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2010-02-04 14:31:25 UTC (rev 2978)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2010-02-04 15:11:31 UTC (rev 2979)
@@ -66,6 +66,7 @@
</JMenu>
<JMenu id="scriptTxtCode" text="isisfish.script.menu.code">
<JMenuItem id="miCheckSyntax" text="isisfish.script.menu.checkSyntax" icon="script_code_red.png" onActionPerformed="getScriptAction().checkScript()" enabled='{isJavaFileSelected()}' />
+ <JMenuItem id="miCheckAllSyntax" text="isisfish.script.menu.checkAllSyntax" icon="script_code_red.png" onActionPerformed="new SwingWorker<Void, Void>(){public Void doInBackground(){getScriptAction().checkAllScripts();return null;}}.execute()" />
<JMenuItem id="miEvaluate" text="isisfish.script.menu.evaluate" icon="script_gear.png" onActionPerformed="getScriptAction().evaluateScript()" enabled='{isJavaFileSelected()}' />
<JSeparator/>
<JMenuItem id="miGenerateJavadoc" text="isisfish.script.menu.javadocgenerate" onActionPerformed="getScriptAction().generateScriptJavadoc()"/>
Modified: isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-en_GB.properties 2010-02-04 14:31:25 UTC (rev 2978)
+++ isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-en_GB.properties 2010-02-04 15:11:31 UTC (rev 2979)
@@ -823,6 +823,7 @@
isisfish.script.commit.tooltip=Commit script to SVN server
isisfish.script.compilation.failed=%s
isisfish.script.compilation.ok=Compilation complete.\n---------------------\n\n%s
+isisfish.script.compilingfile=Compiling %s...
isisfish.script.copy=Copy
isisfish.script.copy.tooltip=Copy current selection (Ctrl-c)
isisfish.script.cut=Cut
@@ -843,6 +844,7 @@
isisfish.script.import.labelOverwrite=Following files already exists. Confirm overridding.
isisfish.script.import.tooltip.checkAll=(Un)Check all scripts
isisfish.script.javadoc.ok=Javadoc generated-----------------\n\n%s
+isisfish.script.menu.checkAllSyntax=Check all scripts
isisfish.script.menu.checkSyntax=Check syntax
isisfish.script.menu.code=Code
isisfish.script.menu.commit=Commit script to server
Modified: isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-fr_FR.properties 2010-02-04 14:31:25 UTC (rev 2978)
+++ isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish-fr_FR.properties 2010-02-04 15:11:31 UTC (rev 2979)
@@ -823,6 +823,7 @@
isisfish.script.commit.tooltip=Committer le script sur le serveur SVN
isisfish.script.compilation.failed=%s
isisfish.script.compilation.ok=Compilation r\u00E9ussie.\n--------------------\n\n%s
+isisfish.script.compilingfile=Compilation de %s...
isisfish.script.copy=Copier
isisfish.script.copy.tooltip=Copier la s\u00E9lection courante (Ctrl-c)
isisfish.script.cut=Couper
@@ -843,6 +844,7 @@
isisfish.script.import.labelOverwrite=Le(s) fichier(s) suivant(s) existe(nt) d\u00E9j\u00E0, Confirmer pour l'\u00E9crasement
isisfish.script.import.tooltip.checkAll=(D\u00E9-)S\u00E9lectionner tous les scripts \u00E0 importer
isisfish.script.javadoc.ok=Javadoc g\u00E9n\u00E9r\u00E9e avec succ\u00E8s\n---------------------------\n\n%s
+isisfish.script.menu.checkAllSyntax=V\u00E9rifier tous les scripts
isisfish.script.menu.checkSyntax=V\u00E9rifier la syntaxe
isisfish.script.menu.code=Code
isisfish.script.menu.commit=Commiter des scripts sur le serveur
@@ -902,7 +904,7 @@
isisfish.sensitivity.firstValue=Premi\u00E8re valeur
isisfish.sensitivity.increment=Cardinalit\u00E9
isisfish.sensitivity.lastValue=Derni\u00E8re valeur
-isisfish.sensitivity.methodfactornotsupported=La m\u00e9thode de sensibilit\u00e9 choisie g\u00e8re les cardinalit\u00e9s des facteurs
+isisfish.sensitivity.methodfactornotsupported=La m\u00E9thode de sensibilit\u00E9 choisie g\u00E8re les cardinalit\u00E9s des facteurs
isisfish.sensitivity.name=Nom du facteur
isisfish.sensitivity.operator=Op\u00E9rateur
isisfish.sensitivity.secondpass=Analyse des r\u00E9sultats
1
0
r2978 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/util
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
by chatellier@users.labs.libre-entreprise.org 04 Feb '10
04 Feb '10
Author: chatellier
Date: 2010-02-04 14:31:25 +0000 (Thu, 04 Feb 2010)
New Revision: 2978
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java
Log:
Use provided compiler only if system compiler can't be found
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2010-02-04 11:24:41 UTC (rev 2977)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/util/CompileHelper.java 2010-02-04 14:31:25 UTC (rev 2978)
@@ -1,5 +1,5 @@
/* *##%
- * Copyright (C) 2006 - 2009
+ * Copyright (C) 2006 - 2010
* Code Lutin, Cédric Pineau, Benjamin Poussin
*
* This program is free software; you can redistribute it and/or
@@ -50,6 +50,7 @@
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
@@ -216,10 +217,16 @@
protected static int compile(List<File> classpath, Collection<File> src,
File dest, PrintWriter out) {
dest.mkdirs();
-
+
int result = -1000;
try {
- JavaCompiler compiler = JavacTool.create();
+
+ // look for best available Java compiler (if none, use provided)
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ if (compiler == null) {
+ compiler = JavacTool.create();
+ }
+
// Use system compiler
// JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = compiler
1
0
04 Feb '10
Author: chatellier
Date: 2010-02-04 11:24:41 +0000 (Thu, 04 Feb 2010)
New Revision: 2977
Added:
isis-fish/branches/3.3.1/doc/devel/Sensitivity.png
isis-fish/branches/3.3.1/doc/devel/sensitivity.zargo
Log:
Add a little diagrams about sensitivity objects (factor, group, domain...)
Added: isis-fish/branches/3.3.1/doc/devel/Sensitivity.png
===================================================================
(Binary files differ)
Property changes on: isis-fish/branches/3.3.1/doc/devel/Sensitivity.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: isis-fish/branches/3.3.1/doc/devel/sensitivity.zargo
===================================================================
(Binary files differ)
Property changes on: isis-fish/branches/3.3.1/doc/devel/sensitivity.zargo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0