r1982 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui: input sensitivity
Author: sletellier Date: 2009-03-17 14:14:48 +0000 (Tue, 17 Mar 2009) New Revision: 1982 Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 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/PopulationZonesUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx Log: Factor of PopulationZone is done 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-03-17 13:33:34 UTC (rev 1981) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2009-03-17 14:14:48 UTC (rev 1982) @@ -72,7 +72,7 @@ <PopulationEquationUI id='populationEquationUI' constructorParams='this'/> </tab> <tab title='{_("isisfish.populationZones.title")}'> - <PopulationZonesUI id='populationZoneUI' constructorParams='this' decorator='boxed' _bean='{PopulationImpl.class}' _method='"MappingZoneReproZoneRecru"'/> + <PopulationZonesUI id='populationZoneUI' constructorParams='this'/> </tab> <tab title='{_("isisfish.populationSeasons.title")}'> <PopulationSeasonsUI id='populationSeasonsUI' constructorParams='this'/> Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2009-03-17 14:14:48 UTC (rev 1982) @@ -0,0 +1,172 @@ + +<fr.ifremer.isisfish.ui.input.InputContentUI> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.PopulationImpl id='bean' javaBean='null'/> + + <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 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; + +MatrixPanelListener listener = new MatrixPanelListener() { + + @Override + public void matrixChanged(MatrixPanelEvent arg0) { + fieldPopulationMappingZoneReproZoneRecruChanged(); + } +}; + +addPropertyChangeListener("bean", new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getOldValue() != null || evt.getNewValue() == null) { + // remove previous binding on getBean() + //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); + } + if (evt.getNewValue() != null) { + // add binding on getBean() + //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); + } + } +}); + +public void refresh(){ + setPopulationZonesPresenceModel(); + setFieldPopulationZonesReproductionModel(); + setFieldPopulationZonesRecruitmentModel(); + fieldPopulationMappingZoneReproZoneRecru.removeMatrixPanelListener(listener); + setFieldPopulationMappingZoneReproZoneRecru(); + fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener); +} +protected void fieldPopulationMappingZoneReproZoneRecruChanged(){ + getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix()); +} +protected void setFieldPopulationMappingZoneReproZoneRecru(){ + if (getBean() != null){ + if (getBean().getMappingZoneReproZoneRecru() != null){ + fieldPopulationMappingZoneReproZoneRecru.setMatrix(getBean().getMappingZoneReproZoneRecru().copy()); + } + } +} +protected void setPopulationZonesPresenceModel(){ + if (getBean() != null){ + setModel(getBean().getPopulationZone(), populationZonesPresence); + } +} +protected void setFieldPopulationZonesReproductionModel(){ + if (getBean() != null){ + setModel(getBean().getReproductionZone(), fieldPopulationZonesReproduction); + } +} +protected void setFieldPopulationZonesRecruitmentModel(){ + if (getBean() != null){ + 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); + } +} +protected void presenceChanged(){ + getBean().setPopulationZone(getSelectedValue(populationZonesPresence)); + setFieldPopulationMappingZoneReproZoneRecru(); +} +protected void reproductionChanged(){ + getBean().setReproductionZone(getSelectedValue(fieldPopulationZonesReproduction)); + setFieldPopulationMappingZoneReproZoneRecru(); +} +protected void recruitementChanged(){ + getBean().setRecruitmentZone(getSelectedValue(fieldPopulationZonesRecruitment)); + setFieldPopulationMappingZoneReproZoneRecru(); +} +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; +} + ]]> + </script> + <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> + </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/PopulationZonesUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-03-17 13:33:34 UTC (rev 1981) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2009-03-17 14:14:48 UTC (rev 1982) @@ -38,172 +38,26 @@ <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 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; -MatrixPanelListener listener = new MatrixPanelListener() { - - @Override - public void matrixChanged(MatrixPanelEvent arg0) { - fieldPopulationMappingZoneReproZoneRecruChanged(); - } -}; - -addPropertyChangeListener("bean", new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { - // remove previous binding on getBean() - //jaxx.runtime.SwingUtil.removeDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); - } - } -}); - public void refresh(){ getVerifier().setSaveButton(save); getVerifier().setCancelButton(cancel); Population population = getVerifier().getEntity(Population.class); setBean((PopulationImpl) population); - setPopulationZonesPresenceModel(); - setFieldPopulationZonesReproductionModel(); - setFieldPopulationZonesRecruitmentModel(); - fieldPopulationMappingZoneReproZoneRecru.removeMatrixPanelListener(listener); - setFieldPopulationMappingZoneReproZoneRecru(); - fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener); + getVerifier().addCurrentPanel(popZones); } -protected void fieldPopulationMappingZoneReproZoneRecruChanged(){ - getBean().setMappingZoneReproZoneRecru(fieldPopulationMappingZoneReproZoneRecru.getMatrix().copy()); -} -protected void setFieldPopulationMappingZoneReproZoneRecru(){ - if (getBean() != null){ - if (getBean().getMappingZoneReproZoneRecru() != null){ - fieldPopulationMappingZoneReproZoneRecru.setMatrix(getBean().getMappingZoneReproZoneRecru().copy()); - } - } -} -protected void setPopulationZonesPresenceModel(){ - if (getBean() != null){ - setModel(getBean().getPopulationZone(), populationZonesPresence); - } -} -protected void setFieldPopulationZonesReproductionModel(){ - if (getBean() != null){ - setModel(getBean().getReproductionZone(), fieldPopulationZonesReproduction); - } -} -protected void setFieldPopulationZonesRecruitmentModel(){ - if (getBean() != null){ - 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); - } -} -protected void presenceChanged(){ - getBean().setPopulationZone(getSelectedValue(populationZonesPresence)); - setFieldPopulationMappingZoneReproZoneRecru(); -} -protected void reproductionChanged(){ - getBean().setReproductionZone(getSelectedValue(fieldPopulationZonesReproduction)); - setFieldPopulationMappingZoneReproZoneRecru(); -} -protected void recruitementChanged(){ - getBean().setRecruitmentZone(getSelectedValue(fieldPopulationZonesRecruitment)); - setFieldPopulationMappingZoneReproZoneRecru(); -} -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; -} ]]> </script> <Table id='body'> <row> - <cell fill='horizontal' weightx='0.3'> - <JLabel text="isisfish.populationZones.selectPopulationAreas" enabled='{isActif()}'/> + <cell fill='both' weightx='1.0' weighty='1'> + <PopulationZonesEditorUI id='popZones' constructorParams='this' bean='{getBean()}' actif='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"MappingZoneReproZoneRecru"'/> </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'> + <cell fill='horizontal' weightx='1.0'> <Table> <row> <cell fill='horizontal' weightx='0.5'> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2009-03-17 13:33:34 UTC (rev 1981) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2009-03-17 14:14:48 UTC (rev 1982) @@ -27,6 +27,7 @@ import fr.ifremer.isisfish.ui.input.PopulationMigrationEmigrationUI; import fr.ifremer.isisfish.ui.input.PopulationMigrationImmigrationUI; import fr.ifremer.isisfish.ui.input.PopulationMigrationMigrationUI; +import fr.ifremer.isisfish.ui.input.PopulationZonesEditorUI; import fr.ifremer.isisfish.ui.widget.IntervalPanel; import java.lang.reflect.Method; import java.util.logging.Level; @@ -119,6 +120,13 @@ result = ipResult; } else if (result instanceof RangeOfValuesUI){ result = new JTextField(""); + } else if (result instanceof PopulationZonesEditorUI){ + PopulationZonesEditorUI origine = (PopulationZonesEditorUI)c; + PopulationZonesEditorUI ui = new PopulationZonesEditorUI(new JAXXInitialContext().add(new InputAction()).add(origine.getRegion())); + ui.setBean(origine.getBean()); + ui.setActif(true); + ui.refresh(); + result = ui; } else if (result instanceof PopulationMigrationMigrationUI){ PopulationMigrationMigrationUI origine = (PopulationMigrationMigrationUI)c; PopulationMigrationMigrationUI ui = new PopulationMigrationMigrationUI(new JAXXInitialContext().add(new InputAction())); @@ -277,7 +285,15 @@ ipResult.setLabelRenderer(Month.MONTH); ipResult.setModel(ip.getModel().clone()); result = ipResult; - }else if (result instanceof PopulationMigrationMigrationUI){ + } else if (result instanceof PopulationZonesEditorUI){ + PopulationZonesEditorUI origine = (PopulationZonesEditorUI)c; + PopulationZonesEditorUI ui = new PopulationZonesEditorUI(new JAXXInitialContext().add(new InputAction()).add(origine.getRegion())); + ui.setBean(origine.getBean()); + ui.getFieldPopulationMappingZoneReproZoneRecru().setMatrix((MatrixND)value); + ui.setActif(true); + ui.refresh(); + result = ui; + } else if (result instanceof PopulationMigrationMigrationUI){ PopulationMigrationMigrationUI origine = (PopulationMigrationMigrationUI)c; PopulationMigrationMigrationUI ui = new PopulationMigrationMigrationUI(new JAXXInitialContext().add(new InputAction())); ui.setBean(origine.getBean()); @@ -314,7 +330,9 @@ Object result = null; if (c instanceof JTextComponent) { result = ((JTextComponent)c).getText(); - } else if (c instanceof JTable){ + } else if (c instanceof PopulationZonesEditorUI){ + result = ((PopulationZonesEditorUI)c).getFieldPopulationMappingZoneReproZoneRecru().getMatrix(); + } else if (c instanceof JTable){ // ((JTable) result).setText(BeanUtils.getProperty(e, fieldName)); } else if (c instanceof MatrixPanelEditor){ Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx 2009-03-17 13:33:34 UTC (rev 1981) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx 2009-03-17 14:14:48 UTC (rev 1982) @@ -102,7 +102,7 @@ } init(); } - if (!isContinueSelected()){ + if (!isContinueSelected() && EditorHelper.isRangeOfValue(cOrigine)){ int i = 0; for (String s : EditorHelper.getDiscretRangeOfValueValues(cOrigine, bean)){ JTextField text = new JTextField(s);
participants (1)
-
sletellier@users.labs.libre-entreprise.org