Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: bd53d0df by Tony Chemit at 2022-11-10T10:55:52+01:00 Labellisation du référentiel 'Type de données des propriétés/matériaux de FOB - Closes #2512 - - - - - ed3a78af by Tony Chemit at 2022-11-10T10:55:52+01:00 Persistence migration - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503 - - - - - f97a3cf9 by Tony Chemit at 2022-11-10T10:57:44+01:00 GUI - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503 - - - - - 14 changed files: - client/core/src/main/resources/fr/ird/observe/client/ui/ObserveCommon.jcss - client/datasource/editor/api/src/main/i18n/getters/java.getter - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/SampleContentTableUIModelStates.java - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/actions/ResetSizeMeasureType.java - client/datasource/editor/api/src/main/resources/fr/ird/observe/client/datasource/editor/api/content/data/sample/CommonSample.jcss - client/datasource/editor/ps/src/main/i18n/getters/java.getter - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jaxx - + client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jcss - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIModelStates.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java - core/services/i18n/src/main/i18n/translations/services_en_GB.properties - core/services/i18n/src/main/i18n/translations/services_es_ES.properties - core/services/i18n/src/main/i18n/translations/services_fr_FR.properties Changes: ===================================== client/core/src/main/resources/fr/ird/observe/client/ui/ObserveCommon.jcss ===================================== @@ -114,11 +114,6 @@ enabled:false; } -.computedDataInformation { - icon:{fr.ird.observe.client.util.UIHelper.getUIManagerActionIcon("data-calcule")}; - disabledIcon:{fr.ird.observe.client.util.UIHelper.getUIManagerActionIcon("data-observe")}; -} - .showReset { showReset:true; } ===================================== client/datasource/editor/api/src/main/i18n/getters/java.getter ===================================== @@ -68,10 +68,6 @@ observe.data.WithDataFile.choose.title.importData observe.data.WithDataFile.delete.data.file.message observe.data.message.will.delete.sub.data.type observe.data.message.will.delete.sub.data.type2 -observe.data.ps.observation.Sample.length.computed.tip -observe.data.ps.observation.Sample.length.observed.tip -observe.data.ps.observation.Sample.weight.computed.tip -observe.data.ps.observation.Sample.weight.observed.tip observe.error.storage.backup.local.db observe.error.storage.close.current.db observe.error.storage.close.local.db @@ -281,7 +277,6 @@ observe.ui.message.db.none.loaded.tip observe.ui.message.delete observe.ui.message.delete.new observe.ui.message.loaded.tip -observe.ui.message.no.species.selected observe.ui.message.quit.invalid.edit observe.ui.message.quit.valid.edit observe.ui.message.show.referential.usages ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/SampleContentTableUIModelStates.java ===================================== @@ -23,10 +23,10 @@ package fr.ird.observe.client.datasource.editor.api.content.data.sample; */ import com.google.common.collect.Maps; -import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.client.datasource.api.cache.ReferencesCache; import fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableUIModel; import fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableUIModelStates; +import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.dto.data.ContainerChildDto; import fr.ird.observe.dto.data.DataDto; import fr.ird.observe.dto.data.ps.observation.SampleMeasureDto; @@ -40,12 +40,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.SIZE_COMPUTED_TIP; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.SIZE_OBSERVED_TIP; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.WEIGHT_COMPUTED_TIP; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.WEIGHT_OBSERVED_TIP; -import static io.ultreia.java4all.i18n.I18n.t; - /** * Created on 08/01/2021. * @@ -75,14 +69,6 @@ public abstract class SampleContentTableUIModelStates<D extends DataDto, C exten public abstract AcquisitionMode getDefaultAcquisitionMode(); - public String getWeightDataTip(boolean computed) { - return computed ? t(WEIGHT_COMPUTED_TIP) : t(WEIGHT_OBSERVED_TIP); - } - - public String getLengthDataTip(boolean computed) { - return computed ? t(SIZE_COMPUTED_TIP) : t(SIZE_OBSERVED_TIP); - } - public SizeMeasureTypeReference getDefaultSizeMeasureType() { return defaultSizeMeasureType; } ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/actions/ResetSizeMeasureType.java ===================================== @@ -31,16 +31,10 @@ import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox; import javax.swing.JButton; import java.awt.event.ActionEvent; -import static io.ultreia.java4all.i18n.I18n.n; import static io.ultreia.java4all.i18n.I18n.t; public class ResetSizeMeasureType<U extends ContentTableUI<?, ?, U>> extends ContentTableUIActionSupport<U> { - public static final String WEIGHT_COMPUTED_TIP = n("observe.data.ps.observation.Sample.weight.computed.tip"); - public static final String WEIGHT_OBSERVED_TIP = n("observe.data.ps.observation.Sample.weight.observed.tip"); - public static final String SIZE_COMPUTED_TIP = n("observe.data.ps.observation.Sample.length.computed.tip"); - public static final String SIZE_OBSERVED_TIP = n("observe.data.ps.observation.Sample.length.observed.tip"); - public static final String NO_SPECIES_SELECTED = n("observe.ui.message.no.species.selected"); private final FilterableComboBox<?> combo; public static <U extends ContentTableUI<?, ?, U>> void install(U ui, JButton editor, FilterableComboBox<?> combo) { ===================================== client/datasource/editor/api/src/main/resources/fr/ird/observe/client/datasource/editor/api/content/data/sample/CommonSample.jcss ===================================== @@ -66,16 +66,6 @@ focusable:false; } -#lengthSourceInformation { - enabled: {tableEditBean.isIsLengthComputed()}; - toolTipText:{getStates().getLengthDataTip(tableEditBean.isIsLengthComputed())}; -} - -#weightSourceInformation { - enabled: {tableEditBean.getAcquisitionMode() == 1 && tableEditBean.isIsWeightComputed()}; - toolTipText:{getStates().getWeightDataTip(tableEditBean.isIsWeightComputed())}; -} - #tagNumber { enabled:{tableEditBean.getAcquisitionMode() == 1}; } ===================================== client/datasource/editor/ps/src/main/i18n/getters/java.getter ===================================== @@ -29,6 +29,10 @@ observe.data.ps.observation.Catch.totalCountComputed.observed.tip observe.data.ps.observation.Route.choice.create.fin.veille.activity observe.data.ps.observation.Route.choice.not.create.fin.veille.activity.and.continue observe.data.ps.observation.Route.message.need.fin.veille.activity +observe.data.ps.observation.Sample.length.computed.tip +observe.data.ps.observation.Sample.length.observed.tip +observe.data.ps.observation.Sample.weight.computed.tip +observe.data.ps.observation.Sample.weight.observed.tip observe.data.ps.observation.Set.schoolType.not.fill observe.referential.Referential.type observe.ui.action.copyCoordinate ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jaxx ===================================== @@ -187,7 +187,7 @@ <JPanel id="invisible"> <JButton id="defaultSizeMeasureType"/> <JButton id="defaultWeightMeasureType"/> - <JButton id='lengthSourceInformation' styleClass='computedDataInformation' onActionPerformed='handler.resetIsLengthComputed()'/> - <JButton id='weightSourceInformation' styleClass='computedDataInformation' onActionPerformed='handler.resetIsWeightComputed()'/> + <JButton id='lengthSourceInformation' onActionPerformed='handler.resetIsLengthComputed()'/> + <JButton id='weightSourceInformation' onActionPerformed='handler.resetIsWeightComputed()'/> </JPanel> </fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableUI> ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jcss ===================================== @@ -0,0 +1,35 @@ +/*- + * #%L + * ObServe Client :: DataSource :: Editor :: PS + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +#lengthSourceInformation { + enabled: {tableEditBean.isIsLengthComputed()}; + toolTipText:{getStates().getLengthDataTip(tableEditBean.isIsLengthComputed())}; + icon:{getStates().getSourceInformationIcon(tableEditBean.isIsLengthComputed())}; + disabledIcon:{getStates().getSourceInformationIcon(tableEditBean.isIsLengthComputed())}; +} + +#weightSourceInformation { + enabled: {tableEditBean.getAcquisitionMode() == 1 && tableEditBean.isIsWeightComputed()}; + toolTipText:{getStates().getWeightDataTip(tableEditBean.isIsWeightComputed())}; + icon:{getStates().getSourceInformationIcon(tableEditBean.isIsWeightComputed())}; + disabledIcon:{getStates().getSourceInformationIcon(tableEditBean.isIsWeightComputed())}; +} ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java ===================================== @@ -21,9 +21,9 @@ */ package fr.ird.observe.client.datasource.editor.ps.data.observation; -import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType; import fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetWeightMeasureType; +import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.dto.data.ps.observation.SampleMeasureDto; import fr.ird.observe.dto.referential.common.SizeMeasureTypeReference; import fr.ird.observe.dto.referential.common.SpeciesReference; @@ -251,7 +251,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler { protected void onWeightChanged(Float newValue) { SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean(); - tableEditBean.setIsWeightComputed(false); + if (tableEditBean.getAcquisitionMode() == 1) { + tableEditBean.setIsWeightComputed(false); + } if (newValue == null) { tableEditBean.setWeightMeasureMethod(null); } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIModelStates.java ===================================== @@ -26,6 +26,7 @@ import fr.ird.observe.client.configuration.ClientConfig; import fr.ird.observe.client.datasource.api.cache.ReferencesCache; import fr.ird.observe.client.datasource.api.cache.ReferencesFilterHelper; import fr.ird.observe.client.datasource.editor.api.content.data.sample.SampleContentTableUIModelStates; +import fr.ird.observe.client.util.UIHelper; import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.dto.data.ps.observation.SampleDto; import fr.ird.observe.dto.data.ps.observation.SampleMeasureDto; @@ -35,11 +36,25 @@ import fr.ird.observe.navigation.id.Project; import fr.ird.observe.services.ObserveServicesProvider; import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition; +import javax.swing.Icon; + +import static io.ultreia.java4all.i18n.I18n.n; +import static io.ultreia.java4all.i18n.I18n.t; + @GenerateJavaBeanDefinition public class SampleUIModelStates extends SampleContentTableUIModelStates<SampleDto, SampleMeasureDto> { + public static final String WEIGHT_COMPUTED_TIP = n("observe.data.ps.observation.Sample.weight.computed.tip"); + public static final String WEIGHT_OBSERVED_TIP = n("observe.data.ps.observation.Sample.weight.observed.tip"); + public static final String SIZE_COMPUTED_TIP = n("observe.data.ps.observation.Sample.length.computed.tip"); + public static final String SIZE_OBSERVED_TIP = n("observe.data.ps.observation.Sample.length.observed.tip"); + private final Icon computedIcon; + private final Icon observedIcon; + public SampleUIModelStates(GeneratedSampleUIModel model) { super(model, SampleDto.newDto(new java.util.Date()), SampleMeasureDto.newDto(new java.util.Date()), model.getSource().getInitializer().getSelectedId(), model.getSource().getInitializer().getScope().isStandalone()); + this.computedIcon = UIHelper.getUIManagerActionIcon("data-calcule"); + this.observedIcon = UIHelper.getUIManagerActionIcon("data-observe"); } @Override @@ -65,4 +80,16 @@ public class SampleUIModelStates extends SampleContentTableUIModelStates<SampleD return beanToSave; } + public String getWeightDataTip(boolean computed) { + return computed ? t(WEIGHT_COMPUTED_TIP) : t(WEIGHT_OBSERVED_TIP); + } + + public String getLengthDataTip(boolean computed) { + return computed ? t(SIZE_COMPUTED_TIP) : t(SIZE_OBSERVED_TIP); + } + + public Icon getSourceInformationIcon(boolean computed) { + return computed ? computedIcon : observedIcon; + } + } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java ===================================== @@ -372,6 +372,10 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe this.sample_idx = resultSet.getInt(20); this.lengthMeasureMethod = resultSet.getString(21); this.weightMeasureMethod = resultSet.getString(22); + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2503 + if (acquisitionMode == 0 && weight != null && !isWeightComputed) { + isWeightComputed = true; + } } } ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1677,7 +1677,7 @@ observe.referential.ps.common.ObjectMaterial.validation=Validation observe.referential.ps.common.ObjectMaterial.validation.bad.parentCode=Code should starts with %1$s- observe.referential.ps.common.ObjectMaterial.validation.invalid.validation=Validation formula is not valid. observe.referential.ps.common.ObjectMaterial.validationInformation=Validation formula must contains variable x -observe.referential.ps.common.ObjectMaterialType.type=Floating objet material type +observe.referential.ps.common.ObjectMaterialType.type=Data type of properties/material of FOB observe.referential.ps.common.ObjectOperation.atLeastOneSelected=Domain observe.referential.ps.common.ObjectOperation.type=Object operation observe.referential.ps.common.ObjectOperation.validation.atLeastOneSelected=At least one domain must be selected. ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1677,7 +1677,7 @@ observe.referential.ps.common.ObjectMaterial.validation=Validation \#TODO observe.referential.ps.common.ObjectMaterial.validation.bad.parentCode=Code should starts with %1$s- \#TODO observe.referential.ps.common.ObjectMaterial.validation.invalid.validation=La formule de validation n'est pas cohérente. \#TODO observe.referential.ps.common.ObjectMaterial.validationInformation=La formule de validation doit contenir la variable x \#TODO -observe.referential.ps.common.ObjectMaterialType.type=Type d'objet flottant \#TODO +observe.referential.ps.common.ObjectMaterialType.type=Data type of properties/material of FOB \#TODO observe.referential.ps.common.ObjectOperation.atLeastOneSelected=Domain observe.referential.ps.common.ObjectOperation.type=Operación sobre el objeto observe.referential.ps.common.ObjectOperation.validation.atLeastOneSelected=At least one domain must be selected. ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1677,7 +1677,7 @@ observe.referential.ps.common.ObjectMaterial.validation=Validation observe.referential.ps.common.ObjectMaterial.validation.bad.parentCode=Le code doit commencer par %1$s- observe.referential.ps.common.ObjectMaterial.validation.invalid.validation=La formule de validation n'est pas cohérente. observe.referential.ps.common.ObjectMaterial.validationInformation=La formule de validation doit contenir la variable x -observe.referential.ps.common.ObjectMaterialType.type=Type d'objet flottant +observe.referential.ps.common.ObjectMaterialType.type=Type de données des propriétés/matériaux de FOB observe.referential.ps.common.ObjectOperation.atLeastOneSelected=Sous-domaine observe.referential.ps.common.ObjectOperation.type=Opération sur l'objet observe.referential.ps.common.ObjectOperation.validation.atLeastOneSelected=Veuillez sélectionner au moins un sous domaine. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/d67d2179b9e61a36ecf3d7571... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/d67d2179b9e61a36ecf3d7571... You're receiving this email because of your account on gitlab.com.