Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: fc4ee4b9 by Tony Chemit at 2023-01-04T15:11:19+01:00 Amélioration du texte d'information quand on ne peut pas encore remplir le marché local - closes #2586 - - - - - 6836cd1c by Tony Chemit at 2023-01-04T16:03:51+01:00 Ajout sur le formulaire d'une information sur la saisie possible ou non du marché local à partir du port d'arrivée sélectionné - closes #2590 - - - - - 14 changed files: - client/datasource/editor/ps/src/main/i18n/getters/java.getter - client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_en_GB.ftl - client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_es_ES.ftl - client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_fr_FR.ftl - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUI.jaxx - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUI.jcss - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIModelStates.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/predicates/CheckTripLocalMarketAcquisitionStatus.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/predicates/CheckTripSupport.java - core/api/dto-decoration/src/main/i18n/getters/labels.getter - 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 - model/src/main/models/Observe/dto/class/i18nLabels.properties Changes: ===================================== client/datasource/editor/ps/src/main/i18n/getters/java.getter ===================================== @@ -6,6 +6,8 @@ observe.Common.whenArriving observe.Common.whenLeaving observe.data.Activity.comment2 observe.data.message.will.delete.sub.data +observe.data.ps.common.Trip.landingHarbour.localMarketNotPossible +observe.data.ps.common.Trip.landingHarbour.localMarketPossible observe.data.ps.dcp.FloatingObjectPreset.action.add observe.data.ps.dcp.FloatingObjectPreset.action.add.tip observe.data.ps.dcp.FloatingObjectPreset.add.title ===================================== client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_en_GB.ftl ===================================== @@ -20,23 +20,35 @@ <html> <body> <p> - To be able to acquire data of type <i>${dtoLabel}</i>, the trip form must first be completed: + To acquire <i>${dtoLabel}</i> data, the trip form must first be completed: </p> <ul> - <li>The <i>Local market collection</i> must be filled with a value that indicate presence of data</li> - <li>The <i>Logbook and associated data</i> tab must be properly filled</li> + <li>The <i>landing harbour</i> must be filled in</li> + <li>This harbour must have packaging reference data associated with it</li> + <li>The tab named <i>Logbook and associated data</i> must be properly filled in</li> + <li>The field named <i>Local market collection</i> must be filled in with a value that indicates existence of data</li> </ul> <hr/> <br/> <p> - Click on <b>Access to trip form</b> to fill properly the form and save.. + Click on <b>Access to trip form</b> to fill in properly the form and save. </p> <br/> -<p>The <i>Local market collection</i> widget will be focused in the proper tab. +<p> + If <i>landing harbour</i> is not filled in, +<ul> + <li>Its widget will be focused in the proper tab, to enable you to fill in it</li> + <li>Once the landing harbour is provided, you need to fill in the tab named <i>Local market collection</i> in the proper tab</li> +</ul> +</p> +<p> + <b>If <i>landing harbour</i> is filled in, but doesn't have packaging reference data associated associated with it, you will not be able to acquire local market data.</b> +</p> +<p>In other cases, the field named <i>Local market collection</i> is focused in the proper tab. </p> <br/> <p> - You can then enter the data. + You can then acquire <i>${dtoLabel}</i> data. </p> </body> </html> ===================================== client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_es_ES.ftl ===================================== @@ -21,23 +21,35 @@ <body> <h1>#TODO</h1> <p> - To be able to acquire data of type <i>${dtoLabel}</i>, the trip form must first be completed: + To acquire <i>${dtoLabel}</i> data, the trip form must first be completed: </p> <ul> - <li>The <i>Local market collection</i> must be filled with a value that indicate presence of data</li> - <li>The <i>Logbook and associated data</i> tab must be properly filled</li> + <li>The <i>landing harbour</i> must be filled in</li> + <li>This harbour must have packaging reference data associated with it</li> + <li>The tab named <i>Logbook and associated data</i> must be properly filled in</li> + <li>The field named <i>Local market collection</i> must be filled in with a value that indicates existence of data</li> </ul> <hr/> <br/> <p> - Click on <b>Access to trip form</b> to fill properly the form and save.. + Click on <b>Access to trip form</b> to fill in properly the form and save. </p> <br/> -<p>The <i>Local market collection</i> widget will be focused in the proper tab. +<p> + If <i>landing harbour</i> is not filled in, +<ul> + <li>Its widget will be focused in the proper tab, to enable you to fill in it</li> + <li>Once the landing harbour is provided, you need to fill in the tab named <i>Local market collection</i> in the proper tab</li> +</ul> +</p> +<p> + <b>If <i>landing harbour</i> is filled in, but doesn't have packaging reference data associated associated with it, you will not be able to acquire local market data.</b> +</p> +<p>In other cases, the field named <i>Local market collection</i> is focused in the proper tab. </p> <br/> <p> - You can then enter the data. + You can then acquire <i>${dtoLabel}</i> data. </p> </body> </html> ===================================== client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_fr_FR.ftl ===================================== @@ -23,18 +23,30 @@ Pour pouvoir créer une donnée de type <i>${dtoLabel}</i>, le formulaire marée doit d'abord être complété : </p> <ul> - <li>La valeur du champs <i>Collecte du marché local</i> doit être renseignée avec une valeur reflétant l'existence de données</li> + <li>Le port d'arrivée doit être renseigné</li> + <li>Ce port doit disposer d'un référentiel de conditionnements</li> <li>L'onglet <i>Livre de bord et données associées</i> doit être renseigné</li> + <li>Le champ <i>Collecte du marché local</i> doit être renseigné avec une valeur attestant de l'existence de données</li> </ul> <hr/> <br/> <p> - Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. + Cliquez sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer. <p> -<br/> -<p> Vous serez redirigé vers l'onglet à renseigner et le champs <i>Collecte du marché local</i> sera sélectionné. + <br/> +<p> + Si le port d'arrivée n'est pas renseigné : +<ul> + <li>Vous serez redirigé vers l'onglet « Caractéristiques générales », et le champs <i>Port d'arrivée</i> sera sélectionné pour vous permettre de le saisir.</li> + <li>Une fois celui-ci renseigné, il vous faudra aller renseigner le champs <i>Collecte du marché local</i> sur l'onglet <i>Livre de bord et données associées</i></li> +</ul> +</p> +<p> + <b>Si le port d'arrivée est renseigné mais que celui-ci ne dispose pas d'un référentiel de conditionnements, il ne sera pas possible de saisir des données de marché local.</b> +</p> +<p>Si le port d'arrivée est renseigné et dispose d'un référentiel de conditionnements, vous serez directement redirigé vers l'onglet <i>Livre de bord et données associées</i>, et le champ <i>Collecte du marché local</i> sera sélectionné pour vous permettre de le saisir. </p> <br/> -<p> Vous pourrez ensuite saisir la donnée souhaitée.</p> +<p>Vous pourrez ensuite saisir les données du <i>${dtoLabel}</i>.</p> </body> </html> ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUI.jaxx ===================================== @@ -113,6 +113,11 @@ <FilterableComboBox id='landingHarbour' genericType='HarbourReference'/> </cell> </row> + <row> + <cell anchor='west' columns="2"> + <JLabel id='landingHarbourMessage' styleClass="skipI18n"/> + </cell> + </row> <row> <cell anchor='west'> <JLabel id='homeIdLabel'/> ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUI.jcss ===================================== @@ -24,6 +24,11 @@ enabled:{!states.isUpdatingMode() || bean.isRouteObsEmpty()}; } +#landingHarbourMessage { + icon:{states.getLandingHarbourMessageIcon(states.isLocalmarketPossible())}; + text:{states.getLandingHarbourMessage(states.isLocalmarketPossible())}; +} + #formsUrl { openLinkTip:"observe.data.ps.common.Trip.action.openLinkFormsUrl.tip"; } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIModelStates.java ===================================== @@ -41,8 +41,11 @@ import fr.ird.observe.dto.referential.ps.logbook.WellContentStatusReference; import fr.ird.observe.navigation.id.Project; import fr.ird.observe.services.ObserveServicesProvider; import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition; +import io.ultreia.java4all.i18n.I18n; import io.ultreia.java4all.util.Dates; +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; +import javax.swing.Icon; import java.beans.PropertyChangeEvent; import java.util.Date; import java.util.Objects; @@ -133,6 +136,20 @@ public class TripUIModelStates extends GeneratedTripUIModelStates { firePropertyChange(PROPERTY_LOCALMARKET_POSSIBLE, oldValue, localmarketPossible); } + public Icon getLandingHarbourMessageIcon(boolean localmarketPossible) { + if (localmarketPossible) { + return SwingValidatorUtil.getInfoIcon(); + } + return SwingValidatorUtil.getErrorIcon(); + } + + public String getLandingHarbourMessage(boolean localmarketPossible) { + if (localmarketPossible) { + return I18n.t("observe.data.ps.common.Trip.landingHarbour.localMarketPossible"); + } + return I18n.t("observe.data.ps.common.Trip.landingHarbour.localMarketNotPossible"); + } + public void setDefaultObservationValues(boolean reset) { TripDto bean = getBean(); if (reset) { ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/predicates/CheckTripLocalMarketAcquisitionStatus.java ===================================== @@ -45,7 +45,13 @@ import java.util.Set; public class CheckTripLocalMarketAcquisitionStatus<U extends ContentUI, D extends DataDto> extends CheckTripSupport<U, D> { public CheckTripLocalMarketAcquisitionStatus() { - super(Set.of(TripLocalmarketDto.class, TripBatchDto.class), TripReference::isLocalmarketEnabled, TripUI::getLogbookTab, TripUI::getLocalMarketAcquisitionStatus); + super(Set.of(TripLocalmarketDto.class, TripBatchDto.class), + TripReference::isLocalmarketEnabled, + TripUI::getLogbookTab, + TripUI::getLocalMarketAcquisitionStatus, + r -> r.getStates().isLocalmarketPossible(), + TripUI::getGeneralTab, + TripUI::getLandingHarbour); } @Override ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/predicates/CheckTripSupport.java ===================================== @@ -49,16 +49,42 @@ public abstract class CheckTripSupport<U extends ContentUI, D extends DataDto> e private final Predicate<TripReference> tripPredicate; private TripUINavigationNode tripNode; - public CheckTripSupport(Set<Class<? extends DataDto>> acceptedTypes, Predicate<TripReference> tripPredicate, Function<TripUI, TabInfo> getTab, Function<TripUI, FilterableComboBox<?>> getCombo) { + public CheckTripSupport(Set<Class<? extends DataDto>> acceptedTypes, + Predicate<TripReference> tripPredicate, + Function<TripUI, TabInfo> getTab, + Function<TripUI, FilterableComboBox<?>> getCombo) { + super(acceptedTypes, TripUI.class, target -> SwingUtilities.invokeLater(() -> applyStrategy(target, getTab, getCombo))); + this.tripPredicate = Objects.requireNonNull(tripPredicate); + } + + public CheckTripSupport(Set<Class<? extends DataDto>> acceptedTypes, + Predicate<TripReference> tripPredicate, + Function<TripUI, TabInfo> getTab, + Function<TripUI, FilterableComboBox<?>> getCombo, + Predicate<TripUI> tripPredicate2, + Function<TripUI, TabInfo> getTab2, + Function<TripUI, FilterableComboBox<?>> getCombo2) { super(acceptedTypes, TripUI.class, target -> SwingUtilities.invokeLater(() -> { - TabInfo tabInfo = getTab.apply(target); - target.selectTab(tabInfo); - FilterableComboBox<?> comboBox = getCombo.apply(target); - SwingUtilities.invokeLater(comboBox.getCombobox()::requestFocusInWindow); + if (tripPredicate2.test(target)) { + // the second predicate is ok, use the first behaviour + applyStrategy(target, getTab, getCombo); + } else { + // the second predicate is ko, use the second behaviour + applyStrategy(target, getTab2, getCombo2); + } })); this.tripPredicate = Objects.requireNonNull(tripPredicate); } + private static void applyStrategy(TripUI target, + Function<TripUI, TabInfo> getTab, + Function<TripUI, FilterableComboBox<?>> getCombo) { + TabInfo tabInfo = getTab.apply(target); + target.selectTab(tabInfo); + FilterableComboBox<?> comboBox = getCombo.apply(target); + SwingUtilities.invokeLater(comboBox.getCombobox()::requestFocusInWindow); + } + @Override public final boolean checkCanCreate(U source, Class<D> dtoType) { TripReference reference = (TripReference) getTripNode(source).getCapability().getReference(); ===================================== core/api/dto-decoration/src/main/i18n/getters/labels.getter ===================================== @@ -776,6 +776,9 @@ observe.data.ps.common.Trip.departureWellContentStatus observe.data.ps.common.Trip.fishingTime observe.data.ps.common.Trip.landingAcquisitionStatus observe.data.ps.common.Trip.landingAcquisitionStatusLabel.tip +observe.data.ps.common.Trip.landingHarbour.localMarketNotPossible +observe.data.ps.common.Trip.landingHarbour.localMarketPossible +observe.data.ps.common.Trip.landingHarbour.requiredForLocalMarket observe.data.ps.common.Trip.landingTotalWeight observe.data.ps.common.Trip.landingWellContentStatus observe.data.ps.common.Trip.localMarketAcquisitionStatusLabel.tip ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -916,6 +916,9 @@ observe.data.ps.common.Trip.fishingTime=Fishing time (h) observe.data.ps.common.Trip.gearUseFeaturesStat=Count of vessel equipment observe.data.ps.common.Trip.landingAcquisitionStatus=Landing sheet collection observe.data.ps.common.Trip.landingAcquisitionStatusLabel.tip=Only choices that indicate existence of data allow acquisition for landing +observe.data.ps.common.Trip.landingHarbour.localMarketNotPossible=Local market data can not be acquired using this landing harbour +observe.data.ps.common.Trip.landingHarbour.localMarketPossible=Local market data can be acquired using this landing harbour +observe.data.ps.common.Trip.landingHarbour.requiredForLocalMarket=The landing harbour is required to acquire local market data observe.data.ps.common.Trip.landingStat=Count of landing observe.data.ps.common.Trip.landingTotalWeight=Landing total weight (t) observe.data.ps.common.Trip.landingWellContentStatus=Landing well content status ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -916,6 +916,9 @@ observe.data.ps.common.Trip.fishingTime=Heures de peche \#TODO observe.data.ps.common.Trip.gearUseFeaturesStat=Count of vessel equipment observe.data.ps.common.Trip.landingAcquisitionStatus=Landing sheet collection \#TODO observe.data.ps.common.Trip.landingAcquisitionStatusLabel.tip=Only choices that indicate existence of data allow acquisition for landing +observe.data.ps.common.Trip.landingHarbour.localMarketNotPossible=Local market data can not be acquired using this landing harbour \#TODO +observe.data.ps.common.Trip.landingHarbour.localMarketPossible=Local market data can be acquired using this landing harbour \#TODO +observe.data.ps.common.Trip.landingHarbour.requiredForLocalMarket=The landing harbour is required to acquire local market data \#TODO observe.data.ps.common.Trip.landingStat=Count of landing observe.data.ps.common.Trip.landingTotalWeight=Total débarqué (en t) \#TODO observe.data.ps.common.Trip.landingWellContentStatus=État de remplissage des cuves après débarquement \#TODO ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -916,6 +916,9 @@ observe.data.ps.common.Trip.fishingTime=Heures de pêche observe.data.ps.common.Trip.gearUseFeaturesStat=Nombre d'équipements observe.data.ps.common.Trip.landingAcquisitionStatus=Collecte du bon de débarquement observe.data.ps.common.Trip.landingAcquisitionStatusLabel.tip=Seuls les choix reflétant l'existence des données permettront la collecte du bon de débarquement +observe.data.ps.common.Trip.landingHarbour.localMarketNotPossible=Il n'est pas possible de saisir des données du marché local avec le port d'arrivée sélectionné +observe.data.ps.common.Trip.landingHarbour.localMarketPossible=Il est possible de saisir des données du marché local avec le port d'arrivée sélectionné +observe.data.ps.common.Trip.landingHarbour.requiredForLocalMarket=Il faut renseigner un port d'arrivée pour permettre la saisie des données du marché local observe.data.ps.common.Trip.landingStat=Nombre de débarquements observe.data.ps.common.Trip.landingTotalWeight=Total débarqué (en t) observe.data.ps.common.Trip.landingWellContentStatus=État de remplissage des cuves après débarquement ===================================== model/src/main/models/Observe/dto/class/i18nLabels.properties ===================================== @@ -56,7 +56,7 @@ data.ll.observation.Tdr=basket,branchline,deploymentEnd,deploymentStart,fishingE data.ll.observation.WeightMeasure=weight,weightMeasureType data.ps.common.GearUseFeatures=comment,gear,gearUseFeaturesMeasurement,number,usedInTrip data.ps.common.GearUseFeaturesMeasurement=gearCharacteristic,measurementValue -data.ps.common.Trip=advancedSamplingAcquisitionStatus,captain,departureHarbour,departureWellContentStatus,endDate,ersId,fishingTime,formsUrl,generalComment,landingAcquisitionStatus,landingHarbour,landingTotalWeight,landingWellContentStatus,localMarketAcquisitionStatus,localMarketSurveySamplingAcquisitionStatus,localMarketTotalWeight,localMarketWellsSamplingAcquisitionStatus,loch,logbookAcquisitionStatus,logbookComment,logbookDataEntryOperator,logbookDataQuality,observationsAcquisitionStatus,observationsComment,observationsDataEntryOperator,observationsDataQuality,observer,ocean,observationsProgram,logbookProgram,reportsUrl,routeLogbook,routeObs,startDate,targetWellsSamplingAcquisitionStatus,timeAtSea,vessel,generalTab,action.openLinkFormsUrl.tip,action.openLinkReportsUrl.tip,landingAcquisitionStatusLabel.tip,localMarketAcquisitionStatusLabel.tip,localMarketSurveySamplingAcquisitionStatusLabel.tip,localMarketWellsSamplingAcquisitionStatusLabel.tip,logbookAcquisitionStatusLabel.tip,logbookTab,mapTab,observationsAcquisitionStatusLabel.tip,observationsTab,targetWellsSamplingAcquisitionStatusLabel.tip,action.create,choice.go.to.trip,list.navigation.node,list.title,message.not.open,navigation.unsaved,observationsTab,title.can.not.create.trip.sub.data,list.title,type,title,root.list.message.none,logbookDataEntryOperator.validation.required,logbookDataQuality.validation.required,logbookProgram.validation.required,observationsDataEntryOperator.validation.required,observationsProgram.validation.required,observer.validation.required +data.ps.common.Trip=advancedSamplingAcquisitionStatus,captain,departureHarbour,departureWellContentStatus,endDate,ersId,fishingTime,formsUrl,generalComment,landingAcquisitionStatus,landingHarbour,landingTotalWeight,landingWellContentStatus,localMarketAcquisitionStatus,localMarketSurveySamplingAcquisitionStatus,localMarketTotalWeight,localMarketWellsSamplingAcquisitionStatus,loch,logbookAcquisitionStatus,logbookComment,logbookDataEntryOperator,logbookDataQuality,observationsAcquisitionStatus,observationsComment,observationsDataEntryOperator,observationsDataQuality,observer,ocean,observationsProgram,logbookProgram,reportsUrl,routeLogbook,routeObs,startDate,targetWellsSamplingAcquisitionStatus,timeAtSea,vessel,generalTab,action.openLinkFormsUrl.tip,action.openLinkReportsUrl.tip,landingAcquisitionStatusLabel.tip,localMarketAcquisitionStatusLabel.tip,localMarketSurveySamplingAcquisitionStatusLabel.tip,localMarketWellsSamplingAcquisitionStatusLabel.tip,logbookAcquisitionStatusLabel.tip,logbookTab,mapTab,observationsAcquisitionStatusLabel.tip,observationsTab,targetWellsSamplingAcquisitionStatusLabel.tip,action.create,choice.go.to.trip,list.navigation.node,list.title,message.not.open,navigation.unsaved,observationsTab,title.can.not.create.trip.sub.data,list.title,type,title,root.list.message.none,logbookDataEntryOperator.validation.required,logbookDataQuality.validation.required,logbookProgram.validation.required,observationsDataEntryOperator.validation.required,observationsProgram.validation.required,observer.validation.required,landingHarbour.localMarketPossible,landingHarbour.localMarketNotPossible,landingHarbour.requiredForLocalMarket data.ps.common.TripGearUseFeatures=gearUseFeatures data.ps.common.TripLocalmarket=localMarketAcquisitionStatus,localMarketSurveySamplingAcquisitionStatus,localMarketWellsSamplingAcquisitionStatus data.ps.common.TripLogbook=logbookAcquisitionStatus,targetWellsSamplingAcquisitionStatus View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ba70fbc5555f2f90d95de241e... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ba70fbc5555f2f90d95de241e... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)