This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit 91d0cfacedbe1b168786fe8cba0acf03d0d0e2e8 Author: Benjamin POUSSIN <poussin@codelutin.com> Date: Thu Jun 23 18:46:20 2016 +0200 fixes #8334 (si les poids sont saisis dans le tableau des mensurations et que on est en tri ascendant ou descendant, à l'élévation les poids n'apparaissent pas dans le tableau) --- .../catches/actions/ComputeBatchWeightsAction.java | 58 +++++++++++----------- .../species/edit/SpeciesBatchUIHandler.java | 35 +++++++++++-- 2 files changed, 60 insertions(+), 33 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java index 0432426..50f391b 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/actions/ComputeBatchWeightsAction.java @@ -45,6 +45,7 @@ import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesB import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesBatchRowModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesBatchTableModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesBatchUI; +import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesBatchUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesBatchUIModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesSortMode; import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler; @@ -276,13 +277,15 @@ public class ComputeBatchWeightsAction extends LongActionSupport<EditCatchesUIMo if (speciesBatchRows != null) { - speciesBatchUI.getModel().setRows(speciesBatchRows); + SpeciesBatchUIHandler handler = speciesBatchUI.getHandler(); + handler.sortAndSetRow(speciesBatchUI.getModel(), speciesBatchRows); } if (benthosBatchRows != null) { - benthosBatchesUI.getModel().setRows(benthosBatchRows); + SpeciesBatchUIHandler handler = benthosBatchesUI.getHandler(); + handler.sortAndSetRow(benthosBatchesUI.getModel(), benthosBatchRows); } @@ -304,32 +307,31 @@ public class ComputeBatchWeightsAction extends LongActionSupport<EditCatchesUIMo } - // keep sortMode - // see https://forge.codelutin.com/issues/5699 - - { - SpeciesBatchUIModel model = speciesBatchUI.getModel(); - SpeciesSortMode sortMode = model.getSpeciesSortMode(); - if (sortMode != SpeciesSortMode.NONE) { - - // must reload order - model.setSpeciesSortMode(SpeciesSortMode.NONE); - model.setSpeciesSortMode(sortMode); - - } - } - - { - SpeciesBatchUIModel model = benthosBatchesUI.getModel(); - SpeciesSortMode sortMode = model.getSpeciesSortMode(); - if (sortMode != SpeciesSortMode.NONE) { - - // must reload order - model.setSpeciesSortMode(SpeciesSortMode.NONE); - model.setSpeciesSortMode(sortMode); - - } - } +// // keep sortMode +// // see https://forge.codelutin.com/issues/5699 +// { +// SpeciesBatchUIModel model = speciesBatchUI.getModel(); +// SpeciesSortMode sortMode = model.getSpeciesSortMode(); +// if (sortMode != SpeciesSortMode.NONE) { +// +// // must reload order +// model.setSpeciesSortMode(SpeciesSortMode.NONE); +// model.setSpeciesSortMode(sortMode); +// +// } +// } +// +// { +// SpeciesBatchUIModel model = benthosBatchesUI.getModel(); +// SpeciesSortMode sortMode = model.getSpeciesSortMode(); +// if (sortMode != SpeciesSortMode.NONE) { +// +// // must reload order +// model.setSpeciesSortMode(SpeciesSortMode.NONE); +// model.setSpeciesSortMode(sortMode); +// +// } +// } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/edit/SpeciesBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/edit/SpeciesBatchUIHandler.java index 3a0f650..e890545 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/edit/SpeciesBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/edit/SpeciesBatchUIHandler.java @@ -201,16 +201,29 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec } } - SpeciesBatchDecorator decorator = getSpeciesColumnDecorator(); +// SpeciesBatchDecorator decorator = getSpeciesColumnDecorator(); +// +// SpeciesSortMode speciesSortMode = model.getSpeciesSortMode(); +// +// SpeciesBatchRowHelper.sortSpeciesRows(getTable(), +// decorator, +// rows, +// speciesSortMode); + } - SpeciesSortMode speciesSortMode = model.getSpeciesSortMode(); +// model.setRows(rows); + sortAndSetRow(model, rows); + } + public void sortAndSetRow(SpeciesBatchUIModel model, List<SpeciesBatchRowModel> rows) { + SpeciesSortMode order = model.getSpeciesSortMode(); + if (order != SpeciesSortMode.NONE && rows != null && rows.size() > 0) { + SpeciesBatchDecorator decorator = getSpeciesColumnDecorator(); SpeciesBatchRowHelper.sortSpeciesRows(getTable(), decorator, rows, - speciesSortMode); + order); } - model.setRows(rows); } @@ -819,8 +832,20 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec log.info("New species sort mode: " + newValue); } + // no reload to fixes bug https://forge.codelutin.com/issues/8334) // must reload fishing operation - selectFishingOperation(getModel().getFishingOperation()); +// selectFishingOperation(getModel().getFishingOperation()); + + if (newValue == SpeciesSortMode.NONE) { + // need to reload data for NONE, because default element order is loose + // after sorting by alphabetic order. + // This maintains same behavior before fixes bug #8334 + // (elevation computation disapear when sorting change) + selectFishingOperation(getModel().getFishingOperation()); + } else { + SpeciesBatchUIModel model = getModel(); + sortAndSetRow(model, model.getRows()); + } }); // when species sort mode change, must reload the firshing operation -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.