branch develop updated (fdf844d -> a2aaca6)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git discards fdf844d [iso] Utilisation d'un vrai modèle pour l'ui principale new a2aaca6 [iso] Utilisation d'un vrai modèle pour l'ui principale This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (fdf844d) \ N -- N -- N refs/heads/develop (a2aaca6) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit a2aaca6465df5baa6bf14169c3e93adb5865e506 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Dec 5 13:24:56 2016 +0100 [iso] Utilisation d'un vrai modèle pour l'ui principale Summary of changes: .../application/swing/ui/ObserveMainUI.jcss | 1 + .../application/swing/ui/ObserveMainUIHandler.java | 2 - .../swing/ui/ObserveMainUIInitializer.java | 11 +-- .../application/swing/ui/ObserveMainUIModel.java | 79 ++++++++-------------- .../swing/ui/actions/AbstractUIAction.java | 10 ++- .../ChangeApplicationLanguageActionSupport.java | 6 +- .../ChangeApplicationLanguageToEnglishAction.java | 1 + .../ChangeApplicationLanguageToFrenchAction.java | 1 + .../ChangeApplicationLanguageToSpanishAction.java | 1 + .../menu/config/ChangeDbLanguageActionSupport.java | 3 - .../config/ChangeDbLanguageToEnglishAction.java | 1 + .../config/ChangeDbLanguageToFrenchAction.java | 1 + .../config/ChangeDbLanguageToSpanishAction.java | 1 + .../menu/storage/StartServerModeAction.java | 4 +- 14 files changed, 49 insertions(+), 73 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit a2aaca6465df5baa6bf14169c3e93adb5865e506 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Dec 5 13:24:56 2016 +0100 [iso] Utilisation d'un vrai modèle pour l'ui principale --- .../application/swing/LocalDatabaseBackupTask.java | 4 +- .../application/swing/ObserveActionExecutor.java | 4 +- .../ObserveSwingApplicationDataSourcesManager.java | 8 +- .../application/swing/ui/ObserveMainUI.jaxx | 26 +- .../application/swing/ui/ObserveMainUI.jcss | 98 ++--- .../application/swing/ui/ObserveMainUIHandler.java | 86 +---- .../swing/ui/ObserveMainUIInitializer.java | 32 +- .../application/swing/ui/ObserveMainUIModel.java | 424 +++++++++++++++++++++ .../ird/observe/application/swing/ui/UIHelper.java | 4 +- .../swing/ui/actions/AbstractUIAction.java | 10 +- .../ui/actions/content/DeleteDataUIAction.java | 4 +- .../actions/content/DeleteReferenceUIAction.java | 4 +- .../ui/actions/global/AbstractGlobalUIAction.java | 2 +- .../actions/global/ChangeFocusGlobalUIAction.java | 6 +- .../ChangeApplicationLanguageActionSupport.java | 6 +- .../ChangeApplicationLanguageToEnglishAction.java | 1 + .../ChangeApplicationLanguageToFrenchAction.java | 1 + .../ChangeApplicationLanguageToSpanishAction.java | 1 + .../menu/config/ChangeDbLanguageActionSupport.java | 3 - .../config/ChangeDbLanguageToEnglishAction.java | 1 + .../config/ChangeDbLanguageToFrenchAction.java | 1 + .../config/ChangeDbLanguageToSpanishAction.java | 1 + .../actions/menu/storage/CloseStorageAction.java | 4 +- .../actions/menu/storage/ReloadStorageAction.java | 4 +- .../menu/storage/StartH2WebServerAction.java | 4 +- .../menu/storage/StartServerModeAction.java | 6 +- .../menu/storage/StopH2WebServerAction.java | 4 +- .../actions/menu/storage/StopServerModeAction.java | 4 +- .../swing/ui/admin/AdminUILauncher.java | 10 +- .../swing/ui/content/ContentUIManager.java | 4 +- .../LonglineDetailCompositionUIHandler.java | 6 +- .../open/impl/longline/TripLonglineUIHandler.java | 4 +- .../open/impl/seine/TripSeineUIHandler.java | 4 +- .../ui/content/table/ContentTableUIHandler.java | 2 +- .../swing/ui/util/tripMap/TripMapUIHandler.java | 4 +- 35 files changed, 544 insertions(+), 243 deletions(-) diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/LocalDatabaseBackupTask.java b/application-swing/src/main/java/fr/ird/observe/application/swing/LocalDatabaseBackupTask.java index 982aaf7..052e108 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/LocalDatabaseBackupTask.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/LocalDatabaseBackupTask.java @@ -82,7 +82,7 @@ public class LocalDatabaseBackupTask implements Runnable { log.info(startMessage + " - " + file); } long t0 = System.nanoTime(); - mainUI.setBusy(true); + mainUI.getModel().setBusy(true); try { mainDataSource.newDataSourceService().backup(file); } finally { @@ -91,7 +91,7 @@ public class LocalDatabaseBackupTask implements Runnable { if (log.isInfoEnabled()) { log.info(endMessage + " - " + file); } - mainUI.setBusy(false); + mainUI.getModel().setBusy(false); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveActionExecutor.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveActionExecutor.java index 9e5514f..4abe990 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveActionExecutor.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveActionExecutor.java @@ -74,7 +74,7 @@ public class ObserveActionExecutor extends ActionExecutor { } ObserveMainUI ui = ObserveSwingApplicationContext.get().getMainUI(); if (ui != null) { - ui.setBusy(true); + ui.getModel().setBusy(true); } } @@ -184,7 +184,7 @@ public class ObserveActionExecutor extends ActionExecutor { } ObserveMainUI ui = ObserveSwingApplicationContext.get().getMainUI(); if (count < 1 && ui != null) { - ui.setBusy(false); + ui.getModel().setBusy(false); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveSwingApplicationDataSourcesManager.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveSwingApplicationDataSourcesManager.java index 5e58b62..a29de90 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveSwingApplicationDataSourcesManager.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ObserveSwingApplicationDataSourcesManager.java @@ -306,13 +306,13 @@ public class ObserveSwingApplicationDataSourcesManager implements Closeable { if (success) { // on peut retourner sur cette base - mainUI.setMode(ObserveUIMode.DB); + mainUI.getModel().setMode(ObserveUIMode.DB); } } else { // on peut retourner sur cette base - mainUI.setMode(ObserveUIMode.NO_DB); + mainUI.getModel().setMode(ObserveUIMode.NO_DB); if (askToCreate) { @@ -445,7 +445,7 @@ public class ObserveSwingApplicationDataSourcesManager implements Closeable { log.debug("dispose ui from storage " + source.getLabel() + ": " + mainUI.getName()); } - mainUI.setMode(ObserveUIMode.NO_DB); + mainUI.getModel().setMode(ObserveUIMode.NO_DB); displayInfo(t("observe.message.db.closed", source.getLabel())); @@ -491,7 +491,7 @@ public class ObserveSwingApplicationDataSourcesManager implements Closeable { dataContext.populateOpens(openIds); mainUI.getInitializer().loadNavigationUI(); - mainUI.setMode(ObserveUIMode.DB); + mainUI.getModel().setMode(ObserveUIMode.DB); mainUI.getStatus().setStatus(t("observe.message.db.loaded", source.getLabel())); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx index 7527ea7..833c73a 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jaxx @@ -98,9 +98,7 @@ </import> - <ObserveUIMode id='mode' javaBean='ObserveUIMode.NO_DB'/> - - <Boolean id='h2WebServer' javaBean='Boolean.FALSE'/> + <ObserveMainUIModel id='model' initializer='getContextValue(ObserveMainUIModel.class)'/> <ObserveActionMap id="observeActionMap" constructorParams='this'/> @@ -124,14 +122,6 @@ <DataContext id='dataContext' initializer='ObserveSwingApplicationContext.get().getDataContext()'/> - <Boolean id='mainFromSynchro' javaBean='false'/> - - <Boolean id='busy' javaBean='false'/> - - <Boolean id='focusOnNavigation' javaBean='false'/> - - <Boolean id='showMnemonic' javaBean='config.isShowMnemonic()'/> - <CardLayout2 id='contentLayout'/> <CardLayout2Ext id='bodyLayout' constructorParams='this, "body"'/> @@ -140,18 +130,6 @@ <script><![CDATA[ -protected Icon updateStorageSatutIcon(boolean isOpened) { - return handler.updateStorageSatutIcon(); -} - -protected String updateStorageSatutText(boolean isOpened) { - return handler.updateStorageSatutText(); -} - -protected String updateStorageStatutToolTipText(boolean isOpened) { - return handler.updateStorageStatutToolTipText(); -} - @Override public void dispose() { log.debug("dispose main ui " + this); @@ -169,7 +147,6 @@ protected void finalize() throws Throwable { super.finalize(); destroy(); } - ]]> </script> @@ -246,7 +223,6 @@ protected void finalize() throws Throwable { <!-- pour afficher le status du service de persistance et changer de service de persistance --> <JButton id='storageStatus' - enabled='{getHandler().acceptMode(getMode(), !isBusy(), ObserveUIMode.DB, ObserveUIMode.NO_DB)}' onActionPerformed="JComponent c = (JComponent) event.getSource(); storageStatusPopup.show(c, 0, c.getHeight());"/> </JToolBar> diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jcss b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jcss index e2d3165..61fe6a2 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jcss +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUI.jcss @@ -34,11 +34,11 @@ JSplitPane { #mainFrame { defaultCloseOperation: "do_nothing_on_close"; - iconImage: {SwingUtil.createImageIcon("logo-OT_web.png").getImage()}; + iconImage: {UIHelper.createImageIcon("logo-OT_web.png").getImage()}; } #menu { - enabled: {!isBusy()}; + enabled:{!model.isBusy()}; } #navigationNoAction { @@ -50,31 +50,31 @@ JSplitPane { // trip menu #navigationOpenAction { - action: {new ReOpenUIAction(this)}; + _observeAction:{ReOpenUIAction.ACTION_NAME}; } #navigationCloseAction { - action: {new CloseOpenUIAction(this)}; + _observeAction:{CloseOpenUIAction.ACTION_NAME}; } #navigationDeleteAction { - action: {new DeleteDataUIAction(this)}; + _observeAction:{DeleteDataUIAction.ACTION_NAME}; } #menuFile { text: "observe.menu.file"; mnemonic: F; - enabled: {getHandler().acceptMode(getMode(), !isBusy(), !isMainFromSynchro(), ObserveUIMode.NO_DB, ObserveUIMode.DB)}; + enabled: {model.isFileEnabled()}; } #menuFileToFullScreen { - action:{new ToFullScreenAction(this)}; - visible:{!config.isFullScreen()} + _observeAction:{ToFullScreenAction.ACTION_NAME}; + visible:{!model.isFullScreen()} } #menuFileToWindowScreen { - action:{new ToWindowScreenAction(this)}; - visible:{config.isFullScreen()} + _observeAction:{ToWindowScreenAction.ACTION_NAME}; + visible:{model.isFullScreen()} } #menuConfigurationConfiguration { @@ -85,7 +85,7 @@ JSplitPane { text: "observe.menu.configuration"; toolTipText: "observe.menu.configuration.tip"; mnemonic: C; - enabled: {getHandler().acceptMode(getMode(), !isBusy(), !isMainFromSynchro(), ObserveUIMode.DB, ObserveUIMode.NO_DB)}; + enabled: {model.isConfigEnabled()}; } #menuLanguage { @@ -93,7 +93,6 @@ JSplitPane { toolTipText: "observe.menu.locale"; actionIcon: "translate"; mnemonic: L; - enabled: {getHandler().acceptMode(getMode(), !isBusy(), !isMainFromSynchro(), ObserveUIMode.DB, ObserveUIMode.NO_DB)}; } #menuApplicationLanguage { @@ -105,17 +104,17 @@ JSplitPane { #menuApplicationLanguageFR { _observeAction:{ChangeApplicationLanguageToFrenchAction.ACTION_NAME}; - enabled: {!getHandler().acceptLocale(getConfig().getLocale(), "fr_FR")}; + enabled:{model.isChangeApplicationLanguageToFrenchEnabled()}; } #menuApplicationLanguageUK { _observeAction:{ChangeApplicationLanguageToEnglishAction.ACTION_NAME}; - enabled: {!getHandler().acceptLocale(getConfig().getLocale(), "en_GB")}; + enabled: {model.isChangeApplicationLanguageToEnglishEnabled()}; } #menuApplicationLanguageES { _observeAction:{ChangeApplicationLanguageToSpanishAction.ACTION_NAME}; - enabled: {!getHandler().acceptLocale(getConfig().getLocale(), "es_ES")}; + enabled: {model.isChangeApplicationLanguageToSpanishEnabled()}; } #menuDbLanguage { @@ -127,17 +126,17 @@ JSplitPane { #menuDbLanguageFR { _observeAction:{ChangeDbLanguageToFrenchAction.ACTION_NAME}; - enabled: {!getHandler().acceptLocale(getConfig().getDbLocale(), "fr_FR")}; + enabled: {model.isChangeDbLanguageToFrenchEnabled()}; } #menuDbLanguageUK { _observeAction:{ChangeDbLanguageToEnglishAction.ACTION_NAME}; - enabled: {!getHandler().acceptLocale(getConfig().getDbLocale(), "en_GB")}; + enabled: {model.isChangeDbLanguageToEnglishEnabled()}; } #menuDbLanguageES { _observeAction:{ChangeDbLanguageToSpanishAction.ACTION_NAME}; - enabled: {!getHandler().acceptLocale(getConfig().getDbLocale(), "es_ES")}; + enabled: {model.isChangeDbLanguageToSpanishEnabled()}; } #menuConfigurationReloadDefault { @@ -146,7 +145,7 @@ JSplitPane { #menuConfigurationReloadResources { _observeAction:{ReloadResourcesAction.ACTION_NAME}; - visible: {getConfig().isDevMode()}; + visible: {model.isDevMode()}; } #menuFileReloadApplication { @@ -160,7 +159,7 @@ JSplitPane { #menuStorage { text: "observe.menu.storage"; mnemonic: S; - enabled: {getHandler().acceptMode(getMode(), !isBusy(), !isMainFromSynchro(), ObserveUIMode.DB, ObserveUIMode.NO_DB)}; + enabled: {model.isStorageEnabled()}; } #menuStorageInfo { @@ -169,17 +168,17 @@ JSplitPane { #menuStorageReload { _observeAction:{ReloadStorageAction.ACTION_NAME}; - enabled: {getHandler().acceptMode(getMode(), getConfig().isMainStorageOpened(), ObserveUIMode.DB)}; + enabled: {model.isStorageReloadEnabled()}; } #menuStorageClose { _observeAction:{CloseStorageAction.ACTION_NAME}; - enabled: {getHandler().acceptMode(getMode(), getConfig().isMainStorageOpened(), ObserveUIMode.DB)}; + enabled: {model.isStorageCloseEnabled()}; } #menuStorageStartServerMode { _observeAction:{StartServerModeAction.ACTION_NAME}; - visible: {getHandler().acceptMode(getMode(), getConfig().isLocalStorageExist() && !isBusy() && !isMainFromSynchro(), ObserveUIMode.NO_DB)}; + visible: {model.isStartServerVisible()}; } #menuStorageChange { @@ -188,18 +187,18 @@ JSplitPane { #menuStorageLoadFromFile { _observeAction:{ImportStorageFromFileAction.ACTION_NAME}; - enabled: {getHandler().acceptMode(getMode(), ObserveUIMode.DB, ObserveUIMode.NO_DB)}; + enabled: {model.isStorageImportEnabled()}; } #menuStorageSaveToFile { _observeAction:{SaveStorageToFileAction.ACTION_NAME}; - enabled: {getHandler().acceptMode(getMode(), getConfig().isMainStorageOpened(), ObserveUIMode.DB)}; + enabled: {model.isStorageSaveEnabled()}; } #menuActions { text: "observe.menu.actions"; mnemonic: A; - enabled: {getHandler().acceptMode(getMode(), !isBusy() && !isMainFromSynchro(), ObserveUIMode.DB, ObserveUIMode.NO_DB)}; + enabled: {model.isActionsEnabled()}; } #menuActionsDataSynchro { @@ -233,7 +232,7 @@ JSplitPane { #menuNavigation { text: "observe.menu.navigation"; mnemonic: N; - enabled:{getHandler().acceptMode(getMode(), !isBusy(), ObserveUIMode.DB)}; + enabled:{model.isNavigationEnabled()}; } #menuNavigationProgram { @@ -262,15 +261,8 @@ JSplitPane { #menuHelp { text: "observe.menu.help"; - mnemonic: e; - enabled: {!isBusy()}; -} - -#menuHelpHelp { - text: "observe.action.help"; - toolTipText: "observe.action.help.tip"; - actionIcon: "help"; - mnemonic: e; + mnemonic: E; + enabled:true; } #menuHelpSite { @@ -285,13 +277,10 @@ JSplitPane { opaque: false; borderPainted: false; focusable: false; - toolTipText: {updateStorageStatutToolTipText(getConfig().isMainStorageOpened())}; - text: {updateStorageSatutText(getConfig().isMainStorageOpened())}; - icon: {updateStorageSatutIcon(getConfig().isMainStorageOpened())}; - _localIcon: {SwingUtil.getUIManagerActionIcon("db-local")}; - _remoteIcon: {SwingUtil.getUIManagerActionIcon("db-remote")}; - _serverIcon: {SwingUtil.getUIManagerActionIcon("db-server")}; - _noneIcon: {SwingUtil.getUIManagerActionIcon("db-none")}; + enabled:{model.isStorageStatusEnabled()}; + toolTipText: {model.getStorageStatusTip()}; + text: {model.getStorageStatusText()}; + icon: {model.getStorageStatusIcon()}; } #storageStatusInfo { @@ -304,19 +293,12 @@ JSplitPane { #storageStatusClose { _observeAction:{CloseStorageAction.ACTION_NAME}; - enabled: {getHandler().acceptMode(getMode(), getConfig().isMainStorageOpened(), ObserveUIMode.DB)}; + enabled: {model.isStorageCloseEnabled()}; } #storageStatusReload { _observeAction:{ReloadStorageAction.ACTION_NAME}; - enabled: {getHandler().acceptMode(getMode(), getConfig().isMainStorageOpened(), ObserveUIMode.DB)}; -} - -#closeHelp { - _observeAction:{CloseHelpAction.ACTION_NAME}; - borderPainted: false; - rolloverEnabled: false; - focusable: false; + enabled: {model.isStorageReloadEnabled()}; } #errorTable { @@ -332,7 +314,7 @@ JSplitPane { #busyBlockLayerUI { useIcon: false; blockingColor: {UIManager.getColor("BlockingLayerUI.blockingColor")}; - block: {isBusy()}; + block: {model.isBusy()}; acceptedComponentNames: {UIHelper.ACCEPTABLE_COMPONENTS}; } @@ -405,12 +387,12 @@ JSplitPane { #startH2WebServer{ _observeAction:{StartH2WebServerAction.ACTION_NAME}; - enabled: {!isH2WebServer()}; + enabled: {!model.isH2WebServer()}; } #stopH2WebServer{ _observeAction:{StopH2WebServerAction.ACTION_NAME}; - enabled: {isH2WebServer()}; + enabled: {model.isH2WebServer()}; } #stopServerMode { @@ -422,7 +404,7 @@ JSplitPane { } #bodyLayout { - selected: {getMode().name()}; + selected: {model.getMode().name()}; } #body { layout: {bodyLayout}; @@ -434,12 +416,12 @@ JSplitPane { #status { showBusy: {true}; - busy: {isBusy()}; + busy: {model.isBusy()}; } #toolbar { layout: {new BoxLayout(toolbar, 0)}; - enabled: {!isBusy()}; + //enabled: {!model.isBusy()}; } #emptySelectionLabel { diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIHandler.java index f9bdaba..3ab56e9 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIHandler.java @@ -22,14 +22,8 @@ package fr.ird.observe.application.swing.ui; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; -import fr.ird.observe.application.swing.db.ObserveSwingDataSource; import jaxx.runtime.spi.UIHandler; -import javax.swing.Icon; -import java.util.Locale; - -import static org.nuiton.i18n.I18n.t; - /** * Le handler de l'ui principale. * @@ -39,85 +33,11 @@ import static org.nuiton.i18n.I18n.t; */ public class ObserveMainUIHandler implements UIHandler<ObserveMainUI> { - public static final String H2_SERVER_URL_PATTERN = "jdbc:h2:%s/%s/obstuna"; - - private ObserveMainUI ui; - - protected Icon updateStorageSatutIcon() { - Icon icon; - - if (ui.getConfig().isMainStorageOpened()) { - - ObserveSwingDataSource service = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource(); - - if (service.isLocal()) { - icon = (Icon) ui.storageStatus.getClientProperty("localIcon"); - } else if (service.isRemote()) { - icon = (Icon) ui.storageStatus.getClientProperty("remoteIcon"); - } else { - icon = (Icon) ui.storageStatus.getClientProperty("serverIcon"); - } - } else { - icon = (Icon) ui.storageStatus.getClientProperty("noneIcon"); - } - return icon; - } - - protected String updateStorageSatutText() { - String text; - if (ui.getConfig().isMainStorageOpened()) { - ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource(); - text = source.getLabel(); - } else { - text = t("observe.message.db.none.loaded"); - } - return text; - } - - protected String updateStorageStatutToolTipText() { - String text; - if (ui.getConfig().isMainStorageOpened()) { - ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource(); - text = t("observe.message.loaded.tip", source.getLabel()); - } else { - text = t("observe.message.db.none.loaded.tip"); - } - return text; - } - - public boolean acceptMode(ObserveUIMode mode, ObserveUIMode... modes) { - return acceptMode(mode, true, modes); - } - - public boolean acceptMode(ObserveUIMode mode, boolean condition, ObserveUIMode... modes) { - if (condition) { - for (ObserveUIMode m : modes) { - if (m.equals(mode)) { - return true; - } - } - } - return false; - } - - public boolean acceptMode(ObserveUIMode mode, boolean notBusy, boolean condition, ObserveUIMode... modes) { - if (notBusy && condition) { - for (ObserveUIMode m : modes) { - if (m.equals(mode)) { - return true; - } - } - } - return false; - } - - public boolean acceptLocale(Locale l, String expected) { - return l != null && l.toString().equals(expected); - } - @Override public void beforeInit(ObserveMainUI ui) { - this.ui = ui; + ObserveMainUIModel model = new ObserveMainUIModel(); + model.init(ObserveSwingApplicationContext.get().getConfig()); + ui.setContextValue(model); } @Override diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIInitializer.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIInitializer.java index c3eb9b6..29c8057 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIInitializer.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIInitializer.java @@ -133,7 +133,7 @@ public class ObserveMainUIInitializer { return; } - ui.setBusy(true); + ui.getModel().setBusy(true); try { @@ -142,7 +142,7 @@ public class ObserveMainUIInitializer { } catch (Exception e) { UIHelper.handlingError(e); } finally { - ui.setBusy(false); + ui.getModel().setBusy(false); String params; if (node instanceof StringNavigationTreeNodeSupport) { params = t(((StringNavigationTreeNodeSupport) node).getData()); @@ -317,7 +317,7 @@ public class ObserveMainUIInitializer { Object[] ids = null; if (ui != null) { - oldMode = ui.getMode(); + oldMode = ui.getModel().getMode(); ids = ui.getNavigation().getSelectedIds(); @@ -345,7 +345,7 @@ public class ObserveMainUIInitializer { } } - ui.setMode(oldMode); + ui.getModel().setMode(oldMode); if (oldMode == ObserveUIMode.DB) { @@ -373,24 +373,18 @@ public class ObserveMainUIInitializer { protected void initialize() { - //FIXME Je ne sais pas comment ces bindings sont générés et on n'en veut pas!!! - ui.removeDataBinding(ObserveMainUI.BINDING_MENU_NAVIGATION_PROGRAM_ENABLED); - ui.removeDataBinding(ObserveMainUI.BINDING_MENU_NAVIGATION_TRIP_ENABLED); - ui.removeDataBinding(ObserveMainUI.BINDING_MENU_NAVIGATION_ROUTE_ENABLED); - ui.removeDataBinding(ObserveMainUI.BINDING_MENU_NAVIGATION_ACTIVITY_ENABLED); - ui.removeDataBinding(ObserveMainUI.BINDING_MENU_NAVIGATION_SET_ENABLED); - ObserveActionMap actionMap = ui.getObserveActionMap(); for (Object o : ui.get$objectMap().values()) { if (o instanceof AbstractButton) { init(actionMap, (AbstractButton) o); - continue; } } + ui.getModel().reload(ui.getConfig()); + MnemonicHelper.addKeyStrokeFromMnemonic(ui); // bad binding, force value @@ -408,12 +402,12 @@ public class ObserveMainUIInitializer { UIHelper.setLayerUI(ui.getBody(), ui.getBusyBlockLayerUI()); // ecoute des changements de l'état busy - ui.addPropertyChangeListener(ObserveMainUI.PROPERTY_BUSY, evt -> { + ui.getModel().addPropertyChangeListener("busy", evt -> { boolean newvalue = (boolean) evt.getNewValue(); updateBusyState(newvalue); }); - ui.addPropertyChangeListener(ObserveMainUI.PROPERTY_FOCUS_ON_NAVIGATION, evt -> { + ui.getModel().addPropertyChangeListener("focusOnNavigation", evt -> { boolean newvalue = (boolean) evt.getNewValue(); updateFocusOnNavigation(newvalue); }); @@ -421,25 +415,25 @@ public class ObserveMainUIInitializer { ui.getNavigationView().addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - ui.setFocusOnNavigation(true); + ui.getModel().setFocusOnNavigation(true); } }); ui.getNavigation().addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - ui.setFocusOnNavigation(true); + ui.getModel().setFocusOnNavigation(true); } }); ui.getNavigationTreeHeader().addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - ui.setFocusOnNavigation(true); + ui.getModel().setFocusOnNavigation(true); } }); ui.getSplitpane2().addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - ui.setFocusOnNavigation(false); + ui.getModel().setFocusOnNavigation(false); } }); } @@ -552,7 +546,7 @@ public class ObserveMainUIInitializer { tree.setVisible(true); - ui.setFocusOnNavigation(true); + ui.getModel().setFocusOnNavigation(true); SwingUtilities.invokeLater(tree::requestFocusInWindow); } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIModel.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIModel.java new file mode 100644 index 0000000..a7bc4f5 --- /dev/null +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/ObserveMainUIModel.java @@ -0,0 +1,424 @@ +package fr.ird.observe.application.swing.ui; + +import fr.ird.observe.application.swing.ObserveSwingApplicationContext; +import fr.ird.observe.application.swing.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.application.swing.db.ObserveSwingDataSource; +import jaxx.runtime.SwingUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.beans.AbstractBean; + +import javax.swing.Icon; +import java.util.Locale; + +import static org.nuiton.i18n.I18n.t; + +/** + * Created on 05/12/16. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 6.0 + */ +public class ObserveMainUIModel extends AbstractBean { + + /** Logger */ + private static final Log log = LogFactory.getLog(ObserveMainUIModel.class); + + private static final Icon DB_LOCAL_ICON = SwingUtil.getUIManagerActionIcon("db-local"); + private static final Icon DB_REMOTE_ICON = SwingUtil.getUIManagerActionIcon("db-remote"); + private static final Icon DB_SERVER_ICON = SwingUtil.getUIManagerActionIcon("db-server"); + private static final Icon DB_NONE_ICON = SwingUtil.getUIManagerActionIcon("db-none"); + + private ObserveUIMode mode = ObserveUIMode.NO_DB; + private boolean h2WebServer; + private boolean busy; + private boolean focusOnNavigation; + + private boolean storageStatusEnabled; + private String storageStatusText; + private String storageStatusTip; + private Icon storageStatusIcon; + private boolean storageCloseEnabled; + private boolean storageReloadEnabled; + private boolean storageImportEnabled; + private boolean storageSaveEnabled; + private boolean startServerVisible; + private boolean navigationEnabled; + private boolean actionsEnabled; + private boolean storageEnabled; + private boolean configEnabled; + private boolean fileEnabled; + private boolean changeApplicationLanguageToFrenchEnabled; + private boolean changeApplicationLanguageToEnglishEnabled; + private boolean changeApplicationLanguageToSpanishEnabled; + private boolean changeDbLanguageToFrenchEnabled; + private boolean changeDbLanguageToEnglishEnabled; + private boolean changeDbLanguageToSpanishEnabled; + private boolean devMode; + private boolean fullScreen; + + private boolean adjusting; + + public void init(ObserveSwingApplicationConfig config) { + config.addPropertyChangeListener(evt -> { + if (adjusting) { + return; + } + if (log.isInfoEnabled()) { + log.info("Config property " + evt.getPropertyName() + " changed, reload main ui model."); + } + reload(config); + }); + + addPropertyChangeListener(evt -> { + if (adjusting) { + return; + } + if (log.isInfoEnabled()) { + log.info("Main ui model property " + evt.getPropertyName() + " changed, reload main ui model."); + } + reload(config); + }); + } + + public void reload(ObserveSwingApplicationConfig config) { + + if (log.isInfoEnabled()) { + log.info("Reload ui model"); + } + adjusting = true; + + try { + + boolean notBusy = !isBusy(); + boolean mainStorageOpened = config.isMainStorageOpened(); + + setStorageStatusEnabled(acceptMode(getMode(), notBusy, ObserveUIMode.DB, ObserveUIMode.NO_DB)); + setStorageStatusText(updateStorageSatutText(config)); + setStorageStatusTip(updateStorageStatutToolTipText(config)); + setStorageStatusIcon(updateStorageSatutIcon(config)); + setStorageCloseEnabled(acceptMode(getMode(), mainStorageOpened, ObserveUIMode.DB)); + setStorageReloadEnabled(acceptMode(getMode(), mainStorageOpened, ObserveUIMode.DB)); + setNavigationEnabled(acceptMode(getMode(), notBusy, ObserveUIMode.DB)); + setActionsEnabled(acceptMode(getMode(), notBusy, ObserveUIMode.DB, ObserveUIMode.NO_DB)); + setFileEnabled(acceptMode(getMode(), notBusy, ObserveUIMode.NO_DB, ObserveUIMode.DB)); + setConfigEnabled(acceptMode(getMode(), notBusy, ObserveUIMode.DB, ObserveUIMode.NO_DB)); + setStorageEnabled(acceptMode(getMode(), notBusy, ObserveUIMode.DB, ObserveUIMode.NO_DB)); + setStartServerVisible(acceptMode(getMode(), config.isLocalStorageExist() && notBusy, ObserveUIMode.NO_DB)); + setStorageImportEnabled(acceptMode(getMode(), ObserveUIMode.DB, ObserveUIMode.NO_DB)); + setStorageSaveEnabled(acceptMode(getMode(), mainStorageOpened, ObserveUIMode.DB)); + Locale applicationLocale = config.getLocale(); + setChangeApplicationLanguageToEnglishEnabled(!acceptLocale(applicationLocale, "en_GB")); + setChangeApplicationLanguageToFrenchEnabled(!acceptLocale(applicationLocale, "fr_FR")); + setChangeApplicationLanguageToSpanishEnabled(!acceptLocale(applicationLocale, "es_ES")); + Locale dbLocale = config.getDbLocale(); + setChangeDbLanguageToEnglishEnabled(!acceptLocale(dbLocale, "en_GB")); + setChangeDbLanguageToFrenchEnabled(!acceptLocale(dbLocale, "fr_FR")); + setChangeDbLanguageToSpanishEnabled(!acceptLocale(dbLocale, "es_ES")); + setFullScreen(config.isFullScreen()); + setDevMode(config.isDevMode()); + setBusy(isBusy()); + } finally { + adjusting = false; + } + + + } + + public ObserveUIMode getMode() { + return mode; + } + + public void setMode(ObserveUIMode mode) { + this.mode = mode; + firePropertyChange("mode", null, mode); + } + + public boolean isH2WebServer() { + return h2WebServer; + } + + public void setH2WebServer(boolean h2WebServer) { + this.h2WebServer = h2WebServer; + firePropertyChange("h2WebServer", null, h2WebServer); + } + + public boolean isBusy() { + return busy; + } + + public void setBusy(boolean busy) { + this.busy = busy; + firePropertyChange("busy", null, busy); + } + + public boolean isFocusOnNavigation() { + return focusOnNavigation; + } + + public void setFocusOnNavigation(boolean focusOnNavigation) { + this.focusOnNavigation = focusOnNavigation; + firePropertyChange("focusOnNavigation", null, focusOnNavigation); + } + + public boolean isStorageStatusEnabled() { + return storageStatusEnabled; + } + + public void setStorageStatusEnabled(boolean storageStatusEnabled) { + this.storageStatusEnabled = storageStatusEnabled; + firePropertyChange("storageStatusEnabled", null, storageStatusEnabled); + } + + public String getStorageStatusText() { + return storageStatusText; + } + + public void setStorageStatusText(String storageStatusText) { + this.storageStatusText = storageStatusText; + firePropertyChange("storageStatusText", null, storageStatusText); + } + + public String getStorageStatusTip() { + return storageStatusTip; + } + + public void setStorageStatusTip(String storageStatusTip) { + this.storageStatusTip = storageStatusTip; + firePropertyChange("storageStatusTip", null, storageStatusTip); + } + + public Icon getStorageStatusIcon() { + return storageStatusIcon; + } + + public void setStorageStatusIcon(Icon storageStatusIcon) { + this.storageStatusIcon = storageStatusIcon; + firePropertyChange("storageStatusIcon", null, storageStatusIcon); + } + + public boolean isStorageCloseEnabled() { + return storageCloseEnabled; + } + + public void setStorageCloseEnabled(boolean storageCloseEnabled) { + this.storageCloseEnabled = storageCloseEnabled; + firePropertyChange("storageCloseEnabled", null, storageCloseEnabled); + } + + public boolean isStorageReloadEnabled() { + return storageReloadEnabled; + } + + public void setStorageReloadEnabled(boolean storageReloadEnabled) { + this.storageReloadEnabled = storageReloadEnabled; + firePropertyChange("storageReloadEnabled", null, storageReloadEnabled); + } + + public boolean isNavigationEnabled() { + return navigationEnabled; + } + + public void setNavigationEnabled(boolean navigationEnabled) { + this.navigationEnabled = navigationEnabled; + firePropertyChange("navigationEnabled", null, navigationEnabled); + } + + public boolean isActionsEnabled() { + return actionsEnabled; + } + + public void setActionsEnabled(boolean actionsEnabled) { + this.actionsEnabled = actionsEnabled; + firePropertyChange("actionsEnabled", null, actionsEnabled); + } + + public boolean isStorageImportEnabled() { + return storageImportEnabled; + } + + public void setStorageImportEnabled(boolean storageImportEnabled) { + this.storageImportEnabled = storageImportEnabled; + firePropertyChange("storageImportEnabled", null, storageImportEnabled); + } + + public boolean isStorageSaveEnabled() { + return storageSaveEnabled; + } + + public void setStorageSaveEnabled(boolean storageSaveEnabled) { + this.storageSaveEnabled = storageSaveEnabled; + firePropertyChange("storageSaveEnabled", null, storageSaveEnabled); + } + + public boolean isStartServerVisible() { + return startServerVisible; + } + + public void setStartServerVisible(boolean startServerVisible) { + this.startServerVisible = startServerVisible; + firePropertyChange("startServerVisible", null, startServerVisible); + } + + public boolean isStorageEnabled() { + return storageEnabled; + } + + public void setStorageEnabled(boolean storageEnabled) { + this.storageEnabled = storageEnabled; + firePropertyChange("storageEnabled", null, storageEnabled); + } + + public boolean isConfigEnabled() { + return configEnabled; + } + + public void setConfigEnabled(boolean configEnabled) { + this.configEnabled = configEnabled; + firePropertyChange("configEnabled", null, configEnabled); + } + + public boolean isFileEnabled() { + return fileEnabled; + } + + public void setFileEnabled(boolean fileEnabled) { + this.fileEnabled = fileEnabled; + firePropertyChange("fileEnabled", null, fileEnabled); + } + + public boolean isChangeApplicationLanguageToFrenchEnabled() { + return changeApplicationLanguageToFrenchEnabled; + } + + public void setChangeApplicationLanguageToFrenchEnabled(boolean changeApplicationLanguageToFrenchEnabled) { + this.changeApplicationLanguageToFrenchEnabled = changeApplicationLanguageToFrenchEnabled; + firePropertyChange("changeApplicationLanguageToFrenchEnabled", null, changeApplicationLanguageToFrenchEnabled); + } + + public boolean isChangeApplicationLanguageToEnglishEnabled() { + return changeApplicationLanguageToEnglishEnabled; + } + + public void setChangeApplicationLanguageToEnglishEnabled(boolean changeApplicationLanguageToEnglishEnabled) { + this.changeApplicationLanguageToEnglishEnabled = changeApplicationLanguageToEnglishEnabled; + firePropertyChange("changeApplicationLanguageToEnglishEnabled", null, changeApplicationLanguageToEnglishEnabled); + } + + public boolean isChangeApplicationLanguageToSpanishEnabled() { + return changeApplicationLanguageToSpanishEnabled; + } + + public void setChangeApplicationLanguageToSpanishEnabled(boolean changeApplicationLanguageToSpanishEnabled) { + this.changeApplicationLanguageToSpanishEnabled = changeApplicationLanguageToSpanishEnabled; + firePropertyChange("changeApplicationLanguageToSpanishEnabled", null, changeApplicationLanguageToSpanishEnabled); + } + + public boolean isChangeDbLanguageToFrenchEnabled() { + return changeDbLanguageToFrenchEnabled; + } + + public void setChangeDbLanguageToFrenchEnabled(boolean changeDbLanguageToFrenchEnabled) { + this.changeDbLanguageToFrenchEnabled = changeDbLanguageToFrenchEnabled; + firePropertyChange("changeDbLanguageToFrenchEnabled", null, changeDbLanguageToFrenchEnabled); + } + + public boolean isChangeDbLanguageToEnglishEnabled() { + return changeDbLanguageToEnglishEnabled; + } + + public void setChangeDbLanguageToEnglishEnabled(boolean changeDbLanguageToEnglishEnabled) { + this.changeDbLanguageToEnglishEnabled = changeDbLanguageToEnglishEnabled; + firePropertyChange("changeDbLanguageToEnglishEnabled", null, changeDbLanguageToEnglishEnabled); + } + + public boolean isChangeDbLanguageToSpanishEnabled() { + return changeDbLanguageToSpanishEnabled; + } + + public void setChangeDbLanguageToSpanishEnabled(boolean changeDbLanguageToSpanishEnabled) { + this.changeDbLanguageToSpanishEnabled = changeDbLanguageToSpanishEnabled; + firePropertyChange("changeDbLanguageToSpanishEnabled", null, changeDbLanguageToSpanishEnabled); + } + + public boolean isDevMode() { + return devMode; + } + + public void setDevMode(boolean devMode) { + this.devMode = devMode; + firePropertyChange("devMode", null, devMode); + } + + public boolean isFullScreen() { + return fullScreen; + } + + public void setFullScreen(boolean fullScreen) { + this.fullScreen = fullScreen; + firePropertyChange("fullScreen", null, fullScreen); + } + + protected Icon updateStorageSatutIcon(ObserveSwingApplicationConfig config) { + Icon icon; + + if (config.isMainStorageOpened()) { + + ObserveSwingDataSource service = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource(); + + if (service.isLocal()) { + icon = DB_LOCAL_ICON; + } else if (service.isRemote()) { + icon = DB_REMOTE_ICON; + } else { + icon = DB_SERVER_ICON; + } + } else { + icon = DB_NONE_ICON; + } + return icon; + } + + protected String updateStorageSatutText(ObserveSwingApplicationConfig config) { + String text; + if (config.isMainStorageOpened()) { + ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource(); + text = source.getLabel(); + } else { + text = t("observe.message.db.none.loaded"); + } + return text; + } + + protected String updateStorageStatutToolTipText(ObserveSwingApplicationConfig config) { + String text; + if (config.isMainStorageOpened()) { + ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource(); + text = t("observe.message.loaded.tip", source.getLabel()); + } else { + text = t("observe.message.db.none.loaded.tip"); + } + return text; + } + + public boolean acceptMode(ObserveUIMode mode, ObserveUIMode... modes) { + return acceptMode(mode, true, modes); + } + + public boolean acceptMode(ObserveUIMode mode, boolean condition, ObserveUIMode... modes) { + if (condition) { + for (ObserveUIMode m : modes) { + if (m.equals(mode)) { + return true; + } + } + } + return false; + } + + public boolean acceptLocale(Locale l, String expected) { + return l != null && l.toString().equals(expected); + } + + +} diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/UIHelper.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/UIHelper.java index 6118600..60bcd4a 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/UIHelper.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/UIHelper.java @@ -296,7 +296,7 @@ public class UIHelper extends SwingUtil { } if (mainUI != null) { - mainUI.setBusy(true); + mainUI.getModel().setBusy(true); } DecoratorService decoratorService = ObserveSwingApplicationContext.get().getDecoratorService(); Decorator<E> decorator = decoratorService.getDecoratorByType(beanClass); @@ -330,7 +330,7 @@ public class UIHelper extends SwingUtil { t("observe.choice.cancel")}, 1); if (mainUI != null) { - mainUI.setBusy(true); + mainUI.getModel().setBusy(true); } return response == 0; } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/AbstractUIAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/AbstractUIAction.java index 781852d..90efdfa 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/AbstractUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/AbstractUIAction.java @@ -24,8 +24,8 @@ package fr.ird.observe.application.swing.ui.actions; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; import fr.ird.observe.application.swing.ui.MnemonicHelper; import fr.ird.observe.application.swing.ui.ObserveMainUI; +import fr.ird.observe.application.swing.ui.UIHelper; import fr.ird.observe.application.swing.ui.content.ContentUI; -import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -56,7 +56,7 @@ public abstract class AbstractUIAction extends AbstractAction { private final ObserveMainUI mainUI; public AbstractUIAction(ObserveMainUI mainUI, String actionCommandKey, String label, String shortDescription, String actionIcon, String acceleratorKey) { - super(t(label), SwingUtil.getUIManagerActionIcon(actionIcon)); + super(t(label), UIHelper.getUIManagerActionIcon(actionIcon)); putValue(ACTION_COMMAND_KEY, actionCommandKey); this.mainUI = mainUI; MnemonicHelper.addKeyStore(this, acceleratorKey, label, shortDescription); @@ -77,6 +77,8 @@ public abstract class AbstractUIAction extends AbstractAction { public void initAction(ContentUI<?, ?> ui, AbstractButton editor) { editor.setAction(this); editor.putClientProperty("ui", ui); + //FIXME Attention on introduit un état dans l'action et si l'action est utilisée plusieurs fois dans un même écran + //FIXME cela va introduire des effets de bord putValue(EDITOR, editor); KeyStroke keyStroke = getAcceleratorKey(); @@ -91,6 +93,8 @@ public abstract class AbstractUIAction extends AbstractAction { public void initForMainUi(AbstractButton editor) { editor.setAction(this); editor.putClientProperty("ui", mainUI); + //FIXME Attention on introduit un état dans l'action et si l'action est utilisée plusieurs fois dans un même écran + //FIXME cela va introduire des effets de bord putValue(EDITOR, editor); KeyStroke keyStroke = getAcceleratorKey(); @@ -108,7 +112,7 @@ public abstract class AbstractUIAction extends AbstractAction { String actionIcon = (String) editor.getClientProperty("actionIcon"); if (actionIcon != null) { - Icon icon = SwingUtil.getUIManagerActionIcon(actionIcon); + Icon icon = UIHelper.getUIManagerActionIcon(actionIcon); editor.setIcon(icon); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteDataUIAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteDataUIAction.java index 10327c0..37837e7 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteDataUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteDataUIAction.java @@ -54,13 +54,13 @@ public class DeleteDataUIAction extends AbstractContentUIAction { @Override protected void actionPerformed(ContentUI<?, ?> contentUI) { - getMainUI().setBusy(true); + getMainUI().getModel().setBusy(true); SwingUtilities.invokeLater(() -> { try { contentUI.delete(); } finally { - getMainUI().setBusy(false); + getMainUI().getModel().setBusy(false); } }); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteReferenceUIAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteReferenceUIAction.java index e205d04..d00c65c 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteReferenceUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/content/DeleteReferenceUIAction.java @@ -52,11 +52,11 @@ public class DeleteReferenceUIAction extends AbstractContentUIAction { @Override protected void actionPerformed(ContentUI<?, ?> ui) { - getMainUI().setBusy(true); + getMainUI().getModel().setBusy(true); try { ui.delete(); } finally { - getMainUI().setBusy(false); + getMainUI().getModel().setBusy(false); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/AbstractGlobalUIAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/AbstractGlobalUIAction.java index 61d781b..2e13c2a 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/AbstractGlobalUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/AbstractGlobalUIAction.java @@ -42,7 +42,7 @@ public abstract class AbstractGlobalUIAction extends AbstractUIAction { public void actionPerformed(Runnable r) { - boolean focusOnNavigation = getMainUI().isFocusOnNavigation(); + boolean focusOnNavigation = getMainUI().getModel().isFocusOnNavigation(); JComponent focusOwner = (JComponent) getMainUI().getFocusOwner(); r.run(); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/ChangeFocusGlobalUIAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/ChangeFocusGlobalUIAction.java index 423dd3f..8c76d2c 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/ChangeFocusGlobalUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/global/ChangeFocusGlobalUIAction.java @@ -51,14 +51,14 @@ public class ChangeFocusGlobalUIAction extends AbstractGlobalUIAction { @Override public void actionPerformed(ActionEvent e) { - boolean navigation = getMainUI().isFocusOnNavigation(); + boolean navigation = getMainUI().getModel().isFocusOnNavigation(); JComponent focusComponent; if (navigation) { if (log.isInfoEnabled()) { log.info("Focus to content"); } - getMainUI().setFocusOnNavigation(false); + getMainUI().getModel().setFocusOnNavigation(false); ContentUI<?, ?> contentUI = getContentUI(e); FocusTraversalPolicy focusTraversalPolicy = contentUI.getFocusTraversalPolicy(); focusComponent = (JComponent) focusTraversalPolicy.getFirstComponent(contentUI); @@ -74,7 +74,7 @@ public class ChangeFocusGlobalUIAction extends AbstractGlobalUIAction { if (log.isInfoEnabled()) { log.info("Focus to navigation"); } - getMainUI().setFocusOnNavigation(true); + getMainUI().getModel().setFocusOnNavigation(true); focusComponent = getMainUI().getNavigation(); } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageActionSupport.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageActionSupport.java index 229157c..4a75a83 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageActionSupport.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageActionSupport.java @@ -48,12 +48,8 @@ public abstract class ChangeApplicationLanguageActionSupport extends AbstractUIA private final Locale newLocale; public ChangeApplicationLanguageActionSupport(ObserveMainUI ui, String actionName, Locale newLocale, String name, String description) { - - super(ui, actionName, name,description, "i18n-" + newLocale.getLanguage(), null); + super(ui, actionName, name, description, "i18n-" + newLocale.getLanguage(), null); this.newLocale = newLocale; - putValue(SHORT_DESCRIPTION, description); - putValue(MNEMONIC_KEY, (int) newLocale.getLanguage().toUpperCase().charAt(0)); - } @Override diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToEnglishAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToEnglishAction.java index 5da9106..625bb38 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToEnglishAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToEnglishAction.java @@ -18,5 +18,6 @@ public class ChangeApplicationLanguageToEnglishAction extends ChangeApplicationL public ChangeApplicationLanguageToEnglishAction(ObserveMainUI ui) { super(ui, ACTION_NAME, Locale.UK, t("observe.action.locale.uk"), t("observe.action.locale.uk.tip")); + putValue(MNEMONIC_KEY, (int) 'A'); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToFrenchAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToFrenchAction.java index dc88275..f057e54 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToFrenchAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToFrenchAction.java @@ -18,5 +18,6 @@ public class ChangeApplicationLanguageToFrenchAction extends ChangeApplicationLa public ChangeApplicationLanguageToFrenchAction(ObserveMainUI ui) { super(ui, ACTION_NAME, Locale.FRANCE, t("observe.action.locale.fr"), t("observe.action.locale.fr.tip")); + putValue(MNEMONIC_KEY, (int) 'F'); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToSpanishAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToSpanishAction.java index bfbd183..1650bfc 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToSpanishAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeApplicationLanguageToSpanishAction.java @@ -18,5 +18,6 @@ public class ChangeApplicationLanguageToSpanishAction extends ChangeApplicationL public ChangeApplicationLanguageToSpanishAction(ObserveMainUI ui) { super(ui, ACTION_NAME, new Locale("es","ES"), t("observe.action.locale.es"), t("observe.action.locale.es.tip")); + putValue(MNEMONIC_KEY, (int) 'E'); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageActionSupport.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageActionSupport.java index e779bfc..1fddb11 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageActionSupport.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageActionSupport.java @@ -49,11 +49,8 @@ public abstract class ChangeDbLanguageActionSupport extends AbstractUIAction { private final ReferentialLocale newLocale; public ChangeDbLanguageActionSupport(ObserveMainUI ui, String actionName, ReferentialLocale newLocale, String name, String description) { - super(ui, actionName, name, description, "i18n-" + newLocale.getLocale().getLanguage(), null); this.newLocale = newLocale; - putValue(MNEMONIC_KEY, (int) newLocale.getLocale().getLanguage().toUpperCase().charAt(0)); - } @Override diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToEnglishAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToEnglishAction.java index a6e53d9..ecee950 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToEnglishAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToEnglishAction.java @@ -17,5 +17,6 @@ public class ChangeDbLanguageToEnglishAction extends ChangeDbLanguageActionSuppo public ChangeDbLanguageToEnglishAction(ObserveMainUI ui) { super(ui, ACTION_NAME, ReferentialLocale.UK, t("observe.action.locale.uk"), t("observe.action.locale.uk.tip")); + putValue(MNEMONIC_KEY, (int) 'A'); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToFrenchAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToFrenchAction.java index ae62b87..d63c5b0 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToFrenchAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToFrenchAction.java @@ -17,5 +17,6 @@ public class ChangeDbLanguageToFrenchAction extends ChangeDbLanguageActionSuppor public ChangeDbLanguageToFrenchAction(ObserveMainUI ui) { super(ui, ACTION_NAME, ReferentialLocale.FR, t("observe.action.locale.fr"), t("observe.action.locale.fr.tip")); + putValue(MNEMONIC_KEY, (int) 'F'); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToSpanishAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToSpanishAction.java index 3fc1594..8cab839 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToSpanishAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/config/ChangeDbLanguageToSpanishAction.java @@ -17,5 +17,6 @@ public class ChangeDbLanguageToSpanishAction extends ChangeDbLanguageActionSuppo public ChangeDbLanguageToSpanishAction(ObserveMainUI ui) { super(ui, ACTION_NAME, ReferentialLocale.ES, t("observe.action.locale.es"), t("observe.action.locale.es.tip")); + putValue(MNEMONIC_KEY, (int) 'E'); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/CloseStorageAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/CloseStorageAction.java index f3c41dc..e41be83 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/CloseStorageAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/CloseStorageAction.java @@ -68,7 +68,7 @@ public class CloseStorageAction extends AbstractUIAction { boolean canContinue = ObserveSwingApplicationContext.get().getContentUIManager().closeSelectedContentUI(); if (canContinue) { - ui.setBusy(true); + ui.getModel().setBusy(true); try { ObserveSwingDataSource source = ObserveSwingApplicationContext.get().getDataSourcesManager().getMainDataSource(); @@ -78,7 +78,7 @@ public class CloseStorageAction extends AbstractUIAction { // on doit fermer le storage en cours d'utilisation source.close(); } finally { - ui.setBusy(false); + ui.getModel().setBusy(false); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/ReloadStorageAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/ReloadStorageAction.java index 4edaccb..52efa91 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/ReloadStorageAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/ReloadStorageAction.java @@ -78,7 +78,7 @@ public class ReloadStorageAction extends AbstractUIAction { ObserveMainUI ui = getMainUI(); - ui.setBusy(false); + ui.getModel().setBusy(false); Object[] ids = ui.getNavigation().getSelectedIds(); @@ -118,7 +118,7 @@ public class ReloadStorageAction extends AbstractUIAction { } } finally { - ui.setBusy(false); + ui.getModel().setBusy(false); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartH2WebServerAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartH2WebServerAction.java index c7784fc..a7027da 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartH2WebServerAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartH2WebServerAction.java @@ -60,7 +60,7 @@ public class StartH2WebServerAction extends AbstractUIAction { public void actionPerformed(ActionEvent event) { ObserveMainUI ui = getMainUI(); - if (ui.isH2WebServer()) { + if (ui.getModel().isH2WebServer()) { if (log.isWarnEnabled()) { log.warn("Can not start h2 web server... (web server already found)"); @@ -83,7 +83,7 @@ public class StartH2WebServerAction extends AbstractUIAction { // par exemple lorsque l'on souhaitera arrêter le server. ObserveSwingApplicationContext.get().setH2WebServer(server); - ui.setH2WebServer(true); + ui.getModel().setH2WebServer(true); } catch (Exception e) { diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartServerModeAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartServerModeAction.java index 85fdbf9..46fee09 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartServerModeAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StartServerModeAction.java @@ -54,6 +54,8 @@ public class StartServerModeAction extends AbstractUIAction { public static final String ACTION_NAME = StartServerModeAction.class.getSimpleName(); + public static final String H2_SERVER_URL_PATTERN = "jdbc:h2:%s/%s/obstuna"; + public StartServerModeAction(ObserveMainUI ui) { super(ui, ACTION_NAME, t("observe.action.start.server.mode"), t("observe.action.start.server.mode.tip"), "db-start-server", null); @@ -80,7 +82,7 @@ public class StartServerModeAction extends AbstractUIAction { String h2Password = config.getH2Password(); Integer port = config.getH2ServerPort(); - ui.setMode(ObserveUIMode.SERVER); + ui.getModel().setMode(ObserveUIMode.SERVER); try { @@ -92,7 +94,7 @@ public class StartServerModeAction extends AbstractUIAction { "-tcpPort", String.valueOf(port)); - String url = String.format(ObserveMainUIHandler.H2_SERVER_URL_PATTERN, + String url = String.format(H2_SERVER_URL_PATTERN, server.getURL(), dbDirectory.getAbsolutePath()); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopH2WebServerAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopH2WebServerAction.java index fb5241f..e8ab7e4 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopH2WebServerAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopH2WebServerAction.java @@ -64,7 +64,7 @@ public class StopH2WebServerAction extends AbstractUIAction { public static void launchStopH2WebServer(ObserveMainUI ui) { - if (ui.isH2WebServer()) { + if (ui.getModel().isH2WebServer()) { if (log.isInfoEnabled()) { log.info("Will stop web server mode..."); } @@ -73,7 +73,7 @@ public class StopH2WebServerAction extends AbstractUIAction { if (server != null) { server.stop(); } - ui.setH2WebServer(false); + ui.getModel().setH2WebServer(false); } else { if (log.isWarnEnabled()) { log.warn("Can not stop h2 web server... (no web server found)"); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopServerModeAction.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopServerModeAction.java index 30f5edd..1a60d49 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopServerModeAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/menu/storage/StopServerModeAction.java @@ -69,9 +69,9 @@ public class StopServerModeAction extends AbstractUIAction { server.stop(); } ObserveMainUI ui = getMainUI(); - ui.setMode(ObserveUIMode.NO_DB); + ui.getModel().setMode(ObserveUIMode.NO_DB); - if (ui.isH2WebServer()) { + if (ui.getModel().isH2WebServer()) { // stop also the h2 web server StopH2WebServerAction.launchStopH2WebServer(ui); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUILauncher.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUILauncher.java index 43697c7..62e9061 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUILauncher.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUILauncher.java @@ -110,7 +110,7 @@ public class AdminUILauncher extends WizardUILancher<AdminStep, AdminUIModel, Ad log.debug("Busy for component " + ui); } if (parent instanceof ObserveMainUI) { - ((ObserveMainUI) parent).setBusy(true); + ((ObserveMainUI) parent).getModel().setBusy(true); super.setBusy(parent); } super.setBusy(ui); @@ -122,7 +122,7 @@ public class AdminUILauncher extends WizardUILancher<AdminStep, AdminUIModel, Ad log.debug("UnBusy for component " + ui); } if (parent instanceof ObserveMainUI) { - ((ObserveMainUI) parent).setBusy(false); + ((ObserveMainUI) parent).getModel().setBusy(false); super.setUnBusy(parent); } super.setUnBusy(ui); @@ -204,7 +204,7 @@ public class AdminUILauncher extends WizardUILancher<AdminStep, AdminUIModel, Ad panel.setToolTipText(t(tip)); panel.setContentContainer(ui); mainUI.setContextValue(ui.getModel()); - mainUI.setMode(ObserveUIMode.SYNCHRO); + mainUI.getModel().setMode(ObserveUIMode.SYNCHRO); // refresh selected tab (otherwise it does NOT display (white screen...) SwingUtilities.invokeLater(() -> ui.getTabs().getSelectedComponent().validate()); @@ -252,7 +252,7 @@ public class AdminUILauncher extends WizardUILancher<AdminStep, AdminUIModel, Ad if (source == null) { // pas de service auparavant - mainUI.setMode(ObserveUIMode.NO_DB); + mainUI.getModel().setMode(ObserveUIMode.NO_DB); return; } @@ -269,7 +269,7 @@ public class AdminUILauncher extends WizardUILancher<AdminStep, AdminUIModel, Ad UIHelper.handlingError("Could not close", e); if (mainUI != null) { - mainUI.setMode(ObserveUIMode.NO_DB); + mainUI.getModel().setMode(ObserveUIMode.NO_DB); } } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ContentUIManager.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ContentUIManager.java index 14cb25d..cf2d349 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ContentUIManager.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/ContentUIManager.java @@ -109,7 +109,7 @@ public class ContentUIManager { if (log.isInfoEnabled()) { log.info("grab enter focus: " + e); } - getMainUI().setFocusOnNavigation(false); + getMainUI().getModel().setFocusOnNavigation(false); } @Override @@ -118,7 +118,7 @@ public class ContentUIManager { if (log.isInfoEnabled()) { log.info("grab moved focus: " + e); } - getMainUI().setFocusOnNavigation(false); + getMainUI().getModel().setFocusOnNavigation(false); } } }); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java index 7875656..2e8b77a 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java @@ -694,7 +694,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong boolean accept = UIHelper.confirmForEntityDelete(ui, SectionDto.class, selectedSection); ObserveMainUI mainUI = ObserveSwingApplicationContext.get().getMainUI(); - mainUI.setBusy(false); + mainUI.getModel().setBusy(false); if (!accept) { return; @@ -796,7 +796,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong boolean accept = UIHelper.confirmForEntityDelete(ui, BasketDto.class, selectedBasket); ObserveMainUI mainUI = ObserveSwingApplicationContext.get().getMainUI(); - mainUI.setBusy(false); + mainUI.getModel().setBusy(false); if (!accept) { return; @@ -907,7 +907,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong boolean accept = UIHelper.confirmForEntityDelete(ui, BranchlineDto.class, selectedBranchline); ObserveMainUI mainUI = ObserveSwingApplicationContext.get().getMainUI(); - mainUI.setBusy(false); + mainUI.getModel().setBusy(false); if (!accept) { return; } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/longline/TripLonglineUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/longline/TripLonglineUIHandler.java index 9e6dea6..e0e4e93 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/longline/TripLonglineUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/longline/TripLonglineUIHandler.java @@ -102,14 +102,14 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto,Tri if (buildTripMap) { SwingUtilities.invokeLater(() -> { - ObserveSwingApplicationContext.get().getMainUI().setBusy(true); + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true); try { TripLonglineUI ui11 = getUi(); TripMapUI tripMap11 = ui11.getTripMap(); TripMapDto tripLonglineMap = getTripLonglineService().getTripLonglineMap(getSelectedId()); tripMap11.getHandler().doOpenMap(tripLonglineMap); } finally { - ObserveSwingApplicationContext.get().getMainUI().setBusy(false); + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false); } }); buildTripMap = false; diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/seine/TripSeineUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/seine/TripSeineUIHandler.java index f2ef463..d790fe7 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -103,14 +103,14 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein if (buildTripMap) { SwingUtilities.invokeLater(() -> { - ObserveSwingApplicationContext.get().getMainUI().setBusy(true); + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true); try { TripSeineUI ui11 = getUi(); TripMapUI tripMap11 = ui11.getTripMap(); TripMapDto tripSeineMap = getTripSeineService().getTripSeineMap(getSelectedId()); tripMap11.getHandler().doOpenMap(tripSeineMap); } finally { - ObserveSwingApplicationContext.get().getMainUI().setBusy(false); + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false); } }); buildTripMap = false; diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/ContentTableUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/ContentTableUIHandler.java index 71d9bbb..afc18c3 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/ContentTableUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/ContentTableUIHandler.java @@ -294,7 +294,7 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto, U } finally { // always reset busy model to false - ObserveSwingApplicationContext.get().getMainUI().setBusy(false); + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false); } } diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/util/tripMap/TripMapUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/util/tripMap/TripMapUIHandler.java index 7b20422..c19cd1b 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/util/tripMap/TripMapUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/util/tripMap/TripMapUIHandler.java @@ -110,7 +110,7 @@ public class TripMapUIHandler { try { ((CardLayout) view.getLayout()).first(view); - ObserveSwingApplicationContext.get().getMainUI().setBusy(true); + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true); ObserveMapPane mapPane = getObserveMapPane(); @@ -155,7 +155,7 @@ public class TripMapUIHandler { } catch (Exception e) { throw new ObserveSwingTechnicalException("Unable to load trip map activity points", e); } finally { - ObserveSwingApplicationContext.get().getMainUI().setBusy(false); + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm