branch feature/8194 created (now 3a92557)
This is an automated email from the git hooks/post-receive script. New change to branch feature/8194 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git at 3a92557 on increment et decremente l'algo à partir du moment où il y a une taille (fixes #8194) This branch includes the following new commits: new 3a92557 on increment et decremente l'algo à partir du moment où il y a une taille (fixes #8194) 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 3a92557e2ed92de335858e8c9129be930d656836 Author: Kevin Morin <morin@codelutin.com> Date: Fri Mar 25 17:02:52 2016 +0100 on increment et decremente l'algo à partir du moment où il y a une taille (fixes #8194) -- 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/8194 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit 3a92557e2ed92de335858e8c9129be930d656836 Author: Kevin Morin <morin@codelutin.com> Date: Fri Mar 25 17:02:52 2016 +0100 on increment et decremente l'algo à partir du moment où il y a une taille (fixes #8194) --- .../frequency/SpeciesFrequencyUIHandler.java | 118 +++++++++------------ 1 file changed, 51 insertions(+), 67 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java index 7c5dde2..4de04f6 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java @@ -47,12 +47,8 @@ import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.ui.swing.TuttiUIContext; import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchRowModel; import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchTableModel; -import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.SamplingCodeCellRenderer; import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.SamplingCodeCellEditor; -import fr.ifremer.tutti.ui.swing.content.operation.catches.species.EditSpeciesBatchPanelUI; -import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesOrBenthosBatchUISupport; -import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchRowModel; -import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchTableModel; +import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.SamplingCodeCellRenderer; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.EditSpeciesBatchPanelUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesOrBenthosBatchUISupport; import fr.ifremer.tutti.ui.swing.content.operation.catches.species.edit.SpeciesBatchRowModel; @@ -225,89 +221,77 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci CaracteristicQualitativeValue gender = row.getGender(sexCaracteristic); Optional<CaracteristicQualitativeValue> maturity = row.getMaturityState(); - // we only update the frequencies if the row is valid - if (row.isValid()) { - - if (log.isDebugEnabled()) { - log.debug("Row is valid"); - } - if (IndividualObservationBatchRowModel.PROPERTY_SIZE.equals(propertyName)) { + if (IndividualObservationBatchRowModel.PROPERTY_SIZE.equals(propertyName)) { - Float oldValue = (Float) evt.getOldValue(); - Float newValue = (Float) evt.getNewValue(); + Float oldValue = (Float) evt.getOldValue(); + Float newValue = (Float) evt.getNewValue(); - if (oldValue != null) { - individualObservationUICache.decrements(gender, maturity, oldValue); - } - if (newValue != null) { - individualObservationUICache.increments(gender, maturity, newValue); - } + if (oldValue != null) { + individualObservationUICache.decrements(gender, maturity, oldValue); + } + if (newValue != null) { + individualObservationUICache.increments(gender, maturity, newValue); + } - if (getModel().mustCopyIndividualObservationSize()) { - updateFrequencyRowsNumbers(oldValue, newValue); + // we only update the frequencies if the row is valid + if (row.isValid() && getModel().mustCopyIndividualObservationSize()) { + updateFrequencyRowsNumbers(oldValue, newValue); - Float weight = row.getWeight(); - if (getModel().mustCopyIndividualObservationWeight() && weight != null) { - updateFrequencyRowsWeights(oldValue, -weight); - updateFrequencyRowsWeights(newValue, weight); - } + Float weight = row.getWeight(); + if (getModel().mustCopyIndividualObservationWeight() && weight != null) { + updateFrequencyRowsWeights(oldValue, -weight); + updateFrequencyRowsWeights(newValue, weight); } } + } - if (getModel().mustCopyIndividualObservationWeight() - && IndividualObservationBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) { - - Float oldValue = (Float) evt.getOldValue(); - Float newValue = (Float) evt.getNewValue(); - Float weightToAdd; + if (row.isValid() && getModel().mustCopyIndividualObservationWeight() + && IndividualObservationBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) { - if (oldValue == null) { - weightToAdd = newValue; + Float oldValue = (Float) evt.getOldValue(); + Float newValue = (Float) evt.getNewValue(); + Float weightToAdd; - } else if (newValue == null) { - weightToAdd = -oldValue; + if (oldValue == null) { + weightToAdd = newValue; - } else { - weightToAdd = newValue - oldValue; - } + } else if (newValue == null) { + weightToAdd = -oldValue; - if (weightToAdd != null) { - updateFrequencyRowsWeights(row.getSize(), weightToAdd); - } + } else { + weightToAdd = newValue - oldValue; } - if (row.withSize() - && (IndividualObservationBatchRowModel.PROPERTY_DEFAULT_CARACTERISTICS.equals(propertyName) - || IndividualObservationBatchRowModel.PROPERTY_CARACTERISTICS.equals(propertyName))) { + if (weightToAdd != null) { + updateFrequencyRowsWeights(row.getSize(), weightToAdd); + } + } - CaracteristicMap oldValue = (CaracteristicMap) evt.getOldValue(); - CaracteristicMap newValue = (CaracteristicMap) evt.getNewValue(); + if (row.withSize() + && (IndividualObservationBatchRowModel.PROPERTY_DEFAULT_CARACTERISTICS.equals(propertyName) + || IndividualObservationBatchRowModel.PROPERTY_CARACTERISTICS.equals(propertyName))) { - if (log.isInfoEnabled()) { - log.info("caracteristics changed"); - } + CaracteristicMap oldValue = (CaracteristicMap) evt.getOldValue(); + CaracteristicMap newValue = (CaracteristicMap) evt.getNewValue(); - if (row.getMaturityCaracteristic().isPresent()) { - Optional<CaracteristicQualitativeValue> oldMaturity = Optional.ofNullable((CaracteristicQualitativeValue) oldValue.get(row.getMaturityCaracteristic().get())); - Optional<CaracteristicQualitativeValue> newMaturity = Optional.ofNullable((CaracteristicQualitativeValue) newValue.get(row.getMaturityCaracteristic().get())); - if (log.isInfoEnabled()) { - log.info("maturities : " + oldMaturity + " " + newMaturity); - } - if (!Objects.equals(oldMaturity, newMaturity)) { - individualObservationUICache.decrements(gender, oldMaturity, row.getSize()); - individualObservationUICache.increments(gender, newMaturity, row.getSize()); - } - } + if (row.getMaturityCaracteristic().isPresent()) { + Optional<CaracteristicQualitativeValue> oldMaturity = Optional.ofNullable((CaracteristicQualitativeValue) oldValue.get(row.getMaturityCaracteristic().get())); + Optional<CaracteristicQualitativeValue> newMaturity = Optional.ofNullable((CaracteristicQualitativeValue) newValue.get(row.getMaturityCaracteristic().get())); - CaracteristicQualitativeValue oldGender = (CaracteristicQualitativeValue) oldValue.get(sexCaracteristic); - CaracteristicQualitativeValue newGender = (CaracteristicQualitativeValue) newValue.get(sexCaracteristic); - if (!Objects.equals(oldGender, newGender)) { - individualObservationUICache.decrements(oldGender, maturity, row.getSize()); - individualObservationUICache.increments(newGender, maturity, row.getSize()); + if (!Objects.equals(oldMaturity, newMaturity)) { + individualObservationUICache.decrements(gender, oldMaturity, row.getSize()); + individualObservationUICache.increments(gender, newMaturity, row.getSize()); } + } + CaracteristicQualitativeValue oldGender = (CaracteristicQualitativeValue) oldValue.get(sexCaracteristic); + CaracteristicQualitativeValue newGender = (CaracteristicQualitativeValue) newValue.get(sexCaracteristic); + if (!Objects.equals(oldGender, newGender)) { + individualObservationUICache.decrements(oldGender, maturity, row.getSize()); + individualObservationUICache.increments(newGender, maturity, row.getSize()); } + } // if the row's valid state changes, then remove or readd it to the frequencies -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm