Author: kmorin Date: 2013-02-05 22:53:25 +0100 (Tue, 05 Feb 2013) New Revision: 341 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/341 Log: refs #1936 [CAPTURE] - Esp?\195?\168ce - pouvoir changer le nom d'une esp?\195?\168ce Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIModel.java Removed: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIModel.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/SpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 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-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java 2013-02-05 21:53:25 UTC (rev 341) @@ -24,6 +24,8 @@ * #L% */ +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import fr.ifremer.tutti.persistence.TuttiPersistence; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.PersistenceService; @@ -32,7 +34,11 @@ import org.apache.commons.logging.LogFactory; import java.awt.event.ActionEvent; +import java.util.HashSet; import java.util.List; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import org.jdesktop.swingx.JXTable; import static org.nuiton.i18n.I18n._; @@ -48,9 +54,9 @@ /** Logger. */ private static final Log log = LogFactory.getLog(RenameSpeciesBatchAction.class); + + protected Species selectedSpecies; - protected List<Species> allSpecies; - public RenameSpeciesBatchAction(SpeciesBatchUIHandler handler) { super(handler, "renameSpeciesBatch", @@ -59,17 +65,34 @@ _("tutti.action.renameSpeciesBatch.tip"), false ); + + } - TuttiPersistence persistenceService = - getContext().getService(PersistenceService.class); - allSpecies = persistenceService.getAllSpecies(); + @Override + protected boolean prepareAction(ActionEvent event) { + boolean result = super.prepareAction(event); + + SpeciesBatchUIHandler handler = getHandler(); + SpeciesBatchUIModel model = handler.getModel(); + List<Species> speciesList = Lists.newArrayList(model.getAllSpecies()); + speciesList.removeAll(Sets.newHashSet(model.getSpeciesUsed().values())); + + selectedSpecies = getHandler().openAddSpeciesDialog(_("tutti.title.selectSpecies"), speciesList); + + result &= selectedSpecies != null; + return result; } @Override protected void doAction(ActionEvent event) { SpeciesBatchUIHandler handler = getHandler(); - - // TODO + + SpeciesBatchTableModel tableModel = handler.getTableModel(); + JXTable table = handler.getTable(); + SpeciesBatchRowModel row = tableModel.getEntry(table.getSelectedRow()); + + PersistenceService persistenceService = getContext().getService(PersistenceService.class); + persistenceService.changeSpeciesBatchSpecies(row.getId(), selectedSpecies); } } Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.css (from rev 339, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.css 2013-02-05 21:53:25 UTC (rev 341) @@ -0,0 +1,31 @@ +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * 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 3 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-3.0.html>. + * #L% + */ +#speciesCombo { + showReset: true; + i18nPrefix: "tutti.property."; + bean: {model}; + property: selectedSpecies; + selectedItem: {model.getSelectedSpecies()}; + data: {model.getSpecies()}; +} \ No newline at end of file Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.jaxx (from rev 339, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUI.jaxx 2013-02-05 21:53:25 UTC (rev 341) @@ -0,0 +1,61 @@ +<!-- + #%L + Tutti :: UI + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 - 2013 Ifremer + %% + 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 3 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-3.0.html>. + #L% + --> +<JPanel layout='{new BorderLayout()}' id='selectSpeciesPopup' + implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectSpeciesUIModel, SelectSpeciesUIHandler>'> + + <import> + fr.ifremer.tutti.persistence.entities.referential.Species + fr.ifremer.tutti.ui.swing.TuttiUI + jaxx.runtime.swing.editor.bean.BeanComboBox + </import> + + <script><![CDATA[ + +public SelectSpeciesUI(TuttiUI parentUI) { + JAXXUtil.initContext(this, parentUI); + SelectSpeciesUIHandler handler = new SelectSpeciesUIHandler(parentUI, this); + setContextValue(handler); + handler.beforeInitUI(); +} + +protected void $afterCompleteSetup() { handler.afterInitUI(); } + ]]></script> + + <SelectSpeciesUIHandler id='handler' + initializer='getContextValue(SelectSpeciesUIHandler.class)'/> + + <SelectSpeciesUIModel id='model' + initializer='getContextValue(SelectSpeciesUIModel.class)'/> + + <BeanComboBox id='speciesCombo' constraints='BorderLayout.CENTER' + constructorParams='this' genericType='Species'/> + + <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> + <JButton id='cancelButton' text='tutti.action.cancel' + onActionPerformed='model.setSelectedSpecies(null); handler.closeDialog(this)'/> + <JButton id='validateButton' text='tutti.action.validate' + onActionPerformed='handler.closeDialog(this)'/> + </JPanel> + +</JPanel> \ No newline at end of file Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIHandler.java (from rev 339, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIHandler.java 2013-02-05 21:53:25 UTC (rev 341) @@ -0,0 +1,84 @@ + +package fr.ifremer.tutti.ui.swing.content.operation.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * 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 3 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-3.0.html>. + * #L% + */ + +import com.google.common.collect.Lists; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.TuttiUI; +import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.CreateSpeciesBatchUI; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since 1.0 + */ +public class SelectSpeciesUIHandler extends AbstractTuttiUIHandler<SelectSpeciesUIModel> { + + private static final Log log = LogFactory.getLog(SelectSpeciesUIHandler.class); + + protected SelectSpeciesUI ui; + + public SelectSpeciesUIHandler(TuttiUI parentUI, SelectSpeciesUI ui) { + super(parentUI.getHandler().getContext()); + this.ui = ui; + } + + @Override + public void beforeInitUI() { + SelectSpeciesUIModel model = new SelectSpeciesUIModel(); + ui.setContextValue(model); + } + + @Override + public void afterInitUI() { + initUI(ui); + + initBeanComboBox(ui.getSpeciesCombo(), + Lists.<Species>newArrayList(), + null); + } + + @Override + public void onCloseUI() { + if (log.isInfoEnabled()) { + log.info("Closing: " + ui); + } + } + + @Override + public SelectSpeciesUIModel getModel() { + return ui.getModel(); + } + + @Override + public SwingValidator<SelectSpeciesUIModel> getValidator() { + return null; + } + +} Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIModel.java (from rev 339, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIModel.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIModel.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SelectSpeciesUIModel.java 2013-02-05 21:53:25 UTC (rev 341) @@ -0,0 +1,72 @@ + +package fr.ifremer.tutti.ui.swing.content.operation.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * 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 3 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-3.0.html>. + * #L% + */ + +import com.google.common.collect.Lists; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; + +import java.util.List; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since 1.0 + */ +public class SelectSpeciesUIModel extends AbstractTuttiBeanUIModel<SelectSpeciesUIModel, SelectSpeciesUIModel> { + + public static final String PROPERTY_SPECIES = "species"; + + public static final String PROPERTY_SELECTED_SPECIES = "selectedSpecies"; + + protected List<Species> species = Lists.newArrayList(); + + protected Species selectedSpecies; + + public SelectSpeciesUIModel() { + super(SelectSpeciesUIModel.class, null, null); + } + + public List<Species> getSpecies() { + return species; + } + + public void setSpecies(List<Species> species) { + Object oldValue = getSpecies(); + this.species = Lists.newArrayList(species); + firePropertyChange(PROPERTY_SPECIES, oldValue, this.species); + } + + public Species getSelectedSpecies() { + return selectedSpecies; + } + + public void setSelectedSpecies(Species selectedSpecies) { + Object oldValue = getSelectedSpecies(); + this.selectedSpecies = selectedSpecies; + firePropertyChange(PROPERTY_SELECTED_SPECIES, oldValue, selectedSpecies); + } + +} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-02-05 21:53:25 UTC (rev 341) @@ -60,6 +60,7 @@ import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier; import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import jaxx.runtime.JAXXUtil; import jaxx.runtime.SwingUtil; import jaxx.runtime.context.JAXXContextEntryDef; @@ -1162,4 +1163,14 @@ model.setRootNumber(model.getRootNumber() + 1); } + public Species openAddSpeciesDialog(String title, List<Species> species) { + SelectSpeciesUI dialog = new SelectSpeciesUI(ui); + SelectSpeciesUIModel model = dialog.getModel(); + model.setSelectedSpecies(null); + model.setSpecies(species); + + openDialog(ui, dialog, title, new Dimension(400, 130)); + + return model.getSelectedSpecies(); + } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesAction.java 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesAction.java 2013-02-05 21:53:25 UTC (rev 341) @@ -53,6 +53,8 @@ private static final Log log = LogFactory.getLog(AddSpeciesAction.class); protected List<Species> allSpecies; + + protected Species selectedSpecies; public AddSpeciesAction(CreateSpeciesBatchUIHandler handler) { super(handler, @@ -68,30 +70,29 @@ } @Override - protected void doAction(ActionEvent event) { + protected boolean prepareAction(ActionEvent event) { + boolean result = super.prepareAction(event); CreateSpeciesBatchUIHandler handler = getHandler(); List<Species> availableSpecies = handler.getModel().getAvailableSpecies(); - final List<Species> species = Lists.newArrayList(allSpecies); + List<Species> species = Lists.newArrayList(allSpecies); species.removeAll(availableSpecies); + + selectedSpecies = getHandler().openAddSpeciesDialog(_("tutti.title.selectSpecies"), species); + + result &= selectedSpecies != null; + return result; + } - // open the popup asynchronously because the setVisible(true) method returns - // only after setVisible(false) has been called and this prevents the loading to hide. - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - Species selectedSpecies = getHandler().openAddSpeciesDialog(_("tutti.title.createBatch"), species); - if (species != null) { - CreateSpeciesBatchUIHandler handler = getHandler(); - CreateSpeciesBatchUIModel model = handler.getModel(); + @Override + protected void doAction(ActionEvent event) { + CreateSpeciesBatchUIHandler handler = getHandler(); + CreateSpeciesBatchUIModel model = handler.getModel(); - List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies()); - availableSpecies.add(selectedSpecies); - model.setAvailableSpecies(availableSpecies); - model.setSpecies(selectedSpecies); - } - } - }); + List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies()); + availableSpecies.add(selectedSpecies); + model.setAvailableSpecies(availableSpecies); + model.setSpecies(selectedSpecies); } } Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.css 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.css 2013-02-05 21:53:25 UTC (rev 341) @@ -1,31 +0,0 @@ -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 - 2013 Ifremer - * %% - * 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 3 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-3.0.html>. - * #L% - */ -#speciesCombo { - showReset: true; - i18nPrefix: "tutti.property."; - bean: {model}; - property: selectedSpecies; - selectedItem: {model.getSelectedSpecies()}; - data: {model.getSpecies()}; -} \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.jaxx 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUI.jaxx 2013-02-05 21:53:25 UTC (rev 341) @@ -1,60 +0,0 @@ -<!-- - #%L - Tutti :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2012 - 2013 Ifremer - %% - 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 3 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-3.0.html>. - #L% - --> -<JPanel layout='{new BorderLayout()}' id='addSpeciesPopup' - implements='fr.ifremer.tutti.ui.swing.TuttiUI<AddSpeciesUIModel, AddSpeciesUIHandler>'> - - <import> - fr.ifremer.tutti.persistence.entities.referential.Species - jaxx.runtime.swing.editor.bean.BeanComboBox - </import> - - <script><![CDATA[ - -public AddSpeciesUI(CreateSpeciesBatchUI parentUI) { - JAXXUtil.initContext(this, parentUI); - AddSpeciesUIHandler handler = new AddSpeciesUIHandler(parentUI, this); - setContextValue(handler); - handler.beforeInitUI(); -} - -protected void $afterCompleteSetup() { handler.afterInitUI(); } - ]]></script> - - <AddSpeciesUIHandler id='handler' - initializer='getContextValue(AddSpeciesUIHandler.class)'/> - - <AddSpeciesUIModel id='model' - initializer='getContextValue(AddSpeciesUIModel.class)'/> - - <BeanComboBox id='speciesCombo' constraints='BorderLayout.CENTER' - constructorParams='this' genericType='Species'/> - - <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> - <JButton id='cancelButton' text='tutti.action.cancel' - onActionPerformed='model.setSelectedSpecies(null); handler.closeDialog(this)'/> - <JButton id='validateButton' text='tutti.action.validate' - onActionPerformed='handler.closeDialog(this)'/> - </JPanel> - -</JPanel> \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIHandler.java 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIHandler.java 2013-02-05 21:53:25 UTC (rev 341) @@ -1,82 +0,0 @@ - -package fr.ifremer.tutti.ui.swing.content.operation.catches.species.split; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 - 2013 Ifremer - * %% - * 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 3 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-3.0.html>. - * #L% - */ - -import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.referential.Species; -import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; -import jaxx.runtime.validator.swing.SwingValidator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author kmorin <kmorin@codelutin.com> - * @since 1.0 - */ -public class AddSpeciesUIHandler extends AbstractTuttiUIHandler<AddSpeciesUIModel> { - - private static final Log log = LogFactory.getLog(AddSpeciesUIHandler.class); - - protected AddSpeciesUI ui; - - public AddSpeciesUIHandler(CreateSpeciesBatchUI parentUI, AddSpeciesUI ui) { - super(parentUI.getHandler().getContext()); - this.ui = ui; - } - - @Override - public void beforeInitUI() { - AddSpeciesUIModel model = new AddSpeciesUIModel(); - ui.setContextValue(model); - } - - @Override - public void afterInitUI() { - initUI(ui); - - initBeanComboBox(ui.getSpeciesCombo(), - Lists.<Species>newArrayList(), - null); - } - - @Override - public void onCloseUI() { - if (log.isInfoEnabled()) { - log.info("Closing: " + ui); - } - } - - @Override - public AddSpeciesUIModel getModel() { - return ui.getModel(); - } - - @Override - public SwingValidator<AddSpeciesUIModel> getValidator() { - return null; - } - -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIModel.java 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/AddSpeciesUIModel.java 2013-02-05 21:53:25 UTC (rev 341) @@ -1,72 +0,0 @@ - -package fr.ifremer.tutti.ui.swing.content.operation.catches.species.split; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 - 2013 Ifremer - * %% - * 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 3 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-3.0.html>. - * #L% - */ - -import com.google.common.collect.Lists; -import fr.ifremer.tutti.persistence.entities.referential.Species; -import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; - -import java.util.List; - -/** - * @author kmorin <kmorin@codelutin.com> - * @since 1.0 - */ -public class AddSpeciesUIModel extends AbstractTuttiBeanUIModel<AddSpeciesUIModel, AddSpeciesUIModel> { - - public static final String PROPERTY_SPECIES = "species"; - - public static final String PROPERTY_SELECTED_SPECIES = "selectedSpecies"; - - protected List<Species> species = Lists.newArrayList(); - - protected Species selectedSpecies; - - public AddSpeciesUIModel() { - super(AddSpeciesUIModel.class, null, null); - } - - public List<Species> getSpecies() { - return species; - } - - public void setSpecies(List<Species> species) { - Object oldValue = getSpecies(); - this.species = Lists.newArrayList(species); - firePropertyChange(PROPERTY_SPECIES, oldValue, this.species); - } - - public Species getSelectedSpecies() { - return selectedSpecies; - } - - public void setSelectedSpecies(Species selectedSpecies) { - Object oldValue = getSelectedSpecies(); - this.selectedSpecies = selectedSpecies; - firePropertyChange(PROPERTY_SELECTED_SPECIES, oldValue, selectedSpecies); - } - -} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java 2013-02-05 21:53:25 UTC (rev 341) @@ -24,6 +24,7 @@ * #L% */ +import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SelectSpeciesUIModel; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import fr.ifremer.tutti.persistence.TuttiPersistence; @@ -36,6 +37,7 @@ import fr.ifremer.tutti.ui.swing.TuttiUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; +import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SelectSpeciesUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel; import fr.ifremer.tutti.ui.swing.util.Cancelable; import jaxx.runtime.SwingUtil; @@ -255,8 +257,8 @@ } public Species openAddSpeciesDialog(String title, List<Species> species) { - AddSpeciesUI dialog = new AddSpeciesUI(ui); - AddSpeciesUIModel model = dialog.getModel(); + SelectSpeciesUI dialog = new SelectSpeciesUI(ui); + SelectSpeciesUIModel model = dialog.getModel(); model.setSelectedSpecies(null); model.setSpecies(species); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-02-05 21:53:25 UTC (rev 341) @@ -565,6 +565,7 @@ editor.stopCellEditing(); } previousCellAction.actionPerformed(null); + } else if (//e.getKeyCode() == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_RIGHT || keyCode == KeyEvent.VK_TAB) { @@ -573,12 +574,14 @@ editor.stopCellEditing(); } nextCellAction.actionPerformed(null); + } else if (keyCode == KeyEvent.VK_UP) { e.consume(); if (editor != null) { editor.stopCellEditing(); } previousRowAction.actionPerformed(null); + } else if (keyCode == KeyEvent.VK_DOWN) { e.consume(); if (editor != null) { Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties =================================================================== --- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-02-05 20:06:05 UTC (rev 340) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-02-05 21:53:25 UTC (rev 341) @@ -373,7 +373,6 @@ tutti.title.create.cruise=Créer une nouvelle campagne tutti.title.create.program=Créer une nouvelle série de campagne tutti.title.create.protocol=Créer un nouveau protocol de saisie -tutti.title.createBatch=Création d'un lot tutti.title.edit.cruise=Éditer une campagne existante tutti.title.edit.operations=Saisie des opérations de pêches (%s) tutti.title.edit.program=Éditer une série de campagne existante @@ -386,6 +385,7 @@ tutti.title.selectedCruise=Campagne %s tutti.title.selectedProgram=Série de campagne %s tutti.title.selectedProtocol=Protocole %s +tutti.title.selectSpecies=Choisissez une espèce tutti.title.splitBatch=Catégorisation du lot tutti.title.validate.operations=Validation des opérations de pêches (%s) tutti.to.be.done=< A FAIRE >