Isis-fish-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- 3175 discussions
r1729 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org 12 Jan '09
by sletellier@users.labs.libre-entreprise.org 12 Jan '09
12 Jan '09
Author: sletellier
Date: 2009-01-12 15:01:10 +0000 (Mon, 12 Jan 2009)
New Revision: 1729
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/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/GearUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.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/SetOfVesselsUI.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/StrategyMonthInfoUI.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/StrategyUI.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/VesselTypeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
Log:
Debug
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -69,11 +69,14 @@
}
}
});
-
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh() {
Cell cell = (Cell)getVerifier().getEntity(Cell.class);
setBean((CellImpl) cell);
- jaxx.runtime.swing.Utils.fillComboBox(fieldCell,getRegion().getCell(), cell);
+ jaxx.runtime.swing.Utils.fillComboBox(fieldCell,getRegion().getCell(), getBean());
cellMap.setFisheryRegion(getRegion());
if (mapListener == null){
cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
@@ -83,8 +86,8 @@
setMapListener();
}
- if (cell != null){
- cellMap.setSelectedCells(cell);
+ if (getBean() != null){
+ cellMap.setSelectedCells(getBean());
}
}
protected void setMapListener(){
@@ -170,10 +173,10 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save' text='isisfish.common.save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel' text='isisfish.common.cancel'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -69,11 +69,17 @@
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh(){
SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class);
setBean((SetOfVesselsImpl) setOfVessels);
- jaxx.runtime.swing.Utils.fillList(fieldEffortDescriptionMetierList,getRegion().getMetier(), null);
- setEffortDescriptionEffortDescriptionList();
+ if (getBean() != null){
+ jaxx.runtime.swing.Utils.fillList(fieldEffortDescriptionMetierList,getRegion().getMetier(), null);
+ setEffortDescriptionEffortDescriptionList();
+ }
}
protected void setEffortDescriptionEffortDescriptionList(){
jaxx.runtime.swing.Utils.fillList(fieldEffortDescriptionEffortDescriptionList,getBean().getPossibleMetiers(), null);
@@ -216,10 +222,10 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.3'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.3'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
<cell fill='horizontal' weightx='0.3'>
<JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
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 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -49,7 +49,10 @@
setButtonTitle("isisfish.input.continueCells");
setNextPath("$root/$cells");
-getVerifier().addSaveButton(save);
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save, false);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh(){
setBean(null);
FisheryRegion region = (FisheryRegion) getVerifier().getEntity(FisheryRegion.class);
@@ -243,10 +246,10 @@
</row>
<row>
<cell fill='horizontal' weightx='0.3'>
- <JButton id='save' text="isisfish.common.save" enabled='false' onActionPerformed='save()'/>
+ <JButton id='save' enabled='false' onActionPerformed='save()'/>
</cell>
<cell fill='horizontal' weightx='0.3'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
<cell fill='horizontal' weightx='0.3'>
<JButton id='check' text="isisfish.common.check" onActionPerformed='check()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -63,6 +63,12 @@
}
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Gear");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh() {
Gear gear = (Gear)getVerifier().getEntity(Gear.class);
setBean((GearImpl) gear);
@@ -102,7 +108,7 @@
<JLabel text="isisfish.gear.technicalParameter" enabled='{isActif()}'/>
</cell>
<cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearParamName" text='{jaxx.runtime.Util.getStringValue(getBean().getParameterName())}' onKeyReleased='getBean().setParameterName(fieldGearParamName.getSelectedText())' enabled='{isActif()}'/>
+ <JTextField id="fieldGearParamName" text='{jaxx.runtime.Util.getStringValue(getBean().getParameterName())}' onKeyReleased='getBean().setParameterName(fieldGearParamName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -134,18 +140,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getNewButton("Gear")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -41,6 +41,7 @@
import fr.ifremer.isisfish.entities.Metier;
setButtonTitle("isisfish.input.continueMetiers");
setNextPath("$root/$metiers");
+gearTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
getVerifier().addCurrentPanel(gearTabUI, selectivityUI);
gearTabUI.refresh();
@@ -48,7 +49,7 @@
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
- <JTabbedPane constraints='BorderLayout.CENTER' id="GearTab" name="Gear">
+ <JTabbedPane constraints='BorderLayout.CENTER' id="gearTab" name="Gear">
<tab title='{_("isisfish.gear.title")}'><GearTabUI id="gearTabUI" constructorParams='this'/></tab>
<tab title='{_("isisfish.selectivity.title")}'><SelectivityUI id="selectivityUI" constructorParams='this'/></tab>
</JTabbedPane>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-01-12 15:01:10 UTC (rev 1729)
@@ -48,6 +48,11 @@
import static fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil.selectSimulation;
import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
import fr.ifremer.isisfish.util.CellPointcomparator;
+import java.beans.PropertyChangeListener;
+import java.beans.VetoableChangeListener;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.lang.ClassUtils;
import org.apache.commons.logging.Log;
@@ -56,6 +61,7 @@
import org.codelutin.math.matrix.MatrixFactory;
import org.codelutin.math.matrix.MatrixND;
import org.codelutin.topia.TopiaContext;
+import org.codelutin.topia.TopiaException;
import org.codelutin.topia.persistence.TopiaDAO;
import org.codelutin.topia.persistence.TopiaEntity;
import org.codelutin.util.FileUtil;
@@ -326,10 +332,10 @@
regionStorage = RegionStorage.getRegion(name);
isisContext = regionStorage.getStorage().beginTransaction();
fisheryRegion = RegionStorage.getFisheryRegion(isisContext);
+ ui.setContextValue(regionStorage);
+ ui.setContextValue(isisContext);
+ ui.setContextValue(fisheryRegion);
}
- ui.setContextValue(regionStorage);
- ui.setContextValue(isisContext);
- ui.setContextValue(fisheryRegion);
} catch (Exception eee) {
log.error("Can't load region", eee);
showMsgBox(eee);
@@ -715,30 +721,36 @@
}
// Population
-
- public Population createPopulation(Species species) {
+ public Species getSpeciesByTopiaId(TopiaContext context, String topiaId){
+ Species result = null;
+ try {
+ SpeciesDAO dao = IsisFishDAOHelper.getSpeciesDAO(context);
+ result = dao.findByTopiaId(topiaId);
+ } catch (TopiaException ex) {
+ Logger.getLogger(InputAction.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return result;
+ }
+ public Population createPopulation(TopiaContext context, Species species) {
if (log.isTraceEnabled()) {
log.trace("create called");
}
try {
String name = "Population_new";
-
- PopulationDAO dao = IsisFishDAOHelper.getPopulationDAO(species.getTopiaContext());
+
+ PopulationDAO dao = IsisFishDAOHelper.getPopulationDAO(context);
Population pop = dao.create();
pop.setName(name);
-
+
species.addPopulation(pop);
pop.setSpecies(species);
+ species.update();
pop.update();
-// population = pop;
-// population.update();
- species.update();
- species.getTopiaContext().commitTransaction();
+ context.commitTransaction();
return pop;
} catch (Exception eee) {
log.error("Can't create Population", eee);
showMsgBox(eee);
-// return new OutputView("Error.xml", "error", eee.getMessage());
}
return null;
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -12,8 +12,8 @@
<script><![CDATA[
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import fr.ifremer.isisfish.entities.FisheryRegion;
-public void refresh(){
-}
+import org.codelutin.topia.persistence.TopiaEntity;
+public void refresh(){}
public InputAction getAction() {
return getContextValue(InputAction.class);
}
@@ -29,6 +29,8 @@
protected void goTo(){
getParentContainer(InputUI.class).setTreeSelection(getNextPath());
}
+public void setInputSaveVerifierBinding(){}
+public void setBean(TopiaEntity t){};
]]>
</script>
<JPanel id='body' constraints='BorderLayout.CENTER'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2009-01-12 15:01:10 UTC (rev 1729)
@@ -96,8 +96,8 @@
try {
currentUI = (InputContentUI) newUI;
InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
- verif.removeAllPanels();
verif.addCurrentPanel(currentUI);
+ currentUI.setInputSaveVerifierBinding();
currentUI.refresh();
currentNode = node;
} catch (Exception e) {
@@ -122,6 +122,9 @@
else if (responce == JOptionPane.CANCEL_OPTION){
exit = false;
}
+ if (exit){
+ verif.removeAllPanels();
+ }
return exit;
}
@@ -131,12 +134,12 @@
log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass()));
}
InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
-
+ verif.setRootPanel((InputUI)context);
verif.removeAllEntity();
- verif.setRootPanel((InputUI)context);
if (TopiaEntity.class.isInstance(data)){
verif.addCurrentEntity((TopiaEntity) data);
}
+ verif.setPanelsActifs();
verif.setCurrentNode(node);
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-01-12 15:01:10 UTC (rev 1729)
@@ -13,13 +13,9 @@
import java.beans.PropertyChangeListener;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.swing.JButton;
import javax.swing.JOptionPane;
-import javax.swing.tree.TreePath;
import jaxx.runtime.JAXXAction;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXInitialContext;
@@ -39,11 +35,42 @@
* @author letellier
*/
public class InputSaveVerifier implements JAXXAction {
- protected Map<JButton, String> listNewButton = new HashMap<JButton, String>();
- protected List<JButton> listDeleteButton = new ArrayList<JButton>();
- protected List<JButton> listSaveButton = new ArrayList<JButton>();
- protected List<JButton> listCancelButton = new ArrayList<JButton>();
+ protected JButton currentNewButton = null;
+ protected JButton currentDeleteButton = null;
+ protected JButton currentSaveButton = null;
+ protected JButton currentCancelButton = null;
+
+ protected ActionListener saveListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaSave();
+ }
+ };
+ protected ActionListener cancelListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaCancel();
+ }
+ };
+ protected ActionListener newListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaCreate();
+ }
+ };
+ protected ActionListener deleteListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaRemove();
+ }
+ };
+
+ protected String type = null;
+
protected boolean editable = false;
protected boolean changed = false;
@@ -91,22 +118,21 @@
protected void topiaChanged(){
changed = true;
setPanelsActifs();
- setEnabled(listSaveButton, true);
- setEnabled(listCancelButton, true);
- setEnabled(listNewButton.keySet(), false);
- setEnabled(listDeleteButton, false);
+ setEnabled(currentSaveButton, true);
+ setEnabled(currentCancelButton, true);
+ setEnabled(currentNewButton, false);
+ setEnabled(currentDeleteButton, false);
}
protected void noModif(){
changed = false;
setPanelsActifs();
- setEnabled(listSaveButton, false);
- setEnabled(listCancelButton, false);
- setEnabled(listNewButton.keySet(), true);
- setEnabled(listDeleteButton, true);
+ setEnabled(currentSaveButton, false);
+ setEnabled(currentCancelButton, false);
+ setEnabled(currentNewButton, true);
+ setEnabled(currentDeleteButton, true);
}
-
- protected void setEnabled(Collection<JButton> buttons, boolean enabled){
- for (JButton b : buttons){
+ protected void setEnabled(JButton b, boolean enabled){
+ if (b != null){
b.setEnabled(enabled);
}
}
@@ -130,7 +156,9 @@
ArrayList<TopiaEntity> allWillBeRemoved = new ArrayList<TopiaEntity>();
for (TopiaEntity te : currentEntities){
allWillBeRemoved.add(te);
- allWillBeRemoved.addAll(te.getComposite());
+ if (te.getComposite() != null){
+ allWillBeRemoved.addAll(te.getComposite());
+ }
}
if (allWillBeRemoved.size() > 0) {
String text = _(
@@ -152,7 +180,6 @@
if (doDelete) {
for (TopiaEntity te : allWillBeRemoved){
te.delete();
- System.out.println(te.getTopiaContext());
}
isisContext.commitTransaction();
msg = _("isisfish.message.remove.finished");
@@ -165,14 +192,13 @@
}
rootUI.setInfoText(msg);
String path = currentNode.getParent().getContextPath();
- System.out.println(path);
rootUI.setTreeModel();
rootUI.setTreeSelection(path);
noModif();
}
- protected void topiaCreate(String type){
+ protected void topiaCreate(){
if (log.isTraceEnabled()) {
log.trace("create called for " + type);
@@ -195,7 +221,6 @@
if (!editable){
path = currentNode.getContextPath() + "/" + entity.getTopiaId();
}
- System.out.println(path);
rootUI.setTreeModel();
rootUI.setTreeSelection(path);
@@ -259,14 +284,6 @@
}
}
}
- protected void setPanelsActifs(boolean b){
- if (!currentPanels.isEmpty()){
- for (InputContentUI panel : currentPanels){
- System.out.println("panel : "+ panel);
- panel.setActif(b);
- }
- }
- }
protected void refreshAll(){
for (InputContentUI panel : currentPanels){
panel.refresh();
@@ -283,12 +300,8 @@
}
});
this.currentEntities.add(currentEntity);
- System.out.println("currentEntity : "+ currentEntity);
setPanelsActifs();
}
- else{
- editable = false;
- }
}
public void removeAllEntity(){
currentEntities.clear();
@@ -296,13 +309,11 @@
noModif();
setPanelsActifs();
}
- public void addCurrentPanel(InputContentUI... currentPanels) {
- if (currentPanels != null){
- for (InputContentUI ui : currentPanels){
- this.currentPanels.add(ui);
- }
- setPanelsActifs();
+ public void addCurrentPanel(InputContentUI... panels) {
+ for (InputContentUI ui : panels){
+ this.currentPanels.add(ui);
}
+ setPanelsActifs();
}
public void removeAllPanels(){
currentPanels.clear();
@@ -312,63 +323,51 @@
return editable;
}
- public JButton getCancelButton() {
- JButton cancelButton = new JButton(_("isisfish.common.cancel"));
- cancelButton.setEnabled(false);
- cancelButton.addActionListener(new ActionListener() {
+ public void setSaveButton(JButton saveButton){
+ setSaveButton(saveButton, true);
+ }
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaCancel();
- }
- });
- listCancelButton.add(cancelButton);
- return cancelButton;
+ public void setNewButton(JButton saveButton, String name){
+ setNewButton(saveButton, name, true);
}
- public JButton getDeleteButton() {
- JButton deleteButton = new JButton(_("isisfish.common.remove"));
- deleteButton.addActionListener(new ActionListener() {
+ public void setSaveButton(JButton saveButton, Boolean listener){
+ if (listener){
+ saveButton.removeActionListener(saveListener);
+ saveButton.addActionListener(saveListener);
+ }
+ saveButton.setEnabled(changed);
+ saveButton.setText(_("isisfish.common.save"));
+ this.currentSaveButton = saveButton;
+ }
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaRemove();
- }
- });
- listDeleteButton.add(deleteButton);
- return deleteButton;
+ public void setCancelButton(JButton cancelButton){
+ cancelButton.removeActionListener(cancelListener);
+ cancelButton.addActionListener(cancelListener);
+ cancelButton.setText(_("isisfish.common.cancel"));
+ cancelButton.setEnabled(changed);
+ this.currentCancelButton = cancelButton;
}
- public JButton getNewButton(String type) {
- JButton newButton = new JButton(_("isisfish.common.new"));
- newButton.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaCreate(listNewButton.get(e.getSource()));
- }
- });
- listNewButton.put(newButton, type);
- return newButton;
+ public void setNewButton(JButton newButton, String t, Boolean listener){
+ if (listener){
+ newButton.removeActionListener(newListener);
+ newButton.addActionListener(newListener);
+ }
+ newButton.setText(_("isisfish.common.new"));
+ newButton.setEnabled(!changed);
+ this.type = t;
+ this.currentNewButton = newButton;
}
- public JButton getSaveButton() {
- JButton saveButton = new JButton(_("isisfish.common.save"));
- saveButton.setEnabled(false);
- saveButton.addActionListener(new ActionListener(){
-
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaSave();
- }
-
- });
- listSaveButton.add(saveButton);
- return saveButton;
+ public void setDeleteButton(JButton deleteButton){
+ deleteButton.removeActionListener(deleteListener);
+ deleteButton.addActionListener(deleteListener);
+ deleteButton.setEnabled(!changed);
+ deleteButton.setText(_("isisfish.common.remove"));
+ this.currentDeleteButton = deleteButton;
}
- public void addSaveButton(JButton saveButton){
- listSaveButton.add(saveButton);
- }
+
public TopiaContext getIsisContext() {
return isisContext;
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-01-12 15:01:10 UTC (rev 1729)
@@ -16,22 +16,38 @@
* @author letellier
*/
public class InputTabbedPaneListener implements ChangeListener{
+ protected int cacheSelectedIndex = -1;
+
@Override
public void stateChanged(ChangeEvent e) {
try {
JTabbedPane pane = (JTabbedPane)e.getSource();
- int cacheSelectedIndex = pane.getSelectedIndex();
- InputContentUI ui = (InputContentUI) pane.getSelectedComponent();
- if (!closeUI(e, ui)) {
+ pane.removeChangeListener(this);
+ int selectedIndex = pane.getSelectedIndex();
+ if (cacheSelectedIndex != -1){
pane.setSelectedIndex(cacheSelectedIndex);
}
+ InputContentUI ui = (InputContentUI) pane.getSelectedComponent();
+ if (closeUI(ui)) {
+ pane.setSelectedIndex(selectedIndex);
+ }
+ ui = (InputContentUI) pane.getSelectedComponent();
+ ui.setInputSaveVerifierBinding();
+ ui.refresh();
+ cacheSelectedIndex = pane.getSelectedIndex();
+ pane.addChangeListener(this);
} catch (Exception ex) {
Logger.getLogger(MetierUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
- protected boolean closeUI(ChangeEvent event, InputContentUI context) throws Exception {
+ /*
+ * Ask you to save if modification are made
+ * @param ui selected
+ * @return true to change tab
+ */
+ protected boolean closeUI(InputContentUI context) throws Exception {
boolean exit = true;
// by default, we says that component was succesfull closed
InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -237,19 +237,6 @@
</JScrollPane>
</JPanel>
</JPanel>
- <JPanel id="inputPane" layout='{cardlayout}'>
- <!--JLabel id='none' horizontalAlignment="0" text="isisfish.input.selectNodeTree" constraints='"none"'/>
- <CellUI id='cellUI' constraints='"Cell"' constructorParams='getContextValue(InputAction.class)'/>
- <ZoneUI id='zoneUI' constraints='"Zone"' constructorParams='getContextValue(InputAction.class)'/>
- <PortUI id='portUI' constraints='"Port"' constructorParams='getContextValue(InputAction.class)'/>
- <SpeciesUI id='speciesUI' constraints='"Species"' constructorParams='getContextValue(InputAction.class)'/>
- <PopulationUI id='populationUI' constraints='"Population"' constructorParams='getContextValue(InputAction.class)'/>
- <GearUI id='gearUI' constraints='"Gear"' constructorParams='getContextValue(InputAction.class)'/>
- <MetierUI id='metierUI' constraints='"Metier"' constructorParams='getContextValue(InputAction.class)'/>
- <TripTypeUI id='tripTypeUI' constraints='"TripType"' constructorParams='getContextValue(InputAction.class)'/>
- <VesselTypeUI id='vesselTypeUI' constraints='"VesselType"' constructorParams='getContextValue(InputAction.class)'/>
- <SetOfVesselsUI id='setOfVesselsUI' constraints='"SetOfVessels"' constructorParams='getContextValue(InputAction.class)'/>
- <StrategyUI id='strategyUI' constraints='"Strategy"' constructorParams='getContextValue(InputAction.class)'/-->
- </JPanel>
+ <JPanel id="inputPane" layout='{cardlayout}'/>
</JSplitPane>
</JPanel>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -38,125 +38,130 @@
<script><![CDATA[
- import com.l2fprod.common.swing.renderer.BooleanCellRenderer;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import fr.ifremer.isisfish.entities.Equation;
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.entities.Metier;
- import fr.ifremer.isisfish.entities.MetierImpl;
- import fr.ifremer.isisfish.entities.MetierSeasonInfo;
- import fr.ifremer.isisfish.entities.TargetSpecies;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import javax.swing.table.DefaultTableModel;
- import fr.ifremer.isisfish.entities.Species;
- import org.codelutin.topia.TopiaContext;
- import javax.swing.table.TableCellEditor;
+import com.l2fprod.common.swing.renderer.BooleanCellRenderer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.Metier;
+import fr.ifremer.isisfish.entities.MetierImpl;
+import fr.ifremer.isisfish.entities.MetierSeasonInfo;
+import fr.ifremer.isisfish.entities.TargetSpecies;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor;
+import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import org.codelutin.topia.persistence.TopiaEntity;
+import javax.swing.table.DefaultTableModel;
+import fr.ifremer.isisfish.entities.Species;
+import org.codelutin.topia.TopiaContext;
+import javax.swing.table.TableCellEditor;
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
+ public void refresh() {
getVerifier().addCurrentPanel(targetFactor);
- public void refresh() {
- Metier metier = (Metier)getVerifier().getEntity(Metier.class);
- setBean((MetierImpl) metier);
- if (getBean() != null){
- if (fieldMetierSeasonInfo.getSelectedIndex() <= 0){
- setSeasonModel();
- }
- else {
- setTableTargetSpeciesModel();
- }
- if (fieldTargetSpecies.getSelectedIndex() <= 0){
- setTargetSpeciesModel();
- }
-
+ Metier metier = (Metier)getVerifier().getEntity(Metier.class);
+ setBean((MetierImpl) metier);
+ if (getBean() != null){
+ if (fieldMetierSeasonInfo.getSelectedIndex() <= 0){
+ setSeasonModel();
+ }
+ else {
+ setTableTargetSpeciesModel();
+ }
+ if (fieldTargetSpecies.getSelectedIndex() <= 0){
+ setTargetSpeciesModel();
+ }
+
// TODO : Equation selectionne
- targetFactor.init(_("isisfish.metierSeasonInfoSpecies.targetFactor"), null, "TargetSpeciesTargetFactorEquation", fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class);
- targetFactor.refresh();
- }
- else{
- DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
- fieldMetierSeasonInfo.setModel(seasonModel);
- setTargetSpeciesModel();
- }
- }
- protected void setSeasonModel(){
+ targetFactor.init(_("isisfish.metierSeasonInfoSpecies.targetFactor"), null, "TargetSpeciesTargetFactorEquation", fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class);
+ targetFactor.refresh();
+ }
+ else{
DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
- java.util.List<MetierSeasonInfo> metierSeasonInfo = getBean().getMetierSeasonInfo();
- if (metierSeasonInfo != null){
- seasonModel.addElement(new GenericCell(" ", null, null));
- for (MetierSeasonInfo m : metierSeasonInfo){
- seasonModel.addElement(new GenericCell(m.getFirstMonth().toString() + "-" + m.getLastMonth().toString(), m, MetierSeasonInfo.class));
- }
- }
fieldMetierSeasonInfo.setModel(seasonModel);
- }
- protected void setTargetSpeciesModel(){
- DefaultComboBoxModel fieldTargetSpeciesModel = new DefaultComboBoxModel();
- java.util.List<Species> species = getRegion().getSpecies();
- if (species != null){
- fieldTargetSpeciesModel.addElement(new GenericCell(" ", null, null));
- for (Species s : species){
- fieldTargetSpeciesModel.addElement(new GenericCell(s.getName(), s, Species.class));
- }
+ setTargetSpeciesModel();
+ }
+}
+protected void setSeasonModel(){
+ DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
+ java.util.List<MetierSeasonInfo> metierSeasonInfo = getBean().getMetierSeasonInfo();
+ if (metierSeasonInfo != null){
+ seasonModel.addElement(new GenericCell(" ", null, null));
+ for (MetierSeasonInfo m : metierSeasonInfo){
+ seasonModel.addElement(new GenericCell(m.getFirstMonth().toString() + "-" + m.getLastMonth().toString(), m, MetierSeasonInfo.class));
}
- fieldTargetSpecies.setModel(fieldTargetSpeciesModel);
- }
- protected void setTableTargetSpeciesModel(){
- DefaultTableModel model = new DefaultTableModel(){
- @Override
- public boolean isCellEditable(int row, int column) {
- boolean result = false;
- if (column > 0){
- result =true;
- }
- return result;
+ }
+ fieldMetierSeasonInfo.setModel(seasonModel);
+}
+protected void setTargetSpeciesModel(){
+ DefaultComboBoxModel fieldTargetSpeciesModel = new DefaultComboBoxModel();
+ java.util.List<Species> species = getRegion().getSpecies();
+ if (species != null){
+ fieldTargetSpeciesModel.addElement(new GenericCell(" ", null, null));
+ for (Species s : species){
+ fieldTargetSpeciesModel.addElement(new GenericCell(s.getName(), s, Species.class));
+ }
+ }
+ fieldTargetSpecies.setModel(fieldTargetSpeciesModel);
+}
+protected void setTableTargetSpeciesModel(){
+ DefaultTableModel model = new DefaultTableModel(){
+ @Override
+ public boolean isCellEditable(int row, int column) {
+ boolean result = false;
+ if (column > 0){
+ result =true;
}
- };
- Object season = ((GenericCell)fieldMetierSeasonInfo.getSelectedItem()).getValue();
- if (season != null){
- Collection<TargetSpecies> targetSpecies = ((MetierSeasonInfo)season).getSpeciesTargetSpecies();
- if (targetSpecies != null){
- ArrayList <GenericCell> species = new ArrayList <GenericCell>();
- ArrayList <Equation> equations = new ArrayList <Equation>();
- ArrayList <Boolean> primaryCatch = new ArrayList <Boolean>();
- for (TargetSpecies t : targetSpecies){
- Species s = t.getSpecies();
- Equation e = t.getTargetFactorEquation();
- Boolean b = t.getPrimaryCatch();
- species.add(new GenericCell(s.getName(),s,Species.class));
- equations.add(e);
- primaryCatch.add(b);
- }
- model.addColumn("Species", species.toArray());
- model.addColumn("Target factor", equations.toArray());
- model.addColumn("Main species for the metier", primaryCatch.toArray());
+ return result;
}
- tableTargetSpecies.setModel(model);
- EquationTableEditor cellEditor = new EquationTableEditor();
- tableTargetSpecies.getColumnModel().getColumn(1).setCellEditor(cellEditor);
+ };
+ Object season = ((GenericCell)fieldMetierSeasonInfo.getSelectedItem()).getValue();
+ if (season != null){
+ Collection<TargetSpecies> targetSpecies = ((MetierSeasonInfo)season).getSpeciesTargetSpecies();
+ if (targetSpecies != null){
+ ArrayList <GenericCell> species = new ArrayList <GenericCell>();
+ ArrayList <Equation> equations = new ArrayList <Equation>();
+ ArrayList <Boolean> primaryCatch = new ArrayList <Boolean>();
+ for (TargetSpecies t : targetSpecies){
+ Species s = t.getSpecies();
+ Equation e = t.getTargetFactorEquation();
+ Boolean b = t.getPrimaryCatch();
+ species.add(new GenericCell(s.getName(),s,Species.class));
+ equations.add(e);
+ primaryCatch.add(b);
+ }
+ model.addColumn("Species", species.toArray());
+ model.addColumn("Target factor", equations.toArray());
+ model.addColumn("Main species for the metier", primaryCatch.toArray());
}
+ tableTargetSpecies.setModel(model);
+ EquationTableEditor cellEditor = new EquationTableEditor();
+ tableTargetSpecies.getColumnModel().getColumn(1).setCellEditor(cellEditor);
}
- protected void add(){
- Object season = ((GenericCell)fieldMetierSeasonInfo.getSelectedItem()).getValue();
- Object species = ((GenericCell)fieldTargetSpecies.getSelectedItem()).getValue();
- if (season != null && species != null){
- getContextValue(InputAction.class).addTargetSpecies(
- getBean(),
- (MetierSeasonInfo)season,
- (Species)species,
- targetFactor.getEditor().getText(),
- fieldPrimaryCatch.isSelected());
- refresh();
- }
- }
- protected void remove(){
+}
+protected void add(){
+ Object season = ((GenericCell)fieldMetierSeasonInfo.getSelectedItem()).getValue();
+ Object species = ((GenericCell)fieldTargetSpecies.getSelectedItem()).getValue();
+ if (season != null && species != null){
+ getContextValue(InputAction.class).addTargetSpecies(
+ getBean(),
+ (MetierSeasonInfo)season,
+ (Species)species,
+ targetFactor.getEditor().getText(),
+ fieldPrimaryCatch.isSelected());
refresh();
}
- protected void metierSeasonChanged(){
- setTableTargetSpeciesModel();
- }
+}
+protected void remove(){
+ refresh();
+}
+protected void metierSeasonChanged(){
+ setTableTargetSpeciesModel();
+}
]]></script>
<Table id='body'>
<row>
@@ -167,7 +172,7 @@
<JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason"/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldMetierSeasonInfo" onActionPerformed='metierSeasonChanged()'/>
+ <JComboBox id="fieldMetierSeasonInfo" onActionPerformed='metierSeasonChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -175,7 +180,7 @@
<JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies"/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldTargetSpecies"/>
+ <JComboBox id="fieldTargetSpecies" enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -188,7 +193,7 @@
<JPanel/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies"/>
+ <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies" enabled='{isActif()}'/>
</cell>
</row>
</Table>
@@ -199,27 +204,27 @@
<Table>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonMetierSpeciesAddTargetSpecies" text="isisfish.common.add" onActionPerformed='add()'/>
+ <JButton id="buttonMetierSpeciesAddTargetSpecies" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
</cell>
</row>
<row>
<cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTable id="tableTargetSpecies"/>
+ <JTable id="tableTargetSpecies" enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
<row>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonMetierSpeciesRemoveTargetSpecies" text="isisfish.common.remove" onActionPerformed='remove()'/>
+ <JButton id="buttonMetierSpeciesRemoveTargetSpecies" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -83,6 +83,13 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "MetierSeasonInfo");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh() {
Metier metier = (Metier)getVerifier().getEntity(Metier.class);
setBean((MetierImpl) metier);
@@ -262,18 +269,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("MetierSeasonInfo")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -48,6 +48,12 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Metier");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh() {
try {
Metier metier = (Metier)getVerifier().getEntity(Metier.class);
@@ -127,18 +133,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("Metier")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -43,9 +43,9 @@
setButtonTitle("isisfish.input.continueTripTypes");
setNextPath("$root/$tripTypes");
-
+metierTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
- getVerifier().addCurrentPanel(metierTabUI, metierSeasonSpeciesUI, metierSeasonInfoUI);
+ getVerifier().addCurrentPanel(metierTabUI, metierSeasonInfoUI, metierSeasonSpeciesUI);
metierTabUI.refresh();
metierSeasonSpeciesUI.refresh();
metierSeasonInfoUI.setSeasonInit(true);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -47,8 +47,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;
+import org.codelutin.topia.persistence.TopiaEntity;
-getVerifier().addCurrentPanel(growthEquation, growthReverseEquation);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -59,20 +59,25 @@
fieldPopulationBasicsNbClasses.setText("");
fieldPopulationBasicsComment.setText("");
fieldPopulationBasicsMatureClass.setSelectedItem(null);
- getVerifier().setPanelsActifs(false);
}
if (evt.getNewValue() != null) {
// add binding on getBean()
- //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
- getVerifier().setPanelsActifs(true);
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text")
}
}
});
- public void refresh(){
- Population population = (Population)getVerifier().getEntity(Population.class);
- setBean((PopulationImpl) population);
- getVerifier().setEditable(true);
- getVerifier().setPanelsActifs();
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Population", false);
+ getVerifier().setDeleteButton(remove);
+}
+public void refresh(){
+ getVerifier().addCurrentPanel(growthEquation, growthReverseEquation);
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ if (getBean() != null){
// TODO : Selection equation
growthEquation.init(_("isisfish.populationBasics.growth"), getBean().getGrowth(), "PopulationGrowth", fr.ifremer.isisfish.equation.PopulationGrowth.class);
growthReverseEquation.init(_("isisfish.populationBasics.growthReverse"), getBean().getGrowthReverse(), "PopulationGrowthReverse", fr.ifremer.isisfish.equation.PopulationGrowthReverse.class);
@@ -83,49 +88,60 @@
setTableAgeLengthModel();
}
}
- protected void createClasses(){
- JFrame wizardFrame = new JFrame();
- wizardFrame.setLayout(new BorderLayout());
- WizardGroupCreationUI wizard = new WizardGroupCreationUI(getContextValue(InputAction.class), this);
- wizardFrame.add(wizard, BorderLayout.CENTER);
- wizardFrame.setTitle(_("isisfish.wizardGroupCreation.title"));
- wizardFrame.setVisible(true);
- wizardFrame.pack();
- wizard.setAgeType(getBean().getSpecies().getAgeGroupType());
- if (wizard.isAgeType()) {
- wizard.setCard("singleGroupAge");
- } else {
- wizard.setCard("beginGroupLength");
- }
- refresh();
+}
+protected void createClasses(){
+ JFrame wizardFrame = new JFrame();
+ wizardFrame.setLayout(new BorderLayout());
+ WizardGroupCreationUI wizard = new WizardGroupCreationUI(getContextValue(InputAction.class), this);
+ wizardFrame.add(wizard, BorderLayout.CENTER);
+ wizardFrame.setTitle(_("isisfish.wizardGroupCreation.title"));
+ wizardFrame.setVisible(true);
+ wizardFrame.pack();
+ wizard.setAgeType(getBean().getSpecies().getAgeGroupType());
+ if (wizard.isAgeType()) {
+ wizard.setCard("singleGroupAge");
+ } else {
+ wizard.setCard("beginGroupLength");
}
- protected void matureClassChanged(){
- Object selected = fieldPopulationBasicsMatureClass.getSelectedItem();
- if (selected != null){
- getBean().setMaturityGroup((PopulationGroup) selected);
- }
+ refresh();
+}
+protected void matureClassChanged(){
+ Object selected = fieldPopulationBasicsMatureClass.getSelectedItem();
+ if (selected != null){
+ getBean().setMaturityGroup((PopulationGroup) selected);
}
- protected void setTableAgeLengthModel(){
- java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup();
- if (popGroup != null){
- DefaultTableModel model = new DefaultTableModel(2, popGroup.size() + 1);
- model.setValueAt("Age", 0, 0);
- model.setValueAt("Lengths", 1, 0);
- int cnt = 1;
- for (PopulationGroup pg : popGroup){
- model.setValueAt(pg.getAge(), 0, cnt);
- model.setValueAt(pg.getLength(), 1, cnt);
- cnt++;
- }
- tableAgeLength.setModel(model);
+}
+protected void setTableAgeLengthModel(){
+ java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup();
+ if (popGroup != null){
+ DefaultTableModel model = new DefaultTableModel(2, popGroup.size() + 1);
+ model.setValueAt("Age", 0, 0);
+ model.setValueAt("Lengths", 1, 0);
+ int cnt = 1;
+ for (PopulationGroup pg : popGroup){
+ model.setValueAt(pg.getAge(), 0, cnt);
+ model.setValueAt(pg.getLength(), 1, cnt);
+ cnt++;
}
+ tableAgeLength.setModel(model);
}
- protected String getSizePopulationGroup(){
- if (getBean() != null){
- return String.valueOf(getBean().sizePopulationGroup());
- }
- return "";
+}
+protected String getSizePopulationGroup(){
+ if (getBean() != null){
+ return String.valueOf(getBean().sizePopulationGroup());
}
+ return "";
+}
+protected void create(){
+ Species species = getAction().getSpeciesByTopiaId(getVerifier().getIsisContext(), getVerifier().getCurrentNode().getParent().getNavigationPath());
+ System.out.println(species);
+ TopiaEntity topia = getContextValue(InputAction.class).createPopulation(getVerifier().getIsisContext(), species);
+
+ getParentContainer(InputUI.class).setTreeModel();
+ getParentContainer(InputUI.class).setTreeSelection("$root/$species/"+ species.getTopiaId() +"/$populations/"+topia.getTopiaId());
+
+ setInfoText(_("isisfish.message.creation.finished"));
+}
]]>
</script>
<Table id='body'>
@@ -212,18 +228,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("Population")'/>
+ <JButton id='create' onActionPerformed='create()'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -57,6 +57,11 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
@@ -94,10 +99,10 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -43,6 +43,10 @@
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.PopulationImpl;
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
@@ -74,10 +78,10 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -67,6 +67,11 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
@@ -148,10 +153,10 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -50,7 +50,7 @@
setPopInfo((PopulationSeasonInfoImpl)pi);
}
public void refresh(){
- Population population = (Population)getVerifier().getEntity(Population.class);
+ Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
getVerifier().addCurrentPanel(migrationEquation, emigrationEquation, immigrationEquation);
migrationEquation.init(_("isisfish.common.migration"), (Formule)getPopInfo().getMigrationEquation(), "Migration", fr.ifremer.isisfish.equation.MigrationEquation.class);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -45,7 +45,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-getVerifier().addCurrentPanel(populationMigrationEquationUI, populationMigrationMigrationUI, populationMigrationImmigrationUI, populationMigrationEmigrationUI);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -59,7 +58,13 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh(){
+ getVerifier().addCurrentPanel(populationMigrationEquationUI, populationMigrationMigrationUI, populationMigrationImmigrationUI, populationMigrationEmigrationUI);
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
setFieldPopulationMigrationSeasonChooserModel();
@@ -146,10 +151,10 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -59,6 +59,10 @@
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh() {
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
@@ -120,10 +124,10 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -82,6 +82,13 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "PopulationSeasonInfo");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
@@ -178,18 +185,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("PopulationSeasonInfo")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -48,9 +48,9 @@
setButtonTitle("isisfish.input.continueGears");
setNextPath("$root/$gears");
-getVerifier().addCurrentPanel(populationBasicsUI, populationGroupUI, populationEquationUI, populationZoneUI, populationSeasonsUI, populationCapturabilityUI, populationRecruitementUI, populationMigrationUI);
-
+populationTab.addChangeListener(new InputTabbedPaneListener());
public void refresh(){
+ getVerifier().addCurrentPanel(populationBasicsUI, populationGroupUI, populationEquationUI, populationZoneUI, populationSeasonsUI, populationCapturabilityUI, populationRecruitementUI, populationMigrationUI);
populationBasicsUI.refresh();
populationGroupUI.refresh();
populationEquationUI.refresh();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -60,6 +60,11 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
@@ -190,12 +195,12 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
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 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -74,6 +74,12 @@
}
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Port");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh() {
Port port = (Port)getVerifier().getEntity(Port.class);
setBean((PortImpl) port);
@@ -155,18 +161,18 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("Port")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -38,87 +38,93 @@
<script>
<![CDATA[
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.Gear;
- import fr.ifremer.isisfish.entities.Species;
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor;
- import javax.swing.table.DefaultTableModel;
- import fr.ifremer.isisfish.entities.Selectivity;
- import fr.ifremer.isisfish.entities.GearImpl;
- import fr.ifremer.isisfish.entities.Equation;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import org.codelutin.topia.TopiaContext;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.entities.Metier;
- import fr.ifremer.isisfish.entities.MetierImpl;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.Gear;
+import fr.ifremer.isisfish.entities.Species;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor;
+import javax.swing.table.DefaultTableModel;
+import fr.ifremer.isisfish.entities.Selectivity;
+import fr.ifremer.isisfish.entities.GearImpl;
+import fr.ifremer.isisfish.entities.Equation;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.codelutin.topia.TopiaContext;
+import org.codelutin.topia.persistence.TopiaEntity;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.entities.Metier;
+import fr.ifremer.isisfish.entities.MetierImpl;
- public void refresh(){
- InputAction action = getAction();
- setBean(null);
- Gear gear = (Gear)getVerifier().getEntity(Gear.class);
- setBean((GearImpl) gear);
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
+public void refresh(){
+ getVerifier().addCurrentPanel(selectivityEquation);
+ InputAction action = getAction();
+ setBean(null);
+ Gear gear = (Gear)getVerifier().getEntity(Gear.class);
+ setBean((GearImpl) gear);
+ if (getBean() != null){
fieldSelectivityPopulation.setModel(getSelectivityPopulationModel());
setSelectivityTableModel();
-
- getVerifier().addCurrentPanel(selectivityEquation);
+ }
+
// TODO : Equation selection
- selectivityEquation.init(_("isisfish.selectivity.equation"), null, "SelectivityEquation", fr.ifremer.isisfish.equation.SelectivityEquation.class);
- selectivityEquation.refresh();
- }
- protected void setSelectivityTableModel(){
- DefaultTableModel model = new DefaultTableModel(){
- @Override
- public boolean isCellEditable(int row, int column) {
- boolean result = false;
- if (column > 0){
- result =true;
- }
- return result;
+ selectivityEquation.init(_("isisfish.selectivity.equation"), null, "SelectivityEquation", fr.ifremer.isisfish.equation.SelectivityEquation.class);
+ selectivityEquation.refresh();
+}
+protected void setSelectivityTableModel(){
+ DefaultTableModel model = new DefaultTableModel(){
+ @Override
+ public boolean isCellEditable(int row, int column) {
+ boolean result = false;
+ if (column > 0){
+ result =true;
}
- };
- Collection<Selectivity> selectivity = getBean().getPopulationSelectivity();
- java.util.List<Population> populations = new ArrayList<Population>();
- java.util.List<Equation> equations = new ArrayList<Equation>();
- if (selectivity != null){
- for (Selectivity s : selectivity){
- populations.add(s.getPopulation());
- equations.add(s.getEquation());
+ return result;
}
+ };
+ Collection<Selectivity> selectivity = getBean().getPopulationSelectivity();
+ java.util.List<Population> populations = new ArrayList<Population>();
+ java.util.List<Equation> equations = new ArrayList<Equation>();
+ if (selectivity != null){
+ for (Selectivity s : selectivity){
+ populations.add(s.getPopulation());
+ equations.add(s.getEquation());
}
- model.addColumn("Population", populations.toArray());
- model.addColumn("Equation", equations.toArray());
+ }
+ model.addColumn("Population", populations.toArray());
+ model.addColumn("Equation", equations.toArray());
- selectivityTable.setModel(model);
- EquationTableEditor cellEditor = new EquationTableEditor();
- selectivityTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
- }
- protected DefaultComboBoxModel getSelectivityPopulationModel(){
- java.util.List<Species> species = getRegion().getSpecies();
- DefaultComboBoxModel selectivityPopulationModel = new DefaultComboBoxModel();
- if (species != null){
- selectivityPopulationModel.addElement(new GenericCell(" ", null, null));
- for (Species s : species){
- if (s.getPopulation() != null){
- for (Population p : s.getPopulation()){
- selectivityPopulationModel.addElement(new GenericCell(p.getName(), p, Population.class));
- }
+ selectivityTable.setModel(model);
+ EquationTableEditor cellEditor = new EquationTableEditor();
+ selectivityTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
+}
+protected DefaultComboBoxModel getSelectivityPopulationModel(){
+ java.util.List<Species> species = getRegion().getSpecies();
+ DefaultComboBoxModel selectivityPopulationModel = new DefaultComboBoxModel();
+ if (species != null){
+ selectivityPopulationModel.addElement(new GenericCell(" ", null, null));
+ for (Species s : species){
+ if (s.getPopulation() != null){
+ for (Population p : s.getPopulation()){
+ selectivityPopulationModel.addElement(new GenericCell(p.getName(), p, Population.class));
}
}
}
- return selectivityPopulationModel;
}
- protected void add(){
- getAction().addSelectivity((Population) ((GenericCell) fieldSelectivityPopulation.getSelectedItem()).getValue(), selectivityEquation.getEditor().getText(), getBean());
- refresh();
- }
- protected void remove(){
- getAction().removeSelectivity(getBean(), (Selectivity) getBean().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0)));
- refresh();
- }
+ return selectivityPopulationModel;
+}
+protected void add(){
+ getAction().addSelectivity((Population) ((GenericCell) fieldSelectivityPopulation.getSelectedItem()).getValue(), selectivityEquation.getEditor().getText(), getBean());
+ refresh();
+}
+protected void remove(){
+ getAction().removeSelectivity(getBean(), (Selectivity) getBean().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0)));
+ refresh();
+}
]]>
</script>
<Table id='body'>
@@ -163,10 +169,10 @@
</row>
<row>
<cell fill='horizontal' weightx='1.0'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
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 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -48,7 +48,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-getVerifier().addCurrentPanel(technicalEfficiency);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -65,14 +64,24 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "SetOfVessels");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh() {
+ getVerifier().addCurrentPanel(technicalEfficiency);
SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class);
setBean((SetOfVesselsImpl) setOfVessels);
- jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsPort,getRegion().getPort(), getBean().getPort());
- jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsVesselType,getRegion().getVesselType(), getBean().getVesselType());
+ if (getBean() != null){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsPort,getRegion().getPort(), getBean().getPort());
+ jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsVesselType,getRegion().getVesselType(), getBean().getVesselType());
- technicalEfficiency.init(_("isisfish.setOfVessels.technicalEfficiency"), (Formule)getBean().getTechnicalEfficiencyEquation(), "SoVTechnicalEfficiencyEquation", fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class);
- technicalEfficiency.refresh();
+ technicalEfficiency.init(_("isisfish.setOfVessels.technicalEfficiency"), (Formule)getBean().getTechnicalEfficiencyEquation(), "SoVTechnicalEfficiencyEquation", fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class);
+ technicalEfficiency.refresh();
+ }
}
]]>
</script>
@@ -143,18 +152,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='1.0'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='1.0'>
- <JButton id='create' javaBean='getVerifier().getNewButton("SetOfVessels")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -41,6 +41,7 @@
setButtonTitle("isisfish.input.continueStrategies");
setNextPath("$root/$strategies");
+setOfVesselsTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
getVerifier().addCurrentPanel(setOfVesselsTabsUI, effortDescriptionUI);
setOfVesselsTabsUI.refresh();
@@ -48,7 +49,7 @@
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
- <JTabbedPane id="SetOfVesselsTab" name="SetOfVessels" constraints='BorderLayout.CENTER'>
+ <JTabbedPane id="setOfVesselsTab" name="SetOfVessels" constraints='BorderLayout.CENTER'>
<tab title='{_("isisfish.setOfVessels.title")}'><SetOfVesselsTabsUI id='setOfVesselsTabsUI' constructorParams='this'/></tab>
<tab title='{_("isisfish.effortDescription.title")}'><EffortDescriptionUI id='effortDescriptionUI' constructorParams='this'/></tab>
</JTabbedPane>
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 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -62,6 +62,12 @@
}
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Species");
+ getVerifier().setDeleteButton(delete);
+}
public void refresh() {
Species species = (Species)getVerifier().getEntity(Species.class);
setBean((SpeciesImpl) species);
@@ -134,18 +140,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("Species")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='delete'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -36,8 +36,12 @@
<script><![CDATA[
import fr.ifremer.isisfish.types.Month;
-getVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, strategyApril, strategyMay, strategyJune, strategyJuly, strategyAugust, strategySeptember, strategyOctober, strategyNovember, strategyDecember);
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+}
public void refresh() {
+ getVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, strategyApril, strategyMay, strategyJune, strategyJuly, strategyAugust, strategySeptember, strategyOctober, strategyNovember, strategyDecember);
strategyJanuary.init(Month.JANUARY);
strategyFebuary.init(Month.FEBRUARY);
strategyMarch.init(Month.MARCH);
@@ -118,10 +122,10 @@
<Table constraints='BorderLayout.SOUTH'>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
</Table>
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 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -63,14 +63,22 @@
}
}
});
+
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Strategy");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh() {
+ getVerifier().addCurrentPanel(strategyInactivity);
Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class);
setBean((StrategyImpl) strategy);
- getVerifier().addCurrentPanel(strategyInactivity);
- strategyInactivity.init("", (Formule)getBean().getInactivityEquation(), "StrategyInactivityEquation", fr.ifremer.isisfish.equation.StrategyInactivityEquation.class);
- strategyInactivity.refresh();
-
- setSetOfVesselsModel();
+ if (getBean() != null){
+ strategyInactivity.init("", (Formule)getBean().getInactivityEquation(), "StrategyInactivityEquation", fr.ifremer.isisfish.equation.StrategyInactivityEquation.class);
+ strategyInactivity.refresh();
+ setSetOfVesselsModel();
+ }
}
protected void setSetOfVesselsModel(){
jaxx.runtime.swing.Utils.fillComboBox(fieldStrategySetOfVessels,getRegion().getSetOfVessels(), getBean().getSetOfVessels());
@@ -135,18 +143,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("Strategy")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -37,6 +37,7 @@
<fr.ifremer.isisfish.ui.input.InputContentUI>
<script><![CDATA[
+strategyTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
getVerifier().addCurrentPanel(strategyTabUI, strategyMonthInfoUI);
strategyTabUI.refresh();
@@ -44,7 +45,7 @@
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
- <JTabbedPane id="StrategyTab" name="Strategy" constraints='BorderLayout.CENTER'>
+ <JTabbedPane id="strategyTab" name="Strategy" constraints='BorderLayout.CENTER'>
<tab title='{_("isisfish.strategy.title")}'><StrategyTabUI id='strategyTabUI' constructorParams='this'/></tab>
<tab title='{_("isisfish.strategyMonthInfo.title")}'><StrategyMonthInfoUI id='strategyMonthInfoUI' constructorParams='this'/></tab>
</JTabbedPane>
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 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -61,6 +61,12 @@
}
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "TripType");
+ getVerifier().setDeleteButton(delete);
+}
public void refresh() {
TripType tripType = (TripType)getVerifier().getEntity(TripType.class);
setBean((TripTypeImpl) tripType);
@@ -113,18 +119,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getNewButton("TripType")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='delete'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -65,6 +65,12 @@
}
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "VesselType");
+ getVerifier().setDeleteButton(delete);
+}
public void refresh() {
VesselType vesselType = (VesselType)getVerifier().getEntity(VesselType.class);
setBean((VesselTypeImpl) vesselType);
@@ -112,7 +118,7 @@
<JLabel text="isisfish.vesselType.maxDuration" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeMaxTripDuration" text='{getBean().getMaxTripDuration().getHour()}' enabled='{isActif()}' onKeyReleased='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText())))'/>
+ <JTextField id="fieldVesselTypeMaxTripDuration" text='{getBean().getMaxTripDuration().getHour()}' enabled='{isActif()}' onKeyReleased='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText()) * 3600))'/>
</cell>
</row>
<row>
@@ -167,18 +173,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("VesselType")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='delete'/>
</cell>
</row>
</Table>
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 2009-01-09 10:16:12 UTC (rev 1728)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2009-01-12 15:01:10 UTC (rev 1729)
@@ -69,6 +69,12 @@
}
});
+public void setInputSaveVerifierBinding(){
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Zone");
+ getVerifier().setDeleteButton(remove);
+}
public void refresh() {
setBean(null);
Zone zone = (Zone)getVerifier().getEntity(Zone.class);
@@ -158,18 +164,18 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton("Zone")'/>
+ <JButton id='create'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton id='remove'/>
</cell>
</row>
</Table>
1
0
Author: sletellier
Date: 2009-01-09 10:16:12 +0000 (Fri, 09 Jan 2009)
New Revision: 1728
Modified:
isis-fish/trunk/pom.xml
Log:
Ajout de saveVerfier et utilisation des binding JAXX
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-01-09 10:15:59 UTC (rev 1727)
+++ isis-fish/trunk/pom.xml 2009-01-09 10:16:12 UTC (rev 1728)
@@ -324,7 +324,7 @@
<!-- Custom version -->
<jaxx.version>1.0-SNAPSHOT</jaxx.version>
<generator.version>0.63</generator.version>
- <topia.version>2.1.2-SNAPSHOT</topia.version>
+ <topia.version>2.1.1</topia.version>
<lutinwidget.version>0.12-SNAPSHOT</lutinwidget.version>
<lutinmatrix.version>1.2-SNAPSHOT</lutinmatrix.version>
<openmap.version>4.6.4</openmap.version>
1
0
r1727 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish
by sletellier@users.labs.libre-entreprise.org 09 Jan '09
by sletellier@users.labs.libre-entreprise.org 09 Jan '09
09 Jan '09
Author: sletellier
Date: 2009-01-09 10:15:59 +0000 (Fri, 09 Jan 2009)
New Revision: 1727
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java
Log:
Ajout de saveVerfier et utilisation des binding JAXX
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2009-01-09 10:15:37 UTC (rev 1726)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2009-01-09 10:15:59 UTC (rev 1727)
@@ -31,6 +31,7 @@
package fr.ifremer.isisfish;
+import java.awt.event.WindowEvent;
import static org.codelutin.i18n.I18n._;
import java.io.File;
@@ -76,6 +77,7 @@
import fr.ifremer.isisfish.vcs.VCSException;
import fr.ifremer.isisfish.vcs.VCSFactory;
import fr.ifremer.isisfish.vcs.VetoableActionListener;
+import java.awt.event.WindowListener;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
@@ -417,7 +419,38 @@
// lauch first UI (welcomeUI)
WelcomeUI welcome = new WelcomeUI();
// Set to exit on close
- welcome.setDefaultCloseOperation(WelcomeUI.EXIT_ON_CLOSE);
+ welcome.setDefaultCloseOperation(WelcomeUI.DO_NOTHING_ON_CLOSE);
+ welcome.addWindowListener(new WindowListener() {
+
+ @Override
+ public void windowOpened(WindowEvent e) {
+ }
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+ ((WelcomeUI)e.getSource()).close();
+ }
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ }
+
+ @Override
+ public void windowIconified(WindowEvent e) {
+ }
+
+ @Override
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ @Override
+ public void windowActivated(WindowEvent e) {
+ }
+
+ @Override
+ public void windowDeactivated(WindowEvent e) {
+ }
+ });
// add context
welcome.setVisible(true);
}
1
0
r1726 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui: . input
by sletellier@users.labs.libre-entreprise.org 09 Jan '09
by sletellier@users.labs.libre-entreprise.org 09 Jan '09
09 Jan '09
Author: sletellier
Date: 2009-01-09 10:15:37 +0000 (Fri, 09 Jan 2009)
New Revision: 1726
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx
Removed:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/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/GearUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.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/SetOfVesselsUI.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/StrategyMonthInfoUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.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/StrategyUI.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/VesselTypeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
Log:
Ajout de saveVerfier et utilisation des binding JAXX
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeSaveVerifier.java 2009-01-09 10:15:37 UTC (rev 1726)
@@ -0,0 +1,38 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package fr.ifremer.isisfish.ui;
+
+import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
+import javax.swing.JOptionPane;
+
+/**
+ *
+ * @author letellier
+ */
+public class WelcomeSaveVerifier {
+ protected InputSaveVerifier inputVerifier = null;
+
+ public void setInputVerifier(InputSaveVerifier inputVerifier) {
+ this.inputVerifier = inputVerifier;
+ }
+
+ public InputSaveVerifier getInputVerifier() {
+ return inputVerifier;
+ }
+
+ public boolean allIsSaved(){
+ boolean exit = true;
+ int responce = inputVerifier.checkEdit();
+ //boolean exit = checkEdit(event, component);
+ if (responce == JOptionPane.OK_OPTION){
+ }
+ else if (responce == JOptionPane.CANCEL_OPTION){
+ exit = false;
+ }
+ return exit;
+ }
+
+}
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -49,7 +49,7 @@
<fr.ifremer.isisfish.ui.result.ResultView/>
</tab>
<tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/book.gif"))}'>
- <fr.ifremer.isisfish.ui.input.InputUI constructorParams='new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier())'/>
+ <fr.ifremer.isisfish.ui.input.InputUI constructorParams='new JAXXInitialContext().add(getContextValue(WelcomeSaveVerifier.class)).add(new InputAction()).add(new InputSaveVerifier())'/>
</tab>
<tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/bookPage.gif"))}'>
<fr.ifremer.isisfish.ui.script.ScriptUI/>
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -41,29 +41,38 @@
import fr.ifremer.isisfish.ui.script.ScriptUI;
import fr.ifremer.isisfish.ui.simulator.SimulUI;
import fr.ifremer.isisfish.ui.simulator.QueueUI;
+ import jaxx.runtime.DefaultJAXXContext;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.IsisConfig;
import javax.swing.JFrame;
import org.codelutin.widget.AboutFrame;
import jaxx.runtime.JAXXInitialContext;
import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
-
- welcomePanelUI.setContent(new WelcomeTabUI());
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ setContextValue(new WelcomeSaveVerifier());
+ welcomePanelUI.setContent(new WelcomeTabUI(new JAXXInitialContext().add(getVerifier())));
protected void openFrame(Container c, String title){
JFrame f = new JFrame();
f.setLayout(new BorderLayout());
- WelcomePanelUI welcome = new WelcomePanelUI();
+ WelcomePanelUI welcome = new WelcomePanelUI(this);
welcome.setContent(c);
f.add(welcome, BorderLayout.CENTER);
f.setTitle(title);
f.setSize(new Dimension(800, 600));
f.setVisible(true);
}
- protected void close() {
+ public void close() {
+ if (getVerifier().allIsSaved()){
+ exit();
+ }
+ }
+ protected void exit(){
this.dispose();
IsisFish.quit();
}
+ protected WelcomeSaveVerifier getVerifier(){
+ return getContextValue(WelcomeSaveVerifier.class);
+ }
protected void monitorUI() {
new ApplicationMonitorUI();
}
@@ -113,7 +122,7 @@
<JMenu text="isisfish.welcome.menu.frame">
<JMenuItem text="isisfish.welcome.menu.simulation" onActionPerformed='openFrame(new SimulUI(new SimulAction()), _("isisfish.simulation.title"))'/>
<JMenuItem text="isisfish.welcome.menu.result" onActionPerformed='openFrame(new ResultView(), _("isisfish.result.title"))'/>
- <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='openFrame(new InputUI(new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier())), _("isisfish.input.title"))'/>
+ <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='openFrame(new InputUI(new JAXXInitialContext().add(this).add(new InputAction()).add(new InputSaveVerifier())), _("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 QueueUI(), _("isisfish.queue.title"))'/>
@@ -131,5 +140,5 @@
<JMenuItem text="isisfish.welcome.menu.about" onActionPerformed='about()'/>
</JMenu>
</JMenuBar>
- <WelcomePanelUI id="welcomePanelUI"/>
+ <WelcomePanelUI id="welcomePanelUI" constructorParams='new DefaultJAXXContext(this)'/>
</JFrame>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -50,7 +50,6 @@
protected OMToolSet toolSet = new OMToolSet();
protected OpenMapEvents mapListener = null;
-setType("Cell");
setButtonTitle("isisfish.input.continueZones");
setNextPath("$root/$zones");
addPropertyChangeListener("bean", new PropertyChangeListener() {
@@ -130,7 +129,7 @@
<JLabel text="isisfish.cell.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldCellName" text='{jaxx.runtime.Util.getStringValue(getBean().getName())}' onKeyReleased='setChanged(true)' onFocusLost='getBean().setName(fieldCellName.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldCellName" text='{jaxx.runtime.Util.getStringValue(getBean().getName())}' onKeyReleased='getBean().setName(fieldCellName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -45,9 +45,6 @@
import fr.ifremer.isisfish.entities.Metier;
import fr.ifremer.isisfish.types.TimeUnit;
-setType("SetOfVessels");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -131,7 +128,7 @@
<JLabel text="isisfish.effortDescription.fishingOperation" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionFishingOperation" text='getEffortDescription().getFishingOperation()' onKeyTyped='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionFishingOperation" text='{getEffortDescription().getFishingOperation()}' onKeyReleased='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -139,7 +136,7 @@
<JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionFishingOperationDuration" text='getEffortDescription().getFishingOperationDuration()' onKeyTyped='getEffortDescription().setFishingOperationDuration(new TimeUnit(Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionFishingOperationDuration" text='{getEffortDescription().getFishingOperationDuration()}' onKeyReleased='getEffortDescription().setFishingOperationDuration(new TimeUnit(Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -147,7 +144,7 @@
<JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='getEffortDescription().getGearsNumberPerOperation()' onKeyTyped='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='{getEffortDescription().getGearsNumberPerOperation()}' onKeyReleased='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -155,7 +152,7 @@
<JLabel text="isisfish.effortDescription.crewSize" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionCrewSize" text='getEffortDescription().getCrewSize()' onKeyTyped='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionCrewSize" text='{getEffortDescription().getCrewSize()}' onKeyReleased='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -163,7 +160,7 @@
<JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='getEffortDescription().getUnitCostOfFishing()' onKeyTyped='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='{getEffortDescription().getUnitCostOfFishing()}' onKeyReleased='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -171,7 +168,7 @@
<JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='getEffortDescription().getFixedCrewSalary()' onKeyTyped='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='{getEffortDescription().getFixedCrewSalary()}' onKeyReleased='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -179,7 +176,7 @@
<JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionCrewFoodCost" text='getEffortDescription().getCrewFoodCost()' onKeyTyped='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionCrewFoodCost" text='{getEffortDescription().getCrewFoodCost()}' onKeyReleased='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -187,7 +184,7 @@
<JLabel text="isisfish.effortDescription.crewShareRate" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionCrewShareRate" text='getEffortDescription().getCrewShareRate()' onKeyTyped='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionCrewShareRate" text='{getEffortDescription().getCrewShareRate()}' onKeyReleased='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -195,7 +192,7 @@
<JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='getEffortDescription().getRepairAndMaintenanceGearCost()' onKeyTyped='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='{getEffortDescription().getRepairAndMaintenanceGearCost()}' onKeyReleased='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -203,7 +200,7 @@
<JLabel text="isisfish.effortDescription.landingCosts" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionLandingCosts" text='getEffortDescription().getLandingCosts()' onKeyTyped='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionLandingCosts" text='{getEffortDescription().getLandingCosts()}' onKeyReleased='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -211,7 +208,7 @@
<JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionOtherRunningCost" text='getEffortDescription().getOtherRunningCost()' onKeyTyped='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldEffortDescriptionOtherRunningCost" text='{getEffortDescription().getOtherRunningCost()}' onKeyReleased='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -47,73 +47,68 @@
protected OMToolSet toolSet = new OMToolSet();
- public void refresh(){
- setBean(null);
- FisheryRegion region = (FisheryRegion) getVerifier().getEntity(FisheryRegion.class);
- setBean((FisheryRegionImpl)region);
- if (region != null){
- setFieldMapfilesModel(getBean());
- cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
- cellMap.setActiveMouseMode(new SelectMouseMode());
- cellMap.setFisheryRegion(getBean());
- toolSet.setupListeners(cellMap);
- toolMap.add((Component)toolSet);
- }
+setButtonTitle("isisfish.input.continueCells");
+setNextPath("$root/$cells");
+getVerifier().addSaveButton(save);
+public void refresh(){
+ setBean(null);
+ FisheryRegion region = (FisheryRegion) getVerifier().getEntity(FisheryRegion.class);
+ setBean((FisheryRegionImpl)region);
+ if (region != null){
+ setFieldMapfilesModel(getBean());
+ cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
+ cellMap.setActiveMouseMode(new SelectMouseMode());
+ cellMap.setFisheryRegion(getBean());
+ toolSet.setupListeners(cellMap);
+ toolMap.add((Component)toolSet);
+ }
+}
+protected void setFieldMapfilesModel(FisheryRegion region){
+ DefaultListModel model = new DefaultListModel();
+ java.util.List<String> mapList = region.getMapFileList();
+ if (mapList != null){
+ int cnt = 0;
+ for (String map : mapList){
+ model.add(cnt, map);
+ cnt++;
}
- protected void setFieldMapfilesModel(FisheryRegion region){
- DefaultListModel model = new DefaultListModel();
- java.util.List<String> mapList = region.getMapFileList();
- if (mapList != null){
- int cnt = 0;
- for (String map : mapList){
- model.add(cnt, map);
- cnt++;
- }
- }
- fieldMapfiles.setModel(model);
+ }
+ fieldMapfiles.setModel(model);
+}
+protected void mapFieldChanged(){
+ Object[] values = fieldMapfiles.getSelectedValues();
+ java.util.List<String> valuesList = new ArrayList<String>();
+ if (values != null){
+ for (Object o : values){
+ valuesList.add((String)o);
}
- protected void mapFieldChanged(){
- Object[] values = fieldMapfiles.getSelectedValues();
- java.util.List<String> valuesList = new ArrayList<String>();
- if (values != null){
- for (Object o : values){
- valuesList.add((String)o);
- }
- }
- getBean().setMapFileList(valuesList);
- }
- protected void addMap(){
- getContextValue(InputAction.class).addMap(getBean());
- }
- protected void delMap(){
- getContextValue(InputAction.class).removeMap(getBean(), fieldMapfiles.getSelectedValues());
- }
- protected void cellFillChanged(){
- }
- protected void cellFile(){
- getContextValue(InputAction.class).loadCellFile(fieldCellFile.getText());
- }
-// protected void save(){
-// setMsg(_("isisfish.message.checking.cell"));
-// getContextValue(InputAction.class).saveFisheryRegion("FisheryRegion");
-// valueChanged(false);
-// getParentContainer(InputUI.class).setTreeModel();
-// getParentContainer(InputUI.class).setFieldCurrentRegionModel();
-// setMsg(_("isisfish.message.save.finished"));
-// refresh();
-// }
-// protected void cancel(){
-// getContextValue(InputAction.class).cancel();
-// valueChanged(false);
-// refresh();
-// }
- protected void check(){
- getContextValue(InputAction.class).checkFisheryRegion(getBean());
- setInfoText(_("isisfish.message.check.region"));
- }
-// protected void goToCell(){
-// getParentContainer(InputUI.class).setTreeSelection("$root/$cells");
-// }
+ }
+ getBean().setMapFileList(valuesList);
+}
+protected void addMap(){
+ getContextValue(InputAction.class).addMap(getBean());
+}
+protected void delMap(){
+ getContextValue(InputAction.class).removeMap(getBean(), fieldMapfiles.getSelectedValues());
+}
+protected void cellFillChanged(){
+}
+protected void cellFile(){
+ getContextValue(InputAction.class).loadCellFile(fieldCellFile.getText());
+}
+protected void check(){
+ getContextValue(InputAction.class).checkFisheryRegion(getBean());
+ setInfoText(_("isisfish.message.check.region"));
+}
+protected void save(){
+ setInfoText(_("isisfish.message.checking.cell"));
+ getContextValue(InputAction.class).saveFisheryRegion(getBean(), "FisheryRegion");
+ getVerifier().setEditable(false);
+ getParentContainer(InputUI.class).setTreeModel();
+ getParentContainer(InputUI.class).setFieldCurrentRegionModel();
+ setInfoText(_("isisfish.message.save.finished"));
+ refresh();
+}
]]>
</script>
@@ -248,7 +243,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.3'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save' text="isisfish.common.save" enabled='false' onActionPerformed='save()'/>
</cell>
<cell fill='horizontal' weightx='0.3'>
<JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -37,64 +37,36 @@
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Gear;
- import fr.ifremer.isisfish.entities.GearImpl;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import org.codelutin.topia.TopiaException;
- import jaxx.runtime.swing.navigation.NavigationTreeModel;
- import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
+import fr.ifremer.isisfish.entities.Gear;
+import fr.ifremer.isisfish.entities.GearImpl;
+import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import org.codelutin.topia.persistence.TopiaEntity;
+import org.codelutin.topia.TopiaException;
+import jaxx.runtime.swing.navigation.NavigationTreeModel;
+import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
- public void refresh() {
- Gear gear = (Gear)getVerifier().getEntity(Gear.class);
- setBean((GearImpl) gear);
- if (gear != null){
- fieldGearName.setText(gear.getName());
- fieldGearEffortUnit.setText(gear.getEffortUnit());
- fieldGearStandardisationFactor.setText(gear.getStandardisationFactor() + "");
- fieldGearParamName.setText(gear.getParameterName());
- DefaultComboBoxModel model = new DefaultComboBoxModel(fr.ifremer.isisfish.types.RangeOfValues.getPossibleTypes());
- fieldGearParamType.setModel(model);
- if (gear.getPossibleValue() != null){
- fieldGearParamPossibleValue.setText(gear.getPossibleValue().getValues());
- }
- fieldGearComment.setText(gear.getComment());
- }
- else{
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
fieldGearName.setText("");
fieldGearEffortUnit.setText("");
fieldGearStandardisationFactor.setText("");
fieldGearParamName.setText("");
- DefaultComboBoxModel model = new DefaultComboBoxModel(fr.ifremer.isisfish.types.RangeOfValues.getPossibleTypes());
- fieldGearParamType.setModel(model);
fieldGearParamPossibleValue.setText("");
fieldGearComment.setText("");
}
- }
- protected void nameChanged(){
- getBean().setName(fieldGearName.getText());
- }
- protected void effortUnitChanged(){
- getBean().setEffortUnit(fieldGearEffortUnit.getText());
- }
- protected void standardisationFactorChanged(){
- getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()));
- }
- protected void paramNameChanged(){
- getBean().setParameterName(fieldGearParamName.getSelectedText());
- }
- protected void paramTypeChanged(){
-// TODO
-// getContextValue(InputAction.class).getGear().setParameterName(fieldGearParamName.getSelectedText());
- }
- protected void paramPossibleValueChanged(){
- if (fieldGearParamPossibleValue.getText() != ""){
- getBean().setStandardisationFactor(Double.parseDouble(fieldGearParamPossibleValue.getText()));
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
}
- protected void commentChanged(){
- getBean().setComment(fieldGearComment.getText());
- }
+});
+public void refresh() {
+ Gear gear = (Gear)getVerifier().getEntity(Gear.class);
+ setBean((GearImpl) gear);
+}
]]>
</script>
<Table id='body'>
@@ -106,7 +78,7 @@
<JLabel text="isisfish.gear.name" enabled='{isActif()}'/>
</cell>
<cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearName" onKeyTyped='nameChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldGearName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldGearName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -114,7 +86,7 @@
<JLabel text="isisfish.gear.effortUnit" enabled='{isActif()}'/>
</cell>
<cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearEffortUnit" onKeyTyped='effortUnitChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldGearEffortUnit" text='{jaxx.runtime.Util.getStringValue(getBean().getEffortUnit())}' onKeyReleased='getBean().setEffortUnit(fieldGearEffortUnit.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -122,7 +94,7 @@
<JLabel text="isisfish.gear.standardisationFactor" enabled='{isActif()}'/>
</cell>
<cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearStandardisationFactor" onKeyTyped='standardisationFactorChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldGearStandardisationFactor" text='{getBean().getStandardisationFactor()}' onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -130,7 +102,7 @@
<JLabel text="isisfish.gear.technicalParameter" enabled='{isActif()}'/>
</cell>
<cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearParamName" onKeyTyped='paramNameChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldGearParamName" text='{jaxx.runtime.Util.getStringValue(getBean().getParameterName())}' onKeyReleased='getBean().setParameterName(fieldGearParamName.getSelectedText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -138,10 +110,10 @@
<JLabel text="isisfish.gear.rangeValues" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldGearParamType" onActionPerformed='paramTypeChanged()' enabled='{isActif()}'/>
+ <JComboBox id="fieldGearParamType" model='{new DefaultComboBoxModel(fr.ifremer.isisfish.types.RangeOfValues.getPossibleTypes())}' onActionPerformed='getBean().setParameterName(fieldGearParamName.getSelectedText())' enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldGearParamPossibleValue" onKeyTyped='paramPossibleValueChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldGearParamPossibleValue" text='{getBean().getPossibleValue().getValues()}' onKeyReleased='getBean().setStandardisationFactor(Double.parseDouble(fieldGearParamPossibleValue.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -150,7 +122,7 @@
</cell>
<cell columns="2" fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JTextArea id="fieldGearComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ <JTextArea id="fieldGearComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldGearComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -162,18 +134,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton javaBean='getVerifier().getSaveButton()'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton javaBean='getVerifier().getCancelButton()'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton javaBean='getVerifier().getNewButton("Gear")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton javaBean='getVerifier().getDeleteButton()'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -38,37 +38,19 @@
<fr.ifremer.isisfish.ui.input.InputContentUI>
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Metier;
- init();
- public void refresh() {
- gearTabUI.refresh();
- selectivityUI.refresh();
- }
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- gearTabUI.setActif((Boolean)evt.getNewValue());
- selectivityUI.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- gearTabUI.setChanged((Boolean)evt.getNewValue());
- selectivityUI.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
- protected void goToMetier(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$metiers");
- }
+import fr.ifremer.isisfish.entities.Metier;
+setButtonTitle("isisfish.input.continueMetiers");
+setNextPath("$root/$metiers");
+public void refresh() {
+ getVerifier().addCurrentPanel(gearTabUI, selectivityUI);
+ gearTabUI.refresh();
+ selectivityUI.refresh();
+}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
<JTabbedPane constraints='BorderLayout.CENTER' id="GearTab" name="Gear">
- <tab title='{_("isisfish.gear.title")}'><GearTabUI id="gearTabUI"/></tab>
- <tab title='{_("isisfish.selectivity.title")}'><SelectivityUI id="selectivityUI"/></tab>
+ <tab title='{_("isisfish.gear.title")}'><GearTabUI id="gearTabUI" constructorParams='this'/></tab>
+ <tab title='{_("isisfish.selectivity.title")}'><SelectivityUI id="selectivityUI" constructorParams='this'/></tab>
</JTabbedPane>
</JPanel>
- <!--JButton constraints='BorderLayout.SOUTH' text="isisfish.input.continueMetiers" onActionPerformed='goToMetier()'/-->
</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-01-09 10:15:37 UTC (rev 1726)
@@ -922,7 +922,7 @@
// FIXME todo loadCellFile
}
- public Object saveFisheryRegion(FisheryRegion fisheryRegion, String type) {
+ public void saveFisheryRegion(FisheryRegion fisheryRegion, String type) {
if (log.isTraceEnabled()) {
log.trace("save called");
}
@@ -995,7 +995,6 @@
log.error(_("isisfish.error.save.region"), eee);
showMsgBox(eee);
}
- return null;
}
public Object checkFisheryRegion(FisheryRegion fisheryRegion) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -2,27 +2,6 @@
<!-- ui state when editing -->
<Boolean id='actif' javaBean='false'/>
-
- <!-- ui state when editing and modified -->
- <Boolean id='changed' javaBean='false'/>
-
- <!-- ui state when a bean is selected in list -->
- <Boolean id='selected' javaBean='false'/>
-
- <!-- New button enabled -->
- <Boolean id='newEnabled' javaBean='false'/>
-
- <!-- Cancel button enabled -->
- <Boolean id='cancelEnabled' javaBean='false'/>
-
- <!-- Save button enabled -->
- <Boolean id='saveEnabled' javaBean='false'/>
-
- <!-- Delete button enabled -->
- <Boolean id='deleteEnabled' javaBean='false'/>
-
- <!-- Next button enabled -->
- <Boolean id='buttonEnabled' javaBean='true'/>
<!-- Next button title -->
<java.lang.String id='buttonTitle' javaBean='""'/>
@@ -30,9 +9,6 @@
<!-- Next button title -->
<java.lang.String id='nextPath' javaBean='null'/>
- <!-- Next button title -->
- <java.lang.String id='type' javaBean='null'/>
-
<script><![CDATA[
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import fr.ifremer.isisfish.entities.FisheryRegion;
@@ -56,5 +32,5 @@
]]>
</script>
<JPanel id='body' constraints='BorderLayout.CENTER'/>
- <JButton id='next' text='{getButtonTitle()}' constraints='BorderLayout.SOUTH' enabled='{isButtonEnabled()}' visible='{getNextPath() != null}' onActionPerformed='goTo()'/>
+ <JButton id='next' text='{getButtonTitle()}' constraints='BorderLayout.SOUTH' visible='{getNextPath() != null}' onActionPerformed='goTo()'/>
</JPanel>
Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx (from rev 1724, isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx)
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -0,0 +1,160 @@
+<!--
+/* *##%
+ * 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 $
+ */
+ -->
+
+<fr.ifremer.isisfish.ui.input.InputContentUI>
+
+ <script><![CDATA[
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.entities.Formule;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+protected Class clazz = null;
+protected String nameEquation = null;
+protected String lblText;
+protected Formule f;
+protected String name;
+protected Class c;
+
+public void init(String lblText, Formule f, String name, Class c){
+ this.lblText = lblText;
+ this.f = f;
+ this.name = name;
+ this.c = c;
+}
+public void refresh(){
+ lbl.setText(lblText);
+ clazz = c;
+ try {
+ editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
+ } catch (IOException ex) {
+ Logger.getLogger(InputOneEquationUI.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ setComboModel(f, name);
+}
+protected void setComboModel(Formule f, String name){
+ DefaultComboBoxModel model = new DefaultComboBoxModel();
+ GenericCell cellSelected = null;
+ for (Formule formule : getAction().getFormules(getVerifier().getIsisContext(),name)){
+ GenericCell cell = new GenericCell(formule.getName(), formule, Formule.class);
+ model.addElement(cell);
+ if (formule.equals(f)){
+ cellSelected = cell;
+ }
+ }
+ combo.setModel(model);
+ if (cellSelected != null){
+ combo.setSelectedItem(cellSelected);
+ Formule selected = getFormule();
+ if (selected != null){
+ editor.setText(selected.getContent());
+ }
+ }
+}
+protected void comboChanged(){
+ Formule selected = getFormule();
+ if (selected != null){
+ editor.setText(selected.getContent());
+ }
+}
+protected Formule getFormule(){
+ Formule result = null;
+ Object selected = combo.getSelectedItem();
+ if (selected != null){
+ GenericCell cell = (GenericCell) selected;
+ if (cell.getValue() != null){
+ result = (Formule)cell.getValue();
+ }
+ }
+ return result;
+}
+protected void saveModel(){
+ Formule e = getFormule();
+ if (e != null){
+ getContextValue(InputAction.class).saveAsModel(e.getCategory(), "Java", e.getContent());
+ }
+ else{
+ getContextValue(InputAction.class).saveAsModel(name, "Java", editor.getText());
+ setComboModel(f, name);
+ }
+ refresh();
+ setInfoText(_("isisfish.message.saveModel.finished"));
+}
+protected void openEditor(){
+ Formule e = getFormule();
+ if (e != null){
+ getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor);
+ }
+ else{
+ getContextValue(InputAction.class).openEditor(name,"new",c, editor.getText(), editor);
+ }
+}
+ ]]>
+ </script>
+ <Table id='body'>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel id='lbl'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="combo" onActionPerformed='comboChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Property changes on: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-01-09 10:15:37 UTC (rev 1726)
@@ -7,16 +7,16 @@
import fr.ifremer.isisfish.IsisFishDAOHelper;
import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
-import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.Map;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.tree.TreePath;
@@ -39,10 +39,11 @@
* @author letellier
*/
public class InputSaveVerifier implements JAXXAction {
- protected JButton newButton = null;
- protected JButton deleteButton = null;
- protected JButton saveButton = null;
- protected JButton cancelButton = null;
+ protected Map<JButton, String> listNewButton = new HashMap<JButton, String>();
+ protected List<JButton> listDeleteButton = new ArrayList<JButton>();
+ protected List<JButton> listSaveButton = new ArrayList<JButton>();
+ protected List<JButton> listCancelButton = new ArrayList<JButton>();
+
protected boolean editable = false;
protected boolean changed = false;
@@ -58,39 +59,6 @@
protected InputUI rootUI;
public InputSaveVerifier(){
- newButton = new JButton(_("isisfish.common.new"));
- newButton.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaCreate();
- }
- });
- deleteButton = new JButton(_("isisfish.common.remove"));
- deleteButton.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaRemove();
- }
- });
- saveButton = new JButton(_("isisfish.common.save"));
- saveButton.addActionListener(new ActionListener(){
-
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaSave();
- }
-
- });
- cancelButton = new JButton(_("isisfish.common.cancel"));
- cancelButton.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- topiaCancel();
- }
- });
}
@Override
public JAXXInitialContext init(JAXXContext parentContent, Object... datas) {
@@ -123,20 +91,26 @@
protected void topiaChanged(){
changed = true;
setPanelsActifs();
- saveButton.setEnabled(true);
- cancelButton.setEnabled(true);
- newButton.setEnabled(false);
- deleteButton.setEnabled(false);
+ setEnabled(listSaveButton, true);
+ setEnabled(listCancelButton, true);
+ setEnabled(listNewButton.keySet(), false);
+ setEnabled(listDeleteButton, false);
}
protected void noModif(){
changed = false;
setPanelsActifs();
- saveButton.setEnabled(false);
- cancelButton.setEnabled(false);
- newButton.setEnabled(true);
- deleteButton.setEnabled(true);
+ setEnabled(listSaveButton, false);
+ setEnabled(listCancelButton, false);
+ setEnabled(listNewButton.keySet(), true);
+ setEnabled(listDeleteButton, true);
}
+ protected void setEnabled(Collection<JButton> buttons, boolean enabled){
+ for (JButton b : buttons){
+ b.setEnabled(enabled);
+ }
+ }
+
/**
* Delete one entity and commit the change, try to selected intelligently
* other node in tree.
@@ -155,6 +129,7 @@
boolean doDelete;
ArrayList<TopiaEntity> allWillBeRemoved = new ArrayList<TopiaEntity>();
for (TopiaEntity te : currentEntities){
+ allWillBeRemoved.add(te);
allWillBeRemoved.addAll(te.getComposite());
}
if (allWillBeRemoved.size() > 0) {
@@ -177,6 +152,7 @@
if (doDelete) {
for (TopiaEntity te : allWillBeRemoved){
te.delete();
+ System.out.println(te.getTopiaContext());
}
isisContext.commitTransaction();
msg = _("isisfish.message.remove.finished");
@@ -188,15 +164,15 @@
ErrorDialogUI.showError(eee);
}
rootUI.setInfoText(msg);
- TreePath treeParentPath = rootUI.getNavigation().getSelectionPath().getParentPath();
+ String path = currentNode.getParent().getContextPath();
+ System.out.println(path);
rootUI.setTreeModel();
- rootUI.setTreeSelection(treeParentPath.toString());
+ rootUI.setTreeSelection(path);
noModif();
}
- protected void topiaCreate(){
- String type = currentPanels.get(0).getType();
+ protected void topiaCreate(String type){
if (log.isTraceEnabled()) {
log.trace("create called for " + type);
@@ -215,10 +191,14 @@
entity.update();
isisContext.commitTransaction();
+ String path = currentNode.getParent().getContextPath() + "/" + entity.getTopiaId();
+ if (!editable){
+ path = currentNode.getContextPath() + "/" + entity.getTopiaId();
+ }
+ System.out.println(path);
+
rootUI.setTreeModel();
- String parentPath = currentNode.getParent().getContextPath() + entity.getTopiaId();
- System.out.println(parentPath);
- rootUI.setTreeSelection(parentPath);
+ rootUI.setTreeSelection(path);
rootUI.setInfoText(_("isisfish.message.creation.finished"));
@@ -279,6 +259,14 @@
}
}
}
+ protected void setPanelsActifs(boolean b){
+ if (!currentPanels.isEmpty()){
+ for (InputContentUI panel : currentPanels){
+ System.out.println("panel : "+ panel);
+ panel.setActif(b);
+ }
+ }
+ }
protected void refreshAll(){
for (InputContentUI panel : currentPanels){
panel.refresh();
@@ -295,6 +283,8 @@
}
});
this.currentEntities.add(currentEntity);
+ System.out.println("currentEntity : "+ currentEntity);
+ setPanelsActifs();
}
else{
editable = false;
@@ -304,10 +294,13 @@
currentEntities.clear();
editable = false;
noModif();
+ setPanelsActifs();
}
- public void addCurrentPanel(InputContentUI currentPanel) {
- if (currentPanel != null){
- this.currentPanels.add(currentPanel);
+ public void addCurrentPanel(InputContentUI... currentPanels) {
+ if (currentPanels != null){
+ for (InputContentUI ui : currentPanels){
+ this.currentPanels.add(ui);
+ }
setPanelsActifs();
}
}
@@ -320,21 +313,62 @@
}
public JButton getCancelButton() {
+ JButton cancelButton = new JButton(_("isisfish.common.cancel"));
+ cancelButton.setEnabled(false);
+ cancelButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaCancel();
+ }
+ });
+ listCancelButton.add(cancelButton);
return cancelButton;
}
public JButton getDeleteButton() {
+ JButton deleteButton = new JButton(_("isisfish.common.remove"));
+ deleteButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaRemove();
+ }
+ });
+ listDeleteButton.add(deleteButton);
return deleteButton;
}
- public JButton getNewButton() {
+ public JButton getNewButton(String type) {
+ JButton newButton = new JButton(_("isisfish.common.new"));
+ newButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaCreate(listNewButton.get(e.getSource()));
+ }
+ });
+ listNewButton.put(newButton, type);
return newButton;
}
public JButton getSaveButton() {
+ JButton saveButton = new JButton(_("isisfish.common.save"));
+ saveButton.setEnabled(false);
+ saveButton.addActionListener(new ActionListener(){
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaSave();
+ }
+
+ });
+ listSaveButton.add(saveButton);
return saveButton;
}
-
+ public void addSaveButton(JButton saveButton){
+ listSaveButton.add(saveButton);
+ }
public TopiaContext getIsisContext() {
return isisContext;
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -38,6 +38,7 @@
<script><![CDATA[
import fr.ifremer.isisfish.ui.Common;
+import fr.ifremer.isisfish.ui.WelcomeSaveVerifier;
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import javax.swing.tree.DefaultMutableTreeNode;
@@ -75,6 +76,7 @@
import fr.ifremer.isisfish.entities.FisheryRegion;
import fr.ifremer.isisfish.datastore.RegionStorage;
+getContextValue(WelcomeSaveVerifier.class).setInputVerifier(getVerifier());
protected FisheryRegion getRegion(){
return getContextValue(FisheryRegion.class);
}
@@ -216,7 +218,7 @@
<Table constraints='BorderLayout.NORTH'>
<row>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldNewRegion" onKeyTyped='newChanged()'/>
+ <JTextField id="fieldNewRegion" onKeyReleased='newChanged()'/>
</cell>
<cell fill='horizontal'>
<JButton id="JButtonNewRegion" text="isisfish.input.newRegion" onActionPerformed='newRegion()' enabled='false'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -56,6 +56,7 @@
import org.codelutin.topia.TopiaContext;
import javax.swing.table.TableCellEditor;
+ getVerifier().addCurrentPanel(targetFactor);
public void refresh() {
Metier metier = (Metier)getVerifier().getEntity(Metier.class);
setBean((MetierImpl) metier);
@@ -69,21 +70,15 @@
if (fieldTargetSpecies.getSelectedIndex() <= 0){
setTargetSpeciesModel();
}
- if (fieldTargetFactorEquation.getSelectedIndex() <= 0){
- setTargetFactorEquationModel();
- }
- try {
- fieldTargetFactorScript.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(SelectivityUI.class.getName()).log(Level.SEVERE, null, ex);
- }
-
+
+// TODO : Equation selectionne
+ targetFactor.init(_("isisfish.metierSeasonInfoSpecies.targetFactor"), null, "TargetSpeciesTargetFactorEquation", fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class);
+ targetFactor.refresh();
}
else{
DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
fieldMetierSeasonInfo.setModel(seasonModel);
setTargetSpeciesModel();
- setTargetFactorEquationModel();
}
}
protected void setSeasonModel(){
@@ -108,17 +103,6 @@
}
fieldTargetSpecies.setModel(fieldTargetSpeciesModel);
}
- protected void setTargetFactorEquationModel(){
- java.util.List<Formule> formules = fr.ifremer.isisfish.datastore.FormuleStorage.getFormules(getContextValue(TopiaContext.class), "TargetFactor");
- DefaultComboBoxModel fieldTargetFactorEquationModel = new DefaultComboBoxModel();
- if (formules != null){
- fieldTargetFactorEquationModel.addElement(new GenericCell(" ", null, null));
- for (Formule f : formules){
- fieldTargetFactorEquationModel.addElement(new GenericCell(f.getName(), f, Formule.class));
- }
- }
- fieldTargetFactorEquation.setModel(fieldTargetFactorEquationModel);
- }
protected void setTableTargetSpeciesModel(){
DefaultTableModel model = new DefaultTableModel(){
@Override
@@ -154,19 +138,6 @@
tableTargetSpecies.getColumnModel().getColumn(1).setCellEditor(cellEditor);
}
}
- protected void equationChanged(){
- GenericCell g = (GenericCell)fieldTargetFactorEquation.getSelectedItem();
- if (g.getValue() != null){
- fieldTargetFactorScript.setText(((Formule)g.getValue()).getContent());
- }
- else{
- try {
- fieldTargetFactorScript.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(MetierSeasonInfoSpeciesUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
protected void add(){
Object season = ((GenericCell)fieldMetierSeasonInfo.getSelectedItem()).getValue();
Object species = ((GenericCell)fieldTargetSpecies.getSelectedItem()).getValue();
@@ -175,7 +146,7 @@
getBean(),
(MetierSeasonInfo)season,
(Species)species,
- fieldTargetFactorScript.getText(),
+ targetFactor.getEditor().getText(),
fieldPrimaryCatch.isSelected());
refresh();
}
@@ -183,14 +154,6 @@
protected void remove(){
refresh();
}
- protected void openEditor(){
- getContextValue(InputAction.class).openEditor("TargetSpeciesTargetFactorEquation","new",fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class, fieldTargetFactorScript.getText(), fieldTargetFactorScript);
- }
- protected void saveAsModel(){
- getContextValue(InputAction.class).saveAsModel("TargetSpeciesTargetFactorEquation", "Java", fieldTargetFactorScript.getText());
- setTargetFactorEquationModel();
- setInfoText(_("isisfish.message.saveModel.finished"));
- }
protected void metierSeasonChanged(){
setTableTargetSpeciesModel();
}
@@ -216,40 +179,11 @@
</cell>
</row>
<row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metierSeasonInfoSpecies.targetFactor"/>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <InputOneEquationUI id='targetFactor' constructorParams='this'/>
</cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldTargetFactorEquation" onActionPerformed='equationChanged()'/>
- </cell>
</row>
<row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton id='saveModel' text="isisfish.common.saveModel" onActionPerformed='saveAsModel()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id='openEditor' text="isisfish.common.openEditor" onActionPerformed='openEditor()'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <org.codelutin.widget.editor.Editor id='fieldTargetFactorScript' askIfNotSaved="false"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
<cell fill='horizontal'>
<JPanel/>
</cell>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -250,7 +250,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='0.3'>
<JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTextArea id="fieldMetierSeasonZoneComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ <JTextArea id="fieldMetierSeasonZoneComment" onKeyReleased='commentChanged()' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -270,7 +270,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("MetierSeasonInfo")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -90,7 +90,7 @@
<JLabel text="isisfish.metier.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldMetierName" onKeyTyped='nameChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldMetierName" onKeyReleased='nameChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -106,7 +106,7 @@
<JLabel text="isisfish.metier.rangeValues" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldMetierParam" onKeyTyped='paramChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldMetierParam" onKeyReleased='paramChanged()' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -115,7 +115,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTextArea id="fieldMetierComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ <JTextArea id="fieldMetierComment" onKeyReleased='commentChanged()' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -135,7 +135,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("Metier")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -36,47 +36,21 @@
+-->
<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- bean property -->
- <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/>
+<script><![CDATA[
+import fr.ifremer.isisfish.entities.TripType;
+import fr.ifremer.isisfish.entities.MetierImpl;
+import fr.ifremer.isisfish.entities.Metier;
- <script><![CDATA[
- import fr.ifremer.isisfish.entities.TripType;
- import fr.ifremer.isisfish.entities.MetierImpl;
- import fr.ifremer.isisfish.entities.Metier;
+setButtonTitle("isisfish.input.continueTripTypes");
+setNextPath("$root/$tripTypes");
- init();
- public void refresh() {
- setBean(null);
- Metier metier = (Metier)getVerifier().getEntity(Metier.class);
- setBean((MetierImpl) metier);
- metierTabUI.refresh();
- metierSeasonSpeciesUI.refresh();
-
- metierSeasonInfoUI.setSeasonInit(true);
- metierSeasonInfoUI.refresh();
- }
- protected void init(){
- metierTab.addChangeListener(new InputTabbedPaneListener());
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- metierTabUI.setActif((Boolean)evt.getNewValue());
- metierSeasonSpeciesUI.setActif((Boolean)evt.getNewValue());
- metierSeasonInfoUI.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- metierTabUI.setChanged((Boolean)evt.getNewValue());
- metierSeasonSpeciesUI.setChanged((Boolean)evt.getNewValue());
- metierSeasonInfoUI.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
- protected void goToTripType(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$tripTypes");
- }
+public void refresh() {
+ getVerifier().addCurrentPanel(metierTabUI, metierSeasonSpeciesUI, metierSeasonInfoUI);
+ metierTabUI.refresh();
+ metierSeasonSpeciesUI.refresh();
+ metierSeasonInfoUI.setSeasonInit(true);
+ metierSeasonInfoUI.refresh();
+}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
<JTabbedPane id="metierTab" name="Metier" constraints='BorderLayout.CENTER' >
@@ -84,6 +58,5 @@
<tab title='{_("isisfish.metierSeasonInfoZone.title")}'><MetierSeasonInfoZoneUI id="metierSeasonInfoUI" constructorParams='this'/></tab>
<tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'><MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" constructorParams='this'/></tab>
</JTabbedPane>
- <!--JButton constraints='BorderLayout.SOUTH' text="isisfish.input.continueTripTypes" onActionPerformed='goToTripType()'/-->
</JPanel>
</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -48,50 +48,41 @@
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
+getVerifier().addCurrentPanel(growthEquation, growthReverseEquation);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
// remove previous binding on getBean()
//jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
+ fieldPopulationBasicsName.setText("");
fieldPopulationBasicsGeographicID.setText("");
fieldPopulationBasicsNbClasses.setText("");
fieldPopulationBasicsComment.setText("");
fieldPopulationBasicsMatureClass.setSelectedItem(null);
+ getVerifier().setPanelsActifs(false);
}
if (evt.getNewValue() != null) {
// add binding on getBean()
//jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ getVerifier().setPanelsActifs(true);
}
}
});
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- editorReverse.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(PopulationBasicsUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- setFieldPopulationBasicsGrowthModel();
- setfieldPopulationBasicsGrowthReverseModel();
- jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsGrowthReverse,getAction().getFormules(getBean().getTopiaContext(), "GrowthReverse"), null);
+ getVerifier().setEditable(true);
+ getVerifier().setPanelsActifs();
+// TODO : Selection equation
+ growthEquation.init(_("isisfish.populationBasics.growth"), getBean().getGrowth(), "PopulationGrowth", fr.ifremer.isisfish.equation.PopulationGrowth.class);
+ growthReverseEquation.init(_("isisfish.populationBasics.growthReverse"), getBean().getGrowthReverse(), "PopulationGrowthReverse", fr.ifremer.isisfish.equation.PopulationGrowthReverse.class);
+ growthEquation.refresh();
+ growthReverseEquation.refresh();
if (getBean() != null){
jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsMatureClass,getBean().getPopulationGroup(), getBean().getMaturityGroup());
-// growthReverseChanged();
-// basicsGrowthChanged();
setTableAgeLengthModel();
}
}
- protected void setFieldPopulationBasicsGrowthModel(){
- jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsGrowth,getAction().getFormules(getBean().getTopiaContext(), "Growth"), null);
- }
- protected void setfieldPopulationBasicsGrowthReverseModel(){
- jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsGrowthReverse,getAction().getFormules(getBean().getTopiaContext(), "GrowthReverse"), null);
- }
protected void createClasses(){
JFrame wizardFrame = new JFrame();
wizardFrame.setLayout(new BorderLayout());
@@ -114,34 +105,6 @@
getBean().setMaturityGroup((PopulationGroup) selected);
}
}
- protected void basicsGrowthChanged(){
- Equation f = (Equation) fieldPopulationBasicsGrowth.getSelectedItem();
- if (f != null){
- editor.setText(f.getContent());
- }
- }
- protected void saveGrowthModel(){
- getContextValue(InputAction.class).saveAsModel("PopulationGrowth", "Java", editor.getText());
- setFieldPopulationBasicsGrowthModel();
- setInfoText(_("isisfish.message.saveModel.finished"));
- }
- protected void openGrowthEditor(){
- getContextValue(InputAction.class).openEditor("PopulationGrowth","new",fr.ifremer.isisfish.equation.PopulationGrowth.class, editor.getText(), editor);
- }
- protected void growthReverseChanged(){
- Equation f = (Equation)fieldPopulationBasicsGrowthReverse.getSelectedItem();
- if (f != null){
- editorReverse.setText(f.getContent());
- }
- }
- protected void saveGrowthReverseModel(){
- getContextValue(InputAction.class).saveAsModel("PopulationGrowthReverse", "Java", editor.getText());
- setfieldPopulationBasicsGrowthReverseModel();
- setInfoText(_("isisfish.message.saveModel.finished"));
- }
- protected void openGrowthReverseEditor(){
- getContextValue(InputAction.class).openEditor("PopulationGrowthReverse","new",fr.ifremer.isisfish.equation.PopulationGrowthReverse.class, editorReverse.getText(), editorReverse);
- }
protected void setTableAgeLengthModel(){
java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup();
if (popGroup != null){
@@ -157,6 +120,12 @@
tableAgeLength.setModel(model);
}
}
+ protected String getSizePopulationGroup(){
+ if (getBean() != null){
+ return String.valueOf(getBean().sizePopulationGroup());
+ }
+ return "";
+ }
]]>
</script>
<Table id='body'>
@@ -171,7 +140,7 @@
<JLabel text="isisfish.populationBasics.name" enabled='{isActif()}'/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationBasicsName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldPopulationBasicsName.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationBasicsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldPopulationBasicsName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -179,7 +148,7 @@
<JLabel text="isisfish.populationBasics.geographicID" enabled='{isActif()}'/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationBasicsGeographicID" text='getBean().getGeographicId()' onKeyTyped='getBean().setGeographicId(fieldPopulationBasicsGeographicID.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationBasicsGeographicID" text='{jaxx.runtime.Util.getStringValue(getBean().getGeographicId())}' onKeyReleased='getBean().setGeographicId(fieldPopulationBasicsGeographicID.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -187,7 +156,7 @@
<JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldPopulationBasicsNbClasses" text='getBean().sizePopulationGroup()' editable="false" enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationBasicsNbClasses" text='{getSizePopulationGroup()}' editable="false" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" onActionPerformed='createClasses()' enabled='{isActif()}'/>
@@ -210,80 +179,22 @@
</cell>
</row>
<row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationBasics.growth" enabled='{isActif()}'/>
+ <cell columns='3' fill='both' weightx='1.0' weighty='1.0'>
+ <InputOneEquationUI id='growthEquation' constructorParams='this'/>
</cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationBasicsGrowth" onActionPerformed='basicsGrowthChanged()' enabled='{isActif()}'/>
- </cell>
</row>
<row>
- <cell fill='both'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveGrowthModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openGrowthEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
+ <cell columns='3' fill='both' weightx='1.0' weighty='1.0'>
+ <InputOneEquationUI id='growthReverseEquation' constructorParams='this'/>
</cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.4'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
</row>
<row>
<cell anchor='east'>
- <JLabel text="isisfish.populationBasics.growthReverse" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationBasicsGrowthReverse" onActionPerformed='growthReverseChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveGrowthReverseModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openGrowthReverseEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.4'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editorReverse' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
<JLabel text="isisfish.population.comments" enabled='{isActif()}'/>
</cell>
<cell columns='2' fill='both' weightx='1.0' weighty='0.2'>
<JScrollPane>
- <JTextArea id="fieldPopulationBasicsComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldPopulationBasicsComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldPopulationBasicsComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPopulationBasicsComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -309,7 +220,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("Population")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -43,9 +43,6 @@
import org.codelutin.math.matrix.gui.MatrixPanelEvent;
import org.codelutin.math.matrix.gui.MatrixPanelListener;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -91,7 +88,7 @@
<row>
<cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JTextArea id="fieldPopulationCapturabilityComment" text='getBean().getCapturabilityComment()' onKeyTyped='getBean().setCapturabilityComment(fieldPopulationCapturabilityComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldPopulationCapturabilityComment" text='{jaxx.runtime.Util.getStringValue(getBean().getCapturabilityComment())}' onKeyReleased='getBean().setCapturabilityComment(fieldPopulationCapturabilityComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -43,12 +43,10 @@
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.PopulationImpl;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
+ getVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price);
naturalDeathRate.init(_("isisfish.populationEquation.naturalDeathRate"), (Formule)getBean().getNaturalDeathRate(), "PopulationNaturalDeathRate", fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class);
meanWeight.init(_("isisfish.populationEquation.meanWeight"), (Formule)getBean().getMeanWeight(), "PopulationMeanWeight", fr.ifremer.isisfish.equation.PopulationMeanWeight.class);
price.init(_("isisfish.populationEquation.price"), (Formule)getBean().getPrice(), "PopulationPrice", fr.ifremer.isisfish.equation.PopulationPrice.class);
@@ -60,18 +58,18 @@
</script>
<Table id='body'>
<row>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='naturalDeathRate' constructorParams='this'/>
+ <cell columns='2' fill='both' weightx='0.5' weighty='0.3'>
+ <InputOneEquationUI id='naturalDeathRate' constructorParams='this'/>
</cell>
</row>
<row>
<cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='meanWeight' constructorParams='this'/>
+ <InputOneEquationUI id='meanWeight' constructorParams='this'/>
</cell>
</row>
<row>
<cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='price' constructorParams='this'/>
+ <InputOneEquationUI id='price' constructorParams='this'/>
</cell>
</row>
<row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -47,9 +47,6 @@
import org.codelutin.math.matrix.gui.MatrixPanelListener;
import org.codelutin.math.matrix.gui.MatrixPanelEvent;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -91,7 +88,7 @@
<JLabel text="isisfish.populationGroup.meanWeigth" enabled='{isActif()}'/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupMeanWeight" text='getPopulationGroup().getMeanWeight()' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationGroupMeanWeight" text='{getPopulationGroup().getMeanWeight()}' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -99,7 +96,7 @@
<JLabel text="isisfish.populationGroup.price" enabled='{isActif()}'/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupPrice" text='getPopulationGroup().getPrice()' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationGroupPrice" text='{getPopulationGroup().getPrice()}' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -114,7 +111,7 @@
<JLabel text="isisfish.populationGroup.reproductionRate" enabled='{isActif()}'/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupReproductionRate" text='getPopulationGroup().getReproductionRate()' onKeyTyped='getPopulationGroup().setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationGroupReproductionRate" text='{getPopulationGroup().getReproductionRate()}' onKeyReleased='getPopulationGroup().setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -122,7 +119,7 @@
<JLabel text="isisfish.populationGroup.age" enabled='{isActif()}'/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupAge" text='getPopulationGroup().getAge()' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationGroupAge" text='{getPopulationGroup().getAge()}' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -130,10 +127,10 @@
<JLabel text="isisfish.populationGroup.length" enabled='{isActif()}'/>
</cell>
<cell fill='both' weightx='0.5'>
- <JTextField id="fieldPopulationGroupMinLength" text='getPopulationGroup().getMinLength()' onKeyTyped='getPopulationGroup().setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationGroupMinLength" text='{getPopulationGroup().getMinLength()}' onKeyReleased='getPopulationGroup().setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()))' enabled='{isActif()}'/>
</cell>
<cell fill='both' weightx='0.5'>
- <JTextField id="fieldPopulationGroupMaxLength" text='getPopulationGroup().getMaxLength()' onKeyTyped='getPopulationGroup().setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationGroupMaxLength" text='{getPopulationGroup().getMaxLength()}' onKeyReleased='getPopulationGroup().setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -142,7 +139,7 @@
</cell>
<cell columns='2' fill='both' weightx='1.0' weighty='0.5'>
<JScrollPane>
- <JTextArea id="fieldPopulationGroupComment" text='getPopulationGroup().getComment()' onKeyTyped='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldPopulationGroupComment" text='{jaxx.runtime.Util.getStringValue(getPopulationGroup().getComment())}' onKeyReleased='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -54,10 +54,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -46,16 +46,13 @@
import fr.ifremer.isisfish.entities.PopulationImpl;
import fr.ifremer.isisfish.entities.Formule;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
-
public void init(PopulationSeasonInfo pi){
setPopInfo((PopulationSeasonInfoImpl)pi);
}
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
+ getVerifier().addCurrentPanel(migrationEquation, emigrationEquation, immigrationEquation);
migrationEquation.init(_("isisfish.common.migration"), (Formule)getPopInfo().getMigrationEquation(), "Migration", fr.ifremer.isisfish.equation.MigrationEquation.class);
emigrationEquation.init(_("isisfish.common.emigration"), (Formule)getPopInfo().getEmigrationEquation(), "Emigration", fr.ifremer.isisfish.equation.EmigrationEquation.class);
immigrationEquation.init(_("isisfish.common.immigration"), (Formule)getPopInfo().getImmigrationEquation(), "Immigration", fr.ifremer.isisfish.equation.ImmigrationEquation.class);
@@ -68,17 +65,17 @@
<Table id='body'>
<row>
<cell fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='migrationEquation' constructorParams='this'/>
+ <InputOneEquationUI id='migrationEquation' constructorParams='this'/>
</cell>
</row>
<row>
<cell fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='emigrationEquation' constructorParams='this'/>
+ <InputOneEquationUI id='emigrationEquation' constructorParams='this'/>
</cell>
</row>
<row>
<cell fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='immigrationEquation' constructorParams='this'/>
+ <InputOneEquationUI id='immigrationEquation' constructorParams='this'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -53,9 +53,6 @@
protected PopulationSeasonInfo popInfo = null;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -53,9 +53,6 @@
protected PopulationSeasonInfo popInfo = null;
protected PopulationSeasonInfo pi;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -45,9 +45,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
+getVerifier().addCurrentPanel(populationMigrationEquationUI, populationMigrationMigrationUI, populationMigrationImmigrationUI, populationMigrationEmigrationUI);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -139,7 +137,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='0.3'>
<JScrollPane>
- <JTextArea id="fieldPopulationMigrationComment" text='getBean().getMigrationComment()' onKeyTyped='getBean().setMigrationComment(fieldPopulationMigrationComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldPopulationMigrationComment" text='{jaxx.runtime.Util.getStringValue(getBean().getMigrationComment())}' onKeyReleased='getBean().setMigrationComment(fieldPopulationMigrationComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -1,196 +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 $
- */
- -->
-
-<fr.ifremer.isisfish.ui.input.InputContentUI>
-
- <!-- bean property -->
- <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
-
- <script><![CDATA[
-import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
-import fr.ifremer.isisfish.entities.Formule;
-import fr.ifremer.isisfish.entities.Population;
-import fr.ifremer.isisfish.entities.PopulationImpl;
-import fr.ifremer.isisfish.entities.Equation;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-protected Class clazz = null;
-protected String nameEquation = null;
-protected String lblText;
-protected Formule f;
-protected String name;
-protected Class c;
-
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
-addPropertyChangeListener("bean", new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getOldValue() != null || evt.getNewValue() == null) {
- // remove previous binding on getBean()
- //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
-// fieldPopulationMonthGapBetweenReproRecrutement.setText("");
-// fieldPopulationRecruitmentComment.setText("");
- }
- if (evt.getNewValue() != null) {
- // add binding on getBean()
- //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
- }
- }
-});
-
-public void init(String lblText, Formule f, String name, Class c){
- this.lblText = lblText;
- this.f = f;
- this.name = name;
- this.c = c;
-}
-public void refresh(){
- Population population = (Population)getVerifier().getEntity(Population.class);
- setBean((PopulationImpl) population);
- lbl.setText(lblText);
- clazz = c;
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(PopulationOneEquationUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- setComboModel(f, name);
-}
-protected void setComboModel(Formule f, String name){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- GenericCell cellSelected = null;
- for (Formule formule : getAction().getFormules(getBean().getTopiaContext(),name)){
- GenericCell cell = new GenericCell(formule.getName(), formule, Formule.class);
- model.addElement(cell);
- if (formule.equals(f)){
- cellSelected = cell;
- }
- }
- combo.setModel(model);
- if (cellSelected != null){
- combo.setSelectedItem(cellSelected);
- Equation selected = getEquation();
- if (selected != null){
- editor.setText(selected.getContent());
- }
- }
-}
-protected void comboChanged(){
- Equation selected = getEquation();
- if (selected != null){
- editor.setText(selected.getContent());
- }
- valueChanged(true);
-}
-protected Equation getEquation(){
- Equation result = null;
- Object selected = combo.getSelectedItem();
- if (selected != null){
- GenericCell cell = (GenericCell) selected;
- if (cell.getValue() != null){
- result = (Equation)cell.getValue();
- }
- }
- return result;
-}
-protected void valueChanged(boolean b){
- changed = b;
- if (getParentContainer(PopulationEquationUI.class) != null){
-// getParentContainer(PopulationEquationUI.class).valueChanged(b);
- }
- else{
-// getParentContainer(PopulationMigrationUI.class).valueChanged(b);
- }
-}
-protected void saveModel(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
- }
- else{
- getContextValue(InputAction.class).saveAsModel(name, "Java", editor.getText());
- setComboModel(f, name);
- }
- refresh();
-// setInfoText(_("isisfish.message.saveModel.finished"));
-}
-protected void openEditor(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor);
- }
- else{
- getContextValue(InputAction.class).openEditor(name,"new",c, editor.getText(), editor);
- }
-}
- ]]>
- </script>
- <Table id='body'>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel id='lbl'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="combo" onActionPerformed='comboChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" onKeyTyped='valueChanged(true)' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
-</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -44,9 +44,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -65,30 +62,11 @@
public void refresh() {
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
- setFieldPopulationReproductionEquationModel();
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(PopulationRecruitmentUI.class.getName()).log(Level.SEVERE, null, ex);
- }
+
+ getVerifier().addCurrentPanel(reproductionEquation);
+ reproductionEquation.init(_("isisfish.populationRecruitment.reproductionEquation"), (Formule)getBean().getReproductionEquation(), "PopulationReproductionEquation", fr.ifremer.isisfish.equation.PopulationGrowth.class);
+ reproductionEquation.refresh();
}
-protected void setFieldPopulationReproductionEquationModel() {
- jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationReproductionEquation,getAction().getFormules(getBean().getTopiaContext(), "Reproduction"), getBean().getReproductionEquation());
-}
-protected void equationChanged(){
- Formule e = (Formule)fieldPopulationReproductionEquation.getSelectedItem();
- if (e != null){
- editor.setText(e.getContent());
- }
-}
-protected void saveModel(){
- getAction().saveAsModel("PopulationReproductionEquation", "Java", editor.getText());
- setFieldPopulationReproductionEquationModel();
- setInfoText(_("isisfish.message.saveModel.finished"));
-}
-protected void openEditor(){
- getAction().openEditor("PopulationReproductionEquation","new", fr.ifremer.isisfish.equation.PopulationGrowth.class, editor.getText(), editor);
-}
]]>
</script>
<Table id='body'>
@@ -96,45 +74,16 @@
<cell fill='both' weightx='1.0' weighty='1.0'>
<Table>
<row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationRecruitment.reproductionEquation" enabled='{isActif()}'/>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <InputOneEquationUI id='reproductionEquation' constructorParams='this'/>
</cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationReproductionEquation" onActionPerformed='equationChanged()' enabled='{isActif()}'/>
- </cell>
</row>
<row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.5'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
<cell anchor='east'>
<JLabel text="Month Gap BetweenRepro Recruitment" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='getBean().getMonthGapBetweenReproRecrutement()' onKeyTyped='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='{getBean().getMonthGapBetweenReproRecrutement()}' onKeyReleased='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -159,7 +108,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='0.5'>
<JScrollPane>
- <JTextArea id="fieldPopulationRecruitmentComment" text='getBean().getRecruitmentComment()' onKeyTyped='getBean().setRecruitmentComment(fieldPopulationRecruitmentComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldPopulationRecruitmentComment" text='{jaxx.runtime.Util.getStringValue(getBean().getRecruitmentComment())}' onKeyReleased='getBean().setRecruitmentComment(fieldPopulationRecruitmentComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -171,10 +120,10 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -69,9 +69,6 @@
}
});
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -97,27 +94,29 @@
interval.setFirst(0);
interval.setLast(2);
ip.setModel(interval);
- try {
- log.debug("************** Interval ************");
- Month firstMonth = getPopulationSeasonInfo().getFirstMonth();
+ if(getPopulationSeasonInfo() != null){
+ try {
+ log.debug("************** Interval ************");
+ Month firstMonth = getPopulationSeasonInfo().getFirstMonth();
- if (firstMonth != null) {
- interval.setFirst(firstMonth.getMonthNumber());
- log.debug(" first : " + interval.getFirst());
- } else {
- interval.setFirst(0);
- }
+ if (firstMonth != null) {
+ interval.setFirst(firstMonth.getMonthNumber());
+ log.debug(" first : " + interval.getFirst());
+ } else {
+ interval.setFirst(0);
+ }
- Month lastMonth = getPopulationSeasonInfo().getLastMonth();
- if (lastMonth != null) {
- interval.setLast(lastMonth.getMonthNumber());
- log.debug(" last : " + interval.getLast());
- } else {
- interval.setLast(3);
+ Month lastMonth = getPopulationSeasonInfo().getLastMonth();
+ if (lastMonth != null) {
+ interval.setLast(lastMonth.getMonthNumber());
+ log.debug(" last : " + interval.getLast());
+ } else {
+ interval.setLast(3);
+ }
+ } catch (Exception e) {
+ log.error("Unexpected origin.", e);
+ // Only trace the error and go on.
}
- } catch (Exception e) {
- log.error("Unexpected origin.", e);
- // Only trace the error and go on.
}
ip.setLabelRenderer(Month.MONTH);
ip.setModel(interval);
@@ -167,7 +166,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JTextArea id="fieldPopulationSeasonComment" text='getBean().getSeasonsComment()' onKeyTyped='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldPopulationSeasonComment" text='{jaxx.runtime.Util.getStringValue(getBean().getSeasonsComment())}' onKeyReleased='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -187,7 +186,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("PopulationSeasonInfo")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -46,9 +46,9 @@
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.PopulationImpl;
-setType("Population");
setButtonTitle("isisfish.input.continueGears");
setNextPath("$root/$gears");
+getVerifier().addCurrentPanel(populationBasicsUI, populationGroupUI, populationEquationUI, populationZoneUI, populationSeasonsUI, populationCapturabilityUI, populationRecruitementUI, populationMigrationUI);
public void refresh(){
populationBasicsUI.refresh();
@@ -59,22 +59,7 @@
populationCapturabilityUI.refresh();
populationRecruitementUI.refresh();
populationMigrationUI.refresh();
-// setSpecies();
}
-// protected void setSpecies(){
-// String[] paths = getContextValue(InputAction.class).getPath().split("/");
-// String topiaId = null;
-// for (String path : paths){
-// if (!path.matches("^\\$.+$")){
-// if (path.matches("^fr\\.ifremer\\.isisfish\\.entities\\.Species\\#.+$")){
-// topiaId = path;
-// }
-// }
-// }
-// if (topiaId != null){
-// getContextValue(InputAction.class).setSpecies(topiaId);
-// }
-// }
]]>
</script>
<JPanel id='body' layout='{new BorderLayout()}'>
@@ -104,6 +89,5 @@
<PopulationMigrationUI id='populationMigrationUI' constructorParams='this'/>
</tab>
</JTabbedPane>
- <!--JButton text="isisfish.input.continueGears" constraints='BorderLayout.SOUTH' onActionPerformed='goToGear()'/-->
</JPanel>
</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -48,9 +48,6 @@
import org.codelutin.math.matrix.gui.MatrixPanelEvent;
import org.codelutin.math.matrix.gui.MatrixPanelListener;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -42,52 +42,42 @@
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Species;
- import fr.ifremer.isisfish.entities.Port;
- import fr.ifremer.isisfish.entities.PortImpl;
- import fr.ifremer.isisfish.entities.Cell;
- import fr.ifremer.isisfish.map.IsisMapBean;
- 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;
+import fr.ifremer.isisfish.entities.Species;
+import fr.ifremer.isisfish.entities.Port;
+import fr.ifremer.isisfish.entities.PortImpl;
+import fr.ifremer.isisfish.entities.Cell;
+import fr.ifremer.isisfish.map.IsisMapBean;
+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 OMToolSet toolSet = new OMToolSet();
- protected OpenMapEvents mapListener = null;
+protected OMToolSet toolSet = new OMToolSet();
+protected OpenMapEvents mapListener = null;
- public void refresh() {
- Port port = (Port)getVerifier().getEntity(Port.class);
- setBean((PortImpl) port);
- if (getBean() != null){
- fieldPortName.setText(getBean().getName());
-
- DefaultListModel portCellModel = new DefaultListModel();
- java.util.List<Cell> cells = getRegion().getCell();
- for (Cell c : cells){
- portCellModel.addElement(c);
- }
- portCell.setModel(portCellModel);
- portCell.setSelectedValue(getBean().getCell());
-
- fieldPortComment.setText(getBean().getComment());
- }
- else{
+setButtonTitle("isisfish.input.continueSpecies");
+setNextPath("$root/$species");
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldPortName.setText("");
-
- DefaultListModel portCellModel = new DefaultListModel();
- java.util.List<Cell> cells = getRegion().getCell();
- for (Cell c : cells){
- portCellModel.addElement(c);
- }
- portCell.setModel(portCellModel);
-
fieldPortComment.setText("");
-
-
}
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
+ }
+});
+ public void refresh() {
+ Port port = (Port)getVerifier().getEntity(Port.class);
+ setBean((PortImpl) port);
+ jaxx.runtime.swing.Utils.fillList(portCell, getRegion().getCell(), getBean().getCell());
portMap.setFisheryRegion(getRegion());
if(mapListener == null){
portMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
@@ -120,15 +110,6 @@
};
}
}
- protected void nameChanged(){
- getBean().setName(fieldPortName.getText());
- }
- protected void portCellChanged(){
- getBean().setCell((Cell)portCell.getSelectedValue());
- }
- protected void commentChanged(){
- getBean().setComment(fieldPortComment.getText());
- }
]]>
</script>
<Table id='body'>
@@ -144,7 +125,7 @@
</row>
<row>
<cell columns='2' fill='horizontal' weightx='1.0' >
- <JTextField id="fieldPortName" onKeyTyped='nameChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldPortName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldPortName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -156,7 +137,7 @@
<row>
<cell columns='2' fill='both' weighty='0.7' weightx='1.0'>
<JScrollPane>
- <JList id="portCell" selectionMode="0" onMouseClicked='portCellChanged()' enabled='{isActif()}'/>
+ <JList id="portCell" selectionMode="0" onMouseClicked='getBean().setCell((Cell)portCell.getSelectedValue())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -168,7 +149,7 @@
<row>
<cell columns='2' fill='both' weighty='0.3' weightx='1.0' >
<JScrollPane>
- <JTextArea id="fieldPortComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ <JTextArea id="fieldPortComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldPortComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -182,7 +163,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("Port")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -61,20 +61,13 @@
setBean(null);
Gear gear = (Gear)getVerifier().getEntity(Gear.class);
setBean((GearImpl) gear);
- fieldSelectivityPopulation.setModel(getSelectivityPopulationModel());
- fieldSelectivityEquation.setModel(getSelectivityEquationModel());
- if (getBean() != null){
- setSelectivityTableModel();
- }
- else{
- DefaultTableModel model = new DefaultTableModel();
- selectivityTable.setModel(model);
- }
- try {
- fieldSelectivityScript.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(SelectivityUI.class.getName()).log(Level.SEVERE, null, ex);
- }
+ fieldSelectivityPopulation.setModel(getSelectivityPopulationModel());
+ setSelectivityTableModel();
+
+ getVerifier().addCurrentPanel(selectivityEquation);
+// TODO : Equation selection
+ selectivityEquation.init(_("isisfish.selectivity.equation"), null, "SelectivityEquation", fr.ifremer.isisfish.equation.SelectivityEquation.class);
+ selectivityEquation.refresh();
}
protected void setSelectivityTableModel(){
DefaultTableModel model = new DefaultTableModel(){
@@ -118,47 +111,14 @@
}
return selectivityPopulationModel;
}
- protected DefaultComboBoxModel getSelectivityEquationModel(){
- java.util.List<Formule> formules = fr.ifremer.isisfish.datastore.FormuleStorage.getFormules(getContextValue(TopiaContext.class), "Selectivity");
- DefaultComboBoxModel selectivityEquationModel = new DefaultComboBoxModel();
- if (formules != null){
- selectivityEquationModel.addElement(new GenericCell(" ", null, null));
- for (Formule f : formules){
- GenericCell g = new GenericCell(f.getName(), f, Formule.class);
- selectivityEquationModel.addElement(g);
- }
- }
- return selectivityEquationModel;
- }
- protected void saveAsModel(){
- getAction().saveAsModel("SelectivityEquation", "Java", fieldSelectivityScript.getText());
- fieldSelectivityEquation.setModel(getSelectivityEquationModel());
- setInfoText(_("isisfish.message.saveModel.finished"));
- }
- protected void openEditor(){
- getAction().openEditor("SelectivityEquation", "new", fr.ifremer.isisfish.equation.SelectivityEquation.class, fieldSelectivityScript.getText(), fieldSelectivityScript);
- }
protected void add(){
- getAction().addSelectivity((Population) ((GenericCell) fieldSelectivityPopulation.getSelectedItem()).getValue(), fieldSelectivityScript.getText(), getBean());
+ getAction().addSelectivity((Population) ((GenericCell) fieldSelectivityPopulation.getSelectedItem()).getValue(), selectivityEquation.getEditor().getText(), getBean());
refresh();
}
protected void remove(){
getAction().removeSelectivity(getBean(), (Selectivity) getBean().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0)));
refresh();
}
- protected void equationChanged(){
- GenericCell g = (GenericCell)fieldSelectivityEquation.getSelectedItem();
- if (g.getValue() != null){
- fieldSelectivityScript.setText(((Formule)(g).getValue()).getContent());
- }
- else {
- try {
- fieldSelectivityScript.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(SelectivityUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
]]>
</script>
<Table id='body'>
@@ -174,39 +134,10 @@
</cell>
</row>
<row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.selectivity.equation" enabled='{isActif()}'/>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <InputOneEquationUI id='selectivityEquation' constructorParams='this'/>
</cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSelectivityEquation" onActionPerformed='equationChanged()' enabled='{isActif()}'/>
- </cell>
</row>
- <row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton id='saveModel' text="isisfish.common.saveModel" onActionPerformed='saveAsModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id='openEditor' text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='fieldSelectivityScript' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
</Table>
</cell>
</row>
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -48,9 +48,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-setType("SetOfVessels");
-setButtonTitle("");
-setNextPath(null);
+getVerifier().addCurrentPanel(technicalEfficiency);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -67,38 +65,15 @@
}
}
});
- public void refresh() {
- SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class);
- setBean((SetOfVesselsImpl) setOfVessels);
- jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsPort,getRegion().getPort(), getBean().getPort());
- jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsVesselType,getRegion().getVesselType(), getBean().getVesselType());
- jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsTechnicalEfficiency,getAction().getFormules(getBean().getTopiaContext(),"TechnicalEfficiency"), getBean().getTechnicalEfficiencyEquation());
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(SelectivityUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- protected void technicalEfficiencyChanged(){
- if (fieldSetOfVesselsTechnicalEfficiency.getSelectedItem() != null){
- editor.setText(((Formule)fieldSetOfVesselsTechnicalEfficiency.getSelectedItem()).getContent());
- getBean().setTechnicalEfficiencyEquation((Equation)fieldSetOfVesselsTechnicalEfficiency.getSelectedItem());
- }
- else{
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(MetierSeasonInfoSpeciesUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- protected void saveAsModel(){
- getContextValue(InputAction.class).saveAsModel("SoVTechnicalEfficiencyEquation", "Java", editor.getText());
- setInfoText(_("isisfish.message.saveModel.finished"));
- }
- protected void openEditor(){
- getContextValue(InputAction.class).openEditor("SoVTechnicalEfficiencyEquation","new",fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class, editor.getText(), editor);
- }
+public void refresh() {
+ SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class);
+ setBean((SetOfVesselsImpl) setOfVessels);
+ jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsPort,getRegion().getPort(), getBean().getPort());
+ jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsVesselType,getRegion().getVesselType(), getBean().getVesselType());
+
+ technicalEfficiency.init(_("isisfish.setOfVessels.technicalEfficiency"), (Formule)getBean().getTechnicalEfficiencyEquation(), "SoVTechnicalEfficiencyEquation", fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class);
+ technicalEfficiency.refresh();
+}
]]>
</script>
<Table id='body'>
@@ -110,7 +85,7 @@
<JLabel text="isisfish.setOfVessels.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldSetOfVesselsName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldSetOfVesselsName.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldSetOfVesselsName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldSetOfVesselsName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -134,7 +109,7 @@
<JLabel text="isisfish.setOfVessels.numberOfVessels" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldSetOfVesselsNumberOfVessels" text='getBean().getNumberOfVessels()' onKeyTyped='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldSetOfVesselsNumberOfVessels" text='{getBean().getNumberOfVessels()}' onKeyReleased='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -142,50 +117,21 @@
<JLabel text="isisfish.setOfVessels.fixedCosts" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldSetOfVesselsFixedCosts" text='getBean().getFixedCosts()' onKeyTyped='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldSetOfVesselsFixedCosts" text='{getBean().getFixedCosts()}' onKeyReleased='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
- <cell anchor='east'>
- <JLabel text="isisfish.setOfVessels.technicalEfficiency" enabled='{isActif()}'/>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
+ <InputOneEquationUI id='technicalEfficiency' constructorParams='this'/>
</cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSetOfVesselsTechnicalEfficiency" onActionPerformed='technicalEfficiencyChanged()' enabled='{isActif()}'/>
- </cell>
</row>
<row>
- <cell fill='both' weighty='0.7'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveAsModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.7'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
<cell anchor='east'>
<JLabel text="isisfish.setOfVessels.comments" enabled='{isActif()}'/>
</cell>
<cell fill='both' weightx='1.0' weighty='0.3'>
<JScrollPane>
- <JTextArea id="fieldSetOfVesselsComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldSetOfVesselsComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldSetOfVesselsComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldSetOfVesselsComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -205,7 +151,7 @@
</row>
<row>
<cell fill='horizontal' weightx='1.0'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("SetOfVessels")'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
<JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -39,10 +39,10 @@
<script><![CDATA[
-setType("SetOfVessels");
setButtonTitle("isisfish.input.continueStrategies");
setNextPath("$root/$strategies");
public void refresh() {
+ getVerifier().addCurrentPanel(setOfVesselsTabsUI, effortDescriptionUI);
setOfVesselsTabsUI.refresh();
effortDescriptionUI.refresh();
}
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -44,9 +44,7 @@
import fr.ifremer.isisfish.entities.Species;
import fr.ifremer.isisfish.entities.SpeciesImpl;
-setType("Species");
setButtonTitle("isisfish.input.continuePopulations");
-setNextPath("$root/$species/" + getBean().getTopiaId() + "/$population");
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -55,7 +53,7 @@
fieldSpeciesName.setText("");
fieldSpeciesScientificName.setText("");
fieldSpeciesCodeRubbin.setText("");
- fieldSpeciesCEE.setText("");
+ fieldSpeciesCEE.setText(0 + "");
fieldSpeciesComment.setText("");
}
if (evt.getNewValue() != null) {
@@ -67,6 +65,7 @@
public void refresh() {
Species species = (Species)getVerifier().getEntity(Species.class);
setBean((SpeciesImpl) species);
+ setNextPath("$root/$species/" + getBean().getTopiaId() + "/$populations");
}
]]>
</script>
@@ -79,7 +78,7 @@
<JLabel text="isisfish.species.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldSpeciesName.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldSpeciesName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -87,7 +86,7 @@
<JLabel text="isisfish.species.scientificName" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesScientificName" text='getBean().getScientificName()' onKeyTyped='getBean().setScientificName(fieldSpeciesScientificName.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesScientificName" text='{jaxx.runtime.Util.getStringValue(getBean().getScientificName())}' onKeyReleased='getBean().setScientificName(fieldSpeciesScientificName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -95,7 +94,7 @@
<JLabel text="isisfish.species.rubbinCode" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesCodeRubbin" text='getBean().getCodeRubbin()' onKeyTyped='getBean().setCodeRubbin(fieldSpeciesCodeRubbin.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesCodeRubbin" text='{jaxx.runtime.Util.getStringValue(getBean().getCodeRubbin())}' onKeyReleased='getBean().setCodeRubbin(fieldSpeciesCodeRubbin.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -103,7 +102,7 @@
<JLabel text="isisfish.species.cee" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesCEE" text='getBean().getCodeCEE()' onKeyTyped='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldSpeciesCEE" text='{getBean().getCodeCEE()}' onKeyReleased='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -123,7 +122,7 @@
</cell>
<cell fill='both' columns='2' weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JTextArea id="fieldSpeciesComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldSpeciesComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldSpeciesComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldSpeciesComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -143,7 +142,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("Species")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -36,9 +36,7 @@
<script><![CDATA[
import fr.ifremer.isisfish.types.Month;
-setType("Population");
-setButtonTitle("");
-setNextPath(null);
+getVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, strategyApril, strategyMay, strategyJune, strategyJuly, strategyAugust, strategySeptember, strategyOctober, strategyNovember, strategyDecember);
public void refresh() {
strategyJanuary.init(Month.JANUARY);
strategyFebuary.init(Month.FEBRUARY);
@@ -66,7 +64,7 @@
strategyDecember.refresh();
}
]]></script>
- <JPanel id='body'>
+ <JPanel id='body' layout='{new BorderLayout()}'>
<Table constraints='BorderLayout.CENTER'>
<row>
<cell fill='both' weightx='0.25' weighty='0.3'>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -52,9 +52,6 @@
Month month = null;
PropertyChangeListener listener = null;
-setType("Strategy");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -104,7 +101,7 @@
<JLabel text="isisfish.strategyMonthInfo.numberOfTrips" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5' anchor='west'>
- <JLabel id='numberOfTrips' text='getStrategyMonthInfo().getNumberOfTrips()' enabled='{isActif()}'/>
+ <JLabel id='numberOfTrips' text='{getStrategyMonthInfo().getNumberOfTrips()}' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -112,7 +109,7 @@
<JLabel text="isisfish.strategyMonthInfo.minInactivityDays" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='getStrategyMonthInfo().getMinInactivityDays()' onKeyTyped='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='{getStrategyMonthInfo().getMinInactivityDays()}' onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -48,9 +48,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-setType("Strategy");
-setButtonTitle("");
-setNextPath(null);
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -69,27 +66,15 @@
public void refresh() {
Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class);
setBean((StrategyImpl) strategy);
+ getVerifier().addCurrentPanel(strategyInactivity);
+ strategyInactivity.init("", (Formule)getBean().getInactivityEquation(), "StrategyInactivityEquation", fr.ifremer.isisfish.equation.StrategyInactivityEquation.class);
+ strategyInactivity.refresh();
+
setSetOfVesselsModel();
- setInactivityModel();
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(StrategyTabUI.class.getName()).log(Level.SEVERE, null, ex);
- }
}
-protected void setInactivityModel(){
- jaxx.runtime.swing.Utils.fillComboBox(fieldStrategyInactivity,getAction().getFormules(getBean().getTopiaContext(), "Inactivity"), null);
-}
protected void setSetOfVesselsModel(){
jaxx.runtime.swing.Utils.fillComboBox(fieldStrategySetOfVessels,getRegion().getSetOfVessels(), getBean().getSetOfVessels());
}
-protected void saveModel(){
-// GenericCell g = (GenericCell)fieldStrategyInactivity.getSelectedItem();
-// getContextValue(InputAction.class).saveEquationAsModel((Equation)g.getValue());
- getAction().saveAsModel("StrategyInactivityEquation", "Java", editor.getText());
- setInactivityModel();
- setInfoText(_("isisfish.message.saveModel.finished"));
-}
]]></script>
<Table id='body'>
<row>
@@ -100,7 +85,7 @@
<JLabel text="isisfish.strategy.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldStrategyName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldStrategyName.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldStrategyName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldStrategyName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -116,7 +101,7 @@
<JLabel text="isisfish.strategy.proportionSetOfVessels" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldStrategyProportionSetOfVessels" text='getBean().getProportionSetOfVessels()' onKeyTyped='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldStrategyProportionSetOfVessels" text='{getBean().getProportionSetOfVessels()}' onKeyReleased='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -128,44 +113,17 @@
</cell>
</row>
<row>
- <cell anchor='west'>
- <JLabel text="isisfish.strategy.inactivity" enabled='{isActif()}'/>
+ <cell columns="2" fill='both' weightx='1.0'>
+ <InputOneEquationUI id="strategyInactivity" constructorParams='this'/>
</cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldStrategyInactivity" onActionPerformed='editor.setText(((Formule)fieldStrategyInactivity.getSelectedItem()).getContent())' enabled='{isActif()}'/>
- </cell>
</row>
<row>
- <cell fill='both' weighty='0.7'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='getAction().openEditor("StrategyInactivityEquation","new",fr.ifremer.isisfish.equation.StrategyInactivityEquation.class, editor.getText(), editor)' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.7'>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
<cell anchor='west'>
<JLabel text="isisfish.strategy.comments" enabled='{isActif()}'/>
</cell>
<cell fill='both' weightx='1.0' weighty='0.3'>
<JScrollPane>
- <JTextArea id="fieldStrategyComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldStrategyComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -185,7 +143,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("Strategy")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -36,10 +36,12 @@
+-->
<fr.ifremer.isisfish.ui.input.InputContentUI>
<script><![CDATA[
- public void refresh() {
- strategyTabUI.refresh();
- strategyMonthInfoUI.refresh();
- }
+
+public void refresh() {
+ getVerifier().addCurrentPanel(strategyTabUI, strategyMonthInfoUI);
+ strategyTabUI.refresh();
+ strategyMonthInfoUI.refresh();
+}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
<JTabbedPane id="StrategyTab" name="Strategy" constraints='BorderLayout.CENTER'>
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -43,9 +43,8 @@
import fr.ifremer.isisfish.entities.TripTypeImpl;
import fr.ifremer.isisfish.types.TimeUnit;
-setType("TripType");
-setButtonTitle("isisfish.input.continueZones");
-setNextPath("$root/$zones");
+setButtonTitle("isisfish.input.continueVesselTypes");
+setNextPath("$root/$vesselTypes");
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -77,7 +76,7 @@
<JLabel text="isisfish.tripType.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldTripTypeName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldTripTypeName.getText())' enabled='{isActif()}'/>
+ <JTextField id="fieldTripTypeName" text='{getBean().getName()}' onKeyReleased='getBean().setName(fieldTripTypeName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -85,7 +84,7 @@
<JLabel text="isisfish.tripType.duration" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldTripTypeDuration" text='getBean().getTripDuration().getHour()' onKeyTyped='getBean().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600))' enabled='{isActif()}'/>
+ <JTextField id="fieldTripTypeDuration" text='{getBean().getTripDuration().getHour()}' onKeyReleased='getBean().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -93,7 +92,7 @@
<JLabel text="isisfish.tripType.minTime" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldTripTypeMinTimeBetweenTrip" text='getBean().getMinTimeBetweenTrip().getHour()' onKeyTyped='getBean().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText()) * 3600))' enabled='{isActif()}'/>
+ <JTextField id="fieldTripTypeMinTimeBetweenTrip" text='{getBean().getMinTimeBetweenTrip().getHour()}' onKeyReleased='getBean().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText()) * 3600))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -102,7 +101,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='1.0'>
<JScrollPane>
- <JTextArea id="fieldTripTypeComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldTripTypeComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldTripTypeComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldTripTypeComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -114,18 +113,18 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ <JButton javaBean='getVerifier().getSaveButton()'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ <JButton javaBean='getVerifier().getCancelButton()'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton javaBean='getVerifier().getNewButton("TripType")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ <JButton javaBean='getVerifier().getDeleteButton()'/>
</cell>
</row>
</Table>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -40,12 +40,10 @@
import fr.ifremer.isisfish.entities.VesselType;
import fr.ifremer.isisfish.entities.VesselTypeImpl;
import fr.ifremer.isisfish.entities.TripType;
-import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
import fr.ifremer.isisfish.types.TimeUnit;
-setType("VesselType");
-setButtonTitle("isisfish.input.continueZones");
-setNextPath("$root/$zones");
+setButtonTitle("isisfish.input.continueSetOfVessels");
+setNextPath("$root/$setOfVessels");
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
@@ -76,7 +74,7 @@
Object[] values = vesselTypeTripType.getSelectedValues();
Collection<TripType> tripTypes = new LinkedList<TripType>();
for (Object o : values){
- tripTypes.add((TripType)((GenericCell)o).getValue());
+ tripTypes.add((TripType)o);
}
getBean().setTripType(tripTypes);
}
@@ -90,7 +88,7 @@
<JLabel text="isisfish.vesselType.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeName" text='getBean().getName()' enabled='{isActif()}' onKeyTyped='getBean().setName(fieldVesselTypeName.getText())'/>
+ <JTextField id="fieldVesselTypeName" text='{getBean().getName()}' enabled='{isActif()}' onKeyReleased='getBean().setName(fieldVesselTypeName.getText())'/>
</cell>
</row>
<row>
@@ -98,7 +96,7 @@
<JLabel text="isisfish.vesselType.length" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeLength" text='getBean().getLength()' enabled='{isActif()}' onKeyTyped='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))'/>
+ <JTextField id="fieldVesselTypeLength" text='{getBean().getLength()}' enabled='{isActif()}' onKeyReleased='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))'/>
</cell>
</row>
<row>
@@ -106,7 +104,7 @@
<JLabel text="isisfish.vesselType.speed" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeSpeed" text='getBean().getSpeed()' enabled='{isActif()}' onKeyTyped='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))'/>
+ <JTextField id="fieldVesselTypeSpeed" text='{getBean().getSpeed()}' enabled='{isActif()}' onKeyReleased='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))'/>
</cell>
</row>
<row>
@@ -114,7 +112,7 @@
<JLabel text="isisfish.vesselType.maxDuration" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeMaxTripDuration" text='getBean().getMaxTripDuration().getHour()' enabled='{isActif()}' onKeyTyped='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText())))'/>
+ <JTextField id="fieldVesselTypeMaxTripDuration" text='{getBean().getMaxTripDuration().getHour()}' enabled='{isActif()}' onKeyReleased='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText())))'/>
</cell>
</row>
<row>
@@ -122,7 +120,7 @@
<JLabel text="isisfish.vesselType.activityRange" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeActivityRange" text='getBean().getActivityRange()' enabled='{isActif()}' onKeyTyped='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))'/>
+ <JTextField id="fieldVesselTypeActivityRange" text='{getBean().getActivityRange()}' enabled='{isActif()}' onKeyReleased='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))'/>
</cell>
</row>
<row>
@@ -130,7 +128,7 @@
<JLabel text="isisfish.vesselType.miniCrew" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeMinCrewSize" text='getBean().getMinCrewSize()' enabled='{isActif()}' onKeyTyped='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))'/>
+ <JTextField id="fieldVesselTypeMinCrewSize" text='{getBean().getMinCrewSize()}' enabled='{isActif()}' onKeyReleased='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))'/>
</cell>
</row>
<row>
@@ -138,7 +136,7 @@
<JLabel text="isisfish.vesselType.fuelCost" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='getBean().getUnitFuelCostOfTravel()' onKeyTyped='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' enabled='{isActif()}'/>
+ <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='{getBean().getUnitFuelCostOfTravel()}' onKeyReleased='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -157,7 +155,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='0.3'>
<JScrollPane>
- <JTextArea id="fieldVesselTypeComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldVesselTypeComment.getText())' enabled='{isActif()}'/>
+ <JTextArea id="fieldVesselTypeComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldVesselTypeComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -177,7 +175,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("VesselType")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
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 2009-01-02 17:22:09 UTC (rev 1725)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2009-01-09 10:15:37 UTC (rev 1726)
@@ -52,7 +52,6 @@
protected OMToolSet toolSet = new OMToolSet();
protected MapMouseListener mapListener = null;
-setType("Zone");
setButtonTitle("isisfish.input.continuePorts");
setNextPath("$root/$ports");
addPropertyChangeListener("bean", new PropertyChangeListener() {
@@ -71,6 +70,7 @@
});
public void refresh() {
+ setBean(null);
Zone zone = (Zone)getVerifier().getEntity(Zone.class);
setBean((ZoneImpl) zone);
jaxx.runtime.swing.Utils.fillList(zoneCells, getRegion().getCell(), getBean().getCell());
@@ -81,8 +81,8 @@
toolSet.setupListeners(zoneMap);
toolMap.add((Component)toolSet);
setMapListener();
+ refreshMap();
}
- refreshMap();
}
protected void setMapListener(){
if (mapListener == null){
@@ -126,7 +126,7 @@
<JTextField id="fieldZoneName"
text='{jaxx.runtime.Util.getStringValue(getBean().getName())}'
enabled='{isActif()}'
- onKeyTyped='getBean().setName(fieldZoneName.getText())'/>
+ onKeyReleased='getBean().setName(fieldZoneName.getText())'/>
</cell>
</row>
<row>
@@ -152,7 +152,7 @@
<JTextArea id="fieldZoneComment"
text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}'
enabled='{isActif()}'
- onKeyTyped='getBean().setComment(fieldZoneComment.getText())'/>
+ onKeyReleased='getBean().setComment(fieldZoneComment.getText())'/>
</JScrollPane>
</cell>
</row>
@@ -166,7 +166,7 @@
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton("Zone")'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
<JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
1
0
Author: sletellier
Date: 2009-01-02 17:22:09 +0000 (Fri, 02 Jan 2009)
New Revision: 1725
Modified:
isis-fish/trunk/pom.xml
Log:
Utilisation des binding
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-01-02 17:22:04 UTC (rev 1724)
+++ isis-fish/trunk/pom.xml 2009-01-02 17:22:09 UTC (rev 1725)
@@ -57,15 +57,22 @@
<version>${lutinwidget.version}</version>
<scope>compile</scope>
</dependency>
-
+
<!--Jaxx-->
<dependency>
<groupId>org.codelutin</groupId>
- <artifactId>jaxx-core</artifactId>
+ <artifactId>jaxx-runtime-swing</artifactId>
<version>${jaxx.version}</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.codelutin</groupId>
+ <artifactId>jaxx-runtime-validator</artifactId>
+ <version>${jaxx.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
<!--Commons-->
<dependency>
<groupId>commons-jxpath</groupId>
@@ -315,7 +322,7 @@
<labs.project>isis-fish</labs.project>
<!-- Custom version -->
- <jaxx.version>0.8-SNAPSHOT</jaxx.version>
+ <jaxx.version>1.0-SNAPSHOT</jaxx.version>
<generator.version>0.63</generator.version>
<topia.version>2.1.2-SNAPSHOT</topia.version>
<lutinwidget.version>0.12-SNAPSHOT</lutinwidget.version>
@@ -391,10 +398,11 @@
<configuration>
<src>${project.basedir}/src/main/java</src>
<addSourcesToClassPath>true</addSourcesToClassPath>
+ <addProjectClassPath>true</addProjectClassPath>
</configuration>
</execution>
</executions>
- <dependencies>
+ <!--dependencies>
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutinwidget</artifactId>
@@ -420,7 +428,7 @@
<artifactId>openmap</artifactId>
<version>${openmap.version}</version>
</dependency>
- </dependencies>
+ </dependencies-->
</plugin>
<plugin>
1
0
r1724 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui: . input script simulator
by sletellier@users.labs.libre-entreprise.org 02 Jan '09
by sletellier@users.labs.libre-entreprise.org 02 Jan '09
02 Jan '09
Author: sletellier
Date: 2009-01-02 17:22:04 +0000 (Fri, 02 Jan 2009)
New Revision: 1724
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
Removed:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContent.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/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/GearUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.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/SetOfVesselsUI.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/StrategyMonthInfoUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.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/StrategyUI.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/VesselTypeUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx
Log:
Utilisation des binding
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeTabUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,6 +35,8 @@
import fr.ifremer.isisfish.ui.simulator.SimulAction;
import fr.ifremer.isisfish.ui.input.InputAction;
import fr.ifremer.isisfish.ui.result.ResultAction;
+ import jaxx.runtime.JAXXInitialContext;
+ import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
simulUI.getContextValue(SimulAction.class).init();
]]>
@@ -47,7 +49,7 @@
<fr.ifremer.isisfish.ui.result.ResultView/>
</tab>
<tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/book.gif"))}'>
- <fr.ifremer.isisfish.ui.input.InputUI constructorParams='new InputAction()'/>
+ <fr.ifremer.isisfish.ui.input.InputUI constructorParams='new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier())'/>
</tab>
<tab title=' ' icon='{new ImageIcon(getClass().getResource("/images/bookPage.gif"))}'>
<fr.ifremer.isisfish.ui.script.ScriptUI/>
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/WelcomeUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -45,6 +45,8 @@
import fr.ifremer.isisfish.IsisConfig;
import javax.swing.JFrame;
import org.codelutin.widget.AboutFrame;
+ import jaxx.runtime.JAXXInitialContext;
+ import fr.ifremer.isisfish.ui.input.InputSaveVerifier;
welcomePanelUI.setContent(new WelcomeTabUI());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@@ -111,7 +113,7 @@
<JMenu text="isisfish.welcome.menu.frame">
<JMenuItem text="isisfish.welcome.menu.simulation" onActionPerformed='openFrame(new SimulUI(new SimulAction()), _("isisfish.simulation.title"))'/>
<JMenuItem text="isisfish.welcome.menu.result" onActionPerformed='openFrame(new ResultView(), _("isisfish.result.title"))'/>
- <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='openFrame(new InputUI(new InputAction()), _("isisfish.input.title"))'/>
+ <JMenuItem text="isisfish.welcome.menu.input" onActionPerformed='openFrame(new InputUI(new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier())), _("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 QueueUI(), _("isisfish.queue.title"))'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -30,18 +30,13 @@
* by : $Author: sletellier $
*/
-->
-
+
+
<!--
+ Cell
+-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- edit property -->
- <Boolean id='actif' javaBean='false'/>
-
- <!-- change property -->
- <Boolean id='changed' javaBean='false'/>
-
<!-- bean property -->
<fr.ifremer.isisfish.entities.CellImpl id='bean' javaBean='null'/>
@@ -49,29 +44,20 @@
import fr.ifremer.isisfish.entities.Cell;
import fr.ifremer.isisfish.entities.CellImpl;
import com.bbn.openmap.gui.OMToolSet;
-import fr.ifremer.isisfish.map.IsisMapBean;
-import fr.ifremer.isisfish.map.OpenMapToolPanel;
-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 OpenMapToolPanel toolMap = new OpenMapToolPanel();
protected OMToolSet toolSet = new OMToolSet();
protected OpenMapEvents mapListener = null;
+setType("Cell");
+setButtonTitle("isisfish.input.continueZones");
+setNextPath("$root/$zones");
addPropertyChangeListener("bean", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
// remove previous binding on getBean()
- jaxx.runtime.Util.removeDataBinding($Table0, "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldCellName.setText("");
fieldCellLatitude.setText("");
fieldCellLongitude.setText("");
@@ -80,31 +66,27 @@
}
if (evt.getNewValue() != null) {
// add binding on getBean()
- jaxx.runtime.Util.applyDataBinding($Table0, "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
}
});
public void refresh() {
- InputAction action = getContextValue(InputAction.class);
- setBean(null);
- Cell cell = action.getCell();
+ Cell cell = (Cell)getVerifier().getEntity(Cell.class);
setBean((CellImpl) cell);
- jaxx.runtime.swing.Utils.fillComboBox(fieldCell,action.getFisheryRegion().getCell(), cell);
- cellMap.setFisheryRegion(action.getFisheryRegion());
+ jaxx.runtime.swing.Utils.fillComboBox(fieldCell,getRegion().getCell(), cell);
+ cellMap.setFisheryRegion(getRegion());
if (mapListener == null){
cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
cellMap.setActiveMouseMode(new SelectMouseMode());
toolSet.setupListeners(cellMap);
toolMap.add((Component)toolSet);
- map.add(toolMap, BorderLayout.NORTH);
setMapListener();
}
if (cell != null){
cellMap.setSelectedCells(cell);
}
- setChanged(false);
}
protected void setMapListener(){
if (mapListener == null){
@@ -120,19 +102,7 @@
};
}
}
-protected void save() {
- TopiaEntity topia = getContextValue(InputAction.class).save();
- getParentContainer(InputUI.class).repaintNode("$root/$cells/" + topia.getTopiaId());
- refresh();
- getParentContainer(WelcomePanelUI.class).setInfoText(_("isisfish.message.save.finished"));
-}
-protected void cancel() {
- getContextValue(InputAction.class).cancel();
- refresh();
- getParentContainer(WelcomePanelUI.class).setInfoText(_("isisfish.message.cancel.finished"));
-}
-
protected void fieldCellChanged() {
Cell c = (Cell)fieldCell.getSelectedItem();
if (c==null) {
@@ -146,9 +116,8 @@
getParentContainer(InputUI.class).setTreeSelection("$root/$cells/"+c.getTopiaId());
}
]]></script>
- <row>
- <cell fill='both' weighty='1.0' weightx='1.0'>
- <JSplitPane id="CellTab" name="Cells"
+ <JPanel id='body' layout='{new BorderLayout()}'>
+ <JSplitPane id="CellTab" name="Cells" constraints='BorderLayout.CENTER'
oneTouchExpandable="true" dividerLocation="200" orientation="horizontal">
<Table>
<row>
@@ -161,7 +130,7 @@
<JLabel text="isisfish.cell.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldCellName" text='{getBean().getName()}' onKeyTyped='setChanged(true)' onFocusLost='if (isChanged()) {getBean().setName(fieldCellName.getText());}' enabled='{isActif()}'/>
+ <JTextField id="fieldCellName" text='{jaxx.runtime.Util.getStringValue(getBean().getName())}' onKeyReleased='setChanged(true)' onFocusLost='getBean().setName(fieldCellName.getText())' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -185,7 +154,7 @@
<JLabel text="isisfish.cell.land" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JCheckBox id="fieldCellLand" onActionPerformed='setChanged(true); getBean().setLand(fieldCellLand.isSelected());' enabled='{isActif()}' selected='{getBean().getLand()}'/>
+ <JCheckBox id="fieldCellLand" onActionPerformed='getBean().setLand(fieldCellLand.isSelected())' enabled='{isActif()}' selected='{getBean().getLand()}'/>
</cell>
</row>
<row>
@@ -196,28 +165,23 @@
<row>
<cell columns='2' fill='both' weighty='1.0' weightx='1.0'>
<JScrollPane>
- <JTextArea id="fieldCellComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyTyped='setChanged(true)' onFocusLost='if (isChanged()) { getBean().setComment(fieldCellComment.getText()); }' enabled='{isActif()}'/>
+ <JTextArea id="fieldCellComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldCellComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
</cell>
</row>
</Table>
<JPanel id='map' layout='{new BorderLayout()}'>
- <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'/>
+ <fr.ifremer.isisfish.map.OpenMapToolPanel id='toolMap' javaBean='new fr.ifremer.isisfish.map.OpenMapToolPanel()' constraints='BorderLayout.NORTH'/>
+ <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' constraints='BorderLayout.CENTER'/>
</JPanel>
</JSplitPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton text="isisfish.input.continueZones" onActionPerformed='getParentContainer(InputUI.class).setTreeSelection("$root/$zones")'/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -30,354 +30,209 @@
* by : $Author: sletellier $
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/>
+ <fr.ifremer.isisfish.entities.EffortDescriptionImpl id='effortDescription' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.EffortDescription;
- import fr.ifremer.isisfish.entities.Metier;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.types.TimeUnit;
+import fr.ifremer.isisfish.entities.EffortDescription;
+import fr.ifremer.isisfish.entities.EffortDescriptionImpl;
+import fr.ifremer.isisfish.entities.SetOfVesselsImpl;
+import fr.ifremer.isisfish.entities.SetOfVessels;
+import fr.ifremer.isisfish.entities.Metier;
+import fr.ifremer.isisfish.types.TimeUnit;
- public EffortDescriptionUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh(){
- fr.ifremer.isisfish.entities.SetOfVessels setOfVessels = getContextValue(InputAction.class).getSetOfVessels();
- if (setOfVessels != null){
- setEffortDescriptionMetierListModel();
- if (fieldEffortDescriptionEffortDescriptionList.getSelectedValue() == null){
- setEffortDescriptionEffortDescriptionListModel(getContextValue(InputAction.class).getSetOfVessels());
- }
- Object value = fieldEffortDescriptionEffortDescriptionList.getSelectedValue();
- if (value != null){
- setEffortDescriptionEffortDescriptionListModel(getContextValue(InputAction.class).getSetOfVessels());
- EffortDescription effort = (EffortDescription)((GenericCell)value).getValue();
- fieldEffortDescriptionFishingOperation.setText(effort.getFishingOperation() + "");
- fieldEffortDescriptionFishingOperationDuration.setText(effort.getFishingOperationDuration() + "");
- fieldEffortDescriptionGearsNumberPerOperation.setText(effort.getGearsNumberPerOperation() + "");
- fieldEffortDescriptionCrewSize.setText(effort.getCrewSize() + "");
- fieldEffortDescriptionUnitCostOfFishing.setText(effort.getUnitCostOfFishing() + "");
- fieldEffortDescriptionFixedCrewSalary.setText(effort.getFixedCrewSalary() + "");
- fieldEffortDescriptionCrewFoodCost.setText(effort.getCrewFoodCost() + "");
- fieldEffortDescriptionCrewShareRate.setText(effort.getCrewShareRate() + "");
- fieldEffortDescriptionRepairAndMaintenanceGearCost.setText(effort.getRepairAndMaintenanceGearCost() + "");
- fieldEffortDescriptionLandingCosts.setText(effort.getLandingCosts() + "");
- fieldEffortDescriptionOtherRunningCost.setText(effort.getOtherRunningCost() + "");
- }
- else{
- DefaultListModel model = new DefaultListModel();
- fieldEffortDescriptionEffortDescriptionList.setModel(model);
- fieldEffortDescriptionFishingOperation.setText("");
- fieldEffortDescriptionFishingOperationDuration.setText("");
- fieldEffortDescriptionGearsNumberPerOperation.setText("");
- fieldEffortDescriptionCrewSize.setText("");
- fieldEffortDescriptionUnitCostOfFishing.setText("");
- fieldEffortDescriptionFixedCrewSalary.setText("");
- fieldEffortDescriptionCrewFoodCost.setText("");
- fieldEffortDescriptionCrewShareRate.setText("");
- fieldEffortDescriptionRepairAndMaintenanceGearCost.setText("");
- fieldEffortDescriptionLandingCosts.setText("");
- fieldEffortDescriptionOtherRunningCost.setText("");
-
- }
+setType("SetOfVessels");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ fieldEffortDescriptionFishingOperation.setText("");
+ fieldEffortDescriptionFishingOperationDuration.setText("");
+ fieldEffortDescriptionGearsNumberPerOperation.setText("");
+ fieldEffortDescriptionCrewSize.setText("");
+ fieldEffortDescriptionUnitCostOfFishing.setText("");
+ fieldEffortDescriptionFixedCrewSalary.setText("");
+ fieldEffortDescriptionCrewFoodCost.setText("");
+ fieldEffortDescriptionCrewShareRate.setText("");
+ fieldEffortDescriptionRepairAndMaintenanceGearCost.setText("");
+ fieldEffortDescriptionLandingCosts.setText("");
+ fieldEffortDescriptionOtherRunningCost.setText("");
}
- }
- protected void setEffortDescriptionMetierListModel(){
- java.util.List<Metier> metiers = getContextValue(InputAction.class).getFisheryRegion().getMetier();
- DefaultListModel model = new DefaultListModel();
- if (metiers != null){
- for (Metier m : metiers){
- model.addElement(new GenericCell(m.getName(), m, Metier.class));
- }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldEffortDescriptionMetierList.setModel(model);
}
- protected void setEffortDescriptionEffortDescriptionListModel(fr.ifremer.isisfish.entities.SetOfVessels setOfVessels){
- Collection<EffortDescription> possibleMetiers = setOfVessels.getPossibleMetiers();
- DefaultListModel model = new DefaultListModel();
- if (possibleMetiers != null){
- for (EffortDescription m : possibleMetiers){
- model.addElement(new GenericCell(m.getPossibleMetiers().getName(), m, EffortDescription.class));
- }
- }
- fieldEffortDescriptionEffortDescriptionList.setModel(model);
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$setOfVessels/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(GearUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
- protected void add(){
- fr.ifremer.isisfish.entities.SetOfVessels setOfVessels = getContextValue(InputAction.class).getSetOfVessels();
- if (setOfVessels != null){
- Object value = fieldEffortDescriptionMetierList.getSelectedValue();
- if (value != null){
- Metier m = (Metier)((GenericCell)value).getValue();
- getContextValue(InputAction.class).addEffortDescription(setOfVessels, m);
- setEffortDescriptionEffortDescriptionListModel(getContextValue(InputAction.class).getSetOfVessels());
- valueChanged(true);
- }
- }
-// refresh();
- }
- protected void remove(){
- fr.ifremer.isisfish.entities.SetOfVessels setOfVessels = getContextValue(InputAction.class).getSetOfVessels();
- if (setOfVessels != null){
- Object value = fieldEffortDescriptionEffortDescriptionList.getSelectedValue();
- if (value != null){
- EffortDescription e = (EffortDescription)((GenericCell)value).getValue();
- getContextValue(InputAction.class).removeEffortDescription(setOfVessels, e);
- valueChanged(false);
- setEffortDescriptionEffortDescriptionListModel(getContextValue(InputAction.class).getSetOfVessels());
- refresh();
- }
- }
- }
- protected EffortDescription getEffortDescription(){
- Object value = fieldEffortDescriptionMetierList.getSelectedValue();
- EffortDescription result = null;
- if (value != null){
- Metier m = (Metier)((GenericCell)value).getValue();
- result = getContextValue(InputAction.class).getSetOfVessels().getPossibleMetiers(m);
- }
- return result;
- }
- protected void fishingOperationChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()));
- valueChanged(true);
- }
- }
- protected void fishingOperationDurationChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setFishingOperationDuration(new TimeUnit(Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())));
- valueChanged(true);
- }
- }
- protected void gearsNumberPerOperationChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()));
- valueChanged(true);
- }
- }
- protected void descriptionCrewSizeChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()));
- valueChanged(true);
- }
- }
- protected void costOfFishingChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()));
- valueChanged(true);
- }
- }
- protected void fixedCrewSalaryChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()));
- valueChanged(true);
- }
- }
- protected void crewFoodCostChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()));
- valueChanged(true);
- }
- }
- protected void crewShareRateChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()));
- valueChanged(true);
- }
- }
- protected void repairAndMaintenanceGearCostChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()));
- valueChanged(true);
- }
- }
- protected void langdingCostsChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()));
- }
- }
- protected void otherRunningCostChanged(){
- EffortDescription possibleMetier = getEffortDescription();
- if (possibleMetier != null){
- possibleMetier.setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()));
- valueChanged(true);
- }
- }
+});
+
+public void refresh(){
+ SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class);
+ setBean((SetOfVesselsImpl) setOfVessels);
+ jaxx.runtime.swing.Utils.fillList(fieldEffortDescriptionMetierList,getRegion().getMetier(), null);
+ setEffortDescriptionEffortDescriptionList();
+}
+protected void setEffortDescriptionEffortDescriptionList(){
+ jaxx.runtime.swing.Utils.fillList(fieldEffortDescriptionEffortDescriptionList,getBean().getPossibleMetiers(), null);
+}
+protected void add(){
+ Object value = fieldEffortDescriptionMetierList.getSelectedValue();
+ if (value != null){
+ Metier m = (Metier)value;
+ getContextValue(InputAction.class).addEffortDescription(getBean(), m);
+ setEffortDescriptionEffortDescriptionList();
+ }
+}
+protected void remove(){
+ Object value = fieldEffortDescriptionEffortDescriptionList.getSelectedValue();
+ if (value != null){
+ EffortDescription e = (EffortDescription)value;
+ getContextValue(InputAction.class).removeEffortDescription(getBean(), e);
+ setEffortDescriptionEffortDescriptionList();
+ }
+}
]]>
</script>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JList id="fieldEffortDescriptionMetierList" selectionMode="0" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='0.5'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="0" onValueChanged='refresh()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='0.5'>
- <Table>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionFishingOperation" onKeyTyped='valueChanged(true)' onFocusLost='fishingOperationChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionFishingOperationDuration" onKeyTyped='valueChanged(true)' onFocusLost='fishingOperationDurationChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" onKeyTyped='valueChanged(true)' onFocusLost='gearsNumberPerOperationChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.crewSize" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionCrewSize" onKeyTyped='valueChanged(true)' onFocusLost='descriptionCrewSizeChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionUnitCostOfFishing" onKeyTyped='valueChanged(true)' onFocusLost='costOfFishingChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionFixedCrewSalary" onKeyTyped='valueChanged(true)' onFocusLost='fixedCrewSalaryChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionCrewFoodCost" onKeyTyped='valueChanged(true)' onFocusLost='crewFoodCostChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.crewShareRate" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionCrewShareRate" onKeyTyped='valueChanged(true)' onFocusLost='crewShareRateChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" onKeyTyped='valueChanged(true)' onFocusLost='repairAndMaintenanceGearCostChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.landingCosts" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionLandingCosts" onKeyTyped='valueChanged(true)' onFocusLost='langdingCostsChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldEffortDescriptionOtherRunningCost" onKeyTyped='valueChanged(true)' onFocusLost='otherRunningCostChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.3'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.3'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.3'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JList id="fieldEffortDescriptionMetierList" selectionMode="0" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='0.5'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JList id="fieldEffortDescriptionEffortDescriptionList" selectionMode="0" onMouseClicked='setEffortDescription((EffortDescriptionImpl)fieldEffortDescriptionEffortDescriptionList.getSelectedValue())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='0.5'>
+ <Table>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.fishingOperation" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionFishingOperation" text='getEffortDescription().getFishingOperation()' onKeyTyped='getEffortDescription().setFishingOperation(Integer.parseInt(fieldEffortDescriptionFishingOperation.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.fishingOperationDuration" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionFishingOperationDuration" text='getEffortDescription().getFishingOperationDuration()' onKeyTyped='getEffortDescription().setFishingOperationDuration(new TimeUnit(Double.parseDouble(fieldEffortDescriptionFishingOperationDuration.getText())))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.gearsNumberPerOperation" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionGearsNumberPerOperation" text='getEffortDescription().getGearsNumberPerOperation()' onKeyTyped='getEffortDescription().setGearsNumberPerOperation(Integer.parseInt(fieldEffortDescriptionGearsNumberPerOperation.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.crewSize" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionCrewSize" text='getEffortDescription().getCrewSize()' onKeyTyped='getEffortDescription().setCrewSize(Integer.parseInt(fieldEffortDescriptionCrewSize.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.unitCostOfFishing" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionUnitCostOfFishing" text='getEffortDescription().getUnitCostOfFishing()' onKeyTyped='getEffortDescription().setUnitCostOfFishing(Double.parseDouble(fieldEffortDescriptionUnitCostOfFishing.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.fixedCrewSalary" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionFixedCrewSalary" text='getEffortDescription().getFixedCrewSalary()' onKeyTyped='getEffortDescription().setFixedCrewSalary(Double.parseDouble(fieldEffortDescriptionFixedCrewSalary.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.crewFoodCost" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionCrewFoodCost" text='getEffortDescription().getCrewFoodCost()' onKeyTyped='getEffortDescription().setCrewFoodCost(Double.parseDouble(fieldEffortDescriptionCrewFoodCost.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.crewShareRate" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionCrewShareRate" text='getEffortDescription().getCrewShareRate()' onKeyTyped='getEffortDescription().setCrewShareRate(Double.parseDouble(fieldEffortDescriptionCrewShareRate.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.repairAndMaintenanceGearCost" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionRepairAndMaintenanceGearCost" text='getEffortDescription().getRepairAndMaintenanceGearCost()' onKeyTyped='getEffortDescription().setRepairAndMaintenanceGearCost(Double.parseDouble(fieldEffortDescriptionRepairAndMaintenanceGearCost.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.landingCosts" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionLandingCosts" text='getEffortDescription().getLandingCosts()' onKeyTyped='getEffortDescription().setLandingCosts(Double.parseDouble(fieldEffortDescriptionLandingCosts.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.effortDescription.otherRunningCost" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldEffortDescriptionOtherRunningCost" text='getEffortDescription().getOtherRunningCost()' onKeyTyped='getEffortDescription().setOtherRunningCost(Double.parseDouble(fieldEffortDescriptionOtherRunningCost.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.3'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.3'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.3'>
+ <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -33,63 +33,33 @@
<!--
+ FisheryRegion
+-->
-<Table id="inputFisheryRegion" implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.FisheryRegionImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
+ <script><![CDATA[
+import fr.ifremer.isisfish.entities.FisheryRegion;
+import com.bbn.openmap.gui.OMToolSet;
+import fr.ifremer.isisfish.map.CellSelectionLayer;
+import com.bbn.openmap.event.SelectMouseMode;
+import fr.ifremer.isisfish.entities.FisheryRegionImpl;
+protected OMToolSet toolSet = new OMToolSet();
- <script>
- <![CDATA[
- import fr.ifremer.isisfish.entities.FisheryRegion;
- import com.bbn.openmap.gui.OMToolSet;
- import fr.ifremer.isisfish.map.IsisMapBean;
- import fr.ifremer.isisfish.map.CellSelectionLayer;
- import com.bbn.openmap.event.SelectMouseMode;
- import fr.ifremer.isisfish.map.OpenMapToolPanel;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
-
- protected FisheryRegion region = null;
- protected OpenMapToolPanel toolMap = new OpenMapToolPanel();
- protected OMToolSet toolSet = new OMToolSet();
-
- init();
- public FisheryRegionUI(InputAction action){
- setContextValue(action);
- }
- protected void init(){
- region = getContextValue(InputAction.class).getFisheryRegion();
+ public void refresh(){
+ setBean(null);
+ FisheryRegion region = (FisheryRegion) getVerifier().getEntity(FisheryRegion.class);
+ setBean((FisheryRegionImpl)region);
if (region != null){
+ setFieldMapfilesModel(getBean());
cellMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
cellMap.setActiveMouseMode(new SelectMouseMode());
- cellMap.setFisheryRegion(region);
+ cellMap.setFisheryRegion(getBean());
toolSet.setupListeners(cellMap);
toolMap.add((Component)toolSet);
- map.add(toolMap, BorderLayout.NORTH);
}
}
- public void refresh(){
- if (region != getContextValue(InputAction.class).getFisheryRegion()){
- init();
- }
- if (region != null){
- fieldRegion.setText(region.getName());
- fieldLatMin.setText(region.getMinLatitude() + "");
- fieldLatMax.setText(region.getMaxLatitude() + "");
- fieldLongMin.setText(region.getMinLongitude() + "");
- fieldLongMax.setText(region.getMaxLongitude() + "");
- fieldCellLengthLatitude.setText(region.getCellLengthLatitude() + "");
- fieldCellLengthLongitude.setText(region.getCellLengthLongitude() + "");
- setFieldMapfilesModel(region);
- fieldComment.setText(region.getComment());
- refreshMap();
- }
- }
- protected void refreshMap(){
-// cellMap.repaint();
- }
protected void setFieldMapfilesModel(FisheryRegion region){
DefaultListModel model = new DefaultListModel();
java.util.List<String> mapList = region.getMapFileList();
@@ -102,39 +72,6 @@
}
fieldMapfiles.setModel(model);
}
- protected void valueChanged(boolean b){
- changed = b;
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
- protected void regionChanged(){
- region.setName(fieldRegion.getText());
- refreshMap();
- }
- protected void latMinChanged(){
- region.setMinLatitude(Float.parseFloat(fieldLatMin.getText()));
- refreshMap();
- }
- protected void latMaxChanged(){
- region.setMaxLatitude(Float.parseFloat(fieldLatMax.getText()));
- refreshMap();
- }
- protected void longMinChanged(){
- region.setMinLongitude(Float.parseFloat(fieldLongMin.getText()));
- refreshMap();
- }
- protected void longMaxChanged(){
- region.setMaxLongitude(Float.parseFloat(fieldLongMax.getText()));
- refreshMap();
- }
- protected void cellLenghtLatChanged(){
- region.setCellLengthLatitude(Float.parseFloat(fieldCellLengthLatitude.getText()));
- refreshMap();
- }
- protected void cellLenghtLongChanged(){
- region.setCellLengthLongitude(Float.parseFloat(fieldCellLengthLongitude.getText()));
- refreshMap();
- }
protected void mapFieldChanged(){
Object[] values = fieldMapfiles.getSelectedValues();
java.util.List<String> valuesList = new ArrayList<String>();
@@ -143,59 +80,47 @@
valuesList.add((String)o);
}
}
- region.setMapFileList(valuesList);
- refreshMap();
+ getBean().setMapFileList(valuesList);
}
protected void addMap(){
- getContextValue(InputAction.class).addMap();
- refreshMap();
+ getContextValue(InputAction.class).addMap(getBean());
}
protected void delMap(){
- getContextValue(InputAction.class).removeMap(fieldMapfiles.getSelectedValues());
- refreshMap();
+ getContextValue(InputAction.class).removeMap(getBean(), fieldMapfiles.getSelectedValues());
}
- protected void commentChanged(){
- region.setComment(fieldComment.getText());
- }
protected void cellFillChanged(){
}
protected void cellFile(){
getContextValue(InputAction.class).loadCellFile(fieldCellFile.getText());
- refreshMap();
}
- protected void save(){
- setMsg(_("isisfish.message.checking.cell"));
- getContextValue(InputAction.class).saveFisheryRegion("FisheryRegion");
- valueChanged(false);
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setFieldCurrentRegionModel();
- setMsg(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- }
+// protected void save(){
+// setMsg(_("isisfish.message.checking.cell"));
+// getContextValue(InputAction.class).saveFisheryRegion("FisheryRegion");
+// valueChanged(false);
+// getParentContainer(InputUI.class).setTreeModel();
+// getParentContainer(InputUI.class).setFieldCurrentRegionModel();
+// setMsg(_("isisfish.message.save.finished"));
+// refresh();
+// }
+// protected void cancel(){
+// getContextValue(InputAction.class).cancel();
+// valueChanged(false);
+// refresh();
+// }
protected void check(){
- getContextValue(InputAction.class).checkFisheryRegion();
- setMsg(_("isisfish.message.check.region"));
+ getContextValue(InputAction.class).checkFisheryRegion(getBean());
+ setInfoText(_("isisfish.message.check.region"));
}
- protected void goToCell(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$cells");
- }
- protected void setMsg(String msg){
- getParentContainer(WelcomePanelUI.class).setInfoText(msg);
- }
+// protected void goToCell(){
+// getParentContainer(InputUI.class).setTreeSelection("$root/$cells");
+// }
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JSplitPane id="FisheryRegionTab" name="FisheryRegion"
+ <JPanel id='body' layout='{new BorderLayout()}'>
+ <JSplitPane id="FisheryRegionTab" name="FisheryRegion" constraints='BorderLayout.CENTER'
oneTouchExpandable="true" dividerLocation="200" orientation="HORIZONTAL">
<Table>
- <!-- Widget -->
<row>
<cell columns='3'>
<JLabel text="isisfish.fisheryRegion.name"/>
@@ -203,7 +128,7 @@
</row>
<row>
<cell columns='3' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldRegion" onKeyTyped='valueChanged(true)' onFocusLost='regionChanged()'/>
+ <JTextField id="fieldRegion" text='{jaxx.runtime.Util.getStringValue(getBean().getName())}' onKeyReleased='getBean().setName(fieldRegion.getText())'/>
</cell>
</row>
<row>
@@ -216,7 +141,7 @@
<JLabel text="isisfish.fisheryRegion.latitude.min"/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldLatMin" onKeyTyped='valueChanged(true)' onFocusLost='latMinChanged()'/>
+ <JTextField id="fieldLatMin" text='{getBean().getMinLatitude()}' onKeyReleased='getBean().setMinLatitude(Float.parseFloat(fieldLatMin.getText()))'/>
</cell>
</row>
<row>
@@ -224,7 +149,7 @@
<JLabel text="isisfish.fisheryRegion.latitude.max"/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldLatMax" onKeyTyped='valueChanged(true)' onFocusLost='latMaxChanged()'/>
+ <JTextField id="fieldLatMax" text='{getBean().getMaxLatitude()}' onKeyReleased='getBean().setMaxLatitude(Float.parseFloat(fieldLatMax.getText()))'/>
</cell>
</row>
<row>
@@ -232,7 +157,7 @@
<JLabel text="isisfish.fisheryRegion.longitude.min"/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldLongMin" onKeyTyped='valueChanged(true)' onFocusLost='longMinChanged()'/>
+ <JTextField id="fieldLongMin" text='{getBean().getMinLongitude()}' onKeyReleased='getBean().setMinLongitude(Float.parseFloat(fieldLongMin.getText()))'/>
</cell>
</row>
<row>
@@ -240,7 +165,7 @@
<JLabel text="isisfish.fisheryRegion.longitude.max"/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldLongMax" onKeyTyped='valueChanged(true)' onFocusLost='longMaxChanged()'/>
+ <JTextField id="fieldLongMax" text='{getBean().getMaxLongitude()}' onKeyReleased='getBean().setMaxLongitude(Float.parseFloat(fieldLongMax.getText()))'/>
</cell>
</row>
<row>
@@ -253,7 +178,7 @@
<JLabel text="isisfish.fisheryRegion.latitude"/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldCellLengthLatitude" onKeyTyped='valueChanged(true)' onFocusLost='cellLenghtLatChanged()'/>
+ <JTextField id="fieldCellLengthLatitude" text='{getBean().getCellLengthLatitude()}' onKeyReleased='getBean().setCellLengthLatitude(Float.parseFloat(fieldCellLengthLatitude.getText()))'/>
</cell>
</row>
<row>
@@ -261,7 +186,7 @@
<JLabel text="isisfish.fisheryRegion.longitude"/>
</cell>
<cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldCellLengthLongitude" onKeyTyped='valueChanged(true)' onFocusLost='cellLenghtLongChanged()'/>
+ <JTextField id="fieldCellLengthLongitude" text='{getBean().getCellLengthLongitude()}' onKeyReleased='getBean().setCellLengthLongitude(Float.parseFloat(fieldCellLengthLongitude.getText()))'/>
</cell>
</row>
<row>
@@ -293,7 +218,7 @@
<row>
<cell columns='3' fill='both' weightx='1.0' weighty='0.4'>
<JScrollPane>
- <JTextArea id="fieldComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()'/>
+ <JTextArea id="fieldComment" text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}' onKeyReleased='getBean().setComment(fieldComment.getText())'/>
</JScrollPane>
</cell>
</row>
@@ -312,7 +237,7 @@
<Table>
<row>
<cell columns='4' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldCellFile" onKeyTyped='valueChanged(true)' onFocusLost='cellFillChanged()'/>
+ <JTextField id="fieldCellFile" onKeyReleased='cellFillChanged()'/>
</cell>
<cell>
<JButton id="buttonCellFile" text="isisfish.common.ellipsis" onActionPerformed='cellFile()'/>
@@ -323,10 +248,10 @@
</row>
<row>
<cell fill='horizontal' weightx='0.3'>
- <JButton id='save' enabled='{isChanged()}' text="isisfish.common.save" onActionPerformed='save()'/>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
</cell>
<cell fill='horizontal' weightx='0.3'>
- <JButton id='cancel' enabled='{isChanged()}' text="isisfish.common.cancel" onActionPerformed='cancel()'/>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
</cell>
<cell fill='horizontal' weightx='0.3'>
<JButton id='check' text="isisfish.common.check" onActionPerformed='check()'/>
@@ -334,14 +259,9 @@
</row>
</Table>
<JPanel id='map' layout='{new BorderLayout()}'>
- <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'/>
+ <fr.ifremer.isisfish.map.OpenMapToolPanel id='toolMap' javaBean='new fr.ifremer.isisfish.map.OpenMapToolPanel()' constraints='BorderLayout.NORTH'/>
+ <fr.ifremer.isisfish.map.IsisMapBean id='cellMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' fisheryRegion='{getBean()}' constraints='BorderLayout.CENTER'/>
</JPanel>
</JSplitPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton text="isisfish.input.continueCells" onActionPerformed='goToCell()'/>
- </cell>
- </row>
-</Table>
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -30,27 +30,24 @@
* by : $Author: sletellier $
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
<script><![CDATA[
import fr.ifremer.isisfish.entities.Gear;
+ import fr.ifremer.isisfish.entities.GearImpl;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import org.codelutin.topia.persistence.TopiaEntity;
import org.codelutin.topia.TopiaException;
import jaxx.runtime.swing.navigation.NavigationTreeModel;
import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
- public GearTabUI (InputAction action){
-
- setContextValue(action);
- }
public void refresh() {
- Gear gear = getContextValue(InputAction.class).getGear();
+ Gear gear = (Gear)getVerifier().getEntity(Gear.class);
+ setBean((GearImpl) gear);
if (gear != null){
fieldGearName.setText(gear.getName());
fieldGearEffortUnit.setText(gear.getEffortUnit());
@@ -74,153 +71,113 @@
fieldGearComment.setText("");
}
}
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("Gear");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$gears/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$gears/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$gears");
- valueChanged(false);
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(GearUI.class).setChanged(b);
- }
protected void nameChanged(){
- getContextValue(InputAction.class).getGear().setName(fieldGearName.getText());
- valueChanged(true);
+ getBean().setName(fieldGearName.getText());
}
protected void effortUnitChanged(){
- getContextValue(InputAction.class).getGear().setEffortUnit(fieldGearEffortUnit.getText());
- valueChanged(true);
+ getBean().setEffortUnit(fieldGearEffortUnit.getText());
}
protected void standardisationFactorChanged(){
- getContextValue(InputAction.class).getGear().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()));
- valueChanged(true);
+ getBean().setStandardisationFactor(Double.parseDouble(fieldGearStandardisationFactor.getText()));
}
protected void paramNameChanged(){
- getContextValue(InputAction.class).getGear().setParameterName(fieldGearParamName.getSelectedText());
- valueChanged(true);
+ getBean().setParameterName(fieldGearParamName.getSelectedText());
}
protected void paramTypeChanged(){
// TODO
// getContextValue(InputAction.class).getGear().setParameterName(fieldGearParamName.getSelectedText());
-// valueChanged(true);
}
protected void paramPossibleValueChanged(){
if (fieldGearParamPossibleValue.getText() != ""){
- getContextValue(InputAction.class).getGear().setStandardisationFactor(Double.parseDouble(fieldGearParamPossibleValue.getText()));
+ getBean().setStandardisationFactor(Double.parseDouble(fieldGearParamPossibleValue.getText()));
}
- valueChanged(true);
}
protected void commentChanged(){
- getContextValue(InputAction.class).getGear().setComment(fieldGearComment.getText());
- valueChanged(true);
+ getBean().setComment(fieldGearComment.getText());
}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.gear.name" enabled='{isActif()}'/>
- </cell>
- <cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.gear.effortUnit" enabled='{isActif()}'/>
- </cell>
- <cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearEffortUnit" onKeyTyped='valueChanged(true)' onFocusLost='effortUnitChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.gear.standardisationFactor" enabled='{isActif()}'/>
- </cell>
- <cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearStandardisationFactor" onKeyTyped='valueChanged(true)' onFocusLost='standardisationFactorChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.gear.technicalParameter" enabled='{isActif()}'/>
- </cell>
- <cell columns="2" fill='horizontal' weightx='1.0'>
- <JTextField id="fieldGearParamName" onKeyTyped='valueChanged(true)' onFocusLost='paramNameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.gear.rangeValues" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldGearParamType" onActionPerformed='paramTypeChanged()' enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldGearParamPossibleValue" onKeyTyped='valueChanged(true)' onFocusLost='paramPossibleValueChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.gear.comments" enabled='{isActif()}'/>
- </cell>
- <cell columns="2" fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JTextArea id="fieldGearComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id="save" enabled='{isChanged()}' text="isisfish.common.save" onActionPerformed='save()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' enabled='{isChanged()}' text="isisfish.common.cancel" onActionPerformed='cancel()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id="create" text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.gear.name" enabled='{isActif()}'/>
+ </cell>
+ <cell columns="2" fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldGearName" onKeyTyped='nameChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.gear.effortUnit" enabled='{isActif()}'/>
+ </cell>
+ <cell columns="2" fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldGearEffortUnit" onKeyTyped='effortUnitChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.gear.standardisationFactor" enabled='{isActif()}'/>
+ </cell>
+ <cell columns="2" fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldGearStandardisationFactor" onKeyTyped='standardisationFactorChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.gear.technicalParameter" enabled='{isActif()}'/>
+ </cell>
+ <cell columns="2" fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldGearParamName" onKeyTyped='paramNameChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.gear.rangeValues" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldGearParamType" onActionPerformed='paramTypeChanged()' enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JTextField id="fieldGearParamPossibleValue" onKeyTyped='paramPossibleValueChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.gear.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell columns="2" fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JTextArea id="fieldGearComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,20 +35,11 @@
<!--
+ Gear
+-->
-<JPanel id='panel' layout='{new BorderLayout()}' implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
-
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
import fr.ifremer.isisfish.entities.Metier;
init();
- public GearUI (InputAction action){
-
- setContextValue(action);
- }
public void refresh() {
gearTabUI.refresh();
selectivityUI.refresh();
@@ -73,9 +64,11 @@
getParentContainer(InputUI.class).setTreeSelection("$root/$metiers");
}
]]></script>
- <JTabbedPane constraints='BorderLayout.CENTER' id="GearTab" name="Gear">
- <tab title='{_("isisfish.gear.title")}'><GearTabUI id="gearTabUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- <tab title='{_("isisfish.selectivity.title")}'><SelectivityUI id="selectivityUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- </JTabbedPane>
- <JButton constraints='BorderLayout.SOUTH' text="isisfish.input.continueMetiers" onActionPerformed='goToMetier()'/>
-</JPanel>
+ <JPanel id='body' layout='{new BorderLayout()}'>
+ <JTabbedPane constraints='BorderLayout.CENTER' id="GearTab" name="Gear">
+ <tab title='{_("isisfish.gear.title")}'><GearTabUI id="gearTabUI"/></tab>
+ <tab title='{_("isisfish.selectivity.title")}'><SelectivityUI id="selectivityUI"/></tab>
+ </JTabbedPane>
+ </JPanel>
+ <!--JButton constraints='BorderLayout.SOUTH' text="isisfish.input.continueMetiers" onActionPerformed='goToMetier()'/-->
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,7 +35,6 @@
*/
import fr.ifremer.isisfish.IsisFishDAOHelper;
-import fr.ifremer.isisfish.IsisFishEntityEnum;
import fr.ifremer.isisfish.datastore.FormuleStorage;
import fr.ifremer.isisfish.datastore.RegionStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
@@ -57,7 +56,6 @@
import org.codelutin.math.matrix.MatrixFactory;
import org.codelutin.math.matrix.MatrixND;
import org.codelutin.topia.TopiaContext;
-import org.codelutin.topia.TopiaException;
import org.codelutin.topia.persistence.TopiaDAO;
import org.codelutin.topia.persistence.TopiaEntity;
import org.codelutin.util.FileUtil;
@@ -73,31 +71,12 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
/** @author letellier */
public class InputAction {
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(InputAction.class);
- protected RegionStorage regionStorage = null;
- protected FisheryRegion fisheryRegion = null;
- protected TopiaContext isisContext = null;
- protected TopiaEntity selected;
- protected String path = null;
- protected Cell cell;
- protected Zone zone;
- protected Port port;
- protected Species species;
- protected Population population;
- protected Gear gear;
- protected Metier metier;
- protected TripType tripType;
- protected VesselType vesselType;
- protected SetOfVessels setOfVessels;
- protected Strategy strategy;
- protected boolean isNull = true;
public InputAction() {
if (log.isDebugEnabled()) {
@@ -109,92 +88,7 @@
ErrorDialogUI.showError(eee);
}
- public void setValue(Object value) {
- if (value == null || !(value instanceof TopiaEntity)) {
- // this is not a TopiaEntity value, or a null value : so quit
- isNull = true;
- cell = null;
- zone = null;
- port = null;
- species = null;
- population = null;
- gear = null;
- metier = null;
- tripType = null;
- vesselType = null;
- setOfVessels = null;
- strategy = null;
- selected = null;
- return;
- }
- isNull = false;
- switch (IsisFishEntityEnum.valueOf(value.getClass())) {
- case Zone:
- zone = (Zone) value;
- break;
- case Cell:
- cell = (Cell) value;
- break;
- case Port:
- port = (Port) value;
- break;
- case Species:
- species = (Species) value;
- break;
- case Population:
- population = (Population) value;
- species = population.getSpecies();
- break;
- case Metier:
- metier = (Metier) value;
- break;
- case TripType:
- tripType = (TripType) value;
- break;
- case Gear:
- gear = (Gear) value;
- break;
- case VesselType:
- vesselType = (VesselType) value;
- break;
- case SetOfVessels:
- setOfVessels = (SetOfVessels) value;
- break;
- case Strategy:
- strategy = (Strategy) value;
- break;
- }
- selected = (TopiaEntity) value;
- }
- public boolean isNull() {
- return isNull;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String getPath() {
- return path;
- }
-
- public TopiaContext getIsisContext() {
- return isisContext;
- }
-
- public RegionStorage getRegionStorage() {
- return regionStorage;
- }
-
- public void setSpecies(String topiaId) {
- try {
- species = IsisFishDAOHelper.getSpeciesDAO(isisContext).findByTopiaId(topiaId);
- } catch (TopiaException ex) {
- Logger.getLogger(InputAction.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
-
/**
* Exporter la region dans un zip
*
@@ -315,7 +209,7 @@
*
* @return TODO
*/
- public File exportRegion() {
+ public File exportRegion(RegionStorage regionStorage) {
File file = null;
try {
file = FileUtil.getFile(".*.zip$", _("isisfish.message.import.region.zipped"));
@@ -341,7 +235,7 @@
*
* @return TODO
*/
- public String copyRegion() {
+ public String copyRegion(RegionStorage regionStorage) {
String newName = null;
try {
newName = showInputDialog(_("isisfish.message.new.region.name"));
@@ -362,7 +256,7 @@
* @param cvsDelete if true delete region in CVS too
* @return TODO
*/
- public String removeRegion(boolean cvsDelete) {
+ public String removeRegion(RegionStorage regionStorage, boolean cvsDelete) {
String result = null;
try {
int resp = JOptionPane.showConfirmDialog(null, _(
@@ -387,7 +281,7 @@
*
* @return TODO
*/
- public String commitRegionInCVS() {
+ public String commitRegionInCVS(RegionStorage regionStorage) {
String result = null;
try {
String msg = regionStorage.getCommentForNextCommit();
@@ -420,19 +314,22 @@
*
* @param name name of region
*/
- public void loadRegion(String name) {
+ public void loadRegion(InputUI ui, String name) {
if (log.isTraceEnabled()) {
log.trace("loadRegion called");
}
try {
- regionStorage = null;
- fisheryRegion = null;
- isisContext = null;
+ RegionStorage regionStorage = null;
+ FisheryRegion fisheryRegion = null;
+ TopiaContext isisContext = null;
if (name != null && !" ".equals(name)) {
regionStorage = RegionStorage.getRegion(name);
isisContext = regionStorage.getStorage().beginTransaction();
fisheryRegion = RegionStorage.getFisheryRegion(isisContext);
}
+ ui.setContextValue(regionStorage);
+ ui.setContextValue(isisContext);
+ ui.setContextValue(fisheryRegion);
} catch (Exception eee) {
log.error("Can't load region", eee);
showMsgBox(eee);
@@ -464,22 +361,6 @@
}
/**
- * If some entities has been modified by the user (EntityModified state is
- * true) then ask the user if he want save, don't save modification, or
- * cancel current wanted action.
- * <p/>
- * If this method return true, only button (save, cancel) will be refreshed
- * not the current input panel
- * <p/>
- * if this method return false, nothing is do
- *
- * @return false if user want cancel action, true otherwize
- */
- protected boolean askForSave() {
- return true;
- }
-
- /**
* Permet de creer simplement un nouvelle objet portant un nom par defaut.
* Le nouvel element est automatiquement selectionné dans l'arbre
*
@@ -488,7 +369,7 @@
* @return null ou un fenetre d'erreur
*/
@SuppressWarnings("unchecked")
- public TopiaEntity create(String type) {
+ public TopiaEntity create(TopiaContext isisContext, String type) {
if (log.isTraceEnabled()) {
log.trace("create called for " + type);
}
@@ -519,7 +400,7 @@
*
* @return the saved entity
*/
- public TopiaEntity save() {
+ public TopiaEntity save(TopiaEntity selected) {
if (log.isTraceEnabled()) {
log.trace("save called");
}
@@ -546,17 +427,17 @@
*
* @return the roolbacked entity
*/
- public TopiaEntity cancel() {
+ public TopiaEntity cancel(TopiaEntity selected) {
if (log.isTraceEnabled()) {
log.trace("cancel called");
}
try {
+ TopiaContext isisContext = selected.getTopiaContext();
isisContext.rollbackTransaction();
// reload the object
if (selected != null) {
selected = isisContext.findByTopiaId(selected.getTopiaId());
- setValue(selected);
}
} catch (Exception eee) {
log.error("Can't cancel modification in region", eee);
@@ -574,7 +455,7 @@
*
* @return if ok return null else OutView error
*/
- public String remove() {
+ public String remove(TopiaEntity selected) {
if (log.isTraceEnabled()) {
log.trace("remove called");
}
@@ -602,7 +483,7 @@
if (doDelete) {
selected.delete();
- isisContext.commitTransaction();
+ selected.getTopiaContext().commitTransaction();
msg = _("isisfish.message.remove.finished");
} else {
msg = _("isisfish.message.remove.canceled");
@@ -686,75 +567,16 @@
return null;
}
- protected String getFisheryRegionName() {
- if (fisheryRegion != null) {
- return fisheryRegion.getName();
- }
- return null;
- }
-
- protected FisheryRegion getFisheryRegion() {
- return fisheryRegion;
- }
-
- protected TopiaEntity getSelected() {
- return selected;
- }
-
- protected Cell getCell() {
- return cell;
- }
-
- protected Zone getZone() {
- return zone;
- }
-
- protected Port getPort() {
- return port;
- }
-
- protected Species getSpecies() {
- return species;
- }
-
- protected Population getPopulation() {
- return population;
- }
-
- protected Gear getGear() {
- return gear;
- }
-
- protected Metier getMetier() {
- return metier;
- }
-
- protected TripType getTripType() {
- return tripType;
- }
-
- protected VesselType getVesselType() {
- return vesselType;
- }
-
- protected SetOfVessels getSetOfVessels() {
- return setOfVessels;
- }
-
- protected Strategy getStrategy() {
- return strategy;
- }
-
- protected List<Formule> getFormules(String name) {
+ protected List<Formule> getFormules(TopiaContext isisContext, String name) {
return FormuleStorage.getFormules(isisContext, name);
}
// InputGear
- public Object addSelectivity(Population pop, String equation) {
+ public Object addSelectivity(Population pop, String equation, Gear gear) {
try {
- SelectivityDAO dao = IsisFishDAOHelper.getSelectivityDAO(isisContext);
+ SelectivityDAO dao = IsisFishDAOHelper.getSelectivityDAO(pop.getTopiaContext());
Selectivity selectivity = dao.create();
selectivity.setGear(gear);
@@ -772,7 +594,7 @@
return null;
}
- public Object removeSelectivity(Selectivity selectivity) {
+ public Object removeSelectivity(Gear gear, Selectivity selectivity) {
if (log.isTraceEnabled()) {
log.trace("removeTargetSpecies called: " + selectivity);
}
@@ -789,12 +611,12 @@
// InputMetier
- public Object createSeasonInfo() {
+ public Object createSeasonInfo(Metier metier) {
if (log.isTraceEnabled()) {
log.trace("createSeasonInfo called");
}
try {
- MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper.getMetierSeasonInfoDAO(isisContext);
+ MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper.getMetierSeasonInfoDAO(metier.getTopiaContext());
MetierSeasonInfo metierSeasonInfo = metierSeasonInfoPS.create();
metierSeasonInfo.setFirstMonth(Month.MONTH[0]);
metierSeasonInfo.setLastMonth(Month.MONTH[3]);
@@ -810,14 +632,14 @@
return null;
}
- public Object removeSeasonInfo(MetierSeasonInfo info) {
+ public Object removeSeasonInfo(Metier metier, MetierSeasonInfo info) {
if (log.isTraceEnabled()) {
log.trace("createSeasonInfo called");
}
try {
metier.removeMetierSeasonInfo(info);
metier.update();
- isisContext.commitTransaction();
+ metier.getTopiaContext().commitTransaction();
} catch (Exception eee) {
log.error("Can't create MetierSeasonInfo", eee);
showMsgBox(eee);
@@ -825,12 +647,12 @@
return null;
}
- public Object addTargetSpecies(MetierSeasonInfo m, Species species, String targetFactorEquation, boolean primaryCatch) {
+ public Object addTargetSpecies(Metier metier, MetierSeasonInfo m, Species species, String targetFactorEquation, boolean primaryCatch) {
if (log.isTraceEnabled()) {
log.trace("addTargetSpecies called: " + metier + " " + species + " " + primaryCatch + " " + targetFactorEquation);
}
try {
- TargetSpeciesDAO dao = IsisFishDAOHelper.getTargetSpeciesDAO(isisContext);
+ TargetSpeciesDAO dao = IsisFishDAOHelper.getTargetSpeciesDAO(metier.getTopiaContext());
TargetSpecies targetSpecies = dao.create();
targetSpecies.setSpecies(species);
@@ -866,7 +688,7 @@
log.trace("addEffortDescription called: " + setOfVessels + " metier: " + metier);
}
try {
- EffortDescriptionDAO effortDescriptionPS = IsisFishDAOHelper.getEffortDescriptionDAO(isisContext);
+ EffortDescriptionDAO effortDescriptionPS = IsisFishDAOHelper.getEffortDescriptionDAO(metier.getTopiaContext());
EffortDescription effortDescription = effortDescriptionPS.create();
effortDescription.setPossibleMetiers(metier);
effortDescription.update();
@@ -884,7 +706,7 @@
}
try {
sov.removePossibleMetiers(effort);
- isisContext.commitTransaction();
+ sov.getTopiaContext().commitTransaction();
} catch (Exception eee) {
log.error("Can't remove entity: " + effort, eee);
showMsgBox(eee);
@@ -894,14 +716,14 @@
// Population
- public Population createPopulation() {
+ public Population createPopulation(Species species) {
if (log.isTraceEnabled()) {
log.trace("create called");
}
try {
String name = "Population_new";
- PopulationDAO dao = IsisFishDAOHelper.getPopulationDAO(isisContext);
+ PopulationDAO dao = IsisFishDAOHelper.getPopulationDAO(species.getTopiaContext());
Population pop = dao.create();
pop.setName(name);
@@ -911,7 +733,7 @@
// population = pop;
// population.update();
species.update();
- isisContext.commitTransaction();
+ species.getTopiaContext().commitTransaction();
return pop;
} catch (Exception eee) {
log.error("Can't create Population", eee);
@@ -921,9 +743,9 @@
return null;
}
- public Object createRecruitmentDistribution() {
+ public Object createRecruitmentDistribution(Population pop) {
if (log.isTraceEnabled()) {
- log.trace("createRecruitmentDistributionontext called: " + population);
+ log.trace("createRecruitmentDistributionontext called: " + pop);
}
try {
String val = JOptionPane.showInputDialog(_("isisfish.message.recruitment.number.month"));
@@ -945,12 +767,12 @@
}
MatrixND newMat = MatrixFactory.getInstance().create(new List[]{sem});
- MatrixND mat = population.getRecruitmentDistribution();
+ MatrixND mat = pop.getRecruitmentDistribution();
if (mat != null) {
newMat.paste(mat);
}
- population.setRecruitmentDistribution(newMat);
- population.update();
+ pop.setRecruitmentDistribution(newMat);
+ pop.update();
}
} catch (Exception eee) {
log.error("Can't remove PopulationSeasonInfo", eee);
@@ -1012,7 +834,7 @@
// FisheryRegion
/** @return TODO */
- public Object addMap() {
+ public Object addMap(FisheryRegion fisheryRegion) {
if (log.isTraceEnabled()) {
log.trace("AddMap called");
}
@@ -1057,7 +879,7 @@
* @param selectedMaps la list dans lequel il faut retirer la carte
* @return TODO
*/
- public Object removeMap(Object[] selectedMaps) {
+ public Object removeMap(FisheryRegion fisheryRegion, Object[] selectedMaps) {
if (log.isTraceEnabled()) {
log.trace("removeMap called");
}
@@ -1100,7 +922,7 @@
// FIXME todo loadCellFile
}
- public Object saveFisheryRegion(String type) {
+ public Object saveFisheryRegion(FisheryRegion fisheryRegion, String type) {
if (log.isTraceEnabled()) {
log.trace("save called");
}
@@ -1176,7 +998,7 @@
return null;
}
- public Object checkFisheryRegion() {
+ public Object checkFisheryRegion(FisheryRegion fisheryRegion) {
try {
if (log.isTraceEnabled()) {
log.trace("check called: ");
Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContent.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContent.java 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContent.java 2009-01-02 17:22:04 UTC (rev 1724)
@@ -1,27 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package fr.ifremer.isisfish.ui.input;
-
-import jaxx.runtime.JAXXObject;
-
-/**
- *
- * @author letellier
- */
-public interface InputContent extends JAXXObject {
-
- void refresh();
-
- java.lang.Boolean isActif();
-
- java.lang.Boolean isChanged();
-
- void setActif(java.lang.Boolean b);
-
- void setChanged(java.lang.Boolean b);
-
- String getName();
-}
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -0,0 +1,60 @@
+<JPanel layout='{new BorderLayout()}'>
+
+ <!-- ui state when editing -->
+ <Boolean id='actif' javaBean='false'/>
+
+ <!-- ui state when editing and modified -->
+ <Boolean id='changed' javaBean='false'/>
+
+ <!-- ui state when a bean is selected in list -->
+ <Boolean id='selected' javaBean='false'/>
+
+ <!-- New button enabled -->
+ <Boolean id='newEnabled' javaBean='false'/>
+
+ <!-- Cancel button enabled -->
+ <Boolean id='cancelEnabled' javaBean='false'/>
+
+ <!-- Save button enabled -->
+ <Boolean id='saveEnabled' javaBean='false'/>
+
+ <!-- Delete button enabled -->
+ <Boolean id='deleteEnabled' javaBean='false'/>
+
+ <!-- Next button enabled -->
+ <Boolean id='buttonEnabled' javaBean='true'/>
+
+ <!-- Next button title -->
+ <java.lang.String id='buttonTitle' javaBean='""'/>
+
+ <!-- Next button title -->
+ <java.lang.String id='nextPath' javaBean='null'/>
+
+ <!-- Next button title -->
+ <java.lang.String id='type' javaBean='null'/>
+
+ <script><![CDATA[
+import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import fr.ifremer.isisfish.entities.FisheryRegion;
+public void refresh(){
+}
+public InputAction getAction() {
+ return getContextValue(InputAction.class);
+}
+public InputSaveVerifier getVerifier(){
+ return getContextValue(InputSaveVerifier.class);
+}
+public FisheryRegion getRegion(){
+ return getContextValue(FisheryRegion.class);
+}
+public void setInfoText(String msg){
+ getParentContainer(WelcomePanelUI.class).setInfoText(msg);
+}
+protected void goTo(){
+ getParentContainer(InputUI.class).setTreeSelection(getNextPath());
+}
+]]>
+ </script>
+ <JPanel id='body' constraints='BorderLayout.CENTER'/>
+ <JButton id='next' text='{getButtonTitle()}' constraints='BorderLayout.SOUTH' enabled='{isButtonEnabled()}' visible='{getNextPath() != null}' onActionPerformed='goTo()'/>
+</JPanel>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,6 +35,7 @@
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import java.awt.Component;
+import org.hibernate.transaction.JOTMTransactionManagerLookup;
/** @author letellier */
public class InputNavigationTreeSelectionAdapter extends NavigationTreeSelectionAdapterWithCardLayout {
@@ -43,6 +44,7 @@
static private final Log log = LogFactory.getLog(InputNavigationTreeSelectionAdapter.class);
protected NavigationTreeNode currentNode = null;
+ protected InputContentUI currentUI = null;
public InputNavigationTreeSelectionAdapter(InputUI context, boolean register) {
super(InputUI.class, null, context, Strategy.PER_UI_TYPE);
@@ -92,20 +94,12 @@
super.openUI(newUI, node);
// apply refresh method (should a contract for all this ui with a method refresh...)
try {
- InputContent ui = (InputContent) newUI;
- boolean parameter = !context.getContextValue(InputAction.class).isNull();
- if (log.isDebugEnabled()) {
- log.debug(parameter);
- }
-// Method setActif = newUI.getClass().getDeclaredMethod("setActif", Boolean.class);
-// setActif.setAccessible(true);
-// setActif.invoke(newUI, parameter);
- ui.setActif(parameter);
- ui.refresh();
+ currentUI = (InputContentUI) newUI;
+ InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
+ verif.removeAllPanels();
+ verif.addCurrentPanel(currentUI);
+ currentUI.refresh();
currentNode = node;
-// Method refresh = newUI.getClass().getDeclaredMethod("refresh");
-// refresh.setAccessible(true);
-// refresh.invoke(newUI);
} catch (Exception e) {
log.debug(e.getMessage(), e);
}
@@ -113,63 +107,41 @@
@Override
protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception {
- // by default, we says that component was succesfull closed
- boolean exit = checkEdit(event, component);
- return exit;
- }
- public boolean checkEdit(TreeSelectionEvent event, Component content) {
boolean exit = true;
- if (content != null) {
- InputContent ui = (InputContent) content;
- if (log.isDebugEnabled()) {
- log.debug(ui.getClass()+"["+ui.getName() + "] <changed:" + ui.isChanged() + ", actif: " + ui.isActif()+">");
+ // by default, we says that component was succesfull closed
+ InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
+ int responce = verif.checkEdit();
+ //boolean exit = checkEdit(event, component);
+ if (responce == JOptionPane.OK_OPTION){
+ JTree tree = (JTree) event.getSource();
+ NavigationTreeModel model = (NavigationTreeModel) tree.getModel();
+ if (currentNode != null) {
+ model.nodeChanged(currentNode);
}
- if (ui.isActif()) {
- if (ui.isChanged()) {
- // ask user to close edition
- // still in edit mode, must warn user
- int responce = askUser(content, _("isisfish.message.page.modified"));
- if (responce == JOptionPane.NO_OPTION) {
- context.getContextValue(InputAction.class).cancel();
- } else if (responce == JOptionPane.OK_OPTION) {
- context.getContextValue(InputAction.class).save();
- ui.setChanged(false);
- JTree tree = (JTree) event.getSource();
- NavigationTreeModel model = (NavigationTreeModel) tree.getModel();
- if (currentNode != null) {
- model.nodeChanged(currentNode);
- }
- } else {
- exit = false;
- }
- }
- }
}
+ else if (responce == JOptionPane.CANCEL_OPTION){
+ exit = false;
+ }
return exit;
}
- public int askUser(Component parent, String message) {
- int response = JOptionPane.showConfirmDialog(parent, message,
- _("isisfish.input.menu.commit"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
- return response;
- }
-
@Override
protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) {
if (log.isDebugEnabled()) {
log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass()));
}
- InputAction action = context.getContextValue(InputAction.class);
- action.setValue(data);
- /*if (data != null) {
- action.setValue(data);
- }*/
- action.setPath(node.getContextPath());
+ InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
+
+ verif.removeAllEntity();
+ verif.setRootPanel((InputUI)context);
+ if (TopiaEntity.class.isInstance(data)){
+ verif.addCurrentEntity((TopiaEntity) data);
+ }
+ verif.setCurrentNode(node);
}
public static NavigationTreeModel getTreeModel(String regionName, FisheryRegion fisheryRegion) {
- //String regionName = context.getContextValue(InputAction.class).getFisheryRegionName();
NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/");
if (regionName == null) {
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-01-02 17:22:04 UTC (rev 1724)
@@ -0,0 +1,386 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package fr.ifremer.isisfish.ui.input;
+
+import fr.ifremer.isisfish.IsisFishDAOHelper;
+import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+import jaxx.runtime.JAXXAction;
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXInitialContext;
+import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
+import org.apache.commons.beanutils.MethodUtils;
+import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.topia.TopiaContext;
+import org.codelutin.topia.TopiaException;
+import org.codelutin.topia.persistence.TopiaDAO;
+import org.codelutin.topia.persistence.TopiaEntity;
+import static org.codelutin.i18n.I18n._;
+
+/**
+ *
+ * @author letellier
+ */
+public class InputSaveVerifier implements JAXXAction {
+ protected JButton newButton = null;
+ protected JButton deleteButton = null;
+ protected JButton saveButton = null;
+ protected JButton cancelButton = null;
+ protected boolean editable = false;
+ protected boolean changed = false;
+
+ protected NavigationTreeNode currentNode = null;
+ protected String currentOnglet = null;
+
+ protected TopiaContext isisContext = null;
+ protected List<TopiaEntity> currentEntities = new ArrayList <TopiaEntity>();
+ protected List<InputContentUI> currentPanels = new ArrayList <InputContentUI>();
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(InputAction.class);
+ protected InputUI rootUI;
+
+ public InputSaveVerifier(){
+ newButton = new JButton(_("isisfish.common.new"));
+ newButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaCreate();
+ }
+ });
+ deleteButton = new JButton(_("isisfish.common.remove"));
+ deleteButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaRemove();
+ }
+ });
+ saveButton = new JButton(_("isisfish.common.save"));
+ saveButton.addActionListener(new ActionListener(){
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaSave();
+ }
+
+ });
+ cancelButton = new JButton(_("isisfish.common.cancel"));
+ cancelButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ topiaCancel();
+ }
+ });
+ }
+ @Override
+ public JAXXInitialContext init(JAXXContext parentContent, Object... datas) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public int checkEdit() {
+ int responce = JOptionPane.NO_OPTION;
+ if (editable) {
+ if (changed) {
+ // ask user to close edition
+ // still in edit mode, must warn user
+ responce = askUser(_("isisfish.message.page.modified"));
+ if (responce == JOptionPane.NO_OPTION) {
+ topiaCancel();
+ } else if (responce == JOptionPane.OK_OPTION) {
+ topiaSave();
+ }
+ }
+ }
+ return responce;
+ }
+
+ public int askUser(String message) {
+ int response = JOptionPane.showConfirmDialog(rootUI, message,
+ _("isisfish.input.menu.commit"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
+ return response;
+ }
+
+ protected void topiaChanged(){
+ changed = true;
+ setPanelsActifs();
+ saveButton.setEnabled(true);
+ cancelButton.setEnabled(true);
+ newButton.setEnabled(false);
+ deleteButton.setEnabled(false);
+ }
+ protected void noModif(){
+ changed = false;
+ setPanelsActifs();
+ saveButton.setEnabled(false);
+ cancelButton.setEnabled(false);
+ newButton.setEnabled(true);
+ deleteButton.setEnabled(true);
+ }
+
+ /**
+ * Delete one entity and commit the change, try to selected intelligently
+ * other node in tree.
+ * <p/>
+ * Refresh all ui component where name match "input<entity type without
+ * package >.*"
+ *
+ * @return if ok return null else OutView error
+ */
+ public void topiaRemove() {
+ if (log.isTraceEnabled()) {
+ log.trace("remove called");
+ }
+ String msg = "";
+ try {
+ boolean doDelete;
+ ArrayList<TopiaEntity> allWillBeRemoved = new ArrayList<TopiaEntity>();
+ for (TopiaEntity te : currentEntities){
+ allWillBeRemoved.addAll(te.getComposite());
+ }
+ if (allWillBeRemoved.size() > 0) {
+ String text = _(
+ "isisfish.message.delete.object", currentEntities.get(0).toString());
+ for (TopiaEntity e : allWillBeRemoved) {
+ text += ClassUtils.getShortClassName(e.getClass()) + " - "
+ + e.toString() + "\n";
+ }
+ int resp = JOptionPane.showConfirmDialog(null, text,
+ _("isisfish.message.delete.entities"), JOptionPane.YES_NO_OPTION);
+ doDelete = resp == JOptionPane.YES_OPTION;
+ } else {
+ String text = _("isisfish.message.confirm.delete.object", currentEntities.get(0).toString());
+ int resp = JOptionPane.showConfirmDialog(null, text,
+ _("isisfish.message.delete.entity"), JOptionPane.YES_NO_OPTION);
+ doDelete = resp == JOptionPane.YES_OPTION;
+ }
+
+ if (doDelete) {
+ for (TopiaEntity te : allWillBeRemoved){
+ te.delete();
+ }
+ isisContext.commitTransaction();
+ msg = _("isisfish.message.remove.finished");
+ } else {
+ msg = _("isisfish.message.remove.canceled");
+ }
+ } catch (Exception eee) {
+ log.error("Can't remove entity: " + currentEntities.get(0), eee);
+ ErrorDialogUI.showError(eee);
+ }
+ rootUI.setInfoText(msg);
+ TreePath treeParentPath = rootUI.getNavigation().getSelectionPath().getParentPath();
+ rootUI.setTreeModel();
+ rootUI.setTreeSelection(treeParentPath.toString());
+ noModif();
+ }
+
+
+ protected void topiaCreate(){
+ String type = currentPanels.get(0).getType();
+
+ if (log.isTraceEnabled()) {
+ log.trace("create called for " + type);
+ }
+ try {
+ //TODO use the IsisFishEntityEnum for this purpose :
+ //TopiaDAO<TopiaEntity> dao = IsisFishEntityEnum.getEntry(type).getDAO(isisContext);
+ String name = type + "_new";
+
+ Method method = MethodUtils.getAccessibleMethod(
+ IsisFishDAOHelper.class, "get" + type + "DAO",
+ TopiaContext.class);
+ TopiaDAO<TopiaEntity> dao = (TopiaDAO<TopiaEntity>) method.invoke(null, isisContext);
+
+ TopiaEntity entity = dao.create("name", name);
+ entity.update();
+ isisContext.commitTransaction();
+
+ rootUI.setTreeModel();
+ String parentPath = currentNode.getParent().getContextPath() + entity.getTopiaId();
+ System.out.println(parentPath);
+ rootUI.setTreeSelection(parentPath);
+
+ rootUI.setInfoText(_("isisfish.message.creation.finished"));
+
+ } catch (Exception eee) {
+ log.error("Can't create entity", eee);
+ showMsgBox(eee);
+ }
+ }
+
+ public void topiaSave(){
+ try {
+ noModif();
+ for (TopiaEntity t : currentEntities){
+ t.update();
+ }
+ isisContext.commitTransaction();
+// rootUI.repaintNode("$root/$ports/" + t.getTopiaId());
+ rootUI.repaintNode(currentNode.getContextPath());
+ rootUI.setInfoText(_("isisfish.message.save.finished"));
+ } catch (TopiaException eee) {
+ log.error("Can't save region", eee);
+ showMsgBox(eee);
+ }
+ }
+
+ /**
+ * Cancel all modification on entity (rollback), and force reload it and
+ * refresh all ui component that name match 'type'Tab
+ *
+ * @return the roolbacked entity
+ */
+ public void topiaCancel() {
+ try {
+ noModif();
+ isisContext.rollbackTransaction();
+ List<TopiaEntity> canceledEntity = new ArrayList<TopiaEntity>();
+ for (TopiaEntity t : currentEntities){
+ t = isisContext.findByTopiaId(t.getTopiaId());
+ rootUI.repaintNode(currentNode.getContextPath());
+ rootUI.setTreeSelection(currentNode.getContextPath());
+ canceledEntity.add(t);
+ }
+ currentEntities = canceledEntity;
+ rootUI.setInfoText(_("isisfish.message.cancel.finished"));
+ } catch (Exception eee) {
+ log.error("Can't cancel modification in region", eee);
+ showMsgBox(eee);
+ }
+ }
+
+ protected void showMsgBox(Exception eee) {
+ ErrorDialogUI.showError(eee);
+ }
+ protected void setPanelsActifs(){
+ if (!currentPanels.isEmpty()){
+ for (InputContentUI panel : currentPanels){
+ panel.setActif(editable);
+ }
+ }
+ }
+ protected void refreshAll(){
+ for (InputContentUI panel : currentPanels){
+ panel.refresh();
+ }
+ }
+ public void addCurrentEntity(TopiaEntity currentEntity) {
+ if (currentEntity != null){
+ editable = true;
+ isisContext = currentEntity.getTopiaContext();
+ currentEntity.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ topiaChanged();
+ }
+ });
+ this.currentEntities.add(currentEntity);
+ }
+ else{
+ editable = false;
+ }
+ }
+ public void removeAllEntity(){
+ currentEntities.clear();
+ editable = false;
+ noModif();
+ }
+ public void addCurrentPanel(InputContentUI currentPanel) {
+ if (currentPanel != null){
+ this.currentPanels.add(currentPanel);
+ setPanelsActifs();
+ }
+ }
+ public void removeAllPanels(){
+ currentPanels.clear();
+ }
+
+ public boolean isEditable() {
+ return editable;
+ }
+
+ public JButton getCancelButton() {
+ return cancelButton;
+ }
+
+ public JButton getDeleteButton() {
+ return deleteButton;
+ }
+
+ public JButton getNewButton() {
+ return newButton;
+ }
+
+ public JButton getSaveButton() {
+ return saveButton;
+ }
+
+ public TopiaContext getIsisContext() {
+ return isisContext;
+ }
+
+ public List<TopiaEntity> getCurrentEntities() {
+ return currentEntities;
+ }
+
+ public TopiaEntity getEntity(Class clazz){
+ for (TopiaEntity te : currentEntities){
+ if (clazz.isInstance(te)){
+ return te;
+ }
+ }
+ return null;
+ }
+
+ public List<InputContentUI> getCurrentPanels() {
+ return currentPanels;
+ }
+
+ public String getCurrentOnglet() {
+ return currentOnglet;
+ }
+
+ public NavigationTreeNode getCurrentNode() {
+ return currentNode;
+ }
+
+ public void setIsisContext(TopiaContext isisContext) {
+ this.isisContext = isisContext;
+ }
+
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ public void setCurrentOnglet(String currentOnglet) {
+ this.currentOnglet = currentOnglet;
+ }
+
+ public void setCurrentNode(NavigationTreeNode currentNode) {
+ this.currentNode = currentNode;
+ }
+
+ void setRootPanel(InputUI inputUI) {
+ this.rootUI = inputUI;
+ }
+}
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-01-02 17:22:04 UTC (rev 1724)
@@ -0,0 +1,45 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package fr.ifremer.isisfish.ui.input;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JOptionPane;
+import javax.swing.JTabbedPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+/**
+ *
+ * @author letellier
+ */
+public class InputTabbedPaneListener implements ChangeListener{
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ try {
+ JTabbedPane pane = (JTabbedPane)e.getSource();
+ int cacheSelectedIndex = pane.getSelectedIndex();
+ InputContentUI ui = (InputContentUI) pane.getSelectedComponent();
+ if (!closeUI(e, ui)) {
+ pane.setSelectedIndex(cacheSelectedIndex);
+ }
+ } catch (Exception ex) {
+ Logger.getLogger(MetierUI.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ protected boolean closeUI(ChangeEvent event, InputContentUI context) throws Exception {
+ boolean exit = true;
+ // by default, we says that component was succesfull closed
+ InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
+ int responce = verif.checkEdit();
+ //boolean exit = checkEdit(event, component);
+ if (responce == JOptionPane.CANCEL_OPTION){
+ exit = false;
+ }
+ return exit;
+ }
+}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -37,163 +37,157 @@
<jaxx.runtime.swing.CardLayout2 id='cardlayout'/>
<script><![CDATA[
- import fr.ifremer.isisfish.ui.Common;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import javax.swing.tree.DefaultMutableTreeNode;
- import javax.swing.tree.DefaultTreeModel;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import fr.ifremer.isisfish.entities.Cell;
- import fr.ifremer.isisfish.entities.Gear;
- import fr.ifremer.isisfish.entities.Metier;
- import fr.ifremer.isisfish.entities.Port;
- import fr.ifremer.isisfish.entities.SetOfVessels;
- import fr.ifremer.isisfish.entities.Species;
- import fr.ifremer.isisfish.entities.Strategy;
- import fr.ifremer.isisfish.entities.TripType;
- import fr.ifremer.isisfish.entities.VesselType;
- import fr.ifremer.isisfish.entities.Zone;
- import fr.ifremer.isisfish.entities.Population;
- import javax.swing.tree.TreeNode;
- import javax.swing.tree.TreePath;
- import org.codelutin.topia.persistence.TopiaEntity;
- import org.codelutin.topia.TopiaException;
- import fr.ifremer.isisfish.IsisFishEntityEnum;
- import jaxx.runtime.JAXXContextEntryDef;
- import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
- import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder;
- import jaxx.runtime.swing.navigation.NavigationUtil;
- import fr.ifremer.isisfish.entities.FisheryRegion;
- import jaxx.runtime.swing.navigation.NavigationTreeCellRenderer;
- import jaxx.runtime.swing.navigation.NavigationTreeModel;
- import jaxx.runtime.Decorator;
- import jaxx.runtime.JXPathDecorator;
-
-/* tree.addTreeSelectionListener(new TreeSelectionListener() {
- @Override
- public void valueChanged(TreeSelectionEvent e) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
- String name = null;
- if (node != null) {
- GenericCell selectedValue = (GenericCell) node.getUserObject();
- if (selectedValue.getType() != null) {
- name = selectedValue.getType().getSimpleName();
- getContextValue(InputAction.class).setValue(selectedValue.getValue(),selectedValue.getType());
- refreshAll(selectedValue);
- }
- else {
- name = "none";
- }
- ((CardLayout) inputPane.getLayout()).show(inputPane, name);
- }
- }
- });*/
-
- public InputUI (InputAction action){
-
- setContextValue(action);
- }
- protected void setFieldCurrentRegionModel(){
- fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
- }
- protected DefaultComboBoxModel getFieldCurrentRegionModel(){
- return new DefaultComboBoxModel(Common.getRegionItem());
- }
- protected void regionChange(){
- final String name = fieldCurrentRegion.getSelectedItem().toString();
- setInfoText(_("isisfish.message.loading.region", name));
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- getContextValue(InputAction.class).loadRegion(name);
- setInfoText(_("isisfish.message.load.finished"));
- setTreeModel();
- }
- });
- }
- protected void setTreeModel(){
- String regionName = getContextValue(InputAction.class).getFisheryRegionName();
- FisheryRegion fisheryRegion = getContextValue(InputAction.class).getFisheryRegion();
- if (fisheryRegion != null){
- setContextValue(fisheryRegion);
- NavigationTreeModel model = InputNavigationTreeSelectionAdapter.getTreeModel(regionName, fisheryRegion);
- navigation.setSelectionModel(navigationSelectionModel);
- navigation.setCellRenderer(new NavigationTreeCellRenderer(this));
+import fr.ifremer.isisfish.ui.Common;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import fr.ifremer.isisfish.entities.Cell;
+import fr.ifremer.isisfish.entities.Gear;
+import fr.ifremer.isisfish.entities.Metier;
+import fr.ifremer.isisfish.entities.Port;
+import fr.ifremer.isisfish.entities.SetOfVessels;
+import fr.ifremer.isisfish.entities.Species;
+import fr.ifremer.isisfish.entities.Strategy;
+import fr.ifremer.isisfish.entities.TripType;
+import fr.ifremer.isisfish.entities.VesselType;
+import fr.ifremer.isisfish.entities.Zone;
+import fr.ifremer.isisfish.entities.Population;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+import org.codelutin.topia.persistence.TopiaEntity;
+import org.codelutin.topia.TopiaException;
+import fr.ifremer.isisfish.IsisFishEntityEnum;
+import jaxx.runtime.JAXXContextEntryDef;
+import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
+import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder;
+import jaxx.runtime.swing.navigation.NavigationUtil;
+import fr.ifremer.isisfish.entities.FisheryRegion;
+import jaxx.runtime.swing.navigation.NavigationTreeCellRenderer;
+import jaxx.runtime.swing.navigation.NavigationTreeModel;
+import jaxx.runtime.Decorator;
+import jaxx.runtime.JXPathDecorator;
+import org.codelutin.topia.TopiaContext;
+import fr.ifremer.isisfish.entities.FisheryRegion;
+import fr.ifremer.isisfish.datastore.RegionStorage;
- setContextValue(model);
- navigation.setModel(model);
- new InputNavigationTreeSelectionAdapter(this, true);
- setTreeSelection("$root");
+protected FisheryRegion getRegion(){
+ return getContextValue(FisheryRegion.class);
+}
+protected InputAction getAction(){
+ return getContextValue(InputAction.class);
+}
+protected InputSaveVerifier getVerifier(){
+ return getContextValue(InputSaveVerifier.class);
+}
+protected RegionStorage getRegionStorage(){
+ return getContextValue(RegionStorage.class);
+}
+protected void setFieldCurrentRegionModel(){
+ fieldCurrentRegion.setModel(getFieldCurrentRegionModel());
+}
+protected DefaultComboBoxModel getFieldCurrentRegionModel(){
+ return new DefaultComboBoxModel(Common.getRegionItem());
+}
+protected void regionChange(){
+ final String name = fieldCurrentRegion.getSelectedItem().toString();
+ setInfoText(_("isisfish.message.loading.region", name));
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ loadRegion(name);
+ getVerifier().setIsisContext(getContextValue(TopiaContext.class));
+ setInfoText(_("isisfish.message.load.finished"));
+ setTreeModel();
}
- }
+ });
+}
+protected void loadRegion(String name){
+ getAction().loadRegion(this, name);
+}
+protected void setTreeModel(){
+ String regionName = getRegion().getName();
+ if (getRegion() != null){
+ setContextValue(getRegion());
+ NavigationTreeModel model = InputNavigationTreeSelectionAdapter.getTreeModel(regionName, getRegion());
+ navigation.setSelectionModel(navigationSelectionModel);
+ navigation.setCellRenderer(new NavigationTreeCellRenderer(this));
- public void repaintNode(String path){
- NavigationTreeModel model = getContextValue(NavigationTreeModel.class);
- NavigationTreeNode currentNode = model.findNode(path);
- model.nodeChanged(currentNode);
+ setContextValue(model);
+ navigation.setModel(model);
+ new InputNavigationTreeSelectionAdapter(this, true);
+ setTreeSelection("$root");
}
- public void setTreeSelection(String path){
- NavigationTreeNode node = NavigationUtil.findNode(this, null, path);
- TreePath pathToRoot = new TreePath(getContextValue(NavigationTreeModel.class).getPathToRoot(node));
- navigation.setSelectionPath(pathToRoot);
- navigation.scrollPathToVisible(pathToRoot);
- }
- protected void setInfoText(String s){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(s);
- }
- protected void newRegion(){
- String name = fieldNewRegion.getText();
- setInfoText(_("isisfish.message.creating.region", name));
- getContextValue(InputAction.class).newRegion(name);
- setInfoText(_("isisfish.message.creating.region", name));
- setFieldCurrentRegionModel();
- fieldCurrentRegion.setSelectedItem(name);
- JButtonNewRegion.setEnabled(false);
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void newChanged(){
- JButtonNewRegion.setEnabled(true);
- }
- protected void importRegion(){
- setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegion()));
- setFieldCurrentRegionModel();
- setInfoText(_("isisfish.message.import.finished"));
- }
- protected void importRegionAndRename(){
- setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegionAndRename()));
- setFieldCurrentRegionModel();
- setInfoText(_("isisfish.message.import.finished"));
- }
- protected void importV2Region(){
- setInfoText(_("isisfish.message.import.xml.v2.file") + getContextValue(InputAction.class).importV2Region());
- setFieldCurrentRegionModel();
- setInfoText(_("isisfish.message.import.finished"));
- }
- protected void importRegionFromSimulation(){
- setInfoText(_("isisfish.message.import", getContextValue(InputAction.class).importRegionFromSimulation()));
- }
- protected void exportRegion(){
- setInfoText(_("isisfish.message.export.zip", getContextValue(InputAction.class).exportRegion()));
- setFieldCurrentRegionModel();
- setInfoText(_("isisfish.message.export.done"));
- }
- protected void copyRegion(){
- setInfoText(_("isisfish.message.copy.region", getContextValue(InputAction.class).copyRegion()));
- setFieldCurrentRegionModel();
- setInfoText(_("isisfish.message.copy.finished"));
- }
- protected void removeRegion(){
- setInfoText(_("isisfish.message.removing.region" + getContextValue(InputAction.class).getRegionStorage().getName()));
- setFieldCurrentRegionModel();
- setInfoText(getContextValue(InputAction.class).removeRegion(false));
- }
- protected void commitRegionInCVS(){
- setInfoText(_("isisfish.message.commiting.region" + getContextValue(InputAction.class).getRegionStorage().getName()));
- setInfoText(getContextValue(InputAction.class).commitRegionInCVS());
- }
+}
+
+public void repaintNode(String path){
+ NavigationTreeModel model = getContextValue(NavigationTreeModel.class);
+ NavigationTreeNode currentNode = model.findNode(path);
+ model.nodeChanged(currentNode);
+}
+public void setTreeSelection(String path){
+ NavigationTreeNode node = NavigationUtil.findNode(this, null, path);
+ TreePath pathToRoot = new TreePath(getContextValue(NavigationTreeModel.class).getPathToRoot(node));
+ navigation.setSelectionPath(pathToRoot);
+ navigation.scrollPathToVisible(pathToRoot);
+}
+protected void setInfoText(String s){
+ WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
+ root.setInfoText(s);
+}
+protected void newRegion(){
+ String name = fieldNewRegion.getText();
+ setInfoText(_("isisfish.message.creating.region", name));
+ getContextValue(InputAction.class).newRegion(name);
+ setInfoText(_("isisfish.message.creating.region", name));
+ setFieldCurrentRegionModel();
+ fieldCurrentRegion.setSelectedItem(name);
+ JButtonNewRegion.setEnabled(false);
+ setInfoText(_("isisfish.message.creation.finished"));
+}
+protected void newChanged(){
+ JButtonNewRegion.setEnabled(true);
+}
+protected void importRegion(){
+ setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegion()));
+ setFieldCurrentRegionModel();
+ setInfoText(_("isisfish.message.import.finished"));
+}
+protected void importRegionAndRename(){
+ setInfoText(_("isisfish.message.import.zip" + getContextValue(InputAction.class).importRegionAndRename()));
+ setFieldCurrentRegionModel();
+ setInfoText(_("isisfish.message.import.finished"));
+}
+protected void importV2Region(){
+ setInfoText(_("isisfish.message.import.xml.v2.file") + getContextValue(InputAction.class).importV2Region());
+ setFieldCurrentRegionModel();
+ setInfoText(_("isisfish.message.import.finished"));
+}
+protected void importRegionFromSimulation(){
+ setInfoText(_("isisfish.message.import", getContextValue(InputAction.class).importRegionFromSimulation()));
+}
+protected void exportRegion(){
+ setInfoText(_("isisfish.message.export.zip", getContextValue(InputAction.class).exportRegion(getRegionStorage())));
+ setFieldCurrentRegionModel();
+ setInfoText(_("isisfish.message.export.done"));
+}
+protected void copyRegion(){
+ setInfoText(_("isisfish.message.copy.region", getContextValue(InputAction.class).copyRegion(getRegionStorage())));
+ setFieldCurrentRegionModel();
+ setInfoText(_("isisfish.message.copy.finished"));
+}
+protected void removeRegion(){
+ setInfoText(_("isisfish.message.removing.region" + getRegionStorage().getName()));
+ setFieldCurrentRegionModel();
+ setInfoText(getContextValue(InputAction.class).removeRegion(getRegionStorage(), false));
+}
+protected void commitRegionInCVS(){
+ setInfoText(_("isisfish.message.commiting.region" + getRegionStorage().getName()));
+ setInfoText(getContextValue(InputAction.class).commitRegionInCVS(getRegionStorage()));
+}
]]>
</script>
<JMenuBar id="menu" constraints='BorderLayout.NORTH'>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,12 +31,11 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
<script><![CDATA[
import com.l2fprod.common.swing.renderer.BooleanCellRenderer;
@@ -45,6 +44,7 @@
import fr.ifremer.isisfish.entities.Equation;
import fr.ifremer.isisfish.entities.Formule;
import fr.ifremer.isisfish.entities.Metier;
+ import fr.ifremer.isisfish.entities.MetierImpl;
import fr.ifremer.isisfish.entities.MetierSeasonInfo;
import fr.ifremer.isisfish.entities.TargetSpecies;
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
@@ -53,14 +53,13 @@
import org.codelutin.topia.persistence.TopiaEntity;
import javax.swing.table.DefaultTableModel;
import fr.ifremer.isisfish.entities.Species;
+ import org.codelutin.topia.TopiaContext;
import javax.swing.table.TableCellEditor;
- public MetierSeasonInfoSpeciesUI (InputAction action){
-
- setContextValue(action);
- }
public void refresh() {
- if (getContextValue(InputAction.class).getMetier() != null){
+ Metier metier = (Metier)getVerifier().getEntity(Metier.class);
+ setBean((MetierImpl) metier);
+ if (getBean() != null){
if (fieldMetierSeasonInfo.getSelectedIndex() <= 0){
setSeasonModel();
}
@@ -88,9 +87,8 @@
}
}
protected void setSeasonModel(){
- Metier metier = getContextValue(InputAction.class).getMetier();
DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
- java.util.List<MetierSeasonInfo> metierSeasonInfo = metier.getMetierSeasonInfo();
+ java.util.List<MetierSeasonInfo> metierSeasonInfo = getBean().getMetierSeasonInfo();
if (metierSeasonInfo != null){
seasonModel.addElement(new GenericCell(" ", null, null));
for (MetierSeasonInfo m : metierSeasonInfo){
@@ -101,7 +99,7 @@
}
protected void setTargetSpeciesModel(){
DefaultComboBoxModel fieldTargetSpeciesModel = new DefaultComboBoxModel();
- java.util.List<Species> species = getContextValue(InputAction.class).getFisheryRegion().getSpecies();
+ java.util.List<Species> species = getRegion().getSpecies();
if (species != null){
fieldTargetSpeciesModel.addElement(new GenericCell(" ", null, null));
for (Species s : species){
@@ -111,7 +109,7 @@
fieldTargetSpecies.setModel(fieldTargetSpeciesModel);
}
protected void setTargetFactorEquationModel(){
- java.util.List<Formule> formules = fr.ifremer.isisfish.datastore.FormuleStorage.getFormules(getContextValue(InputAction.class).getIsisContext(), "TargetFactor");
+ java.util.List<Formule> formules = fr.ifremer.isisfish.datastore.FormuleStorage.getFormules(getContextValue(TopiaContext.class), "TargetFactor");
DefaultComboBoxModel fieldTargetFactorEquationModel = new DefaultComboBoxModel();
if (formules != null){
fieldTargetFactorEquationModel.addElement(new GenericCell(" ", null, null));
@@ -169,150 +167,129 @@
}
}
}
- protected void saveAsModel(){
- getContextValue(InputAction.class).saveAsModel("Metier", "Java", fieldTargetFactorScript.getText());
- setInfoText(_("isisfish.message.saveModel.finished"));
- }
protected void add(){
Object season = ((GenericCell)fieldMetierSeasonInfo.getSelectedItem()).getValue();
Object species = ((GenericCell)fieldTargetSpecies.getSelectedItem()).getValue();
if (season != null && species != null){
getContextValue(InputAction.class).addTargetSpecies(
+ getBean(),
(MetierSeasonInfo)season,
(Species)species,
fieldTargetFactorScript.getText(),
fieldPrimaryCatch.isSelected());
- valueChanged(true);
refresh();
}
}
protected void remove(){
- // getContextValue(InputAction.class).removeSelectivity((Selectivity) getContextValue(InputAction.class).getGear().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0)));
refresh();
}
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$metiers/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void valueChanged(boolean b){
- getParentContainer(MetierUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
protected void openEditor(){
- getContextValue(InputAction.class).openEditor("TargetFactor","new",fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class, fieldTargetFactorScript.getText(), fieldTargetFactorScript);
+ getContextValue(InputAction.class).openEditor("TargetSpeciesTargetFactorEquation","new",fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class, fieldTargetFactorScript.getText(), fieldTargetFactorScript);
}
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
+ protected void saveAsModel(){
+ getContextValue(InputAction.class).saveAsModel("TargetSpeciesTargetFactorEquation", "Java", fieldTargetFactorScript.getText());
+ setTargetFactorEquationModel();
+ setInfoText(_("isisfish.message.saveModel.finished"));
}
protected void metierSeasonChanged(){
setTableTargetSpeciesModel();
}
]]></script>
- <row>
- <cell fill='both' weightx='1.0' weighty='0.5'>
- <Table>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason"/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldMetierSeasonInfo" onActionPerformed='metierSeasonChanged()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies"/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldTargetSpecies"/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metierSeasonInfoSpecies.targetFactor"/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldTargetFactorEquation" onActionPerformed='equationChanged()'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton id='saveModel' text="isisfish.common.saveModel" onActionPerformed='saveAsModel()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id='openEditor' text="isisfish.common.openEditor" onActionPerformed='openEditor()'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <org.codelutin.widget.editor.Editor id='fieldTargetFactorScript' askIfNotSaved="false"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JPanel/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies"/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0' weighty='0.5'>
- <Table>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonMetierSpeciesAddTargetSpecies" text="isisfish.common.add" onActionPerformed='add()'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTable id="tableTargetSpecies"/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonMetierSpeciesRemoveTargetSpecies" text="isisfish.common.remove" onActionPerformed='remove()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='0.5'>
+ <Table>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metierSeasonInfoSpecies.selectSeason"/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldMetierSeasonInfo" onActionPerformed='metierSeasonChanged()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metierSeasonInfoSpecies.selectSpecies"/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldTargetSpecies"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metierSeasonInfoSpecies.targetFactor"/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldTargetFactorEquation" onActionPerformed='equationChanged()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton id='saveModel' text="isisfish.common.saveModel" onActionPerformed='saveAsModel()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton id='openEditor' text="isisfish.common.openEditor" onActionPerformed='openEditor()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <org.codelutin.widget.editor.Editor id='fieldTargetFactorScript' askIfNotSaved="false"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JPanel/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JCheckBox id="fieldPrimaryCatch" text="isisfish.metierSeasonInfoSpecies.mainSpecies"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='0.5'>
+ <Table>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JButton id="buttonMetierSpeciesAddTargetSpecies" text="isisfish.common.add" onActionPerformed='add()'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JTable id="tableTargetSpecies"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JButton id="buttonMetierSpeciesRemoveTargetSpecies" text="isisfish.common.remove" onActionPerformed='remove()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,13 +31,11 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
import fr.ifremer.isisfish.entities.Season;
import fr.ifremer.isisfish.types.Month;
@@ -47,18 +45,47 @@
import fr.ifremer.isisfish.ui.widget.IntervalPanel;
import fr.ifremer.isisfish.entities.Zone;
import fr.ifremer.isisfish.entities.Metier;
+ import fr.ifremer.isisfish.entities.MetierImpl;
import org.codelutin.topia.persistence.TopiaEntity;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
protected boolean seasonInit = true;
protected IntervalPanel ip = new IntervalPanel();
displayMetierSeason.add(ip, BorderLayout.CENTER);
- public MetierSeasonInfoZoneUI (InputAction action){
-
- setContextValue(action);
- }
+ ip.addPropertyChangeListener("first", new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Object selected = fieldMetierSeasonChoice.getSelectedItem();
+ if (selected != null){
+ Object value = ((GenericCell)selected).getValue();
+ // Data extraction
+ Season season = (Season) value;
+ Month first = season.getFirstMonth();
+ first.setMonthNumber(ip.getModel().getFirst());
+ season.setFirstMonth(first);
+ }
+ }
+ });
+
+ ip.addPropertyChangeListener("last", new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Object selected = fieldMetierSeasonChoice.getSelectedItem();
+ if (selected != null){
+ Object value = ((GenericCell)selected).getValue();
+ // Data extraction
+ Season season = (Season) value;
+ Month last = season.getLastMonth();
+ last.setMonthNumber(ip.getModel().getLast());
+ season.setLastMonth(last);
+ }
+ }
+ });
public void refresh() {
- Metier metier = getContextValue(InputAction.class).getMetier();
+ Metier metier = (Metier)getVerifier().getEntity(Metier.class);
+ setBean((MetierImpl) metier);
if (metier != null){
if (seasonInit){
DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
@@ -113,7 +140,7 @@
DefaultListModel zonesModel = new DefaultListModel();
- java.util.List<Zone> metierZone = getContextValue(InputAction.class).getFisheryRegion().getZone();
+ java.util.List<Zone> metierZone = getRegion().getZone();
if (metierZone != null){
for (Zone z : metierZone ){
zonesModel.addElement(z);
@@ -144,7 +171,7 @@
ip.setModel(interval);
fieldMetierSeasonZoneComment.setText("");
DefaultListModel zonesModel = new DefaultListModel();
- java.util.List<Zone> metierZone = getContextValue(InputAction.class).getFisheryRegion().getZone();
+ java.util.List<Zone> metierZone = getRegion().getZone();
if (metierZone != null){
for (Zone z : metierZone ){
zonesModel.addElement(z);
@@ -155,45 +182,6 @@
}
}
}
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("Metier");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$metiers/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$metiers/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$metiers");
- valueChanged(false);
- seasonInit = false;
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(MetierUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
protected void zonesChanged(){
Object selected = fieldMetierSeasonChoice.getSelectedItem();
if (selected != null){
@@ -206,7 +194,6 @@
}
}
}
- valueChanged(true);
}
protected void commentChanged(){
Object selected = fieldMetierSeasonChoice.getSelectedItem();
@@ -218,7 +205,6 @@
season.setSeasonZoneComment(fieldMetierSeasonZoneComment.getText());
}
}
- valueChanged(true);
}
public void setSeasonInit(boolean b){
seasonInit = b;
@@ -228,68 +214,70 @@
refresh();
}
]]></script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metierSeasonInfoZone.selectSeason" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldMetierSeasonChoice" onActionPerformed='metierSeasonChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JPanel id='displayMetierSeason' layout='{new BorderLayout()}' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.common.zone" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.7'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="metierZones" onValueChanged='zonesChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.3'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTextArea id="fieldMetierSeasonZoneComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id ='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metierSeasonInfoZone.selectSeason" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldMetierSeasonChoice" onActionPerformed='metierSeasonChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JPanel id='displayMetierSeason' layout='{new BorderLayout()}' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.common.zone" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.7'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JList id="metierZones" onValueChanged='zonesChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.3'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JTextArea id="fieldMetierSeasonZoneComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,32 +31,28 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
import fr.ifremer.isisfish.entities.Gear;
import fr.ifremer.isisfish.entities.TripType;
import fr.ifremer.isisfish.entities.Metier;
+ import fr.ifremer.isisfish.entities.MetierImpl;
import fr.ifremer.isisfish.ui.WelcomePanelUI;
import org.codelutin.topia.persistence.TopiaEntity;
import org.codelutin.topia.TopiaException;
import java.util.logging.Level;
import java.util.logging.Logger;
-
- public MetierTabUI (InputAction action){
-
- setContextValue(action);
- }
+
public void refresh() {
try {
- Metier metier = getContextValue(InputAction.class).getMetier();
- DefaultComboBoxModel model = new DefaultComboBoxModel(getContextValue(InputAction.class).getFisheryRegion().getGear().toArray());
+ Metier metier = (Metier)getVerifier().getEntity(Metier.class);
+ setBean((MetierImpl) metier);
+ DefaultComboBoxModel model = new DefaultComboBoxModel(getRegion().getGear().toArray());
fieldMetierGear.setModel(model);
if (metier != null){
fieldMetierName.setText(metier.getName());
@@ -73,117 +69,80 @@
}
}
protected void nameChanged(){
- getContextValue(InputAction.class).getMetier().setName(fieldMetierName.getText());
- valueChanged(true);
+ getBean().setName(fieldMetierName.getText());
}
protected void gearChanged(){
- getContextValue(InputAction.class).getMetier().setGear((Gear)fieldMetierGear.getSelectedItem());
- valueChanged(true);
+ getBean().setGear((Gear)fieldMetierGear.getSelectedItem());
}
protected void paramChanged(){
- getContextValue(InputAction.class).getMetier().setGearParameterValue(fieldMetierParam.getText());
- valueChanged(true);
+ getBean().setGearParameterValue(fieldMetierParam.getText());
}
protected void commentChanged(){
- getContextValue(InputAction.class).getMetier().setComment(fieldMetierComment.getText());
- valueChanged(true);
+ getBean().setComment(fieldMetierComment.getText());
}
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("Metier");
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$metiers/"+topia.getTopiaId());
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$metiers/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$metiers");
- valueChanged(false);
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(MetierUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
]]></script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metier.name" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldMetierName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.common.gear" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldMetierGear" onActionPerformed='gearChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metier.rangeValues" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldMetierParam" onKeyTyped='valueChanged(true)' onFocusLost='paramChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.metier.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JTextArea id="fieldMetierComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id="save" text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id="cancel" text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id="create" text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='bady'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metier.name" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldMetierName" onKeyTyped='nameChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.common.gear" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldMetierGear" onActionPerformed='gearChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metier.rangeValues" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldMetierParam" onKeyTyped='paramChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.metier.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JTextArea id="fieldMetierComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -34,22 +34,21 @@
<!--
+ Metier
+-->
-<JPanel layout='{new BorderLayout()}' implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.MetierImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
import fr.ifremer.isisfish.entities.TripType;
+ import fr.ifremer.isisfish.entities.MetierImpl;
+ import fr.ifremer.isisfish.entities.Metier;
init();
- public MetierUI (InputAction action){
-
- setContextValue(action);
- }
public void refresh() {
+ setBean(null);
+ Metier metier = (Metier)getVerifier().getEntity(Metier.class);
+ setBean((MetierImpl) metier);
metierTabUI.refresh();
metierSeasonSpeciesUI.refresh();
@@ -57,6 +56,7 @@
metierSeasonInfoUI.refresh();
}
protected void init(){
+ metierTab.addChangeListener(new InputTabbedPaneListener());
this.addPropertyChangeListener("actif", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -78,10 +78,12 @@
getParentContainer(InputUI.class).setTreeSelection("$root/$tripTypes");
}
]]></script>
- <JTabbedPane id="MetierTab" name="Metier" constraints='BorderLayout.CENTER'>
- <tab title='{_("isisfish.metier.title")}'><MetierTabUI id="metierTabUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- <tab title='{_("isisfish.metierSeasonInfoZone.title")}'><MetierSeasonInfoZoneUI id="metierSeasonInfoUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- <tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'><MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- </JTabbedPane>
- <JButton constraints='BorderLayout.SOUTH' text="isisfish.input.continueTripTypes" onActionPerformed='goToTripType()'/>
-</JPanel>
\ No newline at end of file
+ <JPanel id='body' layout='{new BorderLayout()}'>
+ <JTabbedPane id="metierTab" name="Metier" constraints='BorderLayout.CENTER' >
+ <tab title='{_("isisfish.metier.title")}'><MetierTabUI id="metierTabUI" constructorParams='this'/></tab>
+ <tab title='{_("isisfish.metierSeasonInfoZone.title")}'><MetierSeasonInfoZoneUI id="metierSeasonInfoUI" constructorParams='this'/></tab>
+ <tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'><MetierSeasonInfoSpeciesUI id="metierSeasonSpeciesUI" constructorParams='this'/></tab>
+ </JTabbedPane>
+ <!--JButton constraints='BorderLayout.SOUTH' text="isisfish.input.continueTripTypes" onActionPerformed='goToTripType()'/-->
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,34 +31,45 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Equation;
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.entities.Species;
- import fr.ifremer.isisfish.entities.PopulationGroup;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.entities.Population;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import javax.swing.table.DefaultTableModel;
- import java.util.logging.Level;
- import java.util.logging.Logger;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.Species;
+import fr.ifremer.isisfish.entities.PopulationGroup;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.table.DefaultTableModel;
- protected Population pop = null;
- public PopulationBasicsUI (InputAction action){
-
- setContextValue(action);
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
+ fieldPopulationBasicsGeographicID.setText("");
+ fieldPopulationBasicsNbClasses.setText("");
+ fieldPopulationBasicsComment.setText("");
+ fieldPopulationBasicsMatureClass.setSelectedItem(null);
+ }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
}
+});
public void refresh(){
- jaxx.runtime.Util.assignment(pop = getContextValue(InputAction.class).getPopulation(), "pop", fr.ifremer.isisfish.ui.input.PopulationBasicsUI.this);
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
try {
editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
editorReverse.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
@@ -67,150 +78,44 @@
}
setFieldPopulationBasicsGrowthModel();
setfieldPopulationBasicsGrowthReverseModel();
- if (pop != null){
- fieldPopulationBasicsName.setText(pop.getName());
- fieldPopulationBasicsGeographicID.setText(pop.getGeographicId());
- fieldPopulationBasicsNbClasses.setText(pop.sizePopulationGroup() + "");
- setFieldPopulationBasicsMatureClassModel();
- fieldPopulationBasicsPlusGroup.setSelected(pop.getPlusGroup());
- fieldPopulationBasicsComment.setText(pop.getComment());
- growthReverseChanged();
- basicsGrowthChanged();
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsGrowthReverse,getAction().getFormules(getBean().getTopiaContext(), "GrowthReverse"), null);
+ if (getBean() != null){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsMatureClass,getBean().getPopulationGroup(), getBean().getMaturityGroup());
+// growthReverseChanged();
+// basicsGrowthChanged();
setTableAgeLengthModel();
}
- else{
-// pop = (Population) getContextValue(InputAction.class).create("Population");
- fieldPopulationBasicsName.setText("");
- fieldPopulationBasicsGeographicID.setText("");
- fieldPopulationBasicsNbClasses.setText("");
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldPopulationBasicsMatureClass.setModel(model);
- fieldPopulationBasicsComment.setText("");
- growthReverseChanged();
- basicsGrowthChanged();
- DefaultTableModel tableModel = new DefaultTableModel();
- tableAgeLength.setModel(tableModel);
-
- }
}
- protected void setFieldPopulationBasicsMatureClassModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- PopulationGroup selected = null;
- model.addElement(null);
- if (pop.getPopulationGroup() != null){
- for (PopulationGroup p : pop.getPopulationGroup()){
- model.addElement(p);
- if (pop.getMaturityGroup() == p){
- selected = p;
- }
- }
- }
- fieldPopulationBasicsMatureClass.setModel(model);
- if (selected != null){
- fieldPopulationBasicsMatureClass.setSelectedItem(selected);
- }
- }
protected void setFieldPopulationBasicsGrowthModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- GenericCell selected = null;
- model.addElement(new GenericCell(" ", null, null));
- for (Formule f : getContextValue(InputAction.class).getFormules("Growth")){
- GenericCell c = new GenericCell(f.getName(), f, Formule.class);
- model.addElement(c);
- if (pop != null){
- if (f.equals((Formule)pop.getGrowth())){
- selected = c;
- }
- }
- }
- fieldPopulationBasicsGrowth.setModel(model);
- if (selected != null){
- fieldPopulationBasicsGrowth.setSelectedItem(selected);
- basicsGrowthChanged();
- }
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsGrowth,getAction().getFormules(getBean().getTopiaContext(), "Growth"), null);
}
protected void setfieldPopulationBasicsGrowthReverseModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- model.addElement(new GenericCell(" ", null, null));
- GenericCell selected = null;
- java.util.List<Formule> formules = getContextValue(InputAction.class).getFormules("GrowthReverse");
- if (formules != null){
- for (Formule f : formules){
- GenericCell c = new GenericCell(f.getName(), f, Formule.class);
- model.addElement(c);
- if (pop != null){
- if (((Equation)f).equals(pop.getGrowthReverse())){
- selected = c;
- }
- }
- }
- }
- fieldPopulationBasicsGrowthReverse.setModel(model);
- if (selected != null){
- fieldPopulationBasicsGrowthReverse.setSelectedItem(selected);
- growthReverseChanged();
- }
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsGrowthReverse,getAction().getFormules(getBean().getTopiaContext(), "GrowthReverse"), null);
}
- protected Equation getEquation(){
- Equation result = null;
- Object o = fieldPopulationBasicsGrowth.getSelectedItem();
- if (o != null){
- GenericCell c = (GenericCell)o;
- if (c.getValue() != null){
- result = (Equation)c.getValue();
- }
- }
- return result;
- }
- protected Equation getReverseEquation(){
- Equation result = null;
- Object o = fieldPopulationBasicsGrowthReverse.getSelectedItem();
- if (o != null){
- GenericCell c = (GenericCell)o;
- if (c.getValue() != null){
- result = (Equation)c.getValue();
- }
- }
- return result;
- }
- protected void nameChanged(){
- pop.setName(fieldPopulationBasicsName.getText());
- }
- protected void geographicChanged(){
- if (pop != null){
- pop.setGeographicId(fieldPopulationBasicsGeographicID.getText());
- }
- }
protected void createClasses(){
- if (pop != null){
- JFrame wizardFrame = new JFrame();
- wizardFrame.setLayout(new BorderLayout());
- WizardGroupCreationUI wizard = new WizardGroupCreationUI(getContextValue(InputAction.class), this);
- wizardFrame.add(wizard, BorderLayout.CENTER);
- wizardFrame.setTitle(_("isisfish.wizardGroupCreation.title"));
- wizardFrame.setVisible(true);
- wizardFrame.pack();
- wizard.setAgeType(pop.getSpecies().getAgeGroupType());
- if (wizard.isAgeType()) {
- wizard.setCard("singleGroupAge");
- } else {
- wizard.setCard("beginGroupLength");
- }
- valueChanged(true);
- refresh();
+ JFrame wizardFrame = new JFrame();
+ wizardFrame.setLayout(new BorderLayout());
+ WizardGroupCreationUI wizard = new WizardGroupCreationUI(getContextValue(InputAction.class), this);
+ wizardFrame.add(wizard, BorderLayout.CENTER);
+ wizardFrame.setTitle(_("isisfish.wizardGroupCreation.title"));
+ wizardFrame.setVisible(true);
+ wizardFrame.pack();
+ wizard.setAgeType(getBean().getSpecies().getAgeGroupType());
+ if (wizard.isAgeType()) {
+ wizard.setCard("singleGroupAge");
+ } else {
+ wizard.setCard("beginGroupLength");
}
+ refresh();
}
protected void matureClassChanged(){
Object selected = fieldPopulationBasicsMatureClass.getSelectedItem();
if (selected != null){
- pop.setMaturityGroup((PopulationGroup) selected);
+ getBean().setMaturityGroup((PopulationGroup) selected);
}
}
- protected void plusGroupChanged(){
- pop.setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected());
- }
protected void basicsGrowthChanged(){
- Equation f = getEquation();
+ Equation f = (Equation) fieldPopulationBasicsGrowth.getSelectedItem();
if (f != null){
editor.setText(f.getContent());
}
@@ -219,45 +124,26 @@
getContextValue(InputAction.class).saveAsModel("PopulationGrowth", "Java", editor.getText());
setFieldPopulationBasicsGrowthModel();
setInfoText(_("isisfish.message.saveModel.finished"));
-// Equation e = getEquation();
-// if (e != null){
-// getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
-// }
}
protected void openGrowthEditor(){
getContextValue(InputAction.class).openEditor("PopulationGrowth","new",fr.ifremer.isisfish.equation.PopulationGrowth.class, editor.getText(), editor);
-// Equation e = getEquation();
-// if (e != null){
-// getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), fr.ifremer.isisfish.equation.PopulationGrowth.class, e.getContent(), editor);
-// }
}
protected void growthReverseChanged(){
- Equation f = getReverseEquation();
+ Equation f = (Equation)fieldPopulationBasicsGrowthReverse.getSelectedItem();
if (f != null){
editorReverse.setText(f.getContent());
}
}
protected void saveGrowthReverseModel(){
- getContextValue(InputAction.class).saveAsModel("PopulationGrowth", "Java", editor.getText());
+ getContextValue(InputAction.class).saveAsModel("PopulationGrowthReverse", "Java", editor.getText());
setfieldPopulationBasicsGrowthReverseModel();
setInfoText(_("isisfish.message.saveModel.finished"));
-// Equation e = getEquation();
-// if (e != null){
-// getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
-// }
}
protected void openGrowthReverseEditor(){
- 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);
-// }
+ getContextValue(InputAction.class).openEditor("PopulationGrowthReverse","new",fr.ifremer.isisfish.equation.PopulationGrowthReverse.class, editorReverse.getText(), editorReverse);
}
- protected void commentChanged(){
- pop.setComment(fieldPopulationBasicsComment.getText());
- }
protected void setTableAgeLengthModel(){
- java.util.List<PopulationGroup> popGroup = pop.getPopulationGroup();
+ java.util.List<PopulationGroup> popGroup = getBean().getPopulationGroup();
if (popGroup != null){
DefaultTableModel model = new DefaultTableModel(2, popGroup.size() + 1);
model.setValueAt("Age", 0, 0);
@@ -271,208 +157,169 @@
tableAgeLength.setModel(model);
}
}
- protected void create(){
- Species species = getContextValue(InputAction.class).getSpecies();
- TopiaEntity topia = getContextValue(InputAction.class).createPopulation();
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$species/"+ species.getTopiaId() +"/$populations/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$species/" + species.getTopiaId() + "/$populations");
- valueChanged(false);
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationBasics.name" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationBasicsName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationBasics.geographicID" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationBasicsGeographicID" onKeyTyped='valueChanged(true)' onFocusLost='geographicChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldPopulationBasicsNbClasses" editable="false" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" onActionPerformed='createClasses()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationBasics.maturityGroup" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationBasicsMatureClass" onActionPerformed='matureClassChanged()' enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" onActionPerformed='plusGroupChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='3' fill='both' weightx='1.0'>
- <JTable id='tableAgeLength' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationBasics.growth" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationBasicsGrowth" onActionPerformed='basicsGrowthChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveGrowthModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openGrowthEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.4'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationBasics.growthReverse" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationBasicsGrowthReverse" onActionPerformed='growthReverseChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveGrowthReverseModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openGrowthReverseEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.4'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editorReverse' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.population.comments" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.2'>
- <JScrollPane>
- <JTextArea id="fieldPopulationBasicsComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
-
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationBasics.name" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldPopulationBasicsName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldPopulationBasicsName.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationBasics.geographicID" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldPopulationBasicsGeographicID" text='getBean().getGeographicId()' onKeyTyped='getBean().setGeographicId(fieldPopulationBasicsGeographicID.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationBasics.numberGroup" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JTextField id="fieldPopulationBasicsNbClasses" text='getBean().sizePopulationGroup()' editable="false" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id="buttonPopulationBasicsCreateClasses" text="isisfish.populationBasics.recreateClasses" onActionPerformed='createClasses()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationBasics.maturityGroup" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationBasicsMatureClass" onActionPerformed='matureClassChanged()' enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JCheckBox id="fieldPopulationBasicsPlusGroup" text="isisfish.populationBasics.plusGroup" selected='{getBean().getPlusGroup()}' onActionPerformed='getBean().setPlusGroup(fieldPopulationBasicsPlusGroup.isSelected())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3' fill='both' weightx='1.0'>
+ <JTable id='tableAgeLength' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationBasics.growth" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldPopulationBasicsGrowth" onActionPerformed='basicsGrowthChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.saveModel" onActionPerformed='saveGrowthModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.openEditor" onActionPerformed='openGrowthEditor()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.4'>
+ <JScrollPane>
+ <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationBasics.growthReverse" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldPopulationBasicsGrowthReverse" onActionPerformed='growthReverseChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.saveModel" onActionPerformed='saveGrowthReverseModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.openEditor" onActionPerformed='openGrowthReverseEditor()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.4'>
+ <JScrollPane>
+ <org.codelutin.widget.editor.Editor id='editorReverse' askIfNotSaved="false" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.population.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.2'>
+ <JScrollPane>
+ <JTextArea id="fieldPopulationBasicsComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldPopulationBasicsComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,107 +31,77 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Population;
- import org.codelutin.math.matrix.gui.MatrixPanelEvent;
- import org.codelutin.math.matrix.gui.MatrixPanelListener;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import org.codelutin.math.matrix.gui.MatrixPanelEvent;
+import org.codelutin.math.matrix.gui.MatrixPanelListener;
- protected Population pop = null;
- public PopulationCapturabilityUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- fieldPopulationCapturabilityComment.setText(pop.getCapturabilityComment());
- if (pop.getCapturability() != null){
- fieldPopulationCapturability.setMatrix(pop.getCapturability().copy());
- }
- fieldPopulationCapturability.addMatrixListener(new MatrixPanelListener() {
-
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- pop.setCapturability(fieldPopulationCapturability.getMatrix());
- valueChanged(true);
- }
- });
- valueChanged(false);
- }
- else{
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
fieldPopulationCapturabilityComment.setText("");
fieldPopulationCapturability.setMatrix(null);
- valueChanged(false);
}
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
}
- protected void commentChanged(){
- pop.setCapturabilityComment(fieldPopulationCapturabilityComment.getText());
- valueChanged(true);
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+});
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ fieldPopulationCapturability.addMatrixListener(new MatrixPanelListener() {
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ getBean().setCapturability(fieldPopulationCapturability.getMatrix());
+ }
+ });
+}
]]>
</script>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'>
- <JLabel text="isisfish.populationCapturability.selectCoefficient" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'>
- <JLabel text="isisfish.populationCapturability.comments" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JTextArea id="fieldPopulationCapturabilityComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
-</Table>
-
+ <Table id='body'>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'>
+ <JLabel text="isisfish.populationCapturability.selectCoefficient" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0'>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationCapturability' matrix='{getBean().getCapturability().copy()}' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0' anchor='east'>
+ <JLabel text="isisfish.populationCapturability.comments" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JTextArea id="fieldPopulationCapturabilityComment" text='getBean().getCapturabilityComment()' onKeyTyped='getBean().setCapturabilityComment(fieldPopulationCapturabilityComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -30,102 +30,57 @@
* by : $Author: sletellier $
*/
-->
-<Table implements='InputContent'>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <Boolean id='changed' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
+
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
- protected Population pop = null;
- init();
- public PopulationEquationUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- naturalDeathRate.init(_("isisfish.populationEquation.naturalDeathRate"), (Formule)pop.getNaturalDeathRate(), "NaturalDeathRate", fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class);
- meanWeight.init(_("isisfish.populationEquation.meanWeight"), (Formule)pop.getMeanWeight(), "MeanWeight", fr.ifremer.isisfish.equation.PopulationMeanWeight.class);
- price.init(_("isisfish.populationEquation.price"), (Formule)pop.getPrice(), "Price", fr.ifremer.isisfish.equation.PopulationPrice.class);
- naturalDeathRate.refresh();
- meanWeight.refresh();
- price.refresh();
- }
- }
-
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- naturalDeathRate.setActif((Boolean)evt.getNewValue());
- meanWeight.setActif((Boolean)evt.getNewValue());
- price.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- naturalDeathRate.setChanged((Boolean)evt.getNewValue());
- meanWeight.setChanged((Boolean)evt.getNewValue());
- price.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ naturalDeathRate.init(_("isisfish.populationEquation.naturalDeathRate"), (Formule)getBean().getNaturalDeathRate(), "PopulationNaturalDeathRate", fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class);
+ meanWeight.init(_("isisfish.populationEquation.meanWeight"), (Formule)getBean().getMeanWeight(), "PopulationMeanWeight", fr.ifremer.isisfish.equation.PopulationMeanWeight.class);
+ price.init(_("isisfish.populationEquation.price"), (Formule)getBean().getPrice(), "PopulationPrice", fr.ifremer.isisfish.equation.PopulationPrice.class);
+ naturalDeathRate.refresh();
+ meanWeight.refresh();
+ price.refresh();
+}
]]>
</script>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='naturalDeathRate' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='meanWeight' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='price' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" enabled='{isChanged()}' onActionPerformed='cancel()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" enabled='{isChanged()}' onActionPerformed='save()'/>
- </cell>
- </row>
-</Table>
+ <Table id='body'>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
+ <PopulationOneEquationUI id='naturalDeathRate' constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
+ <PopulationOneEquationUI id='meanWeight' constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.3'>
+ <PopulationOneEquationUI id='price' constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,44 +31,30 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
+ <fr.ifremer.isisfish.entities.PopulationGroupImpl id='populationGroup' javaBean='null'/>
<script><![CDATA[
- import fr.ifremer.isisfish.entities.PopulationGroup;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.entities.Population;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.math.matrix.gui.MatrixPanelListener;
- import org.codelutin.math.matrix.gui.MatrixPanelEvent;
+import fr.ifremer.isisfish.entities.PopulationGroup;
+import fr.ifremer.isisfish.entities.PopulationGroupImpl;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import org.codelutin.math.matrix.gui.MatrixPanelListener;
+import org.codelutin.math.matrix.gui.MatrixPanelEvent;
- protected Population pop = null;
- protected PopulationGroup populationGroup = null;
- public PopulationGroupUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (populationGroup != null){
- setFieldPopulationGroupPopulationGroupModel();
- fieldPopulationGroupMeanWeight.setText(populationGroup.getMeanWeight() + "");
- fieldPopulationGroupPrice.setText(populationGroup.getPrice() + "");
- fieldPopulationGroupReproductionRate.setText(populationGroup.getReproductionRate() + "");
- fieldPopulationGroupAge.setText(populationGroup.getAge() + "");
- fieldPopulationGroupMinLength.setText(populationGroup.getMinLength() + "");
- fieldPopulationGroupMaxLength.setText(populationGroup.getMaxLength() + "");
- fieldPopulationGroupComment.setText(populationGroup.getComment());
- setFieldPopulationGroupNaturalDeathRateModel();
- }
- else{
- DefaultComboBoxModel model = new DefaultComboBoxModel();
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
fieldPopulationGroupMeanWeight.setText("");
fieldPopulationGroupPrice.setText("");
fieldPopulationGroupReproductionRate.setText("");
@@ -76,153 +62,103 @@
fieldPopulationGroupMinLength.setText("");
fieldPopulationGroupMaxLength.setText("");
fieldPopulationGroupComment.setText("");
- fieldPopulationGroupNaturalDeathRate.setMatrix(null);
+// fieldPopulationGroupNaturalDeathRate.setMatrix(null);
}
- }
- protected void setFieldPopulationGroupNaturalDeathRateModel(){
- fieldPopulationGroupNaturalDeathRate.setMatrix(pop.getNaturalDeathRateMatrix());
- }
- protected void setFieldPopulationGroupPopulationGroupModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<PopulationGroup> popGroups = pop.getPopulationGroup();
- model.addElement(new GenericCell(" ", null, null));
- for (PopulationGroup pg : popGroups){
- model.addElement(new GenericCell(pop.getName() + " - " + pg.getId(), pg, PopulationGroup.class));
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldPopulationGroupPopulationGroup.setModel(model);
}
- protected void populationGroupChanged(){
- if (fieldPopulationGroupPopulationGroup.getSelectedItem() != null){
- GenericCell cell = (GenericCell) fieldPopulationGroupPopulationGroup.getSelectedItem();
- if (cell.getValue() != null){
- jaxx.runtime.Util.assignment(populationGroup = (PopulationGroup)cell.getValue(), "populationGroup", fr.ifremer.isisfish.ui.input.PopulationGroupUI.this);
- valueChanged(true);
- refresh();
- }
- }
- }
- protected void reproductionRateChanged(){
- populationGroup.setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()));
- valueChanged(true);
- }
- protected void groupMinLengthChanged(){
- populationGroup.setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()));
- valueChanged(true);
- }
- protected void groupMaxLengthChanged(){
- populationGroup.setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()));
- valueChanged(true);
- }
- protected void groupCommentChanged(){
- populationGroup.setComment(fieldPopulationGroupComment.getText());
- valueChanged(true);
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+});
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationGroupPopulationGroup,getBean().getPopulationGroup(), null);
+}
]]>
</script>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JComboBox id='fieldPopulationGroupPopulationGroup' onActionPerformed='populationGroupChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupMeanWeight" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.populationGroup.price" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupPrice" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.populationGroup.naturalDeathRate" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.5'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationGroupNaturalDeathRate' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupReproductionRate" onKeyTyped='valueChanged(true)' onFocusLost='reproductionRateChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.populationGroup.age" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationGroupAge" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.populationGroup.length" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='0.5'>
- <JTextField id="fieldPopulationGroupMinLength" onKeyTyped='valueChanged(true)' onFocusLost='groupMinLengthChanged()' enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='0.5'>
- <JTextField id="fieldPopulationGroupMaxLength" onKeyTyped='valueChanged(true)' onFocusLost='groupMaxLengthChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.populationGroup.comments" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.5'>
- <JScrollPane>
- <JTextArea id="fieldPopulationGroupComment" onKeyTyped='valueChanged(true)' onFocusLost='groupCommentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='3' fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' enabled='{isChanged()}' text="isisfish.common.save" onActionPerformed='save()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' enabled='{isChanged()}' text="isisfish.common.cancel" onActionPerformed='cancel()'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JComboBox id='fieldPopulationGroupPopulationGroup' onActionPerformed='setPopulationGroup((PopulationGroupImpl)fieldPopulationGroupPopulationGroup.getSelectedItem())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.populationGroup.meanWeigth" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldPopulationGroupMeanWeight" text='getPopulationGroup().getMeanWeight()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.populationGroup.price" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldPopulationGroupPrice" text='getPopulationGroup().getPrice()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.populationGroup.naturalDeathRate" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.5'>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.populationGroup.reproductionRate" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldPopulationGroupReproductionRate" text='getPopulationGroup().getReproductionRate()' onKeyTyped='getPopulationGroup().setReproductionRate(Double.parseDouble(fieldPopulationGroupReproductionRate.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.populationGroup.age" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldPopulationGroupAge" text='getPopulationGroup().getAge()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.populationGroup.length" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='0.5'>
+ <JTextField id="fieldPopulationGroupMinLength" text='getPopulationGroup().getMinLength()' onKeyTyped='getPopulationGroup().setMinLength(Double.parseDouble(fieldPopulationGroupMinLength.getText()))' enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='0.5'>
+ <JTextField id="fieldPopulationGroupMaxLength" text='getPopulationGroup().getMaxLength()' onKeyTyped='getPopulationGroup().setMaxLength(Double.parseDouble(fieldPopulationGroupMaxLength.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.populationGroup.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.5'>
+ <JScrollPane>
+ <JTextArea id="fieldPopulationGroupComment" text='getPopulationGroup().getComment()' onKeyTyped='getPopulationGroup().setComment(fieldPopulationGroupComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3' fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,84 +31,75 @@
*/
-->
-<!--
- name="isisfish.populationMigrationEmigration.title"
--->
-<Table implements='InputContent'>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <Boolean id='changed' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
+ <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/>
+
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import org.codelutin.math.matrix.MatrixND;
- import org.codelutin.math.matrix.gui.MatrixPanelEvent;
- import org.codelutin.math.matrix.gui.MatrixPanelListener;
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.PopulationGroup;
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import fr.ifremer.isisfish.entities.Zone;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl;
+import org.codelutin.math.matrix.MatrixND;
+import org.codelutin.math.matrix.gui.MatrixPanelEvent;
+import org.codelutin.math.matrix.gui.MatrixPanelListener;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationGroup;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.Zone;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
- protected Population pop;
- protected PopulationSeasonInfo popInfo = null;
-
- public PopulationMigrationEmigrationUI (InputAction action){
-
- setContextValue(action);
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
+ populationMigrationEmigrationTable.setMatrix(null);
+ }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
}
+});
public void init(PopulationSeasonInfo pi){
- popInfo = pi;
+ setPopInfo((PopulationSeasonInfoImpl)pi);
}
public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- setFieldPopulationMigrationMigrationGroupChooserModel();
- setFieldPopulationMigrationMigrationDepartureZoneChooserModel();
- populationMigrationEmigrationTable.setMatrix(popInfo.getEmigrationMatrix());
- populationMigrationEmigrationTable.addMatrixListener(new MatrixPanelListener() {
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix());
- }
- });
- }
- else{
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldPopulationMigrationEmigrationGroupChooser.setModel(model);
- fieldPopulationMigrationEmigrationDepartureZoneChooser.setModel(model);
- populationMigrationEmigrationTable.setMatrix(null);
- }
+ setFieldPopulationMigrationMigrationGroupChooserModel();
+ setFieldPopulationMigrationMigrationDepartureZoneChooserModel();
+ populationMigrationEmigrationTable.addMatrixListener(new MatrixPanelListener() {
+
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ popInfo.setMigrationMatrix(populationMigrationEmigrationTable.getMatrix());
+ }
+ });
}
protected void setFieldPopulationMigrationMigrationGroupChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<PopulationGroup> values = pop.getPopulationGroup();
- for (PopulationGroup pg : values){
- model.addElement(pg);
- }
- fieldPopulationMigrationEmigrationGroupChooser.setModel(model);
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationMigrationEmigrationGroupChooser,getBean().getPopulationGroup(), null);
}
protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<Zone> values = pop.getPopulationZone();
- for (Zone z : values){
- model.addElement(z);
- }
- fieldPopulationMigrationEmigrationDepartureZoneChooser.setModel(model);
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationMigrationEmigrationDepartureZoneChooser,getBean().getPopulationZone(), null);
}
protected void add(){
getContextValue(InputAction.class).addEmigration(
- popInfo,
+ getPopInfo(),
(PopulationGroup) fieldPopulationMigrationEmigrationGroupChooser.getSelectedItem(),
(Zone) fieldPopulationMigrationEmigrationDepartureZoneChooser.getSelectedItem(),
Double.parseDouble(fieldPopulationMigrationEmigrationCoefficient.getText()));
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
refresh();
}
protected void remove(){
@@ -121,7 +112,6 @@
MatrixND mat = popInfo.getEmigrationMatrix().copy();
mat.setValue(group, departure, 0);
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
popInfo.setEmigrationMatrix(mat);
}catch(Exception eee){
@@ -132,46 +122,46 @@
}
]]>
</script>
- <row>
- <cell>
- <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationMigrationEmigrationGroupChooser" enabled='{isActif()}'/>
- </cell>
- <cell>
- <JLabel text="isisfish.populationMigrationEmigration.coefficient" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldPopulationMigrationEmigrationCoefficient" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.populationMigrationEmigration.departureZone" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationMigrationEmigrationDepartureZoneChooser" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='0.5'>
- <JPanel/>
- </cell>
- </row>
- <row columns='4'>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row columns='4'>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='populationMigrationEmigrationTable' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='4' fill='horizontal' weightx='1.0'>
- <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
-</Table>
-
-
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell>
+ <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationMigrationEmigrationGroupChooser" enabled='{isActif()}'/>
+ </cell>
+ <cell>
+ <JLabel text="isisfish.populationMigrationEmigration.coefficient" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JTextField id="fieldPopulationMigrationEmigrationCoefficient" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.populationMigrationEmigration.departureZone" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationMigrationEmigrationDepartureZoneChooser" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='0.5'>
+ <JPanel/>
+ </cell>
+ </row>
+ <row columns='4'>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id="add" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row columns='4'>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='populationMigrationEmigrationTable' matrix='{getPopInfo().getEmigrationMatrix()}' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='4' fill='horizontal' weightx='1.0'>
+ <JButton id="remove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -30,78 +30,56 @@
* by : $Author: sletellier $
*/
-->
-<Table name="isisfish.populationMigrationEquation.title" implements='InputContent'>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <Boolean id='changed' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
+ <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='popInfo' javaBean='null'/>
+
<script><![CDATA[
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import fr.ifremer.isisfish.entities.Formule;
- protected Population pop = null;
- protected PopulationSeasonInfo popInfo = null;
- init();
- public PopulationMigrationEquationUI (InputAction action){
-
- setContextValue(action);
- }
- public void init(PopulationSeasonInfo pi){
- this.popInfo = pi;
- }
- public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- migrationEquation.init(_("isisfish.common.migration"), (Formule)popInfo.getMigrationEquation(), "Migration", fr.ifremer.isisfish.equation.MigrationEquation.class);
- emigrationEquation.init(_("isisfish.common.emigration"), (Formule)popInfo.getEmigrationEquation(), "Emigration", fr.ifremer.isisfish.equation.EmigrationEquation.class);
- immigrationEquation.init(_("isisfish.common.immigration"), (Formule)popInfo.getImmigrationEquation(), "Immigration", fr.ifremer.isisfish.equation.ImmigrationEquation.class);
- }
- else{
- migrationEquation.init(_("isisfish.common.migration"), null, "Migration", fr.ifremer.isisfish.equation.MigrationEquation.class);
- emigrationEquation.init(_("isisfish.common.emigration"), null, "Emigration", fr.ifremer.isisfish.equation.EmigrationEquation.class);
- immigrationEquation.init(_("isisfish.common.immigration"), null, "Immigration", fr.ifremer.isisfish.equation.ImmigrationEquation.class);
- }
- migrationEquation.refresh();
- emigrationEquation.refresh();
- immigrationEquation.refresh();
- }
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- migrationEquation.setActif((Boolean)evt.getNewValue());
- emigrationEquation.setActif((Boolean)evt.getNewValue());
- immigrationEquation.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- migrationEquation.setChanged((Boolean)evt.getNewValue());
- emigrationEquation.setChanged((Boolean)evt.getNewValue());
- immigrationEquation.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+
+public void init(PopulationSeasonInfo pi){
+ setPopInfo((PopulationSeasonInfoImpl)pi);
+}
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ migrationEquation.init(_("isisfish.common.migration"), (Formule)getPopInfo().getMigrationEquation(), "Migration", fr.ifremer.isisfish.equation.MigrationEquation.class);
+ emigrationEquation.init(_("isisfish.common.emigration"), (Formule)getPopInfo().getEmigrationEquation(), "Emigration", fr.ifremer.isisfish.equation.EmigrationEquation.class);
+ immigrationEquation.init(_("isisfish.common.immigration"), (Formule)getPopInfo().getImmigrationEquation(), "Immigration", fr.ifremer.isisfish.equation.ImmigrationEquation.class);
+ migrationEquation.refresh();
+ emigrationEquation.refresh();
+ immigrationEquation.refresh();
+}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='migrationEquation' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='emigrationEquation' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0' weighty='0.3'>
- <PopulationOneEquationUI id='immigrationEquation' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
-</Table>
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='0.3'>
+ <PopulationOneEquationUI id='migrationEquation' constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='0.3'>
+ <PopulationOneEquationUI id='emigrationEquation' constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='0.3'>
+ <PopulationOneEquationUI id='immigrationEquation' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -33,82 +33,74 @@
<!-- Fixme : ContextDataSource
name="isisfish.populationMigrationImmigration.title"
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.PopulationGroup;
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import fr.ifremer.isisfish.entities.Zone;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import org.codelutin.math.matrix.MatrixND;
- import org.codelutin.math.matrix.gui.MatrixPanelEvent;
- import org.codelutin.math.matrix.gui.MatrixPanelListener;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import fr.ifremer.isisfish.entities.PopulationGroup;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.Zone;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.math.matrix.MatrixND;
+import org.codelutin.math.matrix.gui.MatrixPanelEvent;
+import org.codelutin.math.matrix.gui.MatrixPanelListener;
- protected PopulationSeasonInfo popInfo = null;
- protected Population pop = null;
- public PopulationMigrationImmigrationUI (InputAction action){
-
- setContextValue(action);
- }
+protected PopulationSeasonInfo popInfo = null;
- public void init(PopulationSeasonInfo pi){
- this.popInfo = pi;
- }
- public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- setFieldPopulationMigrationMigrationGroupChooserModel();
- setFieldPopulationMigrationMigrationArrivalZoneChooserModel();
- populationMigrationImmigrationTable.setMatrix(popInfo.getMigrationMatrix());
- populationMigrationImmigrationTable.addMatrixListener(new MatrixPanelListener() {
-
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- popInfo.setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix());
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
- }
- });
- }
- else{
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldPopulationMigrationImmigrationArrivalZoneChooser.setModel(model);
- fieldPopulationMigrationImmigrationArrivalZoneChooser.setModel(model);
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
populationMigrationImmigrationTable.setMatrix(null);
}
- }
- protected void setFieldPopulationMigrationMigrationGroupChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<PopulationGroup> values = pop.getPopulationGroup();
- for (PopulationGroup pg : values){
- model.addElement(pg);
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldPopulationMigrationImmigrationArrivalZoneChooser.setModel(model);
}
- protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<Zone> values = pop.getPopulationZone();
- for (Zone z : values){
- model.addElement(z);
+});
+
+public void init(PopulationSeasonInfo pi){
+ this.popInfo = pi;
+}
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ setFieldPopulationMigrationMigrationGroupChooserModel();
+ setFieldPopulationMigrationMigrationArrivalZoneChooserModel();
+ populationMigrationImmigrationTable.setMatrix(popInfo.getMigrationMatrix());
+ populationMigrationImmigrationTable.addMatrixListener(new MatrixPanelListener() {
+
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ popInfo.setImmigrationMatrix(populationMigrationImmigrationTable.getMatrix());
}
- fieldPopulationMigrationImmigrationArrivalZoneChooser.setModel(model);
- }
- protected void add(){
- getContextValue(InputAction.class).addImmigration(popInfo,
- (PopulationGroup) fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem(),
- (Zone) fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem(),
- Double.parseDouble(fieldPopulationMigrationImmigrationCoefficient.getText()));
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
- refresh();
- }
- protected void remove(){
+ });
+}
+protected void setFieldPopulationMigrationMigrationGroupChooserModel(){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationMigrationImmigrationArrivalZoneChooser,getBean().getPopulationGroup(), null);
+}
+protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationMigrationImmigrationArrivalZoneChooser,getBean().getPopulationZone(), null);
+}
+protected void add(){
+ getContextValue(InputAction.class).addImmigration(popInfo,
+ (PopulationGroup) fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem(),
+ (Zone) fieldPopulationMigrationImmigrationArrivalZoneChooser.getSelectedItem(),
+ Double.parseDouble(fieldPopulationMigrationImmigrationCoefficient.getText()));
+ refresh();
+}
+protected void remove(){
int row = populationMigrationImmigrationTable.getTable().getSelectedRow();
Object group = populationMigrationImmigrationTable.getTable().getValueAt(row, 0);
Object departure = populationMigrationImmigrationTable.getTable().getValueAt(row, 1);
@@ -117,49 +109,50 @@
MatrixND mat = popInfo.getImmigrationMatrix().copy();
mat.setValue(group, departure, arrival, 0);
popInfo.setImmigrationMatrix(mat);
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
refresh();
- }
+}
]]>
</script>
- <row>
- <cell>
- <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationMigrationImmigrationGroupChooser" enabled='{isActif()}'/>
- </cell>
- <cell>
- <JLabel text="isisfish.populationMigrationImmigration.coefficient" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldPopulationMigrationImmigrationCoefficient" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.populationMigrationImmigration.arrivalZone" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationMigrationImmigrationArrivalZoneChooser" enabled='{isActif()}'/>
- </cell>
- <cell columns='2' fill='horizontal' weightx='0.5'>
- <JPanel/>
- </cell>
- </row>
- <row columns='4'>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id="buttonPopulationMigrationImmigrationAdd" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row columns='4'>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='populationMigrationImmigrationTable' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='4' fill='horizontal' weightx='1.0'>
- <JButton id="buttonPopulationImmigrationMigrationRemove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell>
+ <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationMigrationImmigrationGroupChooser" enabled='{isActif()}'/>
+ </cell>
+ <cell>
+ <JLabel text="isisfish.populationMigrationImmigration.coefficient" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JTextField id="fieldPopulationMigrationImmigrationCoefficient" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.populationMigrationImmigration.arrivalZone" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationMigrationImmigrationArrivalZoneChooser" enabled='{isActif()}'/>
+ </cell>
+ <cell columns='2' fill='horizontal' weightx='0.5'>
+ <JPanel/>
+ </cell>
+ </row>
+ <row columns='4'>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id="buttonPopulationMigrationImmigrationAdd" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row columns='4'>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='populationMigrationImmigrationTable' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='4' fill='horizontal' weightx='1.0'>
+ <JButton id="buttonPopulationImmigrationMigrationRemove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,150 +31,137 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.PopulationGroup;
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import fr.ifremer.isisfish.entities.Zone;
- import org.codelutin.math.matrix.MatrixND;
- import org.codelutin.math.matrix.gui.MatrixPanelEvent;
- import org.codelutin.math.matrix.gui.MatrixPanelListener;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import fr.ifremer.isisfish.entities.PopulationGroup;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.Zone;
+import org.codelutin.math.matrix.MatrixND;
+import org.codelutin.math.matrix.gui.MatrixPanelEvent;
+import org.codelutin.math.matrix.gui.MatrixPanelListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
- protected PopulationSeasonInfo popInfo = null;
- protected Population pop = null;
- protected PopulationSeasonInfo pi;
- public PopulationMigrationMigrationUI (InputAction action){
-
- setContextValue(action);
- }
- public void init(PopulationSeasonInfo pi){
- this.pi = pi;
- }
- public void refresh(){
- popInfo = pi;
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- setFieldPopulationMigrationMigrationGroupChooserModel();
- setFieldPopulationMigrationMigrationDepartureZoneChooserModel();
- setFieldPopulationMigrationMigrationArrivalZoneChooserModel();
- populationMigrationMigrationTable.setMatrix(popInfo.getMigrationMatrix());
- populationMigrationMigrationTable.addMatrixListener(new MatrixPanelListener() {
+protected PopulationSeasonInfo popInfo = null;
+protected PopulationSeasonInfo pi;
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- popInfo.setMigrationMatrix(populationMigrationMigrationTable.getMatrix());
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
- }
- });
- }
- else{
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldPopulationMigrationMigrationGroupChooser.setModel(model);
- fieldPopulationMigrationMigrationDepartureZoneChooser.setModel(model);
- fieldPopulationMigrationMigrationArrivalZoneChooser.setModel(model);
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
populationMigrationMigrationTable.setMatrix(null);
}
- }
- protected void setFieldPopulationMigrationMigrationGroupChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<PopulationGroup> values = pop.getPopulationGroup();
- for (PopulationGroup pg : values){
- model.addElement(pg);
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldPopulationMigrationMigrationGroupChooser.setModel(model);
}
- protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<Zone> values = pop.getPopulationZone();
- for (Zone z : values){
- model.addElement(z);
+});
+public void init(PopulationSeasonInfo pi){
+ this.pi = pi;
+}
+public void refresh(){
+ popInfo = pi;
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+
+ setFieldPopulationMigrationMigrationGroupChooserModel();
+ setFieldPopulationMigrationMigrationDepartureZoneChooserModel();
+ setFieldPopulationMigrationMigrationArrivalZoneChooserModel();
+ populationMigrationMigrationTable.setMatrix(popInfo.getMigrationMatrix());
+ populationMigrationMigrationTable.addMatrixListener(new MatrixPanelListener() {
+
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ popInfo.setMigrationMatrix(populationMigrationMigrationTable.getMatrix());
}
- fieldPopulationMigrationMigrationDepartureZoneChooser.setModel(model);
- }
- protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<Zone> values = pop.getPopulationZone();
- for (Zone z : values){
- model.addElement(z);
- }
- fieldPopulationMigrationMigrationArrivalZoneChooser.setModel(model);
- }
- protected void add(){
- getContextValue(InputAction.class).addMigration(popInfo,
- (PopulationGroup) fieldPopulationMigrationMigrationGroupChooser.getSelectedItem(),
- (Zone) fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem(),
- (Zone) fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem(),
- Double.parseDouble(fieldPopulationMigrationMigrationCoefficient.getText()));
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
- refresh();
- }
- protected void remove(){
- int row = populationMigrationMigrationTable.getTable().getSelectedRow();
- Object group = populationMigrationMigrationTable.getTable().getValueAt(row, 0);
- Object departure = populationMigrationMigrationTable.getTable().getValueAt(row, 1);
- Object arrival = populationMigrationMigrationTable.getTable().getValueAt(row, 2);
+ });
+}
+protected void setFieldPopulationMigrationMigrationGroupChooserModel(){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationMigrationMigrationGroupChooser,getBean().getPopulationGroup(), null);
+}
+protected void setFieldPopulationMigrationMigrationDepartureZoneChooserModel(){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationMigrationMigrationGroupChooser,getBean().getPopulationZone(), null);
+}
+protected void setFieldPopulationMigrationMigrationArrivalZoneChooserModel(){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationMigrationMigrationGroupChooser,getBean().getPopulationZone(), null);
+}
+protected void add(){
+ getAction().addMigration(popInfo,
+ (PopulationGroup) fieldPopulationMigrationMigrationGroupChooser.getSelectedItem(),
+ (Zone) fieldPopulationMigrationMigrationDepartureZoneChooser.getSelectedItem(),
+ (Zone) fieldPopulationMigrationMigrationArrivalZoneChooser.getSelectedItem(),
+ Double.parseDouble(fieldPopulationMigrationMigrationCoefficient.getText()));
+ refresh();
+}
+protected void remove(){
+ int row = populationMigrationMigrationTable.getTable().getSelectedRow();
+ Object group = populationMigrationMigrationTable.getTable().getValueAt(row, 0);
+ Object departure = populationMigrationMigrationTable.getTable().getValueAt(row, 1);
+ Object arrival = populationMigrationMigrationTable.getTable().getValueAt(row, 2);
- MatrixND mat = popInfo.getMigrationMatrix().copy();
- mat.setValue(group, departure, arrival, 0);
- popInfo.setMigrationMatrix(mat);
- getParentContainer(PopulationMigrationUI.class).valueChanged(true);
- refresh();
- }
+ MatrixND mat = popInfo.getMigrationMatrix().copy();
+ mat.setValue(group, departure, arrival, 0);
+ popInfo.setMigrationMatrix(mat);
+ refresh();
+}
]]>
</script>
- <row>
- <cell>
- <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationMigrationMigrationGroupChooser" enabled='{isActif()}'/>
- </cell>
- <cell>
- <JLabel text="isisfish.populationMigrationMigration.coefficient" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldPopulationMigrationMigrationCoefficient" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.populationMigrationMigration.departureZone" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationMigrationMigrationDepartureZoneChooser" enabled='{isActif()}'/>
- </cell>
- <cell>
- <JLabel text="isisfish.populationMigrationMigration.arrivalZone" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JComboBox id="fieldPopulationMigrationMigrationArrivalZoneChooser" enabled='{isActif()}'/>
- </cell>
- </row>
- <row columns='4'>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id="buttonPopulationMigrationMigrationAdd" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row columns='4'>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='populationMigrationMigrationTable' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='4' fill='horizontal' weightx='1.0'>
- <JButton id="buttonPopulationMigrationMigrationRemove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
-</Table>
-
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell>
+ <JLabel text="isisfish.common.populationGroup" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationMigrationMigrationGroupChooser" enabled='{isActif()}'/>
+ </cell>
+ <cell>
+ <JLabel text="isisfish.populationMigrationMigration.coefficient" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JTextField id="fieldPopulationMigrationMigrationCoefficient" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.populationMigrationMigration.departureZone" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationMigrationMigrationDepartureZoneChooser" enabled='{isActif()}'/>
+ </cell>
+ <cell>
+ <JLabel text="isisfish.populationMigrationMigration.arrivalZone" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JComboBox id="fieldPopulationMigrationMigrationArrivalZoneChooser" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row columns='4'>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id="buttonPopulationMigrationMigrationAdd" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row columns='4'>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='populationMigrationMigrationTable' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='4' fill='horizontal' weightx='1.0'>
+ <JButton id="buttonPopulationMigrationMigrationRemove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ </Table>
+ </fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,183 +31,131 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.entities.Population;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
- init();
- protected Population pop;
-// protected PopulationSeasonInfo populationSeasonInfoSelected = null;
- public PopulationMigrationUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- setFieldPopulationMigrationSeasonChooserModel();
- PopulationSeasonInfo selected = getPopulationSeasonInfo();
- if (selected != null){
- fieldUseEquationMigration.setSelected(selected.getUseEquationMigration());
- useEquationChanged();
- populationMigrationEquationUI.init(selected);
- populationMigrationMigrationUI.init(selected);
- populationMigrationImmigrationUI.init(selected);
- populationMigrationEmigrationUI.init(selected);
- populationMigrationEquationUI.refresh();
- populationMigrationMigrationUI.refresh();
- populationMigrationImmigrationUI.refresh();
- populationMigrationEmigrationUI.refresh();
- }
- fieldPopulationMigrationComment.setText(pop.getMigrationComment());
- }
- else{
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldPopulationMigrationSeasonChooser.setModel(model);
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldPopulationMigrationComment.setText("");
}
- }
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- populationMigrationEquationUI.setActif((Boolean)evt.getNewValue());
- populationMigrationMigrationUI.setActif((Boolean)evt.getNewValue());
- populationMigrationImmigrationUI.setActif((Boolean)evt.getNewValue());
- populationMigrationEmigrationUI.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- populationMigrationEquationUI.setChanged((Boolean)evt.getNewValue());
- populationMigrationMigrationUI.setChanged((Boolean)evt.getNewValue());
- populationMigrationImmigrationUI.setChanged((Boolean)evt.getNewValue());
- populationMigrationEmigrationUI.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
- protected void setFieldPopulationMigrationSeasonChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- for (PopulationSeasonInfo psi : pop.getPopulationSeasonInfo()){
- model.addElement(new GenericCell(psi.getFirstMonth() + " - " + psi.getLastMonth(), psi, PopulationSeasonInfo.class));
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldPopulationMigrationSeasonChooser.setModel(model);
}
- protected PopulationSeasonInfo getPopulationSeasonInfo(){
- PopulationSeasonInfo result = null;
- Object selected = fieldPopulationMigrationSeasonChooser.getSelectedItem();
- if (selected != null){
- GenericCell cell = (GenericCell)selected;
- if (cell.getValue() != null){
- result = (PopulationSeasonInfo)cell.getValue();
- }
- }
- return result;
+});
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ setFieldPopulationMigrationSeasonChooserModel();
+ PopulationSeasonInfo selected = getPopulationSeasonInfo();
+ if (selected != null){
+ fieldUseEquationMigration.setSelected(selected.getUseEquationMigration());
+ useEquationChanged();
+ populationMigrationEquationUI.init(selected);
+ populationMigrationMigrationUI.init(selected);
+ populationMigrationImmigrationUI.init(selected);
+ populationMigrationEmigrationUI.init(selected);
+ populationMigrationEquationUI.refresh();
+ populationMigrationMigrationUI.refresh();
+ populationMigrationImmigrationUI.refresh();
+ populationMigrationEmigrationUI.refresh();
}
- protected void seasonChooserChanged(){
-// populationSeasonInfoSelected = getPopulationSeasonInfo();
- valueChanged(true);
- refresh();
+}
+protected void setFieldPopulationMigrationSeasonChooserModel(){
+ DefaultComboBoxModel model = new DefaultComboBoxModel();
+ for (PopulationSeasonInfo psi : getBean().getPopulationSeasonInfo()){
+ model.addElement(new GenericCell(psi.getFirstMonth() + " - " + psi.getLastMonth(), psi, PopulationSeasonInfo.class));
}
- protected void useEquationChanged(){
- if (fieldUseEquationMigration.isSelected()){
- ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseEquation");
+ fieldPopulationMigrationSeasonChooser.setModel(model);
+}
+protected PopulationSeasonInfo getPopulationSeasonInfo(){
+ PopulationSeasonInfo result = null;
+ Object selected = fieldPopulationMigrationSeasonChooser.getSelectedItem();
+ if (selected != null){
+ GenericCell cell = (GenericCell)selected;
+ if (cell.getValue() != null){
+ result = (PopulationSeasonInfo)cell.getValue();
}
- else{
- ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseMatrix");
- }
- valueChanged(true);
}
- protected void commentChanged(){
- pop.setMigrationComment(fieldPopulationMigrationComment.getText());
- valueChanged(true);
+ return result;
+}
+protected void useEquationChanged(){
+ if (fieldUseEquationMigration.isSelected()){
+ ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseEquation");
}
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
+ else{
+ ((CardLayout) hidablePanel.getLayout()).show(hidablePanel, "fieldUseMatrix");
}
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- public void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+}
]]>
</script>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationMigration.selectSeason" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationMigrationSeasonChooser" onActionPerformed='seasonChooserChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' anchor='west'>
- <JCheckBox id="fieldUseEquationMigration" selected='true' text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='0.7'>
- <JPanel id="hidablePanel" layout='{new CardLayout()}'>
- <PopulationMigrationEquationUI id='populationMigrationEquationUI' constraints='"fieldUseEquation"' constructorParams='getContextValue(InputAction.class)'/>
- <JTabbedPane id="fieldUseMatrix" constraints='"fieldUseMatrix"'>
- <tab title='{_("isisfish.metier.title")}'><PopulationMigrationMigrationUI id="populationMigrationMigrationUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- <tab title='{_("isisfish.metierSeasonInfoZone.title")}'><PopulationMigrationImmigrationUI id="populationMigrationImmigrationUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- <tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'><PopulationMigrationEmigrationUI id="populationMigrationEmigrationUI" constructorParams='getContextValue(InputAction.class)'/></tab>
- </JTabbedPane>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationMigration.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.3'>
- <JScrollPane>
- <JTextArea id="fieldPopulationMigrationComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationMigration.selectSeason" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldPopulationMigrationSeasonChooser" onActionPerformed='refresh()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' anchor='west'>
+ <JCheckBox id="fieldUseEquationMigration" selected='true' text="isisfish.populationMigration.useEquation" onActionPerformed='useEquationChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='0.7'>
+ <JPanel id="hidablePanel" layout='{new CardLayout()}'>
+ <PopulationMigrationEquationUI id='populationMigrationEquationUI' constraints='"fieldUseEquation"' constructorParams='this'/>
+ <JTabbedPane id="fieldUseMatrix" constraints='"fieldUseMatrix"'>
+ <tab title='{_("isisfish.metier.title")}'><PopulationMigrationMigrationUI id="populationMigrationMigrationUI" constructorParams='this'/></tab>
+ <tab title='{_("isisfish.metierSeasonInfoZone.title")}'><PopulationMigrationImmigrationUI id="populationMigrationImmigrationUI" constructorParams='this'/></tab>
+ <tab title='{_("isisfish.metierSeasonInfoSpecies.title")}'><PopulationMigrationEmigrationUI id="populationMigrationEmigrationUI" constructorParams='this'/></tab>
+ </JTabbedPane>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationMigration.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.3'>
+ <JScrollPane>
+ <JTextArea id="fieldPopulationMigrationComment" text='getBean().getMigrationComment()' onKeyTyped='getBean().setMigrationComment(fieldPopulationMigrationComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationOneEquationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,146 +31,166 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import fr.ifremer.isisfish.entities.Equation;
+import java.util.logging.Level;
+import java.util.logging.Logger;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.Equation;
- import java.util.logging.Level;
- import java.util.logging.Logger;
-
- protected Population pop = null;
- protected Class clazz = null;
- protected String nameEquation = null;
- protected String lblText;
- protected Formule f;
- protected String name;
- protected Class c;
+protected Class clazz = null;
+protected String nameEquation = null;
+protected String lblText;
+protected Formule f;
+protected String name;
+protected Class c;
- public PopulationOneEquationUI (InputAction action){
- setContextValue(action);
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+// fieldPopulationMonthGapBetweenReproRecrutement.setText("");
+// fieldPopulationRecruitmentComment.setText("");
+ }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
}
- public void init(String lblText, Formule f, String name, Class c){
- this.lblText = lblText;
- this.f = f;
- this.name = name;
- this.c = c;
+});
+
+public void init(String lblText, Formule f, String name, Class c){
+ this.lblText = lblText;
+ this.f = f;
+ this.name = name;
+ this.c = c;
+}
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ lbl.setText(lblText);
+ clazz = c;
+ try {
+ editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
+ } catch (IOException ex) {
+ Logger.getLogger(PopulationOneEquationUI.class.getName()).log(Level.SEVERE, null, ex);
}
- public void refresh(){
- lbl.setText(lblText);
- clazz = c;
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(PopulationOneEquationUI.class.getName()).log(Level.SEVERE, null, ex);
+ setComboModel(f, name);
+}
+protected void setComboModel(Formule f, String name){
+ DefaultComboBoxModel model = new DefaultComboBoxModel();
+ GenericCell cellSelected = null;
+ for (Formule formule : getAction().getFormules(getBean().getTopiaContext(),name)){
+ GenericCell cell = new GenericCell(formule.getName(), formule, Formule.class);
+ model.addElement(cell);
+ if (formule.equals(f)){
+ cellSelected = cell;
}
- setComboModel(f, name);
}
- protected void setComboModel(Formule f, String name){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- GenericCell cellSelected = null;
- for (Formule formule : getContextValue(InputAction.class).getFormules(name)){
- GenericCell cell = new GenericCell(formule.getName(), formule, Formule.class);
- model.addElement(cell);
- if (formule.equals(f)){
- cellSelected = cell;
- }
- }
- combo.setModel(model);
- if (cellSelected != null){
- combo.setSelectedItem(cellSelected);
- comboChanged();
- }
- }
- protected void comboChanged(){
+ combo.setModel(model);
+ if (cellSelected != null){
+ combo.setSelectedItem(cellSelected);
Equation selected = getEquation();
if (selected != null){
editor.setText(selected.getContent());
}
- valueChanged(true);
}
- protected Equation getEquation(){
- Equation result = null;
- Object selected = combo.getSelectedItem();
- if (selected != null){
- GenericCell cell = (GenericCell) selected;
- if (cell.getValue() != null){
- result = (Equation)cell.getValue();
- }
- }
- return result;
+}
+protected void comboChanged(){
+ Equation selected = getEquation();
+ if (selected != null){
+ editor.setText(selected.getContent());
}
- protected void valueChanged(boolean b){
- changed = b;
- if (getParentContainer(PopulationEquationUI.class) != null){
- getParentContainer(PopulationEquationUI.class).valueChanged(b);
+ valueChanged(true);
+}
+protected Equation getEquation(){
+ Equation result = null;
+ Object selected = combo.getSelectedItem();
+ if (selected != null){
+ GenericCell cell = (GenericCell) selected;
+ if (cell.getValue() != null){
+ result = (Equation)cell.getValue();
}
- else{
- getParentContainer(PopulationMigrationUI.class).valueChanged(b);
- }
}
- protected void saveModel(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
- }
- else{
- getContextValue(InputAction.class).saveAsModel(name, "Java", editor.getText());
- setComboModel(f, name);
- }
+ return result;
+}
+protected void valueChanged(boolean b){
+ changed = b;
+ if (getParentContainer(PopulationEquationUI.class) != null){
+// getParentContainer(PopulationEquationUI.class).valueChanged(b);
+ }
+ else{
+// getParentContainer(PopulationMigrationUI.class).valueChanged(b);
+ }
+}
+protected void saveModel(){
+ Equation e = getEquation();
+ if (e != null){
+ getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
+ }
+ else{
+ getContextValue(InputAction.class).saveAsModel(name, "Java", editor.getText());
+ setComboModel(f, name);
+ }
+ refresh();
// setInfoText(_("isisfish.message.saveModel.finished"));
+}
+protected void openEditor(){
+ Equation e = getEquation();
+ if (e != null){
+ getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor);
}
- protected void openEditor(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), clazz, e.getContent(), editor);
- }
- else{
- getContextValue(InputAction.class).openEditor(name,"new",c, editor.getText(), editor);
- }
+ else{
+ getContextValue(InputAction.class).openEditor(name,"new",c, editor.getText(), editor);
}
+}
]]>
</script>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel id='lbl'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="combo" onActionPerformed='comboChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" onKeyTyped='valueChanged(true)' onFocusLost='valueChanged(true)' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
-</Table>
+ <Table id='body'>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel id='lbl'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="combo" onActionPerformed='comboChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" onKeyTyped='valueChanged(true)' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -30,230 +30,155 @@
* by : $Author: sletellier $
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
-
- <Boolean id='changed' javaBean='false'/>
-
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
+
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Equation;
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import java.util.logging.Level;
- import java.util.logging.Logger;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import java.util.logging.Level;
+import java.util.logging.Logger;
- protected Population pop = null;
- public PopulationRecruitmentUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh(){
- jaxx.runtime.Util.assignment(pop = getContextValue(InputAction.class).getPopulation(), "pop", fr.ifremer.isisfish.ui.input.PopulationRecruitmentUI.this);
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(PopulationRecruitmentUI.class.getName()).log(Level.SEVERE, null, ex);
- }
- if (pop != null){
- setFieldPopulationReproductionEquationModel();
- fieldPopulationMonthGapBetweenReproRecrutement.setText(pop.getMonthGapBetweenReproRecrutement() + "");
- fieldPopulationRecruitmentComment.setText(pop.getRecruitmentComment());
- valueChanged(false);
- }
- else{
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldPopulationMonthGapBetweenReproRecrutement.setText("");
fieldPopulationRecruitmentComment.setText("");
- valueChanged(false);
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldPopulationReproductionEquation.setModel(model);
}
- }
- protected void setFieldPopulationReproductionEquationModel() {
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- Equation selected = pop.getReproductionEquation();
- GenericCell cellSelected = null;
- java.util.List<Formule> formules = getContextValue(InputAction.class).getFormules("Reproduction");
- for (Formule f : formules){
- GenericCell cell = new GenericCell(f.getName(), f, Formule.class);
- model.addElement(cell);
- if(f.equals((Formule)selected)){
- cellSelected = cell;
- }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldPopulationReproductionEquation.setModel(model);
- if (cellSelected != null){
- fieldPopulationReproductionEquation.setSelectedItem(cellSelected);
- }
}
- protected void equationChanged(){
- Equation e = getEquation();
- if (e != null){
- editor.setText(e.getContent());
- valueChanged(true);
- }
+});
+
+public void refresh() {
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ setFieldPopulationReproductionEquationModel();
+ try {
+ editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
+ } catch (IOException ex) {
+ Logger.getLogger(PopulationRecruitmentUI.class.getName()).log(Level.SEVERE, null, ex);
}
- protected Equation getEquation(){
- Equation result = null;
- Object o = fieldPopulationReproductionEquation.getSelectedItem();
- if (o != null){
- GenericCell c = (GenericCell)o;
- if (c.getValue() != null){
- result = (Equation)c.getValue();
- }
- }
- return result;
+}
+protected void setFieldPopulationReproductionEquationModel() {
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationReproductionEquation,getAction().getFormules(getBean().getTopiaContext(), "Reproduction"), getBean().getReproductionEquation());
+}
+protected void equationChanged(){
+ Formule e = (Formule)fieldPopulationReproductionEquation.getSelectedItem();
+ if (e != null){
+ editor.setText(e.getContent());
}
- protected void saveModel(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).saveAsModel(e.getCategory(), e.getLanguage(), e.getContent());
- }
- else{
- getContextValue(InputAction.class).saveAsModel("Reproduction", "Java", editor.getText());
- setFieldPopulationReproductionEquationModel();
- setInfoText(_("isisfish.message.saveModel.finished"));
- }
- }
- protected void openEditor(){
- Equation e = getEquation();
- if (e != null){
- getContextValue(InputAction.class).openEditor(e.getCategory(), e.getName(), fr.ifremer.isisfish.equation.PopulationGrowth.class, e.getContent(), editor);
- }
- else{
- getContextValue(InputAction.class).openEditor("Reproduction","new", fr.ifremer.isisfish.equation.PopulationGrowth.class, editor.getText(), editor);
- }
- }
- protected void monthGapChanged(){
- pop.setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()));
- valueChanged(true);
- }
- protected void commentChanged(){
- pop.setRecruitmentComment(fieldPopulationRecruitmentComment.getText());
- valueChanged(true);
- }
- protected void create(){
- getContextValue(InputAction.class).createRecruitmentDistribution();
- refresh();
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+}
+protected void saveModel(){
+ getAction().saveAsModel("PopulationReproductionEquation", "Java", editor.getText());
+ setFieldPopulationReproductionEquationModel();
+ setInfoText(_("isisfish.message.saveModel.finished"));
+}
+protected void openEditor(){
+ getAction().openEditor("PopulationReproductionEquation","new", fr.ifremer.isisfish.equation.PopulationGrowth.class, editor.getText(), editor);
+}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationRecruitment.reproductionEquation" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationReproductionEquation" onActionPerformed='equationChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.5'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="Month Gap BetweenRepro Recruitment" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" onKeyTyped='valueChanged(true)' onFocusLost='monthGapChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0'>
- <JTable/>
- </cell>
- </row>
- <row>
- <cell>
- <JPanel/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id="create" text="isisfish.common.newMatrix" onActionPerformed='create()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.5'>
- <JScrollPane>
- <JTextArea id="fieldPopulationRecruitmentComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationRecruitment.reproductionEquation" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldPopulationReproductionEquation" onActionPerformed='equationChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.5'>
+ <JScrollPane>
+ <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="Month Gap BetweenRepro Recruitment" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='getBean().getMonthGapBetweenReproRecrutement()' onKeyTyped='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationRecruitment.recruitmentDistribution" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0'>
+ <JTable/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JPanel/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id="create" text="isisfish.common.newMatrix" onActionPerformed='getAction().createRecruitmentDistribution(getBean())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationRecruitment.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.5'>
+ <JScrollPane>
+ <JTextArea id="fieldPopulationRecruitmentComment" text='getBean().getRecruitmentComment()' onKeyTyped='getBean().setRecruitmentComment(fieldPopulationRecruitmentComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
</Table>
-
-
\ No newline at end of file
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,251 +31,170 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
+ <fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl id='populationSeasonInfo' javaBean='null'/>
<script><![CDATA[
+import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
+import fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl;
+import fr.ifremer.isisfish.types.Month;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import fr.ifremer.isisfish.ui.widget.Interval;
+import fr.ifremer.isisfish.ui.widget.IntervalPanel;
- import fr.ifremer.isisfish.entities.PopulationSeasonInfo;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.types.Month;
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.widget.Interval;
- import fr.ifremer.isisfish.ui.widget.IntervalPanel;
-
- protected Population pop = null;
- protected IntervalPanel ip = new IntervalPanel();
- fieldPopulationSeasonInterval.add(ip, BorderLayout.CENTER);
- public PopulationSeasonsUI (InputAction action){
-
- setContextValue(action);
+protected IntervalPanel ip = new IntervalPanel();
+fieldPopulationSeasonInterval.add(ip, BorderLayout.CENTER);
+ip.addPropertyChangeListener("first", new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Month first = getPopulationSeasonInfo().getFirstMonth();
+ first.setMonthNumber(ip.getModel().getFirst());
+ getPopulationSeasonInfo().setFirstMonth(first);
}
- public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- setFieldPopulationSeasonInfoChooserModel();
- fieldPopulationSeasonComment.setText(pop.getSeasonsComment());
- // Model instanciation
- Interval interval = new Interval();
- interval.setMin(0);
- interval.setMax(11);
- interval.setFirst(0);
- interval.setLast(2);
- ip.setModel(interval);
- }
- else{
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldPopulationSeasonInfoChooser.setModel(model);
+});
+
+ ip.addPropertyChangeListener("last", new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Month last = getPopulationSeasonInfo().getLastMonth();
+ last.setMonthNumber(ip.getModel().getLast());
+ getPopulationSeasonInfo().setLastMonth(last);
+ }
+});
+
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldPopulationSeasonComment.setText("");
- // Model instanciation
- Interval interval = new Interval();
- interval.setMin(0);
- interval.setMax(11);
- interval.setFirst(0);
- interval.setLast(2);
- ip.setModel(interval);
}
- }
- protected void setFieldPopulationSeasonInfoChooserModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- if (pop.getPopulationSeasonInfo() != null){
- java.util.List<PopulationSeasonInfo> popSeasonInfo = pop.getPopulationSeasonInfo();
- for(PopulationSeasonInfo psi : popSeasonInfo){
- GenericCell cell = new GenericCell(psi.getFirstMonth().toString() + " - " + psi.getLastMonth().toString(),psi, PopulationSeasonInfo.class);
- model.addElement(cell);
- }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldPopulationSeasonInfoChooser.setModel(model);
}
- protected PopulationSeasonInfo getPopulationSeasonInfo(){
- PopulationSeasonInfo result = null;
- Object selected = fieldPopulationSeasonInfoChooser.getSelectedItem();
- if (selected != null){
- GenericCell cellSelected = (GenericCell) selected;
- if (cellSelected.getValue() != null){
- result = (PopulationSeasonInfo) cellSelected.getValue();
- }
- }
- return result;
- }
- protected void infoChooserChanged(){
- PopulationSeasonInfo selected = getPopulationSeasonInfo();
- if (selected != null){
- fieldPopulationSeasonGroupChange.setSelected(selected.getGroupChange());
- fieldPopulationSeasonReproductionDistribution.setMatrix(selected.getLengthChangeMatrix());
+});
+public void refresh(){
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationSeasonInfoChooser,getBean().getPopulationSeasonInfo(), null);
+ // Model instanciation
+ Interval interval = new Interval();
+ interval.setMin(0);
+ interval.setMax(11);
+ interval.setFirst(0);
+ interval.setLast(2);
+ ip.setModel(interval);
+ try {
+ log.debug("************** Interval ************");
+ Month firstMonth = getPopulationSeasonInfo().getFirstMonth();
-
- Interval interval = new Interval();
- interval.setMin(0);
- interval.setMax(11);
+ if (firstMonth != null) {
+ interval.setFirst(firstMonth.getMonthNumber());
+ log.debug(" first : " + interval.getFirst());
+ } else {
interval.setFirst(0);
- interval.setLast(2);
- ip.setModel(interval);
- try {
- log.debug("************** Interval ************");
- Month firstMonth = selected.getFirstMonth();
+ }
- if (firstMonth != null) {
- interval.setFirst(firstMonth.getMonthNumber());
- log.debug(" first : " + interval.getFirst());
- } else {
- interval.setFirst(0);
- }
-
- Month lastMonth = selected.getLastMonth();
- if (lastMonth != null) {
- interval.setLast(lastMonth.getMonthNumber());
- log.debug(" last : " + interval.getLast());
- } else {
- interval.setLast(3);
- }
- } catch (Exception e) {
- log.error("Unexpected origin.", e);
- // Only trace the error and go on.
- }
- ip.setLabelRenderer(Month.MONTH);
- ip.setModel(interval);
+ Month lastMonth = getPopulationSeasonInfo().getLastMonth();
+ if (lastMonth != null) {
+ interval.setLast(lastMonth.getMonthNumber());
+ log.debug(" last : " + interval.getLast());
+ } else {
+ interval.setLast(3);
}
- valueChanged(true);
+ } catch (Exception e) {
+ log.error("Unexpected origin.", e);
+ // Only trace the error and go on.
}
- protected void groupChangedChanged(){
- PopulationSeasonInfo selected = getPopulationSeasonInfo();
- if (selected != null){
- selected.setGroupChange(fieldPopulationSeasonGroupChange.isSelected());
- valueChanged(true);
- }
- }
- protected void commentChanged(){
- if (pop != null){
- pop.setSeasonsComment(fieldPopulationSeasonComment.getText());
- valueChanged(true);
- }
- }
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("Metier");
-
- getParentContainer(InputUI.class).setTreeModel();
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$species/" + species.getTopiaId() + "/$populations");
- valueChanged(false);
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+ ip.setLabelRenderer(Month.MONTH);
+ ip.setModel(interval);
+}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationSeasons.selectSeason" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldPopulationSeasonInfoChooser" onActionPerformed='infoChooserChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.common.season" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JPanel id='fieldPopulationSeasonInterval' layout='{new BorderLayout()}' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JPanel/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JCheckBox id="fieldPopulationSeasonGroupChange" text="isisfish.populationSeasons.changeGroup" onActionPerformed='groupChangedChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationSeasonReproductionDistribution' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.populationSeasons.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JTextArea id="fieldPopulationSeasonComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
-
-
-
-
-
-
-
-
-
-
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationSeasons.selectSeason" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldPopulationSeasonInfoChooser" onActionPerformed='setPopulationSeasonInfo((PopulationSeasonInfoImpl)fieldPopulationSeasonInfoChooser.getSelectedItem())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.common.season" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JPanel id='fieldPopulationSeasonInterval' layout='{new BorderLayout()}' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JPanel/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JCheckBox id="fieldPopulationSeasonGroupChange" text="isisfish.populationSeasons.changeGroup" selected='{getPopulationSeasonInfo().getGroupChange()}'
+ onActionPerformed='getPopulationSeasonInfo().setGroupChange(fieldPopulationSeasonGroupChange.isSelected())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0'>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationSeasonReproductionDistribution' matrix='{getPopulationSeasonInfo().getLengthChangeMatrix()}' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.populationSeasons.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JTextArea id="fieldPopulationSeasonComment" text='getBean().getSeasonsComment()' onKeyTyped='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,105 +35,75 @@
<!--
+ Population
+-->
-<JPanel layout='{new BorderLayout()}' implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
-
- <Boolean id='changed' javaBean='false'/>
-
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Gear;
+import fr.ifremer.isisfish.entities.Gear;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
- init();
- public PopulationUI (InputAction action){
- setContextValue(action);
- }
- public void refresh(){
- populationBasicsUI.refresh();
- populationGroupUI.refresh();
- populationEquationUI.refresh();
- populationZoneUI.refresh();
- populationSeasonsUI.refresh();
- populationCapturabilityUI.refresh();
- populationRecruitementUI.refresh();
- populationMigrationUI.refresh();
- setSpecies();
- }
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- populationBasicsUI.setActif((Boolean)evt.getNewValue());
- populationGroupUI.setActif((Boolean)evt.getNewValue());
- populationEquationUI.setActif((Boolean)evt.getNewValue());
- populationZoneUI.setActif((Boolean)evt.getNewValue());
- populationSeasonsUI.setActif((Boolean)evt.getNewValue());
- populationCapturabilityUI.setActif((Boolean)evt.getNewValue());
- populationRecruitementUI.setActif((Boolean)evt.getNewValue());
- populationMigrationUI.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- populationBasicsUI.setChanged((Boolean)evt.getNewValue());
- populationGroupUI.setChanged((Boolean)evt.getNewValue());
- populationEquationUI.setChanged((Boolean)evt.getNewValue());
- populationZoneUI.setChanged((Boolean)evt.getNewValue());
- populationSeasonsUI.setChanged((Boolean)evt.getNewValue());
- populationCapturabilityUI.setChanged((Boolean)evt.getNewValue());
- populationRecruitementUI.setChanged((Boolean)evt.getNewValue());
- populationMigrationUI.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
- protected void setSpecies(){
- String[] paths = getContextValue(InputAction.class).getPath().split("/");
- String topiaId = null;
- for (String path : paths){
- if (!path.matches("^\\$.+$")){
- if (path.matches("^fr\\.ifremer\\.isisfish\\.entities\\.Species\\#.+$")){
- topiaId = path;
- }
- }
- }
- if (topiaId != null){
- getContextValue(InputAction.class).setSpecies(topiaId);
- }
- }
- protected void goToGear(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$gears");
- }
+setType("Population");
+setButtonTitle("isisfish.input.continueGears");
+setNextPath("$root/$gears");
+
+public void refresh(){
+ populationBasicsUI.refresh();
+ populationGroupUI.refresh();
+ populationEquationUI.refresh();
+ populationZoneUI.refresh();
+ populationSeasonsUI.refresh();
+ populationCapturabilityUI.refresh();
+ populationRecruitementUI.refresh();
+ populationMigrationUI.refresh();
+// setSpecies();
+}
+// protected void setSpecies(){
+// String[] paths = getContextValue(InputAction.class).getPath().split("/");
+// String topiaId = null;
+// for (String path : paths){
+// if (!path.matches("^\\$.+$")){
+// if (path.matches("^fr\\.ifremer\\.isisfish\\.entities\\.Species\\#.+$")){
+// topiaId = path;
+// }
+// }
+// }
+// if (topiaId != null){
+// getContextValue(InputAction.class).setSpecies(topiaId);
+// }
+// }
]]>
</script>
- <JTabbedPane id="PopulationTab" name="Populations" constraints='BorderLayout.CENTER'>
- <tab title='{_("isisfish.populationBasics.title")}'>
- <PopulationBasicsUI id='populationBasicsUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- <tab title='{_("isisfish.populationGroup.title")}'>
- <PopulationGroupUI id='populationGroupUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- <tab title='{_("isisfish.populationEquation.title")}'>
- <PopulationEquationUI id='populationEquationUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- <tab title='{_("isisfish.populationZones.title")}'>
- <PopulationZonesUI id='populationZoneUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- <tab title='{_("isisfish.populationSeasons.title")}'>
- <PopulationSeasonsUI id='populationSeasonsUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- <tab title='{_("isisfish.populationCapturability.title")}'>
- <PopulationCapturabilityUI id='populationCapturabilityUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- <tab title='{_("isisfish.populationRecruitment.title")}'>
- <PopulationRecruitmentUI id='populationRecruitementUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- <tab title='{_("isisfish.populationMigration.title")}'>
- <PopulationMigrationUI id='populationMigrationUI' constructorParams='getContextValue(InputAction.class)'/>
- </tab>
- </JTabbedPane>
- <JButton text="isisfish.input.continueGears" constraints='BorderLayout.SOUTH' onActionPerformed='goToGear()'/>
-</JPanel>
\ No newline at end of file
+ <JPanel id='body' layout='{new BorderLayout()}'>
+ <JTabbedPane id="populationTab" name="Populations" constraints='BorderLayout.CENTER'>
+ <tab title='{_("isisfish.populationBasics.title")}'>
+ <PopulationBasicsUI id='populationBasicsUI' constructorParams='this'/>
+ </tab>
+ <tab title='{_("isisfish.populationGroup.title")}'>
+ <PopulationGroupUI id='populationGroupUI' constructorParams='this'/>
+ </tab>
+ <tab title='{_("isisfish.populationEquation.title")}'>
+ <PopulationEquationUI id='populationEquationUI' constructorParams='this'/>
+ </tab>
+ <tab title='{_("isisfish.populationZones.title")}'>
+ <PopulationZonesUI id='populationZoneUI' constructorParams='this'/>
+ </tab>
+ <tab title='{_("isisfish.populationSeasons.title")}'>
+ <PopulationSeasonsUI id='populationSeasonsUI' constructorParams='this'/>
+ </tab>
+ <tab title='{_("isisfish.populationCapturability.title")}'>
+ <PopulationCapturabilityUI id='populationCapturabilityUI' constructorParams='this'/>
+ </tab>
+ <tab title='{_("isisfish.populationRecruitment.title")}'>
+ <PopulationRecruitmentUI id='populationRecruitementUI' constructorParams='this'/>
+ </tab>
+ <tab title='{_("isisfish.populationMigration.title")}'>
+ <PopulationMigrationUI id='populationMigrationUI' constructorParams='this'/>
+ </tab>
+ </JTabbedPane>
+ <!--JButton text="isisfish.input.continueGears" constraints='BorderLayout.SOUTH' onActionPerformed='goToGear()'/-->
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,75 +31,73 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import jaxx.runtime.swing.JAXXList;
- import fr.ifremer.isisfish.entities.Zone;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.entities.Population;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.math.matrix.gui.MatrixPanelEvent;
- import org.codelutin.math.matrix.gui.MatrixPanelListener;
+import jaxx.runtime.swing.JAXXList;
+import fr.ifremer.isisfish.entities.Zone;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.entities.Population;
+import fr.ifremer.isisfish.entities.PopulationImpl;
+import org.codelutin.topia.persistence.TopiaEntity;
+import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import org.codelutin.math.matrix.gui.MatrixPanelEvent;
+import org.codelutin.math.matrix.gui.MatrixPanelListener;
- protected Population pop = null;
- public PopulationZonesUI (InputAction action){
-
- setContextValue(action);
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
}
+});
public void refresh(){
- pop = getContextValue(InputAction.class).getPopulation();
- if (pop != null){
- setPopulationZonesPresenceModel();
- setFieldPopulationZonesReproductionModel();
- setFieldPopulationZonesRecruitmentModel();
- setFieldPopulationMappingZoneReproZoneRecru();
- fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(new MatrixPanelListener() {
+ Population population = (Population)getVerifier().getEntity(Population.class);
+ setBean((PopulationImpl) population);
+ setPopulationZonesPresenceModel();
+ setFieldPopulationZonesReproductionModel();
+ setFieldPopulationZonesRecruitmentModel();
+ setFieldPopulationMappingZoneReproZoneRecru();
+ fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(new MatrixPanelListener() {
- @Override
- public void matrixChanged(MatrixPanelEvent arg0) {
- fieldPopulationMappingZoneReproZoneRecruChanged();
- }
- });
- valueChanged(false);
- }
- else{
- DefaultListModel model = new DefaultListModel();
- fieldPopulationZonesRecruitment.setModel(model);
- populationZonesPresence.setModel(model);
- fieldPopulationZonesReproduction.setModel(model);
- fieldPopulationMappingZoneReproZoneRecru.setMatrix(null);
- valueChanged(false);
- }
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ fieldPopulationMappingZoneReproZoneRecruChanged();
+ }
+ });
}
protected void fieldPopulationMappingZoneReproZoneRecruChanged(){
- pop.setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix());
- valueChanged(true);
+ getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix());
}
protected void setFieldPopulationMappingZoneReproZoneRecru(){
- if (pop.getMappingZoneReproZoneRecru() != null){
- fieldPopulationMappingZoneReproZoneRecru.setMatrix(pop.getMappingZoneReproZoneRecru().copy());
+ if (getBean().getMappingZoneReproZoneRecru() != null){
+ fieldPopulationMappingZoneReproZoneRecru.setMatrix(getBean().getMappingZoneReproZoneRecru().copy());
}
}
protected void setPopulationZonesPresenceModel(){
- setModel(pop.getPopulationZone(), populationZonesPresence);
+ setModel(getBean().getPopulationZone(), populationZonesPresence);
}
protected void setFieldPopulationZonesReproductionModel(){
- setModel(pop.getReproductionZone(), fieldPopulationZonesReproduction);
+ setModel(getBean().getReproductionZone(), fieldPopulationZonesReproduction);
}
protected void setFieldPopulationZonesRecruitmentModel(){
- setModel(pop.getRecruitmentZone(), fieldPopulationZonesRecruitment);
+ setModel(getBean().getRecruitmentZone(), fieldPopulationZonesRecruitment);
}
protected void setModel(java.util.List<Zone> selected, JAXXList componant){
DefaultListModel model = new DefaultListModel();
- java.util.List<Zone> zones = getContextValue(InputAction.class).getFisheryRegion().getZone();
+ java.util.List<Zone> zones = getRegion().getZone();
java.util.List<GenericCell> selectedZones = new ArrayList<GenericCell>();
if (zones != null){
for (Zone z : zones){
@@ -128,22 +126,13 @@
}
}
protected void presenceChanged(){
- if (pop != null){
- pop.setPopulationZone(getSelectedValue(populationZonesPresence));
- valueChanged(true);
- }
+ getBean().setPopulationZone(getSelectedValue(populationZonesPresence));
}
protected void reproductionChanged(){
- if (pop != null){
- pop.setReproductionZone(getSelectedValue(fieldPopulationZonesReproduction));
- valueChanged(true);
- }
+ getBean().setReproductionZone(getSelectedValue(fieldPopulationZonesReproduction));
}
protected void recruitementChanged(){
- if (pop != null){
- pop.setRecruitmentZone(getSelectedValue(fieldPopulationZonesRecruitment));
- valueChanged(true);
- }
+ getBean().setRecruitmentZone(getSelectedValue(fieldPopulationZonesRecruitment));
}
protected java.util.List<Zone> getSelectedValue(JAXXList componant){
Object[] selected = componant.getSelectedValues();
@@ -158,88 +147,62 @@
}
return selectedZone;
}
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- TopiaEntity species = (TopiaEntity) getContextValue(InputAction.class).getSpecies();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + species.getTopiaId() + "/$populations/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(PopulationUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
]]>
</script>
- <row>
- <cell fill='horizontal' weightx='0.3'>
- <JLabel text="isisfish.populationZones.selectPopulationAreas" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.3'>
- <JLabel text="isisfish.populationZones.selectSpawningAreas" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.3'>
- <JLabel text="isisfish.populationZones.selectRecruitmentAreas" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='0.3' weighty='0.5'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="populationZonesPresence" onMouseClicked='presenceChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- <cell fill='both' weightx='0.3' weighty='0.5'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="fieldPopulationZonesReproduction" onMouseClicked='reproductionChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- <cell fill='both' weightx='0.3' weighty='0.5'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <JList id="fieldPopulationZonesRecruitment" onMouseClicked='recruitementChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='3' anchor='west'>
- <JLabel text="isisfish.populationZones.betweenSpawningRecruitmentAreas" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='3' fill='both' weightx='1.0' weighty='0.5'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationMappingZoneReproZoneRecru' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='3' fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
-
-
-
-
-
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='horizontal' weightx='0.3'>
+ <JLabel text="isisfish.populationZones.selectPopulationAreas" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.3'>
+ <JLabel text="isisfish.populationZones.selectSpawningAreas" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.3'>
+ <JLabel text="isisfish.populationZones.selectRecruitmentAreas" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='0.3' weighty='0.5'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JList id="populationZonesPresence" onMouseClicked='presenceChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ <cell fill='both' weightx='0.3' weighty='0.5'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JList id="fieldPopulationZonesReproduction" onMouseClicked='reproductionChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ <cell fill='both' weightx='0.3' weighty='0.5'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <JList id="fieldPopulationZonesRecruitment" onMouseClicked='recruitementChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3' anchor='west'>
+ <JLabel text="isisfish.populationZones.betweenSpawningRecruitmentAreas" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3' fill='both' weightx='1.0' weighty='0.5'>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id ='fieldPopulationMappingZoneReproZoneRecru' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3' fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,17 +35,16 @@
<!--
+ Port
+-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.PortImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
import fr.ifremer.isisfish.entities.Species;
import fr.ifremer.isisfish.entities.Port;
+ import fr.ifremer.isisfish.entities.PortImpl;
import fr.ifremer.isisfish.entities.Cell;
import fr.ifremer.isisfish.map.IsisMapBean;
import fr.ifremer.isisfish.map.OpenMapToolPanel;
@@ -57,32 +56,29 @@
import org.codelutin.topia.TopiaException;
protected OMToolSet toolSet = new OMToolSet();
- protected OpenMapToolPanel toolMap = new OpenMapToolPanel();
protected OpenMapEvents mapListener = null;
- public PortUI (InputAction action){
-
- setContextValue(action);
- }
+
public void refresh() {
- Port port = getContextValue(InputAction.class).getPort();
- if (port != null){
- fieldPortName.setText(port.getName());
+ Port port = (Port)getVerifier().getEntity(Port.class);
+ setBean((PortImpl) port);
+ if (getBean() != null){
+ fieldPortName.setText(getBean().getName());
DefaultListModel portCellModel = new DefaultListModel();
- java.util.List<Cell> cells = getContextValue(InputAction.class).getFisheryRegion().getCell();
+ java.util.List<Cell> cells = getRegion().getCell();
for (Cell c : cells){
portCellModel.addElement(c);
}
portCell.setModel(portCellModel);
- portCell.setSelectedValue(port.getCell());
+ portCell.setSelectedValue(getBean().getCell());
- fieldPortComment.setText(getContextValue(InputAction.class).getPort().getComment());
+ fieldPortComment.setText(getBean().getComment());
}
else{
fieldPortName.setText("");
DefaultListModel portCellModel = new DefaultListModel();
- java.util.List<Cell> cells = getContextValue(InputAction.class).getFisheryRegion().getCell();
+ java.util.List<Cell> cells = getRegion().getCell();
for (Cell c : cells){
portCellModel.addElement(c);
}
@@ -92,13 +88,12 @@
}
- portMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion());
+ portMap.setFisheryRegion(getRegion());
if(mapListener == null){
portMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
portMap.setActiveMouseMode(new SelectMouseMode());
toolSet.setupListeners(portMap);
toolMap.add((Component)toolSet);
- map.add(toolMap, BorderLayout.NORTH);
setMapListener();
}
refreshMap();
@@ -115,139 +110,91 @@
@Override
public boolean onMouseClicked() {
for (Cell c : portMap.getSelectedCells()){
- Port port = getContextValue(InputAction.class).getPort();
- if (port != null){
- port.setCell(c);
+ if (getBean() != null){
+ getBean().setCell(c);
}
}
- valueChanged(true);
refresh();
return true;
}
};
}
}
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("Port");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$ports/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$ports/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$ports");
- valueChanged(false);
- refresh();
- }
- protected void goToSpecies(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$species");
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- changed=b;
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
protected void nameChanged(){
- getContextValue(InputAction.class).getPort().setName(fieldPortName.getText());
- valueChanged(true);
+ getBean().setName(fieldPortName.getText());
}
protected void portCellChanged(){
- getContextValue(InputAction.class).getPort().setCell((Cell)portCell.getSelectedValue());
- valueChanged(true);
+ getBean().setCell((Cell)portCell.getSelectedValue());
}
protected void commentChanged(){
- getContextValue(InputAction.class).getPort().setComment(fieldPortComment.getText());
- valueChanged(true);
+ getBean().setComment(fieldPortComment.getText());
}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JSplitPane id="PortTab" name="Ports"
- oneTouchExpandable="true" dividerLocation="270" orientation="horizontal">
- <Table>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0' >
- <JLabel text="isisfish.port.name" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0' >
- <JTextField id="fieldPortName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0' >
- <JLabel text="isisfish.port.cell" enabled='{isActif()}'/>
-
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weighty='0.7' weightx='1.0'>
- <JScrollPane>
- <JList id="portCell" selectionMode="0" onMouseClicked='portCellChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JLabel text="isisfish.port.comments" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weighty='0.3' weightx='1.0' >
- <JScrollPane>
- <JTextArea id="fieldPortComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- <JPanel id='map' layout='{new BorderLayout()}'>
- <fr.ifremer.isisfish.map.IsisMapBean id='portMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' constraints='BorderLayout.CENTER'/>
- </JPanel>
- </JSplitPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton text="isisfish.input.continueSpecies" onActionPerformed='goToSpecies()'/>
- </cell>
- </row>
-</Table>
-
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JSplitPane id="PortTab" name="Ports"
+ oneTouchExpandable="true" dividerLocation="270" orientation="horizontal">
+ <Table>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0' >
+ <JLabel text="isisfish.port.name" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0' >
+ <JTextField id="fieldPortName" onKeyTyped='nameChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0' >
+ <JLabel text="isisfish.port.cell" enabled='{isActif()}'/>
+
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weighty='0.7' weightx='1.0'>
+ <JScrollPane>
+ <JList id="portCell" selectionMode="0" onMouseClicked='portCellChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JLabel text="isisfish.port.comments" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weighty='0.3' weightx='1.0' >
+ <JScrollPane>
+ <JTextArea id="fieldPortComment" onKeyTyped='commentChanged()' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ <JPanel id='map' layout='{new BorderLayout()}'>
+ <fr.ifremer.isisfish.map.OpenMapToolPanel id='toolMap' javaBean='new fr.ifremer.isisfish.map.OpenMapToolPanel()' constraints='BorderLayout.NORTH'/>
+ <fr.ifremer.isisfish.map.IsisMapBean id='portMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()' constraints='BorderLayout.CENTER'/>
+ </JPanel>
+ </JSplitPane>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -30,13 +30,11 @@
* by : $Author: sletellier $
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.GearImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script>
<![CDATA[
@@ -48,20 +46,24 @@
import fr.ifremer.isisfish.ui.widget.editor.EquationTableEditor;
import javax.swing.table.DefaultTableModel;
import fr.ifremer.isisfish.entities.Selectivity;
+ import fr.ifremer.isisfish.entities.GearImpl;
import fr.ifremer.isisfish.entities.Equation;
import java.util.logging.Level;
import java.util.logging.Logger;
+ import org.codelutin.topia.TopiaContext;
import org.codelutin.topia.persistence.TopiaEntity;
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+ import fr.ifremer.isisfish.entities.Metier;
+ import fr.ifremer.isisfish.entities.MetierImpl;
- public SelectivityUI (InputAction action){
-
- setContextValue(action);
- }
public void refresh(){
+ InputAction action = getAction();
+ setBean(null);
+ Gear gear = (Gear)getVerifier().getEntity(Gear.class);
+ setBean((GearImpl) gear);
fieldSelectivityPopulation.setModel(getSelectivityPopulationModel());
fieldSelectivityEquation.setModel(getSelectivityEquationModel());
- if (getContextValue(InputAction.class).getGear() != null){
+ if (getBean() != null){
setSelectivityTableModel();
}
else{
@@ -85,7 +87,7 @@
return result;
}
};
- Collection<Selectivity> selectivity = getContextValue(InputAction.class).getGear().getPopulationSelectivity();
+ Collection<Selectivity> selectivity = getBean().getPopulationSelectivity();
java.util.List<Population> populations = new ArrayList<Population>();
java.util.List<Equation> equations = new ArrayList<Equation>();
if (selectivity != null){
@@ -102,7 +104,7 @@
selectivityTable.getColumnModel().getColumn(1).setCellEditor(cellEditor);
}
protected DefaultComboBoxModel getSelectivityPopulationModel(){
- java.util.List<Species> species = getContextValue(InputAction.class).getFisheryRegion().getSpecies();
+ java.util.List<Species> species = getRegion().getSpecies();
DefaultComboBoxModel selectivityPopulationModel = new DefaultComboBoxModel();
if (species != null){
selectivityPopulationModel.addElement(new GenericCell(" ", null, null));
@@ -117,7 +119,7 @@
return selectivityPopulationModel;
}
protected DefaultComboBoxModel getSelectivityEquationModel(){
- java.util.List<Formule> formules = fr.ifremer.isisfish.datastore.FormuleStorage.getFormules(getContextValue(InputAction.class).getIsisContext(), "Selectivity");
+ java.util.List<Formule> formules = fr.ifremer.isisfish.datastore.FormuleStorage.getFormules(getContextValue(TopiaContext.class), "Selectivity");
DefaultComboBoxModel selectivityEquationModel = new DefaultComboBoxModel();
if (formules != null){
selectivityEquationModel.addElement(new GenericCell(" ", null, null));
@@ -129,42 +131,21 @@
return selectivityEquationModel;
}
protected void saveAsModel(){
- getContextValue(InputAction.class).saveAsModel("Selectivity", "Java", fieldSelectivityScript.getText());
- refresh();
+ getAction().saveAsModel("SelectivityEquation", "Java", fieldSelectivityScript.getText());
+ fieldSelectivityEquation.setModel(getSelectivityEquationModel());
setInfoText(_("isisfish.message.saveModel.finished"));
}
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
protected void openEditor(){
- getContextValue(InputAction.class).openEditor("Selectivity", "new", fr.ifremer.isisfish.equation.SelectivityEquation.class, fieldSelectivityScript.getText(), fieldSelectivityScript);
+ getAction().openEditor("SelectivityEquation", "new", fr.ifremer.isisfish.equation.SelectivityEquation.class, fieldSelectivityScript.getText(), fieldSelectivityScript);
}
protected void add(){
- getContextValue(InputAction.class).addSelectivity((Population) ((GenericCell) fieldSelectivityPopulation.getSelectedItem()).getValue(), fieldSelectivityScript.getText());
- valueChanged(true);
+ getAction().addSelectivity((Population) ((GenericCell) fieldSelectivityPopulation.getSelectedItem()).getValue(), fieldSelectivityScript.getText(), getBean());
refresh();
}
protected void remove(){
- getContextValue(InputAction.class).removeSelectivity((Selectivity) getContextValue(InputAction.class).getGear().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0)));
+ getAction().removeSelectivity(getBean(), (Selectivity) getBean().getPopulationSelectivity((Population) selectivityTable.getValueAt(selectivityTable.getSelectedRow(), 0)));
refresh();
}
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$gears/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void valueChanged(boolean b){
- getParentContainer(GearUI.class).setChanged(b);
- }
protected void equationChanged(){
GenericCell g = (GenericCell)fieldSelectivityEquation.getSelectedItem();
if (g.getValue() != null){
@@ -180,83 +161,85 @@
}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.selectivity.selectPopulation" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSelectivityPopulation" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' anchor='east'>
- <JLabel text="isisfish.selectivity.equation" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSelectivityEquation" onActionPerformed='equationChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton id='saveModel' text="isisfish.common.saveModel" onActionPerformed='saveAsModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton id='openEditor' text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <org.codelutin.widget.editor.Editor id='fieldSelectivityScript' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonAddSelectivity" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JTable id="selectivityTable" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id="buttonSelectivityRemove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.selectivity.selectPopulation" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldSelectivityPopulation" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' anchor='east'>
+ <JLabel text="isisfish.selectivity.equation" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldSelectivityEquation" onActionPerformed='equationChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton id='saveModel' text="isisfish.common.saveModel" onActionPerformed='saveAsModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton id='openEditor' text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <org.codelutin.widget.editor.Editor id='fieldSelectivityScript' askIfNotSaved="false" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JButton id="buttonAddSelectivity" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JTable id="selectivityTable" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JButton id="buttonSelectivityRemove" text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,189 +31,58 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.SetOfVesselsImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import org.codelutin.topia.TopiaException;
- import fr.ifremer.isisfish.entities.Port;
- import fr.ifremer.isisfish.entities.Equation;
- import fr.ifremer.isisfish.entities.VesselType;
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import java.util.logging.Level;
- import java.util.logging.Logger;
+import org.codelutin.topia.TopiaException;
+import fr.ifremer.isisfish.entities.Port;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.VesselType;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.SetOfVessels;
+import fr.ifremer.isisfish.entities.SetOfVesselsImpl;
+import java.util.logging.Level;
+import java.util.logging.Logger;
- public SetOfVesselsTabsUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh() {
- fr.ifremer.isisfish.entities.SetOfVessels setOfVessels = getContextValue(InputAction.class).getSetOfVessels();
- if (setOfVessels != null){
- fieldSetOfVesselsName.setText(setOfVessels.getName());
- setFieldSetOfVesselsPortModel(setOfVessels);
- setFieldSetOfVesselsVesselTypeModel(setOfVessels);
- fieldSetOfVesselsNumberOfVessels.setText(setOfVessels.getNumberOfVessels() + "");
- fieldSetOfVesselsFixedCosts.setText(setOfVessels.getFixedCosts() + "");
- setFieldSetOfVesselsTechnicalEfficiencyModel(setOfVessels);
- fieldSetOfVesselsComment.setText(setOfVessels.getComment());
- }
- else{
+setType("SetOfVessels");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
fieldSetOfVesselsName.setText("");
- setFieldSetOfVesselsPortModel(null);
- setFieldSetOfVesselsVesselTypeModel(null);
fieldSetOfVesselsNumberOfVessels.setText("");
fieldSetOfVesselsFixedCosts.setText("");
- setFieldSetOfVesselsTechnicalEfficiencyModel(null);
fieldSetOfVesselsComment.setText("");
}
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
+ }
+});
+ public void refresh() {
+ SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class);
+ setBean((SetOfVesselsImpl) setOfVessels);
+ jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsPort,getRegion().getPort(), getBean().getPort());
+ jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsVesselType,getRegion().getVesselType(), getBean().getVesselType());
+ jaxx.runtime.swing.Utils.fillComboBox(fieldSetOfVesselsTechnicalEfficiency,getAction().getFormules(getBean().getTopiaContext(),"TechnicalEfficiency"), getBean().getTechnicalEfficiencyEquation());
try {
editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
} catch (IOException ex) {
Logger.getLogger(SelectivityUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
- protected void setFieldSetOfVesselsPortModel(fr.ifremer.isisfish.entities.SetOfVessels setOfVessels){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<Port> ports = getContextValue(InputAction.class).getFisheryRegion().getPort();
- GenericCell selectedCell = null;
- for (Port p : ports){
- GenericCell cell = new GenericCell(p.getName(), p, Port.class);
- model.addElement(cell);
- if (setOfVessels != null){
- if (setOfVessels.getPort() != null){
- if (p.getName().equals(setOfVessels.getPort().getName())){
- selectedCell = cell;
- }
- }
- }
- }
- fieldSetOfVesselsPort.setModel(model);
- if (selectedCell != null){
- fieldSetOfVesselsPort.setSelectedItem(selectedCell);
- }
- }
- protected void setFieldSetOfVesselsVesselTypeModel(fr.ifremer.isisfish.entities.SetOfVessels setOfVessels){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<VesselType> vesselTypes = getContextValue(InputAction.class).getFisheryRegion().getVesselType();
- GenericCell selectedCell = null;
- for (VesselType v : vesselTypes){
- GenericCell cell = new GenericCell(v.getName(), v, VesselType.class);
- model.addElement(cell);
- if (setOfVessels != null){
- if (setOfVessels.getVesselType() != null){
- if (v.getName().equals(setOfVessels.getVesselType().getName())){
- selectedCell = cell;
- }
- }
- }
- }
- fieldSetOfVesselsVesselType.setModel(model);
- if (selectedCell != null){
- fieldSetOfVesselsVesselType.setSelectedItem(selectedCell);
- }
- }
- protected void setFieldSetOfVesselsTechnicalEfficiencyModel(fr.ifremer.isisfish.entities.SetOfVessels setOfVessels){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<Formule> formule = getContextValue(InputAction.class).getFormules("TechnicalEfficiency");
- String formuleSelectedName = null;
- GenericCell selectedCell = null;
- for (Formule f : formule){
- GenericCell cell = new GenericCell(f.getName(), f, Formule.class);
- model.addElement(cell);
- if(setOfVessels != null){
- if (setOfVessels.getTechnicalEfficiencyEquation() != null){
- if (f.getName().equals(formuleSelectedName)){
- selectedCell = cell;
- }
- }
- }
- }
- fieldSetOfVesselsTechnicalEfficiency.setModel(model);
- if(selectedCell != null){
- fieldSetOfVesselsTechnicalEfficiency.setSelectedItem(selectedCell);
- }
- }
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("SetOfVessels");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$setOfVessels/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$setOfVessels/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$setOfVessels");
- valueChanged(false);
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(SetOfVesselsUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
- protected void nameChanged(){
- getContextValue(InputAction.class).getSetOfVessels().setName(fieldSetOfVesselsName.getText());
- }
- protected void portChanged(){
- Object value = fieldSetOfVesselsPort.getSelectedItem();
- if (value != null){
- GenericCell cell = (GenericCell) value;
- if (cell.getValue() != null){
- getContextValue(InputAction.class).getSetOfVessels().setPort((Port)cell.getValue());
- }
- }
- }
- protected void vesselTypeChanged(){
- Object value = fieldSetOfVesselsVesselType.getSelectedItem();
- if (value != null){
- GenericCell cell = (GenericCell) value;
- if (cell.getValue() != null){
- getContextValue(InputAction.class).getSetOfVessels().setVesselType((VesselType)cell.getValue());
- }
- }
- }
- protected void numberOfVesselsChanged(){
- getContextValue(InputAction.class).getSetOfVessels().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()));
- }
- protected void fixedCostsChanged(){
- getContextValue(InputAction.class).getSetOfVessels().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()));
- }
protected void technicalEfficiencyChanged(){
- GenericCell g = (GenericCell)fieldSetOfVesselsTechnicalEfficiency.getSelectedItem();
- if (g != null){
- if (g.getValue() != null){
- editor.setText(((Formule)g.getValue()).getContent());
- fr.ifremer.isisfish.entities.SetOfVessels setOfVessels = getContextValue(InputAction.class).getSetOfVessels();
- setOfVessels.setTechnicalEfficiencyEquation((Equation)g.getValue());
- }
+ if (fieldSetOfVesselsTechnicalEfficiency.getSelectedItem() != null){
+ editor.setText(((Formule)fieldSetOfVesselsTechnicalEfficiency.getSelectedItem()).getContent());
+ getBean().setTechnicalEfficiencyEquation((Equation)fieldSetOfVesselsTechnicalEfficiency.getSelectedItem());
}
else{
try {
@@ -223,130 +92,127 @@
}
}
}
- protected void commentChanged(){
- getContextValue(InputAction.class).getSetOfVessels().setComment(fieldSetOfVesselsComment.getText());
- }
protected void saveAsModel(){
-// GenericCell g = (GenericCell)fieldSetOfVesselsTechnicalEfficiency.getSelectedItem();
-// getContextValue(InputAction.class).saveEquationAsModel((Equation)g.getValue());
- getContextValue(InputAction.class).saveAsModel("SetOfVessels", "Java", editor.getText());
+ getContextValue(InputAction.class).saveAsModel("SoVTechnicalEfficiencyEquation", "Java", editor.getText());
setInfoText(_("isisfish.message.saveModel.finished"));
}
protected void openEditor(){
- getContextValue(InputAction.class).openEditor("SetOfVessels","new",fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class, editor.getText(), editor);
+ getContextValue(InputAction.class).openEditor("SoVTechnicalEfficiencyEquation","new",fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class, editor.getText(), editor);
}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.setOfVessels.name" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldSetOfVesselsName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.common.port" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSetOfVesselsPort" onActionPerformed='portChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.setOfVessels.vesselType" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSetOfVesselsVesselType" onActionPerformed='vesselTypeChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.setOfVessels.numberOfVessels" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldSetOfVesselsNumberOfVessels" onKeyTyped='valueChanged(true)' onFocusLost='numberOfVesselsChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.setOfVessels.fixedCosts" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldSetOfVesselsFixedCosts" onKeyTyped='valueChanged(true)' onFocusLost='fixedCostsChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.setOfVessels.technicalEfficiency" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldSetOfVesselsTechnicalEfficiency" onActionPerformed='technicalEfficiencyChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='0.7'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveAsModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.7'>
- <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell anchor='east'>
- <JLabel text="isisfish.setOfVessels.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.3'>
- <JScrollPane>
- <JTextArea id="fieldSetOfVesselsComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.setOfVessels.name" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldSetOfVesselsName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldSetOfVesselsName.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.common.port" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldSetOfVesselsPort" onActionPerformed='getBean().setPort((Port)fieldSetOfVesselsPort.getSelectedItem())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.setOfVessels.vesselType" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldSetOfVesselsVesselType" onActionPerformed='getBean().setVesselType((VesselType)fieldSetOfVesselsVesselType.getSelectedItem())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.setOfVessels.numberOfVessels" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldSetOfVesselsNumberOfVessels" text='getBean().getNumberOfVessels()' onKeyTyped='getBean().setNumberOfVessels(Integer.parseInt(fieldSetOfVesselsNumberOfVessels.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.setOfVessels.fixedCosts" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldSetOfVesselsFixedCosts" text='getBean().getFixedCosts()' onKeyTyped='getBean().setFixedCosts(Double.parseDouble(fieldSetOfVesselsFixedCosts.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.setOfVessels.technicalEfficiency" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldSetOfVesselsTechnicalEfficiency" onActionPerformed='technicalEfficiencyChanged()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='0.7'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.saveModel" onActionPerformed='saveAsModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.7'>
+ <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'>
+ <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='east'>
+ <JLabel text="isisfish.setOfVessels.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.3'>
+ <JScrollPane>
+ <JTextArea id="fieldSetOfVesselsComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldSetOfVesselsComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,47 +35,22 @@
<!--
+ SetOfVessels
+-->
-<JPanel implements='InputContent' layout='{new BorderLayout()}'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
-
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Strategy;
- init();
- public SetOfVesselsUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh() {
- setOfVesselsTabsUI.refresh();
- effortDescriptionUI.refresh();
- }
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- setOfVesselsTabsUI.setActif((Boolean)evt.getNewValue());
- effortDescriptionUI.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- setOfVesselsTabsUI.setChanged((Boolean)evt.getNewValue());
- effortDescriptionUI.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
- protected void goToStrategies(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$strategies");
- }
+
+setType("SetOfVessels");
+setButtonTitle("isisfish.input.continueStrategies");
+setNextPath("$root/$strategies");
+public void refresh() {
+ setOfVesselsTabsUI.refresh();
+ effortDescriptionUI.refresh();
+}
]]></script>
- <JTabbedPane id="SetOfVesselsTab" name="SetOfVessels" constraints='BorderLayout.CENTER'>
- <tab title='{_("isisfish.setOfVessels.title")}'><SetOfVesselsTabsUI id='setOfVesselsTabsUI' constructorParams='getContextValue(InputAction.class)'/></tab>
- <tab title='{_("isisfish.effortDescription.title")}'><EffortDescriptionUI id='effortDescriptionUI' constructorParams='getContextValue(InputAction.class)'/></tab>
- </JTabbedPane>
- <JButton text="isisfish.input.continueStrategies" constraints='BorderLayout.SOUTH' onActionPerformed='goToStrategies()'/>
-</JPanel>
+ <JPanel id='body' layout='{new BorderLayout()}'>
+ <JTabbedPane id="SetOfVesselsTab" name="SetOfVessels" constraints='BorderLayout.CENTER'>
+ <tab title='{_("isisfish.setOfVessels.title")}'><SetOfVesselsTabsUI id='setOfVesselsTabsUI' constructorParams='this'/></tab>
+ <tab title='{_("isisfish.effortDescription.title")}'><EffortDescriptionUI id='effortDescriptionUI' constructorParams='this'/></tab>
+ </JTabbedPane>
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,195 +35,122 @@
<!--
+ Species
+-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.SpeciesImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Population;
- import fr.ifremer.isisfish.entities.Species;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import org.codelutin.topia.TopiaException;
-
- public SpeciesUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh() {
- Species s = getContextValue(InputAction.class).getSpecies();
- if (s != null){
- fieldSpeciesName.setText(s.getName());
- fieldSpeciesScientificName.setText(s.getScientificName());
- fieldSpeciesCodeRubbin.setText(s.getCodeRubbin());
- fieldSpeciesCEE.setText(s.getCodeCEE() + "");
- fieldSpeciesDynamicAge.setSelected(s.getAgeGroupType());
- fieldSpeciesDynamicLength.setSelected(!s.getAgeGroupType());
- fieldSpeciesComment.setText(s.getComment());
- goToPopulation.setEnabled(true);
- }
- else{
+import fr.ifremer.isisfish.entities.Species;
+import fr.ifremer.isisfish.entities.SpeciesImpl;
+
+setType("Species");
+setButtonTitle("isisfish.input.continuePopulations");
+setNextPath("$root/$species/" + getBean().getTopiaId() + "/$population");
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldSpeciesName.setText("");
fieldSpeciesScientificName.setText("");
fieldSpeciesCodeRubbin.setText("");
fieldSpeciesCEE.setText("");
fieldSpeciesComment.setText("");
- goToPopulation.setEnabled(false);
}
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
}
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("Species");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$species/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$species/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$species");
- refresh();
- }
- protected void goToPopulation(){
- Species s = getContextValue(InputAction.class).getSpecies();
- getParentContainer(InputUI.class).setTreeSelection("$root/$species/"+ s.getTopiaId() +"/$populations");
- }
- protected void valueChanged(boolean b){
- changed=b;
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void commentChanged(){
- getContextValue(InputAction.class).getSpecies().setComment(fieldSpeciesComment.getText());
- valueChanged(true);
- }
- protected void dynamicAgeChanged(){
- getContextValue(InputAction.class).getSpecies().setAgeGroupType(fieldSpeciesDynamicAge.isSelected());
- valueChanged(true);
- }
- protected void CEEChanged(){
- getContextValue(InputAction.class).getSpecies().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()));
- valueChanged(true);
- }
- protected void codeChanged(){
- getContextValue(InputAction.class).getSpecies().setCodeRubbin(fieldSpeciesCodeRubbin.getText());
- valueChanged(true);
- }
- protected void scientificNameChanged(){
- getContextValue(InputAction.class).getSpecies().setScientificName(fieldSpeciesScientificName.getText());
- valueChanged(true);
- }
- protected void nameChanged(){
- getContextValue(InputAction.class).getSpecies().setName(fieldSpeciesName.getText());
- valueChanged(true);
- }
+});
+public void refresh() {
+ Species species = (Species)getVerifier().getEntity(Species.class);
+ setBean((SpeciesImpl) species);
+}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell>
- <JLabel text="isisfish.species.name" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.species.scientificName" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesScientificName" onKeyTyped='valueChanged(true)' onFocusLost='scientificNameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.species.rubbinCode" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesCodeRubbin" onKeyTyped='valueChanged(true)' onFocusLost='codeChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.species.cee" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' columns='2' weightx='1.0'>
- <JTextField id="fieldSpeciesCEE" onKeyTyped='valueChanged(true)' onFocusLost='CEEChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.species.structured" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" buttonGroup="structuredGroup" onItemStateChanged='dynamicAgeChanged()' enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" buttonGroup="structuredGroup" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.species.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' columns='2' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JTextArea id="fieldSpeciesComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JButton id='goToPopulation' text="isisfish.input.continuePopulations" enabled='false' onActionPerformed='goToPopulation()'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="isisfish.species.name" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' columns='2' weightx='1.0'>
+ <JTextField id="fieldSpeciesName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldSpeciesName.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.species.scientificName" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' columns='2' weightx='1.0'>
+ <JTextField id="fieldSpeciesScientificName" text='getBean().getScientificName()' onKeyTyped='getBean().setScientificName(fieldSpeciesScientificName.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.species.rubbinCode" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' columns='2' weightx='1.0'>
+ <JTextField id="fieldSpeciesCodeRubbin" text='getBean().getCodeRubbin()' onKeyTyped='getBean().setCodeRubbin(fieldSpeciesCodeRubbin.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.species.cee" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' columns='2' weightx='1.0'>
+ <JTextField id="fieldSpeciesCEE" text='getBean().getCodeCEE()' onKeyTyped='getBean().setCodeCEE(Integer.parseInt(fieldSpeciesCEE.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.species.structured" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JRadioButton id="fieldSpeciesDynamicAge" text="isisfish.species.age" selected='{getBean().getAgeGroupType()}' buttonGroup="structuredGroup" onItemStateChanged='getBean().setAgeGroupType(fieldSpeciesDynamicAge.isSelected())' enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JRadioButton id="fieldSpeciesDynamicLength" text="isisfish.species.length" selected='{!getBean().getAgeGroupType()}' buttonGroup="structuredGroup" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.species.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' columns='2' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JTextArea id="fieldSpeciesComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldSpeciesComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,167 +31,101 @@
*/
-->
-<JPanel layout='{new BorderLayout()}' implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
-
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.StrategyMonthInfo;
- import fr.ifremer.isisfish.types.Month;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
+import fr.ifremer.isisfish.types.Month;
- init();
- public StrategyMonthInfoUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh() {
- strategyJanuary.init(Month.JANUARY);
- strategyFebuary.init(Month.FEBRUARY);
- strategyMarch.init(Month.MARCH);
- strategyApril.init(Month.APRIL);
- strategyMay.init(Month.MAY);
- strategyJune.init(Month.JUNE);
- strategyJuly.init(Month.JULY);
- strategyAugust.init(Month.AUGUST);
- strategySeptember.init(Month.SEPTEMBER);
- strategyOctober.init(Month.OCTOBER);
- strategyNovember.init(Month.NOVEMBER);
- strategyDecember.init(Month.DECEMBER);
- strategyJanuary.refresh();
- strategyFebuary.refresh();
- strategyMarch.refresh();
- strategyApril.refresh();
- strategyMay.refresh();
- strategyJune.refresh();
- strategyJuly.refresh();
- strategyAugust.refresh();
- strategySeptember.refresh();
- strategyOctober.refresh();
- strategyNovember.refresh();
- strategyDecember.refresh();
- }
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- strategyJanuary.setActif((Boolean)evt.getNewValue());
- strategyFebuary.setActif((Boolean)evt.getNewValue());
- strategyMarch.setActif((Boolean)evt.getNewValue());
- strategyApril.setActif((Boolean)evt.getNewValue());
- strategyMay.setActif((Boolean)evt.getNewValue());
- strategyJune.setActif((Boolean)evt.getNewValue());
- strategyJuly.setActif((Boolean)evt.getNewValue());
- strategyAugust.setActif((Boolean)evt.getNewValue());
- strategySeptember.setActif((Boolean)evt.getNewValue());
- strategyOctober.setActif((Boolean)evt.getNewValue());
- strategyNovember.setActif((Boolean)evt.getNewValue());
- strategyDecember.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- strategyJanuary.setChanged((Boolean)evt.getNewValue());
- strategyFebuary.setChanged((Boolean)evt.getNewValue());
- strategyMarch.setChanged((Boolean)evt.getNewValue());
- strategyApril.setChanged((Boolean)evt.getNewValue());
- strategyMay.setChanged((Boolean)evt.getNewValue());
- strategyJune.setChanged((Boolean)evt.getNewValue());
- strategyJuly.setChanged((Boolean)evt.getNewValue());
- strategyAugust.setChanged((Boolean)evt.getNewValue());
- strategySeptember.setChanged((Boolean)evt.getNewValue());
- strategyOctober.setChanged((Boolean)evt.getNewValue());
- strategyNovember.setChanged((Boolean)evt.getNewValue());
- strategyDecember.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$strategies/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- public void valueChanged(boolean b){
- getParentContainer(StrategyUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+setType("Population");
+setButtonTitle("");
+setNextPath(null);
+public void refresh() {
+ strategyJanuary.init(Month.JANUARY);
+ strategyFebuary.init(Month.FEBRUARY);
+ strategyMarch.init(Month.MARCH);
+ strategyApril.init(Month.APRIL);
+ strategyMay.init(Month.MAY);
+ strategyJune.init(Month.JUNE);
+ strategyJuly.init(Month.JULY);
+ strategyAugust.init(Month.AUGUST);
+ strategySeptember.init(Month.SEPTEMBER);
+ strategyOctober.init(Month.OCTOBER);
+ strategyNovember.init(Month.NOVEMBER);
+ strategyDecember.init(Month.DECEMBER);
+ strategyJanuary.refresh();
+ strategyFebuary.refresh();
+ strategyMarch.refresh();
+ strategyApril.refresh();
+ strategyMay.refresh();
+ strategyJune.refresh();
+ strategyJuly.refresh();
+ strategyAugust.refresh();
+ strategySeptember.refresh();
+ strategyOctober.refresh();
+ strategyNovember.refresh();
+ strategyDecember.refresh();
+}
]]></script>
- <Table constraints='BorderLayout.CENTER'>
- <row>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyJanuary' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyFebuary' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyMarch' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyApril' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyMay' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyJune' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyJuly' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyAugust' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategySeptember' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyOctober' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyNovember' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- <cell fill='both' weightx='0.25' weighty='0.3'>
- <StrategyOneMonthInfoUI id='strategyDecember' constructorParams='getContextValue(InputAction.class)'/>
- </cell>
- </row>
- </Table>
+ <JPanel id='body'>
+ <Table constraints='BorderLayout.CENTER'>
+ <row>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyJanuary' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyFebuary' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyMarch' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyApril' constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyMay' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyJune' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyJuly' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyAugust' constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategySeptember' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyOctober' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyNovember' constructorParams='this'/>
+ </cell>
+ <cell fill='both' weightx='0.25' weighty='0.3'>
+ <StrategyOneMonthInfoUI id='strategyDecember' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
- <!--
- |
- | Button action
- |
- +-->
- <Table constraints='BorderLayout.SOUTH'>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' enabled='{isChanged()}' text="isisfish.common.save" onActionPerformed='save()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' enabled='{isChanged()}' text="isisfish.common.cancel" onActionPerformed='cancel()'/>
- </cell>
- </row>
- </Table>
-</JPanel>
\ No newline at end of file
+ <!--
+ |
+ | Button action
+ |
+ +-->
+ <Table constraints='BorderLayout.SOUTH'>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,136 +31,94 @@
*/
-->
-<Table implements='InputContent'>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <Boolean id='changed' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.StrategyImpl id='bean' javaBean='null'/>
+ <fr.ifremer.isisfish.entities.StrategyMonthInfoImpl id='strategyMonthInfo' javaBean='null'/>
+
<script><![CDATA[
- import fr.ifremer.isisfish.entities.StrategyMonthInfo;
- import fr.ifremer.isisfish.entities.Strategy;
- import fr.ifremer.isisfish.types.Month;
- import fr.ifremer.isisfish.entities.TripType;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.entities.StrategyMonthInfo;
+import fr.ifremer.isisfish.entities.StrategyMonthInfoImpl;
+import fr.ifremer.isisfish.entities.Strategy;
+import fr.ifremer.isisfish.entities.StrategyImpl;
+import fr.ifremer.isisfish.types.Month;
+import fr.ifremer.isisfish.entities.TripType;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- protected StrategyMonthInfo strategyMonthInfo = null;
- Month month = null;
- PropertyChangeListener listener = null;
-
- public StrategyOneMonthInfoUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh() {
- Strategy strategy = getContextValue(InputAction.class).getStrategy();
- if (strategy != null && month != null){
- strategyMonthInfo = strategy.getStrategyMonthInfo(month);
- setFieldStrategyMonthInfoTripTypeModel();
- numberOfTrips.setText(strategyMonthInfo.getNumberOfTrips() + "");
- fieldStrategyMonthInfoMinInactivityDays.setText(strategyMonthInfo.getMinInactivityDays() + "");
- setFieldStrategyMonthInfoProportionModel();
- valueChanged(false);
- }
- else{
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- fieldStrategyMonthInfoTripType.setModel(model);
+Month month = null;
+PropertyChangeListener listener = null;
+
+setType("Strategy");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
numberOfTrips.setText("");
fieldStrategyMonthInfoMinInactivityDays.setText("");
fieldStrategyMonthInfoProportion.setMatrix(null);
- valueChanged(false);
}
- }
- public void init(Month m){
- month = m;
- }
- protected void setFieldStrategyMonthInfoTripTypeModel(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- TripType selected = strategyMonthInfo.getTripType();
- GenericCell cellSelected = null;
- for (TripType t : getContextValue(InputAction.class).getFisheryRegion().getTripType()){
- GenericCell g = new GenericCell(t.getName(),t,TripType.class);
- model.addElement(g);
- if (selected != null){
- if (t.getName().equals(selected.getName())){
- cellSelected = g;
- }
- }
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- fieldStrategyMonthInfoTripType.setModel(model);
- if (cellSelected != null){
- fieldStrategyMonthInfoTripType.setSelectedItem(cellSelected);
- }
}
- protected void setFieldStrategyMonthInfoProportionModel(){
- if (strategyMonthInfo != null){
- fieldStrategyMonthInfoProportion.setMatrix(strategyMonthInfo.getProportionMetier());
- if (listener == null){
- strategyMonthInfo.addPropertyChangeListener(getListener());
- }
+});
+fieldStrategyMonthInfoProportion.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (fieldStrategyMonthInfoProportion.getMatrix() != null){
+ getStrategyMonthInfo().setProportionMetier(fieldStrategyMonthInfoProportion.getMatrix());
}
}
- protected PropertyChangeListener getListener(){
- listener = new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (fieldStrategyMonthInfoProportion.getMatrix() != null){
- strategyMonthInfo.setProportionMetier(fieldStrategyMonthInfoProportion.getMatrix());
- valueChanged(true);
- }
- }
- };
- return listener;
- }
- protected void tripTypeChanged(){
- Object selected = fieldStrategyMonthInfoTripType.getSelectedItem();
- if (selected != null){
- TripType tripTypeSelected = (TripType)((GenericCell)selected).getValue();
- strategyMonthInfo.setTripType(tripTypeSelected);
- valueChanged(true);
- }
- }
- protected void minInactivityDayChanged(){
- strategyMonthInfo.setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()));
- valueChanged(true);
- refresh();
- }
- protected void valueChanged(boolean b){
- getParentContainer(StrategyMonthInfoUI.class).valueChanged(b);
- }
+});
+public void refresh() {
+ Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class);
+ setBean((StrategyImpl) strategy);
+ setStrategyMonthInfo((StrategyMonthInfoImpl)getBean().getStrategyMonthInfo(month));
+ jaxx.runtime.swing.Utils.fillComboBox(fieldStrategyMonthInfoTripType,getRegion().getTripType(), getStrategyMonthInfo().getTripType());
+}
+public void init(Month m){
+ month = m;
+}
]]></script>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0' anchor='west'>
- <JLabel id='StrategieMonth' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldStrategyMonthInfoTripType" onActionPerformed='tripTypeChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5' anchor='west'>
- <JLabel text="isisfish.strategyMonthInfo.numberOfTrips" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5' anchor='west'>
- <JLabel id='numberOfTrips' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5' anchor='west'>
- <JLabel text="isisfish.strategyMonthInfo.minInactivityDays" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JTextField id="fieldStrategyMonthInfoMinInactivityDays" onKeyTyped='valueChanged(true)' onFocusLost='minInactivityDayChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
- <org.codelutin.math.matrix.gui.MatrixPanelEditor id="fieldStrategyMonthInfoProportion" enabled='{isActif()}'/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0' anchor='west'>
+ <JLabel id='StrategieMonth' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldStrategyMonthInfoTripType" onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5' anchor='west'>
+ <JLabel text="isisfish.strategyMonthInfo.numberOfTrips" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5' anchor='west'>
+ <JLabel id='numberOfTrips' text='getStrategyMonthInfo().getNumberOfTrips()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5' anchor='west'>
+ <JLabel text="isisfish.strategyMonthInfo.minInactivityDays" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='getStrategyMonthInfo().getMinInactivityDays()' onKeyTyped='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weightx='1.0' weighty='1.0'>
+ <org.codelutin.math.matrix.gui.MatrixPanelEditor id="fieldStrategyMonthInfoProportion" matrix='{getStrategyMonthInfo().getProportionMetier()}' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,250 +31,168 @@
*/
-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.StrategyImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Equation;
- import fr.ifremer.isisfish.entities.Formule;
- import fr.ifremer.isisfish.entities.SetOfVessels;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import java.util.logging.Level;
- import java.util.logging.Logger;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.StrategyImpl;
+import fr.ifremer.isisfish.entities.Strategy;
+import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.SetOfVessels;
+import org.codelutin.topia.persistence.TopiaEntity;
+import fr.ifremer.isisfish.ui.WelcomePanelUI;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import java.util.logging.Level;
+import java.util.logging.Logger;
- public StrategyTabUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh() {
- fr.ifremer.isisfish.entities.Strategy strategy = getContextValue(InputAction.class).getStrategy();
- if (strategy != null){
- fieldStrategyName.setText(strategy.getName());
- setSetOfVesselsModel(strategy);
- fieldStrategyProportionSetOfVessels.setText(strategy.getProportionSetOfVessels() + "");
- setInactivityModel();
- fieldUseEquationInactivity.setSelected(strategy.getInactivityEquationUsed());
- fieldStrategyComment.setText(strategy.getComment());
- }
- else{
- fieldStrategyName.setText("");
- fieldStrategySetOfVessels.setModel(new DefaultComboBoxModel());
+setType("Strategy");
+setButtonTitle("");
+setNextPath(null);
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");fieldPopulationBasicsName.setText("");
+ fieldStrategyName.setText("");
fieldStrategyProportionSetOfVessels.setText("0.0");
- fieldStrategyInactivity.setModel(new DefaultComboBoxModel());
fieldStrategyComment.setText("");
}
- valueChanged(false);
- try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
- Logger.getLogger(StrategyTabUI.class.getName()).log(Level.SEVERE, null, ex);
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
}
- protected void setInactivityModel(){
- java.util.List<Formule> formules = getContextValue(InputAction.class).getFormules("Inactivity");
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- for (Formule f : formules){
- model.addElement(new GenericCell(f.getName(),f,Formule.class));
- }
- fieldStrategyInactivity.setModel(model);
+});
+public void refresh() {
+ Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class);
+ setBean((StrategyImpl) strategy);
+ setSetOfVesselsModel();
+ setInactivityModel();
+ try {
+ editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
+ } catch (IOException ex) {
+ Logger.getLogger(StrategyTabUI.class.getName()).log(Level.SEVERE, null, ex);
}
- protected void setSetOfVesselsModel(fr.ifremer.isisfish.entities.Strategy s){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- java.util.List<SetOfVessels> value = getContextValue(InputAction.class).getFisheryRegion().getSetOfVessels();
- SetOfVessels selected = s.getSetOfVessels();
- GenericCell selectedCell = null;
- for (SetOfVessels sov : value){
- GenericCell cell = new GenericCell(sov.getName(), sov, SetOfVessels.class);
- model.addElement(cell);
- if (selected != null){
- if (sov.getName().equals(selected.getName())){
- selectedCell = cell;
- }
- }
- }
- fieldStrategySetOfVessels.setModel(model);
- if (selectedCell != null){
- fieldStrategySetOfVessels.setSelectedItem(selectedCell);
- }
- }
- protected void nameChanged(){
- getContextValue(InputAction.class).getStrategy().setName(fieldStrategyName.getText());
- }
- protected void setOfVesselsChanged(){
- Object o = fieldStrategySetOfVessels.getSelectedItem();
- if (o != null){
- getContextValue(InputAction.class).getStrategy().setSetOfVessels((SetOfVessels)((GenericCell)o).getValue());
- }
- }
- protected void proportionSetOfVesselsChanged(){
- getContextValue(InputAction.class).getStrategy().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()));
- }
- protected void useInactivityChanged(){
- getContextValue(InputAction.class).getStrategy().setInactivityEquationUsed(fieldUseEquationInactivity.isSelected());
- }
- protected void inactivityChanged(){
- Object o = fieldStrategyInactivity.getSelectedItem();
- if (o != null){
- editor.setText(((Formule)((GenericCell)o).getValue()).getContent());
- }
- }
- protected void commentChanged(){
- getContextValue(InputAction.class).getSetOfVessels().setName(fieldStrategyName.getText());
- }
- protected void saveModel(){
+}
+protected void setInactivityModel(){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldStrategyInactivity,getAction().getFormules(getBean().getTopiaContext(), "Inactivity"), null);
+}
+protected void setSetOfVesselsModel(){
+ jaxx.runtime.swing.Utils.fillComboBox(fieldStrategySetOfVessels,getRegion().getSetOfVessels(), getBean().getSetOfVessels());
+}
+protected void saveModel(){
// 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(){
- 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");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$strategies/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$strategies/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$strategies");
- valueChanged(false);
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- getParentContainer(StrategyUI.class).setChanged(b);
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
+ getAction().saveAsModel("StrategyInactivityEquation", "Java", editor.getText());
+ setInactivityModel();
+ setInfoText(_("isisfish.message.saveModel.finished"));
+}
]]></script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell anchor='west'>
- <JLabel text="isisfish.strategy.name" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldStrategyName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='west'>
- <JLabel text="isisfish.common.setOfVessels" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldStrategySetOfVessels" onActionPerformed='setOfVesselsChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='west'>
- <JLabel text="isisfish.strategy.proportionSetOfVessels" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldStrategyProportionSetOfVessels" onKeyTyped='valueChanged(true)' onFocusLost='proportionSetOfVesselsChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JPanel/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JCheckBox id="fieldUseEquationInactivity" text="isisfish.strategy.inactivityEquationUsed" onActionPerformed='useInactivityChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='west'>
- <JLabel text="isisfish.strategy.inactivity" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JComboBox id="fieldStrategyInactivity" onActionPerformed='inactivityChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='0.7'>
- <Table>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal'>
- <JButton text="isisfish.common.openEditor" onActionPerformed='openEditor()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell fill='both' weighty='1.0'>
- <JPanel/>
- </cell>
- </row>
- </Table>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.7'>
- <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell anchor='west'>
- <JLabel text="isisfish.strategy.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='0.3'>
- <JScrollPane>
- <JTextArea id="fieldStrategyComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell anchor='west'>
+ <JLabel text="isisfish.strategy.name" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldStrategyName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldStrategyName.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='west'>
+ <JLabel text="isisfish.common.setOfVessels" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldStrategySetOfVessels" onActionPerformed='getBean().setSetOfVessels((SetOfVessels)fieldStrategySetOfVessels.getSelectedItem())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='west'>
+ <JLabel text="isisfish.strategy.proportionSetOfVessels" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldStrategyProportionSetOfVessels" text='getBean().getProportionSetOfVessels()' onKeyTyped='getBean().setProportionSetOfVessels(Double.parseDouble(fieldStrategyProportionSetOfVessels.getText()))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JPanel/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JCheckBox id="fieldUseEquationInactivity" selected='{getBean().getInactivityEquationUsed()}' text="isisfish.strategy.inactivityEquationUsed" onActionPerformed='getBean().setInactivityEquationUsed(fieldUseEquationInactivity.isSelected())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='west'>
+ <JLabel text="isisfish.strategy.inactivity" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JComboBox id="fieldStrategyInactivity" onActionPerformed='editor.setText(((Formule)fieldStrategyInactivity.getSelectedItem()).getContent())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='0.7'>
+ <Table>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.saveModel" onActionPerformed='saveModel()' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal'>
+ <JButton text="isisfish.common.openEditor" onActionPerformed='getAction().openEditor("StrategyInactivityEquation","new",fr.ifremer.isisfish.equation.StrategyInactivityEquation.class, editor.getText(), editor)' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='both' weighty='1.0'>
+ <JPanel/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.7'>
+ <org.codelutin.widget.editor.Editor id='editor' askIfNotSaved="false" enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='west'>
+ <JLabel text="isisfish.strategy.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='0.3'>
+ <JScrollPane>
+ <JTextArea id="fieldStrategyComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldStrategyComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -34,39 +34,17 @@
<!--
+ Strategy
+-->
-<JTabbedPane id="StrategyTab" name="Strategy" implements='InputContent'>
-
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
-
- <Boolean id='changed' javaBean='false'/>
-
+<fr.ifremer.isisfish.ui.input.InputContentUI>
<script><![CDATA[
- init();
- public StrategyUI (InputAction action){
- setContextValue(action);
- }
public void refresh() {
strategyTabUI.refresh();
strategyMonthInfoUI.refresh();
}
- protected void init(){
- this.addPropertyChangeListener("actif", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- strategyTabUI.setActif((Boolean)evt.getNewValue());
- strategyMonthInfoUI.setActif((Boolean)evt.getNewValue());
- }
- });
- this.addPropertyChangeListener("changed", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- strategyTabUI.setChanged((Boolean)evt.getNewValue());
- strategyMonthInfoUI.setChanged((Boolean)evt.getNewValue());
- }
- });
- }
]]></script>
- <tab title='{_("isisfish.strategy.title")}'><StrategyTabUI id='strategyTabUI' constructorParams='getContextValue(InputAction.class)'/></tab>
- <tab title='{_("isisfish.strategyMonthInfo.title")}'><StrategyMonthInfoUI id='strategyMonthInfoUI' constructorParams='getContextValue(InputAction.class)'/></tab>
-</JTabbedPane>
+ <JPanel id='body' layout='{new BorderLayout()}'>
+ <JTabbedPane id="StrategyTab" name="Strategy" constraints='BorderLayout.CENTER'>
+ <tab title='{_("isisfish.strategy.title")}'><StrategyTabUI id='strategyTabUI' constructorParams='this'/></tab>
+ <tab title='{_("isisfish.strategyMonthInfo.title")}'><StrategyMonthInfoUI id='strategyMonthInfoUI' constructorParams='this'/></tab>
+ </JTabbedPane>
+ </JPanel>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -33,162 +33,104 @@
<!--
+ TripType
+-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.TripTypeImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.entities.TripType;
- import fr.ifremer.isisfish.entities.VesselType;
- import fr.ifremer.isisfish.types.TimeUnit;
+import fr.ifremer.isisfish.entities.TripType;
+import fr.ifremer.isisfish.entities.TripTypeImpl;
+import fr.ifremer.isisfish.types.TimeUnit;
- public TripTypeUI (InputAction action){
-
- setContextValue(action);
- }
- public void refresh() {
- if (getContextValue(InputAction.class).getTripType() != null){
- fieldTripTypeName.setText(getContextValue(InputAction.class).getTripType().getName());
- fieldTripTypeDuration.setText("" + getContextValue(InputAction.class).getTripType().getTripDuration().getHour());
- fieldTripTypeMinTimeBetweenTrip.setText("" + getContextValue(InputAction.class).getTripType().getMinTimeBetweenTrip().getHour());
- fieldTripTypeComment.setText(getContextValue(InputAction.class).getTripType().getComment());
- }
- else{
+setType("TripType");
+setButtonTitle("isisfish.input.continueZones");
+setNextPath("$root/$zones");
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldTripTypeName.setText("");
fieldTripTypeDuration.setText("");
fieldTripTypeMinTimeBetweenTrip.setText("");
fieldTripTypeComment.setText("");
}
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
+ }
}
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- changed=b;
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
- protected void nameChanged(){
- getContextValue(InputAction.class).getTripType().setName(fieldTripTypeName.getText());
- valueChanged(true);
- }
- protected void typeDurationChanged(){
- 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()) * 3600));
- valueChanged(true);
- }
- protected void commentChanged(){
- getContextValue(InputAction.class).getTripType().setComment(fieldTripTypeComment.getText());
- valueChanged(true);
- }
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("TripType");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$tripTypes/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
- }
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$tripTypes/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$tripTypes");
- valueChanged(false);
- refresh();
- }
- protected void goToVesselTypes(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$vesselTypes");
- }
+});
+public void refresh() {
+ TripType tripType = (TripType)getVerifier().getEntity(TripType.class);
+ setBean((TripTypeImpl) tripType);
+}
]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <Table>
- <row>
- <cell>
- <JLabel text="isisfish.tripType.name" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldTripTypeName" onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.tripType.duration" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldTripTypeDuration" onKeyTyped='valueChanged(true)' onFocusLost='typeDurationChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.tripType.minTime" enabled='{isActif()}'/>
- </cell>
- <cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldTripTypeMinTimeBetweenTrip" onKeyTyped='valueChanged(true)' onFocusLost='minTimeChanged()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text="isisfish.tripType.comments" enabled='{isActif()}'/>
- </cell>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JScrollPane>
- <JTextArea id="fieldTripTypeComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <Table>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
- </cell>
- </row>
- <row>
- <cell columns ='2' fill='horizontal' weightx='1.0'>
- <JButton text="isisfish.input.continueVesselTypes" onActionPerformed='goToVesselTypes()'/>
- </cell>
- </row>
- </Table>
- </cell>
- </row>
-</Table>
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="isisfish.tripType.name" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldTripTypeName" text='getBean().getName()' onKeyTyped='getBean().setName(fieldTripTypeName.getText())' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.tripType.duration" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldTripTypeDuration" text='getBean().getTripDuration().getHour()' onKeyTyped='getBean().setTripDuration(new TimeUnit(Double.parseDouble(fieldTripTypeDuration.getText()) * 3600))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.tripType.minTime" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldTripTypeMinTimeBetweenTrip" text='getBean().getMinTimeBetweenTrip().getHour()' onKeyTyped='getBean().setMinTimeBetweenTrip(new TimeUnit(Double.parseDouble(fieldTripTypeMinTimeBetweenTrip.getText()) * 3600))' enabled='{isActif()}'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="isisfish.tripType.comments" enabled='{isActif()}'/>
+ </cell>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JScrollPane>
+ <JTextArea id="fieldTripTypeComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldTripTypeComment.getText())' enabled='{isActif()}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='1.0'>
+ <Table>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -31,39 +31,26 @@
*/
-->
-<JPanel layout='{new BorderLayout()}' implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.VesselTypeImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.VesselType;
- import fr.ifremer.isisfish.entities.TripType;
- import fr.ifremer.isisfish.ui.WelcomePanelUI;
- import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
- import org.codelutin.topia.persistence.TopiaEntity;
- import fr.ifremer.isisfish.types.TimeUnit;
-
- public VesselTypeUI (InputAction action){
- setContextValue(action);
- }
- public void refresh() {
- VesselType vesselType = getContextValue(InputAction.class).getVesselType();
- setVesselTypeTripTypeModel();
- if (vesselType != null){
- fieldVesselTypeName.setText(vesselType.getName());
- fieldVesselTypeLength.setText("" + vesselType.getLength());
- fieldVesselTypeSpeed.setText("" + vesselType.getSpeed());
- fieldVesselTypeMaxTripDuration.setText("" + vesselType.getMaxTripDuration().getHour());
- fieldVesselTypeActivityRange.setText("" + vesselType.getActivityRange());
- fieldVesselTypeMinCrewSize.setText("" + vesselType.getMinCrewSize());
- fieldVesselTypeSpeed.setText("" + vesselType.getSpeed());
- fieldVesselTypeUnitFuelCostOfTravel.setText("" + vesselType.getUnitFuelCostOfTravel());
- fieldVesselTypeComment.setText(vesselType.getComment());
- }
- else {
+import fr.ifremer.isisfish.entities.VesselType;
+import fr.ifremer.isisfish.entities.VesselTypeImpl;
+import fr.ifremer.isisfish.entities.TripType;
+import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
+import fr.ifremer.isisfish.types.TimeUnit;
+
+setType("VesselType");
+setButtonTitle("isisfish.input.continueZones");
+setNextPath("$root/$zones");
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldVesselTypeName.setText("");
fieldVesselTypeLength.setText("");
fieldVesselTypeSpeed.setText("");
@@ -73,100 +60,28 @@
fieldVesselTypeSpeed.setText("");
fieldVesselTypeUnitFuelCostOfTravel.setText("");
fieldVesselTypeComment.setText("");
-
}
- }
- protected void setVesselTypeTripTypeModel(){
- java.util.List<TripType> tripTypes = getContextValue(InputAction.class).getFisheryRegion().getTripType();
- DefaultListModel model = new DefaultListModel();
- for (TripType t : tripTypes){
- model.addElement(new GenericCell(t.getName(), t, TripType.class));
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- vesselTypeTripType.setModel(model);
}
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("VesselType");
-
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$vesselTypes/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
+});
+public void refresh() {
+ VesselType vesselType = (VesselType)getVerifier().getEntity(VesselType.class);
+ setBean((VesselTypeImpl) vesselType);
+ jaxx.runtime.swing.Utils.fillList(vesselTypeTripType, getRegion().getTripType(), getBean().getTripType());
+}
+protected void tripTypeChanged(){
+ Object[] values = vesselTypeTripType.getSelectedValues();
+ Collection<TripType> tripTypes = new LinkedList<TripType>();
+ for (Object o : values){
+ tripTypes.add((TripType)((GenericCell)o).getValue());
}
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$vesselTypes/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
- }
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
- }
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$vesselTypes");
- valueChanged(false);
- refresh();
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void valueChanged(boolean b){
- changed = b;
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
- protected void goToSetOfVessels(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$setOfVessels");
- }
- protected void nameChanged(){
- getContextValue(InputAction.class).getVesselType().setName(fieldVesselTypeName.getText());
- valueChanged(true);
- }
- protected void lenghtChanged(){
- getContextValue(InputAction.class).getVesselType().setLength(Integer.parseInt(fieldVesselTypeLength.getText()));
- valueChanged(true);
- }
- protected void speedChanged(){
- getContextValue(InputAction.class).getVesselType().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()));
- valueChanged(true);
- }
- protected void tripDurationChanged(){
- getContextValue(InputAction.class).getVesselType().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText())));
- valueChanged(true);
- }
- protected void activityRangeChanged(){
- getContextValue(InputAction.class).getVesselType().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()));
- valueChanged(true);
- }
- protected void minCrewChanged(){
- getContextValue(InputAction.class).getVesselType().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()));
- valueChanged(true);
- }
- protected void unitFuelCostChanged(){
- getContextValue(InputAction.class).getVesselType().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()));
- valueChanged(true);
- }
- protected void tripTypeChanged(){
- Object[] values = vesselTypeTripType.getSelectedValues();
- Collection<TripType> tripTypes = new LinkedList<TripType>();
- for (Object o : values){
- tripTypes.add((TripType)((GenericCell)o).getValue());
- }
- getContextValue(InputAction.class).getVesselType().setTripType(tripTypes);
- valueChanged(true);
- }
- protected void commentChanged(){
- getContextValue(InputAction.class).getVesselType().setComment(fieldVesselTypeComment.getText());
- valueChanged(true);
- }
+ getBean().setTripType(tripTypes);
+}
]]></script>
- <Table constraints='BorderLayout.CENTER'>
+ <Table id='body' constraints='BorderLayout.CENTER'>
<row>
<cell fill='both' weightx='1.0' weighty='1.0'>
<Table>
@@ -175,7 +90,7 @@
<JLabel text="isisfish.vesselType.name" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeName" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='nameChanged()'/>
+ <JTextField id="fieldVesselTypeName" text='getBean().getName()' enabled='{isActif()}' onKeyTyped='getBean().setName(fieldVesselTypeName.getText())'/>
</cell>
</row>
<row>
@@ -183,7 +98,7 @@
<JLabel text="isisfish.vesselType.length" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeLength" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='lenghtChanged()'/>
+ <JTextField id="fieldVesselTypeLength" text='getBean().getLength()' enabled='{isActif()}' onKeyTyped='getBean().setLength(Integer.parseInt(fieldVesselTypeLength.getText()))'/>
</cell>
</row>
<row>
@@ -191,7 +106,7 @@
<JLabel text="isisfish.vesselType.speed" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeSpeed" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='speedChanged()'/>
+ <JTextField id="fieldVesselTypeSpeed" text='getBean().getSpeed()' enabled='{isActif()}' onKeyTyped='getBean().setSpeed(Double.parseDouble(fieldVesselTypeSpeed.getText()))'/>
</cell>
</row>
<row>
@@ -199,7 +114,7 @@
<JLabel text="isisfish.vesselType.maxDuration" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeMaxTripDuration" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='tripDurationChanged()'/>
+ <JTextField id="fieldVesselTypeMaxTripDuration" text='getBean().getMaxTripDuration().getHour()' enabled='{isActif()}' onKeyTyped='getBean().setMaxTripDuration(new TimeUnit(Double.parseDouble(fieldVesselTypeMaxTripDuration.getText())))'/>
</cell>
</row>
<row>
@@ -207,7 +122,7 @@
<JLabel text="isisfish.vesselType.activityRange" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeActivityRange" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='activityRangeChanged()'/>
+ <JTextField id="fieldVesselTypeActivityRange" text='getBean().getActivityRange()' enabled='{isActif()}' onKeyTyped='getBean().setActivityRange(Double.parseDouble(fieldVesselTypeActivityRange.getText()))'/>
</cell>
</row>
<row>
@@ -215,7 +130,7 @@
<JLabel text="isisfish.vesselType.miniCrew" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeMinCrewSize" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='minCrewChanged()'/>
+ <JTextField id="fieldVesselTypeMinCrewSize" text='getBean().getMinCrewSize()' enabled='{isActif()}' onKeyTyped='getBean().setMinCrewSize(Integer.parseInt(fieldVesselTypeMinCrewSize.getText()))'/>
</cell>
</row>
<row>
@@ -223,7 +138,7 @@
<JLabel text="isisfish.vesselType.fuelCost" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" onKeyTyped='valueChanged(true)' onFocusLost='unitFuelCostChanged()' enabled='{isActif()}'/>
+ <JTextField id="fieldVesselTypeUnitFuelCostOfTravel" text='getBean().getUnitFuelCostOfTravel()' onKeyTyped='getBean().setUnitFuelCostOfTravel(Double.parseDouble(fieldVesselTypeUnitFuelCostOfTravel.getText()))' enabled='{isActif()}'/>
</cell>
</row>
<row>
@@ -242,7 +157,7 @@
</cell>
<cell fill='both' weightx='1.0' weighty='0.3'>
<JScrollPane>
- <JTextArea id="fieldVesselTypeComment" onKeyTyped='valueChanged(true)' onFocusLost='commentChanged()' enabled='{isActif()}'/>
+ <JTextArea id="fieldVesselTypeComment" text='getBean().getComment()' onKeyTyped='getBean().setComment(fieldVesselTypeComment.getText())' enabled='{isActif()}'/>
</JScrollPane>
</cell>
</row>
@@ -254,24 +169,22 @@
<Table>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" onActionPerformed='save()' enabled='{isChanged()}'/>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" onActionPerformed='cancel()' enabled='{isChanged()}'/>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
</cell>
</row>
<row>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
</cell>
<cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}'/>
+ <JButton id='delete' javaBean='getVerifier().getDeleteButton()'/>
</cell>
</row>
</Table>
</cell>
</row>
</Table>
- <JButton constraints='BorderLayout.SOUTH' text="isisfish.input.continueSetOfVessels" onActionPerformed='goToSetOfVessels()'/>
-</JPanel>
-
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -236,8 +236,8 @@
try {
// remove all old group
- Population pop = getContextValue(InputAction.class).getPopulation();
- TopiaContext isisContext = getContextValue(InputAction.class).getIsisContext();
+ Population pop = (Population)getContextValue(InputSaveVerifier.class).getEntity(Population.class);
+ TopiaContext isisContext = pop.getTopiaContext();
pop.clearPopulationGroup();
PopulationGroupDAO dao = IsisFishDAOHelper.getPopulationGroupDAO(isisContext);
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -35,232 +35,154 @@
<!--
+ Zone
+-->
-<Table implements='InputContent'>
+<fr.ifremer.isisfish.ui.input.InputContentUI>
- <!-- ui state when the activite is active -->
- <Boolean id='actif' javaBean='false'/>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.ZoneImpl id='bean' javaBean='null'/>
- <Boolean id='changed' javaBean='false'/>
-
<script><![CDATA[
- import fr.ifremer.isisfish.entities.Cell;
- import fr.ifremer.isisfish.entities.Zone;
- 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;
- import org.codelutin.topia.TopiaException;
- import java.util.logging.Level;
- import java.util.logging.Logger;
+import fr.ifremer.isisfish.entities.Cell;
+import fr.ifremer.isisfish.entities.Zone;
+import fr.ifremer.isisfish.entities.ZoneImpl;
+import fr.ifremer.isisfish.map.CellSelectionLayer;
+import com.bbn.openmap.event.SelectMouseMode;
+import com.bbn.openmap.event.MapMouseListener;
+import com.bbn.openmap.gui.OMToolSet;
- protected OpenMapToolPanel toolMap = new OpenMapToolPanel();
- protected OMToolSet toolSet = new OMToolSet();
- protected MapMouseListener mapListener = null;
+protected OMToolSet toolSet = new OMToolSet();
+protected MapMouseListener mapListener = null;
- public ZoneUI (InputAction action){
- setContextValue(action);
- }
- 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();
- for (Cell c : cells){
- zoneCellsModel.addElement(c);
- }
- zoneCells.setModel(zoneCellsModel);
- zoneCells.getSelectionModel().setValueIsAdjusting(true);
- java.util.List<Cell> cellsSelected = z.getCell();
- if (cellsSelected != null){
- int[] indexs = new int[cellsSelected.size()];
- int i = 0;
- for (Cell c : cellsSelected){
- indexs[i] = zoneCellsModel.indexOf(c);
- if (log.isDebugEnabled()) {
- log.debug("refresh " + c + " " + i);
- }
- i++;
- }
- zoneCells.setSelectedIndices(indexs);
- }
- zoneCells.getSelectionModel().setValueIsAdjusting(false);
- fieldZoneName.setText(z.getName());
- fieldZoneComment.setText(getContextValue(InputAction.class).getZone().getComment());
- }
- else{
- DefaultListModel zoneCellsModel = new DefaultListModel();
- java.util.List<Cell> cells = getContextValue(InputAction.class).getFisheryRegion().getCell();
- for (Cell c : cells){
- zoneCellsModel.addElement(c);
- }
- zoneCells.setModel(zoneCellsModel);
+setType("Zone");
+setButtonTitle("isisfish.input.continuePorts");
+setNextPath("$root/$ports");
+addPropertyChangeListener("bean", new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getOldValue() != null || evt.getNewValue() == null) {
+ // remove previous binding on getBean()
+ //jaxx.runtime.Util.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
fieldZoneName.setText("");
fieldZoneComment.setText("");
}
- zoneMap.setFisheryRegion(getContextValue(InputAction.class).getFisheryRegion());
- if (mapListener == null){
- zoneMap.setActiveMouseMode(new SelectMouseMode(false));
- zoneMap.setSelectionMode(CellSelectionLayer.MULT_SELECTION);
- toolSet.setupListeners(zoneMap);
- toolMap.add((Component)toolSet);
- map.add(toolMap, BorderLayout.NORTH);
- setMapListener();
+ if (evt.getNewValue() != null) {
+ // add binding on getBean()
+ //jaxx.runtime.Util.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text");
}
- refreshMap();
}
- protected void setMapListener(){
- if (mapListener == null){
- mapListener = new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) {
- @Override
- 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;
- }
- };
- zoneMap.addMapMouseListener(mapListener);
- }
- }
- protected void refreshMap(){
- if (getContextValue(InputAction.class).getZone() != null){
- zoneMap.setSelectedCells(getContextValue(InputAction.class).getZone().getCell());
- }
- }
- protected void create(){
- TopiaEntity topia = getContextValue(InputAction.class).create("Zone");
+});
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$zones/"+topia.getTopiaId());
-
- setInfoText(_("isisfish.message.creation.finished"));
+public void refresh() {
+ Zone zone = (Zone)getVerifier().getEntity(Zone.class);
+ setBean((ZoneImpl) zone);
+ jaxx.runtime.swing.Utils.fillList(zoneCells, getRegion().getCell(), getBean().getCell());
+ zoneMap.setFisheryRegion(getRegion());
+ if (mapListener == null){
+ zoneMap.setActiveMouseMode(new SelectMouseMode(false));
+ zoneMap.setSelectionMode(CellSelectionLayer.MULT_SELECTION);
+ toolSet.setupListeners(zoneMap);
+ toolMap.add((Component)toolSet);
+ setMapListener();
}
- protected void save(){
- TopiaEntity topia = getContextValue(InputAction.class).save();
- valueChanged(false);
- getParentContainer(InputUI.class).repaintNode("$root/$zones/" + topia.getTopiaId());
- setInfoText(_("isisfish.message.save.finished"));
- refresh();
+ refreshMap();
+}
+protected void setMapListener(){
+ if (mapListener == null){
+ mapListener = new OpenMapEvents(zoneMap, new SelectMouseMode(false), CellSelectionLayer.MULT_SELECTION) {
+ @Override
+ public boolean onMouseClicked() {
+ java.util.List<Cell> selectedCell = zoneMap.getSelectedCells();
+ getBean().setCell(selectedCell);
+ return true;
+ }
+ };
+ zoneMap.addMapMouseListener(mapListener);
}
- protected void cancel(){
- TopiaEntity topia = getContextValue(InputAction.class).cancel();
- valueChanged(false);
- refresh();
- setInfoText(_("isisfish.message.cancel.finished"));
+}
+protected void refreshMap(){
+ zoneMap.setSelectedCells(getBean().getCell());
+}
+protected void zoneCellsChange(){
+ java.util.List<Cell> cells = new ArrayList<Cell>();
+ for (Object o : zoneCells.getSelectedValues()){
+ cells.add((Cell) o);
}
- protected void remove(){
- setInfoText(getContextValue(InputAction.class).remove());
- getParentContainer(InputUI.class).setTreeModel();
- getParentContainer(InputUI.class).setTreeSelection("$root/$zones");
- valueChanged(false);
- refresh();
- }
- protected void goToPort(){
- getParentContainer(InputUI.class).setTreeSelection("$root/$ports");
- }
- protected void setInfoText(String txt){
- WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
- root.setInfoText(txt);
- }
- protected void commentChange(){
- getContextValue(InputAction.class).getZone().setComment(fieldZoneComment.getText());
- valueChanged(true);
- }
- protected void zoneCellsChange(){
- java.util.List<Cell> cells = new ArrayList<Cell>();
- for (Object o : zoneCells.getSelectedValues()){
- cells.add((Cell) o);
- }
- getContextValue(InputAction.class).getZone().setCell(cells);
- valueChanged(true);
- refreshMap();
- }
- protected void nameChange(){
- getContextValue(InputAction.class).getZone().setName(fieldZoneName.getText());
- }
- protected void valueChanged(boolean b){
- changed = b;
- save.setEnabled(b);
- cancel.setEnabled(b);
- }
- ]]>
+ getBean().setCell(cells);
+ refreshMap();
+}
+]]>
</script>
- <row>
- <cell fill='both' weightx='1.0' weighty='1.0'>
- <JSplitPane id="ZoneTab" name="Zones"
- oneTouchExpandable="true" dividerLocation="200" orientation="horizontal">
- <Table>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JLabel enabled='{isActif()}' text="isisfish.zone.name"/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JTextField id="fieldZoneName" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='nameChange()'/>
-<!-- onFocusLost='nameChange()' -->
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JLabel enabled='{isActif()}' text="isisfish.zone.cells"/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weighty='0.7' weightx='1.0'>
- <JScrollPane>
- <JList id="zoneCells" enabled='{isActif()}' onMouseClicked='zoneCellsChange()'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='horizontal' weightx='1.0'>
- <JLabel enabled='{isActif()}' text="isisfish.zone.comments"/>
- </cell>
- </row>
- <row>
- <cell columns='2' fill='both' weighty='0.3' weightx='1.0'>
- <JScrollPane>
- <JTextArea id="fieldZoneComment" enabled='{isActif()}' onKeyTyped='valueChanged(true)' onFocusLost='commentChange()'/>
- </JScrollPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='save' text="isisfish.common.save" enabled='{isChanged()}' onActionPerformed='save()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='cancel' text="isisfish.common.cancel" enabled='{isChanged()}' onActionPerformed='cancel()'/>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='create' text="isisfish.common.new" onActionPerformed='create()'/>
- </cell>
- <cell fill='horizontal' weightx='0.5'>
- <JButton id='remove' text="isisfish.common.remove" enabled='{isActif()}' onActionPerformed='remove()'/>
- </cell>
- </row>
- </Table>
- <JPanel id='map' layout='{new BorderLayout()}'>
- <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap' javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'/>
- </JPanel>
- </JSplitPane>
- </cell>
- </row>
- <row>
- <cell fill='horizontal' weightx='1.0'>
- <JButton text="isisfish.input.continuePorts" onActionPerformed='goToPort()'/>
- </cell>
- </row>
-</Table>
-
\ No newline at end of file
+ <Table id='body'>
+ <row>
+ <cell fill='both' weightx='1.0' weighty='1.0'>
+ <JSplitPane id="ZoneTab" name="Zones"
+ oneTouchExpandable="true" dividerLocation="200" orientation="horizontal">
+ <Table>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JLabel enabled='{isActif()}' text="isisfish.zone.name"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JTextField id="fieldZoneName"
+ text='{jaxx.runtime.Util.getStringValue(getBean().getName())}'
+ enabled='{isActif()}'
+ onKeyTyped='getBean().setName(fieldZoneName.getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JLabel enabled='{isActif()}' text="isisfish.zone.cells"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weighty='0.7' weightx='1.0'>
+ <JScrollPane>
+ <JList id="zoneCells" enabled='{isActif()}' onMouseClicked='zoneCellsChange()'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='horizontal' weightx='1.0'>
+ <JLabel enabled='{isActif()}' text="isisfish.zone.comments"/>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2' fill='both' weighty='0.3' weightx='1.0'>
+ <JScrollPane>
+ <JTextArea id="fieldZoneComment"
+ text='{jaxx.runtime.Util.getStringValue(getBean().getComment())}'
+ enabled='{isActif()}'
+ onKeyTyped='getBean().setComment(fieldZoneComment.getText())'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='save' javaBean='getVerifier().getSaveButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='cancel' javaBean='getVerifier().getCancelButton()'/>
+ </cell>
+ </row>
+ <row>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='create' javaBean='getVerifier().getNewButton()'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.5'>
+ <JButton id='remove' javaBean='getVerifier().getDeleteButton()'/>
+ </cell>
+ </row>
+ </Table>
+ <JPanel id='map' layout='{new BorderLayout()}'>
+ <fr.ifremer.isisfish.map.OpenMapToolPanel id='toolMap'
+ javaBean='new fr.ifremer.isisfish.map.OpenMapToolPanel()'
+ constraints='BorderLayout.NORTH'/>
+ <fr.ifremer.isisfish.map.IsisMapBean id='zoneMap'
+ javaBean='new fr.ifremer.isisfish.map.IsisMapBean()'
+ constraints='BorderLayout.CENTER'/>
+ </JPanel>
+ </JSplitPane>
+ </cell>
+ </row>
+ </Table>
+</fr.ifremer.isisfish.ui.input.InputContentUI>
\ No newline at end of file
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -322,7 +322,7 @@
<JScrollPane>
<javax.swing.JTree id="tree" name="tree" rootVisible="false" model='{getTreeModel()}'/>
</JScrollPane>
- <JSplitPane oneTouchExpandable="true" dividerLocation="250" orientation="VERTICAL">
+ <JSplitPane oneTouchExpandable="true" resizeWeight="0.75" orientation="VERTICAL">
<org.codelutin.widget.editor.Editor id='editor'/>
<JScrollPane>
<JTextArea id="actionLogArea" editable="false"/>
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 2009-01-02 17:19:42 UTC (rev 1723)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ExportUI.jaxx 2009-01-02 17:22:04 UTC (rev 1724)
@@ -34,6 +34,7 @@
<Table>
<script><![CDATA[
import jaxx.runtime.swing.Item;
+ import fr.ifremer.isisfish.ui.WelcomePanelUI;
refresh();
public ExportUI (SimulAction action){
@@ -66,6 +67,14 @@
getContextValue(SimulAction.class).getSimulationParameter().setExportNames(exportNames);
}
}
+ protected void saveExport(){
+ getContextValue(SimulAction.class).saveExport();
+ setInfoText(_("isisfish.export.saved"));
+ }
+ protected void setInfoText(String txt){
+ WelcomePanelUI root = getParentContainer(WelcomePanelUI.class);
+ root.setInfoText(txt);
+ }
]]>
</script>
<row>
@@ -86,7 +95,7 @@
<JButton text="isisfish.common.ellipsis" onActionPerformed='getContextValue(SimulAction.class).updateDirectory()'/>
</cell>
<cell>
- <JButton text="isisfish.common.saveNextSimulation" onActionPerformed='getContextValue(SimulAction.class).saveExport()'/>
+ <JButton text="isisfish.common.saveNextSimulation" onActionPerformed='saveExport()'/>
</cell>
</row>
</Table>
1
0
r1723 - isis-fish/trunk/src/main/resources/i18n
by sletellier@users.labs.libre-entreprise.org 02 Jan '09
by sletellier@users.labs.libre-entreprise.org 02 Jan '09
02 Jan '09
Author: sletellier
Date: 2009-01-02 17:19:42 +0000 (Fri, 02 Jan 2009)
New Revision: 1723
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:
Utilisation des binding
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-24 14:12:33 UTC (rev 1722)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-01-02 17:19:42 UTC (rev 1723)
@@ -51,6 +51,7 @@
Try\ to\ log\ on\ %s@%s\:%d=
Use\ branches,\ switch\ not\ needed=
User\ stop\ simulation\ %s=
+buttonTitle=\=\=\=\=\=\=
cant\ start\ nimbus=
could\ not\ close\ reader\ %1$s=could not close reader %1$s
could\ not\ create\ simulation\ filter\ model\ for\ reason\ %1$s=could not create simulation filter model for reason %1$s
@@ -64,6 +65,7 @@
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.
+getStrategyMonthInfo().getNumberOfTrips()=
isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2008.<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...
@@ -92,6 +94,7 @@
isisfish.common.clear=clear
isisfish.common.date=Date
isisfish.common.debug=debug
+isisfish.common.delete=\=\=\=\=\=\=
isisfish.common.ellipsis=ellipsis
isisfish.common.emigration=emigration
isisfish.common.empty=vide
@@ -345,6 +348,7 @@
isisfish.exit.text=Something has change, please enter a comment
isisfish.exit.title=Exit
isisfish.export.directory=Export directory
+isisfish.export.saved=Export saved
isisfish.export.title=Results export
isisfish.filter=Filter
isisfish.filter.apply=Apply filter
@@ -848,8 +852,8 @@
isisfish.simpleResult.table=defaultToolTip-fr.ifremer.isisfish.map.SimpleResultatMapBean.table12
isisfish.simulation.log.console.title=Log console for simulation '%1$s'
isisfish.simulation.log.showConsole=display log console for simulation %1$s
-isisfish.simulation.menu.import=Import simulation
-isisfish.simulation.menu.save=Save simulation
+isisfish.simulation.menu.import=Restor simulation parameter
+isisfish.simulation.menu.save=Save simulation parameter
isisfish.simulation.menu.simulation=Simulation
isisfish.simulation.name=Simulation name
isisfish.simulation.remote.message.connection=Connecting to Caparmor
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-24 14:12:33 UTC (rev 1722)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-01-02 17:19:42 UTC (rev 1723)
@@ -51,6 +51,7 @@
Try\ to\ log\ on\ %s@%s\:%d=
Use\ branches,\ switch\ not\ needed=
User\ stop\ simulation\ %s=
+buttonTitle=\=\=\=\=\=\=
cant\ start\ nimbus=
could\ not\ close\ reader\ %1$s=could not close reader %1$s
could\ not\ create\ simulation\ filter\ model\ for\ reason\ %1$s=could not create simulation filter model for reason %1$s
@@ -64,6 +65,7 @@
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.
+getStrategyMonthInfo().getNumberOfTrips()=
isisfish.about.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2008.<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...
@@ -92,6 +94,7 @@
isisfish.common.clear=Effacer
isisfish.common.date=Date
isisfish.common.debug=Debug
+isisfish.common.delete=Supprimer
isisfish.common.ellipsis=...
isisfish.common.emigration=\u00E9migration
isisfish.common.empty=vide
@@ -345,6 +348,7 @@
isisfish.exit.text=Quelque chose a chang\u00E9, merci de saisir un commentaire
isisfish.exit.title=Exit
isisfish.export.directory=Dossier d'export
+isisfish.export.saved=Exports des r\u00E9sultats sauvegard\u00E9s
isisfish.export.title=Export des r\u00E9sultats
isisfish.filter=Filtrer
isisfish.filter.apply=Appliquer le filtre
@@ -848,8 +852,8 @@
isisfish.simpleResult.table=defaultToolTip-fr.ifremer.isisfish.map.SimpleResultatMapBean.table12
isisfish.simulation.log.console.title=Console de log simulation '%1$s'
isisfish.simulation.log.showConsole=affichage de la console de log pour la simulation %1$s
-isisfish.simulation.menu.import=Importer une simulation
-isisfish.simulation.menu.save=Sauver la simulation
+isisfish.simulation.menu.import=Restaurer les param\u00E9tres d'une simulation
+isisfish.simulation.menu.save=Sauver les param\u00E8tres de la simulation
isisfish.simulation.menu.simulation=Simulation
isisfish.simulation.name=Nom de la simulation
isisfish.simulation.remote.message.connection=Connexion \u00E0 Caparmor
1
0
r1722 - in isis-fish/trunk/src/main: java/fr/ifremer/isisfish/datastore java/fr/ifremer/isisfish/simulator/launcher resources/i18n
by chatellier@users.labs.libre-entreprise.org 24 Dec '08
by chatellier@users.labs.libre-entreprise.org 24 Dec '08
24 Dec '08
Author: chatellier
Date: 2008-12-24 14:12:33 +0000 (Wed, 24 Dec 2008)
New Revision: 1722
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationExecutor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.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
Log:
Correction du thread de monitoring des simulations distantes
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java 2008-12-24 09:51:58 UTC (rev 1721)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/JavaSourceStorage.java 2008-12-24 14:12:33 UTC (rev 1722)
@@ -84,7 +84,8 @@
}
/**
- * Compile cette classe dans le répertoire par defaut de compilation ({@link IsisConfig#getCompileDirectory()})
+ * Compile cette classe dans le répertoire par defaut de compilation
+ * ({@link fr.ifremer.isisfish.IsisConfig#getCompileDirectory()})
*
* @param force si vrai alors meme si le fichier destination est plus recent
* la compilation aura lieu
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationExecutor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationExecutor.java 2008-12-24 09:51:58 UTC (rev 1721)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationExecutor.java 2008-12-24 14:12:33 UTC (rev 1722)
@@ -35,7 +35,7 @@
* <p>
* Les fonctionnalites en plus par rapport a un {@link ThreadPoolExecutor} sont:
* <li> la possibilite de suspendre l'executor puis ensuite de le relancer
- * <li> l'utilisation de beforeExecute pour fixer le {@link SimulationLauncher}
+ * <li> l'utilisation de beforeExecute pour fixer le {@link SimulatorLauncher}
* du job
* <p>
* Il est aussi possible d'ecoute l'etat de l'attribut pause
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-24 09:51:58 UTC (rev 1721)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java 2008-12-24 14:12:33 UTC (rev 1722)
@@ -137,6 +137,11 @@
control);
launchSimulation(sshSession, simulationService, control,
remotePath);
+
+ // force thread to stop
+ synchronized(control) {
+ control.stopSimulation();
+ }
}
} catch (JSchException e) {
if (log.isErrorEnabled()) {
@@ -487,10 +492,11 @@
while (true) {
while (in.available() > 0) {
int i = in.read(tmp, 0, 1024);
- if (i < 0)
+ if (i < 0) {
break;
+ }
if (log.isInfoEnabled()) {
- log.info(new String(tmp, 0, i));
+ log.info(_("isisfish.error.simulation.remote.output") + new String(tmp, 0, i));
}
}
if (channel.isClosed()) {
@@ -537,8 +543,8 @@
*/
protected class RemoteSSHControlThread implements Runnable {
- /** Sleep 2s */
- protected static final int SLEEPTIME = 2000;
+ /** Sleep 1s */
+ protected static final int SLEEPTIME = 1000;
/** Opened ssh session */
protected Session sshSession;
@@ -574,14 +580,28 @@
File controlFile = downloadControlFile(control.getId());
if (controlFile != null) {
- // on ne lit pas le stop, car le stop ne peut-etre appeler
- // que par l'utilisateur qui est de ce cote de la machine
- SimulationStorage.readControl(controlFile, control,
- "stop");
+ if(log.isDebugEnabled()) {
+ log.debug("Control have been downloaded : " + controlFile.getAbsolutePath());
+ }
+
+ synchronized (control) {
+ // le thread principal a pu le modifier pendant le sleep
+ if(control.isRunning()) {
+ // on ne lit pas le stop, car le stop ne peut-etre appeler
+ // que par l'utilisateur qui est de ce cote de la machine
+ SimulationStorage.readControl(controlFile, control,
+ "stop");
+ }
+ }
// deleteTempFile
controlFile.delete();
}
+ else {
+ if(log.isDebugEnabled()) {
+ log.debug("Control can't have been downloaded");
+ }
+ }
} catch (InterruptedException e) {
if (log.isErrorEnabled()) {
@@ -592,6 +612,7 @@
log.error("Error while reading control file", e);
}
}
+
synchronized (control) {
running = control.isRunning();
}
@@ -605,7 +626,7 @@
* ScpFrom code taken from :
* http://www.jcraft.com/jsch/examples/ScpFrom.java
*
- * @return downloaded temp file (file have to be manualy deleted)
+ * @return downloaded temp file (file have to be manually deleted)
* @throws IOException
*/
protected File downloadControlFile(String simulationId)
@@ -627,7 +648,7 @@
try {
// exec 'scp -f rfile' remotely
- String command = "scp -f " + remoteFile;
+ String command = "scp -f \"" + remoteFile + "\"";
Channel channel = sshSession.openChannel("exec");
((ChannelExec) channel).setCommand(command);
@@ -680,13 +701,15 @@
out.flush();
// read a content of lfile
- fos = new FileOutputStream(localFile);
+ fos = new FileOutputStream(tempFile);
int foo;
while (true) {
- if (buf.length < filesize)
+ if (buf.length < filesize) {
foo = buf.length;
- else
+ }
+ else {
foo = (int) filesize;
+ }
foo = in.read(buf, 0, foo);
if (foo < 0) {
// error
@@ -694,13 +717,14 @@
}
fos.write(buf, 0, foo);
filesize -= foo;
- if (filesize == 0L)
+ if (filesize == 0L) {
break;
+ }
}
fos.close();
fos = null;
- if (checkAck(in) != 0) {
+ if (checkAck(in) == 0) {
localFile = tempFile;
}
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-24 09:51:58 UTC (rev 1721)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-24 14:12:33 UTC (rev 1722)
@@ -316,6 +316,7 @@
isisfish.error.simulation.log.openAppender=could not open appender of simulation %1$s for reason %2$s
isisfish.error.simulation.remote.global=Can't launch a simulation on remote server
isisfish.error.simulation.remote.launch=An error occurs when launching remote simulation
+isisfish.error.simulation.remote.output=Caparmor >
isisfish.error.simulation.remote.upload=Can't upload simulation %s on %s@%s
isisfish.error.simulation.remote.upload.stream=Stream error detected \: %s
isisfish.error.simulation.remote.wrongportvalue=Connection port value is incorrect \: %s
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-24 09:51:58 UTC (rev 1721)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-24 14:12:33 UTC (rev 1722)
@@ -316,6 +316,7 @@
isisfish.error.simulation.log.openAppender=n'a pas pu ouvrir l'appender de la simulation %1$s pour la raison %2$s
isisfish.error.simulation.remote.global=Impossible de lancer une simulation sur serveur distant
isisfish.error.simulation.remote.launch=Une erreur est survenue lors du lancement de la simulation
+isisfish.error.simulation.remote.output=Caparmor >
isisfish.error.simulation.remote.upload=Impossible d'envoyer la simulation %s sur %s@%s
isisfish.error.simulation.remote.upload.stream=Une erreur de flux a \u00E9t\u00E9 d\u00E9tect\u00E9e \: %s
isisfish.error.simulation.remote.wrongportvalue=Le port de connexion a une valeur incorrecte \: %s
1
0
r1721 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/renderer
by chatellier@users.labs.libre-entreprise.org 24 Dec '08
by chatellier@users.labs.libre-entreprise.org 24 Dec '08
24 Dec '08
Author: chatellier
Date: 2008-12-24 09:51:58 +0000 (Wed, 24 Dec 2008)
New Revision: 1721
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/renderer/WithToolTipListModel.java
Log:
Ca faisait planter maven lors de la javadoc :(
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/renderer/WithToolTipListModel.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/renderer/WithToolTipListModel.java 2008-12-23 11:24:23 UTC (rev 1720)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/widget/renderer/WithToolTipListModel.java 2008-12-24 09:51:58 UTC (rev 1721)
@@ -4,7 +4,7 @@
import javax.swing.table.TableCellRenderer;
/**
- * This is the contract ot be realised by any {@link ListCellRenderer] or {@link TableCellRenderer} which
+ * This is the contract ot be realised by any {@link ListCellRenderer} or {@link TableCellRenderer} which
* wants to have an automatic text - tooltip renderer.
* <p/>
* It used a {@link ToolTipListModel} to store the text and tootltip that
1
0
r1720 - in isis-fish/trunk: . src/main/java/fr/ifremer/isisfish src/main/java/fr/ifremer/isisfish/actions src/main/java/fr/ifremer/isisfish/datastore src/main/java/fr/ifremer/isisfish/simulator/launcher src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 23 Dec '08
by chatellier@users.labs.libre-entreprise.org 23 Dec '08
23 Dec '08
Author: chatellier
Date: 2008-12-23 11:24:23 +0000 (Tue, 23 Dec 2008)
New Revision: 1720
Added:
isis-fish/trunk/TODO.txt
Modified:
isis-fish/trunk/pom.xml
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/VCSAction.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.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/SshSimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.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
Log:
Modification du launcher de simulation sur Caparmor
Added: isis-fish/trunk/TODO.txt
===================================================================
--- isis-fish/trunk/TODO.txt (rev 0)
+++ isis-fish/trunk/TODO.txt 2008-12-23 11:24:23 UTC (rev 1720)
@@ -0,0 +1,10 @@
+TODO au 22/12/2008
+==================
+
+ - refaire les UI des résultats
+ - tester que les paramêtres d'une simulation
+ sont corrects
+ (ex:detection qu'il n'y a pas de strategie)
+ - modification des configurations des paths
+ pour les lancements à distance (caparmor...)
+ - simulation path...
\ No newline at end of file
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2008-12-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/pom.xml 2008-12-23 11:24:23 UTC (rev 1720)
@@ -101,6 +101,13 @@
<version>1.8.0</version>
<scope>compile</scope>
</dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
<groupId>org.jdesktop</groupId>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2008-12-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2008-12-23 11:24:23 UTC (rev 1720)
@@ -67,7 +67,8 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(IsisConfig.class);
- /** la version du logiciel constitue de l.d.a.r
+ /**
+ * La version du logiciel constitue de l.d.a.r
* <li>l: le numero de version du logiciel
* <li>d: le numero de version du schema de la base de donnees
* <li>a: le numero de version de l'api des scripts
@@ -268,42 +269,55 @@
String result = getOption(Option.SIMULATOR_SSH_USER_NAME.key);
return result;
}
-
+
/**
- * Retourne le mot de passe pour acceder au serveur de simulation accessible via SSH.
+ * Retourne le chemin complet du jar.
*
- * @return simulator password
+ * @return simulator jar path
*/
- public String getSimulatorSshPassword() {
- String result = getOption(Option.SIMULATOR_SSH_PASSWORD.key);
+ public String getSimulatorSshJarPath() {
+ String result = getOption(Option.SIMULATOR_SSH_JARPATH.key);
return result;
}
/**
- * Retourne la clé privée pour acceder au serveur de simulation accessible via SSH.
+ * Retourne le chemin relatif ou abs du repertoire
+ * root des données d'isis.
*
- * @return simulator password
+ * @return simulator data path
*/
- public String getSimulatorSshPrivateKey() {
- String result = getOption(Option.SIMULATOR_SSH_PRIVATEKEY.key);
+ public String getSimulatorSshDataPath() {
+ String result = getOption(Option.SIMULATOR_SSH_DATAPATH.key);
return result;
}
/**
+ * Retourne la clé privée de l'utilisteur courant.
+ *
+ * @return private ssh key path
+ */
+ public File getSSHPrivateKeyFilePath() {
+ File result = getOptionAsFile(Option.SSH_KEY_FILE.key);
+ return result;
+ }
+
+ /*
* Le type de simulation par defaut a utiliser (local, remote, ...)
* @return
- */
+ *)
public boolean isSimulatorLocal() {
+ // FIXME never called
String value = getOption(Option.SIMULATOR_LAUNCHER.key);
+ // and following code always return false :
boolean result = "local".equalsIgnoreCase(value);
return result;
- }
+ }*/
-// public boolean isUseVCS() {
-// String value = getOption(Option.VCS_TYPE.key);
-// boolean result = !VCSNone.TYPE_NONE.equals(value);
-// return result;
-// }
+ /*public boolean isUseVCS() {
+ String value = getOption(Option.VCS_TYPE.key);
+ boolean result = !VCSNone.TYPE_NONE.equals(value);
+ return result;
+ }*/
public boolean isLaunchUI() {
boolean result = getOptionAsBoolean(Option.LAUNCH_UI.key);
@@ -596,7 +610,12 @@
// Toutes les options disponibles
//////////////////////////////////////////////////
- static public enum Option {
+ /**
+ * Options.
+ *
+ * Set it protected to force getOption() call.
+ */
+ protected static enum Option {
COMPILATION_DIRECTORY("compilation.directory", _("isisfish.config.main.compileDirectory.description"), getUserHome() + File.separator + "isis-build"),
CONFIG_FILE(CONFIG_FILE_NAME, _("isisfish.config.main.configFileName.description"), CONFIG_FILENAME),
@@ -614,7 +633,7 @@
/** prevu pour l'architecture de lancement en plugin: local, isis-server, caparmor, ... */
SIMULATOR_LAUNCHER(SimulationService.SIMULATION_LAUNCHER + ".localDefault", _("isisfish.config.main.localSimulator.description"), InProcessSimulatorLauncher.class.getName()),
SIMULATOR_LAUNCHER_SUB(SimulationService.SIMULATION_LAUNCHER + ".subDefault", _("isisfish.config.main.subSimulator.description"), SubProcessSimulationLauncher.class.getName()),
- // SIMULATOR_LAUNCHER_REMOTE(SimulationService.SIMULATION_LAUNCHER + ".remoteDefault", _("isisfish.config.main.remoteSimulator.description"), SshSimulatorLauncher.class.getName()),
+ SIMULATOR_LAUNCHER_REMOTE(SimulationService.SIMULATION_LAUNCHER + ".remoteCaparmor", _("isisfish.config.main.remoteCaparmor.description"), SshSimulatorLauncher.class.getName()),
SIMULATOR_SERVER("simulation.server", _("isisfish.config.main.simulationServer.description"), "http://simulateur.ifremer.fr:9090"),
/** le login a utiliser pour les launcher distant, le type du launcher est ajouter a la cle (car 1 login par launcher) */
@@ -625,22 +644,23 @@
SIMULATOR_SSH_SERVER("simulation.ssh.server", _("isisfish.config.main.simulation.ssh.server.description"), "caparmor.ifremer.fr:22"),
/** Serveur accessible par ssh : login */
SIMULATOR_SSH_USER_NAME("simulation.ssh.username", _("isisfish.config.main.simulation.ssh.login.description"), "isisfish"),
- /** Serveur accessible par ssh : password */
- SIMULATOR_SSH_PASSWORD("simulation.ssh.password", _("isisfish.config.main.simulation.ssh.password.description"), ""),
- /** Serveur accessible par ssh : cle privee */
- SIMULATOR_SSH_PRIVATEKEY("simulation.ssh.privatekey", _("isisfish.config.main.simulation.ssh.privatekey.description"), getUserHome() + File.separator + ".ssh" + File.separator + "id_rsa"),
-
+ /** Serveur accessible par ssh : remote data path */
+ SIMULATOR_SSH_DATAPATH("simulation.ssh.datapath", _("isisfish.config.main.simulation.ssh.datapath.description"), "/home/" + SIMULATOR_SSH_USER_NAME.defaultValue + "/isis-database-3"),
+ /** Serveur accessible par SSH : chemin complet du jar depuis le /home une fois connecté */
+ SIMULATOR_SSH_JARPATH("simulation.ssh.jarpath", _("isisfish.config.main.simulation.ssh.jarpath.description"), "./isis-fish-" + getVersion() + "/isis-fish-" + getVersion() + ".jar"),
+
LOCALE("locale", _("isisfish.config.main.locale.description"), "fr_FR"),
-// REGION_MAP("regionMap", _("isisfish.config.main.regionMap.description"), "maps"),
-// RESULT_EXPORT("resultExport", String.class, 15, n_("isisfish.config.main.resultExport.description"), "resultExports"),
+ // REGION_MAP("regionMap", _("isisfish.config.main.regionMap.description"), "maps"),
+ // RESULT_EXPORT("resultExport", String.class, 15, n_("isisfish.config.main.resultExport.description"), "resultExports"),
SIMULATION_SHOW_ONLY_ERROR("simulationShowOnlyError", _("isisfish.config.main.simulationShowOnlyError.description"), "false"),
-// SIMULATION_SHOW_ONLY_QUEUE("simulationShowOnlyQueue", _("isisfish.config.main.simulationShowOnlyQueue.description"), "true"),
+ // SIMULATION_SHOW_ONLY_QUEUE("simulationShowOnlyQueue", _("isisfish.config.main.simulationShowOnlyQueue.description"), "true"),
// if false no graphical interface
LAUNCH_UI("launch.ui", _("isisfish.config.main.launchUI.description"), "true"),
DATABASE_DIRECTORY("database.directory", _("isisfish.config.vcs.localDatabasePath.description"), getUserHome() + File.separator + "isis-database-3"),
+ // TODO remove duplicated ssh key configuration
SSH_KEY_FILE("ssh.key.file", _("isisfish.config.vcs.keyFile.description"), getUserHome() + File.separator + ".ssh" + File.separator + "isis_rsa"),
SSH_PASSPHRASE_ENABLED("ssh.passphrase.enabled", _("isisfish.config.vcs.noPassPhrase.description"), "false"),
SSH_PASSPHRASE("ssh.passphrase", _("isisfish.config.vcs.passphrase.description"), ""),
@@ -655,15 +675,13 @@
VCS_USER_PASSWORD(VCS.VCS_USER_PASSWORD, _("isisfish.config.vcs.userPassword.description"), ""),
VCS_HOST_NAME(VCS.VCS_HOST_NAME, _("isisfish.config.vcs.hostName.description"), "labs.libre-entreprise.org"),
VCS_PATH(VCS.VCS_PATH, _("isisfish.config.vcs.remotePath.description"), "/svnroot/isis-fish-data/"),
-// VCS_TAG(VCS.VCS_TAG, _("isisfish.config.vcs.remoteDatabase.description"), "/trunk"),
-// TYPE_REPO_PROPERTY_KEY = newConfigPropertyKey("typeRepo", VCSTypeRepo.class, 9, n_("isisfish.config.vcs.typeRepo.description"), "TAG"),
-// PROJECT_NAME_PROPERTY_KEY = newConfigPropertyKey("projectName", String.class, 11, n_("isisfish.config.main.projectName.description"), "Isis-Fish"),
+ // VCS_TAG(VCS.VCS_TAG, _("isisfish.config.vcs.remoteDatabase.description"), "/trunk"),
+ // TYPE_REPO_PROPERTY_KEY = newConfigPropertyKey("typeRepo", VCSTypeRepo.class, 9, n_("isisfish.config.vcs.typeRepo.description"), "TAG"),
+ // PROJECT_NAME_PROPERTY_KEY = newConfigPropertyKey("projectName", String.class, 11, n_("isisfish.config.main.projectName.description"), "Isis-Fish"),
USER_NAME("user.name", _("isisfish.config.main.userName.description"), System.getProperty("user.name")),
SMTP_SERVER("smtpServer", _("isisfish.config.main.smtpServer.description"), "smtp"),
- USER_MAIL("userMail", _("isisfish.config.main.userMail.description"), USER_NAME.key + "@" + VCS_HOST_NAME.key),
-
- ;
+ USER_MAIL("userMail", _("isisfish.config.main.userMail.description"), USER_NAME.key + "@" + VCS_HOST_NAME.key);
public final String key;
public final String description;
@@ -684,7 +702,7 @@
AfterInit, AfterInitVCS, AfterUI, BeforeExit
}
- static public enum Action {
+ public static enum Action {
HELP(_("Show help"), OtherAction.class.getName() + "#help", "-h", "--help"),
IMPORT_ANALYSE_PLAN(_(""), ImportAction.class.getName() + "#importAnalysePlan", "--importAnalysePlan"),
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/VCSAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/VCSAction.java 2008-12-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/actions/VCSAction.java 2008-12-23 11:24:23 UTC (rev 1720)
@@ -49,7 +49,7 @@
}
public void sshCreateKey(boolean force) throws Exception {
- File f = config.getOptionAsFile(IsisConfig.Option.SSH_KEY_FILE.key);
+ File f = config.getSSHPrivateKeyFilePath();
if (f.exists() && !force) {
log.error("the private key already exist " + f + ", use option [force] to overwrite");
@@ -64,7 +64,7 @@
String openSshPublicKey =
SshKeyGenerator.convertPublicKeyFile(publicKeyFile,
new OpenSSHPublicKeyFormat(
- config.getOption(IsisConfig.Option.USER_NAME.key) +
+ config.getUserName() +
"@forIsisFish 1024-bit rsa"));
log.info("public key OpenSsh : " + openSshPublicKey);
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-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SimulationStorage.java 2008-12-23 11:24:23 UTC (rev 1720)
@@ -121,7 +121,7 @@
* @param name le nom de la simulation dont on souhaite le repertoire
* @return
*/
- static public File getSimulationDirectory(String name) {
+ public static File getSimulationDirectory(String name) {
File result = getSimulationDirectory();
result = new File(result, name);
if (!result.exists()) {
@@ -204,7 +204,7 @@
* externe de connaitre l'etat d'une simulation distante
* @return
*/
- static protected File getSimulationControlFile(String id) {
+ protected static File getSimulationControlFile(String id) {
File result = new File(getSimulationDirectory(id), "control");
return result;
}
@@ -230,17 +230,30 @@
/**
* Reli le fichier contenant les infos de SimulationControl, en excluant
- * certain champs
- * @param id l'identifiant de la simulation a
+ * certain champs.
+ *
+ * @param id l'identifiant de la simulation a lire
* @param control le control a mettre a jour en fonction de ce qui est lu
* @param exclude les champs a exclure
*/
- static public void readControl(String id, SimulationControl control, String... exclude) {
+ public static void readControl(String id, SimulationControl control, String... exclude) {
+ File file = getSimulationControlFile(id);
+ readControl(file, control, exclude);
+ }
+
+ /**
+ * Reli le fichier contenant les infos de SimulationControl, en excluant
+ * certain champs.
+ *
+ * @param controlFile le fichier de control
+ * @param control le control a mettre a jour en fonction de ce qui est lu
+ * @param exclude les champs a exclure
+ */
+ public static void readControl(File controlFile, SimulationControl control, String... exclude) {
try {
Properties prop = new Properties();
- File file = getSimulationControlFile(id);
- if (file.exists()) {
- FileInputStream in = new FileInputStream(file);
+ if (controlFile.exists()) {
+ FileInputStream in = new FileInputStream(controlFile);
try {
prop.load(in);
} finally {
@@ -253,11 +266,11 @@
}
else {
if(log.isDebugEnabled()) {
- log.debug("Control file '" + file.getAbsolutePath() + "'doesn't exists");
+ log.debug("Control file '" + controlFile.getAbsolutePath() + "'doesn't exists");
}
}
- } catch (Exception eee) {
- log.warn("Can't read control", eee);
+ } catch (Exception e) {
+ log.warn("Can't read control", e);
}
}
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-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2008-12-23 11:24:23 UTC (rev 1720)
@@ -122,8 +122,18 @@
return _("isisfish.simulator.launcher.inprocess");
}
+ /**
+ * Display message both in commons-logging and control text progress.
+ *
+ * @param control control
+ * @param message message to display
+ */
protected void message(SimulationControl control, String message) {
- log.info(message);
+ // log
+ if(log.isInfoEnabled()) {
+ log.info(message);
+ }
+ // control
if (control != null) {
control.setText(message);
}
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-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java 2008-12-23 11:24:23 UTC (rev 1720)
@@ -26,10 +26,12 @@
import java.awt.Insets;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.rmi.RemoteException;
+import java.util.List;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
@@ -37,6 +39,7 @@
import javax.swing.JPasswordField;
import javax.swing.JTextField;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -60,10 +63,9 @@
* simulation on that file.
*
* Isis-Fish must be installed on remote server.
+ *
+ * @see JSch
*
- * Scp code using jsch is taken from :
- * http://www.jcraft.com/jsch/examples/ScpTo.java
- *
* @author chatellier
* @version $Revision: 1.0 $
*
@@ -75,195 +77,23 @@
/** Class logger */
protected static Log log = LogFactory.getLog(SshSimulatorLauncher.class);
- protected class MyUserInfo implements UserInfo, UIKeyboardInteractive {
-
- protected String passphrase;
- protected JTextField passphraseField = new JPasswordField(20);
- protected String passwd;
- protected JTextField passwordField = new JPasswordField(20);
-
- /**
- * Constructor.
- */
- public MyUserInfo() {
- this(null);
+ /**
+ * Display message both in commons-logging and control text progress.
+ *
+ * @param control control
+ * @param message message to display
+ */
+ protected void message(SimulationControl control, String message) {
+ // log
+ if (log.isInfoEnabled()) {
+ log.info(message);
}
-
- /**
- * Constructor with password.
- *
- * @param passwd password
- */
- public MyUserInfo(String passwd) {
- this.passwd = passwd;
+ // control
+ if (control != null) {
+ control.setText(message);
}
-
- 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);
- }
-
- public String[] promptKeyboardInteractive(String destination,
- String name, String instruction, String[] prompt, boolean[] echo) {
- log.debug("promptKeyboardInteractive");
- final GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 1, 1,
- GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
- new Insets(0, 0, 0, 0), 0, 0);
- Container panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- gbc.weightx = 1.0;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.gridx = 0;
- panel.add(new JLabel(instruction), gbc);
- gbc.gridy++;
-
- gbc.gridwidth = GridBagConstraints.RELATIVE;
-
- JTextField[] texts = new JTextField[prompt.length];
- for (int i = 0; i < prompt.length; i++) {
- gbc.fill = GridBagConstraints.NONE;
- gbc.gridx = 0;
- gbc.weightx = 1;
- panel.add(new JLabel(prompt[i]), gbc);
-
- gbc.gridx = 1;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.weighty = 1;
- if (echo[i]) {
- texts[i] = new JTextField(20);
- } else {
- texts[i] = new JPasswordField(20);
- }
- panel.add(texts[i], gbc);
- gbc.gridy++;
- }
-
- String[] response = null;
- if (JOptionPane.showConfirmDialog(null, panel, destination + ": "
- + name, JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
- response = new String[prompt.length];
- for (int i = 0; i < prompt.length; i++) {
- response[i] = texts[i].getText();
- }
- }
- // else = cancel
- return response;
- }
-
}
-
- 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()
*/
@@ -273,6 +103,14 @@
}
/*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return _("isisfish.simulator.launcher.remote");
+ }
+
+ /*
* @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulate(fr.ifremer.isisfish.simulator.launcher.SimulationService, fr.ifremer.isisfish.simulator.SimulationControl, java.io.File)
*/
@Override
@@ -282,24 +120,32 @@
// start ssh session
try {
+
+ // connection
+ message(control, _("isisfish.simulation.remote.message.connection"));
Session sshSession = openSSHSession();
-
+
// upload simulation on server
+ message(control, _("isisfish.simulation.remote.message.upload"));
String remotePath = uploadSimulation(sshSession, simulationZip);
// si l'upload a fonctionné
- if(remotePath != null) {
- launchSimulation(sshSession, simulationService, control, remotePath);
+ if (remotePath != null) {
+ message(control, _("isisfish.simulation.remote.message.launch"));
+ // just start a thread
+ checkSimulationProgression(sshSession, simulationService,
+ control);
+ launchSimulation(sshSession, simulationService, control,
+ remotePath);
}
} catch (JSchException e) {
- if(log.isErrorEnabled()) {
+ if (log.isErrorEnabled()) {
log.error(_("isisfish.error.simulation.remote.global"));
}
- throw new SimulationException("isisfish.error.simulation.remote.global", e);
+ throw new SimulationException(
+ _("isisfish.error.simulation.remote.global"), e);
}
-
-
-
+
return null;
}
@@ -314,53 +160,150 @@
JSch jsch = new JSch();
- // add ssh key
- File sshKey = new File(IsisFish.config.getSimulatorSshPrivateKey());
- if(sshKey.canRead()) {
- jsch.addIdentity(sshKey.getAbsolutePath());
- }
-
// extract connection infos
String host = IsisFish.config.getSimulatorSshServer();
String username = IsisFish.config.getSimulatorSshUsername();
- String password = IsisFish.config.getSimulatorSshPassword();
+
int port = 22; // by default, 22
-
- if(host.indexOf(':') > 0) {
+
+ if (host.indexOf(':') > 0) {
String sPort = host.substring(host.indexOf(':') + 1);
try {
port = Integer.parseInt(sPort);
- }
- catch(NumberFormatException e) {
- if(log.isWarnEnabled()) {
- log.warn(_("isisfish.error.simulation.remote.wrongportvalue", sPort));
+ } catch (NumberFormatException e) {
+ if (log.isWarnEnabled()) {
+ log.warn(_(
+ "isisfish.error.simulation.remote.wrongportvalue",
+ sPort));
}
}
host = host.substring(0, host.indexOf(':'));
}
-
+
+ if (log.isInfoEnabled()) {
+ log.info(_("Try to log on %s@%s:%d", username, host, port));
+ }
+
+ // add ssh key
+ boolean sshKeyUsed = false;
+ File sshKey = IsisFish.config.getSSHPrivateKeyFilePath();
+ if (sshKey.canRead()) {
+ if (log.isInfoEnabled()) {
+ log.info(_("Ssh key found '%s' will be used to connect to",
+ sshKey.getAbsoluteFile(), host));
+ }
+ jsch.addIdentity(sshKey.getAbsolutePath());
+ sshKeyUsed = true;
+ }
+
Session session = jsch.getSession(username, host, port);
-
+
// username and password will be given via UserInfo interface.
- UserInfo ui = new NonInteractiveUserInfo(password);
+ UserInfo ui = new SSHUserInfo();
session.setUserInfo(ui);
session.connect(60000); // timeout
-
+
+ // test here, if password has been asked to user
+ if (session.isConnected() && sshKeyUsed && ui.getPassword() != null) {
+ putSshKeyOnRemoteServer(session, sshKey);
+ }
return session;
}
/**
* Close ssh session.
*
- * @param session
+ * @param session session to close
*/
protected void closeSSHSession(Session session) {
- session.disconnect();
+ if (session != null) {
+ session.disconnect();
+ }
}
-
+
/**
+ * Add ssh key into $HOME/.ssh/authorized_keys file.
+ *
+ * Just connect and do an "echo xx >>
+ * @param session opened session
+ * @param sshKey
+ * @throws JSchException
+ */
+ protected void putSshKeyOnRemoteServer(Session session, File sshKey)
+ throws JSchException {
+
+ // get public key for argument private key file
+ // TODO always .pub ?
+ File publicKey = new File(sshKey.getAbsoluteFile() + ".pub");
+
+ // command to :
+ // - make ssh directory
+ // - add key to authorized_keys
+ String command = "if [ ! -d .ssh ] ; then mkdir .ssh; fi ; echo \"%s\" >> .ssh/authorized_keys";
+
+ try {
+ // use usefull readLines from commons-io
+ @SuppressWarnings("unchecked")
+ List<String> contents = FileUtils.readLines(publicKey);
+
+ // only one line
+ if (contents != null && contents.size() == 1) {
+ command = String.format(command, contents.get(0));
+
+ if (log.isInfoEnabled()) {
+ log.info("Add key on remote authorized keys");
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("command is : " + command);
+ }
+
+ // exec previous commande
+ Channel channel = session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ // read buffer
+ // seems to not work without it
+ InputStream in = channel.getInputStream();
+ channel.connect();
+ byte[] tmp = new byte[1024];
+ while (true) {
+ while (in.available() > 0) {
+ int i = in.read(tmp, 0, 1024);
+ if (i < 0)
+ break;
+ if (log.isInfoEnabled()) {
+ log.info(new String(tmp, 0, i));
+ }
+ }
+ if (channel.isClosed()) {
+ if (log.isInfoEnabled()) {
+ log.info("JSch channel exit-status: "
+ + channel.getExitStatus());
+ }
+ break;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ee) {
+ }
+ }
+ channel.disconnect();
+ // end read buffer
+ }
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error(_("Error while uploading public key to remote serveur authorized_keys"),
+ e);
+ }
+ }
+ }
+
+ /**
* Upload simulation file to server.
*
+ * ScpTo code taken from :
+ * http://www.jcraft.com/jsch/examples/ScpTo.java
+ *
* @param session already open valid ssh session
* @param simulationFile simulation file to upload
*
@@ -373,7 +316,7 @@
// file info
String filePath = simulationFile.getAbsolutePath();
-
+
FileInputStream fis = null;
try {
@@ -394,7 +337,7 @@
if (log.isDebugEnabled()) {
log.debug("Uploading " + filePath);
}
-
+
// send "C0644 filesize filename", where filename should not include '/'
long filesize = (new File(filePath)).length();
command = "C0644 " + filesize + " ";
@@ -407,7 +350,7 @@
command += "\n";
out.write(command.getBytes());
out.flush();
-
+
if (checkAck(in) == 0) {
// send a content of lfile
@@ -438,22 +381,21 @@
} catch (JSchException e) {
if (log.isErrorEnabled()) {
log.error(_("isisfish.error.simulation.remote.upload",
- filePath));
+ filePath));
}
} catch (IOException e) {
if (log.isErrorEnabled()) {
log.error(_("isisfish.error.simulation.remote.upload",
- filePath));
+ filePath));
}
- }
- finally {
- try{
- if(fis!=null) {
+ } finally {
+ try {
+ if (fis != null) {
fis.close();
}
- }catch(IOException e) {
- // exception ignoree
- }
+ } catch (IOException e) {
+ // exception ignoree
+ }
}
return remotePath;
@@ -462,6 +404,8 @@
/**
* Check input stream validity.
*
+ * Code taken from Jsch samples.
+ *
* @param in input stream
*/
protected int checkAck(InputStream in) throws IOException {
@@ -485,13 +429,17 @@
sb.append((char) c);
} while (c != '\n');
if (b == 1) { // error
- if(log.isErrorEnabled()) {
- log.error(_("isisfish.error.simulation.remote.upload.stream",sb.toString()));
+ if (log.isErrorEnabled()) {
+ log.error(_(
+ "isisfish.error.simulation.remote.upload.stream",
+ sb.toString()));
}
}
if (b == 2) { // fatal error
- if(log.isFatalEnabled()) {
- log.fatal(_("isisfish.error.simulation.remote.upload.stream",sb.toString()));
+ if (log.isFatalEnabled()) {
+ log.fatal(_(
+ "isisfish.error.simulation.remote.upload.stream",
+ sb.toString()));
}
}
}
@@ -502,23 +450,26 @@
* Launch simulation on remote server.
*
* @param session opened ssh session
- * @param simulationService
- * @param control
- * @param remotePath
+ * @param simulationService simulation service
+ * @param control control
+ * @param remotePath remote zip simulation path
* @throws JSchException
*/
- protected void launchSimulation(Session session, SimulationService simulationService, SimulationControl control, String remotePath) throws JSchException {
-
+ protected void launchSimulation(Session session,
+ SimulationService simulationService, SimulationControl control,
+ String remotePath) throws JSchException {
+
String simulationId = control.getId();
- // remote launch command
- String command = "java -jar isis-fish/isis-fish.jar";
- // no ui
- command += " --option launch.ui false";
- // start simulation
- command += " --simulateWithSimulation " + simulationId + " \"" + remotePath + "\"";
-
- if(log.isDebugEnabled()) {
+ String command = String.format("%s %s %s %s '%s' '%s' %s '%s' '%s'",
+ "java", // java command
+ "-jar", // java jar option
+ IsisFish.config.getSimulatorSshJarPath(), // remote jar path
+ "--option", "launch.ui", "false", // additionnal option ui
+ "--simulateWithSimulation", simulationId, remotePath // add option simulation
+ );
+
+ if (log.isDebugEnabled()) {
log.debug("Launch : " + command);
}
@@ -529,7 +480,7 @@
try {
InputStream in = channel.getInputStream();
-
+
channel.connect();
byte[] tmp = new byte[1024];
@@ -538,13 +489,14 @@
int i = in.read(tmp, 0, 1024);
if (i < 0)
break;
- if(log.isInfoEnabled()) {
+ if (log.isInfoEnabled()) {
log.info(new String(tmp, 0, i));
}
}
if (channel.isClosed()) {
- if(log.isInfoEnabled()) {
- log.info("exit-status: " + channel.getExitStatus());
+ if (log.isInfoEnabled()) {
+ log.info("JSch channel exit-status: "
+ + channel.getExitStatus());
}
break;
}
@@ -555,12 +507,377 @@
}
channel.disconnect();
} catch (IOException e) {
- throw new SimulationException(_("isisfish.error.simulation.remote.launch"), e);
+ throw new SimulationException(
+ _("isisfish.error.simulation.remote.launch"), e);
}
}
+ /**
+ * Launch a thread to check simulation progression on remote
+ * server.
+ *
+ * Use IsisFish.config.SIMULATOR_SSH_DATAPATH to download
+ * remote simulation control file.
+ *
+ * @param sshSession
+ * @param simulationService
+ * @param control
+ */
+ protected void checkSimulationProgression(Session sshSession,
+ SimulationService simulationService, SimulationControl control) {
+
+ Runnable controlRunnable = new RemoteSSHControlThread(sshSession, control);
+ Thread controlThread = new Thread(controlRunnable);
+ controlThread.start();
+
+ }
+
+ /**
+ * Thread that check remote control file every 2s.
+ */
+ protected class RemoteSSHControlThread implements Runnable {
+
+ /** Sleep 2s */
+ protected static final int SLEEPTIME = 2000;
+
+ /** Opened ssh session */
+ protected Session sshSession;
+
+ /** Control (to update progression) */
+ protected SimulationControl control;
+
+ /**
+ * Constructor.
+ * @param sshSession
+ *
+ * @param control control
+ */
+ protected RemoteSSHControlThread(Session sshSession, SimulationControl control) {
+ this.sshSession = sshSession;
+ this.control = control;
+ }
+
+ /*
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+
+ boolean running = true;
+ while (running) {
+
+ // wait
+ try {
+ Thread.sleep(SLEEPTIME);
+
+ // download control file
+ File controlFile = downloadControlFile(control.getId());
+
+ if (controlFile != null) {
+ // on ne lit pas le stop, car le stop ne peut-etre appeler
+ // que par l'utilisateur qui est de ce cote de la machine
+ SimulationStorage.readControl(controlFile, control,
+ "stop");
+
+ // deleteTempFile
+ controlFile.delete();
+ }
+
+ } catch (InterruptedException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Thread has been interrupted", e);
+ }
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Error while reading control file", e);
+ }
+ }
+ synchronized (control) {
+ running = control.isRunning();
+ }
+ }
+ }
+
+ /**
+ * Download remote simulation control file and store
+ * its content into temp file.
+ *
+ * ScpFrom code taken from :
+ * http://www.jcraft.com/jsch/examples/ScpFrom.java
+ *
+ * @return downloaded temp file (file have to be manualy deleted)
+ * @throws IOException
+ */
+ protected File downloadControlFile(String simulationId)
+ throws IOException {
+
+ File localFile = null;
+
+ // build remote file path
+ // FIXME this path should be given by remote IsisFish app
+ // TODO to change
+ String remoteFile = IsisFish.config.getSimulatorSshDataPath();
+ remoteFile += "/" + SimulationStorage.SIMULATION_PATH;
+ remoteFile += "/" + simulationId;
+ remoteFile += "/control";
+
+ // local tmp file
+ File tempFile = File.createTempFile(simulationId, "control");
+ FileOutputStream fos=null;
+
+ try {
+ // exec 'scp -f rfile' remotely
+ String command = "scp -f " + remoteFile;
+ Channel channel = sshSession.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ // get I/O streams for remote scp
+ OutputStream out = channel.getOutputStream();
+ InputStream in = channel.getInputStream();
+
+ channel.connect();
+
+ byte[] buf = new byte[1024];
+
+ // send '\0'
+ buf[0] = 0;
+ out.write(buf, 0, 1);
+ out.flush();
+
+ while (true) {
+ int c = checkAck(in);
+ if (c != 'C') {
+ break;
+ }
+
+ // read '0644 '
+ in.read(buf, 0, 5);
+
+ long filesize = 0L;
+ while (true) {
+ if (in.read(buf, 0, 1) < 0) {
+ // error
+ break;
+ }
+ if (buf[0] == ' ') {
+ break;
+ }
+ filesize = filesize * 10L + (buf[0] - '0');
+ }
+
+ //String file = null;
+ for (int i = 0;; i++) {
+ in.read(buf, i, 1);
+ if (buf[i] == (byte) 0x0a) {
+ //file = new String(buf, 0, i);
+ break;
+ }
+ }
+
+ // send '\0'
+ buf[0] = 0;
+ out.write(buf, 0, 1);
+ out.flush();
+
+ // read a content of lfile
+ fos = new FileOutputStream(localFile);
+ int foo;
+ while (true) {
+ if (buf.length < filesize)
+ foo = buf.length;
+ else
+ foo = (int) filesize;
+ foo = in.read(buf, 0, foo);
+ if (foo < 0) {
+ // error
+ break;
+ }
+ fos.write(buf, 0, foo);
+ filesize -= foo;
+ if (filesize == 0L)
+ break;
+ }
+ fos.close();
+ fos = null;
+
+ if (checkAck(in) != 0) {
+ localFile = tempFile;
+ }
+
+ // send '\0'
+ buf[0] = 0;
+ out.write(buf, 0, 1);
+ out.flush();
+ }
+ }
+ catch(IOException e){
+ if(log.isErrorEnabled()) {
+ log.error("I/O error while downloading control file", e);
+ }
+
+ } catch (JSchException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Jsch error while downloading control file", e);
+ }
+ }
+ finally {
+ try{
+ if(fos!=null) {
+ fos.close();
+ }
+ }
+ catch(Exception ignored) {
+ }
+ }
+
+ if(localFile == null) {
+ // an arror occurs
+ // so remove temp file
+ tempFile.delete();
+ }
+
+ return localFile;
+ }
+ }
+}
+
+/**
+ * Class used to ask used for connection info.
+ *
+ * Password, passphrase...
+ */
+class SSHUserInfo implements UserInfo, UIKeyboardInteractive {
+
+ /**
+ * Passphrase.
+ *
+ * Static to be stored on multiple connexion.
+ */
+ protected static String passphrase;
+
+ /**
+ * Passphrase text field.
+ */
+ protected JTextField passphraseField = new JPasswordField(20);
+
+ /**
+ * Password text field.
+ */
+ protected String passwd;
+
+ /**
+ * Password text field.
+ */
+ protected JTextField passwordField = new JPasswordField(20);
+
+ /**
+ * Call to ask user in remote server key
+ * can be trusted. Here, auto accept.
+ */
@Override
- public String toString() {
- return _("isisfish.simulator.launcher.remote");
+ public boolean promptYesNo(String str) {
+ return true;
}
+
+ @Override
+ public String getPassphrase() {
+ return passphrase;
+ }
+
+ @Override
+ public boolean promptPassphrase(String message) {
+ 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;
+ }
+
+ @Override
+ public String getPassword() {
+ return passwd;
+ }
+
+ @Override
+ public boolean promptPassword(String message) {
+ 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;
+ }
+
+ @Override
+ public void showMessage(String message) {
+ JOptionPane.showMessageDialog(null, message);
+ }
+
+ @Override
+ public String[] promptKeyboardInteractive(String destination, String name,
+ String instruction, String[] prompt, boolean[] echo) {
+ final GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 1, 1,
+ GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
+ new Insets(0, 0, 0, 0), 0, 0);
+ Container panel = new JPanel();
+ panel.setLayout(new GridBagLayout());
+
+ gbc.weightx = 1.0;
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ gbc.gridx = 0;
+ panel.add(new JLabel(instruction), gbc);
+ gbc.gridy++;
+
+ gbc.gridwidth = GridBagConstraints.RELATIVE;
+
+ JTextField[] texts = new JTextField[prompt.length];
+ for (int i = 0; i < prompt.length; i++) {
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.gridx = 0;
+ gbc.weightx = 1;
+ panel.add(new JLabel(prompt[i]), gbc);
+
+ gbc.gridx = 1;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.weighty = 1;
+ if (echo[i]) {
+ texts[i] = new JTextField(20);
+ } else {
+ texts[i] = new JPasswordField(20);
+ }
+ panel.add(texts[i], gbc);
+ gbc.gridy++;
+ }
+
+ String[] response = null;
+ if (JOptionPane.showConfirmDialog(null, panel, destination + ": "
+ + name, JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
+ response = new String[prompt.length];
+ for (int i = 0; i < prompt.length; i++) {
+ response[i] = texts[i].getText();
+
+ // hack to remember password
+ if (prompt[i] != null
+ && prompt[i].toLowerCase().indexOf("password") >= 0) {
+ passwd = response[i];
+ }
+
+ // hack to remember passphrase
+ if (prompt[i] != null
+ && prompt[i].toLowerCase().indexOf("passphrase") >= 0) {
+ passphrase = response[i];
+ }
+ }
+ }
+ // else = cancel
+ return response;
+ }
}
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-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2008-12-23 11:24:23 UTC (rev 1720)
@@ -21,7 +21,6 @@
import static org.codelutin.i18n.I18n._;
-import java.beans.PropertyChangeListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -37,7 +36,11 @@
import fr.ifremer.isisfish.simulator.SimulationControl;
/**
- *
+ * Lanceur de simulation dans un sous processus.
+ *
+ * @see ProcessBuilder
+ * @see Process
+ *
* @author poussin
* @version $Revision$
*
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-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2008-12-23 11:24:23 UTC (rev 1720)
@@ -21,6 +21,7 @@
Clear\ done\ jobs=
Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s=
Error\ during\ vcs\ initialisation=
+Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys=
Generate\ next\ simulation=
Import\ one\ java\ file\ script\ source=
Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s=
@@ -34,7 +35,6 @@
Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s=
Master\ plan=
Month\ Gap\ BetweenRepro\ Recruitment=
-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.\ Can't\ import=
@@ -42,14 +42,15 @@
Rename\ data\ directory\ to\ %s=
Show\ help=
SimulationExecutor\ started\ with\ %s\ thread\ for\ %s=
+Ssh\ key\ found\ '%s'\ will\ be\ used\ to\ connect\ to=
Stop\ simulation\ plan,\ because\ can't\ call\ afterSimulation\ correctly\ on\ plan\ %s=
Stop\ the\ process=
SubProcess\ start\:\ %s\ %s=
Switch\ repository\ type\ to\ none=
The\ equation\ used\ is\ the\ population's\ growth\ curve,\ it\ needs\ to\ be\ defined\ first.=
+Try\ to\ log\ on\ %s@%s\:%d=
Use\ branches,\ switch\ not\ needed=
User\ stop\ simulation\ %s=
-Your\ database\ repository\:\ %s\\n\ don't\ use\ correct=
cant\ start\ nimbus=
could\ not\ close\ reader\ %1$s=could not close reader %1$s
could\ not\ create\ simulation\ filter\ model\ for\ reason\ %1$s=could not create simulation filter model for reason %1$s
@@ -63,7 +64,7 @@
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.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright 2002 - 2008, Ifremer - 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.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2008.<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
@@ -82,10 +83,10 @@
isisfish.change.equation=Can't change equation
isisfish.commit.message=Enter commit message
isisfish.common.add=add
-isisfish.common.add.short=add short
+isisfish.common.add.short=add
isisfish.common.alert=alert
isisfish.common.apply=apply
-isisfish.common.blank=
+isisfish.common.blank=\
isisfish.common.cancel=cancel
isisfish.common.check=check
isisfish.common.clear=clear
@@ -148,11 +149,11 @@
isisfish.config.main.password.description=
isisfish.config.main.projectName.description=name of project
isisfish.config.main.regionMap.description=
-isisfish.config.main.remoteSimulator.description=
+isisfish.config.main.remoteCaparmor.description=
isisfish.config.main.resultExport.description=
+isisfish.config.main.simulation.ssh.datapath.description=
+isisfish.config.main.simulation.ssh.jarpath.description=
isisfish.config.main.simulation.ssh.login.description=
-isisfish.config.main.simulation.ssh.password.description=
-isisfish.config.main.simulation.ssh.privatekey.description=
isisfish.config.main.simulation.ssh.server.description=
isisfish.config.main.simulationServer.description=
isisfish.config.main.simulationShowOnlyError.description=
@@ -559,7 +560,7 @@
isisfish.message.remove.unnecessary.cells=
isisfish.message.removing.region=Removing region %1$s ...
isisfish.message.result.verif.region=R\u00E9sultat de la v\u00E9rification de la r\u00E9gion
-isisfish.message.save.finished=save finished
+isisfish.message.save.finished=Save finished
isisfish.message.saveModel.finished=Save model finished
isisfish.message.setting.cache.aspects=Setting Cache aspects
isisfish.message.setting.trace.aspects=Setting Trace aspects
@@ -833,9 +834,9 @@
isisfish.sensibilityWizard.title=Sensibility Wizard
isisfish.server.ssh.generateKey.title=Generate Ssh key
isisfish.setOfVessels.comments=Comments
-isisfish.setOfVessels.fixedCosts=fixedCosts
-isisfish.setOfVessels.name=name
-isisfish.setOfVessels.numberOfVessels=numberOfVessels
+isisfish.setOfVessels.fixedCosts=Fixed costs
+isisfish.setOfVessels.name=Name
+isisfish.setOfVessels.numberOfVessels=Number of vessels
isisfish.setOfVessels.technicalEfficiency=
isisfish.setOfVessels.title=Caracteristics
isisfish.setOfVessels.vesselType=vesselType
@@ -850,25 +851,28 @@
isisfish.simulation.menu.save=Save simulation
isisfish.simulation.menu.simulation=Simulation
isisfish.simulation.name=Simulation name
+isisfish.simulation.remote.message.connection=Connecting to Caparmor
+isisfish.simulation.remote.message.launch=Launching simulation
+isisfish.simulation.remote.message.upload=Uploading simulation
isisfish.simulation.title=Simulation launcher
isisfish.simulator.launcher.inprocess=in current process
-isisfish.simulator.launcher.remote=on remote server
+isisfish.simulator.launcher.remote=on Caparmor server
isisfish.simulator.launcher.subprocess=in subprocess
isisfish.simulator.simulaction.badid=Can't start simulation, bad id\: %s
isisfish.simulator.subprocess.readoutput.error=
-isisfish.species.age=age
+isisfish.species.age=Age
isisfish.species.cee=CEE
isisfish.species.comments=Comments
-isisfish.species.length=length
+isisfish.species.length=Length
isisfish.species.name=Species name
isisfish.species.rubbinCode=Rubbin code
isisfish.species.scientificName=Scientific name
-isisfish.species.structured=structured
+isisfish.species.structured=Structured
isisfish.strategy.comments=Comments
-isisfish.strategy.inactivity=
-isisfish.strategy.inactivityEquationUsed=
-isisfish.strategy.name=name
-isisfish.strategy.proportionSetOfVessels=proportionSetOfVessels
+isisfish.strategy.inactivity=Inactivity equation
+isisfish.strategy.inactivityEquationUsed=Use inactivity equation
+isisfish.strategy.name=Name
+isisfish.strategy.proportionSetOfVessels=Set of vessels proportion
isisfish.strategy.title=Caracteristics
isisfish.strategyMonthInfo.metier=Metier
isisfish.strategyMonthInfo.minInactivityDays=minInactivityDays
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-22 15:59:12 UTC (rev 1719)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2008-12-23 11:24:23 UTC (rev 1720)
@@ -21,6 +21,7 @@
Clear\ done\ jobs=
Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s=
Error\ during\ vcs\ initialisation=
+Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys=
Generate\ next\ simulation=
Import\ one\ java\ file\ script\ source=
Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s=
@@ -34,7 +35,6 @@
Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s=
Master\ plan=
Month\ Gap\ BetweenRepro\ Recruitment=
-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.\ Can't\ import=
@@ -42,14 +42,15 @@
Rename\ data\ directory\ to\ %s=
Show\ help=
SimulationExecutor\ started\ with\ %s\ thread\ for\ %s=
+Ssh\ key\ found\ '%s'\ will\ be\ used\ to\ connect\ to=
Stop\ simulation\ plan,\ because\ can't\ call\ afterSimulation\ correctly\ on\ plan\ %s=
Stop\ the\ process=
SubProcess\ start\:\ %s\ %s=
Switch\ repository\ type\ to\ none=
The\ equation\ used\ is\ the\ population's\ growth\ curve,\ it\ needs\ to\ be\ defined\ first.=
+Try\ to\ log\ on\ %s@%s\:%d=
Use\ branches,\ switch\ not\ needed=
User\ stop\ simulation\ %s=
-Your\ database\ repository\:\ %s\\n\ don't\ use\ correct=
cant\ start\ nimbus=
could\ not\ close\ reader\ %1$s=could not close reader %1$s
could\ not\ create\ simulation\ filter\ model\ for\ reason\ %1$s=could not create simulation filter model for reason %1$s
@@ -63,7 +64,7 @@
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.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright 2002 - 2008, Ifremer - 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.abouthtmltext=<html><b>Isis-Fish (%s)</b><br /><br />Copyright IFREMER-MAERHA 2000-2008.<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
@@ -82,10 +83,10 @@
isisfish.change.equation=Ne peut pas changer l'\u00E9quation
isisfish.commit.message=Entrer un message de commit
isisfish.common.add=Ajouter
-isisfish.common.add.short=isisfish.common.add.short
+isisfish.common.add.short=Aj.
isisfish.common.alert=alerte
isisfish.common.apply=Appliquer
-isisfish.common.blank=
+isisfish.common.blank=\
isisfish.common.cancel=Annuler
isisfish.common.check=V\u00E9rifier
isisfish.common.clear=Effacer
@@ -148,11 +149,11 @@
isisfish.config.main.password.description=le mot de passe pour se connecter au serveur de simulations distant
isisfish.config.main.projectName.description=le nom du projet
isisfish.config.main.regionMap.description=le nom du r\u00E9pertoire contenant les maps d'une r\u00E9gion
-isisfish.config.main.remoteSimulator.description=lance les simulations sur un serveur distant
+isisfish.config.main.remoteCaparmor.description=lance les simulations sur un serveur distant
isisfish.config.main.resultExport.description=TODO
+isisfish.config.main.simulation.ssh.datapath.description=
+isisfish.config.main.simulation.ssh.jarpath.description=
isisfish.config.main.simulation.ssh.login.description=
-isisfish.config.main.simulation.ssh.password.description=
-isisfish.config.main.simulation.ssh.privatekey.description=
isisfish.config.main.simulation.ssh.server.description=
isisfish.config.main.simulationServer.description=l'url du serveur de simulations distant
isisfish.config.main.simulationShowOnlyError.description=pour indiquer si l'on doit conserver dans l'UI des simulations termin\u00E9es uniquement celles avec erreur
@@ -559,7 +560,7 @@
isisfish.message.remove.unnecessary.cells=
isisfish.message.removing.region=Suppression de lar\u00E9gion %1$s ...
isisfish.message.result.verif.region=R\u00E9sultat de la v\u00E9rification de la r\u00E9gion
-isisfish.message.save.finished=sauvegarde termin\u00E9e
+isisfish.message.save.finished=Sauvegarde termin\u00E9e
isisfish.message.saveModel.finished=Sauvegarde du mod\u00E8le termin\u00E9e
isisfish.message.setting.cache.aspects=Mise en place des aspects Cache
isisfish.message.setting.trace.aspects=Mise en place des aspects Trace
@@ -708,7 +709,7 @@
isisfish.queue.stopSimulation=Arr\u00EAter la simulation
isisfish.queue.title=Queue
isisfish.result.abundance=Abondance
-isisfish.result.add=Ajouter un r\u00E9sultat\=
+isisfish.result.add=Ajouter un r\u00E9sultat
isisfish.result.begin.simulation=En d\u00E9but de simulation\:
isisfish.result.capture=Capturer
isisfish.result.capture.metier=Capturer par m\u00E9tier
@@ -831,10 +832,10 @@
isisfish.sensWizardPanels.validate=Valider
isisfish.sensWizardPanels.values=Valeurs
isisfish.sensibilityWizard.title=Sensibility Wizard
-isisfish.server.ssh.generateKey.title=isisfish.server.ssh.generateKey.title
+isisfish.server.ssh.generateKey.title=G\u00E9n\u00E9rer une cl\u00E9 SSH
isisfish.setOfVessels.comments=Commentaires
isisfish.setOfVessels.fixedCosts=Co\u00FBts fixes
-isisfish.setOfVessels.name=nom
+isisfish.setOfVessels.name=Nom
isisfish.setOfVessels.numberOfVessels=Nombre de navires
isisfish.setOfVessels.technicalEfficiency=
isisfish.setOfVessels.title=Caract\u00E9ristiques
@@ -850,24 +851,27 @@
isisfish.simulation.menu.save=Sauver la simulation
isisfish.simulation.menu.simulation=Simulation
isisfish.simulation.name=Nom de la simulation
+isisfish.simulation.remote.message.connection=Connexion \u00E0 Caparmor
+isisfish.simulation.remote.message.launch=Lancement de la simulation
+isisfish.simulation.remote.message.upload=Upload de la simulation
isisfish.simulation.title=Lanceur de simulation
isisfish.simulator.launcher.inprocess=dans le m\u00EAme processus
-isisfish.simulator.launcher.remote=sur un serveur distant
+isisfish.simulator.launcher.remote=sur le serveur Caparmor
isisfish.simulator.launcher.subprocess=dans un sous processus
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.age=Age
isisfish.species.cee=CEE
isisfish.species.comments=Commentaires
-isisfish.species.length=longueur
+isisfish.species.length=Longueur
isisfish.species.name=Nom des esp\u00E8ces
isisfish.species.rubbinCode=Code Rubbin
isisfish.species.scientificName=Scientific name
isisfish.species.structured=Structur\u00E9
isisfish.strategy.comments=Commentaires
-isisfish.strategy.inactivity=
-isisfish.strategy.inactivityEquationUsed=
-isisfish.strategy.name=nom
+isisfish.strategy.inactivity=\u00C9quation d'inactivit\u00E9
+isisfish.strategy.inactivityEquationUsed=Utiliser une \u00E9quation d'inactivit\u00E9
+isisfish.strategy.name=Nom
isisfish.strategy.proportionSetOfVessels=Proportion des ensembles de navires
isisfish.strategy.title=Caract\u00E9ristiques
isisfish.strategyMonthInfo.metier=M\u00E9tier
1
0