This is an automated email from the git hooks/post-receive script. New change to branch feature/6112 in repository tutti. See http://git.codelutin.com/tutti.git at 990eb96 suppression multiple dans les listes de lots (fixes #6112) This branch includes the following new commits: new 990eb96 suppression multiple dans les listes de lots (fixes #6112) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 990eb965d2d458370f13a1548a0f8f071eafe80d Author: Kevin Morin <morin@codelutin.com> Date: Wed Dec 23 17:29:01 2015 +0100 suppression multiple dans les listes de lots (fixes #6112) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6112 in repository tutti. See http://git.codelutin.com/tutti.git commit 990eb965d2d458370f13a1548a0f8f071eafe80d Author: Kevin Morin <morin@codelutin.com> Date: Wed Dec 23 17:29:01 2015 +0100 suppression multiple dans les listes de lots (fixes #6112) --- .../operation/catches/benthos/BenthosBatchUI.css | 2 - .../catches/benthos/BenthosBatchUIHandler.java | 18 ++++- .../benthos/actions/RemoveBenthosBatchAction.java | 85 ++++++++++++---------- .../operation/catches/species/SpeciesBatchUI.css | 2 - .../catches/species/SpeciesBatchUIHandler.java | 18 ++++- .../species/actions/RemoveSpeciesBatchAction.java | 75 ++++++++++++------- .../resources/i18n/tutti-ui-swing_en_GB.properties | 6 ++ .../resources/i18n/tutti-ui-swing_fr_FR.properties | 10 ++- 8 files changed, 141 insertions(+), 75 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css index 621acc4..9f7ac97 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css @@ -214,8 +214,6 @@ ComputableDataEditor { #removeBenthosBatchMenu { actionIcon: batch-delete; - text: "tutti.editBenthosBatch.action.removeBatch"; - toolTipText: "tutti.editBenthosBatch.action.removeBatch.tip"; i18nMnemonic: "tutti.editBenthosBatch.action.removeBatch.mnemonic"; _applicationAction: {fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.actions.RemoveBenthosBatchAction.class}; enabled: {model.isTableViewModeAll() && model.isRemoveBatchEnabled()}; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java index f760649..1f4cf71 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java @@ -441,7 +441,7 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent enableSplit = true; // action with single selection - enableRemove = selectedRowCount == 1; + enableRemove = true; enableRemoveSub = selectedRowCount == 1; enableRename = selectedRowCount == 1; enableEditFrequencies = selectedRowCount == 1; @@ -554,7 +554,21 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent if (enableRemove) { // can always remove the batch - // no more test + + // update the text of the remove batch menu + String text, tip; + + if (selectedRowCount == 1) { + text = t("tutti.editBenthosBatch.action.removeBatch"); + tip = t("tutti.editBenthosBatch.action.removeBatch.tip"); + + } else { + text = t("tutti.editBenthosBatch.action.removeBatches"); + tip = t("tutti.editBenthosBatch.action.removeBatches.tip"); + } + + ui.getRemoveBenthosBatchMenu().setText(text); + ui.getRemoveBenthosBatchMenu().setToolTipText(tip); } if (enableRemoveSub) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/RemoveBenthosBatchAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/RemoveBenthosBatchAction.java index e58f5fd..0c69cc5 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/RemoveBenthosBatchAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/actions/RemoveBenthosBatchAction.java @@ -50,13 +50,6 @@ import static org.nuiton.i18n.I18n.t; public class RemoveBenthosBatchAction extends LongActionSupport<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> { /** - * Selected row to treat. - * - * @since 2.8 - */ - protected int rowIndex; - - /** * Rows to delete after all. * * @since 3.0-rc-1 @@ -71,14 +64,29 @@ public class RemoveBenthosBatchAction extends LongActionSupport<BenthosBatchUIMo public boolean prepareAction() throws Exception { boolean result = super.prepareAction(); - rowIndex = -1; - if (result) { - int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(), - t("tutti.editBenthosBatch.action.removeBatch.confirm.message"), - t("tutti.editBenthosBatch.action.removeBatch.confirm.title"), - JOptionPane.YES_NO_OPTION); - result = answer == JOptionPane.YES_OPTION; + + int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable()); + int selectedRowCount = selectedRowIndexes.length; + + if (selectedRowCount > 0) { + + String message; + if (selectedRowCount == 1) { + message = t("tutti.editBenthosBatch.action.removeBatch.confirm.message"); + } else { + message = t("tutti.editBenthosBatch.action.removeBatches.confirm.message", selectedRowCount); + } + + int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(), + message, + t("tutti.editBenthosBatch.action.removeBatch.confirm.title"), + JOptionPane.YES_NO_OPTION); + result = answer == JOptionPane.YES_OPTION; + + } else { + result = false; + } } return result; @@ -90,39 +98,42 @@ public class RemoveBenthosBatchAction extends LongActionSupport<BenthosBatchUIMo TuttiPersistence persistenceService = getContext().getPersistenceService(); - JXTable table = handler.getTable(); - - rowIndex = SwingUtil.getSelectedModelRow(table); + int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable()); - Preconditions.checkState(rowIndex != -1, - "Cant remove batch if no batch selected"); + Preconditions.checkState(selectedRowIndexes.length > 0, + "Cant remove batches if no batches selected"); BenthosBatchTableModel tableModel = handler.getTableModel(); - BenthosBatchRowModel selectedBatch = tableModel.getEntry(rowIndex); - Preconditions.checkState(!TuttiEntities.isNew(selectedBatch), - "Can't remove batch if batch is not persisted"); + rowToRemove = Sets.newHashSet(); - // remove selected batch and all his children + for (int rowIndex : selectedRowIndexes) { - // remove parent batch (will destroy all his childs from db) - persistenceService.deleteBenthosBatch(selectedBatch.getId()); + BenthosBatchRowModel selectedBatch = tableModel.getEntry(rowIndex); - if (selectedBatch.isBatchRoot()) { - // update speciesUsed - handler.removeFromSpeciesUsed(selectedBatch); - } else { + Preconditions.checkState(!TuttiEntities.isNew(selectedBatch), + "Can't remove batch if batch is not persisted"); - // remove from his parent - BenthosBatchRowModel parentBatch = selectedBatch.getParentBatch(); - parentBatch.getChildBatch().remove(selectedBatch); - } + // remove selected batch and all his children - // collect of rows to remove from model - rowToRemove = Sets.newHashSet(); - rowToRemove.add(selectedBatch); + // remove parent batch (will destroy all his childs from db) + persistenceService.deleteBenthosBatch(selectedBatch.getId()); - handler.collectChildren(selectedBatch, rowToRemove); + if (selectedBatch.isBatchRoot()) { + // update speciesUsed + handler.removeFromSpeciesUsed(selectedBatch); + } else { + + // remove from his parent + BenthosBatchRowModel parentBatch = selectedBatch.getParentBatch(); + parentBatch.getChildBatch().remove(selectedBatch); + } + + // collect of rows to remove from model + rowToRemove.add(selectedBatch); + + handler.collectChildren(selectedBatch, rowToRemove); + } } @Override diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css index d62bc13..b2892ea 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css @@ -214,8 +214,6 @@ ComputableDataEditor { #removeSpeciesBatchMenu { actionIcon: batch-delete; - text: "tutti.editSpeciesBatch.action.removeBatch"; - toolTipText: "tutti.editSpeciesBatch.action.removeBatch.tip"; i18nMnemonic: "tutti.editSpeciesBatch.action.removeBatch.mnemonic"; _applicationAction: {fr.ifremer.tutti.ui.swing.content.operation.catches.species.actions.RemoveSpeciesBatchAction.class}; enabled: {model.isTableViewModeAll() && model.isRemoveBatchEnabled()}; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java index bfc554f..8d31422 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java @@ -443,7 +443,7 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec enableSplit = true; // action with single selection - enableRemove = selectedRowCount == 1; + enableRemove = true; enableRemoveSub = selectedRowCount == 1; enableRename = selectedRowCount == 1; enableEditFrequencies = selectedRowCount == 1; @@ -557,7 +557,21 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec if (enableRemove) { // can always remove the batch - // no more test + + // update the text of the remove batch menu + String text, tip; + + if (selectedRowCount == 1) { + text = t("tutti.editSpeciesBatch.action.removeBatch"); + tip = t("tutti.editBenthosBatch.action.removeBatch.tip"); + + } else { + text = t("tutti.editSpeciesBatch.action.removeBatches"); + tip = t("tutti.editSpeciesBatch.action.removeBatches.tip"); + } + + ui.getRemoveSpeciesBatchMenu().setText(text); + ui.getRemoveSpeciesBatchMenu().setToolTipText(tip); } if (enableRemoveSub) { diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/actions/RemoveSpeciesBatchAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/actions/RemoveSpeciesBatchAction.java index a9fe585..ab19ee1 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/actions/RemoveSpeciesBatchAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/actions/RemoveSpeciesBatchAction.java @@ -65,11 +65,28 @@ public class RemoveSpeciesBatchAction extends LongActionSupport<SpeciesBatchUIMo boolean result = super.prepareAction(); if (result) { - int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(), - t("tutti.editSpeciesBatch.action.removeBatch.confirm.message"), - t("tutti.editSpeciesBatch.action.removeBatch.confirm.title"), - JOptionPane.YES_NO_OPTION); - result = answer == JOptionPane.YES_OPTION; + + int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable()); + int selectedRowCount = selectedRowIndexes.length; + + if (selectedRowCount > 0) { + + String message; + if (selectedRowCount == 1) { + message = t("tutti.editSpeciesBatch.action.removeBatch.confirm.message"); + } else { + message = t("tutti.editSpeciesBatch.action.removeBatches.confirm.message", selectedRowCount); + } + + int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(), + message, + t("tutti.editSpeciesBatch.action.removeBatch.confirm.title"), + JOptionPane.YES_NO_OPTION); + result = answer == JOptionPane.YES_OPTION; + + } else { + result = false; + } } return result; @@ -81,40 +98,42 @@ public class RemoveSpeciesBatchAction extends LongActionSupport<SpeciesBatchUIMo TuttiPersistence persistenceService = getContext().getPersistenceService(); - JXTable table = handler.getTable(); - - int rowIndex = SwingUtil.getSelectedModelRow(table); + int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable()); - Preconditions.checkState(rowIndex != -1, - "Cant remove batch if no batch selected"); + Preconditions.checkState(selectedRowIndexes.length > 0, + "Cant remove batches if no batches selected"); SpeciesBatchTableModel tableModel = handler.getTableModel(); - SpeciesBatchRowModel selectedBatch = tableModel.getEntry(rowIndex); + rowToRemove = Sets.newHashSet(); - Preconditions.checkState(!TuttiEntities.isNew(selectedBatch), - "Can't remove batch if batch is not persisted"); + for (int rowIndex : selectedRowIndexes) { - // remove selected batch and all his children + SpeciesBatchRowModel selectedBatch = tableModel.getEntry(rowIndex); - // remove parent batch (will destroy all his childs from db) - persistenceService.deleteSpeciesBatch(selectedBatch.getId()); + Preconditions.checkState(!TuttiEntities.isNew(selectedBatch), + "Can't remove batch if batch is not persisted"); - if (selectedBatch.isBatchRoot()) { - // update speciesUsed - handler.removeFromSpeciesUsed(selectedBatch); - } else { + // remove selected batch and all his children - // remove from his parent - SpeciesBatchRowModel parentBatch = selectedBatch.getParentBatch(); - parentBatch.getChildBatch().remove(selectedBatch); - } + // remove parent batch (will destroy all his childs from db) + persistenceService.deleteSpeciesBatch(selectedBatch.getId()); - // collect of rows to remove from model - rowToRemove = Sets.newHashSet(); - rowToRemove.add(selectedBatch); + if (selectedBatch.isBatchRoot()) { + // update speciesUsed + handler.removeFromSpeciesUsed(selectedBatch); + } else { - handler.collectChildren(selectedBatch, rowToRemove); + // remove from his parent + SpeciesBatchRowModel parentBatch = selectedBatch.getParentBatch(); + parentBatch.getChildBatch().remove(selectedBatch); + } + + // collect of rows to remove from model + rowToRemove.add(selectedBatch); + + handler.collectChildren(selectedBatch, rowToRemove); + } } @Override diff --git a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties index 9474746..6d32ed7 100644 --- a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties +++ b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties @@ -456,6 +456,9 @@ tutti.editBenthosBatch.action.removeBatch.confirm.message= tutti.editBenthosBatch.action.removeBatch.confirm.title= tutti.editBenthosBatch.action.removeBatch.mnemonic= tutti.editBenthosBatch.action.removeBatch.tip= +tutti.editBenthosBatch.action.removeBatches= +tutti.editBenthosBatch.action.removeBatches.confirm.message= +tutti.editBenthosBatch.action.removeBatches.tip= tutti.editBenthosBatch.action.removeSubBatch= tutti.editBenthosBatch.action.removeSubBatch.confirm.message= tutti.editBenthosBatch.action.removeSubBatch.confirm.title= @@ -1194,6 +1197,9 @@ tutti.editSpeciesBatch.action.removeBatch.confirm.message= tutti.editSpeciesBatch.action.removeBatch.confirm.title= tutti.editSpeciesBatch.action.removeBatch.mnemonic= tutti.editSpeciesBatch.action.removeBatch.tip= +tutti.editSpeciesBatch.action.removeBatches= +tutti.editSpeciesBatch.action.removeBatches.confirm.message= +tutti.editSpeciesBatch.action.removeBatches.tip= tutti.editSpeciesBatch.action.removeSubBatch= tutti.editSpeciesBatch.action.removeSubBatch.confirm.message= tutti.editSpeciesBatch.action.removeSubBatch.confirm.title= diff --git a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties index 1b34c43..32f8419 100644 --- a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties +++ b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties @@ -435,9 +435,12 @@ tutti.editBenthosBatch.action.importMultiPost.success=Des lots de benthos ont é tutti.editBenthosBatch.action.importMultiPost.tip=Importer des lots de benthos créés sur un poste satellite tutti.editBenthosBatch.action.removeBatch=Supprimer le lot tutti.editBenthosBatch.action.removeBatch.confirm.message=<html>Vous êtes sur le point de supprimer un lot de benthos.<hr/>Êtes-vous sur de vouloir le supprimer ?</html> -tutti.editBenthosBatch.action.removeBatch.confirm.title=Suppression d'un lot de benthos +tutti.editBenthosBatch.action.removeBatch.confirm.title=Suppression de lots de benthos tutti.editBenthosBatch.action.removeBatch.mnemonic=S tutti.editBenthosBatch.action.removeBatch.tip=Supprimer le lot courant (celui de la ligne sélectionnée) et tous ces fils +tutti.editBenthosBatch.action.removeBatches=Supprimer les lots +tutti.editBenthosBatch.action.removeBatches.confirm.message=<html>Vous êtes sur le point de supprimer %s lots de benthos.<hr/>Êtes-vous sur de vouloir les supprimer ?</html> +tutti.editBenthosBatch.action.removeBatches.tip=Supprimer les lots courants (ceux des lignes sélectionnées) et tous leurs fils tutti.editBenthosBatch.action.removeSubBatch=Supprimer les lots fils tutti.editBenthosBatch.action.removeSubBatch.confirm.message=<html>Vous êtes sur le point de supprimer les fils d'un lot de benthos.<hr/>Êtes-vous sur de vouloir les supprimer ?</html> tutti.editBenthosBatch.action.removeSubBatch.confirm.title=Suppression des fils d'un lot de benthos @@ -1149,9 +1152,12 @@ tutti.editSpeciesBatch.action.importPupitri.success=Import Pupitri réussi \: %1 tutti.editSpeciesBatch.action.importPupitri.tip=Import Pupitri tutti.editSpeciesBatch.action.removeBatch=Supprimer le lot tutti.editSpeciesBatch.action.removeBatch.confirm.message=<html>Vous êtes sur le point de supprimer un lot d'espèces.<hr/>Êtes-vous sur de vouloir le supprimer ?</html> -tutti.editSpeciesBatch.action.removeBatch.confirm.title=Suppression d'un lot d'espèces +tutti.editSpeciesBatch.action.removeBatch.confirm.title=Suppression de lots d'espèces tutti.editSpeciesBatch.action.removeBatch.mnemonic=S tutti.editSpeciesBatch.action.removeBatch.tip=Supprimer le lot courant (celui de la ligne sélectionnée) et tous ces fils +tutti.editSpeciesBatch.action.removeBatches=Supprimer les lots +tutti.editSpeciesBatch.action.removeBatches.confirm.message=<html>Vous êtes sur le point de supprimer %s lots d'espèces.<hr/>Êtes-vous sur de vouloir les supprimer ?</html> +tutti.editSpeciesBatch.action.removeBatches.tip=Supprimer les lot courants (ceux des lignes sélectionnées) et tous leurs fils tutti.editSpeciesBatch.action.removeSubBatch=Supprimer les lots fils tutti.editSpeciesBatch.action.removeSubBatch.confirm.message=<html>Vous êtes sur le point de supprimer les fils d'un lot d'espèces.<hr/>Êtes-vous sur de vouloir les supprimer ?</html> tutti.editSpeciesBatch.action.removeSubBatch.confirm.title=Suppression des fils d'un lot d'espèces -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm