r991 - in trunk/tutti-ui-swing/src: license main/filtered-resources main/java/fr/ifremer/tutti/ui/swing/content/operation/catches main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/sp
Author: tchemit Date: 2013-05-23 13:28:29 +0200 (Thu, 23 May 2013) New Revision: 991 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/991 Log: fixes #2489: [IMPORT PUPITRI] lien ?\195?\160 mettre sur un autre onglet fix missing svn properties + license header Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java Removed: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java Modified: trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties Modified: trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties =================================================================== --- trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties 2013-05-23 11:28:29 UTC (rev 991) @@ -5,10 +5,13 @@ # - Affero General Public License (AGPL) # - Apache License # - BSD License +# - BSD-style license # - Common Development and Distribution License (CDDL) v1.0 # - Common Public License Version 1.0 # - Eclipse Public License - v 1.0 +# - GNU Affero General Public License v3 # - GNU General Public License - Version 2 with the class path exception +# - GNU Lesser General Public License (LGPL), version 2.1 # - GNU Library or Lesser General Public License # - General Public License (GPL) # - HSQLDB License @@ -25,11 +28,12 @@ # Please fill the missing licenses for dependencies : # # -#Tue Apr 16 20:56:57 CEST 2013 +#Thu May 23 12:15:03 CEST 2013 antlr--antlr--2.7.6=BSD License commons-codec--commons-codec--1.2=The Apache Software License, Version 2.0 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 dom4j--dom4j--1.6.1=BSD License +javax.persistence--persistence-api--1.0.2=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 javax.transaction--jta--1.1=Common Development and Distribution License (CDDL) v1.0 org.andromda--andromda-core--3.3.1=BSD License org.andromda--andromda-utils--3.3.1=BSD License Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties =================================================================== --- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-05-23 11:28:29 UTC (rev 991) @@ -91,7 +91,7 @@ tutti.editBenthosFrequencies.help=editBenthosFrequencies.html tutti.editCatchBatch.action.cancelEditCatchBatch.help=editCatchBatch.html\#actions tutti.editCatchBatch.action.computeWeights.help=editCatchBatch.html\#actions -tutti.editCatchBatch.action.importPupitri.help=editCatchBatch.html\#actions +tutti.editSpeciesBatch.action.importPupitri.help=editSpeciesBatch.html\#actions tutti.editCatchBatch.action.saveCatchBatch.help=editCatchBatch.html\#actions tutti.editCatchBatch.field.benthosTotalSampleSortedWeight.help=editCatchBatch.html\#fields tutti.editCatchBatch.field.benthosTotalSortedWeight.help=editCatchBatch.html\#fields Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties =================================================================== --- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-05-23 11:28:29 UTC (rev 991) @@ -91,7 +91,7 @@ tutti.editBenthosFrequencies.help=editBenthosFrequencies.html tutti.editCatchBatch.action.cancelEditCatchBatch.help=editCatchBatch.html\#actions tutti.editCatchBatch.action.computeWeights.help=editCatchBatch.html\#actions -tutti.editCatchBatch.action.importPupitri.help=editCatchBatch.html\#actions +tutti.editSpeciesBatch.action.importPupitri.help=editSpeciesBatch.html\#actions tutti.editCatchBatch.action.saveCatchBatch.help=editCatchBatch.html\#actions tutti.editCatchBatch.field.benthosTotalSampleSortedWeight.help=editCatchBatch.html\#fields tutti.editCatchBatch.field.benthosTotalSortedWeight.help=editCatchBatch.html\#fields Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches; +/* + * #%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 fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.service.DecoratorService; import fr.ifremer.tutti.service.catches.multipost.TuttiMultiPostImportExportService; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches; +/* + * #%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 fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.service.DecoratorService; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-05-23 11:28:29 UTC (rev 991) @@ -316,15 +316,6 @@ border: {BorderFactory.createTitledBorder(_("tutti.editCatchBatch.legend.individualObservation"))}; } -#importPupitriButton { - actionIcon: pupitri-import; - text: "tutti.editCatchBatch.action.importPupitri"; - toolTipText: "tutti.editCatchBatch.action.importPupitri.tip"; - i18nMnemonic: "tutti.editCatchBatch.action.importPupitri.mnemonic"; - _tuttiAction: {ImportPupitriAction.class}; - _help: {"tutti.editCatchBatch.action.importPupitri.help"}; -} - #saveButton { actionIcon: save; text: "tutti.editCatchBatch.action.saveCatchBatch"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-05-23 11:28:29 UTC (rev 991) @@ -112,7 +112,6 @@ <TuttiHelpBroker id='broker' constructorParams='"tutti.editCatchBatch.help"'/> <JToolBar id='catchesCaracteristicsTabToolBar'> - <JButton id='importPupitriButton'/> <ButtonAttachment id='catchesCaracteristicsAttachmentsButton' constructorParams='getHandler().getContext(), getModel()'/> </JToolBar> Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,143 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.operation.catches; - -/* - * #%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 fr.ifremer.tutti.persistence.entities.data.CatchBatch; -import fr.ifremer.tutti.persistence.entities.data.FishingOperation; -import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.service.pupitri.TuttiPupitriImportExportService; -import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationAction; -import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel; -import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler; -import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction; -import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JOptionPane; -import java.io.File; - -import static org.nuiton.i18n.I18n._; - -/** - * @author tchemit <chemit@codelutin.com> - * @since 1.0 - */ -public class ImportPupitriAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> { - - private Log log = LogFactory.getLog(ImportPupitriAction.class); - - protected File importedTrunkFile; - - protected File importedCarrouselFile; - - protected ImportPupitriPopupUI importPupitriDialog; - - protected TuttiProtocol currentProtocol; - - protected PersistenceService persistenceService; - - protected EditFishingOperationAction editAction; - - public ImportPupitriAction(EditCatchesUIHandler handler) { - super(handler, false); - persistenceService = getContext().getPersistenceService(); - importPupitriDialog = new ImportPupitriPopupUI(handler.getContext()); - } - - public EditFishingOperationAction getEditAction() { - if (editAction == null) { - editAction = TuttiActionHelper.createLogicAction(getHandler().getParentHandler(), - EditFishingOperationAction.class); - } - return editAction; - } - - @Override - protected boolean prepareAction() throws Exception { - boolean result = true; - currentProtocol = getDataContext().getProtocol(); - - SpeciesBatchUIModel speciesBatchUIModel = getUI().getSpeciesTabContent().getModel(); - if (speciesBatchUIModel.getRowCount() > 0) { - String htmlMessage = String.format( - AbstractTuttiUIHandler.CONFIRMATION_FORMAT, - _("tutti.editCatchBatch.action.importPupitri.existingData.message"), - _("tutti.editCatchBatch.action.importPupitri.existingData.help")); - - int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(), - htmlMessage, - _("tutti.editCatchBatch.action.importPupitri.existingData.title"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.WARNING_MESSAGE); - - result = answer == JOptionPane.OK_OPTION; - } - - if (result) { - importPupitriDialog.open(); - importedTrunkFile = importPupitriDialog.getTrunkFile().getSelectedFile(); - importedCarrouselFile = importPupitriDialog.getCarrouselFile().getSelectedFile(); - result = importedTrunkFile != null - && importedCarrouselFile != null; - } - - return result; - } - - @Override - protected void doAction() throws Exception { - TuttiPupitriImportExportService pupitriImportExportService = - getContext().getTuttiPupitriImportExportService(); - - EditCatchesUIModel model = getModel(); - - FishingOperation operation = model.getFishingOperation(); - CatchBatch catchBatch = model.getCatchBatch(); - - // import - int rejectedSpeciesNb = - pupitriImportExportService.importPupitri(importedTrunkFile, - importedCarrouselFile, - operation, - catchBatch); - - String fishingOperationText = getEditAction().getFishingOperationTitle(operation); - - getEditAction().loadCatchBatch(operation, fishingOperationText, true); - - sendMessage(_("tutti.editCatchBatch.action.importPupitri.success", getUI().getSpeciesTabContent().getModel().getRootNumber(), rejectedSpeciesNb)); - } - - @Override - protected void releaseAction() { - super.releaseAction(); - importedTrunkFile = null; - importedCarrouselFile = null; - currentProtocol = null; - } - -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css 2013-05-23 11:28:29 UTC (rev 991) @@ -1,67 +0,0 @@ -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 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% -*/ - -#importPupitriDialog { - modal: true; - title: "tutti.importPupitri.title"; -} - -#trunkFileLabel { - text: "tutti.importPupitri.field.trunkFile"; - labelFor: {trunkFile}; -} - -#trunkFile { - directoryEnabled: false; - exts: {_("tutti.importPupitri.trunkFile.extension")}; - extsDescription: {_("tutti.importPupitri.trunkFile.extension.description")}; - acceptAllFileFilterUsed: false; -} - -#carrouselFileLabel { - text: "tutti.importPupitri.field.carrouselFile"; - labelFor: {carrouselFile}; -} - -#carrouselFile { - directoryEnabled: false; - exts: {_("tutti.importPupitri.carrouselFile.extension")}; - extsDescription: {_("tutti.importPupitri.carrouselFile.extension.description")}; - acceptAllFileFilterUsed: false; -} - -#cancelButton { - actionIcon: cancel; - text: "tutti.common.cancel"; - toolTipText: "tutti.common.cancel"; - i18nMnemonic: "tutti.common.cancel.mnemonic"; -} - -#validateButton { - actionIcon: add; - text: "tutti.common.validate"; - toolTipText: "tutti.common.validate"; - i18nMnemonic: "tutti.common.validate.mnemonic"; -} - Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx 2013-05-23 11:28:29 UTC (rev 991) @@ -1,94 +0,0 @@ -<!-- - #%L - Tutti :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2012 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% - --> -<JDialog id='importPupitriDialog' layout='{new BorderLayout()}'> - - <import> - fr.ifremer.tutti.ui.swing.TuttiUIContext - - jaxx.runtime.swing.editor.FileEditor - org.jdesktop.swingx.JXTitledPanel - javax.swing.JComponent - </import> - - <script><![CDATA[ - -public ImportPupitriPopupUI(TuttiUIContext context) { - super(context.getMainUI()); - setContextValue(context); - ImportPupitriPopupUIHandler handler = new ImportPupitriPopupUIHandler(context, this); - setContextValue(handler); - handler.beforeInitUI(); -} - -protected void $afterCompleteSetup() { - getHandler().afterInitUI(); -} - -public void open() { - handler.open(); -} - ]]></script> - - <!-- if true, display the form to add attachments - and the button to remove existing attachments --> - <Boolean id='editable' javaBean='true'/> - - <!-- bean property --> - <!--<AttachmentModelAware id='bean' javaBean='null'/>--> - - <ImportPupitriPopupUIHandler id='handler' - initializer='getContextValue(ImportPupitriPopupUIHandler.class)'/> - - <Table id='mainPanel' fill='both'> - - <row> - <cell> - <JLabel id='trunkFileLabel'/> - </cell> - <cell weightx='1'> - <FileEditor id='trunkFile'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='carrouselFileLabel'/> - </cell> - <cell weightx='1'> - <FileEditor id='carrouselFile'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='validateButton' onActionPerformed='handler.validate()'/> - </JPanel> - </cell> - </row> - - </Table> - -</JDialog> \ No newline at end of file Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,96 +0,0 @@ -package fr.ifremer.tutti.ui.swing.content.operation.catches; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 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 fr.ifremer.tutti.ui.swing.TuttiUIContext; -import jaxx.runtime.SwingUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JOptionPane; - -import static org.nuiton.i18n.I18n._; - -/** - * @author kmorin <morin@codelutin.com> - * @author tchemit <chemit@codelutin.com> - * @since 0.2 - */ -public class ImportPupitriPopupUIHandler { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(ImportPupitriPopupUIHandler.class); - - protected final ImportPupitriPopupUI ui; - - protected final TuttiUIContext context; - - public ImportPupitriPopupUIHandler(TuttiUIContext context, - ImportPupitriPopupUI ui) { - this.context = context; - this.ui = ui; - } - - protected void beforeInitUI() { - } - - protected void afterInitUI() { - ui.getTrunkFile().setDialogOwner(ui); - ui.getCarrouselFile().setDialogOwner(ui); - ui.pack(); - ui.setResizable(true); - } - - protected void resetFields() { - ui.getTrunkFile().setSelectedFile((String) null); - ui.getCarrouselFile().setSelectedFile((String) null); - } - - public void open() { - resetFields(); - SwingUtil.center(context.getMainUI(), ui); - ui.setVisible(true); - } - - public void cancel() { - resetFields(); - ui.dispose(); - } - - public void validate() { - if (ui.getTrunkFile().getSelectedFile() != null - && ui.getCarrouselFile().getSelectedFile() != null) { - ui.dispose(); - - } else { - JOptionPane.showMessageDialog(ui, - _("tutti.importPupitri.error.fileMissing.message"), - _("tutti.importPupitri.error.fileMissing.title"), - JOptionPane.ERROR_MESSAGE); - } - } - -} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.css 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.css 2013-05-23 11:28:29 UTC (rev 991) @@ -1,3 +1,26 @@ +/* + * #%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% + */ #importMultiPostLogDialog { title: "tutti.multiPostImportLog.title"; modal: true; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.jaxx 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/MultiPostImportLogDialog.jaxx 2013-05-23 11:28:29 UTC (rev 991) @@ -1,3 +1,26 @@ +<!-- + #%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% + --> <JDialog id='importMultiPostLogDialog' layout='{new BorderLayout()}'> <JTextArea id="message" constraints='BorderLayout.NORTH'/> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental; +/* + * #%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 fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction; import static org.nuiton.i18n.I18n._; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental; +/* + * #%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 fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractImportMultiPostAction; import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUI; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos; +/* + * #%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 fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.service.DecoratorService; import fr.ifremer.tutti.service.catches.multipost.TuttiMultiPostImportExportService; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos; +/* + * #%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 fr.ifremer.tutti.persistence.entities.data.BenthosBatch; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation; +/* + * #%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 fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction; import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIHandler; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation; +/* + * #%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 fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch; import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractImportMultiPostAction; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter; +/* + * #%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 fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter; +/* + * #%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 fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java (from rev 984, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java 2013-05-23 11:28:29 UTC (rev 991) @@ -0,0 +1,140 @@ +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 fr.ifremer.tutti.persistence.entities.data.CatchBatch; +import fr.ifremer.tutti.persistence.entities.data.FishingOperation; +import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; +import fr.ifremer.tutti.service.PersistenceService; +import fr.ifremer.tutti.service.pupitri.TuttiPupitriImportExportService; +import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationAction; +import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel; +import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler; +import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper; + +import javax.swing.JOptionPane; +import java.io.File; + +import static org.nuiton.i18n.I18n._; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class ImportPupitriAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> { + + protected File importedTrunkFile; + + protected File importedCarrouselFile; + + protected ImportPupitriPopupUI importPupitriDialog; + + protected TuttiProtocol currentProtocol; + + protected PersistenceService persistenceService; + + protected EditFishingOperationAction editAction; + + public ImportPupitriAction(SpeciesBatchUIHandler handler) { + super(handler, false); + persistenceService = getContext().getPersistenceService(); + importPupitriDialog = new ImportPupitriPopupUI(handler.getContext()); + } + + public EditFishingOperationAction getEditAction() { + if (editAction == null) { + editAction = TuttiActionHelper.createLogicAction(getHandler().getParentUi().getHandler(), + EditFishingOperationAction.class); + } + return editAction; + } + + @Override + protected boolean prepareAction() throws Exception { + boolean result = true; + currentProtocol = getDataContext().getProtocol(); + + SpeciesBatchUIModel speciesBatchUIModel = getUI().getModel(); + if (speciesBatchUIModel.getRowCount() > 0) { + String htmlMessage = String.format( + AbstractTuttiUIHandler.CONFIRMATION_FORMAT, + _("tutti.editSpeciesBatch.action.importPupitri.existingData.message"), + _("tutti.editSpeciesBatch.action.importPupitri.existingData.help")); + + int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(), + htmlMessage, + _("tutti.editSpeciesBatch.action.importPupitri.existingData.title"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE); + + result = answer == JOptionPane.OK_OPTION; + } + + if (result) { + importPupitriDialog.open(); + importedTrunkFile = importPupitriDialog.getTrunkFile().getSelectedFile(); + importedCarrouselFile = importPupitriDialog.getCarrouselFile().getSelectedFile(); + result = importedTrunkFile != null + && importedCarrouselFile != null; + } + + return result; + } + + @Override + protected void doAction() throws Exception { + TuttiPupitriImportExportService pupitriImportExportService = + getContext().getTuttiPupitriImportExportService(); + + EditCatchesUIModel model = getUI().getHandler().getParentUi().getModel(); + + FishingOperation operation = model.getFishingOperation(); + CatchBatch catchBatch = model.getCatchBatch(); + + // import + int rejectedSpeciesNb = + pupitriImportExportService.importPupitri(importedTrunkFile, + importedCarrouselFile, + operation, + catchBatch); + + String fishingOperationText = getEditAction().getFishingOperationTitle(operation); + + getEditAction().loadCatchBatch(operation, fishingOperationText, true); + + sendMessage(_("tutti.editSpeciesBatch.action.importPupitri.success", + getModel().getRootNumber(), rejectedSpeciesNb)); + } + + @Override + protected void releaseAction() { + super.releaseAction(); + importedTrunkFile = null; + importedCarrouselFile = null; + currentProtocol = null; + } + +} Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.css (from rev 984, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.css 2013-05-23 11:28:29 UTC (rev 991) @@ -0,0 +1,67 @@ +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 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% +*/ + +#importPupitriDialog { + modal: true; + title: "tutti.importPupitri.title"; +} + +#trunkFileLabel { + text: "tutti.importPupitri.field.trunkFile"; + labelFor: {trunkFile}; +} + +#trunkFile { + directoryEnabled: false; + exts: {_("tutti.importPupitri.trunkFile.extension")}; + extsDescription: {_("tutti.importPupitri.trunkFile.extension.description")}; + acceptAllFileFilterUsed: false; +} + +#carrouselFileLabel { + text: "tutti.importPupitri.field.carrouselFile"; + labelFor: {carrouselFile}; +} + +#carrouselFile { + directoryEnabled: false; + exts: {_("tutti.importPupitri.carrouselFile.extension")}; + extsDescription: {_("tutti.importPupitri.carrouselFile.extension.description")}; + acceptAllFileFilterUsed: false; +} + +#cancelButton { + actionIcon: cancel; + text: "tutti.common.cancel"; + toolTipText: "tutti.common.cancel"; + i18nMnemonic: "tutti.common.cancel.mnemonic"; +} + +#validateButton { + actionIcon: add; + text: "tutti.common.validate"; + toolTipText: "tutti.common.validate"; + i18nMnemonic: "tutti.common.validate.mnemonic"; +} + Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.jaxx (from rev 984, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUI.jaxx 2013-05-23 11:28:29 UTC (rev 991) @@ -0,0 +1,94 @@ +<!-- + #%L + Tutti :: UI + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 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% + --> +<JDialog id='importPupitriDialog' layout='{new BorderLayout()}'> + + <import> + fr.ifremer.tutti.ui.swing.TuttiUIContext + + jaxx.runtime.swing.editor.FileEditor + org.jdesktop.swingx.JXTitledPanel + javax.swing.JComponent + </import> + + <script><![CDATA[ + +public ImportPupitriPopupUI(TuttiUIContext context) { + super(context.getMainUI()); + setContextValue(context); + ImportPupitriPopupUIHandler handler = new ImportPupitriPopupUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); +} + +protected void $afterCompleteSetup() { + getHandler().afterInitUI(); +} + +public void open() { + handler.open(); +} + ]]></script> + + <!-- if true, display the form to add attachments + and the button to remove existing attachments --> + <Boolean id='editable' javaBean='true'/> + + <!-- bean property --> + <!--<AttachmentModelAware id='bean' javaBean='null'/>--> + + <ImportPupitriPopupUIHandler id='handler' + initializer='getContextValue(ImportPupitriPopupUIHandler.class)'/> + + <Table id='mainPanel' fill='both'> + + <row> + <cell> + <JLabel id='trunkFileLabel'/> + </cell> + <cell weightx='1'> + <FileEditor id='trunkFile'/> + </cell> + </row> + + <row> + <cell> + <JLabel id='carrouselFileLabel'/> + </cell> + <cell weightx='1'> + <FileEditor id='carrouselFile'/> + </cell> + </row> + + <row> + <cell columns='2'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> + <JButton id='validateButton' onActionPerformed='handler.validate()'/> + </JPanel> + </cell> + </row> + + </Table> + +</JDialog> \ No newline at end of file Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java (from rev 984, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java 2013-05-23 11:28:29 UTC (rev 991) @@ -0,0 +1,96 @@ +package fr.ifremer.tutti.ui.swing.content.operation.catches.species; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 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 fr.ifremer.tutti.ui.swing.TuttiUIContext; +import jaxx.runtime.SwingUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.JOptionPane; + +import static org.nuiton.i18n.I18n._; + +/** + * @author kmorin <morin@codelutin.com> + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class ImportPupitriPopupUIHandler { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(ImportPupitriPopupUIHandler.class); + + protected final ImportPupitriPopupUI ui; + + protected final TuttiUIContext context; + + public ImportPupitriPopupUIHandler(TuttiUIContext context, + ImportPupitriPopupUI ui) { + this.context = context; + this.ui = ui; + } + + protected void beforeInitUI() { + } + + protected void afterInitUI() { + ui.getTrunkFile().setDialogOwner(ui); + ui.getCarrouselFile().setDialogOwner(ui); + ui.pack(); + ui.setResizable(true); + } + + protected void resetFields() { + ui.getTrunkFile().setSelectedFile((String) null); + ui.getCarrouselFile().setSelectedFile((String) null); + } + + public void open() { + resetFields(); + SwingUtil.center(context.getMainUI(), ui); + ui.setVisible(true); + } + + public void cancel() { + resetFields(); + ui.dispose(); + } + + public void validate() { + if (ui.getTrunkFile().getSelectedFile() != null + && ui.getCarrouselFile().getSelectedFile() != null) { + ui.dispose(); + + } else { + JOptionPane.showMessageDialog(ui, + _("tutti.importPupitri.error.fileMissing.message"), + _("tutti.importPupitri.error.fileMissing.title"), + JOptionPane.ERROR_MESSAGE); + } + } + +} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-05-23 11:28:29 UTC (rev 991) @@ -52,6 +52,15 @@ borderPainted: false; } +#importPupitriButton { + actionIcon: pupitri-import; + text: "tutti.editSpeciesBatch.action.importPupitri"; + toolTipText: "tutti.editSpeciesBatch.action.importPupitri.tip"; + i18nMnemonic: "tutti.editSpeciesBatch.action.importPupitri.mnemonic"; + _tuttiAction: {ImportPupitriAction.class}; + _help: {"tutti.editSpeciesBatch.action.importPupitri.help"}; +} + #importMultiPostButton { actionIcon: import; text: "tutti.editSpeciesBatch.action.importMultiPost"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-05-23 11:28:29 UTC (rev 991) @@ -27,6 +27,7 @@ <import> fr.ifremer.tutti.ui.swing.TuttiHelpBroker + fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode fr.ifremer.tutti.ui.swing.util.TuttiUI fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor @@ -43,7 +44,7 @@ <script><![CDATA[ -public SpeciesBatchUI(TuttiUI<?,?> parentUI) { +public SpeciesBatchUI(EditCatchesUI parentUI) { JAXXUtil.initContext(this, parentUI); SpeciesBatchUIHandler handler = new SpeciesBatchUIHandler(parentUI, this); setContextValue(handler); @@ -69,6 +70,7 @@ constructorParams='"tutti.editSpeciesBatch.help"'/> <JToolBar id='speciesBatchTabToolBar'> + <JButton id='importPupitriButton'/> <JButton id='importMultiPostButton'/> <JButton id='exportMultiPostButton'/> </JToolBar> 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-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-05-23 11:28:29 UTC (rev 991) @@ -54,7 +54,6 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchRowModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchUI; import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor; -import fr.ifremer.tutti.ui.swing.util.TuttiUI; import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentCellEditor; import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentCellRenderer; @@ -134,7 +133,9 @@ protected ValidationService validationService = getContext().getValidationService(); - public SpeciesBatchUIHandler(TuttiUI<?, ?> parentUi, + protected final EditCatchesUI parentUi; + + public SpeciesBatchUIHandler(EditCatchesUI parentUi, SpeciesBatchUI ui) { super(parentUi, ui, SpeciesBatchRowModel.PROPERTY_SPECIES, @@ -154,6 +155,7 @@ SpeciesBatchRowModel.PROPERTY_ATTACHMENT, SpeciesBatchRowModel.PROPERTY_FREQUENCY, SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM); + this.parentUi = parentUi; tableFilters = new EnumMap<TableViewMode, RowFilter<SpeciesBatchTableModel, Integer>>(TableViewMode.class); tableFilters.put(TableViewMode.ALL, new RowFilter<SpeciesBatchTableModel, Integer>() { @@ -192,6 +194,10 @@ }); } + public EditCatchesUI getParentUi() { + return parentUi; + } + //------------------------------------------------------------------------// //-- AbstractTuttiBatchTableUIHandler methods --// //------------------------------------------------------------------------// Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties =================================================================== --- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-05-23 11:28:29 UTC (rev 991) @@ -434,15 +434,6 @@ tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message= tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.title= tutti.editCatchBatch.action.computeWeights.tip= -tutti.editCatchBatch.action.importPupitri= -tutti.editCatchBatch.action.importPupitri.existingData.help= -tutti.editCatchBatch.action.importPupitri.existingData.message= -tutti.editCatchBatch.action.importPupitri.existingData.title= -tutti.editCatchBatch.action.importPupitri.mnemonic= -tutti.editCatchBatch.action.importPupitri.noProtocol.message= -tutti.editCatchBatch.action.importPupitri.noProtocol.title= -tutti.editCatchBatch.action.importPupitri.success= -tutti.editCatchBatch.action.importPupitri.tip= tutti.editCatchBatch.action.saveCatchBatch= tutti.editCatchBatch.action.saveCatchBatch.mnemonic= tutti.editCatchBatch.action.saveCatchBatch.tip= @@ -860,6 +851,15 @@ tutti.editSpeciesBatch.action.importMultiPost.sourceFile.title= tutti.editSpeciesBatch.action.importMultiPost.success= tutti.editSpeciesBatch.action.importMultiPost.tip= +tutti.editSpeciesBatch.action.importPupitri= +tutti.editSpeciesBatch.action.importPupitri.existingData.help= +tutti.editSpeciesBatch.action.importPupitri.existingData.message= +tutti.editSpeciesBatch.action.importPupitri.existingData.title= +tutti.editSpeciesBatch.action.importPupitri.mnemonic= +tutti.editSpeciesBatch.action.importPupitri.noProtocol.message= +tutti.editSpeciesBatch.action.importPupitri.noProtocol.title= +tutti.editSpeciesBatch.action.importPupitri.success= +tutti.editSpeciesBatch.action.importPupitri.tip= tutti.editSpeciesBatch.action.removeBatch= tutti.editSpeciesBatch.action.removeBatch.confirm.message= tutti.editSpeciesBatch.action.removeBatch.confirm.title= 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-05-23 10:17:31 UTC (rev 990) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-05-23 11:28:29 UTC (rev 991) @@ -421,13 +421,6 @@ tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message=Le Poids total VRAC saisi est supérieur de moins de %s%% au Poids total Vrac trié. tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.title=Poids total VRAC peu différent du Poids total Vrac trié tutti.editCatchBatch.action.computeWeights.tip=Élever les poids -tutti.editCatchBatch.action.importPupitri=Import Pupitri -tutti.editCatchBatch.action.importPupitri.existingData.help=Que voulez-vous faire ?<ul><li><strong>Annuler</strong> pour ne pas importer les données Pupitri et conserver les espèces saisies</li><li><strong>OK</strong> pour supprimer les espèces existantes et les remplacer par les données de Pupitri</li></ul> -tutti.editCatchBatch.action.importPupitri.existingData.message=Des espèces ont déjà été saisies dans la capture. Si vous continuez, elles vont être écrasées. -tutti.editCatchBatch.action.importPupitri.existingData.title=Données existantes -tutti.editCatchBatch.action.importPupitri.mnemonic=I -tutti.editCatchBatch.action.importPupitri.success=Import Pupitri réussi \: %1s espèces importées, %2s espèces rejetées -tutti.editCatchBatch.action.importPupitri.tip=Import Pupitri tutti.editCatchBatch.action.saveCatchBatch=Enregistrer tutti.editCatchBatch.action.saveCatchBatch.mnemonic=S tutti.editCatchBatch.action.saveCatchBatch.tip=Enregistrer la capture @@ -825,6 +818,13 @@ tutti.editSpeciesBatch.action.importMultiPost.sourceFile.title=Importer des lots d'espèces tutti.editSpeciesBatch.action.importMultiPost.success=Des lots d'espèces ont été importés depuis le fichier %s tutti.editSpeciesBatch.action.importMultiPost.tip=Importer des lots d'espèces créés sur un poste satellite +tutti.editSpeciesBatch.action.importPupitri=Import Pupitri +tutti.editSpeciesBatch.action.importPupitri.existingData.help=Que voulez-vous faire ?<ul><li><strong>Annuler</strong> pour ne pas importer les données Pupitri et conserver les espèces saisies</li><li><strong>OK</strong> pour supprimer les espèces existantes et les remplacer par les données de Pupitri</li></ul> +tutti.editSpeciesBatch.action.importPupitri.existingData.message=Des espèces ont déjà été saisies dans la capture. Si vous continuez, elles vont être écrasées. +tutti.editSpeciesBatch.action.importPupitri.existingData.title=Données existantes +tutti.editSpeciesBatch.action.importPupitri.mnemonic=I +tutti.editSpeciesBatch.action.importPupitri.success=Import Pupitri réussi \: %1s espèces importées, %2s espèces rejetées +tutti.editSpeciesBatch.action.importPupitri.tip=Import Pupitri tutti.editSpeciesBatch.action.removeBatch=Supprimer le lot tutti.editSpeciesBatch.action.removeBatch.confirm.message=Vous êtes sur le point de supprimer un lot d'espèces. Êtes-vous sur de vouloir le supprimer ? tutti.editSpeciesBatch.action.removeBatch.confirm.title=Suppression d'un lot d'espèces
participants (1)
-
tchemit@users.forge.codelutin.com