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

Commits:

27 changed files:

Changes:

  • client-configuration/pom.xml
    ... ... @@ -104,6 +104,14 @@
    104 104
           <groupId>io.ultreia.java4all.jaxx</groupId>
    
    105 105
           <artifactId>jaxx-widgets-gis</artifactId>
    
    106 106
         </dependency>
    
    107
    +    <dependency>
    
    108
    +      <groupId>io.ultreia.java4all.jaxx</groupId>
    
    109
    +      <artifactId>jaxx-widgets-temperature</artifactId>
    
    110
    +    </dependency>
    
    111
    +    <dependency>
    
    112
    +      <groupId>io.ultreia.java4all</groupId>
    
    113
    +      <artifactId>java-bean</artifactId>
    
    114
    +    </dependency>
    
    107 115
     
    
    108 116
       </dependencies>
    
    109 117
     
    

  • client-configuration/src/main/config/Client.ini
    ... ... @@ -174,6 +174,11 @@ description = observe.config.h2.can.migrate.description
    174 174
     key = h2.canMigrate
    
    175 175
     type = Boolean
    
    176 176
     defaultValue = true
    
    177
    +[option h2CanEditReferential]
    
    178
    +description = observe.config.h2.can.editReferential.description
    
    179
    +key = h2.canEditReferential
    
    180
    +type = boolean
    
    181
    +defaultValue = false
    
    177 182
     
    
    178 183
     [option h2ServerPort]
    
    179 184
     description = observe.config.h2.serverPort.description
    
    ... ... @@ -501,6 +506,12 @@ key = ui.coordinate.format
    501 506
     type = org.nuiton.jaxx.widgets.gis.CoordinateFormat
    
    502 507
     defaultValue = "dmd"
    
    503 508
     
    
    509
    +[option temperatureFormat]
    
    510
    +description = observe.config.temperature.format
    
    511
    +key = ui.temperature.format
    
    512
    +type = org.nuiton.jaxx.widgets.temperature.TemperatureFormat
    
    513
    +defaultValue = "C"
    
    514
    +
    
    504 515
     [option focusBorderColor]
    
    505 516
     description = observe.config.ui.focusBorderColor
    
    506 517
     key = ui.focusBorder.color
    
    ... ... @@ -531,6 +542,30 @@ key = server.checkServerVersion
    531 542
     type = Boolean
    
    532 543
     defaultValue = true
    
    533 544
     
    
    545
    +[option showSeineTrip]
    
    546
    +description = observe.config.ui.tree.showSeineTrip.description
    
    547
    +key = ui.tree.showSeineTrip
    
    548
    +type = Boolean
    
    549
    +defaultValue = true
    
    550
    +
    
    551
    +[option showLonglineTrip]
    
    552
    +description = observe.config.ui.tree.showLonglineTrip.description
    
    553
    +key = ui.tree.showLonglineTrip
    
    554
    +type = Boolean
    
    555
    +defaultValue = true
    
    556
    +
    
    557
    +[option showReferential]
    
    558
    +description = observe.config.ui.tree.showReferential.description
    
    559
    +key = ui.tree.showReferential
    
    560
    +type = Boolean
    
    561
    +defaultValue = true
    
    562
    +
    
    563
    +[option showEmptyProgram]
    
    564
    +description = observe.config.ui.tree.showEmptyProgram.description
    
    565
    +key = ui.tree.showEmptyProgram
    
    566
    +type = Boolean
    
    567
    +defaultValue = true
    
    568
    +
    
    534 569
     [action help]
    
    535 570
     description = observe.action.commandline.help
    
    536 571
     action = "fr.ird.observe.client.ObserveCLAction#help"
    

  • client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
    ... ... @@ -8,12 +8,12 @@
    8 8
      * it under the terms of the GNU General Public License as
    
    9 9
      * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    16
    + *
    
    17 17
      * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -30,6 +30,16 @@ import fr.ird.observe.client.constants.DbMode;
    30 30
     import fr.ird.observe.dto.FloatingObjectPreset;
    
    31 31
     import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
    
    32 32
     import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
    
    33
    +import org.apache.commons.lang3.StringUtils;
    
    34
    +import org.apache.commons.logging.Log;
    
    35
    +import org.apache.commons.logging.LogFactory;
    
    36
    +import org.nuiton.config.ApplicationConfig;
    
    37
    +import org.nuiton.config.ArgumentsParserException;
    
    38
    +import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
    
    39
    +import org.nuiton.jaxx.widgets.temperature.TemperatureFormat;
    
    40
    +import org.nuiton.version.Version;
    
    41
    +import org.nuiton.version.Versions;
    
    42
    +
    
    33 43
     import java.beans.PropertyChangeListener;
    
    34 44
     import java.io.File;
    
    35 45
     import java.nio.charset.StandardCharsets;
    
    ... ... @@ -44,15 +54,6 @@ import java.util.LinkedList;
    44 54
     import java.util.List;
    
    45 55
     import java.util.Properties;
    
    46 56
     import java.util.Set;
    
    47
    -import org.apache.commons.lang3.StringUtils;
    
    48
    -import org.apache.commons.logging.Log;
    
    49
    -import org.apache.commons.logging.LogFactory;
    
    50
    -import org.nuiton.config.ApplicationConfig;
    
    51
    -import org.nuiton.config.ArgumentsParserException;
    
    52
    -import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
    
    53
    -import org.nuiton.version.Version;
    
    54
    -import org.nuiton.version.Versions;
    
    55
    -
    
    56 57
     
    
    57 58
     import static org.nuiton.i18n.I18n.t;
    
    58 59
     
    
    ... ... @@ -62,52 +63,72 @@ import static org.nuiton.i18n.I18n.t;
    62 63
      * @author Tony Chemit - dev@tchemit.fr
    
    63 64
      * @since 1.0
    
    64 65
      */
    
    65
    -public class ClientConfig extends GeneratedClientConfig {
    
    66
    +public class ClientConfig extends GeneratedClientConfig implements NavigationTreeConfig {
    
    66 67
     
    
    68
    +    public static final String DB_NAME = "obstuna";
    
    69
    +    public static final List<ClientConfigOption> MAP_LAYERS = ImmutableList.of(
    
    70
    +            ClientConfigOption.MAP_LAYER1,
    
    71
    +            ClientConfigOption.MAP_LAYER2,
    
    72
    +            ClientConfigOption.MAP_LAYER3,
    
    73
    +            ClientConfigOption.MAP_LAYER4,
    
    74
    +            ClientConfigOption.MAP_LAYER5,
    
    75
    +            ClientConfigOption.MAP_LAYER6,
    
    76
    +            ClientConfigOption.MAP_LAYER7,
    
    77
    +            ClientConfigOption.MAP_LAYER8,
    
    78
    +            ClientConfigOption.MAP_LAYER9,
    
    79
    +            ClientConfigOption.MAP_LAYER10);
    
    67 80
         /** le pattern du fichier de sauvegarde d'une base locale */
    
    68 81
         private static final String BACKUP_DB_PATTERN = "obstuna-local-%1$tF--%1$tk-%1$tM-%1$tS.sql.gz";
    
    69
    -
    
    70
    -    public static final String DB_NAME = "obstuna";
    
    71
    -
    
    72 82
         private static final String APPLICATION_VERSION = "application.version";
    
    73
    -
    
    74 83
         private static final String VERSION = "version";
    
    75
    -
    
    76 84
         private static final String PROPERTY_LOCAL_STORAGE_EXIST = "localStorageExist";
    
    77
    -
    
    78 85
         private static final String PROPERTY_INITIAL_DUMP_EXIST = "initialDumpExist";
    
    79
    -
    
    80 86
         private static final String PROPERTY_MAIN_STORAGE_OPENED = "mainStorageOpened";
    
    81
    -
    
    82 87
         /** Logger */
    
    83 88
         private static final Log log = LogFactory.getLog(ClientConfig.class);
    
    84
    -
    
    85 89
         private static final String DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME = "observe-client.conf";
    
    86
    -
    
    90
    +    /**
    
    91
    +     * Liste des options qu'on ne peut pas sauvegarder (les mots de passes,
    
    92
    +     * les options d'admin pour les simples utilisateurs,...).
    
    93
    +     *
    
    94
    +     * @since 1.5
    
    95
    +     */
    
    96
    +    private final String[] unsavables = new String[]{
    
    97
    +//            ClientConfigOption.OBSTUNA_PASSWORD.getKey(),
    
    98
    +            ClientConfigOption.H2_PASSWORD.getKey(),
    
    99
    +            ClientConfigOption.OBSTUNA_CAN_MIGRATE.getKey(),
    
    100
    +    };
    
    101
    +    //FIXME
    
    102
    +    private final ImmutableSet<String> longlinVesselTypeIds = ImmutableSet.copyOf(
    
    103
    +            Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
    
    104
    +                    "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869",
    
    105
    +                    "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1"));
    
    106
    +    private final ImmutableSet<String> seineVesselTypeIds = ImmutableSet.copyOf(
    
    107
    +            Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
    
    108
    +                    "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357",
    
    109
    +                    "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519",
    
    110
    +                    "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084",
    
    111
    +                    "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407"));
    
    112
    +    private final SimpleDateFormat dateFormat = new SimpleDateFormat();
    
    87 113
         /**
    
    88 114
          * un drapeau pour savoir s'il faut lancer l'interface graphique. Cette
    
    89 115
          * valeur peut être programmées lors des actions.
    
    90 116
          */
    
    91 117
         private boolean displayMainUI = true;
    
    92
    -
    
    93 118
         /** drapeau pour savoir si une base locale existe */
    
    94 119
         private boolean localStorageExist;
    
    95
    -
    
    96 120
         /**
    
    97 121
          * drapeau pour savoir si le dump initial a ete chargée depuis la base
    
    98 122
          * centrale
    
    99 123
          */
    
    100 124
         private boolean initialDumpExist;
    
    101
    -
    
    102 125
         /** drapeau pour savoir si une source de données est ouverte */
    
    103 126
         private boolean mainStorageOpened;
    
    104
    -
    
    105 127
         /**
    
    106 128
          * drapeau pour savoir si la source ouverte est locale (attention, lorsqu'il
    
    107 129
          * n'y a pas de storage d'ouvert, la valeur est null).
    
    108 130
          */
    
    109 131
         private Boolean mainStorageOpenedLocal;
    
    110
    -
    
    111 132
         /**
    
    112 133
          * drapeau pour savoir si on peut utiliser des ui dans l'environnement.
    
    113 134
          * <p>
    
    ... ... @@ -116,37 +137,12 @@ public class ClientConfig extends GeneratedClientConfig {
    116 137
          * trouvé.
    
    117 138
          */
    
    118 139
         private boolean canUseUI = true;
    
    119
    -
    
    120 140
         /** La version de l'application */
    
    121 141
         private Version version;
    
    122
    -
    
    123 142
         /** Texte du copyright (calculé dynamiquement). */
    
    124 143
         private String copyrightText;
    
    125
    -
    
    126
    -    /**
    
    127
    -     * Liste des options qu'on ne peut pas sauvegarder (les mots de passes,
    
    128
    -     * les options d'admin pour les simples utilisateurs,...).
    
    129
    -     *
    
    130
    -     * @since 1.5
    
    131
    -     */
    
    132
    -    private final String[] unsavables = new String[]{
    
    133
    -//            ClientConfigOption.OBSTUNA_PASSWORD.getKey(),
    
    134
    -            ClientConfigOption.H2_PASSWORD.getKey(),
    
    135
    -            ClientConfigOption.OBSTUNA_CAN_MIGRATE.getKey(),
    
    136
    -    };
    
    137
    -
    
    138
    -    //FIXME
    
    139
    -    private final ImmutableSet<String> longlinVesselTypeIds = ImmutableSet.copyOf(
    
    140
    -            Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
    
    141
    -                            "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869",
    
    142
    -                            "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1"));
    
    143
    -
    
    144
    -    private final ImmutableSet<String> seineVesselTypeIds = ImmutableSet.copyOf(
    
    145
    -            Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
    
    146
    -                            "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357",
    
    147
    -                            "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519",
    
    148
    -                            "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084",
    
    149
    -                            "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407"));
    
    144
    +    private ImmutableList<ServerDataSourceConfiguration> serverDataSourceConfigurationList;
    
    145
    +    private ImmutableList<RemoteDataSourceConfiguration> remoteDataSourceConfigurationList;
    
    150 146
     
    
    151 147
         public ClientConfig() {
    
    152 148
             this(DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME);
    
    ... ... @@ -217,6 +213,11 @@ public class ClientConfig extends GeneratedClientConfig {
    217 213
             return CoordinateFormat.valueOf(get().getOption(ClientConfigOption.COORDINATE_FORMAT.getKey()));
    
    218 214
         }
    
    219 215
     
    
    216
    +    @Override
    
    217
    +    public TemperatureFormat getTemperatureFormat() {
    
    218
    +        return get().getOption(TemperatureFormat.class, ClientConfigOption.TEMPERATURE_FORMAT.getKey());
    
    219
    +    }
    
    220
    +
    
    220 221
         public String getCopyrightText() {
    
    221 222
             if (copyrightText == null) {
    
    222 223
                 Date date = new Date();
    
    ... ... @@ -232,6 +233,10 @@ public class ClientConfig extends GeneratedClientConfig {
    232 233
             return version;
    
    233 234
         }
    
    234 235
     
    
    236
    +    private void setVersion(Version version) {
    
    237
    +        this.version = version;
    
    238
    +    }
    
    239
    +
    
    235 240
         public boolean isShowTimeEditorSlider() {
    
    236 241
             return isShowDateTimeEditorSlider();
    
    237 242
         }
    
    ... ... @@ -244,24 +249,24 @@ public class ClientConfig extends GeneratedClientConfig {
    244 249
             return displayMainUI;
    
    245 250
         }
    
    246 251
     
    
    247
    -    public boolean isCanUseUI() {
    
    248
    -        return canUseUI;
    
    249
    -    }
    
    250
    -
    
    251
    -    public boolean isLocalStorageExist() {
    
    252
    -        return localStorageExist;
    
    252
    +    public void setDisplayMainUI(boolean b) {
    
    253
    +        displayMainUI = b;
    
    253 254
         }
    
    254 255
     
    
    255
    -    public boolean isInitialDumpExist() {
    
    256
    -        return initialDumpExist;
    
    256
    +    public boolean isCanUseUI() {
    
    257
    +        return canUseUI;
    
    257 258
         }
    
    258 259
     
    
    259
    -    public boolean isMainStorageOpened() {
    
    260
    -        return mainStorageOpened;
    
    260
    +    public void setCanUseUI(boolean canUseUI) {
    
    261
    +        this.canUseUI = canUseUI;
    
    262
    +        if (!canUseUI) {
    
    263
    +            // on ne pourra pas lancer l'ui principale
    
    264
    +            setDisplayMainUI(false);
    
    265
    +        }
    
    261 266
         }
    
    262 267
     
    
    263
    -    public Boolean getMainStorageOpenedLocal() {
    
    264
    -        return mainStorageOpenedLocal;
    
    268
    +    public boolean isLocalStorageExist() {
    
    269
    +        return localStorageExist;
    
    265 270
         }
    
    266 271
     
    
    267 272
         public void setLocalStorageExist(boolean newValue) {
    
    ... ... @@ -270,12 +275,20 @@ public class ClientConfig extends GeneratedClientConfig {
    270 275
             firePropertyChange(PROPERTY_LOCAL_STORAGE_EXIST, newValue);
    
    271 276
         }
    
    272 277
     
    
    278
    +    public boolean isInitialDumpExist() {
    
    279
    +        return initialDumpExist;
    
    280
    +    }
    
    281
    +
    
    273 282
         public void setInitialDumpExist(boolean newValue) {
    
    274 283
             initialDumpExist = newValue;
    
    275 284
             // always force propagation
    
    276 285
             firePropertyChange(PROPERTY_INITIAL_DUMP_EXIST, newValue);
    
    277 286
         }
    
    278 287
     
    
    288
    +    public boolean isMainStorageOpened() {
    
    289
    +        return mainStorageOpened;
    
    290
    +    }
    
    291
    +
    
    279 292
         public void setMainStorageOpened(boolean newValue) {
    
    280 293
             mainStorageOpened = newValue;
    
    281 294
             if (!newValue) {
    
    ... ... @@ -286,36 +299,16 @@ public class ClientConfig extends GeneratedClientConfig {
    286 299
             firePropertyChange(PROPERTY_MAIN_STORAGE_OPENED, newValue);
    
    287 300
         }
    
    288 301
     
    
    302
    +    public Boolean getMainStorageOpenedLocal() {
    
    303
    +        return mainStorageOpenedLocal;
    
    304
    +    }
    
    305
    +
    
    289 306
         public void setMainStorageOpenedLocal(Boolean newValue) {
    
    290 307
             mainStorageOpenedLocal = newValue;
    
    291 308
             // always force propagation
    
    292 309
             firePropertyChange(PROPERTY_MAIN_STORAGE_OPENED + "Local", newValue);
    
    293 310
         }
    
    294 311
     
    
    295
    -    public void setDisplayMainUI(boolean b) {
    
    296
    -        displayMainUI = b;
    
    297
    -    }
    
    298
    -
    
    299
    -    public void setCanUseUI(boolean canUseUI) {
    
    300
    -        this.canUseUI = canUseUI;
    
    301
    -        if (!canUseUI) {
    
    302
    -            // on ne pourra pas lancer l'ui principale
    
    303
    -            setDisplayMainUI(false);
    
    304
    -        }
    
    305
    -    }
    
    306
    -
    
    307
    -    public static final List<ClientConfigOption> MAP_LAYERS = ImmutableList.of(
    
    308
    -            ClientConfigOption.MAP_LAYER1,
    
    309
    -            ClientConfigOption.MAP_LAYER2,
    
    310
    -            ClientConfigOption.MAP_LAYER3,
    
    311
    -            ClientConfigOption.MAP_LAYER4,
    
    312
    -            ClientConfigOption.MAP_LAYER5,
    
    313
    -            ClientConfigOption.MAP_LAYER6,
    
    314
    -            ClientConfigOption.MAP_LAYER7,
    
    315
    -            ClientConfigOption.MAP_LAYER8,
    
    316
    -            ClientConfigOption.MAP_LAYER9,
    
    317
    -            ClientConfigOption.MAP_LAYER10);
    
    318
    -
    
    319 312
         public List<File> getMapLayerFiles() {
    
    320 313
             List<File> layers = new LinkedList<>();
    
    321 314
     
    
    ... ... @@ -399,10 +392,6 @@ public class ClientConfig extends GeneratedClientConfig {
    399 392
             }
    
    400 393
         }
    
    401 394
     
    
    402
    -    private void setVersion(Version version) {
    
    403
    -        this.version = version;
    
    404
    -    }
    
    405
    -
    
    406 395
         public Set<String> getSeineVesselTypeIds() {
    
    407 396
             return seineVesselTypeIds;
    
    408 397
         }
    
    ... ... @@ -429,10 +418,17 @@ public class ClientConfig extends GeneratedClientConfig {
    429 418
             return option == null ? new RemoteDataSourceConfiguration[0] : new Gson().fromJson(option, RemoteDataSourceConfiguration[].class);
    
    430 419
         }
    
    431 420
     
    
    421
    +    @Override
    
    422
    +    public void setRemoteDataSourceConfigurations(RemoteDataSourceConfiguration[] configurations) {
    
    423
    +        String option = new Gson().toJson(configurations);
    
    424
    +        get().setOption(ClientConfigOption.REMOTE_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
    
    425
    +        remoteDataSourceConfigurationList = null;
    
    426
    +    }
    
    427
    +
    
    432 428
         public void addRemoteDataSourceConfiguration(RemoteDataSourceConfiguration configuration) {
    
    433 429
             List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
    
    434 430
             remoteDataSourceConfigurations.add(configuration);
    
    435
    -        setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
    
    431
    +        setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
    
    436 432
             saveForUser();
    
    437 433
         }
    
    438 434
     
    
    ... ... @@ -440,27 +436,17 @@ public class ClientConfig extends GeneratedClientConfig {
    440 436
             List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
    
    441 437
             remoteDataSourceConfigurations.remove(configuration);
    
    442 438
             remoteDataSourceConfigurations.add(configuration);
    
    443
    -        setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
    
    439
    +        setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
    
    444 440
             saveForUser();
    
    445 441
         }
    
    446 442
     
    
    447 443
         public void removeRemoteDataSourceConfiguration(RemoteDataSourceConfiguration configuration) {
    
    448 444
             List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
    
    449 445
             remoteDataSourceConfigurations.remove(configuration);
    
    450
    -        setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
    
    446
    +        setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
    
    451 447
             saveForUser();
    
    452 448
         }
    
    453 449
     
    
    454
    -    @Override
    
    455
    -    public void setRemoteDataSourceConfigurations(RemoteDataSourceConfiguration[] configurations) {
    
    456
    -        String option = new Gson().toJson(configurations);
    
    457
    -        get().setOption(ClientConfigOption.REMOTE_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
    
    458
    -        remoteDataSourceConfigurationList=null;
    
    459
    -    }
    
    460
    -
    
    461
    -    ImmutableList<ServerDataSourceConfiguration> serverDataSourceConfigurationList;
    
    462
    -    ImmutableList<RemoteDataSourceConfiguration> remoteDataSourceConfigurationList;
    
    463
    -
    
    464 450
         public ImmutableList<RemoteDataSourceConfiguration> getRemoteDataSourceConfigurationList() {
    
    465 451
             if (remoteDataSourceConfigurationList == null) {
    
    466 452
                 List<RemoteDataSourceConfiguration> configurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
    
    ... ... @@ -485,10 +471,17 @@ public class ClientConfig extends GeneratedClientConfig {
    485 471
             return option == null ? new ServerDataSourceConfiguration[0] : new Gson().fromJson(option, ServerDataSourceConfiguration[].class);
    
    486 472
         }
    
    487 473
     
    
    474
    +    @Override
    
    475
    +    public void setServerDataSourceConfigurations(ServerDataSourceConfiguration[] configurations) {
    
    476
    +        String option = new Gson().toJson(configurations);
    
    477
    +        get().setOption(ClientConfigOption.SERVER_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
    
    478
    +        serverDataSourceConfigurationList = null;
    
    479
    +    }
    
    480
    +
    
    488 481
         public void addServerDataSourceConfiguration(ServerDataSourceConfiguration configuration) {
    
    489 482
             List<ServerDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
    
    490 483
             remoteDataSourceConfigurations.add(configuration);
    
    491
    -        setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
    
    484
    +        setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
    
    492 485
             saveForUser();
    
    493 486
         }
    
    494 487
     
    
    ... ... @@ -496,27 +489,18 @@ public class ClientConfig extends GeneratedClientConfig {
    496 489
             List<ServerDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
    
    497 490
             remoteDataSourceConfigurations.remove(configuration);
    
    498 491
             remoteDataSourceConfigurations.add(configuration);
    
    499
    -        setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
    
    492
    +        setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
    
    500 493
             saveForUser();
    
    501 494
         }
    
    502 495
     
    
    503 496
         public void removeServerDataSourceConfiguration(ServerDataSourceConfiguration configuration) {
    
    504 497
             List<ServerDataSourceConfiguration> serverDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
    
    505 498
             serverDataSourceConfigurations.remove(configuration);
    
    506
    -        setServerDataSourceConfigurations(serverDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[serverDataSourceConfigurations.size()]));
    
    499
    +        setServerDataSourceConfigurations(serverDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
    
    507 500
             saveForUser();
    
    508 501
         }
    
    509 502
     
    
    510 503
         @Override
    
    511
    -    public void setServerDataSourceConfigurations(ServerDataSourceConfiguration[] configurations) {
    
    512
    -        String option = new Gson().toJson(configurations);
    
    513
    -        get().setOption(ClientConfigOption.SERVER_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
    
    514
    -        serverDataSourceConfigurationList=null;
    
    515
    -    }
    
    516
    -
    
    517
    -    private final SimpleDateFormat dateFormat = new SimpleDateFormat();
    
    518
    -
    
    519
    -    @Override
    
    520 504
         public Date getBuildDate() {
    
    521 505
             String dateStr = get().getOption(ClientConfigOption.BUILD_DATE.getKey());
    
    522 506
             try {
    

  • client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java
    1
    +package fr.ird.observe.client.configuration;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client Configuration
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 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 General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (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 General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.services.service.data.NavigationRequest;
    
    26
    +
    
    27
    +/**
    
    28
    + * Created by tchemit on 01/04/2018.
    
    29
    + *
    
    30
    + * @author Tony Chemit - dev@tchemit.fr
    
    31
    + */
    
    32
    +public interface NavigationTreeConfig {
    
    33
    +
    
    34
    +    boolean isShowSeineTrip();
    
    35
    +
    
    36
    +    void setShowSeineTrip(boolean showSeineTrip);
    
    37
    +
    
    38
    +    boolean isShowLonglineTrip();
    
    39
    +
    
    40
    +    void setShowLonglineTrip(boolean showLonglineTrip);
    
    41
    +
    
    42
    +    boolean isShowReferential();
    
    43
    +
    
    44
    +    void setShowReferential(boolean showReferential);
    
    45
    +
    
    46
    +    boolean isShowEmptyProgram();
    
    47
    +
    
    48
    +    void setShowEmptyProgram(boolean showEmptyProgram);
    
    49
    +
    
    50
    +    default NavigationRequest toRequest() {
    
    51
    +        NavigationRequest navigationRequest = new NavigationRequest();
    
    52
    +        navigationRequest.setLoadLongline(isShowLonglineTrip());
    
    53
    +        navigationRequest.setLoadSeine(isShowSeineTrip());
    
    54
    +        navigationRequest.setLoadEmptyProgram(isShowEmptyProgram());
    
    55
    +        return navigationRequest;
    
    56
    +    }
    
    57
    +
    
    58
    +    default void load(NavigationTreeConfig config) {
    
    59
    +        setShowEmptyProgram(config.isShowEmptyProgram());
    
    60
    +        setShowReferential(config.isShowReferential());
    
    61
    +        setShowLonglineTrip(config.isShowLonglineTrip());
    
    62
    +        setShowSeineTrip(config.isShowSeineTrip());
    
    63
    +    }
    
    64
    +}

  • client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java
    1
    +package fr.ird.observe.client.configuration;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client Configuration
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 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 General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (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 General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import io.ultreia.java4all.bean.AbstractJavaBean;
    
    26
    +
    
    27
    +/**
    
    28
    + * Created by tchemit on 01/04/2018.
    
    29
    + *
    
    30
    + * @author Tony Chemit - dev@tchemit.fr
    
    31
    + */
    
    32
    +public class NavigationTreeConfigBean extends AbstractJavaBean implements NavigationTreeConfig {
    
    33
    +
    
    34
    +
    
    35
    +    private boolean showSeineTrip = true;
    
    36
    +    private boolean showLonglineTrip = true;
    
    37
    +    private boolean showReferential = true;
    
    38
    +    private boolean showEmptyProgram = true;
    
    39
    +
    
    40
    +    @Override
    
    41
    +    public boolean isShowSeineTrip() {
    
    42
    +        return showSeineTrip;
    
    43
    +    }
    
    44
    +
    
    45
    +    @Override
    
    46
    +    public void setShowSeineTrip(boolean showSeineTrip) {
    
    47
    +        boolean oldValue = isShowSeineTrip();
    
    48
    +        this.showSeineTrip = showSeineTrip;
    
    49
    +        firePropertyChange("showSeineTrip", oldValue, showSeineTrip);
    
    50
    +    }
    
    51
    +
    
    52
    +    @Override
    
    53
    +    public boolean isShowLonglineTrip() {
    
    54
    +        return showLonglineTrip;
    
    55
    +    }
    
    56
    +
    
    57
    +    @Override
    
    58
    +    public void setShowLonglineTrip(boolean showLonglineTrip) {
    
    59
    +        boolean oldValue = isShowLonglineTrip();
    
    60
    +        this.showLonglineTrip = showLonglineTrip;
    
    61
    +        firePropertyChange("showLonglineTrip", oldValue, showLonglineTrip);
    
    62
    +    }
    
    63
    +
    
    64
    +    @Override
    
    65
    +    public boolean isShowReferential() {
    
    66
    +        return showReferential;
    
    67
    +    }
    
    68
    +
    
    69
    +    @Override
    
    70
    +    public void setShowReferential(boolean showReferential) {
    
    71
    +        boolean oldValue = isShowReferential();
    
    72
    +        this.showReferential = showReferential;
    
    73
    +        firePropertyChange("showReferential", oldValue, showReferential);
    
    74
    +    }
    
    75
    +
    
    76
    +    @Override
    
    77
    +    public boolean isShowEmptyProgram() {
    
    78
    +        return showEmptyProgram;
    
    79
    +    }
    
    80
    +
    
    81
    +    @Override
    
    82
    +    public void setShowEmptyProgram(boolean showEmptyProgram) {
    
    83
    +        boolean oldValue = isShowEmptyProgram();
    
    84
    +        this.showEmptyProgram = showEmptyProgram;
    
    85
    +        firePropertyChange("showEmptyProgram", oldValue, showEmptyProgram);
    
    86
    +    }
    
    87
    +}

  • client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
    ... ... @@ -33,6 +33,7 @@ observe.config.defaultTmpDirectory.description=Default temporary directory used
    33 33
     observe.config.defaultValidationReportDirectory.description=Default validation report directory
    
    34 34
     observe.config.devMode=Dev mode
    
    35 35
     observe.config.floatingObjectPresets.description=Floating Objects references
    
    36
    +observe.config.h2.can.editReferential.description=Local database can edit referential
    
    36 37
     observe.config.h2.can.migrate.description=Flag to know if you can migrate h2 data sources
    
    37 38
     observe.config.h2.login.description=H2 Login
    
    38 39
     observe.config.h2.password.description=H2 Password
    
    ... ... @@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Species for object school
    74 75
     observe.config.speciesList.seine.schoolEstimate=Species for school esitmates
    
    75 76
     observe.config.speciesList.seine.targetCatch=Species for target catches
    
    76 77
     observe.config.swingSessionFile.description=Swing session file.
    
    78
    +observe.config.temperature.format=Default temperature format
    
    77 79
     observe.config.ui.autoPopupNumberEditor=Flag sets to true when number editor show automaticly popup
    
    78 80
     observe.config.ui.changeSynchroSrc=Flag sets to true if you can change local source in admin tasks
    
    79 81
     observe.config.ui.focusBorderColor=Color of the focus container border
    
    ... ... @@ -85,6 +87,10 @@ observe.config.ui.showMnemonic=Show mnemonic on actions
    85 87
     observe.config.ui.showNumberEditorButton=Flag sets to true to show button to invoke popup on number's editors
    
    86 88
     observe.config.ui.showTimeEditorSlider=Show timer slider
    
    87 89
     observe.config.ui.storeRemoteStorage=Flag sets to true to store in config a remote connexion (except passwords)
    
    90
    +observe.config.ui.tree.showEmptyProgram.description=Show programs with no trip inside
    
    91
    +observe.config.ui.tree.showLonglineTrip.description=Show Longline trips
    
    92
    +observe.config.ui.tree.showReferential.description=Show Referential
    
    93
    +observe.config.ui.tree.showSeineTrip.description=Show Seine Trips
    
    88 94
     observe.config.ui.treeOpenNodes=Opened data from last session
    
    89 95
     observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source
    
    90 96
     observe.config.validation.lengthWeightEnable=Force validation of species length max
    

  • client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
    ... ... @@ -33,6 +33,7 @@ observe.config.defaultTmpDirectory.description=Directorio temporal por defecto
    33 33
     observe.config.defaultValidationReportDirectory.description=Directorio por defecto de almacenamiento de los informes de validación
    
    34 34
     observe.config.devMode=Modo desarrollador
    
    35 35
     observe.config.floatingObjectPresets.description=Objets flottants de référence \#TODO
    
    36
    +observe.config.h2.can.editReferential.description=Local database can edit referential \#TODO
    
    36 37
     observe.config.h2.can.migrate.description=Autorizar la actualización de las bases locales (h2)
    
    37 38
     observe.config.h2.login.description=Login h2
    
    38 39
     observe.config.h2.password.description=Contraseña h2
    
    ... ... @@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Especies para las estimaci
    74 75
     observe.config.speciesList.seine.schoolEstimate=Especies para las estimaciones
    
    75 76
     observe.config.speciesList.seine.targetCatch=Especies par las capturas objetivo
    
    76 77
     observe.config.swingSessionFile.description=Fichier de sauvegarde des états des UI. \#TODO
    
    78
    +observe.config.temperature.format=Default temperature format \#TODO
    
    77 79
     observe.config.ui.autoPopupNumberEditor=Para mostrar automáticamente el editor numérico durante la edición de un número
    
    78 80
     observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
    
    79 81
     observe.config.ui.focusBorderColor=Couleur de la bordure de la zone qui a le focus \#TODO
    
    ... ... @@ -85,6 +87,10 @@ observe.config.ui.showMnemonic=Afficher les racourcis clavier \#TODO
    85 87
     observe.config.ui.showNumberEditorButton=Para mostrar el botón que permite usar el editor numérico a la izquierda de cada campo numérico
    
    86 88
     observe.config.ui.showTimeEditorSlider=Para mostrar la regla de edición de las horas
    
    87 89
     observe.config.ui.storeRemoteStorage=Para activar la copia de seguridad de la configuración de la fuente de datos remota
    
    90
    +observe.config.ui.tree.showEmptyProgram.description=Show programs with no trip inside \#TODO
    
    91
    +observe.config.ui.tree.showLonglineTrip.description=Show Longline trips \#TODO
    
    92
    +observe.config.ui.tree.showReferential.description=Show Referential \#TODO
    
    93
    +observe.config.ui.tree.showSeineTrip.description=Show Seine Trips \#TODO
    
    88 94
     observe.config.ui.treeOpenNodes=Nudos abiertos del arbol abiertos cuando se cerró la base por última vez
    
    89 95
     observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source \#TODO
    
    90 96
     observe.config.validation.lengthWeightEnable=Forcer la validation des bormes min/max de taille d'espèce \#TODO
    

  • client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
    ... ... @@ -33,6 +33,7 @@ observe.config.defaultTmpDirectory.description=Le répertoire temporaire par dé
    33 33
     observe.config.defaultValidationReportDirectory.description=Le répertoire par défaut où sont stockés les rapports de validation
    
    34 34
     observe.config.devMode=Mode développeur
    
    35 35
     observe.config.floatingObjectPresets.description=Objets flottants de référence
    
    36
    +observe.config.h2.can.editReferential.description=Pour pouvoir éditer le référentiel d'une base locale
    
    36 37
     observe.config.h2.can.migrate.description=Autoriser la mise à jour des bases locales (H2)
    
    37 38
     observe.config.h2.login.description=L'identifiant H2
    
    38 39
     observe.config.h2.password.description=Le mot de passe H2
    
    ... ... @@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Espèces pour les estimati
    74 75
     observe.config.speciesList.seine.schoolEstimate=Espèces pour les estimations
    
    75 76
     observe.config.speciesList.seine.targetCatch=Espèces pour les captures cible
    
    76 77
     observe.config.swingSessionFile.description=Fichier de sauvegarde des états des UI.
    
    78
    +observe.config.temperature.format=Unité de température
    
    77 79
     observe.config.ui.autoPopupNumberEditor=Pour afficher automatiquement l'éditeur numérique lors de l'édition d'un nombre
    
    78 80
     observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
    
    79 81
     observe.config.ui.focusBorderColor=Couleur de la bordure de la zone qui a le focus
    
    ... ... @@ -85,6 +87,10 @@ observe.config.ui.showMnemonic=Afficher les racourcis clavier
    85 87
     observe.config.ui.showNumberEditorButton=Pour afficher le bouton qui permet d'utiliser l'éditeur numérique à gauche de chaque champs numérique
    
    86 88
     observe.config.ui.showTimeEditorSlider=Pour afficher la réglette d'édition des heures
    
    87 89
     observe.config.ui.storeRemoteStorage=Pour activer la sauvegarde de la configuration de la source distante
    
    90
    +observe.config.ui.tree.showEmptyProgram.description=Voir les programmes sans marée
    
    91
    +observe.config.ui.tree.showLonglineTrip.description=Voir les marées Palangre
    
    92
    +observe.config.ui.tree.showReferential.description=Voir le référentiel
    
    93
    +observe.config.ui.tree.showSeineTrip.description=Voir les marées Senne
    
    88 94
     observe.config.ui.treeOpenNodes=Nœuds de l'arbre ouverts lors de la dernière fermeture de la base
    
    89 95
     observe.config.ui.treeSelectedNodes.description=Nœuds sélectionnés sur la dernière base ouverte
    
    90 96
     observe.config.validation.lengthWeightEnable=Forcer la validation des bormes min/max de taille d'espèce
    

  • client/pom.xml
    ... ... @@ -382,10 +382,20 @@
    382 382
           <artifactId>class-mapping</artifactId>
    
    383 383
         </dependency>
    
    384 384
     
    
    385
    +    <dependency>
    
    386
    +      <groupId>io.ultreia.java4all</groupId>
    
    387
    +      <artifactId>java-lang</artifactId>
    
    388
    +      <scope>runtime</scope>
    
    389
    +    </dependency>
    
    390
    +
    
    385 391
         <!-- jaxx dependencies -->
    
    386 392
     
    
    387 393
         <dependency>
    
    388 394
           <groupId>io.ultreia.java4all.jaxx</groupId>
    
    395
    +      <artifactId>jaxx-runtime-spi</artifactId>
    
    396
    +    </dependency>
    
    397
    +    <dependency>
    
    398
    +      <groupId>io.ultreia.java4all.jaxx</groupId>
    
    389 399
           <artifactId>jaxx-runtime</artifactId>
    
    390 400
         </dependency>
    
    391 401
         <dependency>
    

  • client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
    ... ... @@ -61,10 +61,11 @@ public abstract class ObserveKeyStrokes {
    61 61
         public static final KeyStroke KEY_STROKE_RELOAD_DEFAULT_CONFIGURATION = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
    
    62 62
         public static final KeyStroke KEY_STROKE_ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    
    63 63
         public static final KeyStroke KEY_STROKE_ENTER = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    
    64
    -    public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F1");
    
    65
    -    public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F2");
    
    66
    -    public static final KeyStroke KEY_STROKE_SHOW_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed F3");
    
    67
    -    public static final KeyStroke KEY_STROKE_SHOW_EMPTY_PROGRAM = KeyStroke.getKeyStroke("ctrl pressed F4");
    
    64
    +    public static final KeyStroke KEY_STROKE_NAVIGATION_CONFIGURE = KeyStroke.getKeyStroke("ctrl pressed F1");
    
    65
    +    public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F2");
    
    66
    +    public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F3");
    
    67
    +    public static final KeyStroke KEY_STROKE_SHOW_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed F4");
    
    68
    +    public static final KeyStroke KEY_STROKE_SHOW_EMPTY_PROGRAM = KeyStroke.getKeyStroke("ctrl pressed F5");
    
    68 69
         public static final KeyStroke KEY_STROKE_CONFIGURE_LOCAL_SOURCE = KeyStroke.getKeyStroke("ctrl pressed L");
    
    69 70
         public static final KeyStroke KEY_STROKE_CONFIGURE_REMOTE_SOURCE = KeyStroke.getKeyStroke("ctrl pressed R");
    
    70 71
         public static final KeyStroke KEY_STROKE_SAVE_TABLE_ENTRY = KeyStroke.getKeyStroke("ctrl pressed S");
    

  • client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx
    ... ... @@ -77,8 +77,10 @@
    77 77
     
    
    78 78
         fr.ird.observe.client.ui.content.ContentUIManager
    
    79 79
         fr.ird.observe.client.ui.content.ObserveActionMap
    
    80
    +    fr.ird.observe.client.ui.tree.navigation.NavigationUI
    
    80 81
         fr.ird.observe.client.ui.tree.navigation.NavigationTree
    
    81
    -    fr.ird.observe.client.ui.tree.navigation.NavigationTreeHeader
    
    82
    +    fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel
    
    83
    +    fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel
    
    82 84
         fr.ird.observe.client.ui.util.UIHelper
    
    83 85
         fr.ird.observe.client.ui.util.ObserveBlockingLayerUI
    
    84 86
     
    
    ... ... @@ -252,10 +254,8 @@ protected void finalize() throws Throwable {
    252 254
           <!-- left : navigation -->
    
    253 255
     
    
    254 256
           <JXTitledPanel id='navigationView'>
    
    255
    -        <JScrollPane id='navigationScrollPane' columnHeaderView='{navigationTreeHeader}'>
    
    256
    -          <NavigationTree id="navigation"/>
    
    257
    -          <NavigationTreeHeader id='navigationTreeHeader' tree='{navigation}'/>
    
    258
    -        </JScrollPane>
    
    257
    +        <NavigationUI id="navigationUI" initializer="new NavigationUI((JAXXContext)this)"/>
    
    258
    +        <NavigationTree id="navigation" initializer="navigationUI.getTree()"/>
    
    259 259
           </JXTitledPanel>
    
    260 260
     
    
    261 261
           <!-- right : (content + messages) -->
    

  • client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
    ... ... @@ -6,15 +6,15 @@
    6 6
      * %%
    
    7 7
      * This program is free software: you can redistribute it and/or modify
    
    8 8
      * it under the terms of the GNU General Public License as
    
    9
    - * published by the Free Software Foundation, either version 3 of the 
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    17
    - * You should have received a copy of the GNU General Public 
    
    16
    + *
    
    17
    + * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20 20
      * #L%
    
    ... ... @@ -32,7 +32,6 @@ import fr.ird.observe.client.ui.content.ContentUIManager;
    32 32
     import fr.ird.observe.client.ui.content.ObserveActionMap;
    
    33 33
     import fr.ird.observe.client.ui.tree.ObserveNavigationTreeShowPopupAction;
    
    34 34
     import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
    
    35
    -import fr.ird.observe.client.ui.tree.navigation.NavigationTreeHeader;
    
    36 35
     import fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel;
    
    37 36
     import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    38 37
     import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
    
    ... ... @@ -44,19 +43,14 @@ import fr.ird.observe.client.ui.util.UIHelper;
    44 43
     import fr.ird.observe.dto.decoration.DecoratorService;
    
    45 44
     import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
    
    46 45
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    47
    -import java.awt.Component;
    
    48
    -import java.awt.Container;
    
    49
    -import java.awt.Cursor;
    
    50
    -import java.awt.Dimension;
    
    51
    -import java.awt.event.ComponentAdapter;
    
    52
    -import java.awt.event.ComponentEvent;
    
    53
    -import java.awt.event.KeyEvent;
    
    54
    -import java.awt.event.MouseAdapter;
    
    55
    -import java.awt.event.MouseEvent;
    
    56
    -import java.util.ArrayList;
    
    57
    -import java.util.List;
    
    58
    -import java.util.Locale;
    
    59
    -import java.util.Objects;
    
    46
    +import org.apache.commons.logging.Log;
    
    47
    +import org.apache.commons.logging.LogFactory;
    
    48
    +import org.nuiton.i18n.I18n;
    
    49
    +import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
    
    50
    +import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
    
    51
    +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
    
    52
    +import org.nuiton.jaxx.widgets.error.ErrorDialogUI;
    
    53
    +
    
    60 54
     import javax.swing.AbstractButton;
    
    61 55
     import javax.swing.JComponent;
    
    62 56
     import javax.swing.JSplitPane;
    
    ... ... @@ -67,14 +61,16 @@ import javax.swing.border.Border;
    67 61
     import javax.swing.border.LineBorder;
    
    68 62
     import javax.swing.event.TreeSelectionEvent;
    
    69 63
     import javax.swing.tree.TreePath;
    
    70
    -import org.apache.commons.logging.Log;
    
    71
    -import org.apache.commons.logging.LogFactory;
    
    72
    -import org.nuiton.i18n.I18n;
    
    73
    -import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
    
    74
    -import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
    
    75
    -import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
    
    76
    -import org.nuiton.jaxx.widgets.error.ErrorDialogUI;
    
    77
    -
    
    64
    +import java.awt.Component;
    
    65
    +import java.awt.Container;
    
    66
    +import java.awt.Cursor;
    
    67
    +import java.awt.event.KeyEvent;
    
    68
    +import java.awt.event.MouseAdapter;
    
    69
    +import java.awt.event.MouseEvent;
    
    70
    +import java.util.ArrayList;
    
    71
    +import java.util.List;
    
    72
    +import java.util.Locale;
    
    73
    +import java.util.Objects;
    
    78 74
     
    
    79 75
     import static fr.ird.observe.client.ui.content.ContentUIInitializer.OBSERVE_ACTION;
    
    80 76
     import static org.nuiton.i18n.I18n.t;
    
    ... ... @@ -94,11 +90,87 @@ public class ObserveMainUIInitializer {
    94 90
         private static final String EMPTY_SELECTION = "emptySelection";
    
    95 91
     
    
    96 92
         private final ObserveMainUI ui;
    
    93
    +    private Border focusBorder;
    
    94
    +    private Border noFocusBorder;
    
    97 95
     
    
    98 96
         ObserveMainUIInitializer(ObserveMainUI ui) {
    
    99 97
             this.ui = ui;
    
    100 98
         }
    
    101 99
     
    
    100
    +    /**
    
    101
    +     * Methode pour initialiser l'ui principale sans l'afficher.
    
    102
    +     *
    
    103
    +     * @param context le context applicatif
    
    104
    +     * @param config  la configuration a utiliser
    
    105
    +     * @return l'ui instancie et initialisee mais non visible encore
    
    106
    +     */
    
    107
    +    public static ObserveMainUI initUI(ObserveSwingApplicationContext context, ClientConfig config) {
    
    108
    +
    
    109
    +        SwingValidatorMessageTableModel errorModel = new ObserveSwingValidatorMessageTableModel();
    
    110
    +
    
    111
    +        DecoratorService decoratorService = context.getDecoratorService();
    
    112
    +
    
    113
    +        boolean reloadDecorators = false;
    
    114
    +        Locale currentLocale = I18n.getDefaultLocale();
    
    115
    +        Locale configurationLocale = config.getLocale();
    
    116
    +        if (!configurationLocale.equals(currentLocale)) {
    
    117
    +            if (log.isInfoEnabled()) {
    
    118
    +                log.info("re-init I18n with locale " + configurationLocale);
    
    119
    +            }
    
    120
    +            I18n.setDefaultLocale(configurationLocale);
    
    121
    +            reloadDecorators = true;
    
    122
    +        }
    
    123
    +        if (!config.getDbLocale().equals(decoratorService.getReferentialLocale().getLocale())) {
    
    124
    +            if (log.isInfoEnabled()) {
    
    125
    +                log.info("re-init db with locale " + config.getDbLocale());
    
    126
    +            }
    
    127
    +            decoratorService.setReferentialLocale(ReferentialLocale.valueOf(config.getDbLocale()));
    
    128
    +
    
    129
    +            reloadDecorators = true;
    
    130
    +        }
    
    131
    +
    
    132
    +        if (reloadDecorators) {
    
    133
    +            if (log.isInfoEnabled()) {
    
    134
    +                log.info("reload decorators");
    
    135
    +            }
    
    136
    +            decoratorService.reload();
    
    137
    +        }
    
    138
    +
    
    139
    +        JAXXInitialContext tx = new JAXXInitialContext();
    
    140
    +        tx.add(context).add(errorModel);
    
    141
    +
    
    142
    +        // show main ui
    
    143
    +        ObserveMainUI ui = new ObserveMainUI(tx);
    
    144
    +        ui.setUndecorated(config.isFullScreen());
    
    145
    +
    
    146
    +        String title = t("observe.title.welcome.admin") + (" v " + config.getVersion());
    
    147
    +        ui.setTitle(title);
    
    148
    +
    
    149
    +        context.setMainUI(ui);
    
    150
    +
    
    151
    +        ErrorDialogUI.init(ui);
    
    152
    +
    
    153
    +        // set fullscreen propery on main ui
    
    154
    +        ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
    
    155
    +
    
    156
    +        new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationUI(), ui.getNavigationPopup());
    
    157
    +
    
    158
    +        return ui;
    
    159
    +    }
    
    160
    +
    
    161
    +    public static void setMainUIVisible(ObserveSwingApplicationContext rootContext, ObserveMainUI ui, boolean replace) {
    
    162
    +
    
    163
    +        // force le redimensionnement du splitpane
    
    164
    +        ui.getSplitpane().revalidate();
    
    165
    +
    
    166
    +        // force le redimensionnement du splitpane2
    
    167
    +        ui.getSplitpane2().revalidate();
    
    168
    +
    
    169
    +        // affichage de l'interface graphique
    
    170
    +        SwingUtilities.invokeLater(() -> ui.setVisible(true));
    
    171
    +        rootContext.getSwingSessionHelper().addComponent(ui, replace);
    
    172
    +    }
    
    173
    +
    
    102 174
         private void changeNavigationNode(TreeSelectionEvent event) {
    
    103 175
     
    
    104 176
             ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource();
    
    ... ... @@ -196,7 +268,7 @@ public class ObserveMainUIInitializer {
    196 268
                     if (ui.getNavigation().equals(focusOwner)) {
    
    197 269
                         focusOnNavigation = true;
    
    198 270
                     }
    
    199
    -                if (ui.getNavigationTreeHeader().equals(focusOwner)) {
    
    271
    +                if (ui.getNavigationUI().equals(focusOwner)) {
    
    200 272
                         focusOnNavigation = true;
    
    201 273
                     }
    
    202 274
                     if (ui.getNavigationView().equals(focusOwner)) {
    
    ... ... @@ -209,7 +281,7 @@ public class ObserveMainUIInitializer {
    209 281
                                 focusOnNavigation = true;
    
    210 282
                                 break;
    
    211 283
                             }
    
    212
    -                        if (ui.getNavigationTreeHeader().equals(focusOwnerParent)) {
    
    284
    +                        if (ui.getNavigationUI().equals(focusOwnerParent)) {
    
    213 285
                                 focusOnNavigation = true;
    
    214 286
                                 break;
    
    215 287
                             }
    
    ... ... @@ -243,67 +315,6 @@ public class ObserveMainUIInitializer {
    243 315
         }
    
    244 316
     
    
    245 317
         /**
    
    246
    -     * Methode pour initialiser l'ui principale sans l'afficher.
    
    247
    -     *
    
    248
    -     * @param context le context applicatif
    
    249
    -     * @param config  la configuration a utiliser
    
    250
    -     * @return l'ui instancie et initialisee mais non visible encore
    
    251
    -     */
    
    252
    -    public static ObserveMainUI initUI(ObserveSwingApplicationContext context, ClientConfig config) {
    
    253
    -
    
    254
    -        SwingValidatorMessageTableModel errorModel = new ObserveSwingValidatorMessageTableModel();
    
    255
    -
    
    256
    -        DecoratorService decoratorService = context.getDecoratorService();
    
    257
    -
    
    258
    -        boolean reloadDecorators = false;
    
    259
    -        Locale currentLocale = I18n.getDefaultLocale();
    
    260
    -        Locale configurationLocale = config.getLocale();
    
    261
    -        if (!configurationLocale.equals(currentLocale)) {
    
    262
    -            if (log.isInfoEnabled()) {
    
    263
    -                log.info("re-init I18n with locale " + configurationLocale);
    
    264
    -            }
    
    265
    -            I18n.setDefaultLocale(configurationLocale);
    
    266
    -            reloadDecorators = true;
    
    267
    -        }
    
    268
    -        if (!config.getDbLocale().equals(decoratorService.getReferentialLocale().getLocale())) {
    
    269
    -            if (log.isInfoEnabled()) {
    
    270
    -                log.info("re-init db with locale " + config.getDbLocale());
    
    271
    -            }
    
    272
    -            decoratorService.setReferentialLocale(ReferentialLocale.valueOf(config.getDbLocale()));
    
    273
    -
    
    274
    -            reloadDecorators = true;
    
    275
    -        }
    
    276
    -
    
    277
    -        if (reloadDecorators) {
    
    278
    -            if (log.isInfoEnabled()) {
    
    279
    -                log.info("reload decorators");
    
    280
    -            }
    
    281
    -            decoratorService.reload();
    
    282
    -        }
    
    283
    -
    
    284
    -        JAXXInitialContext tx = new JAXXInitialContext();
    
    285
    -        tx.add(context).add(errorModel);
    
    286
    -
    
    287
    -        // show main ui
    
    288
    -        ObserveMainUI ui = new ObserveMainUI(tx);
    
    289
    -        ui.setUndecorated(config.isFullScreen());
    
    290
    -
    
    291
    -        String title = t("observe.title.welcome.admin") + (" v " + config.getVersion());
    
    292
    -        ui.setTitle(title);
    
    293
    -
    
    294
    -        context.setMainUI(ui);
    
    295
    -
    
    296
    -        ErrorDialogUI.init(ui);
    
    297
    -
    
    298
    -        // set fullscreen propery on main ui
    
    299
    -        ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
    
    300
    -
    
    301
    -        new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationScrollPane(), ui.getNavigationPopup());
    
    302
    -
    
    303
    -        return ui;
    
    304
    -    }
    
    305
    -
    
    306
    -    /**
    
    307 318
          * Permet de recharger l'ui principale et de changer de le mode
    
    308 319
          * d'affichage.
    
    309 320
          *
    
    ... ... @@ -358,11 +369,7 @@ public class ObserveMainUIInitializer {
    358 369
     
    
    359 370
                 // on met à jour le modèle de navigation
    
    360 371
                 NavigationTreeModel treeModel = ui.getNavigation().getTreeModel();
    
    361
    -            treeModel.setLoadSeine(ui.getNavigationTreeHeader().getShowSeine().isSelected());
    
    362
    -            treeModel.setLoadLongline(ui.getNavigationTreeHeader().getShowLongline().isSelected());
    
    363
    -            treeModel.setLoadReferential(ui.getNavigationTreeHeader().getShowReferential().isSelected());
    
    364
    -            treeModel.setLoadEmptyProgram(ui.getNavigationTreeHeader().getShowEmptyProgram().isSelected());
    
    365
    -
    
    372
    +            treeModel.load(config);
    
    366 373
                 treeModel.populate();
    
    367 374
     
    
    368 375
                 // on conserve les noeuds a reselectionner
    
    ... ... @@ -378,19 +385,6 @@ public class ObserveMainUIInitializer {
    378 385
             setMainUIVisible(rootContext, ui, true);
    
    379 386
         }
    
    380 387
     
    
    381
    -    public static void setMainUIVisible(ObserveSwingApplicationContext rootContext, ObserveMainUI ui, boolean replace) {
    
    382
    -
    
    383
    -        // force le redimensionnement du splitpane
    
    384
    -        ui.getSplitpane().revalidate();
    
    385
    -
    
    386
    -        // force le redimensionnement du splitpane2
    
    387
    -        ui.getSplitpane2().revalidate();
    
    388
    -
    
    389
    -        // affichage de l'interface graphique
    
    390
    -        SwingUtilities.invokeLater(() -> ui.setVisible(true));
    
    391
    -        rootContext.getSwingSessionHelper().addComponent(ui, replace);
    
    392
    -    }
    
    393
    -
    
    394 388
         void initialize() {
    
    395 389
     
    
    396 390
             ObserveActionMap actionMap = ui.getObserveActionMap();
    
    ... ... @@ -440,43 +434,43 @@ public class ObserveMainUIInitializer {
    440 434
             };
    
    441 435
             ui.getNavigationView().addMouseListener(mouseAdapter);
    
    442 436
             ui.getNavigation().addMouseListener(mouseAdapter);
    
    443
    -        ui.getNavigationTreeHeader().addMouseListener(mouseAdapter);
    
    437
    +        ui.getNavigationUI().addMouseListener(mouseAdapter);
    
    444 438
     
    
    445 439
             init(ui.getSplitpane());
    
    446 440
             init(ui.getSplitpane2());
    
    447 441
             init(ui.getNavigation());
    
    448 442
     
    
    449
    -        ui.getNavigationView().setRightDecoration(ui.getNavigationTreeHeader().getToolbar());
    
    450
    -        ui.getNavigationView().addComponentListener(new ComponentAdapter() {
    
    451
    -
    
    452
    -            @Override
    
    453
    -            public void componentResized(ComponentEvent e) {
    
    454
    -
    
    455
    -                JComponent source = (JComponent) e.getSource();
    
    456
    -
    
    457
    -                NavigationTreeHeader actions = ui.getNavigationTreeHeader();
    
    458
    -
    
    459
    -                Dimension preferredLayoutSize = actions.getLayout().preferredLayoutSize(actions);
    
    460
    -
    
    461
    -                Dimension showLonglineSize = actions.getShowLongline().getSize();
    
    462
    -                Dimension showSeineSize = actions.getShowSeine().getSize();
    
    463
    -                Dimension showReferential = actions.getShowReferential().getSize();
    
    464
    -                Dimension showEmpty = actions.getShowEmptyProgram().getSize();
    
    465
    -                int minWidth = 18 + (int) Math.max(showLonglineSize.getWidth() + showSeineSize.getWidth(), showReferential.getWidth() + showEmpty.getWidth());
    
    466
    -                source.setMinimumSize(new Dimension(minWidth, (int) source.getSize().getHeight()));
    
    467
    -                log.debug("Header resized to minumun: " + source.getMinimumSize());
    
    468
    -
    
    469
    -                int maxWidth = ui.getNavigationView().getWidth() - 10;
    
    470
    -
    
    471
    -                int currentWidth = (int) preferredLayoutSize.getWidth();
    
    472
    -                int height = 32;
    
    473
    -                if (currentWidth > maxWidth) {
    
    474
    -                    height += 32;
    
    475
    -                }
    
    476
    -                actions.setPreferredSize(new Dimension(maxWidth, height));
    
    477
    -
    
    478
    -            }
    
    479
    -        });
    
    443
    +        ui.getNavigationView().setRightDecoration(ui.getNavigationUI().getToolbar());
    
    444
    +//        ui.getNavigationView().addComponentListener(new ComponentAdapter() {
    
    445
    +//
    
    446
    +//            @Override
    
    447
    +//            public void componentResized(ComponentEvent e) {
    
    448
    +//
    
    449
    +//                JComponent source = (JComponent) e.getSource();
    
    450
    +//
    
    451
    +//                NavigationTreeHeader actions = ui.getNavigationUI();
    
    452
    +//
    
    453
    +//                Dimension preferredLayoutSize = actions.getLayout().preferredLayoutSize(actions);
    
    454
    +//
    
    455
    +//                Dimension showLonglineSize = actions.getShowLongline().getSize();
    
    456
    +//                Dimension showSeineSize = actions.getShowSeine().getSize();
    
    457
    +//                Dimension showReferential = actions.getShowReferential().getSize();
    
    458
    +//                Dimension showEmpty = actions.getShowEmptyProgram().getSize();
    
    459
    +//                int minWidth = 18 + (int) Math.max(showLonglineSize.getWidth() + showSeineSize.getWidth(), showReferential.getWidth() + showEmpty.getWidth());
    
    460
    +//                source.setMinimumSize(new Dimension(minWidth, (int) source.getSize().getHeight()));
    
    461
    +//                log.debug("Header resized to minumun: " + source.getMinimumSize());
    
    462
    +//
    
    463
    +//                int maxWidth = ui.getNavigationView().getWidth() - 10;
    
    464
    +//
    
    465
    +//                int currentWidth = (int) preferredLayoutSize.getWidth();
    
    466
    +//                int height = 32;
    
    467
    +//                if (currentWidth > maxWidth) {
    
    468
    +//                    height += 32;
    
    469
    +//                }
    
    470
    +//                actions.setPreferredSize(new Dimension(maxWidth, height));
    
    471
    +//
    
    472
    +//            }
    
    473
    +//        });
    
    480 474
         }
    
    481 475
     
    
    482 476
         protected void init(ObserveActionMap actionMap, AbstractButton editor) {
    
    ... ... @@ -498,9 +492,6 @@ public class ObserveMainUIInitializer {
    498 492
     
    
    499 493
         }
    
    500 494
     
    
    501
    -    private Border focusBorder;
    
    502
    -    private Border noFocusBorder;
    
    503
    -
    
    504 495
         private Border getFocusBorder() {
    
    505 496
             if (focusBorder == null) {
    
    506 497
                 focusBorder = new LineBorder(ObserveSwingApplicationContext.get().getConfig().getFocusBorderColor(), 3, true);
    
    ... ... @@ -549,7 +540,7 @@ public class ObserveMainUIInitializer {
    549 540
     
    
    550 541
         /**
    
    551 542
          * Nettoye des ui tout ce qui concerne un modèle de navigation.
    
    552
    -     * <p>
    
    543
    +     *
    
    553 544
          * <b>Note:</b> cette méthode doit être appelée avant tout rechargement de modèle de naivgation.
    
    554 545
          *
    
    555 546
          * @param progressModel progress model to interact with ui
    
    ... ... @@ -576,7 +567,7 @@ public class ObserveMainUIInitializer {
    576 567
     
    
    577 568
         /**
    
    578 569
          * Charge dans l'ui un nouveau modèle de navigation.
    
    579
    -     * <p>
    
    570
    +     *
    
    580 571
          * <b>Note:</b> cette méthode doit être appelée après tout rechargement de modèle de naivgation.
    
    581 572
          *
    
    582 573
          * @param progressModel the progress model to interact with ui
    

  • client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
    ... ... @@ -72,15 +72,15 @@ public class DataSynchroModel extends AdminActionModel {
    72 72
             super(AdminStep.DATA_SYNCHRONIZE);
    
    73 73
     
    
    74 74
     //        leftSelectionDataModel = new SelectionTreeModel();
    
    75
    -//        leftSelectionDataModel.setLoadLongline(true);
    
    76
    -//        leftSelectionDataModel.setLoadSeine(true);
    
    77
    -//        leftSelectionDataModel.setLoadReferential(false);
    
    75
    +//        leftSelectionDataModel.setShowLonglineTrip(true);
    
    76
    +//        leftSelectionDataModel.setShowSeineTrip(true);
    
    77
    +//        leftSelectionDataModel.setShowReferential(false);
    
    78 78
     //        leftSelectionDataModel.setShowEmptyTrips(false);
    
    79 79
     //
    
    80 80
     //        rightSelectionDataModel = new SelectionTreeModel();
    
    81
    -//        rightSelectionDataModel.setLoadLongline(true);
    
    82
    -//        rightSelectionDataModel.setLoadSeine(true);
    
    83
    -//        rightSelectionDataModel.setLoadReferential(false);
    
    81
    +//        rightSelectionDataModel.setShowLonglineTrip(true);
    
    82
    +//        rightSelectionDataModel.setShowSeineTrip(true);
    
    83
    +//        rightSelectionDataModel.setShowReferential(false);
    
    84 84
     //        rightSelectionDataModel.setShowEmptyTrips(false);
    
    85 85
             tasks = new DefaultListModel<>();
    
    86 86
     
    

  • client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
    ... ... @@ -33,6 +33,7 @@
    33 33
         fr.ird.observe.client.constants.ValidationModelMode
    
    34 34
     
    
    35 35
         org.nuiton.validator.NuitonValidatorScope
    
    36
    +    org.nuiton.i18n.I18n
    
    36 37
     
    
    37 38
         java.io.File
    
    38 39
     
    

  • client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
    ... ... @@ -24,7 +24,7 @@
    24 24
       layout:{new BorderLayout()};
    
    25 25
     }
    
    26 26
     #referentialSynchronizeConfigPanel {
    
    27
    -  border:{new TitledBorder(t("observe.actions.synchro.referential.config.mode"))};
    
    27
    +  border:{new TitledBorder(I18n.t("observe.actions.synchro.referential.config.mode"))};
    
    28 28
     }
    
    29 29
     
    
    30 30
     #synchronizeMode {
    

  • client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
    ... ... @@ -415,7 +415,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
    415 415
             Action resetAction = new AbstractAction() {
    
    416 416
                 @Override
    
    417 417
                 public void actionPerformed(ActionEvent e) {
    
    418
    -                beanComboBox.doActionPerformed__on__resetButton(null);
    
    418
    +                beanComboBox.getResetButton().doClick();
    
    419 419
                     SwingUtilities.invokeLater(beanComboBox::grabFocus);
    
    420 420
                 }
    
    421 421
             };
    
    ... ... @@ -768,7 +768,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
    768 768
             list.init(decorator, new ArrayList<>(), new ArrayList<>());
    
    769 769
     
    
    770 770
             JList<R> selectedList = list.getSelectedList();
    
    771
    -        ListCellRenderer<? super R> renderer = selectedList.getCellRenderer();
    
    771
    +        ListCellRenderer renderer = selectedList.getCellRenderer();
    
    772 772
     
    
    773 773
             selectedList.setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
    
    774 774
             list.getUniverseList().setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
    
    ... ... @@ -795,7 +795,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
    795 795
             list.init(decorator, new ArrayList<>(), new ArrayList<>());
    
    796 796
     
    
    797 797
             JList<R> selectedList = list.getSelectedList();
    
    798
    -        ListCellRenderer<? super R> renderer = selectedList.getCellRenderer();
    
    798
    +        ListCellRenderer renderer = selectedList.getCellRenderer();
    
    799 799
     
    
    800 800
             selectedList.setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
    
    801 801
             list.getUniverseList().setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
    
    ... ... @@ -822,7 +822,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
    822 822
             list.init(decorator, Collections.emptyList());
    
    823 823
     
    
    824 824
             JList<R> list1 = list.getList();
    
    825
    -        ListCellRenderer<? super R> renderer = list1.getCellRenderer();
    
    825
    +        ListCellRenderer renderer = list1.getCellRenderer();
    
    826 826
             list1.setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
    
    827 827
     
    
    828 828
         }
    
    ... ... @@ -847,7 +847,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
    847 847
             list.init(decorator, Collections.emptyList());
    
    848 848
     
    
    849 849
             JList<R> list1 = list.getList();
    
    850
    -        ListCellRenderer<? super R> renderer = list1.getCellRenderer();
    
    850
    +        ListCellRenderer renderer = list1.getCellRenderer();
    
    851 851
             list1.setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
    
    852 852
     
    
    853 853
         }
    

  • client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
    ... ... @@ -30,6 +30,8 @@
    30 30
         fr.ird.observe.client.ui.storage.tabs.SecurityModel
    
    31 31
         fr.ird.observe.client.ui.storage.StorageStep
    
    32 32
         fr.ird.observe.client.ui.storage.StorageUIModel
    
    33
    +
    
    34
    +    org.nuiton.i18n.I18n
    
    33 35
       </import>
    
    34 36
     
    
    35 37
       <StorageStep id='step' initializer='StorageStep.ROLES'/>
    
    ... ... @@ -44,7 +46,7 @@
    44 46
       <script><![CDATA[
    
    45 47
     
    
    46 48
     public String updateAdministrateur(String role) {
    
    47
    -    return t("observe.storage.security.administrateur", role);
    
    49
    +    return I18n.t("observe.storage.security.administrateur", role);
    
    48 50
     }
    
    49 51
     ]]>
    
    50 52
       </script>
    

  • client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
    ... ... @@ -25,7 +25,7 @@
    25 25
     }
    
    26 26
     
    
    27 27
     #administrateurPanel {
    
    28
    - border:{new TitledBorder(t("observe.storage.security.administrateur"))};
    
    28
    + border:{new TitledBorder(I18n.t("observe.storage.security.administrateur"))};
    
    29 29
      layout:{new BorderLayout()};
    
    30 30
     }
    
    31 31
     
    
    ... ... @@ -43,13 +43,13 @@
    43 43
     }
    
    44 44
     
    
    45 45
     #techniciens {
    
    46
    -  border:{new TitledBorder(t("observe.storage.security.technicien"))};
    
    46
    +  border:{new TitledBorder(I18n.t("observe.storage.security.technicien"))};
    
    47 47
     }
    
    48 48
     
    
    49 49
     #readers {
    
    50
    -  border:{new TitledBorder(t("observe.storage.security.reader"))};
    
    50
    +  border:{new TitledBorder(I18n.t("observe.storage.security.reader"))};
    
    51 51
     }
    
    52 52
     
    
    53 53
     #referentiels {
    
    54
    -  border:{new TitledBorder(t("observe.storage.security.referentiel"))};
    
    54
    +  border:{new TitledBorder(I18n.t("observe.storage.security.referentiel"))};
    
    55 55
     }

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jaxx deleted
    1
    -<!--
    
    2
    -  #%L
    
    3
    -  ObServe :: Client
    
    4
    -  %%
    
    5
    -  Copyright (C) 2008 - 2017 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
    -  This program is distributed in the hope that it will be useful,
    
    12
    -  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    13
    -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    14
    -  GNU General Public License for more details.
    
    15
    -  You should have received a copy of the GNU General Public
    
    16
    -  License along with this program.  If not, see
    
    17
    -  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    18
    -  #L%
    
    19
    -  -->
    
    20
    -<JPanel layout='{new FlowLayout(FlowLayout.LEFT, 2, 2)}'>
    
    21
    -
    
    22
    -  <import>
    
    23
    -    java.awt.FlowLayout
    
    24
    -  </import>
    
    25
    -
    
    26
    -  <JToggleButton id='showSeine' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    27
    -  <JToggleButton id='showLongline' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    28
    -  <JToggleButton id='showReferential' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    29
    -  <JToggleButton id='showEmptyProgram' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    30
    -
    
    31
    -  <NavigationTree id='tree' javaBean='new NavigationTree()'/>
    
    32
    -
    
    33
    -  <JToolBar id='toolbar'>
    
    34
    -    <JButton id='colapseAll' onActionPerformed='handler.collapseAll()'/>
    
    35
    -    <JButton id='expandAll' onActionPerformed='handler.expandAll()'/>
    
    36
    -  </JToolBar>
    
    37
    -
    
    38
    -</JPanel>

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeModel.java
    ... ... @@ -10,18 +10,20 @@ package fr.ird.observe.client.ui.tree.navigation;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import fr.ird.observe.client.configuration.ClientConfig;
    
    26
    +import fr.ird.observe.client.configuration.NavigationTreeConfigBean;
    
    25 27
     import fr.ird.observe.client.db.ObserveSwingDataSource;
    
    26 28
     import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    27 29
     import fr.ird.observe.client.ui.tree.navigation.nodes.RootNavigationTreeNode;
    
    ... ... @@ -33,19 +35,20 @@ import fr.ird.observe.client.ui.tree.navigation.nodes.referential.ReferentialsSe
    33 35
     import fr.ird.observe.client.ui.tree.navigation.nodes.seine.ProgramSeineNavigationTreeNode;
    
    34 36
     import fr.ird.observe.dto.data.longline.TripLonglineHelper;
    
    35 37
     import fr.ird.observe.dto.data.longline.TripLonglineReference;
    
    36
    -import fr.ird.observe.dto.referential.ProgramHelper;
    
    37
    -import fr.ird.observe.dto.referential.ProgramReference;
    
    38 38
     import fr.ird.observe.dto.data.seine.TripSeineHelper;
    
    39 39
     import fr.ird.observe.dto.data.seine.TripSeineReference;
    
    40
    +import fr.ird.observe.dto.referential.ProgramHelper;
    
    41
    +import fr.ird.observe.dto.referential.ProgramReference;
    
    40 42
     import fr.ird.observe.services.service.data.NavigationRequest;
    
    41 43
     import fr.ird.observe.services.service.data.NavigationResult;
    
    42 44
     import fr.ird.observe.services.service.data.NavigationService;
    
    45
    +
    
    46
    +import javax.swing.tree.DefaultTreeModel;
    
    43 47
     import java.util.ArrayList;
    
    44 48
     import java.util.Collection;
    
    45 49
     import java.util.Collections;
    
    46 50
     import java.util.List;
    
    47 51
     import java.util.Map;
    
    48
    -import javax.swing.tree.DefaultTreeModel;
    
    49 52
     
    
    50 53
     /**
    
    51 54
      * Created on 14/11/16.
    
    ... ... @@ -55,44 +58,50 @@ import javax.swing.tree.DefaultTreeModel;
    55 58
      */
    
    56 59
     public class NavigationTreeModel extends DefaultTreeModel {
    
    57 60
     
    
    58
    -    private boolean loadSeine = true;
    
    59
    -    private boolean loadLongline = true;
    
    60
    -    private boolean loadReferential = true;
    
    61
    -    private boolean loadEmptyProgram = true;
    
    61
    +    private final NavigationTreeConfigBean config;
    
    62 62
     
    
    63
    -    public NavigationTreeModel() {
    
    63
    +    NavigationTreeModel() {
    
    64 64
             super(new RootNavigationTreeNode());
    
    65
    +        config = new NavigationTreeConfigBean();
    
    65 66
         }
    
    66 67
     
    
    67
    -    public NavigationTreeNodeSupport<?> findNode(NavigationTreeNodeSupport<?> node, Object... ids) {
    
    68
    -        NavigationTreeNodeSupport<?> result = null;
    
    69
    -        for (Object id : ids) {
    
    68
    +    public NavigationTreeConfigBean getConfig() {
    
    69
    +        return config;
    
    70
    +    }
    
    70 71
     
    
    71
    -            if (id instanceof String) {
    
    72
    -                result = node.findChildById((String) id);
    
    73
    -            } else if (id instanceof Class) {
    
    74
    -                result = node.findChildByType((Class) id);
    
    72
    +    @Override
    
    73
    +    public RootNavigationTreeNode getRoot() {
    
    74
    +        return (RootNavigationTreeNode) super.getRoot();
    
    75
    +    }
    
    75 76
     
    
    76
    -            }
    
    77
    -            if (result == null) {
    
    77
    +    public <N extends NavigationTreeNodeSupport> void reload(N node) {
    
    78
    +        node.reload();
    
    79
    +        super.reload(node);
    
    80
    +    }
    
    78 81
     
    
    79
    -                // un des noeud n'a pas ete trouve, on sortReferential
    
    80
    -                break;
    
    82
    +    public <N extends NavigationTreeNodeSupport> void open(N node) {
    
    83
    +        if (node instanceof WithChildsToReload) {
    
    84
    +            boolean updated = node.populateChilds();
    
    85
    +            if (updated) {
    
    86
    +                reload(node);
    
    81 87
                 }
    
    82
    -            node = result;
    
    83 88
             }
    
    84
    -        return result;
    
    85 89
         }
    
    86 90
     
    
    87
    -    public NavigationTreeNodeSupport<?> findNodeByType(NavigationTreeNodeSupport<?> node, Class<?> nodeType) {
    
    88
    -        return node.findChildByType(nodeType);
    
    91
    +    public void save(ClientConfig config) {
    
    92
    +        config.load(this.config);
    
    93
    +        config.saveForUser();
    
    94
    +    }
    
    95
    +
    
    96
    +    public void load(ClientConfig config) {
    
    97
    +        this.config.load(config);
    
    89 98
         }
    
    90 99
     
    
    91 100
         public void populate() {
    
    92 101
     
    
    93 102
             NavigationService navigationService = ObserveSwingDataSource.MAIN.getNavigationService();
    
    94 103
     
    
    95
    -        NavigationRequest navigationRequest = toNavigationRequest();
    
    104
    +        NavigationRequest navigationRequest = config.toRequest();
    
    96 105
             NavigationResult navigationResult = navigationService.getNavigation(navigationRequest);
    
    97 106
     
    
    98 107
             List<ProgramReference> programs = new ArrayList<>(navigationResult.getPrograms());
    
    ... ... @@ -119,75 +128,38 @@ public class NavigationTreeModel extends DefaultTreeModel {
    119 128
                     ProgramSeineNavigationTreeNode programNode = new ProgramSeineNavigationTreeNode(program, references);
    
    120 129
                     root.add(programNode);
    
    121 130
                 }
    
    122
    -
    
    123 131
             }
    
    124 132
     
    
    125
    -        if (isLoadReferential()) {
    
    133
    +        if (config.isShowReferential()) {
    
    126 134
                 root.add(new ReferentialsCommonNavigationTreeNode());
    
    127 135
                 root.add(new ReferentialsLonglineNavigationTreeNode());
    
    128 136
                 root.add(new ReferentialsSeineNavigationTreeNode());
    
    129 137
             }
    
    130
    -
    
    131 138
             setRoot(root);
    
    132 139
         }
    
    133 140
     
    
    134
    -    private NavigationRequest toNavigationRequest() {
    
    135
    -        NavigationRequest navigationRequest = new NavigationRequest();
    
    136
    -        navigationRequest.setLoadLongline(isLoadLongline());
    
    137
    -        navigationRequest.setLoadSeine(isLoadSeine());
    
    138
    -        navigationRequest.setLoadEmptyProgram(isLoadEmptyProgram());
    
    139
    -        return navigationRequest;
    
    140
    -    }
    
    141
    -
    
    142
    -    @Override
    
    143
    -    public RootNavigationTreeNode getRoot() {
    
    144
    -        return (RootNavigationTreeNode) super.getRoot();
    
    145
    -    }
    
    146
    -
    
    147
    -    public boolean isLoadSeine() {
    
    148
    -        return loadSeine;
    
    149
    -    }
    
    150
    -
    
    151
    -    public void setLoadSeine(boolean loadSeine) {
    
    152
    -        this.loadSeine = loadSeine;
    
    153
    -    }
    
    154
    -
    
    155
    -    public boolean isLoadLongline() {
    
    156
    -        return loadLongline;
    
    157
    -    }
    
    158
    -
    
    159
    -    public void setLoadLongline(boolean loadLongline) {
    
    160
    -        this.loadLongline = loadLongline;
    
    161
    -    }
    
    162
    -
    
    163
    -    public boolean isLoadReferential() {
    
    164
    -        return loadReferential;
    
    165
    -    }
    
    166
    -
    
    167
    -    public void setLoadReferential(boolean loadReferential) {
    
    168
    -        this.loadReferential = loadReferential;
    
    169
    -    }
    
    170
    -
    
    171
    -    public boolean isLoadEmptyProgram() {
    
    172
    -        return loadEmptyProgram;
    
    173
    -    }
    
    141
    +    NavigationTreeNodeSupport<?> findNode(NavigationTreeNodeSupport<?> node, Object... ids) {
    
    142
    +        NavigationTreeNodeSupport<?> result = null;
    
    143
    +        for (Object id : ids) {
    
    174 144
     
    
    175
    -    public void setLoadEmptyProgram(boolean loadEmptyProgram) {
    
    176
    -        this.loadEmptyProgram = loadEmptyProgram;
    
    177
    -    }
    
    145
    +            if (id instanceof String) {
    
    146
    +                result = node.findChildById((String) id);
    
    147
    +            } else if (id instanceof Class) {
    
    148
    +                result = node.findChildByType((Class) id);
    
    178 149
     
    
    179
    -    public <N extends NavigationTreeNodeSupport> void reload(N node) {
    
    180
    -        node.reload();
    
    181
    -        super.reload(node);
    
    182
    -    }
    
    150
    +            }
    
    151
    +            if (result == null) {
    
    183 152
     
    
    184
    -    public <N extends NavigationTreeNodeSupport> void open(N node) {
    
    185
    -        if (node instanceof WithChildsToReload) {
    
    186
    -            boolean updated = node.populateChilds();
    
    187
    -            if (updated) {
    
    188
    -                reload(node);
    
    153
    +                // un des noeud n'a pas ete trouve, on sortReferential
    
    154
    +                break;
    
    189 155
                 }
    
    156
    +            node = result;
    
    190 157
             }
    
    158
    +        return result;
    
    159
    +    }
    
    160
    +
    
    161
    +    NavigationTreeNodeSupport<?> findNodeByType(NavigationTreeNodeSupport<?> node, Class<?> nodeType) {
    
    162
    +        return node.findChildByType(nodeType);
    
    191 163
         }
    
    192 164
     
    
    193 165
     }

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
    1
    +<JScrollPane id='navigationScrollPane' columnHeaderView='{toolbar}' viewportView="{tree}">
    
    2
    +
    
    3
    +  <import>
    
    4
    +    fr.ird.observe.client.configuration.NavigationTreeConfigBean
    
    5
    +    static org.nuiton.i18n.I18n.t
    
    6
    +  </import>
    
    7
    +  <NavigationTree id='tree' />
    
    8
    +  <NavigationTreeModel id='treeModel' javaBean='{tree.getTreeModel()}'/>
    
    9
    +  <NavigationTreeConfigBean id='navigationConfig' javaBean='treeModel.getConfig()'/>
    
    10
    +
    
    11
    +  <JPopupMenu id='configurePopup'>
    
    12
    +    <JCheckBoxMenuItem id='showSeineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    13
    +    <JCheckBoxMenuItem id='showLonglineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    14
    +    <JCheckBoxMenuItem id='showReferential' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    15
    +    <JCheckBoxMenuItem id='showEmptyProgram' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    16
    +  </JPopupMenu>
    
    17
    +
    
    18
    +  <JToolBar id='toolbar'>
    
    19
    +    <JButton id='colapseAll' onActionPerformed='handler.collapseAll()'/>
    
    20
    +    <JButton id='expandAll' onActionPerformed='handler.expandAll()'/>
    
    21
    +    <JToggleButton id='configure' onActionPerformed='handler.configure()'/>
    
    22
    +  </JToolBar>
    
    23
    +
    
    24
    +</JScrollPane>

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jcssclient/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
    ... ... @@ -8,36 +8,35 @@
    8 8
      * it under the terms of the GNU General Public License as
    
    9 9
      * published by the Free Software Foundation, either version 3 of the
    
    10 10
      * License, or (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    16
    + *
    
    17 17
      * You should have received a copy of the GNU General Public
    
    18 18
      * License along with this program.  If not, see
    
    19 19
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20 20
      * #L%
    
    21 21
      */
    
    22 22
     
    
    23
    -#showSeine {
    
    24
    -  selected: {tree.getTreeModel().isLoadSeine()};
    
    23
    +#showSeineTrip {
    
    24
    +  selected: {navigationConfig.isShowSeineTrip()};
    
    25 25
       text:"observe.constant.ObserveModelType.PS";
    
    26 26
       toolTipText:"observe.constant.ObserveModelType.PS.description";
    
    27 27
     }
    
    28
    -#showLongline {
    
    29
    -  selected: {tree.getTreeModel().isLoadLongline()};
    
    28
    +#showLonglineTrip {
    
    29
    +  selected: {navigationConfig.isShowLonglineTrip()};
    
    30 30
       text:"observe.constant.ObserveModelType.LL";
    
    31 31
       toolTipText:"observe.constant.ObserveModelType.LL.description";
    
    32 32
     }
    
    33 33
     #showReferential {
    
    34
    -  selected: {tree.getTreeModel().isLoadReferential()};
    
    34
    +  selected: {navigationConfig.isShowReferential()};
    
    35 35
       text:"observe.constant.ObserveModelType.REF";
    
    36 36
       toolTipText:"observe.constant.ObserveModelType.REF.description";
    
    37 37
     }
    
    38
    -
    
    39 38
     #showEmptyProgram {
    
    40
    -  selected: {tree.getTreeModel().isLoadEmptyProgram()};
    
    39
    +  selected: {navigationConfig.isShowEmptyProgram()};
    
    41 40
       text:"observe.constant.ObserveModelType.EMPTY";
    
    42 41
       toolTipText:"observe.constant.ObserveModelType.EMPTY.description";
    
    43 42
     }
    
    ... ... @@ -61,3 +60,8 @@ JButton {
    61 60
       actionIcon:expand;
    
    62 61
       toolTipText:"observe.tree.action.expandAll.tip";
    
    63 62
     }
    
    63
    +
    
    64
    +#configure {
    
    65
    +  actionIcon:generate;
    
    66
    +  toolTipText:"observe.tree.action.configure.tip";
    
    67
    +}

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeaderHandler.javaclient/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
    1 1
     package fr.ird.observe.client.ui.tree.navigation;
    
    2 2
     
    
    3
    -/*
    
    4
    - * #%L
    
    5
    - * ObServe :: Client
    
    6
    - * %%
    
    7
    - * Copyright (C) 2008 - 2017 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 General Public License as
    
    11
    - * published by the Free Software Foundation, either version 3 of the
    
    12
    - * License, or (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 General Public
    
    20
    - * License along with this program.  If not, see
    
    21
    - * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    - * #L%
    
    23
    - */
    
    24
    -
    
    25 3
     import fr.ird.observe.client.ObserveSwingApplicationContext;
    
    4
    +import fr.ird.observe.client.configuration.ClientConfig;
    
    5
    +import fr.ird.observe.client.configuration.NavigationTreeConfig;
    
    26 6
     import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    27
    -import fr.ird.observe.client.ui.util.UIHelper;
    
    28 7
     import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    29
    -import fr.ird.observe.dto.referential.ProgramDto;
    
    30
    -import fr.ird.observe.dto.data.seine.TripSeineDto;
    
    31
    -import java.awt.Color;
    
    32
    -import java.awt.event.ActionEvent;
    
    33
    -import javax.swing.AbstractAction;
    
    34
    -import javax.swing.ActionMap;
    
    35
    -import javax.swing.InputMap;
    
    36
    -import javax.swing.JComponent;
    
    8
    +import fr.ird.observe.client.ui.util.UIHelper;
    
    37 9
     import org.apache.commons.logging.Log;
    
    38 10
     import org.apache.commons.logging.LogFactory;
    
    39 11
     import org.jdesktop.swingx.decorator.ColorHighlighter;
    
    ... ... @@ -41,17 +13,29 @@ import org.jdesktop.swingx.search.Searchable;
    41 13
     import org.jdesktop.swingx.search.TreeSearchable;
    
    42 14
     import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    43 15
     
    
    16
    +import javax.swing.AbstractAction;
    
    17
    +import javax.swing.ActionMap;
    
    18
    +import javax.swing.InputMap;
    
    19
    +import javax.swing.JComponent;
    
    20
    +import javax.swing.JPopupMenu;
    
    21
    +import javax.swing.SwingUtilities;
    
    22
    +import java.awt.Color;
    
    23
    +import java.awt.Dimension;
    
    24
    +import java.awt.event.ActionEvent;
    
    25
    +
    
    44 26
     /**
    
    45
    - * @author Samuel Maisonneuve- maisonneuve@codelutin.com
    
    27
    + * Created by tchemit on 01/04/2018.
    
    28
    + *
    
    29
    + * @author Tony Chemit - dev@tchemit.fr
    
    46 30
      */
    
    47
    -public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHeader> {
    
    31
    +public class NavigationUIHandler implements UIHandler<NavigationUI> {
    
    48 32
     
    
    49 33
         /** Logger */
    
    50
    -    private static final Log log = LogFactory.getLog(NavigationTreeHeaderHandler.class);
    
    34
    +    private static final Log log = LogFactory.getLog(NavigationUIHandler.class);
    
    51 35
     
    
    52
    -    private NavigationTreeHeader ui;
    
    36
    +    private NavigationUI ui;
    
    53 37
     
    
    54
    -    public NavigationTreeHeader getUi() {
    
    38
    +    public NavigationUI getUi() {
    
    55 39
             return ui;
    
    56 40
         }
    
    57 41
     
    
    ... ... @@ -60,15 +44,15 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
    60 44
         }
    
    61 45
     
    
    62 46
         @Override
    
    63
    -    public void beforeInit(NavigationTreeHeader ui) {
    
    47
    +    public void beforeInit(NavigationUI ui) {
    
    64 48
             this.ui = ui;
    
    65 49
         }
    
    66 50
     
    
    67 51
         @Override
    
    68
    -    public void afterInit(NavigationTreeHeader ui) {
    
    52
    +    public void afterInit(NavigationUI ui) {
    
    69 53
     
    
    70
    -        ui.getShowSeine().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
    
    71
    -        ui.getShowLongline().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
    
    54
    +        ui.getShowSeineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
    
    55
    +        ui.getShowLonglineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
    
    72 56
             ui.getShowReferential().setIcon(UIHelper.getUIManagerIcon("navigation.referentiel-16"));
    
    73 57
             ui.getShowEmptyProgram().setIcon(UIHelper.getUIManagerIcon("navigation.data.seine.TripSeine-16"));
    
    74 58
     
    
    ... ... @@ -77,10 +61,16 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
    77 61
             tree.setSearchable(searchable);
    
    78 62
             searchable.setMatchHighlighter(new ColorHighlighter(Color.YELLOW, Color.BLACK));
    
    79 63
     
    
    80
    -        ObserveKeyStrokes.addKeyStroke(ui.getShowSeine(), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
    
    81
    -        ObserveKeyStrokes.addKeyStroke(ui.getShowLongline(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
    
    64
    +        ObserveKeyStrokes.addKeyStroke(ui.getShowSeineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
    
    65
    +        ObserveKeyStrokes.addKeyStroke(ui.getShowLonglineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
    
    82 66
             ObserveKeyStrokes.addKeyStroke(ui.getShowReferential(), ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL);
    
    83 67
             ObserveKeyStrokes.addKeyStroke(ui.getShowEmptyProgram(), ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM);
    
    68
    +        ObserveKeyStrokes.addKeyStroke(ui.getConfigure(), ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE);
    
    69
    +        //FIXME (no text, so no text after...)
    
    70
    +        ui.getConfigure().setText(null);
    
    71
    +        ClientConfig config = ObserveSwingApplicationContext.get().getConfig();
    
    72
    +        NavigationTreeModel treeModel = (NavigationTreeModel) tree.getModel();
    
    73
    +        treeModel.load(config);
    
    84 74
     
    
    85 75
             InputMap inputMap = ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    
    86 76
             ActionMap actionMap = ui.getActionMap();
    
    ... ... @@ -88,32 +78,66 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
    88 78
             actionMap.put("showSeine", new AbstractAction() {
    
    89 79
                 @Override
    
    90 80
                 public void actionPerformed(ActionEvent e) {
    
    91
    -                ui.getShowSeine().doClick();
    
    81
    +                if (ui.getConfigurePopup().isVisible()) {
    
    82
    +                    ui.getShowSeineTrip().doClick();
    
    83
    +                }
    
    84
    +                ui.getConfigurePopup().setVisible(false);
    
    92 85
                 }
    
    93 86
             });
    
    94 87
             inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE, "showLongline");
    
    95 88
             actionMap.put("showLongline", new AbstractAction() {
    
    96 89
                 @Override
    
    97 90
                 public void actionPerformed(ActionEvent e) {
    
    98
    -                ui.getShowLongline().doClick();
    
    91
    +                if (ui.getConfigurePopup().isVisible()) {
    
    92
    +                    ui.getShowLonglineTrip().doClick();
    
    93
    +                }
    
    94
    +                ui.getConfigurePopup().setVisible(false);
    
    99 95
                 }
    
    100 96
             });
    
    101 97
             inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL, "showReferential");
    
    102 98
             actionMap.put("showReferential", new AbstractAction() {
    
    103 99
                 @Override
    
    104 100
                 public void actionPerformed(ActionEvent e) {
    
    105
    -                ui.getShowReferential().doClick();
    
    101
    +                if (ui.getConfigurePopup().isVisible()) {
    
    102
    +                    ui.getShowReferential().doClick();
    
    103
    +                }
    
    104
    +                ui.getConfigurePopup().setVisible(false);
    
    106 105
                 }
    
    107 106
             });
    
    108 107
             inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM, "showEmptyProgram");
    
    109 108
             actionMap.put("showEmptyProgram", new AbstractAction() {
    
    110 109
                 @Override
    
    111 110
                 public void actionPerformed(ActionEvent e) {
    
    112
    -                ui.getShowEmptyProgram().doClick();
    
    111
    +                if (ui.getConfigurePopup().isVisible()) {
    
    112
    +                    ui.getShowEmptyProgram().doClick();
    
    113
    +                }
    
    114
    +                ui.getConfigurePopup().setVisible(false);
    
    115
    +            }
    
    116
    +        });
    
    117
    +        inputMap.put(ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE, "configure");
    
    118
    +        actionMap.put("configure", new AbstractAction() {
    
    119
    +            @Override
    
    120
    +            public void actionPerformed(ActionEvent e) {
    
    121
    +                ui.getConfigure().doClick();
    
    113 122
                 }
    
    114 123
             });
    
    115 124
         }
    
    116 125
     
    
    126
    +    void configure() {
    
    127
    +        SwingUtilities.invokeLater(() -> {
    
    128
    +            JComponent c = ui.getConfigure();
    
    129
    +            JPopupMenu p = ui.getConfigurePopup();
    
    130
    +            if (p.isVisible()) {
    
    131
    +                p.setVisible(false);
    
    132
    +                return;
    
    133
    +            }
    
    134
    +            int width = ui.getParent().getWidth() - 5;
    
    135
    +            int height = p.getPreferredSize().height;
    
    136
    +            p.setPreferredSize(new Dimension(width, height));
    
    137
    +            p.show(c, (c.getWidth() == 0 ? 24 : c.getWidth()) - width + 2, c.getHeight());
    
    138
    +        });
    
    139
    +    }
    
    140
    +
    
    117 141
         public void search(String term) {
    
    118 142
     
    
    119 143
             Searchable searchable = getTree().getSearchable();
    
    ... ... @@ -121,7 +145,7 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
    121 145
     
    
    122 146
         }
    
    123 147
     
    
    124
    -    public void tryToUpdateNavigationTree() {
    
    148
    +    void tryToUpdateNavigationTree() {
    
    125 149
     
    
    126 150
             boolean canContinue = ObserveSwingApplicationContext.get().getContentUIManager().closeSelectedContentUI();
    
    127 151
     
    
    ... ... @@ -137,23 +161,24 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
    137 161
             }
    
    138 162
             tree.clearSelection();
    
    139 163
     
    
    140
    -        boolean showSeine = ui.getShowSeine().isSelected();
    
    141
    -        boolean showLongline = ui.getShowLongline().isSelected();
    
    164
    +        boolean showSeine = ui.getShowSeineTrip().isSelected();
    
    165
    +        boolean showLongline = ui.getShowLonglineTrip().isSelected();
    
    142 166
             boolean showReferential = ui.getShowReferential().isSelected();
    
    143 167
             boolean showEmptyProgram = ui.getShowEmptyProgram().isSelected();
    
    144 168
     
    
    145 169
             NavigationTreeModel treeModel = tree.getTreeModel();
    
    146
    -        treeModel.setLoadSeine(showSeine);
    
    147
    -        treeModel.setLoadLongline(showLongline);
    
    148
    -        treeModel.setLoadReferential(showReferential);
    
    149
    -        treeModel.setLoadEmptyProgram(showEmptyProgram);
    
    150
    -
    
    170
    +        NavigationTreeConfig navigationTreeConfig = treeModel.getConfig();
    
    171
    +        navigationTreeConfig.setShowSeineTrip(showSeine);
    
    172
    +        navigationTreeConfig.setShowLonglineTrip(showLongline);
    
    173
    +        navigationTreeConfig.setShowReferential(showReferential);
    
    174
    +        navigationTreeConfig.setShowEmptyProgram(showEmptyProgram);
    
    175
    +        treeModel.save(ObserveSwingApplicationContext.get().getConfig());
    
    151 176
             treeModel.populate();
    
    152
    -
    
    153 177
             //FIXME repositionner le nœud sélectionné
    
    154 178
             if (!treeModel.getRoot().isLeaf()) {
    
    155 179
                 tree.setSelectionRow(0);
    
    156 180
             }
    
    181
    +        ui.getConfigure().setSelected(false);
    
    157 182
         }
    
    158 183
     
    
    159 184
         public void collapseAll() {
    

  • client/src/main/resources/i18n/client_en_GB.properties
    ... ... @@ -1488,6 +1488,7 @@ observe.title.storage.info=Storage details
    1488 1488
     observe.title.unique.key=Unique keys used in a referentiel
    
    1489 1489
     observe.title.welcome.admin=ObServe
    
    1490 1490
     observe.tree.action.collapseAll.tip=Collapse all
    
    1491
    +observe.tree.action.configure.tip=Configure
    
    1491 1492
     observe.tree.action.expandAll.tip=Expand all
    
    1492 1493
     observe.tree.action.selectAll.tip=Select All
    
    1493 1494
     observe.tree.action.unselectAll.tip=Unselect All
    

  • client/src/main/resources/i18n/client_es_ES.properties
    ... ... @@ -1488,6 +1488,7 @@ observe.title.storage.info=Información sobre la fuente de datos
    1488 1488
     observe.title.unique.key=Ids de negocio del referencial %1$s
    
    1489 1489
     observe.title.welcome.admin=ObServe
    
    1490 1490
     observe.tree.action.collapseAll.tip=Cerrar los nudos
    
    1491
    +observe.tree.action.configure.tip=Configure \#TODO
    
    1491 1492
     observe.tree.action.expandAll.tip=Abrir los nudos
    
    1492 1493
     observe.tree.action.selectAll.tip=Seleccionar todo
    
    1493 1494
     observe.tree.action.unselectAll.tip=Deseleccionar todo
    

  • client/src/main/resources/i18n/client_fr_FR.properties
    ... ... @@ -1488,6 +1488,7 @@ observe.title.storage.info=Information sur la source de données
    1488 1488
     observe.title.unique.key=Clefs métier du référentiel %1$s
    
    1489 1489
     observe.title.welcome.admin=ObServe
    
    1490 1490
     observe.tree.action.collapseAll.tip=Tout grouper
    
    1491
    +observe.tree.action.configure.tip=Configurer
    
    1491 1492
     observe.tree.action.expandAll.tip=Tout déplier
    
    1492 1493
     observe.tree.action.selectAll.tip=Tout sélectionner
    
    1493 1494
     observe.tree.action.unselectAll.tip=Tout désélectionner
    

  • pom.xml
    ... ... @@ -35,7 +35,7 @@
    35 35
       <packaging>pom</packaging>
    
    36 36
     
    
    37 37
       <name>ObServe :: Pom</name>
    
    38
    -  <description>Projet ObServe</description>
    
    38
    +  <description>Project ObServe</description>
    
    39 39
       <url>https://ultreiaio.gitlab.io/ird-observe</url>
    
    40 40
       <inceptionYear>2008</inceptionYear>
    
    41 41
       <organization>
    
    ... ... @@ -142,10 +142,10 @@
    142 142
         <projectId>ird-observe</projectId>
    
    143 143
         <stageId>frirdobserve</stageId>
    
    144 144
     
    
    145
    -    <!-- dev version (for develop purpose -->
    
    145
    +    <!-- dev version -->
    
    146 146
         <devMode>true</devMode>
    
    147 147
     
    
    148
    -    <!--Modèle version-->
    
    148
    +    <!--persistence model version-->
    
    149 149
         <observe.model.version>7.0</observe.model.version>
    
    150 150
     
    
    151 151
         <!-- build timestamp configuration -->
    
    ... ... @@ -157,7 +157,7 @@
    157 157
         <!--<eugenePluginVersion>3.0-alpha-13</eugenePluginVersion>-->
    
    158 158
         <!--<processorPluginVersion>1.3</processorPluginVersion>-->
    
    159 159
     
    
    160
    -    <lib.version.java4all.jaxx>3.0-alpha-12</lib.version.java4all.jaxx>
    
    160
    +    <lib.version.java4all.jaxx>3.0-alpha-26</lib.version.java4all.jaxx>
    
    161 161
         <lib.version.nuiton.topia>3.3</lib.version.nuiton.topia>
    
    162 162
         <lib.version.nuiton.validation>3.1</lib.version.nuiton.validation>
    
    163 163
         <xworkVersion>2.3.34</xworkVersion>