Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
April 2018
- 1 participants
- 53 discussions
[Git][ultreiaio/ird-observe][develop] Amélioration de l'arbre de navigation
by Tony CHEMIT 01 Apr '18
by Tony CHEMIT 01 Apr '18
01 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
cdbaa4e7 by Tony CHEMIT at 2018-04-01T13:39:24Z
Amélioration de l'arbre de navigation
- - - - -
27 changed files:
- client-configuration/pom.xml
- client-configuration/src/main/config/Client.ini
- client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- + client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java
- + client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java
- client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
- client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
- client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
- client/pom.xml
- client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
- client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
- client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
- client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
- client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
- − client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jaxx
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeModel.java
- + client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jcss → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeaderHandler.java → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
- client/src/main/resources/i18n/client_en_GB.properties
- client/src/main/resources/i18n/client_es_ES.properties
- client/src/main/resources/i18n/client_fr_FR.properties
- pom.xml
Changes:
=====================================
client-configuration/pom.xml
=====================================
--- a/client-configuration/pom.xml
+++ b/client-configuration/pom.xml
@@ -104,6 +104,14 @@
<groupId>io.ultreia.java4all.jaxx</groupId>
<artifactId>jaxx-widgets-gis</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all.jaxx</groupId>
+ <artifactId>jaxx-widgets-temperature</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all</groupId>
+ <artifactId>java-bean</artifactId>
+ </dependency>
</dependencies>
=====================================
client-configuration/src/main/config/Client.ini
=====================================
--- a/client-configuration/src/main/config/Client.ini
+++ b/client-configuration/src/main/config/Client.ini
@@ -174,6 +174,11 @@ description = observe.config.h2.can.migrate.description
key = h2.canMigrate
type = Boolean
defaultValue = true
+[option h2CanEditReferential]
+description = observe.config.h2.can.editReferential.description
+key = h2.canEditReferential
+type = boolean
+defaultValue = false
[option h2ServerPort]
description = observe.config.h2.serverPort.description
@@ -501,6 +506,12 @@ key = ui.coordinate.format
type = org.nuiton.jaxx.widgets.gis.CoordinateFormat
defaultValue = "dmd"
+[option temperatureFormat]
+description = observe.config.temperature.format
+key = ui.temperature.format
+type = org.nuiton.jaxx.widgets.temperature.TemperatureFormat
+defaultValue = "C"
+
[option focusBorderColor]
description = observe.config.ui.focusBorderColor
key = ui.focusBorder.color
@@ -531,6 +542,30 @@ key = server.checkServerVersion
type = Boolean
defaultValue = true
+[option showSeineTrip]
+description = observe.config.ui.tree.showSeineTrip.description
+key = ui.tree.showSeineTrip
+type = Boolean
+defaultValue = true
+
+[option showLonglineTrip]
+description = observe.config.ui.tree.showLonglineTrip.description
+key = ui.tree.showLonglineTrip
+type = Boolean
+defaultValue = true
+
+[option showReferential]
+description = observe.config.ui.tree.showReferential.description
+key = ui.tree.showReferential
+type = Boolean
+defaultValue = true
+
+[option showEmptyProgram]
+description = observe.config.ui.tree.showEmptyProgram.description
+key = ui.tree.showEmptyProgram
+type = Boolean
+defaultValue = true
+
[action help]
description = observe.action.commandline.help
action = "fr.ird.observe.client.ObserveCLAction#help"
=====================================
client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
=====================================
--- a/client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
+++ b/client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -30,6 +30,16 @@ import fr.ird.observe.client.constants.DbMode;
import fr.ird.observe.dto.FloatingObjectPreset;
import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.config.ApplicationConfig;
+import org.nuiton.config.ArgumentsParserException;
+import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
+import org.nuiton.jaxx.widgets.temperature.TemperatureFormat;
+import org.nuiton.version.Version;
+import org.nuiton.version.Versions;
+
import java.beans.PropertyChangeListener;
import java.io.File;
import java.nio.charset.StandardCharsets;
@@ -44,15 +54,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.config.ApplicationConfig;
-import org.nuiton.config.ArgumentsParserException;
-import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
-import org.nuiton.version.Version;
-import org.nuiton.version.Versions;
-
import static org.nuiton.i18n.I18n.t;
@@ -62,52 +63,72 @@ import static org.nuiton.i18n.I18n.t;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-public class ClientConfig extends GeneratedClientConfig {
+public class ClientConfig extends GeneratedClientConfig implements NavigationTreeConfig {
+ public static final String DB_NAME = "obstuna";
+ public static final List<ClientConfigOption> MAP_LAYERS = ImmutableList.of(
+ ClientConfigOption.MAP_LAYER1,
+ ClientConfigOption.MAP_LAYER2,
+ ClientConfigOption.MAP_LAYER3,
+ ClientConfigOption.MAP_LAYER4,
+ ClientConfigOption.MAP_LAYER5,
+ ClientConfigOption.MAP_LAYER6,
+ ClientConfigOption.MAP_LAYER7,
+ ClientConfigOption.MAP_LAYER8,
+ ClientConfigOption.MAP_LAYER9,
+ ClientConfigOption.MAP_LAYER10);
/** le pattern du fichier de sauvegarde d'une base locale */
private static final String BACKUP_DB_PATTERN = "obstuna-local-%1$tF--%1$tk-%1$tM-%1$tS.sql.gz";
-
- public static final String DB_NAME = "obstuna";
-
private static final String APPLICATION_VERSION = "application.version";
-
private static final String VERSION = "version";
-
private static final String PROPERTY_LOCAL_STORAGE_EXIST = "localStorageExist";
-
private static final String PROPERTY_INITIAL_DUMP_EXIST = "initialDumpExist";
-
private static final String PROPERTY_MAIN_STORAGE_OPENED = "mainStorageOpened";
-
/** Logger */
private static final Log log = LogFactory.getLog(ClientConfig.class);
-
private static final String DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME = "observe-client.conf";
-
+ /**
+ * Liste des options qu'on ne peut pas sauvegarder (les mots de passes,
+ * les options d'admin pour les simples utilisateurs,...).
+ *
+ * @since 1.5
+ */
+ private final String[] unsavables = new String[]{
+// ClientConfigOption.OBSTUNA_PASSWORD.getKey(),
+ ClientConfigOption.H2_PASSWORD.getKey(),
+ ClientConfigOption.OBSTUNA_CAN_MIGRATE.getKey(),
+ };
+ //FIXME
+ private final ImmutableSet<String> longlinVesselTypeIds = ImmutableSet.copyOf(
+ Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1"));
+ private final ImmutableSet<String> seineVesselTypeIds = ImmutableSet.copyOf(
+ Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407"));
+ private final SimpleDateFormat dateFormat = new SimpleDateFormat();
/**
* un drapeau pour savoir s'il faut lancer l'interface graphique. Cette
* valeur peut être programmées lors des actions.
*/
private boolean displayMainUI = true;
-
/** drapeau pour savoir si une base locale existe */
private boolean localStorageExist;
-
/**
* drapeau pour savoir si le dump initial a ete chargée depuis la base
* centrale
*/
private boolean initialDumpExist;
-
/** drapeau pour savoir si une source de données est ouverte */
private boolean mainStorageOpened;
-
/**
* drapeau pour savoir si la source ouverte est locale (attention, lorsqu'il
* n'y a pas de storage d'ouvert, la valeur est null).
*/
private Boolean mainStorageOpenedLocal;
-
/**
* drapeau pour savoir si on peut utiliser des ui dans l'environnement.
* <p>
@@ -116,37 +137,12 @@ public class ClientConfig extends GeneratedClientConfig {
* trouvé.
*/
private boolean canUseUI = true;
-
/** La version de l'application */
private Version version;
-
/** Texte du copyright (calculé dynamiquement). */
private String copyrightText;
-
- /**
- * Liste des options qu'on ne peut pas sauvegarder (les mots de passes,
- * les options d'admin pour les simples utilisateurs,...).
- *
- * @since 1.5
- */
- private final String[] unsavables = new String[]{
-// ClientConfigOption.OBSTUNA_PASSWORD.getKey(),
- ClientConfigOption.H2_PASSWORD.getKey(),
- ClientConfigOption.OBSTUNA_CAN_MIGRATE.getKey(),
- };
-
- //FIXME
- private final ImmutableSet<String> longlinVesselTypeIds = ImmutableSet.copyOf(
- Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869",
- "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1"));
-
- private final ImmutableSet<String> seineVesselTypeIds = ImmutableSet.copyOf(
- Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407"));
+ private ImmutableList<ServerDataSourceConfiguration> serverDataSourceConfigurationList;
+ private ImmutableList<RemoteDataSourceConfiguration> remoteDataSourceConfigurationList;
public ClientConfig() {
this(DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME);
@@ -217,6 +213,11 @@ public class ClientConfig extends GeneratedClientConfig {
return CoordinateFormat.valueOf(get().getOption(ClientConfigOption.COORDINATE_FORMAT.getKey()));
}
+ @Override
+ public TemperatureFormat getTemperatureFormat() {
+ return get().getOption(TemperatureFormat.class, ClientConfigOption.TEMPERATURE_FORMAT.getKey());
+ }
+
public String getCopyrightText() {
if (copyrightText == null) {
Date date = new Date();
@@ -232,6 +233,10 @@ public class ClientConfig extends GeneratedClientConfig {
return version;
}
+ private void setVersion(Version version) {
+ this.version = version;
+ }
+
public boolean isShowTimeEditorSlider() {
return isShowDateTimeEditorSlider();
}
@@ -244,24 +249,24 @@ public class ClientConfig extends GeneratedClientConfig {
return displayMainUI;
}
- public boolean isCanUseUI() {
- return canUseUI;
- }
-
- public boolean isLocalStorageExist() {
- return localStorageExist;
+ public void setDisplayMainUI(boolean b) {
+ displayMainUI = b;
}
- public boolean isInitialDumpExist() {
- return initialDumpExist;
+ public boolean isCanUseUI() {
+ return canUseUI;
}
- public boolean isMainStorageOpened() {
- return mainStorageOpened;
+ public void setCanUseUI(boolean canUseUI) {
+ this.canUseUI = canUseUI;
+ if (!canUseUI) {
+ // on ne pourra pas lancer l'ui principale
+ setDisplayMainUI(false);
+ }
}
- public Boolean getMainStorageOpenedLocal() {
- return mainStorageOpenedLocal;
+ public boolean isLocalStorageExist() {
+ return localStorageExist;
}
public void setLocalStorageExist(boolean newValue) {
@@ -270,12 +275,20 @@ public class ClientConfig extends GeneratedClientConfig {
firePropertyChange(PROPERTY_LOCAL_STORAGE_EXIST, newValue);
}
+ public boolean isInitialDumpExist() {
+ return initialDumpExist;
+ }
+
public void setInitialDumpExist(boolean newValue) {
initialDumpExist = newValue;
// always force propagation
firePropertyChange(PROPERTY_INITIAL_DUMP_EXIST, newValue);
}
+ public boolean isMainStorageOpened() {
+ return mainStorageOpened;
+ }
+
public void setMainStorageOpened(boolean newValue) {
mainStorageOpened = newValue;
if (!newValue) {
@@ -286,36 +299,16 @@ public class ClientConfig extends GeneratedClientConfig {
firePropertyChange(PROPERTY_MAIN_STORAGE_OPENED, newValue);
}
+ public Boolean getMainStorageOpenedLocal() {
+ return mainStorageOpenedLocal;
+ }
+
public void setMainStorageOpenedLocal(Boolean newValue) {
mainStorageOpenedLocal = newValue;
// always force propagation
firePropertyChange(PROPERTY_MAIN_STORAGE_OPENED + "Local", newValue);
}
- public void setDisplayMainUI(boolean b) {
- displayMainUI = b;
- }
-
- public void setCanUseUI(boolean canUseUI) {
- this.canUseUI = canUseUI;
- if (!canUseUI) {
- // on ne pourra pas lancer l'ui principale
- setDisplayMainUI(false);
- }
- }
-
- public static final List<ClientConfigOption> MAP_LAYERS = ImmutableList.of(
- ClientConfigOption.MAP_LAYER1,
- ClientConfigOption.MAP_LAYER2,
- ClientConfigOption.MAP_LAYER3,
- ClientConfigOption.MAP_LAYER4,
- ClientConfigOption.MAP_LAYER5,
- ClientConfigOption.MAP_LAYER6,
- ClientConfigOption.MAP_LAYER7,
- ClientConfigOption.MAP_LAYER8,
- ClientConfigOption.MAP_LAYER9,
- ClientConfigOption.MAP_LAYER10);
-
public List<File> getMapLayerFiles() {
List<File> layers = new LinkedList<>();
@@ -399,10 +392,6 @@ public class ClientConfig extends GeneratedClientConfig {
}
}
- private void setVersion(Version version) {
- this.version = version;
- }
-
public Set<String> getSeineVesselTypeIds() {
return seineVesselTypeIds;
}
@@ -429,10 +418,17 @@ public class ClientConfig extends GeneratedClientConfig {
return option == null ? new RemoteDataSourceConfiguration[0] : new Gson().fromJson(option, RemoteDataSourceConfiguration[].class);
}
+ @Override
+ public void setRemoteDataSourceConfigurations(RemoteDataSourceConfiguration[] configurations) {
+ String option = new Gson().toJson(configurations);
+ get().setOption(ClientConfigOption.REMOTE_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
+ remoteDataSourceConfigurationList = null;
+ }
+
public void addRemoteDataSourceConfiguration(RemoteDataSourceConfiguration configuration) {
List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
remoteDataSourceConfigurations.add(configuration);
- setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
saveForUser();
}
@@ -440,27 +436,17 @@ public class ClientConfig extends GeneratedClientConfig {
List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
remoteDataSourceConfigurations.remove(configuration);
remoteDataSourceConfigurations.add(configuration);
- setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
saveForUser();
}
public void removeRemoteDataSourceConfiguration(RemoteDataSourceConfiguration configuration) {
List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
remoteDataSourceConfigurations.remove(configuration);
- setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
saveForUser();
}
- @Override
- public void setRemoteDataSourceConfigurations(RemoteDataSourceConfiguration[] configurations) {
- String option = new Gson().toJson(configurations);
- get().setOption(ClientConfigOption.REMOTE_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
- remoteDataSourceConfigurationList=null;
- }
-
- ImmutableList<ServerDataSourceConfiguration> serverDataSourceConfigurationList;
- ImmutableList<RemoteDataSourceConfiguration> remoteDataSourceConfigurationList;
-
public ImmutableList<RemoteDataSourceConfiguration> getRemoteDataSourceConfigurationList() {
if (remoteDataSourceConfigurationList == null) {
List<RemoteDataSourceConfiguration> configurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
@@ -485,10 +471,17 @@ public class ClientConfig extends GeneratedClientConfig {
return option == null ? new ServerDataSourceConfiguration[0] : new Gson().fromJson(option, ServerDataSourceConfiguration[].class);
}
+ @Override
+ public void setServerDataSourceConfigurations(ServerDataSourceConfiguration[] configurations) {
+ String option = new Gson().toJson(configurations);
+ get().setOption(ClientConfigOption.SERVER_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
+ serverDataSourceConfigurationList = null;
+ }
+
public void addServerDataSourceConfiguration(ServerDataSourceConfiguration configuration) {
List<ServerDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
remoteDataSourceConfigurations.add(configuration);
- setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
saveForUser();
}
@@ -496,27 +489,18 @@ public class ClientConfig extends GeneratedClientConfig {
List<ServerDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
remoteDataSourceConfigurations.remove(configuration);
remoteDataSourceConfigurations.add(configuration);
- setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
saveForUser();
}
public void removeServerDataSourceConfiguration(ServerDataSourceConfiguration configuration) {
List<ServerDataSourceConfiguration> serverDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
serverDataSourceConfigurations.remove(configuration);
- setServerDataSourceConfigurations(serverDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[serverDataSourceConfigurations.size()]));
+ setServerDataSourceConfigurations(serverDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
saveForUser();
}
@Override
- public void setServerDataSourceConfigurations(ServerDataSourceConfiguration[] configurations) {
- String option = new Gson().toJson(configurations);
- get().setOption(ClientConfigOption.SERVER_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
- serverDataSourceConfigurationList=null;
- }
-
- private final SimpleDateFormat dateFormat = new SimpleDateFormat();
-
- @Override
public Date getBuildDate() {
String dateStr = get().getOption(ClientConfigOption.BUILD_DATE.getKey());
try {
=====================================
client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java
=====================================
--- /dev/null
+++ b/client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java
@@ -0,0 +1,64 @@
+package fr.ird.observe.client.configuration;
+
+/*-
+ * #%L
+ * ObServe :: Client Configuration
+ * %%
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ird.observe.services.service.data.NavigationRequest;
+
+/**
+ * Created by tchemit on 01/04/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public interface NavigationTreeConfig {
+
+ boolean isShowSeineTrip();
+
+ void setShowSeineTrip(boolean showSeineTrip);
+
+ boolean isShowLonglineTrip();
+
+ void setShowLonglineTrip(boolean showLonglineTrip);
+
+ boolean isShowReferential();
+
+ void setShowReferential(boolean showReferential);
+
+ boolean isShowEmptyProgram();
+
+ void setShowEmptyProgram(boolean showEmptyProgram);
+
+ default NavigationRequest toRequest() {
+ NavigationRequest navigationRequest = new NavigationRequest();
+ navigationRequest.setLoadLongline(isShowLonglineTrip());
+ navigationRequest.setLoadSeine(isShowSeineTrip());
+ navigationRequest.setLoadEmptyProgram(isShowEmptyProgram());
+ return navigationRequest;
+ }
+
+ default void load(NavigationTreeConfig config) {
+ setShowEmptyProgram(config.isShowEmptyProgram());
+ setShowReferential(config.isShowReferential());
+ setShowLonglineTrip(config.isShowLonglineTrip());
+ setShowSeineTrip(config.isShowSeineTrip());
+ }
+}
=====================================
client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java
=====================================
--- /dev/null
+++ b/client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java
@@ -0,0 +1,87 @@
+package fr.ird.observe.client.configuration;
+
+/*-
+ * #%L
+ * ObServe :: Client Configuration
+ * %%
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import io.ultreia.java4all.bean.AbstractJavaBean;
+
+/**
+ * Created by tchemit on 01/04/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public class NavigationTreeConfigBean extends AbstractJavaBean implements NavigationTreeConfig {
+
+
+ private boolean showSeineTrip = true;
+ private boolean showLonglineTrip = true;
+ private boolean showReferential = true;
+ private boolean showEmptyProgram = true;
+
+ @Override
+ public boolean isShowSeineTrip() {
+ return showSeineTrip;
+ }
+
+ @Override
+ public void setShowSeineTrip(boolean showSeineTrip) {
+ boolean oldValue = isShowSeineTrip();
+ this.showSeineTrip = showSeineTrip;
+ firePropertyChange("showSeineTrip", oldValue, showSeineTrip);
+ }
+
+ @Override
+ public boolean isShowLonglineTrip() {
+ return showLonglineTrip;
+ }
+
+ @Override
+ public void setShowLonglineTrip(boolean showLonglineTrip) {
+ boolean oldValue = isShowLonglineTrip();
+ this.showLonglineTrip = showLonglineTrip;
+ firePropertyChange("showLonglineTrip", oldValue, showLonglineTrip);
+ }
+
+ @Override
+ public boolean isShowReferential() {
+ return showReferential;
+ }
+
+ @Override
+ public void setShowReferential(boolean showReferential) {
+ boolean oldValue = isShowReferential();
+ this.showReferential = showReferential;
+ firePropertyChange("showReferential", oldValue, showReferential);
+ }
+
+ @Override
+ public boolean isShowEmptyProgram() {
+ return showEmptyProgram;
+ }
+
+ @Override
+ public void setShowEmptyProgram(boolean showEmptyProgram) {
+ boolean oldValue = isShowEmptyProgram();
+ this.showEmptyProgram = showEmptyProgram;
+ firePropertyChange("showEmptyProgram", oldValue, showEmptyProgram);
+ }
+}
=====================================
client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
+++ b/client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
@@ -33,6 +33,7 @@ observe.config.defaultTmpDirectory.description=Default temporary directory used
observe.config.defaultValidationReportDirectory.description=Default validation report directory
observe.config.devMode=Dev mode
observe.config.floatingObjectPresets.description=Floating Objects references
+observe.config.h2.can.editReferential.description=Local database can edit referential
observe.config.h2.can.migrate.description=Flag to know if you can migrate h2 data sources
observe.config.h2.login.description=H2 Login
observe.config.h2.password.description=H2 Password
@@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Species for object school
observe.config.speciesList.seine.schoolEstimate=Species for school esitmates
observe.config.speciesList.seine.targetCatch=Species for target catches
observe.config.swingSessionFile.description=Swing session file.
+observe.config.temperature.format=Default temperature format
observe.config.ui.autoPopupNumberEditor=Flag sets to true when number editor show automaticly popup
observe.config.ui.changeSynchroSrc=Flag sets to true if you can change local source in admin tasks
observe.config.ui.focusBorderColor=Color of the focus container border
@@ -85,6 +87,10 @@ observe.config.ui.showMnemonic=Show mnemonic on actions
observe.config.ui.showNumberEditorButton=Flag sets to true to show button to invoke popup on number's editors
observe.config.ui.showTimeEditorSlider=Show timer slider
observe.config.ui.storeRemoteStorage=Flag sets to true to store in config a remote connexion (except passwords)
+observe.config.ui.tree.showEmptyProgram.description=Show programs with no trip inside
+observe.config.ui.tree.showLonglineTrip.description=Show Longline trips
+observe.config.ui.tree.showReferential.description=Show Referential
+observe.config.ui.tree.showSeineTrip.description=Show Seine Trips
observe.config.ui.treeOpenNodes=Opened data from last session
observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source
observe.config.validation.lengthWeightEnable=Force validation of species length max
=====================================
client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
+++ b/client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
@@ -33,6 +33,7 @@ observe.config.defaultTmpDirectory.description=Directorio temporal por defecto
observe.config.defaultValidationReportDirectory.description=Directorio por defecto de almacenamiento de los informes de validación
observe.config.devMode=Modo desarrollador
observe.config.floatingObjectPresets.description=Objets flottants de référence \#TODO
+observe.config.h2.can.editReferential.description=Local database can edit referential \#TODO
observe.config.h2.can.migrate.description=Autorizar la actualización de las bases locales (h2)
observe.config.h2.login.description=Login h2
observe.config.h2.password.description=Contraseña h2
@@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Especies para las estimaci
observe.config.speciesList.seine.schoolEstimate=Especies para las estimaciones
observe.config.speciesList.seine.targetCatch=Especies par las capturas objetivo
observe.config.swingSessionFile.description=Fichier de sauvegarde des états des UI. \#TODO
+observe.config.temperature.format=Default temperature format \#TODO
observe.config.ui.autoPopupNumberEditor=Para mostrar automáticamente el editor numérico durante la edición de un número
observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
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
observe.config.ui.showNumberEditorButton=Para mostrar el botón que permite usar el editor numérico a la izquierda de cada campo numérico
observe.config.ui.showTimeEditorSlider=Para mostrar la regla de edición de las horas
observe.config.ui.storeRemoteStorage=Para activar la copia de seguridad de la configuración de la fuente de datos remota
+observe.config.ui.tree.showEmptyProgram.description=Show programs with no trip inside \#TODO
+observe.config.ui.tree.showLonglineTrip.description=Show Longline trips \#TODO
+observe.config.ui.tree.showReferential.description=Show Referential \#TODO
+observe.config.ui.tree.showSeineTrip.description=Show Seine Trips \#TODO
observe.config.ui.treeOpenNodes=Nudos abiertos del arbol abiertos cuando se cerró la base por última vez
observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source \#TODO
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
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
+++ b/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é
observe.config.defaultValidationReportDirectory.description=Le répertoire par défaut où sont stockés les rapports de validation
observe.config.devMode=Mode développeur
observe.config.floatingObjectPresets.description=Objets flottants de référence
+observe.config.h2.can.editReferential.description=Pour pouvoir éditer le référentiel d'une base locale
observe.config.h2.can.migrate.description=Autoriser la mise à jour des bases locales (H2)
observe.config.h2.login.description=L'identifiant H2
observe.config.h2.password.description=Le mot de passe H2
@@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Espèces pour les estimati
observe.config.speciesList.seine.schoolEstimate=Espèces pour les estimations
observe.config.speciesList.seine.targetCatch=Espèces pour les captures cible
observe.config.swingSessionFile.description=Fichier de sauvegarde des états des UI.
+observe.config.temperature.format=Unité de température
observe.config.ui.autoPopupNumberEditor=Pour afficher automatiquement l'éditeur numérique lors de l'édition d'un nombre
observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
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
observe.config.ui.showNumberEditorButton=Pour afficher le bouton qui permet d'utiliser l'éditeur numérique à gauche de chaque champs numérique
observe.config.ui.showTimeEditorSlider=Pour afficher la réglette d'édition des heures
observe.config.ui.storeRemoteStorage=Pour activer la sauvegarde de la configuration de la source distante
+observe.config.ui.tree.showEmptyProgram.description=Voir les programmes sans marée
+observe.config.ui.tree.showLonglineTrip.description=Voir les marées Palangre
+observe.config.ui.tree.showReferential.description=Voir le référentiel
+observe.config.ui.tree.showSeineTrip.description=Voir les marées Senne
observe.config.ui.treeOpenNodes=Nœuds de l'arbre ouverts lors de la dernière fermeture de la base
observe.config.ui.treeSelectedNodes.description=Nœuds sélectionnés sur la dernière base ouverte
observe.config.validation.lengthWeightEnable=Forcer la validation des bormes min/max de taille d'espèce
=====================================
client/pom.xml
=====================================
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -382,10 +382,20 @@
<artifactId>class-mapping</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all</groupId>
+ <artifactId>java-lang</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
<!-- jaxx dependencies -->
<dependency>
<groupId>io.ultreia.java4all.jaxx</groupId>
+ <artifactId>jaxx-runtime-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all.jaxx</groupId>
<artifactId>jaxx-runtime</artifactId>
</dependency>
<dependency>
=====================================
client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
@@ -61,10 +61,11 @@ public abstract class ObserveKeyStrokes {
public static final KeyStroke KEY_STROKE_RELOAD_DEFAULT_CONFIGURATION = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
public static final KeyStroke KEY_STROKE_ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
public static final KeyStroke KEY_STROKE_ENTER = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
- public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F1");
- public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F2");
- public static final KeyStroke KEY_STROKE_SHOW_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed F3");
- public static final KeyStroke KEY_STROKE_SHOW_EMPTY_PROGRAM = KeyStroke.getKeyStroke("ctrl pressed F4");
+ public static final KeyStroke KEY_STROKE_NAVIGATION_CONFIGURE = KeyStroke.getKeyStroke("ctrl pressed F1");
+ public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F2");
+ public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F3");
+ public static final KeyStroke KEY_STROKE_SHOW_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed F4");
+ public static final KeyStroke KEY_STROKE_SHOW_EMPTY_PROGRAM = KeyStroke.getKeyStroke("ctrl pressed F5");
public static final KeyStroke KEY_STROKE_CONFIGURE_LOCAL_SOURCE = KeyStroke.getKeyStroke("ctrl pressed L");
public static final KeyStroke KEY_STROKE_CONFIGURE_REMOTE_SOURCE = KeyStroke.getKeyStroke("ctrl pressed R");
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
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx
+++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx
@@ -77,8 +77,10 @@
fr.ird.observe.client.ui.content.ContentUIManager
fr.ird.observe.client.ui.content.ObserveActionMap
+ fr.ird.observe.client.ui.tree.navigation.NavigationUI
fr.ird.observe.client.ui.tree.navigation.NavigationTree
- fr.ird.observe.client.ui.tree.navigation.NavigationTreeHeader
+ fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel
+ fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel
fr.ird.observe.client.ui.util.UIHelper
fr.ird.observe.client.ui.util.ObserveBlockingLayerUI
@@ -252,10 +254,8 @@ protected void finalize() throws Throwable {
<!-- left : navigation -->
<JXTitledPanel id='navigationView'>
- <JScrollPane id='navigationScrollPane' columnHeaderView='{navigationTreeHeader}'>
- <NavigationTree id="navigation"/>
- <NavigationTreeHeader id='navigationTreeHeader' tree='{navigation}'/>
- </JScrollPane>
+ <NavigationUI id="navigationUI" initializer="new NavigationUI((JAXXContext)this)"/>
+ <NavigationTree id="navigation" initializer="navigationUI.getTree()"/>
</JXTitledPanel>
<!-- right : (content + messages) -->
=====================================
client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
@@ -6,15 +6,15 @@
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
+ *
+ * You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
@@ -32,7 +32,6 @@ import fr.ird.observe.client.ui.content.ContentUIManager;
import fr.ird.observe.client.ui.content.ObserveActionMap;
import fr.ird.observe.client.ui.tree.ObserveNavigationTreeShowPopupAction;
import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
-import fr.ird.observe.client.ui.tree.navigation.NavigationTreeHeader;
import fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel;
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
@@ -44,19 +43,14 @@ import fr.ird.observe.client.ui.util.UIHelper;
import fr.ird.observe.dto.decoration.DecoratorService;
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
import fr.ird.observe.dto.referential.ReferentialLocale;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Objects;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.I18n;
+import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
+import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
+import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
+import org.nuiton.jaxx.widgets.error.ErrorDialogUI;
+
import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.JSplitPane;
@@ -67,14 +61,16 @@ import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.TreePath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.i18n.I18n;
-import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
-import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
-import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
-import org.nuiton.jaxx.widgets.error.ErrorDialogUI;
-
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Objects;
import static fr.ird.observe.client.ui.content.ContentUIInitializer.OBSERVE_ACTION;
import static org.nuiton.i18n.I18n.t;
@@ -94,11 +90,87 @@ public class ObserveMainUIInitializer {
private static final String EMPTY_SELECTION = "emptySelection";
private final ObserveMainUI ui;
+ private Border focusBorder;
+ private Border noFocusBorder;
ObserveMainUIInitializer(ObserveMainUI ui) {
this.ui = ui;
}
+ /**
+ * Methode pour initialiser l'ui principale sans l'afficher.
+ *
+ * @param context le context applicatif
+ * @param config la configuration a utiliser
+ * @return l'ui instancie et initialisee mais non visible encore
+ */
+ public static ObserveMainUI initUI(ObserveSwingApplicationContext context, ClientConfig config) {
+
+ SwingValidatorMessageTableModel errorModel = new ObserveSwingValidatorMessageTableModel();
+
+ DecoratorService decoratorService = context.getDecoratorService();
+
+ boolean reloadDecorators = false;
+ Locale currentLocale = I18n.getDefaultLocale();
+ Locale configurationLocale = config.getLocale();
+ if (!configurationLocale.equals(currentLocale)) {
+ if (log.isInfoEnabled()) {
+ log.info("re-init I18n with locale " + configurationLocale);
+ }
+ I18n.setDefaultLocale(configurationLocale);
+ reloadDecorators = true;
+ }
+ if (!config.getDbLocale().equals(decoratorService.getReferentialLocale().getLocale())) {
+ if (log.isInfoEnabled()) {
+ log.info("re-init db with locale " + config.getDbLocale());
+ }
+ decoratorService.setReferentialLocale(ReferentialLocale.valueOf(config.getDbLocale()));
+
+ reloadDecorators = true;
+ }
+
+ if (reloadDecorators) {
+ if (log.isInfoEnabled()) {
+ log.info("reload decorators");
+ }
+ decoratorService.reload();
+ }
+
+ JAXXInitialContext tx = new JAXXInitialContext();
+ tx.add(context).add(errorModel);
+
+ // show main ui
+ ObserveMainUI ui = new ObserveMainUI(tx);
+ ui.setUndecorated(config.isFullScreen());
+
+ String title = t("observe.title.welcome.admin") + (" v " + config.getVersion());
+ ui.setTitle(title);
+
+ context.setMainUI(ui);
+
+ ErrorDialogUI.init(ui);
+
+ // set fullscreen propery on main ui
+ ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
+
+ new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationUI(), ui.getNavigationPopup());
+
+ return ui;
+ }
+
+ public static void setMainUIVisible(ObserveSwingApplicationContext rootContext, ObserveMainUI ui, boolean replace) {
+
+ // force le redimensionnement du splitpane
+ ui.getSplitpane().revalidate();
+
+ // force le redimensionnement du splitpane2
+ ui.getSplitpane2().revalidate();
+
+ // affichage de l'interface graphique
+ SwingUtilities.invokeLater(() -> ui.setVisible(true));
+ rootContext.getSwingSessionHelper().addComponent(ui, replace);
+ }
+
private void changeNavigationNode(TreeSelectionEvent event) {
ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource();
@@ -196,7 +268,7 @@ public class ObserveMainUIInitializer {
if (ui.getNavigation().equals(focusOwner)) {
focusOnNavigation = true;
}
- if (ui.getNavigationTreeHeader().equals(focusOwner)) {
+ if (ui.getNavigationUI().equals(focusOwner)) {
focusOnNavigation = true;
}
if (ui.getNavigationView().equals(focusOwner)) {
@@ -209,7 +281,7 @@ public class ObserveMainUIInitializer {
focusOnNavigation = true;
break;
}
- if (ui.getNavigationTreeHeader().equals(focusOwnerParent)) {
+ if (ui.getNavigationUI().equals(focusOwnerParent)) {
focusOnNavigation = true;
break;
}
@@ -243,67 +315,6 @@ public class ObserveMainUIInitializer {
}
/**
- * Methode pour initialiser l'ui principale sans l'afficher.
- *
- * @param context le context applicatif
- * @param config la configuration a utiliser
- * @return l'ui instancie et initialisee mais non visible encore
- */
- public static ObserveMainUI initUI(ObserveSwingApplicationContext context, ClientConfig config) {
-
- SwingValidatorMessageTableModel errorModel = new ObserveSwingValidatorMessageTableModel();
-
- DecoratorService decoratorService = context.getDecoratorService();
-
- boolean reloadDecorators = false;
- Locale currentLocale = I18n.getDefaultLocale();
- Locale configurationLocale = config.getLocale();
- if (!configurationLocale.equals(currentLocale)) {
- if (log.isInfoEnabled()) {
- log.info("re-init I18n with locale " + configurationLocale);
- }
- I18n.setDefaultLocale(configurationLocale);
- reloadDecorators = true;
- }
- if (!config.getDbLocale().equals(decoratorService.getReferentialLocale().getLocale())) {
- if (log.isInfoEnabled()) {
- log.info("re-init db with locale " + config.getDbLocale());
- }
- decoratorService.setReferentialLocale(ReferentialLocale.valueOf(config.getDbLocale()));
-
- reloadDecorators = true;
- }
-
- if (reloadDecorators) {
- if (log.isInfoEnabled()) {
- log.info("reload decorators");
- }
- decoratorService.reload();
- }
-
- JAXXInitialContext tx = new JAXXInitialContext();
- tx.add(context).add(errorModel);
-
- // show main ui
- ObserveMainUI ui = new ObserveMainUI(tx);
- ui.setUndecorated(config.isFullScreen());
-
- String title = t("observe.title.welcome.admin") + (" v " + config.getVersion());
- ui.setTitle(title);
-
- context.setMainUI(ui);
-
- ErrorDialogUI.init(ui);
-
- // set fullscreen propery on main ui
- ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
-
- new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationScrollPane(), ui.getNavigationPopup());
-
- return ui;
- }
-
- /**
* Permet de recharger l'ui principale et de changer de le mode
* d'affichage.
*
@@ -358,11 +369,7 @@ public class ObserveMainUIInitializer {
// on met à jour le modèle de navigation
NavigationTreeModel treeModel = ui.getNavigation().getTreeModel();
- treeModel.setLoadSeine(ui.getNavigationTreeHeader().getShowSeine().isSelected());
- treeModel.setLoadLongline(ui.getNavigationTreeHeader().getShowLongline().isSelected());
- treeModel.setLoadReferential(ui.getNavigationTreeHeader().getShowReferential().isSelected());
- treeModel.setLoadEmptyProgram(ui.getNavigationTreeHeader().getShowEmptyProgram().isSelected());
-
+ treeModel.load(config);
treeModel.populate();
// on conserve les noeuds a reselectionner
@@ -378,19 +385,6 @@ public class ObserveMainUIInitializer {
setMainUIVisible(rootContext, ui, true);
}
- public static void setMainUIVisible(ObserveSwingApplicationContext rootContext, ObserveMainUI ui, boolean replace) {
-
- // force le redimensionnement du splitpane
- ui.getSplitpane().revalidate();
-
- // force le redimensionnement du splitpane2
- ui.getSplitpane2().revalidate();
-
- // affichage de l'interface graphique
- SwingUtilities.invokeLater(() -> ui.setVisible(true));
- rootContext.getSwingSessionHelper().addComponent(ui, replace);
- }
-
void initialize() {
ObserveActionMap actionMap = ui.getObserveActionMap();
@@ -440,43 +434,43 @@ public class ObserveMainUIInitializer {
};
ui.getNavigationView().addMouseListener(mouseAdapter);
ui.getNavigation().addMouseListener(mouseAdapter);
- ui.getNavigationTreeHeader().addMouseListener(mouseAdapter);
+ ui.getNavigationUI().addMouseListener(mouseAdapter);
init(ui.getSplitpane());
init(ui.getSplitpane2());
init(ui.getNavigation());
- ui.getNavigationView().setRightDecoration(ui.getNavigationTreeHeader().getToolbar());
- ui.getNavigationView().addComponentListener(new ComponentAdapter() {
-
- @Override
- public void componentResized(ComponentEvent e) {
-
- JComponent source = (JComponent) e.getSource();
-
- NavigationTreeHeader actions = ui.getNavigationTreeHeader();
-
- Dimension preferredLayoutSize = actions.getLayout().preferredLayoutSize(actions);
-
- Dimension showLonglineSize = actions.getShowLongline().getSize();
- Dimension showSeineSize = actions.getShowSeine().getSize();
- Dimension showReferential = actions.getShowReferential().getSize();
- Dimension showEmpty = actions.getShowEmptyProgram().getSize();
- int minWidth = 18 + (int) Math.max(showLonglineSize.getWidth() + showSeineSize.getWidth(), showReferential.getWidth() + showEmpty.getWidth());
- source.setMinimumSize(new Dimension(minWidth, (int) source.getSize().getHeight()));
- log.debug("Header resized to minumun: " + source.getMinimumSize());
-
- int maxWidth = ui.getNavigationView().getWidth() - 10;
-
- int currentWidth = (int) preferredLayoutSize.getWidth();
- int height = 32;
- if (currentWidth > maxWidth) {
- height += 32;
- }
- actions.setPreferredSize(new Dimension(maxWidth, height));
-
- }
- });
+ ui.getNavigationView().setRightDecoration(ui.getNavigationUI().getToolbar());
+// ui.getNavigationView().addComponentListener(new ComponentAdapter() {
+//
+// @Override
+// public void componentResized(ComponentEvent e) {
+//
+// JComponent source = (JComponent) e.getSource();
+//
+// NavigationTreeHeader actions = ui.getNavigationUI();
+//
+// Dimension preferredLayoutSize = actions.getLayout().preferredLayoutSize(actions);
+//
+// Dimension showLonglineSize = actions.getShowLongline().getSize();
+// Dimension showSeineSize = actions.getShowSeine().getSize();
+// Dimension showReferential = actions.getShowReferential().getSize();
+// Dimension showEmpty = actions.getShowEmptyProgram().getSize();
+// int minWidth = 18 + (int) Math.max(showLonglineSize.getWidth() + showSeineSize.getWidth(), showReferential.getWidth() + showEmpty.getWidth());
+// source.setMinimumSize(new Dimension(minWidth, (int) source.getSize().getHeight()));
+// log.debug("Header resized to minumun: " + source.getMinimumSize());
+//
+// int maxWidth = ui.getNavigationView().getWidth() - 10;
+//
+// int currentWidth = (int) preferredLayoutSize.getWidth();
+// int height = 32;
+// if (currentWidth > maxWidth) {
+// height += 32;
+// }
+// actions.setPreferredSize(new Dimension(maxWidth, height));
+//
+// }
+// });
}
protected void init(ObserveActionMap actionMap, AbstractButton editor) {
@@ -498,9 +492,6 @@ public class ObserveMainUIInitializer {
}
- private Border focusBorder;
- private Border noFocusBorder;
-
private Border getFocusBorder() {
if (focusBorder == null) {
focusBorder = new LineBorder(ObserveSwingApplicationContext.get().getConfig().getFocusBorderColor(), 3, true);
@@ -549,7 +540,7 @@ public class ObserveMainUIInitializer {
/**
* Nettoye des ui tout ce qui concerne un modèle de navigation.
- * <p>
+ *
* <b>Note:</b> cette méthode doit être appelée avant tout rechargement de modèle de naivgation.
*
* @param progressModel progress model to interact with ui
@@ -576,7 +567,7 @@ public class ObserveMainUIInitializer {
/**
* Charge dans l'ui un nouveau modèle de navigation.
- * <p>
+ *
* <b>Note:</b> cette méthode doit être appelée après tout rechargement de modèle de naivgation.
*
* @param progressModel the progress model to interact with ui
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
@@ -72,15 +72,15 @@ public class DataSynchroModel extends AdminActionModel {
super(AdminStep.DATA_SYNCHRONIZE);
// leftSelectionDataModel = new SelectionTreeModel();
-// leftSelectionDataModel.setLoadLongline(true);
-// leftSelectionDataModel.setLoadSeine(true);
-// leftSelectionDataModel.setLoadReferential(false);
+// leftSelectionDataModel.setShowLonglineTrip(true);
+// leftSelectionDataModel.setShowSeineTrip(true);
+// leftSelectionDataModel.setShowReferential(false);
// leftSelectionDataModel.setShowEmptyTrips(false);
//
// rightSelectionDataModel = new SelectionTreeModel();
-// rightSelectionDataModel.setLoadLongline(true);
-// rightSelectionDataModel.setLoadSeine(true);
-// rightSelectionDataModel.setLoadReferential(false);
+// rightSelectionDataModel.setShowLonglineTrip(true);
+// rightSelectionDataModel.setShowSeineTrip(true);
+// rightSelectionDataModel.setShowReferential(false);
// rightSelectionDataModel.setShowEmptyTrips(false);
tasks = new DefaultListModel<>();
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
@@ -33,6 +33,7 @@
fr.ird.observe.client.constants.ValidationModelMode
org.nuiton.validator.NuitonValidatorScope
+ org.nuiton.i18n.I18n
java.io.File
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
@@ -24,7 +24,7 @@
layout:{new BorderLayout()};
}
#referentialSynchronizeConfigPanel {
- border:{new TitledBorder(t("observe.actions.synchro.referential.config.mode"))};
+ border:{new TitledBorder(I18n.t("observe.actions.synchro.referential.config.mode"))};
}
#synchronizeMode {
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
+++ b/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>>
Action resetAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- beanComboBox.doActionPerformed__on__resetButton(null);
+ beanComboBox.getResetButton().doClick();
SwingUtilities.invokeLater(beanComboBox::grabFocus);
}
};
@@ -768,7 +768,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, new ArrayList<>(), new ArrayList<>());
JList<R> selectedList = list.getSelectedList();
- ListCellRenderer<? super R> renderer = selectedList.getCellRenderer();
+ ListCellRenderer renderer = selectedList.getCellRenderer();
selectedList.setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
list.getUniverseList().setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
@@ -795,7 +795,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, new ArrayList<>(), new ArrayList<>());
JList<R> selectedList = list.getSelectedList();
- ListCellRenderer<? super R> renderer = selectedList.getCellRenderer();
+ ListCellRenderer renderer = selectedList.getCellRenderer();
selectedList.setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
list.getUniverseList().setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
@@ -822,7 +822,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, Collections.emptyList());
JList<R> list1 = list.getList();
- ListCellRenderer<? super R> renderer = list1.getCellRenderer();
+ ListCellRenderer renderer = list1.getCellRenderer();
list1.setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
}
@@ -847,7 +847,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, Collections.emptyList());
JList<R> list1 = list.getList();
- ListCellRenderer<? super R> renderer = list1.getCellRenderer();
+ ListCellRenderer renderer = list1.getCellRenderer();
list1.setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
+++ b/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
@@ -30,6 +30,8 @@
fr.ird.observe.client.ui.storage.tabs.SecurityModel
fr.ird.observe.client.ui.storage.StorageStep
fr.ird.observe.client.ui.storage.StorageUIModel
+
+ org.nuiton.i18n.I18n
</import>
<StorageStep id='step' initializer='StorageStep.ROLES'/>
@@ -44,7 +46,7 @@
<script><![CDATA[
public String updateAdministrateur(String role) {
- return t("observe.storage.security.administrateur", role);
+ return I18n.t("observe.storage.security.administrateur", role);
}
]]>
</script>
=====================================
client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
+++ b/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
@@ -25,7 +25,7 @@
}
#administrateurPanel {
- border:{new TitledBorder(t("observe.storage.security.administrateur"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.administrateur"))};
layout:{new BorderLayout()};
}
@@ -43,13 +43,13 @@
}
#techniciens {
- border:{new TitledBorder(t("observe.storage.security.technicien"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.technicien"))};
}
#readers {
- border:{new TitledBorder(t("observe.storage.security.reader"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.reader"))};
}
#referentiels {
- border:{new TitledBorder(t("observe.storage.security.referentiel"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.referentiel"))};
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jaxx deleted
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jaxx
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- #%L
- ObServe :: Client
- %%
- Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel layout='{new FlowLayout(FlowLayout.LEFT, 2, 2)}'>
-
- <import>
- java.awt.FlowLayout
- </import>
-
- <JToggleButton id='showSeine' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
- <JToggleButton id='showLongline' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
- <JToggleButton id='showReferential' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
- <JToggleButton id='showEmptyProgram' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
-
- <NavigationTree id='tree' javaBean='new NavigationTree()'/>
-
- <JToolBar id='toolbar'>
- <JButton id='colapseAll' onActionPerformed='handler.collapseAll()'/>
- <JButton id='expandAll' onActionPerformed='handler.expandAll()'/>
- </JToolBar>
-
-</JPanel>
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeModel.java
+++ b/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;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
+import fr.ird.observe.client.configuration.ClientConfig;
+import fr.ird.observe.client.configuration.NavigationTreeConfigBean;
import fr.ird.observe.client.db.ObserveSwingDataSource;
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
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
import fr.ird.observe.client.ui.tree.navigation.nodes.seine.ProgramSeineNavigationTreeNode;
import fr.ird.observe.dto.data.longline.TripLonglineHelper;
import fr.ird.observe.dto.data.longline.TripLonglineReference;
-import fr.ird.observe.dto.referential.ProgramHelper;
-import fr.ird.observe.dto.referential.ProgramReference;
import fr.ird.observe.dto.data.seine.TripSeineHelper;
import fr.ird.observe.dto.data.seine.TripSeineReference;
+import fr.ird.observe.dto.referential.ProgramHelper;
+import fr.ird.observe.dto.referential.ProgramReference;
import fr.ird.observe.services.service.data.NavigationRequest;
import fr.ird.observe.services.service.data.NavigationResult;
import fr.ird.observe.services.service.data.NavigationService;
+
+import javax.swing.tree.DefaultTreeModel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import javax.swing.tree.DefaultTreeModel;
/**
* Created on 14/11/16.
@@ -55,44 +58,50 @@ import javax.swing.tree.DefaultTreeModel;
*/
public class NavigationTreeModel extends DefaultTreeModel {
- private boolean loadSeine = true;
- private boolean loadLongline = true;
- private boolean loadReferential = true;
- private boolean loadEmptyProgram = true;
+ private final NavigationTreeConfigBean config;
- public NavigationTreeModel() {
+ NavigationTreeModel() {
super(new RootNavigationTreeNode());
+ config = new NavigationTreeConfigBean();
}
- public NavigationTreeNodeSupport<?> findNode(NavigationTreeNodeSupport<?> node, Object... ids) {
- NavigationTreeNodeSupport<?> result = null;
- for (Object id : ids) {
+ public NavigationTreeConfigBean getConfig() {
+ return config;
+ }
- if (id instanceof String) {
- result = node.findChildById((String) id);
- } else if (id instanceof Class) {
- result = node.findChildByType((Class) id);
+ @Override
+ public RootNavigationTreeNode getRoot() {
+ return (RootNavigationTreeNode) super.getRoot();
+ }
- }
- if (result == null) {
+ public <N extends NavigationTreeNodeSupport> void reload(N node) {
+ node.reload();
+ super.reload(node);
+ }
- // un des noeud n'a pas ete trouve, on sortReferential
- break;
+ public <N extends NavigationTreeNodeSupport> void open(N node) {
+ if (node instanceof WithChildsToReload) {
+ boolean updated = node.populateChilds();
+ if (updated) {
+ reload(node);
}
- node = result;
}
- return result;
}
- public NavigationTreeNodeSupport<?> findNodeByType(NavigationTreeNodeSupport<?> node, Class<?> nodeType) {
- return node.findChildByType(nodeType);
+ public void save(ClientConfig config) {
+ config.load(this.config);
+ config.saveForUser();
+ }
+
+ public void load(ClientConfig config) {
+ this.config.load(config);
}
public void populate() {
NavigationService navigationService = ObserveSwingDataSource.MAIN.getNavigationService();
- NavigationRequest navigationRequest = toNavigationRequest();
+ NavigationRequest navigationRequest = config.toRequest();
NavigationResult navigationResult = navigationService.getNavigation(navigationRequest);
List<ProgramReference> programs = new ArrayList<>(navigationResult.getPrograms());
@@ -119,75 +128,38 @@ public class NavigationTreeModel extends DefaultTreeModel {
ProgramSeineNavigationTreeNode programNode = new ProgramSeineNavigationTreeNode(program, references);
root.add(programNode);
}
-
}
- if (isLoadReferential()) {
+ if (config.isShowReferential()) {
root.add(new ReferentialsCommonNavigationTreeNode());
root.add(new ReferentialsLonglineNavigationTreeNode());
root.add(new ReferentialsSeineNavigationTreeNode());
}
-
setRoot(root);
}
- private NavigationRequest toNavigationRequest() {
- NavigationRequest navigationRequest = new NavigationRequest();
- navigationRequest.setLoadLongline(isLoadLongline());
- navigationRequest.setLoadSeine(isLoadSeine());
- navigationRequest.setLoadEmptyProgram(isLoadEmptyProgram());
- return navigationRequest;
- }
-
- @Override
- public RootNavigationTreeNode getRoot() {
- return (RootNavigationTreeNode) super.getRoot();
- }
-
- public boolean isLoadSeine() {
- return loadSeine;
- }
-
- public void setLoadSeine(boolean loadSeine) {
- this.loadSeine = loadSeine;
- }
-
- public boolean isLoadLongline() {
- return loadLongline;
- }
-
- public void setLoadLongline(boolean loadLongline) {
- this.loadLongline = loadLongline;
- }
-
- public boolean isLoadReferential() {
- return loadReferential;
- }
-
- public void setLoadReferential(boolean loadReferential) {
- this.loadReferential = loadReferential;
- }
-
- public boolean isLoadEmptyProgram() {
- return loadEmptyProgram;
- }
+ NavigationTreeNodeSupport<?> findNode(NavigationTreeNodeSupport<?> node, Object... ids) {
+ NavigationTreeNodeSupport<?> result = null;
+ for (Object id : ids) {
- public void setLoadEmptyProgram(boolean loadEmptyProgram) {
- this.loadEmptyProgram = loadEmptyProgram;
- }
+ if (id instanceof String) {
+ result = node.findChildById((String) id);
+ } else if (id instanceof Class) {
+ result = node.findChildByType((Class) id);
- public <N extends NavigationTreeNodeSupport> void reload(N node) {
- node.reload();
- super.reload(node);
- }
+ }
+ if (result == null) {
- public <N extends NavigationTreeNodeSupport> void open(N node) {
- if (node instanceof WithChildsToReload) {
- boolean updated = node.populateChilds();
- if (updated) {
- reload(node);
+ // un des noeud n'a pas ete trouve, on sortReferential
+ break;
}
+ node = result;
}
+ return result;
+ }
+
+ NavigationTreeNodeSupport<?> findNodeByType(NavigationTreeNodeSupport<?> node, Class<?> nodeType) {
+ return node.findChildByType(nodeType);
}
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
=====================================
--- /dev/null
+++ b/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
@@ -0,0 +1,24 @@
+<JScrollPane id='navigationScrollPane' columnHeaderView='{toolbar}' viewportView="{tree}">
+
+ <import>
+ fr.ird.observe.client.configuration.NavigationTreeConfigBean
+ static org.nuiton.i18n.I18n.t
+ </import>
+ <NavigationTree id='tree' />
+ <NavigationTreeModel id='treeModel' javaBean='{tree.getTreeModel()}'/>
+ <NavigationTreeConfigBean id='navigationConfig' javaBean='treeModel.getConfig()'/>
+
+ <JPopupMenu id='configurePopup'>
+ <JCheckBoxMenuItem id='showSeineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ <JCheckBoxMenuItem id='showLonglineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ <JCheckBoxMenuItem id='showReferential' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ <JCheckBoxMenuItem id='showEmptyProgram' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ </JPopupMenu>
+
+ <JToolBar id='toolbar'>
+ <JButton id='colapseAll' onActionPerformed='handler.collapseAll()'/>
+ <JButton id='expandAll' onActionPerformed='handler.expandAll()'/>
+ <JToggleButton id='configure' onActionPerformed='handler.configure()'/>
+ </JToolBar>
+
+</JScrollPane>
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jcss → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jcss
+++ b/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
@@ -8,36 +8,35 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
-#showSeine {
- selected: {tree.getTreeModel().isLoadSeine()};
+#showSeineTrip {
+ selected: {navigationConfig.isShowSeineTrip()};
text:"observe.constant.ObserveModelType.PS";
toolTipText:"observe.constant.ObserveModelType.PS.description";
}
-#showLongline {
- selected: {tree.getTreeModel().isLoadLongline()};
+#showLonglineTrip {
+ selected: {navigationConfig.isShowLonglineTrip()};
text:"observe.constant.ObserveModelType.LL";
toolTipText:"observe.constant.ObserveModelType.LL.description";
}
#showReferential {
- selected: {tree.getTreeModel().isLoadReferential()};
+ selected: {navigationConfig.isShowReferential()};
text:"observe.constant.ObserveModelType.REF";
toolTipText:"observe.constant.ObserveModelType.REF.description";
}
-
#showEmptyProgram {
- selected: {tree.getTreeModel().isLoadEmptyProgram()};
+ selected: {navigationConfig.isShowEmptyProgram()};
text:"observe.constant.ObserveModelType.EMPTY";
toolTipText:"observe.constant.ObserveModelType.EMPTY.description";
}
@@ -61,3 +60,8 @@ JButton {
actionIcon:expand;
toolTipText:"observe.tree.action.expandAll.tip";
}
+
+#configure {
+ actionIcon:generate;
+ toolTipText:"observe.tree.action.configure.tip";
+}
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeaderHandler.java → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeaderHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
@@ -1,39 +1,11 @@
package fr.ird.observe.client.ui.tree.navigation;
-/*
- * #%L
- * ObServe :: Client
- * %%
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
import fr.ird.observe.client.ObserveSwingApplicationContext;
+import fr.ird.observe.client.configuration.ClientConfig;
+import fr.ird.observe.client.configuration.NavigationTreeConfig;
import fr.ird.observe.client.ui.ObserveKeyStrokes;
-import fr.ird.observe.client.ui.util.UIHelper;
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
-import fr.ird.observe.dto.referential.ProgramDto;
-import fr.ird.observe.dto.data.seine.TripSeineDto;
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import javax.swing.AbstractAction;
-import javax.swing.ActionMap;
-import javax.swing.InputMap;
-import javax.swing.JComponent;
+import fr.ird.observe.client.ui.util.UIHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.decorator.ColorHighlighter;
@@ -41,17 +13,29 @@ import org.jdesktop.swingx.search.Searchable;
import org.jdesktop.swingx.search.TreeSearchable;
import org.nuiton.jaxx.runtime.spi.UIHandler;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+
/**
- * @author Samuel Maisonneuve- maisonneuve(a)codelutin.com
+ * Created by tchemit on 01/04/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
*/
-public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHeader> {
+public class NavigationUIHandler implements UIHandler<NavigationUI> {
/** Logger */
- private static final Log log = LogFactory.getLog(NavigationTreeHeaderHandler.class);
+ private static final Log log = LogFactory.getLog(NavigationUIHandler.class);
- private NavigationTreeHeader ui;
+ private NavigationUI ui;
- public NavigationTreeHeader getUi() {
+ public NavigationUI getUi() {
return ui;
}
@@ -60,15 +44,15 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
}
@Override
- public void beforeInit(NavigationTreeHeader ui) {
+ public void beforeInit(NavigationUI ui) {
this.ui = ui;
}
@Override
- public void afterInit(NavigationTreeHeader ui) {
+ public void afterInit(NavigationUI ui) {
- ui.getShowSeine().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
- ui.getShowLongline().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
+ ui.getShowSeineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
+ ui.getShowLonglineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
ui.getShowReferential().setIcon(UIHelper.getUIManagerIcon("navigation.referentiel-16"));
ui.getShowEmptyProgram().setIcon(UIHelper.getUIManagerIcon("navigation.data.seine.TripSeine-16"));
@@ -77,10 +61,16 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
tree.setSearchable(searchable);
searchable.setMatchHighlighter(new ColorHighlighter(Color.YELLOW, Color.BLACK));
- ObserveKeyStrokes.addKeyStroke(ui.getShowSeine(), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
- ObserveKeyStrokes.addKeyStroke(ui.getShowLongline(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
+ ObserveKeyStrokes.addKeyStroke(ui.getShowSeineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
+ ObserveKeyStrokes.addKeyStroke(ui.getShowLonglineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
ObserveKeyStrokes.addKeyStroke(ui.getShowReferential(), ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL);
ObserveKeyStrokes.addKeyStroke(ui.getShowEmptyProgram(), ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM);
+ ObserveKeyStrokes.addKeyStroke(ui.getConfigure(), ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE);
+ //FIXME (no text, so no text after...)
+ ui.getConfigure().setText(null);
+ ClientConfig config = ObserveSwingApplicationContext.get().getConfig();
+ NavigationTreeModel treeModel = (NavigationTreeModel) tree.getModel();
+ treeModel.load(config);
InputMap inputMap = ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap actionMap = ui.getActionMap();
@@ -88,32 +78,66 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
actionMap.put("showSeine", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowSeine().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowSeineTrip().doClick();
+ }
+ ui.getConfigurePopup().setVisible(false);
}
});
inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE, "showLongline");
actionMap.put("showLongline", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowLongline().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowLonglineTrip().doClick();
+ }
+ ui.getConfigurePopup().setVisible(false);
}
});
inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL, "showReferential");
actionMap.put("showReferential", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowReferential().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowReferential().doClick();
+ }
+ ui.getConfigurePopup().setVisible(false);
}
});
inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM, "showEmptyProgram");
actionMap.put("showEmptyProgram", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowEmptyProgram().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowEmptyProgram().doClick();
+ }
+ ui.getConfigurePopup().setVisible(false);
+ }
+ });
+ inputMap.put(ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE, "configure");
+ actionMap.put("configure", new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ui.getConfigure().doClick();
}
});
}
+ void configure() {
+ SwingUtilities.invokeLater(() -> {
+ JComponent c = ui.getConfigure();
+ JPopupMenu p = ui.getConfigurePopup();
+ if (p.isVisible()) {
+ p.setVisible(false);
+ return;
+ }
+ int width = ui.getParent().getWidth() - 5;
+ int height = p.getPreferredSize().height;
+ p.setPreferredSize(new Dimension(width, height));
+ p.show(c, (c.getWidth() == 0 ? 24 : c.getWidth()) - width + 2, c.getHeight());
+ });
+ }
+
public void search(String term) {
Searchable searchable = getTree().getSearchable();
@@ -121,7 +145,7 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
}
- public void tryToUpdateNavigationTree() {
+ void tryToUpdateNavigationTree() {
boolean canContinue = ObserveSwingApplicationContext.get().getContentUIManager().closeSelectedContentUI();
@@ -137,23 +161,24 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
}
tree.clearSelection();
- boolean showSeine = ui.getShowSeine().isSelected();
- boolean showLongline = ui.getShowLongline().isSelected();
+ boolean showSeine = ui.getShowSeineTrip().isSelected();
+ boolean showLongline = ui.getShowLonglineTrip().isSelected();
boolean showReferential = ui.getShowReferential().isSelected();
boolean showEmptyProgram = ui.getShowEmptyProgram().isSelected();
NavigationTreeModel treeModel = tree.getTreeModel();
- treeModel.setLoadSeine(showSeine);
- treeModel.setLoadLongline(showLongline);
- treeModel.setLoadReferential(showReferential);
- treeModel.setLoadEmptyProgram(showEmptyProgram);
-
+ NavigationTreeConfig navigationTreeConfig = treeModel.getConfig();
+ navigationTreeConfig.setShowSeineTrip(showSeine);
+ navigationTreeConfig.setShowLonglineTrip(showLongline);
+ navigationTreeConfig.setShowReferential(showReferential);
+ navigationTreeConfig.setShowEmptyProgram(showEmptyProgram);
+ treeModel.save(ObserveSwingApplicationContext.get().getConfig());
treeModel.populate();
-
//FIXME repositionner le nœud sélectionné
if (!treeModel.getRoot().isLeaf()) {
tree.setSelectionRow(0);
}
+ ui.getConfigure().setSelected(false);
}
public void collapseAll() {
=====================================
client/src/main/resources/i18n/client_en_GB.properties
=====================================
--- a/client/src/main/resources/i18n/client_en_GB.properties
+++ b/client/src/main/resources/i18n/client_en_GB.properties
@@ -1488,6 +1488,7 @@ observe.title.storage.info=Storage details
observe.title.unique.key=Unique keys used in a referentiel
observe.title.welcome.admin=ObServe
observe.tree.action.collapseAll.tip=Collapse all
+observe.tree.action.configure.tip=Configure
observe.tree.action.expandAll.tip=Expand all
observe.tree.action.selectAll.tip=Select All
observe.tree.action.unselectAll.tip=Unselect All
=====================================
client/src/main/resources/i18n/client_es_ES.properties
=====================================
--- a/client/src/main/resources/i18n/client_es_ES.properties
+++ b/client/src/main/resources/i18n/client_es_ES.properties
@@ -1488,6 +1488,7 @@ observe.title.storage.info=Información sobre la fuente de datos
observe.title.unique.key=Ids de negocio del referencial %1$s
observe.title.welcome.admin=ObServe
observe.tree.action.collapseAll.tip=Cerrar los nudos
+observe.tree.action.configure.tip=Configure \#TODO
observe.tree.action.expandAll.tip=Abrir los nudos
observe.tree.action.selectAll.tip=Seleccionar todo
observe.tree.action.unselectAll.tip=Deseleccionar todo
=====================================
client/src/main/resources/i18n/client_fr_FR.properties
=====================================
--- a/client/src/main/resources/i18n/client_fr_FR.properties
+++ b/client/src/main/resources/i18n/client_fr_FR.properties
@@ -1488,6 +1488,7 @@ observe.title.storage.info=Information sur la source de données
observe.title.unique.key=Clefs métier du référentiel %1$s
observe.title.welcome.admin=ObServe
observe.tree.action.collapseAll.tip=Tout grouper
+observe.tree.action.configure.tip=Configurer
observe.tree.action.expandAll.tip=Tout déplier
observe.tree.action.selectAll.tip=Tout sélectionner
observe.tree.action.unselectAll.tip=Tout désélectionner
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
<packaging>pom</packaging>
<name>ObServe :: Pom</name>
- <description>Projet ObServe</description>
+ <description>Project ObServe</description>
<url>https://ultreiaio.gitlab.io/ird-observe</url>
<inceptionYear>2008</inceptionYear>
<organization>
@@ -142,10 +142,10 @@
<projectId>ird-observe</projectId>
<stageId>frirdobserve</stageId>
- <!-- dev version (for develop purpose -->
+ <!-- dev version -->
<devMode>true</devMode>
- <!--Modèle version-->
+ <!--persistence model version-->
<observe.model.version>7.0</observe.model.version>
<!-- build timestamp configuration -->
@@ -157,7 +157,7 @@
<!--<eugenePluginVersion>3.0-alpha-13</eugenePluginVersion>-->
<!--<processorPluginVersion>1.3</processorPluginVersion>-->
- <lib.version.java4all.jaxx>3.0-alpha-12</lib.version.java4all.jaxx>
+ <lib.version.java4all.jaxx>3.0-alpha-26</lib.version.java4all.jaxx>
<lib.version.nuiton.topia>3.3</lib.version.nuiton.topia>
<lib.version.nuiton.validation>3.1</lib.version.nuiton.validation>
<xworkVersion>2.3.34</xworkVersion>
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/cdbaa4e78c89734f40c43e7cc03…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/cdbaa4e78c89734f40c43e7cc03…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Amélioration de l'arbre de navigation
by Tony CHEMIT 01 Apr '18
by Tony CHEMIT 01 Apr '18
01 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
2e66cbe9 by Tony CHEMIT at 2018-04-01T13:34:33Z
Amélioration de l'arbre de navigation
- - - - -
27 changed files:
- client-configuration/pom.xml
- client-configuration/src/main/config/Client.ini
- client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
- + client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java
- + client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java
- client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
- client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
- client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
- client/pom.xml
- client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
- client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
- client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
- client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
- client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
- − client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jaxx
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeModel.java
- + client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jcss → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeaderHandler.java → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
- client/src/main/resources/i18n/client_en_GB.properties
- client/src/main/resources/i18n/client_es_ES.properties
- client/src/main/resources/i18n/client_fr_FR.properties
- pom.xml
Changes:
=====================================
client-configuration/pom.xml
=====================================
--- a/client-configuration/pom.xml
+++ b/client-configuration/pom.xml
@@ -104,6 +104,14 @@
<groupId>io.ultreia.java4all.jaxx</groupId>
<artifactId>jaxx-widgets-gis</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all.jaxx</groupId>
+ <artifactId>jaxx-widgets-temperature</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all</groupId>
+ <artifactId>java-bean</artifactId>
+ </dependency>
</dependencies>
=====================================
client-configuration/src/main/config/Client.ini
=====================================
--- a/client-configuration/src/main/config/Client.ini
+++ b/client-configuration/src/main/config/Client.ini
@@ -174,6 +174,11 @@ description = observe.config.h2.can.migrate.description
key = h2.canMigrate
type = Boolean
defaultValue = true
+[option h2CanEditReferential]
+description = observe.config.h2.can.editReferential.description
+key = h2.canEditReferential
+type = boolean
+defaultValue = false
[option h2ServerPort]
description = observe.config.h2.serverPort.description
@@ -501,6 +506,12 @@ key = ui.coordinate.format
type = org.nuiton.jaxx.widgets.gis.CoordinateFormat
defaultValue = "dmd"
+[option temperatureFormat]
+description = observe.config.temperature.format
+key = ui.temperature.format
+type = org.nuiton.jaxx.widgets.temperature.TemperatureFormat
+defaultValue = "C"
+
[option focusBorderColor]
description = observe.config.ui.focusBorderColor
key = ui.focusBorder.color
@@ -531,6 +542,30 @@ key = server.checkServerVersion
type = Boolean
defaultValue = true
+[option showSeineTrip]
+description = observe.config.ui.tree.showSeineTrip.description
+key = ui.tree.showSeineTrip
+type = Boolean
+defaultValue = true
+
+[option showLonglineTrip]
+description = observe.config.ui.tree.showLonglineTrip.description
+key = ui.tree.showLonglineTrip
+type = Boolean
+defaultValue = true
+
+[option showReferential]
+description = observe.config.ui.tree.showReferential.description
+key = ui.tree.showReferential
+type = Boolean
+defaultValue = true
+
+[option showEmptyProgram]
+description = observe.config.ui.tree.showEmptyProgram.description
+key = ui.tree.showEmptyProgram
+type = Boolean
+defaultValue = true
+
[action help]
description = observe.action.commandline.help
action = "fr.ird.observe.client.ObserveCLAction#help"
=====================================
client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
=====================================
--- a/client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
+++ b/client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -30,6 +30,16 @@ import fr.ird.observe.client.constants.DbMode;
import fr.ird.observe.dto.FloatingObjectPreset;
import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.config.ApplicationConfig;
+import org.nuiton.config.ArgumentsParserException;
+import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
+import org.nuiton.jaxx.widgets.temperature.TemperatureFormat;
+import org.nuiton.version.Version;
+import org.nuiton.version.Versions;
+
import java.beans.PropertyChangeListener;
import java.io.File;
import java.nio.charset.StandardCharsets;
@@ -44,15 +54,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.config.ApplicationConfig;
-import org.nuiton.config.ArgumentsParserException;
-import org.nuiton.jaxx.widgets.gis.CoordinateFormat;
-import org.nuiton.version.Version;
-import org.nuiton.version.Versions;
-
import static org.nuiton.i18n.I18n.t;
@@ -62,52 +63,72 @@ import static org.nuiton.i18n.I18n.t;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-public class ClientConfig extends GeneratedClientConfig {
+public class ClientConfig extends GeneratedClientConfig implements NavigationTreeConfig {
+ public static final String DB_NAME = "obstuna";
+ public static final List<ClientConfigOption> MAP_LAYERS = ImmutableList.of(
+ ClientConfigOption.MAP_LAYER1,
+ ClientConfigOption.MAP_LAYER2,
+ ClientConfigOption.MAP_LAYER3,
+ ClientConfigOption.MAP_LAYER4,
+ ClientConfigOption.MAP_LAYER5,
+ ClientConfigOption.MAP_LAYER6,
+ ClientConfigOption.MAP_LAYER7,
+ ClientConfigOption.MAP_LAYER8,
+ ClientConfigOption.MAP_LAYER9,
+ ClientConfigOption.MAP_LAYER10);
/** le pattern du fichier de sauvegarde d'une base locale */
private static final String BACKUP_DB_PATTERN = "obstuna-local-%1$tF--%1$tk-%1$tM-%1$tS.sql.gz";
-
- public static final String DB_NAME = "obstuna";
-
private static final String APPLICATION_VERSION = "application.version";
-
private static final String VERSION = "version";
-
private static final String PROPERTY_LOCAL_STORAGE_EXIST = "localStorageExist";
-
private static final String PROPERTY_INITIAL_DUMP_EXIST = "initialDumpExist";
-
private static final String PROPERTY_MAIN_STORAGE_OPENED = "mainStorageOpened";
-
/** Logger */
private static final Log log = LogFactory.getLog(ClientConfig.class);
-
private static final String DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME = "observe-client.conf";
-
+ /**
+ * Liste des options qu'on ne peut pas sauvegarder (les mots de passes,
+ * les options d'admin pour les simples utilisateurs,...).
+ *
+ * @since 1.5
+ */
+ private final String[] unsavables = new String[]{
+// ClientConfigOption.OBSTUNA_PASSWORD.getKey(),
+ ClientConfigOption.H2_PASSWORD.getKey(),
+ ClientConfigOption.OBSTUNA_CAN_MIGRATE.getKey(),
+ };
+ //FIXME
+ private final ImmutableSet<String> longlinVesselTypeIds = ImmutableSet.copyOf(
+ Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1"));
+ private final ImmutableSet<String> seineVesselTypeIds = ImmutableSet.copyOf(
+ Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084",
+ "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407"));
+ private final SimpleDateFormat dateFormat = new SimpleDateFormat();
/**
* un drapeau pour savoir s'il faut lancer l'interface graphique. Cette
* valeur peut être programmées lors des actions.
*/
private boolean displayMainUI = true;
-
/** drapeau pour savoir si une base locale existe */
private boolean localStorageExist;
-
/**
* drapeau pour savoir si le dump initial a ete chargée depuis la base
* centrale
*/
private boolean initialDumpExist;
-
/** drapeau pour savoir si une source de données est ouverte */
private boolean mainStorageOpened;
-
/**
* drapeau pour savoir si la source ouverte est locale (attention, lorsqu'il
* n'y a pas de storage d'ouvert, la valeur est null).
*/
private Boolean mainStorageOpenedLocal;
-
/**
* drapeau pour savoir si on peut utiliser des ui dans l'environnement.
* <p>
@@ -116,37 +137,12 @@ public class ClientConfig extends GeneratedClientConfig {
* trouvé.
*/
private boolean canUseUI = true;
-
/** La version de l'application */
private Version version;
-
/** Texte du copyright (calculé dynamiquement). */
private String copyrightText;
-
- /**
- * Liste des options qu'on ne peut pas sauvegarder (les mots de passes,
- * les options d'admin pour les simples utilisateurs,...).
- *
- * @since 1.5
- */
- private final String[] unsavables = new String[]{
-// ClientConfigOption.OBSTUNA_PASSWORD.getKey(),
- ClientConfigOption.H2_PASSWORD.getKey(),
- ClientConfigOption.OBSTUNA_CAN_MIGRATE.getKey(),
- };
-
- //FIXME
- private final ImmutableSet<String> longlinVesselTypeIds = ImmutableSet.copyOf(
- Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869",
- "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1"));
-
- private final ImmutableSet<String> seineVesselTypeIds = ImmutableSet.copyOf(
- Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084",
- "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407"));
+ private ImmutableList<ServerDataSourceConfiguration> serverDataSourceConfigurationList;
+ private ImmutableList<RemoteDataSourceConfiguration> remoteDataSourceConfigurationList;
public ClientConfig() {
this(DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME);
@@ -217,6 +213,11 @@ public class ClientConfig extends GeneratedClientConfig {
return CoordinateFormat.valueOf(get().getOption(ClientConfigOption.COORDINATE_FORMAT.getKey()));
}
+ @Override
+ public TemperatureFormat getTemperatureFormat() {
+ return get().getOption(TemperatureFormat.class, ClientConfigOption.TEMPERATURE_FORMAT.getKey());
+ }
+
public String getCopyrightText() {
if (copyrightText == null) {
Date date = new Date();
@@ -232,6 +233,10 @@ public class ClientConfig extends GeneratedClientConfig {
return version;
}
+ private void setVersion(Version version) {
+ this.version = version;
+ }
+
public boolean isShowTimeEditorSlider() {
return isShowDateTimeEditorSlider();
}
@@ -244,24 +249,24 @@ public class ClientConfig extends GeneratedClientConfig {
return displayMainUI;
}
- public boolean isCanUseUI() {
- return canUseUI;
- }
-
- public boolean isLocalStorageExist() {
- return localStorageExist;
+ public void setDisplayMainUI(boolean b) {
+ displayMainUI = b;
}
- public boolean isInitialDumpExist() {
- return initialDumpExist;
+ public boolean isCanUseUI() {
+ return canUseUI;
}
- public boolean isMainStorageOpened() {
- return mainStorageOpened;
+ public void setCanUseUI(boolean canUseUI) {
+ this.canUseUI = canUseUI;
+ if (!canUseUI) {
+ // on ne pourra pas lancer l'ui principale
+ setDisplayMainUI(false);
+ }
}
- public Boolean getMainStorageOpenedLocal() {
- return mainStorageOpenedLocal;
+ public boolean isLocalStorageExist() {
+ return localStorageExist;
}
public void setLocalStorageExist(boolean newValue) {
@@ -270,12 +275,20 @@ public class ClientConfig extends GeneratedClientConfig {
firePropertyChange(PROPERTY_LOCAL_STORAGE_EXIST, newValue);
}
+ public boolean isInitialDumpExist() {
+ return initialDumpExist;
+ }
+
public void setInitialDumpExist(boolean newValue) {
initialDumpExist = newValue;
// always force propagation
firePropertyChange(PROPERTY_INITIAL_DUMP_EXIST, newValue);
}
+ public boolean isMainStorageOpened() {
+ return mainStorageOpened;
+ }
+
public void setMainStorageOpened(boolean newValue) {
mainStorageOpened = newValue;
if (!newValue) {
@@ -286,36 +299,16 @@ public class ClientConfig extends GeneratedClientConfig {
firePropertyChange(PROPERTY_MAIN_STORAGE_OPENED, newValue);
}
+ public Boolean getMainStorageOpenedLocal() {
+ return mainStorageOpenedLocal;
+ }
+
public void setMainStorageOpenedLocal(Boolean newValue) {
mainStorageOpenedLocal = newValue;
// always force propagation
firePropertyChange(PROPERTY_MAIN_STORAGE_OPENED + "Local", newValue);
}
- public void setDisplayMainUI(boolean b) {
- displayMainUI = b;
- }
-
- public void setCanUseUI(boolean canUseUI) {
- this.canUseUI = canUseUI;
- if (!canUseUI) {
- // on ne pourra pas lancer l'ui principale
- setDisplayMainUI(false);
- }
- }
-
- public static final List<ClientConfigOption> MAP_LAYERS = ImmutableList.of(
- ClientConfigOption.MAP_LAYER1,
- ClientConfigOption.MAP_LAYER2,
- ClientConfigOption.MAP_LAYER3,
- ClientConfigOption.MAP_LAYER4,
- ClientConfigOption.MAP_LAYER5,
- ClientConfigOption.MAP_LAYER6,
- ClientConfigOption.MAP_LAYER7,
- ClientConfigOption.MAP_LAYER8,
- ClientConfigOption.MAP_LAYER9,
- ClientConfigOption.MAP_LAYER10);
-
public List<File> getMapLayerFiles() {
List<File> layers = new LinkedList<>();
@@ -399,10 +392,6 @@ public class ClientConfig extends GeneratedClientConfig {
}
}
- private void setVersion(Version version) {
- this.version = version;
- }
-
public Set<String> getSeineVesselTypeIds() {
return seineVesselTypeIds;
}
@@ -429,10 +418,17 @@ public class ClientConfig extends GeneratedClientConfig {
return option == null ? new RemoteDataSourceConfiguration[0] : new Gson().fromJson(option, RemoteDataSourceConfiguration[].class);
}
+ @Override
+ public void setRemoteDataSourceConfigurations(RemoteDataSourceConfiguration[] configurations) {
+ String option = new Gson().toJson(configurations);
+ get().setOption(ClientConfigOption.REMOTE_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
+ remoteDataSourceConfigurationList = null;
+ }
+
public void addRemoteDataSourceConfiguration(RemoteDataSourceConfiguration configuration) {
List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
remoteDataSourceConfigurations.add(configuration);
- setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
saveForUser();
}
@@ -440,27 +436,17 @@ public class ClientConfig extends GeneratedClientConfig {
List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
remoteDataSourceConfigurations.remove(configuration);
remoteDataSourceConfigurations.add(configuration);
- setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
saveForUser();
}
public void removeRemoteDataSourceConfiguration(RemoteDataSourceConfiguration configuration) {
List<RemoteDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
remoteDataSourceConfigurations.remove(configuration);
- setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setRemoteDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new RemoteDataSourceConfiguration[0]));
saveForUser();
}
- @Override
- public void setRemoteDataSourceConfigurations(RemoteDataSourceConfiguration[] configurations) {
- String option = new Gson().toJson(configurations);
- get().setOption(ClientConfigOption.REMOTE_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
- remoteDataSourceConfigurationList=null;
- }
-
- ImmutableList<ServerDataSourceConfiguration> serverDataSourceConfigurationList;
- ImmutableList<RemoteDataSourceConfiguration> remoteDataSourceConfigurationList;
-
public ImmutableList<RemoteDataSourceConfiguration> getRemoteDataSourceConfigurationList() {
if (remoteDataSourceConfigurationList == null) {
List<RemoteDataSourceConfiguration> configurations = new ArrayList<>(Arrays.asList(getRemoteDataSourceConfigurations()));
@@ -485,10 +471,17 @@ public class ClientConfig extends GeneratedClientConfig {
return option == null ? new ServerDataSourceConfiguration[0] : new Gson().fromJson(option, ServerDataSourceConfiguration[].class);
}
+ @Override
+ public void setServerDataSourceConfigurations(ServerDataSourceConfiguration[] configurations) {
+ String option = new Gson().toJson(configurations);
+ get().setOption(ClientConfigOption.SERVER_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
+ serverDataSourceConfigurationList = null;
+ }
+
public void addServerDataSourceConfiguration(ServerDataSourceConfiguration configuration) {
List<ServerDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
remoteDataSourceConfigurations.add(configuration);
- setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
saveForUser();
}
@@ -496,27 +489,18 @@ public class ClientConfig extends GeneratedClientConfig {
List<ServerDataSourceConfiguration> remoteDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
remoteDataSourceConfigurations.remove(configuration);
remoteDataSourceConfigurations.add(configuration);
- setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[remoteDataSourceConfigurations.size()]));
+ setServerDataSourceConfigurations(remoteDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
saveForUser();
}
public void removeServerDataSourceConfiguration(ServerDataSourceConfiguration configuration) {
List<ServerDataSourceConfiguration> serverDataSourceConfigurations = new ArrayList<>(Arrays.asList(getServerDataSourceConfigurations()));
serverDataSourceConfigurations.remove(configuration);
- setServerDataSourceConfigurations(serverDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[serverDataSourceConfigurations.size()]));
+ setServerDataSourceConfigurations(serverDataSourceConfigurations.toArray(new ServerDataSourceConfiguration[0]));
saveForUser();
}
@Override
- public void setServerDataSourceConfigurations(ServerDataSourceConfiguration[] configurations) {
- String option = new Gson().toJson(configurations);
- get().setOption(ClientConfigOption.SERVER_DATA_SOURCE_CONFIGURATIONS.getKey(), option);
- serverDataSourceConfigurationList=null;
- }
-
- private final SimpleDateFormat dateFormat = new SimpleDateFormat();
-
- @Override
public Date getBuildDate() {
String dateStr = get().getOption(ClientConfigOption.BUILD_DATE.getKey());
try {
=====================================
client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java
=====================================
--- /dev/null
+++ b/client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java
@@ -0,0 +1,64 @@
+package fr.ird.observe.client.configuration;
+
+/*-
+ * #%L
+ * ObServe :: Client Configuration
+ * %%
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ird.observe.services.service.data.NavigationRequest;
+
+/**
+ * Created by tchemit on 01/04/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public interface NavigationTreeConfig {
+
+ boolean isShowSeineTrip();
+
+ void setShowSeineTrip(boolean showSeineTrip);
+
+ boolean isShowLonglineTrip();
+
+ void setShowLonglineTrip(boolean showLonglineTrip);
+
+ boolean isShowReferential();
+
+ void setShowReferential(boolean showReferential);
+
+ boolean isShowEmptyProgram();
+
+ void setShowEmptyProgram(boolean showEmptyProgram);
+
+ default NavigationRequest toRequest() {
+ NavigationRequest navigationRequest = new NavigationRequest();
+ navigationRequest.setLoadLongline(isShowLonglineTrip());
+ navigationRequest.setLoadSeine(isShowSeineTrip());
+ navigationRequest.setLoadEmptyProgram(isShowEmptyProgram());
+ return navigationRequest;
+ }
+
+ default void load(NavigationTreeConfig config) {
+ setShowEmptyProgram(config.isShowEmptyProgram());
+ setShowReferential(config.isShowReferential());
+ setShowLonglineTrip(config.isShowLonglineTrip());
+ setShowSeineTrip(config.isShowSeineTrip());
+ }
+}
=====================================
client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java
=====================================
--- /dev/null
+++ b/client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java
@@ -0,0 +1,87 @@
+package fr.ird.observe.client.configuration;
+
+/*-
+ * #%L
+ * ObServe :: Client Configuration
+ * %%
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import io.ultreia.java4all.bean.AbstractJavaBean;
+
+/**
+ * Created by tchemit on 01/04/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public class NavigationTreeConfigBean extends AbstractJavaBean implements NavigationTreeConfig {
+
+
+ private boolean showSeineTrip = true;
+ private boolean showLonglineTrip = true;
+ private boolean showReferential = true;
+ private boolean showEmptyProgram = true;
+
+ @Override
+ public boolean isShowSeineTrip() {
+ return showSeineTrip;
+ }
+
+ @Override
+ public void setShowSeineTrip(boolean showSeineTrip) {
+ boolean oldValue = isShowSeineTrip();
+ this.showSeineTrip = showSeineTrip;
+ firePropertyChange("showSeineTrip", oldValue, showSeineTrip);
+ }
+
+ @Override
+ public boolean isShowLonglineTrip() {
+ return showLonglineTrip;
+ }
+
+ @Override
+ public void setShowLonglineTrip(boolean showLonglineTrip) {
+ boolean oldValue = isShowLonglineTrip();
+ this.showLonglineTrip = showLonglineTrip;
+ firePropertyChange("showLonglineTrip", oldValue, showLonglineTrip);
+ }
+
+ @Override
+ public boolean isShowReferential() {
+ return showReferential;
+ }
+
+ @Override
+ public void setShowReferential(boolean showReferential) {
+ boolean oldValue = isShowReferential();
+ this.showReferential = showReferential;
+ firePropertyChange("showReferential", oldValue, showReferential);
+ }
+
+ @Override
+ public boolean isShowEmptyProgram() {
+ return showEmptyProgram;
+ }
+
+ @Override
+ public void setShowEmptyProgram(boolean showEmptyProgram) {
+ boolean oldValue = isShowEmptyProgram();
+ this.showEmptyProgram = showEmptyProgram;
+ firePropertyChange("showEmptyProgram", oldValue, showEmptyProgram);
+ }
+}
=====================================
client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
+++ b/client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
@@ -33,6 +33,7 @@ observe.config.defaultTmpDirectory.description=Default temporary directory used
observe.config.defaultValidationReportDirectory.description=Default validation report directory
observe.config.devMode=Dev mode
observe.config.floatingObjectPresets.description=Floating Objects references
+observe.config.h2.can.editReferential.description=Local database can edit referential
observe.config.h2.can.migrate.description=Flag to know if you can migrate h2 data sources
observe.config.h2.login.description=H2 Login
observe.config.h2.password.description=H2 Password
@@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Species for object school
observe.config.speciesList.seine.schoolEstimate=Species for school esitmates
observe.config.speciesList.seine.targetCatch=Species for target catches
observe.config.swingSessionFile.description=Swing session file.
+observe.config.temperature.format=Default temperature format
observe.config.ui.autoPopupNumberEditor=Flag sets to true when number editor show automaticly popup
observe.config.ui.changeSynchroSrc=Flag sets to true if you can change local source in admin tasks
observe.config.ui.focusBorderColor=Color of the focus container border
@@ -85,6 +87,10 @@ observe.config.ui.showMnemonic=Show mnemonic on actions
observe.config.ui.showNumberEditorButton=Flag sets to true to show button to invoke popup on number's editors
observe.config.ui.showTimeEditorSlider=Show timer slider
observe.config.ui.storeRemoteStorage=Flag sets to true to store in config a remote connexion (except passwords)
+observe.config.ui.tree.showEmptyProgram.description=Show programs with no trip inside
+observe.config.ui.tree.showLonglineTrip.description=Show Longline trips
+observe.config.ui.tree.showReferential.description=Show Referential
+observe.config.ui.tree.showSeineTrip.description=Show Seine Trips
observe.config.ui.treeOpenNodes=Opened data from last session
observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source
observe.config.validation.lengthWeightEnable=Force validation of species length max
=====================================
client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
+++ b/client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
@@ -33,6 +33,7 @@ observe.config.defaultTmpDirectory.description=Directorio temporal por defecto
observe.config.defaultValidationReportDirectory.description=Directorio por defecto de almacenamiento de los informes de validación
observe.config.devMode=Modo desarrollador
observe.config.floatingObjectPresets.description=Objets flottants de référence \#TODO
+observe.config.h2.can.editReferential.description=Local database can edit referential \#TODO
observe.config.h2.can.migrate.description=Autorizar la actualización de las bases locales (h2)
observe.config.h2.login.description=Login h2
observe.config.h2.password.description=Contraseña h2
@@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Especies para las estimaci
observe.config.speciesList.seine.schoolEstimate=Especies para las estimaciones
observe.config.speciesList.seine.targetCatch=Especies par las capturas objetivo
observe.config.swingSessionFile.description=Fichier de sauvegarde des états des UI. \#TODO
+observe.config.temperature.format=Default temperature format \#TODO
observe.config.ui.autoPopupNumberEditor=Para mostrar automáticamente el editor numérico durante la edición de un número
observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
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
observe.config.ui.showNumberEditorButton=Para mostrar el botón que permite usar el editor numérico a la izquierda de cada campo numérico
observe.config.ui.showTimeEditorSlider=Para mostrar la regla de edición de las horas
observe.config.ui.storeRemoteStorage=Para activar la copia de seguridad de la configuración de la fuente de datos remota
+observe.config.ui.tree.showEmptyProgram.description=Show programs with no trip inside \#TODO
+observe.config.ui.tree.showLonglineTrip.description=Show Longline trips \#TODO
+observe.config.ui.tree.showReferential.description=Show Referential \#TODO
+observe.config.ui.tree.showSeineTrip.description=Show Seine Trips \#TODO
observe.config.ui.treeOpenNodes=Nudos abiertos del arbol abiertos cuando se cerró la base por última vez
observe.config.ui.treeSelectedNodes.description=Selected nodes on last data source \#TODO
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
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
+++ b/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é
observe.config.defaultValidationReportDirectory.description=Le répertoire par défaut où sont stockés les rapports de validation
observe.config.devMode=Mode développeur
observe.config.floatingObjectPresets.description=Objets flottants de référence
+observe.config.h2.can.editReferential.description=Pour pouvoir éditer le référentiel d'une base locale
observe.config.h2.can.migrate.description=Autoriser la mise à jour des bases locales (H2)
observe.config.h2.login.description=L'identifiant H2
observe.config.h2.password.description=Le mot de passe H2
@@ -74,6 +75,7 @@ observe.config.speciesList.seine.objectSchoolEstimate=Espèces pour les estimati
observe.config.speciesList.seine.schoolEstimate=Espèces pour les estimations
observe.config.speciesList.seine.targetCatch=Espèces pour les captures cible
observe.config.swingSessionFile.description=Fichier de sauvegarde des états des UI.
+observe.config.temperature.format=Unité de température
observe.config.ui.autoPopupNumberEditor=Pour afficher automatiquement l'éditeur numérique lors de l'édition d'un nombre
observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
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
observe.config.ui.showNumberEditorButton=Pour afficher le bouton qui permet d'utiliser l'éditeur numérique à gauche de chaque champs numérique
observe.config.ui.showTimeEditorSlider=Pour afficher la réglette d'édition des heures
observe.config.ui.storeRemoteStorage=Pour activer la sauvegarde de la configuration de la source distante
+observe.config.ui.tree.showEmptyProgram.description=Voir les programmes sans marée
+observe.config.ui.tree.showLonglineTrip.description=Voir les marées Palangre
+observe.config.ui.tree.showReferential.description=Voir le référentiel
+observe.config.ui.tree.showSeineTrip.description=Voir les marées Senne
observe.config.ui.treeOpenNodes=Nœuds de l'arbre ouverts lors de la dernière fermeture de la base
observe.config.ui.treeSelectedNodes.description=Nœuds sélectionnés sur la dernière base ouverte
observe.config.validation.lengthWeightEnable=Forcer la validation des bormes min/max de taille d'espèce
=====================================
client/pom.xml
=====================================
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -382,10 +382,20 @@
<artifactId>class-mapping</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all</groupId>
+ <artifactId>java-lang</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
<!-- jaxx dependencies -->
<dependency>
<groupId>io.ultreia.java4all.jaxx</groupId>
+ <artifactId>jaxx-runtime-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.ultreia.java4all.jaxx</groupId>
<artifactId>jaxx-runtime</artifactId>
</dependency>
<dependency>
=====================================
client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
@@ -61,10 +61,11 @@ public abstract class ObserveKeyStrokes {
public static final KeyStroke KEY_STROKE_RELOAD_DEFAULT_CONFIGURATION = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
public static final KeyStroke KEY_STROKE_ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
public static final KeyStroke KEY_STROKE_ENTER = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
- public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F1");
- public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F2");
- public static final KeyStroke KEY_STROKE_SHOW_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed F3");
- public static final KeyStroke KEY_STROKE_SHOW_EMPTY_PROGRAM = KeyStroke.getKeyStroke("ctrl pressed F4");
+ public static final KeyStroke KEY_STROKE_NAVIGATION_CONFIGURE = KeyStroke.getKeyStroke("ctrl pressed F1");
+ public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F2");
+ public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F3");
+ public static final KeyStroke KEY_STROKE_SHOW_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed F4");
+ public static final KeyStroke KEY_STROKE_SHOW_EMPTY_PROGRAM = KeyStroke.getKeyStroke("ctrl pressed F5");
public static final KeyStroke KEY_STROKE_CONFIGURE_LOCAL_SOURCE = KeyStroke.getKeyStroke("ctrl pressed L");
public static final KeyStroke KEY_STROKE_CONFIGURE_REMOTE_SOURCE = KeyStroke.getKeyStroke("ctrl pressed R");
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
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx
+++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx
@@ -77,8 +77,10 @@
fr.ird.observe.client.ui.content.ContentUIManager
fr.ird.observe.client.ui.content.ObserveActionMap
+ fr.ird.observe.client.ui.tree.navigation.NavigationUI
fr.ird.observe.client.ui.tree.navigation.NavigationTree
- fr.ird.observe.client.ui.tree.navigation.NavigationTreeHeader
+ fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel
+ fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel
fr.ird.observe.client.ui.util.UIHelper
fr.ird.observe.client.ui.util.ObserveBlockingLayerUI
@@ -252,10 +254,8 @@ protected void finalize() throws Throwable {
<!-- left : navigation -->
<JXTitledPanel id='navigationView'>
- <JScrollPane id='navigationScrollPane' columnHeaderView='{navigationTreeHeader}'>
- <NavigationTree id="navigation"/>
- <NavigationTreeHeader id='navigationTreeHeader' tree='{navigation}'/>
- </JScrollPane>
+ <NavigationUI id="navigationUI" initializer="new NavigationUI((JAXXContext)this)"/>
+ <NavigationTree id="navigation" initializer="navigationUI.getTree()"/>
</JXTitledPanel>
<!-- right : (content + messages) -->
=====================================
client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
@@ -6,15 +6,15 @@
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
+ *
+ * You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
@@ -32,7 +32,6 @@ import fr.ird.observe.client.ui.content.ContentUIManager;
import fr.ird.observe.client.ui.content.ObserveActionMap;
import fr.ird.observe.client.ui.tree.ObserveNavigationTreeShowPopupAction;
import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
-import fr.ird.observe.client.ui.tree.navigation.NavigationTreeHeader;
import fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel;
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
@@ -44,19 +43,14 @@ import fr.ird.observe.client.ui.util.UIHelper;
import fr.ird.observe.dto.decoration.DecoratorService;
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
import fr.ird.observe.dto.referential.ReferentialLocale;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Objects;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.I18n;
+import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
+import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
+import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
+import org.nuiton.jaxx.widgets.error.ErrorDialogUI;
+
import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.JSplitPane;
@@ -67,14 +61,16 @@ import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.TreePath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.i18n.I18n;
-import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
-import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
-import org.nuiton.jaxx.validator.swing.SwingValidatorUtil;
-import org.nuiton.jaxx.widgets.error.ErrorDialogUI;
-
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Objects;
import static fr.ird.observe.client.ui.content.ContentUIInitializer.OBSERVE_ACTION;
import static org.nuiton.i18n.I18n.t;
@@ -94,11 +90,87 @@ public class ObserveMainUIInitializer {
private static final String EMPTY_SELECTION = "emptySelection";
private final ObserveMainUI ui;
+ private Border focusBorder;
+ private Border noFocusBorder;
ObserveMainUIInitializer(ObserveMainUI ui) {
this.ui = ui;
}
+ /**
+ * Methode pour initialiser l'ui principale sans l'afficher.
+ *
+ * @param context le context applicatif
+ * @param config la configuration a utiliser
+ * @return l'ui instancie et initialisee mais non visible encore
+ */
+ public static ObserveMainUI initUI(ObserveSwingApplicationContext context, ClientConfig config) {
+
+ SwingValidatorMessageTableModel errorModel = new ObserveSwingValidatorMessageTableModel();
+
+ DecoratorService decoratorService = context.getDecoratorService();
+
+ boolean reloadDecorators = false;
+ Locale currentLocale = I18n.getDefaultLocale();
+ Locale configurationLocale = config.getLocale();
+ if (!configurationLocale.equals(currentLocale)) {
+ if (log.isInfoEnabled()) {
+ log.info("re-init I18n with locale " + configurationLocale);
+ }
+ I18n.setDefaultLocale(configurationLocale);
+ reloadDecorators = true;
+ }
+ if (!config.getDbLocale().equals(decoratorService.getReferentialLocale().getLocale())) {
+ if (log.isInfoEnabled()) {
+ log.info("re-init db with locale " + config.getDbLocale());
+ }
+ decoratorService.setReferentialLocale(ReferentialLocale.valueOf(config.getDbLocale()));
+
+ reloadDecorators = true;
+ }
+
+ if (reloadDecorators) {
+ if (log.isInfoEnabled()) {
+ log.info("reload decorators");
+ }
+ decoratorService.reload();
+ }
+
+ JAXXInitialContext tx = new JAXXInitialContext();
+ tx.add(context).add(errorModel);
+
+ // show main ui
+ ObserveMainUI ui = new ObserveMainUI(tx);
+ ui.setUndecorated(config.isFullScreen());
+
+ String title = t("observe.title.welcome.admin") + (" v " + config.getVersion());
+ ui.setTitle(title);
+
+ context.setMainUI(ui);
+
+ ErrorDialogUI.init(ui);
+
+ // set fullscreen propery on main ui
+ ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
+
+ new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationUI(), ui.getNavigationPopup());
+
+ return ui;
+ }
+
+ public static void setMainUIVisible(ObserveSwingApplicationContext rootContext, ObserveMainUI ui, boolean replace) {
+
+ // force le redimensionnement du splitpane
+ ui.getSplitpane().revalidate();
+
+ // force le redimensionnement du splitpane2
+ ui.getSplitpane2().revalidate();
+
+ // affichage de l'interface graphique
+ SwingUtilities.invokeLater(() -> ui.setVisible(true));
+ rootContext.getSwingSessionHelper().addComponent(ui, replace);
+ }
+
private void changeNavigationNode(TreeSelectionEvent event) {
ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource();
@@ -196,7 +268,7 @@ public class ObserveMainUIInitializer {
if (ui.getNavigation().equals(focusOwner)) {
focusOnNavigation = true;
}
- if (ui.getNavigationTreeHeader().equals(focusOwner)) {
+ if (ui.getNavigationUI().equals(focusOwner)) {
focusOnNavigation = true;
}
if (ui.getNavigationView().equals(focusOwner)) {
@@ -209,7 +281,7 @@ public class ObserveMainUIInitializer {
focusOnNavigation = true;
break;
}
- if (ui.getNavigationTreeHeader().equals(focusOwnerParent)) {
+ if (ui.getNavigationUI().equals(focusOwnerParent)) {
focusOnNavigation = true;
break;
}
@@ -243,67 +315,6 @@ public class ObserveMainUIInitializer {
}
/**
- * Methode pour initialiser l'ui principale sans l'afficher.
- *
- * @param context le context applicatif
- * @param config la configuration a utiliser
- * @return l'ui instancie et initialisee mais non visible encore
- */
- public static ObserveMainUI initUI(ObserveSwingApplicationContext context, ClientConfig config) {
-
- SwingValidatorMessageTableModel errorModel = new ObserveSwingValidatorMessageTableModel();
-
- DecoratorService decoratorService = context.getDecoratorService();
-
- boolean reloadDecorators = false;
- Locale currentLocale = I18n.getDefaultLocale();
- Locale configurationLocale = config.getLocale();
- if (!configurationLocale.equals(currentLocale)) {
- if (log.isInfoEnabled()) {
- log.info("re-init I18n with locale " + configurationLocale);
- }
- I18n.setDefaultLocale(configurationLocale);
- reloadDecorators = true;
- }
- if (!config.getDbLocale().equals(decoratorService.getReferentialLocale().getLocale())) {
- if (log.isInfoEnabled()) {
- log.info("re-init db with locale " + config.getDbLocale());
- }
- decoratorService.setReferentialLocale(ReferentialLocale.valueOf(config.getDbLocale()));
-
- reloadDecorators = true;
- }
-
- if (reloadDecorators) {
- if (log.isInfoEnabled()) {
- log.info("reload decorators");
- }
- decoratorService.reload();
- }
-
- JAXXInitialContext tx = new JAXXInitialContext();
- tx.add(context).add(errorModel);
-
- // show main ui
- ObserveMainUI ui = new ObserveMainUI(tx);
- ui.setUndecorated(config.isFullScreen());
-
- String title = t("observe.title.welcome.admin") + (" v " + config.getVersion());
- ui.setTitle(title);
-
- context.setMainUI(ui);
-
- ErrorDialogUI.init(ui);
-
- // set fullscreen propery on main ui
- ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null);
-
- new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationScrollPane(), ui.getNavigationPopup());
-
- return ui;
- }
-
- /**
* Permet de recharger l'ui principale et de changer de le mode
* d'affichage.
*
@@ -358,11 +369,7 @@ public class ObserveMainUIInitializer {
// on met à jour le modèle de navigation
NavigationTreeModel treeModel = ui.getNavigation().getTreeModel();
- treeModel.setLoadSeine(ui.getNavigationTreeHeader().getShowSeine().isSelected());
- treeModel.setLoadLongline(ui.getNavigationTreeHeader().getShowLongline().isSelected());
- treeModel.setLoadReferential(ui.getNavigationTreeHeader().getShowReferential().isSelected());
- treeModel.setLoadEmptyProgram(ui.getNavigationTreeHeader().getShowEmptyProgram().isSelected());
-
+ treeModel.load(config);
treeModel.populate();
// on conserve les noeuds a reselectionner
@@ -378,19 +385,6 @@ public class ObserveMainUIInitializer {
setMainUIVisible(rootContext, ui, true);
}
- public static void setMainUIVisible(ObserveSwingApplicationContext rootContext, ObserveMainUI ui, boolean replace) {
-
- // force le redimensionnement du splitpane
- ui.getSplitpane().revalidate();
-
- // force le redimensionnement du splitpane2
- ui.getSplitpane2().revalidate();
-
- // affichage de l'interface graphique
- SwingUtilities.invokeLater(() -> ui.setVisible(true));
- rootContext.getSwingSessionHelper().addComponent(ui, replace);
- }
-
void initialize() {
ObserveActionMap actionMap = ui.getObserveActionMap();
@@ -440,43 +434,43 @@ public class ObserveMainUIInitializer {
};
ui.getNavigationView().addMouseListener(mouseAdapter);
ui.getNavigation().addMouseListener(mouseAdapter);
- ui.getNavigationTreeHeader().addMouseListener(mouseAdapter);
+ ui.getNavigationUI().addMouseListener(mouseAdapter);
init(ui.getSplitpane());
init(ui.getSplitpane2());
init(ui.getNavigation());
- ui.getNavigationView().setRightDecoration(ui.getNavigationTreeHeader().getToolbar());
- ui.getNavigationView().addComponentListener(new ComponentAdapter() {
-
- @Override
- public void componentResized(ComponentEvent e) {
-
- JComponent source = (JComponent) e.getSource();
-
- NavigationTreeHeader actions = ui.getNavigationTreeHeader();
-
- Dimension preferredLayoutSize = actions.getLayout().preferredLayoutSize(actions);
-
- Dimension showLonglineSize = actions.getShowLongline().getSize();
- Dimension showSeineSize = actions.getShowSeine().getSize();
- Dimension showReferential = actions.getShowReferential().getSize();
- Dimension showEmpty = actions.getShowEmptyProgram().getSize();
- int minWidth = 18 + (int) Math.max(showLonglineSize.getWidth() + showSeineSize.getWidth(), showReferential.getWidth() + showEmpty.getWidth());
- source.setMinimumSize(new Dimension(minWidth, (int) source.getSize().getHeight()));
- log.debug("Header resized to minumun: " + source.getMinimumSize());
-
- int maxWidth = ui.getNavigationView().getWidth() - 10;
-
- int currentWidth = (int) preferredLayoutSize.getWidth();
- int height = 32;
- if (currentWidth > maxWidth) {
- height += 32;
- }
- actions.setPreferredSize(new Dimension(maxWidth, height));
-
- }
- });
+ ui.getNavigationView().setRightDecoration(ui.getNavigationUI().getToolbar());
+// ui.getNavigationView().addComponentListener(new ComponentAdapter() {
+//
+// @Override
+// public void componentResized(ComponentEvent e) {
+//
+// JComponent source = (JComponent) e.getSource();
+//
+// NavigationTreeHeader actions = ui.getNavigationUI();
+//
+// Dimension preferredLayoutSize = actions.getLayout().preferredLayoutSize(actions);
+//
+// Dimension showLonglineSize = actions.getShowLongline().getSize();
+// Dimension showSeineSize = actions.getShowSeine().getSize();
+// Dimension showReferential = actions.getShowReferential().getSize();
+// Dimension showEmpty = actions.getShowEmptyProgram().getSize();
+// int minWidth = 18 + (int) Math.max(showLonglineSize.getWidth() + showSeineSize.getWidth(), showReferential.getWidth() + showEmpty.getWidth());
+// source.setMinimumSize(new Dimension(minWidth, (int) source.getSize().getHeight()));
+// log.debug("Header resized to minumun: " + source.getMinimumSize());
+//
+// int maxWidth = ui.getNavigationView().getWidth() - 10;
+//
+// int currentWidth = (int) preferredLayoutSize.getWidth();
+// int height = 32;
+// if (currentWidth > maxWidth) {
+// height += 32;
+// }
+// actions.setPreferredSize(new Dimension(maxWidth, height));
+//
+// }
+// });
}
protected void init(ObserveActionMap actionMap, AbstractButton editor) {
@@ -498,9 +492,6 @@ public class ObserveMainUIInitializer {
}
- private Border focusBorder;
- private Border noFocusBorder;
-
private Border getFocusBorder() {
if (focusBorder == null) {
focusBorder = new LineBorder(ObserveSwingApplicationContext.get().getConfig().getFocusBorderColor(), 3, true);
@@ -549,7 +540,7 @@ public class ObserveMainUIInitializer {
/**
* Nettoye des ui tout ce qui concerne un modèle de navigation.
- * <p>
+ *
* <b>Note:</b> cette méthode doit être appelée avant tout rechargement de modèle de naivgation.
*
* @param progressModel progress model to interact with ui
@@ -576,7 +567,7 @@ public class ObserveMainUIInitializer {
/**
* Charge dans l'ui un nouveau modèle de navigation.
- * <p>
+ *
* <b>Note:</b> cette méthode doit être appelée après tout rechargement de modèle de naivgation.
*
* @param progressModel the progress model to interact with ui
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java
@@ -72,15 +72,15 @@ public class DataSynchroModel extends AdminActionModel {
super(AdminStep.DATA_SYNCHRONIZE);
// leftSelectionDataModel = new SelectionTreeModel();
-// leftSelectionDataModel.setLoadLongline(true);
-// leftSelectionDataModel.setLoadSeine(true);
-// leftSelectionDataModel.setLoadReferential(false);
+// leftSelectionDataModel.setShowLonglineTrip(true);
+// leftSelectionDataModel.setShowSeineTrip(true);
+// leftSelectionDataModel.setShowReferential(false);
// leftSelectionDataModel.setShowEmptyTrips(false);
//
// rightSelectionDataModel = new SelectionTreeModel();
-// rightSelectionDataModel.setLoadLongline(true);
-// rightSelectionDataModel.setLoadSeine(true);
-// rightSelectionDataModel.setLoadReferential(false);
+// rightSelectionDataModel.setShowLonglineTrip(true);
+// rightSelectionDataModel.setShowSeineTrip(true);
+// rightSelectionDataModel.setShowReferential(false);
// rightSelectionDataModel.setShowEmptyTrips(false);
tasks = new DefaultListModel<>();
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx
@@ -33,6 +33,7 @@
fr.ird.observe.client.constants.ValidationModelMode
org.nuiton.validator.NuitonValidatorScope
+ org.nuiton.i18n.I18n
java.io.File
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss
@@ -24,7 +24,7 @@
layout:{new BorderLayout()};
}
#referentialSynchronizeConfigPanel {
- border:{new TitledBorder(t("observe.actions.synchro.referential.config.mode"))};
+ border:{new TitledBorder(I18n.t("observe.actions.synchro.referential.config.mode"))};
}
#synchronizeMode {
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
+++ b/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>>
Action resetAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- beanComboBox.doActionPerformed__on__resetButton(null);
+ beanComboBox.getResetButton().doClick();
SwingUtilities.invokeLater(beanComboBox::grabFocus);
}
};
@@ -768,7 +768,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, new ArrayList<>(), new ArrayList<>());
JList<R> selectedList = list.getSelectedList();
- ListCellRenderer<? super R> renderer = selectedList.getCellRenderer();
+ ListCellRenderer renderer = selectedList.getCellRenderer();
selectedList.setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
list.getUniverseList().setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
@@ -795,7 +795,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, new ArrayList<>(), new ArrayList<>());
JList<R> selectedList = list.getSelectedList();
- ListCellRenderer<? super R> renderer = selectedList.getCellRenderer();
+ ListCellRenderer renderer = selectedList.getCellRenderer();
selectedList.setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
list.getUniverseList().setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
@@ -822,7 +822,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, Collections.emptyList());
JList<R> list1 = list.getList();
- ListCellRenderer<? super R> renderer = list1.getCellRenderer();
+ ListCellRenderer renderer = list1.getCellRenderer();
list1.setCellRenderer(new DataReferenceListCellRenderer<>(renderer));
}
@@ -847,7 +847,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
list.init(decorator, Collections.emptyList());
JList<R> list1 = list.getList();
- ListCellRenderer<? super R> renderer = list1.getCellRenderer();
+ ListCellRenderer renderer = list1.getCellRenderer();
list1.setCellRenderer(new ReferentialReferenceListCellRenderer<>(renderer));
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
+++ b/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jaxx
@@ -30,6 +30,8 @@
fr.ird.observe.client.ui.storage.tabs.SecurityModel
fr.ird.observe.client.ui.storage.StorageStep
fr.ird.observe.client.ui.storage.StorageUIModel
+
+ org.nuiton.i18n.I18n
</import>
<StorageStep id='step' initializer='StorageStep.ROLES'/>
@@ -44,7 +46,7 @@
<script><![CDATA[
public String updateAdministrateur(String role) {
- return t("observe.storage.security.administrateur", role);
+ return I18n.t("observe.storage.security.administrateur", role);
}
]]>
</script>
=====================================
client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
+++ b/client/src/main/java/fr/ird/observe/client/ui/storage/tabs/RolesUI.jcss
@@ -25,7 +25,7 @@
}
#administrateurPanel {
- border:{new TitledBorder(t("observe.storage.security.administrateur"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.administrateur"))};
layout:{new BorderLayout()};
}
@@ -43,13 +43,13 @@
}
#techniciens {
- border:{new TitledBorder(t("observe.storage.security.technicien"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.technicien"))};
}
#readers {
- border:{new TitledBorder(t("observe.storage.security.reader"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.reader"))};
}
#referentiels {
- border:{new TitledBorder(t("observe.storage.security.referentiel"))};
+ border:{new TitledBorder(I18n.t("observe.storage.security.referentiel"))};
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jaxx deleted
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jaxx
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- #%L
- ObServe :: Client
- %%
- Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel layout='{new FlowLayout(FlowLayout.LEFT, 2, 2)}'>
-
- <import>
- java.awt.FlowLayout
- </import>
-
- <JToggleButton id='showSeine' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
- <JToggleButton id='showLongline' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
- <JToggleButton id='showReferential' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
- <JToggleButton id='showEmptyProgram' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
-
- <NavigationTree id='tree' javaBean='new NavigationTree()'/>
-
- <JToolBar id='toolbar'>
- <JButton id='colapseAll' onActionPerformed='handler.collapseAll()'/>
- <JButton id='expandAll' onActionPerformed='handler.expandAll()'/>
- </JToolBar>
-
-</JPanel>
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeModel.java
+++ b/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;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
+import fr.ird.observe.client.configuration.ClientConfig;
+import fr.ird.observe.client.configuration.NavigationTreeConfigBean;
import fr.ird.observe.client.db.ObserveSwingDataSource;
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
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
import fr.ird.observe.client.ui.tree.navigation.nodes.seine.ProgramSeineNavigationTreeNode;
import fr.ird.observe.dto.data.longline.TripLonglineHelper;
import fr.ird.observe.dto.data.longline.TripLonglineReference;
-import fr.ird.observe.dto.referential.ProgramHelper;
-import fr.ird.observe.dto.referential.ProgramReference;
import fr.ird.observe.dto.data.seine.TripSeineHelper;
import fr.ird.observe.dto.data.seine.TripSeineReference;
+import fr.ird.observe.dto.referential.ProgramHelper;
+import fr.ird.observe.dto.referential.ProgramReference;
import fr.ird.observe.services.service.data.NavigationRequest;
import fr.ird.observe.services.service.data.NavigationResult;
import fr.ird.observe.services.service.data.NavigationService;
+
+import javax.swing.tree.DefaultTreeModel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import javax.swing.tree.DefaultTreeModel;
/**
* Created on 14/11/16.
@@ -55,44 +58,50 @@ import javax.swing.tree.DefaultTreeModel;
*/
public class NavigationTreeModel extends DefaultTreeModel {
- private boolean loadSeine = true;
- private boolean loadLongline = true;
- private boolean loadReferential = true;
- private boolean loadEmptyProgram = true;
+ private final NavigationTreeConfigBean config;
- public NavigationTreeModel() {
+ NavigationTreeModel() {
super(new RootNavigationTreeNode());
+ config = new NavigationTreeConfigBean();
}
- public NavigationTreeNodeSupport<?> findNode(NavigationTreeNodeSupport<?> node, Object... ids) {
- NavigationTreeNodeSupport<?> result = null;
- for (Object id : ids) {
+ public NavigationTreeConfigBean getConfig() {
+ return config;
+ }
- if (id instanceof String) {
- result = node.findChildById((String) id);
- } else if (id instanceof Class) {
- result = node.findChildByType((Class) id);
+ @Override
+ public RootNavigationTreeNode getRoot() {
+ return (RootNavigationTreeNode) super.getRoot();
+ }
- }
- if (result == null) {
+ public <N extends NavigationTreeNodeSupport> void reload(N node) {
+ node.reload();
+ super.reload(node);
+ }
- // un des noeud n'a pas ete trouve, on sortReferential
- break;
+ public <N extends NavigationTreeNodeSupport> void open(N node) {
+ if (node instanceof WithChildsToReload) {
+ boolean updated = node.populateChilds();
+ if (updated) {
+ reload(node);
}
- node = result;
}
- return result;
}
- public NavigationTreeNodeSupport<?> findNodeByType(NavigationTreeNodeSupport<?> node, Class<?> nodeType) {
- return node.findChildByType(nodeType);
+ public void save(ClientConfig config) {
+ config.load(this.config);
+ config.saveForUser();
+ }
+
+ public void load(ClientConfig config) {
+ this.config.load(config);
}
public void populate() {
NavigationService navigationService = ObserveSwingDataSource.MAIN.getNavigationService();
- NavigationRequest navigationRequest = toNavigationRequest();
+ NavigationRequest navigationRequest = config.toRequest();
NavigationResult navigationResult = navigationService.getNavigation(navigationRequest);
List<ProgramReference> programs = new ArrayList<>(navigationResult.getPrograms());
@@ -119,75 +128,38 @@ public class NavigationTreeModel extends DefaultTreeModel {
ProgramSeineNavigationTreeNode programNode = new ProgramSeineNavigationTreeNode(program, references);
root.add(programNode);
}
-
}
- if (isLoadReferential()) {
+ if (config.isShowReferential()) {
root.add(new ReferentialsCommonNavigationTreeNode());
root.add(new ReferentialsLonglineNavigationTreeNode());
root.add(new ReferentialsSeineNavigationTreeNode());
}
-
setRoot(root);
}
- private NavigationRequest toNavigationRequest() {
- NavigationRequest navigationRequest = new NavigationRequest();
- navigationRequest.setLoadLongline(isLoadLongline());
- navigationRequest.setLoadSeine(isLoadSeine());
- navigationRequest.setLoadEmptyProgram(isLoadEmptyProgram());
- return navigationRequest;
- }
-
- @Override
- public RootNavigationTreeNode getRoot() {
- return (RootNavigationTreeNode) super.getRoot();
- }
-
- public boolean isLoadSeine() {
- return loadSeine;
- }
-
- public void setLoadSeine(boolean loadSeine) {
- this.loadSeine = loadSeine;
- }
-
- public boolean isLoadLongline() {
- return loadLongline;
- }
-
- public void setLoadLongline(boolean loadLongline) {
- this.loadLongline = loadLongline;
- }
-
- public boolean isLoadReferential() {
- return loadReferential;
- }
-
- public void setLoadReferential(boolean loadReferential) {
- this.loadReferential = loadReferential;
- }
-
- public boolean isLoadEmptyProgram() {
- return loadEmptyProgram;
- }
+ NavigationTreeNodeSupport<?> findNode(NavigationTreeNodeSupport<?> node, Object... ids) {
+ NavigationTreeNodeSupport<?> result = null;
+ for (Object id : ids) {
- public void setLoadEmptyProgram(boolean loadEmptyProgram) {
- this.loadEmptyProgram = loadEmptyProgram;
- }
+ if (id instanceof String) {
+ result = node.findChildById((String) id);
+ } else if (id instanceof Class) {
+ result = node.findChildByType((Class) id);
- public <N extends NavigationTreeNodeSupport> void reload(N node) {
- node.reload();
- super.reload(node);
- }
+ }
+ if (result == null) {
- public <N extends NavigationTreeNodeSupport> void open(N node) {
- if (node instanceof WithChildsToReload) {
- boolean updated = node.populateChilds();
- if (updated) {
- reload(node);
+ // un des noeud n'a pas ete trouve, on sortReferential
+ break;
}
+ node = result;
}
+ return result;
+ }
+
+ NavigationTreeNodeSupport<?> findNodeByType(NavigationTreeNodeSupport<?> node, Class<?> nodeType) {
+ return node.findChildByType(nodeType);
}
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
=====================================
--- /dev/null
+++ b/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
@@ -0,0 +1,24 @@
+<JScrollPane id='navigationScrollPane' columnHeaderView='{toolbar}' viewportView="{tree}">
+
+ <import>
+ fr.ird.observe.client.configuration.NavigationTreeConfigBean
+ static org.nuiton.i18n.I18n.t
+ </import>
+ <NavigationTree id='tree' />
+ <NavigationTreeModel id='treeModel' javaBean='{tree.getTreeModel()}'/>
+ <NavigationTreeConfigBean id='navigationConfig' javaBean='treeModel.getConfig()'/>
+
+ <JPopupMenu id='configurePopup'>
+ <JCheckBoxMenuItem id='showSeineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ <JCheckBoxMenuItem id='showLonglineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ <JCheckBoxMenuItem id='showReferential' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ <JCheckBoxMenuItem id='showEmptyProgram' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
+ </JPopupMenu>
+
+ <JToolBar id='toolbar'>
+ <JButton id='colapseAll' onActionPerformed='handler.collapseAll()'/>
+ <JButton id='expandAll' onActionPerformed='handler.expandAll()'/>
+ <JToggleButton id='configure' onActionPerformed='handler.configure()'/>
+ </JToolBar>
+
+</JScrollPane>
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jcss → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeader.jcss
+++ b/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
@@ -8,36 +8,35 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
-#showSeine {
- selected: {tree.getTreeModel().isLoadSeine()};
+#showSeineTrip {
+ selected: {navigationConfig.isShowSeineTrip()};
text:"observe.constant.ObserveModelType.PS";
toolTipText:"observe.constant.ObserveModelType.PS.description";
}
-#showLongline {
- selected: {tree.getTreeModel().isLoadLongline()};
+#showLonglineTrip {
+ selected: {navigationConfig.isShowLonglineTrip()};
text:"observe.constant.ObserveModelType.LL";
toolTipText:"observe.constant.ObserveModelType.LL.description";
}
#showReferential {
- selected: {tree.getTreeModel().isLoadReferential()};
+ selected: {navigationConfig.isShowReferential()};
text:"observe.constant.ObserveModelType.REF";
toolTipText:"observe.constant.ObserveModelType.REF.description";
}
-
#showEmptyProgram {
- selected: {tree.getTreeModel().isLoadEmptyProgram()};
+ selected: {navigationConfig.isShowEmptyProgram()};
text:"observe.constant.ObserveModelType.EMPTY";
toolTipText:"observe.constant.ObserveModelType.EMPTY.description";
}
@@ -61,3 +60,8 @@ JButton {
actionIcon:expand;
toolTipText:"observe.tree.action.expandAll.tip";
}
+
+#configure {
+ actionIcon:generate;
+ toolTipText:"observe.tree.action.configure.tip";
+}
=====================================
client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeaderHandler.java → client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTreeHeaderHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
@@ -1,39 +1,11 @@
package fr.ird.observe.client.ui.tree.navigation;
-/*
- * #%L
- * ObServe :: Client
- * %%
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
import fr.ird.observe.client.ObserveSwingApplicationContext;
+import fr.ird.observe.client.configuration.ClientConfig;
+import fr.ird.observe.client.configuration.NavigationTreeConfig;
import fr.ird.observe.client.ui.ObserveKeyStrokes;
-import fr.ird.observe.client.ui.util.UIHelper;
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
-import fr.ird.observe.dto.referential.ProgramDto;
-import fr.ird.observe.dto.data.seine.TripSeineDto;
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import javax.swing.AbstractAction;
-import javax.swing.ActionMap;
-import javax.swing.InputMap;
-import javax.swing.JComponent;
+import fr.ird.observe.client.ui.util.UIHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.decorator.ColorHighlighter;
@@ -41,17 +13,29 @@ import org.jdesktop.swingx.search.Searchable;
import org.jdesktop.swingx.search.TreeSearchable;
import org.nuiton.jaxx.runtime.spi.UIHandler;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+
/**
- * @author Samuel Maisonneuve- maisonneuve(a)codelutin.com
+ * Created by tchemit on 01/04/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
*/
-public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHeader> {
+public class NavigationUIHandler implements UIHandler<NavigationUI> {
/** Logger */
- private static final Log log = LogFactory.getLog(NavigationTreeHeaderHandler.class);
+ private static final Log log = LogFactory.getLog(NavigationUIHandler.class);
- private NavigationTreeHeader ui;
+ private NavigationUI ui;
- public NavigationTreeHeader getUi() {
+ public NavigationUI getUi() {
return ui;
}
@@ -60,15 +44,15 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
}
@Override
- public void beforeInit(NavigationTreeHeader ui) {
+ public void beforeInit(NavigationUI ui) {
this.ui = ui;
}
@Override
- public void afterInit(NavigationTreeHeader ui) {
+ public void afterInit(NavigationUI ui) {
- ui.getShowSeine().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
- ui.getShowLongline().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
+ ui.getShowSeineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
+ ui.getShowLonglineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
ui.getShowReferential().setIcon(UIHelper.getUIManagerIcon("navigation.referentiel-16"));
ui.getShowEmptyProgram().setIcon(UIHelper.getUIManagerIcon("navigation.data.seine.TripSeine-16"));
@@ -77,10 +61,16 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
tree.setSearchable(searchable);
searchable.setMatchHighlighter(new ColorHighlighter(Color.YELLOW, Color.BLACK));
- ObserveKeyStrokes.addKeyStroke(ui.getShowSeine(), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
- ObserveKeyStrokes.addKeyStroke(ui.getShowLongline(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
+ ObserveKeyStrokes.addKeyStroke(ui.getShowSeineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
+ ObserveKeyStrokes.addKeyStroke(ui.getShowLonglineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
ObserveKeyStrokes.addKeyStroke(ui.getShowReferential(), ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL);
ObserveKeyStrokes.addKeyStroke(ui.getShowEmptyProgram(), ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM);
+ ObserveKeyStrokes.addKeyStroke(ui.getConfigure(), ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE);
+ //FIXME (no text, so no text after...)
+ ui.getConfigure().setText(null);
+ ClientConfig config = ObserveSwingApplicationContext.get().getConfig();
+ NavigationTreeModel treeModel = (NavigationTreeModel) tree.getModel();
+ treeModel.load(config);
InputMap inputMap = ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap actionMap = ui.getActionMap();
@@ -88,32 +78,66 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
actionMap.put("showSeine", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowSeine().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowSeineTrip().doClick();
+ }
+ ui.getConfigurePopup().setVisible(false);
}
});
inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE, "showLongline");
actionMap.put("showLongline", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowLongline().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowLonglineTrip().doClick();
+ }bre de
+ ui.getConfigurePopup().setVisible(false);
}
});
inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL, "showReferential");
actionMap.put("showReferential", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowReferential().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowReferential().doClick();
+ }
+ ui.getConfigurePopup().setVisible(false);
}
});
inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM, "showEmptyProgram");
actionMap.put("showEmptyProgram", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
- ui.getShowEmptyProgram().doClick();
+ if (ui.getConfigurePopup().isVisible()) {
+ ui.getShowEmptyProgram().doClick();
+ }
+ ui.getConfigurePopup().setVisible(false);
+ }
+ });
+ inputMap.put(ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE, "configure");
+ actionMap.put("configure", new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ui.getConfigure().doClick();
}
});
}
+ void configure() {
+ SwingUtilities.invokeLater(() -> {
+ JComponent c = ui.getConfigure();
+ JPopupMenu p = ui.getConfigurePopup();
+ if (p.isVisible()) {
+ p.setVisible(false);
+ return;
+ }
+ int width = ui.getParent().getWidth() - 5;
+ int height = p.getPreferredSize().height;
+ p.setPreferredSize(new Dimension(width, height));
+ p.show(c, (c.getWidth() == 0 ? 24 : c.getWidth()) - width + 2, c.getHeight());
+ });
+ }
+
public void search(String term) {
Searchable searchable = getTree().getSearchable();
@@ -121,7 +145,7 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
}
- public void tryToUpdateNavigationTree() {
+ void tryToUpdateNavigationTree() {
boolean canContinue = ObserveSwingApplicationContext.get().getContentUIManager().closeSelectedContentUI();
@@ -137,23 +161,24 @@ public class NavigationTreeHeaderHandler implements UIHandler<NavigationTreeHead
}
tree.clearSelection();
- boolean showSeine = ui.getShowSeine().isSelected();
- boolean showLongline = ui.getShowLongline().isSelected();
+ boolean showSeine = ui.getShowSeineTrip().isSelected();
+ boolean showLongline = ui.getShowLonglineTrip().isSelected();
boolean showReferential = ui.getShowReferential().isSelected();
boolean showEmptyProgram = ui.getShowEmptyProgram().isSelected();
NavigationTreeModel treeModel = tree.getTreeModel();
- treeModel.setLoadSeine(showSeine);
- treeModel.setLoadLongline(showLongline);
- treeModel.setLoadReferential(showReferential);
- treeModel.setLoadEmptyProgram(showEmptyProgram);
-
+ NavigationTreeConfig navigationTreeConfig = treeModel.getConfig();
+ navigationTreeConfig.setShowSeineTrip(showSeine);
+ navigationTreeConfig.setShowLonglineTrip(showLongline);
+ navigationTreeConfig.setShowReferential(showReferential);
+ navigationTreeConfig.setShowEmptyProgram(showEmptyProgram);
+ treeModel.save(ObserveSwingApplicationContext.get().getConfig());
treeModel.populate();
-
//FIXME repositionner le nœud sélectionné
if (!treeModel.getRoot().isLeaf()) {
tree.setSelectionRow(0);
}
+ ui.getConfigure().setSelected(false);
}
public void collapseAll() {
=====================================
client/src/main/resources/i18n/client_en_GB.properties
=====================================
--- a/client/src/main/resources/i18n/client_en_GB.properties
+++ b/client/src/main/resources/i18n/client_en_GB.properties
@@ -1488,6 +1488,7 @@ observe.title.storage.info=Storage details
observe.title.unique.key=Unique keys used in a referentiel
observe.title.welcome.admin=ObServe
observe.tree.action.collapseAll.tip=Collapse all
+observe.tree.action.configure.tip=Configure
observe.tree.action.expandAll.tip=Expand all
observe.tree.action.selectAll.tip=Select All
observe.tree.action.unselectAll.tip=Unselect All
=====================================
client/src/main/resources/i18n/client_es_ES.properties
=====================================
--- a/client/src/main/resources/i18n/client_es_ES.properties
+++ b/client/src/main/resources/i18n/client_es_ES.properties
@@ -1488,6 +1488,7 @@ observe.title.storage.info=Información sobre la fuente de datos
observe.title.unique.key=Ids de negocio del referencial %1$s
observe.title.welcome.admin=ObServe
observe.tree.action.collapseAll.tip=Cerrar los nudos
+observe.tree.action.configure.tip=Configure \#TODO
observe.tree.action.expandAll.tip=Abrir los nudos
observe.tree.action.selectAll.tip=Seleccionar todo
observe.tree.action.unselectAll.tip=Deseleccionar todo
=====================================
client/src/main/resources/i18n/client_fr_FR.properties
=====================================
--- a/client/src/main/resources/i18n/client_fr_FR.properties
+++ b/client/src/main/resources/i18n/client_fr_FR.properties
@@ -1488,6 +1488,7 @@ observe.title.storage.info=Information sur la source de données
observe.title.unique.key=Clefs métier du référentiel %1$s
observe.title.welcome.admin=ObServe
observe.tree.action.collapseAll.tip=Tout grouper
+observe.tree.action.configure.tip=Configurer
observe.tree.action.expandAll.tip=Tout déplier
observe.tree.action.selectAll.tip=Tout sélectionner
observe.tree.action.unselectAll.tip=Tout désélectionner
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
<packaging>pom</packaging>
<name>ObServe :: Pom</name>
- <description>Projet ObServe</description>
+ <description>Project ObServe</description>
<url>https://ultreiaio.gitlab.io/ird-observe</url>
<inceptionYear>2008</inceptionYear>
<organization>
@@ -142,10 +142,10 @@
<projectId>ird-observe</projectId>
<stageId>frirdobserve</stageId>
- <!-- dev version (for develop purpose -->
+ <!-- dev version -->
<devMode>true</devMode>
- <!--Modèle version-->
+ <!--persistence model version-->
<observe.model.version>7.0</observe.model.version>
<!-- build timestamp configuration -->
@@ -157,7 +157,7 @@
<!--<eugenePluginVersion>3.0-alpha-13</eugenePluginVersion>-->
<!--<processorPluginVersion>1.3</processorPluginVersion>-->
- <lib.version.java4all.jaxx>3.0-alpha-12</lib.version.java4all.jaxx>
+ <lib.version.java4all.jaxx>3.0-alpha-26</lib.version.java4all.jaxx>
<lib.version.nuiton.topia>3.3</lib.version.nuiton.topia>
<lib.version.nuiton.validation>3.1</lib.version.nuiton.validation>
<xworkVersion>2.3.34</xworkVersion>
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/2e66cbe9569a34d5d033b9317ec…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/2e66cbe9569a34d5d033b9317ec…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 4 commits: improve longline position api (but still could be improved ?)
by Tony CHEMIT 01 Apr '18
by Tony CHEMIT 01 Apr '18
01 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
0c820790 by Tony CHEMIT at 2018-04-01T09:22:55Z
improve longline position api (but still could be improved ?)
- - - - -
1491da9a by Tony CHEMIT at 2018-04-01T09:22:59Z
improve sql request api (requires now db version)
- - - - -
9f65eea2 by Tony CHEMIT at 2018-04-01T09:22:59Z
optimize dependences + add missing license header
- - - - -
4cd6cb75 by Tony CHEMIT at 2018-04-01T09:22:59Z
fix a template
- - - - -
30 changed files:
- client/src/main/ftl/dataSourceConnectionReport_en.ftl
- client/src/main/ftl/dataSourceConnectionReport_es.ftl
- client/src/main/ftl/dataSourceConnectionReport_fr.ftl
- client/src/main/java/fr/ird/observe/client/ui/admin/save/SaveLocalUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LonglinePositionHelper.java
- client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIModel.java
- dto/src/main/java/fr/ird/observe/binder/data/longline/BasketDtoReferenceBinder.java
- dto/src/main/java/fr/ird/observe/binder/data/longline/BranchlineDtoReferenceBinder.java
- − dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdDto.java
- dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdReference.java
- − dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdDto.java
- dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdReference.java
- dto/src/main/models/Observe.model
- persistence/pom.xml
- persistence/src/main/java/fr/ird/observe/binder/data/longline/BasketEntityReferenceBinder.java
- persistence/src/main/java/fr/ird/observe/binder/data/longline/BranchlineEntityReferenceBinder.java
- persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaApplicationContext.java
- persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaConfiguration.java
- + persistence/src/main/resources/hibernate.properties
- services-local/src/main/java/fr/ird/observe/services/local/ObserveJdbcHelper.java
- services-local/src/main/java/fr/ird/observe/services/local/ObserveServiceContextLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/ObserveServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/LonglinePositionSetDtoHelper.java
- services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
- services-local/src/test/java/fr/ird/observe/services/local/service/sql/MigrateTestsDatabases.java
- services-local/src/test/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocalTest.java
- services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerRequest.java
Changes:
=====================================
client/src/main/ftl/dataSourceConnectionReport_en.ftl
=====================================
--- a/client/src/main/ftl/dataSourceConnectionReport_en.ftl
+++ b/client/src/main/ftl/dataSourceConnectionReport_en.ftl
@@ -57,14 +57,14 @@
<li>
<!--FIXME Bavencoff 17/03/2016 use decorator-->
- [${program.getPropertyValue("gearTypePrefix")}] Programme ${program.getPropertyValue("label")}
+ [${program.getGearTypePrefix()}] Programme ${program.getLabel()}
<ul>
<#list selectDataModel.getSelectedTripsByProgram(program) as trip>
<li>
<!--FIXME Bavencoff 17/03/2016 use decorator-->
- ${trip.getPropertyValue("startDate")?date?string.short} - ${trip.getPropertyValue("endDate")?date?string.short} - ${trip.getPropertyValue("vessel")} - ${trip.getPropertyValue("observer")}
+ ${trip.getStartDate()?date?string.short} - ${trip.getEndDate()?date?string.short} - ${trip.getVesselLabel()} - ${trip.getObserverLabel()}
</li>
</#list>
=====================================
client/src/main/ftl/dataSourceConnectionReport_es.ftl
=====================================
--- a/client/src/main/ftl/dataSourceConnectionReport_es.ftl
+++ b/client/src/main/ftl/dataSourceConnectionReport_es.ftl
@@ -62,14 +62,14 @@
<li>
<!--FIXME Bavencoff 17/03/2016 use decorator-->
- [${program.getPropertyValue("gearTypePrefix")}] Programa ${program.getPropertyValue("label")}
+ [${program.getGearTypePrefix()}] Programa ${program.getLabel()}
<ul>
<#list selectDataModel.getSelectedTripsByProgram(program) as trip>
<li>
<!--FIXME Bavencoff 17/03/2016 use decorator-->
- ${trip.getPropertyValue("startDate")?date?string.short} - ${trip.getPropertyValue("endDate")?date?string.short} - ${trip.getPropertyValue("vessel")} - ${trip.getPropertyValue("observer")}
+ ${trip.getStartDate()?date?string.short} - ${trip.getEndDate()?date?string.short} - ${trip.getVesselLabel()} - ${trip.getObserverLabel()}
</li>
</#list>
=====================================
client/src/main/ftl/dataSourceConnectionReport_fr.ftl
=====================================
--- a/client/src/main/ftl/dataSourceConnectionReport_fr.ftl
+++ b/client/src/main/ftl/dataSourceConnectionReport_fr.ftl
@@ -57,14 +57,14 @@
<li>
<!--FIXME Bavencoff 17/03/2016 use decorator-->
- [${program.getPropertyValue("gearTypePrefix")}] Programme ${program.getPropertyValue("label")}
+ [${program.getGearTypePrefix()}] Programme ${program.getLabel()}
<ul>
<#list selectDataModel.getSelectedTripsByProgram(program) as trip>
<li>
<!--FIXME Bavencoff 17/03/2016 use decorator-->
- ${trip.getPropertyValue("startDate")?date?string.short} - ${trip.getPropertyValue("endDate")?date?string.short} - ${trip.getPropertyValue("vessel")} - ${trip.getPropertyValue("observer")}
+ ${trip.getStartDate()?date?string.short} - ${trip.getEndDate()?date?string.short} - ${trip.getVesselLabel()} - ${trip.getObserverLabel()}
</li>
</#list>
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/save/SaveLocalUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/save/SaveLocalUIHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/save/SaveLocalUIHandler.java
@@ -140,7 +140,7 @@ public class SaveLocalUIHandler extends AdminTabUIHandler<SaveLocalUI> implement
File backupFile = stepModel.getBackupFile();
SqlScriptProducerService dumpService = source.getSqlScriptProducerService();
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(source.getVersion()).addSchema().addReferential().addAllData();
byte[] dump = dumpService.produceAddSqlScript(request).getSqlCode();
try (FileOutputStream outputStream = new FileOutputStream(backupFile)) {
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LonglinePositionHelper.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LonglinePositionHelper.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LonglinePositionHelper.java
@@ -268,39 +268,31 @@ public class LonglinePositionHelper<D extends LonglinePositionAwareDto> {
}
- protected SectionReference getSection(BasketReference basket) {
-
- String sectionId = ((BasketWithSectionIdReference) basket).getSectionId();
-
+ private SectionReference getSection(BasketReference basket) {
+ String sectionId = basket.getSectionId();
return sectionUniverse.stream()
.filter(s -> sectionId.equals(s.getId()))
.findFirst()
.orElse(null);
-
}
- protected BasketReference getBasket(BranchlineReference branchline) {
-
- String basketId = ((BranchlineWithBasketIdReference) branchline).getBasketId();
-
+ private BasketReference getBasket(BranchlineReference branchline) {
+ String basketId = branchline.getBasketId();
return basketUniverse.stream()
.filter(b -> basketId.equals(b.getId()))
.findFirst()
.orElse(null);
-
}
- protected List<BasketReference> getBaskets(SectionReference section) {
-
+ private List<BasketReference> getBaskets(SectionReference section) {
return basketUniverse.stream()
- .filter(b -> section.getId().equals(((BasketWithSectionIdReference) b).getSectionId()))
+ .filter(b -> section.getId().equals(b.getSectionId()))
.collect(Collectors.toList());
}
- protected List<BranchlineReference> getBranchlines(BasketReference basket) {
-
+ private List<BranchlineReference> getBranchlines(BasketReference basket) {
return branchlineUniverse.stream()
- .filter(b -> basket.getId().equals(((BranchlineWithBasketIdReference) b).getBasketId()))
+ .filter(b -> basket.getId().equals(b.getBasketId()))
.collect(Collectors.toList());
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIHandler.java
@@ -655,7 +655,7 @@ public class StorageUIHandler implements UIHandler<StorageUI> {
log.debug(dst);
}
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveSwingApplicationContext.get().getConfig().getModelVersion()).addSchema().addReferential().addAllData();
byte[] dataDump = dumpProducerService.produceAddSqlScript(request).getSqlCode();
try (FileOutputStream outputStream = new FileOutputStream(dst)) {
=====================================
client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/storage/StorageUIModel.java
@@ -1546,7 +1546,7 @@ public class StorageUIModel extends WizardModel<StorageStep> {
SqlScriptProducerService dumpService = source.getSqlScriptProducerService();
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(source.getVersion()).addSchema().addReferential();
byte[] dump = dumpService.produceAddSqlScript(request).getSqlCode();
result.setImportDatabase(dump);
=====================================
dto/src/main/java/fr/ird/observe/binder/data/longline/BasketDtoReferenceBinder.java
=====================================
--- a/dto/src/main/java/fr/ird/observe/binder/data/longline/BasketDtoReferenceBinder.java
+++ b/dto/src/main/java/fr/ird/observe/binder/data/longline/BasketDtoReferenceBinder.java
@@ -41,7 +41,7 @@ public class BasketDtoReferenceBinder extends DataDtoReferenceBinder<BasketDto,
@Override
public BasketReference toReference(ReferentialLocale referentialLocale, BasketDto dto) {
- return new BasketReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier());
+ return new BasketReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier(), null);
}
}
=====================================
dto/src/main/java/fr/ird/observe/binder/data/longline/BranchlineDtoReferenceBinder.java
=====================================
--- a/dto/src/main/java/fr/ird/observe/binder/data/longline/BranchlineDtoReferenceBinder.java
+++ b/dto/src/main/java/fr/ird/observe/binder/data/longline/BranchlineDtoReferenceBinder.java
@@ -41,7 +41,7 @@ public class BranchlineDtoReferenceBinder extends DataDtoReferenceBinder<Branchl
@Override
public BranchlineReference toReference(ReferentialLocale referentialLocale, BranchlineDto dto) {
- return new BranchlineReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier());
+ return new BranchlineReference(dto, dto.getSettingIdentifier(), dto.getHaulingIdentifier(), null);
}
}
=====================================
dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdDto.java deleted
=====================================
--- a/dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdDto.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package fr.ird.observe.dto.data.longline;
-
-/*-
- * #%L
- * ObServe :: Dto
- * %%
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-public class BasketWithSectionIdDto extends BasketDto {
-
- private static final long serialVersionUID = 3690753995685507632L;
-
- public static final String PROPERTY_SECTION_ID = "sectionId";
-}
=====================================
dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdReference.java
=====================================
--- a/dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdReference.java
+++ b/dto/src/main/java/fr/ird/observe/dto/data/longline/BasketWithSectionIdReference.java
@@ -34,10 +34,11 @@ public class BasketWithSectionIdReference extends BasketReference {
private final String sectionId;
public BasketWithSectionIdReference(DtoReferenceAware dto, Integer settingIdentifier, Integer haulingIdentifier, String sectionId) {
- super(dto, settingIdentifier, haulingIdentifier);
+ super(dto, settingIdentifier, haulingIdentifier, sectionId);
this.sectionId = sectionId;
}
+ @Override
public String getSectionId() {
return sectionId;
}
=====================================
dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdDto.java deleted
=====================================
--- a/dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdDto.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package fr.ird.observe.dto.data.longline;
-
-/*-
- * #%L
- * ObServe :: Dto
- * %%
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-public class BranchlineWithBasketIdDto extends BranchlineDto {
-
- private static final long serialVersionUID = 7018072108318352694L;
-
- public static final String PROPERTY_BASKET_ID = "basketId";
-
-}
=====================================
dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdReference.java
=====================================
--- a/dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdReference.java
+++ b/dto/src/main/java/fr/ird/observe/dto/data/longline/BranchlineWithBasketIdReference.java
@@ -10,12 +10,12 @@ package fr.ird.observe.dto.data.longline;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -34,11 +34,12 @@ public class BranchlineWithBasketIdReference extends BranchlineReference {
private final String basketId;
public BranchlineWithBasketIdReference(DtoReferenceAware dto, Integer settingIdentifier, Integer haulingIdentifier, String basketId) {
- super(dto, settingIdentifier, haulingIdentifier);
+ super(dto, settingIdentifier, haulingIdentifier, basketId);
this.basketId = basketId;
}
+ @Override
public String getBasketId() {
return basketId;
}
=====================================
dto/src/main/models/Observe.model
=====================================
--- a/dto/src/main/models/Observe.model
+++ b/dto/src/main/models/Observe.model
@@ -109,14 +109,15 @@ individualWeight + {*:1} Float
baitSettingStatus {*:1} fr.ird.observe.dto.referential.longline.BaitSettingStatusReference
baitType {*:1} fr.ird.observe.dto.referential.longline.BaitTypeReference
-data.longline.Basket > data.Data >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier
+data.longline.Basket > data.Data >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier,sectionId
settingIdentifier + {*:1} Integer
haulingIdentifier + {*:1} Integer
floatline1Length + {*:1} Float
floatline2Length + {*:1} Float
branchline + {*} data.longline.Branchline | ordered unique
+section + {*:1} fr.ird.observe.dto.data.longline.SectionReference
-data.longline.Branchline > data.Commentable >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier
+data.longline.Branchline > data.Commentable >> data.longline.LonglineCompositionDto | references=settingIdentifier,haulingIdentifier,basketId
settingIdentifier + {*:1} Integer
haulingIdentifier + {*:1} Integer
depthRecorder + {*:1} Boolean
@@ -139,6 +140,7 @@ hookType {*:0..1} fr.ird.observe.dto.referential.longline.HookTypeReference
tracelineType {*:0..1} fr.ird.observe.dto.referential.longline.LineTypeReference
topType {*:0..1} fr.ird.observe.dto.referential.longline.LineTypeReference
baitType {*:0..1} fr.ird.observe.dto.referential.longline.BaitTypeReference
+basket + {*:1} fr.ird.observe.dto.data.longline.BasketReference
data.longline.BranchlinesComposition > data.Data | references=topTypeLabel,tracelineTypeLabel,length,proportion
length + {*:1} Float
=====================================
persistence/pom.xml
=====================================
--- a/persistence/pom.xml
+++ b/persistence/pom.xml
@@ -133,6 +133,11 @@
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<scope>runtime</scope>
@@ -140,6 +145,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-hikaricp</artifactId>
+ <scope>runtime</scope>
</dependency>
<!-- test -->
@@ -277,6 +283,26 @@
</executions>
</plugin>
+ <plugin>
+ <groupId>org.hibernate.orm.tooling</groupId>
+ <artifactId>hibernate-enhance-maven-plugin</artifactId>
+ <version>${lib.version.hibernate}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <failOnError>true</failOnError>
+ <enableLazyInitialization>true</enableLazyInitialization>
+ <enableDirtyTracking>true</enableDirtyTracking>
+ <enableAssociationManagement>true</enableAssociationManagement>
+ <enableExtendedEnhancement>false</enableExtendedEnhancement>
+ </configuration>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
</project>
=====================================
persistence/src/main/java/fr/ird/observe/binder/data/longline/BasketEntityReferenceBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/data/longline/BasketEntityReferenceBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/data/longline/BasketEntityReferenceBinder.java
@@ -27,6 +27,7 @@ import fr.ird.observe.dto.referential.ReferentialLocale;
import fr.ird.observe.dto.data.longline.BasketDto;
import fr.ird.observe.dto.data.longline.BasketReference;
import fr.ird.observe.entities.longline.Basket;
+import fr.ird.observe.entities.longline.Section;
/**
* Created on 24/11/15.
@@ -39,10 +40,13 @@ public class BasketEntityReferenceBinder extends DataEntityReferenceBinderSuppor
super(BasketDto.class, BasketReference.class, Basket.class);
}
+ public BasketReference toReference(Basket entity, Section section) {
+ return new BasketReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), section.getTopiaId());
+ }
+
@Override
public BasketReference toReference(ReferentialLocale referentialLocale, Basket entity) {
-
- return new BasketReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier());
+ return new BasketReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), null);
}
}
=====================================
persistence/src/main/java/fr/ird/observe/binder/data/longline/BranchlineEntityReferenceBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/data/longline/BranchlineEntityReferenceBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/data/longline/BranchlineEntityReferenceBinder.java
@@ -23,9 +23,10 @@ package fr.ird.observe.binder.data.longline;
*/
import fr.ird.observe.binder.data.DataEntityReferenceBinderSupport;
-import fr.ird.observe.dto.referential.ReferentialLocale;
import fr.ird.observe.dto.data.longline.BranchlineDto;
import fr.ird.observe.dto.data.longline.BranchlineReference;
+import fr.ird.observe.dto.referential.ReferentialLocale;
+import fr.ird.observe.entities.longline.Basket;
import fr.ird.observe.entities.longline.Branchline;
/**
@@ -39,10 +40,13 @@ public class BranchlineEntityReferenceBinder extends DataEntityReferenceBinderSu
super(BranchlineDto.class, BranchlineReference.class, Branchline.class);
}
+ public BranchlineReference toReference(Branchline entity, Basket basket) {
+ return new BranchlineReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), basket.getTopiaId());
+ }
+
@Override
public BranchlineReference toReference(ReferentialLocale referentialLocale, Branchline entity) {
-
- return new BranchlineReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier());
+ return new BranchlineReference(entity, entity.getSettingIdentifier(), entity.getHaulingIdentifier(), null);
}
}
=====================================
persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaApplicationContext.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaApplicationContext.java
+++ b/persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaApplicationContext.java
@@ -279,33 +279,6 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat
log.info(String.format("For TripSeine, found %d tables to use.", tripSeineTables.size()));
}
return tripSeineTables;
-
- /*
- return TopiaSqlTables.builder(filterTable, ObserveEntityEnum.TripSeine) // → TripSeine
- .addAndEnterJoinTable(ObserveEntityEnum.GearUseFeaturesSeine) // → GearUseFeaturesSeine
- .addJoinTable(ObserveEntityEnum.GearUseFeaturesMeasurementSeine)
- .backToParent() // ← TripSeine
- .addAndEnterJoinTable(ObserveEntityEnum.Route) // → Route
- .addAndEnterJoinTable(ObserveEntityEnum.ActivitySeine) // → ActivitySeine
- .addAndEnterReverseJoinTable(ObserveEntityEnum.SetSeine) // → SetSeine
- .addJoinTable(ObserveEntityEnum.SchoolEstimate)
- .addJoinTable(ObserveEntityEnum.NonTargetCatch)
- .addJoinTable(ObserveEntityEnum.TargetCatch)
- .addAndEnterJoinTable(ObserveEntityEnum.TargetSample) // → TargetSample
- .addJoinTable(ObserveEntityEnum.TargetLength)
- .backToParent() // ← SetSeine
- .addAndEnterJoinTable(ObserveEntityEnum.NonTargetSample) // → NonTargetSample
- .addJoinTable(ObserveEntityEnum.NonTargetLength)
- .backToParent() // ← SetSeine
- .backToParent() // ← ActivitySeine
- .addAssociationTable(ObserveEntityEnum.ObservedSystem.name(), true)
- .addAndEnterJoinTable(ObserveEntityEnum.FloatingObject) // → FloatingObject
- .addJoinTable(ObserveEntityEnum.ObjectObservedSpecies)
- .addJoinTable(ObserveEntityEnum.ObjectSchoolEstimate)
- .addJoinTable(ObserveEntityEnum.TransmittingBuoy)
- .build();
- */
-
}
public TopiaSqlTables getTripLonglineTables() {
@@ -346,43 +319,9 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat
null);
tripLonglineTables.replaceTable("observe_longline.branchline", branchlineTable);
-
-
}
return tripLonglineTables;
-
- /*
- return TopiaSqlTables.builder(filterTable, ObserveEntityEnum.TripLongline) // → TripLongline
- .addAndEnterJoinTable(ObserveEntityEnum.GearUseFeaturesLongline) // → GearUseFeaturesLongline
- .addJoinTable(ObserveEntityEnum.GearUseFeaturesMeasurementLongline)
- .backToParent() // ← TripLongline
- .addAndEnterJoinTable(ObserveEntityEnum.ActivityLongline) // → ActivityLongline
- .addAndEnterReverseJoinTable(ObserveEntityEnum.SetLongline) // → SetLongline
- .addJoinTable(ObserveEntityEnum.BaitsComposition)
- .addJoinTable(ObserveEntityEnum.FloatlinesComposition)
- .addJoinTable(ObserveEntityEnum.HooksComposition)
- .addJoinTable(ObserveEntityEnum.BranchlinesComposition)
- .addAssociationTable(ObserveEntityEnum.MitigationType.name(), true)
- .addAndEnterJoinTable(ObserveEntityEnum.Section) // → Section
- .addAndEnterJoinTable(ObserveEntityEnum.Basket) // → Basket
- .addJoinTable(ObserveEntityEnum.Branchline)
- .backToParent() // ← Section
- .backToParent() // ← SetLongline
- .addAndEnterJoinTable(ObserveEntityEnum.CatchLongline) // → CatchLongline
- .addJoinTable(ObserveEntityEnum.SizeMeasure)
- .addJoinTable(ObserveEntityEnum.WeightMeasure)
- .addAssociationTable("Predator", true)
- .backToParent() // ← SetLongline
- .addAndEnterJoinTable(ObserveEntityEnum.Tdr) // → Tdr
- .addJoinTable(ObserveEntityEnum.TdrRecord)
- .addAssociationTable(ObserveEntityEnum.Species.name(), true)
- .backToParent() // ← SetLongline
- .backToParent() // ← ActivityLongline
- .addJoinTable(ObserveEntityEnum.Encounter)
- .addJoinTable(ObserveEntityEnum.SensorUsed)
- .build();
- */
- }
+}
public TopiaSqlTables getReferentialTables() {
@@ -391,139 +330,9 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat
referentialTables = topiaSqlTablesFactory.newReplicateEntityTables(
new TripReplicateTablesPredicate(),
Entities.REFERENCE_ENTITIES);
-// ObserveEntityEnum.VesselSizeCategory,
-// ObserveEntityEnum.Country,
-// ObserveEntityEnum.Harbour,
-// ObserveEntityEnum.VesselType,
-// ObserveEntityEnum.Vessel,
-// ObserveEntityEnum.Ocean,
-// ObserveEntityEnum.SpeciesGroup,
-// ObserveEntityEnum.Species,
-// ObserveEntityEnum.Sex,
-// ObserveEntityEnum.FpaZone,
-// ObserveEntityEnum.SpeciesList,
-// ObserveEntityEnum.Person,
-// ObserveEntityEnum.Organism,
-// ObserveEntityEnum.LengthWeightParameter,
-// ObserveEntityEnum.Program,
-// ObserveEntityEnum.GearCaracteristicType,
-// ObserveEntityEnum.GearCaracteristic,
-// ObserveEntityEnum.Gear,
-// ObserveEntityEnum.LastUpdateDate,
-// ObserveEntityEnum.VesselActivitySeine,
-// ObserveEntityEnum.SurroundingActivity,
-// ObserveEntityEnum.ReasonForNullSet,
-// ObserveEntityEnum.ReasonForNoFishing,
-// ObserveEntityEnum.SpeciesFate,
-// ObserveEntityEnum.ObjectFate,
-// ObserveEntityEnum.WeightCategory,
-// ObserveEntityEnum.DetectionMode,
-// ObserveEntityEnum.TransmittingBuoyOperation,
-// ObserveEntityEnum.ObjectOperation,
-// ObserveEntityEnum.ReasonForDiscard,
-// ObserveEntityEnum.SpeciesStatus,
-// ObserveEntityEnum.ObservedSystem,
-// ObserveEntityEnum.TransmittingBuoyType,
-// ObserveEntityEnum.ObjectType,
-// ObserveEntityEnum.Wind,
-// ObserveEntityEnum.BaitHaulingStatus,
-// ObserveEntityEnum.BaitSettingStatus,
-// ObserveEntityEnum.BaitType,
-// ObserveEntityEnum.CatchFateLongline,
-// ObserveEntityEnum.EncounterType,
-// ObserveEntityEnum.Healthness,
-// ObserveEntityEnum.HookPosition,
-// ObserveEntityEnum.HookSize,
-// ObserveEntityEnum.HookType,
-// ObserveEntityEnum.ItemVerticalPosition,
-// ObserveEntityEnum.ItemHorizontalPosition,
-// ObserveEntityEnum.LightsticksColor,
-// ObserveEntityEnum.LightsticksType,
-// ObserveEntityEnum.LineType,
-// ObserveEntityEnum.MaturityStatus,
-// ObserveEntityEnum.MitigationType,
-// ObserveEntityEnum.SensorBrand,
-// ObserveEntityEnum.SensorDataFormat,
-// ObserveEntityEnum.SensorType,
-// ObserveEntityEnum.SettingShape,
-// ObserveEntityEnum.SizeMeasureType,
-// ObserveEntityEnum.StomacFullness,
-// ObserveEntityEnum.TripType,
-// ObserveEntityEnum.VesselActivityLongline,
-// ObserveEntityEnum.WeightMeasureType);
}
log.info(String.format("For Referential, found %d tables to use.", referentialTables.size()));
return referentialTables;
-
- /*
-
- return TopiaSqlTables.builder()
- .addMainTable(ObserveEntityEnum.VesselSizeCategory) // → VesselSizeCategory
- .addMainTable(ObserveEntityEnum.Country) // → Country
- .addMainTable(ObserveEntityEnum.Harbour) // → Harbour
- .addMainTable(ObserveEntityEnum.VesselType) // → VesselType
- .addMainTable(ObserveEntityEnum.Vessel) // → Vessel
- .addMainTable(ObserveEntityEnum.Ocean) // → Ocean
- .addMainTable(ObserveEntityEnum.SpeciesGroup) // → SpeciesGroup
- .addMainTable(ObserveEntityEnum.Species) // → Species
- .addAssociationTable(ObserveEntityEnum.Ocean.name(), false)
- .addMainTable(ObserveEntityEnum.Sex) // → Sex
- .addMainTable(ObserveEntityEnum.FpaZone) // → FpaZone
- .addMainTable(ObserveEntityEnum.SpeciesList) // → SpeciesList
- .addAssociationTable(ObserveEntityEnum.Species.name(), false)
- .addMainTable(ObserveEntityEnum.Person) // → Person
- .addMainTable(ObserveEntityEnum.Organism) // → Organism
- .addMainTable(ObserveEntityEnum.LengthWeightParameter) // → LengthWeightParameter
- .addMainTable(ObserveEntityEnum.Program) // → Program
- .addMainTable(ObserveEntityEnum.GearCaracteristicType) // → GearCaracteristicType
- .addMainTable(ObserveEntityEnum.GearCaracteristic) // → GearCaracteristic
- .addMainTable(ObserveEntityEnum.Gear) // → Gear
- .addAssociationTable(ObserveEntityEnum.GearCaracteristic.name(), false)
- .addMainTable(ObserveEntityEnum.LastUpdateDate) // → LastUpdateDate
- .addMainTable(ObserveEntityEnum.VesselActivitySeine) // → VesselActivitySeine
- .addMainTable(ObserveEntityEnum.SurroundingActivity) // → SurroundingActivity
- .addMainTable(ObserveEntityEnum.ReasonForNullSet) // → ReasonForNullSet
- .addMainTable(ObserveEntityEnum.ReasonForNoFishing) // → ReasonForNoFishing
- .addMainTable(ObserveEntityEnum.SpeciesFate) // → SpeciesFate
- .addMainTable(ObserveEntityEnum.ObjectFate) // → ObjectFate
- .addMainTable(ObserveEntityEnum.WeightCategory) // → WeightCategory
- .addMainTable(ObserveEntityEnum.DetectionMode) // → DetectionMode
- .addMainTable(ObserveEntityEnum.TransmittingBuoyOperation) // → TransmittingBuoyOperation
- .addMainTable(ObserveEntityEnum.ObjectOperation) // → ObjectOperation
- .addMainTable(ObserveEntityEnum.ReasonForDiscard) // → ReasonForDiscard
- .addMainTable(ObserveEntityEnum.SpeciesStatus) // → SpeciesStatus
- .addMainTable(ObserveEntityEnum.ObservedSystem) // → ObservedSystem
- .addMainTable(ObserveEntityEnum.TransmittingBuoyType) // → TransmittingBuoyType
- .addMainTable(ObserveEntityEnum.ObjectType) // → ObjectType
- .addMainTable(ObserveEntityEnum.Wind) // → Wind
- .addMainTable(ObserveEntityEnum.BaitHaulingStatus) // → BaitHaulingStatus
- .addMainTable(ObserveEntityEnum.BaitSettingStatus) // → BaitSettingStatus
- .addMainTable(ObserveEntityEnum.BaitType) // → BaitType
- .addMainTable(ObserveEntityEnum.CatchFateLongline) // → CatchFateLongline
- .addMainTable(ObserveEntityEnum.EncounterType) // → EncounterType
- .addMainTable(ObserveEntityEnum.Healthness) // → Healthness
- .addMainTable(ObserveEntityEnum.HookPosition) // → HookPosition
- .addMainTable(ObserveEntityEnum.HookSize) // → HookSize
- .addMainTable(ObserveEntityEnum.HookType) // → HookType
- .addMainTable(ObserveEntityEnum.ItemVerticalPosition) // → ItemVerticalPosition
- .addMainTable(ObserveEntityEnum.ItemHorizontalPosition) // → ItemHorizontalPosition
- .addMainTable(ObserveEntityEnum.LightsticksColor) // → LightsticksColor
- .addMainTable(ObserveEntityEnum.LightsticksType) // → LightsticksType
- .addMainTable(ObserveEntityEnum.LineType) // → LineType
- .addMainTable(ObserveEntityEnum.MaturityStatus) // → MaturityStatus
- .addMainTable(ObserveEntityEnum.MitigationType) // → MitigationType
- .addMainTable(ObserveEntityEnum.SensorBrand) // → SensorBrand
- .addMainTable(ObserveEntityEnum.SensorDataFormat) // → SensorDataFormat
- .addMainTable(ObserveEntityEnum.SensorType) // → SensorType
- .addMainTable(ObserveEntityEnum.SettingShape) // → SettingShape
- .addMainTable(ObserveEntityEnum.SizeMeasureType) // → SizeMeasureType
- .addMainTable(ObserveEntityEnum.StomacFullness) // → StomacFullness
- .addMainTable(ObserveEntityEnum.TripType) // → TripType
- .addMainTable(ObserveEntityEnum.VesselActivityLongline) // → VesselActivityLongline
- .addMainTable(ObserveEntityEnum.WeightMeasureType) // → WeightMeasureType
-
- .build();
-*/
}
public <E extends ObserveReferentialEntity> TopiaSqlTables getReferentialTable(Class<E> entityType) {
=====================================
persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaConfiguration.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaConfiguration.java
+++ b/persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaConfiguration.java
@@ -22,7 +22,11 @@ package fr.ird.observe.persistence;
* #L%
*/
-import org.hibernate.hikaricp.internal.HikariCPConnectionProvider;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
import org.nuiton.topia.persistence.BeanTopiaConfiguration;
import org.nuiton.topia.persistence.HibernateAvailableSettings;
import org.nuiton.topia.persistence.jdbc.JdbcConfiguration;
@@ -36,27 +40,37 @@ public class ObserveTopiaConfiguration extends BeanTopiaConfiguration {
private static final long serialVersionUID = 1L;
- protected final boolean h2Configuration;
+ private final boolean h2Configuration;
protected final boolean showSql;
+ private static final Map<String, String> HIBERNATE_GLOBAL_PROPERTIES;
+
+ static {
+
+ Properties p = new Properties();
+ try (InputStream stream = ObserveTopiaPersistenceContext.class.getResourceAsStream("/hibernate.properties")) {
+ try {
+ p.load(stream);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ HIBERNATE_GLOBAL_PROPERTIES = new TreeMap<>();
+ for (String s : p.stringPropertyNames()) {
+ HIBERNATE_GLOBAL_PROPERTIES.put(s, p.getProperty(s));
+ }
+
+ }
public ObserveTopiaConfiguration(JdbcConfiguration jdbcConfiguration, boolean h2Configuration, boolean showSql) {
super(jdbcConfiguration);
this.h2Configuration = h2Configuration;
this.showSql = showSql;
if (showSql) {
- hibernateExtraConfiguration.put("hibernate.show_sql", Boolean.TRUE.toString());
+ hibernateExtraConfiguration.put(HibernateAvailableSettings.SHOW_SQL, Boolean.TRUE.toString());
}
-
- hibernateExtraConfiguration.put(HibernateAvailableSettings.CONNECTION_PROVIDER, HikariCPConnectionProvider.class.getName());
- hibernateExtraConfiguration.put("hibernate.hikari.minimumIdle", "2");
- hibernateExtraConfiguration.put("hibernate.hikari.maximumPoolSize", "20");
- hibernateExtraConfiguration.put("hibernate.hikari.autoCommit", "false");
- hibernateExtraConfiguration.put("hibernate.hikari.registerMbeans", "true");
-
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.CONNECTION_PROVIDER, "org.hibernate.c3p0.internal.C3P0ConnectionProvider");
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.C3P0_MAX_SIZE, "500");
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.C3P0_MAX_STATEMENTS, "500");
-// hibernateExtraConfiguration.put(HibernateAvailableSettings.C3P0_TIMEOUT, "100");
+ hibernateExtraConfiguration.putAll(HIBERNATE_GLOBAL_PROPERTIES);
}
public boolean isH2Configuration() {
=====================================
persistence/src/main/resources/hibernate.properties
=====================================
--- /dev/null
+++ b/persistence/src/main/resources/hibernate.properties
@@ -0,0 +1,29 @@
+###
+# #%L
+# ObServe :: Persistence
+# %%
+# Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/gpl-3.0.html>.
+# #L%
+###
+hibernate.bytecode.provider=bytebuddy
+hibernate.use_sql_comments=false
+hibernate.format_sql=false
+hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider
+hibernate.hikari.minimumIdle=2
+hibernate.hikari.maximumPoolSize=20
+hibernate.hikari.autoCommit=false
+#hibernate.hikari.registerMbeans=true
=====================================
services-local/src/main/java/fr/ird/observe/services/local/ObserveJdbcHelper.java
=====================================
--- a/services-local/src/main/java/fr/ird/observe/services/local/ObserveJdbcHelper.java
+++ b/services-local/src/main/java/fr/ird/observe/services/local/ObserveJdbcHelper.java
@@ -68,13 +68,20 @@ public class ObserveJdbcHelper extends JdbcHelper {
while (observerDataPrivilege.next()) {
String security = observerDataPrivilege.getString("PRIVILEGE");
+ String grantor = observerDataPrivilege.getString("GRANTOR");
String grantee = observerDataPrivilege.getString("GRANTEE");
// Il se peut que le login soit echappe sous la forme \"login\"
+ grantor= grantor.replaceAll("\\\\\"", "");
grantee = grantee.replaceAll("\\\\\"", "");
if (log.isDebugEnabled()) {
log.debug(String.format("(security %s) - grantee (%s)", security, grantee));
}
- if (grantee.equals(jdbcConfiguration.getJdbcConnectionUser())) {
+ if (grantor.equals(jdbcConfiguration.getJdbcConnectionUser())) {
+ if (log.isDebugEnabled()) {
+ log.debug("for " + tableName + " table " + grantor + '/' + security);
+ }
+ tablePrivileges.add(security);
+ } else if (grantee.equals(jdbcConfiguration.getJdbcConnectionUser())) {
if (log.isDebugEnabled()) {
log.debug("for " + tableName + " table " + grantee + '/' + security);
}
=====================================
services-local/src/main/java/fr/ird/observe/services/local/ObserveServiceContextLocal.java
=====================================
--- a/services-local/src/main/java/fr/ird/observe/services/local/ObserveServiceContextLocal.java
+++ b/services-local/src/main/java/fr/ird/observe/services/local/ObserveServiceContextLocal.java
@@ -88,7 +88,7 @@ public class ObserveServiceContextLocal {
return observeServiceInitializer.withDataSourceConnection();
}
- Optional<ObserveDataSourceConnectionTopia> getDataSourceConnection() {
+ public Optional<ObserveDataSourceConnectionTopia> getDataSourceConnection() {
//noinspection unchecked
return (Optional) observeServiceInitializer.getDataSourceConnection();
}
=====================================
services-local/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocal.java
=====================================
--- a/services-local/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocal.java
+++ b/services-local/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocal.java
@@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -26,7 +26,6 @@ import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
-import fr.ird.observe.spi.DbModelHelper;
import fr.ird.observe.dto.db.ObserveDbUserDto;
import fr.ird.observe.dto.reference.ReferentialDtoReference;
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
@@ -55,13 +54,7 @@ import fr.ird.observe.services.service.DatabaseDestroyNotAuthorizedException;
import fr.ird.observe.services.service.DatabaseNotFoundException;
import fr.ird.observe.services.service.sql.AddSqlScriptProducerRequest;
import fr.ird.observe.services.service.sql.SqlScriptProducerService;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.util.Optional;
-import java.util.Set;
-import java.util.UUID;
-import java.util.stream.Collectors;
+import fr.ird.observe.spi.DbModelHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.persistence.jdbc.JdbcHelper;
@@ -69,7 +62,15 @@ import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity;
import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
import org.nuiton.topia.persistence.metadata.TopiaMetadataModelVisitor;
import org.nuiton.version.Version;
+import org.nuiton.version.Versions;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import java.util.stream.Collectors;
import static org.nuiton.i18n.I18n.l;
@@ -234,7 +235,7 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS
temporaryTopiaApplicationContext.getMigrationService().runSchemaMigration();
SqlScriptProducerService dumpProducerService = serviceContext.newService(temporaryConfiguration, SqlScriptProducerService.class);
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential().addAllData();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres(dataSourceConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
byte[] dump = dumpProducerService.produceAddSqlScript(request).getSqlCode();
topiaApplicationContext.executeSqlStatements(dump);
topiaApplicationContext.getMigrationService().createSchemaIfNotExist();
@@ -283,11 +284,12 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS
ObserveDataSourceConfiguration importDataSourceConfiguration = dataSourceCreateConfiguration.getImportReferentialDataSourceConfiguration();
+ Version dbVersion = Versions.valueOf(topiaApplicationContext.getModelVersion());
AddSqlScriptProducerRequest request;
if (((ObserveDataSourceConfigurationTopiaSupport) dataSourceConfiguration).isH2Database()) {
- request = AddSqlScriptProducerRequest.forH2();
+ request = AddSqlScriptProducerRequest.forH2(dbVersion);
} else {
- request = AddSqlScriptProducerRequest.forPostgres();
+ request = AddSqlScriptProducerRequest.forPostgres(dbVersion);
}
request.addReferential();
@@ -319,12 +321,12 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS
ObserveDataSourceConfiguration importDataSourceConfiguration = dataSourceCreateConfiguration.getImportDataDataSourceConfiguration();
-
+ Version dbVersion = Versions.valueOf(topiaApplicationContext.getModelVersion());
AddSqlScriptProducerRequest request;
if (((ObserveDataSourceConfigurationTopiaSupport) dataSourceConfiguration).isH2Database()) {
- request = AddSqlScriptProducerRequest.forH2();
+ request = AddSqlScriptProducerRequest.forH2(dbVersion);
} else {
- request = AddSqlScriptProducerRequest.forPostgres();
+ request = AddSqlScriptProducerRequest.forPostgres(dbVersion);
}
if (!referantialImported) {
@@ -612,8 +614,8 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS
if (log.isDebugEnabled()) {
log.debug("User can write referential : " + writeReferential + ", " +
- "read data : " + readData + ", " +
- "write data : " + writeData + ".");
+ "read data : " + readData + ", " +
+ "write data : " + writeData + ".");
}
ObserveMigrationConfigurationProvider observeMigrationConfigurationProvider = ObserveMigrationConfigurationProvider.get();
=====================================
services-local/src/main/java/fr/ird/observe/services/local/service/ObserveServiceLocal.java
=====================================
--- a/services-local/src/main/java/fr/ird/observe/services/local/service/ObserveServiceLocal.java
+++ b/services-local/src/main/java/fr/ird/observe/services/local/service/ObserveServiceLocal.java
@@ -166,9 +166,7 @@ import org.nuiton.topia.persistence.TopiaNoResultException;
*/
public abstract class ObserveServiceLocal implements ObserveService {
- /**
- * Logger.
- */
+ /** Logger. */
private static final Log log = LogFactory.getLog(ObserveServiceLocal.class);
protected static final DataDtoEntityPersistenceContext<TripSeineDto, TripSeineReference, TripSeine, TripSeineTopiaDao> TRIP_SEINE_SPI =
@@ -289,21 +287,6 @@ public abstract class ObserveServiceLocal implements ObserveService {
return serviceContext.getTopiaPersistenceContext();
}
-// protected <D extends IdDto, E extends ObserveEntity> void deleteEntity(Class<D> dtoType, Class<E> entityType, Iterable<String> ids) {
-// ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
-// TopiaDao<E> dao = persistenceContext.getDao(entityType);
-// for (String id : ids) {
-// E entity = dao.forTopiaIdEquals(id).findUniqueOrNull();
-// if (entity == null) {
-// throw new DataNotFoundException(dtoType, id);
-// }
-// dao.delete(entity);
-// }
-//
-// updateLastUpdateDate(entityType);
-//
-// }
-
public <E extends ObserveEntity> void updateLastUpdateDate(Class<E> entityType) {
getTopiaPersistenceContext().updateLastUpdateDate(entityType, now());
}
@@ -331,35 +314,6 @@ public abstract class ObserveServiceLocal implements ObserveService {
}
- // protected <E extends ObserveDataEntity, D extends DataDto> Form<D> dataEntityToForm(Class<D> dtoType, E entity) {
-//
-// D dto = DbModelHelper.fromDataDto(dtoType).toDto(serviceContext.getReferentialLocale(), dtoType, entity);
-// return Form.newFormDto(dtoType, dto);
-//
-// }
-//
-//
-// protected <E extends ObserveDataEntity, D extends DataDto> void copyDataDtoToEntity(D dto, E entity) {
-//
-// DbModelHelper.fromDataDto(dto).copyToEntity(serviceContext.getReferentialLocale(), dto, entity);
-//
-// }
-
-//
-// protected <E extends ObserveDataEntity, D extends DataDto> E loadOrCreateEntityFromDataDto(D dto) {
-//
-// Class<E> entityType = DbModelHelper.fromDataDto(dto).toEntityType();
-//
-// E entity;
-// if (dto.isPersisted()) {
-// entity = loadEntity(dto.get(), dto.getId());
-// } else {
-// entity = getTopiaPersistenceContext().newEntity(entityType);
-// }
-// return entity;
-// }
-
-
protected <E extends ObserveEntity, D extends IdDto> void checkLastUpdateDate(E entity, D dto) {
if (entity.isPersisted()) {
@@ -382,14 +336,6 @@ public abstract class ObserveServiceLocal implements ObserveService {
return serviceContext.now();
}
- // protected <D extends DataDto, E extends ObserveDataEntity> D loadEntityToDataDto(Class<D> dtoType, String id) {
-//
-// E entity = loadEntity(dtoType, id);
-// DataEntityDtoBinderSupport<D, E> binder = DbModelHelper.fromDataDto(dtoType).toEntityBinder();
-// return binder.toDto(getReferentialLocale(), entity);
-//
-// }
-//
public <D extends ReferentialDto, E extends ObserveReferentialEntity> D loadEntityToReferentialDto(ReferentialEntityDtoBinderSupport<D, E> binder, String id) {
E entity = loadEntity(binder.getDtoType(), id);
@@ -397,29 +343,6 @@ public abstract class ObserveServiceLocal implements ObserveService {
}
-// protected <D extends DataDto, R extends DataDtoReference<D, R>, E extends ObserveDataEntity> R loadEntityToDataReferenceDto(Class<D> dtoType, String id) {
-//
-// E entity = loadEntity(dtoType, id);
-//
-// DataEntityReferenceBinderSupport<D, R, E> dataBinderFromDto = DbModelHelper.fromDataDto(dtoType).toEntityReferenceBinder();
-// return dataBinderFromDto.toReference(getReferentialLocale(), entity);
-//
-// }
-
-// protected <E extends ObserveEntity> boolean existsEntity(Class<E> entityType, String id) {
-// ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
-// TopiaDao<E> dao = persistenceContext.getDao(entityType);
-// return dao.forTopiaIdEquals(id).exists();
-// }
-
-// protected <D extends DataDto, R extends DataDtoReference<D, R>, E extends ObserveDataEntity> R toReference(Class<R> referenceType, E entity) {
-//
-// DataEntityReferenceBinderSupport<D, R, E> binder = DbModelHelper.fromDataReference(referenceType).toEntityReferenceBinder();
-//
-// return binder.toReference(getReferentialLocale(), entity);
-//
-// }
-
protected <D extends DataDto, E extends ObserveDataEntity, R extends DataDtoReference<D, R>> DataDtoReferenceSet<R> toDataReferenceSet(DataEntityReferenceBinderSupport<D, R, E> binder, Collection<E> entities) {
ReferentialLocale referentialLocale = getReferentialLocale();
@@ -455,13 +378,13 @@ public abstract class ObserveServiceLocal implements ObserveService {
protected DataFileDto newDataFileDto(Blob data, String dataFilename) {
DataFileDto dto = new DataFileDto();
try {
- // on copie le blob pour supprimer le lien entre la blob venant de la base et la connexion à la base
+ // copy blob
int length = (int) data.length();
byte[] bytes = data.getBytes(1, length);
dto.setContent(bytes);
} catch (SQLException e) {
if (log.isErrorEnabled()) {
- log.error("unable to read blod from " + dataFilename, e);
+ log.error("unable to read blob from " + dataFilename, e);
}
}
dto.setName(dataFilename);
=====================================
services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java
=====================================
--- a/services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java
+++ b/services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java
@@ -44,6 +44,7 @@ import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.StringUtil;
+import org.nuiton.version.Version;
/**
* Created on 20/07/16.
@@ -76,9 +77,9 @@ public class TripManagementServiceLocal extends ObserveServiceLocal implements T
if (log.isInfoEnabled()) {
log.info("Start export of trip: " + tripId);
}
+ Version dbVersion = serviceContext.getDataSourceConnection().orElseThrow(IllegalStateException::new).getVersion();
- AddSqlScriptProducerRequest request;
- request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres() : AddSqlScriptProducerRequest.forH2())
+ AddSqlScriptProducerRequest request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres(dbVersion) : AddSqlScriptProducerRequest.forH2(dbVersion))
.dataIdsToAdd(ImmutableSet.of(tripId));
AddSqlScriptProducerResult producerResult = sqlScriptProducerService.produceAddSqlScript(request);
byte[] tripContent = producerResult.getSqlCode();
=====================================
services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/LonglinePositionSetDtoHelper.java
=====================================
--- a/services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/LonglinePositionSetDtoHelper.java
+++ b/services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/LonglinePositionSetDtoHelper.java
@@ -10,22 +10,23 @@ package fr.ird.observe.services.local.service.data.longline;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
+import fr.ird.observe.binder.data.longline.BasketEntityReferenceBinder;
+import fr.ird.observe.binder.data.longline.BranchlineEntityReferenceBinder;
+import fr.ird.observe.binder.data.longline.SectionEntityReferenceBinder;
import fr.ird.observe.dto.data.longline.BasketReference;
-import fr.ird.observe.dto.data.longline.BasketWithSectionIdReference;
import fr.ird.observe.dto.data.longline.BranchlineReference;
-import fr.ird.observe.dto.data.longline.BranchlineWithBasketIdReference;
import fr.ird.observe.dto.data.longline.LonglinePositionAwareDto;
import fr.ird.observe.dto.data.longline.LonglinePositionSetDto;
import fr.ird.observe.dto.data.longline.SectionReference;
@@ -39,27 +40,30 @@ import fr.ird.observe.entities.longline.SetLongline;
*/
class LonglinePositionSetDtoHelper {
+ private static final SectionEntityReferenceBinder SECTION_BINDER = new SectionEntityReferenceBinder();
+ private static final BasketEntityReferenceBinder BASKET_BINDER = new BasketEntityReferenceBinder();
+ private static final BranchlineEntityReferenceBinder BRANCHLINE_BINDER = new BranchlineEntityReferenceBinder();
+
+
// constitution des références des position sur la ligne
static void loadPositionSet(SetLongline setLongline, LonglinePositionSetDto target) {
for (Section section : setLongline.getSection()) {
- SectionReference sectionRef = toSectionReference(section);
+ SectionReference sectionReference = SECTION_BINDER.toReference(null, section);
- target.addSections(sectionRef);
+ target.addSections(sectionReference);
for (Basket basket : section.getBasket()) {
- BasketWithSectionIdReference basketRef = toBasketReference(basket, section);
+ BasketReference basketReference = BASKET_BINDER.toReference(basket, section);
- target.addBaskets(basketRef);
+ target.addBaskets(basketReference);
for (Branchline branchline : basket.getBranchline()) {
- BranchlineWithBasketIdReference branchlineRef = toBranchlineReference(branchline, basket);
-
- target.addBranchlines(branchlineRef);
-
+ BranchlineReference branchlineReference = BRANCHLINE_BINDER.toReference(branchline, basket);
+ target.addBranchlines(branchlineReference);
}
}
@@ -74,21 +78,21 @@ class LonglinePositionSetDtoHelper {
if (basketRef != null) {
- BasketReference basketRefWithSection = positionSetDto.getBaskets().stream()
+ BasketReference basketReference = positionSetDto.getBaskets().stream()
.filter(b -> basketRef.getId().equals(b.getId()))
.findFirst()
.orElse(null);
- positionDto.setBasket(basketRefWithSection);
+ positionDto.setBasket(basketReference);
}
- BranchlineReference branchlineRef = positionDto.getBranchline();
+ BranchlineReference branchlineReference = positionDto.getBranchline();
- if (branchlineRef != null) {
+ if (branchlineReference != null) {
BranchlineReference branchlineRefWithSection = positionSetDto.getBranchlines().stream()
- .filter(b -> branchlineRef.getId().equals(b.getId()))
+ .filter(b -> branchlineReference.getId().equals(b.getId()))
.findFirst()
.orElse(null);
@@ -97,19 +101,4 @@ class LonglinePositionSetDtoHelper {
}
}
- private static SectionReference toSectionReference(Section section) {
-
- return new SectionReference(section, section.getSettingIdentifier(), section.getHaulingIdentifier());
- }
-
- private static BasketWithSectionIdReference toBasketReference(Basket basket, Section section) {
-
- return new BasketWithSectionIdReference(basket, basket.getSettingIdentifier(), basket.getHaulingIdentifier(), section.getTopiaId());
- }
-
- private static BranchlineWithBasketIdReference toBranchlineReference(Branchline branchline, Basket basket) {
-
- return new BranchlineWithBasketIdReference(branchline, branchline.getSettingIdentifier(), branchline.getHaulingIdentifier(), basket.getTopiaId());
- }
-
}
=====================================
services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
=====================================
--- a/services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
+++ b/services-local/src/main/java/fr/ird/observe/services/local/service/referential/ReferentialServiceLocal.java
@@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.referential;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -63,6 +63,14 @@ import fr.ird.observe.spi.context.ReferentialEntityContext;
import fr.ird.observe.spi.context.ReferentialReferenceEntityContext;
import fr.ird.observe.spi.map.ImmutableDtoMap;
import fr.ird.observe.spi.map.ImmutableSetDtoMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.persistence.TopiaDao;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
+import org.nuiton.version.Version;
+import org.nuiton.version.Versions;
+
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
@@ -71,11 +79,6 @@ import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaDao;
-import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
/**
* Created on 16/08/15.
@@ -84,14 +87,13 @@ import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
*/
public class ReferentialServiceLocal extends ObserveServiceLocal implements ReferentialService {
- private static final Log log = LogFactory.getLog(ReferentialServiceLocal.class);
public static final List<String> SPECIES_GROUP_IDS = Arrays.asList(
"fr.ird.observe.entities.referentiel.SpeciesGroup#1445863056144#0.9820877553253712",
"fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.24333033683679461",
"fr.ird.observe.entities.referentiel.SpeciesGroup#1446014286433#0.6480183366605247",
"fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683689#0.7120116158620075"
);
-
+ private static final Log log = LogFactory.getLog(ReferentialServiceLocal.class);
@Override
public <D extends ReferentialDto, R extends ReferentialDtoReference<D, R>> ReferentialDtoReferenceSet<R> getReferenceSet(Class<R> type, Date lastUpdateDate) {
@@ -387,7 +389,8 @@ public class ReferentialServiceLocal extends ObserveServiceLocal implements Refe
boolean h2 = serviceContext.getDataSourceConfiguration().orElseThrow(IllegalStateException::new).isH2Database();
- AddSqlScriptProducerRequest addRequest = h2 ? AddSqlScriptProducerRequest.forH2() : AddSqlScriptProducerRequest.forPostgres();
+ Version dbVersion = Versions.valueOf(serviceContext.getTopiaApplicationContext().getModelVersion());
+ AddSqlScriptProducerRequest addRequest = h2 ? AddSqlScriptProducerRequest.forH2(dbVersion) : AddSqlScriptProducerRequest.forPostgres(dbVersion);
for (Class<? extends ReferentialDtoReference> dtoType : missingReferentialIds.referentialReferenceTypes()) {
Set<String> ids = missingReferentialIds.get(dtoType);
addRequest.referentialIdsToAdd(dtoType, ids);
=====================================
services-local/src/test/java/fr/ird/observe/services/local/service/sql/MigrateTestsDatabases.java
=====================================
--- a/services-local/src/test/java/fr/ird/observe/services/local/service/sql/MigrateTestsDatabases.java
+++ b/services-local/src/test/java/fr/ird/observe/services/local/service/sql/MigrateTestsDatabases.java
@@ -91,7 +91,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport {
@CopyDatabaseConfiguration
@Test
public void migrateReferentielDb() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
migrate(service.produceAddSqlScript(request));
}
@@ -100,7 +100,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport {
@CopyDatabaseConfiguration
@Test
public void migrateDataForTestSeineDb() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
migrate(service.produceAddSqlScript(request));
}
@@ -109,7 +109,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport {
@CopyDatabaseConfiguration
@Test
public void migrateDataForTestLonglineDb() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema().addReferential().addAllData();
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
migrate(service.produceAddSqlScript(request));
}
@@ -118,7 +118,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport {
@CopyDatabaseConfiguration
@Test
public void migrateEmptyH2Db() throws IOException, IncompatibleDataSourceCreateConfigurationException, DataSourceCreateWithNoReferentialImportException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2().addSchema();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forH2(ObserveTestConfiguration.getModelVersion()).addSchema();
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
migrate(service.produceAddSqlScript(request));
}
@@ -127,7 +127,7 @@ public class MigrateTestsDatabases extends ServiceLocalTestSupport {
@CopyDatabaseConfiguration
@Test
public void migrateEmptyPgDb() throws IOException {
- AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres().addSchema();
+ AddSqlScriptProducerRequest request = AddSqlScriptProducerRequest.forPostgres(ObserveTestConfiguration.getModelVersion()).addSchema();
dataSourceService.migrateData(localTestMethodResource.getDataSourceConfiguration());
migrate(DatabaseName.empty_pg.name(), service.produceAddSqlScript(request));
}
=====================================
services-local/src/test/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocalTest.java
=====================================
--- a/services-local/src/test/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocalTest.java
+++ b/services-local/src/test/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocalTest.java
@@ -38,6 +38,7 @@ import org.junit.Before;
import org.junit.Test;
import org.nuiton.util.StringUtil;
import org.nuiton.util.TimeLog;
+import org.nuiton.version.Version;
/**
* Created on 31/12/15.
@@ -49,9 +50,11 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport {
private static final TimeLog timeLog = new TimeLog(SqlScriptProducerServiceLocalTest.class, 10, 1000);
protected SqlScriptProducerService service;
+ private Version dbVersion;
@Before
public void setUp() throws Exception {
+ dbVersion = localTestMethodResource.getDbVersion();
service = localTestMethodResource.newService(SqlScriptProducerService.class);
}
@@ -59,8 +62,8 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport {
@Test
public void testProduceSchema() throws Exception {
- produce(AddSqlScriptProducerRequest.forH2().addSchema());
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema());
+ produce(AddSqlScriptProducerRequest.forH2(dbVersion).addSchema());
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema());
}
@@ -68,7 +71,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport {
@Test
public void testProduceReferential() throws Exception {
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential());
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema().addReferential());
}
@@ -76,7 +79,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport {
@Test
public void testProduceSomeReferential() throws Exception {
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema().referentialIdsToAdd(ProgramReference.class, ImmutableSet.of(ObserveFixtures.PROGRAM_ID)));
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema().referentialIdsToAdd(ProgramReference.class, ImmutableSet.of(ObserveFixtures.PROGRAM_ID)));
}
@@ -85,7 +88,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport {
public void testProduceTripSeine() throws Exception {
// produce(AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential().addAllData());
- produce(AddSqlScriptProducerRequest.forPostgres().addSchema().addReferential().dataIdsToAdd(ObserveFixtures.TRIP_SEINE_IDS));
+ produce(AddSqlScriptProducerRequest.forPostgres(dbVersion).addSchema().addReferential().dataIdsToAdd(ObserveFixtures.TRIP_SEINE_IDS));
}
@@ -93,7 +96,7 @@ public class SqlScriptProducerServiceLocalTest extends ServiceLocalTestSupport {
@Test
public void testProduceTripLongline() throws Exception {
- produce(AddSqlScriptProducerRequest.forH2().addSchema().addReferential().addAllData());
+ produce(AddSqlScriptProducerRequest.forH2(dbVersion).addSchema().addReferential().addAllData());
// produce(AddSqlScriptProducerRequest.forH2().addSchema().addReferential().dataIdsToAdd(ObserveFixtures.TRIP_LONGLINE_IDS));
}
=====================================
services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerRequest.java
=====================================
--- a/services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerRequest.java
+++ b/services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerRequest.java
@@ -31,6 +31,7 @@ import fr.ird.observe.dto.ObserveDto;
import fr.ird.observe.dto.reference.ReferentialDtoReference;
import java.util.Set;
import java.util.stream.Collectors;
+import org.nuiton.version.Version;
/**
* Created on 31/12/15.
@@ -40,6 +41,8 @@ import java.util.stream.Collectors;
public class AddSqlScriptProducerRequest implements ObserveDto {
private final boolean postgres;
+ private final Version dbVersion;
+
private boolean addSchema;
private boolean addReferential;
private boolean addSomeReferential;
@@ -47,12 +50,12 @@ public class AddSqlScriptProducerRequest implements ObserveDto {
private ImmutableSet<String> dataIds;
private final ArrayListMultimap<Class<? extends ReferentialDtoReference>, String> referentialIds = ArrayListMultimap.create();
- public static AddSqlScriptProducerRequest forH2() {
- return new AddSqlScriptProducerRequest(false);
+ public static AddSqlScriptProducerRequest forH2(Version dbVersion) {
+ return new AddSqlScriptProducerRequest(false, dbVersion);
}
- public static AddSqlScriptProducerRequest forPostgres() {
- return new AddSqlScriptProducerRequest(true);
+ public static AddSqlScriptProducerRequest forPostgres(Version dbVersion) {
+ return new AddSqlScriptProducerRequest(true, dbVersion);
}
public AddSqlScriptProducerRequest addSchema() {
@@ -94,8 +97,13 @@ public class AddSqlScriptProducerRequest implements ObserveDto {
return addReferential;
}
- protected AddSqlScriptProducerRequest(boolean postgres) {
+ public Version getDbVersion() {
+ return dbVersion;
+ }
+
+ protected AddSqlScriptProducerRequest(boolean postgres, Version dbVersion) {
this.postgres = postgres;
+ this.dbVersion = dbVersion;
}
public boolean isAddData() {
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/0aac62baf2eed2bb70f9b493c4…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/0aac62baf2eed2bb70f9b493c4…
You're receiving this email because of your account on gitlab.com.
1
0