Commit bb8385b3 authored by PECQUOT's avatar PECQUOT

[enh] Multi line edition for survey grouped measurements TO BE CONTINUED (Mantis #49615)

the button is hidden for the moment ...
Signed-off-by: PECQUOT's avatarlp1ee9d <ludovic.pecquot@e-is.pro>
parent 7940333d
......@@ -53,6 +53,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.util.DateUtil;
import javax.annotation.Nonnull;
import java.sql.Array;
import java.sql.SQLException;
import java.time.format.DateTimeFormatter;
......@@ -177,8 +178,8 @@ public class ReefDbBeans extends QuadrigeBeans {
} else if (bean instanceof ExtractionPeriodDTO) {
ExtractionPeriodDTO period = (ExtractionPeriodDTO) bean;
return Dates.formatDate(period.getStartDate(), DEFAULT_DATE_FORMAT)
+ " => "
+ Dates.formatDate(period.getEndDate(), DEFAULT_DATE_FORMAT);
+ " => "
+ Dates.formatDate(period.getEndDate(), DEFAULT_DATE_FORMAT);
}
return bean.toString();
......@@ -496,16 +497,30 @@ public class ReefDbBeans extends QuadrigeBeans {
public static boolean haveSameMeasurements(Collection<MeasurementDTO> measurements, Collection<MeasurementDTO> otherMeasurements) {
List<Integer> pmfmIds = measurements.stream()
.filter(measurement -> !isMeasurementEmpty(measurement))
.map(measurement -> measurement.getPmfm().getId())
.collect(Collectors.toList());
.filter(measurement -> !isMeasurementEmpty(measurement))
.map(measurement -> measurement.getPmfm().getId())
.collect(Collectors.toList());
List<Integer> otherPmfmIds = otherMeasurements.stream()
.filter(measurement -> !isMeasurementEmpty(measurement))
.map(measurement -> measurement.getPmfm().getId())
.collect(Collectors.toList());
.filter(measurement -> !isMeasurementEmpty(measurement))
.map(measurement -> measurement.getPmfm().getId())
.collect(Collectors.toList());
return pmfmIds.containsAll(otherPmfmIds) && otherPmfmIds.containsAll(pmfmIds);
}
/**
* Compare measurement values only (not pmfm or other propoerty)
*
* @param measurement1 first measurement
* @param measurement2 second measurement
* @return true if their values are equals or null
*/
public static boolean measurementValuesEquals(@Nonnull MeasurementDTO measurement1, @Nonnull MeasurementDTO measurement2) {
return (measurement1.getNumericalValue() == null && measurement2.getNumericalValue() == null
&& measurement1.getQualitativeValue() == null && measurement2.getQualitativeValue() == null)
|| (measurement1.getNumericalValue() != null && measurement1.getNumericalValue().equals(measurement2.getNumericalValue()))
|| (measurement1.getQualitativeValue() != null && measurement1.getQualitativeValue().equals(measurement2.getQualitativeValue()));
}
/**
* Get the unified comments from all individual measurements
*
......@@ -642,9 +657,9 @@ public class ReefDbBeans extends QuadrigeBeans {
return new ArrayList<>();
}
return filterCollection(bean.getErrors(), error -> error.isError()
&& (controlOnly == null || (controlOnly == error.isControl()))
&& error.containsPropertyName(propertyName)
&& (pmfmId == null || pmfmId.equals(error.getPmfmId())));
&& (controlOnly == null || (controlOnly == error.isControl()))
&& error.containsPropertyName(propertyName)
&& (pmfmId == null || pmfmId.equals(error.getPmfmId())));
}
/**
......@@ -694,14 +709,14 @@ public class ReefDbBeans extends QuadrigeBeans {
*/
public static List<ErrorDTO> getWarnings(ErrorAware bean, final String propertyName, final Integer pmfmId, final Boolean controlOnly) {
if (bean == null || CollectionUtils.isEmpty(bean.getErrors())
// if an error is found, return empty list because error is priority
|| !getErrors(bean, propertyName, pmfmId, controlOnly).isEmpty()) {
// if an error is found, return empty list because error is priority
|| !getErrors(bean, propertyName, pmfmId, controlOnly).isEmpty()) {
return new ArrayList<>();
}
return filterCollection(bean.getErrors(), error -> error.isWarning()
&& (controlOnly == null || (controlOnly == error.isControl()))
&& error.containsPropertyName(propertyName)
&& (pmfmId == null || pmfmId.equals(error.getPmfmId())));
&& (controlOnly == null || (controlOnly == error.isControl()))
&& error.containsPropertyName(propertyName)
&& (pmfmId == null || pmfmId.equals(error.getPmfmId())));
}
/**
......@@ -794,13 +809,13 @@ public class ReefDbBeans extends QuadrigeBeans {
private static Predicate<ErrorDTO> errorEqualPredicate(ErrorDTO thisError) {
return error -> error.isError() == thisError.isError()
&& error.isWarning() == thisError.isWarning()
&& error.isControl() == thisError.isControl()
&& Objects.equals(error.getControlElementCode(), thisError.getControlElementCode())
&& Objects.deepEquals(error.getPropertyName().toArray(), thisError.getPropertyName().toArray())
&& Objects.equals(error.getPmfmId(), thisError.getPmfmId())
&& Objects.equals(error.getIndividualId(), thisError.getIndividualId())
&& Objects.equals(error.getMessage(), thisError.getMessage());
&& error.isWarning() == thisError.isWarning()
&& error.isControl() == thisError.isControl()
&& Objects.equals(error.getControlElementCode(), thisError.getControlElementCode())
&& Objects.deepEquals(error.getPropertyName().toArray(), thisError.getPropertyName().toArray())
&& Objects.equals(error.getPmfmId(), thisError.getPmfmId())
&& Objects.equals(error.getIndividualId(), thisError.getIndividualId())
&& Objects.equals(error.getMessage(), thisError.getMessage());
}
/**
......@@ -811,9 +826,9 @@ public class ReefDbBeans extends QuadrigeBeans {
*/
public static boolean isPmfmMandatory(ControlRuleDTO controlRule) {
return ControlElementValues.MEASUREMENT.equals(controlRule.getControlElement()) &&
(ControlFeatureMeasurementValues.PMFM.equals(controlRule.getControlFeature())
|| ControlFeatureMeasurementValues.NUMERICAL_VALUE.equals(controlRule.getControlFeature())
|| ControlFeatureMeasurementValues.QUALITATIVE_VALUE.equals(controlRule.getControlFeature()));
(ControlFeatureMeasurementValues.PMFM.equals(controlRule.getControlFeature())
|| ControlFeatureMeasurementValues.NUMERICAL_VALUE.equals(controlRule.getControlFeature())
|| ControlFeatureMeasurementValues.QUALITATIVE_VALUE.equals(controlRule.getControlFeature()));
}
public static boolean isPreconditionRule(ControlRuleDTO controlRule) {
......@@ -826,14 +841,14 @@ public class ReefDbBeans extends QuadrigeBeans {
public static boolean isQualitativeControlRule(ControlRuleDTO controlRule) {
return ControlFunctionValues.IS_AMONG.equals(controlRule.getFunction())
&& ControlElementValues.MEASUREMENT.equals(controlRule.getControlElement())
&& ControlFeatureMeasurementValues.QUALITATIVE_VALUE.equals(controlRule.getControlFeature());
&& ControlElementValues.MEASUREMENT.equals(controlRule.getControlElement())
&& ControlFeatureMeasurementValues.QUALITATIVE_VALUE.equals(controlRule.getControlFeature());
}
public static boolean isNumericalControlRule(ControlRuleDTO controlRule) {
return ControlFunctionValues.MIN_MAX.equals(controlRule.getFunction())
&& ControlElementValues.MEASUREMENT.equals(controlRule.getControlElement())
&& ControlFeatureMeasurementValues.NUMERICAL_VALUE.equals(controlRule.getControlFeature());
&& ControlElementValues.MEASUREMENT.equals(controlRule.getControlElement())
&& ControlFeatureMeasurementValues.NUMERICAL_VALUE.equals(controlRule.getControlFeature());
}
/**
......@@ -844,8 +859,8 @@ public class ReefDbBeans extends QuadrigeBeans {
*/
public static boolean isSurveyValidated(SurveyDTO survey) {
return survey.getValidationDate() != null
|| SynchronizationStatusValues.SYNCHRONIZED.equals(survey.getSynchronizationStatus())
|| SynchronizationStatusValues.READY_TO_SYNCHRONIZE.equals(survey.getSynchronizationStatus());
|| SynchronizationStatusValues.SYNCHRONIZED.equals(survey.getSynchronizationStatus())
|| SynchronizationStatusValues.READY_TO_SYNCHRONIZE.equals(survey.getSynchronizationStatus());
}
/**
......@@ -858,8 +873,8 @@ public class ReefDbBeans extends QuadrigeBeans {
public static FilterDTO getFilterOfType(ExtractionDTO extraction, ExtractionFilterValues extractionFilter) {
return CollectionUtils.isNotEmpty(extraction.getFilters())
? findByProperty(extraction.getFilters(), FilterDTO.PROPERTY_FILTER_TYPE_ID, extractionFilter.getFilterTypeId())
: null;
? findByProperty(extraction.getFilters(), FilterDTO.PROPERTY_FILTER_TYPE_ID, extractionFilter.getFilterTypeId())
: null;
}
/**
......@@ -885,7 +900,7 @@ public class ReefDbBeans extends QuadrigeBeans {
if (beans == null)
return null;
return beans.stream().map(bean -> bean instanceof CodeOnly ? ((CodeOnly)bean).getCode() : bean.getId().toString()).collect(Collectors.toList());
return beans.stream().map(bean -> bean instanceof CodeOnly ? ((CodeOnly) bean).getCode() : bean.getId().toString()).collect(Collectors.toList());
}
}
......@@ -319,7 +319,6 @@ public class OperationMeasurementsGroupedTableUIHandler
// Colonne commentaire
final TableColumnExt colComment = addCommentColumn(OperationMeasurementsGroupedTableModel.COMMENT);
setDefaultColumnMinWidth(colComment);
// Modele de la table
final OperationMeasurementsGroupedTableModel tableModel = new OperationMeasurementsGroupedTableModel(getTable().getColumnModel());
......
......@@ -27,6 +27,7 @@ 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;
import fr.ifremer.reefdb.dto.ReefDbBeans;
......@@ -38,10 +39,7 @@ import fr.ifremer.reefdb.dto.referential.TaxonGroupDTO;
import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbRowUIModel;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
......@@ -77,15 +75,20 @@ public abstract class AbstractMeasurementsGroupedRowModel<B extends QuadrigeBean
private final AllowedQualitativeValuesMap allowedQualitativeValuesMap;
private final List<ErrorDTO> preconditionErrors;
private List<ColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel>> multipleValuesOnIdentifier;
private List<Integer> multipleValuesOnPmfmIds;
/**
* <p>Constructor for AbstractReefDbRowUIModel.</p>
*/
public AbstractMeasurementsGroupedRowModel(boolean readOnly) {
super(null, null);
this.individualMeasurements = Lists.newArrayList();
this.errors = Lists.newArrayList();
this.preconditionErrors = Lists.newArrayList();
this.individualMeasurements = new ArrayList<>();
this.errors = new ArrayList<>();
this.preconditionErrors = new ArrayList<>();
this.allowedQualitativeValuesMap = new AllowedQualitativeValuesMap();
this.multipleValuesOnIdentifier = new ArrayList<>();
this.multipleValuesOnPmfmIds = new ArrayList<>();
this.readOnly = readOnly;
}
......@@ -291,6 +294,22 @@ public abstract class AbstractMeasurementsGroupedRowModel<B extends QuadrigeBean
return preconditionErrors;
}
public List<ColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel>> getMultipleValuesOnIdentifier() {
return multipleValuesOnIdentifier;
}
public void addMultipleValuesOnIdentifier(ColumnIdentifier<? extends AbstractMeasurementsGroupedRowModel> identifier) {
multipleValuesOnIdentifier.add(identifier);
}
public List<Integer> getMultipleValuesOnPmfmIds() {
return multipleValuesOnPmfmIds;
}
public void addMultipleValuesOnPmfmId(Integer pmfmId) {
multipleValuesOnPmfmIds.add(pmfmId);
}
public boolean isSameRow(AbstractMeasurementsGroupedRowModel<?, ?> that) {
return Objects.equals(this.getTaxonGroup(), that.getTaxonGroup())
&& Objects.equals(this.getTaxon(), that.getTaxon());
......
......@@ -102,7 +102,6 @@ public abstract class AbstractMeasurementsGroupedTableUIHandler<
@Override
public void afterInit(UI ui) {
// Initialiser l UI
initUI(ui);
createTaxonGroupCellEditor();
......@@ -301,7 +300,7 @@ public abstract class AbstractMeasurementsGroupedTableUIHandler<
}
private List<R> buildRows(boolean readOnly) {
protected List<R> buildRows(boolean readOnly) {
List<R> rows = new ArrayList<>();
......@@ -681,7 +680,8 @@ public abstract class AbstractMeasurementsGroupedTableUIHandler<
}
protected boolean hasAnalyst(R row) {
if (row.getAnalyst() == null && row.getIndividualMeasurements().stream().anyMatch(this::isMeasurementNotEmpty)) {
if (!row.getMultipleValuesOnIdentifier().contains(AbstractMeasurementsGroupedTableModel.ANALYST)
&& row.getAnalyst() == null && row.getIndividualMeasurements().stream().anyMatch(this::isMeasurementNotEmpty)) {
ReefDbBeans.addError(row,
t("reefdb.validator.error.analyst.required"),
AbstractMeasurementsGroupedRowModel.PROPERTY_ANALYST);
......
......@@ -36,7 +36,7 @@ public class SurveyMeasurementsGroupedRowModel extends AbstractMeasurementsGroup
*
* @param readOnly a boolean.
*/
SurveyMeasurementsGroupedRowModel(boolean readOnly) {
public SurveyMeasurementsGroupedRowModel(boolean readOnly) {
super(readOnly);
}
......
......@@ -28,6 +28,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;
......@@ -42,39 +43,38 @@ public class SurveyMeasurementsGroupedTableModel extends AbstractMeasurementsGro
* Identifiant pour la colonne groupe taxon.
*/
public static final ReefDbColumnIdentifier<SurveyMeasurementsGroupedRowModel> TAXON_GROUP = ReefDbColumnIdentifier.newId(
SurveyMeasurementsGroupedRowModel.PROPERTY_TAXON_GROUP,
n("reefdb.property.taxonGroup.short"),
n("reefdb.survey.measurement.grouped.taxonGroup.tip"),
TaxonGroupDTO.class);
SurveyMeasurementsGroupedRowModel.PROPERTY_TAXON_GROUP,
n("reefdb.property.taxonGroup.short"),
n("reefdb.survey.measurement.grouped.taxonGroup.tip"),
TaxonGroupDTO.class);
/**
* Identifiant pour la colonne taxon.
*/
public static final ReefDbColumnIdentifier<SurveyMeasurementsGroupedRowModel> TAXON = ReefDbColumnIdentifier.newId(
SurveyMeasurementsGroupedRowModel.PROPERTY_TAXON,
n("reefdb.property.taxon"),
n("reefdb.survey.measurement.grouped.taxon.tip"),
TaxonDTO.class,
DecoratorService.WITH_CITATION);
SurveyMeasurementsGroupedRowModel.PROPERTY_TAXON,
n("reefdb.property.taxon"),
n("reefdb.survey.measurement.grouped.taxon.tip"),
TaxonDTO.class,
DecoratorService.WITH_CITATION);
/**
* Identifiant pour la colonne taxon saisi.
*/
public static final ReefDbColumnIdentifier<SurveyMeasurementsGroupedRowModel> INPUT_TAXON_NAME = ReefDbColumnIdentifier.newReadOnlyId(
SurveyMeasurementsGroupedRowModel.PROPERTY_INPUT_TAXON_NAME,
n("reefdb.property.inputTaxon"),
n("reefdb.survey.measurement.grouped.inputTaxon.tip"),
String.class);
SurveyMeasurementsGroupedRowModel.PROPERTY_INPUT_TAXON_NAME,
n("reefdb.property.inputTaxon"),
n("reefdb.survey.measurement.grouped.inputTaxon.tip"),
String.class);
/**
* Identifiant pour la colonne valeur.
*/
public static final ReefDbColumnIdentifier<SurveyMeasurementsGroupedRowModel> COMMENT = ReefDbColumnIdentifier.newId(
SurveyMeasurementsGroupedRowModel.PROPERTY_COMMENT,
n("reefdb.property.comment"),
n("reefdb.survey.measurement.grouped.comment.tip"),
String.class);
SurveyMeasurementsGroupedRowModel.PROPERTY_COMMENT,
n("reefdb.property.comment"),
n("reefdb.survey.measurement.grouped.comment.tip"),
String.class);
/**
* Constructor.
......@@ -110,8 +110,8 @@ public class SurveyMeasurementsGroupedTableModel extends AbstractMeasurementsGro
* {@inheritDoc}
*/
@Override
public SurveyMeasurementsGroupedTableUIModel getTableUIModel() {
return (SurveyMeasurementsGroupedTableUIModel) super.getTableUIModel();
public AbstractMeasurementsGroupedTableUIModel getTableUIModel() {
return (AbstractMeasurementsGroupedTableUIModel) super.getTableUIModel();
}
/**
......@@ -122,8 +122,8 @@ public class SurveyMeasurementsGroupedTableModel extends AbstractMeasurementsGro
if (getTableUIModel().getSurvey() != null && getTableUIModel().getSurvey().getProgram() != null) {
return SurveyMeasurementsGroupedTableUIModel.PROPERTY_SURVEY + '_'
+ SurveyDTO.PROPERTY_INDIVIDUAL_PMFMS + '_'
+ getTableUIModel().getSurvey().getProgram().getCode();
+ SurveyDTO.PROPERTY_INDIVIDUAL_PMFMS + '_'
+ getTableUIModel().getSurvey().getProgram().getCode();
}
return super.getStateContext();
......
......@@ -59,9 +59,10 @@
<JPanel id='tableauBasPanelButtons' layout='{new BorderLayout()}' constraints="BorderLayout.PAGE_END">
<JPanel layout='{new FlowLayout()}' constraints='BorderLayout.LINE_START'>
<JButton id='tableauBasNouveauBouton' alignmentX='{Component.CENTER_ALIGNMENT}' onActionPerformed="model.insertNewRowAfterSelected()"/>
<JButton id='tableauBasDupliquerBouton' alignmentX='{Component.CENTER_ALIGNMENT}'/>
<JButton id='tableauBasSupprimerBouton' alignmentX='{Component.CENTER_ALIGNMENT}' onActionPerformed="handler.removeIndividualMeasurements()"/>
<JButton id='newButton' alignmentX='{Component.CENTER_ALIGNMENT}' onActionPerformed="model.insertNewRowAfterSelected()"/>
<JButton id='duplicateButton' alignmentX='{Component.CENTER_ALIGNMENT}'/>
<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">
<ToggleButton id="fullScreenToggleButton" onActionPerformed="handler.toggleFullScreen(tableauBasPanel, fullScreenToggleButton)"/>
......
......@@ -34,21 +34,21 @@
toggledToolTipText: {t("reefdb.table.view.unFullScreen.tip")};
}
#tableauBasNouveauBouton {
#newButton {
actionIcon: add;
text: "reefdb.common.new";
toolTipText: "reefdb.survey.measurement.grouped.new.tip";
enabled: {model.getSurvey().isEditable() && !model.getPmfms().isEmpty()};
}
#tableauBasSupprimerBouton {
#deleteButton {
actionIcon: delete;
text: "reefdb.common.delete";
toolTipText: "reefdb.survey.measurement.grouped.delete.tip";
enabled: {model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && !model.getPmfms().isEmpty()};
}
#tableauBasDupliquerBouton {
#duplicateButton {
actionIcon: copy;
text: "reefdb.action.duplicate.label";
toolTipText: "reefdb.action.duplicate.measurement.tip";
......@@ -56,6 +56,14 @@
enabled: {model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && (model.getSelectedRows().size() == 1) && !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()};
visible: {false};
}
#tableBlockLayer {
blockingColor: {handler.getConfig().getColorBlockingLayer()};
block:{model.isLoading()};
......
......@@ -30,14 +30,15 @@ import fr.ifremer.reefdb.dto.data.measurement.MeasurementAware;
import fr.ifremer.reefdb.dto.data.measurement.MeasurementDTO;
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.content.observation.survey.measurement.grouped.multiedit.SurveyMeasurementsMultiEditUI;
import fr.ifremer.reefdb.ui.swing.content.observation.survey.measurement.grouped.multiedit.SurveyMeasurementsMultiEditUIModel;
import jaxx.runtime.SwingUtil;
import org.jdesktop.swingx.table.TableColumnExt;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.RowFilter;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.Dimension;
import java.awt.Insets;
import java.util.List;
/**
......@@ -89,8 +90,8 @@ public class SurveyMeasurementsGroupedTableUIHandler
super.afterInit(ui);
// Les boutons sont desactives
getUI().getTableauBasSupprimerBouton().setEnabled(false);
getUI().getTableauBasDupliquerBouton().setEnabled(false);
getUI().getDeleteButton().setEnabled(false);
getUI().getDuplicateButton().setEnabled(false);
SwingUtil.setLayerUI(ui.getTableauBasScrollPane(), ui.getTableBlockLayer());
// Keep initial border
......@@ -193,7 +194,6 @@ public class SurveyMeasurementsGroupedTableUIHandler
// Colonne commentaire
final TableColumnExt colComment = addCommentColumn(SurveyMeasurementsGroupedTableModel.COMMENT);
setDefaultColumnMinWidth(colComment);
// Modele de la table
final SurveyMeasurementsGroupedTableModel tableModel = new SurveyMeasurementsGroupedTableModel(getTable().getColumnModel());
......@@ -221,4 +221,23 @@ public class SurveyMeasurementsGroupedTableUIHandler
getModel().setModify(true);
}
public void editSelectedMeasurements() {
saveTableInSwingSession();
SurveyMeasurementsMultiEditUI multiEditUI = new SurveyMeasurementsMultiEditUI(getUI());
SurveyMeasurementsMultiEditUIModel multiEditModel = multiEditUI.getModel();
multiEditModel.setObservationHandler(getModel().getObservationUIHandler());
multiEditModel.setRowsToEdit(getModel().getSelectedRows());
multiEditModel.setPmfms(getModel().getPmfms());
multiEditModel.setSurvey(getModel().getSurvey());
JComponent parent = getUI().getTableauBasScrollPane();
Insets borderInsets = parent.getBorder().getBorderInsets(parent);
openDialog(multiEditUI, new Dimension(parent.getWidth() + borderInsets.left + borderInsets.right, 150), true, parent);
if (multiEditModel.isValid()) {
}
}
}
<!--
#%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="surveyMeasurementsMultiEditUI" layout="{new BorderLayout()}"
implements='fr.ifremer.reefdb.ui.swing.util.ReefDbUI&lt;SurveyMeasurementsMultiEditUIModel, SurveyMeasurementsMultiEditUIHandler&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>
<SurveyMeasurementsMultiEditUIModel id='model' initializer='getContextValue(SurveyMeasurementsMultiEditUIModel.class)'/>
<script><![CDATA[
public SurveyMeasurementsMultiEditUI(ApplicationUI parentUI) {
ApplicationUIUtil.setParentUI(this, parentUI);
}
]]></script>
<JPanel layout="{new BorderLayout()}">
<JScrollPane id="scrollPane" decorator='boxed' border="{null}">
<SwingTable id="surveyGroupedMeasurementMultiEditTable"/>
</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%
*/
#surveyMeasurementsMultiEditUI {
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()};
}
\ No newline at end of file
package fr.ifremer.reefdb.ui.swing.content.observation.survey.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