Commit e0fcf311 authored by PECQUOT's avatar PECQUOT

[enh] Add multiline edition dialog for survey's and operation's grouped...

[enh] Add multiline edition dialog for survey's and operation's grouped measurement tables (Mantis #49615)
Signed-off-by: PECQUOT's avatarlp1ee9d <ludovic.pecquot@e-is.pro>
parent 1ff7fa3f
......@@ -10,7 +10,7 @@
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.9.0</version>
<version>3.9.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Reef DB</name>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.9.0</version>
<version>3.9.1-SNAPSHOT</version>
</parent>
<artifactId>reefdb-core</artifactId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.9.0</version>
<version>3.9.1-SNAPSHOT</version>
</parent>
<artifactId>reefdb-ui-swing</artifactId>
......
......@@ -478,7 +478,7 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
return;
}
// find the 3 columns
// find the transition column
PmfmTableColumn transitionLengthColumn = null;
for (PmfmTableColumn column : getModel().getGroupedTableUIModel().getPmfmColumns()) {
......
......@@ -51,7 +51,7 @@ public class OperationMeasurementsGroupedRowModel
*
* @param readOnly a boolean.
*/
OperationMeasurementsGroupedRowModel(boolean readOnly) {
public OperationMeasurementsGroupedRowModel(boolean readOnly) {
super(readOnly);
}
......
......@@ -29,6 +29,7 @@ import fr.ifremer.reefdb.dto.data.survey.SurveyDTO;
import fr.ifremer.reefdb.dto.referential.TaxonDTO;
import fr.ifremer.reefdb.dto.referential.TaxonGroupDTO;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsGroupedTableModel;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsGroupedTableUIModel;
import fr.ifremer.reefdb.ui.swing.util.table.ReefDbColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
......@@ -48,6 +49,12 @@ public class OperationMeasurementsGroupedTableModel extends AbstractMeasurements
n("reefdb.samplingOperation.measurement.mnemonic.tip"),
SamplingOperationDTO.class, true);
public static final ReefDbColumnIdentifier<OperationMeasurementsGroupedRowModel> SAMPLING_READ_ONLY = ReefDbColumnIdentifier.newReadOnlyId(
OperationMeasurementsGroupedRowModel.PROPERTY_SAMPLING_OPERATION,
n("reefdb.property.mnemonic"),
n("reefdb.samplingOperation.measurement.mnemonic.tip"),
SamplingOperationDTO.class);
/**
* Identifiant pour la colonne groupe taxon.
*/
......@@ -70,7 +77,7 @@ public class OperationMeasurementsGroupedTableModel extends AbstractMeasurements
/**
* Identifiant pour la colonne taxon saisi.
*/
public static final ReefDbColumnIdentifier<OperationMeasurementsGroupedRowModel> INPUT_TAXON_NAME = ReefDbColumnIdentifier.newReadOnlyId(
public static final ReefDbColumnIdentifier<OperationMeasurementsGroupedRowModel> INPUT_TAXON_NAME = ReefDbColumnIdentifier.newId(
OperationMeasurementsGroupedRowModel.PROPERTY_INPUT_TAXON_NAME,
n("reefdb.property.inputTaxon"),
n("reefdb.samplingOperation.measurement.inputTaxon.tip"),
......@@ -90,8 +97,8 @@ public class OperationMeasurementsGroupedTableModel extends AbstractMeasurements
*
* @param columnModel Le modele pour les colonnes
*/
public OperationMeasurementsGroupedTableModel(final TableColumnModelExt columnModel) {
super(columnModel);
public OperationMeasurementsGroupedTableModel(final TableColumnModelExt columnModel, boolean createNewRow) {
super(columnModel, createNewRow);
}
/**
......@@ -119,8 +126,8 @@ public class OperationMeasurementsGroupedTableModel extends AbstractMeasurements
* {@inheritDoc}
*/
@Override
public OperationMeasurementsGroupedTableUIModel getTableUIModel() {
return (OperationMeasurementsGroupedTableUIModel) super.getTableUIModel();
public AbstractMeasurementsGroupedTableUIModel getTableUIModel() {
return (AbstractMeasurementsGroupedTableUIModel) super.getTableUIModel();
}
/**
......
......@@ -62,6 +62,7 @@
<JButton id='addButton' alignmentX='{Component.CENTER_ALIGNMENT}' onActionPerformed="model.insertNewRowAfterSelected()"/>
<JButton id='duplicateButton' alignmentX='{Component.CENTER_ALIGNMENT}'/>
<JButton id='initDataGridButton' alignmentX='{Component.CENTER_ALIGNMENT}' onActionPerformed="handler.initializeDataGrid()"/>
<JButton id='multiEditButton' alignmentX='{Component.CENTER_ALIGNMENT}' onActionPerformed="handler.editSelectedMeasurements()"/>
<JButton id='deleteButton' alignmentX='{Component.CENTER_ALIGNMENT}' onActionPerformed="handler.removeIndividualMeasurements()"/>
</JPanel>
<JPanel constraints="BorderLayout.LINE_END">
......
......@@ -63,6 +63,13 @@
enabled: {model.getSurvey().isEditable() && model.isTransitionGridInitializationEnabled() && !model.getPmfms().isEmpty()};
}
#multiEditButton {
actionIcon: edit;
text: "reefdb.common.edit";
toolTipText: "reefdb.measurement.grouped.multiEdit.tip";
enabled: {model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && (model.getSelectedRows().size() >= 2) && !model.getPmfms().isEmpty()};
}
#tableBlockLayer {
blockingColor: {handler.getConfig().getColorBlockingLayer()};
block:{model.isLoading()};
......
......@@ -37,6 +37,7 @@ import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import fr.ifremer.reefdb.service.ReefDbTechnicalException;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.initGrid.InitGridUI;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.initGrid.InitGridUIModel;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.multiedit.OperationMeasurementsMultiEditUI;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsGroupedTableModel;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsGroupedTableUIHandler;
import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbTableUIModel;
......@@ -321,7 +322,7 @@ public class OperationMeasurementsGroupedTableUIHandler
final TableColumnExt colComment = addCommentColumn(OperationMeasurementsGroupedTableModel.COMMENT);
// Modele de la table
final OperationMeasurementsGroupedTableModel tableModel = new OperationMeasurementsGroupedTableModel(getTable().getColumnModel());
final OperationMeasurementsGroupedTableModel tableModel = new OperationMeasurementsGroupedTableModel(getTable().getColumnModel(), true);
tableModel.setNoneEditableCols();
getTable().setModel(tableModel);
......@@ -457,6 +458,19 @@ public class OperationMeasurementsGroupedTableUIHandler
samplingOperation.equals(row.getSamplingOperation()) && nextIndividualId.get() == row.getIndividualId()));
}
public void editSelectedMeasurements() {
OperationMeasurementsMultiEditUI editUI = new OperationMeasurementsMultiEditUI(getUI());
// add the calculated transition pmfm as read-only
if (getModel().getTransitionLengthPmfmId() != null) {
editUI.getModel().getReadOnlyPmfmIds().add(getModel().getTransitionLengthPmfmId());
}
editSelectedMeasurements(editUI);
}
static class SamplingOperationComparator implements Comparator<SamplingOperationDTO> {
AlphanumericComparator delegate;
......
<!--
#%L
Reef DB :: UI
$Id:$
$HeadURL:$
%%
Copyright (C) 2014 - 2015 Ifremer
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
<JDialog id="operationMeasurementsMultiEditUI" layout="{new BorderLayout()}"
implements='fr.ifremer.reefdb.ui.swing.util.ReefDbUI&lt;OperationMeasurementsMultiEditUIModel, OperationMeasurementsMultiEditUIHandler&gt;'>
<import>
fr.ifremer.reefdb.ui.swing.ReefDbHelpBroker
fr.ifremer.reefdb.ui.swing.ReefDbUIContext
fr.ifremer.reefdb.ui.swing.util.ReefDbUI
fr.ifremer.quadrige3.ui.swing.ApplicationUI
fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil
java.awt.FlowLayout
javax.swing.Box
javax.swing.BoxLayout
java.awt.BorderLayout
fr.ifremer.quadrige3.ui.swing.table.SwingTable
static org.nuiton.i18n.I18n.*
</import>
<OperationMeasurementsMultiEditUIModel id='model' initializer='getContextValue(OperationMeasurementsMultiEditUIModel.class)'/>
<script><![CDATA[
public OperationMeasurementsMultiEditUI(ApplicationUI parentUI) {
ApplicationUIUtil.setParentUI(this, parentUI);
}
]]></script>
<JPanel layout="{new BorderLayout()}">
<JScrollPane id="scrollPane" decorator='boxed' border="{null}">
<SwingTable id="operationGroupedMeasurementMultiEditTable"/>
</JScrollPane>
</JPanel>
<JPanel layout="{new GridLayout(1,0)}" constraints='BorderLayout.PAGE_END'>
<JButton id="cancelButton" onActionPerformed='handler.cancel()'/>
<JButton id="validButton" onActionPerformed='handler.valid()'/>
</JPanel>
</JDialog>
\ No newline at end of file
/*
* #%L
* Reef DB :: UI
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2014 - 2015 Ifremer
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
#operationMeasurementsMultiEditUI {
modal: true;
resizable: false;
title: "reefdb.measurement.grouped.multiEdit.title";
}
#cancelButton {
actionIcon: cancel;
text: "reefdb.common.cancel";
toolTipText: "reefdb.common.cancel";
i18nMnemonic: "reefdb.common.cancel.mnemonic";
}
#validButton {
actionIcon: accept;
text: "reefdb.common.validate";
toolTipText: "reefdb.common.validate";
i18nMnemonic: "reefdb.common.validate.mnemonic";
enabled: {model.isValid() && model.isModify()};
}
\ No newline at end of file
package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.multiedit;
/*
* #%L
* Reef DB :: UI
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2014 - 2015 Ifremer
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
import fr.ifremer.quadrige3.ui.swing.table.ColumnIdentifier;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
import fr.ifremer.reefdb.dto.data.measurement.MeasurementAware;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedRowModel;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedTableModel;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedTableUI;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsGroupedTableModel;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsMultiEditUIHandler;
import org.jdesktop.swingx.table.TableColumnExt;
import org.nuiton.jaxx.application.swing.util.Cancelable;
/**
* Controleur pour les mesures de l'observation.
*/
public class OperationMeasurementsMultiEditUIHandler
extends AbstractMeasurementsMultiEditUIHandler<OperationMeasurementsGroupedRowModel, OperationMeasurementsMultiEditUIModel, OperationMeasurementsMultiEditUI>
implements Cancelable {
/**
* <p>Constructor for OperationMeasurementsMultiEditUIHandler.</p>
*/
public OperationMeasurementsMultiEditUIHandler() {
super();
}
/**
* {@inheritDoc}
*/
@Override
public AbstractMeasurementsGroupedTableModel<OperationMeasurementsGroupedRowModel> getTableModel() {
return (OperationMeasurementsGroupedTableModel) getTable().getModel();
}
@Override
protected OperationMeasurementsMultiEditUIModel createNewModel() {
return new OperationMeasurementsMultiEditUIModel();
}
@Override
protected OperationMeasurementsGroupedRowModel createNewRow(boolean readOnly, MeasurementAware parentBean) {
return new OperationMeasurementsGroupedRowModel(readOnly);
}
/**
* {@inheritDoc}
*/
@Override
public SwingTable getTable() {
return getUI().getOperationGroupedMeasurementMultiEditTable();
}
@Override
protected SwingTable getReferentTable() {
return ((OperationMeasurementsGroupedTableUI) ApplicationUIUtil.getParentUI(getUI())).getOperationGroupedMeasurementTable();
}
/**
* Initialisation du tableau.
*/
@Override
protected void initTable() {
final TableColumnExt samplingCol = addColumn(OperationMeasurementsGroupedTableModel.SAMPLING_READ_ONLY);
samplingCol.setEditable(false);
// Colonne groupe taxon
addColumn(
taxonGroupCellEditor,
newTableCellRender(OperationMeasurementsGroupedTableModel.TAXON_GROUP),
OperationMeasurementsGroupedTableModel.TAXON_GROUP);
// Colonne taxon
addColumn(
taxonCellEditor,
newTableCellRender(OperationMeasurementsGroupedTableModel.TAXON),
OperationMeasurementsGroupedTableModel.TAXON);
// Colonne taxon saisi
final TableColumnExt colInputTaxon = addColumn(OperationMeasurementsGroupedTableModel.INPUT_TAXON_NAME);
colInputTaxon.setEditable(false);
// Colonne analyste
addColumn(
departmentCellEditor,
newTableCellRender(AbstractMeasurementsGroupedTableModel.ANALYST),
(ColumnIdentifier<OperationMeasurementsGroupedRowModel>) AbstractMeasurementsGroupedTableModel.ANALYST);
// No comment column because comment editor is also a JDialog
// final TableColumnExt colComment = addCommentColumn(OperationMeasurementsGroupedTableModel.COMMENT);
// Modele de la table
final OperationMeasurementsGroupedTableModel tableModel = new OperationMeasurementsGroupedTableModel(getTable().getColumnModel(), false);
tableModel.setNoneEditableCols();
getTable().setModel(tableModel);
// Initialisation de la table
initTable(getTable());
// border
addEditionPanelBorder();
}
}
package fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.multiedit;
/*
* #%L
* Reef DB :: UI
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2014 - 2015 Ifremer
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
import com.google.common.collect.ImmutableSet;
import fr.ifremer.reefdb.dto.data.measurement.MeasurementDTO;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedRowModel;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedTableModel;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsGroupedTableModel;
import fr.ifremer.reefdb.ui.swing.content.observation.shared.AbstractMeasurementsMultiEditUIModel;
import fr.ifremer.reefdb.ui.swing.util.table.ReefDbColumnIdentifier;
import java.util.Set;
public class OperationMeasurementsMultiEditUIModel
extends AbstractMeasurementsMultiEditUIModel<MeasurementDTO, OperationMeasurementsGroupedRowModel, OperationMeasurementsMultiEditUIModel> {
@Override
public Set<ReefDbColumnIdentifier<OperationMeasurementsGroupedRowModel>> getIdentifiersToCheck() {
return ImmutableSet.of(
OperationMeasurementsGroupedTableModel.SAMPLING_READ_ONLY, // use this read-only (and not mandatory) version of SAMPLING
OperationMeasurementsGroupedTableModel.TAXON_GROUP,
OperationMeasurementsGroupedTableModel.TAXON,
OperationMeasurementsGroupedTableModel.INPUT_TAXON_NAME,
(ReefDbColumnIdentifier<OperationMeasurementsGroupedRowModel>) AbstractMeasurementsGroupedTableModel.ANALYST
);
}
}
......@@ -26,7 +26,6 @@ package fr.ifremer.reefdb.ui.swing.content.observation.shared;
import com.google.common.collect.Lists;
import fr.ifremer.quadrige3.core.dao.technical.factorization.pmfm.AllowedQualitativeValuesMap;
import fr.ifremer.quadrige3.ui.core.dto.CommentAware;
import fr.ifremer.quadrige3.ui.core.dto.QuadrigeBean;
import fr.ifremer.quadrige3.ui.swing.table.ColumnIdentifier;
import fr.ifremer.reefdb.dto.ErrorAware;
import fr.ifremer.reefdb.dto.ErrorDTO;
......@@ -46,7 +45,7 @@ import java.util.stream.Collectors;
/**
* @author peck7 on 08/01/2019.
*/
public abstract class AbstractMeasurementsGroupedRowModel<B extends QuadrigeBean, R extends AbstractMeasurementsGroupedRowModel<B, R>>
public abstract class AbstractMeasurementsGroupedRowModel<B extends MeasurementDTO, R extends AbstractMeasurementsGroupedRowModel<B, R>>
extends AbstractReefDbRowUIModel<B, R> implements CommentAware, MeasurementAware, ErrorAware {
public static String PROPERTY_INDIVIDUAL_ID = "individualId";
......@@ -75,7 +74,8 @@ public abstract class AbstractMeasurementsGroupedRowModel<B extends QuadrigeBean
private final AllowedQualitativeValuesMap allowedQualitativeValuesMap;
private final List<ErrorDTO> preconditionErrors;
private List<ColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel>> multipleValuesOnIdentifier;
// used with multi edit model
private List<ColumnIdentifier<? extends R>> multipleValuesOnIdentifier;
private List<Integer> multipleValuesOnPmfmIds;
/**
......@@ -294,11 +294,11 @@ public abstract class AbstractMeasurementsGroupedRowModel<B extends QuadrigeBean
return preconditionErrors;
}
public List<ColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel>> getMultipleValuesOnIdentifier() {
public List<ColumnIdentifier<? extends R>> getMultipleValuesOnIdentifier() {
return multipleValuesOnIdentifier;
}
public void addMultipleValuesOnIdentifier(ColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel> identifier) {
public void addMultipleValuesOnIdentifier(ColumnIdentifier<? extends R> identifier) {
multipleValuesOnIdentifier.add(identifier);
}
......
......@@ -23,6 +23,7 @@ package fr.ifremer.reefdb.ui.swing.content.observation.shared;
* #L%
*/
import fr.ifremer.reefdb.dto.data.measurement.MeasurementDTO;
import fr.ifremer.reefdb.dto.referential.DepartmentDTO;
import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbTableModel;
import fr.ifremer.reefdb.ui.swing.util.table.ReefDbColumnIdentifier;
......@@ -33,19 +34,19 @@ import static org.nuiton.i18n.I18n.n;
/**
* @author peck7 on 08/01/2019.
*/
public abstract class AbstractMeasurementsGroupedTableModel<R extends AbstractMeasurementsGroupedRowModel<?, ?>>
public abstract class AbstractMeasurementsGroupedTableModel<R extends AbstractMeasurementsGroupedRowModel<MeasurementDTO, ?>>
extends AbstractReefDbTableModel<R> {
/**
* Identifiant pour la colonne analyst.
*/
public static final ReefDbColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel> ANALYST = ReefDbColumnIdentifier.newId(
public static final ReefDbColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel<MeasurementDTO, ?>> ANALYST = ReefDbColumnIdentifier.newId(
AbstractMeasurementsGroupedRowModel.PROPERTY_ANALYST,
n("reefdb.property.analyst"),
n("reefdb.measurement.analyst.tip"),
DepartmentDTO.class);
public static final ReefDbColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel> INDIVIDUAL_ID = ReefDbColumnIdentifier.newReadOnlyId(
public static final ReefDbColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel<MeasurementDTO, ?>> INDIVIDUAL_ID = ReefDbColumnIdentifier.newReadOnlyId(
AbstractMeasurementsGroupedRowModel.PROPERTY_INDIVIDUAL_ID,
n("reefdb.property.individualId"),
n("reefdb.property.individualId"),
......@@ -56,8 +57,8 @@ public abstract class AbstractMeasurementsGroupedTableModel<R extends AbstractMe
*
* @param columnModel a {@link TableColumnModelExt} object.
*/
public AbstractMeasurementsGroupedTableModel(TableColumnModelExt columnModel) {
super(columnModel, true, false);
public AbstractMeasurementsGroupedTableModel(TableColumnModelExt columnModel, boolean createNewRow) {
super(columnModel, createNewRow, false);
}
public abstract ReefDbColumnIdentifier<R> getPmfmInsertPosition();
......
......@@ -49,6 +49,7 @@ import fr.ifremer.reefdb.dto.referential.TaxonDTO;
import fr.ifremer.reefdb.dto.referential.TaxonGroupDTO;
import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import fr.ifremer.reefdb.dto.referential.pmfm.QualitativeValueDTO;
import fr.ifremer.reefdb.ui.swing.content.observation.operation.measurement.grouped.OperationMeasurementsGroupedRowModel;
import fr.ifremer.reefdb.ui.swing.util.ReefDbUI;
import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbTableUIHandler;
import fr.ifremer.reefdb.ui.swing.util.table.PmfmTableColumn;
......@@ -59,7 +60,12 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.Insets;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
......@@ -71,8 +77,8 @@ import static org.nuiton.i18n.I18n.t;
* @author peck7 on 08/01/2019.
*/
public abstract class AbstractMeasurementsGroupedTableUIHandler<
R extends AbstractMeasurementsGroupedRowModel<?, R>,
M extends AbstractMeasurementsGroupedTableUIModel<?, R, M>,
R extends AbstractMeasurementsGroupedRowModel<MeasurementDTO, R>,
M extends AbstractMeasurementsGroupedTableUIModel<MeasurementDTO, R, M>,
UI extends ReefDbUI<M, ?>>
extends AbstractReefDbTableUIHandler<R, M, UI> {
......@@ -611,6 +617,10 @@ public abstract class AbstractMeasurementsGroupedTableUIHandler<
}
private void setDirty(Object bean) {
if (bean instanceof DirtyAware) ((DirtyAware) bean).setDirty(true);
}
protected void updateMeasurementFromRow(MeasurementDTO measurement, R row) {
measurement.setIndividualId(row.getIndividualId());
measurement.setTaxonGroup(row.getTaxonGroup());
......@@ -1101,12 +1111,92 @@ public abstract class AbstractMeasurementsGroupedTableUIHandler<
}
}
/*
Private methods
/**
* Open the multiline edit dialog (Mantis #49615)
*
* @param dialog the dialog to open
*/
protected void editSelectedMeasurements(JDialog dialog) {
// save current table state to be able to restore it in dialog's table
saveTableInSwingSession();
Assert.isInstanceOf(ReefDbUI.class, dialog);
ReefDbUI<?, ?> multiEditUI = (ReefDbUI<?, ?>) dialog;
Assert.isInstanceOf(AbstractMeasurementsMultiEditUIModel.class, multiEditUI.getModel());
AbstractMeasurementsMultiEditUIModel<MeasurementDTO, R, ?> multiEditModel = (AbstractMeasurementsMultiEditUIModel<MeasurementDTO, R, ?>) multiEditUI.getModel();
multiEditModel.setObservationHandler(getModel().getObservationUIHandler());
multiEditModel.setRowsToEdit(getModel().getSelectedRows());
multiEditModel.setPmfms(getModel().getPmfms());