Tony CHEMIT pushed to branch feature/v8_maquette at ultreiaio / ird-observe
Commits:
-
27bcb0df
by Tony CHEMIT at 2018-04-09T13:42:52Z
16 changed files:
- client/src/main/java/fr/ird/observe/client/ObserveSwingApplicationContext.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TripLonglineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/ActivitySeineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/RouteUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/NavigationTreeNodeSupport.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/ReferenceNavigationTreeNodeSupport.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/ActivitiesLonglineNavigationTreeNode.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/ProgramLonglineNavigationTreeNode.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/seine/ActivitiesSeineNavigationTreeNode.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/seine/ProgramSeineNavigationTreeNode.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/seine/RoutesSeineNavigationTreeNode.java
- services-client/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java
Changes:
| ... | ... | @@ -2,19 +2,19 @@ |
| 2 | 2 |
* #%L
|
| 3 | 3 |
* ObServe :: Client
|
| 4 | 4 |
* %%
|
| 5 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 5 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | 10 |
* License, or (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 | 18 |
* License along with this program. If not, see
|
| 19 | 19 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
* #L%
|
| ... | ... | @@ -23,7 +23,6 @@ package fr.ird.observe.client; |
| 23 | 23 |
|
| 24 | 24 |
import com.google.common.base.Preconditions;
|
| 25 | 25 |
import com.google.common.collect.ImmutableSet;
|
| 26 |
-import fr.ird.observe.spi.DtoModelHelper;
|
|
| 27 | 26 |
import fr.ird.observe.client.backup.AtCloseApplicationLocalDatabaseBackupTask;
|
| 28 | 27 |
import fr.ird.observe.client.backup.BackupsManager;
|
| 29 | 28 |
import fr.ird.observe.client.configuration.ClientConfig;
|
| ... | ... | @@ -34,12 +33,20 @@ import fr.ird.observe.client.ui.content.ContentUIManager; |
| 34 | 33 |
import fr.ird.observe.client.ui.content.ObserveActionMap;
|
| 35 | 34 |
import fr.ird.observe.client.ui.content.ObserveFocusManager;
|
| 36 | 35 |
import fr.ird.observe.client.validation.ClientValidationContext;
|
| 37 |
-import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 38 | 36 |
import fr.ird.observe.dto.decoration.DecoratorService;
|
| 37 |
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 39 | 38 |
import fr.ird.observe.services.ObserveDataSourceConfigurationMainFactory;
|
| 40 | 39 |
import fr.ird.observe.services.ObserveServiceMainFactory;
|
| 41 | 40 |
import fr.ird.observe.services.validation.ValidatorDto;
|
| 42 | 41 |
import fr.ird.observe.services.validation.ValidatorsManager;
|
| 42 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 43 |
+import org.apache.commons.lang3.SystemUtils;
|
|
| 44 |
+import org.apache.commons.logging.Log;
|
|
| 45 |
+import org.apache.commons.logging.LogFactory;
|
|
| 46 |
+import org.h2.tools.Server;
|
|
| 47 |
+import org.nuiton.jaxx.runtime.context.DefaultApplicationContext;
|
|
| 48 |
+import org.nuiton.jaxx.runtime.context.JAXXContextEntryDef;
|
|
| 49 |
+ |
|
| 43 | 50 |
import java.io.Closeable;
|
| 44 | 51 |
import java.io.IOException;
|
| 45 | 52 |
import java.util.Arrays;
|
| ... | ... | @@ -49,13 +56,6 @@ import java.util.List; |
| 49 | 56 |
import java.util.Objects;
|
| 50 | 57 |
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
| 51 | 58 |
import java.util.concurrent.TimeUnit;
|
| 52 |
-import org.apache.commons.lang3.SystemUtils;
|
|
| 53 |
-import org.apache.commons.logging.Log;
|
|
| 54 |
-import org.apache.commons.logging.LogFactory;
|
|
| 55 |
-import org.h2.tools.Server;
|
|
| 56 |
-import org.nuiton.jaxx.runtime.context.DefaultApplicationContext;
|
|
| 57 |
-import org.nuiton.jaxx.runtime.context.JAXXContextEntryDef;
|
|
| 58 |
- |
|
| 59 | 59 |
|
| 60 | 60 |
import static fr.ird.observe.client.ObserveSwingApplicationContext.Entries.ACTIONS;
|
| 61 | 61 |
import static fr.ird.observe.client.ObserveSwingApplicationContext.Entries.ACTION_MAP;
|
| ... | ... | @@ -97,91 +97,12 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 97 | 97 |
|
| 98 | 98 |
/** Logger */
|
| 99 | 99 |
private static final Log log = LogFactory.getLog(ObserveSwingApplicationContext.class);
|
| 100 |
- |
|
| 101 |
- enum Entries {
|
|
| 102 |
- |
|
| 103 |
- CONFIG("Config", ClientConfig.class),
|
|
| 104 |
- DECORATOR_SERVICE("Decorator service", DecoratorService.class),
|
|
| 105 |
- TEXT_GENERATOR("Text generator", ObserveTextGenerator.class),
|
|
| 106 |
- DATA_SOURCE_CONFIGURATION_FACTORY("Data source configuration main factory", ObserveDataSourceConfigurationMainFactory.class),
|
|
| 107 |
- OPEN_DATA_MANAGER("Open data manager", ObserveOpenDataManager.class),
|
|
| 108 |
- DATA_CONTEXT("Data context", ClientDataContext.class),
|
|
| 109 |
- CONTENT_UI_MANAGER("Content UI manager", ContentUIManager.class),
|
|
| 110 |
- DATA_SOURCES_MANAGER("Data sources manager", ObserveDataSourcesManager.class),
|
|
| 111 |
- FLOATING_OBJECT_REFERENCES_MANAGER("Floating object referenfences manager", FloatingObjectPresetsManager.class),
|
|
| 112 |
- OBSERVE_SWING_SESSION_HELPER("Swing session Helper", ObserveSwingSessionHelper.class),
|
|
| 113 |
- VALIDATION_CONTEXT("Validation context", ClientValidationContext.class),
|
|
| 114 |
- MAIN_UI("Main UI", ObserveMainUI.class),
|
|
| 115 |
- ACTIONS("Command line Actions", ObserveCLAction.class),
|
|
| 116 |
- ACTION_MAP("UI Actions", ObserveActionMap.class),
|
|
| 117 |
- H2_SERVER_MODE("H2 Server mode", Boolean.class),
|
|
| 118 |
- H2_SERVER("H2 Server", Server.class),
|
|
| 119 |
- H2_WEBSERVER("H2 Web server", Server.class),
|
|
| 120 |
- FOCUS_MANAGER("Focus manager", ObserveFocusManager.class),
|
|
| 121 |
- VALIDATORS_MANAGER("Validators manager", ValidatorsManager.class),
|
|
| 122 |
- BACKUP_MANAGER("Backup manager", BackupsManager.class),
|
|
| 123 |
- LOCAL_DATABASE_BACKUP_TIMER("Local database backup task", ScheduledThreadPoolExecutor.class),
|
|
| 124 |
- NODE_TO_RESELECT("Node to reselect");
|
|
| 125 |
- |
|
| 126 |
- private final String objectName;
|
|
| 127 |
- private final JAXXContextEntryDef entryDef;
|
|
| 128 |
- |
|
| 129 |
- <O> Entries(String objectName, Class<O> entryType) {
|
|
| 130 |
- this.objectName = objectName;
|
|
| 131 |
- this.entryDef = newContextEntryDef(objectName, entryType);
|
|
| 132 |
- }
|
|
| 133 |
- |
|
| 134 |
- Entries(String objectName) {
|
|
| 135 |
- this.objectName = objectName;
|
|
| 136 |
- this.entryDef = newListContextEntryDef(objectName);
|
|
| 137 |
- }
|
|
| 138 |
- |
|
| 139 |
- @SuppressWarnings("unchecked")
|
|
| 140 |
- public <O> O get() {
|
|
| 141 |
- return (O) entryDef.getContextValue(ObserveSwingApplicationContext.get());
|
|
| 142 |
- }
|
|
| 143 |
- |
|
| 144 |
- @SuppressWarnings("unchecked")
|
|
| 145 |
- private <O> void set(O instance) {
|
|
| 146 |
- entryDef.setContextValue(ObserveSwingApplicationContext.get(), instance);
|
|
| 147 |
- if (log.isInfoEnabled()) {
|
|
| 148 |
- log.info("Add to application context " + objectName + ": " + (instance instanceof Collection ? ((Collection) instance).size() + " element(s)" : instance));
|
|
| 149 |
- }
|
|
| 150 |
- }
|
|
| 151 |
- |
|
| 152 |
- private <O> void remove() {
|
|
| 153 |
- O instance = get();
|
|
| 154 |
- entryDef.removeContextValue(ObserveSwingApplicationContext.get());
|
|
| 155 |
- if (log.isInfoEnabled()) {
|
|
| 156 |
- log.info("Remove from application context " + objectName + ": " + (instance instanceof Collection ? ((Collection) instance).size() + " element(s)" : instance));
|
|
| 157 |
- }
|
|
| 158 |
- }
|
|
| 159 |
- }
|
|
| 160 |
- |
|
| 161 | 100 |
private static ObserveSwingApplicationContext INSTANCE;
|
| 162 |
- |
|
| 163 | 101 |
/** Un objet pour bloquer le context */
|
| 164 | 102 |
private final Object lock;
|
| 165 |
- |
|
| 166 | 103 |
/** Un drapeau pour savoir quand l'application est en cours de fermeture. */
|
| 167 | 104 |
private boolean closed;
|
| 168 | 105 |
|
| 169 |
- /**
|
|
| 170 |
- * Récupération du contexte applicatif.
|
|
| 171 |
- *
|
|
| 172 |
- * @return l'instance partagé du contexte.
|
|
| 173 |
- * @throws IllegalStateException si le contexte n'a pas été initialisé
|
|
| 174 |
- */
|
|
| 175 |
- public static ObserveSwingApplicationContext get() throws IllegalStateException {
|
|
| 176 |
- Objects.requireNonNull(INSTANCE, "no application context initialized.");
|
|
| 177 |
- return INSTANCE;
|
|
| 178 |
- }
|
|
| 179 |
- |
|
| 180 |
- /** @return {@code true} si le context a été initialisé */
|
|
| 181 |
- public static boolean isInit() {
|
|
| 182 |
- return INSTANCE != null;
|
|
| 183 |
- }
|
|
| 184 |
- |
|
| 185 | 106 |
public ObserveSwingApplicationContext(ClientConfig config) {
|
| 186 | 107 |
|
| 187 | 108 |
Preconditions.checkState(INSTANCE == null, "application context already registred.");
|
| ... | ... | @@ -216,9 +137,21 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 216 | 137 |
lock = new Object();
|
| 217 | 138 |
}
|
| 218 | 139 |
|
| 219 |
- //-------------------------------------------
|
|
| 220 |
- // - Read
|
|
| 221 |
- //-------------------------------------------
|
|
| 140 |
+ /**
|
|
| 141 |
+ * Récupération du contexte applicatif.
|
|
| 142 |
+ *
|
|
| 143 |
+ * @return l'instance partagé du contexte.
|
|
| 144 |
+ * @throws IllegalStateException si le contexte n'a pas été initialisé
|
|
| 145 |
+ */
|
|
| 146 |
+ public static ObserveSwingApplicationContext get() throws IllegalStateException {
|
|
| 147 |
+ Objects.requireNonNull(INSTANCE, "no application context initialized.");
|
|
| 148 |
+ return INSTANCE;
|
|
| 149 |
+ }
|
|
| 150 |
+ |
|
| 151 |
+ /** @return {@code true} si le context a été initialisé */
|
|
| 152 |
+ public static boolean isInit() {
|
|
| 153 |
+ return INSTANCE != null;
|
|
| 154 |
+ }
|
|
| 222 | 155 |
|
| 223 | 156 |
/**
|
| 224 | 157 |
* @return {@code true} si le context applicatif a été fermé (et est donc
|
| ... | ... | @@ -228,6 +161,10 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 228 | 161 |
return closed;
|
| 229 | 162 |
}
|
| 230 | 163 |
|
| 164 |
+ //-------------------------------------------
|
|
| 165 |
+ // - Read
|
|
| 166 |
+ //-------------------------------------------
|
|
| 167 |
+ |
|
| 231 | 168 |
public ClientConfig getConfig() {
|
| 232 | 169 |
return CONFIG.get();
|
| 233 | 170 |
}
|
| ... | ... | @@ -276,10 +213,29 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 276 | 213 |
return MAIN_UI.get();
|
| 277 | 214 |
}
|
| 278 | 215 |
|
| 216 |
+ public void setMainUI(ObserveMainUI ui) {
|
|
| 217 |
+ MAIN_UI.set(ui);
|
|
| 218 |
+ |
|
| 219 |
+ ObserveActionMap actionMap = ui.getObserveActionMap();
|
|
| 220 |
+ ui.getRootPane().setActionMap(actionMap);
|
|
| 221 |
+ |
|
| 222 |
+ ACTION_MAP.set(actionMap);
|
|
| 223 |
+ |
|
| 224 |
+ }
|
|
| 225 |
+ |
|
| 279 | 226 |
public List<Object> getNodesToReselect() {
|
| 280 | 227 |
return NODE_TO_RESELECT.get();
|
| 281 | 228 |
}
|
| 282 | 229 |
|
| 230 |
+ public void setNodesToReselect(Object[] paths) {
|
|
| 231 |
+ if (paths == null) {
|
|
| 232 |
+ NODE_TO_RESELECT.remove();
|
|
| 233 |
+ |
|
| 234 |
+ } else {
|
|
| 235 |
+ NODE_TO_RESELECT.set(Arrays.asList(paths));
|
|
| 236 |
+ }
|
|
| 237 |
+ }
|
|
| 238 |
+ |
|
| 283 | 239 |
public ObserveActionMap getActionMap() {
|
| 284 | 240 |
return ACTION_MAP.get();
|
| 285 | 241 |
}
|
| ... | ... | @@ -288,14 +244,26 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 288 | 244 |
return H2_SERVER.get();
|
| 289 | 245 |
}
|
| 290 | 246 |
|
| 247 |
+ public void setH2Server(Server server) {
|
|
| 248 |
+ H2_SERVER.set(server);
|
|
| 249 |
+ }
|
|
| 250 |
+ |
|
| 291 | 251 |
public Server getH2WebServer() {
|
| 292 | 252 |
return H2_WEBSERVER.get();
|
| 293 | 253 |
}
|
| 294 | 254 |
|
| 255 |
+ public void setH2WebServer(Server server) {
|
|
| 256 |
+ H2_WEBSERVER.set(server);
|
|
| 257 |
+ }
|
|
| 258 |
+ |
|
| 295 | 259 |
private ScheduledThreadPoolExecutor getLocalDatabaseBackupTimer() {
|
| 296 | 260 |
return LOCAL_DATABASE_BACKUP_TIMER.get();
|
| 297 | 261 |
}
|
| 298 | 262 |
|
| 263 |
+ //-------------------------------------------
|
|
| 264 |
+ // - Write
|
|
| 265 |
+ //-------------------------------------------
|
|
| 266 |
+ |
|
| 299 | 267 |
public ObserveSwingSessionHelper getSwingSessionHelper() {
|
| 300 | 268 |
return OBSERVE_SWING_SESSION_HELPER.get();
|
| 301 | 269 |
}
|
| ... | ... | @@ -308,37 +276,6 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 308 | 276 |
return BACKUP_MANAGER.get();
|
| 309 | 277 |
}
|
| 310 | 278 |
|
| 311 |
- //-------------------------------------------
|
|
| 312 |
- // - Write
|
|
| 313 |
- //-------------------------------------------
|
|
| 314 |
- |
|
| 315 |
- public void setNodesToReselect(Object[] paths) {
|
|
| 316 |
- if (paths == null) {
|
|
| 317 |
- NODE_TO_RESELECT.remove();
|
|
| 318 |
- |
|
| 319 |
- } else {
|
|
| 320 |
- NODE_TO_RESELECT.set(Arrays.asList(paths));
|
|
| 321 |
- }
|
|
| 322 |
- }
|
|
| 323 |
- |
|
| 324 |
- public void setH2Server(Server server) {
|
|
| 325 |
- H2_SERVER.set(server);
|
|
| 326 |
- }
|
|
| 327 |
- |
|
| 328 |
- public void setH2WebServer(Server server) {
|
|
| 329 |
- H2_WEBSERVER.set(server);
|
|
| 330 |
- }
|
|
| 331 |
- |
|
| 332 |
- public void setMainUI(ObserveMainUI ui) {
|
|
| 333 |
- MAIN_UI.set(ui);
|
|
| 334 |
- |
|
| 335 |
- ObserveActionMap actionMap = ui.getObserveActionMap();
|
|
| 336 |
- ui.getRootPane().setActionMap(actionMap);
|
|
| 337 |
- |
|
| 338 |
- ACTION_MAP.set(actionMap);
|
|
| 339 |
- |
|
| 340 |
- }
|
|
| 341 |
- |
|
| 342 | 279 |
public void removeMainUI() {
|
| 343 | 280 |
MAIN_UI.remove();
|
| 344 | 281 |
}
|
| ... | ... | @@ -347,16 +284,16 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 347 | 284 |
H2_SERVER_MODE.remove();
|
| 348 | 285 |
}
|
| 349 | 286 |
|
| 350 |
- //-------------------------------------------
|
|
| 351 |
- // - Locks
|
|
| 352 |
- //-------------------------------------------
|
|
| 353 |
- |
|
| 354 | 287 |
void lock() throws InterruptedException {
|
| 355 | 288 |
synchronized (lock) {
|
| 356 | 289 |
lock.wait();
|
| 357 | 290 |
}
|
| 358 | 291 |
}
|
| 359 | 292 |
|
| 293 |
+ //-------------------------------------------
|
|
| 294 |
+ // - Locks
|
|
| 295 |
+ //-------------------------------------------
|
|
| 296 |
+ |
|
| 360 | 297 |
public void releaseLock() {
|
| 361 | 298 |
synchronized (lock) {
|
| 362 | 299 |
lock.notifyAll();
|
| ... | ... | @@ -364,7 +301,7 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 364 | 301 |
}
|
| 365 | 302 |
|
| 366 | 303 |
@Override
|
| 367 |
- public void close() throws IOException {
|
|
| 304 |
+ public void close() {
|
|
| 368 | 305 |
if (log.isInfoEnabled()) {
|
| 369 | 306 |
log.info("Closing swing application context " + this);
|
| 370 | 307 |
}
|
| ... | ... | @@ -398,11 +335,7 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 398 | 335 |
log.error("Could not close", e);
|
| 399 | 336 |
}
|
| 400 | 337 |
}
|
| 401 |
- try {
|
|
| 402 |
- ObserveServiceMainFactory.get().close();
|
|
| 403 |
- } catch (IOException e) {
|
|
| 404 |
- log.error("Could not close", e);
|
|
| 405 |
- }
|
|
| 338 |
+ ObserveServiceMainFactory.get().close();
|
|
| 406 | 339 |
|
| 407 | 340 |
// fermeture du context principal
|
| 408 | 341 |
clear();
|
| ... | ... | @@ -421,12 +354,63 @@ public class ObserveSwingApplicationContext extends DefaultApplicationContext im |
| 421 | 354 |
super.finalize();
|
| 422 | 355 |
}
|
| 423 | 356 |
|
| 424 |
-// private void registerMainAction(ActionMap actionMap, UIActionSupport action) {
|
|
| 425 |
-// String actionId = action.getActionId();
|
|
| 426 |
-// if (log.isInfoEnabled()) {
|
|
| 427 |
-// log.info("Register UI action " + actionId);
|
|
| 428 |
-// }
|
|
| 429 |
-// actionMap.put(actionId, action);
|
|
| 430 |
-// }
|
|
| 357 |
+ enum Entries {
|
|
| 358 |
+ |
|
| 359 |
+ CONFIG("Config", ClientConfig.class),
|
|
| 360 |
+ DECORATOR_SERVICE("Decorator service", DecoratorService.class),
|
|
| 361 |
+ TEXT_GENERATOR("Text generator", ObserveTextGenerator.class),
|
|
| 362 |
+ DATA_SOURCE_CONFIGURATION_FACTORY("Data source configuration main factory", ObserveDataSourceConfigurationMainFactory.class),
|
|
| 363 |
+ OPEN_DATA_MANAGER("Open data manager", ObserveOpenDataManager.class),
|
|
| 364 |
+ DATA_CONTEXT("Data context", ClientDataContext.class),
|
|
| 365 |
+ CONTENT_UI_MANAGER("Content UI manager", ContentUIManager.class),
|
|
| 366 |
+ DATA_SOURCES_MANAGER("Data sources manager", ObserveDataSourcesManager.class),
|
|
| 367 |
+ FLOATING_OBJECT_REFERENCES_MANAGER("Floating object referenfences manager", FloatingObjectPresetsManager.class),
|
|
| 368 |
+ OBSERVE_SWING_SESSION_HELPER("Swing session Helper", ObserveSwingSessionHelper.class),
|
|
| 369 |
+ VALIDATION_CONTEXT("Validation context", ClientValidationContext.class),
|
|
| 370 |
+ MAIN_UI("Main UI", ObserveMainUI.class),
|
|
| 371 |
+ ACTIONS("Command line Actions", ObserveCLAction.class),
|
|
| 372 |
+ ACTION_MAP("UI Actions", ObserveActionMap.class),
|
|
| 373 |
+ H2_SERVER_MODE("H2 Server mode", Boolean.class),
|
|
| 374 |
+ H2_SERVER("H2 Server", Server.class),
|
|
| 375 |
+ H2_WEBSERVER("H2 Web server", Server.class),
|
|
| 376 |
+ FOCUS_MANAGER("Focus manager", ObserveFocusManager.class),
|
|
| 377 |
+ VALIDATORS_MANAGER("Validators manager", ValidatorsManager.class),
|
|
| 378 |
+ BACKUP_MANAGER("Backup manager", BackupsManager.class),
|
|
| 379 |
+ LOCAL_DATABASE_BACKUP_TIMER("Local database backup task", ScheduledThreadPoolExecutor.class),
|
|
| 380 |
+ NODE_TO_RESELECT("Node to reselect");
|
|
| 381 |
+ |
|
| 382 |
+ private final String objectName;
|
|
| 383 |
+ private final JAXXContextEntryDef entryDef;
|
|
| 384 |
+ |
|
| 385 |
+ <O> Entries(String objectName, Class<O> entryType) {
|
|
| 386 |
+ this.objectName = objectName;
|
|
| 387 |
+ this.entryDef = newContextEntryDef(objectName, entryType);
|
|
| 388 |
+ }
|
|
| 389 |
+ |
|
| 390 |
+ Entries(String objectName) {
|
|
| 391 |
+ this.objectName = objectName;
|
|
| 392 |
+ this.entryDef = newListContextEntryDef(objectName);
|
|
| 393 |
+ }
|
|
| 394 |
+ |
|
| 395 |
+ @SuppressWarnings("unchecked")
|
|
| 396 |
+ public <O> O get() {
|
|
| 397 |
+ return (O) entryDef.getContextValue(ObserveSwingApplicationContext.get());
|
|
| 398 |
+ }
|
|
| 431 | 399 |
|
| 400 |
+ @SuppressWarnings("unchecked")
|
|
| 401 |
+ private <O> void set(O instance) {
|
|
| 402 |
+ entryDef.setContextValue(ObserveSwingApplicationContext.get(), instance);
|
|
| 403 |
+ if (log.isInfoEnabled()) {
|
|
| 404 |
+ log.info("Add to application context " + objectName + ": " + (instance instanceof Collection ? ((Collection) instance).size() + " element(s)" : instance));
|
|
| 405 |
+ }
|
|
| 406 |
+ }
|
|
| 407 |
+ |
|
| 408 |
+ private <O> void remove() {
|
|
| 409 |
+ O instance = get();
|
|
| 410 |
+ entryDef.removeContextValue(ObserveSwingApplicationContext.get());
|
|
| 411 |
+ if (log.isInfoEnabled()) {
|
|
| 412 |
+ log.info("Remove from application context " + objectName + ": " + (instance instanceof Collection ? ((Collection) instance).size() + " element(s)" : instance));
|
|
| 413 |
+ }
|
|
| 414 |
+ }
|
|
| 415 |
+ }
|
|
| 432 | 416 |
}
|
| ... | ... | @@ -28,13 +28,18 @@ import fr.ird.observe.client.db.constants.DataContextType; |
| 28 | 28 |
import fr.ird.observe.client.ui.content.ContentMode;
|
| 29 | 29 |
import fr.ird.observe.client.ui.content.ContentUIModel;
|
| 30 | 30 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler;
|
| 31 |
+import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
|
| 32 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 33 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.longline.ActivitiesLonglineNavigationTreeNode;
|
|
| 31 | 34 |
import fr.ird.observe.client.validation.ClientValidationContext;
|
| 32 | 35 |
import fr.ird.observe.dto.data.longline.ActivityLonglineDto;
|
| 33 | 36 |
import fr.ird.observe.dto.data.longline.ActivityLonglineHelper;
|
| 37 |
+import fr.ird.observe.dto.data.longline.ActivityLonglineReference;
|
|
| 34 | 38 |
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
| 35 | 39 |
import fr.ird.observe.dto.form.Form;
|
| 36 | 40 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 37 | 41 |
import fr.ird.observe.dto.result.TripChildSaveResultDto;
|
| 42 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 38 | 43 |
import org.apache.commons.logging.Log;
|
| 39 | 44 |
import org.apache.commons.logging.LogFactory;
|
| 40 | 45 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| ... | ... | @@ -241,8 +246,6 @@ class ActivityLonglineLogbookUIHandler extends ContentOpenableUIHandler<Activity |
| 241 | 246 |
|
| 242 | 247 |
setUpdateMareeNodeTag(saveResult.isTripEndDateUpdated());
|
| 243 | 248 |
|
| 244 |
- obtainChildPosition(bean);
|
|
| 245 |
- |
|
| 246 | 249 |
if (notPersisted) {
|
| 247 | 250 |
// ouverture de l'activité après création
|
| 248 | 251 |
getOpenDataManager().openActivityLongline(getSelectedParentId(), bean.getId(), null);
|
| ... | ... | @@ -257,9 +260,15 @@ class ActivityLonglineLogbookUIHandler extends ContentOpenableUIHandler<Activity |
| 257 | 260 |
return true;
|
| 258 | 261 |
}
|
| 259 | 262 |
|
| 263 |
+ |
|
| 260 | 264 |
@Override
|
| 261 |
- protected int getOpenablePosition(String parentId, ActivityLonglineDto bean) {
|
|
| 262 |
- return getActivityLonglineService().getActivityLonglinePositionInTripLongline(parentId, bean.getId());
|
|
| 265 |
+ protected int getOpenablePosition() {
|
|
| 266 |
+ NavigationTree treeHelper = getNavigationTree();
|
|
| 267 |
+ NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
|
| 268 |
+ ActivitiesLonglineNavigationTreeNode parentNode = (ActivitiesLonglineNavigationTreeNode) node.getParent();
|
|
| 269 |
+ ActivityLonglineReference reference = DtoModelHelper.fromDataDto(getBeanType()).toReference(getDecoratorService().getReferentialLocale(), getBean());
|
|
| 270 |
+ return ActivitiesLonglineNavigationTreeNode.sortReferences(parentNode, node, reference, ActivityLonglineReference::getTimeStamp);
|
|
| 271 |
+// return getActivityLonglineService().getActivityLonglinePositionInTripLongline(parentId, bean.getId());
|
|
| 263 | 272 |
}
|
| 264 | 273 |
|
| 265 | 274 |
@Override
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.client.ui.content.data.longline; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Client
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -28,20 +28,25 @@ import fr.ird.observe.client.db.constants.DataContextType; |
| 28 | 28 |
import fr.ird.observe.client.ui.content.ContentMode;
|
| 29 | 29 |
import fr.ird.observe.client.ui.content.ContentUIModel;
|
| 30 | 30 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler;
|
| 31 |
+import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
|
| 32 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 33 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.longline.ActivitiesLonglineNavigationTreeNode;
|
|
| 31 | 34 |
import fr.ird.observe.client.validation.ClientValidationContext;
|
| 32 |
-import fr.ird.observe.dto.form.Form;
|
|
| 33 | 35 |
import fr.ird.observe.dto.data.longline.ActivityLonglineDto;
|
| 34 | 36 |
import fr.ird.observe.dto.data.longline.ActivityLonglineHelper;
|
| 37 |
+import fr.ird.observe.dto.data.longline.ActivityLonglineReference;
|
|
| 35 | 38 |
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
| 39 |
+import fr.ird.observe.dto.form.Form;
|
|
| 36 | 40 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 37 | 41 |
import fr.ird.observe.dto.result.TripChildSaveResultDto;
|
| 38 |
-import java.util.Optional;
|
|
| 39 |
-import javax.swing.SwingUtilities;
|
|
| 42 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 40 | 43 |
import org.apache.commons.logging.Log;
|
| 41 | 44 |
import org.apache.commons.logging.LogFactory;
|
| 42 | 45 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 43 | 46 |
import org.nuiton.validator.NuitonValidatorScope;
|
| 44 | 47 |
|
| 48 |
+import javax.swing.*;
|
|
| 49 |
+import java.util.Optional;
|
|
| 45 | 50 |
|
| 46 | 51 |
import static org.nuiton.i18n.I18n.n;
|
| 47 | 52 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -241,8 +246,6 @@ class ActivityLonglineUIHandler extends ContentOpenableUIHandler<ActivityLonglin |
| 241 | 246 |
|
| 242 | 247 |
setUpdateMareeNodeTag(saveResult.isTripEndDateUpdated());
|
| 243 | 248 |
|
| 244 |
- obtainChildPosition(bean);
|
|
| 245 |
- |
|
| 246 | 249 |
if (notPersisted) {
|
| 247 | 250 |
// ouverture de l'activité après création
|
| 248 | 251 |
getOpenDataManager().openActivityLongline(getSelectedParentId(), bean.getId(), null);
|
| ... | ... | @@ -258,8 +261,13 @@ class ActivityLonglineUIHandler extends ContentOpenableUIHandler<ActivityLonglin |
| 258 | 261 |
}
|
| 259 | 262 |
|
| 260 | 263 |
@Override
|
| 261 |
- protected int getOpenablePosition(String parentId, ActivityLonglineDto bean) {
|
|
| 262 |
- return getActivityLonglineService().getActivityLonglinePositionInTripLongline(parentId, bean.getId());
|
|
| 264 |
+ protected int getOpenablePosition() {
|
|
| 265 |
+ NavigationTree treeHelper = getNavigationTree();
|
|
| 266 |
+ NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
|
| 267 |
+ ActivitiesLonglineNavigationTreeNode parentNode = (ActivitiesLonglineNavigationTreeNode) node.getParent();
|
|
| 268 |
+ ActivityLonglineReference reference = DtoModelHelper.fromDataDto(getBeanType()).toReference(getDecoratorService().getReferentialLocale(), getBean());
|
|
| 269 |
+ return ActivitiesLonglineNavigationTreeNode.sortReferences(parentNode, node, reference, ActivityLonglineReference::getTimeStamp);
|
|
| 270 |
+// return getActivityLonglineService().getActivityLonglinePositionInTripLongline(parentId, bean.getId());
|
|
| 263 | 271 |
}
|
| 264 | 272 |
|
| 265 | 273 |
@Override
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.longline; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -29,8 +29,12 @@ import fr.ird.observe.client.db.constants.DataContextType; |
| 29 | 29 |
import fr.ird.observe.client.ui.content.ContentMode;
|
| 30 | 30 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler;
|
| 31 | 31 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIModel;
|
| 32 |
+import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
|
| 33 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 34 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.longline.ProgramLonglineNavigationTreeNode;
|
|
| 32 | 35 |
import fr.ird.observe.client.ui.util.tripMap.TripMapUI;
|
| 33 | 36 |
import fr.ird.observe.dto.data.TripMapDto;
|
| 37 |
+import fr.ird.observe.dto.data.longline.TripLonglineReference;
|
|
| 34 | 38 |
import fr.ird.observe.dto.form.Form;
|
| 35 | 39 |
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
| 36 | 40 |
import fr.ird.observe.dto.data.longline.TripLonglineHelper;
|
| ... | ... | @@ -51,6 +55,7 @@ import javax.swing.JTabbedPane; |
| 51 | 55 |
import javax.swing.SwingUtilities;
|
| 52 | 56 |
import javax.swing.event.TableModelListener;
|
| 53 | 57 |
|
| 58 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 54 | 59 |
import org.apache.commons.logging.Log;
|
| 55 | 60 |
import org.apache.commons.logging.LogFactory;
|
| 56 | 61 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| ... | ... | @@ -245,18 +250,18 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr |
| 245 | 250 |
}
|
| 246 | 251 |
|
| 247 | 252 |
super.startEditUI(TripLonglineUI.BINDING_VESSEL_SELECTED_ITEM,
|
| 248 |
- TripLonglineUI.BINDING_CAPTAIN_SELECTED_ITEM,
|
|
| 249 |
- TripLonglineUI.BINDING_OBSERVATION_OBSERVER_SELECTED_ITEM,
|
|
| 250 |
- TripLonglineUI.BINDING_OBSERVATION_TRIP_TYPE_SELECTED_ITEM,
|
|
| 251 |
- TripLonglineUI.BINDING_OBSERVATION_DATA_ENTRY_OPERATOR_SELECTED_ITEM,
|
|
| 252 |
- TripLonglineUI.BINDING_TOTAL_FISHING_OPERATIONS_NUMBER_NUMBER_VALUE,
|
|
| 253 |
- TripLonglineUI.BINDING_OCEAN_SELECTED_ITEM,
|
|
| 254 |
- TripLonglineUI.BINDING_START_DATE_DATE,
|
|
| 255 |
- TripLonglineUI.BINDING_END_DATE_DATE,
|
|
| 256 |
- TripLonglineUI.BINDING_COMMENT_MODEL,
|
|
| 257 |
- TripLonglineUI.BINDING_HOME_ID_TEXT,
|
|
| 258 |
- TripLonglineUI.BINDING_CLOSE_ENABLED,
|
|
| 259 |
- TripLonglineUI.BINDING_CLOSE_AND_CREATE_ENABLED);
|
|
| 253 |
+ TripLonglineUI.BINDING_CAPTAIN_SELECTED_ITEM,
|
|
| 254 |
+ TripLonglineUI.BINDING_OBSERVATION_OBSERVER_SELECTED_ITEM,
|
|
| 255 |
+ TripLonglineUI.BINDING_OBSERVATION_TRIP_TYPE_SELECTED_ITEM,
|
|
| 256 |
+ TripLonglineUI.BINDING_OBSERVATION_DATA_ENTRY_OPERATOR_SELECTED_ITEM,
|
|
| 257 |
+ TripLonglineUI.BINDING_TOTAL_FISHING_OPERATIONS_NUMBER_NUMBER_VALUE,
|
|
| 258 |
+ TripLonglineUI.BINDING_OCEAN_SELECTED_ITEM,
|
|
| 259 |
+ TripLonglineUI.BINDING_START_DATE_DATE,
|
|
| 260 |
+ TripLonglineUI.BINDING_END_DATE_DATE,
|
|
| 261 |
+ TripLonglineUI.BINDING_COMMENT_MODEL,
|
|
| 262 |
+ TripLonglineUI.BINDING_HOME_ID_TEXT,
|
|
| 263 |
+ TripLonglineUI.BINDING_CLOSE_ENABLED,
|
|
| 264 |
+ TripLonglineUI.BINDING_CLOSE_AND_CREATE_ENABLED);
|
|
| 260 | 265 |
model.setModified(create);
|
| 261 | 266 |
}
|
| 262 | 267 |
|
| ... | ... | @@ -310,9 +315,6 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr |
| 310 | 315 |
SaveResultDto saveResult = getTripLonglineService().save(bean);
|
| 311 | 316 |
saveResult.toDto(bean);
|
| 312 | 317 |
|
| 313 |
- // recuperation de la position de la maree dans le program
|
|
| 314 |
- obtainChildPosition(bean);
|
|
| 315 |
- |
|
| 316 | 318 |
// ouverture de la marée
|
| 317 | 319 |
if (notPersisted) {
|
| 318 | 320 |
getOpenDataManager().openTripLongline(getSelectedParentId(), bean.getId());
|
| ... | ... | @@ -321,12 +323,6 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr |
| 321 | 323 |
}
|
| 322 | 324 |
|
| 323 | 325 |
@Override
|
| 324 |
- protected int getOpenablePosition(String parentId, TripLonglineDto bean) {
|
|
| 325 |
- |
|
| 326 |
- return getTripLonglineService().getTripLonglinePositionInProgram(parentId, bean.getId());
|
|
| 327 |
- }
|
|
| 328 |
- |
|
| 329 |
- @Override
|
|
| 330 | 326 |
protected boolean doDelete(TripLonglineDto bean) {
|
| 331 | 327 |
|
| 332 | 328 |
if (askToDelete(bean)) {
|
| ... | ... | @@ -374,4 +370,14 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr |
| 374 | 370 |
model.setObservationTabValid(observationTabValid);
|
| 375 | 371 |
|
| 376 | 372 |
}
|
| 373 |
+ |
|
| 374 |
+ @Override
|
|
| 375 |
+ protected int getOpenablePosition() {
|
|
| 376 |
+ NavigationTree treeHelper = getNavigationTree();
|
|
| 377 |
+ NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
|
| 378 |
+ ProgramLonglineNavigationTreeNode parentNode = (ProgramLonglineNavigationTreeNode) node.getParent();
|
|
| 379 |
+ TripLonglineReference reference = DtoModelHelper.fromDataDto(getBeanType()).toReference(getDecoratorService().getReferentialLocale(), getBean());
|
|
| 380 |
+ return ProgramLonglineNavigationTreeNode.sortReferences(parentNode, node, reference, TripLonglineReference::getStartDate);
|
|
| 381 |
+ }
|
|
| 382 |
+ |
|
| 377 | 383 |
}
|
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 |
* #%L
|
| 3 | 3 |
* ObServe :: Client
|
| 4 | 4 |
* %%
|
| 5 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 5 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -27,22 +27,21 @@ import fr.ird.observe.client.db.constants.DataContextType; |
| 27 | 27 |
import fr.ird.observe.client.ui.content.ContentMode;
|
| 28 | 28 |
import fr.ird.observe.client.ui.content.ContentUIModel;
|
| 29 | 29 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler;
|
| 30 |
+import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
|
| 31 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 32 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.seine.ActivitiesSeineNavigationTreeNode;
|
|
| 30 | 33 |
import fr.ird.observe.client.validation.ClientValidationContext;
|
| 34 |
+import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
|
| 35 |
+import fr.ird.observe.dto.data.seine.ActivitySeineHelper;
|
|
| 36 |
+import fr.ird.observe.dto.data.seine.ActivitySeineReference;
|
|
| 37 |
+import fr.ird.observe.dto.data.seine.RouteDto;
|
|
| 38 |
+import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 31 | 39 |
import fr.ird.observe.dto.form.Form;
|
| 32 | 40 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 33 | 41 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineHelper;
|
| 34 | 42 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineReference;
|
| 35 | 43 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 36 |
-import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
|
| 37 |
-import fr.ird.observe.dto.data.seine.ActivitySeineHelper;
|
|
| 38 |
-import fr.ird.observe.dto.data.seine.RouteDto;
|
|
| 39 |
-import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 40 |
-import java.util.HashSet;
|
|
| 41 |
-import java.util.List;
|
|
| 42 |
-import java.util.Optional;
|
|
| 43 |
-import java.util.Set;
|
|
| 44 |
-import javax.swing.SwingUtilities;
|
|
| 45 |
-import javax.swing.event.TableModelListener;
|
|
| 44 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 46 | 45 |
import org.apache.commons.logging.Log;
|
| 47 | 46 |
import org.apache.commons.logging.LogFactory;
|
| 48 | 47 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| ... | ... | @@ -50,6 +49,12 @@ import org.nuiton.jaxx.validator.swing.SwingValidatorMessage; |
| 50 | 49 |
import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
|
| 51 | 50 |
import org.nuiton.validator.NuitonValidatorScope;
|
| 52 | 51 |
|
| 52 |
+import javax.swing.*;
|
|
| 53 |
+import javax.swing.event.TableModelListener;
|
|
| 54 |
+import java.util.HashSet;
|
|
| 55 |
+import java.util.List;
|
|
| 56 |
+import java.util.Optional;
|
|
| 57 |
+import java.util.Set;
|
|
| 53 | 58 |
|
| 54 | 59 |
import static org.nuiton.i18n.I18n.n;
|
| 55 | 60 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -68,7 +73,7 @@ class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySeineDto, |
| 68 | 73 |
|
| 69 | 74 |
ActivitySeineUIHandler() {
|
| 70 | 75 |
super(DataContextType.Route, DataContextType.ActivitySeine,
|
| 71 |
- n("observe.common.ActivitySeineDto.message.not.open"));
|
|
| 76 |
+ n("observe.common.ActivitySeineDto.message.not.open"));
|
|
| 72 | 77 |
computeTabValidStateListener = e -> {
|
| 73 | 78 |
|
| 74 | 79 |
SwingValidatorMessageTableModel source = (SwingValidatorMessageTableModel) e.getSource();
|
| ... | ... | @@ -131,17 +136,17 @@ class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySeineDto, |
| 131 | 136 |
|
| 132 | 137 |
// la route n'est pas ouverte
|
| 133 | 138 |
addMessage(ui,
|
| 134 |
- NuitonValidatorScope.INFO,
|
|
| 135 |
- getTypeI18nKey(RouteDto.class),
|
|
| 136 |
- t("observe.common.RouteDto.message.not.open"));
|
|
| 139 |
+ NuitonValidatorScope.INFO,
|
|
| 140 |
+ getTypeI18nKey(RouteDto.class),
|
|
| 141 |
+ t("observe.common.RouteDto.message.not.open"));
|
|
| 137 | 142 |
|
| 138 | 143 |
} else if (!getOpenDataManager().isOpenTripSeine(dataContext.getSelectedTripSeineId())) {
|
| 139 | 144 |
|
| 140 | 145 |
// la marée n'est past ouverte
|
| 141 | 146 |
addMessage(ui,
|
| 142 |
- NuitonValidatorScope.INFO,
|
|
| 143 |
- getTypeI18nKey(TripSeineDto.class),
|
|
| 144 |
- t("observe.common.TripSeineDto.message.not.open"));
|
|
| 147 |
+ NuitonValidatorScope.INFO,
|
|
| 148 |
+ getTypeI18nKey(TripSeineDto.class),
|
|
| 149 |
+ t("observe.common.TripSeineDto.message.not.open"));
|
|
| 145 | 150 |
|
| 146 | 151 |
if (getModel().isHistoricalData()) {
|
| 147 | 152 |
|
| ... | ... | @@ -251,28 +256,28 @@ class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySeineDto, |
| 251 | 256 |
ui.getValidator().setContext(contextName);
|
| 252 | 257 |
if (create) {
|
| 253 | 258 |
addMessage(ui,
|
| 254 |
- NuitonValidatorScope.INFO,
|
|
| 255 |
- getTypeI18nKey(ActivitySeineDto.class),
|
|
| 256 |
- t("observe.common.ActivitySeineDto.message.creating"));
|
|
| 259 |
+ NuitonValidatorScope.INFO,
|
|
| 260 |
+ getTypeI18nKey(ActivitySeineDto.class),
|
|
| 261 |
+ t("observe.common.ActivitySeineDto.message.creating"));
|
|
| 257 | 262 |
} else {
|
| 258 | 263 |
addMessage(ui,
|
| 259 |
- NuitonValidatorScope.INFO,
|
|
| 260 |
- getTypeI18nKey(ActivitySeineDto.class),
|
|
| 261 |
- t("observe.common.ActivitySeineDto.message.updating"));
|
|
| 264 |
+ NuitonValidatorScope.INFO,
|
|
| 265 |
+ getTypeI18nKey(ActivitySeineDto.class),
|
|
| 266 |
+ t("observe.common.ActivitySeineDto.message.updating"));
|
|
| 262 | 267 |
}
|
| 263 | 268 |
|
| 264 | 269 |
super.startEditUI(ActivitySeineUI.BINDING_TIME_TIME,
|
| 265 |
- ActivitySeineUI.BINDING_VESSEL_SPEED_NUMBER_VALUE,
|
|
| 266 |
- ActivitySeineUI.BINDING_SEA_SURFACE_TEMPERATURE_STORAGE_TEMPERATURE,
|
|
| 267 |
- ActivitySeineUI.BINDING_COMMENT_MODEL,
|
|
| 268 |
- ActivitySeineUI.BINDING_VESSEL_ACTIVITY_SEINE_SELECTED_ITEM,
|
|
| 269 |
- ActivitySeineUI.BINDING_PREVIOUS_FPA_ZONE_SELECTED_ITEM,
|
|
| 270 |
- ActivitySeineUI.BINDING_CURRENT_FPA_ZONE_SELECTED_ITEM,
|
|
| 271 |
- ActivitySeineUI.BINDING_NEXT_FPA_ZONE_SELECTED_ITEM,
|
|
| 272 |
- ActivitySeineUI.BINDING_SURROUNDING_ACTIVITY_SELECTED_ITEM,
|
|
| 273 |
- ActivitySeineUI.BINDING_CLOSE_ENABLED,
|
|
| 274 |
- ActivitySeineUI.BINDING_ADD_SET_ENABLED,
|
|
| 275 |
- ActivitySeineUI.BINDING_CLOSE_AND_CREATE_ENABLED);
|
|
| 270 |
+ ActivitySeineUI.BINDING_VESSEL_SPEED_NUMBER_VALUE,
|
|
| 271 |
+ ActivitySeineUI.BINDING_SEA_SURFACE_TEMPERATURE_STORAGE_TEMPERATURE,
|
|
| 272 |
+ ActivitySeineUI.BINDING_COMMENT_MODEL,
|
|
| 273 |
+ ActivitySeineUI.BINDING_VESSEL_ACTIVITY_SEINE_SELECTED_ITEM,
|
|
| 274 |
+ ActivitySeineUI.BINDING_PREVIOUS_FPA_ZONE_SELECTED_ITEM,
|
|
| 275 |
+ ActivitySeineUI.BINDING_CURRENT_FPA_ZONE_SELECTED_ITEM,
|
|
| 276 |
+ ActivitySeineUI.BINDING_NEXT_FPA_ZONE_SELECTED_ITEM,
|
|
| 277 |
+ ActivitySeineUI.BINDING_SURROUNDING_ACTIVITY_SELECTED_ITEM,
|
|
| 278 |
+ ActivitySeineUI.BINDING_CLOSE_ENABLED,
|
|
| 279 |
+ ActivitySeineUI.BINDING_ADD_SET_ENABLED,
|
|
| 280 |
+ ActivitySeineUI.BINDING_CLOSE_AND_CREATE_ENABLED);
|
|
| 276 | 281 |
model.setModified(create);
|
| 277 | 282 |
}
|
| 278 | 283 |
|
| ... | ... | @@ -288,8 +293,6 @@ class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySeineDto, |
| 288 | 293 |
SaveResultDto saveResult = getActivitySeineService().save(routeId, getModel().getBean());
|
| 289 | 294 |
saveResult.toDto(bean);
|
| 290 | 295 |
|
| 291 |
- obtainChildPosition(bean);
|
|
| 292 |
- |
|
| 293 | 296 |
if (notPersisted) {
|
| 294 | 297 |
// ouverture de l'activité après création
|
| 295 | 298 |
getOpenDataManager().openActivitySeine(getSelectedParentId(), bean.getId(), null);
|
| ... | ... | @@ -305,8 +308,13 @@ class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySeineDto, |
| 305 | 308 |
}
|
| 306 | 309 |
|
| 307 | 310 |
@Override
|
| 308 |
- protected int getOpenablePosition(String parentId, ActivitySeineDto bean) {
|
|
| 309 |
- return getActivitySeineService().getActivitySeinePositionInRoute(parentId, bean.getId());
|
|
| 311 |
+ protected int getOpenablePosition() {
|
|
| 312 |
+ NavigationTree treeHelper = getNavigationTree();
|
|
| 313 |
+ NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
|
| 314 |
+ ActivitiesSeineNavigationTreeNode parentNode = (ActivitiesSeineNavigationTreeNode) node.getParent();
|
|
| 315 |
+ ActivitySeineReference reference = DtoModelHelper.fromDataDto(getBeanType()).toReference(getDecoratorService().getReferentialLocale(), getBean());
|
|
| 316 |
+ return ActivitiesSeineNavigationTreeNode.sortReferences(parentNode, node, reference, ActivitySeineReference::getTime);
|
|
| 317 |
+// return getActivitySeineService().getActivitySeinePositionInRoute(parentId, bean.getId());
|
|
| 310 | 318 |
}
|
| 311 | 319 |
|
| 312 | 320 |
@Override
|
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 |
* #%L
|
| 3 | 3 |
* ObServe :: Client
|
| 4 | 4 |
* %%
|
| 5 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 5 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -24,28 +24,32 @@ package fr.ird.observe.client.ui.content.data.seine; |
| 24 | 24 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 25 | 25 |
import fr.ird.observe.client.db.ClientDataContext;
|
| 26 | 26 |
import fr.ird.observe.client.db.constants.DataContextType;
|
| 27 |
-import fr.ird.observe.client.ui.util.UIHelper;
|
|
| 28 | 27 |
import fr.ird.observe.client.ui.content.ContentMode;
|
| 29 | 28 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler;
|
| 30 | 29 |
import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
| 31 | 30 |
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
| 31 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.seine.RouteSeineNavigationTreeNode;
|
|
| 32 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.seine.RoutesSeineNavigationTreeNode;
|
|
| 33 |
+import fr.ird.observe.client.ui.util.UIHelper;
|
|
| 34 |
+import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
|
| 35 |
+import fr.ird.observe.dto.data.seine.RouteDto;
|
|
| 36 |
+import fr.ird.observe.dto.data.seine.RouteHelper;
|
|
| 37 |
+import fr.ird.observe.dto.data.seine.RouteReference;
|
|
| 38 |
+import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 32 | 39 |
import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
| 33 | 40 |
import fr.ird.observe.dto.form.Form;
|
| 34 | 41 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineHelper;
|
| 35 | 42 |
import fr.ird.observe.dto.referential.seine.VesselActivitySeineReference;
|
| 36 | 43 |
import fr.ird.observe.dto.result.TripChildSaveResultDto;
|
| 37 |
-import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
|
| 38 |
-import fr.ird.observe.dto.data.seine.RouteDto;
|
|
| 39 |
-import fr.ird.observe.dto.data.seine.RouteHelper;
|
|
| 40 |
-import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 41 |
-import java.util.Date;
|
|
| 42 |
-import javax.swing.JOptionPane;
|
|
| 44 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 43 | 45 |
import org.apache.commons.logging.Log;
|
| 44 | 46 |
import org.apache.commons.logging.LogFactory;
|
| 45 | 47 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 46 | 48 |
import org.nuiton.util.DateUtil;
|
| 47 | 49 |
import org.nuiton.validator.NuitonValidatorScope;
|
| 48 | 50 |
|
| 51 |
+import javax.swing.*;
|
|
| 52 |
+import java.util.Date;
|
|
| 49 | 53 |
|
| 50 | 54 |
import static org.nuiton.i18n.I18n.n;
|
| 51 | 55 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -204,8 +208,6 @@ class RouteUIHandler extends ContentOpenableUIHandler<RouteDto, RouteUI> impleme |
| 204 | 208 |
// on doit toujours recharger le nœud de la marée puisque le nombre de routes a changé
|
| 205 | 209 |
setUpdateMareeNodeTag(true);
|
| 206 | 210 |
|
| 207 |
- obtainChildPosition(bean);
|
|
| 208 |
- |
|
| 209 | 211 |
// ouverture de la route
|
| 210 | 212 |
if (notPersisted) {
|
| 211 | 213 |
getOpenDataManager().openRoute(getSelectedParentId(), bean.getId());
|
| ... | ... | @@ -215,8 +217,12 @@ class RouteUIHandler extends ContentOpenableUIHandler<RouteDto, RouteUI> impleme |
| 215 | 217 |
}
|
| 216 | 218 |
|
| 217 | 219 |
@Override
|
| 218 |
- protected int getOpenablePosition(String parentId, RouteDto bean) {
|
|
| 219 |
- return getRouteService().getRoutePositionInTripSeine(parentId, bean.getId());
|
|
| 220 |
+ protected int getOpenablePosition() {
|
|
| 221 |
+ NavigationTree treeHelper = getNavigationTree();
|
|
| 222 |
+ NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
|
| 223 |
+ RoutesSeineNavigationTreeNode parentNode = (RoutesSeineNavigationTreeNode) node.getParent();
|
|
| 224 |
+ RouteReference reference = DtoModelHelper.fromDataDto(getBeanType()).toReference(getDecoratorService().getReferentialLocale(), getBean());
|
|
| 225 |
+ return RouteSeineNavigationTreeNode.sortReferences(parentNode, node, reference, RouteReference::getDate);
|
|
| 220 | 226 |
}
|
| 221 | 227 |
|
| 222 | 228 |
@Override
|
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 |
* #%L
|
| 3 | 3 |
* ObServe :: Client
|
| 4 | 4 |
* %%
|
| 5 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 5 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -28,8 +28,14 @@ import fr.ird.observe.client.db.constants.DataContextType; |
| 28 | 28 |
import fr.ird.observe.client.ui.content.ContentMode;
|
| 29 | 29 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler;
|
| 30 | 30 |
import fr.ird.observe.client.ui.content.open.ContentOpenableUIModel;
|
| 31 |
+import fr.ird.observe.client.ui.tree.navigation.NavigationTree;
|
|
| 32 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
|
| 33 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.seine.ProgramSeineNavigationTreeNode;
|
|
| 31 | 34 |
import fr.ird.observe.client.ui.util.tripMap.TripMapUI;
|
| 32 | 35 |
import fr.ird.observe.dto.data.TripMapDto;
|
| 36 |
+import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 37 |
+import fr.ird.observe.dto.data.seine.TripSeineHelper;
|
|
| 38 |
+import fr.ird.observe.dto.data.seine.TripSeineReference;
|
|
| 33 | 39 |
import fr.ird.observe.dto.form.Form;
|
| 34 | 40 |
import fr.ird.observe.dto.reference.DtoReferenceCollection;
|
| 35 | 41 |
import fr.ird.observe.dto.referential.PersonDto;
|
| ... | ... | @@ -39,18 +45,17 @@ import fr.ird.observe.dto.referential.VesselDto; |
| 39 | 45 |
import fr.ird.observe.dto.referential.VesselHelper;
|
| 40 | 46 |
import fr.ird.observe.dto.referential.VesselReference;
|
| 41 | 47 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 42 |
-import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 43 |
-import fr.ird.observe.dto.data.seine.TripSeineHelper;
|
|
| 44 |
-import java.util.Date;
|
|
| 45 |
-import java.util.List;
|
|
| 46 |
-import javax.swing.JComponent;
|
|
| 47 |
-import javax.swing.JTabbedPane;
|
|
| 48 |
-import javax.swing.SwingUtilities;
|
|
| 48 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 49 | 49 |
import org.apache.commons.logging.Log;
|
| 50 | 50 |
import org.apache.commons.logging.LogFactory;
|
| 51 | 51 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 52 | 52 |
import org.nuiton.util.DateUtil;
|
| 53 | 53 |
|
| 54 |
+import javax.swing.JComponent;
|
|
| 55 |
+import javax.swing.JTabbedPane;
|
|
| 56 |
+import javax.swing.SwingUtilities;
|
|
| 57 |
+import java.util.Date;
|
|
| 58 |
+import java.util.List;
|
|
| 54 | 59 |
|
| 55 | 60 |
import static org.nuiton.i18n.I18n.n;
|
| 56 | 61 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -289,9 +294,6 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein |
| 289 | 294 |
SaveResultDto saveResult = getTripSeineService().save(bean);
|
| 290 | 295 |
saveResult.toDto(bean);
|
| 291 | 296 |
|
| 292 |
- // recuperation de la position de la maree dans le program
|
|
| 293 |
- obtainChildPosition(bean);
|
|
| 294 |
- |
|
| 295 | 297 |
// ouverture de la marée
|
| 296 | 298 |
if (notPersisted) {
|
| 297 | 299 |
getOpenDataManager().openTripSeine(getSelectedParentId(), bean.getId());
|
| ... | ... | @@ -300,9 +302,14 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein |
| 300 | 302 |
return true;
|
| 301 | 303 |
}
|
| 302 | 304 |
|
| 303 |
- protected int getOpenablePosition(String parentId, TripSeineDto bean) {
|
|
| 305 |
+ protected int getOpenablePosition() {
|
|
| 304 | 306 |
|
| 305 |
- return getTripSeineService().getTripSeinePositionInProgram(parentId, bean.getId());
|
|
| 307 |
+ NavigationTree treeHelper = getNavigationTree();
|
|
| 308 |
+ NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
|
| 309 |
+ ProgramSeineNavigationTreeNode parentNode = (ProgramSeineNavigationTreeNode) node.getParent();
|
|
| 310 |
+ TripSeineReference reference = DtoModelHelper.fromDataDto(getBeanType()).toReference(getDecoratorService().getReferentialLocale(), getBean());
|
|
| 311 |
+ return ProgramSeineNavigationTreeNode.sortReferences(parentNode, node, reference, TripSeineReference::getStartDate);
|
|
| 312 |
+// return getTripSeineService().getTripSeinePositionInProgram(parentId, bean.getId());
|
|
| 306 | 313 |
}
|
| 307 | 314 |
|
| 308 | 315 |
@Override
|
| ... | ... | @@ -48,10 +48,9 @@ import static org.nuiton.i18n.I18n.t; |
| 48 | 48 |
*/
|
| 49 | 49 |
public abstract class ContentOpenableUIHandler<E extends DataDto, U extends ContentOpenableUI<E, U>> extends ContentUIHandler<E, U> {
|
| 50 | 50 |
|
| 51 |
- private static final String POSITION_OPENABLE = "positionOpenable";
|
|
| 51 |
+// private static final String POSITION_OPENABLE = "positionOpenable";
|
|
| 52 | 52 |
|
| 53 |
- /** Logger */
|
|
| 54 |
- static private final Log log = LogFactory.getLog(ContentOpenableUIHandler.class);
|
|
| 53 |
+ private static final Log log = LogFactory.getLog(ContentOpenableUIHandler.class);
|
|
| 55 | 54 |
private static final String UPDATE_TRIP_NODE = "updateTripNode";
|
| 56 | 55 |
protected final String closeMessage;
|
| 57 | 56 |
|
| ... | ... | @@ -147,8 +146,7 @@ public abstract class ContentOpenableUIHandler<E extends DataDto, U extends Cont |
| 147 | 146 |
model.setMode(ContentMode.READ);
|
| 148 | 147 |
|
| 149 | 148 |
removeAllMessages(ui);
|
| 150 |
- addMessage(ui, NuitonValidatorScope.INFO,
|
|
| 151 |
- getTypeI18nKey(bean.getClass()), t(closeMessage));
|
|
| 149 |
+ addMessage(ui, NuitonValidatorScope.INFO, getTypeI18nKey(bean.getClass()), t(closeMessage));
|
|
| 152 | 150 |
|
| 153 | 151 |
NavigationTree treeHelper = getNavigationTree();
|
| 154 | 152 |
treeHelper.reloadSelectedNode(bean instanceof TripSeineDto || bean instanceof TripLonglineDto, true);
|
| ... | ... | @@ -162,9 +160,9 @@ public abstract class ContentOpenableUIHandler<E extends DataDto, U extends Cont |
| 162 | 160 |
|
| 163 | 161 |
super.afterSave(refresh);
|
| 164 | 162 |
|
| 165 |
- U ui = getUi();
|
|
| 163 |
+ E bean = getBean();
|
|
| 164 |
+ int position = getOpenablePosition();
|
|
| 166 | 165 |
|
| 167 |
- int position = ui.getContextValue(Integer.class, POSITION_OPENABLE);
|
|
| 168 | 166 |
NavigationTree treeHelper = getNavigationTree();
|
| 169 | 167 |
|
| 170 | 168 |
NavigationTreeNodeSupport node = treeHelper.getSelectedNode();
|
| ... | ... | @@ -176,8 +174,6 @@ public abstract class ContentOpenableUIHandler<E extends DataDto, U extends Cont |
| 176 | 174 |
|
| 177 | 175 |
boolean create = node.getId() == null;
|
| 178 | 176 |
|
| 179 |
- E bean = getBean();
|
|
| 180 |
- |
|
| 181 | 177 |
int oldPosition;
|
| 182 | 178 |
if (create) {
|
| 183 | 179 |
oldPosition = parentNode.getChildCount();
|
| ... | ... | @@ -258,20 +254,20 @@ public abstract class ContentOpenableUIHandler<E extends DataDto, U extends Cont |
| 258 | 254 |
createDataUI();
|
| 259 | 255 |
}
|
| 260 | 256 |
|
| 261 |
- protected final void obtainChildPosition(E bean) {
|
|
| 262 |
- |
|
| 263 |
- String containerId = getSelectedParentId();
|
|
| 264 |
- |
|
| 265 |
- int position = getOpenablePosition(containerId, bean);
|
|
| 266 |
- |
|
| 267 |
- if (log.isDebugEnabled()) {
|
|
| 268 |
- log.debug("Position of child : " + position);
|
|
| 269 |
- }
|
|
| 270 |
- |
|
| 271 |
- getUi().setContextValue(position, POSITION_OPENABLE);
|
|
| 272 |
- }
|
|
| 273 |
- |
|
| 274 |
- protected abstract int getOpenablePosition(String parentId, E bean);
|
|
| 257 |
+// protected final void obtainChildPosition(E bean) {
|
|
| 258 |
+//
|
|
| 259 |
+// String containerId = getSelectedParentId();
|
|
| 260 |
+//
|
|
| 261 |
+// int position = getOpenablePosition(containerId, bean);
|
|
| 262 |
+//
|
|
| 263 |
+// if (log.isDebugEnabled()) {
|
|
| 264 |
+// log.debug("Position of child : " + position);
|
|
| 265 |
+// }
|
|
| 266 |
+//
|
|
| 267 |
+// getUi().setContextValue(position, POSITION_OPENABLE);
|
|
| 268 |
+// }
|
|
| 269 |
+ |
|
| 270 |
+ protected abstract int getOpenablePosition();
|
|
| 275 | 271 |
|
| 276 | 272 |
protected final void finalizeOpenUI(ContentMode mode, boolean create) {
|
| 277 | 273 |
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.client.ui.tree.navigation.nodes; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Client
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -26,15 +26,22 @@ import fr.ird.observe.client.ui.ObserveKeyStrokes; |
| 26 | 26 |
import fr.ird.observe.client.ui.actions.content.SelectNodeUIAction;
|
| 27 | 27 |
import fr.ird.observe.client.ui.content.ContentUI;
|
| 28 | 28 |
import fr.ird.observe.client.ui.tree.ObserveTreeNodeSupport;
|
| 29 |
-import java.awt.Color;
|
|
| 30 |
-import java.awt.event.ActionEvent;
|
|
| 31 |
-import java.util.Enumeration;
|
|
| 32 |
-import javax.swing.AbstractAction;
|
|
| 33 |
-import javax.swing.JMenuItem;
|
|
| 29 |
+import fr.ird.observe.dto.IdDto;
|
|
| 30 |
+import fr.ird.observe.dto.reference.DtoReference;
|
|
| 34 | 31 |
import org.apache.commons.logging.Log;
|
| 35 | 32 |
import org.apache.commons.logging.LogFactory;
|
| 36 | 33 |
import org.nuiton.jaxx.runtime.JAXXObject;
|
| 37 | 34 |
|
| 35 |
+import javax.swing.AbstractAction;
|
|
| 36 |
+import javax.swing.JMenuItem;
|
|
| 37 |
+import java.awt.Color;
|
|
| 38 |
+import java.awt.event.ActionEvent;
|
|
| 39 |
+import java.util.ArrayList;
|
|
| 40 |
+import java.util.Comparator;
|
|
| 41 |
+import java.util.Enumeration;
|
|
| 42 |
+import java.util.List;
|
|
| 43 |
+import java.util.function.Function;
|
|
| 44 |
+ |
|
| 38 | 45 |
/**
|
| 39 | 46 |
* Created on 14/11/16.
|
| 40 | 47 |
*
|
| ... | ... | @@ -48,6 +55,21 @@ public abstract class NavigationTreeNodeSupport<O> extends ObserveTreeNodeSuppor |
| 48 | 55 |
|
| 49 | 56 |
private boolean loaded;
|
| 50 | 57 |
|
| 58 |
+ public static <D extends IdDto, R extends DtoReference<D, R>, C extends Comparable> int sortReferences(Iterable<? extends ReferenceNavigationTreeNodeSupport<D, R>> childNodes, NavigationTreeNodeSupport selectedNode, R reference, Function<R, C> comparatorFunction) {
|
|
| 59 |
+ List<R> references = new ArrayList<>();
|
|
| 60 |
+ for (ReferenceNavigationTreeNodeSupport<D, R> childNode : childNodes) {
|
|
| 61 |
+ if (childNode == selectedNode) {
|
|
| 62 |
+ continue;
|
|
| 63 |
+ }
|
|
| 64 |
+ references.add(childNode.getData());
|
|
| 65 |
+ }
|
|
| 66 |
+ references.add(reference);
|
|
| 67 |
+ @SuppressWarnings("unchecked")
|
|
| 68 |
+ Comparator<R> comparing = Comparator.comparing(comparatorFunction);
|
|
| 69 |
+ references.sort(comparing);
|
|
| 70 |
+ return references.indexOf(reference);
|
|
| 71 |
+ }
|
|
| 72 |
+ |
|
| 51 | 73 |
public abstract Class<?> getDataType();
|
| 52 | 74 |
|
| 53 | 75 |
public abstract void reload();
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.client.ui.tree.navigation.nodes; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Client
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -26,9 +26,14 @@ import fr.ird.observe.client.ObserveSwingApplicationContext; |
| 26 | 26 |
import fr.ird.observe.dto.IdDto;
|
| 27 | 27 |
import fr.ird.observe.dto.IdHelper;
|
| 28 | 28 |
import fr.ird.observe.dto.reference.DtoReference;
|
| 29 |
-import java.awt.Color;
|
|
| 30 | 29 |
import org.nuiton.decorator.Decorator;
|
| 31 | 30 |
|
| 31 |
+import java.awt.*;
|
|
| 32 |
+import java.util.ArrayList;
|
|
| 33 |
+import java.util.Comparator;
|
|
| 34 |
+import java.util.List;
|
|
| 35 |
+import java.util.function.Function;
|
|
| 36 |
+ |
|
| 32 | 37 |
/**
|
| 33 | 38 |
* Created on 14/11/16.
|
| 34 | 39 |
*
|
| ... | ... | @@ -39,17 +44,17 @@ public abstract class ReferenceNavigationTreeNodeSupport<D extends IdDto, R exte |
| 39 | 44 |
|
| 40 | 45 |
private final Decorator<R> decorator;
|
| 41 | 46 |
|
| 42 |
- @Override
|
|
| 43 |
- public String getId() {
|
|
| 44 |
- return getData().getId();
|
|
| 45 |
- }
|
|
| 46 |
- |
|
| 47 | 47 |
protected ReferenceNavigationTreeNodeSupport(R data, boolean allowChildren) {
|
| 48 | 48 |
super(data, allowChildren && data.isPersisted());
|
| 49 | 49 |
this.decorator = ObserveSwingApplicationContext.get().getDecoratorService().getReferenceDecorator(getDataType());
|
| 50 | 50 |
}
|
| 51 | 51 |
|
| 52 | 52 |
@Override
|
| 53 |
+ public String getId() {
|
|
| 54 |
+ return getData().getId();
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+ @Override
|
|
| 53 | 58 |
public Color getColor() {
|
| 54 | 59 |
return isPersisted() ? super.getColor() : Color.RED;
|
| 55 | 60 |
}
|
| ... | ... | @@ -25,10 +25,15 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.longline; |
| 25 | 25 |
import fr.ird.observe.client.ui.content.data.longline.ActivityLonglinesUI;
|
| 26 | 26 |
import fr.ird.observe.client.ui.tree.navigation.nodes.ClassNavigationTreeNode;
|
| 27 | 27 |
import fr.ird.observe.client.ui.tree.navigation.nodes.WithChildsToReload;
|
| 28 |
+import fr.ird.observe.client.ui.tree.navigation.nodes.seine.TripSeineNavigationTreeNode;
|
|
| 28 | 29 |
import fr.ird.observe.dto.IdHelper;
|
| 29 | 30 |
import fr.ird.observe.dto.data.longline.ActivityLonglineDto;
|
| 30 | 31 |
import fr.ird.observe.dto.data.longline.ActivityLonglineReference;
|
| 31 | 32 |
import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
| 33 |
+import org.apache.commons.collections4.EnumerationUtils;
|
|
| 34 |
+import org.jetbrains.annotations.NotNull;
|
|
| 35 |
+ |
|
| 36 |
+import java.util.Iterator;
|
|
| 32 | 37 |
|
| 33 | 38 |
|
| 34 | 39 |
import static org.nuiton.i18n.I18n.t;
|
| ... | ... | @@ -39,7 +44,7 @@ import static org.nuiton.i18n.I18n.t; |
| 39 | 44 |
* @author Tony Chemit - dev@tchemit.fr
|
| 40 | 45 |
* @since 6.0
|
| 41 | 46 |
*/
|
| 42 |
-public class ActivitiesLonglineNavigationTreeNode extends ClassNavigationTreeNode<ActivityLonglineDto> implements WithChildsToReload {
|
|
| 47 |
+public class ActivitiesLonglineNavigationTreeNode extends ClassNavigationTreeNode<ActivityLonglineDto> implements WithChildsToReload, Iterable<ActivityLonglineNavigationTreeNode> {
|
|
| 43 | 48 |
|
| 44 | 49 |
ActivitiesLonglineNavigationTreeNode() {
|
| 45 | 50 |
super(ActivityLonglineDto.class, true, t("observe.ui.tree.activities"));
|
| ... | ... | @@ -67,4 +72,11 @@ public class ActivitiesLonglineNavigationTreeNode extends ClassNavigationTreeNod |
| 67 | 72 |
add(new ActivityLonglineNavigationTreeNode(reference));
|
| 68 | 73 |
}
|
| 69 | 74 |
}
|
| 75 |
+ |
|
| 76 |
+ @SuppressWarnings("unchecked")
|
|
| 77 |
+ @NotNull
|
|
| 78 |
+ @Override
|
|
| 79 |
+ public Iterator<ActivityLonglineNavigationTreeNode> iterator() {
|
|
| 80 |
+ return EnumerationUtils.toList(children()).iterator();
|
|
| 81 |
+ }
|
|
| 70 | 82 |
}
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.longline; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Client
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -27,9 +27,11 @@ import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNod |
| 27 | 27 |
import fr.ird.observe.dto.data.longline.TripLonglineReference;
|
| 28 | 28 |
import fr.ird.observe.dto.referential.ProgramDto;
|
| 29 | 29 |
import fr.ird.observe.dto.referential.ProgramReference;
|
| 30 |
+import org.apache.commons.collections4.EnumerationUtils;
|
|
| 31 |
+import org.jetbrains.annotations.NotNull;
|
|
| 32 |
+ |
|
| 30 | 33 |
import java.util.Collection;
|
| 31 | 34 |
import java.util.Iterator;
|
| 32 |
-import org.apache.commons.collections4.EnumerationUtils;
|
|
| 33 | 35 |
|
| 34 | 36 |
/**
|
| 35 | 37 |
* Created on 14/11/16.
|
| ... | ... | @@ -74,8 +76,11 @@ public class ProgramLonglineNavigationTreeNode extends ReferenceNavigationTreeNo |
| 74 | 76 |
return TripLonglinesUI.class;
|
| 75 | 77 |
}
|
| 76 | 78 |
|
| 79 |
+ @SuppressWarnings("unchecked")
|
|
| 80 |
+ @NotNull
|
|
| 77 | 81 |
@Override
|
| 78 | 82 |
public Iterator<TripLonglineNavigationTreeNode> iterator() {
|
| 79 | 83 |
return EnumerationUtils.toList(children()).iterator();
|
| 80 | 84 |
}
|
| 85 |
+ |
|
| 81 | 86 |
}
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.seine; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Client
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -26,10 +26,13 @@ import fr.ird.observe.client.ui.content.data.seine.ActivitySeinesUI; |
| 26 | 26 |
import fr.ird.observe.client.ui.tree.navigation.nodes.ClassNavigationTreeNode;
|
| 27 | 27 |
import fr.ird.observe.client.ui.tree.navigation.nodes.WithChildsToReload;
|
| 28 | 28 |
import fr.ird.observe.dto.IdHelper;
|
| 29 |
-import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
|
| 30 | 29 |
import fr.ird.observe.dto.data.seine.ActivitySeineDto;
|
| 31 | 30 |
import fr.ird.observe.dto.data.seine.ActivitySeineReference;
|
| 31 |
+import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
|
| 32 |
+import org.apache.commons.collections4.EnumerationUtils;
|
|
| 33 |
+import org.jetbrains.annotations.NotNull;
|
|
| 32 | 34 |
|
| 35 |
+import java.util.Iterator;
|
|
| 33 | 36 |
|
| 34 | 37 |
import static org.nuiton.i18n.I18n.t;
|
| 35 | 38 |
|
| ... | ... | @@ -39,7 +42,7 @@ import static org.nuiton.i18n.I18n.t; |
| 39 | 42 |
* @author Tony Chemit - dev@tchemit.fr
|
| 40 | 43 |
* @since 6.0
|
| 41 | 44 |
*/
|
| 42 |
-public class ActivitiesSeineNavigationTreeNode extends ClassNavigationTreeNode<ActivitySeineDto> implements WithChildsToReload {
|
|
| 45 |
+public class ActivitiesSeineNavigationTreeNode extends ClassNavigationTreeNode<ActivitySeineDto> implements WithChildsToReload ,Iterable<ActivitySeineNavigationTreeNode> {
|
|
| 43 | 46 |
|
| 44 | 47 |
ActivitiesSeineNavigationTreeNode() {
|
| 45 | 48 |
super(ActivitySeineDto.class, true, t("observe.ui.tree.activities"));
|
| ... | ... | @@ -67,4 +70,11 @@ public class ActivitiesSeineNavigationTreeNode extends ClassNavigationTreeNode<A |
| 67 | 70 |
add(new ActivitySeineNavigationTreeNode(reference));
|
| 68 | 71 |
}
|
| 69 | 72 |
}
|
| 73 |
+ |
|
| 74 |
+ @SuppressWarnings("unchecked")
|
|
| 75 |
+ @NotNull
|
|
| 76 |
+ @Override
|
|
| 77 |
+ public Iterator<ActivitySeineNavigationTreeNode> iterator() {
|
|
| 78 |
+ return EnumerationUtils.toList(children()).iterator();
|
|
| 79 |
+ }
|
|
| 70 | 80 |
}
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.seine; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Client
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -24,12 +24,14 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.seine; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.ui.content.data.seine.TripSeinesUI;
|
| 26 | 26 |
import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
|
| 27 |
+import fr.ird.observe.dto.data.seine.TripSeineReference;
|
|
| 27 | 28 |
import fr.ird.observe.dto.referential.ProgramDto;
|
| 28 | 29 |
import fr.ird.observe.dto.referential.ProgramReference;
|
| 29 |
-import fr.ird.observe.dto.data.seine.TripSeineReference;
|
|
| 30 |
+import org.apache.commons.collections4.EnumerationUtils;
|
|
| 31 |
+import org.jetbrains.annotations.NotNull;
|
|
| 32 |
+ |
|
| 30 | 33 |
import java.util.Collection;
|
| 31 | 34 |
import java.util.Iterator;
|
| 32 |
-import org.apache.commons.collections4.EnumerationUtils;
|
|
| 33 | 35 |
|
| 34 | 36 |
/**
|
| 35 | 37 |
* Created on 14/11/16.
|
| ... | ... | @@ -61,7 +63,6 @@ public class ProgramSeineNavigationTreeNode extends ReferenceNavigationTreeNodeS |
| 61 | 63 |
return TripSeinesUI.class;
|
| 62 | 64 |
}
|
| 63 | 65 |
|
| 64 |
- |
|
| 65 | 66 |
@Override
|
| 66 | 67 |
public boolean isOpen() {
|
| 67 | 68 |
// le programme est ouvert si l'une de ses marées est ouverte
|
| ... | ... | @@ -73,6 +74,8 @@ public class ProgramSeineNavigationTreeNode extends ReferenceNavigationTreeNodeS |
| 73 | 74 |
return false;
|
| 74 | 75 |
}
|
| 75 | 76 |
|
| 77 |
+ @SuppressWarnings("unchecked")
|
|
| 78 |
+ @NotNull
|
|
| 76 | 79 |
@Override
|
| 77 | 80 |
public Iterator<TripSeineNavigationTreeNode> iterator() {
|
| 78 | 81 |
return EnumerationUtils.toList(children()).iterator();
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.seine; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Client
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -26,10 +26,13 @@ import fr.ird.observe.client.ui.content.data.seine.RoutesUI; |
| 26 | 26 |
import fr.ird.observe.client.ui.tree.navigation.nodes.ClassNavigationTreeNode;
|
| 27 | 27 |
import fr.ird.observe.client.ui.tree.navigation.nodes.WithChildsToReload;
|
| 28 | 28 |
import fr.ird.observe.dto.IdHelper;
|
| 29 |
-import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
|
| 30 | 29 |
import fr.ird.observe.dto.data.seine.RouteDto;
|
| 31 | 30 |
import fr.ird.observe.dto.data.seine.RouteReference;
|
| 31 |
+import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
|
| 32 |
+import org.apache.commons.collections4.EnumerationUtils;
|
|
| 33 |
+import org.jetbrains.annotations.NotNull;
|
|
| 32 | 34 |
|
| 35 |
+import java.util.Iterator;
|
|
| 33 | 36 |
|
| 34 | 37 |
import static org.nuiton.i18n.I18n.t;
|
| 35 | 38 |
|
| ... | ... | @@ -39,7 +42,7 @@ import static org.nuiton.i18n.I18n.t; |
| 39 | 42 |
* @author Tony Chemit - dev@tchemit.fr
|
| 40 | 43 |
* @since 6.0
|
| 41 | 44 |
*/
|
| 42 |
-public class RoutesSeineNavigationTreeNode extends ClassNavigationTreeNode<RouteDto> implements WithChildsToReload {
|
|
| 45 |
+public class RoutesSeineNavigationTreeNode extends ClassNavigationTreeNode<RouteDto> implements WithChildsToReload,Iterable<RouteSeineNavigationTreeNode> {
|
|
| 43 | 46 |
|
| 44 | 47 |
RoutesSeineNavigationTreeNode() {
|
| 45 | 48 |
super(RouteDto.class, true, t("observe.ui.tree.seine.routes"));
|
| ... | ... | @@ -67,4 +70,12 @@ public class RoutesSeineNavigationTreeNode extends ClassNavigationTreeNode<Route |
| 67 | 70 |
add(new RouteSeineNavigationTreeNode(reference));
|
| 68 | 71 |
}
|
| 69 | 72 |
}
|
| 73 |
+ |
|
| 74 |
+ |
|
| 75 |
+ @SuppressWarnings("unchecked")
|
|
| 76 |
+ @NotNull
|
|
| 77 |
+ @Override
|
|
| 78 |
+ public Iterator<RouteSeineNavigationTreeNode> iterator() {
|
|
| 79 |
+ return EnumerationUtils.toList(children()).iterator();
|
|
| 80 |
+ }
|
|
| 70 | 81 |
}
|
| ... | ... | @@ -4,7 +4,7 @@ package fr.ird.observe.services.client; |
| 4 | 4 |
* #%L
|
| 5 | 5 |
* ObServe :: Services client implementation
|
| 6 | 6 |
* %%
|
| 7 |
- * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 | 8 |
* %%
|
| 9 | 9 |
* This program is free software: you can redistribute it and/or modify
|
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| ... | ... | @@ -36,9 +36,11 @@ import fr.ird.observe.services.gson.ObserveDataSourceConnectionAdapter; |
| 36 | 36 |
import fr.ird.observe.services.gson.ObserveDtoGsonSupplier;
|
| 37 | 37 |
import fr.ird.observe.services.service.ObserveService;
|
| 38 | 38 |
import io.ultreia.java4all.http.HResponseBuilder;
|
| 39 |
-import java.io.IOException;
|
|
| 40 |
-import java.util.Objects;
|
|
| 41 | 39 |
import org.apache.commons.lang3.StringUtils;
|
| 40 |
+import org.apache.commons.logging.Log;
|
|
| 41 |
+import org.apache.commons.logging.LogFactory;
|
|
| 42 |
+ |
|
| 43 |
+import java.util.Objects;
|
|
| 42 | 44 |
|
| 43 | 45 |
/**
|
| 44 | 46 |
* Created on 16/08/15.
|
| ... | ... | @@ -47,8 +49,10 @@ import org.apache.commons.lang3.StringUtils; |
| 47 | 49 |
*/
|
| 48 | 50 |
public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport implements ObserveDataSourceConfigurationRestConstants {
|
| 49 | 51 |
|
| 52 |
+ private static final Log log = LogFactory.getLog(ObserveServiceFactoryClient.class);
|
|
| 53 |
+ private final static ClassMappingClient CLASS_MAPPING = ClassMappingClient.get();
|
|
| 54 |
+ private final static int LOCATE_PREFIX_LENGTH = ObserveServiceClientSupport.class.getPackage().getName().length();
|
|
| 50 | 55 |
private final ObserveRequestBuilderFactory requestBuilderFactory = new ObserveRequestBuilderFactory();
|
| 51 |
- |
|
| 52 | 56 |
private final HResponseBuilder responseBuilder = HResponseBuilder.create(new ObserveDtoGsonSupplier() {
|
| 53 | 57 |
|
| 54 | 58 |
@Override
|
| ... | ... | @@ -60,9 +64,6 @@ public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport im |
| 60 | 64 |
|
| 61 | 65 |
}
|
| 62 | 66 |
});
|
| 63 |
- private final static ClassMappingClient CLASS_MAPPING = ClassMappingClient.get();
|
|
| 64 |
- |
|
| 65 |
- private final static int LOCATE_PREFIX_LENGTH = ObserveServiceClientSupport.class.getPackage().getName().length();
|
|
| 66 | 67 |
|
| 67 | 68 |
@Override
|
| 68 | 69 |
public <S extends ObserveService> boolean accept(ObserveDataSourceConfiguration dataSourceConfiguration, Class<S> serviceType) {
|
| ... | ... | @@ -130,8 +131,12 @@ public class ObserveServiceFactoryClient extends ObserveServiceFactorySupport im |
| 130 | 131 |
}
|
| 131 | 132 |
|
| 132 | 133 |
@Override
|
| 133 |
- public void close() throws IOException {
|
|
| 134 |
- responseBuilder.close();
|
|
| 134 |
+ public void close() {
|
|
| 135 |
+ try {
|
|
| 136 |
+ responseBuilder.close();
|
|
| 137 |
+ } catch (Exception e) {
|
|
| 138 |
+ log.error("Can't close response builder", e);
|
|
| 139 |
+ }
|
|
| 135 | 140 |
}
|
| 136 | 141 |
|
| 137 | 142 |
}
|