r3254 - in isis-fish/branches/3.3.1/src/main: java/fr/ifremer/isisfish/ui/input java/fr/ifremer/isisfish/ui/input/tree java/fr/ifremer/isisfish/ui/sensitivity resources resources/fr resources/fr/ifremer resources/fr/ifremer/isisfish resources/fr/ifremer/isisfish/entities
Author: chatellier Date: 2011-04-15 16:11:41 +0000 (Fri, 15 Apr 2011) New Revision: 3254 Log: Add validation. Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeSelectionModel.java isis-fish/branches/3.3.1/src/main/resources/fr/ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Cell-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/FisheryRegion-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Gear-gear-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Metier-metier-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Population-basics-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-warning-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/SetOfVessels-basics-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Species-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/TripType-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/VesselType-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-error-validation.xml isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-warning-validation.xml Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/CellUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -42,6 +42,12 @@ javax.swing.DefaultComboBoxModel; </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Cell' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldCellName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected OMToolSet toolSet = new OMToolSet(); @@ -106,12 +112,6 @@ refreshRegionInMap(cellMap); }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - protected void fieldCellChanged(ItemEvent event) { if (cellChanged && event.getStateChange() == ItemEvent.SELECTED) { Cell c = (Cell)fieldCell.getSelectedItem(); @@ -193,10 +193,16 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' text='isisfish.common.save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' text='isisfish.common.cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionParametersUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -38,9 +38,13 @@ java.beans.PropertyChangeEvent; java.beans.PropertyChangeListener; </import> + + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="effortdescriptionparameters" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ - - protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { @@ -78,12 +82,6 @@ setBean(setOfVessels); }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - protected void effortDescriptionSelectionChanged() { EffortDescription selectedEffort = (EffortDescription)fieldEffortDescriptionEffortDescriptionList.getSelectedValue(); setEffortDescription(selectedEffort); @@ -281,10 +279,16 @@ </row> <row> <cell fill='horizontal' weightx='0.3'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/EffortDescriptionUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -40,6 +40,11 @@ java.beans.PropertyChangeListener; </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="effortdescription" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ /** * Get input action from context. @@ -71,12 +76,6 @@ setBean(setOfVessels); }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - protected void onFieldEffortDescriptionMetierListValueChanged() { // active le bouton seulement si l'interface est active // dans le cas de sensitivity par exemple @@ -152,10 +151,16 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/FisheryRegionUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -40,6 +40,12 @@ javax.swing.JTable </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.FisheryRegion' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldRegion" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected OMToolSet toolSet = new OMToolSet(); @@ -56,7 +62,10 @@ addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { + if (evt.getNewValue() == null) { + + } + if (evt.getNewValue() != null) { setFieldMapfilesModel(getBean()); /* numberEditor is not working fieldLatMin.init(); @@ -66,9 +75,6 @@ fieldCellLengthLatitude.init(); fieldCellLengthLongitude.init();*/ } - if (evt.getNewValue() != null) { - - } } }); } @@ -82,12 +88,6 @@ setBean(region); } - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save, false); - getSaveVerifier().setCancelButton(cancel); -} - protected InputAction getInputAction() { return getContextValue(InputAction.class); } @@ -131,11 +131,11 @@ protected void save() { setInfoText(_("isisfish.message.checking.cell")); getInputAction().saveFisheryRegion(getBean()); - getSaveVerifier().setEditable(false); - // TODO remove getParentContainer reference - // FIXME echatellier 20110306 : use new tree cell api - //getParentContainer(InputUI.class).setTreeModel(); - //getParentContainer(InputUI.class).setFieldCurrentRegionModel(); + + // reload tree + InputUI inputUI = getParentContainer(InputUI.class); + inputUI.getHandler().reloadFisheryTree(inputUI); + setInfoText(_("isisfish.message.save.finished")); refresh(); } @@ -297,10 +297,16 @@ </row> <row> <cell fill='horizontal' weightx='0.3'> - <JButton id='save' enabled='false' onActionPerformed='save()' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="save()"/> </cell> <cell fill='horizontal' weightx='0.3'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> <cell fill='horizontal' weightx='0.3'> <JButton id='check' text="isisfish.common.check" onActionPerformed='check()' decorator='boxed'/> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearTabUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -28,11 +28,19 @@ <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> <import> - fr.ifremer.isisfish.entities.Gear; - jaxx.runtime.swing.editor.NumberEditor; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; + fr.ifremer.isisfish.entities.Gear; + jaxx.runtime.swing.editor.NumberEditor; + java.beans.PropertyChangeEvent; + java.beans.PropertyChangeListener; </import> + + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="gear" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Gear' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldGearName" /> + <field name="effortUnit" component="fieldGearEffortUnit" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { @@ -67,14 +75,6 @@ // fieldGearStandardisationFactor.init(); //} }*/ - - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, Gear.class); - getSaveVerifier().setDeleteButton(remove); -} ]]></script> <JPanel id="body"> <Table> @@ -149,18 +149,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Gear.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/GearUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -58,12 +58,6 @@ }*/ @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(gearTab); -} - - at Override public void setLayer(boolean active) { gearTabUI.setLayer(active); selectivityUI.setLayer(active); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputAction.java 2011-04-15 16:11:41 UTC (rev 3254) @@ -46,6 +46,7 @@ import org.nuiton.widget.editor.Editor; import fr.ifremer.isisfish.IsisFishDAOHelper; +import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.FormuleStorage; import fr.ifremer.isisfish.datastore.RegionStorage; import fr.ifremer.isisfish.entities.Cell; @@ -618,30 +619,25 @@ } } - public void createMetierSeasonInfo(Metier metier) { + public MetierSeasonInfo createMetierSeasonInfo(Metier metier) { + MetierSeasonInfo metierSeasonInfo = null; if (log.isDebugEnabled()) { log.debug("createMetierSeasonInfo called"); } try { MetierSeasonInfoDAO metierSeasonInfoPS = IsisFishDAOHelper .getMetierSeasonInfoDAO(metier.getTopiaContext()); - MetierSeasonInfo metierSeasonInfo = metierSeasonInfoPS.create(); + metierSeasonInfo = metierSeasonInfoPS.create(); metierSeasonInfo.setFirstMonth(Month.MONTH[0]); metierSeasonInfo.setLastMonth(Month.MONTH[3]); metier.addMetierSeasonInfo(metierSeasonInfo); metierSeasonInfo.update(); metier.update(); - - // EC-20091112 : commit() twice cause hibernate error: - // Found two representations of same collection: - // isisContext.commitTransaction(); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Can't create MetierSeasonInfo", eee); - } - ErrorHelper.showErrorDialog(_("isisfish.error.input.addentity", - "MetierSeasonInfo"), eee); + + } catch (TopiaException eee) { + throw new IsisFishRuntimeException("Can't create MetierSeasonInfo", eee); } + return metierSeasonInfo; } public void removeMetierSeasonInfo(Metier metier, MetierSeasonInfo info) { Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -54,8 +54,12 @@ } }}' /> + <!-- Layer qui control les clics sur les JTables (certaines equations) --> <fr.ifremer.isisfish.ui.sensitivity.TableBlockingLayerUI id="tableLayerUI" constructorParams='this' /> + <!-- Validation + <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errorsTableModel' /> --> + <import> javax.swing.JComponent javax.swing.event.ChangeListener @@ -76,22 +80,13 @@ <script><![CDATA[ protected ChangeListener tabbedPaneChangeListener; -/** +/* * Overriden with generic type */ public abstract void setBean(B entity); public abstract B getBean(); -/** - * This is a hack for tabbed UI. - * - * In this case of UI, they have multiples save/cancel - * buttons, they have to be manually activated - * on tab siwtching. - */ -public abstract void setActionButtons(); - public InputAction getAction() { return getContextValue(InputAction.class); } @@ -203,14 +198,6 @@ tabbedPane.addChangeListener(tabbedPaneChangeListener); } -/** - * Active les boutons sur l'onglet actuellement affiché. - */ -protected void setCurrentTabActionButtons(JTabbedPane tabbedPane) { - InputContentUI selectedUI = (InputContentUI) tabbedPane.getSelectedComponent(); - selectedUI.setActionButtons(); -} - ]]></script> <JPanel id='body' constraints='BorderLayout.CENTER' layout='{new BorderLayout()}' /> <JButton id='next' text='{getButtonTitle()}' constraints='BorderLayout.SOUTH' Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputHandler.java 2011-04-15 16:11:41 UTC (rev 3254) @@ -81,6 +81,7 @@ import fr.ifremer.isisfish.ui.input.tree.FisheryTreeHelper; import fr.ifremer.isisfish.ui.input.tree.FisheryTreeNode; import fr.ifremer.isisfish.ui.input.tree.FisheryTreeRenderer; +import fr.ifremer.isisfish.ui.input.tree.FisheryTreeSelectionModel; import fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI; import fr.ifremer.isisfish.ui.sensitivity.SensitivityInputHandler; import fr.ifremer.isisfish.ui.simulator.filter.SimulationFilterUtil; @@ -160,6 +161,7 @@ inputUI.getFisheryRegionTree().setCellRenderer(null); inputUI.getFisheryRegionTree().setModel(model); inputUI.getFisheryRegionTree().setCellRenderer(new FisheryTreeRenderer(dataProvider)); + inputUI.getFisheryRegionTree().setSelectionModel(new FisheryTreeSelectionModel(inputUI)); treeHelper.setUI(inputUI.getFisheryRegionTree(), true, false, null); // global context value : fisheryRegion, regionStorage, treeHelper @@ -174,6 +176,17 @@ } /** + * Reload current loaded fishery tree. + * + * @param inputUI inputUI + */ + public void reloadFisheryTree(InputUI inputUI) { + FisheryTreeHelper fisheryTreeHelper = inputUI.getContextValue(FisheryTreeHelper.class); + TreeModel fisheryTreeModel = inputUI.getContextValue(TreeModel.class); + fisheryTreeHelper.refreshNode((FisheryTreeNode)fisheryTreeModel.getRoot(), true); + } + + /** * Main ui fishery region selection changed. * * @param inputUI inputUI @@ -481,22 +494,18 @@ */ public void nodeSelectionChanged(InputUI inputUI, TreeSelectionEvent event) { - //TreePath oldTreePath = event.getOldLeadSelectionPath(); TreePath newTreePath = event.getNewLeadSelectionPath(); - - //FisheryRegionTreeHelper treeHelper = inputUI.getContextValue(FisheryRegionTreeHelper.class); if (newTreePath != null) { Object lastTreePath = newTreePath.getLastPathComponent(); if (lastTreePath instanceof FisheryTreeNode) { FisheryTreeNode isisTreeNode = (FisheryTreeNode)lastTreePath; Class<?> internalClass = isisTreeNode.getInternalClass(); - - // noeud qui n'en charge pas d'autres (= un bean) TopiaEntityContextable topiaEntity = null; String topiaId = isisTreeNode.getId(); try { + // noeud qui n'en charge pas d'autres (= un bean) if (isisTreeNode.isStaticNode()) { FisheryRegion fisheryRegion = inputUI.getContextValue(FisheryRegion.class); TopiaContext topiaContext = fisheryRegion.getTopiaContext(); @@ -506,7 +515,7 @@ InputContentUI inputContentUI = getUIInstanceForBeanClass(internalClass, inputUI); // mandatory set - inputContentUI.getSaveVerifier().reset(); // before set bean !!! + //inputContentUI.getSaveVerifier().reset(); // before set bean !!! if (topiaEntity != null) { inputContentUI.getSaveVerifier().addCurrentEntity(topiaEntity); inputContentUI.getSaveVerifier().setInputContentUI(inputContentUI); @@ -514,7 +523,6 @@ inputContentUI.setBean((TopiaEntityContextable)topiaEntity); inputContentUI.setActive(topiaEntity != null); - inputContentUI.setActionButtons(); // add initialized ui to panel inputUI.getCardlayoutPrincipal().show(inputUI.getInputPanePrincipal(), "normale"); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputOneEquationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -175,11 +175,6 @@ editor.getCurrentEditor().addDocumentListener(listener); } - at Override -public void setActionButtons() { - -} - protected void setComboModel() { if (getBean() != null){ TopiaContext isisContext = ((org.nuiton.topia.persistence.TopiaEntityAbstract)getBean()).getTopiaContext(); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2011-04-15 16:11:41 UTC (rev 3254) @@ -29,20 +29,14 @@ import java.awt.Component; import java.awt.Dimension; -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.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; -import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JScrollPane; @@ -63,7 +57,6 @@ import fr.ifremer.isisfish.IsisFishDAOHelper; import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.ui.SaveVerifier; -import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; /** * InputSaveVerifier. @@ -79,56 +72,13 @@ /** Class logger. */ private static Log log = LogFactory.getLog(InputSaveVerifier.class); - /** New button. Used to create new {@link #type} component. */ - protected JButton currentNewButton = null; - /** Delete button. */ - protected JButton currentDeleteButton = null; - /** Save button. */ - protected JButton currentSaveButton = null; - /** Cancel button. */ - protected JButton currentCancelButton = null; - - /** Save listener. */ - protected ActionListener saveListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - topiaSave(); - } - }; - - /** Cancel listener. */ - protected ActionListener cancelListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - topiaCancel(); - } - }; - - /** New listener. */ - protected ActionListener newListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - topiaCreate(); - } - }; - - /** Delete listener. */ - protected ActionListener deleteListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - topiaRemove(); - } - }; - - /** Entity type for new creation. */ - protected Class<?> type; - /** Current entity modification state (modifier by PCL). */ protected boolean changed = false; - /** Editable is true when entity can be modified (in sensitity, cannot). */ + /** Editable is true when entity can be modified (in sensitivity, cannot). */ protected boolean editable = false; + /** L'ui en cours d'edition (au plus bas niveau des tabPane). */ protected InputContentUI<?> inputContentUI; /** Map entity key to {@link TopiaEntity}. */ @@ -163,22 +113,18 @@ _("isisfish.input.menu.commit"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (response == JOptionPane.NO_OPTION) { - topiaCancel(); + cancel(); } else if (response == JOptionPane.YES_OPTION) { - topiaSave(); + save(); } } } return response; } - /** Called by entity property change listener on data change. */ + /* Called by entity property change listener on data change.*/ protected void topiaChanged() { changed = true; - setEnabled(currentSaveButton, true); - setEnabled(currentCancelButton, true); - setEnabled(currentNewButton, false); - setEnabled(currentDeleteButton, false); } /** @@ -187,32 +133,16 @@ */ protected void noModif() { changed = false; - setEnabled(currentSaveButton, false); - setEnabled(currentCancelButton, false); - setEnabled(currentNewButton, true); - setEnabled(currentDeleteButton, editable); } /** - * Set component enabled state. - * - * @param c component - * @param enabled enabled state - */ - protected void setEnabled(Component c, boolean enabled) { - if (c != null) { - c.setEnabled(enabled); - } - } - - /** * 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 >.*" */ - protected void topiaRemove() { + public void delete() { String msg = ""; try { boolean doDelete; @@ -256,8 +186,10 @@ /** * Create new {@link type} entity. + * + * @param type */ - protected void topiaCreate() { + public void create(Class<? extends TopiaEntityContextable> type) { if (log.isDebugEnabled()) { log.debug("Create called for " + type); @@ -293,9 +225,10 @@ * Change registered button states. * Commit opened topia context. */ - protected void topiaSave() { + public void save() { TopiaEntityContextable topiaEntity = (TopiaEntityContextable)inputContentUI.getBean(); TopiaContext topiaContext = inputContentUI.getTopiaContext(); + try { for (TopiaEntityContextable entity : currentEntities.values()) { entity.update(); @@ -327,25 +260,21 @@ /** * Cancel all modification on entity (rollback), and force reload it. */ - protected void topiaCancel() { + public void cancel() { TopiaContext topiaContext = inputContentUI.getTopiaContext(); TopiaEntityContextable topiaEntity = (TopiaEntityContextable)inputContentUI.getBean(); try { topiaContext.rollbackTransaction(); noModif(); + + // sans cette boucle + // une annulation/sauvegarde provoque l'erreur + // org.hibernate.NonUniqueObjectException: a different object with + // the same identifier value was already associated with the session Map<String, TopiaEntityContextable> canceledEntity = (Map<String, TopiaEntityContextable>)currentEntities.clone(); - currentEntities.clear(); for (Entry<String, TopiaEntityContextable> currentEntity : canceledEntity.entrySet()) { TopiaEntityContextable t = (TopiaEntityContextable)topiaContext.findByTopiaId(currentEntity.getValue().getTopiaId()); - - // TODO a quoi ca sert de recharger les entités ? - // desynchronise la précédente - // fix : org.hibernate.NonUniqueObjectException: a different object with the - // same identifier value was already associated with the session - //((TopiaContextImpl)isisContext).getHibernate().evict(t2); - //t.setTopiaId(null); - String key = currentEntity.getKey(); addCurrentEntity(t, key); } @@ -401,7 +330,7 @@ * Remove all entity with key * * @param currentEntity entity to check - * @param key specific key (defauft to topiaId) + * @param key specific key (default to topiaId) */ public void addCurrentEntity(TopiaEntityContextable currentEntity, String key) { if (currentEntity != null) { @@ -448,80 +377,23 @@ } } - public void reset() { + /*public void reset() { removeAllEntity(); - this.currentCancelButton = null; - this.currentDeleteButton = null; - this.currentNewButton = null; - this.currentSaveButton = null; - } + }*/ - public void removeAllEntity() { + /*public void removeAllEntity() { currentEntities.clear(); editable = false; noModif(); - } + }*/ - public boolean isEditable() { + /*public boolean isEditable() { return editable; - } + }*/ - public void setSaveButton(JButton saveButton) { - setSaveButton(saveButton, true); - } - - public void setSaveButton(JButton saveButton, boolean listener) { - if (listener) { - // TODO what is it for (remove/readd) ? - saveButton.removeActionListener(saveListener); - saveButton.addActionListener(saveListener); - } - saveButton.setEnabled(changed); - saveButton.setText(_("isisfish.common.save")); - this.currentSaveButton = saveButton; - } - - public void setNewButton(JButton saveButton, Class<? extends TopiaEntityContextable> type) { - setNewButton(saveButton, type, true); - } - - public void setNewButton(JButton newButton, Class<? extends TopiaEntityContextable> type, boolean listener) { - if (listener) { - // TODO what is it for (remove/readd) ? - newButton.removeActionListener(newListener); - newButton.addActionListener(newListener); - } - newButton.setText(_("isisfish.common.new")); - newButton.setEnabled(!changed); - this.type = type; - this.currentNewButton = newButton; - } - - public void setCancelButton(JButton cancelButton) { - cancelButton.removeActionListener(cancelListener); - cancelButton.addActionListener(cancelListener); - cancelButton.setText(_("isisfish.common.cancel")); - cancelButton.setEnabled(changed); - this.currentCancelButton = cancelButton; - } - - public void setDeleteButton(JButton deleteButton) { - setDeleteButton(deleteButton, true); - } - - public void setDeleteButton(JButton deleteButton, boolean listener) { - if (listener) { - deleteButton.removeActionListener(deleteListener); - deleteButton.addActionListener(deleteListener); - } - deleteButton.setEnabled(editable); - deleteButton.setText(_("isisfish.common.remove")); - this.currentDeleteButton = deleteButton; - } - - public Collection<TopiaEntityContextable> getCurrentEntities() { + /*public Collection<TopiaEntityContextable> getCurrentEntities() { return currentEntities.values(); - } + }*/ public <E extends TopiaEntityContextable> E getEntity(Class<E> clazz, String key) { return (E) currentEntities.get(key); @@ -536,15 +408,7 @@ return null; } - public void setEditable(boolean editable) { + /*public void setEditable(boolean editable) { this.editable = editable; - } - - public SensitivityTabUI getSensPanel() { - return null; //sensUI; - } - - public void setSensPanel(SensitivityTabUI sensUI) { - //this.sensUI = sensUI; - } + }*/ } Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/InputTabbedPaneListener.java 2011-04-15 16:11:41 UTC (rev 3254) @@ -34,6 +34,8 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaEntityContextable; +import fr.ifremer.isisfish.ui.SaveVerifier; + /** * Listener used to control InputUI tab panel switching. * @@ -52,6 +54,7 @@ @Override public void stateChanged(ChangeEvent e) { + JTabbedPane pane = (JTabbedPane) e.getSource(); // to not fire additional event during tab index management @@ -63,7 +66,8 @@ pane.setSelectedIndex(cacheSelectedIndex); } InputContentUI ui = (InputContentUI) pane.getSelectedComponent(); - if (canChangeTab(ui)) { + InputSaveVerifier saveVerifier = (InputSaveVerifier)ui.getContextValue(InputSaveVerifier.class); + if (canChangeTab(saveVerifier)) { pane.setSelectedIndex(selectedIndex); } ui = (InputContentUI) pane.getSelectedComponent(); @@ -89,7 +93,6 @@ if (log.isDebugEnabled()) { log.debug("Activating action buttons on " + ui); } - ui.setActionButtons(); cacheSelectedIndex = pane.getSelectedIndex(); pane.addChangeListener(this); @@ -102,15 +105,14 @@ /** * Ask you to save if modification are made. * - * @param currentUI current displayed UI + * @param saveVerifier save verifier * @return true to change tab */ - protected boolean canChangeTab(InputContentUI<?> currentUI) { + protected boolean canChangeTab(SaveVerifier saveVerifier) { // by default, we says that component was successfully closed boolean exit = true; - InputSaveVerifier verif = currentUI.getContextValue(InputSaveVerifier.class); - int response = verif.checkEdit(); + int response = saveVerifier.checkEdit(); if (response == JOptionPane.CANCEL_OPTION) { exit = false; Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesEditorUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -45,6 +45,7 @@ java.awt.Dimension javax.swing.DefaultComboBoxModel </import> + <script><![CDATA[ protected void $afterCompleteSetup() { @@ -94,11 +95,6 @@ targetFactor.setActive(targetSpeciesSelected); } - at Override -public void setActionButtons() { - -} - protected void setTargetSpeciesModel() { java.util.List<Species> species = getFisheryRegion().getSpecies(); SpeciesComboModel fieldTargetSpeciesModel = new SpeciesComboModel(species); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoSpeciesUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -39,6 +39,12 @@ java.beans.PropertyChangeListener; javax.swing.DefaultComboBoxModel </import> + + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="seasonspecies" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Metier' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { @@ -73,12 +79,6 @@ } }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - protected void setSeasonModel(){ java.util.List<MetierSeasonInfo> metierSeasonInfo = getBean().getMetierSeasonInfo(); MetierSeasonInfoComboModel seasonModel = new MetierSeasonInfoComboModel(metierSeasonInfo); @@ -132,10 +132,16 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierSeasonInfoZoneUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -26,10 +26,9 @@ <!-- bean property --> <fr.ifremer.isisfish.entities.Metier id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.MetierSeasonInfo id='metierSeasonInfo' javaBean='null'/> - <Boolean id='metierSeasonInfoNotNull' javaBean='false'/> - <import> fr.ifremer.isisfish.entities.Metier; fr.ifremer.isisfish.entities.MetierSeasonInfo; @@ -44,6 +43,11 @@ java.util.ArrayList java.awt.Dimension </import> + + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="seasonzones" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Metier' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> <script><![CDATA[ @@ -72,32 +76,7 @@ } } }); - - save.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getSaveVerifier().topiaSave(); - setMetierSeasonInfoCombo(); - } - }); - create.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).createMetierSeasonInfo(getBean()); - setMetierSeasonInfoCombo(); - } - - }); - - remove.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).removeMetierSeasonInfo(getBean(), getMetierSeasonInfo()); - setMetierSeasonInfoCombo(); - } - }); - addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue() == null) { @@ -110,20 +89,31 @@ }); } + protected void save() { + getSaveVerifier().save(); + setMetierSeasonInfoCombo(); + } + + protected void create() { + MetierSeasonInfo newMSI = getContextValue(InputAction.class).createMetierSeasonInfo(getBean()); + setMetierSeasonInfo(newMSI); + setMetierSeasonInfoCombo(); + } + + protected void delete() { + getContextValue(InputAction.class).removeMetierSeasonInfo(getBean(), getMetierSeasonInfo()); + setMetierSeasonInfo(null); + setMetierSeasonInfoCombo(); + } + public void refresh() { if (log.isDebugEnabled()) { log.debug("Refresh called in ui : " + this); } - //if (!isActive()) { - setMetierSeasonInfoNotNull(false); - //} + setMetierSeasonInfo(null); - Metier metier = getSaveVerifier().getEntity(Metier.class); - // don't add setBean(null) here : useless - //setBean(metier); - if (getBean() != null) { // Model instanciation interval = new Interval(); @@ -140,17 +130,13 @@ ip.setModel(interval); } } - - @Override - public void setActionButtons() { - getSaveVerifier().setSaveButton(save, false); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, MetierSeasonInfo.class, false); - getSaveVerifier().setDeleteButton(remove, false); - } protected void setSeason() { if (getMetierSeasonInfo() != null) { + + // register selected item in save verifier + getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); + try { if (log.isDebugEnabled()) { log.debug("Refresh interval : "); @@ -198,9 +184,10 @@ java.util.List<MetierSeasonInfo> metierSeasonInfoList = getBean().getMetierSeasonInfo(); MetierSeasonInfoComboModel metierSeasonInfoModel = new MetierSeasonInfoComboModel(metierSeasonInfoList); metierSeasonInfoCombo.setModel(metierSeasonInfoModel); + metierSeasonInfoModel.setSelectedItem(getMetierSeasonInfo()); } - protected void metierZonesChanged(){ + protected void metierZonesChanged() { Object[] selected = metierZones.getSelectedValues(); java.util.List<Zone> zones = new ArrayList<Zone>(); for (Object o : selected){ @@ -208,11 +195,10 @@ } getMetierSeasonInfo().setZone(zones); } + protected void seasonChanged() { init = true; setMetierSeasonInfo((MetierSeasonInfo)metierSeasonInfoCombo.getSelectedItem()); - getSaveVerifier().addCurrentEntity(getMetierSeasonInfo()); - setMetierSeasonInfoNotNull(getMetierSeasonInfo() != null); setSeason(); setMetierZone(); init = false; @@ -228,36 +214,39 @@ <JLabel text="isisfish.metierSeasonInfoZone.selectSeason" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JComboBox id="metierSeasonInfoCombo" onActionPerformed='seasonChanged()' enabled='{isActive()}' - renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" /> + <JComboBox id="metierSeasonInfoCombo" onItemStateChanged='seasonChanged()' enabled='{isActive()}' + renderer="{new fr.ifremer.isisfish.ui.input.metier.MetierSeasonInfoComboRenderer()}" /> </cell> </row> <row> <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{isMetierSeasonInfoNotNull()}'/> + <JLabel text="isisfish.metierSeasonInfoZone.season" enabled='{getMetierSeasonInfo() != null}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <IntervalPanel id='ip' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> + <IntervalPanel id='ip' enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> </cell> </row> <row> <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.common.zone" enabled='{isMetierSeasonInfoNotNull()}'/> + <JLabel text="isisfish.common.zone" enabled='{getMetierSeasonInfo() != null}'/> </cell> <cell fill='both' weightx='1.0' weighty='0.7'> <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> - <JAXXList id="metierZones" onValueChanged='metierZonesChanged()' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> + <JAXXList id="metierZones" onValueChanged='metierZonesChanged()' + enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> </JScrollPane> </cell> </row> <row> <cell fill='horizontal' anchor='east'> - <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{isMetierSeasonInfoNotNull()}'/> + <JLabel text="isisfish.metierSeasonInfoZone.comments" enabled='{getMetierSeasonInfo() != null}'/> </cell> <cell fill='both' weightx='1.0' weighty='0.3'> <JScrollPane minimumSize='{new Dimension(0,0)}' preferredSize='{new Dimension(0,0)}'> <!-- jaxx.runtime.SwingUtil.getStringValue for null values --> - <JTextArea id="fieldMetierSeasonZoneComment" text='{jaxx.runtime.SwingUtil.getStringValue(getMetierSeasonInfo().getSeasonZoneComment())}' onKeyReleased='getMetierSeasonInfo().setSeasonZoneComment(fieldMetierSeasonZoneComment.getText())' enabled='{isMetierSeasonInfoNotNull()}' decorator='boxed'/> + <JTextArea id="fieldMetierSeasonZoneComment" text='{jaxx.runtime.SwingUtil.getStringValue(getMetierSeasonInfo().getSeasonZoneComment())}' + onKeyReleased='getMetierSeasonInfo().setSeasonZoneComment(fieldMetierSeasonZoneComment.getText())' + enabled='{getMetierSeasonInfo() != null}' decorator='boxed'/> </JScrollPane> </cell> </row> @@ -269,18 +258,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="create()"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{getMetierSeasonInfo() != null}" + onActionPerformed="delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierTabUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -34,6 +34,13 @@ java.beans.PropertyChangeListener; java.awt.Dimension </import> + + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="metier" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Metier' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldMetierName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ @@ -68,14 +75,6 @@ setBean(metier); }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, Metier.class); - getSaveVerifier().setDeleteButton(remove); -} - protected void gearChanged() { if (!init) { getBean().setGear((Gear)fieldMetierGear.getSelectedItem()); @@ -137,18 +136,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Metier.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/MetierUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -39,7 +39,7 @@ setNextPath(n_("isisfish.input.tree.triptypes")); // install change listener - // (depends on sensitivity c'ant be done on constructor) + // (depends on sensitivity can't be done on constructor) installChangeListener(metierTab); } @@ -52,12 +52,6 @@ }*/ @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(metierTab); -} - - at Override public void setLayer(boolean active) { metierTabUI.setLayer(active); metierSeasonInfoUI.setLayer(active); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationBasicsUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -42,6 +42,12 @@ java.awt.BorderLayout </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="basics" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldPopulationBasicsName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { @@ -81,14 +87,6 @@ //getSaveVerifier().addCurrentPanel(growthEquation, growthReverseEquation); } - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, Population.class, false); - getSaveVerifier().setDeleteButton(remove); -} - /** * Open creation classe wizard after confirmation. */ @@ -261,18 +259,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed' /> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed' /> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' onActionPerformed='create()' decorator='boxed' /> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Population.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed' /> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationCapturabilityUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -35,6 +35,11 @@ org.nuiton.math.matrix.gui.MatrixPanelListener; </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="capturability" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { @@ -76,12 +81,6 @@ // TODO add only once, not at all refresh //fieldPopulationCapturability.addMatrixListener(listener); }*/ - - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} ]]> </script> <JPanel id="body"> @@ -116,10 +115,16 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationEquationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -31,6 +31,12 @@ fr.ifremer.isisfish.entities.Formule; fr.ifremer.isisfish.entities.Population; </import> + + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="equation" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ /*public void refresh() { Population population = getSaveVerifier().getEntity(Population.class); @@ -42,12 +48,6 @@ getSaveVerifier().addCurrentPanel(naturalDeathRate, meanWeight, price); }*/ - - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} ]]> </script> <JPanel id="body"> @@ -81,10 +81,16 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationGroupUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -50,6 +50,11 @@ java.beans.PropertyChangeListener; </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="group" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { @@ -97,12 +102,6 @@ setBean(population); }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - protected void setNaturalDeathRateMatrix() { try { Population population = getBean(); @@ -245,10 +244,16 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEmigrationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -75,11 +75,6 @@ refreshPanel(); }*/ - at Override -public void setActionButtons() { - -} - public void refreshPanel() { setFieldPopulationMigrationMigrationGroupChooserModel(); setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationEquationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -44,11 +44,6 @@ /*public void refresh() { getSaveVerifier().addCurrentPanel(immigrationEquation, emigrationEquation, migrationEquation); }*/ - - at Override -public void setActionButtons() { - -} ]]> </script> <JPanel id="body"> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationImmigrationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -80,11 +80,6 @@ refreshPanel(); }*/ - at Override -public void setActionButtons() { - -} - public void refreshPanel(){ setFieldPopulationMigrationMigrationGroupChooserModel(); setFieldPopulationMigrationMigrationArrivalZoneChooserModel(); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationMigrationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -84,11 +84,6 @@ refreshPanel(); }*/ - at Override -public void setActionButtons() { - -} - public void refreshPanel(){ setFieldPopulationMigrationMigrationGroupChooserModel(); setFieldPopulationMigrationMigrationDepartureZoneChooserModel(); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationMigrationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -39,6 +39,12 @@ java.beans.PropertyChangeListener; java.awt.CardLayout </import> + + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="migration" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { @@ -91,12 +97,6 @@ setSelectedPopulationSeasonInfo(fieldPopulationMigrationSeasonChooser.getModel().getSelectedItem() != null); } - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - protected void seasonChanged() { PopulationSeasonInfoComboModel model = (PopulationSeasonInfoComboModel)fieldPopulationMigrationSeasonChooser.getModel(); PopulationSeasonInfo selectedPSI = (PopulationSeasonInfo)model.getSelectedItem(); @@ -198,10 +198,16 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -35,6 +35,11 @@ org.nuiton.math.matrix.gui.MatrixPanelListener; </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="recruitement" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { @@ -76,12 +81,6 @@ // TODO add only once //fieldPopulationRecruitmentDistribution.addMatrixListener(listener); }*/ - - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} ]]> </script> <JPanel id='body'> @@ -152,10 +151,16 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonSpacializedUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -26,9 +26,9 @@ <!-- bean property --> <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> - <Boolean id='popSeasonInfoNotNull' javaBean='false'/> <Boolean id='ageGroupType' javaBean='false'/> <import> @@ -55,11 +55,6 @@ //matrixPanelPopulationSeasonLengthChange.addMatrixListener(matrixPanelListener); }*/ - at Override -public void setActionButtons() { - -} - /** * Called on spacialized radio button change. */ @@ -117,7 +112,7 @@ <JRadioButton id="radioPopulationSeasonGroupChangeLengthNoSpacialized" buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" selected='{getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' - enabled='{isPopSeasonInfoNotNull()}' + enabled='{getPopulationSeasonInfo() != null}' text="isisfish.populationSeasons.noSpacialized" onActionPerformed='spacializedActionPerformed()' visible='{isAgeGroupType()}' decorator='boxed' /> </cell> @@ -125,24 +120,25 @@ <JRadioButton id="radioPopulationSeasonGroupChangeLengthSpacialized" buttonGroup="radioPopulationSeasonGroupChangeLengthSpacializedGroup" selected='{!getPopulationSeasonInfo().getSimpleLengthChangeMatrix()}' - enabled='{isPopSeasonInfoNotNull()}' + enabled='{getPopulationSeasonInfo() != null}' text="isisfish.populationSeasons.spacialized" onActionPerformed='spacializedActionPerformed()' visible='{isAgeGroupType()}' decorator='boxed' /> </cell> </row> <row> <cell> - <JLabel text="isisfish.populationSeasons.changeGroup" visible='{isAgeGroupType()}'/> + <JLabel text="isisfish.populationSeasons.changeGroup" visible='{isAgeGroupType()}' + enabled='{getPopulationSeasonInfo() != null}'/> </cell> <cell fill='horizontal' weightx='0.5'> <JButton text="isisfish.populationSeasons.computeCoefficient" decorator='boxed' visible='{isAgeGroupType()}' - enabled='{isPopSeasonInfoNotNull()}' onActionPerformed='computeMatrixChangeOfGroup()'/> + enabled='{getPopulationSeasonInfo() != null}' onActionPerformed='computeMatrixChangeOfGroup()'/> </cell> <cell fill='horizontal' weightx='0.5'> <JButton id="buttonPopulationSeasonGroupChangeLengthButtonShow" text="isisfish.populationSeasons.showSpacialized" - enabled='{radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected()}' decorator='boxed' + enabled='{radioPopulationSeasonGroupChangeLengthNoSpacialized.isSelected() && getPopulationSeasonInfo() != null}' onActionPerformed='showSpacializedMatrixChangeOfGroup()' - visible='{isAgeGroupType()}'/> + visible='{isAgeGroupType()}' decorator='boxed'/> </cell> </row> <row> @@ -151,7 +147,7 @@ </cell> <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> <org.nuiton.math.matrix.gui.MatrixPanelEditor id='matrixPanelPopulationSeasonLengthChange' - enabled='{isPopSeasonInfoNotNull()}' + enabled='{getPopulationSeasonInfo() != null}' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"LengthChangeMatrix"' visible='{isAgeGroupType()}' decorator='boxed' matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getLengthChangeMatrix().copy()}' Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationSeasonsUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -29,20 +29,24 @@ <fr.ifremer.isisfish.entities.PopulationSeasonInfo id='populationSeasonInfo' javaBean='null'/> - <Boolean id='popSeasonInfoNotNull' javaBean='false'/> - <import> - fr.ifremer.isisfish.entities.PopulationSeasonInfo; - fr.ifremer.isisfish.types.Month; - fr.ifremer.isisfish.entities.Population; - fr.ifremer.isisfish.ui.widget.Interval; - org.nuiton.math.matrix.MatrixND; - org.nuiton.math.matrix.gui.MatrixPanelEvent; - java.beans.PropertyChangeEvent; - java.beans.PropertyChangeListener; - org.nuiton.math.matrix.gui.MatrixPanelListener; + java.beans.PropertyChangeEvent + java.beans.PropertyChangeListener + fr.ifremer.isisfish.ui.input.population.PopulationSeasonInfoComboModel + fr.ifremer.isisfish.entities.PopulationSeasonInfo + fr.ifremer.isisfish.types.Month + fr.ifremer.isisfish.entities.Population + fr.ifremer.isisfish.ui.widget.Interval + org.nuiton.math.matrix.MatrixND + org.nuiton.math.matrix.gui.MatrixPanelEvent + org.nuiton.math.matrix.gui.MatrixPanelListener </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="seasons" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected Interval seasonInterval; @@ -84,33 +88,25 @@ } } }); - - create.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); - setPopulationSeasonInfo(seasonNew); - setPopulationSeasonInfoCombo(); - } - }); - - remove.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); - setPopulationSeasonInfoCombo(); - } - }); - - save.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - getSaveVerifier().topiaSave(); - setPopulationSeasonInfoCombo(); - } - }); } +protected void create() { + PopulationSeasonInfo seasonNew = getContextValue(InputAction.class).createPopulationSeasonInfo(getBean()); + setPopulationSeasonInfo(seasonNew); + setPopulationSeasonInfoCombo(); +} + +protected void delete() { + getContextValue(InputAction.class).removePopulationSeasonInfo(getBean(), getPopulationSeasonInfo()); + setPopulationSeasonInfo(null); + setPopulationSeasonInfoCombo(); +} + +protected void save() { + getSaveVerifier().save(); + setPopulationSeasonInfoCombo(); +} + protected void populationSeasonReproductionDistributionMatrixChanged(MatrixPanelEvent event) { if (getPopulationSeasonInfo() != null && fieldPopulationSeasonReproductionDistribution.getMatrix() != null) { MatrixND reproductionDistribution = fieldPopulationSeasonReproductionDistribution.getMatrix().copy(); @@ -122,10 +118,6 @@ } public void refresh() { - if (!isActive()) { - setPopSeasonInfoNotNull(false); - } - Population population = getSaveVerifier().getEntity(Population.class); // add null before, for second to be considered as a changed event @@ -133,6 +125,8 @@ //setBean(null); //setBean(population); + setPopulationSeasonInfo(null); + // Model instanciation seasonInterval = new Interval(); seasonInterval.setMin(0); @@ -148,23 +142,15 @@ //fieldPopulationSeasonReproductionDistribution.addMatrixListener(matrixPanelListener); - if(getPopulationSeasonInfo() != null) { + /*if(getPopulationSeasonInfo() != null) { PopulationSeasonInfo popInfo = getPopulationSeasonInfo(); setPopulationSeasonInfo(null); setPopulationSeasonInfo(popInfo); getSaveVerifier().addCurrentEntity(getPopulationSeasonInfo()); - } + }*/ //getSaveVerifier().addCurrentPanel(populationSeasonSpecializedUI); } - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save, false); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, PopulationSeasonInfo.class, false); - getSaveVerifier().setDeleteButton(remove, false); -} - protected void setSeasonInterval() { if(getPopulationSeasonInfo() != null) { try { @@ -202,8 +188,9 @@ protected void setPopulationSeasonInfoCombo() { if (getBean() != null) { - jaxx.runtime.SwingUtil.fillComboBox(fieldPopulationSeasonInfoChooser, - getBean().getPopulationSeasonInfo(), getPopulationSeasonInfo(), true); + PopulationSeasonInfoComboModel populationSeasonInfoModel = new PopulationSeasonInfoComboModel(getBean().getPopulationSeasonInfo()); + fieldPopulationSeasonInfoChooser.setModel(populationSeasonInfoModel); + populationSeasonInfoModel.setSelectedItem(getPopulationSeasonInfo()); } } @@ -220,10 +207,11 @@ log.debug("Season changed : " + seasonInfoSelected); } setPopulationSeasonInfo(seasonInfoSelected); - setPopSeasonInfoNotNull(getPopulationSeasonInfo() != null); + if (seasonInfoSelected != null) { + getSaveVerifier().addCurrentEntity(seasonInfoSelected); + } setSeasonInterval(); setReproductionDistributionMatrix(); - getSaveVerifier().addCurrentEntity(getPopulationSeasonInfo()); init = false; } @@ -261,16 +249,18 @@ <JLabel text="isisfish.populationSeasons.selectSeason" enabled='{isActive()}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <JAXXComboBox id="fieldPopulationSeasonInfoChooser" - onActionPerformed='seasonChanged()' enabled='{isActive()}'/> + <JComboBox id="fieldPopulationSeasonInfoChooser" + onItemStateChanged='seasonChanged()' enabled='{isActive()}' + renderer="{new fr.ifremer.isisfish.ui.input.population.PopulationSeasonInfoComboRenderer()}"/> </cell> </row> <row> <cell anchor='east'> - <JLabel text="isisfish.common.season" enabled='{isPopSeasonInfoNotNull()}'/> + <JLabel text="isisfish.common.season" enabled='{getPopulationSeasonInfo() != null}'/> </cell> <cell fill='horizontal' weightx='1.0'> - <fr.ifremer.isisfish.ui.widget.IntervalPanel id='seasonIntervalPanel' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> + <fr.ifremer.isisfish.ui.widget.IntervalPanel id='seasonIntervalPanel' + enabled='{getPopulationSeasonInfo() != null}' decorator='boxed'/> </cell> </row> <row> @@ -280,13 +270,13 @@ <cell fill='both' weightx='1.0'> <JCheckBox id="fieldPopulationSeasonGroupChange" text="isisfish.populationSeasons.changeGroup" selected='{getPopulationSeasonInfo().getGroupChange()}' decorator='boxed' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"GroupChange"' - onActionPerformed='seasonGroupChanged()' enabled='{isPopSeasonInfoNotNull()}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> + onActionPerformed='seasonGroupChanged()' enabled='{getPopulationSeasonInfo() != null}' visible='{isAgeGroupType(getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> </cell> </row> <row> <cell columns='2' fill='both' weightx='1.0' weighty='0.6'> <PopulationSeasonSpacializedUI id='populationSeasonSpecializedUI' constructorParams='this' bean='{getBean()}' - populationSeasonInfo='{getPopulationSeasonInfo()}' popSeasonInfoNotNull='{isPopSeasonInfoNotNull()}' + populationSeasonInfo='{getPopulationSeasonInfo()}' ageGroupType='{isAgeGroupType(!getPopulationSeasonInfo().getPopulation().getSpecies().getAgeGroupType())}'/> </cell> </row> @@ -297,18 +287,18 @@ <cell fill='horizontal' weightx='1.0'> <JCheckBox id="fieldPopulationSeasonReproduction" selected='{getPopulationSeasonInfo().getReproduction()}' onActionPerformed='getPopulationSeasonInfo().setReproduction(fieldPopulationSeasonReproduction.isSelected())' - text="isisfish.populationSeasons.Reproduction" enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> + text="isisfish.populationSeasons.Reproduction" enabled='{getPopulationSeasonInfo() != null}' decorator='boxed'/> </cell> </row> <row> <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{isPopSeasonInfoNotNull()}' + <JLabel text="isisfish.populationSeasons.distributionSpawning" enabled='{getPopulationSeasonInfo() != null}' visible='{getPopulationSeasonInfo().getReproduction()}'/> </cell> <cell fill='both' weightx='1.0' weighty='0.2'> <org.nuiton.math.matrix.gui.MatrixPanelEditor id='fieldPopulationSeasonReproductionDistribution' matrix='{getPopulationSeasonInfo() == null ? null : getPopulationSeasonInfo().getReproductionDistribution().copy()}' - enabled='{isPopSeasonInfoNotNull()}' + enabled='{getPopulationSeasonInfo() != null}' visible='{getPopulationSeasonInfo().getReproduction()}' decorator='boxed' _sensitivityBean='{PopulationSeasonInfo.class}' _sensitivityMethod='"ReproductionDistribution"' onMatrixChanged="populationSeasonReproductionDistributionMatrixChanged(event)" /> @@ -316,12 +306,14 @@ </row> <row> <cell anchor='east'> - <JLabel text="isisfish.populationSeasons.comments" enabled='{isPopSeasonInfoNotNull()}'/> + <JLabel text="isisfish.populationSeasons.comments" enabled='{getPopulationSeasonInfo() != null}'/> </cell> <cell fill='both' weightx='1.0' weighty='0.1'> <JScrollPane> <!-- jaxx.runtime.SwingUtil.getStringValue() comment can be null --> - <JTextArea id="fieldPopulationSeasonComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getSeasonsComment())}' onKeyReleased='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' enabled='{isPopSeasonInfoNotNull()}' decorator='boxed'/> + <JTextArea id="fieldPopulationSeasonComment" text='{jaxx.runtime.SwingUtil.getStringValue(getBean().getSeasonsComment())}' + onKeyReleased='getBean().setSeasonsComment(fieldPopulationSeasonComment.getText())' + enabled='{getPopulationSeasonInfo() != null}' decorator='boxed'/> </JScrollPane> </cell> </row> @@ -333,18 +325,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="create()"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{getPopulationSeasonInfo() != null}" + onActionPerformed="delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -49,12 +49,6 @@ }*/ @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(populationTab); -} - - at Override public void setLayer(boolean active) { populationBasicsUI.setLayer(active); populationZoneUI.setLayer(active); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesEditorUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -71,11 +71,6 @@ //fieldPopulationMappingZoneReproZoneRecru.addMatrixListener(listener); }*/ - at Override -public void setActionButtons() { - -} - protected void setFieldPopulationMappingZoneReproZoneRecru(){ if (getBean() != null){ if (getBean().getMappingZoneReproZoneRecru() != null){ Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PopulationZonesUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -27,6 +27,11 @@ <!-- bean property --> <fr.ifremer.isisfish.entities.Population id='bean' javaBean='null'/> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="zones" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Population' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ /*public void refresh() { Population population = getSaveVerifier().getEntity(Population.class); @@ -38,12 +43,6 @@ getSaveVerifier().addCurrentPanel(popZones); }*/ - - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} ]]> </script> <JPanel id='body'> @@ -57,10 +56,16 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/PortUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -40,6 +40,13 @@ java.beans.PropertyChangeListener </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Port' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldPortName" /> + <field name="cell" component="portCell" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected OMToolSet toolSet = new OMToolSet(); @@ -99,14 +106,6 @@ refreshRegionInMap(portMap); }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, Port.class); - getSaveVerifier().setDeleteButton(remove); -} - protected void fillList() { if (getBean() != null) { portChanged = false; @@ -162,18 +161,30 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Port.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/RangeOfValuesUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -78,11 +78,6 @@ } }*/ - at Override -public void setActionButtons() { - -} - protected void gearParamChanged() { if (fieldGearParamType.getSelectedItem() != null && !init) { getBean().setPossibleValue(new RangeOfValues(fieldGearParamType.getSelectedItem().toString().concat("[" + fieldGearParamPossibleValue.getText() + "]"))); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityEditorUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -93,11 +93,6 @@ removeSelectivityButton.setEnabled(false); } - at Override -public void setActionButtons() { - -} - protected void setSelectivityTableModel() { java.util.List<Selectivity> selectivitiesList = new ArrayList<Selectivity>(); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SelectivityUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -27,6 +27,11 @@ <!-- bean property --> <fr.ifremer.isisfish.entities.Gear id='bean' javaBean='null'/> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="selectivity" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Gear' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <import> fr.ifremer.isisfish.entities.Gear </import> @@ -44,12 +49,6 @@ }*/ @Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - - at Override public void setLayer(boolean active) { super.setLayer(active); editor.setLayer(active); @@ -65,10 +64,16 @@ </row> <row> <cell fill='horizontal' weightx='1.0'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsBasicsUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -38,6 +38,12 @@ java.beans.PropertyChangeListener </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="basics" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.SetOfVessels' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldSetOfVesselsName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ boolean init = false; @@ -78,14 +84,6 @@ } }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, SetOfVessels.class); - getSaveVerifier().setDeleteButton(remove); -} - protected void portChanged() { if (!init) { getBean().setPort((Port)fieldSetOfVesselsPort.getSelectedItem()); @@ -183,18 +181,30 @@ <Table> <row> <cell fill='horizontal' weightx='1.0'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='1.0'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(SetOfVessels.class)"/> </cell> <cell fill='horizontal' weightx='1.0'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SetOfVesselsUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -45,11 +45,6 @@ }*/ @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(setOfVesselsTab); -} - at Override public void setLayer(boolean active) { setOfVesselsBasicsUI.setLayer(active); effortDescriptionUI.setLayer(active); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesStructuredUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -28,11 +28,6 @@ <Boolean id='actif' javaBean='false'/> <script><![CDATA[ - @Override - public void setActionButtons() { - - } - protected void dynamicChanged() { if (getBean() != null) { getBean().setAgeGroupType(fieldSpeciesDynamicAge.isSelected()); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/SpeciesUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -35,6 +35,12 @@ java.beans.PropertyChangeListener; </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Species' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldSpeciesName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { setButtonTitle(_("isisfish.input.continuePopulations")); @@ -83,16 +89,7 @@ // Number Editor is not working //fieldSpeciesCEE.init(); } -}*/ - - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, Species.class); - getSaveVerifier().setDeleteButton(delete); -} - +}*/ ]]> </script> <JPanel id='body'> @@ -172,18 +169,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Species.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -33,6 +33,11 @@ static org.nuiton.i18n.I18n._ </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="month" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Strategy' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { @@ -56,12 +61,6 @@ }*/ @Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); -} - - at Override public void setLayer(boolean active) { strategyJanuary.setLayer(active); strategyFebuary.setLayer(active); @@ -137,10 +136,16 @@ <Table constraints='BorderLayout.SOUTH'> <row> <cell fill='horizontal' weightx='1'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='1'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -107,11 +107,6 @@ } } - at Override -public void setActionButtons() { - -} - protected void setProportionMetierMatrix() { if (getStrategyMonthInfo().getProportionMetier() != null) { fieldStrategyMonthInfoProportion.setMatrix(getStrategyMonthInfo().getProportionMetier().copy()); @@ -131,7 +126,7 @@ <row> <cell columns='2' fill='horizontal' weightx='1.0'> <JAXXComboBox id="fieldStrategyMonthInfoTripType" onActionPerformed='getStrategyMonthInfo().setTripType((TripType)fieldStrategyMonthInfoTripType.getSelectedItem())' - enabled='{isActive()}' decorator='boxed'/> + enabled='{isActive()}' decorator='boxed'/> </cell> </row> <row> @@ -140,7 +135,7 @@ </cell> <cell fill='horizontal' weightx='0.5' anchor='west'> <JLabel id='numberOfTrips' text='{String.valueOf(getStrategyMonthInfo().getNumberOfTrips())}' enabled='{isActive()}' - decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"NumberOfTrips"'/> + decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"NumberOfTrips"'/> </cell> </row> <row> @@ -153,16 +148,16 @@ enabled='{isActive()}' decorator='boxed' useSign='true' _sensitivityBean='{StrategyMonthInfoImpl.class}' _sensitivityMethod='"MinInactivityDays"'/--> <JTextField id="fieldStrategyMonthInfoMinInactivityDays" text='{String.valueOf(getStrategyMonthInfo().getMinInactivityDays())}' - onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"MinInactivityDays"'/> + onKeyReleased='getStrategyMonthInfo().setMinInactivityDays(Double.parseDouble(fieldStrategyMonthInfoMinInactivityDays.getText()))' + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"MinInactivityDays"'/> </cell> </row> <row> <cell columns='2' fill='both' weightx='1.0' weighty='1.0'> <org.nuiton.math.matrix.gui.MatrixPanelEditor id="fieldStrategyMonthInfoProportion" linearModelShowDefault='{true}' - linearModel='{true}' matrix='{getStrategyMonthInfo().getProportionMetier() == null ? null : getStrategyMonthInfo().getProportionMetier().copy()}' - onMatrixChanged="strategyMonthInfoProportionMatrixChanged(event)" - enabled='{isActive()}' decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"ProportionMetier"'/> + linearModel='{true}' matrix='{getStrategyMonthInfo().getProportionMetier() == null ? null : getStrategyMonthInfo().getProportionMetier().copy()}' + onMatrixChanged="strategyMonthInfoProportionMatrixChanged(event)" + enabled='{isActive()}' decorator='boxed' _sensitivityBean='{fr.ifremer.isisfish.entities.StrategyMonthInfoImpl.class}' _sensitivityMethod='"ProportionMetier"'/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyTabUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -38,6 +38,12 @@ java.beans.PropertyChangeListener </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' context="basics" + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Strategy' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldStrategyName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { @@ -81,14 +87,6 @@ } } - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, Strategy.class); - getSaveVerifier().setDeleteButton(remove); -} - protected void setSetOfVesselsModel() { ActionListener[] listeners = fieldStrategySetOfVessels.getActionListeners(); for (ActionListener listener : listeners) { @@ -178,18 +176,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Strategy.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/StrategyUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -38,12 +38,6 @@ }*/ @Override -public void setActionButtons() { - // active les bouton sur l'onglet courant - setCurrentTabActionButtons(strategyTab); -} - - at Override public void setLayer(boolean active) { strategyTabUI.setLayer(active); strategyMonthInfoUI.setLayer(active); Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/TripTypeUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -35,6 +35,12 @@ java.beans.PropertyChangeListener </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.TripType' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldTripTypeName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { setButtonTitle(_("isisfish.input.continueVesselTypes")); @@ -63,14 +69,6 @@ setBean(null); setBean(tripType); }*/ - - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, TripType.class); - getSaveVerifier().setDeleteButton(delete); -} ]]> </script> <JPanel id="body"> @@ -127,18 +125,30 @@ <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(TripType.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/VesselTypeUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -38,6 +38,12 @@ java.beans.PropertyChangeListener </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.VesselType' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldVesselTypeName" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected void $afterCompleteSetup() { setButtonTitle(_("isisfish.input.continueSetOfVessels")); @@ -45,7 +51,7 @@ addPropertyChangeListener(PROPERTY_BEAN, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { - if (evt.getOldValue() != null || evt.getNewValue() == null) { + if (evt.getNewValue() == null) { fieldVesselTypeName.setText(""); fieldVesselTypeLength.setText(""); fieldVesselTypeSpeed.setText(""); @@ -85,14 +91,6 @@ } }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, VesselType.class); - getSaveVerifier().setDeleteButton(delete); -} - protected void setListModel() { java.util.List<TripType> tripTypes = getFisheryRegion().getTripType(); TripTypeListModel tripTypeModel = new TripTypeListModel(tripTypes); @@ -232,22 +230,34 @@ </cell> </row> <row> - <cell fill='both' weightx='1.0'> + <cell fill='both' weightx='1.0'> <Table> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(VesselType.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='delete' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/ZoneUI.jaxx 2011-04-15 16:11:41 UTC (rev 3254) @@ -44,6 +44,13 @@ java.util.ArrayList </import> + <jaxx.runtime.validator.swing.SwingValidator id='validator' + bean='{getBean()}' beanClass='fr.ifremer.isisfish.entities.Zone' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="name" component="fieldZoneName" /> + <field name="cell" component="zoneCells" /> + </jaxx.runtime.validator.swing.SwingValidator> + <script><![CDATA[ protected OMToolSet toolSet = new OMToolSet(); @@ -94,14 +101,6 @@ refreshRegionInMap(zoneMap); }*/ - at Override -public void setActionButtons() { - getSaveVerifier().setSaveButton(save); - getSaveVerifier().setCancelButton(cancel); - getSaveVerifier().setNewButton(create, Zone.class); - getSaveVerifier().setDeleteButton(remove); -} - protected void setZoneCells(){ if (getBean() != null){ DefaultListModel model = new DefaultListModel(); @@ -182,18 +181,30 @@ </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='save' decorator='boxed'/> + <JButton id='save' decorator='boxed' + text="isisfish.common.save" + enabled="{validator.isValid() && validator.isChanged()}" + onActionPerformed="getSaveVerifier().save();validator.setChanged(false);"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='cancel' decorator='boxed'/> + <JButton id='cancel' decorator='boxed' + text="isisfish.common.cancel" + enabled="{validator.isChanged()}" + onActionPerformed="getSaveVerifier().cancel()"/> </cell> </row> <row> <cell fill='horizontal' weightx='0.5'> - <JButton id='create' decorator='boxed'/> + <JButton id='create' decorator='boxed' + text="isisfish.common.new" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().create(Zone.class)"/> </cell> <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' decorator='boxed'/> + <JButton id='delete' decorator='boxed' + text="isisfish.common.remove" + enabled="{!validator.isChanged()}" + onActionPerformed="getSaveVerifier().delete()"/> </cell> </row> </Table> Added: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeSelectionModel.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeSelectionModel.java (rev 0) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeSelectionModel.java 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,113 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Codelutin, Chatellier Eric + * %% + * 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, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package fr.ifremer.isisfish.ui.input.tree; + +import javax.swing.JOptionPane; +import javax.swing.tree.DefaultTreeSelectionModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import fr.ifremer.isisfish.ui.input.InputSaveVerifier; +import fr.ifremer.isisfish.ui.input.InputUI; + +/** + * Surcharge du model de selection de l'arbre de pecherie pour + * intersepter les changements de noeud dans le cas où l'utilisateur + * n'aurais pas sauvé une UI et eviter de boucler dans le cas d'une + * annulation. + */ +public class FisheryTreeSelectionModel extends DefaultTreeSelectionModel { + + /** serialVersionUID. */ + private static final long serialVersionUID = 2087232709918450858L; + + protected InputUI ui; + + public FisheryTreeSelectionModel(InputUI ui) { + this.ui = ui; + setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); + } + + @Override + public void setSelectionPath(TreePath path) { + if (willContinueSelection()) { + super.setSelectionPath(path); + } + } + + @Override + public void setSelectionPaths(TreePath[] pPaths) { + if (willContinueSelection()) { + super.setSelectionPaths(pPaths); + } + } + + @Override + public void addSelectionPath(TreePath path) { + if (willContinueSelection()) { + super.addSelectionPath(path); + } + } + + @Override + public void addSelectionPaths(TreePath[] paths) { + if (willContinueSelection()) { + super.addSelectionPaths(paths); + } + } + + @Override + public void removeSelectionPath(TreePath path) { + if (willContinueSelection()) { + super.removeSelectionPath(path); + } + } + + @Override + public void removeSelectionPaths(TreePath[] paths) { + if (willContinueSelection()) { + super.removeSelectionPaths(paths); + } + } + + @Override + public void clearSelection() { + if (willContinueSelection()) { + super.clearSelection(); + } + } + + protected boolean willContinueSelection() { + + boolean result = true; + + // check for non validated modification + InputSaveVerifier inputSaveVerifier = ui.getContextValue(InputSaveVerifier.class); + if (inputSaveVerifier.checkEdit() == JOptionPane.CANCEL_OPTION) { + result = false; + } + + return result; + } +} Property changes on: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/input/tree/FisheryTreeSelectionModel.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityInputHandler.java 2011-04-15 16:11:41 UTC (rev 3254) @@ -159,7 +159,7 @@ InputContentUI inputContentUI = getUIInstanceForBeanClass(internalClass, sensitivityTabUI); // mandatory set - inputContentUI.getSaveVerifier().reset(); // before set bean !!! + //inputContentUI.getSaveVerifier().reset(); // before set bean !!! if (topiaEntity != null) { inputContentUI.getSaveVerifier().addCurrentEntity(topiaEntity); inputContentUI.getSaveVerifier().setInputContentUI(inputContentUI); @@ -167,7 +167,6 @@ inputContentUI.setBean((TopiaEntityContextable)topiaEntity); inputContentUI.setActive(topiaEntity != null); - inputContentUI.setActionButtons(); inputContentUI.setLayer(true); // add initialized ui to panel Modified: isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java =================================================================== --- isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java 2011-04-15 16:09:00 UTC (rev 3253) +++ isis-fish/branches/3.3.1/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityTabbedPaneListener.java 2011-04-15 16:11:41 UTC (rev 3254) @@ -66,7 +66,6 @@ // refresh ui ui.setBean(null); ui.setBean(entity); - ui.setActionButtons(); cacheSelectedIndex = pane.getSelectedIndex(); pane.addChangeListener(this); Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Cell-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Cell-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Cell-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/FisheryRegion-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/FisheryRegion-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/FisheryRegion-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Gear-gear-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Gear-gear-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Gear-gear-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Metier-metier-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Metier-metier-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Metier-metier-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Population-basics-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Population-basics-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Population-basics-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="cell"> + <field-validator type="fieldexpression"> + <param name="expression"><![CDATA[ cell != null ]]></param> + <message>No port cell</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-warning-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-warning-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Port-warning-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/SetOfVessels-basics-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/SetOfVessels-basics-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/SetOfVessels-basics-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Species-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Species-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Species-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/TripType-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/TripType-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/TripType-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/VesselType-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/VesselType-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/VesselType-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-error-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-error-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-error-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="name"> + <field-validator type="requiredstring"> + <param name="trim">true</param> + <message>Missing name</message> + </field-validator> + </field> +</validators> Added: isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-warning-validation.xml =================================================================== --- isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-warning-validation.xml (rev 0) +++ isis-fish/branches/3.3.1/src/main/resources/fr/ifremer/isisfish/entities/Zone-warning-validation.xml 2011-04-15 16:11:41 UTC (rev 3254) @@ -0,0 +1,33 @@ +<!-- + #%L + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric + %% + 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, see + <http://www.gnu.org/licenses/gpl-2.0.html>. + #L% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +<validators> + <field name="cell"> + <field-validator type="fieldexpression"> + <param name="expression"><![CDATA[ !cell.empty ]]></param> + <message>Empty zones</message> + </field-validator> + </field> +</validators>
participants (1)
-
chatellier@users.labs.libre-entreprise.org