Author: chatellier Date: 2009-06-09 09:07:35 +0000 (Tue, 09 Jun 2009) New Revision: 2348 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx Log: Fix buttons activation and fields reset on cancel 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-06-08 17:02:31 UTC (rev 2347) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2009-06-09 09:07:35 UTC (rev 2348) @@ -31,14 +31,13 @@ import fr.ifremer.isisfish.entities.SetOfVessels; import fr.ifremer.isisfish.entities.Metier; import fr.ifremer.isisfish.types.TimeUnit; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.ListSelectionEvent; import jaxx.runtime.swing.Item; -addPropertyChangeListener("bean", new PropertyChangeListener() { +addPropertyChangeListener("effortDescription", 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"); - fieldEffortDescriptionFishingOperation.setText(""); fieldEffortDescriptionFishingOperationDuration.setText(""); fieldEffortDescriptionGearsNumberPerOperation.setText(""); @@ -52,12 +51,31 @@ fieldEffortDescriptionOtherRunningCost.setText(""); } if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); + } } }); +fieldEffortDescriptionMetierList.addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + // active le bouton seulement si l'interface est active + // dans le cas de sensitivity par exemple + if(isActif()) { + buttonEffortDescriptionAdd.setEnabled(fieldEffortDescriptionMetierList.getSelectedIndex() != -1); + } + } +}); + +fieldEffortDescriptionEffortDescriptionList.addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + // active le bouton seulement si l'interface est active + // dans le cas de sensitivity par exemple + if(isActif()) { + removeEffortDescriptionButton.setEnabled(fieldEffortDescriptionEffortDescriptionList.getSelectedIndex() != -1); + } + } +}); + @Override public void refresh() { SetOfVessels setOfVessels = getVerifier().getEntity(SetOfVessels.class); @@ -76,7 +94,7 @@ getVerifier().setCancelButton(cancel); } -protected void setEffortDescriptionEffortDescriptionList(){ +protected void setEffortDescriptionEffortDescriptionList() { if (getBean().getPossibleMetiers() != null){ java.util.List<Item> items = new ArrayList<Item>(); for (EffortDescription e : getBean().getPossibleMetiers()){ @@ -85,7 +103,7 @@ fieldEffortDescriptionEffortDescriptionList.setItems(items); } } -protected void add(){ +protected void addEffortDescription() { Object value = fieldEffortDescriptionMetierList.getSelectedValue(); if (value != null){ Metier m = (Metier)value; @@ -93,7 +111,7 @@ setEffortDescriptionEffortDescriptionList(); } } -protected void remove(){ +protected void removeEffortDescription() { Object value = fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); if (value != null) { EffortDescription e = (EffortDescription)value; @@ -104,10 +122,11 @@ protected void effortDescriptionChanged() { EffortDescriptionImpl selectedEffort = (EffortDescriptionImpl)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); setEffortDescription(selectedEffort); - getVerifier().addCurrentEntity(getEffortDescription()); - - /* NumberEditor is not working + if (getEffortDescription() != null) { + getVerifier().addCurrentEntity(getEffortDescription()); + + /* NumberEditor is not working fieldEffortDescriptionFishingOperation.init(); fieldEffortDescriptionGearsNumberPerOperation.init(); fieldEffortDescriptionCrewSize.init(); @@ -117,8 +136,8 @@ fieldEffortDescriptionCrewShareRate.init(); fieldEffortDescriptionRepairAndMaintenanceGearCost.init(); fieldEffortDescriptionLandingCosts.init(); - fieldEffortDescriptionOtherRunningCost.init(); - }*/ + fieldEffortDescriptionOtherRunningCost.init();*/ + } } ]]> </script> @@ -135,7 +154,7 @@ <Table> <row> <cell fill='horizontal' weightx='1.0'> - <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='add()' enabled='{isActif()}'/> + <JButton id="buttonEffortDescriptionAdd" text="isisfish.common.add" onActionPerformed='addEffortDescription()' enabled='false'/> </cell> </row> <row> @@ -311,7 +330,7 @@ <JButton id='cancel' decorator='boxed'/> </cell> <cell fill='horizontal' weightx='0.3'> - <JButton id='remove' text="isisfish.common.remove" onActionPerformed='remove()' enabled='{isActif()}' decorator='boxed'/> + <JButton id='removeEffortDescriptionButton' text="isisfish.common.remove" onActionPerformed='removeEffortDescription()' enabled='false' decorator='boxed'/> </cell> </row> </Table>
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org