Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: ba70fbc5 by Tony Chemit at 2023-01-04T14:13:55+01:00 Amélioration du texte d'information quand on ne peut pas encore remplir le marché local - closes #2586 - - - - - 5 changed files: - 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/predicates/CheckTripLocalMarketAcquisitionStatus.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/predicates/CheckTripSupport.java Changes: ===================================== client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_en_GB.ftl ===================================== @@ -23,6 +23,7 @@ To be able to acquire data of type <i>${dtoLabel}</i>, the trip form must first be completed: </p> <ul> + <li>The <i>landing harbour</i> must be filled (<i>with a packaging referential filled</i>)</li> <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> </ul> @@ -32,7 +33,17 @@ Click on <b>Access to trip form</b> to fill 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, + <ul> + <li>his widget will be focused in the proper tab</li> + <li>once the landing harbour filled (<i>with a packaging referential filled</i>, you will need to fill the <i>Local market collection</i> in the proper tab</li> +</ul> +</p> +<p> + <b>If <i>landing harbour</i> is filled, but with no <i>packaging referential filled</i>, you will not be able to add local market data.</b> +</p> +<p>In other cases, the <i>Local market collection</i> widget will be focused in the proper tab. </p> <br/> <p> ===================================== client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_es_ES.ftl ===================================== @@ -24,6 +24,7 @@ To be able to acquire data of type <i>${dtoLabel}</i>, the trip form must first be completed: </p> <ul> + <li>The <i>landing harbour</i> must be filled (<i>with a packaging referential filled</i>)</li> <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> </ul> @@ -33,7 +34,17 @@ Click on <b>Access to trip form</b> to fill 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, +<ul> + <li>his widget will be focused in the proper tab</li> + <li>once the landing harbour filled (<i>with a packaging referential filled</i>, you will need to fill the <i>Local market collection</i> in the proper tab</li> +</ul> +</p> +<p> + <b>If <i>landing harbour</i> is filled, but with no <i>packaging referential filled</i>, you will not be able to add local market data.</b> +</p> +<p>In other cases, the <i>Local market collection</i> widget will be focused in the proper tab. </p> <br/> <p> ===================================== client/datasource/editor/ps/src/main/i18n/templates/checkPsTripLocalMarketAcquisitionStatus_fr_FR.ftl ===================================== @@ -23,6 +23,7 @@ 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>Le port d'arrivée doit être renseigné (<i>avec un référentiel de conditionnements remplis)</i></li> <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>L'onglet <i>Livre de bord et données associées</i> doit être renseigné</li> </ul> @@ -32,7 +33,17 @@ Cliquer 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é. +<p> + Si le port d'arrivée n'est pas renseigné, + <ul> + <li>vous serez redirigé vers l'onglet « général » et le champs <i>Port d'arrivée</i> sera sélectionné.</li> + <li>une fois celui-ci renseigné (<i>avec un référentiel de conditionnements remplis)</i>, il vous faudra aller renseigner le champs <i>Collecte du marché local</i> dans l'onglet dédié</li> +</ul> +</p> +<p> + <b>Si le port d'arrivée est renseigné mais que celui-ci ne possède pas de référentiel de conditionnements remplis, il n'est pas possible de saisir des données du marché local.</b> +</p> +<p>Si le port d'arrivée est renseigné (avec un référentiel de conditionnements remplis), vous serez redirigé vers l'onglet à renseigner et le champs <i>Collecte du marché local</i> sera sélectionné. </p> <br/> <p> Vous pourrez ensuite saisir la donnée souhaitée.</p> ===================================== 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(); View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/ba70fbc5555f2f90d95de241ee... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/ba70fbc5555f2f90d95de241ee... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)