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
March 2011
- 2 participants
- 76 discussions
r3223 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input: . tree tree/loadors
by chatellier@users.labs.libre-entreprise.org 31 Mar '11
by chatellier@users.labs.libre-entreprise.org 31 Mar '11
31 Mar '11
Author: chatellier
Date: 2011-03-31 16:06:07 +0000 (Thu, 31 Mar 2011)
New Revision: 3223
Log:
Fix tree nextPath navigation
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<fr.ifremer.isisfish.entities.Cell id='bean' javaBean='null'/>
<import>
+ static org.nuiton.i18n.I18n.n_
java.awt.event.MouseEvent;
fr.ifremer.isisfish.entities.Cell;
com.bbn.openmap.gui.Tool;
@@ -48,7 +49,8 @@
protected void $afterCompleteSetup() {
setButtonTitle(_("isisfish.input.continueZones"));
- setNextPath("$root/$zones");
+ setNextPath(n_("isisfish.input.tree.zones"));
+
new OpenMapEvents(cellMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) {
@Override
public boolean mouseClicked(MouseEvent e) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -27,6 +27,7 @@
<fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/>
<import>
+ static org.nuiton.i18n.I18n.n_
java.beans.PropertyChangeEvent;
java.beans.PropertyChangeListener;
</import>
@@ -34,7 +35,7 @@
protected void $afterCompleteSetup() {
setButtonTitle(_("isisfish.input.continueMetiers"));
- setNextPath("$root/$metiers");
+ setNextPath(n_("isisfish.input.tree.metiers"));
addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -33,7 +33,7 @@
<Boolean id='sensitivity' javaBean='false'/>
<!-- Next button title -->
- <java.lang.String id='buttonTitle' javaBean='""'/>
+ <java.lang.String id='buttonTitle' javaBean='null'/>
<!-- Next path -->
<java.lang.String id='nextPath' javaBean='null'/>
@@ -129,8 +129,12 @@
}
}
protected void goTo() {
- // FIXME echatellier 20110306 use new tree api
- //getParentContainer(InputUI.class).setTreeSelection(getNextPath());
+ // FIXME il ne faut pas appeler le parent
+ // on ne sais jamais de quel type est le parent
+ InputUI inputUI = getParentContainer(InputUI.class);
+ if (inputUI != null) {
+ inputUI.getHandler().setTreeSelection(this, nextPath);
+ }
}
/**
@@ -228,5 +232,5 @@
]]></script>
<JPanel id='body' constraints='BorderLayout.CENTER' layout='{new BorderLayout()}' />
<JButton id='next' text='{getButtonTitle()}' constraints='BorderLayout.SOUTH'
- visible='{getNextPath() != null}' onActionPerformed='goTo()' decorator='boxed'/>
+ visible='{getButtonTitle() != null}' onActionPerformed='goTo()' decorator='boxed'/>
</JPanel>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2011-03-31 16:06:07 UTC (rev 3223)
@@ -589,13 +589,32 @@
* Called by specific UI (CellUI to change node).
*
* @param inputUI context ui (to get context value tree helper...)
- * @param topiaId node id to select
+ * @param nodeId node id to select
*/
- public void setTreeSelection(InputContentUI<?> inputUI, String topiaId) {
+ public void setTreeSelection(InputContentUI<?> inputUI, String nodeId) {
+ setTreeSelection(inputUI, null, nodeId);
+ }
+
+ /**
+ * Change tree selection with new node id.
+ *
+ * Called by specific UI (CellUI to change node).
+ *
+ * @param inputUI context ui (to get context value tree helper...)
+ * @param parentNodeId find node to select from this node
+ * @param nodeId node id to select
+ */
+ public void setTreeSelection(InputContentUI<?> inputUI, String parentNodeId, String nodeId) {
FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class);
TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class);
- FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode((FisheryTreeNode)fisheryTreeModel.getRoot(), topiaId);
- fisheryTreeHelper.selectNode(newSelectNode);
+ FisheryTreeNode fromNode = (FisheryTreeNode)fisheryTreeModel.getRoot();
+ if (parentNodeId != null) {
+ fromNode = fisheryTreeHelper.findNode(fromNode, parentNodeId);
+ }
+ FisheryTreeNode newSelectNode = fisheryTreeHelper.findNode(fromNode, nodeId);
+ if (newSelectNode != null) {
+ fisheryTreeHelper.selectNode(newSelectNode);
+ }
}
/**
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<import>
static org.nuiton.i18n.I18n._
+ static org.nuiton.i18n.I18n.n_
java.beans.PropertyChangeEvent;
java.beans.PropertyChangeListener;
</import>
@@ -36,7 +37,7 @@
protected void $afterCompleteSetup() {
setButtonTitle(_("isisfish.input.continueTripTypes"));
- setNextPath("$root/$tripTypes");
+ setNextPath(n_("isisfish.input.tree.triptypes"));
// install change listener
// (depends on sensitivity c'ant be done on constructor)
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/>
<import>
+ static org.nuiton.i18n.I18n.n_
fr.ifremer.isisfish.ui.sensitivity.SensitivityTabbedPaneListener;
</import>
<script><![CDATA[
@@ -35,7 +36,7 @@
protected void $afterCompleteSetup() {
setButtonTitle(_("isisfish.input.continueGears"));
- setNextPath("$root/$gears");
+ setNextPath(n_("isisfish.input.tree.gears"));
// install change listener
// (depends on sensitivity can't be done on constructor)
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<fr.ifremer.isisfish.entities.Port id='bean' javaBean='null'/>
<import>
+ static org.nuiton.i18n.I18n.n_
fr.ifremer.isisfish.entities.Port;
fr.ifremer.isisfish.entities.Cell;
com.bbn.openmap.gui.Tool;
@@ -73,7 +74,7 @@
};
setButtonTitle(_("isisfish.input.continueSpecies"));
- setNextPath("$root/$species");
+ setNextPath(n_("isisfish.input.tree.species"));
addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -26,10 +26,13 @@
<fr.ifremer.isisfish.entities.SetOfVessels id='bean' javaBean='null'/>
+ <import>
+ static org.nuiton.i18n.I18n.n_
+ </import>
<script><![CDATA[
protected void $afterCompleteSetup() {
setButtonTitle(_("isisfish.input.continueStrategies"));
- setNextPath("$root/$strategies");
+ setNextPath(n_("isisfish.input.tree.strategies"));
// install change listener
// (depends on sensitivity can't be done on constructor)
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<fr.ifremer.isisfish.entities.Species id='bean' javaBean='null'/>
<import>
+ static org.nuiton.i18n.I18n.n_
fr.ifremer.isisfish.entities.Species;
jaxx.runtime.swing.editor.NumberEditor;
java.beans.PropertyChangeEvent;
@@ -55,6 +56,21 @@
});
}
+ at Override
+protected void goTo() {
+ // FIXME il ne faut pas appeler le parent
+ // on ne sais jamais de quel type est le parent
+ InputUI inputUI = getParentContainer(InputUI.class);
+ if (inputUI != null) {
+ if (getBean() == null) {
+ inputUI.getHandler().setTreeSelection(this, n_("isisfish.input.tree.species"), n_("isisfish.input.tree.populations"));
+ }
+ else {
+ inputUI.getHandler().setTreeSelection(this, getBean().getTopiaId(), n_("isisfish.input.tree.populations"));
+ }
+ }
+}
+
public void refresh() {
Species species = (Species)getVerifier().getEntity(Species.class);
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<fr.ifremer.isisfish.entities.TripType id='bean' javaBean='null'/>
<import>
+ static org.nuiton.i18n.I18n.n_
fr.ifremer.isisfish.entities.TripType;
fr.ifremer.isisfish.types.TimeUnit;
java.beans.PropertyChangeEvent;
@@ -37,7 +38,7 @@
setButtonTitle(_("isisfish.input.continueVesselTypes"));
-setNextPath("$root/$vesselTypes");
+setNextPath(n_("isisfish.input.tree.vesseltypes"));
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<fr.ifremer.isisfish.entities.VesselType id='bean' javaBean='null'/>
<import>
+ static org.nuiton.i18n.I18n.n_
fr.ifremer.isisfish.entities.VesselType;
fr.ifremer.isisfish.entities.TripType;
fr.ifremer.isisfish.types.TimeUnit;
@@ -41,7 +42,8 @@
protected void $afterCompleteSetup() {
setButtonTitle(_("isisfish.input.continueSetOfVessels"));
- setNextPath("$root/$setOfVessels");
+ setNextPath(n_("isisfish.input.tree.setofvessels"));
+
addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-03-31 16:06:07 UTC (rev 3223)
@@ -28,6 +28,7 @@
<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;
@@ -48,6 +49,10 @@
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);
@@ -64,9 +69,6 @@
}
};
- setButtonTitle(_("isisfish.input.continuePorts"));
- setNextPath("$root/$ports");
-
addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getNewValue() == null) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeHelper.java 2011-03-31 16:06:07 UTC (rev 3223)
@@ -22,7 +22,7 @@
*/
package fr.ifremer.isisfish.ui.input.tree;
-import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
import javax.swing.tree.TreeModel;
@@ -68,25 +68,25 @@
// first level nodes
FisheryTreeNode cellsChild = new FisheryTreeNode(Cell.class,
- _("isisfish.input.tree.cells"), null, new CellsNodeLoador());
+ n_("isisfish.input.tree.cells"), null, new CellsNodeLoador());
FisheryTreeNode zonesChild = new FisheryTreeNode(Zone.class,
- _("isisfish.input.tree.zones"), null, new ZonesNodeLoador());
+ n_("isisfish.input.tree.zones"), null, new ZonesNodeLoador());
FisheryTreeNode portsChild = new FisheryTreeNode(Port.class,
- _("isisfish.input.tree.ports"), null, new PortsNodeLoador());
+ n_("isisfish.input.tree.ports"), null, new PortsNodeLoador());
FisheryTreeNode speciesChild = new FisheryTreeNode(Species.class,
- _("isisfish.input.tree.species"), null, new SpeciesNodeLoador());
+ n_("isisfish.input.tree.species"), null, new SpeciesNodeLoador());
FisheryTreeNode gearsChild = new FisheryTreeNode(Gear.class,
- _("isisfish.input.tree.gears"), null, new GearsNodeLoador());
+ n_("isisfish.input.tree.gears"), null, new GearsNodeLoador());
FisheryTreeNode metiersChild = new FisheryTreeNode(Metier.class,
- _("isisfish.input.tree.metiers"), null, new MetiersNodeLoador());
+ n_("isisfish.input.tree.metiers"), null, new MetiersNodeLoador());
FisheryTreeNode tripTypesChild = new FisheryTreeNode(TripType.class,
- _("isisfish.input.tree.triptypes"), null, new TripTypesNodeLoador());
+ n_("isisfish.input.tree.triptypes"), null, new TripTypesNodeLoador());
FisheryTreeNode vesselTypesChild = new FisheryTreeNode(VesselType.class,
- _("isisfish.input.tree.vesseltypes"), null, new VesselTypesNodeLoador());
+ n_("isisfish.input.tree.vesseltypes"), null, new VesselTypesNodeLoador());
FisheryTreeNode setOfVesselsChild = new FisheryTreeNode(SetOfVessels.class,
- _("isisfish.input.tree.setofvessels"), null, new SetOfVesselsNodeLoador());
+ n_("isisfish.input.tree.setofvessels"), null, new SetOfVesselsNodeLoador());
FisheryTreeNode strategiesChild = new FisheryTreeNode(Strategy.class,
- _("isisfish.input.tree.strategies"), null, new StrategiesNodeLoador());
+ n_("isisfish.input.tree.strategies"), null, new StrategiesNodeLoador());
root.add(cellsChild);
root.add(zonesChild);
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeRenderer.java 2011-03-31 16:06:07 UTC (rev 3223)
@@ -23,6 +23,8 @@
package fr.ifremer.isisfish.ui.input.tree;
+import static org.nuiton.i18n.I18n._;
+
import java.awt.Component;
import javax.swing.JTree;
@@ -77,7 +79,7 @@
FisheryTreeNode node = (FisheryTreeNode)value;
if (!node.isStaticNode() || node.isStringNode()) {
- stringValue = node.getId();
+ stringValue = _(node.getId());
} else {
FisheryRegion fisheryRegion = provider.getFisheryRegion();
TopiaContext topiaContext = ((FisheryRegionImpl)fisheryRegion).getTopiaContext();
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java 2011-03-31 16:02:49 UTC (rev 3222)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/loadors/SpeciesNodeLoador.java 2011-03-31 16:06:07 UTC (rev 3223)
@@ -22,7 +22,7 @@
*/
package fr.ifremer.isisfish.ui.input.tree.loadors;
-import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
import java.util.List;
@@ -67,7 +67,7 @@
// Create clients static nodes
FisheryTreeNode speciesPopulationStaticNode = new FisheryTreeNode(
- Population.class, _("isisfish.input.tree.populations"),
+ Population.class, n_("isisfish.input.tree.populations"),
null, new PopulationsNodeLoador(species));
speciesNode.add(speciesPopulationStaticNode);
1
0
r3222 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration
by chatellier@users.labs.libre-entreprise.org 31 Mar '11
by chatellier@users.labs.libre-entreprise.org 31 Mar '11
31 Mar '11
Author: chatellier
Date: 2011-03-31 16:02:49 +0000 (Thu, 31 Mar 2011)
New Revision: 3222
Log:
Add if exists condition
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java 2011-03-31 13:48:34 UTC (rev 3221)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java 2011-03-31 16:02:49 UTC (rev 3222)
@@ -65,6 +65,6 @@
// CONSTRAINT_0 est la nom généré de la constainte d'unicité
// sur les maturityGroup
// en v3.3, il n'y a qu'une contrainte sur la table population
- queries.add("ALTER TABLE POPULATION DROP CONSTRAINT CONSTRAINT_0;");
+ queries.add("ALTER TABLE POPULATION DROP CONSTRAINT IF EXISTS CONSTRAINT_0;");
}
}
1
0
r3221 - in isis-fish/branches/3.3.1/src/main: java/fr/ifremer/isisfish/datastore/migration xmi
by chatellier@users.labs.libre-entreprise.org 31 Mar '11
by chatellier@users.labs.libre-entreprise.org 31 Mar '11
31 Mar '11
Author: chatellier
Date: 2011-03-31 13:48:34 +0000 (Thu, 31 Mar 2011)
New Revision: 3221
Log:
Add migration to remove unique maturitygroup constraints
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java
isis-fish/branches/3.3.1/src/main/xmi/isis-fish.zargo
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2011-03-30 16:26:57 UTC (rev 3220)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/DatabaseMigrationClass.java 2011-03-31 13:48:34 UTC (rev 3221)
@@ -49,6 +49,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_331 = new Version("3.3.1");
public DatabaseMigrationClass() {
super(new MigrationResolver());
@@ -68,6 +69,9 @@
else if (version.equals(VERSION_33)) {
result = MigrationV32V33.class;
}
+ else if (version.equals(VERSION_331)) {
+ result = MigrationV33V331.class;
+ }
return result;
}
@@ -78,7 +82,7 @@
*/
@Override
public Version[] getAvailableVersions() {
- Version[] result = new Version[] { VERSION_32, VERSION_33 };
+ Version[] result = new Version[] { VERSION_32, VERSION_33, VERSION_331 };
return result;
}
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java 2011-03-31 13:48:34 UTC (rev 3221)
@@ -0,0 +1,70 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 3.3.1
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class MigrationV33V331 extends MigrationCallBackForVersion {
+
+ /**
+ * Constructor.
+ *
+ * @param version version
+ * @param callback callback
+ */
+ public MigrationV33V331(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 {
+ // remove maturity group
+ // CONSTRAINT_0 est la nom généré de la constainte d'unicité
+ // sur les maturityGroup
+ // en v3.3, il n'y a qu'une contrainte sur la table population
+ queries.add("ALTER TABLE POPULATION DROP CONSTRAINT CONSTRAINT_0;");
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/datastore/migration/MigrationV33V331.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: isis-fish/branches/3.3.1/src/main/xmi/isis-fish.zargo
===================================================================
(Binary files differ)
1
0
r3220 - in isis-fish/branches/3.3.1/src: main/java/fr/ifremer/isisfish/simulator/launcher main/java/fr/ifremer/isisfish/simulator/sensitivity main/java/fr/ifremer/isisfish/simulator/sensitivity/domain test/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
30 Mar '11
Author: chatellier
Date: 2011-03-30 16:26:57 +0000 (Wed, 30 Mar 2011)
New Revision: 3220
Log:
Gere les groups de facteurs apres calcul par les calculators et
leurs g?\195?\169n?\195?\169rations dans le prescript de simulation.
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -82,6 +82,7 @@
import fr.ifremer.isisfish.simulator.SimulationParameter;
import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan;
import fr.ifremer.isisfish.simulator.sensitivity.Factor;
+import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup;
import fr.ifremer.isisfish.simulator.sensitivity.Scenario;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityScenarios;
@@ -437,6 +438,8 @@
TopiaContext context = regionStorage.getStorage().beginTransaction();
sensitivitycalculator.setTopiaContext(context);
+ // Sensitivity scenario returned contains same factor references
+ // as input design plan. Factor group are still present
SensitivityScenarios sensitivityScenarios = sensitivitycalculator
.compute(designPlan, masterExportDirectory);
@@ -509,15 +512,24 @@
}
}
+ /** Permet de manipuler un int entre plusieurs appele de methodes recursive. */
+ public static class Counter {
+ protected int counter = 0;
+ public void inc() {
+ counter++;
+ }
+ public int getCounter() {
+ return counter;
+ }
+ }
+
/**
* Generate prescript to set factor values before simulation start.
*
* @param scenario to generate prescript
* @return simulation pre script with correct values
- * @throws IOException if pre script can't be made
*/
- protected String generatePreScript(Scenario scenario) throws IOException {
-
+ protected String generatePreScript(Scenario scenario) {
ConvertUtilsBean beanUtils = ConverterUtil.getConverter(null);
// n'utilise plus freemarker, car il y avait plus d'instruction
@@ -530,72 +542,93 @@
buffer.append("ConvertUtilsBean beanUtils = ConverterUtil.getConverter(db);\n");
buffer.append("SimulationParameter params = context.getSimulationStorage().getParameter();\n");
- int factorIndex = 0; // pour les collision de nom value
- for (Factor factor : scenario.getFactors()) {
- buffer.append("/* factor : ").append(factor.getName()).append(" */\n");
+ generatePreScript(beanUtils, buffer, new Counter(), scenario.getFactors());
+
+ String scriptContent = buffer.toString();
+ if (log.isTraceEnabled()) {
+ log.trace("Simulation prescript content = " + scriptContent);
+ }
+ return scriptContent;
+ }
- // cas special 1 : population de départ
- if (factor.getPath().startsWith("parameters.population.")) {
- String paramName = StringUtils.removeStart(factor.getPath(), "parameters.");
- paramName += ".number";
- // pas de convert, c'est fait comme ca dans
- // SimulationParameters.toProperties();
- MatrixND matrix = (MatrixND)factor.getValue();
- Object stringValue = String.valueOf(matrix.toList());
- buffer.append("params.setProperty(\"").append(paramName).append("\",\"").append(stringValue).append("\");\n");
+ /**
+ * Generate prescript for a factor list that can be called recursively to
+ * manage factor group.
+ *
+ * @param beanUtils beanUtils converter
+ * @param buffer buffer to fill
+ * @param level call level used to avoid variables name collision
+ * @param factors factor list to manage
+ */
+ protected void generatePreScript(ConvertUtilsBean beanUtils, StringBuffer buffer, Counter counter, Collection<Factor> factors) {
+
+ for (Factor factor : factors) {
+ if (factor instanceof FactorGroup) {
+ buffer.append("/* factor group : ").append(factor.getName()).append(" */\n");
+ FactorGroup factorGroup = (FactorGroup)factor;
+ generatePreScript(beanUtils, buffer, counter, factorGroup.getFactors());
}
- // cas special 2 : regles
- else if (factor.getPath().equals("parameters.rules")) {
- List<Rule> rules = (List<Rule>)factor.getValue();
- List<String> rulesNames = new ArrayList<String>();
- int ruleIndex = 0;
- for (Rule rule : rules) {
- rulesNames.add(rule.getClass().getSimpleName());
- Properties rulesProps = RuleHelper.getRuleAsProperties(ruleIndex++, null, rule);
- for (String rulesProp : rulesProps.stringPropertyNames()) {
- String value = rulesProps.getProperty(rulesProp);
- buffer.append("params.setProperty(\"").append(rulesProp).append("\",\"").append(value).append("\");\n");
+ else {
+ int factorIndex = counter.getCounter();
+ buffer.append("/* factor : ").append(factor.getName()).append(" */\n");
+
+ // cas special 1 : population de départ
+ if (factor.getPath().startsWith("parameters.population.")) {
+ String paramName = StringUtils.removeStart(factor.getPath(), "parameters.");
+ paramName += ".number";
+ // pas de convert, c'est fait comme ca dans
+ // SimulationParameters.toProperties();
+ MatrixND matrix = (MatrixND)factor.getValue();
+ Object stringValue = String.valueOf(matrix.toList());
+ buffer.append("params.setProperty(\"").append(paramName).append("\",\"").append(stringValue).append("\");\n");
+ }
+ // cas special 2 : regles
+ else if (factor.getPath().equals("parameters.rules")) {
+ List<Rule> rules = (List<Rule>)factor.getValue();
+ List<String> rulesNames = new ArrayList<String>();
+ int ruleIndex = 0;
+ for (Rule rule : rules) {
+ rulesNames.add(rule.getClass().getSimpleName());
+ Properties rulesProps = RuleHelper.getRuleAsProperties(ruleIndex++, null, rule);
+ for (String rulesProp : rulesProps.stringPropertyNames()) {
+ String value = rulesProps.getProperty(rulesProp);
+ buffer.append("params.setProperty(\"").append(rulesProp).append("\",\"").append(value).append("\");\n");
+ }
}
+ buffer.append("params.setProperty(\"rules\",\"").append(StringUtils.join(rulesNames, ",")).append("\");\n");
}
- buffer.append("params.setProperty(\"rules\",\"").append(StringUtils.join(rulesNames, ",")).append("\");\n");
+ // cas special 3 : equation
+ else if (factor.getDomain() instanceof EquationContinuousDomain) {
+ EquationContinuousDomain domain = (EquationContinuousDomain)factor.getDomain();
+ buffer.append("context.setValue(\"").append(factor.getName());
+ buffer.append("\",").append(factor.getValue()).append(",\"");
+ buffer.append(domain.getOperator()).append("\");\n");
+ }
+ // cas pas si special
+ else {
+ Object value = factor.getValue();
+ String stringValue = beanUtils.convert(value);
+ String path = factor.getPath();
+ String topiaId = path.substring(0, path.lastIndexOf('#'));
+ String property = path.substring(path.lastIndexOf('#') + 1);
+ // Double value123 = beanUtils.convert("mystringvalue", Double.class);
+ buffer.append(value.getClass().getName()).append(" value");
+ buffer.append(factorIndex).append(" = beanUtils.convert(\"");
+ buffer.append(stringValue).append("\", ").append(value.getClass().getName());
+ buffer.append(".class);\n");
+ // TopiaEntity entity123 = db.findByTopiaId(topiaId);
+ buffer.append("TopiaEntity entity").append(factorIndex);
+ buffer.append(" = db.findByTopiaId(\"").append(topiaId);
+ buffer.append("\");\n");
+ // BeanUtils.setProperty(entity123, "property", value123);
+ buffer.append("BeanUtils.setProperty(entity").append(factorIndex);
+ buffer.append(", \"").append(property).append("\", ");
+ buffer.append("value").append(factorIndex).append(");\n");
+ }
}
- // cas special 3 : equation
- else if (factor.getDomain() instanceof EquationContinuousDomain) {
- EquationContinuousDomain domain = (EquationContinuousDomain)factor.getDomain();
- buffer.append("context.setValue(\"").append(factor.getName());
- buffer.append("\",").append(factor.getValue()).append(",\"");
- buffer.append(domain.getOperator()).append("\");\n");
- }
- // cas pas si special
- else {
- Object value = factor.getValue();
- String stringValue = beanUtils.convert(value);
- String path = factor.getPath();
- String topiaId = path.substring(0, path.lastIndexOf('#'));
- String property = path.substring(path.lastIndexOf('#') + 1);
- // Double value123 = beanUtils.convert("mystringvalue", Double.class);
- buffer.append(value.getClass().getName()).append(" value");
- buffer.append(factorIndex).append(" = beanUtils.convert(\"");
- buffer.append(stringValue).append("\", ").append(value.getClass().getName());
- buffer.append(".class);\n");
- // TopiaEntity entity123 = db.findByTopiaId(topiaId);
- buffer.append("TopiaEntity entity").append(factorIndex);
- buffer.append(" = db.findByTopiaId(\"").append(topiaId);
- buffer.append("\");\n");
- // BeanUtils.setProperty(entity123, "property", value123);
- buffer.append("BeanUtils.setProperty(entity").append(factorIndex);
- buffer.append(", \"").append(property).append("\", ");
- buffer.append("value").append(factorIndex).append(");\n");
- }
-
- factorIndex++;
- }
- String scriptContent = buffer.toString();
- if (log.isTraceEnabled()) {
- log.trace("Simulation prescript content = " + scriptContent);
+ counter.inc();
}
- return scriptContent;
}
protected void submit(SimulationJob job) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -216,7 +216,7 @@
for (Factor factor:factors) {
if (factor.getDomain() instanceof DiscreteDomain) {
String attributeValues = "list(";
- Collection values = ((DiscreteDomain) factor.getDomain())
+ Collection<Object> values = ((DiscreteDomain) factor.getDomain())
.getValues().values();
for (Object j:values) {
attributeValues += j + ",";
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Domain.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -59,19 +59,28 @@
* @return found value or <tt>null</tt> if not found
*/
Object getValueForIdentifier(Object identifier);
-
+
/**
+ * Compute value for domain.
+ *
+ * @param valueIdentifier
+ * @return computed value for domain
+ * @since 3.3.1.0
+ */
+ public Object getComputedValueForIdentifier(Object valueIdentifier);
+
+ /**
* Accept a new visitor.
*
* @param visitor
*/
public void accept(DomainVisitor visitor);
-
+
/**
* Clone the domain
*
* @return the domain cloned
*/
-
public Domain clone();
+
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/Factor.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -182,6 +182,17 @@
}
/**
+ * This method is protected and can be called only by {@link FactorGroup}
+ * to compute given valueIdentifier with specific factor domain
+ * implementation.
+ *
+ * @param valueIdentifier
+ */
+ protected void setComputedValueForIdentifier(Object valueIdentifier) {
+ value = domain.getComputedValueForIdentifier(valueIdentifier);
+ }
+
+ /**
* Get path.
*
* @return the path
@@ -222,10 +233,9 @@
try {
f = (Factor)super.clone();
- f.domain = domain.clone();
- //f.path = path;
- // FIXME make real clone() for value
- //f.value = value;
+ if (domain != null) {
+ f.domain = domain.clone();
+ }
} catch (CloneNotSupportedException e) {
throw new RuntimeException("Error on clone()", e);
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/FactorGroup.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -273,6 +273,38 @@
}
/**
+ * Return factor group domain depending of factor group type (discrete/continuous).
+ *
+ * @return factor group domain
+ */
+ @Override
+ public Domain getDomain() {
+ Domain domain = null;
+ if (isContinuous()) {
+ domain = new ContinuousDomain(0.0, 1.0);
+ }
+ else if (isDiscrete()) {
+ // les domaines doivent avoir les même domaines
+ // et pour l'utilisation quand fera l'appelant
+ // de getDomain(), on peut en retourner un au hazard
+ domain = factors.get(0).getDomain();
+ }
+ // else pas de factor dans le group
+ return domain;
+ }
+
+ /**
+ * Set value for label.
+ *
+ * @param valueIdentifier new value identifier to get
+ */
+ public void setValueForIdentifier(Object valueIdentifier) {
+ for (Factor factor : factors) {
+ factor.setComputedValueForIdentifier(valueIdentifier);
+ }
+ }
+
+ /**
* Accept a new visitor.
*
* @param visitor
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomain.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -108,6 +108,19 @@
public Object getValueForIdentifier(Object identifier) {
return identifier;
}
+
+ /*
+ * @see fr.ifremer.isisfish.simulator.sensitivity.Domain#getComputedValueForIdentifier(java.lang.Object)
+ */
+ @Override
+ public Object getComputedValueForIdentifier(Object valueIdentifier) {
+ // dans ce cas, la value est entre 0 et 1
+ double doubleValue = (Double)valueIdentifier;
+
+ double value = minBound + (minBound + maxBound) * doubleValue;
+
+ return value;
+ }
/**
* Accept a new visitor.
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/DiscreteDomain.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -94,6 +94,14 @@
return values.get(identifier);
}
+ /*
+ * @see fr.ifremer.isisfish.simulator.sensitivity.Domain#getComputedValueForIdentifier(java.lang.Object)
+ */
+ @Override
+ public Object getComputedValueForIdentifier(Object valueIdentifier) {
+ return getValueForIdentifier(valueIdentifier);
+ }
+
/**
* Accept a new visitor.
*
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/EquationContinuousDomain.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -177,6 +177,14 @@
}
return identifier;
}
+
+ /*
+ * @see fr.ifremer.isisfish.simulator.sensitivity.Domain#getComputedValueForIdentifier(java.lang.Object)
+ */
+ @Override
+ public Object getComputedValueForIdentifier(Object valueIdentifier) {
+ return getValueForIdentifier(valueIdentifier);
+ }
/**
* Get value used to create the equation.
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/domain/MatrixContinuousDomain.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -168,6 +168,14 @@
return temp;
}
+ /*
+ * @see fr.ifremer.isisfish.simulator.sensitivity.Domain#getComputedValueForIdentifier(java.lang.Object)
+ */
+ @Override
+ public Object getComputedValueForIdentifier(Object valueIdentifier) {
+ return getValueForIdentifier(valueIdentifier);
+ }
+
/**
* Get value used to create the matrix.
*
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-03-30 16:16:09 UTC (rev 3219)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-03-30 16:26:57 UTC (rev 3220)
@@ -25,7 +25,6 @@
package fr.ifremer.isisfish.simulator.launcher;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -58,6 +57,7 @@
import fr.ifremer.isisfish.simulator.SimulationParameterImpl;
import fr.ifremer.isisfish.simulator.sensitivity.DesignPlan;
import fr.ifremer.isisfish.simulator.sensitivity.Factor;
+import fr.ifremer.isisfish.simulator.sensitivity.FactorGroup;
import fr.ifremer.isisfish.simulator.sensitivity.Scenario;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculator;
import fr.ifremer.isisfish.simulator.sensitivity.SensitivityCalculatorRandomMock;
@@ -66,7 +66,6 @@
import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.MatrixContinuousDomain;
import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDomain;
-import freemarker.template.TemplateException;
/**
* Test for {@link SimulationService}.
@@ -227,13 +226,11 @@
/**
* Test la generation de facteur simple.
*
- * @throws IOException
- * @throws TemplateException
* @throws StorageException
* @throws TopiaException
*/
@Test
- public void testFactorPreScriptFactorInt() throws IOException, TemplateException, StorageException, TopiaException {
+ public void testFactorPreScriptFactorInt() throws StorageException, TopiaException {
// factor
Factor factor = new Factor("testint");
@@ -262,18 +259,12 @@
/**
* Creer un simulation.
* Creer un populationSeasonInfoDAO.
- * Affectation de la matrice m1.
- * Le prescript doit la changer en m2.
*
- * @throws IOException
- * @throws TemplateException
* @throws StorageException
* @throws TopiaException
- *
- * FIXME fix this test (empty schema error)
*/
@Test
- public void testFactorPreScriptFactorMatrix() throws IOException, TemplateException, StorageException, TopiaException {
+ public void testFactorPreScriptFactorMatrix() throws StorageException, TopiaException {
// matrix 1
MatrixND matrix1 = MatrixFactory.getInstance().create("test1",
@@ -329,13 +320,11 @@
/**
* Creer un scenario basé sur les EquationDomain.
*
- * @throws IOException
- * @throws TemplateException
* @throws StorageException
* @throws TopiaException
*/
@Test
- public void testFactorPreScriptEquation() throws IOException, TemplateException, StorageException, TopiaException {
+ public void testFactorPreScriptEquation() throws StorageException, TopiaException {
// factor
Factor factorEquation = new Factor("test.equation.name.K1");
@@ -356,7 +345,7 @@
SimulationService service = SimulationService.getService();
String scriptContent = service.generatePreScript(scenario);
- log.info("Script = " + scriptContent);
+ //log.info("Script = " + scriptContent);
// le nom de la valeur de la variable n'apparait pas "en elle meme"
// dans le prescript, il y a seulement le nom
@@ -368,12 +357,10 @@
* Test que la generation du prescript avec l'ajout des populations
* de départ et des regles de IsisFish 3.3.1.0 fonctionne correctement.
*
- * @throws TemplateException
- * @throws IOException
* @throws IsisFishException
*/
@Test
- public void testPrescriptGenerationPopAndRules() throws IOException, TemplateException, IsisFishException {
+ public void testPrescriptGenerationPopAndRules() throws IsisFishException {
// get a context to a database
RegionStorage regionStorage = RegionStorage.getRegion("BaseMotosICA");
@@ -416,11 +403,92 @@
// generate prescript for that wonderfull scenario
SimulationService service = SimulationService.getService();
String preScriptContent = service.generatePreScript(scenario1);
- log.info("Script = " + preScriptContent);
+ //log.info("Script = " + preScriptContent);
Assert.assertTrue(preScriptContent.contains("params.setProperty(\"population.xxx.number\""));
Assert.assertTrue(preScriptContent.contains("params.setProperty(\"rule.0.parameter.species\",\"fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378\");"));
Assert.assertTrue(preScriptContent.contains("params.setProperty(\"rule.1.parameter.propSurvie\",\"42.0\");"));
Assert.assertTrue(preScriptContent.contains("rules\",\"TACpoids,TailleMin\")"));
}
+
+ /**
+ * Test que la generation du prescript avec l'ajout des groupes des facteurs
+ * depuis IsisFish 3.3.1.0 fonctionne correctement.
+ *
+ * @throws IsisFishException
+ */
+ @Test
+ public void testPrescriptGenerationGroups() throws IsisFishException {
+
+ // build test scenario
+ Scenario scenario1 = new Scenario();
+
+ // factor 1
+ Factor factor1 = new Factor("factor 1 (double)");
+ ContinuousDomain domain1 = new ContinuousDomain();
+ domain1.setMinBound(0.0);
+ domain1.setMaxBound(50.0);
+ domain1.setCardinality(4);
+ factor1.setDomain(domain1);
+ factor1.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength");
+
+ // factor 2
+ Factor factor2 = new Factor("factor 2 (double)");
+ ContinuousDomain domain2 = new ContinuousDomain();
+ domain2.setMinBound(1.0);
+ domain2.setMaxBound(9.0);
+ domain2.setCardinality(3);
+ factor2.setDomain(domain2);
+ factor2.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength");
+
+ // factor 3
+ Factor factor3 = new Factor("factor 3 (double)");
+ DiscreteDomain domain3 = new DiscreteDomain();
+ domain3.getValues().put(0.0, 12.3);
+ domain3.getValues().put(1.0, 70.9);
+ domain3.getValues().put(2.0, 21.0);
+ domain3.getValues().put(3.0, -12.1);
+ domain3.getValues().put(4.0, -8.45);
+ factor3.setDomain(domain3);
+ factor3.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521013#0.1715620681984218#maxLength");
+
+ // factor 4
+ Factor factor4 = new Factor("factor 4 (double)");
+ DiscreteDomain domain4 = new DiscreteDomain();
+ domain4.getValues().put(0.0, -7.3);
+ domain4.getValues().put(1.0, 4.9);
+ domain4.getValues().put(2.0, -42.0);
+ domain4.getValues().put(3.0, 27.1);
+ domain4.getValues().put(4.0, 53.32);
+ factor4.setDomain(domain4);
+ factor4.setPath("fr.ifremer.isisfish.entities.PopulationGroup#1156461521064#0.022976136053553198#minLength");
+
+ // group continu
+ FactorGroup group1 = new FactorGroup("myContinuousGroup");
+ group1.addFactor(factor1);
+ group1.addFactor(factor2);
+
+ // group discret
+ FactorGroup group2 = new FactorGroup("myDiscreteGroup");
+ group2.addFactor(factor3);
+ group2.addFactor(factor4);
+
+ // compute AS => scenario
+ group1.setValueForIdentifier(0.75);
+ scenario1.addFactor(group1);
+ group2.setValueForIdentifier(2.0);
+ scenario1.addFactor(group2);
+
+ // generate prescript for that wonderfull scenario
+ SimulationService service = SimulationService.getService();
+ String preScriptContent = service.generatePreScript(scenario1);
+ //log.info("Script = " + preScriptContent);
+
+ Assert.assertTrue(preScriptContent.contains("/* factor group : myContinuousGroup */"));
+ Assert.assertTrue(preScriptContent.contains("beanUtils.convert(\"37.5\""));
+ Assert.assertTrue(preScriptContent.contains("beanUtils.convert(\"8.5\""));
+ Assert.assertTrue(preScriptContent.contains("/* factor group : myDiscreteGroup */"));
+ Assert.assertTrue(preScriptContent.contains("beanUtils.convert(\"21.0\""));
+ Assert.assertTrue(preScriptContent.contains("value4 = beanUtils.convert(\"-42.0\""));
+ }
}
1
0
r3219 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
30 Mar '11
Author: chatellier
Date: 2011-03-30 16:16:09 +0000 (Wed, 30 Mar 2011)
New Revision: 3219
Log:
Init exception handler only if ui is launched
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/IsisFish.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/IsisFish.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/IsisFish.java 2011-03-30 14:30:41 UTC (rev 3218)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/IsisFish.java 2011-03-30 16:16:09 UTC (rev 3219)
@@ -128,31 +128,6 @@
public static void main(String... args) throws Exception {
- // catch wall application exception
- Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
- public void uncaughtException(Thread t, Throwable cause) {
- if (cause instanceof LinkageError) {
- if (log.isFatalEnabled()) {
- log.fatal("Linkage error detected", cause);
- }
-
- // a real java.lang.Error sometimes happen when
- // using non recompiled script due to dependency changes
- // this is the better solution found :
- // remove isis build directory
- FileUtil.deleteRecursively(IsisFish.config.getCompileDirectory());
-
- ErrorHelper.showErrorDialog(null, _("isisfish.error.linkageerror.message"), cause);
- }
- else {
- if (log.isErrorEnabled()) {
- log.error("Global application exception", cause);
- }
- ErrorHelper.showErrorDialog(null, cause.getMessage(), cause);
- }
- }
- });
-
// permet de faire fonctionner la compilation en webstart
System.setSecurityManager(null);
@@ -612,6 +587,31 @@
public static void launchUI() {
if (config.isLaunchUI()) {
+ // catch wall application exception
+ Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+ public void uncaughtException(Thread t, Throwable cause) {
+ if (cause instanceof LinkageError) {
+ if (log.isFatalEnabled()) {
+ log.fatal("Linkage error detected", cause);
+ }
+
+ // a real java.lang.Error sometimes happen when
+ // using non recompiled script due to dependency changes
+ // this is the better solution found :
+ // remove isis build directory
+ FileUtil.deleteRecursively(IsisFish.config.getCompileDirectory());
+
+ ErrorHelper.showErrorDialog(null, _("isisfish.error.linkageerror.message"), cause);
+ }
+ else {
+ if (log.isErrorEnabled()) {
+ log.error("Global application exception", cause);
+ }
+ ErrorHelper.showErrorDialog(null, cause.getMessage(), cause);
+ }
+ }
+ });
+
// migration must be done in UI envirronement and
// must nerver be done in caparmor
// TODO set it here for now, ui is not displayed on caparmor
1
0
30 Mar '11
Author: chatellier
Date: 2011-03-30 14:30:41 +0000 (Wed, 30 Mar 2011)
New Revision: 3218
Log:
Update changelog
Modified:
isis-fish/branches/3.3.1/changelog.txt
Modified: isis-fish/branches/3.3.1/changelog.txt
===================================================================
--- isis-fish/branches/3.3.1/changelog.txt 2011-03-30 14:26:20 UTC (rev 3217)
+++ isis-fish/branches/3.3.1/changelog.txt 2011-03-30 14:30:41 UTC (rev 3218)
@@ -1,5 +1,6 @@
isis-fish (3.3.1.0-rc1) stable; urgency=low
+ * Add view to test R configuration
* Disable charset converter (need to be retested)
* Add a new button to check all script in one action in script UI
* Improve UI to enable some fields/tabs only after region loading
@@ -11,7 +12,7 @@
* Use new Jaxx tree api
* Update i18n to 2.3.1
* Update to topia 2.5.3
- * Update to Jaxx 2.3
+ * Update to Jaxx 2.4
* Update to rSyntaxTextArea 1.5.0
* Update to svnkit 1.3.5
1
0
r3217 - in isis-fish/branches/3.3.1/src/main: java/fr/ifremer/isisfish/ui java/fr/ifremer/isisfish/ui/config resources/i18n
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
30 Mar '11
Author: chatellier
Date: 2011-03-30 14:26:20 +0000 (Wed, 30 Mar 2011)
New Revision: 3217
Log:
Add R tester UI.
Added:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx
isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties
isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java 2011-03-30 11:32:50 UTC (rev 3216)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeHandler.java 2011-03-30 14:26:20 UTC (rev 3217)
@@ -52,6 +52,8 @@
import fr.ifremer.isisfish.IsisConfig;
import fr.ifremer.isisfish.IsisFish;
+import fr.ifremer.isisfish.ui.config.RConfigHandler;
+import fr.ifremer.isisfish.ui.config.RConfigUI;
import fr.ifremer.isisfish.ui.config.SSHLauncherConfigUI;
import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
@@ -251,29 +253,45 @@
}
/**
+ * Display VCS config ui.
*
* @param welcomeUI parent ui
*/
public void configVCS(WelcomeUI welcomeUI) {
- VCSConfigUI vcsConfig = new VCSConfigUI();
+ VCSConfigUI vcsConfig = new VCSConfigUI(welcomeUI, welcomeUI);
vcsConfig.pack();
- org.nuiton.widget.SwingUtil.center(vcsConfig);
+ vcsConfig.setLocationRelativeTo(welcomeUI);
vcsConfig.setVisible(true);
}
/**
+ * Display ssh launcher config ui.
*
* @param welcomeUI parent ui
*/
public void configurationSSHLauncher(WelcomeUI welcomeUI) {
- SSHLauncherConfigUI configUI = new SSHLauncherConfigUI();
+ SSHLauncherConfigUI configUI = new SSHLauncherConfigUI(welcomeUI, welcomeUI);
configUI.pack();
configUI.setSize(600, configUI.getHeight());
- org.nuiton.widget.SwingUtil.center(configUI);
+ configUI.setLocationRelativeTo(welcomeUI);
configUI.setVisible(true);
}
/**
+ * Display R config tester UI.
+ *
+ * @param welcomeUI parent ui
+ */
+ public void configurationR(WelcomeUI welcomeUI) {
+ RConfigUI rconfigUI = new RConfigUI(welcomeUI, welcomeUI);
+ RConfigHandler handler = rconfigUI.getHandler();
+ handler.init(rconfigUI);
+ rconfigUI.pack();
+ rconfigUI.setLocationRelativeTo(welcomeUI);
+ rconfigUI.setVisible(true);
+ }
+
+ /**
* Open url using default system browser.
*
* @param welcomeUI parent ui
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2011-03-30 11:32:50 UTC (rev 3216)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2011-03-30 14:26:20 UTC (rev 3217)
@@ -50,6 +50,7 @@
<JMenuItem text="isisfish.welcome.menu.configuration" onActionPerformed='getHandler().config(this)'/>
<JMenuItem text="isisfish.welcome.menu.configuration.vcs" onActionPerformed='getHandler().configVCS(this)' enabled="false"/>
<JMenuItem text="isisfish.welcome.menu.configuration.sshlauncher" onActionPerformed='getHandler().configurationSSHLauncher(this)'/>
+ <JMenuItem text="isisfish.welcome.menu.configuration.r" onActionPerformed='getHandler().configurationR(this)'/>
</JMenu>
<JMenu text="isisfish.welcome.menu.help">
<JMenuItem text="isisfish.welcome.menu.help.isisfish" onActionPerformed='getHandler().help(this, "ISISFISH")'/>
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java 2011-03-30 14:26:20 UTC (rev 3217)
@@ -0,0 +1,122 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.isisfish.ui.config;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Color;
+import java.io.File;
+
+import javax.swing.JOptionPane;
+
+import org.apache.commons.lang.StringUtils;
+import org.nuiton.j2r.REngine;
+import org.nuiton.j2r.RException;
+import org.nuiton.j2r.RProxy;
+
+/**
+ * Handler for R Configuration UI.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class RConfigHandler {
+
+ /**
+ * Initialise l'ui.
+ *
+ * @param rconfigUI ui to init
+ */
+ public void init(RConfigUI rconfigUI) {
+ String rHome = System.getenv("R_HOME");
+ rconfigUI.getRHomeField().setText(rHome);
+ if (StringUtils.isBlank(rHome)) {
+ rconfigUI.getRHomeField().setBackground(Color.RED);
+ }
+
+ String rType = System.getProperty("R.type");
+ rconfigUI.getRTypeField().setText(rType);
+ if (!"net".equals(rType) && !"jni".equals(rType)) {
+ rconfigUI.getRTypeField().setBackground(Color.RED);
+ }
+
+ // sur windows c'est potentielement ca
+ // sur linux, c'est pas possible
+ String systemPath = System.getenv("PATH");
+ String rBinPath = rHome + File.separator + "bin";
+ if (systemPath.contains(rBinPath)) {
+ rconfigUI.getSystemPathField().setBackground(Color.GREEN.brighter());
+ rconfigUI.getSystemPathField().setText(_("isisfish.simulator.configuration.r.systempathok", rBinPath));
+ }
+ else {
+ rconfigUI.getSystemPathField().setBackground(Color.RED);
+ rconfigUI.getSystemPathField().setText(_("isisfish.simulator.configuration.r.systempathnok", rBinPath));
+ }
+ rconfigUI.getSystemPathField().setToolTipText(systemPath);
+ }
+
+ /**
+ * Test r configuration.
+ *
+ * @param rconfigUI
+ */
+ public void testRCOnfiguration(RConfigUI rconfigUI) {
+ REngine engine = null;
+ try {
+ engine = new RProxy();
+
+ boolean error = false;
+ try {
+ engine.eval("library('lhs')");
+ }
+ catch (RException ex) {
+ JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.lhsnotinstalled"),
+ _("isisfish.simulator.configuration.r.title"), JOptionPane.ERROR_MESSAGE);
+ error = true;
+ }
+ try {
+ engine.eval("library('sensitivity')");
+ }
+ catch (RException ex) {
+ JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.sensitivitynotinstalled"),
+ _("isisfish.simulator.configuration.r.title"), JOptionPane.ERROR_MESSAGE);
+ error = true;
+ }
+
+ if (!error) {
+ JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.testok"),
+ _("isisfish.simulator.configuration.r.title"), JOptionPane.INFORMATION_MESSAGE);
+ }
+ }
+ catch (RException ex) {
+ JOptionPane.showMessageDialog(rconfigUI, _("isisfish.simulator.configuration.r.cantinit", ex.getMessage()),
+ _("isisfish.simulator.configuration.r.title"), JOptionPane.ERROR_MESSAGE);
+ }
+ }
+}
Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx (rev 0)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/RConfigUI.jaxx 2011-03-30 14:26:20 UTC (rev 3217)
@@ -0,0 +1,68 @@
+<!--
+ #%L
+ IsisFish
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 Ifremer, CodeLutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-2.0.html>.
+ #L%
+ -->
+<JDialog title="isisfish.simulator.configuration.r.title" layout="{new BorderLayout()}">
+ <RConfigHandler id="handler" />
+ <Table constraints="BorderLayout.CENTER">
+ <row>
+ <cell columns="2">
+ <JLabel text="isisfish.simulator.configuration.r.details" />
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.simulator.configuration.r.rhome" />
+ </cell>
+ <cell weightx="1.0" fill='horizontal'>
+ <JTextField id="rHomeField" editable="false" />
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.simulator.configuration.r.rtype" />
+ </cell>
+ <cell fill='horizontal'>
+ <JTextField id="rTypeField" editable="false" />
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.simulator.configuration.r.systempath" />
+ </cell>
+ <cell fill='horizontal'>
+ <JTextField id="systemPathField" editable="false" />
+ </cell>
+ </row>
+ <row>
+ <cell columns="2" anchor='center'>
+ <JPanel>
+ <JButton text="isisfish.simulator.configuration.r.launchtest"
+ onActionPerformed="getHandler().testRCOnfiguration(this)" />
+ <JButton text="isisfish.common.close"
+ onActionPerformed="dispose()" />
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java 2011-03-30 11:32:50 UTC (rev 3216)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigAction.java 2011-03-30 14:26:20 UTC (rev 3217)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2009 - 2010 Ifremer, Code Lutin, Chatellier Eric
+ * Copyright (C) 2009 - 2011 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
@@ -46,7 +46,6 @@
import com.jcraft.jsch.Session;
import fr.ifremer.isisfish.IsisFish;
-import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.util.ssh.InvalidPassphraseException;
import fr.ifremer.isisfish.util.ssh.SSHAgent;
import fr.ifremer.isisfish.util.ssh.SSHException;
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx 2011-03-30 11:32:50 UTC (rev 3216)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/config/SSHLauncherConfigUI.jaxx 2011-03-30 14:26:20 UTC (rev 3217)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
Modified: isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties
===================================================================
--- isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties 2011-03-30 11:32:50 UTC (rev 3216)
+++ isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_en_GB.properties 2011-03-30 14:26:20 UTC (rev 3217)
@@ -96,6 +96,7 @@
isisfish.common.cancel=Cancel
isisfish.common.check=Check
isisfish.common.clear=Clear
+isisfish.common.close=Close
isisfish.common.confirm=Confirm
isisfish.common.date=Date
isisfish.common.debug=debug
@@ -949,6 +950,18 @@
isisfish.simulation.remote.message.waitingstart=Waiting for simulation start
isisfish.simulation.restarting=Restarting...
isisfish.simulation.title=Simulation launcher
+isisfish.simulator.configuration.r.cantinit=Can't init R \: %s
+isisfish.simulator.configuration.r.details=This window display current system R configuration and can be used to test if R is successfully installed.
+isisfish.simulator.configuration.r.launchtest=Test
+isisfish.simulator.configuration.r.lhsnotinstalled=LHS library not installed \!
+isisfish.simulator.configuration.r.rhome=R_HOME
+isisfish.simulator.configuration.r.rtype=R.type
+isisfish.simulator.configuration.r.sensitivitynotinstalled=Sensitivity library not installed \!
+isisfish.simulator.configuration.r.systempath=PATH
+isisfish.simulator.configuration.r.systempathnok=Path doesn't contains R bin directory (%s)
+isisfish.simulator.configuration.r.systempathok=Path contains R bin directory (%s)
+isisfish.simulator.configuration.r.testok=R successfully tested \!
+isisfish.simulator.configuration.r.title=R Configuration
isisfish.simulator.launcher.inprocess=in current process
isisfish.simulator.launcher.remote=on Caparmor server
isisfish.simulator.launcher.subprocess=in subprocess
@@ -1084,8 +1097,9 @@
isisfish.welcome.menu.api=API
isisfish.welcome.menu.close=Close
isisfish.welcome.menu.configuration=Configuration
+isisfish.welcome.menu.configuration.r=R configuration
isisfish.welcome.menu.configuration.sshlauncher=Caparmor configuration
-isisfish.welcome.menu.configuration.vcs=VCS Configuration
+isisfish.welcome.menu.configuration.vcs=VCS configuration
isisfish.welcome.menu.file=File
isisfish.welcome.menu.frame=Window
isisfish.welcome.menu.help=Help
Modified: isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties
===================================================================
--- isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties 2011-03-30 11:32:50 UTC (rev 3216)
+++ isis-fish/branches/3.3.1/src/main/resources/i18n/isis-fish_fr_FR.properties 2011-03-30 14:26:20 UTC (rev 3217)
@@ -96,6 +96,7 @@
isisfish.common.cancel=Annuler
isisfish.common.check=V\u00E9rifier
isisfish.common.clear=Effacer
+isisfish.common.close=Fermer
isisfish.common.confirm=Confirmation
isisfish.common.date=Date
isisfish.common.debug=Debug
@@ -949,6 +950,18 @@
isisfish.simulation.remote.message.waitingstart=Attente du d\u00E9marrage de la simulation
isisfish.simulation.restarting=Red\u00E9marrage...
isisfish.simulation.title=Lanceur de simulation
+isisfish.simulator.configuration.r.cantinit=Impossible d'initialiser R \: %s
+isisfish.simulator.configuration.r.details=Cet \u00E9cran affiche la configuration syst\u00E8me actuelle de R et permet de tester si un appel simple \u00E0 R fonctionne.
+isisfish.simulator.configuration.r.launchtest=Tester
+isisfish.simulator.configuration.r.lhsnotinstalled=La librairie 'lhs' n'est pas install\u00E9e \!
+isisfish.simulator.configuration.r.rhome=R_HOME
+isisfish.simulator.configuration.r.rtype=R.type
+isisfish.simulator.configuration.r.sensitivitynotinstalled=La librairie 'sensitivity' n'est pas install\u00E9e \!
+isisfish.simulator.configuration.r.systempath=PATH
+isisfish.simulator.configuration.r.systempathnok=Le path ne contient pas le dossier bin de R (%s)
+isisfish.simulator.configuration.r.systempathok=Le path contient le dossier bin de R (%s)
+isisfish.simulator.configuration.r.testok=R test\u00E9 avec succ\u00E8s \!
+isisfish.simulator.configuration.r.title=Configuration de R
isisfish.simulator.launcher.inprocess=dans le m\u00EAme processus
isisfish.simulator.launcher.remote=sur le serveur Caparmor
isisfish.simulator.launcher.subprocess=dans un sous processus
@@ -1084,6 +1097,7 @@
isisfish.welcome.menu.api=API
isisfish.welcome.menu.close=Fermer
isisfish.welcome.menu.configuration=Configuration
+isisfish.welcome.menu.configuration.r=Configuration R
isisfish.welcome.menu.configuration.sshlauncher=Configuration Caparmor
isisfish.welcome.menu.configuration.vcs=Configuration vcs
isisfish.welcome.menu.file=Fichier
1
0
r3216 - isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
by chatellier@users.labs.libre-entreprise.org 30 Mar '11
30 Mar '11
Author: chatellier
Date: 2011-03-30 11:32:50 +0000 (Wed, 30 Mar 2011)
New Revision: 3216
Log:
Fix test
Modified:
isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
Modified: isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
===================================================================
--- isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-03-29 16:01:45 UTC (rev 3215)
+++ isis-fish/branches/3.3.1/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2011-03-30 11:32:50 UTC (rev 3216)
@@ -418,7 +418,7 @@
String preScriptContent = service.generatePreScript(scenario1);
log.info("Script = " + preScriptContent);
- Assert.assertTrue(preScriptContent.contains("params.setProperty(\"parameters.population.xxx\""));
+ Assert.assertTrue(preScriptContent.contains("params.setProperty(\"population.xxx.number\""));
Assert.assertTrue(preScriptContent.contains("params.setProperty(\"rule.0.parameter.species\",\"fr.ifremer.isisfish.entities.Species#1169028645830#0.022262364425031378\");"));
Assert.assertTrue(preScriptContent.contains("params.setProperty(\"rule.1.parameter.propSurvie\",\"42.0\");"));
Assert.assertTrue(preScriptContent.contains("rules\",\"TACpoids,TailleMin\")"));
1
0
r3215 - in isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish: simulator/launcher ui/models/rule ui/sensitivity ui/simulator ui/widget/editor
by chatellier@users.labs.libre-entreprise.org 29 Mar '11
by chatellier@users.labs.libre-entreprise.org 29 Mar '11
29 Mar '11
Author: chatellier
Date: 2011-03-29 16:01:45 +0000 (Tue, 29 Mar 2011)
New Revision: 3215
Log:
Fix rule factor edition (params).
Fix initial population factors.
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2011-03-29 16:01:45 UTC (rev 3215)
@@ -53,6 +53,7 @@
import org.apache.commons.lang.time.DurationFormatUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.math.matrix.MatrixND;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.util.FileUtil;
@@ -535,8 +536,13 @@
// cas special 1 : population de départ
if (factor.getPath().startsWith("parameters.population.")) {
- Object stringValue = beanUtils.convert(factor.getValue());
- buffer.append("params.setProperty(\"").append(factor.getPath()).append("\",\"").append(stringValue).append("\");\n");
+ String paramName = StringUtils.removeStart(factor.getPath(), "parameters.");
+ paramName += ".number";
+ // pas de convert, c'est fait comme ca dans
+ // SimulationParameters.toProperties();
+ MatrixND matrix = (MatrixND)factor.getValue();
+ Object stringValue = String.valueOf(matrix.toList());
+ buffer.append("params.setProperty(\"").append(paramName).append("\",\"").append(stringValue).append("\");\n");
}
// cas special 2 : regles
else if (factor.getPath().equals("parameters.rules")) {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleParametersTableCellEditor.java 2011-03-29 16:01:45 UTC (rev 3215)
@@ -57,8 +57,6 @@
* @param rule rule
*/
public RuleParametersTableCellEditor(Rule rule) {
- super();
-
this.rule = rule;
ruleParametersTypes = new ArrayList<Class<?>>();
//TODO map may be sorted
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx 2011-03-29 16:01:45 UTC (rev 3215)
@@ -43,7 +43,7 @@
<SensitivityInputHandler id="handler" />
- <Boolean id='continuePossible' javaBean='true'/>
+ <Boolean id='continuePossible' javaBean='false'/>
<Boolean id='continueSelected' javaBean='false'/>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx 2011-03-29 16:01:45 UTC (rev 3215)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2009 - 2010 Ifremer, CodeLutin
+ Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2011-03-29 16:01:45 UTC (rev 3215)
@@ -49,6 +49,7 @@
fr.ifremer.isisfish.ui.models.sensitivity.SensitivityCalculatorParametersTableModel;
java.awt.CardLayout
javax.swing.ComboBoxModel
+ fr.ifremer.isisfish.datastore.RegionStorage;
</import>
<script><![CDATA[
@@ -212,7 +213,7 @@
exportParamsTable.setModel(model);
exportParamsTable.getColumnModel().getColumn(0).setCellRenderer(new SensitivityExportParametersTableCellRenderer(export));
SensitivityExportParametersTableCellEditor cellEditor = new SensitivityExportParametersTableCellEditor(export);
- cellEditor.setRegion(simulAction.getRegionStorage());
+ cellEditor.setRegionStorage(getContextValue(RegionStorage.class));
exportParamsTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
}
else {
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-03-29 16:01:45 UTC (rev 3215)
@@ -3,7 +3,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -29,20 +29,15 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
-import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedMap;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
import javax.swing.JComponent;
-import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
-import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.event.TreeSelectionEvent;
@@ -52,7 +47,6 @@
import javax.swing.tree.TreePath;
import jaxx.runtime.context.JAXXInitialContext;
-import jaxx.runtime.swing.editor.NumberEditor;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -60,7 +54,6 @@
import org.nuiton.math.matrix.MatrixND;
import org.nuiton.math.matrix.gui.MatrixPanelEditor;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityContextable;
@@ -81,14 +74,6 @@
import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.ui.input.InputContentUI;
import fr.ifremer.isisfish.ui.input.InputHandler;
-import fr.ifremer.isisfish.ui.input.InputOneEquationUI;
-import fr.ifremer.isisfish.ui.input.MetierSeasonInfoSpeciesEditorUI;
-import fr.ifremer.isisfish.ui.input.PopulationMigrationEmigrationUI;
-import fr.ifremer.isisfish.ui.input.PopulationMigrationImmigrationUI;
-import fr.ifremer.isisfish.ui.input.PopulationMigrationMigrationUI;
-import fr.ifremer.isisfish.ui.input.PopulationZonesEditorUI;
-import fr.ifremer.isisfish.ui.input.SelectivityEditorUI;
-import fr.ifremer.isisfish.ui.input.SpeciesStructuredUI;
import fr.ifremer.isisfish.ui.input.tree.FisheryDataProvider;
import fr.ifremer.isisfish.ui.input.tree.FisheryTreeHelper;
import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode;
@@ -135,7 +120,6 @@
// global context value : fisheryRegion, regionStorage, treeHelper
sensitivityTabUI.setContextValue(fisheryRegion);
- //sensitivityTabUI.setContextValue(regionStorage);
sensitivityTabUI.setContextValue(treeHelper);
sensitivityTabUI.setContextValue(model);
sensitivityTabUI.setContextValue(fisheryRegion.getTopiaContext());
@@ -289,42 +273,21 @@
protected void factorSelected(SensitivityTabUI sensitivityTabUI) {
// get selected factor
TreePath selectedPath = sensitivityTabUI.getFactorsTree().getSelectionPath();
- Object[] pathWay = selectedPath.getPath();
- Object selectedObject = pathWay[pathWay.length - 1];
-
- if (selectedObject != null) {
- if (!(selectedObject instanceof FactorGroup)) {
- Factor selectedFactor = (Factor)selectedObject;
- FactorWizardUI factorWizardUI = new FactorWizardUI(sensitivityTabUI);
- SensitivityInputHandler handler = factorWizardUI.getHandler();
- /*JComponent component = sensitivityTabUI.getSimulAction().getFactorComponent(selectedFactor);
- if (component != null) {
- wizard.initExisting(component, selectedFactor);
- wizard.pack();
- wizard.setLocationRelativeTo(sensitivityTabUI);
- wizard.setVisible(true);
+
+ // method appelee au clic, donc pas forcement de selection
+ if (selectedPath != null) {
+ Object[] pathWay = selectedPath.getPath();
+ Object selectedObject = pathWay[pathWay.length - 1];
+ if (selectedObject != null) {
+ if (!(selectedObject instanceof FactorGroup)) {
+ Factor selectedFactor = (Factor)selectedObject;
+ FactorWizardUI factorWizardUI = new FactorWizardUI(sensitivityTabUI);
+ SensitivityInputHandler handler = factorWizardUI.getHandler();
+ handler.initExistingFactor(factorWizardUI, selectedFactor);
+ factorWizardUI.pack();
+ factorWizardUI.setLocationRelativeTo(sensitivityTabUI.getFactorsTree());
+ factorWizardUI.setVisible(true);
}
- else {*/
-
- // cas d'un rechargement de simulation
- // le facteur n'a pas d'instance de composant associé
- // method 2
- //JComponent component2 = EditorHelper.getEditorForFactor(selectedFactor, sensitivityTabUI.getFisheryRegion().getTopiaContext());
- //if (component2 != null) {
- //if (log.isDebugEnabled()) {
- // log.debug("Component found is " + component2);
- //}
- handler.initExistingFactor(factorWizardUI, selectedFactor);
- factorWizardUI.pack();
- factorWizardUI.setLocationRelativeTo(sensitivityTabUI.getFactorsTree());
- factorWizardUI.setVisible(true);
- //}
- /*else {
- if (log.isDebugEnabled()) {
- log.debug("No component found, skip edition of factor " + selectedFactor.getName());
- }
- }*/
- //}
}
}
}
@@ -458,7 +421,7 @@
cache = o;
JComponent c = null;
if (o != null) {
- c = getEditorWithValue(dDomain, o);
+ c = getEditorWithValue(factorWizardUI, dDomain, o);
}
else {
if (log.isWarnEnabled()) {
@@ -636,6 +599,8 @@
* Get copy of component with original entity value as default value.
*
* @param value value
+ * @param bean bean
+ * @param property property
* @return component copy
*/
public ContinuousPanelContainerUI getContinuousPanel(Object value, TopiaEntityContextable bean, String property) {
@@ -760,12 +725,13 @@
/**
* Get editor for value (discrete).
*
+ * @param factorWizardUI context for context value (RegionStorage)
* @param value type to get editor
* @param factorPath for equation
* @param context for equation
* @return component
*/
- protected JComponent getEditorWithValue(Domain domain, Object value) {
+ protected JComponent getEditorWithValue(FactorWizardUI factorWizardUI, Domain domain, Object value) {
JComponent result = null;
@@ -782,7 +748,7 @@
((MatrixPanelEditor)result).setMatrix((MatrixND)value);
}
else if (domain instanceof RuleDomain) {
- result = new RuleChooser();
+ result = new RuleChooser(factorWizardUI);
((RuleChooser)result).setRulesList((List<Rule>)value);
}
else if (value instanceof String) {
@@ -842,7 +808,7 @@
// dans ce cas c'est des regles ou pop de départ
if (factorPath.equals("parameters.rules")) {
- result = new RuleChooser();
+ result = new RuleChooser(factorWizardUI);
}
else if (factorPath.startsWith("parameters.population.")) {
// todo
@@ -890,14 +856,13 @@
protected void saveContinue(String name,
String comment, String path, ContinuousPanelContainerUI panel,
SimulAction action, boolean exist) {
- System.out.println(" panel = " + panel);
DefaultContinuousPanelUI defaultPanel = null;
if (panel instanceof MatrixContinuousPanelUI) {
MatrixContinuousPanelUI matrixPanel = (MatrixContinuousPanelUI) panel;
Double coef = Double.valueOf(matrixPanel.getCoef().getText()) / 100;
- MatrixND matrix = matrixPanel.getMatrix();
- String operateur = (String) matrixPanel.getOperator()
- .getSelectedItem();
+ //MatrixND matrix = matrixPanel.getMatrix();
+ MatrixND matrix = matrixPanel.getComponentPanel().getMatrix();
+ String operateur = (String)matrixPanel.getOperator().getSelectedItem();
action.addContinuousMatrixFactor(name, comment, path, coef, matrix,
operateur, exist);
@@ -970,9 +935,9 @@
protected void saveDiscret(String name,
String comment, String path, List<JComponent> components,
SimulAction action, boolean exist) {
- List<Serializable> values = new ArrayList<Serializable>();
+ List<Object> values = new ArrayList<Object>();
for (JComponent c : components) {
- values.add((Serializable) getComponentValue(c));
+ values.add(getComponentValue(c));
}
action.addDiscreteFactor(name, comment, path, values, exist);
}
@@ -991,7 +956,9 @@
result = ((MatrixPanelEditor) component).getMatrix();
} /*else if (component instanceof InputOneEquationUI) {
result = ((InputOneEquationUI) component).getEditor().getText();*/
-
+ else if (component instanceof RuleChooser) {
+ result = ((RuleChooser)component).getRulesList();
+ }
if (log.isDebugEnabled()) {
log.debug("Value for component : " + component.getClass().getSimpleName() + " is " + result);
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2011-03-29 16:01:45 UTC (rev 3215)
@@ -152,7 +152,7 @@
protected void setSensitivityTabRegion() {
if (isSensitivity()) {
try {
- // FIXME this transation in nerver closed
+ // FIXME this transation in never closed
TopiaContext tx = simulAction.getRegionStorage().getStorage().beginTransaction();
FisheryRegion fisheryRegion = RegionStorage.getFisheryRegion(tx);
getParentContainer(SensitivityUI.class).getSensitivityTabUI().setFisheryRegion(fisheryRegion);
@@ -495,7 +495,7 @@
<Table>
<row>
<cell fill="both" weightx="1" weighty="1">
- <RuleChooser id="ruleChooser"
+ <RuleChooser id="ruleChooser" constructorParams='this'
active="{getRegionStorage() != null}" />
</cell>
<cell>
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/RuleChooser.jaxx 2011-03-29 16:01:45 UTC (rev 3215)
@@ -32,6 +32,8 @@
<Boolean id="active" javaBean="true"/>
<import>
+ java.beans.PropertyChangeEvent;
+ java.beans.PropertyChangeListener;
fr.ifremer.isisfish.IsisFishException;
fr.ifremer.isisfish.datastore.RuleStorage;
fr.ifremer.isisfish.rule.Rule;
@@ -40,8 +42,6 @@
fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellEditor;
fr.ifremer.isisfish.ui.models.rule.RuleParametersTableCellRenderer;
fr.ifremer.isisfish.ui.util.ErrorHelper;
- java.beans.PropertyChangeEvent;
- java.beans.PropertyChangeListener;
fr.ifremer.isisfish.datastore.RegionStorage;
</import>
@@ -114,7 +114,7 @@
RuleParametersTableModel model = new RuleParametersTableModel(selectedRule);
selectedRuleParameterTable.setModel(model);
RuleParametersTableCellEditor cellEditor = new RuleParametersTableCellEditor(selectedRule);
- cellEditor.setRegion(getContextValue(RegionStorage.class));
+ cellEditor.setRegionStorage(getContextValue(RegionStorage.class));
RuleParametersTableCellRenderer cellRenderer = new RuleParametersTableCellRenderer(selectedRule);
selectedRuleParameterTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer);
selectedRuleParameterTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2011-03-29 16:01:45 UTC (rev 3215)
@@ -24,6 +24,7 @@
-->
<Table>
<import>
+ java.awt.Dimension
javax.swing.table.DefaultTableModel;
fr.ifremer.isisfish.datastore.AnalysePlanStorage;
fr.ifremer.isisfish.datastore.StorageChangeEvent;
@@ -36,7 +37,7 @@
fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableModel;
fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableCellEditor;
fr.ifremer.isisfish.ui.models.analyzeplan.AnalyzePlanParametersTableCellRenderer;
- java.awt.Dimension
+ fr.ifremer.isisfish.datastore.RegionStorage;
</import>
<SimulAction id='simulAction' javaBean='getContextValue(SimulAction.class)' />
@@ -124,7 +125,7 @@
AnalyzePlanParametersTableModel model = new AnalyzePlanParametersTableModel(selectedAnalyzePlan);
simulParamsAnalysePlans.setModel(model);
AnalyzePlanParametersTableCellEditor cellEditor = new AnalyzePlanParametersTableCellEditor(selectedAnalyzePlan);
- cellEditor.setRegion(simulAction.getRegionStorage());
+ cellEditor.setRegionStorage(getContextValue(RegionStorage.class));
simulParamsAnalysePlans.getColumnModel().getColumn(0).setCellRenderer(new AnalyzePlanParametersTableCellRenderer(selectedAnalyzePlan));
simulParamsAnalysePlans.getColumnModel().getColumn(1).setCellEditor(cellEditor);
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2011-03-29 16:01:45 UTC (rev 3215)
@@ -264,6 +264,7 @@
*/
public void regionChange(ParamsUI paramsUI, String regionName) {
regionStorage = RegionStorage.getRegion(regionName);
+ paramsUI.getParentContainer(SimulationUI.class).setContextValue(regionStorage);
paramsUI.getParentContainer(SimulationUI.class).setRegionStorage(regionStorage);
param.setRegionName(regionName);
}
@@ -906,17 +907,27 @@
}
public void addDiscreteFactor(String name, String comment, String path,
- List<Serializable> values, boolean exist) {
+ List<Object> values, boolean exist) {
Factor f = new Factor(name);
- DiscreteDomain domain = new DiscreteDomain();
- int i = 0;
- for (Serializable value : values) {
+ DiscreteDomain domain = null;
+ // FIXME echatellier gere le path mieux que ca
+ if ("parameters.rules".equals(path)) {
+ domain = new RuleDomain();
+ }
+ else {
+ domain = new DiscreteDomain();
+ }
+
+ SortedMap<Object, Object> domainValues = new TreeMap<Object, Object>();
+ int label = 0;
+ for (Object value : values) {
// FIXME test when integer
// Don't work with String ;(
- domain.getValues().put(i, value);
+ domainValues.put(label, value);
// and start at 0
- i++;
+ label++;
}
+ domain.setValues(domainValues);
f.setDomain(domain);
f.setComment(comment);
f.setPath(path);
@@ -1250,7 +1261,7 @@
SensitivityInputHandler handler = wizard.getHandler();
handler.initExistingFactor(wizard, selectedFactor);
wizard.pack();
- wizard.setLocationRelativeTo(source);
+ wizard.setLocationRelativeTo(paramsUI);
wizard.setVisible(true);
}
}
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java 2011-03-29 15:32:40 UTC (rev 3214)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/widget/editor/ParameterTableCellEditor.java 2011-03-29 16:01:45 UTC (rev 3215)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2006 - 2010 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+ * Copyright (C) 2006 - 2011 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -56,8 +56,6 @@
import fr.ifremer.isisfish.util.ConverterUtil;
/**
- * ParameterTableCellEditor.
- *
* Un editeur generic de champs qui se base sur le model de données
* a editer.
*
@@ -77,7 +75,7 @@
/** Class logger. */
private static Log log = LogFactory.getLog(ParameterTableCellEditor.class);
- protected RegionStorage region = null;
+ protected RegionStorage regionStorage = null;
protected Component editor = null;
@@ -122,18 +120,24 @@
}
/**
- * @return Returns the topiaContext.
+ * Return region storage.
+ *
+ * @return returns the region storage.
*/
public RegionStorage getRegion() {
- return this.region;
+ return regionStorage;
}
/**
- * @param region
- * The topiaContext to set.
+ * Set region storage.
+ *
+ * @param regionStorage the region storage to set.
*/
- public void setRegion(RegionStorage region) {
- this.region = region;
+ public void setRegionStorage(RegionStorage regionStorage) {
+ this.regionStorage = regionStorage;
+ if (regionStorage == null && log.isWarnEnabled()) {
+ log.warn("setRegionStorage called with null value in parameters table cell editor");
+ }
}
public Component getTableCellEditorComponent(JTable table, Object value,
@@ -149,10 +153,10 @@
case Topia:
// on a un bean comme parametre
try {
- if (region == null) {
+ if (regionStorage == null) {
return null;
}
- TopiaContext context = region.getStorage().beginTransaction();
+ TopiaContext context = regionStorage.getStorage().beginTransaction();
if (context != null) {
List list = context.find("from " + type.getName());
c = new JComboBox(list.toArray());
@@ -184,14 +188,11 @@
}
int month = date.getMonth().getMonthNumber();
int yea = date.getYear();
- editor = new DateComponent(month, yea, region == null ? null : region
- .getStorage());
+ editor = new DateComponent(month, yea);
//editor = new JTextField(String.valueOf(date.getDate()));
break;
case Mounth:
- editor = DateComponent.createMounthCombo(((Month) value)
- .getMonthNumber(), region == null ? null : region
- .getStorage());
+ editor = DateComponent.createMounthCombo(((Month) value).getMonthNumber());
break;
case File:
// break;
@@ -287,8 +288,9 @@
}
if (result instanceof String && !String.class.equals(type)) {
- if (region != null)
- context = region.getStorage();
+ if (regionStorage != null) {
+ context = regionStorage.getStorage();
+ }
ConvertUtilsBean cub = ConverterUtil.getConverter(context);
result = cub.convert((String) result, type);
}
@@ -321,10 +323,10 @@
protected JComboBox year;
- public DateComponent(int mounth, int year, TopiaContext context) {
+ public DateComponent(int mounth, int year) {
super(new GridLayout(0, 2));
- this.mounth = createMounthCombo(mounth, context);
+ this.mounth = createMounthCombo(mounth);
this.year = createYearCombo(200, year);
this.add(this.mounth);
@@ -355,48 +357,19 @@
public int getSelectedValue() {
int selectedYear = getSelectedYear();
int selectedMounth = getSelectedMounth();
- if (log.isInfoEnabled()) {
- log.info("selected mounth " + selectedMounth);
- log.info("selected year " + selectedYear);
+ if (log.isDebugEnabled()) {
+ log.debug("selected mounth " + selectedMounth);
+ log.debug("selected year " + selectedYear);
}
return selectedMounth + selectedYear * 12;
}
- public static JComboBox createMounthCombo(int mounth,
- TopiaContext context) {
+ public static JComboBox createMounthCombo(int mounth) {
JComboBox combo = EnumEditor.newEditor(MonthEnum.class);
combo.setSelectedIndex(mounth);
return combo;
}
- /*public static JComboBox createMounthCombo(int mounth, TopiaContext context) {
- JComboBox combo = createMounthCombo0(context);
- combo.setSelectedIndex(mounth);
- return combo;
- }
-
- private static JComboBox createMounthCombo0(TopiaContext context) {
-
- List<String> listM = new ArrayList<String>();
- // TODO Should use database ? data instead of thoses awfull hardcore
- // code...
- listM.add("janvier");
- listM.add("fevrier");
- listM.add("mars");
- listM.add("avril");
- listM.add("mai");
- listM.add("juin");
- listM.add("juillet");
- listM.add("aout");
- listM.add("septembre");
- listM.add("octobre");
- listM.add("novembre");
- listM.add("decembre");
- JComboBox combo = new JComboBox(listM.toArray());
- listM.clear();
- return combo;
- }*/
-
public static JComboBox createYearCombo(int nb, int selectedYear) {
List<Integer> listI = new ArrayList<Integer>();
for (int i = 0; i < nb; i++)
1
0
r3214 - isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity
by chatellier@users.labs.libre-entreprise.org 29 Mar '11
by chatellier@users.labs.libre-entreprise.org 29 Mar '11
29 Mar '11
Author: chatellier
Date: 2011-03-29 15:32:40 +0000 (Tue, 29 Mar 2011)
New Revision: 3214
Log:
Modify code (one return...)
Modified:
isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java
Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java
===================================================================
--- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2011-03-29 15:29:34 UTC (rev 3213)
+++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/simulator/sensitivity/AbstractSensitivityCalculator.java 2011-03-29 15:32:40 UTC (rev 3214)
@@ -246,27 +246,30 @@
}
protected String getNominalValue(Factor factor) {
+ String result = null;
+
Domain domain = factor.getDomain();
if (domain instanceof MatrixContinuousDomain) {
- return "1.0";
+ result = "1.0";
}
+ else {
+ String path = factor.getPath();
+ String topiaId = path.substring(0, path.lastIndexOf("#"));
+ String propertyName=path.substring(path.lastIndexOf("#") + 1);
- String path = factor.getPath();
- String topiaId = path.substring(0,path.lastIndexOf("#"));
- String propertyName=path.substring(path.lastIndexOf("#") + 1);
-
- Object value = null;
- try {
- TopiaEntity entity = context.findByTopiaId(topiaId);
- value = BeanUtils.getProperty(entity, propertyName);
- } catch (Exception ee) {
- log.error("An error occurred while trying to get nominal value",ee);
+ try {
+ TopiaEntity entity = context.findByTopiaId(topiaId);
+ result = BeanUtils.getProperty(entity, propertyName);
+ } catch (Exception ex) {
+ if (log.isErrorEnabled()) {
+ log.error("An error occurred while trying to get nominal value", ex);
+ }
+ }
}
- if (value == null){
- return null;
+ if (log.isDebugEnabled()) {
+ log.debug("Nominal value :" + result);
}
- log.info("Nominal value :" + value);
- return value.toString();
+ return result;
}
protected String editRInstruction(String rCall){
1
0