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
December 2008
- 3 participants
- 82 discussions
r1682 - isis-fish/trunk/src/main/resources/i18n
by sletellier@users.labs.libre-entreprise.org 18 Dec '08
by sletellier@users.labs.libre-entreprise.org 18 Dec '08
18 Dec '08
Author: sletellier
Date: 2008-12-18 12:16:42 +0000 (Thu, 18 Dec 2008)
New Revision: 1682
Modified:
isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Debug vol5
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-18 12:16:30 UTC (rev 1681)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-18 12:16:42 UTC (rev 1682)
@@ -752,6 +752,7 @@
isisfish.result.vbox=defaultToolTip-fr.ifremer.resultat.ResultatView.vbox1
isisfish.result.viewPanel=defaultToolTip-fr.ifremer.resultat.ResultatEdit.viewPanel
isisfish.resultChoice.save=Results to save
+isisfish.resultChoice.saved=Results saved
isisfish.resultChoice.title=Result choice
isisfish.resume.matrixInfoGrid=defaultToolTip-fr.ifremer.resultat.ResumePanel.matriceInfoGrid
isisfish.resume.resumeTextArea=defaultToolTip-fr.ifremer.resultat.ResumePanel.resumeTextArea
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-18 12:16:30 UTC (rev 1681)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-18 12:16:42 UTC (rev 1682)
@@ -752,6 +752,7 @@
isisfish.result.vbox=defaultToolTip-fr.ifremer.resultat.ResultatView.vbox1
isisfish.result.viewPanel=defaultToolTip-fr.ifremer.resultat.ResultatEdit.viewPanel
isisfish.resultChoice.save=R\u00E9sultats \u00E0 sauvegarder
+isisfish.resultChoice.saved=R\u00E9sultats sauvegard\u00E9
isisfish.resultChoice.title=Choix de r\u00E9sultats
isisfish.resume.matrixInfoGrid=defaultToolTip-fr.ifremer.resultat.ResumePanel.matriceInfoGrid
isisfish.resume.resumeTextArea=defaultToolTip-fr.ifremer.resultat.ResumePanel.resumeTextArea
1
0
r1681 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui: . input result script simulator
by sletellier@users.labs.libre-entreprise.org 18 Dec '08
by sletellier@users.labs.libre-entreprise.org 18 Dec '08
18 Dec '08
Author: sletellier
Date: 2008-12-18 12:16:30 +0000 (Thu, 18 Dec 2008)
New Revision: 1681
Removed:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulQueueUI.jaxx
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
Log:
Debug vol5
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -39,8 +39,8 @@
import fr.ifremer.isisfish.ui.result.ResultAction;
import fr.ifremer.isisfish.ui.result.ResultView;
import fr.ifremer.isisfish.ui.script.ScriptUI;
- import fr.ifremer.isisfish.ui.simulator.SimulQueueUI;
import fr.ifremer.isisfish.ui.simulator.SimulUI;
+ import fr.ifremer.isisfish.ui.simulator.QueueUI;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.IsisConfig;
import javax.swing.JFrame;
@@ -67,12 +67,15 @@
}
protected void updateVCS(){
// FIXME a reimplanter
+// thread:Welcome.updateVCS()
}
protected void config(){
// FIXME a reimplanter
+// Welcome.showConfig()
}
protected void configVCS(){
// FIXME a reimplanter
+// fr.ifremer.isisfish.versionning.ui.VCSConfigUI.doLaunch()
}
protected void help(){
// FIXME a reimplanter
@@ -108,7 +111,7 @@
<JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='openFrame(new InputUI(new InputAction()), _("isisfish.input.title"))'/>
<JMenuItem text="isisfish.welcome.menu.script" onActionPerformed='openFrame(new ScriptUI(), _("isisfish.script.title"))'/>
<JSeparator/>
- <JMenuItem text="isisfish.welcome.menu.queue" onActionPerformed='openFrame(new SimulQueueUI(), _("isisfish.queue.title"))'/>
+ <JMenuItem text="isisfish.welcome.menu.queue" onActionPerformed='openFrame(new QueueUI(), _("isisfish.queue.title"))'/>
<JSeparator/>
<JMenu text="isisfish.welcome.menu.configuration">
<JMenuItem text="isisfish.welcome.menu.configuration" onActionPerformed='config()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -144,7 +144,7 @@
valueChanged(true);
}
}
- refresh();
+// refresh();
}
protected void remove(){
fr.ifremer.isisfish.entities.SetOfVessels setOfVessels = getContextValue(InputAction.class).getSetOfVessels();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -53,9 +53,18 @@
protected OpenMapToolPanel toolMap = new OpenMapToolPanel();
protected OMToolSet toolSet = new OMToolSet();
+ init();
public FisheryRegionUI(InputAction action){
setContextValue(action);
}
+ protected void init(){
+ cellMap = new IsisMapBean();
+ toolSet.setupListeners(cellMap);
+ toolMap.add((Component)toolSet);
+ fisheryRegionMapPanel.add(toolMap, BorderLayout.NORTH);
+ fisheryRegionMapPanel.add(cellMap, BorderLayout.CENTER);
+
+ }
public void refresh(){
jaxx.runtime.Util.assignment(region = getContextValue(InputAction.class).getFisheryRegion(), "region", fr.ifremer.isisfish.ui.input.FisheryRegionUI.this);
fieldRegion.setText(region.getName());
@@ -70,15 +79,8 @@
refreshMap();
}
protected void refreshMap(){
- cellMap = new IsisMapBean();
cellMap.setFisheryRegion(region);
- cellMap.setSelectionMode(0);
- toolSet.setupListeners(cellMap);
- toolMap.add((Component)toolSet);
- fisheryRegionMapPanel.add(toolMap, BorderLayout.NORTH);
- fisheryRegionMapPanel.add(cellMap, BorderLayout.CENTER);
cellMap.repaint();
-// cellMap.setSelectedCells(cell);
}
protected void setFieldMapfilesModel(FisheryRegion region){
DefaultListModel model = new DefaultListModel();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -131,7 +131,9 @@
// valueChanged(true);
}
protected void paramPossibleValueChanged(){
- getContextValue(InputAction.class).getGear().setStandardisationFactor(Double.parseDouble(fieldGearParamPossibleValue.getText()));
+ if (fieldGearParamPossibleValue.getText() != ""){
+ getContextValue(InputAction.class).getGear().setStandardisationFactor(Double.parseDouble(fieldGearParamPossibleValue.getText()));
+ }
valueChanged(true);
}
protected void commentChanged(){
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -274,14 +274,17 @@
}
protected void importRegion(){
setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegion()));
+ fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
setInfoText(_("isisfish.message.import.finished"));
}
protected void importRegionAndRename(){
setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegionAndRename()));
+ fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
setInfoText(_("isisfish.message.import.finished"));
}
protected void importV2Region(){
setInfoText(_("isisfish.message.import.xml.v2.file") + getContextValue(InputAction.class).importV2Region());
+ fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
setInfoText(_("isisfish.message.import.finished"));
}
protected void importRegionFromSimulation(){
@@ -289,23 +292,23 @@
}
protected void exportRegion(){
setInfoText(_("isisfish.message.export.zip", getContextValue(InputAction.class).exportRegion()));
+ fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
setInfoText(_("isisfish.message.export.done"));
}
protected void copyRegion(){
setInfoText(_("isisfish.message.copy.region", getContextValue(InputAction.class).copyRegion()));
+ fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
setInfoText(_("isisfish.message.copy.finished"));
}
protected void removeRegion(){
setInfoText(_("isisfish.message.removing.region" + getContextValue(InputAction.class).getRegionStorage().getName()));
+ fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
setInfoText(getContextValue(InputAction.class).removeRegion(false));
}
protected void commitRegionInCVS(){
setInfoText(_("isisfish.message.commiting.region" + getContextValue(InputAction.class).getRegionStorage().getName()));
setInfoText(getContextValue(InputAction.class).commitRegionInCVS());
}
- protected void about(){
- // TODO
- }
]]>
</script>
<JMenuBar id="menu" constraints='BorderLayout.NORTH'>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -235,16 +235,20 @@
}
}
protected void saveGrowthReverseModel(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
- }
+
+ getContextValue(InputAction.class).saveAsModel("Population", "Java", editor.getText());
+ setInfoText(_("isisfish.message.saveModel.finished"));
+// Equation e = getEquation();
+// if (e != null){
+// getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
+// }
}
protected void openGrowthReverseEditor(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), fr.ifremer.isisfish.equation.PopulationGrowthReverse.class, e.getContent(), editorReverse);
- }
+ getContextValue(InputAction.class).openEditor("PopulationGrowth","new",fr.ifremer.isisfish.equation.PopulationGrowthReverse.class, editorReverse.getText(), editorReverse);
+// Equation e = getEquation();
+// if (e != null){
+// getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), fr.ifremer.isisfish.equation.PopulationGrowthReverse.class, e.getContent(), editorReverse);
+// }
}
protected void commentChanged(){
pop.setComment(fieldPopulationBasicsComment.getText());
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -130,6 +130,7 @@
}
protected void saveAsModel(){
getContextValue(InputAction.class).saveAsModel("Selectivity", "Java", fieldSelectivityScript.getText());
+ refresh();
setInfoText(_("isisfish.message.saveModel.finished"));
}
protected void setInfoText(String txt){
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -175,7 +175,7 @@
root.setInfoText(txt);
}
protected void valueChanged(boolean b){
- getParentContainer(GearUI.class).setChanged(b);
+ getParentContainer(SetOfVesselsUI.class).setChanged(b);
save.setEnabled(b);
cancel.setEnabled(b);
}
@@ -233,8 +233,7 @@
setInfoText(_("isisfish.message.saveModel.finished"));
}
protected void openEditor(){
- fr.ifremer.isisfish.entities.SetOfVessels setOfVessels = getContextValue(InputAction.class).getSetOfVessels();
- getContextValue(InputAction.class).openEditor(setOfVessels.getTechnicalEfficiencyEquation().getCategory(),"new",fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class, editor.getText(), editor);
+ getContextValue(InputAction.class).openEditor("SetOfVessels","new",fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class, editor.getText(), editor);
}
]]>
</script>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -73,7 +73,6 @@
fieldSpeciesComment.setText("");
goToPopulation.setEnabled(false);
}
- valueChanged(false);
}
protected void create(){
TopiaEntity topia = getContextValue(InputAction.class).create("Species");
@@ -100,7 +99,6 @@
setInfoText(getContextValue(InputAction.class).remove());
getParentContainer(InputUI.class).setTreeModel();
getParentContainer(InputUI.class).setTreeSelection("$root/$species");
- valueChanged(false);
refresh();
}
protected void goToPopulation(){
@@ -119,32 +117,26 @@
protected void commentChanged(){
getContextValue(InputAction.class).getSpecies().setComment(fieldSpeciesComment.getText());
valueChanged(true);
- refresh();
}
protected void dynamicAgeChanged(){
getContextValue(InputAction.class).getSpecies().setAgeGroupType(fieldSpeciesDynamicAge.isSelected());
valueChanged(true);
- refresh();
}
protected void CEEChanged(){
getContextValue(InputAction.class).getSpecies().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()));
valueChanged(true);
- refresh();
}
protected void codeChanged(){
getContextValue(InputAction.class).getSpecies().setCodeRubbin(fieldSpeciesCodeRubbin.getText());
valueChanged(true);
- refresh();
}
protected void scientificNameChanged(){
getContextValue(InputAction.class).getSpecies().setScientificName(fieldSpeciesScientificName.getText());
valueChanged(true);
- refresh();
}
protected void nameChanged(){
getContextValue(InputAction.class).getSpecies().setName(fieldSpeciesName.getText());
valueChanged(true);
- refresh();
}
]]>
</script>
@@ -156,7 +148,7 @@
<JLabel text="isisfish.species.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesName" onFocusLost='nameChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -164,7 +156,7 @@
<JLabel text="isisfish.species.scientificName" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesScientificName" onFocusLost='scientificNameChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesScientificName" onKeyTyped='valueChanged(true)' onFocusLost='scientificNameChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -172,7 +164,7 @@
<JLabel text="isisfish.species.rubbinCode" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesCodeRubbin" onFocusLost='codeChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesCodeRubbin" onKeyTyped='valueChanged(true)' onFocusLost='codeChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -180,7 +172,7 @@
<JLabel text="isisfish.species.cee" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesCEE" onFocusLost='CEEChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesCEE" onKeyTyped='valueChanged(true)' onFocusLost='CEEChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -200,7 +192,7 @@
</cell>
<cell fill='both' columns='2' weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JTextArea id="fieldSpeciesComment" onFocusLost='commentChanged()' enabled='{isActif()}'/>
+ <JTextArea id="fieldSpeciesComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -131,11 +131,11 @@
// GenericCell g = (GenericCell)fieldStrategyInactivity.getSelectedItem();
// getContextValue(InputAction.class).saveEquationAsModel((Equation)g.getValue());
getContextValue(InputAction.class).saveAsModel("Strategy", "Java", editor.getText());
+ refresh();
setInfoText(_("isisfish.message.saveModel.finished"));
}
protected void openEditor(){
- fr.ifremer.isisfish.entities.Strategy strategy = getContextValue(InputAction.class).getStrategy();
- getContextValue(InputAction.class).openEditor(strategy.getInactivityEquation().getContent(),"new",fr.ifremer.isisfish.equation.StrategyInactivityEquation.class, editor.getText(), editor);
+ getContextValue(InputAction.class).openEditor("Strategy","new",fr.ifremer.isisfish.equation.StrategyInactivityEquation.class, editor.getText(), editor);
}
protected void create(){
TopiaEntity topia = getContextValue(InputAction.class).create("Strategy");
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -79,11 +79,11 @@
valueChanged(true);
}
protected void typeDurationChanged(){
- getContextValue(InputAction.class).getTripType().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText())));
+ getContextValue(InputAction.class).getTripType().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600));
valueChanged(true);
}
protected void minTimeChanged(){
- getContextValue(InputAction.class).getTripType().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText())));
+ getContextValue(InputAction.class).getTripType().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText()) * 3600));
valueChanged(true);
}
protected void commentChanged(){
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -181,7 +181,6 @@
}
protected void nameChange(){
getContextValue(InputAction.class).getZone().setName(fieldZoneName.getText());
- valueChanged(true);
}
protected void valueChanged(boolean b){
changed = b;
@@ -202,7 +201,7 @@
</row>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldZoneName" enabled='{isActif()}' onKeyTyped='nameChange()'/>
+ <JTextField id="fieldZoneName" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='nameChange()'/>
<!-- onFocusLost='nameChange()' -->
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/result/ResultView.java 2008-12-18 12:16:30 UTC (rev 1681)
@@ -10,12 +10,18 @@
* @version
*/
+import java.util.logging.Level;
+import java.util.logging.Logger;
import static org.codelutin.i18n.I18n._;
import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.logging.SimulationLoggerUtil;
import fr.ifremer.isisfish.simulator.SimulationProperties;
+import fr.ifremer.isisfish.simulator.launcher.SimulationJob;
+import fr.ifremer.isisfish.simulator.launcher.SimulationService;
+import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener;
import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil;
+import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
import fr.ifremer.isisfish.ui.widget.filter.FilterModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -38,12 +44,35 @@
public ResultView (){
super();
+
+ SimulationService.getService().addSimulationServiceListener(new SimulationServiceListener() {
+
+ @Override
+ public void simulationStart(SimulationService simService, SimulationJob job) {
+ }
+
+ @Override
+ public void simulationStop(SimulationService simService, SimulationJob job) {
+ try {
+ initSimulation();
+ } catch (IOException ex) {
+ Logger.getLogger(ResultView.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (ParseException ex) {
+ Logger.getLogger(ResultView.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ @Override
+ public void clearJobDone(SimulationService simService) {
+ }
+ });
init();
try {
initSimulation();
} catch (Exception e) {
log.warn(_("could not create simulation filter model for reason %1$s",e.getMessage()),e);
+ showMsgBox(e);
}
}
@@ -95,6 +124,7 @@
initSimulation();
} catch (Exception eee) {
log.warn("Can't delete simulation", eee);
+ showMsgBox(eee);
}
}
}
@@ -120,6 +150,7 @@
intFrame.setSelected(true);
} catch (PropertyVetoException eee) {
log.warn("Error dans l internalFrame ", eee);
+ showMsgBox(eee);
}
}
}
@@ -131,7 +162,8 @@
SimulationLoggerUtil.showSimulationLogConsole(name);
} catch (Exception e) {
- // ignore ?
+ log.error(e);
+ showMsgBox(e);
}
}
public void on_filterSimulationLogButton_clicked() {
@@ -145,7 +177,11 @@
}
} catch (Exception e) {
log.warn(_("could not filter on simulations"), e);
+ showMsgBox(e);
}
}
+ protected void showMsgBox(Exception eee){
+ ErrorDialogUI.showError(eee);
+ }
}// ResultView
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptAction.java 2008-12-18 12:16:30 UTC (rev 1681)
@@ -13,6 +13,7 @@
import fr.ifremer.isisfish.datastore.RuleStorage;
import fr.ifremer.isisfish.datastore.ScriptStorage;
import fr.ifremer.isisfish.datastore.SimulatorStorage;
+import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
import fr.ifremer.isisfish.vcs.VCSException;
import java.io.ByteArrayOutputStream;
@@ -58,10 +59,8 @@
public ScriptAction(){
}
- protected void showMsgBox(String txt){
- if (txt != null){
- showMessageDialog(null, txt);
- }
+ protected void showMsgBox(Exception eee){
+ ErrorDialogUI.showError(eee);
}
public CodeSourceStorage getCode(){
return code;
@@ -218,7 +217,7 @@
}
protected void returnError(String s, Exception eee) {
log.error(s,eee);
- showMsgBox("error " + s);
+ showMsgBox(eee);
}
public void loadScript(GenericCell c, String fileName, String type){
ScriptMapping mapping = ScriptMapping.valueOf(type);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/AdvancedParamsUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -30,7 +30,13 @@
* by : $Author: sletellier $
*/
-->
+
<Table>
+ <Boolean id='ajout' javaBean='false'/>
+
+ <Boolean id='remove' javaBean='false'/>
+
+ <Boolean id='changed' javaBean='false'/>
<script>
<![CDATA[
import javax.swing.table.DefaultTableModel;
@@ -63,6 +69,7 @@
protected void addTagValue(){
getContextValue(SimulAction.class).addTagValue(fieldTag.getText(), fieldValue.getText());
setTableTagValue();
+ setRemove(true);
}
protected void removeTagValue(){
getContextValue(SimulAction.class).removeTagValue(tableTagValue.getValueAt(tableTagValue.getSelectedRow(),0).toString());
@@ -104,6 +111,69 @@
DefaultTableModel model = new DefaultTableModel(columnName, 0);
}
}
+ protected void simulationStatistiqueChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setUseStatistic(fieldSimulationStatistique.isSelected());
+ valueChanged(true);
+ }
+ protected void simulationCacheChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setUseOptimization(fieldSimulationCache.isSelected());
+ valueChanged(true);
+ }
+
+ protected void simulErrorChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setSimulLogLevel("error");
+ valueChanged(true);
+ }
+ protected void simulWarnChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setSimulLogLevel("warn");
+ valueChanged(true);
+ }
+ protected void simulInfoChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setSimulLogLevel("info");
+ valueChanged(true);
+ }
+ protected void simulDebugChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setSimulLogLevel("debug");
+ valueChanged(true);
+ }
+
+ protected void scriptErrorChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setScriptLogLevel("error");
+ valueChanged(true);
+ }
+ protected void scriptWarnChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setScriptLogLevel("warn");
+ valueChanged(true);
+ }
+ protected void scriptInfoChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setScriptLogLevel("info");
+ valueChanged(true);
+ }
+ protected void scriptDebugChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setScriptLogLevel("debug");
+ valueChanged(true);
+ }
+
+ protected void libErrorChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setLibLogLevel("error");
+ valueChanged(true);
+ }
+ protected void libWarnChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setLibLogLevel("warn");
+ valueChanged(true);
+ }
+ protected void libInfoChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setLibLogLevel("info");
+ valueChanged(true);
+ }
+ protected void libDebugChanged(){
+ getContextValue(SimulAction.class).getSimulationParameter().setLibLogLevel("debug");
+ valueChanged(true);
+ }
+ protected void valueChanged(boolean b){
+ save.setEnabled(b);
+ setChanged(b);
+ }
]]>
</script>
<row>
@@ -128,13 +198,13 @@
<JPanel/>
</cell>
<cell columns="2" fill="horizontal" weightx="0.3">
- <JCheckBox id="fieldSimulationStatistique" text="isisfish.advancedParams.simulationStatistique"/>
+ <JCheckBox id="fieldSimulationStatistique" text="isisfish.advancedParams.simulationStatistique" onActionPerformed = 'simulationStatistiqueChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
<JPanel/>
</cell>
<cell columns="2" fill="horizontal" weightx="0.3">
- <JCheckBox id="fieldSimulationCache" text="isisfish.advancedParams.simulationCache"/>
+ <JCheckBox id="fieldSimulationCache" text="isisfish.advancedParams.simulationCache" onActionPerformed = 'simulationCacheChanged()'/>
</cell>
</row>
<row>
@@ -142,16 +212,16 @@
<JLabel text="isisfish.advancedParams.simulLevelLogger"/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsSimulLoggerError" text="isisfish.common.error" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsSimulLoggerError" text="isisfish.common.error" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup" onActionPerformed = 'simulErrorChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsSimulLoggerWarn" text="isisfish.common.warn" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsSimulLoggerWarn" text="isisfish.common.warn" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup" onActionPerformed = 'simulWarnChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsSimulLoggerInfo" text="isisfish.common.info" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsSimulLoggerInfo" text="isisfish.common.info" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup" onActionPerformed = 'simulInfoChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsSimulLoggerDebug" text="isisfish.common.debug" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsSimulLoggerDebug" text="isisfish.common.debug" buttonGroup="fieldSimulAdvParamsSimulLoggerGroup" onActionPerformed = 'simulDebugChanged()'/>
</cell>
</row>
<row>
@@ -159,16 +229,16 @@
<JLabel text="isisfish.advancedParams.scriptLevelLogger"/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsScriptLoggerError" text="isisfish.common.error" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsScriptLoggerError" text="isisfish.common.error" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup" onActionPerformed = 'scriptErrorChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsScriptLoggerWarn" text="isisfish.common.warn" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsScriptLoggerWarn" text="isisfish.common.warn" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup" onActionPerformed = 'scriptWarnChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsScriptLoggerInfo" text="isisfish.common.info" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsScriptLoggerInfo" text="isisfish.common.info" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup" onActionPerformed = 'scriptInfoChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsScriptLoggerDebug" text="isisfish.common.debug" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsScriptLoggerDebug" text="isisfish.common.debug" buttonGroup="fieldSimulAdvParamsScriptLoggerGroup" onActionPerformed = 'scriptDebugChanged()'/>
</cell>
</row>
<row>
@@ -176,16 +246,16 @@
<JLabel text="isisfish.advancedParams.libLevelLogger"/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsLibLoggerError" text="isisfish.common.error" buttonGroup="fieldSimulAdvParamsLibLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsLibLoggerError" text="isisfish.common.error" buttonGroup="fieldSimulAdvParamsLibLoggerGroup" onActionPerformed = 'libErrorChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsLibLoggerWarn" text="isisfish.common.warn" buttonGroup="fieldSimulAdvParamsLibLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsLibLoggerWarn" text="isisfish.common.warn" buttonGroup="fieldSimulAdvParamsLibLoggerGroup" onActionPerformed = 'libWarnChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsLibLoggerInfo" text="isisfish.common.info" buttonGroup="fieldSimulAdvParamsLibLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsLibLoggerInfo" text="isisfish.common.info" buttonGroup="fieldSimulAdvParamsLibLoggerGroup" onActionPerformed = 'libInfoChanged()'/>
</cell>
<cell fill="horizontal" weightx="0.2">
- <JRadioButton id="fieldSimulAdvParamsLibLoggerDebug" text="isisfish.common.debug" buttonGroup="fieldSimulAdvParamsLibLoggerGroup"/>
+ <JRadioButton id="fieldSimulAdvParamsLibLoggerDebug" text="isisfish.common.debug" buttonGroup="fieldSimulAdvParamsLibLoggerGroup" onActionPerformed = 'libDebugChanged()'/>
</cell>
</row>
<row>
@@ -198,18 +268,18 @@
<JLabel text="isisfish.common.tag"/>
</cell>
<cell columns="2" fill="horizontal" weightx="0.25">
- <JTextField id="fieldTag"/>
+ <JTextField id="fieldTag" onKeyTyped="setAjout(true)"/>
</cell>
<cell fill="horizontal" weightx="0.25">
<JLabel text="isisfish.common.value"/>
</cell>
<cell columns="2" fill="horizontal" weightx="0.25">
- <JTextField id="fieldValue"/>
+ <JTextField id="fieldValue" onKeyTyped="setAjout(true)"/>
</cell>
</row>
<row>
<cell columns="6" fill="horizontal" weightx="1.0">
- <JButton text="isisfish.common.add" onActionPerformed = 'addTagValue()'/>
+ <JButton id='add' text="isisfish.common.add" enabled="{isAjout()}" onActionPerformed='addTagValue()'/>
</cell>
</row>
<row>
@@ -221,12 +291,12 @@
</row>
<row>
<cell columns="6" fill="horizontal" weightx="1.0">
- <JButton text="isisfish.common.remove" onActionPerformed = 'removeTagValue()'/>
- </cell>
+ <JButton text="isisfish.common.remove" enabled="{isRemove()}" onActionPerformed='removeTagValue()'/>
+ </cell>
</row>
<row>
<cell columns="6" fill="horizontal" weightx="1.0">
- <JButton text="isisfish.common.saveNextSimulation" onActionPerformed = 'saveTagValue()'/>
+ <JButton id='save' text="isisfish.common.saveNextSimulation" enabled="{isChanged()}" onActionPerformed='saveTagValue()'/>
</cell>
</row>
</Table>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -39,6 +39,13 @@
setContextValue(action);
}
public void refresh(){
+ fieldSimulExportFolder.setText(getContextValue(SimulAction.class).getSimulationParameter().getExportDirectory());
+ listSimulExportChoose.setModel(getListSimulExportChooseModel());
+ }
+ protected DefaultComboBoxModel getListSimulExportChooseModel(){
+ return new DefaultComboBoxModel(getContextValue(SimulAction.class).getExportNames().toArray());
+ }
+ protected void exportChanged(){
if (listSimulExportChoose.getSelectedIndex() > -1){
Object[] values = listSimulExportChoose.getSelectedValues();
java.util.List<String> exportNames = new LinkedList<String>();
@@ -47,18 +54,13 @@
}
getContextValue(SimulAction.class).getSimulationParameter().setExportNames(exportNames);
}
- fieldSimulExportFolder.setText(getContextValue(SimulAction.class).getSimulationParameter().getExportDirectory());
- listSimulExportChoose.setModel(getListSimulExportChooseModel());
}
- protected DefaultComboBoxModel getListSimulExportChooseModel(){
- return new DefaultComboBoxModel(getContextValue(SimulAction.class).getExportNames().toArray());
- }
]]>
</script>
<row>
<cell columns="4" fill="both" weightx="1.0" weighty="1.0">
<JScrollPane>
- <JList id="listSimulExportChoose" selectionMode="2" model='{getListSimulExportChooseModel()}' onValueChanged='refresh()'/>
+ <JList id="listSimulExportChoose" selectionMode="2" model='{getListSimulExportChooseModel()}' onValueChanged='exportChanged()'/>
</JScrollPane>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -55,9 +55,30 @@
import javax.swing.text.JTextComponent;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
+ import fr.ifremer.isisfish.simulator.launcher.SimulationService;
+ import fr.ifremer.isisfish.simulator.launcher.SimulationJob;
+ import fr.ifremer.isisfish.simulator.launcher.SimulationServiceListener;
setContextValue(new MatrixPanelEditor());
simulParamsNumbers.add(getContextValue(MatrixPanelEditor.class), BorderLayout.CENTER);
+
+
+ SimulationService.getService().addSimulationServiceListener(new SimulationServiceListener() {
+
+ @Override
+ public void simulationStart(SimulationService simService, SimulationJob job) {
+ }
+
+ @Override
+ public void simulationStop(SimulationService simService, SimulationJob job) {
+ System.out.println("refresh !!!");
+ fieldSimulParamsSelect.setModel(getSimulParamsSelectModel());
+ }
+
+ @Override
+ public void clearJobDone(SimulationService simService) {
+ }
+ });
public ParamsUI(SimulAction action){
setContextValue(action);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -32,8 +32,9 @@
-->
<JPanel id="ResultChoice" name="isisfish.resultChoice.title" layout='{new BorderLayout()}'>
<script><![CDATA[
- public ResultChoiceUI (SimulAction action){
-
+ import fr.ifremer.isisfish.ui.WelcomePanelUI;
+
+ public ResultChoiceUI (SimulAction action){
setContextValue(action);
}
public void refresh(){
@@ -45,8 +46,13 @@
protected void saveResultNames(){
if (listResultNames.getSelectedIndex() != -1){
getContextValue(SimulAction.class).saveResultNames(listResultNames.getSelectedValues());
+ setInfoText("isisfish.resultChoice.saved");
}
}
+ protected void setInfoText(String txt){
+ WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
+ root.setInfoText(txt);
+ }
]]>
</script>
<JLabel text="isisfish.resultChoice.save" horizontalAlignment="0" constraints='BorderLayout.NORTH'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SensUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -46,6 +46,7 @@
}
public void refresh(){
listSimulParamsAnalysePlansList.setModel(new DefaultComboBoxModel(getContextValue(SimulAction.class).getParamAnalysePlans().toArray()));
+ setSimulParamsAnalysePlans();
}
public void addAnalysePlan(){
getContextValue(SimulAction.class).addAnalysePlan(fieldSimulParamsAnalysePlansSelect.getSelectedItem().toString());
@@ -87,16 +88,23 @@
return result;
}
};
+ java.util.List<GenericCell> valuesList = new ArrayList<GenericCell>();
+ java.util.List<Object> propertyList = new ArrayList<Object>();
for (Iterator<String> it = values.keySet().iterator(); it.hasNext();) {
String name = it.next();
Object properties = getContextValue(SimulAction.class).getAnalysePlanParameterValue(name, listSimulParamsAnalysePlansList.getSelectedValue().toString());
GenericCell value = new GenericCell(name, values.get(name), null);
- model.setValueAt(value, row, 0);
- model.setValueAt(properties, row, 1);
+ valuesList.add(value);
+ propertyList.add(properties);
+// model.setValueAt(value, row, 0);
+// model.setValueAt(properties, row, 1);
row++;
}
+ model.addColumn("Name", valuesList.toArray());
+ model.addColumn("Value", propertyList.toArray());
simulParamsAnalysePlans.setModel(model);
ParameterColumnEditor cellEditor = new ParameterColumnEditor();
+ cellEditor.setName("Name");
cellEditor.setRegion(getContextValue(SimulAction.class).getRegionStorage());
simulParamsAnalysePlans.getColumnModel().getColumn(1).setCellEditor(cellEditor);
simulParamsAnalysePlans.getModel().addTableModelListener(new TableModelListener() {
Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulQueueUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulQueueUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulQueueUI.jaxx 2008-12-18 12:16:30 UTC (rev 1681)
@@ -1,34 +0,0 @@
-<!--
-/* *##%
- * Copyright (C) 2005
- * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
-
-/* *
- * IsisFish.java
- *
- * Created: 1 aout 2005 18:37:25 CEST
- *
- * @author Benjamin POUSSIN <poussin at codelutin.com>
- * @version $Revision: 1312 $
- *
- * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $
- * by : $Author: sletellier $
- */
- -->
-<JPanel visible="true" size='{new Dimension(400,400)}' layout='{new BorderLayout()}'>
-</JPanel>
1
0
r1680 - in isis-fish/trunk: . src/main/java/fr/ifremer/isisfish src/main/java/fr/ifremer/isisfish/ui src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 17 Dec '08
by chatellier@users.labs.libre-entreprise.org 17 Dec '08
17 Dec '08
Author: chatellier
Date: 2008-12-17 17:18:58 +0000 (Wed, 17 Dec 2008)
New Revision: 1680
Removed:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/AboutFrameUI.jaxx
Modified:
isis-fish/trunk/pom.xml
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Add about frame
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2008-12-17 17:18:41 UTC (rev 1679)
+++ isis-fish/trunk/pom.xml 2008-12-17 17:18:58 UTC (rev 1680)
@@ -317,7 +317,7 @@
<topia.version>2.1.2-SNAPSHOT</topia.version>
<!-- lutinwidget version -->
- <lutinwidget.version>0.11</lutinwidget.version>
+ <lutinwidget.version>0.12-SNAPSHOT</lutinwidget.version>
<!-- lutinmatrix version -->
<lutinmatrix.version>1.2-SNAPSHOT</lutinmatrix.version>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2008-12-17 17:18:41 UTC (rev 1679)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2008-12-17 17:18:58 UTC (rev 1680)
@@ -31,6 +31,27 @@
package fr.ifremer.isisfish;
+import static org.codelutin.i18n.I18n._;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.List;
+import java.util.Locale;
+
+import javax.swing.JOptionPane;
+
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.i18n.I18n;
+import org.codelutin.log.LutinLogFactory;
+import org.codelutin.log.UserLog;
+import org.codelutin.math.matrix.DoubleBigVector;
+import org.codelutin.math.matrix.MatrixFactory;
+import org.codelutin.topia.TopiaException;
+import org.codelutin.util.LocaleConverter;
+import org.codelutin.util.VersionNumber;
+
import fr.ifremer.isisfish.datastore.AnalysePlanStorage;
import fr.ifremer.isisfish.datastore.ExportStorage;
import fr.ifremer.isisfish.datastore.FormuleStorage;
@@ -44,6 +65,7 @@
import fr.ifremer.isisfish.types.Month;
import fr.ifremer.isisfish.types.RangeOfValues;
import fr.ifremer.isisfish.types.TimeUnit;
+import fr.ifremer.isisfish.ui.WelcomeUI;
import fr.ifremer.isisfish.util.DateConverter;
import fr.ifremer.isisfish.util.MonthConverter;
import fr.ifremer.isisfish.util.RangeOfValuesConverter;
@@ -54,26 +76,7 @@
import fr.ifremer.isisfish.vcs.VCSException;
import fr.ifremer.isisfish.vcs.VCSFactory;
import fr.ifremer.isisfish.vcs.VetoableActionListener;
-import java.io.File;
-import java.text.SimpleDateFormat;
-import org.apache.commons.beanutils.ConvertUtils;
-import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-import org.codelutin.log.LutinLogFactory;
-import org.codelutin.math.matrix.DoubleBigVector;
-import org.codelutin.math.matrix.MatrixFactory;
-import java.util.Locale;
-import javax.swing.JOptionPane;
-import org.apache.commons.logging.Log;
-import org.codelutin.i18n.I18n;
-import org.codelutin.log.UserLog;
-import org.codelutin.topia.TopiaException;
-import org.codelutin.util.LocaleConverter;
-import org.codelutin.util.VersionNumber;
-
-import fr.ifremer.isisfish.ui.WelcomeUI;
-
/**
* This is the main class of <code>IsisFish</code> application.
*
@@ -207,7 +210,7 @@
}
} else if (action == VCSActionEvent.UPDATE_REPOSITORY) {
- // consctuit une chaine plutot qu'un Arrays.toString() qui
+ // construit une chaine plutot qu'un Arrays.toString() qui
// est illisible
String modifiedFiles = "";
for(File file : files) {
@@ -225,10 +228,10 @@
* Permet de faire une demande a l'utilisateur. S'il repond annuler, on
* quit l'application
*
- * @param msg
+ * @param msg question to ask
* @return true if user confirm question
*/
- public static boolean ask(String msg) {
+ protected static boolean ask(String msg) {
boolean result = true;
int value = JOptionPane.showConfirmDialog(null, msg);
if (value == JOptionPane.CANCEL_OPTION) {
@@ -237,6 +240,19 @@
result = value == JOptionPane.OK_OPTION;
return result;
}
+
+ /**
+ * Permet d'afficher un message d'avertissement
+ * à l'utilisateur.
+ *
+ * @param msg msg to show
+ * @return true if user confirm question
+ */
+ protected static void warn(String msg) {
+ JOptionPane.showMessageDialog(null, msg,
+ _("isisfish.error.warning.title"),
+ JOptionPane.WARNING_MESSAGE);
+ }
/**
* Switch le vcs vers VCSNone et le sauvegarde pour le prochain lancement
@@ -249,8 +265,9 @@
}
/**
- * Initialise le VCS et check s'il y a des mises a jour pour prevenir
- * l'utilisateur
+ * Initialise le VCS et check s'il y a des mises à jour pour
+ * prevenir l'utilisateur.
+ *
* @throws VCSException
*/
static public void initVCS() throws VCSException {
@@ -269,9 +286,7 @@
if (local.exists()) {
if (!vcs.isValidLocalRepository()) {
log.info(_("Local repository exists but it's not valide for current vcs: %s", config.getOption(VCS.VCS_TYPE)));
- if (ask(_("Your database repository: %s\n don't use correct" +
- " protocol.\nDo you want to make backup of your database" +
- " and take the correct one ?", local))) {
+ if (ask(_("isisfish.vcs.init.wrongprotocol", local))) {
File localBackup = new File(local.getParentFile(),
local.getName() + "-" +
new SimpleDateFormat("yyyy-mm-dd-HH-mm-ss").format(new java.util.Date()));
@@ -291,8 +306,7 @@
log.info(_("Local repository don't exist"));
if (!vcs.isConnected()) {
UserLog.warn(_(
- "No database version %s found and can't get it.\n" +
- "You must go to ISIS-Fish web site and download database manualy.",
+ "isisfish.vcs.init.notfoundcantdownload",
IsisConfig.getDatabaseVersion()));
} else {
// Si on utilise pas le bon tag on change de tag
@@ -345,13 +359,31 @@
} else {
// Si on utilise pas le bon tag on change de tag
VersionNumber tag = IsisConfig.getApiVersion();
+
+ List<File> filesInClonflict = null;
if (vcs.isTag(tag)) {
// un tag dispo, on a donc pas la derniere version, on switch
- vcs.setTag(tag);
+ filesInClonflict = vcs.setTag(tag);
} else {
// pas de tag dispo on retourne sur le trunk
- vcs.setTag(null);
+ filesInClonflict = vcs.setTag(null);
}
+
+ // TODO change code is case of conflict
+ // display a beautiful frame to manage each case
+ // for now, display a simple warning message
+ // si refus de l'utilisateur, c'est null aussi
+ if(filesInClonflict != null && !filesInClonflict.isEmpty()) {
+
+ // construit une chaine plutot qu'un Arrays.toString() qui
+ // est illisible
+ String conflictFiles = "";
+ for(File file : filesInClonflict) {
+ conflictFiles += " - " + file.toString() + "\n";
+ }
+
+ warn(_("isisfish.vcs.switchtag.warningconflict", conflictFiles));
+ }
}
// check file status
@@ -379,24 +411,18 @@
// add context
welcome.setVisible(true);
}
+ else {
+ if (log.isInfoEnabled()) {
+ log.info(_("isisfish.message.launchui.notlaunch"));
+ }
+ }
}
-// static public void checkout() throws VCSException {
-// checkout(true);
-// }
-//
-// static public void checkout(boolean createRegion) throws VCSException {
-// if (config.isUseVCS()) {
-// IsisVCSHelper.doCheckoutModule(context.handler, SCRIPT, EXPORT, SIMULATOR, FORMULE, RULE, ANALYSE_PLAN);
-// VCSHelper.doCheckoutDir(context.handler, SIMULATION.getDirectory(), REGION.getDirectory());
-// IsisVCSHelper.doCheckoutRegion(context.handler, "DemoRegion", createRegion);
-// }
-// }
+ /**
+ * Initialise les convertiseurs utilisé par commons-beansutils.
+ */
+ protected static void initConvertersAndMatrixFactory() {
- public static void initConvertersAndMatrixFactory() {
- // ajout du support de XMLGridLayout dans SwiXml
-// ConverterLibrary.getInstance().register(java.awt.LayoutManager.class, new LayoutConverter());
-
ConvertUtils.register(new LocaleConverter(), Locale.class);
// init converters
@@ -410,4 +436,5 @@
// par defaut on utilise des doubles pour les matrices
MatrixFactory.setDefaultVectorClass(DoubleBigVector.class);
}
+
} // IsisFish
Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/AboutFrameUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/AboutFrameUI.jaxx 2008-12-17 17:18:41 UTC (rev 1679)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/AboutFrameUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
@@ -1,37 +0,0 @@
-<!--
-/* *##%
- * Copyright (C) 2005
- * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
-
-/* *
- * IsisFish.java
- *
- * Created: 1 aout 2005 18:37:25 CEST
- *
- * @author Benjamin POUSSIN <poussin at codelutin.com>
- * @version $Revision: 1312 $
- *
- * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $
- * by : $Author: sletellier $
- */
- -->
-<JPanel id="aboutFrame" layout='{new BorderLayout()}'>
- <JLabel id="version" text='{_("isisfish.about.text") + " " + fr.ifremer.isisfish.IsisConfig.getVersion()}' constraints='BorderLayout.NORTH'/>
- <JLabel text="isisfish.about.site" constraints='BorderLayout.CENTER'/>
- <JButton text="isisfish.common.ok" constraints='BorderLayout.SOUTH' onActionPerformed='getParentContainer(JFrame.class).dispose()'/>
-</JPanel>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2008-12-17 17:18:41 UTC (rev 1679)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2008-12-17 17:18:58 UTC (rev 1680)
@@ -42,7 +42,10 @@
import fr.ifremer.isisfish.ui.simulator.SimulQueueUI;
import fr.ifremer.isisfish.ui.simulator.SimulUI;
import fr.ifremer.isisfish.IsisFish;
+ import fr.ifremer.isisfish.IsisConfig;
import javax.swing.JFrame;
+ import org.codelutin.widget.AboutFrame;
+
welcomePanelUI.setContent(new WelcomeTabUI());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
protected void openFrame(Container c, String title){
@@ -75,12 +78,18 @@
// FIXME a reimplanter
}
protected void about(){
- JFrame f = new JFrame();
- f.setLayout(new BorderLayout());
- f.add(new AboutFrameUI(), BorderLayout.CENTER);
- f.setTitle(_("isisfish.about.title"));
- f.setVisible(true);
- f.pack();
+ AboutFrame about = new AboutFrame();
+ about.setTitle(_("isisfish.about.title"));
+ about.setIconPath("images/strategy.jpg");
+ about.setAboutHtmlText(_("isisfish.about.abouthtmltext", IsisConfig.getVersion()));
+ about.setLicenseText(_("isisfish.about.licensetext"));
+ about.setBackgroundColor(Color.WHITE);
+ // center frame
+ Dimension dim = getToolkit().getScreenSize();
+ about.setSize(640, 520);
+ about.setLocation((dim.width - about.getSize().width) / 2,
+ (dim.height - about.getSize().height) / 2);
+ about.setVisible(true);
}
]]>
</script>
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-17 17:18:41 UTC (rev 1679)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-17 17:18:58 UTC (rev 1680)
@@ -62,8 +62,8 @@
destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite=
directory\ %s\ must\ be\ a\ directory=
filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines.
-isisfish.about.site=http\://isisfish.labs.libre-entreprise.org - by B.Poussin
-isisfish.about.text=Isis-Fish Simulator
+isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright 2002 - 2008, Code Lutin.<br /><br /><a href\="http\://isis-fish.labs.libre-entreprise.org">http\://isis-fish.labs.libre-entreprise.org</a><br /><br />Please, report any bug you can found.<html>
+isisfish.about.licensetext=You can modify and redistribute the program under the conditions of the GNU General Public License (version 2 or later). A copy of the GPL is in the file "LICENSE.txt" provided with Isis-Fish. All rights reserved. No guarantees are provided for use of this program.
isisfish.about.title=About Isis-Fish...
isisfish.advancedParameters.title=advanced Parameters
isisfish.advancedParams.freeParameters=
@@ -211,7 +211,7 @@
isisfish.error.delete.file=could not delete file %1$s
isisfish.error.delete.vcs.files=Can't delete vcs files
isisfish.error.dialog.message=Some errors have been detected
-isisfish.error.dialog.title=Error...
+isisfish.error.dialog.title=Error
isisfish.error.during.simulation=Error during simulation
isisfish.error.emigration.negative=emigration negative
isisfish.error.empty.code.rubbin=rubbin's code is empty
@@ -337,6 +337,7 @@
isisfish.error.undefined.zone.reproduction=No reprodution's zone defined
isisfish.error.unsupported.equation.langage=unsupported langage '%1$s' for equation\: %2$s
isisfish.error.wait.simThread=Can't wait SimThread
+isisfish.error.warning.title=Warning
isisfish.error.write.simulation=Can't write information %1$s
isisfish.exit.text=Something has change, please enter a comment
isisfish.exit.title=Exit
@@ -536,6 +537,7 @@
isisfish.message.import.scripts.file.cancelled=Import scripts cancelled
isisfish.message.import.xml.v2.file=Import xml v2 file
isisfish.message.import.zip=Import zip file
+isisfish.message.launchui.notlaunch=
isisfish.message.load.finished=load finished
isisfish.message.load.map=Try to load map file\: %1$s (%2$s, %3$s)
isisfish.message.loading.old.simulation=Loading old simulation ...
@@ -886,7 +888,10 @@
isisfish.vcs.commit.cancel=vcs.commit.cancel
isisfish.vcs.commit.label=vcs.commit.label
isisfish.vcs.commit.ok=vcs.commit.ok
+isisfish.vcs.init.notfoundcantdownload=No database version %s found and can't get it.\nYou must go to ISIS-Fish web site and download database manually.
+isisfish.vcs.init.wrongprotocol=Your database repository\: %s\n don't use correct protocol.\nDo you want to make backup of your database and take the correct one ?
isisfish.vcs.switchprotocol.confirm=Protocol to access repository script has changed.\nDo you want to switch your repository ?
+isisfish.vcs.switchtag.warningconflict=Your repository is now up-to-date, but following files are conflicted, you may check them \:\n%s
isisfish.vcs.switchversion.confirm=You don't use correct repository script for your application version %s.\nDo you want to switch your repository ?
isisfish.vcs.update=vcs.update
isisfish.vcs.update.cancel=cancel
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-17 17:18:41 UTC (rev 1679)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-17 17:18:58 UTC (rev 1680)
@@ -62,9 +62,9 @@
destination\ already\ exists\ %s\ use\ \\'force\\'\ argument\ to\ force\ overwrite=
directory\ %s\ must\ be\ a\ directory=
filter\ loaded\ in\ %1$s\ ms\ \:\ found\ %2$s\ lines.=filter loaded in %1$s ms \: found %2$s lines.
-isisfish.about.site=http\://isisfish.labs.libre-entreprise.org - par B.Poussin
-isisfish.about.text=Simulateur Isis-Fish
-isisfish.about.title=A propos de Isis-Fish...
+isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright 2002 - 2008, Code Lutin.<br /><br /><a href\="http\://isis-fish.labs.libre-entreprise.org">http\://isis-fish.labs.libre-entreprise.org</a><br /><br />Merci de rapporter les bugs.<html>
+isisfish.about.licensetext=Vous pouvez modifier et redistribuer ce programme sous les conditions \u00E9nonc\u00E9es par la licence GNU GPL (version 2 ou ult\u00E9rieure). Une copie de la licence GPL est dans le fichier \u00AB\u00A0LICENSE.txt\u00A0\u00BB fourni avec Isis-Fish. Tous droits r\u00E9serv\u00E9s. Aucune garantie n'est fournie pour l'utilisation de ce programme.
+isisfish.about.title=\u00C0 propos de Isis-Fish...
isisfish.advancedParameters.title=Param\u00E8tres avanc\u00E9s
isisfish.advancedParams.freeParameters=Param\u00E8tres libres
isisfish.advancedParams.libLevelLogger=Niveau de tracage des librairies
@@ -211,7 +211,7 @@
isisfish.error.delete.file=could not delete file %1$s
isisfish.error.delete.vcs.files=Can't delete vcs files
isisfish.error.dialog.message=Une erreur a \u00E9t\u00E9 d\u00E9tect\u00E9e
-isisfish.error.dialog.title=Erreur...
+isisfish.error.dialog.title=Erreur
isisfish.error.during.simulation=Error during simulation
isisfish.error.emigration.negative=emigration negative
isisfish.error.empty.code.rubbin=le code rubbin est vide
@@ -337,6 +337,7 @@
isisfish.error.undefined.zone.reproduction=il n'y a pas de zone de reproduction de d\u00E9finit
isisfish.error.unsupported.equation.langage=unsupported langage '%1$s' for equation\: %2$s
isisfish.error.wait.simThread=Can't wait SimThread
+isisfish.error.warning.title=Attention
isisfish.error.write.simulation=Can't write information %1$s
isisfish.exit.text=Quelque chose a chang\u00E9, merci de saisir un commentaire
isisfish.exit.title=Exit
@@ -536,6 +537,7 @@
isisfish.message.import.scripts.file.cancelled=Importation des scripts annul\u00E9
isisfish.message.import.xml.v2.file=Import xml v2 file
isisfish.message.import.zip=Import zip file
+isisfish.message.launchui.notlaunch=
isisfish.message.load.finished=Chargement termin\u00E9
isisfish.message.load.map=Chargement de la carte \: %1$s (%2$s, %3$s)
isisfish.message.loading.old.simulation=Chargement d'une ancienne simulation ...
@@ -886,7 +888,10 @@
isisfish.vcs.commit.cancel=annuler
isisfish.vcs.commit.label=Entrer quelques mots concernant la modification des scripts
isisfish.vcs.commit.ok=confirmer
+isisfish.vcs.init.notfoundcantdownload=La base de donn\u00E9es pour la version %s n'a ni pu \u00EAtre trouv\u00E9e, ni t\u00E9l\u00E9charg\u00E9e.\nVous devez la t\u00E9l\u00E9charger manullement \u00E0 partir du site d'Isis-Fish.
+isisfish.vcs.init.wrongprotocol=Votre base de donn\u00E9es locale \: %s n'utilise pas un protocole correct.\nVoulez-vous faire une sauvegarde de cette base et r\u00E9cup\u00E9rer une meilleure version ?
isisfish.vcs.switchprotocol.confirm=Le protocole d'acc\u00E8s au d\u00E9p\u00F4t des scripts a chang\u00E9.\nVoulez-vous changer vers le nouveau d\u00E9p\u00F4t ?
+isisfish.vcs.switchtag.warningconflict=Votre base de donn\u00E9es a \u00E9t\u00E9 mise \u00E0 jour\nmais les fichiers suivants sont en conflit, merci de les v\u00E9rifier \:\n%s
isisfish.vcs.switchversion.confirm=Vous n'utilisez pas le d\u00E9p\u00F4t correct pour votre version d'Isis-Fish \: %s.\nVoulez-vous changer de d\u00E9p\u00F4t ?
isisfish.vcs.update=R\u00E9sultats de la synchronisation avec le serveur
isisfish.vcs.update.cancel=annuler
1
0
r1679 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs
by chatellier@users.labs.libre-entreprise.org 17 Dec '08
by chatellier@users.labs.libre-entreprise.org 17 Dec '08
17 Dec '08
Author: chatellier
Date: 2008-12-17 17:18:41 +0000 (Wed, 17 Dec 2008)
New Revision: 1679
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java
Log:
Update cvs svn, return conflit file on switch
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java 2008-12-17 13:40:51 UTC (rev 1678)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java 2008-12-17 17:18:41 UTC (rev 1679)
@@ -338,9 +338,10 @@
* trunk.
* @param version version to go, if null trunk is used, otherwize
* tags/version is used
+ * @return a list of all file in conflict
* @throws VCSException
*/
- void setTag(VersionNumber version) throws VCSException;
+ List<File> setTag(VersionNumber version) throws VCSException;
/**
* Change host.
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java 2008-12-17 13:40:51 UTC (rev 1678)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java 2008-12-17 17:18:41 UTC (rev 1679)
@@ -196,8 +196,9 @@
return false;
}
- public void setTag(VersionNumber version) throws VCSException {
+ public List<File> setTag(VersionNumber version) throws VCSException {
// do nothing
+ return null;
}
public String getTag() throws VCSException {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2008-12-17 13:40:51 UTC (rev 1678)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2008-12-17 17:18:41 UTC (rev 1679)
@@ -1,4 +1,4 @@
-/* *##% IsisFish
+/* *##% GeSi
* Copyright (C) 2008 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
@@ -165,15 +165,15 @@
getSVNManager().getWCClient().doGetProperty(url, "",
SVNRevision.HEAD, SVNRevision.HEAD);
connectionState = ConnectionState.ON_LINE;
-
- if (log.isInfoEnabled()) {
+
+ if(log.isInfoEnabled()) {
log.info(_("isisfish.vcs.vcssvn.isconnected.switchto",
- getRemoteRepository()));
+ getRemoteRepository()));
}
} catch (SVNException eee) {
- if (log.isWarnEnabled()) {
+ if(log.isWarnEnabled()) {
log.warn(_("isisfish.vcs.vcssvn.isconnected.switchoff",
- getRemoteRepository()));
+ getRemoteRepository()));
}
connectionState = ConnectionState.OFF_LINE;
}
@@ -191,41 +191,39 @@
*/
@Override
public void checkProtocol() throws VCSException {
-
+
// on doit verifier ici que seul le protocole a change
// le doRelocate de svn, ne permet de ne change que
// le protocol ou host par exemple
// dans le cas d'un changement de path, le do relocate
// echoue (operation non permise)
-
+
try {
// test que les protocoles, userInfo, host, port sont egaux.
-
+
// copies locales
File localRoot = getLocalRepository();
SVNInfo info = getSVNManager().getWCClient().doInfo(localRoot,
SVNRevision.WORKING);
SVNURL url = info.getURL();
-
+
// url distante (suposée)
SVNURL newUrl = getRemoteURL();
-
+
// hack just for doRelocate to work
newUrl = newUrl.setPath(url.getPath(), false);
-
+
if (!url.getProtocol().equals(newUrl.getProtocol()) // http, svn ...
- || (url.getUserInfo() == null && newUrl.getUserInfo() != url
- .getUserInfo()) // username
- || (url.getUserInfo() != null && !url.getUserInfo().equals(
- newUrl.getUserInfo())) // username
+ || (url.getUserInfo() == null && newUrl.getUserInfo() != url.getUserInfo()) // username
+ || (url.getUserInfo() != null && !url.getUserInfo().equals(newUrl.getUserInfo())) // username
|| url.getPort() != newUrl.getPort() // 80
|| !url.getHost().equals(newUrl.getHost())) {
if (fireAction(VCSActionEvent.SWITCH_PROTOCOL)) {
- if (log.isInfoEnabled()) {
- log.info(_("isisfish.vcs.vcssvn.checkProtocol.relocate",
- localRoot, url, newUrl));
+ if(log.isInfoEnabled()) {
+ log.info(_("isisfish.vcs.vcssvn.checkProtocol.relocate", localRoot,
+ url, newUrl));
}
-
+
// le relocate de SVNKit
// ne supporte que le changement de protocole/host/port
// pas le path
@@ -234,7 +232,8 @@
}
}
} catch (SVNException e) {
- throw new VCSException(_("isisfish.vcs.vcssvn.checkProtocol.error"), e);
+ throw new VCSException(
+ _("isisfish.vcs.vcssvn.checkProtocol.error"), e);
}
}
@@ -346,7 +345,8 @@
// if can't commit
if (!isWriteable()) {
- throw new VCSException(_("isisfish.vcs.vcssvn.commit.errorreadonly"));
+ throw new VCSException(
+ _("isisfish.vcs.vcssvn.commit.errorreadonly"));
}
// list to array
@@ -390,8 +390,7 @@
SVNDepth.INFINITY); // depth
if (log.isInfoEnabled()) {
- log.info(_("isisfish.vcs.vcssvn.global.torevision", commitInfo
- .getNewRevision()));
+ log.info(_("isisfish.vcs.vcssvn.global.torevision", commitInfo.getNewRevision()));
}
} catch (SVNException e) {
throw new VCSException(_("isisfish.vcs.vcssvn.commit.error"), e);
@@ -400,7 +399,8 @@
public void add(List<File> files, String msg) throws VCSException {
if (!isWriteable()) {
- throw new VCSException(_("isisfish.vcs.vcssvn.add.errorreadonly"));
+ throw new VCSException(
+ _("isisfish.vcs.vcssvn.add.errorreadonly"));
}
try {
if (fireAction(VCSActionEvent.ADD, files.toArray(new File[files
@@ -463,9 +463,7 @@
true); // boolean allowUnversionedObstructions
if (log.isInfoEnabled()) {
- log
- .info(_("isisfish.vcs.vcssvn.global.torevision",
- newRevision));
+ log.info(_("isisfish.vcs.vcssvn.global.torevision", newRevision));
}
}
} catch (SVNException eee) {
@@ -475,7 +473,8 @@
public void delete(List<File> files, String msg) throws VCSException {
if (!isWriteable()) {
- throw new VCSException(_("isisfish.vcs.vcssvn.delete.errorreadonly"));
+ throw new VCSException(
+ _("isisfish.vcs.vcssvn.delete.errorreadonly"));
}
try {
if (fireAction(VCSActionEvent.DELETE, files.toArray(new File[files
@@ -639,7 +638,7 @@
public Map<File, String> getChanglog(List<File> files) throws VCSException {
throw new UnsupportedOperationException("Not supported yet.");
-
+
/*final Map<File, String> changLog = new HashMap<File, String>();
try {
@@ -649,7 +648,7 @@
// Handler
ISVNLogEntryHandler handler = new ISVNLogEntryHandler() {
-
+
@Override
public void handleLogEntry(SVNLogEntry logEntry)
throws SVNException {
@@ -795,8 +794,8 @@
// log
if (log.isDebugEnabled()) {
- log.debug(_("isisfish.vcs.vcssvn.global.filestatus", status
- .getFile().getAbsolutePath(), status
+ log.debug(_("isisfish.vcs.vcssvn.global.filestatus", status.getFile()
+ .getAbsolutePath(), status
.getRemoteContentsStatus().toString()));
}
@@ -805,9 +804,8 @@
// log
if (log.isDebugEnabled()) {
- log.debug(_(
- "isisfish.vcs.vcssvn.global.foundUpdatedFile",
- status.getFile().getAbsolutePath()));
+ log.debug(_("isisfish.vcs.vcssvn.global.foundUpdatedFile", status
+ .getFile().getAbsolutePath()));
}
result.add(status.getFile());
@@ -839,13 +837,13 @@
* @throws VCSException
*/
public boolean haveUpdate() throws VCSException {
-
+
// c'est juste si la liste renvoyé par getUpdatedFile() n'est pas vide ?
List<File> updatedFiles = getUpdatedFile();
-
+
boolean result = false;
-
- if (updatedFiles != null && !updatedFiles.isEmpty()) {
+
+ if(updatedFiles != null && !updatedFiles.isEmpty()) {
result = true;
}
return result;
@@ -859,35 +857,29 @@
* @throws VCSException
*/
public boolean isOnRemote(File file) throws VCSException {
-
+
File localFile = file;
if (localFile == null) {
localFile = getLocalRepository();
}
-
+
boolean result = false;
try {
SVNStatusClient statusClient = getSVNManager().getStatusClient();
- SVNStatus status = statusClient
- .doStatus(localFile, true /*remote*/);
-
+ SVNStatus status = statusClient.doStatus(localFile, true /*remote*/);
+
SVNStatusType localStatus = status.getContentsStatus();
SVNStatusType remoteStatus = status.getRemoteContentsStatus();
-
- if (log.isDebugEnabled()) {
- log
- .debug(_(
- "isisfish.vcs.vcssvn.global.filelocalandremotestatus",
- localFile.getAbsolutePath(), localStatus,
- remoteStatus));
+
+ if(log.isDebugEnabled()) {
+ log.debug(_("isisfish.vcs.vcssvn.global.filelocalandremotestatus",localFile.getAbsolutePath(),localStatus, remoteStatus));
}
-
+
// don't return true if:
// - file is locally added
// - file is remotely deleted
- if (!localStatus.equals(SVNStatusType.STATUS_ADDED)
- && !remoteStatus.equals(SVNStatusType.STATUS_DELETED)) {
+ if(!localStatus.equals(SVNStatusType.STATUS_ADDED) && !remoteStatus.equals(SVNStatusType.STATUS_DELETED)) {
result = true;
}
@@ -895,12 +887,11 @@
// catch exception
// if exception, file doesn't exists on server
// result is still 'false'
- if (log.isDebugEnabled()) {
- log.debug(_("isisfish.vcs.vcssvn.isonremote.error", localFile
- .getAbsolutePath()), e);
+ if(log.isDebugEnabled()) {
+ log.debug(_("isisfish.vcs.vcssvn.isonremote.error",localFile.getAbsolutePath()),e);
}
}
-
+
return result;
}
@@ -913,33 +904,31 @@
*/
@Override
public boolean isUpToDate(File file) throws VCSException {
-
+
File localFile = file;
if (localFile == null) {
localFile = getLocalRepository();
}
-
+
boolean result = false;
-
+
try {
SVNStatusClient statusClient = getSVNManager().getStatusClient();
- SVNStatus status = statusClient
- .doStatus(localFile, true /*remote*/);
+ SVNStatus status = statusClient.doStatus(localFile, true /*remote*/);
SVNStatusType localStatus = status.getContentsStatus();
SVNStatusType remoteStatus = status.getRemoteContentsStatus();
-
+
// TODO peut on dire que le fichier est à jour
// si le status local est normal et le distant est none
- if (localStatus == SVNStatusType.STATUS_NORMAL
- && remoteStatus == SVNStatusType.STATUS_NONE) {
+ if (localStatus == SVNStatusType.STATUS_NORMAL && remoteStatus == SVNStatusType.STATUS_NONE) {
result = true;
}
} catch (SVNException eee) {
throw new VCSException(_("isisfish.vcs.vcssvn.isuptodate.error"), eee);
}
-
+
return result;
}
@@ -956,7 +945,8 @@
localFile = getLocalRepository();
}
if (!accept(localFile)) {
- throw new VCSException(_("isisfish.vcs.vcssvn.update.notinlocal"));
+ throw new VCSException(
+ _("isisfish.vcs.vcssvn.update.notinlocal"));
}
if (fireAction(VCSActionEvent.UPDATE, localFile)) {
// si le repertoire pere, n'est pas encore dans le repo local
@@ -976,8 +966,7 @@
false); // boolean depthIsSticky
if (log.isInfoEnabled()) {
- log.info(_("isisfish.vcs.vcssvn.global.torevision",
- newRevision));
+ log.info(_("isisfish.vcs.vcssvn.global.torevision", newRevision));
}
// recherche de tous les fichiers locaux en conflit
@@ -1070,7 +1059,8 @@
}
return result;
} catch (SVNException eee) {
- throw new VCSException(_("isisfish.vcs.vcssvn.gettag.error"), eee);
+ throw new VCSException(
+ _("isisfish.vcs.vcssvn.gettag.error"), eee);
}
}
@@ -1078,8 +1068,12 @@
* @see org.codelutin.isisfish.vcs.VCS#setTag(org.codelutin.util.VersionNumber)
*/
@Override
- public void setTag(VersionNumber version) throws VCSException {
+ public List<File> setTag(VersionNumber version) throws VCSException {
+
+ List<File> filesInConflict = null;
+
try {
+
String tag = "/trunk";
if (version != null) {
tag = "/tags/" + version;
@@ -1115,14 +1109,35 @@
true);// boolean depthIsSticky
if (log.isInfoEnabled()) {
- log.info(_("isisfish.vcs.vcssvn.global.torevision",
- newRevision));
+ log.info(_("isisfish.vcs.vcssvn.global.torevision", newRevision));
}
+
+ // recherche de tous les fichiers locaux en conflit apres le switch
+ Map<File, SVNStatus> status = getLocalStatus(localRoot,
+ true, SVNStatusType.STATUS_CONFLICTED);
+ if (status.size() > 0) {
+ filesInConflict = new ArrayList<File>();
+ filesInConflict.addAll(status.keySet());
+ // on supprime les conflits pour pouvoir commiter convenablement
+ // les fichiers
+ //getSVNManager().getWCClient().doResolve(localFile, recurse);
+
+ // FIXME use conflit resolution choice ?
+ //SVNWCClient wcClient = getSVNManager().getWCClient();
+ //wcClient.doResolve(localFile, // File file
+ // recurse ? SVNDepth.INFINITY : SVNDepth.FILES, // depth
+ // SVNConflictChoice.MERGED); // ConflictChoice
+ }
}
}
+
+
} catch (SVNException eee) {
- throw new VCSException(_("isisfish.vcs.vcssvn.setTag.error"), eee);
+ throw new VCSException(
+ _("isisfish.vcs.vcssvn.setTag.error"), eee);
}
+
+ return filesInConflict;
}
}
\ No newline at end of file
1
0
r1678 - in isis-fish/trunk/src/main: java/fr/ifremer/isisfish/actions java/fr/ifremer/isisfish/datastore java/fr/ifremer/isisfish/simulator java/fr/ifremer/isisfish/simulator/launcher java/fr/ifremer/isisfish/ui/simulator resources resources/i18n
by chatellier@users.labs.libre-entreprise.org 17 Dec '08
by chatellier@users.labs.libre-entreprise.org 17 Dec '08
17 Dec '08
Author: chatellier
Date: 2008-12-17 13:40:51 +0000 (Wed, 17 Dec 2008)
New Revision: 1678
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationInformation.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationJob.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
isis-fish/trunk/src/main/resources/log4j.properties
Log:
Corection du lancement des simulations par sous process
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/SimulationAction.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -21,6 +21,13 @@
import static org.codelutin.i18n.I18n._;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import fr.ifremer.isisfish.IsisConfig;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.datastore.RegionStorage;
@@ -30,16 +37,11 @@
import fr.ifremer.isisfish.simulator.launcher.InProcessSimulatorLauncher;
import fr.ifremer.isisfish.simulator.launcher.SimulationService;
import fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher;
-import java.io.File;
-import java.io.FileInputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Properties;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import fr.ifremer.isisfish.types.Month;
/**
- *
+ * Action des simulations.
+ *
* @author poussin
* @version $Revision$
*
@@ -56,48 +58,66 @@
public SimulationAction(IsisConfig config) {
this.config = config;
}
-
- public static void simulateWithRegion(String simulId, File parameterFile, File region) throws Exception {
- Properties props = new Properties();
- FileInputStream inStream = new FileInputStream(parameterFile);
- props.load(inStream);
- inStream.close();
- SimulationParameter params = new SimulationParameter();
- params.fromProperties(SimulationStorage.getSimulationDirectory(), props);
+ /**
+ *
+ * @param simulId
+ * @param parameterFile
+ * @param region
+ * @throws Exception
+ */
+ public static void simulateWithRegion(String simulId, File parameterFile,
+ File region) throws Exception {
+ Properties props = new Properties();
+ FileInputStream inStream = new FileInputStream(parameterFile);
+ props.load(inStream);
+ inStream.close();
- // try to import region if needed
- String regionName = params.getRegionName();
- if (region != null) {
- if (!RegionStorage.exists(regionName)) {
- RegionStorage.importAndRenameZip(region, regionName);
- } else {
- log.warn(_("Region %s allready exist in repository. Cant import", regionName));
- }
+ SimulationParameter params = new SimulationParameter();
+ params.fromProperties(SimulationStorage.getSimulationDirectory(),
+ props);
+
+ // try to import region if needed
+ String regionName = params.getRegionName();
+ if (region != null) {
+ if (!RegionStorage.exists(regionName)) {
+ RegionStorage.importAndRenameZip(region, regionName);
+ } else {
+ log.warn(_(
+ "Region %s allready exist in repository. Can't import",
+ regionName));
}
+ }
- SimulationService.getService().submit(simulId, params, null, 0);
+ SimulationService.getService().submit(simulId, params, null, 0);
}
-
+
/**
*
* @param simulId id de simulation
- * @param zip Zip de la simulation
- * @param parameterFile parametre optionnel pour la simulation
+ * @param simulationZip Zip de la simulation
+ * @throws Exception
*/
- public static void simulateWithSimulation(String simulId, File simulationZip) throws Exception {
+ public static void simulateWithSimulation(String simulId, File simulationZip)
+ throws Exception {
log.info("id:" + simulId + ", zip:" + simulationZip);
String name = simulId; // ne pas mettre la date, car le sub process la met deja + " " + new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date());
+
+ SimulationControl control = new SimulationControl(name);
- SimulationControl control = new SimulationControl(name);
+ // pour forcer le fichier de control a être sauver
+ // pour ensuite être lu par le processus parent
+ control.setAutoSaveState(true);
+
// lancement de la simulation
SimulatorLauncher launcher = new InProcessSimulatorLauncher();
- SimulationStorage simulation = launcher.simulate(null, control, simulationZip);
+ SimulationStorage simulation = launcher.simulate(null, control,
+ simulationZip);
simulation.getStorage().closeContext();
+
// FIXME integrer ca dans le process normal d'init
IsisFish.quit();
}
-
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/ScriptStorage.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -50,10 +50,8 @@
import java.util.Map;
/**
- *
- * Gestion des fichers CVS de type scripts (appratenant au module scripts).
+ * Gestion des fichers CVS de type scripts (appartenant au module scripts).
*/
-
public class ScriptStorage extends JavaSourceStorage implements Docable {
static final public String SCRIPT_PATH = "scripts";
@@ -207,7 +205,6 @@
* @see Docable
*/
public String getDescription() {
- throw new IsisFishRuntimeException(_("isisfish.error.not.support.class" +
- "Docable#getDescription() method %1$s",this));
+ throw new IsisFishRuntimeException(_("isisfish.error.not.support.class",this));
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationInformation.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationInformation.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationInformation.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -292,5 +292,3 @@
setInfo(OTHER_INFO, getInfomation() + value + "\n");
}
}
-
-
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -104,7 +104,7 @@
}
/**
- * Retourne le repertoire de base de stockage des simultions
+ * Retourne le repertoire de base de stockage des simulations
* @return
*/
static public File getSimulationDirectory() {
@@ -251,6 +251,11 @@
}
control.updateFromProperties(prop);
}
+ else {
+ if(log.isDebugEnabled()) {
+ log.debug("Control file '" + file.getAbsolutePath() + "'doesn't exists");
+ }
+ }
} catch (Exception eee) {
log.warn("Can't read control", eee);
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationControl.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -31,17 +31,18 @@
package fr.ifremer.isisfish.simulator;
-import fr.ifremer.isisfish.datastore.SimulationStorage;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Hashtable;
+import java.util.Map;
+import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.types.Date;
-import java.util.Properties;
/**
* Permit to communicate with user interface from simulation thread
@@ -67,10 +68,11 @@
protected int progress = 0;
protected String text = "";
- protected Hashtable<String, Object> update = new Hashtable<String, Object>();
+ protected Map<String, Object> update = new Hashtable<String, Object>();
/**
*
+ * @param id simulation id
*/
public SimulationControl(String id) {
this.id = id;
@@ -121,14 +123,15 @@
/**
* appelee juste avant de reellement demarrer le thread de simulation
* indique que cette simulation est en cours et qu'il ne faut plus la lancer
- * @param running The running to set.
+ *
+ * @param started The running to set.
*/
public void setStarted(boolean started) {
boolean oldValue = this.started;
this.started = started;
listeners.firePropertyChange("started", oldValue, this.started);
}
-
+
/**
* Method running
*
@@ -208,11 +211,15 @@
public void setProgress(int progress) {
int oldValue = this.progress;
this.progress = progress;
+ if(log.isTraceEnabled()) {
+ log.trace("control fire event 'progress' (" + oldValue + "/" + this.progress);
+ }
listeners.firePropertyChange("progress", oldValue, this.progress);
}
/**
* demande l'arret de la simulation
+ * @param val
*/
public void setStopSimulationRequest(boolean val){
boolean oldValue = this.stop;
@@ -261,7 +268,7 @@
* that contains last modified field
* @return
*/
- public Hashtable getUpdateHashtable() {
+ public Hashtable<String, Object> getUpdateHashtable() {
Hashtable<String, Object> result = new Hashtable<String, Object>(update);
update.clear();
@@ -290,37 +297,46 @@
/**
* update current object from Properties representation
- *
+ *
+ * @param props new properties to update from
*/
- public void updateFromProperties(Properties h) {
+ public void updateFromProperties(Properties props) {
inUpdateFromHashtable = true;
+
+ if(log.isTraceEnabled()) {
+ log.trace("updateFromProperties properties = " + props.toString());
+ }
+
+ // warning : props.contains("started")
+ // seems to not works on properties :(
+ // use containsKey()
try {
- if (h.contains("started")) {
- boolean started = "true".equalsIgnoreCase(h.getProperty("started"));
+ if (props.containsKey("started")) {
+ boolean started = "true".equalsIgnoreCase(props.getProperty("started"));
setStarted(started);
}
- if (h.contains("running")) {
- boolean running = "true".equalsIgnoreCase(h.getProperty("running"));
+ if (props.containsKey("running")) {
+ boolean running = "true".equalsIgnoreCase(props.getProperty("running"));
setRunning(running);
}
- if (h.contains("stop")) {
- boolean stop = "true".equalsIgnoreCase(h.getProperty("stop"));
+ if (props.containsKey("stop")) {
+ boolean stop = "true".equalsIgnoreCase(props.getProperty("stop"));
setStopSimulationRequest(stop);
}
- if (h.contains("date")) {
- Date date = new Date(Integer.parseInt(h.getProperty("date")));
+ if (props.containsKey("date")) {
+ Date date = new Date(Integer.parseInt(props.getProperty("date")));
setDate(date);
}
- if (h.contains("progressMax")) {
- int progressMax = Integer.parseInt(h.getProperty("progressMax"));
+ if (props.containsKey("progressMax")) {
+ int progressMax = Integer.parseInt(props.getProperty("progressMax"));
setProgressMax(progressMax);
}
- if (h.contains("progress")) {
- int progress = Integer.parseInt(h.getProperty("progress"));
+ if (props.containsKey("progress")) {
+ int progress = Integer.parseInt(props.getProperty("progress"));
setProgress(progress);
}
- if (h.contains("text")) {
- String text = h.getProperty("text");
+ if (props.containsKey("text")) {
+ String text = props.getProperty("text");
setText(text);
}
} finally {
@@ -333,34 +349,34 @@
* update current object from hashtable representation
*
*/
- public void updateFromHashtable(Hashtable h) {
+ public void updateFromHashtable(Hashtable<String, Object> h) {
inUpdateFromHashtable = true;
try {
- if (h.contains("started")) {
+ if (h.containsKey("started")) {
boolean started = (Boolean)h.get("started");
setStarted(started);
}
- if (h.contains("running")) {
+ if (h.containsKey("running")) {
boolean running = (Boolean)h.get("running");
setRunning(running);
}
- if (h.contains("stop")) {
+ if (h.containsKey("stop")) {
boolean stop = (Boolean)h.get("stop");
setStopSimulationRequest(stop);
}
- if (h.contains("date")) {
+ if (h.containsKey("date")) {
Date date = new Date((Integer)h.get("date"));
setDate(date);
}
- if (h.contains("progressMax")) {
+ if (h.containsKey("progressMax")) {
int progressMax = (Integer)h.get("progressMax");
setProgressMax(progressMax);
}
- if (h.contains("progress")) {
+ if (h.containsKey("progress")) {
int progress = (Integer)h.get("progress");
setProgress(progress);
}
- if (h.contains("text")) {
+ if (h.containsKey("text")) {
String text = (String)h.get("text");
setText(text);
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -60,6 +60,8 @@
import fr.ifremer.isisfish.simulator.SimulationParameter;
import fr.ifremer.isisfish.simulator.SimulationPreScript;
import fr.ifremer.isisfish.simulator.Simulator;
+import fr.ifremer.isisfish.types.Date;
+import fr.ifremer.isisfish.types.Month;
/**
* Fait une simulation dans la meme jvm
@@ -75,22 +77,42 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(InProcessSimulatorLauncher.class);
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulate(fr.ifremer.isisfish.simulator.launcher.SimulationService, fr.ifremer.isisfish.simulator.SimulationControl, java.io.File)
+ */
public SimulationStorage simulate(SimulationService simulationService,
SimulationControl control, File simulationZip)
throws RemoteException{
+
String id = control.getId();
log.info(_("simulate %s with file %s", id, simulationZip));
SimulationStorage simulation = null;
+
try {
simulation = SimulationStorage.importAndRenameZip(simulationZip, id);
+
+ // add missing control informations
+ SimulationParameter param = simulation.getParameter();
+ control.setDate(new Date());
+ control.setProgress(0);
+ control.setStarted(true);
+ int lastYear = param.getNumberOfYear();
+ int lastDate = lastYear * Month.NUMBER_OF_MONTH;
+ control.setProgressMax(lastDate);
+
simulation = localSimulate(control, simulation);
} catch (Exception eee) {
log.error(_("Can't do simulation %s", id), eee);
- simulation.getInformation().setException(eee);
+ if(simulation != null) {
+ simulation.getInformation().setException(eee);
+ }
}
return simulation;
}
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#maxSimulationThread()
+ */
public int maxSimulationThread() {
return 1;
}
@@ -162,7 +184,7 @@
}
}
- /**
+ /**
* Modifie le classloader du thread passé en paramètre.
* <p>
* Sert pour les simulations pour qu'elles puissent trouver les
@@ -175,8 +197,8 @@
protected AspectClassLoader changeClassLoader(Thread thread, File directory) {
try {
URL [] classpath = new URL[]{directory.toURI().toURL(),
- // poussin 20080821
- // il semble ne plus trouve les formules, est-ce mieux avec le compile dir ?
+ // poussin 20080821
+ // il semble ne plus trouve les formules, est-ce mieux avec le compile dir ?
IsisFish.config.getCompileDirectory().toURI().toURL()
};
//URL [] classpath = new URL[]{directory.toURL()};
@@ -293,7 +315,7 @@
simulatorObject.simulate(context);
//
- // Ajout des nouveaux objets créées durant la simulation
+ // Ajout des nouveaux objets créés durant la simulation
//
message(control, _("isisfish.message.add.objets.simulation"));
// on ajoute sur le DBResult car pour les exports peut-etre auront
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationJob.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationJob.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationJob.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -184,6 +184,8 @@
} else {
// on est sur une simple simulation, ou le resultat d'un plan
+ /* code moved to
+ fr.ifremer.isisfish.simulator.launcher.InProcessSimulatorLauncher.simulate(SimulationService, SimulationControl, File)
// set date to 0 at beginning of simulation
control.setDate(new Date());
control.setProgress(0);
@@ -191,7 +193,7 @@
int lastYear = param.getNumberOfYear();
int lastDate = lastYear * Month.NUMBER_OF_MONTH;
- control.setProgressMax(lastDate);
+ control.setProgressMax(lastDate);*/
File zip = item.getSimulationZip();
SimulationStorage simulation = launcher.simulate(simulationService, control, zip);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -324,6 +324,7 @@
*
* @param id l'identifiant de la simulation
* @param param les parametres de la simulation
+ * @param launcher
* @param priority la priorite de la simulation
*/
public void submit(String id, SimulationParameter param,
@@ -590,26 +591,26 @@
}
/**
- * Prepare les fichiers qui seront utils ? la simulation:
+ * Prepare les fichiers qui seront utilsé à la simulation:
* <li> scripts
* <li> rules
* <li> exports
* <li> simulators
* <li> export de la database de la region
* <p>
- * Le tout est zipp? et le zip est retourn?, il peut-?tre directement
- * import? dans le SimulationStorage (en le renomant comme il faut
+ * Le tout est zippé et le zip est retourné, il peut-être directement
+ * importé dans le SimulationStorage (en le renomant comme il faut
* importAndRenameZip).
* <p>
- * Ce zip est automatiquement supprim? a la fin de l'application.
+ * Ce zip est automatiquement supprimé à la fin de l'application.
*
* @param control le controleur
* @param param les parametre de la simulation
* @param compile si vrai la version compile des fichiers Java est aussi
* mise dans le fichier zip. Cela peut servir pour les simulations locales
* pour ne pas recompiler pour chaque simulation avec plan d'analyse
- * @return un zip de simulation pour une simulation pret a ?tre faite
- * @throws SimulationException pour tout probl?me rencontr? (IO,Topia...)
+ * @return un zip de simulation pour une simulation pret a être faite
+ * @throws SimulationException pour tout problème rencontré (IO,Topia...)
*/
protected File prepareSimulationZipFile(SimulationControl control,
SimulationParameter param, boolean compile) throws SimulationException {
@@ -695,16 +696,16 @@
}
/**
- * Compile les fichiers pr?sent dans le r?pertoire pass? en
- * parametre, ce r?pertoire est hi?rarchis? en: rules, exports, simulators
- * et scripts. Seul les fichiers des 3 premiers r?pertoire sont compil?
- * les fichiers du dernier sont compil? par les d?pendances qu'on les autres
+ * Compile les fichiers présent dans le répertoire passé en
+ * parametre, ce répertoire est hiérarchisé en: rules, exports, simulators
+ * et scripts. Seuls les fichiers des 3 premiers répertoires sont compilés
+ * les fichiers du dernier sont compilé par les dépendances qu'on les autres
* <p>
* Il permet donc de compiler facilement tous les fichiers pour une
* simulation
*
* @param control le controleur
- * @param directory le r?pertoire o? compiler
+ * @param directory le répertoire où compiler
*/
protected void compileAllFile(SimulationControl control, File directory) {
@@ -713,9 +714,9 @@
//
// Recherche des fichiers a compiler
- // On ne prend pas les scripts, car ils sont tous copi?s mais pas
- // forc?ment util. Lors de la compilation des autres fichiers, les
- // script servant r?ellement seront automatiquement compil?
+ // On ne prend pas les scripts, car ils sont tous copiés mais pas
+ // forcément util. Lors de la compilation des autres fichiers, les
+ // script servant réellement seront automatiquement compilé
List<File> fileToCompile = new ArrayList<File>();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -50,6 +50,9 @@
*/
public class SimulationServiceTableModel extends AbstractTableModel {
+ /** serialVersionUID */
+ private static final long serialVersionUID = 2414926794815727974L;
+
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(SimulationServiceTableModel.class);
@@ -60,8 +63,9 @@
_("isisfish.queue.status"),
_("isisfish.queue.progression"),
};
+
/** columns types */
- protected Class[] columnClass = new Class[]{
+ protected Class<?>[] columnClass = new Class[]{
String.class, // id
String.class, // analyse plan number
String.class, // local, remote, batch
@@ -157,27 +161,48 @@
return result;
}
+ /*
+ * @see javax.swing.table.TableModel#getRowCount()
+ */
public int getRowCount() {
int result = jobs.size();
return result;
}
+ /*
+ * @see javax.swing.table.TableModel#getColumnCount()
+ */
public int getColumnCount() {
int result = columnHeader.length;
return result;
}
+ /*
+ * @see javax.swing.table.AbstractTableModel#getColumnClass(int)
+ */
@Override
public Class<?> getColumnClass(int columnIndex) {
return columnClass[columnIndex];
}
+ /*
+ * @see javax.swing.table.AbstractTableModel#getColumnName(int)
+ */
@Override
public String getColumnName(int column) {
return columnHeader[column];
}
+ /*
+ * @see javax.swing.table.TableModel#getValueAt(int, int)
+ */
public Object getValueAt(int rowIndex, int columnIndex) {
+
+ // FIXME ArrayIndexOutOfBoundException here
+ if(rowIndex >= jobs.size()) {
+ return null;
+ }
+
SimulationJob job = jobs.get(rowIndex);
SimulationControl control = job.getItem().getControl();
String id = control.getId();
@@ -185,6 +210,14 @@
Object result = "";
+ if(log.isDebugEnabled()) {
+ log.debug("Update table model : " +
+ "id = " + control.getId() + ", " +
+ "control.getProgress() = " + control.getProgress() + ", " +
+ "control.getProgressMax() = " + control.getProgressMax() + ", "+
+ "control.getDate() = " + control.getDate());
+ }
+
switch (columnIndex) {
case 0:
result = id;
@@ -209,21 +242,17 @@
}
break;
case 3:
- if (control != null) {
- if (control.isStopSimulationRequest()) {
- result = _("isisfish.launch.stop");
- } else {
- result = control.getText();
- }
+ if (control.isStopSimulationRequest()) {
+ result = _("isisfish.launch.stop");
+ } else {
+ result = control.getText();
}
break;
case 4:
JProgressBar pb = getProgressBar(job);
- if (control != null) {
- pb.setMaximum(control.getProgressMax());
- pb.setValue(control.getProgress());
- pb.setString(control.getDate().getMonth() + "/" + control.getDate().getYear());
- }
+ pb.setMaximum(control.getProgressMax());
+ pb.setValue(control.getProgress());
+ pb.setString(control.getDate().getMonth() + "/" + control.getDate().getYear());
result = pb;
break;
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -197,7 +197,73 @@
}
}
+
+ protected class NonInteractiveUserInfo implements UserInfo {
+ protected String passphrase;
+ protected JTextField passphraseField = new JPasswordField(20);
+ protected String passwd;
+ protected JTextField passwordField = new JPasswordField(20);
+
+ /**
+ * Constructor with password.
+ *
+ * @param passwd password
+ */
+ public NonInteractiveUserInfo(String passwd) {
+ this.passwd = passwd;
+ }
+
+ public boolean promptYesNo(String str) {
+ log.debug("promptYesNo");
+ Object[] options = { "yes", "no" };
+ int foo = JOptionPane.showOptionDialog(null, str, "Warning",
+ JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
+ null, options, options[0]);
+ return foo == 0;
+ }
+
+ public String getPassphrase() {
+ log.debug("getPassphrase");
+ return passphrase;
+ }
+
+ public boolean promptPassphrase(String message) {
+ log.debug("promptPassphrase");
+ Object[] ob = { passphraseField };
+ int result = JOptionPane.showConfirmDialog(null, ob, message,
+ JOptionPane.OK_CANCEL_OPTION);
+ boolean bResult = false;
+ if (result == JOptionPane.OK_OPTION) {
+ passphrase = passphraseField.getText();
+ bResult = true;
+ }
+ return bResult;
+ }
+
+ public String getPassword() {
+ log.debug("getPassword");
+ return passwd;
+ }
+
+ public boolean promptPassword(String message) {
+ log.debug("promptPassword");
+ Object[] ob = { passwordField };
+ int result = JOptionPane.showConfirmDialog(null, ob, message,
+ JOptionPane.OK_CANCEL_OPTION);
+ boolean bResult = false;
+ if (result == JOptionPane.OK_OPTION) {
+ passwd = passwordField.getText();
+ bResult = true;
+ }
+ return bResult;
+ }
+
+ public void showMessage(String message) {
+ JOptionPane.showMessageDialog(null, message);
+ }
+ }
+
/*
* @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#maxSimulationThread()
*/
@@ -276,9 +342,9 @@
Session session = jsch.getSession(username, host, port);
// username and password will be given via UserInfo interface.
- UserInfo ui = new MyUserInfo(password);
+ UserInfo ui = new NonInteractiveUserInfo(password);
session.setUserInfo(ui);
- session.connect(60000);
+ session.connect(60000); // timeout
return session;
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -20,6 +20,8 @@
package fr.ifremer.isisfish.simulator.launcher;
import static org.codelutin.i18n.I18n._;
+
+import java.beans.PropertyChangeListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -87,9 +89,24 @@
return result;
}
+ /**
+ * Display both message on UI (listeners and log).
+ *
+ * @param control
+ * @param message
+ */
+ protected void message(SimulationControl control, String message) {
+ log.info(message);
+ if (control != null) {
+ control.setText(message);
+ }
+ }
+
public SimulationStorage subProcessSimulate(SimulationControl control,
File simulationZip) throws Exception {
+ message(control, _("isisfish.message.simulation.prepare"));
+
String simulationId = control.getId();
// on ferme le SimulationStorage pour ne pas interferer avec le process
//simulation.closeStorage();
@@ -104,20 +121,17 @@
IsisFish.class.getName(), "--option", "launch.ui", "false",
"--simulateWithSimulation", simulationId, simulationZip.getAbsolutePath());
processBuilder.redirectErrorStream(true);
-
+
// demarrage du process
Process process = processBuilder.start();
if(log.isInfoEnabled()) {
log.info(_("SubProcess start: %s %s", process, processBuilder.command()));
}
- // FIXME control can't be null here
- if (control != null) {
- // prepare de thread de surveillance du process si control n'est pas null
- Thread monitor = new SimulationCheckpointExternalProcessThread(
- control, simulationId, process);
- monitor.start();
- }
+ // prepare de thread de surveillance du process si control n'est pas null
+ Thread monitor = new SimulationCheckpointExternalProcessThread(
+ control, simulationId, process);
+ monitor.start();
// on attend que la simulation soit fini
process.waitFor();
@@ -156,7 +170,6 @@
this.simulationId = simulationId;
this.process = process;
this.out = process.getInputStream();
-
}
@Override
@@ -189,14 +202,11 @@
// passe artificiellement le control a fini
control.stopSimulation();
}
+
if (!control.isRunning()) {
return;
}
}
- //} catch (InterruptedException eee) {
- // if(log.isDebugEnabled()) {
- // log.debug("Can't update control for " + control.getId(), eee);
- // }
} catch (IOException e) {
if(log.isErrorEnabled()) {
log.error(_("isisfish.simulator.subprocess.readoutput.error"), e);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2008-12-17 13:40:51 UTC (rev 1678)
@@ -615,11 +615,11 @@
return SimulationService.getService().getSimulationLaunchers();
}
/**
- * Launch automaticaly the simulation, when is possible (no other simulation)
- * or wait for the last automaticaly simulation ended.
+ * Launch automatically the simulation, when is possible (no other simulation)
+ * or wait for the last automatically simulation ended.
*
* @param simulId id of the simulation to simulate
- * @param inQueue flag to say put in queue
+ * @param launcher launcher to use
*/
public void simul(String simulId, SimulatorLauncher launcher) {
simulId += " " + dateFormat.format(new java.util.Date());
@@ -628,7 +628,7 @@
if (simulId == null || "".equals(simulId) ||
SimulationStorage.localyExists(simulId) ||
SimulationService.getService().exists(simulId)) {
- UserLog.error(_("Can't start simulation, bad id: %s", simulId));
+ UserLog.error(_("isisfish.simulator.simulaction.badid", simulId));
} else {
SimulationParameter p = param.copy();
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-17 13:40:51 UTC (rev 1678)
@@ -16,7 +16,6 @@
Can't\ instantiate\ %s=
Can't\ open\ log\ for\ %s=
Can't\ simulate\ %s=
-Can't\ start\ simulation,\ bad\ id\:\ %s=
Check\ state\ of\ local\ repository\:\ %s=
Checkout\ pom.xml\ to\ %s=
Clear\ done\ jobs=
@@ -38,7 +37,7 @@
No\ database\ version\ %s\ found\ and\ can't\ get\ it.\\n=
Normal\ stop\ thread,\ this\ is\ not\ an\ error=
Not\ start\ simulation\ %s\ because\ user\ ask\ stop=
-Region\ %s\ allready\ exist\ in\ repository.\ Cant\ import=
+Region\ %s\ allready\ exist\ in\ repository.\ Can't\ import=
Region\ %s\ already\ inited=
Rename\ data\ directory\ to\ %s=
Show\ help=
@@ -276,7 +275,7 @@
isisfish.error.not.found.class=this class does not
isisfish.error.not.found.code=could not found codeclass for %1$s
isisfish.error.not.found.description=could not found description for %1$s
-isisfish.error.not.found.field=could not found field %1$s doc for %1$s
+isisfish.error.not.found.field=could not found field %1$s doc for %2$s
isisfish.error.not.found.field.class=could not found field %1$s for class %2$s
isisfish.error.not.null.class.grown=classe mature vaut nul
isisfish.error.not.null.mean.weight=poids moyen nul
@@ -563,6 +562,7 @@
isisfish.message.setting.trace.aspects=Setting Trace aspects
isisfish.message.simulation.ended=Simulation ended
isisfish.message.simulation.execution=Simulation execution
+isisfish.message.simulation.prepare=Preparing simulation
isisfish.message.tray.disabled=SystemTray disabled
isisfish.message.update.finished=update finished
isisfish.metier.comments=Comments
@@ -695,14 +695,14 @@
isisfish.port.name=Name
isisfish.preScript.backParameter=Back to parameter tab
isisfish.preScript.title=Pre simulation script
-isisfish.queue.id=id
+isisfish.queue.id=Id
isisfish.queue.launcher=Simulation launcher
isisfish.queue.plan=Plan
isisfish.queue.progression=Progression
isisfish.queue.showLog=Show simulation log
isisfish.queue.simulationLaunch=Simulation queue launch
isisfish.queue.status=Status
-isisfish.queue.stopSimulation=
+isisfish.queue.stopSimulation=Stop simulation
isisfish.queue.title=Queue
isisfish.result.abundance=Abondance
isisfish.result.add=Add a result
@@ -714,7 +714,7 @@
isisfish.result.datasRadioButton=defaultToolTip-fr.ifremer.resultat.ResultatEdit.donneeRadioButton
isisfish.result.desktopPane=defaultToolTip-fr.ifremer.resultat.ResultatView.desktopPane
isisfish.result.dimension=Dimension
-isisfish.result.end.simulation=En fin de Simulation\:
+isisfish.result.end.simulation=Simuation end \:
isisfish.result.export=Export
isisfish.result.export.file=Export text file
isisfish.result.file=File
@@ -850,10 +850,7 @@
isisfish.simulator.launcher.inprocess=in current process
isisfish.simulator.launcher.remote=on remote server
isisfish.simulator.launcher.subprocess=in subprocess
-isisfish.simulator.simulaction.init=Error during simulation init \: %s
-isisfish.simulator.simulaction.loadOldSimulation=Can't load old simulation \: %s
-isisfish.simulator.simulaction.regionChange=Can't change region \: %s
-isisfish.simulator.simulaction.viewlogerror=Can't view log \: %s
+isisfish.simulator.simulaction.badid=Can't start simulation, bad id\: %s
isisfish.simulator.subprocess.readoutput.error=
isisfish.species.age=age
isisfish.species.cee=CEE
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-17 13:40:51 UTC (rev 1678)
@@ -16,7 +16,6 @@
Can't\ instantiate\ %s=
Can't\ open\ log\ for\ %s=
Can't\ simulate\ %s=
-Can't\ start\ simulation,\ bad\ id\:\ %s=
Check\ state\ of\ local\ repository\:\ %s=
Checkout\ pom.xml\ to\ %s=
Clear\ done\ jobs=
@@ -38,7 +37,7 @@
No\ database\ version\ %s\ found\ and\ can't\ get\ it.\\n=
Normal\ stop\ thread,\ this\ is\ not\ an\ error=
Not\ start\ simulation\ %s\ because\ user\ ask\ stop=
-Region\ %s\ allready\ exist\ in\ repository.\ Cant\ import=
+Region\ %s\ allready\ exist\ in\ repository.\ Can't\ import=
Region\ %s\ already\ inited=La r\u00E9gion %s a d\u00E9j\u00E0 \u00E9t\u00E9 initialis\u00E9e
Rename\ data\ directory\ to\ %s=
Show\ help=
@@ -276,13 +275,13 @@
isisfish.error.not.found.class=this class does not
isisfish.error.not.found.code=could not found codeclass for %1$s
isisfish.error.not.found.description=could not found description for %1$s
-isisfish.error.not.found.field=could not found field %1$s doc for %1$s
+isisfish.error.not.found.field=could not found field %1$s doc for %2$s
isisfish.error.not.found.field.class=could not found field %1$s for class %2$s
isisfish.error.not.null.class.grown=classe mature vaut nul
isisfish.error.not.null.mean.weight=poids moyen nul
isisfish.error.not.null.natiral.death=mortalite naturelle nulle
isisfish.error.not.possible.metier=Pas de m\u00E9tier possible
-isisfish.error.not.support.class=this class does not support
+isisfish.error.not.support.class=La classe %s ne supporte pas les descritions
isisfish.error.number.classes.upper.zero=Error, the number of classes must be upper than 0
isisfish.error.obtain.analyseplan=Can't obtain description of AnalysePlan
isisfish.error.obtain.doc.export=Can't obtain @Doc on class Export
@@ -497,7 +496,7 @@
isisfish.log.tooltip.mailTo=Entrer l'adresse du destinataire du courriel
isisfish.log.tooltip.sendAll=Envoyer toute la simulation, ou uniquement le fichier de log
isisfish.log.tooltip.sendMail=Cliquer pour envoyer le courriel contentant les fichiers
-isisfish.message.add.objets.simulation=Add new objets simulation
+isisfish.message.add.objets.simulation=Ajout des nouveaux objets cr\u00E9\u00E9s durant la simulation
isisfish.message.backup.database.finished=backup database finished
isisfish.message.backup.database.progress=backup database in progress
isisfish.message.cancel.finished=Cancel finished
@@ -563,6 +562,7 @@
isisfish.message.setting.trace.aspects=Mise en place des aspects Trace
isisfish.message.simulation.ended=Simulation termin\u00E9e
isisfish.message.simulation.execution=Simulation execution
+isisfish.message.simulation.prepare=Pr\u00E9paration de la simulation
isisfish.message.tray.disabled=Icone de notification d\u00E9sactiv\u00E9e
isisfish.message.update.finished=Mise \u00E0 jour termin\u00E9e
isisfish.metier.comments=Commentaires
@@ -695,20 +695,20 @@
isisfish.port.name=Nom
isisfish.preScript.backParameter=Retour aux param\u00E8tres
isisfish.preScript.title=Script de pr\u00E9-simulation
-isisfish.queue.id=identifiant
+isisfish.queue.id=Identifiant
isisfish.queue.launcher=Lanceur de simulation
isisfish.queue.plan=Plan
isisfish.queue.progression=Progression
isisfish.queue.showLog=Voir les logs de la simulation
isisfish.queue.simulationLaunch=Lanceur de la queue des simulations
-isisfish.queue.status=Etat
-isisfish.queue.stopSimulation=Arreter la simulation
+isisfish.queue.status=\u00C9tat
+isisfish.queue.stopSimulation=Arr\u00EAter la simulation
isisfish.queue.title=Queue
isisfish.result.abundance=Abondance
isisfish.result.add=Ajouter un r\u00E9sultat\=
-isisfish.result.begin.simulation=En debut de Simulation\:
+isisfish.result.begin.simulation=En d\u00E9but de simulation\:
isisfish.result.capture=Capturer
-isisfish.result.capture.metier=Capturer par metier
+isisfish.result.capture.metier=Capturer par m\u00E9tier
isisfish.result.choose.simulation=Choisir une simulation
isisfish.result.datas=Donn\u00E9es
isisfish.result.datasRadioButton=defaultToolTip-fr.ifremer.resultat.ResultatEdit.donneeRadioButton
@@ -716,7 +716,7 @@
isisfish.result.dimension=Dimension
isisfish.result.end.simulation=En fin de Simulation\:
isisfish.result.export=Export
-isisfish.result.export.file=Exporter text file
+isisfish.result.export.file=Exporter un fichier texte
isisfish.result.file=Fichier
isisfish.result.graph=Graphe
isisfish.result.graphRadioButton=defaultToolTip-fr.ifremer.resultat.ResultatEdit.graphRadioButton
@@ -850,10 +850,7 @@
isisfish.simulator.launcher.inprocess=dans le m\u00EAme processus
isisfish.simulator.launcher.remote=sur un serveur distant
isisfish.simulator.launcher.subprocess=dans un sous processus
-isisfish.simulator.simulaction.init=Erreur d'initialisation de la simulation \: %s
-isisfish.simulator.simulaction.loadOldSimulation=Erreur lors du chargement d'une ancienne simulation \: %s
-isisfish.simulator.simulaction.regionChange=Erreur lors du changement de region \: %s
-isisfish.simulator.simulaction.viewlogerror=Erreur de visualisation des logs \: %s
+isisfish.simulator.simulaction.badid=Impossible de lancer la simulation '%s' \: l'identifiant existe d\u00E9j\u00E0 \!
isisfish.simulator.subprocess.readoutput.error=
isisfish.species.age=age
isisfish.species.cee=CEE
Modified: isis-fish/trunk/src/main/resources/log4j.properties
===================================================================
--- isis-fish/trunk/src/main/resources/log4j.properties 2008-12-17 13:11:32 UTC (rev 1677)
+++ isis-fish/trunk/src/main/resources/log4j.properties 2008-12-17 13:40:51 UTC (rev 1678)
@@ -6,12 +6,11 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.fr.ifremer.isisfish=INFO
+log4j.logger.fr.ifremer.isisfish=DEBUG
log4j.logger.org.codelutin=INFO
-log4j.logger.analyseplans=INFO
-log4j.logger.exports=INFO
-log4j.logger.formules=INFO
-log4j.logger.rules=INFO
-log4j.logger.scripts=INFO
-log4j.logger.simulators=INFO
-log4j.logger.fr.ifremer.isisfish.ui.input.InputNavigationTreeSelectionAdapter=DEBUG
+log4j.logger.analyseplans=DEBUG
+log4j.logger.exports=DEBUG
+log4j.logger.formules=DEBUG
+log4j.logger.rules=DEBUG
+log4j.logger.scripts=DEBUG
+log4j.logger.simulators=DEBUG
1
0
Author: chatellier
Date: 2008-12-17 13:11:32 +0000 (Wed, 17 Dec 2008)
New Revision: 1677
Modified:
isis-fish/trunk/pom.xml
Log:
Use topia-persistence 2.1.2
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2008-12-17 08:56:59 UTC (rev 1676)
+++ isis-fish/trunk/pom.xml 2008-12-17 13:11:32 UTC (rev 1677)
@@ -47,7 +47,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutinmatrix</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>${lutinmatrix.version}</version>
<scope>compile</scope>
</dependency>
@@ -314,10 +314,12 @@
<generator.version>0.63</generator.version>
<!-- topia version -->
- <topia.version>2.1.1</topia.version>
+ <topia.version>2.1.2-SNAPSHOT</topia.version>
<!-- lutinwidget version -->
<lutinwidget.version>0.11</lutinwidget.version>
+ <!-- lutinmatrix version -->
+ <lutinmatrix.version>1.2-SNAPSHOT</lutinmatrix.version>
<!--Main class in JAR -->
<maven.jar.main.class>fr.ifremer.isisfish.IsisFish</maven.jar.main.class>
@@ -410,7 +412,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutinmatrix</artifactId>
- <version>1.1</version>
+ <version>${lutinmatrix.version}</version>
</dependency>
</dependencies>
</plugin>
1
0
Author: chatellier
Date: 2008-12-17 08:56:59 +0000 (Wed, 17 Dec 2008)
New Revision: 1676
Modified:
isis-fish/trunk/pom.xml
Log:
Passage de lutinmatrix en snapshot pour test
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2008-12-16 16:01:32 UTC (rev 1675)
+++ isis-fish/trunk/pom.xml 2008-12-17 08:56:59 UTC (rev 1676)
@@ -47,7 +47,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutinmatrix</artifactId>
- <version>1.1</version>
+ <version>1.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
1
0
r1675 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org 16 Dec '08
by sletellier@users.labs.libre-entreprise.org 16 Dec '08
16 Dec '08
Author: sletellier
Date: 2008-12-16 16:01:32 +0000 (Tue, 16 Dec 2008)
New Revision: 1675
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
Log:
Interaction avec openMap
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2008-12-16 16:01:32 UTC (rev 1675)
@@ -54,10 +54,19 @@
import org.codelutin.topia.persistence.TopiaEntity;
import fr.ifremer.isisfish.entities.Zone;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import com.bbn.openmap.event.MapMouseListener;
+import com.bbn.openmap.event.SelectMouseMode;
+import fr.ifremer.isisfish.map.CellSelectionLayer;
+import java.util.logging.Level;
+import com.bbn.openmap.omGraphics.OMGraphic;
+import java.util.logging.Logger;
+import org.codelutin.topia.TopiaException;
+
protected IsisMapBean cellMap = new IsisMapBean();
protected OpenMapToolPanel toolMap = new OpenMapToolPanel();
protected OMToolSet toolSet = new OMToolSet();
+protected OpenMapEvents mapListener = null;
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
@@ -87,6 +96,9 @@
cellMap.setFisheryRegion(action.getFisheryRegion());
toolSet.setupListeners(cellMap);
toolMap.add((Component)toolSet);
+// cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
+// cellMap.setActiveMouseMode(new SelectMouseMode());
+ setMapListener();
cellMapPanel.add(toolMap, BorderLayout.NORTH);
cellMapPanel.add(cellMap, BorderLayout.CENTER);
@@ -95,7 +107,20 @@
}
setChanged(false);
}
+protected void setMapListener(){
+ if (mapListener == null){
+ mapListener = new OpenMapEvents(cellMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) {
+ @Override
+ public boolean onMouseClicked() {
+ for (Cell c : cellMap.getSelectedCells()){
+ getParentContainer(InputUI.class).setTreeSelection("$root/$cells/" + c.getTopiaId());
+ }
+ return true;
+ }
+ };
+ }
+}
protected void save() {
TopiaEntity topia = getContextValue(InputAction.class).save();
getParentContainer(InputUI.class).repaintNode("$root/$cells/" + topia.getTopiaId());
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/OpenMapEvents.java 2008-12-16 16:01:32 UTC (rev 1675)
@@ -0,0 +1,252 @@
+/* *##%
+* Copyright (C) 2005
+* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*##%*/
+
+/* *
+* OpenMapEvents.java
+*
+* Created: 5 septembre 2005 03:21:41 CEST
+*
+* @author Benjamin POUSSIN <poussin at codelutin.com>
+* @version $Revision: 202 $
+*
+* Last update: $Date: 2006-06-30 18:39:09 +0200 (ven, 30 jun 2006) $
+* by : $Author: bpoussin $
+*/
+
+package fr.ifremer.isisfish.ui.input;
+
+import java.awt.event.MouseEvent;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.bbn.openmap.Layer;
+import com.bbn.openmap.event.DistanceMouseMode;
+import com.bbn.openmap.event.MapMouseListener;
+import com.bbn.openmap.event.MapMouseMode;
+import com.bbn.openmap.event.NullMouseMode;
+import com.bbn.openmap.event.ProjectionEvent;
+import com.bbn.openmap.event.SelectMouseMode;
+
+import fr.ifremer.isisfish.map.IsisMapBean;
+
+public abstract class OpenMapEvents extends Layer implements MapMouseListener { // OpenMapEvents
+
+ /** */
+ private static final long serialVersionUID = -8365120112075269288L;
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(OpenMapEvents.class);
+
+ public OpenMapEvents (IsisMapBean map, MapMouseMode mouseMode, int selectMode){
+ super();
+ this.mouseMode = mouseMode;
+ this.map = map;
+ this.selectMode = selectMode;
+ map.setSelectionMode(selectMode);
+ map.setActiveMouseMode(mouseMode);
+ map.addMapMouseListener(this);
+
+ }
+ public void projectionChanged(ProjectionEvent e){
+ // do nothing, it's not reel layer
+ }
+
+ /**
+ * SelectMouseMode property: Null, Distance, Nav, Select
+ */
+ protected MapMouseMode mouseMode = null;
+ protected IsisMapBean map = null;
+ protected int selectMode = 1;
+
+ /**
+ * OnMouseDragged property.
+ */
+ protected String onMouseDragged = null;
+
+ /**
+ * Get onMouseDragged property.
+ *
+ *@return OnMouseDragged property.
+ */
+ public String getOnMouseDragged() {
+ return this.onMouseDragged;
+ }
+
+ /**
+ * Set onMouseDragged property.
+ *
+ *@param onMouseDragged New onMouseDragged property.
+ */
+ public void setOnMouseDragged(String onMouseDragged) {
+ this.onMouseDragged = onMouseDragged;
+ }
+
+ /**
+ * OnMouseEntered property.
+ */
+ protected String onMouseEntered = null;
+
+ /**
+ * Get onMouseEntered property.
+ *
+ *@return OnMouseEntered property.
+ */
+ public String getOnMouseEntered() {
+ return this.onMouseEntered;
+ }
+
+ /**
+ * Set onMouseEntered property.
+ *
+ *@param onMouseEntered New onMouseEntered property.
+ */
+ public void setOnMouseEntered(String onMouseEntered) {
+ this.onMouseEntered = onMouseEntered;
+ }
+
+ /**
+ * OnMouseExited property.
+ */
+ protected String onMouseExited = null;
+
+ /**
+ * Get onMouseExited property.
+ *
+ *@return OnMouseExited property.
+ */
+ public String getOnMouseExited() {
+ return this.onMouseExited;
+ }
+
+ /**
+ * Set onMouseExited property.
+ *
+ *@param onMouseExited New onMouseExited property.
+ */
+ public void setOnMouseExited(String onMouseExited) {
+ this.onMouseExited = onMouseExited;
+ }
+
+ /**
+ * OnMouseMoved property.
+ */
+ protected String onMouseMoved = null;
+
+ /**
+ * Get onMouseMoved property.
+ *
+ *@return OnMouseMoved property.
+ */
+ public String getOnMouseMoved() {
+ return this.onMouseMoved;
+ }
+
+ /**
+ * Set onMouseMoved property.
+ *
+ *@param onMouseMoved New onMouseMoved property.
+ */
+ public void setOnMouseMoved(String onMouseMoved) {
+ this.onMouseMoved = onMouseMoved;
+ }
+
+ /**
+ * OnMousePressed property.
+ */
+ protected String onMousePressed = null;
+
+ /**
+ * Get onMousePressed property.
+ *
+ *@return OnMousePressed property.
+ */
+ public String getOnMousePressed() {
+ return this.onMousePressed;
+ }
+
+ /**
+ * Set onMousePressed property.
+ *
+ *@param onMousePressed New onMousePressed property.
+ */
+ public void setOnMousePressed(String onMousePressed) {
+ this.onMousePressed = onMousePressed;
+ }
+
+ /**
+ * OnMouseReleased property.
+ */
+ protected String onMouseReleased = null;
+
+ /**
+ * Get onMouseReleased property.
+ *
+ *@return OnMouseReleased property.
+ */
+ public String getOnMouseReleased() {
+ return this.onMouseReleased;
+ }
+
+ /**
+ * Set onMouseReleased property.
+ *
+ *@param onMouseReleased New onMouseReleased property.
+ */
+ public void setOnMouseReleased(String onMouseReleased) {
+ this.onMouseReleased = onMouseReleased;
+ }
+
+ public String[] getMouseModeServiceList() {
+ return new String[] {
+ SelectMouseMode.modeID
+ };
+ }
+
+ public boolean mouseClicked(MouseEvent e){
+ onMouseClicked();
+ return true;
+ }
+
+ public boolean mouseDragged(MouseEvent e){
+ return false;
+ }
+
+ public void mouseEntered(MouseEvent e){
+ }
+
+ public void mouseExited(MouseEvent e) {
+ }
+
+ public void mouseMoved(){
+ }
+
+ public boolean mouseMoved(MouseEvent e){
+ return false;
+ }
+
+ public boolean mousePressed(MouseEvent e){
+ return false;
+ }
+
+ public boolean mouseReleased(MouseEvent e){
+ return false;
+ }
+
+ public abstract boolean onMouseClicked();
+} // OpenMapEvents
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2008-12-16 16:01:32 UTC (rev 1675)
@@ -51,12 +51,15 @@
import fr.ifremer.isisfish.map.OpenMapToolPanel;
import com.bbn.openmap.gui.OMToolSet;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
+ import fr.ifremer.isisfish.map.CellSelectionLayer;
+ import com.bbn.openmap.event.SelectMouseMode;
import org.codelutin.topia.persistence.TopiaEntity;
import org.codelutin.topia.TopiaException;
protected IsisMapBean portMap = new IsisMapBean();
protected OpenMapToolPanel toolMap = new OpenMapToolPanel();
protected OMToolSet toolSet = new OMToolSet();
+ protected OpenMapEvents mapListener = null;
public PortUI (InputAction action){
setContextValue(action);
@@ -75,13 +78,6 @@
portCell.setSelectedValue(port.getCell());
fieldPortComment.setText(getContextValue(InputAction.class).getPort().getComment());
-
- portMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion());
- toolSet.setupListeners(portMap);
- toolMap.add((Component)toolSet);
- portMapPanel.add(toolMap, BorderLayout.NORTH);
- portMapPanel.add(portMap, BorderLayout.CENTER);
- refreshMap();
}
else{
fieldPortName.setText("");
@@ -95,14 +91,15 @@
fieldPortComment.setText("");
- portMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion());
- toolSet.setupListeners(portMap);
- toolMap.add((Component)toolSet);
- portMapPanel.add(toolMap, BorderLayout.NORTH);
- portMapPanel.add(portMap, BorderLayout.CENTER);
- refreshMap();
}
+ portMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion());
+ toolSet.setupListeners(portMap);
+ toolMap.add((Component)toolSet);
+ setMapListener();
+ portMapPanel.add(toolMap, BorderLayout.NORTH);
+ portMapPanel.add(portMap, BorderLayout.CENTER);
+ refreshMap();
}
protected void refreshMap(){
java.util.List<Cell> cells = new ArrayList<Cell>();
@@ -110,6 +107,25 @@
portMap.setSelectedCells(cells);
portMap.setSelectedCells(cells);
}
+ protected void setMapListener(){
+ if (mapListener == null){
+ mapListener = new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) {
+
+ @Override
+ public boolean onMouseClicked() {
+ for (Cell c : portMap.getSelectedCells()){
+ Port port = getContextValue(InputAction.class).getPort();
+ if (port != null){
+ port.setCell(c);
+ }
+ }
+ valueChanged(true);
+ refresh();
+ return true;
+ }
+ };
+ }
+ }
protected void create(){
TopiaEntity topia = getContextValue(InputAction.class).create("Port");
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-16 16:01:32 UTC (rev 1675)
@@ -64,49 +64,10 @@
protected MapMouseListener mapListener = null;
public ZoneUI (InputAction action){
-
setContextValue(action);
- this.addFocusListener(new FocusListener() {
-
- @Override
- public void focusGained(FocusEvent e) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void focusLost(FocusEvent e) {;
- if (changed){
- if (!askAndSave()){
- getParentContainer(InputUI.class).setTreeSelection("$root/$zones"+getContextValue(InputAction.class).getZone().getTopiaId());
- }
- }
- }
- });
}
- protected boolean askAndSave(){
- boolean result = true;
- try {
- int choice = JOptionPane.showConfirmDialog(null, _("isisfish.message.page.modified"));
- switch (choice) {
- case JOptionPane.YES_OPTION:
- getContextValue(InputAction.class).getIsisContext().commitTransaction();
- result = true;
- break;
- case JOptionPane.NO_OPTION:
- getContextValue(InputAction.class).getIsisContext().rollbackTransaction();
- result = true;
- break;
- case JOptionPane.CANCEL_OPTION:
- result = false;
- break;
- };
- } catch (TopiaException ex) {
- Logger.getLogger(InputUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- return result;
- }
- public void refresh() {
- if (! getContextValue(InputAction.class).isNull()){
+ public void refresh() {
+ if (!getContextValue(InputAction.class).isNull()){
Zone z = getContextValue(InputAction.class).getZone();
DefaultListModel zoneCellsModel = new DefaultListModel();
java.util.List<Cell> cells = getContextValue(InputAction.class).getFisheryRegion().getCell();
@@ -143,79 +104,26 @@
zoneMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion());
toolSet.setupListeners(zoneMap);
toolMap.add((Component)toolSet);
- zoneMap.setActiveMouseMode(new SelectMouseMode());
- zoneMap.setSelectionMode(CellSelectionLayer.MULT_SELECTION);
setMapListener();
zoneMapPanel.add(toolMap, BorderLayout.NORTH);
zoneMapPanel.add(zoneMap, BorderLayout.CENTER);
- valueChanged(false);
refreshMap();
}
protected void setMapListener(){
if (mapListener == null){
- mapListener = new MapMouseListener() {
+ mapListener = new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) {
@Override
- public boolean mouseClicked(MouseEvent e) {
- java.util.List<Cell> cells = (java.util.List<Cell>) zoneMap.getSelectedCells();
- if (cells != null){
- int[] indexs = new int[cells.size()];
- int i = 0;
- for (Cell c : cells){
- indexs[i] = ((DefaultListModel)zoneCells.getModel()).indexOf(c);
- if (log.isDebugEnabled()) {
- log.debug("refresh " + c + " " + i);
- }
- i++;
- }
- zoneCells.setSelectedIndices(indexs);
+ public boolean onMouseClicked() {
+ java.util.List<Cell> selectedCell = zoneMap.getSelectedCells();
+ if (!getContextValue(InputAction.class).isNull()){
+ getContextValue(InputAction.class).getZone().setCell(selectedCell);
+ valueChanged(true);
+ refresh();
return true;
}
return false;
}
-
- @Override
- public String[] getMouseModeServiceList() {
- return new String[] {
- SelectMouseMode.modeID
- };
- }
-
- @Override
- public boolean mousePressed(MouseEvent arg0) {
- return false;
- }
-
- @Override
- public boolean mouseReleased(MouseEvent arg0) {
- return false;
- }
-
- @Override
- public void mouseEntered(MouseEvent arg0) {
-
- }
-
- @Override
- public void mouseExited(MouseEvent arg0) {
-
- }
-
- @Override
- public boolean mouseDragged(MouseEvent arg0) {
- return false;
- }
-
- @Override
- public boolean mouseMoved(MouseEvent arg0) {
- return false;
- }
-
- @Override
- public void mouseMoved() {
-
- }
};
- zoneMap.addMapMouseListener(mapListener);
}
}
protected void refreshMap(){
1
0
r1674 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui: . input simulator
by sletellier@users.labs.libre-entreprise.org 15 Dec '08
by sletellier@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: sletellier
Date: 2008-12-15 17:46:56 +0000 (Mon, 15 Dec 2008)
New Revision: 1674
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx
Log:
Debug vol4
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2008-12-15 11:42:44 UTC (rev 1673)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
@@ -33,15 +33,10 @@
<JPanel id='welcomePanelUI' layout='{new BorderLayout()}'>
<script><![CDATA[
import fr.ifremer.isisfish.ui.simulator.SimulAction;
- import static javax.swing.JOptionPane.showMessageDialog;
import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.ui.result.ResultAction;
- showMsgBox(simulUI.getContextValue(SimulAction.class).init());
- protected void showMsgBox(String txt){
- if (txt != null){
- showMessageDialog(this, txt);
- }
- }
+
+ simulUI.getContextValue(SimulAction.class).init();
]]>
</script>
<JTabbedPane id="simulTabs" tabPlacement='{JTabbedPane.LEFT}' constraints="BorderLayout.CENTER">
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2008-12-15 11:42:44 UTC (rev 1673)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
@@ -30,7 +30,7 @@
* by : $Author: sletellier $
*/
-->
-<JPanel id="input" visible="true" size='{new Dimension(700,500)}' layout='{new BorderLayout()}' location='{new Point(0,139)}'>
+<JPanel id="input" layout='{new BorderLayout()}'>
<javax.swing.tree.DefaultTreeSelectionModel id='navigationSelectionModel' selectionMode='{javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION}'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-15 11:42:44 UTC (rev 1673)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
@@ -48,6 +48,9 @@
import fr.ifremer.isisfish.entities.Port;
import fr.ifremer.isisfish.map.IsisMapBean;
import fr.ifremer.isisfish.map.OpenMapToolPanel;
+ import fr.ifremer.isisfish.map.CellSelectionLayer;
+ import com.bbn.openmap.event.SelectMouseMode;
+ import com.bbn.openmap.event.MapMouseListener;
import com.bbn.openmap.gui.OMToolSet;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import org.codelutin.topia.persistence.TopiaEntity;
@@ -58,6 +61,7 @@
protected IsisMapBean zoneMap = new IsisMapBean();
protected OpenMapToolPanel toolMap = new OpenMapToolPanel();
protected OMToolSet toolSet = new OMToolSet();
+ protected MapMouseListener mapListener = null;
public ZoneUI (InputAction action){
@@ -116,7 +120,7 @@
int i = 0;
for (Cell c : cellsSelected){
indexs[i] = zoneCellsModel.indexOf(c);
- if (log.isDebugEnabled()) {
+ if (log.isDebugEnabled()) {
log.debug("refresh " + c + " " + i);
}
i++;
@@ -139,17 +143,85 @@
zoneMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion());
toolSet.setupListeners(zoneMap);
toolMap.add((Component)toolSet);
+ zoneMap.setActiveMouseMode(new SelectMouseMode());
+ zoneMap.setSelectionMode(CellSelectionLayer.MULT_SELECTION);
+ setMapListener();
zoneMapPanel.add(toolMap, BorderLayout.NORTH);
zoneMapPanel.add(zoneMap, BorderLayout.CENTER);
valueChanged(false);
refreshMap();
}
+ protected void setMapListener(){
+ if (mapListener == null){
+ mapListener = new MapMouseListener() {
+ @Override
+ public boolean mouseClicked(MouseEvent e) {
+ java.util.List<Cell> cells = (java.util.List<Cell>) zoneMap.getSelectedCells();
+ if (cells != null){
+ int[] indexs = new int[cells.size()];
+ int i = 0;
+ for (Cell c : cells){
+ indexs[i] = ((DefaultListModel)zoneCells.getModel()).indexOf(c);
+ if (log.isDebugEnabled()) {
+ log.debug("refresh " + c + " " + i);
+ }
+ i++;
+ }
+ zoneCells.setSelectedIndices(indexs);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public String[] getMouseModeServiceList() {
+ return new String[] {
+ SelectMouseMode.modeID
+ };
+ }
+
+ @Override
+ public boolean mousePressed(MouseEvent arg0) {
+ return false;
+ }
+
+ @Override
+ public boolean mouseReleased(MouseEvent arg0) {
+ return false;
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent arg0) {
+
+ }
+
+ @Override
+ public void mouseExited(MouseEvent arg0) {
+
+ }
+
+ @Override
+ public boolean mouseDragged(MouseEvent arg0) {
+ return false;
+ }
+
+ @Override
+ public boolean mouseMoved(MouseEvent arg0) {
+ return false;
+ }
+
+ @Override
+ public void mouseMoved() {
+
+ }
+ };
+ zoneMap.addMapMouseListener(mapListener);
+ }
+ }
protected void refreshMap(){
- java.util.List<Cell> cells = new ArrayList<Cell>();
- for (Object o : zoneCells.getSelectedValues()){
- cells.add((Cell) o );
+ if (getContextValue(InputAction.class).getZone() != null){
+ zoneMap.setSelectedCells(getContextValue(InputAction.class).getZone().getCell());
}
- zoneMap.setSelectedCells(cells);
}
protected void create(){
TopiaEntity topia = getContextValue(InputAction.class).create("Zone");
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2008-12-15 11:42:44 UTC (rev 1673)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
@@ -89,7 +89,7 @@
if(selected != null && !selected.trim().isEmpty()) {
WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
root.setInfoText(_("isisfish.message.loading.region"));
- showMsgBox(getContextValue(SimulAction.class).regionChange(fieldSimulParamsRegion.getSelectedItem().toString()));
+ getContextValue(SimulAction.class).regionChange(fieldSimulParamsRegion.getSelectedItem().toString());
refresh();
root.setInfoText(_("isisfish.message.region.loaded"));
}
@@ -103,7 +103,7 @@
if (selected != null && !selected.equals(" ")){
WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
root.setInfoText(_("isisfish.message.loading.old.simulation"));
- showMsgBox(getContextValue(SimulAction.class).loadOldSimulation(selected));
+ getContextValue(SimulAction.class).loadOldSimulation(selected);
refresh();
root.setInfoText(_("isisfish.message.old.simulation.loaded"));
}
@@ -121,7 +121,7 @@
setRulesItems();
}
protected void simul(){
- showMsgBox(getContextValue(SimulAction.class).simul(fieldSimulParamsName.getText(), (SimulatorLauncher)comboSelLauncher.getSelectedItem()));
+ getContextValue(SimulAction.class).simul(fieldSimulParamsName.getText(), (SimulatorLauncher)comboSelLauncher.getSelectedItem());
SimulUI simul = getParentContainer(SimulUI.class);
simul.selTab(6);
}
@@ -148,13 +148,15 @@
}
listSimulParamsStrategies.setModel(listSimulParamsStrategiesModel);
java.util.List<Strategy> strategiesSelected = getContextValue(SimulAction.class).getSimulationParameter().getStrategies();
- int[] indexs = new int[listSimulParamsStrategiesModel.size()];
- int i = 0;
- for (Strategy s : strategiesSelected){
- indexs[i] = listSimulParamsStrategiesModel.indexOf(s);
- i++;
+ if (listSimulParamsStrategiesModel.size() != 0){
+ int[] indexs = new int[listSimulParamsStrategiesModel.size()];
+ int i = 0;
+ for (Strategy s : strategiesSelected){
+ indexs[i] = listSimulParamsStrategiesModel.indexOf(s);
+ i++;
+ }
+ listSimulParamsStrategies.setSelectedIndices(indexs);
}
- listSimulParamsStrategies.setSelectedIndices(indexs);
}
protected void setListSimulParamsPopulationsItems(){
DefaultListModel listSimulParamsPopulationsModel = new DefaultListModel();
@@ -164,14 +166,16 @@
}
listSimulParamsPopulations.setModel(listSimulParamsPopulationsModel);
java.util.List<Population> populationsSelected = getContextValue(SimulAction.class).getSimulationParameter().getPopulations();
- int[] indexs = new int[listSimulParamsPopulationsModel.size()];
- int i = 0;
- for (Population p : populationsSelected){
- indexs[i] = listSimulParamsPopulationsModel.indexOf(p);
- i++;
+ if (listSimulParamsPopulationsModel.size() != 0){
+ int[] indexs = new int[listSimulParamsPopulationsModel.size()];
+ int i = 0;
+ for (Population p : populationsSelected){
+ indexs[i] = listSimulParamsPopulationsModel.indexOf(p);
+ i++;
+ }
+ listSimulParamsPopulations.setSelectedIndices(indexs);
+ populationSelected();
}
- listSimulParamsPopulations.setSelectedIndices(indexs);
- populationSelected();
}
protected void setRulesItems(){
listSimulParamsMesuresList.setListData(getContextValue(SimulAction.class).getRules().toArray());
@@ -241,11 +245,6 @@
}
});
}
- protected void showMsgBox(String txt){
- if (txt != null){
- showMessageDialog(this, txt);
- }
- }
protected void selectFilter(){
try {
getContextValue(SimulAction.class).setOldSimulatorNames(fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil.filterSimulation(getContextValue(SimulAction.class).getOldSimulationItem()));
@@ -352,7 +351,7 @@
<JLabel text="isisfish.params.simulationName" minimumSize='{new Dimension(140,25)}' preferredSize='{new Dimension(140,25)}'/>
</cell>
<cell fill="both" weightx="1.0">
- <JTextField id="fieldSimulParamsName" onKeyPressed='saveName()'/>
+ <JTextField id="fieldSimulParamsName" onFocusLost='saveName()'/>
</cell>
</row>
</Table>
@@ -387,7 +386,7 @@
<row>
<cell columns="4" fill="both" weightx="1.0" weighty="0.3">
<JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTextArea id="fieldSimulParamsDesc" text='{getContextValue(SimulAction.class).getSimulationParameter().getDescription()}' onKeyPressed='saveDescription()'/>
+ <JTextArea id="fieldSimulParamsDesc" text='{getContextValue(SimulAction.class).getSimulationParameter().getDescription()}' onFocusLost='saveDescription()'/>
</JScrollPane>
</cell>
</row>
@@ -531,12 +530,15 @@
<cell>
<JLabel id="lblLauncher" text="isisfish.params.lblLauncher"/>
</cell>
- <cell fill="horizontal" weightx="0.5">
+ <cell fill="horizontal" weightx="0.4">
<JComboBox id="comboSelLauncher" model='{new DefaultComboBoxModel(getContextValue(SimulAction.class).getSimulationLauncher().toArray())}'/>
</cell>
- <cell fill="horizontal" weightx="0.5">
+ <cell fill="horizontal" weightx="0.4">
<JButton id="buttonSimulParamsSimulate" text="isisfish.common.simulate" onActionPerformed='simul()'/>
</cell>
+ <cell fill="horizontal" weightx="0.2">
+ <JButton id="saveSimul" text="isisfish.simulation.menu.save" onActionPerformed='getParentContainer(SimulUI.class).saveSimulation()'/>
+ </cell>
</row>
</Table>
</cell>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2008-12-15 11:42:44 UTC (rev 1673)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2008-12-15 17:46:56 UTC (rev 1674)
@@ -62,6 +62,7 @@
import fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher;
import fr.ifremer.isisfish.ui.Common;
import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil;
+import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
import fr.ifremer.isisfish.ui.widget.filter.FilterModel;
import java.io.BufferedReader;
import java.io.File;
@@ -107,7 +108,10 @@
public SimulAction() {
init();
}
- public String init(){
+ protected void showMsgBox(Exception eee){
+ ErrorDialogUI.showError(eee);
+ }
+ public void init(){
log.debug("Init ");
try {
param = new SimulationParameter();
@@ -127,39 +131,30 @@
}
catch (Exception eee) {
log.error("Can't init SimulationParameter", eee);
- return (_("isisfish.simulator.simulaction.init",eee.getMessage()));
+ showMsgBox(eee);
}
- return null;
}
protected void setName(String name){
simulName = name;
}
- protected String importSimulation(File f){
- String result = null;
+ protected void importSimulation(File f){
FileInputStream fos = null;
try {
fos = new FileInputStream(f);
- BufferedReader br = new BufferedReader(new InputStreamReader(fos));
- String line = br.readLine();
- if (line.matches("^#.*")){
- result = line.substring(1);
- }
-
Properties proper = new Properties();
proper.load(fos);
-// TODO : réparer
-// param.fromProperties(proper);
- simulName = result;
+ param.fromProperties(SimulationStorage.getSimulationDirectory(), proper);
} catch (Exception ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
} finally {
try {
fos.close();
} catch (IOException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
- return result;
}
protected void saveSimulation(File f){
FileOutputStream fos = null;
@@ -168,11 +163,13 @@
param.copy().toProperties().store(fos, simulName);
} catch (Exception ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
} finally {
try {
fos.close();
} catch (IOException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
}
@@ -196,6 +193,7 @@
} catch (Exception eee) {
if (log.isWarnEnabled()) {
log.warn("Can't find result name script", eee);
+ showMsgBox(eee);
}
}
return result;
@@ -206,15 +204,14 @@
log.info(_("User stop simulation %s", job.getItem().getControl().getId()));
}
- protected String viewLog(SimulationJob job) {
+ protected void viewLog(SimulationJob job) {
String id = job.getItem().getControl().getId();
try {
SimulationLoggerUtil.showSimulationLogConsole(id);
} catch (Exception eee) {
UserLog.error(_("Can't open log for %s", id), eee);
- return (_("isisfish.simulator.simulaction.viewlogerror",eee.getMessage()));
+ showMsgBox(eee);
}
- return null;
}
protected void clearDoneJobs() {
@@ -227,7 +224,7 @@
*
* @param regionName SimulationParameter/description
*/
- public String regionChange(String regionName) {
+ public void regionChange(String regionName) {
try{
regionStorage = RegionStorage.getRegion(regionName);
param.setRegionName(regionName);
@@ -236,9 +233,8 @@
}
}
catch (Exception eee){
- return (_("isisfish.simulator.simulaction.regionChange",eee.getMessage()));
+ showMsgBox(eee);
}
- return null;
}
/**
@@ -247,7 +243,7 @@
* @param simulName name of simulation to load
* @return <code>null</code> if ok, an OutputView otherwise with error
*/
- public String loadOldSimulation(String simulName) {
+ public void loadOldSimulation(String simulName) {
log.debug("call loadOldSimulation: " + simulName);
try {
this.simulName = simulName;
@@ -258,9 +254,8 @@
regionStorage = param.getRegion();
} catch (Exception eee) {
log.error("Can't load old Simulation: " + simulName, eee);
- return (_("isisfish.simulator.simulaction.loadOldSimulation",eee.getMessage()));
+ showMsgBox(eee);
}
- return null;
}
/*
@@ -279,6 +274,7 @@
param.addRule(ruleTmp);
} catch (IsisFishException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
public List<String> getRuleNames() {
@@ -295,6 +291,7 @@
result.add(RuleStorage.getName(r));
} catch (Exception ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
return result;
@@ -335,6 +332,7 @@
result = RuleStorage.getParameterValue(getRule(ruleName), paramName);
} catch (IsisFishException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
return result;
@@ -345,6 +343,7 @@
RuleStorage.setParameterValue(getRule(ruleName), paramName, o);
} catch (IsisFishException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
}
@@ -357,6 +356,7 @@
result = RegionStorage.getFisheryRegion(param.getRegion().getStorage().beginTransaction()).getStrategy();
} catch (Exception ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
return result;
}
@@ -381,6 +381,7 @@
}
} catch (Exception ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
return result;
}
@@ -433,8 +434,10 @@
return oldSimulNames;
} catch (ParseException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
} catch (IOException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
return null;
}
@@ -533,6 +536,7 @@
getSimulationParameter().addAnalysePlan(ap);
} catch (IsisFishException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
public void removeAnalysePlan(String name){
@@ -569,6 +573,7 @@
result = AnalysePlanStorage.getParameterValue(getAnalysePlan(analysePlanName), paramName);
} catch (IsisFishException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
return result;
@@ -579,6 +584,7 @@
AnalysePlanStorage.setParameterValue(getAnalysePlan(analysePlanName), paramName, o);
} catch (IsisFishException ex) {
Logger.getLogger(SimulAction.class.getName()).log(Level.SEVERE, null, ex);
+ showMsgBox(ex);
}
}
}
@@ -615,7 +621,7 @@
* @param simulId id of the simulation to simulate
* @param inQueue flag to say put in queue
*/
- public String simul(String simulId, SimulatorLauncher launcher) {
+ public void simul(String simulId, SimulatorLauncher launcher) {
simulId += " " + dateFormat.format(new java.util.Date());
log.debug("call simulate");
try {
@@ -630,8 +636,7 @@
}
} catch (Exception eee) {
log.error("Can't start simulation", eee);
- return ("Error.xml" + "error" + eee.getMessage());
+ showMsgBox(eee);
}
- return null;
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2008-12-15 11:42:44 UTC (rev 1673)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulUI.jaxx 2008-12-15 17:46:56 UTC (rev 1674)
@@ -34,8 +34,8 @@
<script><![CDATA[
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
- public SimulUI(SimulAction action){
-
+
+ public SimulUI(SimulAction action){
setContextValue(action);
}
protected void enablePreSimul(){
@@ -65,22 +65,21 @@
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
//This is where a real application would open the file.
- String name = getContextValue(SimulAction.class).importSimulation(file);
+ getContextValue(SimulAction.class).importSimulation(file);
refreshAll();
- paramsUI.setName(name);
}
}
protected void saveSimulation(){
JFileChooser fc = new JFileChooser();
- int returnVal = fc.showOpenDialog(null);
+ int returnVal = fc.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
//This is where a real application would open the file.
-// getContextValue(SimulAction.class).saveSimulation(file);
- Element result = DocumentHelper.createElement("simul");
- result.add(paramsUI.save());
- System.out.println(result.asXML());
+ getContextValue(SimulAction.class).saveSimulation(file);
+// Element result = DocumentHelper.createElement("simul");
+// result.add(paramsUI.save());
+// System.out.println(result.asXML());
}
}
]]>
1
0
r1673 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org 15 Dec '08
by chatellier@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: chatellier
Date: 2008-12-15 11:42:44 +0000 (Mon, 15 Dec 2008)
New Revision: 1673
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
Log:
Add hibernate big hack to unset parameters topiaId
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2008-12-15 11:41:36 UTC (rev 1672)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2008-12-15 11:42:44 UTC (rev 1673)
@@ -21,23 +21,9 @@
import static org.codelutin.i18n.I18n._;
-import fr.ifremer.isisfish.IsisConfig;
-import fr.ifremer.isisfish.IsisFish;
-import fr.ifremer.isisfish.IsisFishRuntimeException;
-import fr.ifremer.isisfish.aspect.AspectClassLoader;
-import fr.ifremer.isisfish.aspect.Cache;
-import fr.ifremer.isisfish.aspect.Trace;
-import fr.ifremer.isisfish.datastore.SimulationStorage;
-import fr.ifremer.isisfish.datastore.SimulatorStorage;
-import fr.ifremer.isisfish.simulator.SimulationContext;
-import fr.ifremer.isisfish.simulator.SimulationControl;
-import fr.ifremer.isisfish.simulator.SimulationException;
-import fr.ifremer.isisfish.simulator.SimulationExportResultWrapper;
-import fr.ifremer.isisfish.simulator.SimulationListener;
-import fr.ifremer.isisfish.simulator.SimulationParameter;
-import fr.ifremer.isisfish.simulator.SimulationPreScript;
-import fr.ifremer.isisfish.simulator.Simulator;
import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
@@ -45,6 +31,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
import org.apache.commons.lang.time.DurationFormatUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -56,6 +43,24 @@
import org.codelutin.util.ObjectUtil;
import org.codelutin.util.StringUtil;
+import fr.ifremer.isisfish.IsisConfig;
+import fr.ifremer.isisfish.IsisFish;
+import fr.ifremer.isisfish.IsisFishRuntimeException;
+import fr.ifremer.isisfish.aspect.AspectClassLoader;
+import fr.ifremer.isisfish.aspect.Cache;
+import fr.ifremer.isisfish.aspect.Trace;
+import fr.ifremer.isisfish.datastore.SimulationStorage;
+import fr.ifremer.isisfish.datastore.SimulatorStorage;
+import fr.ifremer.isisfish.rule.Rule;
+import fr.ifremer.isisfish.simulator.SimulationContext;
+import fr.ifremer.isisfish.simulator.SimulationControl;
+import fr.ifremer.isisfish.simulator.SimulationException;
+import fr.ifremer.isisfish.simulator.SimulationExportResultWrapper;
+import fr.ifremer.isisfish.simulator.SimulationListener;
+import fr.ifremer.isisfish.simulator.SimulationParameter;
+import fr.ifremer.isisfish.simulator.SimulationPreScript;
+import fr.ifremer.isisfish.simulator.Simulator;
+
/**
* Fait une simulation dans la meme jvm
*
@@ -229,6 +234,26 @@
// forceReload, save all modification in parameter and reread it
parameters = simulation.getForceReloadParameter();
+ // Rule modification
+ List<Rule> rules = parameters.getRules();
+ for (Rule rule : rules) {
+ // FIXME fix hibernate bug
+ // org.hibernate.HibernateException: Found shared references to a collection
+ // to not have same loaded entity into different context !
+ Field[] fields = rule.getClass().getFields();
+ for(Field field : fields) {
+ if(Modifier.isPublic(field.getModifiers())) {
+ log.debug("change field is " + field.getName() + "(set topiaId = null)");
+ Object fieldValue = field.get(rule);
+ if(fieldValue instanceof TopiaEntity) {
+ TopiaEntity valueEntity = (TopiaEntity)fieldValue;
+ valueEntity.setTopiaId(null);
+ field.set(rule, valueEntity);
+ }
+ }
+ }
+ }
+
//
// Activation de l'OAP demandée
//
@@ -304,14 +329,13 @@
//
SimulationContext context = SimulationContext.get();
- TopiaContext tx;
context.closeDB();
context.closeDBResult();
try {
// close all transaction
- if (context != null && context.getSimulationStorage() != null) {
+ if (context.getSimulationStorage() != null) {
context.getSimulationStorage().closeMemStorage();
context.getSimulationStorage().closeStorage();
}
1
0