Commit 7940333d authored by PECQUOT's avatar PECQUOT

[fix] Opening qualitative values modal from PMFMU will now load correctly the...

[fix] Opening qualitative values modal from PMFMU will now load correctly the qualitative values from selected parameter (Mantis #49916,49708)
[fix] Delete a rule list which is selected in selection combobox will be removed before reload (Mantis #50537)
[fix] Recompute rows valid state when a sampling operation is removed (Mantis #33741)
[fix] HomeUI: default program filter now includes local programs (Mantis #49917)
[fix] Update title on context change; Taxon group and taxon filters in measurement screens are initialized once and avoid circular effect (Mantis #49551)
[fix] Don't force the analyst column at the last column (Mantis #49537)
[fix] ControlRuleTable: Stop table edition to avoid rendering exception (Mantis #49268)
[fix] ImportSynchroAction: If user cancel the program selection, then cancel synchro (Mantis #46164)
[fix] Set default pmfm column min width (Mantis #50452)
[enh] Parameter and PMFMU screens: Force qualitative values column visible; TODO need validation from sbe ! (Mantis #50012)
[enh] Force sismer column non visible; TODO need validation from sbe ! (Mantis #49973)
[enh] DuplicateSurveyAction: Change message and buttons (Mantis #50011)
Signed-off-by: PECQUOT's avatarlp1ee9d <ludovic.pecquot@e-is.pro>
parent ee764cdb
## Sprint 81 - v3.9.0
## Sprint 80 - v3.8.1
- Pas de mise à jour de modèle
......
......@@ -10,7 +10,7 @@
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.8.2-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Reef DB</name>
......@@ -171,7 +171,7 @@
<maven.compiler.debug>true</maven.compiler.debug>
<!-- Quadrige3 Core version -->
<quadrige3-core.version>3.6.4</quadrige3-core.version>
<quadrige3-core.version>3.6.5-SNAPSHOT</quadrige3-core.version>
<!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.8.2-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
</parent>
<artifactId>reefdb-core</artifactId>
......
......@@ -29,7 +29,6 @@ import fr.ifremer.quadrige3.core.ProgressionCoreModel;
import fr.ifremer.quadrige3.core.dao.technical.Assert;
import fr.ifremer.quadrige3.core.dao.technical.Dates;
import fr.ifremer.quadrige3.core.dao.technical.Times;
import fr.ifremer.quadrige3.core.security.SecurityContextHelper;
import fr.ifremer.quadrige3.ui.core.dto.referential.BaseReferentialDTO;
import fr.ifremer.reefdb.config.ReefDbConfiguration;
import fr.ifremer.reefdb.dao.administration.user.ReefDbDepartmentDao;
......@@ -177,7 +176,8 @@ public class ObservationServiceImpl implements ObservationInternalService {
Collection<String> programCodes;
// if no filter on single program, force filter on writable programs
if (StringUtils.isBlank(programCode)) {
programCodes = programStrategyService.getWritableProgramCodesByQuserId(SecurityContextHelper.getQuadrigeUserId());
// get writable programs including locals (Mantis #49917)
programCodes = programStrategyService.getWritablePrograms().stream().map(ProgramDTO::getCode).collect(Collectors.toSet());
} else {
programCodes = Collections.singleton(programCode);
}
......@@ -599,8 +599,10 @@ public class ObservationServiceImpl implements ObservationInternalService {
if (dataContext.isContextFiltered(FilterTypeValues.PROGRAM) && !forceNoContext) {
result = contextService.getFilteredPrograms(dataContext.getContextId());
// context filtered programs can eventually out of user rights, filter them
Set<String> writableProgramCodes = programStrategyService.getWritableProgramCodesByQuserId(dataContext.getPrincipalUserId());
result = result.stream().filter(programDTO -> writableProgramCodes.contains(programDTO.getCode())).collect(Collectors.toList());
// Set<String> writableProgramCodes = programStrategyService.getWritableProgramCodesByQuserId(dataContext.getPrincipalUserId());
// Get correct list of writable programs (Mantis #49913)
List<ProgramDTO> writablePrograms = programStrategyService.getWritableProgramsByUserAndStatus(dataContext.getPrincipalUserId(), StatusFilter.ACTIVE);
result = result.stream().filter(writablePrograms::contains).collect(Collectors.toList());
} else if (campaignId != null) {
result = programStrategyService.getWritableProgramsByCampaignId(campaignId);
} else {
......
......@@ -1215,4 +1215,9 @@ public interface ReferentialService {
*/
QualitativeValueDTO getQualitativeValue(int qualitativeValueId);
List<QualitativeValueDTO> getQualitativeValues(Collection<Integer> qualitativeValueIds);}
List<QualitativeValueDTO> getQualitativeValues(Collection<Integer> qualitativeValueIds);
List<QualitativeValueDTO> getQualitativeValues(String parameterCode);
}
......@@ -1464,6 +1464,14 @@ public class ReferentialServiceImpl implements ReferentialService {
return result;
}
@Override
public List<QualitativeValueDTO> getQualitativeValues(String parameterCode) {
if (StringUtils.isBlank(parameterCode))
return null;
return qualitativeValueDao.getQualitativeValuesByParameterCode(parameterCode);
}
/**
* {@inheritDoc}
*/
......
......@@ -54,6 +54,7 @@ fr.ifremer.reefdb.dto.referential.GroupingTypeDTO.attribute.grouping.stereotype=
fr.ifremer.reefdb.dto.referential.TaxonGroupDTO.attribute.taxons.stereotype=ordered
fr.ifremer.reefdb.dto.referential.TaxonDTO.attribute.taxonGroups.stereotype=ordered
fr.ifremer.reefdb.dto.referential.pmfm.ParameterDTO.attribute.qualitativeValues.stereotype=ordered
fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO.attribute.qualitativeValues.stereotype=ordered
fr.ifremer.reefdb.dto.referential.pmfm.MatrixDTO.attribute.fractions.stereotype=unique
fr.ifremer.reefdb.dto.referential.pmfm.FractionDTO.attribute.matrixes.stereotype=unique
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer.common</groupId>
<artifactId>common-parent</artifactId>
<version>3.0.6</version>
<version>3.0.9</version>
</parent>
<groupId>fr.ifremer.reefdb</groupId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.8.2-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
</parent>
<artifactId>reefdb-ui-swing</artifactId>
......
......@@ -43,7 +43,7 @@
# Please fill the missing licenses for dependencies :
#
#
#Tue Jan 21 15:10:29 CET 2020
#Wed Jan 22 09:26:52 CET 2020
com.oracle--ojdbc7--12.1.0.2.0=OTN license
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
......
......@@ -1255,6 +1255,9 @@ public class ReefDbUIContext extends ApplicationUIContext implements JAXXHelpUIH
// set to data context (for service use)
dataContext.setContext(selectedContext);
firePropertyChange(PROPERTY_SELECTED_CONTEXT_ID, null, contextId);
// Change title to reflect context change (Mantis #49551)
getMainUI().getHandler().changeTitle();
}
......
......@@ -179,8 +179,10 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
// If no programs selected (or user cancelled): only import referential
if (CollectionUtils.isEmpty(programs)) {
getSynchroUIContext().setImportData(false);
referentialOnly = true;
// getSynchroUIContext().setImportData(false);
// referentialOnly = true;
// If user cancel the program selection, then cancel synchro (Mantis #46164)
return;
}
// Transform selected programs into a code list
......
......@@ -121,6 +121,16 @@ public class HomeUIHandler extends AbstractReefDbUIHandler<HomeUIModel, HomeUI>
null,
null);
// Listener on remove filter on campaigns
getUI().getCampaignCombo().setActionListener(e -> {
if (!askBefore(t("reefdb.common.unfilter"), t("reefdb.common.unfilter.confirmation"))) {
return;
}
getUI().getCampaignCombo().setActionEnabled(false);
getModel().setForceNoCampaignFilter(true);
applyContext();
});
// Initailisation des programmes
initBeanFilterableComboBox(
getUI().getProgramCombo(),
......@@ -192,16 +202,6 @@ public class HomeUIHandler extends AbstractReefDbUIHandler<HomeUIModel, HomeUI>
*/
private void initListeners() {
// Listener on remove filter on campaigns
getUI().getCampaignCombo().setActionListener(e -> {
if (!askBefore(t("reefdb.common.unfilter"), t("reefdb.common.unfilter.confirmation"))) {
return;
}
getUI().getCampaignCombo().setActionEnabled(false);
getModel().setForceNoCampaignFilter(true);
applyContext();
});
// Listener sur la selection du programme
getModel().addPropertyChangeListener(HomeUIModel.PROPERTY_PROGRAM, evt -> {
// update locations
......
......@@ -320,15 +320,6 @@ public class OperationsTableUIHandler extends AbstractReefDbTableUIHandler<Opera
colSamplingDepartment.setSortable(true);
colSamplingDepartment.setMinWidth(100);
// Colonne service analyste
final TableColumnExt colAnalystDepartment = addColumn(
analystDepartmentCellEditor,
newTableCellRender(OperationsTableModel.ANALYST),
OperationsTableModel.ANALYST
);
colAnalystDepartment.setSortable(true);
colAnalystDepartment.setMinWidth(100);
// Colonne immersion
final TableColumnExt colDepth = addColumn(
newNumberCellEditor(Double.class, false, ReefDbUI.DECIMAL2_PATTERN),
......@@ -380,6 +371,15 @@ public class OperationsTableUIHandler extends AbstractReefDbTableUIHandler<Opera
colPositioningPrecision.setMinWidth(100);
colPositioningPrecision.setEditable(false);
// Colonne service analyste
final TableColumnExt colAnalystDepartment = addColumn(
analystDepartmentCellEditor,
newTableCellRender(OperationsTableModel.ANALYST),
OperationsTableModel.ANALYST
);
colAnalystDepartment.setSortable(true);
colAnalystDepartment.setMinWidth(100);
// Modele de la table
final OperationsTableModel tableModel = new OperationsTableModel(getTable().getColumnModel(), true);
getTable().setModel(tableModel);
......@@ -586,6 +586,9 @@ public class OperationsTableUIHandler extends AbstractReefDbTableUIHandler<Opera
// Suppression des lignes
getModel().deleteSelectedRows();
// Recompute valid state (Mantis #33741)
recomputeRowsValidState();
forceRevalidateModel();
saveToSurvey();
......@@ -750,7 +753,9 @@ public class OperationsTableUIHandler extends AbstractReefDbTableUIHandler<Opera
getContext().restoreComponentFromSwingSession(getTable());
// hide analyst column if no pmfm (Mantis #42619)
forceColumnVisibleAtLastPosition(OperationsTableModel.ANALYST, notEmpty);
// forceColumnVisibleAtLastPosition(OperationsTableModel.ANALYST, notEmpty);
// Don't force position (Mantis #49537)
forceColumnVisible(OperationsTableModel.ANALYST, notEmpty);
// set columns with errors visible
ensureColumnsWithErrorAreVisible(getModel().getRows());
......
......@@ -147,7 +147,9 @@ public class AddOperationTableUIHandler extends AbstractReefDbTableUIHandler<Ope
OperationsTableRowModel newRow = getModel().addNewRow(newSamplingOperation);
// If no PMFM, hide analysis column and set default (Mantis #42619)
forceColumnVisibleAtLastPosition(OperationsTableModel.ANALYST, notEmpty);
// forceColumnVisibleAtLastPosition(OperationsTableModel.ANALYST, notEmpty);
// Don't force position (Mantis #49537)
forceColumnVisible(OperationsTableModel.ANALYST, notEmpty);
// Set analyst from pmfm strategies
if (notEmpty) {
......
......@@ -61,18 +61,20 @@ public class DuplicateSurveyAction extends AbstractReefDbAction<SurveysTableUIMo
return false;
}
// Change message and buttons (Mantis #50011)
String title = t("reefdb.home.survey.duplicate.title");
String message = String.format(SurveysTableUIHandler.CONFIRMATION_FORMAT,
t("reefdb.home.survey.duplicate.message"),
t("reefdb.home.survey.duplicate.help"));
// String message = String.format(SurveysTableUIHandler.CONFIRMATION_FORMAT,
// t("reefdb.home.survey.duplicate.message"), TODO remove after validation
// t("reefdb.home.survey.duplicate.help")); TODO remove after validation
JCheckBox duplicateCoordinateCheckBox = new JCheckBox(t("reefdb.home.survey.duplicate.coordinate"));
JCheckBox duplicateSurveyMeasurementsCheckBox = new JCheckBox(t("reefdb.home.survey.duplicate.surveyMeasurements"));
Object[] messageObjects = {message, duplicateCoordinateCheckBox, duplicateSurveyMeasurementsCheckBox};
Object[] messageObjects = {/*message, */duplicateCoordinateCheckBox, duplicateSurveyMeasurementsCheckBox};
Object[] options = {
t("reefdb.home.survey.duplicate.option.simple"),
t("reefdb.home.survey.duplicate.option.full"),
t("reefdb.home.survey.duplicate.option.simple"),
t("reefdb.common.cancel")};
int result = getContext().getDialogHelper().showOptionDialog(getUI(), messageObjects, title, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION, options, options[0]);
......@@ -80,7 +82,7 @@ public class DuplicateSurveyAction extends AbstractReefDbAction<SurveysTableUIMo
return false;
}
fullDuplication = result == 1;
fullDuplication = result == 0;
duplicateCoordinate = duplicateCoordinateCheckBox.isSelected();
duplicateSurveyMeasurements = duplicateSurveyMeasurementsCheckBox.isSelected();
......
......@@ -23,10 +23,10 @@ package fr.ifremer.reefdb.ui.swing.content.manage.campaign.table;
* #L%
*/
import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
import fr.ifremer.reefdb.dto.ReefDbBeans;
import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbTableModel;
import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbTableUIHandler;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
import org.jdesktop.swingx.table.TableColumnExt;
import javax.swing.SortOrder;
......@@ -232,4 +232,9 @@ public class CampaignsTableUIHandler extends AbstractReefDbTableUIHandler<Campai
getTable().setSortOrder(CampaignsTableModel.NAME, SortOrder.ASCENDING);
}
@Override
public void afterViewInit() {
// Force sismer column non visible (Mantis #49973)
forceColumnVisible(CampaignsTableModel.SISMER_LINK, false);
}
}
......@@ -323,7 +323,7 @@ public class ProgramsTableUIHandler extends AbstractReefDbTableUIHandler<Program
final ProgramsTableRowModel selectedProgram = getModel().getSingleSelectedRow();
// Si un seul element a ete selectionne
if (selectedProgram != null) {
if (selectedProgram != null && StringUtils.isNotBlank(selectedProgram.getCode())) {
newRowSelected = true;
......@@ -344,7 +344,8 @@ public class ProgramsTableUIHandler extends AbstractReefDbTableUIHandler<Program
getModel().addPropertyChangeListener(ProgramsTableUIModel.PROPERTY_SELECTED_ROWS, evt -> {
if (getModel().getSelectedRows().size() == 1) {
getUI().getEditCombobox().setEnabled(!getModel().getSelectedRows().iterator().next().isLocal());
ProgramsTableRowModel selected = getModel().getSelectedRows().iterator().next();
getUI().getEditCombobox().setEnabled(selected.getStatus() != null && !selected.isLocal());
} else {
getUI().getEditCombobox().setEnabled(false);
}
......
......@@ -169,7 +169,6 @@ public class PmfmsLocalUIHandler extends AbstractReefDbTableUIHandler<PmfmTableR
initTable(getTable());
// Les colonnes optionnelles sont invisibles
associatedQualitativeValueCol.setVisible(false);
idCol.setVisible(false);
// stepCol.setVisible(false);
// maxDecimalNumberCol.setVisible(false);
......@@ -178,6 +177,12 @@ public class PmfmsLocalUIHandler extends AbstractReefDbTableUIHandler<PmfmTableR
getTable().setVisibleRowCount(5);
}
@Override
public void afterViewInit() {
// force qualitative values column visible (Mantis #50012)
forceColumnVisible(PmfmTableModel.QUALITATIVE_VALUES, true);
}
/** {@inheritDoc} */
@Override
public AbstractReefDbTableModel<PmfmTableRowModel> getTableModel() {
......
......@@ -183,7 +183,6 @@ public class PmfmsNationalUIHandler extends
initTable(getTable(), true);
// Les colonnes optionnelles sont invisibles
associatedQualitativeValueCol.setVisible(false);
idCol.setVisible(false);
// stepCol.setVisible(false);
// maxDecimalNumberCol.setVisible(false);
......@@ -192,7 +191,11 @@ public class PmfmsNationalUIHandler extends
getTable().setVisibleRowCount(5);
}
@Override
public void afterViewInit() {
// force qualitative values column visible (Mantis #50012)
forceColumnVisible(PmfmTableModel.QUALITATIVE_VALUES, true);
}
/** {@inheritDoc} */
@Override
......
......@@ -155,6 +155,12 @@ public class ManageParametersLocalUIHandler extends AbstractReefDbTableUIHandler
getTable().setVisibleRowCount(5);
}
@Override
public void afterViewInit() {
// force qualitative values column visible (Mantis #50012)
forceColumnVisible(ParameterTableModel.ASSOCIATED_QUALITATIVE_VALUE, true);
}
/** {@inheritDoc} */
@Override
public AbstractReefDbTableModel<ParameterTableRowModel> getTableModel() {
......
......@@ -149,6 +149,12 @@ public class ManageParametersNationalUIHandler extends
getTable().setVisibleRowCount(5);
}
@Override
public void afterViewInit() {
// force qualitative values column visible (Mantis #50012)
forceColumnVisible(ParameterTableModel.ASSOCIATED_QUALITATIVE_VALUE, true);
}
/** {@inheritDoc} */
@Override
public AbstractReefDbTableModel<ParameterTableRowModel> getTableModel() {
......
......@@ -181,13 +181,13 @@ public class ParameterTableRowModel extends AbstractReefDbRowUIModel<ParameterDT
/** {@inheritDoc} */
@Override
public Collection<QualitativeValueDTO> getQualitativeValues() {
public List<QualitativeValueDTO> getQualitativeValues() {
return delegateObject.getQualitativeValues();
}
/** {@inheritDoc} */
@Override
public void setQualitativeValues(Collection<QualitativeValueDTO> QualitativeValues) {
public void setQualitativeValues(List<QualitativeValueDTO> QualitativeValues) {
delegateObject.setQualitativeValues(QualitativeValues);
}
......
......@@ -26,6 +26,7 @@ package fr.ifremer.reefdb.ui.swing.content.manage.referential.pmfm.qualitativeva
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import fr.ifremer.quadrige3.core.dao.referential.StatusCode;
import fr.ifremer.quadrige3.ui.core.dto.referential.BaseReferentialDTO;
import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
import fr.ifremer.reefdb.dao.technical.Daos;
import fr.ifremer.reefdb.dto.ReefDbBeans;
......@@ -42,7 +43,7 @@ import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.table.TableColumnExt;
import org.nuiton.jaxx.application.swing.util.Cancelable;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
/**
......@@ -86,8 +87,13 @@ public class QualitativeValueUIHandler extends AbstractReefDbTableUIHandler<Qual
PmfmDTO pmfm = (PmfmDTO) getModel().getParentRowModel();
List<QualitativeValueDTO> universeValues = null;
if (pmfm.getParameter() != null) {
// gather qualitative values from service (Mantis #49916,49708)
List<QualitativeValueDTO> qualitativeValues = getContext().getReferentialService().getQualitativeValues(pmfm.getParameter().getCode());
// filter active qualitative values only
universeValues = ReefDbBeans.filterCollection(pmfm.getParameter().getQualitativeValues(), (Predicate<QualitativeValueDTO>) input -> input != null && input.getStatus() != null && StatusFilter.ACTIVE.toStatusCodes().contains(input.getStatus().getCode()));
universeValues = ReefDbBeans.filterCollection(qualitativeValues, (Predicate<QualitativeValueDTO>) input ->
input != null && input.getStatus() != null && StatusFilter.ACTIVE.toStatusCodes().contains(input.getStatus().getCode()));
// sort by label
universeValues.sort(Comparator.comparing(BaseReferentialDTO::getName));
}
List<QualitativeValueDTO> selectedValues = Lists.newArrayList(pmfm.getQualitativeValues());
......@@ -96,7 +102,11 @@ public class QualitativeValueUIHandler extends AbstractReefDbTableUIHandler<Qual
getUI().getListPanelLayout().setSelected(DOUBLE_LIST);
} else {
getModel().setBeans(getQualitativeValuesFromRow(getModel().getParentRowModel()));
List<QualitativeValueDTO> qualitativeValues = getQualitativeValuesFromRow(getModel().getParentRowModel());
if (qualitativeValues != null) {
qualitativeValues.sort(Comparator.comparing(BaseReferentialDTO::getName));
}
getModel().setBeans(qualitativeValues);
getUI().getListPanelLayout().setSelected(TABLE);
}
});
......@@ -142,7 +152,7 @@ public class QualitativeValueUIHandler extends AbstractReefDbTableUIHandler<Qual
}
}
private Collection<QualitativeValueDTO> getQualitativeValuesFromRow(AbstractReefDbRowUIModel rowModel) {
private List<QualitativeValueDTO> getQualitativeValuesFromRow(AbstractReefDbRowUIModel rowModel) {
if (ParameterDTO.class.isAssignableFrom(rowModel.getClass())) {
return ((ParameterDTO) rowModel).getQualitativeValues();
}
......
......@@ -59,6 +59,14 @@ public class SaveAction extends AbstractReefDbRemoteSaveAction<RulesUIModel, Rul
@Override
protected void reload() {
// If control rules in table, force newCode state to false (Mantis #46446)
if (getModel().getControlRuleUIModel().getRowCount() > 0) {
getModel().getControlRuleUIModel().getRows().forEach(controlRuleRowModel -> controlRuleRowModel.setNewCode(false));
}
// reload ComboBox
getUI().getRulesMenuUI().getHandler().reloadComboBox();
getActionEngine().runInternalAction(getUI().getRulesMenuUI().getHandler(), SearchAction.class);
}
......@@ -91,24 +99,4 @@ public class SaveAction extends AbstractReefDbRemoteSaveAction<RulesUIModel, Rul
);
}
/**
* {@inheritDoc}
*/
@Override
public void postSuccessAction() {
super.postSuccessAction();
// don't finish action if remote save is aborted (Mantis #48235)
if (isSaveAborted())
return;
// If control rules in table, force newCode state to false (Mantis #46446)
if (getModel().getControlRuleUIModel().getRowCount() > 0) {
getModel().getControlRuleUIModel().getRows().forEach(controlRuleRowModel -> controlRuleRowModel.setNewCode(false));
}
// reload ComboBox
getUI().getRulesMenuUI().getHandler().reloadComboBox();
}
}
......@@ -643,6 +643,9 @@ public class ControlRuleTableUIHandler extends
*/
public void loadControlRules(final Collection<ControlRuleDTO> controlRules) {
// Stop table edition to avoid rendering exception (Mantis #49268)
getTable().editingStopped(null);
// Load les controlRule dans le model
getModel().setBeans(controlRules);
......
......@@ -99,18 +99,18 @@ public class RulesMenuUIHandler extends AbstractReefDbUIHandler<RulesMenuUIModel
/**
* <p>reloadComboBox.</p>
*/
@SuppressWarnings("unchecked")
public void reloadComboBox() {
getModel().setLoading(true);
BeanFilterableComboBox cb = getUI().getRuleListComboBox();
BeanFilterableComboBox<RuleListDTO> cb = getUI().getRuleListComboBox();
cb.setData(null);
List<RuleListDTO> ruleLists = getContext().getRuleListService().getRuleLists();
cb.setData(ruleLists);
// if (cb.getSelectedItem() != null) {
// RulesUI parentUI = (RulesUI) ReefDbUIs.getParentUI(getUI());
// cb.setSelectedItem(parentUI.getModel().getRuleListUIModel().getSingleSelectedRow());
// }
// clear selected item if not present in list (Mantis #50537)
if (cb.getSelectedItem() instanceof RuleListDTO && !ruleLists.contains(cb.getSelectedItem())) {
cb.setSelectedItem(null);
}
getModel().setLoading(false);
}
......
......@@ -68,6 +68,8 @@ import static org.nuiton.i18n.I18n.t;
*/
public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<OperationMeasurementsTabUIModel, OperationMeasurementsTabUI> implements TabHandler {
private boolean firstLoad = true;
/**
* {@inheritDoc}
*/
......@@ -222,8 +224,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
if (CollectionUtils.isEmpty(taxonGroups) && getModel().getTaxonGroup() != null) {
getModel().setTaxonGroup(null);
} else if (taxonGroups.size() == 1) {
getModel().setTaxonGroup(taxonGroups.get(0));
// Don't auto-select unique value (Mantis #49551)
// } else if (taxonGroups.size() == 1) {
// getModel().setTaxonGroup(taxonGroups.get(0));
}
}
......@@ -238,8 +241,9 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
if (CollectionUtils.isEmpty(taxons) && getModel().getTaxon() != null) {
getModel().setTaxon(null);
} else if (taxons.size() == 1) {
getModel().setTaxon(taxons.get(0));
// Don't auto-select unique value (Mantis #49551)
// } else if (taxons.size() == 1) {
// getModel().setTaxon(taxons.get(0));
}
}
......@@ -263,11 +267,22 @@ public class OperationMeasurementsTabUIHandler extends AbstractReefDbUIHandler<O
return;
}
getModel().setAdjusting(true);
if (firstLoad) {
firstLoad = false;
// prepare combo boxes
updateTaxonGroupComboBox(null, false);
updateTaxonComboBox(null, false);
// prepare combo boxes
updateTaxonGroupComboBox(null, false);
updateTaxonComboBox(null, false);
// auto-select filters if unique (Mantis #49551)
if (CollectionUtils.size(getUI().getSelectionGroupeTaxonCombo().getData()) == 1) {
getUI().getSelectionGroupeTaxonCombo().setSelectedItem(getUI().getSelectionGroupeTaxonCombo().getData().get(0));
}
if (CollectionUtils.size(getUI().getSelectionTaxonCombo().getData()) == 1) {
getUI().getSelectionTaxonCombo().setSelectedItem(getUI().getSelectionTaxonCombo().getData().get(0));
}
}
getModel().setAdjusting(true);
List<PmfmStrategyDTO> pmfmStrategies = ReefDbBeans.filterCollection(survey.getPmfmStrategies(), input -> input != null && input.isSampling());
......
......@@ -174,7 +174,9 @@ public class OperationMeasurementsUngroupedTableUIHandler extends AbstractReefDb
getContext().restoreComponentFromSwingSession(getTable());