This is an automated email from the git hooks/post-receive script. New commit to branch feature/7277 in repository tutti. See http://git.codelutin.com/tutti.git commit 2effe203155a18228e4b0be0cf2df5f521da48e9 Author: Kevin Morin <morin@codelutin.com> Date: Wed Dec 23 15:38:47 2015 +0100 on garde dans le modèle la dernirèe categorie V/HV qui a été utilisée à la création d'un batch de benthos our la resélectionner dans la combo lors de la création du batch suivant (quand on choisit une espèce)(fixes #7277) --- .../catches/benthos/BenthosBatchUIHandler.java | 2 ++ .../benthos/create/CreateBenthosBatchUI.jaxx | 22 +++++++++++----------- .../create/CreateBenthosBatchUIHandler.java | 19 +++++++++++++------ .../benthos/create/CreateBenthosBatchUIModel.java | 19 +++++++++++++++++++ 4 files changed, 45 insertions(+), 17 deletions(-) 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 43aff84..f760649 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 @@ -961,6 +961,8 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent batchRootRowModel.getSampleWeight() ); } + + batchRootRowModel.setLastSampleCategoryUsed(batchRootRowModel.getSampleCategory()); } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx index 9ff2abf..fe116b7 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.jaxx @@ -82,35 +82,35 @@ public CreateBenthosBatchUI(EditCatchesUI parentUI) { </cell> </row> - <!-- Species batch weight --> + <!-- Sorted / Unsorted Category --> <row> <cell anchor='west'> - <JLabel id='batchWeightLabel'/> + <JLabel id='sampleCategoryLabel'/> </cell> <cell weightx='1.0' columns='2'> - <NumberEditor id='batchWeightField' constructorParams='this'/> + <BeanFilterableComboBox id='sampleCategoryComboBox' + constructorParams='this' + genericType='CaracteristicQualitativeValue'/> </cell> </row> - <!-- Species batch count --> + <!-- Species batch weight --> <row> <cell anchor='west'> - <JLabel id='batchCountLabel'/> + <JLabel id='batchWeightLabel'/> </cell> <cell weightx='1.0' columns='2'> - <NumberEditor id='batchCountField' constructorParams='this'/> + <NumberEditor id='batchWeightField' constructorParams='this'/> </cell> </row> - <!-- Sorted / Unsorted Category --> + <!-- Species batch count --> <row> <cell anchor='west'> - <JLabel id='sampleCategoryLabel'/> + <JLabel id='batchCountLabel'/> </cell> <cell weightx='1.0' columns='2'> - <BeanFilterableComboBox id='sampleCategoryComboBox' - constructorParams='this' - genericType='CaracteristicQualitativeValue'/> + <NumberEditor id='batchCountField' constructorParams='this'/> </cell> </row> diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java index 8a7c914..fe094d9 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java @@ -112,19 +112,26 @@ public class CreateBenthosBatchUIHandler extends AbstractTuttiTableUIHandler<Spl } else { - // look for best value for V/HV category : if sorted is available then use it + // select the last used V/HV category used, or sorted if no batch has been created List<CaracteristicQualitativeValue> qualitativeValues = CreateBenthosBatchUIHandler.this.ui.getSampleCategoryComboBox().getData(); CaracteristicQualitativeValue newCategory = null; - for (CaracteristicQualitativeValue qualitativeValue : qualitativeValues) { - if (source.isSpeciesAndCategoryAvailable(newValue, qualitativeValue)) { - newCategory = qualitativeValue; + CaracteristicQualitativeValue defaultCategory = getModel().getLastSampleCategoryUsed(); + if (defaultCategory == null) { + defaultCategory = sortedValue; + } + + if (newCategory == null) { + for (CaracteristicQualitativeValue qualitativeValue : qualitativeValues) { + if (source.isSpeciesAndCategoryAvailable(newValue, qualitativeValue)) { + newCategory = qualitativeValue; - if (newCategory.equals(sortedValue)) { - break; + if (newCategory.equals(defaultCategory)) { + break; + } } } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java index ccc4a7d..cb4dba0 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java @@ -54,6 +54,8 @@ public class CreateBenthosBatchUIModel extends AbstractTuttiTableUIModel<CreateB public static final String PROPERTY_SAMPLE_CATEGORY = "sampleCategory"; + public static final String PROPERTY_LAST_SAMPLE_CATEGORY_USED = "lastSampleCategoryUsed"; + public static final String PROPERTY_BATCH_WEIGHT = "batchWeight"; public static final String PROPERTY_BATCH_COUNT = "batchCount"; @@ -86,6 +88,13 @@ public class CreateBenthosBatchUIModel extends AbstractTuttiTableUIModel<CreateB protected CaracteristicQualitativeValue sampleCategory; /** + * Last first category used. + * + * @since 4.2 + */ + protected CaracteristicQualitativeValue lastSampleCategoryUsed; + + /** * Batch weight. * * @since 0.3 @@ -180,6 +189,16 @@ public class CreateBenthosBatchUIModel extends AbstractTuttiTableUIModel<CreateB firePropertyChange(PROPERTY_SAMPLE_CATEGORY, oldValue, sampleCategory); } + public CaracteristicQualitativeValue getLastSampleCategoryUsed() { + return lastSampleCategoryUsed; + } + + public void setLastSampleCategoryUsed(CaracteristicQualitativeValue lastSampleCategoryUsed) { + Object oldValue = getLastSampleCategoryUsed(); + this.lastSampleCategoryUsed = lastSampleCategoryUsed; + firePropertyChange(PROPERTY_LAST_SAMPLE_CATEGORY_USED, oldValue, lastSampleCategoryUsed); + } + public Float getBatchWeight() { return batchWeight; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.