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 2012
- 1 participants
- 22 discussions
r3612 - in branches/4.1/src/main: java/fr/ifremer/isisfish/entities java/fr/ifremer/isisfish/simulator java/fr/ifremer/isisfish/ui/input/variable xmi
by echatellier@users.forge.codelutin.com 17 Feb '12
by echatellier@users.forge.codelutin.com 17 Feb '12
17 Feb '12
Author: echatellier
Date: 2012-02-17 16:36:52 +0100 (Fri, 17 Feb 2012)
New Revision: 3612
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3612
Log:
Add variable's equation and matrix support
Modified:
branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java
branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx
branches/4.1/src/main/xmi/isis-fish.zargo
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java 2012-02-17 09:19:34 UTC (rev 3611)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java 2012-02-17 15:36:52 UTC (rev 3612)
@@ -25,19 +25,47 @@
package fr.ifremer.isisfish.entities;
-import org.nuiton.math.matrix.MatrixND;
+import static org.nuiton.i18n.I18n._;
+import org.nuiton.topia.TopiaException;
+
+import fr.ifremer.isisfish.IsisFishDAOHelper;
+import fr.ifremer.isisfish.IsisFishRuntimeException;
+import fr.ifremer.isisfish.equation.Language;
+import fr.ifremer.isisfish.equation.VariableEquation;
+
public class VariableImpl extends VariableAbstract {
private static final long serialVersionUID = 3978428224373810278L;
+ /*
+ private static Log log = LogFactory.getLog(VariableImpl.class);
+
@Override
public void setDoubleValue(double doubleValue) {
super.setDoubleValue(doubleValue);
super.setMatrixValue(null);
+
+ deletePreviousEquation();
super.setEquationValue(null);
}
+ /*
+ * Manually delete equation since topia (or hibernate) can't delete
+ * orphan object with many-to-one relations.
+ *
+ protected void deletePreviousEquation() {
+ if (super.getEquationValue() != null) {
+ try {
+ IsisFishDAOHelper.getEquationDAO(getTopiaContext()).delete(super.getEquationValue());
+ } catch (TopiaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't delete equation", ex);
+ }
+ }
+ }
+ }
+
@Override
public void setEquationValue(Equation equationValue) {
super.setEquationValue(equationValue);
@@ -49,7 +77,40 @@
public void setMatrixValue(MatrixND matrixValue) {
super.setMatrixValue(matrixValue);
super.setDoubleValue(0);
+
+ deletePreviousEquation();
super.setEquationValue(null);
+ }*/
+
+ public void setEquationValueContent(String content) {
+ try {
+ Equation eq = getEquationValue();
+
+ if (eq == null) {
+ EquationDAO dao = IsisFishDAOHelper
+ .getEquationDAO(getTopiaContext());
+ // create Growth equation
+ eq = dao.create();
+ eq.setCategory("Variable");
+ eq.setJavaInterface(VariableEquation.class);
+ eq.setLanguage(Language.JAVA);
+ setEquationValue(eq);
+ }
+
+ eq.setName(getName());
+
+ // Fire
+ String _oldValue = eq.getContent();
+ fireOnPreWrite("content", _oldValue, content);
+
+ eq.setContent(content);
+ eq.update();
+
+ fireOnPostWrite("content", _oldValue, content);
+
+ } catch (TopiaException eee) {
+ throw new IsisFishRuntimeException(_("isisfish.change.equation"), eee);
+ }
}
} //VariableImpl
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java 2012-02-17 09:19:34 UTC (rev 3611)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java 2012-02-17 15:36:52 UTC (rev 3612)
@@ -104,6 +104,19 @@
}
/**
+ * Return variable value as matrix.
+ *
+ * @param name variable name
+ * @return value as matrix
+ * @throws TopiaException if can't restore variable from db
+ */
+ public MatrixND getAsMatrix(String name) throws TopiaException {
+ Variable v = getVariableEntity(name);
+ MatrixND result = v.getMatrixValue();
+ return result;
+ }
+
+ /**
* Set variable value.
*
* @param name variable name
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java 2012-02-17 09:19:34 UTC (rev 3611)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java 2012-02-17 15:36:52 UTC (rev 3612)
@@ -40,8 +40,6 @@
import fr.ifremer.isisfish.IsisFishDAOHelper;
import fr.ifremer.isisfish.IsisFishRuntimeException;
-import fr.ifremer.isisfish.entities.Equation;
-import fr.ifremer.isisfish.entities.EquationImpl;
import fr.ifremer.isisfish.entities.Variable;
import fr.ifremer.isisfish.entities.VariableDAO;
import fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel;
@@ -151,7 +149,7 @@
JList variableList = view.getVariablesList();
Variable variable = (Variable)variableList.getSelectedValue();
view.setVariable(variable);
- if (variable != null) {
+ /*if (variable != null) {
view.getVariableNameField().setText(variable.getName());
String type = variable.getType();
@@ -160,11 +158,11 @@
if ("double".equals(type)) {
view.getVariableDoubleValue().setText(String.valueOf(variable.getDoubleValue()));
} else if ("matrix".equals(type)) {
- //cardLayout.show(view.getVariableTypePanel(), "matrixtype");
+ //view.get
} else if ("equation".equals(type)) {
//cardLayout.show(view.getVariableTypePanel(), "equationtype");
}
- }
+ }*/
}
/**
@@ -175,6 +173,7 @@
public void showSelectedType(EntityVariableUI view) {
CardLayout cardLayout = view.getVariableTypeLayout();
String type = (String)view.getVariableTypeCombo().getSelectedItem();
+ view.getVariable().setType(type);
if ("double".equals(type)) {
cardLayout.show(view.getVariableTypePanel(), "doubletype");
} else if ("matrix".equals(type)) {
@@ -195,7 +194,7 @@
variable.setName(view.getVariableNameField().getText().trim());
String type = (String)view.getVariableTypeCombo().getSelectedItem();
- variable.setType((String)view.getVariableTypeCombo().getSelectedItem());
+ //variable.setType((String)view.getVariableTypeCombo().getSelectedItem());
if ("double".equals(type)) {
try {
@@ -208,14 +207,14 @@
}
} else if ("matrix".equals(type)) {
variable.setMatrixValue(view.getMatrixPanel().getMatrix());
- } else if ("equation".equals(type)) {
+ } /*else if ("equation".equals(type)) {
Equation eq = variable.getEquationValue();
if (eq == null) {
eq = new EquationImpl();
}
eq.setContent(view.getVariableDoubleValue().getText());
variable.setEquationValue(eq);
- }
+ }*/
try {
// save in db
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx 2012-02-17 09:19:34 UTC (rev 3611)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx 2012-02-17 15:36:52 UTC (rev 3612)
@@ -58,7 +58,7 @@
<row>
<cell fill="horizontal">
<JButton text="isisfish.variables.addvariable" onActionPerformed="getVarHandler().addNewVariable(this)"
- enabled='{isActive()}'/>
+ enabled='{isActive()}' decorator='boxed' />
</cell>
</row>
</Table>
@@ -71,8 +71,12 @@
enabled='{isActive() && getVariable() != null}'/>
</cell>
<cell fill="horizontal" weightx='1.0'>
- <JTextField id="variableNameField"
- enabled='{isActive() && getVariable() != null}'/>
+ <JTextField id="variableNameField" text="{getVariable().getName()}"
+ enabled='{isActive() && getVariable() != null}' decorator='boxed' />
+ <javax.swing.text.Document
+ initializer="variableNameField.getDocument()"
+ onInsertUpdate='getVariable().setName(variableNameField.getText())'
+ onRemoveUpdate='getVariable().setName(variableNameField.getText())' />
</cell>
</row>
<row>
@@ -82,8 +86,9 @@
</cell>
<cell fill="horizontal" weightx='1.0'>
<JComboBox id="variableTypeCombo" model="{new VariableTypeComboModel()}"
+ selectedItem="{getVariable().getType()}"
onActionPerformed="getVarHandler().showSelectedType(this)"
- enabled='{isActive() && getVariable() != null}'/>
+ enabled='{isActive() && getVariable() != null}' decorator='boxed' />
</cell>
</row>
<row>
@@ -98,7 +103,9 @@
<JLabel text="isisfish.variables.double.value" enabled='{isActive() && getVariable() != null}' />
</cell>
<cell fill="horizontal" weightx='1.0' anchor="northeast" weighty='1.0'>
- <JTextField id="variableDoubleValue" enabled='{isActive() && getVariable() != null}' />
+ <JTextField id="variableDoubleValue" decorator='boxed'
+ text="{String.valueOf(getVariable().getDoubleValue())}"
+ enabled='{isActive() && getVariable() != null}' />
</cell>
</row>
</Table>
@@ -114,7 +121,9 @@
<row>
<cell fill="both" weightx='1.0' weighty='1.0'>
<org.nuiton.math.matrix.gui.MatrixPanelEditor id="matrixPanel"
- enabled='{isActive() && getVariable() != null}'/>
+ enabled='{isActive() && getVariable() != null}'
+ matrix="{getVariable().getMatrixValue() != null ? getVariable().getMatrixValue().copy() : null}"
+ dimensionEdit='true' decorator='boxed' />
</cell>
</row>
</Table>
@@ -124,7 +133,13 @@
<row>
<cell fill="both" weightx='1.0' weighty='1.0'>
<fr.ifremer.isisfish.ui.input.InputOneEquationUI id="variableEquationValue"
- active='{isActive() && getVariable() != null}'/>
+ constructorParams='this'
+ active='{isActive() && getVariable() != null}'
+ text='isisfish.common.equation' formuleCategory='Variable'
+ clazz='{fr.ifremer.isisfish.equation.VariableEquation.class}'
+ bean='{getVariable()}' beanProperty='EquationValue'
+ _sensitivityBean='{fr.ifremer.isisfish.entities.Variable.class}' _sensitivityMethod='"EquationValue"'
+ decorator='boxed' />
</cell>
</row>
</Table>
@@ -135,12 +150,14 @@
<cell anchor="west">
<JButton text="isisfish.variables.deletevariable"
onActionPerformed="getVarHandler().deleteVariable(this)"
- enabled='{isActive() && getVariable() != null}'/>
+ enabled='{isActive() && getVariable() != null}'
+ decorator='boxed' />
</cell>
<cell anchor="east" weightx='1.0'>
<JButton text="isisfish.variables.savevariable"
onActionPerformed="getVarHandler().saveVariable(this)"
- enabled='{isActive() && getVariable() != null}'/>
+ enabled='{isActive() && getVariable() != null}'
+ decorator='boxed' />
</cell>
</row>
</Table>
Modified: branches/4.1/src/main/xmi/isis-fish.zargo
===================================================================
(Binary files differ)
1
0
r3611 - branches/4.1/src/main/java/fr/ifremer/isisfish
by echatellier@users.forge.codelutin.com 17 Feb '12
by echatellier@users.forge.codelutin.com 17 Feb '12
17 Feb '12
Author: echatellier
Date: 2012-02-17 10:19:34 +0100 (Fri, 17 Feb 2012)
New Revision: 3611
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3611
Log:
Remove openmap sysout
Modified:
branches/4.1/src/main/java/fr/ifremer/isisfish/IsisFish.java
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/IsisFish.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/IsisFish.java 2012-02-16 16:58:57 UTC (rev 3610)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/IsisFish.java 2012-02-17 09:19:34 UTC (rev 3611)
@@ -56,6 +56,8 @@
import org.nuiton.util.Version;
import org.nuiton.widget.SwingSession;
+import com.bbn.openmap.MapBean;
+
import fr.ifremer.isisfish.cron.CronService;
import fr.ifremer.isisfish.datastore.SimulationPlanStorage;
import fr.ifremer.isisfish.datastore.ExportStorage;
@@ -604,6 +606,9 @@
// init IsisTray
IsisTray.getInstance();
+ // OpenMap sysout
+ MapBean.suppressCopyright = true;
+
// configure swing session
// can't be in config ? getUserConfigDirectory() not static
File isisConfigDirectory = new File(config.getUserConfigDirectory(), "isis-fish");
1
0
r3610 - in branches/4.1/src/main/java/fr/ifremer/isisfish: equation simulator
by echatellier@users.forge.codelutin.com 16 Feb '12
by echatellier@users.forge.codelutin.com 16 Feb '12
16 Feb '12
Author: echatellier
Date: 2012-02-16 17:58:57 +0100 (Thu, 16 Feb 2012)
New Revision: 3610
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3610
Log:
Add simulation context methods to use entities variables.
Added:
branches/4.1/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java
branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java
Modified:
branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java 2012-02-16 16:58:57 UTC (rev 3610)
@@ -0,0 +1,56 @@
+/*
+ * #%L
+ * IsisFish
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer, Code Lutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.equation;
+
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import fr.ifremer.isisfish.simulator.SimulationContext;
+import fr.ifremer.isisfish.types.TimeStep;
+import fr.ifremer.isisfish.util.Args;
+
+/**
+ * Generic equation signature used in variable values.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public interface VariableEquation {
+
+ /**
+ * Compute target factor.
+ *
+ * @param context simulation context
+ * @param entity l'entity sur laquelle la variable a été ajoutée
+ * @param step le pas de temps courant
+ * @return equation result
+ * @throws Exception
+ */
+ @Args({"context", "entity", "step"})
+ public double compute(SimulationContext context, TopiaEntity entity, TimeStep step) throws Exception;
+}
Property changes on: branches/4.1/src/main/java/fr/ifremer/isisfish/equation/VariableEquation.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java 2012-02-16 16:58:26 UTC (rev 3609)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationContext.java 2012-02-16 16:58:57 UTC (rev 3610)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2012 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -26,18 +26,28 @@
package fr.ifremer.isisfish.simulator;
import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaEntity;
+import fr.ifremer.isisfish.IsisFishRuntimeException;
import fr.ifremer.isisfish.datastore.SimulationStorage;
+import fr.ifremer.isisfish.entities.Variable;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityUtils;
+import fr.ifremer.isisfish.types.TimeStep;
/**
* Keep all information on one simulation.
@@ -45,7 +55,7 @@
* <li> Launch parameter
* <li> Database (TopiaContext)
* <li> SimulationControl
- * <li> Effectif by pop (N)
+ * <li> Effective by pop (N)
* <li> Result
*
* Created: 3 juil. 2006 17:05:27
@@ -78,9 +88,12 @@
/** TopiaContext must be used to save result */
protected TopiaContext dbResult = null;
+ /** Cache des variables d'entités. Topia id > map of attributes. */
+ protected Map<TopiaEntity, SimulationVariable> variablesCache = new HashMap<TopiaEntity, SimulationVariable>();
+
/** Context value used in equation. */
protected Map<String, Double> contextEquationValue = new HashMap<String, Double>();
-
+
private static ThreadLocal<SimulationContext> simulationContext = new ThreadLocal<SimulationContext>() {
protected synchronized SimulationContext initialValue() {
return new SimulationContext();
@@ -336,7 +349,7 @@
public void setComputeValue(String key, Double value) {
contextEquationValue.put(key, value);
}
-
+
/**
* Return value from context.
*
@@ -361,7 +374,7 @@
log.trace("Found key '" + localKey + "' current value = " + value);
}
- // since 3.4.0.0, operator is always *
+ // since 4.0.0.0, operator is always *
result = value;
}
else {
@@ -373,4 +386,70 @@
return result;
}
+
+ /**
+ * Get object containing variable for given entity.
+ *
+ * @param entity entity
+ * @return map object for this class
+ */
+ public SimulationVariable get(TopiaEntity entity) {
+ SimulationVariable v = variablesCache.get(entity);
+ if (v == null) {
+ v = new SimulationVariable(this, entity);
+ variablesCache.put(entity, v);
+ }
+ return v;
+ }
+
+ /**
+ * Save all cached context values.
+ *
+ * @param step
+ */
+ public void saveContextValues(TimeStep step) {
+ File exportFile = new File(getScriptDirectory(), "variables.txt");
+
+ Writer out = null;
+ try {
+ out = new FileWriter(exportFile, true);
+
+ out.write("=========== Step : " + step.toString() + " ===========\n");
+ for (Map.Entry<TopiaEntity, SimulationVariable> entry : variablesCache.entrySet()) {
+ TopiaEntity entity = entry.getKey();
+ SimulationVariable simVariable = entry.getValue();
+
+ String name = null;
+ try {
+ name = BeanUtils.getProperty(entity, "name");
+ } catch (Exception ex) {
+ name = entity.getTopiaId();
+ }
+
+ for (Entry<String, Variable> variableEntry : simVariable.variablesCache.entrySet()) {
+ Variable variable = variableEntry.getValue();
+
+ out.write(name + " ");
+ out.write(variable.getName());
+ out.write(" = ");
+
+ if ("double".equals(variable.getType())) {
+ out.write(String.valueOf(variable.getDoubleValue()));
+ } else if ("matrix".equals(variable.getType())) {
+ out.write("todo matrix");
+ } else if ("equation".equals(variable.getType())) {
+ out.write("todo equation");
+ }
+ out.write("\n");
+ }
+ }
+ out.write("\n\n");
+
+ out.close();
+ } catch (IOException ex) {
+ throw new IsisFishRuntimeException("Can't save ", ex);
+ } finally {
+ IOUtils.closeQuietly(out);
+ }
+ }
}
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java 2012-02-16 16:58:57 UTC (rev 3610)
@@ -0,0 +1,155 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.simulator;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.nuiton.math.matrix.MatrixND;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.EquationImpl;
+import fr.ifremer.isisfish.entities.Variable;
+import fr.ifremer.isisfish.equation.VariableEquation;
+import fr.ifremer.isisfish.types.TimeStep;
+import fr.ifremer.isisfish.util.EvaluatorHelper;
+
+/**
+ * Object containing cached variable value for a specific entity.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class SimulationVariable {
+
+ /** Simulation context (to get db). */
+ protected SimulationContext simulationContext;
+
+ /** Managed entity id. */
+ protected TopiaEntity topiaEntity;
+
+ /** Variable name > variable entity. */
+ protected Map<String, Variable> variablesCache = new HashMap<String, Variable>();
+
+ public SimulationVariable(SimulationContext simulationContext, TopiaEntity topiaEntity) {
+ this.simulationContext = simulationContext;
+ this.topiaEntity = topiaEntity;
+ }
+
+ /**
+ * Return variable entity from cache or database.
+ *
+ * @param name variable name to get
+ * @return variable entity
+ * @throws TopiaException if can't restore variable from db
+ */
+ protected Variable getVariableEntity(String name) throws TopiaException {
+ Variable v = variablesCache.get(name);
+ if (v == null) {
+ TopiaContext topiaContext = simulationContext.getDB();
+ List<Variable> vindb = topiaContext.find("FROM " + Variable.class.getName() +
+ " WHERE " + Variable.PROPERTY_ENTITY_ID + " = :id" +
+ " AND " + Variable.PROPERTY_NAME + " = :name",
+ "id", topiaEntity.getTopiaId(),
+ "name", name);
+ if (!vindb.isEmpty()) {
+ v = vindb.get(0);
+ variablesCache.put(name, v);
+ }
+ }
+ return v;
+ }
+
+ /**
+ * Return variable value as double.
+ *
+ * @param name variable name
+ * @return value as double
+ * @throws TopiaException if can't restore variable from db
+ */
+ public double getAsDouble(String name) throws TopiaException {
+ Variable v = getVariableEntity(name);
+ double result = v.getDoubleValue();
+ return result;
+ }
+
+ /**
+ * Set variable value.
+ *
+ * @param name variable name
+ * @param value new value
+ * @throws TopiaException if can't restore variable from db
+ */
+ public void set(String name, Object value) throws TopiaException {
+ Variable v = getVariableEntity(name);
+ if (double.class.isAssignableFrom(value.getClass()) || Double.class.isAssignableFrom(value.getClass())) {
+ v.setDoubleValue((Double)value);
+ } else if (value instanceof MatrixND) {
+ v.setMatrixValue((MatrixND)value);
+ } else if (value instanceof String) {
+ Equation eq = v.getEquationValue();
+ if (eq == null) {
+ eq = new EquationImpl();
+ eq.setContent((String)value);
+ }
+ v.setEquationValue(eq);
+ }
+ }
+
+ /**
+ * Eval current variable equation.
+ *
+ * @param name variable name
+ * @return equation result
+ * @throws TopiaException if can't restore variable from db
+ */
+ public double eval(String name) throws TopiaException {
+ Variable v = getVariableEntity(name);
+ Equation eq = v.getEquationValue();
+
+ Map<String, Object> args = new HashMap<String, Object>();
+ args.put("context", simulationContext);
+ args.put("entity", topiaEntity);
+ args.put("step", new TimeStep()); // FIXME echatellier how to get real timestep value ?
+
+ Object val = EvaluatorHelper.evaluate("fr.ifremer.isisfish.equation",
+ topiaEntity.getTopiaId() + "#" + name, VariableEquation.class,
+ eq.getContent(), args);
+
+ double result = 0.0;
+ if (val instanceof Number) {
+ result = ((Number) val).doubleValue();
+ }
+ return result;
+ }
+}
Property changes on: branches/4.1/src/main/java/fr/ifremer/isisfish/simulator/SimulationVariable.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
r3609 - in branches/4.1: . src/main/java/fr/ifremer/isisfish/map
by echatellier@users.forge.codelutin.com 16 Feb '12
by echatellier@users.forge.codelutin.com 16 Feb '12
16 Feb '12
Author: echatellier
Date: 2012-02-16 17:58:26 +0100 (Thu, 16 Feb 2012)
New Revision: 3609
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3609
Log:
Update to openmap 5
Modified:
branches/4.1/pom.xml
branches/4.1/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java
branches/4.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java
branches/4.1/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java
Modified: branches/4.1/pom.xml
===================================================================
--- branches/4.1/pom.xml 2012-02-15 10:49:27 UTC (rev 3608)
+++ branches/4.1/pom.xml 2012-02-16 16:58:26 UTC (rev 3609)
@@ -244,7 +244,7 @@
<dependency>
<groupId>com.bbn</groupId>
<artifactId>openmap</artifactId>
- <version>4.6.5</version>
+ <version>5.0</version>
<scope>compile</scope>
</dependency>
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java 2012-02-15 10:49:27 UTC (rev 3608)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/map/CellSelectionLayer.java 2012-02-16 16:58:26 UTC (rev 3609)
@@ -32,13 +32,13 @@
import org.nuiton.topia.TopiaException;
-import com.bbn.openmap.LatLonPoint;
import com.bbn.openmap.event.MapMouseListener;
import com.bbn.openmap.event.NavMouseMode;
import com.bbn.openmap.event.NullMouseMode;
import com.bbn.openmap.event.SelectMouseMode;
import com.bbn.openmap.omGraphics.OMGraphic;
import com.bbn.openmap.omGraphics.OMRect;
+import com.bbn.openmap.proj.coords.LatLonPoint;
import fr.ifremer.isisfish.entities.FisheryRegion;
@@ -100,12 +100,13 @@
* @param pt le point pour lequel on cherche le carre correspondant
* @return le carre correspondant au point donne sinon renvoie null.
*/
- public OMGraphic findXY(LatLonPoint pt) {
+ public OMRect findXY(LatLonPoint pt) {
// Recupere le vecteur de tous les carres possibles.
- List<OMRect> allRect = graphics.getTargets();
+ List<OMGraphic> allRect = graphics.getTargets();
// Parcours le vecteur, et cherche le carre, et le renvoie si il existe
- for (OMRect rect : allRect) {
+ for (OMGraphic rectg : allRect) {
+ OMRect rect = (OMRect)rectg;
if (pt.getLatitude() >= rect.getSouthLat()
&& pt.getLatitude() < rect.getNorthLat()
&& pt.getLongitude() >= rect.getWestLon()
@@ -123,16 +124,17 @@
*/
public List<LatLonPoint> getSelected() {
// Recupere le vecteur de tous les carres possibles.
- List<OMRect> allRect = graphics.getTargets();
+ List<OMGraphic> allRect = graphics.getTargets();
List<LatLonPoint> result = new ArrayList<LatLonPoint>();
// Parcours le vecteur de tous les carres possibles.
- for (OMRect rect : allRect) {
+ for (OMGraphic rectg : allRect) {
+ OMRect rect = (OMRect)rectg;
// Si le carre est selectionne, on rajoute ses coordonnees au vector results
if (rect.getFillPaint() != null
- && !OMGraphic.isClear(rect.getFillPaint())) {
- result.add(new LatLonPoint(rect.getSouthLat(), rect
+ && !rect.isClear(rect.getFillPaint())) {
+ result.add(new LatLonPoint.Double(rect.getSouthLat(), rect
.getWestLon()));
}
}
@@ -144,10 +146,11 @@
*/
public void unSelectAll() {
// Recupere le vecteur de tous les carres possibles.
- List<OMRect> allRect = graphics.getTargets();
+ List<OMGraphic> allRect = graphics.getTargets();
// Parcours le vecteur et met a null la couleur de fond de chaque carre
- for (OMRect rect : allRect) {
+ for (OMGraphic rectg : allRect) {
+ OMRect rect = (OMRect)rectg;
rect.setFillPaint(null);
}
// Rafraichit le layer
@@ -161,7 +164,7 @@
*/
public boolean select(LatLonPoint pt) {
// Recherche le carre correspondant au point donne
- OMGraphic select = findXY(pt);
+ OMRect select = findXY(pt);
// si pas trouve on sort.
if (select == null)
@@ -169,7 +172,7 @@
// si trouve et pas deja selectionne
if (select.getFillPaint() == null
- || OMGraphic.isClear(select.getFillPaint())) {
+ || select.isClear(select.getFillPaint())) {
// Si on est en mode SINGLE_SELECTION, on deselectionne tous les carres avant.
if (getSelectionMode() == SINGLE_SELECTION)
unSelectAll();
@@ -188,7 +191,7 @@
* @return true si reussi sinon false.
*/
public boolean select(float latitude, float longitude) {
- return select(new LatLonPoint(latitude, longitude));
+ return select(new LatLonPoint.Float(latitude, longitude));
}
/**
@@ -214,7 +217,7 @@
* @return true si reussi sinon false.
*/
public boolean unSelect(float latitude, float longitude) {
- return unSelect(new LatLonPoint(latitude, longitude));
+ return unSelect(new LatLonPoint.Float(latitude, longitude));
}
/**
@@ -283,7 +286,7 @@
}
// on recherche le carre clique
- OMGraphic select = findXY(getProjection().inverse(e.getX(), e.getY()));
+ OMRect select = findXY((LatLonPoint)getProjection().inverse(e.getX(), e.getY()));
// si on le trouve pas,on renvoie false
if (select == null) {
@@ -292,7 +295,7 @@
// si le carre n est pas selectionne, on le selectionne
if (select.getFillPaint() == null
- || OMGraphic.isClear(select.getFillPaint())) {
+ || select.isClear(select.getFillPaint())) {
// si on est en mode SINGLE_SELECTION, on deselectionne tous avant.
if (getSelectionMode() == SINGLE_SELECTION) {
unSelectAll();
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2012-02-15 10:49:27 UTC (rev 3608)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2012-02-16 16:58:26 UTC (rev 3609)
@@ -40,7 +40,6 @@
import org.nuiton.topia.TopiaException;
import com.bbn.openmap.BufferedMapBean;
-import com.bbn.openmap.LatLonPoint;
import com.bbn.openmap.Layer;
import com.bbn.openmap.LayerHandler;
import com.bbn.openmap.MouseDelegator;
@@ -55,6 +54,7 @@
import com.bbn.openmap.layer.shape.ShapeLayer;
import com.bbn.openmap.layer.vpf.VPFLayer;
import com.bbn.openmap.omGraphics.DrawingAttributes;
+import com.bbn.openmap.proj.coords.LatLonPoint;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.IsisFishDAOHelper;
@@ -595,7 +595,7 @@
// OR this one
//setProjection(new CADRG(new LatLonPoint(centerLat, centerLong), SCALE, 480, 540));
- setCenter(new LatLonPoint(centerLat, centerLong));
+ setCenter(new LatLonPoint.Float(centerLat, centerLong));
//setScale(SCALE);
addSpecificLayer();
addGraticuleLayer();
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java 2012-02-15 10:49:27 UTC (rev 3608)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/map/ResultatLayer.java 2012-02-16 16:58:26 UTC (rev 3609)
@@ -42,13 +42,13 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.math.matrix.MatrixND;
-import com.bbn.openmap.LatLonPoint;
import com.bbn.openmap.event.MapMouseListener;
import com.bbn.openmap.event.ProjectionEvent;
import com.bbn.openmap.event.SelectMouseMode;
import com.bbn.openmap.layer.OMGraphicHandlerLayer;
import com.bbn.openmap.omGraphics.OMGraphicList;
import com.bbn.openmap.proj.Projection;
+import com.bbn.openmap.proj.coords.LatLonPoint;
import fr.ifremer.isisfish.entities.Cell;
import fr.ifremer.isisfish.entities.Zone;
1
0
r3608 - branches/4.1/src/main/resources/templates/ssh
by echatellier@users.forge.codelutin.com 15 Feb '12
by echatellier@users.forge.codelutin.com 15 Feb '12
15 Feb '12
Author: echatellier
Date: 2012-02-15 11:49:27 +0100 (Wed, 15 Feb 2012)
New Revision: 3608
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3608
Log:
Add R module loading
Modified:
branches/4.1/src/main/resources/templates/ssh/qsub-script.ftl
Modified: branches/4.1/src/main/resources/templates/ssh/qsub-script.ftl
===================================================================
--- branches/4.1/src/main/resources/templates/ssh/qsub-script.ftl 2012-02-15 10:24:56 UTC (rev 3607)
+++ branches/4.1/src/main/resources/templates/ssh/qsub-script.ftl 2012-02-15 10:49:27 UTC (rev 3608)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
+ Copyright (C) 2009 - 2012 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -26,8 +26,7 @@
cd "${isishome}"
-#source /usr/share/modules/init/csh
-#module load java/1.6.0
+module load R/2.11.1-gnu
<#assign commonCommand="${javapath} -Xmx2000M -jar isis-fish*.jar --option launch.ui false --option perform.vcsupdate false --option perform.migration false --option perform.cron false" />
<#if qsubmutiplejob>
1
0
r3607 - in branches/4.1/src/main: java/fr/ifremer/isisfish/datastore/migration java/fr/ifremer/isisfish/ui/input/variable xmi
by echatellier@users.forge.codelutin.com 15 Feb '12
by echatellier@users.forge.codelutin.com 15 Feb '12
15 Feb '12
Author: echatellier
Date: 2012-02-15 11:24:56 +0100 (Wed, 15 Feb 2012)
New Revision: 3607
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3607
Log:
Udpate variable UI
Modified:
branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx
branches/4.1/src/main/xmi/isis-fish.properties
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java 2012-02-15 09:22:14 UTC (rev 3606)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java 2012-02-15 10:24:56 UTC (rev 3607)
@@ -66,7 +66,7 @@
"TOPIAID VARCHAR(255) NOT NULL, " +
"TOPIAVERSION BIGINT NOT NULL, " +
"TOPIACREATEDATE DATE, " +
- "ENTITYID VARCHAR(255), " +
+ "ENTITYID VARCHAR(255) NOT NULL, " +
"NAME LONGVARCHAR, " +
"TYPE LONGVARCHAR, " +
"DOUBLEVALUE DOUBLE, " +
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java 2012-02-15 09:22:14 UTC (rev 3606)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java 2012-02-15 10:24:56 UTC (rev 3607)
@@ -32,6 +32,8 @@
import javax.swing.JList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaEntity;
@@ -55,6 +57,9 @@
*/
public class EntityVariableHandler {
+ /** Class logger. */
+ private static Log log = LogFactory.getLog(EntityVariableHandler.class);
+
/**
* Init view with currently entity variables.
*
@@ -62,6 +67,10 @@
*/
public void initView(EntityVariableUI view) {
+ // clear previous
+ view.getVariablesList().clearSelection();
+
+ // fill current list
List<Variable> variables = null;
TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel();
TopiaEntity bean = view.getBean();
@@ -88,19 +97,51 @@
TopiaContext context = view.getTopiaContext();
VariableDAO dao = IsisFishDAOHelper.getVariableDAO(context);
- Variable variable = dao.create("name", _("isisfish.variables.defaultname"),
- "type", "double");
+ Variable variable = dao.create(
+ Variable.PROPERTY_ENTITY_ID, view.getBean().getTopiaId(),
+ Variable.PROPERTY_NAME, _("isisfish.variables.defaultname"),
+ Variable.PROPERTY_TYPE, "double");
TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel();
List<Variable> variables = (List<Variable>)model.getElements();
variables.add(variable);
model.setEntities(variables);
+
+ // auto select
+ view.getVariablesList().setSelectedValue(variable, true);
} catch (TopiaException ex) {
throw new IsisFishRuntimeException("Can't add variable", ex);
}
}
/**
+ * Delete selected variable.
+ *
+ * @param view view
+ */
+ public void deleteVariable(EntityVariableUI view) {
+ JList variableList = view.getVariablesList();
+ Variable variable = (Variable)variableList.getSelectedValue();
+
+ try {
+ // delete in db
+ TopiaContext context = view.getTopiaContext();
+ VariableDAO dao = IsisFishDAOHelper.getVariableDAO(context);
+ dao.delete(variable);
+ context.commitTransaction();
+
+ // refresh ui
+ view.getVariablesList().clearSelection(); // fix event bug
+ TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel();
+ List<Variable> variables = (List<Variable>)model.getElements();
+ variables.remove(variable);
+ model.setEntities(variables);
+ } catch (TopiaException ex) {
+ throw new IsisFishRuntimeException("Can't delete variable", ex);
+ }
+ }
+
+ /**
* Display selected variable for edition.
*
* @param view view
@@ -109,11 +150,21 @@
JList variableList = view.getVariablesList();
Variable variable = (Variable)variableList.getSelectedValue();
+ view.setVariable(variable);
if (variable != null) {
view.getVariableNameField().setText(variable.getName());
- view.getVariableTypeCombo().setSelectedItem(variable.getType());
+
+ String type = variable.getType();
+ view.getVariableTypeCombo().setSelectedItem(type); // fire showSelectedType
+
+ if ("double".equals(type)) {
+ view.getVariableDoubleValue().setText(String.valueOf(variable.getDoubleValue()));
+ } else if ("matrix".equals(type)) {
+ //cardLayout.show(view.getVariableTypePanel(), "matrixtype");
+ } else if ("equation".equals(type)) {
+ //cardLayout.show(view.getVariableTypePanel(), "equationtype");
+ }
}
-
}
/**
@@ -142,12 +193,19 @@
JList variableList = view.getVariablesList();
Variable variable = (Variable)variableList.getSelectedValue();
variable.setName(view.getVariableNameField().getText().trim());
-
+
String type = (String)view.getVariableTypeCombo().getSelectedItem();
variable.setType((String)view.getVariableTypeCombo().getSelectedItem());
-
+
if ("double".equals(type)) {
- variable.setDoubleValue(0);
+ try {
+ double v = Double.parseDouble(view.getVariableDoubleValue().getText().trim());
+ variable.setDoubleValue(v);
+ } catch (NumberFormatException ex) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse double value as double", ex);
+ }
+ }
} else if ("matrix".equals(type)) {
variable.setMatrixValue(view.getMatrixPanel().getMatrix());
} else if ("equation".equals(type)) {
@@ -158,5 +216,20 @@
eq.setContent(view.getVariableDoubleValue().getText());
variable.setEquationValue(eq);
}
+
+ try {
+ // save in db
+ TopiaContext context = view.getTopiaContext();
+ VariableDAO dao = IsisFishDAOHelper.getVariableDAO(context);
+ dao.update(variable);
+ context.commitTransaction();
+
+ // refresh ui (name change)
+ TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel();
+ List<Variable> variables = (List<Variable>)model.getElements();
+ model.setEntities(variables);
+ } catch (TopiaException ex) {
+ throw new IsisFishRuntimeException("Can't save variable", ex);
+ }
}
}
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx 2012-02-15 09:22:14 UTC (rev 3606)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx 2012-02-15 10:24:56 UTC (rev 3607)
@@ -29,6 +29,8 @@
<!-- bean property -->
<org.nuiton.topia.persistence.TopiaEntityContextable id='bean' javaBean='null'/>
+ <fr.ifremer.isisfish.entities.Variable id="variable" javaBean='null' />
+
<script><![CDATA[
protected void $afterCompleteSetup() {
addPropertyChangeListener(PROPERTY_BEAN, new java.beans.PropertyChangeListener() {
@@ -48,13 +50,15 @@
<JScrollPane>
<JList id="variablesList" cellRenderer="{new VariableListRenderer()}"
model="{new fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel()}"
- onValueChanged="getVarHandler().showSelectedVariable(this)"/>
+ onValueChanged="getVarHandler().showSelectedVariable(this)"
+ enabled='{isActive()}'/>
</JScrollPane>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JButton text="isisfish.variables.addvariable" onActionPerformed="getVarHandler().addNewVariable(this)" />
+ <JButton text="isisfish.variables.addvariable" onActionPerformed="getVarHandler().addNewVariable(this)"
+ enabled='{isActive()}'/>
</cell>
</row>
</Table>
@@ -63,19 +67,23 @@
<Table border='{BorderFactory.createTitledBorder(_("isisfish.variables.variabledetail"))}'>
<row>
<cell fill="horizontal">
- <JLabel text="isisfish.variables.variablename" />
+ <JLabel text="isisfish.variables.variablename"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
<cell fill="horizontal" weightx='1.0'>
- <JTextField id="variableNameField" />
+ <JTextField id="variableNameField"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
</row>
<row>
<cell fill="horizontal">
- <JLabel text="isisfish.variables.variabletype" />
+ <JLabel text="isisfish.variables.variabletype"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
<cell fill="horizontal" weightx='1.0'>
<JComboBox id="variableTypeCombo" model="{new VariableTypeComboModel()}"
- onActionPerformed="getVarHandler().showSelectedType(this)"/>
+ onActionPerformed="getVarHandler().showSelectedType(this)"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
</row>
<row>
@@ -87,10 +95,10 @@
<Table constraints='"doubletype"'>
<row>
<cell fill="horizontal" anchor="northeast" weighty='1.0'>
- <JLabel text="isisfish.variables.double.value" />
+ <JLabel text="isisfish.variables.double.value" enabled='{isActive() && getVariable() != null}' />
</cell>
<cell fill="horizontal" weightx='1.0' anchor="northeast" weighty='1.0'>
- <JTextField id="variableDoubleValue" />
+ <JTextField id="variableDoubleValue" enabled='{isActive() && getVariable() != null}' />
</cell>
</row>
</Table>
@@ -99,12 +107,14 @@
<Table constraints='"matrixtype"'>
<row>
<cell fill="horizontal">
- <JLabel text="isisfish.variables.matrix.value" />
+ <JLabel text="isisfish.variables.matrix.value"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
</row>
<row>
<cell fill="both" weightx='1.0' weighty='1.0'>
- <org.nuiton.math.matrix.gui.MatrixPanelEditor id="matrixPanel" />
+ <org.nuiton.math.matrix.gui.MatrixPanelEditor id="matrixPanel"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
</row>
</Table>
@@ -113,7 +123,8 @@
<Table constraints='"equationtype"'>
<row>
<cell fill="both" weightx='1.0' weighty='1.0'>
- <fr.ifremer.isisfish.ui.input.InputOneEquationUI id="variableEquationValue" />
+ <fr.ifremer.isisfish.ui.input.InputOneEquationUI id="variableEquationValue"
+ active='{isActive() && getVariable() != null}'/>
</cell>
</row>
</Table>
@@ -122,10 +133,14 @@
</row>
<row>
<cell anchor="west">
- <JButton text="isisfish.variables.deletevariable" />
+ <JButton text="isisfish.variables.deletevariable"
+ onActionPerformed="getVarHandler().deleteVariable(this)"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
<cell anchor="east" weightx='1.0'>
- <JButton text="isisfish.variables.savevariable" />
+ <JButton text="isisfish.variables.savevariable"
+ onActionPerformed="getVarHandler().saveVariable(this)"
+ enabled='{isActive() && getVariable() != null}'/>
</cell>
</row>
</Table>
Modified: branches/4.1/src/main/xmi/isis-fish.properties
===================================================================
--- branches/4.1/src/main/xmi/isis-fish.properties 2012-02-15 09:22:14 UTC (rev 3606)
+++ branches/4.1/src/main/xmi/isis-fish.properties 2012-02-15 10:24:56 UTC (rev 3607)
@@ -53,5 +53,6 @@
fr.ifremer.isisfish.entities.TargetSpecies.class.tagvalue.contextable=true
fr.ifremer.isisfish.entities.TripType.class.tagvalue.contextable=true
fr.ifremer.isisfish.entities.Variable.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Variable.attribute.entityId.tagvalue.notNull=true
fr.ifremer.isisfish.entities.VesselType.class.tagvalue.contextable=true
fr.ifremer.isisfish.entities.Zone.class.tagvalue.contextable=true
1
0
Author: echatellier
Date: 2012-02-15 10:22:14 +0100 (Wed, 15 Feb 2012)
New Revision: 3606
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3606
Log:
Variable must extends TopiaEntityContextable
Modified:
branches/4.1/src/main/xmi/isis-fish.properties
Modified: branches/4.1/src/main/xmi/isis-fish.properties
===================================================================
--- branches/4.1/src/main/xmi/isis-fish.properties 2012-02-14 16:50:58 UTC (rev 3605)
+++ branches/4.1/src/main/xmi/isis-fish.properties 2012-02-15 09:22:14 UTC (rev 3606)
@@ -5,7 +5,7 @@
# $Id$
# $HeadURL$
# %%
-# Copyright (C) 1999 - 2011 Ifremer, CodeLutin, Chatellier
+# Copyright (C) 1999 - 2012 Ifremer, CodeLutin, Chatellier Eric
# %%
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
@@ -22,7 +22,7 @@
# <http://www.gnu.org/licenses/gpl-2.0.html>.
# #L%
###
-model.tagvalue.copyright=/* Copyright (C) 1999 - 2011 Ifremer - Code Lutin */
+model.tagvalue.copyright=/* Copyright (C) 1999 - 2012 Ifremer - Code Lutin */
model.tagvalue.org.nuiton.math.matrix.MatrixND=fr.ifremer.isisfish.types.hibernate.MatrixType(name,dim,dimNames,semantics,data)
model.tagvalue.fr.ifremer.isisfish.types.Month=fr.ifremer.isisfish.types.hibernate.MonthType
model.tagvalue.fr.ifremer.isisfish.types.TimeStep=fr.ifremer.isisfish.types.hibernate.TimeStepType
@@ -52,5 +52,6 @@
fr.ifremer.isisfish.entities.StrategyMonthInfo.class.tagvalue.contextable=true
fr.ifremer.isisfish.entities.TargetSpecies.class.tagvalue.contextable=true
fr.ifremer.isisfish.entities.TripType.class.tagvalue.contextable=true
+fr.ifremer.isisfish.entities.Variable.class.tagvalue.contextable=true
fr.ifremer.isisfish.entities.VesselType.class.tagvalue.contextable=true
fr.ifremer.isisfish.entities.Zone.class.tagvalue.contextable=true
1
0
14 Feb '12
Author: echatellier
Date: 2012-02-14 17:50:58 +0100 (Tue, 14 Feb 2012)
New Revision: 3605
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3605
Log:
Ajout de la configuration R dans les script bat
Modified:
branches/4.1/src/main/assembly/isisfish.bat
branches/4.1/src/main/assembly/isisfish64.bat
Modified: branches/4.1/src/main/assembly/isisfish.bat
===================================================================
--- branches/4.1/src/main/assembly/isisfish.bat 2012-02-14 16:48:29 UTC (rev 3604)
+++ branches/4.1/src/main/assembly/isisfish.bat 2012-02-14 16:50:58 UTC (rev 3605)
@@ -1,5 +1,7 @@
@echo off
+rem SET R_HOME=C:\Program Files\R\R-2.14.1
+rem SET PATH=%PATH%;%R_HOME%\bin\i386
+
echo [Script] Isis starting...
java -Xmx1024M -Djava.library.path=jri -DR.type=jni -jar ${project.build.finalName}.${project.packaging} %1 %2 %3 %4 %5 %6 %7 %8 %9 > debug.txt 2>&1
-
Modified: branches/4.1/src/main/assembly/isisfish64.bat
===================================================================
--- branches/4.1/src/main/assembly/isisfish64.bat 2012-02-14 16:48:29 UTC (rev 3604)
+++ branches/4.1/src/main/assembly/isisfish64.bat 2012-02-14 16:50:58 UTC (rev 3605)
@@ -1,5 +1,7 @@
@echo off
+rem SET R_HOME=C:\Program Files\R\R-2.14.1
+rem SET PATH=%PATH%;%R_HOME%\bin\x64
+
echo [Script] Isis starting...
java -Xmx1024M -Djava.library.path=jri64 -DR.type=jni -jar ${project.build.finalName}.${project.packaging} %1 %2 %3 %4 %5 %6 %7 %8 %9 > debug.txt 2>&1
-
1
0
r3604 - in branches/4.1/src/main: java/fr/ifremer/isisfish/datastore/migration java/fr/ifremer/isisfish/entities java/fr/ifremer/isisfish/ui/input java/fr/ifremer/isisfish/ui/input/model java/fr/ifremer/isisfish/ui/input/variable resources/i18n xmi
by echatellier@users.forge.codelutin.com 14 Feb '12
by echatellier@users.forge.codelutin.com 14 Feb '12
14 Feb '12
Author: echatellier
Date: 2012-02-14 17:48:29 +0100 (Tue, 14 Feb 2012)
New Revision: 3604
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3604
Log:
Debut de l'impl?\195?\169mentation et de l'interface de gestion des variables habitats
Added:
branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java
branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableListRenderer.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableTypeComboModel.java
Modified:
branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java
branches/4.1/src/main/resources/i18n/isis-fish_en_GB.properties
branches/4.1/src/main/resources/i18n/isis-fish_fr_FR.properties
branches/4.1/src/main/xmi/isis-fish.zargo
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2012-02-13 14:55:15 UTC (rev 3603)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2012-02-14 16:48:29 UTC (rev 3604)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -50,6 +50,7 @@
protected static final Version VERSION_32 = new Version("3.2");
protected static final Version VERSION_33 = new Version("3.3");
protected static final Version VERSION_40 = new Version("4.0");
+ protected static final Version VERSION_41 = new Version("4.1");
public DatabaseMigrationClass() {
super(new MigrationResolver());
@@ -65,12 +66,12 @@
if (version.equals(VERSION_32)) {
result = MigrationV0V32.class;
- }
- else if (version.equals(VERSION_33)) {
+ } else if (version.equals(VERSION_33)) {
result = MigrationV32V33.class;
- }
- else if (version.equals(VERSION_40)) {
+ } else if (version.equals(VERSION_40)) {
result = MigrationV33V40.class;
+ } else if (version.equals(VERSION_41)) {
+ result = MigrationV40V41.class;
}
return result;
}
@@ -82,7 +83,7 @@
*/
@Override
public Version[] getAvailableVersions() {
- Version[] result = new Version[] { VERSION_32, VERSION_33, VERSION_40 };
+ Version[] result = new Version[] { VERSION_32, VERSION_33, VERSION_40, VERSION_41 };
return result;
}
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java 2012-02-14 16:48:29 UTC (rev 3604)
@@ -0,0 +1,81 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.datastore.migration;
+
+import java.util.List;
+
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass;
+import org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion;
+import org.nuiton.util.Version;
+
+/**
+ * Migration between version 3.3 and 4.0.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class MigrationV40V41 extends MigrationCallBackForVersion {
+
+ /**
+ * Constructor.
+ *
+ * @param version version
+ * @param callback callback
+ */
+ public MigrationV40V41(Version version, TopiaMigrationCallbackByClass callback) {
+ super(version, callback);
+ }
+
+ /*
+ * @see org.nuiton.topia.migration.TopiaMigrationCallbackByClass.MigrationCallBackForVersion#prepareMigrationScript(org.nuiton.topia.framework.TopiaContextImplementor, java.util.List, boolean, boolean)
+ */
+ @Override
+ protected void prepareMigrationScript(TopiaContextImplementor tx,
+ List<String> queries, boolean showSql, boolean showProgression)
+ throws TopiaException {
+
+ queries.add("CREATE TABLE VARIABLE( " +
+ "TOPIAID VARCHAR(255) NOT NULL, " +
+ "TOPIAVERSION BIGINT NOT NULL, " +
+ "TOPIACREATEDATE DATE, " +
+ "ENTITYID VARCHAR(255), " +
+ "NAME LONGVARCHAR, " +
+ "TYPE LONGVARCHAR, " +
+ "DOUBLEVALUE DOUBLE, " +
+ "MATRIXVALUE_NAME VARCHAR(255), " +
+ "MATRIXVALUE_DIM VARCHAR(255), " +
+ "MATRIXVALUE_DIMNAMES LONGVARCHAR, " +
+ "MATRIXVALUE_SEMANTICS LONGVARCHAR," +
+ "MATRIXVALUE_DATA LONGVARCHAR, " +
+ "EQUATIONVALUE VARCHAR(255)) ");
+
+ }
+}
Property changes on: branches/4.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV40V41.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java 2012-02-14 16:48:29 UTC (rev 3604)
@@ -0,0 +1,55 @@
+/*
+ * #%L
+ * IsisFish
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer, Code Lutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.entities;
+
+import org.nuiton.math.matrix.MatrixND;
+
+public class VariableImpl extends VariableAbstract {
+
+ private static final long serialVersionUID = 3978428224373810278L;
+
+ @Override
+ public void setDoubleValue(double doubleValue) {
+ super.setDoubleValue(doubleValue);
+ super.setMatrixValue(null);
+ super.setEquationValue(null);
+ }
+
+ @Override
+ public void setEquationValue(Equation equationValue) {
+ super.setEquationValue(equationValue);
+ super.setDoubleValue(0);
+ super.setMatrixValue(null);
+ }
+
+ @Override
+ public void setMatrixValue(MatrixND matrixValue) {
+ super.setMatrixValue(matrixValue);
+ super.setDoubleValue(0);
+ super.setEquationValue(null);
+ }
+
+} //VariableImpl
Property changes on: branches/4.1/src/main/java/fr/ifremer/isisfish/entities/VariableImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Copied: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx (from rev 3601, branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx)
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneBasicsUI.jaxx 2012-02-14 16:48:29 UTC (rev 3604)
@@ -0,0 +1,206 @@
+<!--
+ #%L
+ IsisFish
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 Ifremer, Code Lutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-2.0.html>.
+ #L%
+ -->
+<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'>
+
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/>
+
+ <import>
+ static org.nuiton.i18n.I18n.n_
+ javax.swing.event.ListSelectionEvent
+ fr.ifremer.isisfish.entities.Cell
+ fr.ifremer.isisfish.entities.Zone
+ fr.ifremer.isisfish.map.CellSelectionLayer
+ fr.ifremer.isisfish.map.CopyMapToClipboardListener
+ fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel
+ com.bbn.openmap.event.SelectMouseMode
+ com.bbn.openmap.gui.Tool
+ com.bbn.openmap.gui.OMToolSet
+ java.beans.PropertyChangeEvent
+ java.beans.PropertyChangeListener
+ java.awt.event.MouseEvent
+ java.util.ArrayList
+ </import>
+
+ <BeanValidator id='validator'
+ bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Zone'
+ uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI">
+ <field name="name" component="fieldZoneName" />
+ <field name="cell" component="spZoneCells" />
+ </BeanValidator>
+
+ <script><![CDATA[
+protected OMToolSet toolSet = new OMToolSet();
+
+protected void $afterCompleteSetup() {
+
+ toolSet.setupListeners(zoneMap);
+ toolMap.add((Tool)toolSet);
+
+ // add copy to clipboard support
+ zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap));
+ new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) {
+ @Override
+ public boolean mouseClicked(MouseEvent e) {
+ boolean result = false;
+ if (getBean() != null) { // impossible de desactiver la carte :(
+ getBean().setCell(zoneMap.getSelectedCells());
+ setZoneCells();
+ }
+ return result;
+ }
+ };
+
+ addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getNewValue() == null) {
+ fieldZoneName.setText("");
+ fieldZoneComment.setText("");
+ zoneMap.setSelectedCells();
+ }
+ if (evt.getNewValue() != null) {
+ setZoneCells();
+ }
+ }
+ });
+}
+
+protected void setZoneCells() {
+ if (getBean() != null) {
+ List<Cell> cells = getFisheryRegion().getCell();
+ TopiaEntityListModel model = new TopiaEntityListModel(cells);
+ zoneCells.setModel(model);
+ if (getBean().getCell() != null) {
+ for (Cell selectedCell : getBean().getCell()) {
+ int index = cells.indexOf(selectedCell);
+ zoneCells.addSelectionInterval(index, index);
+ }
+ }
+ }
+}
+
+protected void zoneCellsChange(ListSelectionEvent event) {
+ // sans ca, ca boucle (modification depuis la carte)
+ if (event.getValueIsAdjusting()) {
+ // pas a faie dans le cas d'une AS
+ if (isActive()) {
+ java.util.List<Cell> cells = new ArrayList<Cell>();
+ for (Object o : zoneCells.getSelectedValues()) {
+ cells.add((Cell) o);
+ }
+ getBean().setCell(cells);
+ }
+ }
+}
+]]>
+ </script>
+ <JPanel id='body'>
+ <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="horizontal">
+ <Table>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JLabel enabled='{isActive()}' text="isisfish.zone.name"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldZoneName"
+ text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}'
+ enabled='{isActive()}' decorator='boxed'
+ onKeyReleased='getBean().setName(fieldZoneName.getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JLabel enabled='{isActive()}' text="isisfish.zone.cells"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weighty='0.7' weightx='1.0'>
+ <JScrollPane id="spZoneCells">
+ <JList id="zoneCells" enabled='{isActive()}'
+ onValueChanged='zoneCellsChange(event)' decorator='boxed'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JLabel enabled='{isActive()}' text="isisfish.zone.comments"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weighty='0.3' weightx='1.0'>
+ <JScrollPane>
+ <JTextArea id="fieldZoneComment"
+ text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}'
+ enabled='{isActive()}'
+ decorator='boxed'
+ onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' decorator='boxed'
+ text="isisfish.common.save"
+ enabled="{validator.isValid() && validator.isChanged()}"
+ onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' decorator='boxed'
+ text="isisfish.common.cancel"
+ enabled="{validator.isChanged()}"
+ onActionPerformed="getSaveVerifier().cancel()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' decorator='boxed'
+ text="isisfish.common.new"
+ enabled="{!validator.isChanged()}"
+ onActionPerformed="getSaveVerifier().create(Zone.class)"/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='delete' decorator='boxed'
+ text="isisfish.common.remove"
+ enabled="{!validator.isChanged() && getBean() != null}"
+ onActionPerformed="getSaveVerifier().delete()"/>
+ </cell>
+ </row>
+ </Table>
+ <JPanel id='map' layout='{new BorderLayout()}'>
+ <com.bbn.openmap.gui.ToolPanel id='toolMap'
+ javaBean='new com.bbn.openmap.gui.ToolPanel()'
+ decorator='boxed' constraints='BorderLayout.NORTH'/>
+ <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap'
+ javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'
+ selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}"
+ fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()==null?null:bean.getCell()}'
+ decorator='boxed' constraints='BorderLayout.CENTER'/>
+ <!-- FIXME echatellier 20110429 : binding -->
+ </JPanel>
+ </JSplitPane>
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2012-02-13 14:55:15 UTC (rev 3603)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2012-02-14 16:48:29 UTC (rev 3604)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2009 - 2010 Ifremer, Code Lutin
+ Copyright (C) 2012 Ifremer, Code Lutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -22,187 +22,50 @@
<http://www.gnu.org/licenses/gpl-2.0.html>.
#L%
-->
-<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='Zone'>
+<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='fr.ifremer.isisfish.entities.Zone'>
- <!-- bean property -->
<fr.ifremer.isisfish.entities.Zone id='bean' javaBean='null'/>
<import>
static org.nuiton.i18n.I18n.n_
- javax.swing.event.ListSelectionEvent
- fr.ifremer.isisfish.entities.Cell
- fr.ifremer.isisfish.entities.Zone
- fr.ifremer.isisfish.map.CellSelectionLayer
- fr.ifremer.isisfish.map.CopyMapToClipboardListener
- fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel
- com.bbn.openmap.event.SelectMouseMode
- com.bbn.openmap.gui.Tool
- com.bbn.openmap.gui.OMToolSet
- java.beans.PropertyChangeEvent
- java.beans.PropertyChangeListener
- java.awt.event.MouseEvent
- java.util.ArrayList
+ java.beans.PropertyChangeEvent;
+ java.beans.PropertyChangeListener;
</import>
-
- <BeanValidator id='validator'
- bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Zone'
- uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI">
- <field name="name" component="fieldZoneName" />
- <field name="cell" component="spZoneCells" />
- </BeanValidator>
-
<script><![CDATA[
-protected OMToolSet toolSet = new OMToolSet();
protected void $afterCompleteSetup() {
setButtonTitle(_("isisfish.input.continuePorts"));
setNextPath(n_("isisfish.input.tree.ports"));
- toolSet.setupListeners(zoneMap);
- toolMap.add((Tool)toolSet);
-
- // add copy to clipboard support
- zoneMap.addMapMouseListener(new CopyMapToClipboardListener(zoneMap));
- new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) {
- @Override
- public boolean mouseClicked(MouseEvent e) {
- boolean result = false;
- if (getBean() != null) { // impossible de desactiver la carte :(
- getBean().setCell(zoneMap.getSelectedCells());
- setZoneCells();
- }
- return result;
- }
- };
-
- addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getNewValue() == null) {
- fieldZoneName.setText("");
- fieldZoneComment.setText("");
- zoneMap.setSelectedCells();
- }
- if (evt.getNewValue() != null) {
- setZoneCells();
- }
- }
- });
+ // install change listener
+ // (depends on sensitivity can't be done on constructor)
+ installChangeListener(zoneTab);
}
-protected void setZoneCells() {
- if (getBean() != null) {
- List<Cell> cells = getFisheryRegion().getCell();
- TopiaEntityListModel model = new TopiaEntityListModel(cells);
- zoneCells.setModel(model);
- if (getBean().getCell() != null) {
- for (Cell selectedCell : getBean().getCell()) {
- int index = cells.indexOf(selectedCell);
- zoneCells.addSelectionInterval(index, index);
- }
- }
- }
+@Override
+public void setLayer(boolean active) {
+ super.setLayer(active);
+ zoneBasicsUI.setLayer(active);
+ variablesUI.setLayer(active);
}
-protected void zoneCellsChange(ListSelectionEvent event) {
- // sans ca, ca boucle (modification depuis la carte)
- if (event.getValueIsAdjusting()) {
- // pas a faie dans le cas d'une AS
- if (isActive()) {
- java.util.List<Cell> cells = new ArrayList<Cell>();
- for (Object o : zoneCells.getSelectedValues()) {
- cells.add((Cell) o);
- }
- getBean().setCell(cells);
- }
- }
+@Override
+public void resetChangeModel() {
+ zoneBasicsUI.resetChangeModel();
+ variablesUI.resetChangeModel();
}
-]]>
- </script>
- <JPanel id='body'>
- <JSplitPane oneTouchExpandable="true" dividerLocation="200" orientation="horizontal">
- <Table>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JLabel enabled='{isActive()}' text="isisfish.zone.name"/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldZoneName"
- text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getName())}'
- enabled='{isActive()}' decorator='boxed'
- onKeyReleased='getBean().setName(fieldZoneName.getText())'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JLabel enabled='{isActive()}' text="isisfish.zone.cells"/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weighty='0.7' weightx='1.0'>
- <JScrollPane id="spZoneCells">
- <JList id="zoneCells" enabled='{isActive()}'
- onValueChanged='zoneCellsChange(event)' decorator='boxed'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JLabel enabled='{isActive()}' text="isisfish.zone.comments"/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weighty='0.3' weightx='1.0'>
- <JScrollPane>
- <JTextArea id="fieldZoneComment"
- text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getComment())}'
- enabled='{isActive()}'
- decorator='boxed'
- onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' decorator='boxed'
- text="isisfish.common.save"
- enabled="{validator.isValid() && validator.isChanged()}"
- onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' decorator='boxed'
- text="isisfish.common.cancel"
- enabled="{validator.isChanged()}"
- onActionPerformed="getSaveVerifier().cancel()"/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' decorator='boxed'
- text="isisfish.common.new"
- enabled="{!validator.isChanged()}"
- onActionPerformed="getSaveVerifier().create(Zone.class)"/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' decorator='boxed'
- text="isisfish.common.remove"
- enabled="{!validator.isChanged() && getBean() != null}"
- onActionPerformed="getSaveVerifier().delete()"/>
- </cell>
- </row>
- </Table>
- <JPanel id='map' layout='{new BorderLayout()}'>
- <com.bbn.openmap.gui.ToolPanel id='toolMap'
- javaBean='new com.bbn.openmap.gui.ToolPanel()'
- decorator='boxed' constraints='BorderLayout.NORTH'/>
- <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap'
- javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'
- selectionMode="{fr.ifremer.isisfish.map.CellSelectionLayer.MULT_SELECTION}"
- fisheryRegion='{getFisheryRegion()}' selectedCells='{getBean()==null?null:bean.getCell()}'
- decorator='boxed' constraints='BorderLayout.CENTER'/>
- <!-- FIXME echatellier 20110429 : binding -->
- </JPanel>
- </JSplitPane>
+ ]]></script>
+ <JPanel id="body">
+ <JTabbedPane constraints='BorderLayout.CENTER' id="zoneTab">
+ <tab title='isisfish.gear.title'>
+ <ZoneBasicsUI id="zoneBasicsUI" bean="{getBean()}" active="{isActive()}"
+ sensitivity="{isSensitivity()}" constructorParams='this' />
+ </tab>
+ <tab title='isisfish.variables.tabtitle'>
+ <fr.ifremer.isisfish.ui.input.variable.EntityVariableUI id="variablesUI"
+ bean="{getBean()}" active="{isActive()}"
+ sensitivity="{isSensitivity()}" constructorParams='this'/>
+ </tab>
+ </JTabbedPane>
</JPanel>
-</fr.ifremer.isisfish.ui.input.InputContentUI>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java 2012-02-13 14:55:15 UTC (rev 3603)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/model/TopiaEntityListModel.java 2012-02-14 16:48:29 UTC (rev 3604)
@@ -50,15 +50,30 @@
/** Zones list */
protected List<? extends TopiaEntity> entities;
+ public TopiaEntityListModel() {
+
+ }
+
/**
* Constructor with entities list.
*
* @param entities entities list
*/
public TopiaEntityListModel(List<? extends TopiaEntity> entities) {
+ this();
this.entities = entities;
}
+ /**
+ * Update model entities list.
+ *
+ * @param entities entities
+ */
+ public void setEntities(List<? extends TopiaEntity> entities) {
+ this.entities = entities;
+ fireContentsChanged(this, 0, entities == null ? 0 : entities.size() - 1);
+ }
+
/*
* @see javax.swing.ListModel#getElementAt(int)
*/
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java 2012-02-14 16:48:29 UTC (rev 3604)
@@ -0,0 +1,162 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.ui.input.variable;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.CardLayout;
+import java.util.List;
+
+import javax.swing.JList;
+
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import fr.ifremer.isisfish.IsisFishDAOHelper;
+import fr.ifremer.isisfish.IsisFishRuntimeException;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.EquationImpl;
+import fr.ifremer.isisfish.entities.Variable;
+import fr.ifremer.isisfish.entities.VariableDAO;
+import fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel;
+
+/**
+ * Handler for generic variable ui.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class EntityVariableHandler {
+
+ /**
+ * Init view with currently entity variables.
+ *
+ * @param view view
+ */
+ public void initView(EntityVariableUI view) {
+
+ List<Variable> variables = null;
+ TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel();
+ TopiaEntity bean = view.getBean();
+ if (bean != null) {
+ try {
+ TopiaContext context = view.getTopiaContext();
+ VariableDAO dao = IsisFishDAOHelper.getVariableDAO(context);
+ variables = dao.findAllByEntityId(bean.getTopiaId());
+ } catch (TopiaException ex) {
+ throw new IsisFishRuntimeException("Can't init view", ex);
+ }
+ }
+
+ model.setEntities(variables);
+ }
+
+ /**
+ * Add new variable into list.
+ *
+ * @param view view
+ */
+ public void addNewVariable(EntityVariableUI view) {
+ try {
+ TopiaContext context = view.getTopiaContext();
+ VariableDAO dao = IsisFishDAOHelper.getVariableDAO(context);
+
+ Variable variable = dao.create("name", _("isisfish.variables.defaultname"),
+ "type", "double");
+
+ TopiaEntityListModel model = (TopiaEntityListModel)view.getVariablesList().getModel();
+ List<Variable> variables = (List<Variable>)model.getElements();
+ variables.add(variable);
+ model.setEntities(variables);
+ } catch (TopiaException ex) {
+ throw new IsisFishRuntimeException("Can't add variable", ex);
+ }
+ }
+
+ /**
+ * Display selected variable for edition.
+ *
+ * @param view view
+ */
+ public void showSelectedVariable(EntityVariableUI view) {
+
+ JList variableList = view.getVariablesList();
+ Variable variable = (Variable)variableList.getSelectedValue();
+ if (variable != null) {
+ view.getVariableNameField().setText(variable.getName());
+ view.getVariableTypeCombo().setSelectedItem(variable.getType());
+ }
+
+ }
+
+ /**
+ * Display card layout part associated with selected type.
+ *
+ * @param view view
+ */
+ public void showSelectedType(EntityVariableUI view) {
+ CardLayout cardLayout = view.getVariableTypeLayout();
+ String type = (String)view.getVariableTypeCombo().getSelectedItem();
+ if ("double".equals(type)) {
+ cardLayout.show(view.getVariableTypePanel(), "doubletype");
+ } else if ("matrix".equals(type)) {
+ cardLayout.show(view.getVariableTypePanel(), "matrixtype");
+ } else if ("equation".equals(type)) {
+ cardLayout.show(view.getVariableTypePanel(), "equationtype");
+ }
+ }
+
+ /**
+ * Save current edited variable.
+ *
+ * @param view view
+ */
+ public void saveVariable(EntityVariableUI view) {
+ JList variableList = view.getVariablesList();
+ Variable variable = (Variable)variableList.getSelectedValue();
+ variable.setName(view.getVariableNameField().getText().trim());
+
+ String type = (String)view.getVariableTypeCombo().getSelectedItem();
+ variable.setType((String)view.getVariableTypeCombo().getSelectedItem());
+
+ if ("double".equals(type)) {
+ variable.setDoubleValue(0);
+ } else if ("matrix".equals(type)) {
+ variable.setMatrixValue(view.getMatrixPanel().getMatrix());
+ } else if ("equation".equals(type)) {
+ Equation eq = variable.getEquationValue();
+ if (eq == null) {
+ eq = new EquationImpl();
+ }
+ eq.setContent(view.getVariableDoubleValue().getText());
+ variable.setEquationValue(eq);
+ }
+ }
+}
Property changes on: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/EntityVariableUI.jaxx 2012-02-14 16:48:29 UTC (rev 3604)
@@ -0,0 +1,135 @@
+<!--
+ #%L
+ IsisFish
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer, Code Lutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-2.0.html>.
+ #L%
+ -->
+<fr.ifremer.isisfish.ui.input.InputContentUI superGenericType='org.nuiton.topia.persistence.TopiaEntityContextable'>
+
+ <EntityVariableHandler id="varHandler" />
+
+ <!-- bean property -->
+ <org.nuiton.topia.persistence.TopiaEntityContextable id='bean' javaBean='null'/>
+
+ <script><![CDATA[
+ protected void $afterCompleteSetup() {
+ addPropertyChangeListener(PROPERTY_BEAN, new java.beans.PropertyChangeListener() {
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ varHandler.initView(EntityVariableUI.this);
+ }
+ });
+ }
+ ]]></script>
+
+ <Table>
+ <row>
+ <cell fill="both" weightx='1.0' weighty='1.0'>
+ <Table border='{BorderFactory.createTitledBorder(_("isisfish.variables.variableslist"))}'>
+ <row>
+ <cell fill="both" weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JList id="variablesList" cellRenderer="{new VariableListRenderer()}"
+ model="{new fr.ifremer.isisfish.ui.input.model.TopiaEntityListModel()}"
+ onValueChanged="getVarHandler().showSelectedVariable(this)"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton text="isisfish.variables.addvariable" onActionPerformed="getVarHandler().addNewVariable(this)" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill="both" weightx='3.0' weighty='1.0' rows="2">
+ <Table border='{BorderFactory.createTitledBorder(_("isisfish.variables.variabledetail"))}'>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="isisfish.variables.variablename" />
+ </cell>
+ <cell fill="horizontal" weightx='1.0'>
+ <JTextField id="variableNameField" />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="isisfish.variables.variabletype" />
+ </cell>
+ <cell fill="horizontal" weightx='1.0'>
+ <JComboBox id="variableTypeCombo" model="{new VariableTypeComboModel()}"
+ onActionPerformed="getVarHandler().showSelectedType(this)"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns="2" fill="both" weightx='1.0' weighty='1.0'>
+ <CardLayout id="variableTypeLayout" />
+
+ <JPanel id="variableTypePanel" layout="{variableTypeLayout}">
+ <!-- double -->
+ <Table constraints='"doubletype"'>
+ <row>
+ <cell fill="horizontal" anchor="northeast" weighty='1.0'>
+ <JLabel text="isisfish.variables.double.value" />
+ </cell>
+ <cell fill="horizontal" weightx='1.0' anchor="northeast" weighty='1.0'>
+ <JTextField id="variableDoubleValue" />
+ </cell>
+ </row>
+ </Table>
+
+ <!-- matrix -->
+ <Table constraints='"matrixtype"'>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="isisfish.variables.matrix.value" />
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx='1.0' weighty='1.0'>
+ <org.nuiton.math.matrix.gui.MatrixPanelEditor id="matrixPanel" />
+ </cell>
+ </row>
+ </Table>
+
+ <!-- equation -->
+ <Table constraints='"equationtype"'>
+ <row>
+ <cell fill="both" weightx='1.0' weighty='1.0'>
+ <fr.ifremer.isisfish.ui.input.InputOneEquationUI id="variableEquationValue" />
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
+ <JButton text="isisfish.variables.deletevariable" />
+ </cell>
+ <cell anchor="east" weightx='1.0'>
+ <JButton text="isisfish.variables.savevariable" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableListRenderer.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableListRenderer.java (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableListRenderer.java 2012-02-14 16:48:29 UTC (rev 3604)
@@ -0,0 +1,69 @@
+/*
+ * #%L
+ * IsisFish
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.ui.input.variable;
+
+import java.awt.Component;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JLabel;
+import javax.swing.JList;
+
+import fr.ifremer.isisfish.entities.Variable;
+
+/**
+ * Renderer pour liste des trip types.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class VariableListRenderer extends DefaultListCellRenderer {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 1113492654780402245L;
+
+ /*
+ * @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 alternated highlight rows and default
+ // selection color
+ JLabel c = (JLabel) super.getListCellRendererComponent(list, value,
+ index, isSelected, cellHasFocus);
+
+ Variable variable = (Variable) value;
+ if (variable != null) {
+ c.setText(variable.getName());
+ }
+
+ return c;
+ }
+}
Property changes on: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableListRenderer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableTypeComboModel.java
===================================================================
--- branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableTypeComboModel.java (rev 0)
+++ branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableTypeComboModel.java 2012-02-14 16:48:29 UTC (rev 3604)
@@ -0,0 +1,80 @@
+/*
+ * #%L
+ * IsisFish
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer, CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.ui.input.variable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.DefaultComboBoxModel;
+
+/**
+ * Modele pour la liste des type possible de variable.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class VariableTypeComboModel extends DefaultComboBoxModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 6171850179969290032L;
+
+ /** Values list */
+ protected List<String> variableTypes;
+
+ /**
+ * Empty constructor.
+ */
+ public VariableTypeComboModel() {
+ variableTypes = new ArrayList<String>();
+ variableTypes.add("double");
+ variableTypes.add("equation");
+ variableTypes.add("matrix");
+ }
+
+ /*
+ * @see javax.swing.ListModel#getElementAt(int)
+ */
+ @Override
+ public Object getElementAt(int index) {
+ return variableTypes.get(index);
+ }
+
+ /*
+ * @see javax.swing.ListModel#getSize()
+ */
+ @Override
+ public int getSize() {
+ int size = 0;
+
+ if (variableTypes != null) {
+ size = variableTypes.size();
+ }
+ return size;
+ }
+}
Property changes on: branches/4.1/src/main/java/fr/ifremer/isisfish/ui/input/variable/VariableTypeComboModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: branches/4.1/src/main/resources/i18n/isis-fish_en_GB.properties
===================================================================
--- branches/4.1/src/main/resources/i18n/isis-fish_en_GB.properties 2012-02-13 14:55:15 UTC (rev 3603)
+++ branches/4.1/src/main/resources/i18n/isis-fish_en_GB.properties 2012-02-14 16:48:29 UTC (rev 3604)
@@ -64,7 +64,7 @@
destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite=
destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite=
filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines.
-isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2011.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Please, report any bug you can found.<html>
+isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2012.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Please, report any bug you can found.<html>
isisfish.about.licensetext=You can modify and redistribute the program under the conditions of the GNU General Public License (version 2 or later). A copy of the GPL is in the file "LICENSE.txt" provided with ISIS-Fish. All rights reserved. No guarantees are provided for use of this program.
isisfish.about.title=About ISIS-Fish...
isisfish.advancedParameters.title=Advanced parameters
@@ -967,6 +967,18 @@
isisfish.tripType.name=Name
isisfish.ui.script.communityvcs=Community VCS
isisfish.ui.script.officialvcs=Official VCS
+isisfish.variables.addvariable=Add
+isisfish.variables.defaultname=VarName
+isisfish.variables.deletevariable=Delete
+isisfish.variables.double.value=Real value \:
+isisfish.variables.equation.value=Equation \:
+isisfish.variables.matrix.value=Matrix \:
+isisfish.variables.savevariable=Save
+isisfish.variables.tabtitle=Variables
+isisfish.variables.variabledetail=Variable details
+isisfish.variables.variablename=Variable name \:
+isisfish.variables.variableslist=Variables
+isisfish.variables.variabletype=Variable type
isisfish.vcs.ask.passphrase=Enter your pass phrase (if your private key have one).
isisfish.vcs.ask.passphrase.title=Ask your pass phrase
isisfish.vcs.commit=vcs.commit
Modified: branches/4.1/src/main/resources/i18n/isis-fish_fr_FR.properties
===================================================================
--- branches/4.1/src/main/resources/i18n/isis-fish_fr_FR.properties 2012-02-13 14:55:15 UTC (rev 3603)
+++ branches/4.1/src/main/resources/i18n/isis-fish_fr_FR.properties 2012-02-14 16:48:29 UTC (rev 3604)
@@ -64,7 +64,7 @@
destination\ already\ exists\ %s\ use\ 'force'\ argument\ to\ force\ overwrite=
destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite=
filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines.
-isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2011.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Merci de rapporter les bugs.<html>
+isisfish.about.abouthtmltext=<html><b>ISIS-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2012.<br /><br /><a href\="http\://www.isis-fish.org">http\://www.isis-fish.org</a><br /><br />Merci de rapporter les bugs.<html>
isisfish.about.licensetext=Vous pouvez modifier et redistribuer ce programme sous les conditions énoncées par la licence GNU GPL (version 2 ou ultérieure). Une copie de la licence GPL est dans le fichier « LICENSE.txt » fourni avec ISIS-Fish. Tous droits réservés. Aucune garantie n'est fournie pour l'utilisation de ce programme.
isisfish.about.title=À propos de ISIS-Fish...
isisfish.advancedParameters.title=Paramètres avancés
@@ -967,6 +967,18 @@
isisfish.tripType.name=Nom
isisfish.ui.script.communityvcs=VCS Communauté
isisfish.ui.script.officialvcs=VCS Officiel
+isisfish.variables.addvariable=Ajouter
+isisfish.variables.defaultname=VarName
+isisfish.variables.deletevariable=Supprimer
+isisfish.variables.double.value=Valeur réelle \:
+isisfish.variables.equation.value=Equation
+isisfish.variables.matrix.value=Matrice
+isisfish.variables.savevariable=Sauver
+isisfish.variables.tabtitle=Variables
+isisfish.variables.variabledetail=Détail
+isisfish.variables.variablename=Nom de la variable \:
+isisfish.variables.variableslist=Variables
+isisfish.variables.variabletype=Type \:
isisfish.vcs.ask.passphrase=Entrez votre passphrase (si votre clef ssh en contient une).
isisfish.vcs.ask.passphrase.title=Demande de passe phrase
isisfish.vcs.commit=Message de sauvegarde
Modified: branches/4.1/src/main/xmi/isis-fish.zargo
===================================================================
(Binary files differ)
1
0
Author: echatellier
Date: 2012-02-13 15:55:15 +0100 (Mon, 13 Feb 2012)
New Revision: 3603
Url: http://forge.codelutin.com/repositories/revision/isis-fish/3603
Log:
Evolution #821: Update to h2 1.3.164
Evolution #822: Update to nuiton-utils 2.4.4
Evolution #823: Update to topia 2.6.6
Evolution #824: Update to hibernate 3.6.10.Final
Evolution #825: Update to jsch 0.1.46
Evolution #826: Update to swingx 1.6.3
Modified:
branches/4.1/pom.xml
Modified: branches/4.1/pom.xml
===================================================================
--- branches/4.1/pom.xml 2012-02-13 10:41:30 UTC (rev 3602)
+++ branches/4.1/pom.xml 2012-02-13 14:55:15 UTC (rev 3603)
@@ -113,6 +113,12 @@
<artifactId>jaxx-runtime</artifactId>
<version>${jaxxVersion}</version>
<scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>swingx-core</artifactId>
+ <groupId>org.swinglabs</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -127,6 +133,12 @@
<artifactId>jaxx-widgets</artifactId>
<version>${jaxxVersion}</version>
<scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>swingx-core</artifactId>
+ <groupId>org.swinglabs</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -245,14 +257,14 @@
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
- <version>0.1.45</version>
+ <version>0.1.46</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.swinglabs</groupId>
+ <groupId>org.swinglabs.swingx</groupId>
<artifactId>swingx-core</artifactId>
- <version>1.6.2-2</version>
+ <version>1.6.3</version>
<scope>compile</scope>
</dependency>
@@ -278,7 +290,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.163</version>
+ <version>1.3.164</version>
<scope>compile</scope>
</dependency>
@@ -524,9 +536,9 @@
<!-- Dependencies version -->
<jaxxVersion>2.4.2</jaxxVersion>
<eugeneVersion>2.4.2</eugeneVersion>
- <topiaVersion>2.6.5</topiaVersion>
- <hibernateVersion>3.6.9.Final</hibernateVersion>
- <nuitonUtilsVersion>2.4.2</nuitonUtilsVersion>
+ <topiaVersion>2.6.6</topiaVersion>
+ <hibernateVersion>3.6.10.Final</hibernateVersion>
+ <nuitonUtilsVersion>2.4.4</nuitonUtilsVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion>
<aspectwerkzVersion>2.0</aspectwerkzVersion>
1
0