This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit 410b9db0d7f7c0b10375ceb0e3037367c7023e9d Author: Kevin Morin <morin@codelutin.com> Date: Mon Jan 26 17:51:30 2015 +0100 refactor --- .../operation/catches/EditCatchesUIHandler.java | 24 ++--------------- .../operation/catches/EditCatchesUIModel.java | 31 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java index 606c93d..e539f7f 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java @@ -284,17 +284,7 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi new Function<EditCatchesUIModel, Color>() { @Override public Color apply(EditCatchesUIModel model) { - Float catchTotalRejectedWeight = model.getCatchTotalRejectedComputedOrNotWeight().getDataOrComputedData(); - Float speciesTotalSortedWeight = model.getSpeciesTotalSortedComputedOrNotWeight().getDataOrComputedData(); - Float speciesTotalSampleSortedComputedWeight = model.getSpeciesTotalSampleSortedComputedWeight(); - - boolean warning = catchTotalRejectedWeight != null - && speciesTotalSortedWeight != null - && speciesTotalSampleSortedComputedWeight != null - && Weights.isEqualWeight(catchTotalRejectedWeight, 0f) - && Weights.isEqualWeight(speciesTotalSortedWeight, - speciesTotalSampleSortedComputedWeight); - + boolean warning = model.isSpeciesTotalUnsortedComputedWeightInWarning(); return warning ? Color.ORANGE : Color.decode("#006bba"); } })); @@ -311,17 +301,7 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi new Function<EditCatchesUIModel, Color>() { @Override public Color apply(EditCatchesUIModel model) { - Float catchTotalRejectedWeight = model.getCatchTotalRejectedComputedOrNotWeight().getDataOrComputedData(); - Float benthosTotalSortedWeight = model.getBenthosTotalSortedComputedOrNotWeight().getDataOrComputedData(); - Float benthosTotalSampleSortedComputedWeight = model.getBenthosTotalSampleSortedComputedWeight(); - - boolean warning = catchTotalRejectedWeight != null - && benthosTotalSortedWeight != null - && benthosTotalSampleSortedComputedWeight != null - && Weights.isEqualWeight(catchTotalRejectedWeight, 0f) - && Weights.isEqualWeight(benthosTotalSortedWeight, - benthosTotalSampleSortedComputedWeight); - + boolean warning = model.isBenthosTotalUnsortedComputedWeightInWarning(); return warning ? Color.ORANGE : Color.decode("#006bba"); } })); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java index a2ccbea..6da2338 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java @@ -37,6 +37,7 @@ import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel; import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware; import fr.ifremer.tutti.ui.swing.util.computable.ComputableData; +import fr.ifremer.tutti.util.Weights; import org.apache.commons.collections4.CollectionUtils; import org.nuiton.jaxx.application.swing.tab.TabContentModel; import org.nuiton.util.beans.Binder; @@ -625,6 +626,21 @@ public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<CatchBatch, Edi firePropertyChange(PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT, oldValue, speciesTotalLivingNotItemizedComputedWeight); } + public boolean isSpeciesTotalUnsortedComputedWeightInWarning() { + Float catchTotalRejectedWeight = getCatchTotalRejectedComputedOrNotWeight().getDataOrComputedData(); + Float speciesTotalSortedWeight = getSpeciesTotalSortedComputedOrNotWeight().getDataOrComputedData(); + Float speciesTotalSampleSortedComputedWeight = getSpeciesTotalSampleSortedComputedWeight(); + + boolean warning = catchTotalRejectedWeight != null + && speciesTotalSortedWeight != null + && speciesTotalSampleSortedComputedWeight != null + && Weights.isEqualWeight(catchTotalRejectedWeight, 0f) + && Weights.isEqualWeight(speciesTotalSortedWeight, + speciesTotalSampleSortedComputedWeight); + + return warning; + } + //------------------------------------------------------------------------// //-- Benthos --// //------------------------------------------------------------------------// @@ -749,6 +765,21 @@ public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<CatchBatch, Edi firePropertyChange(PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT, oldValue, benthosTotalLivingNotItemizedComputedWeight); } + public boolean isBenthosTotalUnsortedComputedWeightInWarning() { + Float catchTotalRejectedWeight = getCatchTotalRejectedComputedOrNotWeight().getDataOrComputedData(); + Float benthosTotalSortedWeight = getBenthosTotalSortedComputedOrNotWeight().getDataOrComputedData(); + Float benthosTotalSampleSortedComputedWeight = getBenthosTotalSampleSortedComputedWeight(); + + boolean warning = catchTotalRejectedWeight != null + && benthosTotalSortedWeight != null + && benthosTotalSampleSortedComputedWeight != null + && Weights.isEqualWeight(catchTotalRejectedWeight, 0f) + && Weights.isEqualWeight(benthosTotalSortedWeight, + benthosTotalSampleSortedComputedWeight); + + return warning; + } + //------------------------------------------------------------------------// //-- Marine Litter --// //------------------------------------------------------------------------// -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.