Isis-fish-commits
Threads by month
- ----- 2026 -----
- August
- July
- 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
January 2009
- 3 participants
- 45 discussions
r1742 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org Jan. 16, 2009
by sletellier@users.labs.libre-entreprise.org Jan. 16, 2009
Jan. 16, 2009
Author: sletellier
Date: 2009-01-16 17:52:40 +0000 (Fri, 16 Jan 2009)
New Revision: 1742
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/InputOneEquationUI.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
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/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:
Save on Tab changed
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -69,11 +69,9 @@
}
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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(), getBean());
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -69,11 +69,9 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
-public void refresh(){
SetOfVessels setOfVessels = (SetOfVessels)getVerifier().getEntity(SetOfVessels.class);
setBean((SetOfVesselsImpl) setOfVessels);
if (getBean() != null){
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -49,11 +49,9 @@
setButtonTitle("isisfish.input.continueCells");
setNextPath("$root/$cells");
-public void setInputSaveVerifierBinding(){
+public void refresh(){
getVerifier().setSaveButton(save, false);
getVerifier().setCancelButton(cancel);
-}
-public void refresh(){
setBean(null);
FisheryRegion region = (FisheryRegion) getVerifier().getEntity(FisheryRegion.class);
setBean((FisheryRegionImpl)region);
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -63,13 +63,11 @@
}
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
}
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -44,8 +44,6 @@
gearTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
getVerifier().addCurrentPanel(gearTabUI, selectivityUI);
- gearTabUI.refresh();
- selectivityUI.refresh();
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2009-01-16 17:52:40 UTC (rev 1742)
@@ -51,6 +51,7 @@
import java.beans.PropertyChangeListener;
import java.beans.VetoableChangeListener;
import java.util.Date;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.beanutils.MethodUtils;
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -29,7 +29,6 @@
protected void goTo(){
getParentContainer(InputUI.class).setTreeSelection(getNextPath());
}
-public void setInputSaveVerifierBinding(){}
public void setBean(TopiaEntity t){};
]]>
</script>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputNavigationTreeSelectionAdapter.java 2009-01-16 17:52:40 UTC (rev 1742)
@@ -95,10 +95,7 @@
// apply refresh method (should a contract for all this ui with a method refresh...)
try {
currentUI = (InputContentUI) newUI;
- InputSaveVerifier verif = context.getContextValue(InputSaveVerifier.class);
- verif.addCurrentPanel(currentUI);
- currentUI.setInputSaveVerifierBinding();
- currentUI.refresh();
+ context.getContextValue(InputSaveVerifier.class).addCurrentPanel(currentUI);
currentNode = node;
} catch (Exception e) {
log.debug(e.getMessage(), e);
@@ -139,7 +136,7 @@
if (TopiaEntity.class.isInstance(data)){
verif.addCurrentEntity((TopiaEntity) data);
}
- verif.setPanelsActifs();
+ verif.refreshAll();
verif.setCurrentNode(node);
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-01-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -33,102 +33,117 @@
<fr.ifremer.isisfish.ui.input.InputContentUI>
+ <!-- bean property -->
+ <fr.ifremer.isisfish.entities.Formule id='formule' javaBean='null'/>
+
+ <String id='lblText' javaBean='null'/>
+
<script><![CDATA[
import fr.ifremer.isisfish.ui.widget.editor.GenericCell;
import fr.ifremer.isisfish.entities.Formule;
+import fr.ifremer.isisfish.entities.Equation;
+import fr.ifremer.isisfish.entities.EquationImpl;
import java.util.logging.Level;
import java.util.logging.Logger;
+import java.lang.reflect.Method;
+import org.apache.commons.beanutils.MethodUtils;
+import org.codelutin.topia.persistence.TopiaEntity;
+import fr.ifremer.isisfish.entities.EquationDAO;
+import fr.ifremer.isisfish.IsisFishDAOHelper;
-protected Class clazz = null;
-protected String nameEquation = null;
-protected String lblText;
-protected Formule f;
+protected Class clazz;
+protected TopiaEntity bean;
+protected String method;
protected String name;
-protected Class c;
+protected Equation selectedEquation;
-public void init(String lblText, Formule f, String name, Class c){
- this.lblText = lblText;
- this.f = f;
+
+public void init(String lblText, TopiaEntity bean, String method, String name, Class c){
+ setLblText(lblText);
+ this.bean = bean;
+ this.method = method;
this.name = name;
- this.c = c;
+ this.clazz = c;
+ selectedEquation = getEquation();
}
-public void refresh(){
- lbl.setText(lblText);
- clazz = c;
+protected Equation getEquation(){
+ Equation result = null;
try {
- editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
- } catch (IOException ex) {
+ if (bean != null){
+ Method m = bean.getClass().getMethod("get" + method, null);
+ result = (Equation) m.invoke(bean, (Object[])null);
+ }
+ } catch (Exception ex) {
Logger.getLogger(InputOneEquationUI.class.getName()).log(Level.SEVERE, null, ex);
}
- setComboModel(f, name);
+ return result;
}
-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;
+protected void setEquation(Formule f){
+ try {
+ EquationDAO dao = IsisFishDAOHelper.getEquationDAO(bean.getTopiaContext());
+ Equation e = dao.create("name", f.getName());
+ e.setCategory(f.getCategory());
+ e.setContent(f.getContent());
+ e.setJavaInterface(clazz);
+ e.setLanguage("java");
+ e.update();
+ e.getTopiaContext().commitTransaction();
+ if (bean != null) {
+ Method m = bean.getClass().getMethod("set" + method, Equation.class);
+ m.invoke(bean, e);
}
+ } catch (Exception ex) {
+ Logger.getLogger(InputOneEquationUI.class.getName()).log(Level.SEVERE, null, ex);
}
- 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());
+public void refresh(){
+ try {
+ editor.open(org.codelutin.util.FileUtil.getTempFile("", ".java"));
+ } catch (IOException ex) {
+ Logger.getLogger(InputOneEquationUI.class.getName()).log(Level.SEVERE, null, ex);
}
- f = selected;
+ setComboModel();
+ setFormule((Formule)combo.getSelectedItem());
+ setEditorText();
}
-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();
- }
+protected void setComboModel(){
+ java.util.List<Formule> formules = getAction().getFormules(getVerifier().getIsisContext(), name);
+ if (formules != null){
+ jaxx.runtime.swing.Utils.fillComboBox(combo,formules, selectedEquation, "getName");
}
- return result;
}
protected void saveModel(){
- Formule e = getFormule();
+ Formule e = (Formule)combo.getSelectedItem();
if (e != null){
getContextValue(InputAction.class).saveAsModel(e.getCategory(), "Java", e.getContent());
}
else{
getContextValue(InputAction.class).saveAsModel(name, "Java", editor.getText());
- setComboModel(f, name);
+ setComboModel();
}
- refresh();
setInfoText(_("isisfish.message.saveModel.finished"));
}
protected void openEditor(){
- Formule e = getFormule();
+ Formule e = (Formule)combo.getSelectedItem();
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);
+ getContextValue(InputAction.class).openEditor(name, "new", clazz, editor.getText(), editor);
}
}
+protected void setEditorText(){
+ editor.setText(getFormule().getContent());
+}
]]>
</script>
<Table id='body'>
<row>
<cell fill='horizontal' anchor='east'>
- <JLabel id='lbl'/>
+ <JLabel id='lbl' text='{getLblText()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
- <JComboBox id="combo" onActionPerformed='comboChanged()' enabled='{isActif()}'/>
+ <JComboBox id="combo" onActionPerformed='setFormule((Formule)combo.getSelectedItem());setEquation(getFormule());setEditorText();' enabled='{isActif()}'/>
</cell>
</row>
<row>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-01-16 17:52:40 UTC (rev 1742)
@@ -288,6 +288,7 @@
for (InputContentUI panel : currentPanels){
panel.refresh();
}
+ setPanelsActifs();
}
public void addCurrentEntity(TopiaEntity currentEntity) {
if (currentEntity != null){
@@ -312,6 +313,7 @@
public void addCurrentPanel(InputContentUI... panels) {
for (InputContentUI ui : panels){
this.currentPanels.add(ui);
+ ui.refresh();
}
setPanelsActifs();
}
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2009-01-16 17:52:40 UTC (rev 1742)
@@ -33,8 +33,6 @@
pane.setSelectedIndex(selectedIndex);
}
ui = (InputContentUI) pane.getSelectedComponent();
- ui.setInputSaveVerifierBinding();
- ui.refresh();
cacheSelectedIndex = pane.getSelectedIndex();
pane.addChangeListener(this);
} catch (Exception ex) {
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -56,13 +56,9 @@
import org.codelutin.topia.TopiaContext;
import javax.swing.table.TableCellEditor;
-
-public void setInputSaveVerifierBinding(){
+ public void refresh() {
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
- public void refresh() {
- getVerifier().addCurrentPanel(targetFactor);
Metier metier = (Metier)getVerifier().getEntity(Metier.class);
setBean((MetierImpl) metier);
if (getBean() != null){
@@ -77,8 +73,8 @@
}
// TODO : Equation selectionne
- targetFactor.init(_("isisfish.metierSeasonInfoSpecies.targetFactor"), null, "TargetSpeciesTargetFactorEquation", fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class);
- targetFactor.refresh();
+ targetFactor.init(_("isisfish.metierSeasonInfoSpecies.targetFactor"), null, "", "TargetSpeciesTargetFactorEquation", fr.ifremer.isisfish.equation.TargetSpeciesTargetFactorEquation.class);
+ getVerifier().addCurrentPanel(targetFactor);
}
else{
DefaultComboBoxModel seasonModel = new DefaultComboBoxModel();
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -84,13 +84,11 @@
}
});
-public void setInputSaveVerifierBinding(){
- getVerifier().setSaveButton(save);
- getVerifier().setCancelButton(cancel);
- getVerifier().setNewButton(create, "MetierSeasonInfo");
- getVerifier().setDeleteButton(remove);
-}
public void refresh() {
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "MetierSeasonInfo");
+ getVerifier().setDeleteButton(remove);
Metier metier = (Metier)getVerifier().getEntity(Metier.class);
setBean((MetierImpl) metier);
if (metier != null){
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -48,13 +48,11 @@
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() {
+ getVerifier().setSaveButton(save);
+ getVerifier().setCancelButton(cancel);
+ getVerifier().setNewButton(create, "Metier");
+ getVerifier().setDeleteButton(remove);
try {
Metier metier = (Metier)getVerifier().getEntity(Metier.class);
setBean((MetierImpl) metier);
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -46,10 +46,7 @@
metierTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
getVerifier().addCurrentPanel(metierTabUI, metierSeasonInfoUI, metierSeasonSpeciesUI);
- metierTabUI.refresh();
- metierSeasonSpeciesUI.refresh();
metierSeasonInfoUI.setSeasonInit(true);
- metierSeasonInfoUI.refresh();
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -67,24 +67,20 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh(){
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);
- growthEquation.refresh();
- growthReverseEquation.refresh();
+ growthEquation.init(_("isisfish.populationBasics.growth"), getBean(), "Growth", "PopulationGrowth", fr.ifremer.isisfish.equation.PopulationGrowth.class);
+ growthReverseEquation.init(_("isisfish.populationBasics.growthReverse"), getBean(), "GrowthReverse", "PopulationGrowthReverse", fr.ifremer.isisfish.equation.PopulationGrowthReverse.class);
+ getVerifier().addCurrentPanel(growthEquation, growthReverseEquation);
if (getBean() != null){
- jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsMatureClass,getBean().getPopulationGroup(), getBean().getMaturityGroup());
+ jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationBasicsMatureClass, getBean().getPopulationGroup(), getBean().getMaturityGroup());
setTableAgeLengthModel();
}
}
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -58,11 +58,9 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
-public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
fieldPopulationCapturability.addMatrixListener(new MatrixPanelListener() {
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -43,20 +43,15 @@
import fr.ifremer.isisfish.entities.Population;
import fr.ifremer.isisfish.entities.PopulationImpl;
-public void setInputSaveVerifierBinding(){
+public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
-public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
+ naturalDeathRate.init(_("isisfish.populationEquation.naturalDeathRate"), getBean(), "NaturalDeathRate", "PopulationNaturalDeathRate", fr.ifremer.isisfish.equation.PopulationNaturalDeathRate.class);
+ meanWeight.init(_("isisfish.populationEquation.meanWeight"), getBean(), "MeanWeight", "PopulationMeanWeight", fr.ifremer.isisfish.equation.PopulationMeanWeight.class);
+ price.init(_("isisfish.populationEquation.price"), getBean(), "Price", "PopulationPrice", fr.ifremer.isisfish.equation.PopulationPrice.class);
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);
- naturalDeathRate.refresh();
- meanWeight.refresh();
- price.refresh();
}
]]>
</script>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -68,11 +68,9 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
-public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationGroupPopulationGroup,getBean().getPopulationGroup(), 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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -52,13 +52,10 @@
public void refresh(){
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
+ migrationEquation.init(_("isisfish.common.migration"), getPopInfo(), "MigrationEquation", "Migration", fr.ifremer.isisfish.equation.MigrationEquation.class);
+ emigrationEquation.init(_("isisfish.common.emigration"), getPopInfo(), "EmigrationEquation", "Emigration", fr.ifremer.isisfish.equation.EmigrationEquation.class);
+ immigrationEquation.init(_("isisfish.common.immigration"), getPopInfo(), "ImmigrationEquation", "Immigration", fr.ifremer.isisfish.equation.ImmigrationEquation.class);
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);
- migrationEquation.refresh();
- emigrationEquation.refresh();
- immigrationEquation.refresh();
}
]]>
</script>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -59,11 +59,9 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh(){
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);
@@ -76,10 +74,6 @@
populationMigrationMigrationUI.init(selected);
populationMigrationImmigrationUI.init(selected);
populationMigrationEmigrationUI.init(selected);
- populationMigrationEquationUI.refresh();
- populationMigrationMigrationUI.refresh();
- populationMigrationImmigrationUI.refresh();
- populationMigrationEmigrationUI.refresh();
}
}
protected void setFieldPopulationMigrationSeasonChooserModel(){
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -59,17 +59,14 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
-public void refresh() {
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
+ reproductionEquation.init(_("isisfish.populationRecruitment.reproductionEquation"), getBean(), "ReproductionEquation", "PopulationReproductionEquation", fr.ifremer.isisfish.equation.PopulationGrowth.class);
getVerifier().addCurrentPanel(reproductionEquation);
- reproductionEquation.init(_("isisfish.populationRecruitment.reproductionEquation"), (Formule)getBean().getReproductionEquation(), "PopulationReproductionEquation", fr.ifremer.isisfish.equation.PopulationGrowth.class);
- reproductionEquation.refresh();
}
]]>
</script>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -83,13 +83,11 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh(){
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);
jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationSeasonInfoChooser,getBean().getPopulationSeasonInfo(), null);
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -51,14 +51,6 @@
populationTab.addChangeListener(new InputTabbedPaneListener());
public void refresh(){
getVerifier().addCurrentPanel(populationBasicsUI, populationGroupUI, populationEquationUI, populationZoneUI, populationSeasonsUI, populationCapturabilityUI, populationRecruitementUI, populationMigrationUI);
- populationBasicsUI.refresh();
- populationGroupUI.refresh();
- populationEquationUI.refresh();
- populationZoneUI.refresh();
- populationSeasonsUI.refresh();
- populationCapturabilityUI.refresh();
- populationRecruitementUI.refresh();
- populationMigrationUI.refresh();
}
]]>
</script>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -61,94 +61,92 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
- public void refresh(){
- Population population = (Population)getVerifier().getEntity(Population.class);
- setBean((PopulationImpl) population);
- 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();
- }
- });
- }
- protected void fieldPopulationMappingZoneReproZoneRecruChanged(){
- getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix());
- }
- protected void setFieldPopulationMappingZoneReproZoneRecru(){
- if (getBean().getMappingZoneReproZoneRecru() != null){
- fieldPopulationMappingZoneReproZoneRecru.setMatrix(getBean().getMappingZoneReproZoneRecru().copy());
+ @Override
+ public void matrixChanged(MatrixPanelEvent arg0) {
+ fieldPopulationMappingZoneReproZoneRecruChanged();
}
+ });
+}
+protected void fieldPopulationMappingZoneReproZoneRecruChanged(){
+ getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix());
+}
+protected void setFieldPopulationMappingZoneReproZoneRecru(){
+ if (getBean().getMappingZoneReproZoneRecru() != null){
+ fieldPopulationMappingZoneReproZoneRecru.setMatrix(getBean().getMappingZoneReproZoneRecru().copy());
}
- protected void setPopulationZonesPresenceModel(){
- setModel(getBean().getPopulationZone(), populationZonesPresence);
- }
- protected void setFieldPopulationZonesReproductionModel(){
- setModel(getBean().getReproductionZone(), fieldPopulationZonesReproduction);
- }
- protected void setFieldPopulationZonesRecruitmentModel(){
- setModel(getBean().getRecruitmentZone(), fieldPopulationZonesRecruitment);
- }
- protected void setModel(java.util.List<Zone> selected, JAXXList componant){
- DefaultListModel model = new DefaultListModel();
- java.util.List<Zone> zones = getRegion().getZone();
- java.util.List<GenericCell> selectedZones = new ArrayList<GenericCell>();
- if (zones != null){
- for (Zone z : zones){
- GenericCell cell = new GenericCell(z.getName(), z, Zone.class);
- model.addElement(cell);
- if (selected != null){
- if (selected.contains(z)){
- selectedZones.add(cell);
- }
+}
+protected void setPopulationZonesPresenceModel(){
+ setModel(getBean().getPopulationZone(), populationZonesPresence);
+}
+protected void setFieldPopulationZonesReproductionModel(){
+ setModel(getBean().getReproductionZone(), fieldPopulationZonesReproduction);
+}
+protected void setFieldPopulationZonesRecruitmentModel(){
+ setModel(getBean().getRecruitmentZone(), fieldPopulationZonesRecruitment);
+}
+protected void setModel(java.util.List<Zone> selected, JAXXList componant){
+ DefaultListModel model = new DefaultListModel();
+ java.util.List<Zone> zones = getRegion().getZone();
+ java.util.List<GenericCell> selectedZones = new ArrayList<GenericCell>();
+ if (zones != null){
+ for (Zone z : zones){
+ GenericCell cell = new GenericCell(z.getName(), z, Zone.class);
+ model.addElement(cell);
+ if (selected != null){
+ if (selected.contains(z)){
+ selectedZones.add(cell);
}
}
}
- componant.setModel(model);
- if (selectedZones.size() > 0){
- java.util.List <Integer> indicesList = new ArrayList<Integer>();
- for (GenericCell c : selectedZones){
- indicesList.add(model.indexOf(c));
- }
- int[] indices = new int[indicesList.size()];
- int cnt = 0;
- for (Integer i : indicesList){
- indices[cnt]=i;
- cnt ++;
- }
- componant.setSelectedIndices(indices);
+ }
+ componant.setModel(model);
+ if (selectedZones.size() > 0){
+ java.util.List <Integer> indicesList = new ArrayList<Integer>();
+ for (GenericCell c : selectedZones){
+ indicesList.add(model.indexOf(c));
}
+ int[] indices = new int[indicesList.size()];
+ int cnt = 0;
+ for (Integer i : indicesList){
+ indices[cnt]=i;
+ cnt ++;
+ }
+ componant.setSelectedIndices(indices);
}
- protected void presenceChanged(){
- getBean().setPopulationZone(getSelectedValue(populationZonesPresence));
- }
- protected void reproductionChanged(){
- getBean().setReproductionZone(getSelectedValue(fieldPopulationZonesReproduction));
- }
- protected void recruitementChanged(){
- getBean().setRecruitmentZone(getSelectedValue(fieldPopulationZonesRecruitment));
- }
- protected java.util.List<Zone> getSelectedValue(JAXXList componant){
- Object[] selected = componant.getSelectedValues();
- java.util.List<Zone> selectedZone = new ArrayList<Zone>();
- if (selected != null){
- for (Object i : selected){
- GenericCell cell = (GenericCell)i;
- if (cell.getValue() != null){
- selectedZone.add((Zone)cell.getValue());
- }
+}
+protected void presenceChanged(){
+ getBean().setPopulationZone(getSelectedValue(populationZonesPresence));
+}
+protected void reproductionChanged(){
+ getBean().setReproductionZone(getSelectedValue(fieldPopulationZonesReproduction));
+}
+protected void recruitementChanged(){
+ getBean().setRecruitmentZone(getSelectedValue(fieldPopulationZonesRecruitment));
+}
+protected java.util.List<Zone> getSelectedValue(JAXXList componant){
+ Object[] selected = componant.getSelectedValues();
+ java.util.List<Zone> selectedZone = new ArrayList<Zone>();
+ if (selected != null){
+ for (Object i : selected){
+ GenericCell cell = (GenericCell)i;
+ if (cell.getValue() != null){
+ selectedZone.add((Zone)cell.getValue());
}
}
- return selectedZone;
}
+ return selectedZone;
+}
]]>
</script>
<Table id='body'>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -74,48 +74,46 @@
}
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
- jaxx.runtime.swing.Utils.fillList(portCell, getRegion().getCell(), getBean().getCell());
- portMap.setFisheryRegion(getRegion());
- if(mapListener == null){
- portMap.setSelectionMode(CellSelectionLayer.SINGLE_SELECTION);
- portMap.setActiveMouseMode(new SelectMouseMode());
- toolSet.setupListeners(portMap);
- toolMap.add((Component)toolSet);
- setMapListener();
- }
- refreshMap();
+ 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);
+ portMap.setActiveMouseMode(new SelectMouseMode());
+ toolSet.setupListeners(portMap);
+ toolMap.add((Component)toolSet);
+ setMapListener();
}
- protected void refreshMap(){
- java.util.List<Cell> cells = new ArrayList<Cell>();
- cells.add((Cell)portCell.getSelectedValue());
- portMap.setSelectedCells(cells);
- }
- protected void setMapListener(){
- if (mapListener == null){
- mapListener = new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) {
+ refreshMap();
+}
+protected void refreshMap(){
+ java.util.List<Cell> cells = new ArrayList<Cell>();
+ cells.add((Cell)portCell.getSelectedValue());
+ portMap.setSelectedCells(cells);
+}
+protected void setMapListener(){
+ if (mapListener == null){
+ mapListener = new OpenMapEvents(portMap, new SelectMouseMode(false), CellSelectionLayer.SINGLE_SELECTION) {
- @Override
- public boolean onMouseClicked() {
- for (Cell c : portMap.getSelectedCells()){
- if (getBean() != null){
- getBean().setCell(c);
- }
+ @Override
+ public boolean onMouseClicked() {
+ for (Cell c : portMap.getSelectedCells()){
+ if (getBean() != null){
+ getBean().setCell(c);
}
- refresh();
- return true;
}
- };
- }
+ refresh();
+ return true;
+ }
+ };
}
+}
]]>
</script>
<Table id='body'>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -56,12 +56,9 @@
import fr.ifremer.isisfish.entities.Metier;
import fr.ifremer.isisfish.entities.MetierImpl;
-public void setInputSaveVerifierBinding(){
+public void refresh(){
getVerifier().setSaveButton(save);
getVerifier().setCancelButton(cancel);
-}
-public void refresh(){
- getVerifier().addCurrentPanel(selectivityEquation);
InputAction action = getAction();
setBean(null);
Gear gear = (Gear)getVerifier().getEntity(Gear.class);
@@ -72,8 +69,8 @@
}
// TODO : Equation selection
- selectivityEquation.init(_("isisfish.selectivity.equation"), null, "SelectivityEquation", fr.ifremer.isisfish.equation.SelectivityEquation.class);
- selectivityEquation.refresh();
+ selectivityEquation.init(_("isisfish.selectivity.equation"), null, "", "SelectivityEquation", fr.ifremer.isisfish.equation.SelectivityEquation.class);
+ getVerifier().addCurrentPanel(selectivityEquation);
}
protected void setSelectivityTableModel(){
DefaultTableModel model = new DefaultTableModel(){
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsTabsUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -65,22 +65,19 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
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"), getBean(), "TechnicalEfficiencyEquation", "SoVTechnicalEfficiencyEquation", fr.ifremer.isisfish.equation.SoVTechnicalEfficiencyEquation.class);
+ getVerifier().addCurrentPanel(technicalEfficiency);
}
}
]]>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -44,8 +44,6 @@
setOfVesselsTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
getVerifier().addCurrentPanel(setOfVesselsTabsUI, effortDescriptionUI);
- setOfVesselsTabsUI.refresh();
- effortDescriptionUI.refresh();
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -62,13 +62,11 @@
}
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
setNextPath("$root/$species/" + getBean().getTopiaId() + "/$populations");
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -36,12 +36,9 @@
<script><![CDATA[
import fr.ifremer.isisfish.types.Month;
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
@@ -54,18 +51,7 @@
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();
+ getVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, strategyApril, strategyMay, strategyJune, strategyJuly, strategyAugust, strategySeptember, strategyOctober, strategyNovember, strategyDecember);
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -76,7 +76,7 @@
}
});
public void refresh() {
- Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class);
+ 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());
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -64,19 +64,16 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
if (getBean() != null){
- strategyInactivity.init("", (Formule)getBean().getInactivityEquation(), "StrategyInactivityEquation", fr.ifremer.isisfish.equation.StrategyInactivityEquation.class);
- strategyInactivity.refresh();
+ strategyInactivity.init("", getBean(), "InactivityEquation", "StrategyInactivityEquation", fr.ifremer.isisfish.equation.StrategyInactivityEquation.class);
+ getVerifier().addCurrentPanel(strategyInactivity);
setSetOfVesselsModel();
}
}
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -40,8 +40,6 @@
strategyTab.addChangeListener(new InputTabbedPaneListener());
public void refresh() {
getVerifier().addCurrentPanel(strategyTabUI, strategyMonthInfoUI);
- strategyTabUI.refresh();
- strategyMonthInfoUI.refresh();
}
]]></script>
<JPanel id='body' layout='{new BorderLayout()}'>
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -61,13 +61,12 @@
}
}
});
-public void setInputSaveVerifierBinding(){
+
+public void refresh() {
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);
}
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -65,13 +65,11 @@
}
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
jaxx.runtime.swing.Utils.fillList(vesselTypeTripType, getRegion().getTripType(), getBean().getTripType());
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-14 15:45:53 UTC (rev 1741)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2009-01-16 17:52:40 UTC (rev 1742)
@@ -69,13 +69,11 @@
}
});
-public void setInputSaveVerifierBinding(){
+public void refresh() {
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);
setBean((ZoneImpl) zone);
1
0
r1741 - isis-fish/trunk/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org Jan. 14, 2009
by chatellier@users.labs.libre-entreprise.org Jan. 14, 2009
Jan. 14, 2009
Author: chatellier
Date: 2009-01-14 15:45:53 +0000 (Wed, 14 Jan 2009)
New Revision: 1741
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:
Download simulation result when simulation complete.
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 2009-01-14 14:37:55 UTC (rev 1740)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-01-14 15:45:53 UTC (rev 1741)
@@ -21,7 +21,10 @@
Clear\ done\ jobs=
Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s=
Error\ during\ vcs\ initialisation=
+Error\ while\ downloading\ simulation\ control=
+Error\ while\ launching\ simulation=
Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys=
+Error\ while\ uploading\ simulation=
Generate\ next\ simulation=
Import\ one\ java\ file\ script\ source=
Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s=
@@ -51,7 +54,6 @@
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
@@ -65,7 +67,6 @@
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...
@@ -94,7 +95,6 @@
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
@@ -318,10 +318,6 @@
isisfish.error.script.save=Can't save file %1$s for reason %2$s
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
isisfish.error.simulation.resultXml.close=Can't close simulation result XML for reason %1$s
isisfish.error.simulation.resultXml.open=Can't open simulation result XML for reason %1$s
@@ -443,17 +439,6 @@
isisfish.infoItem.sum=defaultToolTip-fr.ifremer.resultat.InfoItemDate.sumButton
isisfish.infoItem.sum.year=Sum elements per year
isisfish.infoItem.table=defaultToolTip-fr.ifremer.resultat.InfoItem.table30
-isisfish.input.continueCells=Continue to Cells
-isisfish.input.continueGears=Continue to Gears
-isisfish.input.continueMetiers=Continue to Metiers
-isisfish.input.continuePopulations=Continue to Populations
-isisfish.input.continuePorts=Continue to Ports
-isisfish.input.continueSetOfVessels=Continue to SetOfVessels
-isisfish.input.continueSpecies=Continue to Species
-isisfish.input.continueStrategies=Continue to Strategies
-isisfish.input.continueTripTypes=Continue to TripTypes
-isisfish.input.continueVesselTypes=Continue to VesselTypes
-isisfish.input.continueZones=Continue to zones
isisfish.input.menu.addRegion=Add region
isisfish.input.menu.commit=Commit change
isisfish.input.menu.copyRegion=Copy Region
@@ -857,6 +842,7 @@
isisfish.simulation.menu.simulation=Simulation
isisfish.simulation.name=Simulation name
isisfish.simulation.remote.message.connection=Connecting to Caparmor
+isisfish.simulation.remote.message.downloadresults=Downloading results
isisfish.simulation.remote.message.launch=Launching simulation
isisfish.simulation.remote.message.upload=Uploading simulation
isisfish.simulation.title=Simulation launcher
@@ -874,7 +860,6 @@
isisfish.species.scientificName=Scientific name
isisfish.species.structured=Structured
isisfish.strategy.comments=Comments
-isisfish.strategy.inactivity=Inactivity equation
isisfish.strategy.inactivityEquationUsed=Use inactivity equation
isisfish.strategy.name=Name
isisfish.strategy.proportionSetOfVessels=Set of vessels proportion
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 2009-01-14 14:37:55 UTC (rev 1740)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-01-14 15:45:53 UTC (rev 1741)
@@ -21,7 +21,10 @@
Clear\ done\ jobs=
Could\ not\ found\ formule\ type\ %s\ autorised\ type\ are\ %s=
Error\ during\ vcs\ initialisation=
+Error\ while\ downloading\ simulation\ control=
+Error\ while\ launching\ simulation=
Error\ while\ uploading\ public\ key\ to\ remote\ serveur\ authorized_keys=
+Error\ while\ uploading\ simulation=
Generate\ next\ simulation=
Import\ one\ java\ file\ script\ source=
Import\ simulation\ file\ %s\ in\ directory\ %s\ and\ rename\ from\ %s\ to\ %s=
@@ -51,7 +54,6 @@
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
@@ -65,7 +67,6 @@
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...
@@ -94,7 +95,6 @@
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
@@ -318,10 +318,6 @@
isisfish.error.script.save=N'a pas pu sauver le fichier %1$s pour la raison suivante %2$s
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
isisfish.error.simulation.resultXml.close=Can't close simulation result XML for reason %1$s
isisfish.error.simulation.resultXml.open=Can't open simulation result XML for reason %1$s
@@ -443,17 +439,6 @@
isisfish.infoItem.sum=defaultToolTip-fr.ifremer.resultat.InfoItemDate.sumButton
isisfish.infoItem.sum.year=Somme de \u00E9l\u00E9ment par ann\u00E9e
isisfish.infoItem.table=defaultToolTip-fr.ifremer.resultat.InfoItem.table30
-isisfish.input.continueCells=Continuer vers les mailles
-isisfish.input.continueGears=Continuer vers les engins
-isisfish.input.continueMetiers=Continuer vers les M\u00E9tiers
-isisfish.input.continuePopulations=Continuer vers les populations
-isisfish.input.continuePorts=Continuer vers les ports
-isisfish.input.continueSetOfVessels=Continuer vers les ensembles de navires
-isisfish.input.continueSpecies=Contiuer vers les esp\u00E8ces
-isisfish.input.continueStrategies=Continuer vers les strat\u00E9gies
-isisfish.input.continueTripTypes=Continuer vers les types de trajets
-isisfish.input.continueVesselTypes=Continuer vers les types de navires
-isisfish.input.continueZones=Continuer vers les zones
isisfish.input.menu.addRegion=Ajouter une r\u00E9gion
isisfish.input.menu.commit=Sauvegarder les changements
isisfish.input.menu.copyRegion=Copier r\u00E9gion
@@ -857,6 +842,7 @@
isisfish.simulation.menu.simulation=Simulation
isisfish.simulation.name=Nom de la simulation
isisfish.simulation.remote.message.connection=Connexion \u00E0 Caparmor
+isisfish.simulation.remote.message.downloadresults=T\u00E9l\u00E9chargement des r\u00E9sultats
isisfish.simulation.remote.message.launch=Lancement de la simulation
isisfish.simulation.remote.message.upload=Upload de la simulation
isisfish.simulation.title=Lanceur de simulation
@@ -874,7 +860,6 @@
isisfish.species.scientificName=Scientific name
isisfish.species.structured=Structur\u00E9
isisfish.strategy.comments=Commentaires
-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
1
0
Author: chatellier
Date: 2009-01-14 14:37:55 +0000 (Wed, 14 Jan 2009)
New Revision: 1740
Modified:
isis-fish/trunk/changelog.txt
Log:
Update changelog
Modified: isis-fish/trunk/changelog.txt
===================================================================
--- isis-fish/trunk/changelog.txt 2009-01-14 14:22:05 UTC (rev 1739)
+++ isis-fish/trunk/changelog.txt 2009-01-14 14:37:55 UTC (rev 1740)
@@ -1,5 +1,8 @@
isis-fish (3.2.0.x) xxx
+ * Add ssh simulation launcher
+ * Add Jaxx UI for all interfaces
+ * Remove SwixAT UI
* switch to lutinproject 3.3
* switch to topia-service 1.0.1
* switch to topia-persistence 2.1.1
1
0
r1739 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org Jan. 14, 2009
by chatellier@users.labs.libre-entreprise.org Jan. 14, 2009
Jan. 14, 2009
Author: chatellier
Date: 2009-01-14 14:22:05 +0000 (Wed, 14 Jan 2009)
New Revision: 1739
Added:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHUtils.java
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java
Log:
Move ssh specific code to utility class.
Use ANT optionnal ssh task code (better than jsch samples)
Download simulation result when simulation complete.
Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHUtils.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHUtils.java (rev 0)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHUtils.java 2009-01-14 14:22:05 UTC (rev 1739)
@@ -0,0 +1,495 @@
+/* *##%
+ * Copyright (C) 2008 Code Lutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *##%*/
+
+package fr.ifremer.isisfish.simulator.launcher;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+
+/**
+ * SSH utils class.
+ *
+ * All this code has be taken from ant optionnal ssh task.
+ *
+ * Use full for:
+ * - scpTo command
+ * - scpFrom command
+ * - exec command
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 13 janv. 2009 $
+ * By : $Author: chatellier $
+ */
+public class SSHUtils {
+
+ /** log. */
+ private static Log log = LogFactory.getLog(SSHUtils.class);
+
+ protected static final byte LINE_FEED = 0x0a;
+ protected static final int BUFFER_SIZE = 1024;
+ private static final int HUNDRED_KILOBYTES = 102400;
+
+ /** Utility class */
+ protected SSHUtils() {
+
+ }
+
+ /**
+ * Exec command on remote server.
+ *
+ * @param session opened valid session
+ * @param command command to exec
+ * @throws SSHException
+ */
+ public static void exec(Session session, String command)
+ throws SSHException {
+
+ try {
+ // exec previous command
+ Channel channel = session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ channel.getInputStream()));
+ channel.connect();
+ String line = null;
+ while (true) {
+ while ((line = br.readLine()) != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Remote output : " + line);
+ }
+ }
+ if (channel.isClosed()) {
+ if (log.isInfoEnabled()) {
+ log.info("JSch channel exit-status: "
+ + channel.getExitStatus());
+ }
+ break;
+ }
+ try {
+ Thread.sleep(500);
+ } catch (Exception ee) {
+ }
+ }
+ channel.disconnect();
+ // end read buffer
+ } catch (JSchException e) {
+ throw new SSHException("I/O error while executing command", e);
+ } catch (IOException e) {
+ throw new SSHException("I/O error while executing command", e);
+ }
+
+ }
+
+ /**
+ * Download a local file from remote server.
+ *
+ * @param session opened valid jsch session
+ * @param remoteFileName remote file name to download
+ * @param localFile local file name to download into
+ *
+ * @throws SSHException
+ */
+ public static void scpFrom(Session session, String remoteFileName,
+ File localFile) throws SSHException {
+
+ String command = "scp -f -r \"" + remoteFileName + "\"";
+
+ ChannelExec channel = null;
+ try {
+ channel = (ChannelExec) session.openChannel("exec");
+ channel.setCommand(command);
+
+ // get I/O streams for remote scp
+ OutputStream out = channel.getOutputStream();
+ InputStream in = channel.getInputStream();
+
+ channel.connect();
+
+ sendAck(out);
+ startRemoteCpProtocol(in, out, localFile);
+ } catch (IOException e) {
+ throw new SSHException(e);
+ } catch (JSchException e) {
+ throw new SSHException(e);
+ } finally {
+ if (channel != null) {
+ channel.disconnect();
+ }
+ }
+ }
+
+ /**
+ * Upload file on remote server.
+ *
+ * @param session opened valid session
+ * @param localFile file to upload
+ * @param remoteFilePath remote file path
+ *
+ * @throws SSHException
+ */
+ public static void scpTo(Session session, File localFile,
+ String remoteFilePath) throws SSHException {
+
+ try {
+ doSingleTransfer(session, localFile, remoteFilePath);
+ } catch (IOException e) {
+ throw new SSHException(e);
+ } catch (JSchException e) {
+ throw new SSHException(e);
+ }
+ }
+
+ /**
+ * Send an ack.
+ * @param out the output stream to use
+ * @throws IOException on error
+ */
+ protected static void sendAck(OutputStream out) throws IOException {
+ byte[] buf = new byte[1];
+ buf[0] = 0;
+ out.write(buf);
+ out.flush();
+ }
+
+ /**
+ * Reads the response, throws a BuildException if the response
+ * indicates an error.
+ * @param in the input stream to use
+ * @throws IOException on I/O error
+ */
+ protected static void waitForAck(InputStream in) throws IOException,
+ SSHException {
+ int b = in.read();
+
+ // b may be 0 for success,
+ // 1 for error,
+ // 2 for fatal error,
+
+ if (b == -1) {
+ // didn't receive any response
+ throw new SSHException("No response from server");
+ } else if (b != 0) {
+ StringBuffer sb = new StringBuffer();
+
+ int c = in.read();
+ while (c > 0 && c != '\n') {
+ sb.append((char) c);
+ c = in.read();
+ }
+
+ if (b == 1) {
+ throw new SSHException("server indicated an error: "
+ + sb.toString());
+ } else if (b == 2) {
+ throw new SSHException("server indicated a fatal error: "
+ + sb.toString());
+ } else {
+ throw new SSHException("unknown response, code " + b
+ + " message: " + sb.toString());
+ }
+ }
+ }
+
+ /**
+ * Track progress every 10% if 100kb < filesize < 1mb. For larger
+ * files track progress for every percent transmitted.
+ * @param filesize the size of the file been transmitted
+ * @param totalLength the total transmission size
+ * @param percentTransmitted the current percent transmitted
+ * @return the percent that the file is of the total
+ */
+ protected static int trackProgress(long filesize, long totalLength,
+ int percentTransmitted) {
+
+ // CheckStyle:MagicNumber OFF
+ int percent = (int) Math.round(Math
+ .floor((totalLength / (double) filesize) * 100));
+
+ if (percent > percentTransmitted) {
+ if (filesize < 1048576) {
+ if (percent % 5 == 0) {
+ if (percent == 100) {
+ System.out.println(" 100%");
+ } else {
+ System.out.print("*");
+ }
+ }
+ } else {
+ if (percent == 50) {
+ System.out.println(" 50%");
+ } else if (percent == 100) {
+ System.out.println(" 100%");
+ } else {
+ System.out.print(".");
+ }
+ }
+ }
+ // CheckStyle:MagicNumber ON
+
+ return percent;
+ }
+
+ protected static void startRemoteCpProtocol(InputStream in,
+ OutputStream out, File localFile) throws IOException, SSHException {
+ File startFile = localFile;
+ while (true) {
+ // C0644 filesize filename - header for a regular file
+ // T time 0 time 0\n - present if perserve time.
+ // D directory - this is the header for a directory.
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ while (true) {
+ int read = in.read();
+ if (read < 0) {
+ return;
+ }
+ if ((byte) read == LINE_FEED) {
+ break;
+ }
+ stream.write(read);
+ }
+ String serverResponse = stream.toString("UTF-8");
+ if (serverResponse.charAt(0) == 'C') {
+ parseAndFetchFile(serverResponse, startFile, out, in);
+ } else if (serverResponse.charAt(0) == 'D') {
+ startFile = parseAndCreateDirectory(serverResponse, startFile);
+ sendAck(out);
+ } else if (serverResponse.charAt(0) == 'E') {
+ startFile = startFile.getParentFile();
+ sendAck(out);
+ } else if (serverResponse.charAt(0) == '\01'
+ || serverResponse.charAt(0) == '\02') {
+ // this indicates an error.
+ throw new IOException(serverResponse.substring(1));
+ }
+ }
+ }
+
+ protected static File parseAndCreateDirectory(String serverResponse,
+ File localFile) {
+ int start = serverResponse.indexOf(" ");
+ // appears that the next token is not used and it's zero.
+ start = serverResponse.indexOf(" ", start + 1);
+ String directoryName = serverResponse.substring(start + 1);
+ if (localFile.isDirectory()) {
+ File dir = new File(localFile, directoryName);
+ dir.mkdir();
+ log.debug("Creating: " + dir);
+ return dir;
+ }
+ return null;
+ }
+
+ protected static void parseAndFetchFile(String serverResponse,
+ File localFile, OutputStream out, InputStream in)
+ throws IOException, SSHException {
+ int start = 0;
+ int end = serverResponse.indexOf(" ", start + 1);
+ start = end + 1;
+ end = serverResponse.indexOf(" ", start + 1);
+ long filesize = Long.parseLong(serverResponse.substring(start, end));
+ String filename = serverResponse.substring(end + 1);
+ log.debug("Receiving: " + filename + " : " + filesize);
+ File transferFile = (localFile.isDirectory()) ? new File(localFile,
+ filename) : localFile;
+ fetchFile(transferFile, filesize, out, in);
+ waitForAck(in);
+ sendAck(out);
+ }
+
+ protected static void fetchFile(File localFile, long filesize,
+ OutputStream out, InputStream in) throws IOException {
+ byte[] buf = new byte[BUFFER_SIZE];
+ sendAck(out);
+
+ // read a content of lfile
+ FileOutputStream fos = new FileOutputStream(localFile);
+ int length;
+ long totalLength = 0;
+
+ // only track progress for files larger than 100kb in verbose mode
+ boolean trackProgress = filesize > HUNDRED_KILOBYTES;
+ // since filesize keeps on decreasing we have to store the
+ // initial filesize
+ long initFilesize = filesize;
+ int percentTransmitted = 0;
+
+ try {
+ while (true) {
+ length = in.read(buf, 0, (BUFFER_SIZE < filesize) ? BUFFER_SIZE
+ : (int) filesize);
+ if (length < 0) {
+ throw new EOFException("Unexpected end of stream.");
+ }
+ fos.write(buf, 0, length);
+ filesize -= length;
+ totalLength += length;
+ if (filesize == 0) {
+ break;
+ }
+
+ if (trackProgress) {
+ percentTransmitted = trackProgress(initFilesize,
+ totalLength, percentTransmitted);
+ }
+ }
+ } finally {
+ fos.flush();
+ fos.close();
+ }
+ }
+
+ protected static void doSingleTransfer(Session session, File localFile,
+ String remoteFilePath) throws IOException, JSchException,
+ SSHException {
+
+ String command = "scp -t \"" + remoteFilePath + "\"";
+ ChannelExec channel = (ChannelExec) session.openChannel("exec");
+ channel.setCommand(command);
+ try {
+
+ OutputStream out = channel.getOutputStream();
+ InputStream in = channel.getInputStream();
+
+ channel.connect();
+
+ waitForAck(in);
+ sendFileToRemote(localFile, in, out);
+ } finally {
+ channel.disconnect();
+ }
+ }
+
+ protected static void sendFileToRemote(File localFile, InputStream in,
+ OutputStream out) throws IOException, SSHException {
+ // send "C0644 filesize filename", where filename should not include '/'
+ long filesize = localFile.length();
+ String command = "C0644 " + filesize + " ";
+ command += localFile.getName();
+ command += "\n";
+
+ out.write(command.getBytes());
+ out.flush();
+
+ waitForAck(in);
+
+ // send a content of lfile
+ FileInputStream fis = new FileInputStream(localFile);
+ byte[] buf = new byte[BUFFER_SIZE];
+ long totalLength = 0;
+
+ // only track progress for files larger than 100kb in verbose mode
+ boolean trackProgress = filesize > HUNDRED_KILOBYTES;
+ // since filesize keeps on decreasing we have to store the
+ // initial filesize
+ long initFilesize = filesize;
+ int percentTransmitted = 0;
+
+ try {
+ while (true) {
+ int len = fis.read(buf, 0, buf.length);
+ if (len <= 0) {
+ break;
+ }
+ out.write(buf, 0, len);
+ totalLength += len;
+
+ if (trackProgress) {
+ percentTransmitted = trackProgress(initFilesize,
+ totalLength, percentTransmitted);
+ }
+ }
+ out.flush();
+ sendAck(out);
+ waitForAck(in);
+ } finally {
+ fis.close();
+ }
+ }
+}
+
+/**
+ * SSHException.
+ *
+ * @author chatellier
+ * @version $Revision: 1.0 $
+ *
+ * Last update : $Date: 14 janv. 2009 $
+ * By : $Author: chatellier $
+ */
+class SSHException extends Exception {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -198651402309210758L;
+
+ /**
+ * Constructs a new exception with null as its detail message.
+ */
+ public SSHException() {
+ super();
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message.
+ *
+ * @param message message
+ * @param cause cause
+ */
+ public SSHException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and cause.
+ *
+ * @param message message
+ */
+ public SSHException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail message
+ * of (cause==null ? null : cause.toString()) (which typically contains the
+ * class and detail message of cause).
+ *
+ * @param cause cause
+ */
+ public SSHException(Throwable cause) {
+ super(cause);
+ }
+
+}
\ No newline at end of file
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 2009-01-13 19:48:00 UTC (rev 1738)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SshSimulatorLauncher.java 2009-01-14 14:22:05 UTC (rev 1739)
@@ -25,11 +25,7 @@
import java.awt.GridBagLayout;
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;
@@ -43,8 +39,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import com.jcraft.jsch.Channel;
-import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
@@ -132,11 +126,16 @@
// si l'upload a fonctionné
if (remotePath != null) {
message(control, _("isisfish.simulation.remote.message.launch"));
+
// just start a thread
checkSimulationProgression(sshSession, simulationService,
control);
launchSimulation(sshSession, simulationService, control,
remotePath);
+
+ // recuperation des resultats
+ message(control, _("isisfish.simulation.remote.message.downloadresults"));
+ downloadResults(sshSession, control.getId());
// force thread to stop
synchronized(control) {
@@ -262,38 +261,7 @@
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
+ SSHUtils.exec(session, command);
}
} catch (IOException e) {
if (log.isErrorEnabled()) {
@@ -301,14 +269,17 @@
e);
}
}
+ catch (SSHException 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
*
@@ -316,141 +287,78 @@
*/
protected String uploadSimulation(Session session, File simulationFile) {
- // return flag
- String remotePath = null;
+ String localPath = simulationFile.getAbsolutePath();
+
+ // Copy simulation file in same arch as local arch
+ // on windows, it's a bad idee :)))
+ // copy it always on caparmor remote temp dir ?
+ // /tmp ?
+ // TODO check it
- // file info
- String filePath = simulationFile.getAbsolutePath();
+ String remotePath = "/tmp/";
- FileInputStream fis = null;
- try {
+ if(localPath.lastIndexOf("/") > 0) {
+ remotePath += localPath.substring(localPath.lastIndexOf("/") + 1);
+ }
+ else if(localPath.lastIndexOf("\\") > 0) { // windows
+ remotePath += localPath.substring(localPath.lastIndexOf("\\") + 1);
+ }
+ else {
+ remotePath += localPath;
+ }
- // exec 'scp -t rfile' remotely
- String command = "scp -p -t " + filePath;
- Channel channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- // Check input stream validity
- if (checkAck(in) == 0) {
-
- 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 + " ";
- if (filePath.lastIndexOf('/') > 0) {
- command += filePath
- .substring(filePath.lastIndexOf('/') + 1);
- } else {
- command += filePath;
- }
- command += "\n";
- out.write(command.getBytes());
- out.flush();
-
- if (checkAck(in) == 0) {
-
- // send a content of lfile
- fis = new FileInputStream(filePath);
- byte[] buf = new byte[1024];
- while (true) {
- int len = fis.read(buf, 0, buf.length);
- if (len <= 0) {
- break;
- }
- out.write(buf, 0, len); //out.flush();
- }
- fis.close();
- fis = null;
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- if (checkAck(in) == 0) {
- remotePath = filePath;
- }
- out.close();
-
- channel.disconnect();
- }
- }
-
- } catch (JSchException e) {
+ try {
+ SSHUtils.scpTo(session, simulationFile, remotePath);
+ }
+ catch(SSHException e) {
if (log.isErrorEnabled()) {
- log.error(_("isisfish.error.simulation.remote.upload",
- filePath));
+ log.error(_("Error while uploading simulation"),
+ e);
}
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error(_("isisfish.error.simulation.remote.upload",
- filePath));
- }
- } finally {
- try {
- if (fis != null) {
- fis.close();
- }
- } catch (IOException e) {
- // exception ignoree
- }
+
+ remotePath = null;
}
return remotePath;
}
/**
- * Check input stream validity.
+ * Download resulation results.
*
- * Code taken from Jsch samples.
- *
- * @param in input stream
+ * @return downloaded temp file (file have to be manually deleted)
*/
- protected int checkAck(InputStream in) throws IOException {
- int b = in.read();
- // b may be 0 for success,
- // 1 for error,
- // 2 for fatal error,
- // -1
- if (b == 0) {
- return b;
+ protected File downloadResults(Session session, String simulationId) {
+
+ // simulation directory
+ File localFile = new File(IsisFish.config.getDatabaseDirectory(),
+ SimulationStorage.SIMULATION_PATH);
+
+ if(log.isDebugEnabled()) {
+ log.debug("Downloading results in " + localFile.getAbsolutePath());
}
- if (b == -1) {
- return b;
- }
+
+ // 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;
- if (b == 1 || b == 2) {
- StringBuffer sb = new StringBuffer();
- int c;
- do {
- c = in.read();
- sb.append((char) c);
- } while (c != '\n');
- if (b == 1) { // error
- if (log.isErrorEnabled()) {
- log.error(_(
- "isisfish.error.simulation.remote.upload.stream",
- sb.toString()));
- }
+ try {
+ SSHUtils.scpFrom(session, remoteFile, localFile);
+ }
+ catch(SSHException e) {
+ // error can append because control file does'nt exist yet
+ if (log.isDebugEnabled()) {
+ log.debug(_("Error while downloading simulation control"));
}
- if (b == 2) { // fatal error
- if (log.isFatalEnabled()) {
- log.fatal(_(
- "isisfish.error.simulation.remote.upload.stream",
- sb.toString()));
- }
- }
+
+ localFile = null;
}
- return b;
+
+ return localFile;
}
-
+
/**
* Launch simulation on remote server.
*
@@ -477,44 +385,15 @@
if (log.isDebugEnabled()) {
log.debug("Launch : " + command);
}
-
- Channel channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- channel.setInputStream(null);
-
+
try {
- 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(_("isisfish.error.simulation.remote.output") + 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) {
- }
+ SSHUtils.exec(session, command);
+ }
+ catch(SSHException e) {
+ if (log.isErrorEnabled()) {
+ log.error(_("Error while launching simulation"),
+ e);
}
- channel.disconnect();
- } catch (IOException e) {
- throw new SimulationException(
- _("isisfish.error.simulation.remote.launch"), e);
}
}
@@ -623,9 +502,6 @@
* 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 manually deleted)
* @throws IOException
*/
@@ -643,123 +519,19 @@
remoteFile += "/control";
// local tmp file
- File tempFile = File.createTempFile(simulationId, "control");
- FileOutputStream fos=null;
-
+ localFile = File.createTempFile(simulationId, "control");
+
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(tempFile);
- 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();
- }
+ SSHUtils.scpFrom(sshSession, remoteFile, localFile);
}
- catch(IOException e){
- if(log.isErrorEnabled()) {
- log.error("I/O error while downloading control file", e);
+ catch(SSHException e) {
+ if (log.isErrorEnabled()) {
+ log.error(_("Error while launching simulation"),
+ e);
}
- } catch (JSchException e) {
- if(log.isErrorEnabled()) {
- log.error("Jsch error while downloading control file", e);
- }
+ localFile = null;
}
- finally {
- try{
- if(fos!=null) {
- fos.close();
- }
- }
- catch(Exception ignored) {
- }
- }
-
- if(localFile == null) {
- // an arror occurs
- // so remove temp file
- tempFile.delete();
- }
-
return localFile;
}
}
1
0
r1738 - in isis-fish/trunk: . src/test/java/fr/ifremer src/test/java/fr/ifremer/isisfish/entity src/test/java/fr/ifremer/isisfish/logging src/test/java/fr/ifremer/isisfish/logging/io src/test/java/fr/ifremer/isisfish/simulator
by tchemit@users.labs.libre-entreprise.org Jan. 13, 2009
by tchemit@users.labs.libre-entreprise.org Jan. 13, 2009
Jan. 13, 2009
Author: tchemit
Date: 2009-01-13 19:48:00 +0000 (Tue, 13 Jan 2009)
New Revision: 1738
Added:
isis-fish/trunk/src/test/java/fr/ifremer/TestUtils.java
Modified:
isis-fish/trunk/pom.xml
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/SimulationLoggerUtilTest.java
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/TestUtil.java
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderTest.java
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderUtilTest.java
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationHelperTest.java
Log:
suis pass?\195?\169 dans le coin et j'ai vu que y'avait plus beaucoup de test qui passaient...
il faut laisser les tester m?\195?\170me s'il y a des erreurs...
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-01-13 16:51:24 UTC (rev 1737)
+++ isis-fish/trunk/pom.xml 2009-01-13 19:48:00 UTC (rev 1738)
@@ -332,12 +332,8 @@
<!--Main class in JAR -->
<maven.jar.main.class>fr.ifremer.isisfish.IsisFish</maven.jar.main.class>
- <!-- for the moment skip tests -->
- <maven.test.skip>true</maven.test.skip>
-
- <!-- FIXE should at leaste be this !-->
<!-- Ignore failure test for now -->
- <!--maven.test.testFailureIgnore>true</maven.test.testFailureIgnore-->
+ <maven.test.testFailureIgnore>true</maven.test.testFailureIgnore>
<!-- jnlp -->
<keystorepath>../../../CodeLutinKeystore</keystorepath>
Added: isis-fish/trunk/src/test/java/fr/ifremer/TestUtils.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/TestUtils.java (rev 0)
+++ isis-fish/trunk/src/test/java/fr/ifremer/TestUtils.java 2009-01-13 19:48:00 UTC (rev 1738)
@@ -0,0 +1,35 @@
+package fr.ifremer;
+
+import java.io.File;
+
+/**
+ * Une classe pour avoir des choses utiles pour tous les tests d'isis
+ *
+ * @author chemit
+ */
+public abstract class TestUtils {
+
+ static File basedir;
+
+ static File targetdir;
+
+ public static File getBasedir() {
+ if (basedir == null) {
+ String base = System.getProperty("basedir");
+ if (base == null || base.isEmpty()) {
+ base = new File("").getAbsolutePath();
+ }
+ basedir = new File(base);
+ System.out.println("basedir for test " + basedir);
+ }
+ return basedir;
+ }
+
+ public static File getTargetdir() {
+ if (targetdir == null) {
+ targetdir = new File(getBasedir(), "target");
+ System.out.println("targetdir for test " + targetdir);
+ }
+ return targetdir;
+ }
+}
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java 2009-01-13 16:51:24 UTC (rev 1737)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/entity/PopulationSeasonInfoTest.java 2009-01-13 19:48:00 UTC (rev 1738)
@@ -36,9 +36,12 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.awt.event.WindowEvent;
import javax.swing.Box;
import javax.swing.JOptionPane;
+import javax.swing.JDialog;
+import javax.swing.SwingUtilities;
import junit.framework.TestCase;
@@ -53,8 +56,7 @@
*
*/
-public class PopulationSeasonInfoTest extends TestCase {
-
+public class PopulationSeasonInfoTest extends TestCase {
public void testToString() {
String [] s = new String[]{"toto", "titi", "tutu"};
System.out.println(Arrays.toString(s));
@@ -63,20 +65,20 @@
/*
* Test method for 'fr.ifremer.isisfish.entities.PopulationSeasonInfoImpl.getGroupChangeMatrix(Month)'
*/
- public void testGetGroupChangeMatrix() {
+ public void testGetGroupChangeMatrix() throws InterruptedException {
System.out.println("begin");
int nbrAge = 3;
int nbrZone = 2;
boolean groupplus = true;
List<String> sem = new ArrayList<String>();
-
+
for (int i=0; i<nbrAge; i++) {
for (int j=0; j<nbrZone; j++) {
sem.add("g" + i + "/z" + j);
- }
+ }
}
-
+
MatrixND mat = MatrixFactory.getInstance().create(new List[]{sem, sem});
for(MatrixIterator mi=mat.iterator(); mi.next();){
int [] dim = mi.getCoordinates();
@@ -91,25 +93,49 @@
// regarde si on est bien dans le dernier block
&& (nbrAge-1 == i/nbrZone)
// regarde si on est bien sur la diagonal
- && (i == j))
+ && (i == j))
){
mi.setValue(1);
}
}
-
- MatrixPanelEditor panel = new MatrixPanelEditor(false, 800, 300);
+
+ final MatrixPanelEditor panel = new MatrixPanelEditor(false, 800, 300);
panel.setMatrix(mat);
- JOptionPane.showMessageDialog(null, panel,
- _("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE);
+ final JDialog dialog = new JDialog();
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ JOptionPane.showMessageDialog(dialog, panel,_("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE);
+
+ }
+ });
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ dialog.dispose();
+ }
+ });
+ t.start();
+
+ // it would really be nice to wait the thread, otherwise the test
+ // means nothing!!!
+ t.join();
+
+
+
System.out.println("end");
}
/**
* Converte no spacialized matrix to spacialized matrix
*/
- public void testSpacializeLengthChangeMatrix() {
-
-
+ public void testSpacializeLengthChangeMatrix() throws InterruptedException {
+
+
int nbsecteurs = 2;
int nbclasses = 3;
@@ -118,15 +144,15 @@
for (MatrixIterator mi=mat.iterator(); mi.next();) {
mi.setValue(i++);
}
-
+
List<String> sem = new ArrayList<String>();
-
+
for (i=0; i<nbclasses; i++) {
for (int j=0; j<nbsecteurs; j++) {
sem.add("g" + i + "/z" + j);
- }
+ }
}
-
+
MatrixND bigmat = MatrixFactory.getInstance().create(new List[]{sem, sem});
for(i=0; i<nbclasses; i++){
@@ -141,17 +167,38 @@
panel.setMatrix(mat);
MatrixPanelEditor bigpanel = new MatrixPanelEditor(false, 800, 300);
bigpanel.setMatrix(bigmat);
-
- Box box = Box.createVerticalBox();
+
+ final Box box = Box.createVerticalBox();
box.add(panel);
box.add(bigpanel);
-
- JOptionPane.showMessageDialog(null, box,
- _("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE);
+
+ final JDialog dialog = new JDialog();
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ JOptionPane.showMessageDialog(dialog, box, _("Spacialized visualisation"), JOptionPane.INFORMATION_MESSAGE);
+ }
+ });
+
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ dialog.dispose();
+ }
+ });
+ t.start();
+
+ // it would really be nice to wait the thread, otherwise the test
+ // means nothing!!!
+ t.join();
System.out.println("end");
}
-
+
}
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/SimulationLoggerUtilTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/SimulationLoggerUtilTest.java 2009-01-13 16:51:24 UTC (rev 1737)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/SimulationLoggerUtilTest.java 2009-01-13 19:48:00 UTC (rev 1738)
@@ -1,6 +1,7 @@
package fr.ifremer.isisfish.logging;
+import fr.ifremer.TestUtils;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
@@ -17,7 +18,7 @@
static private final String category = "fr.ifremer.isisfish.logging";
- static private final String appenderId = "myLogger_" + System.currentTimeMillis();
+ static private final String appenderId = category+"."+"myLogger_" + System.currentTimeMillis();
static private Log log = LogFactory.getLog(category);
@@ -31,9 +32,9 @@
List<String> messagesToWrite = new ArrayList<String>();
List<String> messagesToSkip = new ArrayList<String>();
- logInfo(logInit, "before new config", null,null);
- logInfo(logInit2, "before new config", null,null);
- logInfo(log, "before new config", null,null);
+ logInfo(logInit, "before new config", null, null);
+ logInfo(logInit2, "before new config", null, null);
+ logInfo(log, "before new config", null, null);
String threadName = Thread.currentThread().getName();
@@ -43,7 +44,9 @@
Level hibernateLogLevel = hibernatelog.getLevel();
- String loggerFile = "testLog.log";
+ String loggerFile = new File(TestUtils.getTargetdir(), SimulationLoggerUtilTest.class.getSimpleName() + "_" + System.nanoTime() + ".log").getAbsolutePath();
+ System.out.println(">>>> loggerFile " + loggerFile);
+
// todo do a test for addSimulationAppender too!
SimulationLoggerUtil.addSimulationAppender(
loggerFile,
@@ -67,10 +70,10 @@
hibernatelog.fatal(message);
messagesToWrite.add(message);
- logInfo(logInit, "after new config using old logger", messagesToWrite,messagesToSkip);
+ logInfo(logInit, "after new config using old logger", messagesToWrite, messagesToSkip);
- logInfo(logger, "after new config using new logger", messagesToWrite,messagesToSkip);
- logInfo(log, "after new config using new logger", messagesToWrite,messagesToSkip);
+ logInfo(logger, "after new config using new logger", messagesToWrite, messagesToSkip);
+ logInfo(log, "after new config using new logger", messagesToWrite, messagesToSkip);
final String message0 = "BLOCK LOG must not appear in log file !!! since coming from another thread";
messagesToSkip.add(message0);
@@ -111,13 +114,14 @@
log.info("-- nb messages skipped : " + messagesToSkip.size());
log.info("-- nb messages written : " + messagesToWrite.size());
-
+ System.out.println("test messages to be skipped");
for (String s : messagesToSkip) {
- Assert.assertTrue(logFileContent.indexOf(s) == -1);
+ Assert.assertTrue("should not have write this entry : '" + s + "'", logFileContent.indexOf(s) == -1);
}
+ System.out.println("test messages to be written");
for (String s : messagesToWrite) {
- Assert.assertTrue(s, logFileContent.indexOf(s) > -1);
+ Assert.assertTrue("should have write this entry : '" + s + "'", logFileContent.indexOf(s) > -1);
}
logFile.delete();
@@ -256,6 +260,7 @@
messagesToWrite.add(message);
}
}
+
private void logDebug(Log logger, String prefix, List<String> messagesToWrite) {
String message;
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/TestUtil.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/TestUtil.java 2009-01-13 16:51:24 UTC (rev 1737)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/TestUtil.java 2009-01-13 19:48:00 UTC (rev 1738)
@@ -10,6 +10,7 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
/**
* Usefull methods for tests.
@@ -17,7 +18,7 @@
* @author chemit
*/
-public class TestUtil {
+public abstract class TestUtil {
public static String filename;
public static long MEGA_STREAM_SIZE = 6 * 100000;
@@ -25,6 +26,19 @@
protected static final Log log = LogFactory.getLog(TestUtil.class);
+ public static void createMock(File testDir, String filename, int i) throws IOException, InterruptedException {
+ TestUtil.MEGA_STREAM_SIZE = 6 * i;
+ TestUtil.filename = new File(testDir, filename).getAbsolutePath();
+ File file = new File(testDir, filename);
+ long t0 = System.nanoTime();
+ mockLogFile();
+ long t1;
+
+ t1 = System.nanoTime();
+ log.info("create [" + TestUtil.MEGA_STREAM_SIZE + "] in " + StringUtil.convertTime(t1 - t0) + " [file: " + file + ", length: " + StringUtil.convertMemory(file.length()) + "]");
+ System.gc();
+ }
+
static void pause(long time) throws InterruptedException {
Thread.sleep(time);
totalPause += time;
@@ -59,16 +73,100 @@
}
t1 = System.currentTimeMillis();
- log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1-t0) + " | total " + i + " in " + StringUtil.convertTime( t1 - totalPause-t00));
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
//pause(500);
t0 = System.currentTimeMillis();
for (i = MAX_0; i < 2 * MAX_0; i++) {
+ LogRecord record = LogRecord.newInstance(LogLevel.WARN, 0, i + " warn", "jkljfdjkl fdkjlkj lkjdlkfjl dfkljl dflkfdj lfdjlk fjdlkj fdl", "vmfof o rieipk?prj,anklvndfkljn gmlrtsoijrmoig", i, new String[0]);
+ s.write(record.toString() + '\n');
+ }
+ t1 = System.currentTimeMillis();
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
+ //pause(500);
+ t0 = System.currentTimeMillis();
+ for (i = 2 * MAX_0; i < 3 * MAX_0; i++) {
+ LogRecord record = LogRecord.newInstance(LogLevel.INFO, 0, i + " info", "grlgjlrmgr jglerj mgrjm gre pjkogremoiqp jgpo rejopigjrej,m", "grkgherjfezoprjgbpdofajhlbnb;k nfkfjgmjmsg", i, new String[0]);
+ s.write(record.toString() + '\n');
+ }
+ t1 = System.currentTimeMillis();
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
+ //pause(500);
+ t0 = System.currentTimeMillis();
+ for (i = 3 * MAX_0; i < 4 * MAX_0; i++) {
+ LogRecord record = LogRecord.newInstance(LogLevel.DEBUG, 0, i + " debug", "grmgjueroijiorehjnjodj j gn mbr,nhltrhjjdo jp joi jreio j", "gezoeteroiyerphehkzb,fgbd bcmsherkgheiusbcjkdvberb ", i, new String[0]);
+ s.write(record.toString() + '\n');
+ s.flush();
+ }
+ t1 = System.currentTimeMillis();
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
+ //pause(500);
+ t0 = System.currentTimeMillis();
+ for (i = 4 * MAX_0; i < 5 * MAX_0; i++) {
+ LogRecord record = LogRecord.newInstance(LogLevel.TRACE, 0, i + " trace", "ffgkdhvlsdknjk eriopgejo ipjiropj i io poi opijgr pe jupoieruj ga geigerihpi oeop erp ", "griofeioteogbbekjbnrjemk prejrlmekhgrehivbn rekhgrhi ", i, new String[0]);
+ s.write(record.toString() + '\n');
+ }
+ t1 = System.currentTimeMillis();
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
+ //pause(500);
+ t0 = System.currentTimeMillis();
+ for (i = 5 * MAX_0; i < 6 * MAX_0; i++) {
+ LogRecord record = LogRecord.newInstance(LogLevel.TRACE, 0, i + " user", "grekgrhze t e re klgre ge rgre gre gfer g rjyukj yujty reez ze fz", "gekfhezh zhrze hgerhglkrej ljbvkxdfn df,ekgrrnvkmn", i, new String[0]);
+ s.write(record.toString() + '\n');
+ s.flush();
+ }
+ t1 = System.currentTimeMillis();
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
+ } catch (OutOfMemoryError e) {
+ t1 = System.currentTimeMillis();
+ log.info("failed after | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
+ e.printStackTrace();
+ } finally {
+ if (s != null) {
+ s.flush();
+ s.close();
+ }
+ }
+ }
+
+ /**
+ * create a mock of logEvents
+ *
+ * @throws java.io.IOException todo
+ * @throws InterruptedException todo
+ */
+ public static void mockLogFile2() throws IOException, InterruptedException {
+ File f = new File(filename);
+ if (f.exists()) {
+ f.delete();
+ }
+ BufferedWriter s = new BufferedWriter(new FileWriter(f));
+ int MAX_0 = (int) (MEGA_STREAM_SIZE / 6);
+ int i = 0;
+ long t0, t00;
+ long t1;
+ totalPause = 0;
+ t00 = System.currentTimeMillis();
+ t0 = System.currentTimeMillis();
+ try {
+
+ for (i = 0; i < MAX_0; i++) {
+ LogRecord record = LogRecord.newInstance(LogLevel.FATAL, 0, i + "debug ", "ioreiovrio veuio vreupo xz xe opiu tep uxr u ", "xeoiujoiz xpo puoi rui hp", i, new String[0]);
+ s.write(record.toString() + '\n');
+ s.flush();
+ }
+
+ t1 = System.currentTimeMillis();
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
+ //pause(500);
+ t0 = System.currentTimeMillis();
+
+ for (i = MAX_0; i < 2 * MAX_0; i++) {
LogRecord record = LogRecord.newInstance(LogLevel.WARN, 0, i + " warn", "jkljfdjkl fdkjlkj lkjdlkfjl dfkljl dflkfdj lfdjlk fjdlkj fdl", "vmfof o rieipk?prj,ùnklvndfkljn gmlrtsoîjrmoig", i, new String[0]);
s.write(record.toString() + '\n');
}
t1 = System.currentTimeMillis();
- log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1-t0) + " | total " + i + " in " + StringUtil.convertTime( t1 - totalPause-t00));
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
//pause(500);
t0 = System.currentTimeMillis();
for (i = 2 * MAX_0; i < 3 * MAX_0; i++) {
@@ -76,7 +174,7 @@
s.write(record.toString() + '\n');
}
t1 = System.currentTimeMillis();
- log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1-t0) + " | total " + i + " in " + StringUtil.convertTime( t1 - totalPause-t00));
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
//pause(500);
t0 = System.currentTimeMillis();
for (i = 3 * MAX_0; i < 4 * MAX_0; i++) {
@@ -85,7 +183,7 @@
s.flush();
}
t1 = System.currentTimeMillis();
- log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1-t0) + " | total " + i + " in " + StringUtil.convertTime( t1 - totalPause-t00));
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
//pause(500);
t0 = System.currentTimeMillis();
for (i = 4 * MAX_0; i < 5 * MAX_0; i++) {
@@ -93,7 +191,7 @@
s.write(record.toString() + '\n');
}
t1 = System.currentTimeMillis();
- log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1-t0) + " | total " + i + " in " + StringUtil.convertTime( t1 - totalPause-t00));
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
//pause(500);
t0 = System.currentTimeMillis();
for (i = 5 * MAX_0; i < 6 * MAX_0; i++) {
@@ -102,10 +200,10 @@
s.flush();
}
t1 = System.currentTimeMillis();
- log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1-t0) + " | total " + i + " in " + StringUtil.convertTime( t1 - totalPause-t00));
+ log.debug("create next [" + MAX_0 + "] in " + StringUtil.convertTime(t1 - t0) + " | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
} catch (OutOfMemoryError e) {
t1 = System.currentTimeMillis();
- log.info("failed after | total " + i + " in " + StringUtil.convertTime( t1 - totalPause-t00));
+ log.info("failed after | total " + i + " in " + StringUtil.convertTime(t1 - totalPause - t00));
e.printStackTrace();
} finally {
if (s != null) {
@@ -122,7 +220,7 @@
IsisFish.init();
} catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
/**
@@ -193,7 +291,7 @@
String fileName,
String methodName,
int lineNumber,
- String[] errors) {
+ String[] errors) throws UnsupportedEncodingException {
return new LogRecord(
level == null ? LogLevel.DEBUG.ordinal() : level.ordinal(),
timestamp,
@@ -211,11 +309,11 @@
String filename,
String methodName,
int lineNumber,
- String[] throwableStrRep) {
+ String[] throwableStrRep) throws UnsupportedEncodingException {
this.level = level;
this.timeStamp = timestamp;
//this.message = message;
- this.message = filename + ":" + lineNumber + " - " + methodName + " - " + message;
+ this.message = new String((filename + ":" + lineNumber + " - " + methodName + " - " + message).getBytes("utf-8"));
//this.filename = filename;
//this.methodName = methodName;
//this.lineNumber = lineNumber;
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderTest.java 2009-01-13 16:51:24 UTC (rev 1737)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderTest.java 2009-01-13 19:48:00 UTC (rev 1738)
@@ -1,5 +1,6 @@
package fr.ifremer.isisfish.logging.io;
+import fr.ifremer.TestUtils;
import fr.ifremer.isisfish.logging.TestUtil;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
@@ -20,6 +21,8 @@
protected static final Log log = LogFactory.getLog(LineReaderTest.class);
+ File testDir;
+
final static int[] sizes = new int[]{
10,
50,
@@ -38,19 +41,23 @@
protected void setUp() throws Exception {
super.setUp();
- new File("bench").mkdirs();
+
+ testDir = new File(TestUtils.getTargetdir(), "bench_" + System.nanoTime());
+ testDir.mkdirs();
+ System.out.println("benchdir " + testDir);
+
}
- protected void createMock(int i) throws IOException, InterruptedException {
+ protected static void createMock(File testDir, int i) throws IOException, InterruptedException {
TestUtil.MEGA_STREAM_SIZE = 6 * i;
- TestUtil.filename = "bench/" + LineReaderTest.class.getSimpleName() + "_" + 6 * i + ".log";
- File file = new File(TestUtil.filename);
+ TestUtil.filename = new File(testDir, LineReaderTest.class.getSimpleName() + "_" + 6 * i + ".log").getAbsolutePath();
+ File file = new File(testDir, TestUtil.filename);
long t0 = System.nanoTime();
TestUtil.mockLogFile();
long t1;
t1 = System.nanoTime();
- log.info("create [" + TestUtil.MEGA_STREAM_SIZE + "] in " + StringUtil.convertTime(t1-t0) + " [file: " + file + ", length: " + StringUtil.convertMemory(file.length()) + "]");
+ log.info("create [" + TestUtil.MEGA_STREAM_SIZE + "] in " + StringUtil.convertTime(t1 - t0) + " [file: " + file + ", length: " + StringUtil.convertMemory(file.length()) + "]");
System.gc();
}
@@ -58,7 +65,7 @@
public void estMakeMock() throws Exception {
for (int size : sizes) {
- createMock(size);
+ createMock(testDir, size);
}
}
@@ -110,8 +117,9 @@
private boolean showLog = false;
protected LineReader createReader(File f, String ext) throws IOException {
- return new LineReader(f, new FileOffsetReader(new File(f,ext)));
+ return new LineReader(f, new FileOffsetReader(new File(f, ext)));
}
+
protected void scanAllLines(int size) throws IOException {
TestUtil.MEGA_STREAM_SIZE = size;
TestUtil.filename = "bench/" + LineReaderTest.class.getSimpleName() + "_" + TestUtil.MEGA_STREAM_SIZE + ".log";
@@ -357,7 +365,7 @@
System.out.println("");
System.out.println("");
- LineReader reader2 = new LineReader(reader, new FileOffsetReader(new File(f,"offsets_debug_or_warn"))) {
+ LineReader reader2 = new LineReader(reader, new FileOffsetReader(new File(f, "offsets_debug_or_warn"))) {
public boolean match(String line) {
return line.contains("debug") || line.contains("warn");
}
@@ -384,7 +392,7 @@
System.out.println("");
System.out.println("");
- LineReader reader3 = new LineReader(reader, new FileOffsetReader(new File(f,"offsets_debug"))) {
+ LineReader reader3 = new LineReader(reader, new FileOffsetReader(new File(f, "offsets_debug"))) {
public boolean match(String line) {
return line.contains("debug");
}
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderUtilTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderUtilTest.java 2009-01-13 16:51:24 UTC (rev 1737)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/logging/io/LineReaderUtilTest.java 2009-01-13 19:48:00 UTC (rev 1738)
@@ -1,7 +1,9 @@
package fr.ifremer.isisfish.logging.io;
+import fr.ifremer.TestUtils;
import fr.ifremer.isisfish.logging.LogLevel;
import fr.ifremer.isisfish.logging.LogLevelUtil;
+import fr.ifremer.isisfish.logging.TestUtil;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -18,6 +20,18 @@
protected static final Log log = LogFactory.getLog(LineReaderUtilTest.class);
+ static File testDir;
+
+ public static File getTestDir() {
+ if (testDir == null) {
+ testDir = new File(TestUtils.getTargetdir(), "bench_" + System.nanoTime());
+ if (!testDir.mkdirs()) {
+ throw new IllegalStateException("could not create directory " + testDir);
+ }
+ }
+ return testDir;
+ }
+
final static int[] sizes = new int[]{
10,
50,
@@ -37,15 +51,14 @@
protected void setUp() throws Exception {
super.setUp();
- new File("bench").mkdirs();
- String filename = "bench/LineReaderTest_30.log";
- f = new File(filename);
+ System.out.println("benchdir " + getTestDir());
+ String filename = "LineReaderTest_30.log";
+ f = new File(testDir, filename);
+
if (!f.exists()) {
- new LineReaderTest().createMock(5);
+ TestUtil.createMock(testDir, filename, 5);
}
-
-
}
@@ -54,14 +67,14 @@
long nbLines;
LineReader reader, reader2;
- reader = new LineReader(f, new FileOffsetReader(new File(f, "offsets")));
+ reader = new LineReader(f, new FileOffsetReader(new File(f.getParentFile(), "offsets")));
reader.getOffsetReader().deleteOffsetFile();
reader.open();
nbLines = reader.getNbLines();
assertEquals(30, nbLines);
log.info("found " + nbLines + " in reader " + reader);
- reader2 = new LineReaderUtil.LevelLineReader(reader, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + LogLevel.DEBUG.mask())), LogLevel.DEBUG);
+ reader2 = new LineReaderUtil.LevelLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + LogLevel.DEBUG.mask())), LogLevel.FATAL);
reader2.getOffsetReader().deleteOffsetFile();
reader2.open();
nbLines = reader2.getNbLines();
@@ -69,13 +82,21 @@
assertEquals(5, nbLines);
reader2.close();
- reader2 = new LineReaderUtil.LevelLineReader(reader, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + LogLevel.INFO.mask())), LogLevel.INFO);
+ reader2 = new LineReaderUtil.LevelLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + LogLevel.DEBUG.mask())), LogLevel.DEBUG);
reader2.getOffsetReader().deleteOffsetFile();
reader2.open();
nbLines = reader2.getNbLines();
log.info("found " + nbLines + " in reader " + reader2);
assertEquals(5, nbLines);
+ reader2.close();
+
+ reader2 = new LineReaderUtil.LevelLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + LogLevel.INFO.mask())), LogLevel.INFO);
reader2.getOffsetReader().deleteOffsetFile();
+ reader2.open();
+ nbLines = reader2.getNbLines();
+ log.info("found " + nbLines + " in reader " + reader2);
+ assertEquals(5, nbLines);
+ reader2.getOffsetReader().deleteOffsetFile();
reader2.close();
reader.getOffsetReader().deleteOffsetFile();
@@ -84,11 +105,11 @@
public void testLevelsReader() throws Exception {
- LineReader reader, reader2,reader3;
+ LineReader reader, reader2, reader3;
int levels;
long nbLines;
- reader = new LineReader(f, new FileOffsetReader(new File(f, "offsets")));
+ reader = new LineReader(f, new FileOffsetReader(new File(f.getParentFile(), "offsets")));
reader.getOffsetReader().deleteOffsetFile();
reader.open();
nbLines = reader.getNbLines();
@@ -96,7 +117,7 @@
log.info("found " + nbLines + " in reader " + reader);
levels = LogLevelUtil.createSet(LogLevel.DEBUG, LogLevel.INFO);
- reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + levels)), LogLevel.DEBUG, LogLevel.INFO);
+ reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + levels)), LogLevel.DEBUG, LogLevel.INFO);
reader2.getOffsetReader().deleteOffsetFile();
reader2.open();
nbLines = reader2.getNbLines();
@@ -106,7 +127,7 @@
reader2.close();
levels = LogLevelUtil.createSet(LogLevel.WARN, LogLevel.INFO);
- reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + levels)), LogLevel.INFO, LogLevel.WARN);
+ reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + levels)), LogLevel.INFO, LogLevel.WARN);
reader2.getOffsetReader().deleteOffsetFile();
assertTrue(reader2.getOffsetReader().needCreate());
reader2.open();
@@ -114,8 +135,8 @@
log.info("found " + nbLines + " in reader " + reader2);
assertEquals(10, nbLines);
- levels = LogLevelUtil.createSet( LogLevel.INFO);
- reader3 = new LineReaderUtil.LevelsLineReader(reader2, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + levels)), LogLevel.INFO);
+ levels = LogLevelUtil.createSet(LogLevel.INFO);
+ reader3 = new LineReaderUtil.LevelsLineReader(reader2, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + levels)), LogLevel.INFO);
reader3.getOffsetReader().deleteOffsetFile();
assertTrue(reader3.getOffsetReader().needCreate());
reader3.open();
@@ -123,11 +144,11 @@
log.info("found " + nbLines + " in reader " + reader3);
assertEquals(5, nbLines);
- reader2.close();
+ reader2.close();
reader3.close();
levels = LogLevelUtil.createSet(LogLevel.INFO, LogLevel.WARN);
- reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + levels)), LogLevel.WARN, LogLevel.INFO);
+ reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + levels)), LogLevel.WARN, LogLevel.INFO);
assertFalse(reader2.getOffsetReader().needCreate());
reader2.open();
nbLines = reader2.getNbLines();
@@ -137,7 +158,7 @@
reader2.close();
levels = LogLevelUtil.createSet(LogLevel.DEBUG);
- reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + levels)), LogLevel.DEBUG);
+ reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + levels)), LogLevel.DEBUG);
assertFalse(reader2.getOffsetReader().needCreate());
reader2.open();
nbLines = reader2.getNbLines();
@@ -146,7 +167,7 @@
reader2.close();
levels = LogLevelUtil.createSet(LogLevel.DEBUG, LogLevel.DEBUG);
- reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile(), "leveloffsets_" + levels)), LogLevel.DEBUG, LogLevel.DEBUG);
+ reader2 = new LineReaderUtil.LevelsLineReader(reader, new FileOffsetReader(new File(reader.getFile().getParentFile(), "leveloffsets_" + levels)), LogLevel.DEBUG, LogLevel.DEBUG);
assertFalse(reader2.getOffsetReader().needCreate());
reader2.open();
nbLines = reader2.getNbLines();
@@ -165,7 +186,7 @@
LineReader reader, reader2;
long nbLines;
- reader = new LineReader(f, new FileOffsetReader(new File(f, "offsets")));
+ reader = new LineReader(f, new FileOffsetReader(new File(f.getParentFile(), "offsets")));
reader.getOffsetReader().deleteOffsetFile();
reader.open();
nbLines = reader.getNbLines();
@@ -191,5 +212,5 @@
reader.getOffsetReader().deleteOffsetFile();
reader.close();
}
-
+
}
\ No newline at end of file
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationHelperTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationHelperTest.java 2009-01-13 16:51:24 UTC (rev 1737)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/SimulationHelperTest.java 2009-01-13 19:48:00 UTC (rev 1738)
@@ -31,42 +31,40 @@
package fr.ifremer.isisfish.simulator;
-import java.io.File;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.math.matrix.DoubleBigVector;
-import org.codelutin.math.matrix.MatrixFactory;
-import org.codelutin.topia.TopiaContext;
-
+import fr.ifremer.TestUtils;
import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.datastore.ResultStorage;
import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.entities.Result;
import fr.ifremer.isisfish.types.Date;
-
import junit.framework.TestCase;
import junit.framework.TestFailure;
import junit.framework.TestResult;
import junit.framework.TestSuite;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.math.matrix.DoubleBigVector;
+import org.codelutin.math.matrix.MatrixFactory;
+import org.codelutin.topia.TopiaContext;
+import java.io.File;
+import java.util.Enumeration;
+import java.util.List;
-/**
- * @author poussin
- *
- */
+/** @author poussin */
+
public class SimulationHelperTest extends TestCase {
private static final Log log = LogFactory.getLog(SimulationHelperTest.class);
-
- final static private String [] SIMULATION_ZIP_FILE = new String[]{
- "src/test/fr/ifremer/isisfish/simulator/SimulationTest.zip",
- // put here other zip simulation test
- };
-
+
+ final static private String[] SIMULATION_ZIP_FILE = new String[]{
+ //TC - 20090113 : remove the asrc to src when the zip file will be in correct db version, otherwise there is a ui asking to migrate
+ // or just desactivate the migration service ?
+ "asrc" + File.separator + "test" + File.separator + "java" + File.separator + "fr" + File.separator + "ifremer" + File.separator + "isisfish" + File.separator + "simulator" + File.separator + "SimulationTest.zip",
+ // put here other zip simulation test
+ };
+
// public void testVerifResult() throws Exception {
// try {
// IsisConfig.load();
@@ -115,18 +113,19 @@
// }
// }
-/*
-10;20;30;40;50;60;70;80;90;
-100;200;300;400;500;600;700;800;900;
-1000;2000;3000;4000;5000;6000;7000;8000;9000;
-10000;20000;30000;40000;50000;60000;70000;80000;90000;
-100000;200000;300000;400000;500000;600000;700000;800000;900000;
-1000000;2000000;3000000;4000000;5000000;6000000;7000000;8000000;9000000;
-10000000;20000000;30000000;40000000;50000000;60000000;70000000;80000000;90000000;
-100000000;200000000;300000000;400000000;500000000;600000000;700000000;800000000;900000000;
-1000000000;2000000000;3000000000;4000000000;5000000000;6000000000;7000000000;8000000000;9000000000;
-10000000000;20000000000;30000000000;40000000000;50000000000;60000000000;70000000000;80000000000;90000000000;
-*/
+ /*
+ 10;20;30;40;50;60;70;80;90;
+ 100;200;300;400;500;600;700;800;900;
+ 1000;2000;3000;4000;5000;6000;7000;8000;9000;
+ 10000;20000;30000;40000;50000;60000;70000;80000;90000;
+ 100000;200000;300000;400000;500000;600000;700000;800000;900000;
+ 1000000;2000000;3000000;4000000;5000000;6000000;7000000;8000000;9000000;
+ 10000000;20000000;30000000;40000000;50000000;60000000;70000000;80000000;90000000;
+ 100000000;200000000;300000000;400000000;500000000;600000000;700000000;800000000;900000000;
+ 1000000000;2000000000;3000000000;4000000000;5000000000;6000000000;7000000000;8000000000;9000000000;
+ 10000000000;20000000000;30000000000;40000000000;50000000000;60000000000;70000000000;80000000000;90000000000;
+ */
+
public void testSimulate() throws Exception {
try {
// par defaut on utilise des doubles pour les matrices
@@ -135,36 +134,36 @@
for (String zipName : SIMULATION_ZIP_FILE) {
// recuperation du fichier zip de la simulation de test
- File zip = new File(zipName);
+ File zip = new File(TestUtils.getBasedir(), zipName);
// import de cette simulation
String name = "simulation-test-" + System.currentTimeMillis();
SimulationStorage simRef = SimulationStorage.importAndRenameZip(zip, name + "-ref");
// import de la simulation avec un autre nom
- SimulationStorage sim = SimulationStorage.importAndRenameZip(zip, name);
-
+ SimulationStorage sim = SimulationStorage.importAndRenameZip(zip, name);
+
try {
// suppression des resultats de cette simulation
TopiaContext tx = sim.getStorage().beginTransaction();
tx.execute("DELETE from " + Result.class.getName());
tx.commitTransaction();
-
+
// lancement de la simulation
// FIXME a remplacer avec SimulationService
// SimulationHelper.simulate(null, sim);
-
+
// verification qu'on retrouve les memes resulats pour les deux simulations
ResultStorage resultRef = simRef.getResultStorage();
ResultStorage result = sim.getResultStorage();
-
+
List<String> resultNames = resultRef.getResultName();
assertEquals(resultNames, result.getResultName());
-
+
Date lastDate = resultRef.getLastDate();
log.info("Check result ...");
- for (Date date=new Date(0); date.before(lastDate); date=date.next()) {
+ for (Date date = new Date(0); date.before(lastDate); date = date.next()) {
for (String resultName : resultNames) {
log.debug("Check result " + date + " " + resultName);
assertEquals("Date " + date.getDate() + " result " + resultName,
@@ -172,7 +171,7 @@
result.getMatrix(date, resultName));
}
}
-
+
} finally {
// fermeture des bases
simRef.getStorage().closeContext();
@@ -188,22 +187,22 @@
throw eee;
}
}
-
+
public static void main(String[] args) {
TestSuite suite = new TestSuite(SimulationHelperTest.class);
TestResult result = new TestResult();
suite.run(result);
if (result.wasSuccessful()) {
System.out.println("Test Ok");
- } else {
+ } else {
System.out.println("Test Faild");
System.out.println("Failures");
- for (Enumeration e=result.failures(); e.hasMoreElements();) {
+ for (Enumeration e = result.failures(); e.hasMoreElements();) {
System.out.println(e.nextElement().toString());
}
System.out.println("Errors");
- for (Enumeration e=result.errors(); e.hasMoreElements();) {
- TestFailure eee = (TestFailure)e.nextElement();
+ for (Enumeration e = result.errors(); e.hasMoreElements();) {
+ TestFailure eee = (TestFailure) e.nextElement();
System.out.println(eee.toString());
eee.thrownException().printStackTrace();
}
1
0
r1737 - in isis-fish/trunk: . src/test/java/fr/ifremer/isisfish/ui
by tchemit@users.labs.libre-entreprise.org Jan. 13, 2009
by tchemit@users.labs.libre-entreprise.org Jan. 13, 2009
Jan. 13, 2009
Author: tchemit
Date: 2009-01-13 16:51:24 +0000 (Tue, 13 Jan 2009)
New Revision: 1737
Removed:
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/TestJaxx.java
Modified:
isis-fish/trunk/changelog.txt
isis-fish/trunk/pom.xml
Log:
passage en lutinproject 3.3 (+ suppression d'un test Jaxx)
Modified: isis-fish/trunk/changelog.txt
===================================================================
--- isis-fish/trunk/changelog.txt 2009-01-13 16:44:36 UTC (rev 1736)
+++ isis-fish/trunk/changelog.txt 2009-01-13 16:51:24 UTC (rev 1737)
@@ -1,6 +1,6 @@
isis-fish (3.2.0.x) xxx
- * switch to lutinproject 3.2
+ * switch to lutinproject 3.3
* switch to topia-service 1.0.1
* switch to topia-persistence 2.1.1
* remove tools.jar (now isis need JDK !!!)
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-01-13 16:44:36 UTC (rev 1736)
+++ isis-fish/trunk/pom.xml 2009-01-13 16:51:24 UTC (rev 1737)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>lutinproject</artifactId>
- <version>3.2</version>
+ <version>3.3</version>
</parent>
<groupId>ifremer</groupId>
@@ -73,13 +73,6 @@
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>org.codelutin.jaxx</groupId>
- <artifactId>jaxx-compiler-api</artifactId>
- <version>${jaxx.version}</version>
- <scope>test</scope>
- </dependency>
-
<!--Commons-->
<dependency>
<groupId>commons-jxpath</groupId>
@@ -342,6 +335,10 @@
<!-- for the moment skip tests -->
<maven.test.skip>true</maven.test.skip>
+ <!-- FIXE should at leaste be this !-->
+ <!-- Ignore failure test for now -->
+ <!--maven.test.testFailureIgnore>true</maven.test.testFailureIgnore-->
+
<!-- jnlp -->
<keystorepath>../../../CodeLutinKeystore</keystorepath>
<keystorealias>CodeLutin</keystorealias>
@@ -567,7 +564,7 @@
<execution>
<phase>verify</phase>
<goals>
- <goal>attached</goal>
+ <goal>inline</goal>
</goals>
</execution>
</executions>
Deleted: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/TestJaxx.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/TestJaxx.java 2009-01-13 16:44:36 UTC (rev 1736)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/ui/TestJaxx.java 2009-01-13 16:51:24 UTC (rev 1737)
@@ -1,38 +0,0 @@
-package fr.ifremer.isisfish.ui;
-
-import jaxx.reflect.ClassDescriptor;
-import jaxx.reflect.JavaFileParser;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-
-/** @author chemit */
-public class TestJaxx {
-
- @Test
- public void testParseEntity() throws Exception {
- URL javaSource = new File("target/generated-sources/java/fr/ifremer/isisfish/entities/Cell.java").toURI().toURL();
-
- InputStream in = javaSource.openStream();
- Reader reader = new InputStreamReader(in, "utf-8");
- ClassDescriptor result = JavaFileParser.parseJavaFile(javaSource.toString(), reader, getClass().getClassLoader());
- reader.close();
- Assert.assertNotNull(result);
- }
-
- @Test
- public void testParseEntityImpl() throws Exception {
- URL javaSource = new File("src/main/java/fr/ifremer/isisfish/entities/CellImpl.java").toURI().toURL();
-
- InputStream in = javaSource.openStream();
- Reader reader = new InputStreamReader(in, "utf-8");
- ClassDescriptor result = JavaFileParser.parseJavaFile(javaSource.toString(), reader, getClass().getClassLoader());
- reader.close();
- Assert.assertNotNull(result);
- }
-}
1
0
r1736 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org Jan. 13, 2009
by chatellier@users.labs.libre-entreprise.org Jan. 13, 2009
Jan. 13, 2009
Author: chatellier
Date: 2009-01-13 16:44:36 +0000 (Tue, 13 Jan 2009)
New Revision: 1736
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java
Log:
Reduce very verbose log level
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java 2009-01-13 13:45:32 UTC (rev 1735)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTableModel.java 2009-01-13 16:44:36 UTC (rev 1736)
@@ -210,8 +210,8 @@
Object result = "";
- if(log.isDebugEnabled()) {
- log.debug("Update table model : " +
+ if(log.isTraceEnabled()) {
+ log.trace("Update table model : " +
"id = " + control.getId() + ", " +
"control.getProgress() = " + control.getProgress() + ", " +
"control.getProgressMax() = " + control.getProgressMax() + ", "+
1
0
r1735 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator
by chatellier@users.labs.libre-entreprise.org Jan. 13, 2009
by chatellier@users.labs.libre-entreprise.org Jan. 13, 2009
Jan. 13, 2009
Author: chatellier
Date: 2009-01-13 13:45:32 +0000 (Tue, 13 Jan 2009)
New Revision: 1735
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
Log:
Fix unsaved strategies list problem
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2009-01-13 13:33:49 UTC (rev 1734)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2009-01-13 13:45:32 UTC (rev 1735)
@@ -70,7 +70,6 @@
@Override
public void simulationStop(SimulationService simService, SimulationJob job) {
- System.out.println("refresh !!!");
fieldSimulParamsSelect.setModel(getSimulParamsSelectModel());
}
@@ -178,6 +177,7 @@
i++;
}
listSimulParamsStrategies.setSelectedIndices(indexs);
+ strategySelected();
}
}
protected void setListSimulParamsPopulationsItems(){
1
0
Author: chatellier
Date: 2009-01-13 13:33:49 +0000 (Tue, 13 Jan 2009)
New Revision: 1734
Modified:
isis-fish/trunk/pom.xml
Log:
Les test d?\195?\169pendent explicitement du compilateur jaxx.
Le plugin eclipse:eclipse ne les trouve pas.
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-01-13 13:17:54 UTC (rev 1733)
+++ isis-fish/trunk/pom.xml 2009-01-13 13:33:49 UTC (rev 1734)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>lutinproject</artifactId>
- <version>3.3</version>
+ <version>3.2</version>
</parent>
<groupId>ifremer</groupId>
@@ -73,6 +73,13 @@
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.codelutin.jaxx</groupId>
+ <artifactId>jaxx-compiler-api</artifactId>
+ <version>${jaxx.version}</version>
+ <scope>test</scope>
+ </dependency>
+
<!--Commons-->
<dependency>
<groupId>commons-jxpath</groupId>
1
0
Author: chatellier
Date: 2009-01-13 13:17:54 +0000 (Tue, 13 Jan 2009)
New Revision: 1733
Modified:
isis-fish/trunk/pom.xml
Log:
Update libs
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-01-12 18:05:58 UTC (rev 1732)
+++ isis-fish/trunk/pom.xml 2009-01-13 13:17:54 UTC (rev 1733)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>lutinproject</artifactId>
- <version>3.2</version>
+ <version>3.3</version>
</parent>
<groupId>ifremer</groupId>
@@ -26,7 +26,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutinutil</artifactId>
- <version>1.0.1</version>
+ <version>1.0.2</version>
<scope>compile</scope>
</dependency>
@@ -325,7 +325,7 @@
<jaxx.version>1.1-SNAPSHOT</jaxx.version>
<generator.version>0.63</generator.version>
<topia.version>2.1.1</topia.version>
- <lutinwidget.version>0.12-SNAPSHOT</lutinwidget.version>
+ <lutinwidget.version>0.12</lutinwidget.version>
<lutinmatrix.version>1.2-SNAPSHOT</lutinmatrix.version>
<openmap.version>4.6.4</openmap.version>
@@ -550,7 +550,7 @@
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
+ <version>2.2-beta-3</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
1
0
r1732 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org Jan. 12, 2009
by sletellier@users.labs.libre-entreprise.org Jan. 12, 2009
Jan. 12, 2009
Author: sletellier
Date: 2009-01-12 18:05:58 +0000 (Mon, 12 Jan 2009)
New Revision: 1732
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.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/PopulationGroupUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx
Log:
WizardGroupCreation work
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-01-12 18:05:16 UTC (rev 1731)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2009-01-12 18:05:58 UTC (rev 1732)
@@ -86,6 +86,7 @@
if (selected != null){
editor.setText(selected.getContent());
}
+ f = selected;
}
protected Formule getFormule(){
Formule result = null;
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-12 18:05:16 UTC (rev 1731)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2009-01-12 18:05:58 UTC (rev 1732)
@@ -92,7 +92,8 @@
protected void createClasses(){
JFrame wizardFrame = new JFrame();
wizardFrame.setLayout(new BorderLayout());
- WizardGroupCreationUI wizard = new WizardGroupCreationUI(getContextValue(InputAction.class), this);
+ WizardGroupCreationUI wizard = new WizardGroupCreationUI(this);
+ wizard.init(this);
wizardFrame.add(wizard, BorderLayout.CENTER);
wizardFrame.setTitle(_("isisfish.wizardGroupCreation.title"));
wizardFrame.setVisible(true);
@@ -134,7 +135,6 @@
}
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();
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-12 18:05:16 UTC (rev 1731)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2009-01-12 18:05:58 UTC (rev 1732)
@@ -76,6 +76,7 @@
Population population = (Population)getVerifier().getEntity(Population.class);
setBean((PopulationImpl) population);
jaxx.runtime.swing.Utils.fillComboBox(fieldPopulationGroupPopulationGroup,getBean().getPopulationGroup(), null);
+ getVerifier().addCurrentEntity(getPopulationGroup());
}
]]>
</script>
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-12 18:05:16 UTC (rev 1731)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/WizardGroupCreationUI.jaxx 2009-01-12 18:05:58 UTC (rev 1732)
@@ -56,10 +56,8 @@
protected double step = 1;
protected PopulationBasicsUI popBasic;
-// setCard("endInputGroupLength");
- public WizardGroupCreationUI(InputAction action, PopulationBasicsUI p){
-
- setContextValue(action);
+
+ public void init(PopulationBasicsUI p){
popBasic = p;
}
@@ -334,7 +332,7 @@
}
protected void cancel(){
- getParentContainer(JFrame.class).dispose();
+ getParentContainer(JFrame.class).dispose();
}
protected void refreshChoice(){
setInputType(beginGroupLengthTypeInput.isSelected());
1
0
Jan. 12, 2009
Author: sletellier
Date: 2009-01-12 18:05:16 +0000 (Mon, 12 Jan 2009)
New Revision: 1731
Modified:
isis-fish/trunk/src/main/xmi/isis-fish.zargo
Log:
Correction de l'unicit?\195?\169 entre les populations et les maturityGroupes
Modified: isis-fish/trunk/src/main/xmi/isis-fish.zargo
===================================================================
(Binary files differ)
1
0
Author: sletellier
Date: 2009-01-12 16:38:00 +0000 (Mon, 12 Jan 2009)
New Revision: 1730
Modified:
isis-fish/trunk/pom.xml
Log:
JAXX 1.1-SNAPSHOT
Modified: isis-fish/trunk/pom.xml
===================================================================
--- isis-fish/trunk/pom.xml 2009-01-12 15:01:10 UTC (rev 1729)
+++ isis-fish/trunk/pom.xml 2009-01-12 16:38:00 UTC (rev 1730)
@@ -60,14 +60,14 @@
<!--Jaxx-->
<dependency>
- <groupId>org.codelutin</groupId>
+ <groupId>org.codelutin.jaxx</groupId>
<artifactId>jaxx-runtime-swing</artifactId>
<version>${jaxx.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.codelutin</groupId>
+ <groupId>org.codelutin.jaxx</groupId>
<artifactId>jaxx-runtime-validator</artifactId>
<version>${jaxx.version}</version>
<scope>compile</scope>
@@ -322,7 +322,7 @@
<labs.project>isis-fish</labs.project>
<!-- Custom version -->
- <jaxx.version>1.0-SNAPSHOT</jaxx.version>
+ <jaxx.version>1.1-SNAPSHOT</jaxx.version>
<generator.version>0.63</generator.version>
<topia.version>2.1.1</topia.version>
<lutinwidget.version>0.12-SNAPSHOT</lutinwidget.version>
@@ -387,7 +387,7 @@
</plugin>
<plugin>
- <groupId>org.codelutin</groupId>
+ <groupId>org.codelutin.jaxx</groupId>
<artifactId>maven-jaxx-plugin</artifactId>
<version>${jaxx.version}</version>
<executions>
1
0
r1729 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org Jan. 12, 2009
by sletellier@users.labs.libre-entreprise.org Jan. 12, 2009
Jan. 12, 2009
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 Jan. 9, 2009
by sletellier@users.labs.libre-entreprise.org Jan. 9, 2009
Jan. 9, 2009
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 Jan. 9, 2009
by sletellier@users.labs.libre-entreprise.org Jan. 9, 2009
Jan. 9, 2009
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 Jan. 2, 2009
by sletellier@users.labs.libre-entreprise.org Jan. 2, 2009
Jan. 2, 2009
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 Jan. 2, 2009
by sletellier@users.labs.libre-entreprise.org Jan. 2, 2009
Jan. 2, 2009
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