Author: tchemit Date: 2013-02-11 17:21:12 +0100 (Mon, 11 Feb 2013) New Revision: 394 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/394 Log: refs #1936: [CAPTURE] - Esp?\195?\168ce - pouvoir changer le nom d'une esp?\195?\168ce Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java 2013-02-11 15:57:22 UTC (rev 393) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java 2013-02-11 16:21:12 UTC (rev 394) @@ -26,6 +26,7 @@ import com.google.common.collect.Lists; import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -89,6 +90,12 @@ } @Override + protected void releaseAction(ActionEvent event) { + selectedSpecies = null; + super.releaseAction(event); + } + + @Override protected void doAction(ActionEvent event) { SpeciesBatchUIHandler handler = getHandler(); @@ -96,17 +103,14 @@ JXTable table = handler.getTable(); SpeciesBatchRowModel row = tableModel.getEntry(table.getSelectedRow()); - // TODO 20130206 kmorin uncomment the following lines when the service is available -// PersistenceService persistenceService = getContext().getService(PersistenceService.class); -// persistenceService.changeSpeciesBatchSpecies(row.getId(), selectedSpecies); + PersistenceService persistenceService = getService(PersistenceService.class); + persistenceService.changeSpeciesBatchSpecies(row.getId(), selectedSpecies); - Collection<Species> speciesUSed = handler.getModel().getSpeciesUsed() + Collection<Species> speciesUsed = getModel().getSpeciesUsed() .get(row.getSortedUnsortedCategoryValue()); - speciesUSed.remove(row.getSpecies()); + speciesUsed.remove(row.getSpecies()); changeChildrenSpecies(row, selectedSpecies); - speciesUSed.add(selectedSpecies); - - selectedSpecies = null; + speciesUsed.add(selectedSpecies); } protected void changeChildrenSpecies(SpeciesBatchRowModel row,