Commit 9a5810cd authored by PECQUOT's avatar PECQUOT

[fix] Grouped measurements: automatic calculation and saving into parent beans...

[fix] Grouped measurements: automatic calculation and saving into parent beans has been replaced by unique function executed at observation saving (Mantis #51725 and #51737)
[fix] PIT protocol: section calculation fixed (Mantis #51710)
[fix] Upgrade quadrige3-core to version 3.6.14 (Mantis #51731)
Signed-off-by: PECQUOT's avatarlp1ee9d <ludovic.pecquot@e-is.pro>
parent 8538694d
## Sprint 91 - v3.9.9
- Pas de mise à jour de modèle
## Sprint 90 - v3.9.8 ## Sprint 90 - v3.9.8
- Pas de mise à jour de modèle - Pas de mise à jour de modèle
......
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
<maven.compiler.debug>true</maven.compiler.debug> <maven.compiler.debug>true</maven.compiler.debug>
<!-- Quadrige3 Core version --> <!-- Quadrige3 Core version -->
<quadrige3-core.version>3.6.13</quadrige3-core.version> <quadrige3-core.version>3.6.14-SNAPSHOT</quadrige3-core.version>
<!-- Last ReefDb launcher version --> <!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion> <launcherVersion>3.0.3</launcherVersion>
......
...@@ -24,11 +24,14 @@ package fr.ifremer.reefdb.dto; ...@@ -24,11 +24,14 @@ package fr.ifremer.reefdb.dto;
*/ */
import fr.ifremer.quadrige3.core.dao.referential.UnitId; import fr.ifremer.quadrige3.core.dao.referential.UnitId;
import fr.ifremer.reefdb.dto.data.measurement.MeasurementDTO;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author ludovic.pecquot@e-is.pro on 13/04/2017. * @author ludovic.pecquot@e-is.pro on 13/04/2017.
...@@ -54,4 +57,38 @@ public class ReefDbBeansTest { ...@@ -54,4 +57,38 @@ public class ReefDbBeansTest {
Assert.assertEquals(60, result.intValue()); Assert.assertEquals(60, result.intValue());
} }
@Test
public void testReduce() {
List<MeasurementDTO> beans = new ArrayList<>();
{
MeasurementDTO bean = ReefDbBeanFactory.newMeasurementDTO();
bean.setId(1);
beans.add(bean);
}
{
MeasurementDTO bean = ReefDbBeanFactory.newMeasurementDTO();
bean.setId(-2);
beans.add(bean);
}
{
MeasurementDTO bean = ReefDbBeanFactory.newMeasurementDTO();
bean.setId(null);
beans.add(bean);
}
{
MeasurementDTO bean = ReefDbBeanFactory.newMeasurementDTO();
bean.setId(4);
beans.add(bean);
}
int minNegativeId = beans.stream()
.filter(measurementDTO -> measurementDTO.getId() != null)
.mapToInt(MeasurementDTO::getId)
.min().orElse(0);
Assert.assertEquals(-2, minNegativeId);
}
} }
...@@ -82,10 +82,13 @@ public class SaveAction extends AbstractReefDbSaveAction<ObservationUIModel, Obs ...@@ -82,10 +82,13 @@ public class SaveAction extends AbstractReefDbSaveAction<ObservationUIModel, Obs
return false; return false;
} }
// TODO Must save partial models from tabs // Save partial models from tabs
getUI().getSurveyDetailsTabUI().getHandler().saveActualModel(); getUI().getSurveyDetailsTabUI().getHandler().save();
// getUI().getPrelevementGeneralTabUI().getHandler().saveActualModel(); getUI().getPhotosTabUI().getHandler().save();
getUI().getPhotosTabUI().getHandler().saveActualModel();
// Save and control measurements tabs (Mantis #51725)
getUI().getSurveyMeasurementsTabUI().getHandler().save();
getUI().getOperationMeasurementsTabUI().getHandler().save();
return true; return true;
} }
...@@ -142,11 +145,11 @@ public class SaveAction extends AbstractReefDbSaveAction<ObservationUIModel, Obs ...@@ -142,11 +145,11 @@ public class SaveAction extends AbstractReefDbSaveAction<ObservationUIModel, Obs
public void postSuccessAction() { public void postSuccessAction() {
super.postSuccessAction(); super.postSuccessAction();
getHandler().refreshModels();
// show error messages // show error messages
showControlResult(controlMessages, false); showControlResult(controlMessages, false);
getHandler().refreshModels();
// Postpone model modify state (Mantis #50915) // Postpone model modify state (Mantis #50915)
SwingUtilities.invokeLater(() -> getModel().setModify(false)); SwingUtilities.invokeLater(() -> getModel().setModify(false));
......
...@@ -23,6 +23,7 @@ package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement; ...@@ -23,6 +23,7 @@ package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement;
* #L% * #L%
*/ */
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable; import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
...@@ -56,10 +57,7 @@ import org.nuiton.jaxx.application.swing.tab.TabHandler; ...@@ -56,10 +57,7 @@ import org.nuiton.jaxx.application.swing.tab.TabHandler;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Comparator; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static org.nuiton.i18n.I18n.t; import static org.nuiton.i18n.I18n.t;
...@@ -114,16 +112,16 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -114,16 +112,16 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
// Initialisation des prelevements // Initialisation des prelevements
initBeanFilterableComboBox( initBeanFilterableComboBox(
getUI().getSelectionPrelevementsCombo(), getUI().getSelectionPrelevementsCombo(),
getModel().getSamplings(), getModel().getSamplingOperations(),
getModel().getSampling(), getModel().getSampling(),
DecoratorService.CONCAT); DecoratorService.CONCAT);
// Initialisation des groupe de taxons // Initialisation des groupe de taxons
initBeanFilterableComboBox( initBeanFilterableComboBox(
getUI().getSelectionGroupeTaxonCombo(), getUI().getSelectionGroupeTaxonCombo(),
null, null,
null, DecoratorService.NAME); null, DecoratorService.NAME);
getUI().getSelectionGroupeTaxonCombo().setActionEnabled(getContext().getDataContext().isContextFiltered(FilterTypeValues.TAXON_GROUP)); getUI().getSelectionGroupeTaxonCombo().setActionEnabled(getContext().getDataContext().isContextFiltered(FilterTypeValues.TAXON_GROUP));
getUI().getSelectionGroupeTaxonCombo().setActionListener(e -> { getUI().getSelectionGroupeTaxonCombo().setActionListener(e -> {
...@@ -135,9 +133,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -135,9 +133,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
// Intialisation des taxons // Intialisation des taxons
initBeanFilterableComboBox( initBeanFilterableComboBox(
getUI().getSelectionTaxonCombo(), getUI().getSelectionTaxonCombo(),
null, null,
null); null);
getUI().getSelectionTaxonCombo().setActionEnabled(getContext().getDataContext().isContextFiltered(FilterTypeValues.TAXON)); getUI().getSelectionTaxonCombo().setActionEnabled(getContext().getDataContext().isContextFiltered(FilterTypeValues.TAXON));
getUI().getSelectionTaxonCombo().setActionListener(e -> { getUI().getSelectionTaxonCombo().setActionListener(e -> {
...@@ -180,17 +178,37 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -180,17 +178,37 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
getModel().setAdjusting(false); getModel().setAdjusting(false);
}); });
PropertyChangeListener loadListener = new PropertyChangeListener() {
Map<String, Boolean> eventMap = new HashMap<>(ImmutableMap.of(
OperationMeasurementsUngroupedTableUIModel.EVENT_MEASUREMENTS_LOADED, false,
OperationMeasurementsGroupedTableUIModel.EVENT_INDIVIDUAL_MEASUREMENTS_LOADED, false
));
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (isEventComplete(evt.getPropertyName())) {
// detect if the triplet of PMFM for transition length
detectPmfmForTransitionCalculator();
detectPitPmfmForGridInitialization();
resetEventMap();
}
}
private boolean isEventComplete(String propertyName) {
if (eventMap.containsKey(propertyName))
eventMap.put(propertyName, true);
return eventMap.values().stream().allMatch(aBoolean -> aBoolean);
}
private void resetEventMap() {
eventMap.keySet().forEach(key -> eventMap.put(key, false));
}
};
// add listeners on table models // add listeners on table models
getModel().getUngroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsUngroupedTableUIModel.EVENT_MEASUREMENTS_LOADED, evt -> { getModel().getUngroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsUngroupedTableUIModel.EVENT_MEASUREMENTS_LOADED, loadListener);
// detect if the triplet of PMFM for transition length getModel().getGroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsGroupedTableUIModel.EVENT_INDIVIDUAL_MEASUREMENTS_LOADED, loadListener);
detectPmfmForTransitionCalculator();
detectPitPmfmForGridInitialization();
});
getModel().getGroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsGroupedTableUIModel.EVENT_MEASUREMENTS_LOADED, evt -> {
// detect if the triplet of PMFM for transition length
detectPmfmForTransitionCalculator();
detectPitPmfmForGridInitialization();
});
// Add listeners on PROPERTY_ROWS_IN_ERROR to catch modifications and revalidate // Add listeners on PROPERTY_ROWS_IN_ERROR to catch modifications and revalidate
getModel().getUngroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsUngroupedTableUIModel.PROPERTY_ROWS_IN_ERROR, evt -> { getModel().getUngroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsUngroupedTableUIModel.PROPERTY_ROWS_IN_ERROR, evt -> {
...@@ -218,7 +236,7 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -218,7 +236,7 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
getUI().getSelectionGroupeTaxonCombo().setActionEnabled(!forceNoFilter && getContext().getDataContext().isContextFiltered(FilterTypeValues.TAXON_GROUP)); getUI().getSelectionGroupeTaxonCombo().setActionEnabled(!forceNoFilter && getContext().getDataContext().isContextFiltered(FilterTypeValues.TAXON_GROUP));
List<TaxonGroupDTO> taxonGroups = getModel().getObservationUIHandler().getAvailableTaxonGroups(taxon,forceNoFilter); List<TaxonGroupDTO> taxonGroups = getModel().getObservationUIHandler().getAvailableTaxonGroups(taxon, forceNoFilter);
getUI().getSelectionGroupeTaxonCombo().setData(taxonGroups); getUI().getSelectionGroupeTaxonCombo().setData(taxonGroups);
...@@ -287,7 +305,7 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -287,7 +305,7 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
List<PmfmStrategyDTO> pmfmStrategies = ReefDbBeans.filterCollection(survey.getPmfmStrategies(), input -> input != null && input.isSampling()); List<PmfmStrategyDTO> pmfmStrategies = ReefDbBeans.filterCollection(survey.getPmfmStrategies(), input -> input != null && input.isSampling());
// list available samplings // list available samplings
getUI().getSelectionPrelevementsCombo().setData(getModel().getSamplings()); getUI().getSelectionPrelevementsCombo().setData(getModel().getSamplingOperations());
// Load ungrouped data (up table) // Load ungrouped data (up table)
{ {
...@@ -301,9 +319,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -301,9 +319,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
} }
// Load other Pmfms in sampling operations // Load other Pmfms in sampling operations
if (CollectionUtils.isNotEmpty(getModel().getSamplings())) { if (CollectionUtils.isNotEmpty(getModel().getSamplingOperations())) {
// populate pmfms from strategy to sampling operation and vice versa // populate pmfms from strategy to sampling operation and vice versa
for (SamplingOperationDTO samplingOperation : getModel().getSamplings()) { for (SamplingOperationDTO samplingOperation : getModel().getSamplingOperations()) {
ReefDbBeans.fillListsEachOther(samplingOperation.getPmfms(), pmfms); ReefDbBeans.fillListsEachOther(samplingOperation.getPmfms(), pmfms);
} }
} }
...@@ -330,9 +348,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -330,9 +348,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
} }
// Load other Pmfms in sampling operations // Load other Pmfms in sampling operations
if (CollectionUtils.isNotEmpty(getModel().getSamplings())) { if (CollectionUtils.isNotEmpty(getModel().getSamplingOperations())) {
// populate pmfms from strategy to sampling operation and vice versa // populate pmfms from strategy to sampling operation and vice versa
for (SamplingOperationDTO samplingOperation : getModel().getSamplings()) { for (SamplingOperationDTO samplingOperation : getModel().getSamplingOperations()) {
ReefDbBeans.fillListsEachOther(samplingOperation.getIndividualPmfms(), individualPmfms); ReefDbBeans.fillListsEachOther(samplingOperation.getIndividualPmfms(), individualPmfms);
} }
} }
...@@ -345,8 +363,8 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -345,8 +363,8 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
} }
//update selected sampling //update selected sampling
if (getContext().getSelectedSamplingOperationId() != null && getModel().getSamplings() != null) { if (getContext().getSelectedSamplingOperationId() != null && getModel().getSamplingOperations() != null) {
for (SamplingOperationDTO samplingOperation : getModel().getSamplings()) { for (SamplingOperationDTO samplingOperation : getModel().getSamplingOperations()) {
if (getContext().getSelectedSamplingOperationId().equals(samplingOperation.getId())) { if (getContext().getSelectedSamplingOperationId().equals(samplingOperation.getId())) {
getModel().setSampling(samplingOperation); getModel().setSampling(samplingOperation);
break; break;
...@@ -394,13 +412,13 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -394,13 +412,13 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
private void detectPmfmForTransitionCalculator() { private void detectPmfmForTransitionCalculator() {
if (CollectionUtils.isEmpty(getModel().getUngroupedTableUIModel().getPmfmColumns()) if (CollectionUtils.isEmpty(getModel().getUngroupedTableUIModel().getPmfmColumns())
|| CollectionUtils.isEmpty(getModel().getGroupedTableUIModel().getPmfmColumns())) { || CollectionUtils.isEmpty(getModel().getGroupedTableUIModel().getPmfmColumns())) {
// both tables must have pmfm columns // both tables must have pmfm columns
return; return;
} }
List<Integer[]> transitionLengthPmfmTriplets = getConfig().getCalculatedTransitionLengthPmfmTriplets(); List<Integer[]> transitionLengthPmfmTriplets = getConfig().getCalculatedTransitionLengthPmfmTriplets();
for (Integer[] transitionLengthPmfmTriplet: transitionLengthPmfmTriplets) { for (Integer[] transitionLengthPmfmTriplet : transitionLengthPmfmTriplets) {
int transitionLengthPmfmId = transitionLengthPmfmTriplet[0]; int transitionLengthPmfmId = transitionLengthPmfmTriplet[0];
int startPositionPmfmId = transitionLengthPmfmTriplet[1]; int startPositionPmfmId = transitionLengthPmfmTriplet[1];
...@@ -435,7 +453,6 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -435,7 +453,6 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
getModel().getGroupedTableUIModel().setCalculatedLengthEndPositionPmfmId(endPositionPmfmId); getModel().getGroupedTableUIModel().setCalculatedLengthEndPositionPmfmId(endPositionPmfmId);
getModel().getGroupedTableUIModel().setCalculatedLengthTransitionPmfmId(transitionLengthPmfmId); getModel().getGroupedTableUIModel().setCalculatedLengthTransitionPmfmId(transitionLengthPmfmId);
// set the transition length column non editable // set the transition length column non editable
transitionLengthColumn.setEditable(false); transitionLengthColumn.setEditable(false);
transitionLengthColumn.getPmfmIdentifier().setNotMandatory(); transitionLengthColumn.getPmfmIdentifier().setNotMandatory();
...@@ -450,17 +467,22 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -450,17 +467,22 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
map.put(ungroupedRow.getName(), (BigDecimal) startPositionColumn.getPmfmIdentifier().getValue(ungroupedRow)); map.put(ungroupedRow.getName(), (BigDecimal) startPositionColumn.getPmfmIdentifier().getValue(ungroupedRow));
} }
// Remove previous calculator
if (transitionLengthCalculator != null) {
getModel().getGroupedTableUIModel().removePropertyChangeListener(OperationMeasurementsGroupedTableUIModel.PROPERTY_SAMPLING_OPERATION, transitionLengthCalculator);
}
// create calculator // create calculator
TransitionLengthCalculator calculator = new TransitionLengthCalculator(map, transitionLengthCalculator = new TransitionLengthCalculator(map,
startPositionColumn.getPmfmIdentifier(), startPositionColumn.getPmfmIdentifier(),
endPositionColumn.getPmfmIdentifier(), endPositionColumn.getPmfmIdentifier(),
transitionLengthColumn.getPmfmIdentifier()); transitionLengthColumn.getPmfmIdentifier());
startPositionColumn.getPmfmIdentifier().addPropertyChangeListener(calculator); startPositionColumn.getPmfmIdentifier().addPropertyChangeListener(transitionLengthCalculator);
endPositionColumn.getPmfmIdentifier().addPropertyChangeListener(calculator); endPositionColumn.getPmfmIdentifier().addPropertyChangeListener(transitionLengthCalculator);
// add also property change listener on sampling operation column (when a sampling operation in a row has changed) (Mantis #0027395) // add also property change listener on sampling operation column (when a sampling operation in a row has changed) (Mantis #0027395)
getModel().getGroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsGroupedTableUIModel.PROPERTY_SAMPLING_OPERATION, calculator); getModel().getGroupedTableUIModel().addPropertyChangeListener(OperationMeasurementsGroupedTableUIModel.PROPERTY_SAMPLING_OPERATION, transitionLengthCalculator);
} }
} }
...@@ -533,6 +555,8 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -533,6 +555,8 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
return false; return false;
} }
private TransitionLengthCalculator transitionLengthCalculator;
private class TransitionLengthCalculator implements PropertyChangeListener { private class TransitionLengthCalculator implements PropertyChangeListener {
private final Map<String, BigDecimal> startPositionMap; private final Map<String, BigDecimal> startPositionMap;
...@@ -625,4 +649,25 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O ...@@ -625,4 +649,25 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
getUI().getGroupedTable().getOperationGroupedMeasurementTable().repaint(); getUI().getGroupedTable().getOperationGroupedMeasurementTable().repaint();
} }
} }
public void save() {
try {
// Disable filter
getModel().getUngroupedTableUIModel().setSamplingFilter(null);
getModel().getGroupedTableUIModel().setMeasurementFilter(new MeasurementsFilter());
// save ungrouped measurements
getUI().getUngroupedTable().getHandler().save();
// save grouped measurements
getUI().getGroupedTable().getHandler().save();
} finally {
doSearch();
}
}
} }
...@@ -122,11 +122,11 @@ public class OperationMeasurementsTabUIModel extends AbstractEmptyUIModel<Operat ...@@ -122,11 +122,11 @@ public class OperationMeasurementsTabUIModel extends AbstractEmptyUIModel<Operat
} }
/** /**
* <p>getSamplings.</p> * <p>getSamplingOperations.</p>
* *
* @return a {@link java.util.List} object. * @return a {@link java.util.List} object.
*/ */
public List<SamplingOperationDTO> getSamplings() { public List<SamplingOperationDTO> getSamplingOperations() {
return observationModel == null ? null : (List<SamplingOperationDTO>) observationModel.getSamplingOperations(); return observationModel == null ? null : (List<SamplingOperationDTO>) observationModel.getSamplingOperations();
} }
......
...@@ -24,7 +24,6 @@ package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.gro ...@@ -24,7 +24,6 @@ package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.gro
*/ */
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import fr.ifremer.quadrige3.core.dao.technical.AlphanumericComparator; import fr.ifremer.quadrige3.core.dao.technical.AlphanumericComparator;
import fr.ifremer.quadrige3.ui.swing.table.ColumnIdentifier; import fr.ifremer.quadrige3.ui.swing.table.ColumnIdentifier;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable; import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
...@@ -51,8 +50,6 @@ import javax.swing.RowFilter; ...@@ -51,8 +50,6 @@ import javax.swing.RowFilter;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -226,23 +223,17 @@ public class OperationMeasurementsGroupedTableUIHandler ...@@ -226,23 +223,17 @@ public class OperationMeasurementsGroupedTableUIHandler
// remove measurement from old sampling // remove measurement from old sampling
if (oldValue != null) { if (oldValue != null) {
SamplingOperationDTO oldSamplingOperation = (SamplingOperationDTO) oldValue; SamplingOperationDTO oldSamplingOperation = (SamplingOperationDTO) oldValue;
oldSamplingOperation.removeAllIndividualMeasurements(row.getIndividualMeasurements());
oldSamplingOperation.setDirty(true);
resetIndividualMeasurementIds(row); resetIndividualMeasurementIds(row);
setDirty(oldSamplingOperation);
} }
// recalculate individual id // recalculate individual id
if (newValue != null) { if (newValue != null) {
// affect new sampling operation now // affect new sampling operation now
row.setSamplingOperation((SamplingOperationDTO) newValue); SamplingOperationDTO newSamplingOperation = (SamplingOperationDTO) newValue;
row.setSamplingOperation(newSamplingOperation);
// calculate new individual ids setDirty(newSamplingOperation);
calculateIndividualIds(row);
// fire event for parent listener
getModel().firePropertyChanged(OperationMeasurementsGroupedTableUIModel.PROPERTY_SAMPLING_OPERATION, null, newValue);
} }
} }
...@@ -250,36 +241,6 @@ public class OperationMeasurementsGroupedTableUIHandler ...@@ -250,36 +241,6 @@ public class OperationMeasurementsGroupedTableUIHandler
super.onRowModified(rowIndex, row, propertyName, propertyIndex, oldValue, newValue); super.onRowModified(rowIndex, row, propertyName, propertyIndex, oldValue, newValue);