This is an automated email from the git hooks/post-receive script. New commit to branch feature/8228 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit 665a7a5620bfc1ccd1267a15748d9c43c914f603 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Apr 12 12:42:38 2016 +0200 Ne plus utiliser des optional à tout bout de champs :( --- .../frequency/IndividualObservationUICache.java | 25 +++++++++++----------- .../frequency/SpeciesFrequencyUIHandler.java | 12 ++++++----- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationUICache.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationUICache.java index b1502cf..3ebe8b7 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationUICache.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/IndividualObservationUICache.java @@ -162,7 +162,7 @@ public class IndividualObservationUICache implements Closeable { @Override public void summaryUpdated(SamplingEvent event) { - displaySummary(Optional.of(event)); + displaySummary(event); } }; @@ -453,36 +453,32 @@ public class IndividualObservationUICache implements Closeable { } - public void updateSelectedRow(Optional<IndividualObservationBatchRowModel> optSelectedRow) { + public void updateSelectedRow(IndividualObservationBatchRowModel selectedRow) { - Optional<SamplingEvent> event; - if (withSamplingCache() && optSelectedRow.isPresent() && optSelectedRow.get().withSize()) { + SamplingEvent event = null; - IndividualObservationBatchRowModel selectedRow = optSelectedRow.get(); + if (withSamplingCache() && selectedRow != null && selectedRow.withSize()) { CaracteristicQualitativeValue maturityQualitativeValue = uiModel.getMaturityValue(selectedRow); - Boolean maturity = samplingCache.getMaturity(uiModel.getBatch().getSpecies().getReferenceTaxonId(), maturityQualitativeValue); + Boolean maturity = samplingCache.getMaturity(selectedRow.getSpecies().getReferenceTaxonId(), maturityQualitativeValue); int lengthstep = uiModel.getLengthStepInMm(selectedRow.getSize()); - event = samplingCache.getEventForSummary(fishingOperation, species, maturity, uiModel.getGender(selectedRow), lengthstep); + event = samplingCache.getEventForSummary(fishingOperation, species, maturity, uiModel.getGender(selectedRow), lengthstep).orElse(null); - } else { - event = Optional.empty(); } displaySummary(event); } - protected void displaySummary(Optional<SamplingEvent> optEvent) { + protected void displaySummary(SamplingEvent event) { if (isInit()) { String summary = null; - if (optEvent.isPresent() && uiModel.isCanDisplayNotifications()) { - SamplingEvent event = optEvent.get(); + if (event != null && uiModel.isCanDisplayNotifications()) { CalcifiedPiecesSamplingDefinition cpsDef = event.getCpsDef(); if (log.isInfoEnabled()) { - log.info("samplingNeeded for " + cpsDef); + log.info("displaySummary for " + cpsDef); } int nbForOperation = event.getNbSamplingForOperation(); @@ -516,6 +512,9 @@ public class IndividualObservationUICache implements Closeable { } } + if (log.isInfoEnabled()) { + log.info("getSamplingResumeLabel: " + summary); + } ui.getSamplingResumeLabel().setText(summary); } } 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 7d925f0..755015d 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 @@ -1355,13 +1355,15 @@ public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<Speci resetSamplingLabel(); } - Optional<IndividualObservationBatchRowModel> selectedRow; - if (obsTable.getSelectedRowCount() == 1) { - selectedRow = Optional.of(getObsTableModel().getRows().get(obsTable.getSelectedRow())); + IndividualObservationBatchRowModel selectedRow = null; - } else { - selectedRow = Optional.empty(); + if (!obsTable.getSelectionModel().isSelectionEmpty()) { + if (obsTable.getSelectedRowCount() == 1) { + selectedRow = getObsTableModel().getEntry(obsTable.getSelectedRow()); + + } } + individualObservationUICache.updateSelectedRow(selectedRow); }); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.