Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
cede2ae6
by Tony Chemit at 2022-08-03T11:23:52+02:00
22 changed files:
- client/core/src/main/java/fr/ird/observe/client/ClientUIContext.java
- client/core/src/main/java/fr/ird/observe/client/ClientUIContextApi.java
- client/core/src/main/java/fr/ird/observe/client/WithClientUIContextApi.java
- client/core/src/main/java/fr/ird/observe/client/main/MainUIModel.java
- client/core/src/main/java/fr/ird/observe/client/main/ObserveMainUI.jaxx
- client/core/src/main/java/fr/ird/observe/client/main/ObserveMainUIHandler.java
- client/core/src/main/java/fr/ird/observe/client/main/focus/MainUIFocusModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorBodyContent.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/avdth/ImportDialogHandler.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/avdth/ImportDialogModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/actions/DeleteEdit.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/DataSourceEditorMenu.jaxx
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/DataSourceEditorMenuModel.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/NavigationTree.java
- toolkit/api/src/main/i18n/getters/java.getter
- toolkit/api/src/main/i18n/translations/toolkit_en_GB.properties
- toolkit/api/src/main/i18n/translations/toolkit_es_ES.properties
- toolkit/api/src/main/i18n/translations/toolkit_fr_FR.properties
- toolkit/api/src/main/java/fr/ird/observe/navigation/tree/navigation/NavigationTreeSelectionModel.java
- toolkit/api/src/main/java/fr/ird/observe/navigation/tree/navigation/NavigationTreeSupport.java
- client/core/src/main/java/fr/ird/observe/client/util/busy/BusyLayerUI.java → toolkit/api/src/main/java/fr/ird/observe/spi/ui/BusyLayerUI.java
- client/core/src/main/java/fr/ird/observe/client/util/busy/BusyModel.java → toolkit/api/src/main/java/fr/ird/observe/spi/ui/BusyModel.java
Changes:
| ... | ... | @@ -33,7 +33,7 @@ import fr.ird.observe.client.main.body.NoBodyContentComponent; |
| 33 | 33 | import fr.ird.observe.client.main.callback.ObserveUICallbackManager;
|
| 34 | 34 | import fr.ird.observe.client.main.focus.MainUIFocusModel;
|
| 35 | 35 | import fr.ird.observe.client.util.action.ObserveExecutorService;
|
| 36 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 36 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 37 | 37 | import fr.ird.observe.client.util.session.ObserveSwingSessionHelper;
|
| 38 | 38 | import fr.ird.observe.dto.data.ps.dcp.FloatingObjectPresetsManager;
|
| 39 | 39 | import fr.ird.observe.navigation.id.IdProjectManager;
|
| ... | ... | @@ -32,7 +32,7 @@ import fr.ird.observe.client.main.ObserveMainUI; |
| 32 | 32 | import fr.ird.observe.client.main.callback.ObserveUICallbackManager;
|
| 33 | 33 | import fr.ird.observe.client.main.focus.MainUIFocusModel;
|
| 34 | 34 | import fr.ird.observe.client.util.UIHelper;
|
| 35 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 35 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 36 | 36 | import fr.ird.observe.client.util.session.ObserveSwingSessionHelper;
|
| 37 | 37 | import fr.ird.observe.dto.ObserveUtil;
|
| 38 | 38 | import fr.ird.observe.dto.data.ps.dcp.FloatingObjectPresetsManager;
|
| ... | ... | @@ -31,7 +31,7 @@ import fr.ird.observe.client.main.MainUIModel; |
| 31 | 31 | import fr.ird.observe.client.main.ObserveMainUI;
|
| 32 | 32 | import fr.ird.observe.client.main.callback.ObserveUICallbackManager;
|
| 33 | 33 | import fr.ird.observe.client.main.focus.MainUIFocusModel;
|
| 34 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 34 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 35 | 35 | import fr.ird.observe.client.util.session.ObserveSwingSessionHelper;
|
| 36 | 36 | import fr.ird.observe.dto.data.ps.dcp.FloatingObjectPresetsManager;
|
| 37 | 37 | import fr.ird.observe.navigation.id.IdProjectManager;
|
| ... | ... | @@ -24,7 +24,7 @@ package fr.ird.observe.client.main; |
| 24 | 24 | |
| 25 | 25 | import fr.ird.observe.client.configuration.ClientConfig;
|
| 26 | 26 | import fr.ird.observe.client.main.focus.MainUIFocusModel;
|
| 27 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 27 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 28 | 28 | import io.ultreia.java4all.bean.AbstractJavaBean;
|
| 29 | 29 | import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
|
| 30 | 30 |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | |
| 23 | 23 | <import>
|
| 24 | 24 | fr.ird.observe.client.util.JMenuWithAccelerator
|
| 25 | - fr.ird.observe.client.util.busy.BusyModel
|
|
| 25 | + fr.ird.observe.spi.ui.BusyModel
|
|
| 26 | 26 | fr.ird.observe.client.configuration.ClientConfig
|
| 27 | 27 | fr.ird.observe.client.main.MainUIModel
|
| 28 | 28 | fr.ird.observe.client.main.body.MainUIBodyContentManager
|
| ... | ... | @@ -27,8 +27,8 @@ import fr.ird.observe.client.configuration.ClientConfig; |
| 27 | 27 | import fr.ird.observe.client.main.body.MainUIBodyContentManager;
|
| 28 | 28 | import fr.ird.observe.client.util.ObserveKeyStrokesSupport;
|
| 29 | 29 | import fr.ird.observe.client.util.UIHelper;
|
| 30 | -import fr.ird.observe.client.util.busy.BusyLayerUI;
|
|
| 31 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 30 | +import fr.ird.observe.spi.ui.BusyLayerUI;
|
|
| 31 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 32 | 32 | import org.apache.logging.log4j.LogManager;
|
| 33 | 33 | import org.apache.logging.log4j.Logger;
|
| 34 | 34 | import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| ... | ... | @@ -22,7 +22,7 @@ package fr.ird.observe.client.main.focus; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 25 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 26 | 26 | import org.apache.logging.log4j.LogManager;
|
| 27 | 27 | import org.apache.logging.log4j.Logger;
|
| 28 | 28 |
| ... | ... | @@ -44,7 +44,7 @@ import fr.ird.observe.client.main.ObserveMainUI; |
| 44 | 44 | import fr.ird.observe.client.main.body.MainUIBodyContent;
|
| 45 | 45 | import fr.ird.observe.client.main.focus.MainUIFocusModel;
|
| 46 | 46 | import fr.ird.observe.client.util.UIHelper;
|
| 47 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 47 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 48 | 48 | import fr.ird.observe.dto.ProgressionModel;
|
| 49 | 49 | import fr.ird.observe.dto.ProtectedIdsCommon;
|
| 50 | 50 | import fr.ird.observe.dto.db.BabModelVersionException;
|
| ... | ... | @@ -25,7 +25,7 @@ package fr.ird.observe.client.datasource.editor.api.avdth; |
| 25 | 25 | import fr.ird.observe.client.WithClientUIContextApi;
|
| 26 | 26 | import fr.ird.observe.client.util.ObserveBlockingLayerUI;
|
| 27 | 27 | import fr.ird.observe.client.util.UIHelper;
|
| 28 | -import fr.ird.observe.client.util.busy.BusyLayerUI;
|
|
| 28 | +import fr.ird.observe.spi.ui.BusyLayerUI;
|
|
| 29 | 29 | import fr.ird.observe.client.util.init.UIInitHelper;
|
| 30 | 30 | import fr.ird.observe.dto.referential.common.OceanReference;
|
| 31 | 31 | import fr.ird.observe.dto.referential.ps.common.ProgramReference;
|
| ... | ... | @@ -27,7 +27,7 @@ import fr.ird.observe.client.configuration.ClientConfig; |
| 27 | 27 | import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
| 28 | 28 | import fr.ird.observe.client.datasource.validation.ContentMessageTableModel;
|
| 29 | 29 | import fr.ird.observe.client.main.focus.FocusDispatcher;
|
| 30 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 30 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 31 | 31 | import fr.ird.observe.dto.ProgressionModel;
|
| 32 | 32 | import fr.ird.observe.services.service.data.ps.AvdthDataImportConfiguration;
|
| 33 | 33 | import fr.ird.observe.services.service.data.ps.AvdthDataImportResult;
|
| ... | ... | @@ -29,7 +29,7 @@ import fr.ird.observe.client.datasource.editor.api.content.ContentUIHandler; |
| 29 | 29 | import fr.ird.observe.client.datasource.editor.api.content.data.edit.ContentEditUI;
|
| 30 | 30 | import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTree;
|
| 31 | 31 | import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
|
| 32 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 32 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 33 | 33 | import fr.ird.observe.dto.IdDto;
|
| 34 | 34 | import fr.ird.observe.dto.data.EditableDto;
|
| 35 | 35 | import fr.ird.observe.spi.decoration.DecoratorService;
|
| ... | ... | @@ -18,20 +18,7 @@ |
| 18 | 18 | #L%
|
| 19 | 19 | -->
|
| 20 | 20 | <JMenu id='menuStorage'>
|
| 21 | - |
|
| 22 | - <!-- <import>-->
|
|
| 23 | - <!-- fr.ird.observe.client.main.MainUIModel-->
|
|
| 24 | - <!-- fr.ird.observe.client.util.busy.BusyModel-->
|
|
| 25 | - <!-- fr.ird.observe.client.util.UIHelper-->
|
|
| 26 | - <!-- java.util.Locale-->
|
|
| 27 | - <!-- java.awt.Dimension-->
|
|
| 28 | - <!-- javax.swing.BoxLayout-->
|
|
| 29 | - <!-- javax.swing.JComponent-->
|
|
| 30 | - <!-- </import>-->
|
|
| 31 | - |
|
| 32 | 21 | <DataSourceEditorMenuModel id="uiModel" initializer="getContextValue(DataSourceEditorMenuModel.class)"/>
|
| 33 | - <!-- <BusyModel id='busyModel' initializer='uiModel.getBusyModel()'/>-->
|
|
| 34 | - <!-- <MainUIModel id="mainUiModel" initializer="uiModel.getMainUIModel()"/>-->
|
|
| 35 | 22 | <JMenuItem id='changeStorage'/>
|
| 36 | 23 | <JMenuItem id='reloadStorage' styleClass="optional"/>
|
| 37 | 24 | <JMenuItem id='closeStorage' styleClass="optional"/>
|
| ... | ... | @@ -30,7 +30,7 @@ import fr.ird.observe.client.main.MainUIModel; |
| 30 | 30 | import fr.ird.observe.client.main.body.MainUIBodyContentManager;
|
| 31 | 31 | import fr.ird.observe.client.main.body.NoBodyContentComponent;
|
| 32 | 32 | import fr.ird.observe.client.util.UIHelper;
|
| 33 | -import fr.ird.observe.client.util.busy.BusyModel;
|
|
| 33 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 34 | 34 | import io.ultreia.java4all.bean.AbstractJavaBean;
|
| 35 | 35 | import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
|
| 36 | 36 | import org.apache.logging.log4j.LogManager;
|
| ... | ... | @@ -93,7 +93,7 @@ public class NavigationTree extends JXTree implements WithClientUIContextApi { |
| 93 | 93 | |
| 94 | 94 | @Override
|
| 95 | 95 | public void updateUI() {
|
| 96 | - setSelectionModel(new NavigationTreeSelectionModel());
|
|
| 96 | + setSelectionModel(new NavigationTreeSelectionModel(getBusyModel()));
|
|
| 97 | 97 | super.updateUI();
|
| 98 | 98 | }
|
| 99 | 99 |
| ... | ... | @@ -87,3 +87,4 @@ observe.ui.datasource.storage.error.rest.password.required |
| 87 | 87 | observe.ui.datasource.storage.error.rest.user.required
|
| 88 | 88 | observe.ui.datasource.storage.error.rest.user.unknown
|
| 89 | 89 | observe.ui.message.warning.will.be.delete
|
| 90 | +observe.ui.tree.loading.node |
| ... | ... | @@ -155,3 +155,4 @@ observe.ui.datasource.storage.error.rest.password.required=Password is mandatory |
| 155 | 155 | observe.ui.datasource.storage.error.rest.user.required=User login is mandatory
|
| 156 | 156 | observe.ui.datasource.storage.error.rest.user.unknown=User "%s" is not defined on server
|
| 157 | 157 | observe.ui.message.warning.will.be.delete=%1$s\n\nBe ware, export will replace existing data.
|
| 158 | +observe.ui.tree.loading.node=Loading selected node |
| ... | ... | @@ -155,3 +155,4 @@ observe.ui.datasource.storage.error.rest.password.required=Le contraseña es obl |
| 155 | 155 | observe.ui.datasource.storage.error.rest.user.required=El usuario es obligatorio
|
| 156 | 156 | observe.ui.datasource.storage.error.rest.user.unknown=El usuario "%s" no es conocido del servidor
|
| 157 | 157 | observe.ui.message.warning.will.be.delete=%1$s\n\nAtención, la exportación reemplazará la marea existente.
|
| 158 | +observe.ui.tree.loading.node=Loading selected node |
| ... | ... | @@ -155,3 +155,4 @@ observe.ui.datasource.storage.error.rest.password.required=Le mot de passe est o |
| 155 | 155 | observe.ui.datasource.storage.error.rest.user.required=L'utilisateur est obligatoire
|
| 156 | 156 | observe.ui.datasource.storage.error.rest.user.unknown=L'utilisateur "%s" est inconnu sur le serveur
|
| 157 | 157 | observe.ui.message.warning.will.be.delete=%1$s\n\nAttention, l'export remplacera la marée existante.
|
| 158 | +observe.ui.tree.loading.node=Chargement du nœud sélectionné |
| ... | ... | @@ -25,9 +25,12 @@ package fr.ird.observe.navigation.tree.navigation; |
| 25 | 25 | import fr.ird.observe.navigation.tree.navigation.event.NavigationTreeSelectionEvent;
|
| 26 | 26 | import fr.ird.observe.navigation.tree.navigation.event.NavigationTreeSelectionListener;
|
| 27 | 27 | import fr.ird.observe.navigation.tree.navigation.event.NavigationTreeSelectionVetoException;
|
| 28 | +import fr.ird.observe.spi.ui.BusyModel;
|
|
| 29 | +import io.ultreia.java4all.i18n.I18n;
|
|
| 28 | 30 | import org.apache.logging.log4j.LogManager;
|
| 29 | 31 | import org.apache.logging.log4j.Logger;
|
| 30 | 32 | |
| 33 | +import javax.swing.SwingUtilities;
|
|
| 31 | 34 | import javax.swing.event.TreeExpansionEvent;
|
| 32 | 35 | import javax.swing.tree.DefaultTreeSelectionModel;
|
| 33 | 36 | import javax.swing.tree.ExpandVetoException;
|
| ... | ... | @@ -47,8 +50,10 @@ public class NavigationTreeSelectionModel extends DefaultTreeSelectionModel { |
| 47 | 50 | private static final Logger log = LogManager.getLogger(NavigationTreeSelectionModel.class);
|
| 48 | 51 | |
| 49 | 52 | private boolean skipCheckPreviousContent;
|
| 53 | + private final BusyModel busyModel;
|
|
| 50 | 54 | |
| 51 | - public NavigationTreeSelectionModel() {
|
|
| 55 | + public NavigationTreeSelectionModel(BusyModel busyModel) {
|
|
| 56 | + this.busyModel = busyModel;
|
|
| 52 | 57 | setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
| 53 | 58 | }
|
| 54 | 59 | |
| ... | ... | @@ -84,29 +89,35 @@ public class NavigationTreeSelectionModel extends DefaultTreeSelectionModel { |
| 84 | 89 | return;
|
| 85 | 90 | }
|
| 86 | 91 | TreePath path = pPaths[0];
|
| 87 | - boolean[] newness = new boolean[pPaths.length];
|
|
| 88 | - Arrays.fill(newness, true);
|
|
| 89 | - NavigationTreeSelectionEvent event = new NavigationTreeSelectionEvent(this, pPaths, newness, getLeadSelectionPath(), path, skipCheckPreviousContent);
|
|
| 90 | 92 | boolean canChange = !Objects.equals(path, getSelectionPath());
|
| 91 | 93 | if (canChange) {
|
| 94 | + boolean[] newness = new boolean[pPaths.length];
|
|
| 95 | + Arrays.fill(newness, true);
|
|
| 96 | + NavigationTreeSelectionEvent event = new NavigationTreeSelectionEvent(this, pPaths, newness, getLeadSelectionPath(), path, skipCheckPreviousContent);
|
|
| 92 | 97 | try {
|
| 93 | 98 | fireVetoValueChanged(event);
|
| 94 | 99 | } catch (NavigationTreeSelectionVetoException e) {
|
| 95 | 100 | canChange = false;
|
| 96 | 101 | }
|
| 97 | 102 | }
|
| 98 | - |
|
| 99 | -// boolean canChange = skipCheckPreviousContent || (!Objects.equals(path, getSelectionPath()) && contentUIManager.closeSelectedContentUI());
|
|
| 100 | 103 | if (!canChange) {
|
| 101 | 104 | // cancel the change of node
|
| 102 | 105 | log.warn(String.format("Do not change selection path: %s against: %s", path, getSelectionPath()));
|
| 103 | 106 | return;
|
| 104 | 107 | }
|
| 105 | -// FIXME Move this in a listener
|
|
| 106 | -// if (skipCheckPreviousContent) {
|
|
| 107 | -// contentUIManager.closeSafeSelectedContentUI();
|
|
| 108 | -// }
|
|
| 109 | - super.setSelectionPaths(pPaths);
|
|
| 108 | + // can now safely select new path
|
|
| 109 | + if (busyModel == null) {
|
|
| 110 | + super.setSelectionPaths(pPaths);
|
|
| 111 | + } else {
|
|
| 112 | + busyModel.addTask(I18n.t("observe.ui.tree.loading.node"));
|
|
| 113 | + SwingUtilities.invokeLater(() -> {
|
|
| 114 | + try {
|
|
| 115 | + setSelectionPaths(pPaths);
|
|
| 116 | + } finally {
|
|
| 117 | + busyModel.popTask();
|
|
| 118 | + }
|
|
| 119 | + });
|
|
| 120 | + }
|
|
| 110 | 121 | }
|
| 111 | 122 | |
| 112 | 123 | @Override
|
| ... | ... | @@ -54,7 +54,7 @@ public class NavigationTreeSupport<R extends NavigationTreeNode, M extends Navig |
| 54 | 54 | |
| 55 | 55 | @Override
|
| 56 | 56 | public void updateUI() {
|
| 57 | - setSelectionModel(new NavigationTreeSelectionModel());
|
|
| 57 | + setSelectionModel(new NavigationTreeSelectionModel(null));
|
|
| 58 | 58 | super.updateUI();
|
| 59 | 59 | }
|
| 60 | 60 |
| 1 | -package fr.ird.observe.client.util.busy;
|
|
| 1 | +package fr.ird.observe.spi.ui;
|
|
| 2 | 2 | |
| 3 | 3 | /*-
|
| 4 | 4 | * #%L
|
| 5 | - * ObServe Client :: Core
|
|
| 5 | + * ObServe Toolkit :: API
|
|
| 6 | 6 | * %%
|
| 7 | 7 | * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
| 8 | 8 | * %%
|
| 1 | -package fr.ird.observe.client.util.busy;
|
|
| 1 | +package fr.ird.observe.spi.ui;
|
|
| 2 | 2 | |
| 3 | 3 | /*-
|
| 4 | 4 | * #%L
|
| 5 | - * ObServe Client :: Core
|
|
| 5 | + * ObServe Toolkit :: API
|
|
| 6 | 6 | * %%
|
| 7 | 7 | * Copyright (C) 2008 - 2022 IRD, Ultreia.io
|
| 8 | 8 | * %%
|