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
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:
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | To be able to acquire data of type <i>${dtoLabel}</i>, the trip form must first be completed:
|
| 24 | 24 | </p>
|
| 25 | 25 | <ul>
|
| 26 | + <li>The <i>landing harbour</i> must be filled (<i>with a packaging referential filled</i>)</li>
|
|
| 26 | 27 | <li>The <i>Local market collection</i> must be filled with a value that indicate presence of data</li>
|
| 27 | 28 | <li>The <i>Logbook and associated data</i> tab must be properly filled</li>
|
| 28 | 29 | </ul>
|
| ... | ... | @@ -32,7 +33,17 @@ |
| 32 | 33 | Click on <b>Access to trip form</b> to fill properly the form and save.
|
| 33 | 34 | </p>
|
| 34 | 35 | <br/>
|
| 35 | -<p>The <i>Local market collection</i> widget will be focused in the proper tab.
|
|
| 36 | +<p>
|
|
| 37 | + If <i>landing harbour</i> is not filled,
|
|
| 38 | + <ul>
|
|
| 39 | + <li>his widget will be focused in the proper tab</li>
|
|
| 40 | + <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>
|
|
| 41 | +</ul>
|
|
| 42 | +</p>
|
|
| 43 | +<p>
|
|
| 44 | + <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>
|
|
| 45 | +</p>
|
|
| 46 | +<p>In other cases, the <i>Local market collection</i> widget will be focused in the proper tab.
|
|
| 36 | 47 | </p>
|
| 37 | 48 | <br/>
|
| 38 | 49 | <p>
|
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | To be able to acquire data of type <i>${dtoLabel}</i>, the trip form must first be completed:
|
| 25 | 25 | </p>
|
| 26 | 26 | <ul>
|
| 27 | + <li>The <i>landing harbour</i> must be filled (<i>with a packaging referential filled</i>)</li>
|
|
| 27 | 28 | <li>The <i>Local market collection</i> must be filled with a value that indicate presence of data</li>
|
| 28 | 29 | <li>The <i>Logbook and associated data</i> tab must be properly filled</li>
|
| 29 | 30 | </ul>
|
| ... | ... | @@ -33,7 +34,17 @@ |
| 33 | 34 | Click on <b>Access to trip form</b> to fill properly the form and save.
|
| 34 | 35 | </p>
|
| 35 | 36 | <br/>
|
| 36 | -<p>The <i>Local market collection</i> widget will be focused in the proper tab.
|
|
| 37 | +<p>
|
|
| 38 | + If <i>landing harbour</i> is not filled,
|
|
| 39 | +<ul>
|
|
| 40 | + <li>his widget will be focused in the proper tab</li>
|
|
| 41 | + <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>
|
|
| 42 | +</ul>
|
|
| 43 | +</p>
|
|
| 44 | +<p>
|
|
| 45 | + <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>
|
|
| 46 | +</p>
|
|
| 47 | +<p>In other cases, the <i>Local market collection</i> widget will be focused in the proper tab.
|
|
| 37 | 48 | </p>
|
| 38 | 49 | <br/>
|
| 39 | 50 | <p>
|
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | Pour pouvoir créer une donnée de type <i>${dtoLabel}</i>, le formulaire marée doit d'abord être complété :
|
| 24 | 24 | </p>
|
| 25 | 25 | <ul>
|
| 26 | + <li>Le port d'arrivée doit être renseigné (<i>avec un référentiel de conditionnements remplis)</i></li>
|
|
| 26 | 27 | <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>
|
| 27 | 28 | <li>L'onglet <i>Livre de bord et données associées</i> doit être renseigné</li>
|
| 28 | 29 | </ul>
|
| ... | ... | @@ -32,7 +33,17 @@ |
| 32 | 33 | Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer.
|
| 33 | 34 | <p>
|
| 34 | 35 | <br/>
|
| 35 | -<p> Vous serez redirigé vers l'onglet à renseigner et le champs <i>Collecte du marché local</i> sera sélectionné.
|
|
| 36 | +<p>
|
|
| 37 | + Si le port d'arrivée n'est pas renseigné,
|
|
| 38 | + <ul>
|
|
| 39 | + <li>vous serez redirigé vers l'onglet « général » et le champs <i>Port d'arrivée</i> sera sélectionné.</li>
|
|
| 40 | + <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>
|
|
| 41 | +</ul>
|
|
| 42 | +</p>
|
|
| 43 | +<p>
|
|
| 44 | + <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>
|
|
| 45 | +</p>
|
|
| 46 | +<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é.
|
|
| 36 | 47 | </p>
|
| 37 | 48 | <br/>
|
| 38 | 49 | <p> Vous pourrez ensuite saisir la donnée souhaitée.</p>
|
| ... | ... | @@ -45,7 +45,13 @@ import java.util.Set; |
| 45 | 45 | public class CheckTripLocalMarketAcquisitionStatus<U extends ContentUI, D extends DataDto> extends CheckTripSupport<U, D> {
|
| 46 | 46 | |
| 47 | 47 | public CheckTripLocalMarketAcquisitionStatus() {
|
| 48 | - super(Set.of(TripLocalmarketDto.class, TripBatchDto.class), TripReference::isLocalmarketEnabled, TripUI::getLogbookTab, TripUI::getLocalMarketAcquisitionStatus);
|
|
| 48 | + super(Set.of(TripLocalmarketDto.class, TripBatchDto.class),
|
|
| 49 | + TripReference::isLocalmarketEnabled,
|
|
| 50 | + TripUI::getLogbookTab,
|
|
| 51 | + TripUI::getLocalMarketAcquisitionStatus,
|
|
| 52 | + r -> r.getStates().isLocalmarketPossible(),
|
|
| 53 | + TripUI::getGeneralTab,
|
|
| 54 | + TripUI::getLandingHarbour);
|
|
| 49 | 55 | }
|
| 50 | 56 | |
| 51 | 57 | @Override
|
| ... | ... | @@ -49,16 +49,42 @@ public abstract class CheckTripSupport<U extends ContentUI, D extends DataDto> e |
| 49 | 49 | private final Predicate<TripReference> tripPredicate;
|
| 50 | 50 | private TripUINavigationNode tripNode;
|
| 51 | 51 | |
| 52 | - public CheckTripSupport(Set<Class<? extends DataDto>> acceptedTypes, Predicate<TripReference> tripPredicate, Function<TripUI, TabInfo> getTab, Function<TripUI, FilterableComboBox<?>> getCombo) {
|
|
| 52 | + public CheckTripSupport(Set<Class<? extends DataDto>> acceptedTypes,
|
|
| 53 | + Predicate<TripReference> tripPredicate,
|
|
| 54 | + Function<TripUI, TabInfo> getTab,
|
|
| 55 | + Function<TripUI, FilterableComboBox<?>> getCombo) {
|
|
| 56 | + super(acceptedTypes, TripUI.class, target -> SwingUtilities.invokeLater(() -> applyStrategy(target, getTab, getCombo)));
|
|
| 57 | + this.tripPredicate = Objects.requireNonNull(tripPredicate);
|
|
| 58 | + }
|
|
| 59 | + |
|
| 60 | + public CheckTripSupport(Set<Class<? extends DataDto>> acceptedTypes,
|
|
| 61 | + Predicate<TripReference> tripPredicate,
|
|
| 62 | + Function<TripUI, TabInfo> getTab,
|
|
| 63 | + Function<TripUI, FilterableComboBox<?>> getCombo,
|
|
| 64 | + Predicate<TripUI> tripPredicate2,
|
|
| 65 | + Function<TripUI, TabInfo> getTab2,
|
|
| 66 | + Function<TripUI, FilterableComboBox<?>> getCombo2) {
|
|
| 53 | 67 | super(acceptedTypes, TripUI.class, target -> SwingUtilities.invokeLater(() -> {
|
| 54 | - TabInfo tabInfo = getTab.apply(target);
|
|
| 55 | - target.selectTab(tabInfo);
|
|
| 56 | - FilterableComboBox<?> comboBox = getCombo.apply(target);
|
|
| 57 | - SwingUtilities.invokeLater(comboBox.getCombobox()::requestFocusInWindow);
|
|
| 68 | + if (tripPredicate2.test(target)) {
|
|
| 69 | + // the second predicate is ok, use the first behaviour
|
|
| 70 | + applyStrategy(target, getTab, getCombo);
|
|
| 71 | + } else {
|
|
| 72 | + // the second predicate is ko, use the second behaviour
|
|
| 73 | + applyStrategy(target, getTab2, getCombo2);
|
|
| 74 | + }
|
|
| 58 | 75 | }));
|
| 59 | 76 | this.tripPredicate = Objects.requireNonNull(tripPredicate);
|
| 60 | 77 | }
|
| 61 | 78 | |
| 79 | + private static void applyStrategy(TripUI target,
|
|
| 80 | + Function<TripUI, TabInfo> getTab,
|
|
| 81 | + Function<TripUI, FilterableComboBox<?>> getCombo) {
|
|
| 82 | + TabInfo tabInfo = getTab.apply(target);
|
|
| 83 | + target.selectTab(tabInfo);
|
|
| 84 | + FilterableComboBox<?> comboBox = getCombo.apply(target);
|
|
| 85 | + SwingUtilities.invokeLater(comboBox.getCombobox()::requestFocusInWindow);
|
|
| 86 | + }
|
|
| 87 | + |
|
| 62 | 88 | @Override
|
| 63 | 89 | public final boolean checkCanCreate(U source, Class<D> dtoType) {
|
| 64 | 90 | TripReference reference = (TripReference) getTripNode(source).getCapability().getReference();
|