[tutti] branch develop updated (4ab3ac4 -> 0783eb2)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository tutti. See http://git.codelutin.com/tutti.git from 4ab3ac4 fixes #5803: [AIDE] le lien https://doc.codelutin.com/tutti/tutti-ui-swing derrière Aide/Site est inaccessible new 0783eb2 fixes #5800: [CAPTURE] bug création espèce VRAC HVRAC quand modification de la catégorisation dans le tableau 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 0783eb20c41bad9b2f46312e769367bda94e7bfa Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Sep 15 18:34:10 2014 +0200 fixes #5800: [CAPTURE] bug création espèce VRAC HVRAC quand modification de la catégorisation dans le tableau Summary of changes: .../operation/catches/EditCatchesUIModel.java | 9 +++++++++ .../operation/catches/SampleCategoryAble.java | 2 ++ .../catches/SampleCategoryColumnIdentifier.java | 7 +++++++ .../catches/benthos/BenthosBatchRowModel.java | 7 +++++++ .../catches/benthos/BenthosBatchTableModel.java | 16 ++++++++++----- .../catches/benthos/BenthosBatchUIHandler.java | 23 +++++++++++++++------- .../catches/species/SpeciesBatchRowModel.java | 7 +++++++ .../catches/species/SpeciesBatchTableModel.java | 16 ++++++++++----- .../catches/species/SpeciesBatchUIHandler.java | 19 ++++++++++++++---- 9 files changed, 85 insertions(+), 21 deletions(-) -- 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 develop in repository tutti. See http://git.codelutin.com/tutti.git commit 0783eb20c41bad9b2f46312e769367bda94e7bfa Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Sep 15 18:34:10 2014 +0200 fixes #5800: [CAPTURE] bug création espèce VRAC HVRAC quand modification de la catégorisation dans le tableau --- .../operation/catches/EditCatchesUIModel.java | 9 +++++++++ .../operation/catches/SampleCategoryAble.java | 2 ++ .../catches/SampleCategoryColumnIdentifier.java | 7 +++++++ .../catches/benthos/BenthosBatchRowModel.java | 7 +++++++ .../catches/benthos/BenthosBatchTableModel.java | 16 ++++++++++----- .../catches/benthos/BenthosBatchUIHandler.java | 23 +++++++++++++++------- .../catches/species/SpeciesBatchRowModel.java | 7 +++++++ .../catches/species/SpeciesBatchTableModel.java | 16 ++++++++++----- .../catches/species/SpeciesBatchUIHandler.java | 19 ++++++++++++++---- 9 files changed, 85 insertions(+), 21 deletions(-) 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 b277c13..d224692 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 @@ -382,6 +382,15 @@ public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<CatchBatch, Edi return speciesUsed; } + public void replaceCaracteristicValue(Species species, + CaracteristicQualitativeValue oldValue, + CaracteristicQualitativeValue newValue) { + + speciesUsed.remove(oldValue, species); + speciesUsed.put(newValue, species); + + } + public Multimap<CaracteristicQualitativeValue, CaracteristicQualitativeValue> getMarineLitterCategoriesUsed() { return marineLitterCategoriesUsed; } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryAble.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryAble.java index be4c653..b3cd28b 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryAble.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryAble.java @@ -46,6 +46,8 @@ public interface SampleCategoryAble<E extends SampleCategoryAble> extends Iterab SampleCategory<?> getSampleCategoryByIndex(int sampleCategoryIndex); + Serializable getSampleCategoryValue(Integer sampleCategoryId); + void setSampleCategoryValue(Integer sampleCategoryId, Serializable value); void setSampleCategoryWeight(Integer sampleCategoryId, Object value); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java index 7bb2cf9..46a901e 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java @@ -66,6 +66,13 @@ public class SampleCategoryColumnIdentifier<R extends SampleCategoryAble> extend entry.setSampleCategoryWeight(getSampleCategoryId(), value); } + public Serializable getCategoryValue(R entry) { + + Serializable value = entry.getSampleCategoryValue(getSampleCategoryId()); + return value; + + } + public void setCategoryValue(R entry, Serializable value) { entry.setSampleCategoryValue(getSampleCategoryId(), value); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java index d60e123..0746823 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java @@ -496,6 +496,13 @@ public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, } @Override + public Serializable getSampleCategoryValue(Integer sampleCategoryId) { + SampleCategory<?> sampleCategory = getSampleCategoryById(sampleCategoryId); + Serializable result = (Serializable) JavaBeanObjectUtil.getProperty(sampleCategory, SampleCategory.PROPERTY_CATEGORY_VALUE); + return result; + } + + @Override public void setSampleCategoryValue(Integer sampleCategoryId, Serializable value) { SampleCategory<?> sampleCategory = getSampleCategoryById(sampleCategoryId); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java index 11b0fa1..300023a 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java @@ -25,16 +25,16 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryColumnIdentifier; -import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.table.TableColumnModelExt; +import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; +import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; import javax.swing.table.TableColumn; import java.io.Serializable; @@ -326,20 +326,26 @@ public class BenthosBatchTableModel extends AbstractApplicationTableModel<Bentho * @param row the row to walk through * @param columnIndex index of the column where the sample category is * @param newValue new sample category value to set + * @return the old category value replaced by the new one * @since 2.6 */ - public void updateSampleCategorieValue(BenthosBatchRowModel row, - int columnIndex, - Serializable newValue) { + public Serializable updateSampleCategorieValue(BenthosBatchRowModel row, + int columnIndex, + Serializable newValue) { SampleCategoryColumnIdentifier<BenthosBatchRowModel> identifier = (SampleCategoryColumnIdentifier<BenthosBatchRowModel>) getIdentifier(columnIndex); + Serializable oldValue = identifier.getCategoryValue(row); + // set category value identifier.setCategoryValue(row, newValue); // update row shell updateShell(row, columnIndex); + + return oldValue; + } /** 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 ba3674b..07e9b0f 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 @@ -68,8 +68,6 @@ import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentCellRenderer; import fr.ifremer.tutti.ui.swing.util.comment.CommentCellEditor; import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer; import fr.ifremer.tutti.ui.swing.util.computable.ComputableDataTableCell; -import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI; -import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel; import fr.ifremer.tutti.util.Weights; import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.editor.NumberEditor; @@ -100,7 +98,6 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; @@ -1162,7 +1159,9 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent String categoryDecorated = decorate(caracteristic, DecoratorService.CARACTERISTIC_PARAMETER_ONLY); String dialogTitle = t("tutti.editBenthosBatch.title.changeSampleCategoryValue", categoryDecorated); - if (caracteristic.isNumericType()) { + boolean numericType = caracteristic.isNumericType(); + + if (numericType) { // open a simple number editor NumberEditor editor = new NumberEditor(); @@ -1237,13 +1236,23 @@ public class BenthosBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Bent if (selectedItem != null) { // update rows values - tableModel.updateSampleCategorieValue(firstAncestorRow, - columnIndex, - selectedItem); + Serializable oldValue = tableModel.updateSampleCategorieValue(firstAncestorRow, + columnIndex, + selectedItem); // save the first ancestor row with the modified category value saveRow(firstAncestorRow); + + if (!numericType) { + + // update speciesUsed cache + EditCatchesUIModel createBatchModel = ui.getParentContainer(EditCatchesUI.class).getModel(); + createBatchModel.replaceCaracteristicValue(firstAncestorRow.getSpecies(), (CaracteristicQualitativeValue) oldValue, (CaracteristicQualitativeValue) selectedItem); + + } + } + } public void splitBatch(SampleCategoryModelEntry sampleCategoryDef, diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java index f37cff6..3aae78b 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java @@ -488,6 +488,13 @@ public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, } @Override + public Serializable getSampleCategoryValue(Integer sampleCategoryId) { + SampleCategory<?> sampleCategory = getSampleCategoryById(sampleCategoryId); + Serializable result = (Serializable) JavaBeanObjectUtil.getProperty(sampleCategory, SampleCategory.PROPERTY_CATEGORY_VALUE); + return result; + } + + @Override public void setSampleCategoryValue(Integer sampleCategoryId, Serializable value) { SampleCategory<?> sampleCategory = getSampleCategoryById(sampleCategoryId); diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java index cc962b6..1ed02e4 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java @@ -25,16 +25,16 @@ package fr.ifremer.tutti.ui.swing.content.operation.catches.species; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; import fr.ifremer.tutti.persistence.entities.data.SampleCategory; import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.type.WeightUnit; import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryColumnIdentifier; -import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.table.TableColumnModelExt; +import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; +import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; import javax.swing.table.TableColumn; import java.io.Serializable; @@ -325,20 +325,26 @@ public class SpeciesBatchTableModel extends AbstractApplicationTableModel<Specie * @param row the row to walk through * @param columnIndex index of the column where the sample category is * @param newValue new sample category value to set + * @return the old category value replaced by the new one * @since 2.6 */ - public void updateSampleCategorieValue(SpeciesBatchRowModel row, - int columnIndex, - Serializable newValue) { + public Serializable updateSampleCategorieValue(SpeciesBatchRowModel row, + int columnIndex, + Serializable newValue) { SampleCategoryColumnIdentifier<SpeciesBatchRowModel> identifier = (SampleCategoryColumnIdentifier<SpeciesBatchRowModel>) getIdentifier(columnIndex); + Serializable oldValue = identifier.getCategoryValue(row); + // set category value identifier.setCategoryValue(row, newValue); // update row shell updateShell(row, columnIndex); + + return oldValue; + } /** diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java index 68f6755..13bfa76 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java @@ -1119,7 +1119,9 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec String categoryDecorated = decorate(caracteristic, DecoratorService.CARACTERISTIC_PARAMETER_ONLY); String dialogTitle = t("tutti.editSpeciesBatch.title.changeSampleCategoryValue", categoryDecorated); - if (caracteristic.isNumericType()) { + boolean numericType = caracteristic.isNumericType(); + + if (numericType) { // open a simple number editor NumberEditor editor = new NumberEditor(); @@ -1194,12 +1196,21 @@ public class SpeciesBatchUIHandler extends AbstractTuttiBatchTableUIHandler<Spec if (selectedItem != null) { // update rows values - tableModel.updateSampleCategorieValue(firstAncestorRow, - columnIndex, - selectedItem); + Serializable oldValue = tableModel.updateSampleCategorieValue(firstAncestorRow, + columnIndex, + selectedItem); // save the first ancestor row with the modified category value saveRow(firstAncestorRow); + + if (!numericType) { + + // update speciesUsed cache + EditCatchesUIModel createBatchModel = ui.getParentContainer(EditCatchesUI.class).getModel(); + createBatchModel.replaceCaracteristicValue(firstAncestorRow.getSpecies(), (CaracteristicQualitativeValue) oldValue, (CaracteristicQualitativeValue) selectedItem); + + } + } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm