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

Commits:

10 changed files:

Changes:

  • src/site/markdown/installer.md.vm
    ... ... @@ -30,6 +30,8 @@ Après téléchargement, on dézippe l'archive et on obtient l'arborescence suiv
    30 30
       ├── fill-db.bat                          (1)
    
    31 31
       ├── fill-db.sh                           (1)
    
    32 32
       ├── db.properties                        (2)
    
    33
    +  ├── translate.sh
    
    34
    +  ├── translate.bat
    
    33 35
       ├── README.md
    
    34 36
       ├── scripts                              (3)
    
    35 37
       │   ├── ddl
    
    ... ... @@ -61,7 +63,7 @@ url=jdbc:postgresql:%s
    61 63
     
    
    62 64
     # Créer une nouvelle base
    
    63 65
     
    
    64
    -Sous Linux
    
    66
    +Sous Linux, Mac
    
    65 67
     ```
    
    66 68
       sh create-db.sh dbName
    
    67 69
     ```
    
    ... ... @@ -75,7 +77,7 @@ Sous windows
    75 77
     
    
    76 78
     **Il faut que la base soit créée et que l'extension postgis soit installée**.
    
    77 79
     
    
    78
    -Sous Linux
    
    80
    +Sous Linux, Mac
    
    79 81
     ```
    
    80 82
       sh fill-db.sh dbName
    
    81 83
     ```
    

  • src/site/markdown/translate.md
    1
    +# Traduire T3+
    
    2
    +
    
    3
    +[L'installer](./installer.html) contient un script pour vous aider à traduire l'application.
    
    4
    +
    
    5
    +Sous Linux, Mac
    
    6
    +```
    
    7
    +  sh translate.sh
    
    8
    +```
    
    9
    +
    
    10
    +Sous windows
    
    11
    +```
    
    12
    +  translate.bat
    
    13
    +```
    
    14
    + 
    
    15
    +# Translate T3+
    
    16
    +
    
    17
    +[L'installer](./installer.html) contains a script to help you doing this :).
    
    18
    +
    
    19
    +Under Linux, Mac
    
    20
    +```
    
    21
    +  sh translate.sh
    
    22
    +```
    
    23
    +
    
    24
    +Under windows
    
    25
    +```
    
    26
    +  translate.bat
    
    27
    +```

  • src/site/site.xml
    ... ... @@ -77,6 +77,7 @@
    77 77
           <item name="Installation" href="install.html"/>
    
    78 78
           <item name="Création de base" href="installer.html"/>
    
    79 79
           <item name="Configuration" href="./config-report.html"/>
    
    80
    +      <item name="Translate" href="./translate.html"/>
    
    80 81
         </menu>
    
    81 82
     
    
    82 83
         <menu name="Modélisation">
    

  • t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java
    ... ... @@ -53,6 +53,7 @@ import java.util.HashSet;
    53 53
     import java.util.Iterator;
    
    54 54
     import java.util.List;
    
    55 55
     import java.util.Set;
    
    56
    +import java.util.TreeSet;
    
    56 57
     
    
    57 58
     import static org.nuiton.i18n.I18n.l;
    
    58 59
     
    
    ... ... @@ -82,6 +83,7 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati
    82 83
         private VesselSimpleTypeTopiaDao vesselSimpleTypeDAO;
    
    83 84
         /** usable complete trips group by vessel */
    
    84 85
         private ListMultimap<Vessel, CompleteTrip> completeTripsByVessel;
    
    86
    +    private Set<String> tripStrDone;
    
    85 87
     
    
    86 88
         public ComputeRF2Action() {
    
    87 89
             super(Level0Step.COMPUTE_RF2);
    
    ... ... @@ -117,6 +119,7 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati
    117 119
                 // use all fleets
    
    118 120
                 fleets = countryDAO.findAll();
    
    119 121
             }
    
    122
    +        tripStrDone = new TreeSet<>();
    
    120 123
             List<Trip> tripList = getUsableTrips(landingHarbours, true);
    
    121 124
             setTrips(tripList);
    
    122 125
             completeTripsByVessel = ArrayListMultimap.create();
    
    ... ... @@ -280,10 +283,14 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati
    280 283
                         tripCatchWeight = trip.getElementaryCatchTotalWeightRf1(species);
    
    281 284
                     }
    
    282 285
                     totalCatchWeight += tripCatchWeight;
    
    283
    -                addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight));
    
    286
    +                if (tripStrDone.add(tripStr)) {
    
    287
    +                    addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight));
    
    288
    +                }
    
    284 289
                 } else {
    
    285 290
                     // this trip does not have any landing catches for given species
    
    286
    -                addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr));
    
    291
    +                if (tripStrDone.add(tripStr)) {
    
    292
    +                    addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr));
    
    293
    +                }
    
    287 294
                 }
    
    288 295
             }
    
    289 296
             addInfoMessage(l(locale, "t3.level0.computeRF2.resume.total.rf1", totalCatchWeight, totalLandingWeight));
    

  • t3-installer/pom.xml
    ... ... @@ -52,6 +52,16 @@
    52 52
         </dependency>
    
    53 53
     
    
    54 54
         <dependency>
    
    55
    +      <groupId>io.ultreia.java4all.jaxx</groupId>
    
    56
    +      <artifactId>jaxx-runtime</artifactId>
    
    57
    +    </dependency>
    
    58
    +
    
    59
    +    <dependency>
    
    60
    +      <groupId>io.ultreia.java4all.i18n</groupId>
    
    61
    +      <artifactId>i18n-editor</artifactId>
    
    62
    +    </dependency>
    
    63
    +
    
    64
    +    <dependency>
    
    55 65
           <groupId>com.h2database</groupId>
    
    56 66
           <artifactId>h2</artifactId>
    
    57 67
           <scope>runtime</scope>
    

  • t3-installer/src/main/assembly/dist/README.md
    1
    -Tools to manage T3 databases.
    
    1
    +# T3 Console
    
    2
    +
    
    3
    +### Before using database commands
    
    2 4
     
    
    3 5
     First fill the **db.properties** file with correct values.
    
    4 6
     
    
    5 7
     Then use the command you need :).
    
    6 8
     
    
    7
    -# Create a database
    
    8
    -
    
    9
    +## Create a database
    
    9 10
     This will create the database on postgres server, then fill it.
    
    10
    -
    
    11 11
     ```
    
    12
    -create-db.sh dbName
    
    12
    +sh create-db.sh dbName
    
    13 13
     ```
    
    14 14
     or 
    
    15 15
     ```
    
    16 16
     create-db.bat dbName
    
    17 17
     ```
    
    18 18
     
    
    19
    -# Fill a database
    
    20
    -
    
    19
    +## Fill a database
    
    21 20
     This will just fill a database on postgres server.
    
    22 21
      
    
    23 22
     **but the database must be empty and have a t3 schema initialized.**
    
    24
    -
    
    25 23
     ```
    
    26
    -fill-db.sh dbName
    
    24
    +sh fill-db.sh dbName
    
    27 25
     ```
    
    28 26
     or 
    
    29 27
     ```
    
    30 28
     fill-db.bat dbName
    
    31 29
     ```
    
    30
    +
    
    31
    +## Translate application
    
    32
    +This will open a GUI to translate application.
    
    33
    +```
    
    34
    +sh translate.sh
    
    35
    +```
    
    36
    +or 
    
    37
    +```
    
    38
    +translate.bat
    
    39
    +```

  • t3-installer/src/main/assembly/dist/translate.bat
    1
    +java  -Xmx2048M -Xms512M -jar ${project.build.finalName}.jar --translate
    \ No newline at end of file

  • t3-installer/src/main/assembly/dist/translate.sh
    1
    +#!/bin/sh
    
    2
    +
    
    3
    +java  -Xmx2048M -Xms512M -jar ${project.build.finalName}.jar --translate

  • t3-installer/src/main/config/T3Installer.ini
    ... ... @@ -5,3 +5,7 @@ aliases = --create-db
    5 5
     [action fillDb]
    
    6 6
     action = fr.ird.t3.console.T3DatabaseTool#fill
    
    7 7
     aliases = --fill-db
    
    8
    +
    
    9
    +[action translate]
    
    10
    +action = fr.ird.t3.console.T3I18nTool#start
    
    11
    +aliases = --translate

  • t3-installer/src/main/java/fr/ird/t3/console/T3I18nTool.java
    1
    +package fr.ird.t3.console;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * T3 :: Installer
    
    6
    + * %%
    
    7
    + * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU Affero General Public License as published by
    
    11
    + * the Free Software Foundation, either version 3 of the License, or
    
    12
    + * (at your option) any later version.
    
    13
    + * 
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + * 
    
    19
    + * You should have received a copy of the GNU Affero General Public License
    
    20
    + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    21
    + * #L%
    
    22
    + */
    
    23
    +
    
    24
    +import org.nuiton.i18n.editor.model.Project;
    
    25
    +import org.nuiton.i18n.editor.ui.ProjectUI;
    
    26
    +import org.nuiton.jaxx.runtime.swing.SwingUtil;
    
    27
    +
    
    28
    +import java.net.URL;
    
    29
    +import java.util.Objects;
    
    30
    +
    
    31
    +/**
    
    32
    + * Created by tchemit on 14/03/2018.
    
    33
    + *
    
    34
    + * @author Tony Chemit - dev@tchemit.fr
    
    35
    + */
    
    36
    +public class T3I18nTool {
    
    37
    +
    
    38
    +    @SuppressWarnings("unused")
    
    39
    +    public void start() throws Exception {
    
    40
    +        SwingUtil.initNimbusLoookAndFeel();
    
    41
    +        URL url = Objects.requireNonNull(getClass().getClassLoader().getResource("META-INF/t3-i18n-definition.properties"));
    
    42
    +        Project project = new Project(url);
    
    43
    +        ProjectUI ui = new ProjectUI(null, project);
    
    44
    +        ui.setVisible(true);
    
    45
    +    }
    
    46
    +}