Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

17 changed files:

Changes:

  • client-datasource-editor-common/pom.xml
    ... ... @@ -90,6 +90,11 @@
    90 90
           <version>${project.version}</version>
    
    91 91
         </dependency>
    
    92 92
     
    
    93
    +    <dependency>
    
    94
    +      <groupId>io.ultreia.java4all</groupId>
    
    95
    +      <artifactId>application-template</artifactId>
    
    96
    +    </dependency>
    
    97
    +
    
    93 98
         <dependency>
    
    94 99
           <groupId>io.ultreia.java4all.jaxx</groupId>
    
    95 100
           <artifactId>jaxx-runtime-spi</artifactId>
    

  • client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_en_GB.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client DataSource Editor Common
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +<p>
    
    25
    +  To be able to acquire data of type <i>${dtoType}</i>, the trip form must first be completed:
    
    26
    +</p>
    
    27
    +<ul>
    
    28
    +  <li>The <i>Logbook and associated data</i> checkbox must be checked</li>
    
    29
    +  <li>The <i>Logbook and associated data</i> tab must be properly filled</li>
    
    30
    +</ul>
    
    31
    +<hr/>
    
    32
    +<br/>
    
    33
    +<p>
    
    34
    +  Click on <b>Access to trip form</b> to fill properly the form and save.
    
    35
    +</p>
    
    36
    +<br/>
    
    37
    +<p>The <i>logbook and associated data</i> box will be checked automatically and you will be redirected to the proper
    
    38
    +  tab.
    
    39
    +</p>
    
    40
    +<br/>
    
    41
    +<p>
    
    42
    +  You can then enter the data.
    
    43
    +</p>
    
    44
    +</body>
    
    45
    +</html>

  • client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_es_ES.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client DataSource Editor Common
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +<p>
    
    25
    +  Para poder acceder al diario de pesca (<i>${dtoType}</i>), primero se debe completar el formulario de marea:
    
    26
    +</p>
    
    27
    +<ul>
    
    28
    +  <li>La casilla <i>diario de pesca y datos asociados</i> debe estar marcada</li>
    
    29
    +  <li>Se debe seleccionar la identidad de la persona que registra los datos en el <i>diario de pesca y datos
    
    30
    +      asociados</i> (observador/a u otro/a)
    
    31
    +  </li>
    
    32
    +</ul>
    
    33
    +<hr/>
    
    34
    +<br/>
    
    35
    +<p>
    
    36
    +  Haga click en <b>Acceder al formulario de marea</b> para añadir la identidad de la persona que registra los datos y
    
    37
    +  guardar.
    
    38
    +</p>
    
    39
    +<br/>
    
    40
    +<p>
    
    41
    +  La casilla <i>diario de pesca y datos asociados</i> se marcará automáticamente.
    
    42
    +</p>
    
    43
    +<br/>
    
    44
    +<p>
    
    45
    +  Podrá entonces introducir
    
    46
    +  datos.
    
    47
    +</p>
    
    48
    +</body>
    
    49
    +</html>

  • client-datasource-editor-common/src/main/i18n/templates/askToFillTripLogbook_fr_FR.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client DataSource Editor Common
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +<p>
    
    25
    +  Pour pouvoir créer une donnée de type <i>${dtoType}</i>, le formulaire marée doit d'abord être complété :
    
    26
    +</p>
    
    27
    +<ul>
    
    28
    +  <li>La case <i>Livre de bord et données associées</i> doit être cochée</li>
    
    29
    +  <li>L'onglet <i>Livre de bord et données associées</i> doit dûment renseigné</li>
    
    30
    +</ul>
    
    31
    +<hr/>
    
    32
    +<br/>
    
    33
    +<p>
    
    34
    +  Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer.
    
    35
    +<p>
    
    36
    +<br/>
    
    37
    +<p> La case <i>livre de bord et données associées</i> sera cochée automatiquement, et vous serez redirigé vers l'onglet
    
    38
    +  à renseigner.
    
    39
    +</p>
    
    40
    +<br/>
    
    41
    +<p> Vous pourrez ensuite saisir la donnée souhaitée.</p>
    
    42
    +</body>
    
    43
    +</html>

  • client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_en_GB.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client DataSource Editor Common
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +<p>
    
    25
    +  To be able to acquire data of type <i>${dtoType}</i>, the trip form must first be completed:
    
    26
    +</p>
    
    27
    +<ul>
    
    28
    +  <li>The <i>Observations</i> checkbox must be checked</li>
    
    29
    +  <li>The <i>Observations</i> tab must be properly filled</li>
    
    30
    +</ul>
    
    31
    +<hr/>
    
    32
    +<br/>
    
    33
    +<p>
    
    34
    +  Click on <b>Access to trip form</b> to fill properly the form and save.
    
    35
    +</p>
    
    36
    +<br/>
    
    37
    +<p>The <i>observations</i> box will be checked automatically and you will be redirected to the proper
    
    38
    +  tab.
    
    39
    +</p>
    
    40
    +<br/>
    
    41
    +<p>
    
    42
    +  You can then enter the data.
    
    43
    +</p>
    
    44
    +</body>
    
    45
    +</html>

  • client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_es_ES.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client DataSource Editor Common
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +<p>
    
    25
    +  Para poder acceder al observaciones (<i>${dtoType}</i>), primero se debe completar el formulario de marea:
    
    26
    +</p>
    
    27
    +<ul>
    
    28
    +  <li>La casilla <i>observaciones</i> debe estar marcada</li>
    
    29
    +  <li>Se debe seleccionar la identidad de la persona que registra los datos en el <i>observaciones</i> (observador/a u
    
    30
    +    otro/a)
    
    31
    +  </li>
    
    32
    +</ul>
    
    33
    +<hr/>
    
    34
    +<br/>
    
    35
    +<p>
    
    36
    +  Haga click en <b>Acceder al formulario de marea</b> para añadir la identidad de la persona que registra los datos y
    
    37
    +  guardar.
    
    38
    +</p>
    
    39
    +<br/>
    
    40
    +<p>
    
    41
    +  La casilla <i>observaciones</i> se marcará automáticamente.
    
    42
    +</p>
    
    43
    +<br/>
    
    44
    +<p>
    
    45
    +  Podrá entonces introducir
    
    46
    +  datos.
    
    47
    +</p>
    
    48
    +</body>
    
    49
    +</html>

  • client-datasource-editor-common/src/main/i18n/templates/askToFillTripObservations_fr_FR.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client DataSource Editor Common
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +<p>
    
    25
    +  Pour pouvoir créer une donnée d'observation de type <i>${dtoType}</i>, le formulaire marée doit d'abord être complété
    
    26
    +  :
    
    27
    +</p>
    
    28
    +<ul>
    
    29
    +  <li>La case <i>Observations</i> doit être cochée</li>
    
    30
    +  <li>Le saisisseur des observations doit être sélectionné</li>
    
    31
    +</ul>
    
    32
    +<hr/>
    
    33
    +<br/>
    
    34
    +<p>
    
    35
    +  Cliquer sur <b>Accéder au formulaire marée</b> pour compléter ces données et enregistrer.
    
    36
    +<p>
    
    37
    +  <br/>
    
    38
    +<p> La case <i>observations</i> sera cochée automatiquement, et vous serez redirigé vers l'onglet
    
    39
    +  à renseigner.
    
    40
    +</p>
    
    41
    +<br/>
    
    42
    +<p> Vous pourrez ensuite saisir la donnée souhaitée.</p>
    
    43
    +</body>
    
    44
    +</html>

  • client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/TripActionHelper.java
    ... ... @@ -22,56 +22,107 @@ package fr.ird.observe.client.datasource.editor.content.data;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import fr.ird.observe.client.WithClientUIContext;
    
    25 26
     import fr.ird.observe.client.datasource.editor.content.ContentUI;
    
    26 27
     import fr.ird.observe.client.datasource.editor.tree.navigation.NavigationTree;
    
    27
    -import fr.ird.observe.client.main.ObserveMainUI;
    
    28 28
     import fr.ird.observe.client.util.UIHelper;
    
    29 29
     import fr.ird.observe.dto.data.DataDto;
    
    30 30
     import fr.ird.observe.dto.data.TripAware;
    
    31 31
     import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
    
    32 32
     import fr.ird.observe.navigation.tree.ReferenceNode;
    
    33 33
     import fr.ird.observe.spi.DtoModelHelper;
    
    34
    +import io.ultreia.java4all.application.template.spi.GenerateTemplate;
    
    34 35
     import io.ultreia.java4all.i18n.I18n;
    
    35 36
     import org.apache.logging.log4j.LogManager;
    
    36 37
     import org.apache.logging.log4j.Logger;
    
    38
    +import org.nuiton.jaxx.runtime.swing.TabInfo;
    
    37 39
     
    
    40
    +import javax.swing.JLabel;
    
    38 41
     import javax.swing.JOptionPane;
    
    39 42
     import javax.swing.SwingUtilities;
    
    40 43
     import javax.swing.tree.TreeNode;
    
    44
    +import java.util.Objects;
    
    45
    +import java.util.function.Function;
    
    41 46
     
    
    42 47
     import static io.ultreia.java4all.i18n.I18n.t;
    
    43 48
     
    
    44 49
     /**
    
    45 50
      * Store here any mutual code for some actions.
    
    46 51
      */
    
    47
    -public class TripActionHelper {
    
    52
    +@GenerateTemplate(template = {
    
    53
    +        "askToFillTripObservations.ftl",
    
    54
    +        "askToFillTripLogbook.ftl"
    
    55
    +})
    
    56
    +public abstract class TripActionHelper implements WithClientUIContext {
    
    48 57
     
    
    49 58
         private static final Logger log = LogManager.getLogger(TripActionHelper.class);
    
    50 59
     
    
    51
    -    protected static boolean gotoTripObservationTab(ObserveMainUI mainui, ContentUI ui, TripAware tripDto, Class<? extends DataDto> dtoType, int tabIndex) {
    
    60
    +    protected final ContentUI ui;
    
    61
    +    /**
    
    62
    +     * Used internal by template.
    
    63
    +     */
    
    64
    +    private String dtoType;
    
    65
    +
    
    66
    +    protected TripActionHelper(ContentUI ui) {
    
    67
    +        this.ui = Objects.requireNonNull(ui);
    
    68
    +    }
    
    69
    +
    
    70
    +    public boolean gotoTripObservationTab(Class<? extends DataDto> dtoType) {
    
    71
    +        TripAware tripDto = getTrip();
    
    72
    +        return gotoTripObservationTab(tripDto, dtoType);
    
    73
    +    }
    
    74
    +
    
    75
    +    public boolean gotoTripLogbookTab(Class<? extends DataDto> dtoType) {
    
    76
    +        TripAware tripDto = getTrip();
    
    77
    +        return gotoTripLogbookTab(tripDto, dtoType);
    
    78
    +    }
    
    79
    +
    
    80
    +    protected abstract TripAware getTrip();
    
    81
    +
    
    82
    +    protected boolean gotoTripObservationTab(TripAware tripDto, Class<? extends DataDto> dtoType) {
    
    52 83
             boolean canExecuteAction = tripDto.isObservationsAvailability();
    
    53 84
             if (!canExecuteAction) {
    
    54
    -            askAndGotoTripMetaDataTab(mainui, ui, tripDto, dtoType, TripAware.PROPERTY_OBSERVATIONS_AVAILABILITY, tabIndex);
    
    85
    +            String dataType = I18n.t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType));
    
    86
    +            String message = getObservationMessage(dataType);
    
    87
    +            askAndGotoTripMetaDataTab(tripDto, dataType, message, TripAware.PROPERTY_OBSERVATIONS_AVAILABILITY, TripUI::getObservationsTab);
    
    55 88
             }
    
    56 89
             return canExecuteAction;
    
    57 90
         }
    
    58 91
     
    
    59
    -    protected static boolean gotoTripLogbookTab(ObserveMainUI mainui, ContentUI ui, TripAware tripDto, Class<? extends DataDto> dtoType, int tabIndex) {
    
    92
    +    protected boolean gotoTripLogbookTab(TripAware tripDto, Class<? extends DataDto> dtoType) {
    
    60 93
             boolean canExecuteAction = tripDto.isLogbookAvailability();
    
    61 94
             if (!canExecuteAction) {
    
    62
    -            askAndGotoTripMetaDataTab(mainui, ui, tripDto, dtoType, TripAware.PROPERTY_LOGBOOK_AVAILABILITY, tabIndex);
    
    95
    +            String dataType = I18n.t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType));
    
    96
    +            String message = getLogbookMessage(dataType);
    
    97
    +            askAndGotoTripMetaDataTab(tripDto, dataType, message, TripAware.PROPERTY_LOGBOOK_AVAILABILITY, TripUI::getLogbookTab);
    
    63 98
             }
    
    64 99
             return canExecuteAction;
    
    65 100
         }
    
    66 101
     
    
    67
    -    private static void askAndGotoTripMetaDataTab(ObserveMainUI mainui, ContentUI ui, TripAware tripDto, Class<? extends DataDto> dtoType, String availabilityPropertyName, int tabIndex) {
    
    68
    -        String dataType = I18n.t(ObserveI18nDecoratorHelper.getTypeI18nKey(dtoType));
    
    102
    +    protected String getObservationMessage(String dtoType) {
    
    103
    +        this.dtoType = dtoType;
    
    104
    +        try {
    
    105
    +            return TripActionHelperTemplate.generateAskToFillTripObservations(this);
    
    106
    +        } finally {
    
    107
    +            this.dtoType = null;
    
    108
    +        }
    
    109
    +    }
    
    110
    +
    
    111
    +    protected String getLogbookMessage(String dtoType) {
    
    112
    +        this.dtoType = dtoType;
    
    113
    +        try {
    
    114
    +            return TripActionHelperTemplate.generateAskToFillTripLogbook(this);
    
    115
    +        } finally {
    
    116
    +            this.dtoType = null;
    
    117
    +        }
    
    118
    +    }
    
    119
    +
    
    120
    +    private void askAndGotoTripMetaDataTab(TripAware tripDto, String dataType, String message, String availabilityPropertyName, Function<TripUI, TabInfo> tabGetter) {
    
    69 121
             // Let's ask user to fill them
    
    70
    -        //FIXME Use a template
    
    71 122
             int response = UIHelper.askUser(
    
    72
    -                mainui,
    
    73
    -                t("observe.data.common.Trip.title.can.not.create.trip.sub.data"),
    
    74
    -                dataType,
    
    123
    +                getClientUIContext().getMainUI(),
    
    124
    +                t("observe.data.common.Trip.title.can.not.create.trip.sub.data", dataType),
    
    125
    +                new JLabel(message),
    
    75 126
                     JOptionPane.WARNING_MESSAGE,
    
    76 127
                     new Object[]{
    
    77 128
                             t("observe.data.common.Trip.choice.go.to.trip"),
    
    ... ... @@ -91,7 +142,15 @@ public class TripActionHelper {
    91 142
                 // set availability flag to true
    
    92 143
                 tripUI.getModel().set(availabilityPropertyName, true);
    
    93 144
                 // go to meta-data tab
    
    94
    -            SwingUtilities.invokeLater(() -> tripUI.getMainTabbedPane().setSelectedIndex(tabIndex));
    
    145
    +            TabInfo tabInfo = tabGetter.apply(tripUI);
    
    146
    +            SwingUtilities.invokeLater(() -> tripUI.selectTab(tabInfo));
    
    95 147
             }
    
    96 148
         }
    
    149
    +
    
    150
    +
    
    151
    +    public String getDtoType() {
    
    152
    +        return dtoType;
    
    153
    +    }
    
    154
    +
    
    155
    +
    
    97 156
     }

  • client-datasource-editor-common/src/main/java/fr/ird/observe/client/datasource/editor/content/data/TripUI.java
    ... ... @@ -24,6 +24,7 @@ package fr.ird.observe.client.datasource.editor.content.data;
    24 24
     
    
    25 25
     import fr.ird.observe.client.datasource.editor.content.data.open.ContentOpenableUIModel;
    
    26 26
     import fr.ird.observe.client.datasource.editor.content.data.trip.map.TripMapUI;
    
    27
    +import org.nuiton.jaxx.runtime.swing.TabInfo;
    
    27 28
     
    
    28 29
     import javax.swing.JTabbedPane;
    
    29 30
     
    
    ... ... @@ -44,4 +45,16 @@ public interface TripUI {
    44 45
     
    
    45 46
         ContentOpenableUIModel<?, ?> getModel();
    
    46 47
     
    
    48
    +    TabInfo getGeneralTab();
    
    49
    +
    
    50
    +    TabInfo getMapTab();
    
    51
    +
    
    52
    +    TabInfo getObservationsTab();
    
    53
    +
    
    54
    +    TabInfo getLogbookTab();
    
    55
    +
    
    56
    +    default void selectTab(TabInfo tabInfo) {
    
    57
    +        getMainTabbedPane().setSelectedIndex(tabInfo.getTabIndex());
    
    58
    +    }
    
    59
    +
    
    47 60
     }

  • client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/CreateSupport.java
    ... ... @@ -50,11 +50,11 @@ public class CreateSupport<D extends DataDto, R extends DataDtoReference<D, R>>
    50 50
         protected boolean canExecuteAction(ActionEvent e) {
    
    51 51
             boolean canExecuteAction = super.canExecuteAction(e);
    
    52 52
             if (canExecuteAction && checkTripAvailability) {
    
    53
    +            LlTripActionHelper helper = new LlTripActionHelper(ui);
    
    53 54
                 if (getBeanType().getName().contains(".observation.")) {
    
    54
    -                canExecuteAction = LlTripActionHelper.gotoTripObservationTab(getMainUI(), ui, getServicesProvider(), getBeanType());
    
    55
    +                canExecuteAction = helper.gotoTripObservationTab(getBeanType());
    
    55 56
                 } else {
    
    56
    -                canExecuteAction = LlTripActionHelper.gotoTripLogbookTab(getMainUI(), ui, getServicesProvider(), getBeanType());
    
    57
    -
    
    57
    +                canExecuteAction = helper.gotoTripLogbookTab(getBeanType());
    
    58 58
                 }
    
    59 59
             }
    
    60 60
             return canExecuteAction;
    

  • client-datasource-editor-ll/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ll/LlTripActionHelper.java
    ... ... @@ -22,13 +22,9 @@ package fr.ird.observe.client.datasource.editor.content.data.ll;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.client.ClientUIContextApplicationComponent;
    
    26 25
     import fr.ird.observe.client.datasource.editor.content.ContentUI;
    
    27 26
     import fr.ird.observe.client.datasource.editor.content.data.TripActionHelper;
    
    28
    -import fr.ird.observe.client.main.ObserveMainUI;
    
    29
    -import fr.ird.observe.dto.data.DataDto;
    
    30 27
     import fr.ird.observe.dto.data.ll.common.TripDto;
    
    31
    -import fr.ird.observe.services.ObserveServicesProvider;
    
    32 28
     
    
    33 29
     /**
    
    34 30
      * Created on 18/09/2020.
    
    ... ... @@ -38,22 +34,13 @@ import fr.ird.observe.services.ObserveServicesProvider;
    38 34
      */
    
    39 35
     public class LlTripActionHelper extends TripActionHelper {
    
    40 36
     
    
    41
    -    public static boolean gotoTripObservationTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) {
    
    42
    -        TripDto tripDto = getTrip(servicesProvider);
    
    43
    -        return gotoTripObservationTab(mainui, ui, tripDto, dtoType, 2);
    
    37
    +    public LlTripActionHelper(ContentUI ui) {
    
    38
    +        super(ui);
    
    44 39
         }
    
    45 40
     
    
    46
    -    public static boolean gotoTripLogbookTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) {
    
    47
    -        TripDto tripDto = getTrip(servicesProvider);
    
    48
    -        return gotoTripLogbookTab(mainui, ui, tripDto, dtoType, 3);
    
    49
    -    }
    
    50
    -
    
    51
    -    public static String getSelectedTripId() {
    
    52
    -        return ClientUIContextApplicationComponent.value().getObserveSelectModel().getLongline().getTrip().getId();
    
    53
    -    }
    
    54
    -
    
    55
    -    static TripDto getTrip(ObserveServicesProvider servicesProvider) {
    
    56
    -        String tripId = getSelectedTripId();
    
    57
    -        return servicesProvider.getLlCommonTripService().loadDto(tripId);
    
    41
    +    @Override
    
    42
    +    protected TripDto getTrip() {
    
    43
    +        String tripId = getClientUIContext().getObserveSelectModel().getLongline().getTrip().getId();
    
    44
    +        return getClientUIContext().getDataSourcesManager().getMainDataSource().getLlCommonTripService().loadDto(tripId);
    
    58 45
         }
    
    59 46
     }

  • client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/CreateSupport.java
    ... ... @@ -50,11 +50,11 @@ public class CreateSupport<D extends DataDto, R extends DataDtoReference<D, R>>
    50 50
         protected boolean canExecuteAction(ActionEvent e) {
    
    51 51
             boolean canExecuteAction = super.canExecuteAction(e);
    
    52 52
             if (canExecuteAction && checkTripAvailability) {
    
    53
    +            PsTripActionHelper helper = new PsTripActionHelper(ui);
    
    53 54
                 if (getBeanType().getName().contains(".observation.")) {
    
    54
    -                canExecuteAction = PsTripActionHelper.gotoTripObservationTab(getMainUI(), ui, getServicesProvider(), getBeanType());
    
    55
    +                canExecuteAction = helper.gotoTripObservationTab(getBeanType());
    
    55 56
                 } else {
    
    56
    -                canExecuteAction = PsTripActionHelper.gotoTripLogbookTab(getMainUI(), ui, getServicesProvider(), getBeanType());
    
    57
    -
    
    57
    +                canExecuteAction = helper.gotoTripLogbookTab(getBeanType());
    
    58 58
                 }
    
    59 59
             }
    
    60 60
             return canExecuteAction;
    

  • client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/PsTripActionHelper.java
    ... ... @@ -22,13 +22,9 @@ package fr.ird.observe.client.datasource.editor.content.data.ps;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.client.ClientUIContextApplicationComponent;
    
    26 25
     import fr.ird.observe.client.datasource.editor.content.ContentUI;
    
    27 26
     import fr.ird.observe.client.datasource.editor.content.data.TripActionHelper;
    
    28
    -import fr.ird.observe.client.main.ObserveMainUI;
    
    29
    -import fr.ird.observe.dto.data.DataDto;
    
    30 27
     import fr.ird.observe.dto.data.ps.common.TripDto;
    
    31
    -import fr.ird.observe.services.ObserveServicesProvider;
    
    32 28
     
    
    33 29
     /**
    
    34 30
      * Created on 18/09/2020.
    
    ... ... @@ -38,22 +34,13 @@ import fr.ird.observe.services.ObserveServicesProvider;
    38 34
      */
    
    39 35
     public class PsTripActionHelper extends TripActionHelper {
    
    40 36
     
    
    41
    -    public static boolean gotoTripObservationTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) {
    
    42
    -        TripDto tripDto = getTrip(servicesProvider);
    
    43
    -        return gotoTripObservationTab(mainui, ui, tripDto, dtoType, 1);
    
    37
    +    public PsTripActionHelper(ContentUI ui) {
    
    38
    +        super(ui);
    
    44 39
         }
    
    45 40
     
    
    46
    -    public static boolean gotoTripLogbookTab(ObserveMainUI mainui, ContentUI ui, ObserveServicesProvider servicesProvider, Class<? extends DataDto> dtoType) {
    
    47
    -        TripDto tripDto = getTrip(servicesProvider);
    
    48
    -        return gotoTripLogbookTab(mainui, ui, tripDto, dtoType, 2);
    
    49
    -    }
    
    50
    -
    
    51
    -    public static String getSelectedTripId() {
    
    52
    -        return ClientUIContextApplicationComponent.value().getObserveSelectModel().getSeine().getTrip().getId();
    
    53
    -    }
    
    54
    -
    
    55
    -    static TripDto getTrip(ObserveServicesProvider servicesProvider) {
    
    56
    -        String tripId = getSelectedTripId();
    
    57
    -        return servicesProvider.getPsCommonTripService().loadDto(tripId);
    
    41
    +    @Override
    
    42
    +    protected TripDto getTrip() {
    
    43
    +        String tripId = getClientUIContext().getObserveSelectModel().getSeine().getTrip().getId();
    
    44
    +        return getClientUIContext().getDataSourcesManager().getMainDataSource().getPsCommonTripService().loadDto(tripId);
    
    58 45
         }
    
    59 46
     }

  • client-datasource-editor-ps/src/main/java/fr/ird/observe/client/datasource/editor/content/data/ps/localmarket/actions/LocalmarketUIActionSupport.java
    ... ... @@ -68,7 +68,8 @@ public abstract class LocalmarketUIActionSupport<D extends DataDto> extends Cont
    68 68
         protected boolean canExecuteAction(ActionEvent e) {
    
    69 69
             boolean canExecuteAction = super.canExecuteAction(e);
    
    70 70
             if (canExecuteAction) {
    
    71
    -            canExecuteAction = PsTripActionHelper.gotoTripLogbookTab(getMainUI(), ui, getServicesProvider(), getBeanType());
    
    71
    +            PsTripActionHelper helper = new PsTripActionHelper(ui);
    
    72
    +            canExecuteAction = helper.gotoTripLogbookTab(getBeanType());
    
    72 73
             }
    
    73 74
             return canExecuteAction;
    
    74 75
         }
    

  • observe-i18n/src/main/i18n/translations/observe_en_GB.properties
    ... ... @@ -440,8 +440,8 @@ observe.data.Trip.validation.startDate.after.now=Start date of the trip must be
    440 440
     observe.data.Trip.validation.unclosed.activityObs=There is an open activity on trip (%1$s).
    
    441 441
     observe.data.Trip.validation.unclosed.routeObs=There is an open route on trip (%1$s).
    
    442 442
     observe.data.Trip.validation.vessel.overlap=There is already a trip using same vessel on equivalent date range. \#TODO
    
    443
    -observe.data.common.Trip.choice.go.to.trip=Go to trip
    
    444
    -observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data...
    
    443
    +observe.data.common.Trip.choice.go.to.trip=Access to trip form
    
    444
    +observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data of type `%s`...
    
    445 445
     observe.data.ll.Activity.validation.endDate.after.currentTrip.startDate=End date must be after current trip start date
    
    446 446
     observe.data.ll.Activity.validation.endDate.after.startDate=End date must be after start date
    
    447 447
     observe.data.ll.Activity.validation.endDate.before.currentTrip.endDate=End date must be before current trip end date
    
    ... ... @@ -490,11 +490,11 @@ observe.data.ll.common.Trip.availableData=Available data
    490 490
     observe.data.ll.common.Trip.ersId=Id ERS
    
    491 491
     observe.data.ll.common.Trip.generalComment=Comment
    
    492 492
     observe.data.ll.common.Trip.generalTab=Common characteristics
    
    493
    -observe.data.ll.common.Trip.logbookAvailability=Logbook
    
    493
    +observe.data.ll.common.Trip.logbookAvailability=Logbook and associated data
    
    494 494
     observe.data.ll.common.Trip.logbookComment=Comment
    
    495 495
     observe.data.ll.common.Trip.logbookDataEntryOperator=Data entry operator
    
    496 496
     observe.data.ll.common.Trip.logbookDataQuality=Data quality
    
    497
    -observe.data.ll.common.Trip.logbookTab=Logbook
    
    497
    +observe.data.ll.common.Trip.logbookTab=Logbook and associated data
    
    498 498
     observe.data.ll.common.Trip.mapTab=Map
    
    499 499
     observe.data.ll.common.Trip.message.not.open=Current trip is not opened, no edit possible.
    
    500 500
     observe.data.ll.common.Trip.noOfCrewMembers=Numer of crew
    
    ... ... @@ -1343,7 +1343,7 @@ observe.data.ps.common.Trip.list=List of trips
    1343 1343
     observe.data.ps.common.Trip.list.message.none=< No trip for current program >
    
    1344 1344
     observe.data.ps.common.Trip.localMarketTotalWeight=Local market total weight (t)
    
    1345 1345
     observe.data.ps.common.Trip.loch=Loch (mile)
    
    1346
    -observe.data.ps.common.Trip.logbookAvailability=Logbook
    
    1346
    +observe.data.ps.common.Trip.logbookAvailability=Logbook and associated data
    
    1347 1347
     observe.data.ps.common.Trip.logbookComment=Comment
    
    1348 1348
     observe.data.ps.common.Trip.logbookDataEntryOperator=Data entry operator
    
    1349 1349
     observe.data.ps.common.Trip.logbookDataQuality=Data quality
    

  • observe-i18n/src/main/i18n/translations/observe_es_ES.properties
    ... ... @@ -440,8 +440,8 @@ observe.data.Trip.validation.startDate.after.now=Start date of the trip must be
    440 440
     observe.data.Trip.validation.unclosed.activityObs=Existe una actividad que no fue cerrada (%1$s).
    
    441 441
     observe.data.Trip.validation.unclosed.routeObs=Existe una ruta que no fue cerrada (%1$s).
    
    442 442
     observe.data.Trip.validation.vessel.overlap=There is already a trip using same vessel on equivalent date range. \#TODO
    
    443
    -observe.data.common.Trip.choice.go.to.trip=Go to trip \#TODO
    
    444
    -observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data... \#TODO
    
    443
    +observe.data.common.Trip.choice.go.to.trip=Acceder al formulario de marea
    
    444
    +observe.data.common.Trip.title.can.not.create.trip.sub.data=Can't create a trip data of type `%s`... \#TODO
    
    445 445
     observe.data.ll.Activity.validation.endDate.after.currentTrip.startDate=End date must be after current trip start date \#TODO
    
    446 446
     observe.data.ll.Activity.validation.endDate.after.startDate=End date must be after start date \#TODO
    
    447 447
     observe.data.ll.Activity.validation.endDate.before.currentTrip.endDate=End date must be before current trip end date \#TODO
    
    ... ... @@ -490,21 +490,21 @@ observe.data.ll.common.Trip.availableData=Données disponibles
    490 490
     observe.data.ll.common.Trip.ersId=Id ERS
    
    491 491
     observe.data.ll.common.Trip.generalComment=Comentarios
    
    492 492
     observe.data.ll.common.Trip.generalTab=General características
    
    493
    -observe.data.ll.common.Trip.logbookAvailability=Logbook \#TODO
    
    493
    +observe.data.ll.common.Trip.logbookAvailability=Diario de pesca y datos asociados
    
    494 494
     observe.data.ll.common.Trip.logbookComment=Comentarios
    
    495 495
     observe.data.ll.common.Trip.logbookDataEntryOperator=Operador de captación de datos
    
    496 496
     observe.data.ll.common.Trip.logbookDataQuality=Qualité de donnée \#TODO
    
    497
    -observe.data.ll.common.Trip.logbookTab=Caractéristiques Logbook
    
    497
    +observe.data.ll.common.Trip.logbookTab=Diario de pesca y datos asociados
    
    498 498
     observe.data.ll.common.Trip.mapTab=Mapa
    
    499 499
     observe.data.ll.common.Trip.message.not.open=La marea actual no está abierta, no se puede modificar.
    
    500 500
     observe.data.ll.common.Trip.noOfCrewMembers=Nombre d'équipage
    
    501 501
     observe.data.ll.common.Trip.noOfDays=Duración (días)
    
    502 502
     observe.data.ll.common.Trip.observationMethod=Observations method \#TODO
    
    503
    -observe.data.ll.common.Trip.observationsAvailability=Données d'observation
    
    503
    +observe.data.ll.common.Trip.observationsAvailability=Observaciones
    
    504 504
     observe.data.ll.common.Trip.observationsComment=Comentarios
    
    505 505
     observe.data.ll.common.Trip.observationsDataEntryOperator=Operador de captación de datos
    
    506 506
     observe.data.ll.common.Trip.observationsDataQuality=Qualité de donnée \#TODO
    
    507
    -observe.data.ll.common.Trip.observationsTab=Caractéristiques d'observation
    
    507
    +observe.data.ll.common.Trip.observationsTab=Observaciones
    
    508 508
     observe.data.ll.common.Trip.species=Especie objetivo
    
    509 509
     observe.data.ll.common.Trip.species.selected=Espèces sélectionnées \#TODO
    
    510 510
     observe.data.ll.common.Trip.species.universe=Espèces disponibles \#TODO
    
    ... ... @@ -1343,7 +1343,7 @@ observe.data.ps.common.Trip.list=Lista de mareas
    1343 1343
     observe.data.ps.common.Trip.list.message.none=Ninguna marea para el programa actual
    
    1344 1344
     observe.data.ps.common.Trip.localMarketTotalWeight=Total marché local (en t) \#TODO
    
    1345 1345
     observe.data.ps.common.Trip.loch=Loch (miles nautiques) \#TODO
    
    1346
    -observe.data.ps.common.Trip.logbookAvailability=Logbook \#TODO
    
    1346
    +observe.data.ps.common.Trip.logbookAvailability=Diario de pesca y datos asociados
    
    1347 1347
     observe.data.ps.common.Trip.logbookComment=Comentario
    
    1348 1348
     observe.data.ps.common.Trip.logbookDataEntryOperator=Opérateur de saisie \#TODO
    
    1349 1349
     observe.data.ps.common.Trip.logbookDataQuality=Qualité de donnée \#TODO
    

  • observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
    ... ... @@ -440,8 +440,8 @@ observe.data.Trip.validation.startDate.after.now=La date de début de marée doi
    440 440
     observe.data.Trip.validation.unclosed.activityObs=Il existe une activité non clôturée (%1$s).
    
    441 441
     observe.data.Trip.validation.unclosed.routeObs=Il existe une route non clôturée (%1$s).
    
    442 442
     observe.data.Trip.validation.vessel.overlap=Il existe déjà une marée utilisant ce navire sur une plage temporelle équivalente. \#TODO
    
    443
    -observe.data.common.Trip.choice.go.to.trip=Accéder à la marée
    
    444
    -observe.data.common.Trip.title.can.not.create.trip.sub.data=Impossible de créer une donnée de marée...
    
    443
    +observe.data.common.Trip.choice.go.to.trip=Accéder au formulaire marée
    
    444
    +observe.data.common.Trip.title.can.not.create.trip.sub.data=Impossible de créer une donnée de type `%s` pour la marée...
    
    445 445
     observe.data.ll.Activity.validation.endDate.after.currentTrip.startDate=La date de fin doit être supérieure ou égale à la date de début de marée
    
    446 446
     observe.data.ll.Activity.validation.endDate.after.startDate=La date de fin doit être supérieure ou égale à la date de début de l'activité
    
    447 447
     observe.data.ll.Activity.validation.endDate.before.currentTrip.endDate=La date de fin doit être inférieur ou égale à la date de fin de marée
    
    ... ... @@ -490,11 +490,11 @@ observe.data.ll.common.Trip.availableData=Données disponibles
    490 490
     observe.data.ll.common.Trip.ersId=Id ERS
    
    491 491
     observe.data.ll.common.Trip.generalComment=Commentaire
    
    492 492
     observe.data.ll.common.Trip.generalTab=Caractéristiques communes
    
    493
    -observe.data.ll.common.Trip.logbookAvailability=Livre de bord
    
    493
    +observe.data.ll.common.Trip.logbookAvailability=Livre de bord et données associées
    
    494 494
     observe.data.ll.common.Trip.logbookComment=Commentaire
    
    495 495
     observe.data.ll.common.Trip.logbookDataEntryOperator=Opérateur de saisie
    
    496 496
     observe.data.ll.common.Trip.logbookDataQuality=Qualité de donnée
    
    497
    -observe.data.ll.common.Trip.logbookTab=Caractéristiques Logbook
    
    497
    +observe.data.ll.common.Trip.logbookTab=Livre de bord et données associées
    
    498 498
     observe.data.ll.common.Trip.mapTab=Carte
    
    499 499
     observe.data.ll.common.Trip.message.not.open=La marée courante n'est pas ouverte, aucune modification possible.
    
    500 500
     observe.data.ll.common.Trip.noOfCrewMembers=Nombre d'équipage
    
    ... ... @@ -504,7 +504,7 @@ observe.data.ll.common.Trip.observationsAvailability=Données d'observation
    504 504
     observe.data.ll.common.Trip.observationsComment=Commentaire
    
    505 505
     observe.data.ll.common.Trip.observationsDataEntryOperator=Opérateur de saisie
    
    506 506
     observe.data.ll.common.Trip.observationsDataQuality=Qualité de donnée
    
    507
    -observe.data.ll.common.Trip.observationsTab=Caractéristiques d'observation
    
    507
    +observe.data.ll.common.Trip.observationsTab=Données d'observation
    
    508 508
     observe.data.ll.common.Trip.species=Espèces ciblées
    
    509 509
     observe.data.ll.common.Trip.species.selected=Espèces sélectionnées
    
    510 510
     observe.data.ll.common.Trip.species.universe=Espèces disponibles
    
    ... ... @@ -1343,7 +1343,7 @@ observe.data.ps.common.Trip.list=Liste des marées
    1343 1343
     observe.data.ps.common.Trip.list.message.none=< Aucune marée pour le programme courant >
    
    1344 1344
     observe.data.ps.common.Trip.localMarketTotalWeight=Total marché local (en t)
    
    1345 1345
     observe.data.ps.common.Trip.loch=Loch (miles nautiques)
    
    1346
    -observe.data.ps.common.Trip.logbookAvailability=Livre de Bord
    
    1346
    +observe.data.ps.common.Trip.logbookAvailability=Livre de bord et données associées
    
    1347 1347
     observe.data.ps.common.Trip.logbookComment=Commentaire
    
    1348 1348
     observe.data.ps.common.Trip.logbookDataEntryOperator=Opérateur de saisie
    
    1349 1349
     observe.data.ps.common.Trip.logbookDataQuality=Qualité de donnée