Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
21c928dd
by Tony Chemit at 2020-05-10T13:04:00+02:00
14 changed files:
- client-core/src/main/i18n/getters/java.getter
- client-core/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/CancelRemoteUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/CancelServerUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DeleteRemoteUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DeleteServerUIAction.java
- + client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DuplicateRemoteUIAction.java
- + client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DuplicateServerUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/storage/presets/RemotePresetsUI.jaxx
- client-core/src/main/java/fr/ird/observe/client/ui/storage/presets/RemotePresetsUI.jcss
- client-core/src/main/java/fr/ird/observe/client/ui/storage/presets/RemotePresetsUIHandler.java
- observe-i18n/src/main/i18n/translations/observe_en_GB.properties
- observe-i18n/src/main/i18n/translations/observe_es_ES.properties
- observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
Changes:
| ... | ... | @@ -44,6 +44,9 @@ observe.action.delete.remote.tip |
| 44 | 44 |
observe.action.delete.server.tip
|
| 45 | 45 |
observe.action.delete.tip
|
| 46 | 46 |
observe.action.detail
|
| 47 |
+observe.action.duplicate
|
|
| 48 |
+observe.action.duplicate.remote.tip
|
|
| 49 |
+observe.action.duplicate.server.tip
|
|
| 47 | 50 |
observe.action.exit
|
| 48 | 51 |
observe.action.exit.tip
|
| 49 | 52 |
observe.action.floatingObjectPresets
|
| ... | ... | @@ -86,6 +86,7 @@ public abstract class ObserveKeyStrokes { |
| 86 | 86 |
public static final KeyStroke KEY_STROKE_RESET_DATA = KeyStroke.getKeyStroke("pressed F7");
|
| 87 | 87 |
public static final KeyStroke KEY_STROKE_NEW_NEXT_DATA = KeyStroke.getKeyStroke("pressed F4");
|
| 88 | 88 |
public static final KeyStroke KEY_STROKE_DELETE_DATA_GLOBAL = KeyStroke.getKeyStroke("pressed F6");
|
| 89 |
+ public static final KeyStroke KEY_STROKE_DUPLICATE = KeyStroke.getKeyStroke("pressed F2");
|
|
| 89 | 90 |
public static final KeyStroke KEY_STROKE_OPEN_DATA = KeyStroke.getKeyStroke("pressed F2");
|
| 90 | 91 |
public static final KeyStroke KEY_STROKE_CLOSE_DATA = KeyStroke.getKeyStroke("pressed F3");
|
| 91 | 92 |
public static final KeyStroke KEY_STROKE_SAVE_DATA = KeyStroke.getKeyStroke("pressed F5");
|
| ... | ... | @@ -57,6 +57,8 @@ public class CancelRemoteUIAction extends PresetsUIActionSupport { |
| 57 | 57 |
ObserveSwingApplicationContext.get().getConfig().removeRemoteDataSourceConfiguration(configuration);
|
| 58 | 58 |
ui.getModel().setRemoteDataSourceConfiguration(null);
|
| 59 | 59 |
ui.getModel().setRemoteCreateMode(false);
|
| 60 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 61 |
+ ui.getRemoteConfigurations().setSelectedIndex(newConfiguration);
|
|
| 60 | 62 |
}
|
| 61 | 63 |
|
| 62 | 64 |
}
|
| ... | ... | @@ -57,6 +57,8 @@ public class CancelServerUIAction extends PresetsUIActionSupport { |
| 57 | 57 |
ObserveSwingApplicationContext.get().getConfig().removeServerDataSourceConfiguration(configuration);
|
| 58 | 58 |
ui.getModel().setServerDataSourceConfiguration(null);
|
| 59 | 59 |
ui.getModel().setServerCreateMode(false);
|
| 60 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 61 |
+ ui.getServerConfigurations().setSelectedIndex(newConfiguration);
|
|
| 60 | 62 |
}
|
| 61 | 63 |
|
| 62 | 64 |
}
|
| ... | ... | @@ -69,6 +69,8 @@ public class DeleteRemoteUIAction extends PresetsUIActionSupport { |
| 69 | 69 |
ui.getModel().setRemoteDataSourceConfigurations(configurations);
|
| 70 | 70 |
ObserveSwingApplicationContext.get().getConfig().removeRemoteDataSourceConfiguration(configuration);
|
| 71 | 71 |
ui.getModel().setRemoteDataSourceConfiguration(null);
|
| 72 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 73 |
+ ui.getRemoteConfigurations().setSelectedIndex(newConfiguration);
|
|
| 72 | 74 |
}
|
| 73 | 75 |
}
|
| 74 | 76 |
}
|
| ... | ... | @@ -71,6 +71,8 @@ public class DeleteServerUIAction extends PresetsUIActionSupport { |
| 71 | 71 |
ui.getModel().setServerDataSourceConfigurations(configurations);
|
| 72 | 72 |
ObserveSwingApplicationContext.get().getConfig().removeServerDataSourceConfiguration(configuration);
|
| 73 | 73 |
ui.getModel().setServerDataSourceConfiguration(null);
|
| 74 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 75 |
+ ui.getServerConfigurations().setSelectedIndex(newConfiguration);
|
|
| 74 | 76 |
}
|
| 75 | 77 |
|
| 76 | 78 |
}
|
| 1 |
+package fr.ird.observe.client.ui.actions.storage.presets;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client core
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import fr.ird.observe.client.ui.ObserveKeyStrokes;
|
|
| 26 |
+import fr.ird.observe.client.ui.ObserveMainUI;
|
|
| 27 |
+import fr.ird.observe.client.ui.storage.presets.RemotePresetsUI;
|
|
| 28 |
+import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
|
|
| 29 |
+ |
|
| 30 |
+import java.util.ArrayList;
|
|
| 31 |
+import java.util.List;
|
|
| 32 |
+ |
|
| 33 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 34 |
+ |
|
| 35 |
+public class DuplicateRemoteUIAction extends PresetsUIActionSupport {
|
|
| 36 |
+ |
|
| 37 |
+ public static final String ACTION_NAME = DuplicateRemoteUIAction.class.getName();
|
|
| 38 |
+ |
|
| 39 |
+ public DuplicateRemoteUIAction(ObserveMainUI mainUI) {
|
|
| 40 |
+ super(mainUI, ACTION_NAME, n("observe.action.duplicate"), n("observe.action.duplicate.remote.tip"), "mode-create", ObserveKeyStrokes.KEY_STROKE_DUPLICATE);
|
|
| 41 |
+ }
|
|
| 42 |
+ |
|
| 43 |
+ @Override
|
|
| 44 |
+ protected void doActionPerformed(RemotePresetsUI ui) {
|
|
| 45 |
+ |
|
| 46 |
+ RemoteDataSourceConfiguration incomingConfiguration = ui.getModel().getRemoteDataSourceConfiguration();
|
|
| 47 |
+ |
|
| 48 |
+ RemoteDataSourceConfiguration configuration = new RemoteDataSourceConfiguration();
|
|
| 49 |
+ |
|
| 50 |
+ configuration.setLogin(incomingConfiguration.getLogin());
|
|
| 51 |
+ configuration.setPassword(incomingConfiguration.getPassword());
|
|
| 52 |
+ configuration.setName(incomingConfiguration.getName() + " (Copie)");
|
|
| 53 |
+ configuration.setUrl(incomingConfiguration.getUrl());
|
|
| 54 |
+ |
|
| 55 |
+ List<RemoteDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getRemoteDataSourceConfigurations());
|
|
| 56 |
+ configurations.add(configuration);
|
|
| 57 |
+ ui.getModel().setRemoteDataSourceConfigurations(configurations);
|
|
| 58 |
+ ui.getModel().setRemoteCreateMode(true);
|
|
| 59 |
+ ui.getRemoteConfigurations().setSelectedValue(configuration, true);
|
|
| 60 |
+ }
|
|
| 61 |
+}
|
| 1 |
+package fr.ird.observe.client.ui.actions.storage.presets;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client core
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import fr.ird.observe.client.ui.ObserveKeyStrokes;
|
|
| 26 |
+import fr.ird.observe.client.ui.ObserveMainUI;
|
|
| 27 |
+import fr.ird.observe.client.ui.storage.presets.RemotePresetsUI;
|
|
| 28 |
+import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
|
|
| 29 |
+ |
|
| 30 |
+import java.util.ArrayList;
|
|
| 31 |
+import java.util.List;
|
|
| 32 |
+ |
|
| 33 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 34 |
+ |
|
| 35 |
+public class DuplicateServerUIAction extends PresetsUIActionSupport {
|
|
| 36 |
+ |
|
| 37 |
+ public static final String ACTION_NAME = DuplicateServerUIAction.class.getName();
|
|
| 38 |
+ |
|
| 39 |
+ public DuplicateServerUIAction(ObserveMainUI mainUI) {
|
|
| 40 |
+ super(mainUI, ACTION_NAME, n("observe.action.duplicate"), n("observe.action.duplicate.server.tip"), "mode-create", ObserveKeyStrokes.KEY_STROKE_DUPLICATE);
|
|
| 41 |
+ }
|
|
| 42 |
+ |
|
| 43 |
+ @Override
|
|
| 44 |
+ protected void doActionPerformed(RemotePresetsUI ui) {
|
|
| 45 |
+ |
|
| 46 |
+ ServerDataSourceConfiguration incomingConfiguration = ui.getModel().getServerDataSourceConfiguration();
|
|
| 47 |
+ ServerDataSourceConfiguration configuration = new ServerDataSourceConfiguration();
|
|
| 48 |
+ |
|
| 49 |
+ configuration.setDatabaseName(incomingConfiguration.getDatabaseName());
|
|
| 50 |
+ configuration.setLogin(incomingConfiguration.getLogin());
|
|
| 51 |
+ configuration.setPassword(incomingConfiguration.getPassword());
|
|
| 52 |
+ configuration.setName(incomingConfiguration.getName() + " (Copie)");
|
|
| 53 |
+ configuration.setUrl(incomingConfiguration.getUrl());
|
|
| 54 |
+ |
|
| 55 |
+ List<ServerDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getServerDataSourceConfigurations());
|
|
| 56 |
+ configurations.add(configuration);
|
|
| 57 |
+ ui.getModel().setServerDataSourceConfigurations(configurations);
|
|
| 58 |
+ ui.getModel().setServerCreateMode(true);
|
|
| 59 |
+ ui.getServerConfigurations().setSelectedValue(configuration, true);
|
|
| 60 |
+ |
|
| 61 |
+ }
|
|
| 62 |
+}
|
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 |
<http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
#L%
|
| 21 | 21 |
-->
|
| 22 |
-<JPanel layout="{new BorderLayout()}">
|
|
| 22 |
+<org.jdesktop.swingx.JXTitledPanel id="dataSourcePresets">
|
|
| 23 | 23 |
|
| 24 | 24 |
<import>
|
| 25 | 25 |
fr.ird.observe.dto.presets.RemoteDataSourceConfiguration
|
| ... | ... | @@ -28,6 +28,8 @@ |
| 28 | 28 |
fr.ird.observe.client.ui.actions.storage.presets.CreatePresetUIAction
|
| 29 | 29 |
fr.ird.observe.client.ui.actions.storage.presets.DeleteRemoteUIAction
|
| 30 | 30 |
fr.ird.observe.client.ui.actions.storage.presets.DeleteServerUIAction
|
| 31 |
+ fr.ird.observe.client.ui.actions.storage.presets.DuplicateRemoteUIAction
|
|
| 32 |
+ fr.ird.observe.client.ui.actions.storage.presets.DuplicateServerUIAction
|
|
| 31 | 33 |
fr.ird.observe.client.ui.actions.storage.presets.QuitPresetsUIAction
|
| 32 | 34 |
fr.ird.observe.client.ui.actions.storage.presets.CancelRemoteUIAction
|
| 33 | 35 |
fr.ird.observe.client.ui.actions.storage.presets.ResetRemoteUIAction
|
| ... | ... | @@ -39,24 +41,26 @@ |
| 39 | 41 |
fr.ird.observe.client.ui.actions.storage.presets.TestServerUIAction
|
| 40 | 42 |
|
| 41 | 43 |
org.nuiton.jaxx.widgets.select.BeanComboBox
|
| 42 |
- |
|
| 44 |
+ java.awt.CardLayout
|
|
| 43 | 45 |
</import>
|
| 44 | 46 |
|
| 45 | 47 |
<RemotePresetsUIModel id="model" initializer="getContextValue(RemotePresetsUIModel.class)"/>
|
| 46 | 48 |
|
| 47 | 49 |
<JTabbedPane id='tabs' constraints='BorderLayout.CENTER'>
|
| 48 | 50 |
<tab id='remoteTab' title="observe.storage.remote.presets.title">
|
| 49 |
- <JSplitPane id="remotePanel">
|
|
| 50 |
- <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/>
|
|
| 51 |
- <JPanel id="remoteContentPanel" layout="{new BorderLayout()}">
|
|
| 52 |
- <JLabel id="noRemoteSelected" constraints='BorderLayout.CENTER'/>
|
|
| 53 |
- <Table id="remoteForm" constraints='BorderLayout.SOUTH' fill="both">
|
|
| 51 |
+ <JPanel id="remotePanel" layout="{new BorderLayout()}">
|
|
| 52 |
+ <JScrollPane id='remoteConfigurationsPane' constraints='BorderLayout.CENTER'>
|
|
| 53 |
+ <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/>
|
|
| 54 |
+ </JScrollPane>
|
|
| 55 |
+ <JPanel id="remoteContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'>
|
|
| 56 |
+ <JLabel id="noRemoteSelected" constraints='"empty"'/>
|
|
| 57 |
+ <Table id="remoteForm" constraints='"form"' fill="both">
|
|
| 54 | 58 |
<row>
|
| 55 | 59 |
<cell anchor='west'>
|
| 56 | 60 |
<JLabel text='observe.storage.remote.name'/>
|
| 57 | 61 |
</cell>
|
| 58 | 62 |
<cell weightx='1' fill="both" anchor='east'>
|
| 59 |
- <JTextField id="remoteName" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 63 |
+ <JTextField id="remoteName" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 60 | 64 |
</cell>
|
| 61 | 65 |
</row>
|
| 62 | 66 |
<row>
|
| ... | ... | @@ -64,7 +68,7 @@ |
| 64 | 68 |
<JLabel text='observe.storage.remote.url'/>
|
| 65 | 69 |
</cell>
|
| 66 | 70 |
<cell weightx='1' fill="both" anchor='east'>
|
| 67 |
- <JTextField id="remoteUrl" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 71 |
+ <JTextField id="remoteUrl" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 68 | 72 |
</cell>
|
| 69 | 73 |
</row>
|
| 70 | 74 |
<row>
|
| ... | ... | @@ -72,7 +76,7 @@ |
| 72 | 76 |
<JLabel text='observe.storage.remote.login'/>
|
| 73 | 77 |
</cell>
|
| 74 | 78 |
<cell weightx='1' fill="both" anchor='east'>
|
| 75 |
- <JTextField id="remoteLogin" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 79 |
+ <JTextField id="remoteLogin" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 76 | 80 |
</cell>
|
| 77 | 81 |
</row>
|
| 78 | 82 |
<row>
|
| ... | ... | @@ -80,7 +84,7 @@ |
| 80 | 84 |
<JLabel text='observe.storage.remote.password'/>
|
| 81 | 85 |
</cell>
|
| 82 | 86 |
<cell weightx='1' fill="both" anchor='east'>
|
| 83 |
- <JTextField id="remotePassword" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 87 |
+ <JTextField id="remotePassword" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 84 | 88 |
</cell>
|
| 85 | 89 |
</row>
|
| 86 | 90 |
<row>
|
| ... | ... | @@ -97,26 +101,29 @@ |
| 97 | 101 |
<JButton id="saveRemoteAction"/>
|
| 98 | 102 |
<JButton id="deleteRemoteAction"/>
|
| 99 | 103 |
<JButton id="testRemoteAction"/>
|
| 104 |
+ <JButton id="duplicateRemoteAction"/>
|
|
| 100 | 105 |
</JPanel>
|
| 101 | 106 |
</cell>
|
| 102 | 107 |
</row>
|
| 103 | 108 |
</Table>
|
| 104 | 109 |
</JPanel>
|
| 105 |
- </JSplitPane>
|
|
| 110 |
+ </JPanel>
|
|
| 106 | 111 |
</tab>
|
| 107 | 112 |
<tab id='serverTab' title="observe.storage.server.presets.title">
|
| 108 | 113 |
|
| 109 |
- <JSplitPane id="serverPanel">
|
|
| 110 |
- <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/>
|
|
| 111 |
- <JPanel id="serverContentPanel" layout="{new BorderLayout()}">
|
|
| 112 |
- <JLabel id="noServerSelected" constraints='BorderLayout.CENTER'/>
|
|
| 113 |
- <Table id="serverForm" constraints='BorderLayout.SOUTH' fill="both">
|
|
| 114 |
+ <JPanel id="serverPanel" layout="{new BorderLayout()}" >
|
|
| 115 |
+ <JScrollPane id='serverConfigurationsPane' constraints='BorderLayout.CENTER'>
|
|
| 116 |
+ <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/>
|
|
| 117 |
+ </JScrollPane>
|
|
| 118 |
+ <JPanel id="serverContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'>
|
|
| 119 |
+ <JLabel id="noServerSelected" constraints='"empty"'/>
|
|
| 120 |
+ <Table id="serverForm" constraints='"form"' fill="both">
|
|
| 114 | 121 |
<row>
|
| 115 | 122 |
<cell anchor='west'>
|
| 116 | 123 |
<JLabel text='observe.storage.remote.name'/>
|
| 117 | 124 |
</cell>
|
| 118 | 125 |
<cell weightx='1' fill="both" anchor='east'>
|
| 119 |
- <JTextField id="serverName" onKeyReleased="model.setServerModified(true);"/>
|
|
| 126 |
+ <JTextField id="serverName" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 120 | 127 |
</cell>
|
| 121 | 128 |
</row>
|
| 122 | 129 |
<row>
|
| ... | ... | @@ -124,7 +131,7 @@ |
| 124 | 131 |
<JLabel text='observe.storage.remote.url'/>
|
| 125 | 132 |
</cell>
|
| 126 | 133 |
<cell weightx='1' fill="both" anchor='east'>
|
| 127 |
- <JTextField id="serverUrl" onKeyReleased="model.setServerModified(true);"/>
|
|
| 134 |
+ <JTextField id="serverUrl" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 128 | 135 |
</cell>
|
| 129 | 136 |
</row>
|
| 130 | 137 |
<row>
|
| ... | ... | @@ -132,7 +139,7 @@ |
| 132 | 139 |
<JLabel text='observe.storage.remote.login'/>
|
| 133 | 140 |
</cell>
|
| 134 | 141 |
<cell weightx='1' fill="both" anchor='east'>
|
| 135 |
- <JTextField id="serverLogin" onKeyReleased="model.setServerModified(true);"/>
|
|
| 142 |
+ <JTextField id="serverLogin" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 136 | 143 |
</cell>
|
| 137 | 144 |
</row>
|
| 138 | 145 |
<row>
|
| ... | ... | @@ -140,7 +147,7 @@ |
| 140 | 147 |
<JLabel text='observe.storage.remote.password'/>
|
| 141 | 148 |
</cell>
|
| 142 | 149 |
<cell weightx='1' fill="both" anchor='east'>
|
| 143 |
- <JTextField id="serverPassword" onKeyReleased="model.setServerModified(true);"/>
|
|
| 150 |
+ <JTextField id="serverPassword" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 144 | 151 |
</cell>
|
| 145 | 152 |
</row>
|
| 146 | 153 |
<row>
|
| ... | ... | @@ -148,7 +155,7 @@ |
| 148 | 155 |
<JLabel id="serverDataBaseLabel" text='observe.storage.server.dataBase'/>
|
| 149 | 156 |
</cell>
|
| 150 | 157 |
<cell weightx='1' fill="both" anchor='east'>
|
| 151 |
- <JTextField id="serverDataBase" onKeyReleased="model.setServerModified(true);"/>
|
|
| 158 |
+ <JTextField id="serverDataBase" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 152 | 159 |
</cell>
|
| 153 | 160 |
</row>
|
| 154 | 161 |
|
| ... | ... | @@ -160,12 +167,13 @@ |
| 160 | 167 |
<JButton id="saveServerAction"/>
|
| 161 | 168 |
<JButton id="deleteServerAction"/>
|
| 162 | 169 |
<JButton id="testServerAction"/>
|
| 170 |
+ <JButton id="duplicateServerAction"/>
|
|
| 163 | 171 |
</JPanel>
|
| 164 | 172 |
</cell>
|
| 165 | 173 |
</row>
|
| 166 | 174 |
</Table>
|
| 167 | 175 |
</JPanel>
|
| 168 |
- </JSplitPane>
|
|
| 176 |
+ </JPanel>
|
|
| 169 | 177 |
</tab>
|
| 170 | 178 |
</JTabbedPane>
|
| 171 | 179 |
|
| ... | ... | @@ -174,4 +182,4 @@ |
| 174 | 182 |
<JButton id="quitAction"/>
|
| 175 | 183 |
</JPanel>
|
| 176 | 184 |
|
| 177 |
-</JPanel>
|
|
| 185 |
+</org.jdesktop.swingx.JXTitledPanel>
|
| ... | ... | @@ -21,15 +21,10 @@ |
| 21 | 21 |
*/
|
| 22 | 22 |
|
| 23 | 23 |
#noRemoteSelected {
|
| 24 |
- visible: true;
|
|
| 25 | 24 |
text:"observe.storage.presets.no.selected";
|
| 26 | 25 |
horizontalAlignment: center;
|
| 27 | 26 |
}
|
| 28 | 27 |
|
| 29 |
-#remoteForm {
|
|
| 30 |
- visible: false;
|
|
| 31 |
-}
|
|
| 32 |
- |
|
| 33 | 28 |
#remoteName {
|
| 34 | 29 |
text:{SwingUtil.getStringValue(model.getRemoteDataSourceConfiguration().getName())};
|
| 35 | 30 |
}
|
| ... | ... | @@ -52,15 +47,10 @@ |
| 52 | 47 |
}
|
| 53 | 48 |
|
| 54 | 49 |
#noServerSelected {
|
| 55 |
- visible: true;
|
|
| 56 | 50 |
text:"observe.storage.presets.no.selected";
|
| 57 | 51 |
horizontalAlignment: center;
|
| 58 | 52 |
}
|
| 59 | 53 |
|
| 60 |
-#serverForm {
|
|
| 61 |
- visible: false;
|
|
| 62 |
-}
|
|
| 63 |
- |
|
| 64 | 54 |
#serverName {
|
| 65 | 55 |
text:{SwingUtil.getStringValue(model.getServerDataSourceConfiguration().getName())};
|
| 66 | 56 |
}
|
| ... | ... | @@ -87,6 +77,7 @@ |
| 87 | 77 |
|
| 88 | 78 |
#resetRemoteAction {
|
| 89 | 79 |
_observeAction:{ResetRemoteUIAction.ACTION_NAME};
|
| 80 |
+ enabled:{model.isRemoteModified()};
|
|
| 90 | 81 |
}
|
| 91 | 82 |
|
| 92 | 83 |
#saveRemoteAction {
|
| ... | ... | @@ -98,6 +89,10 @@ |
| 98 | 89 |
_observeAction:{DeleteRemoteUIAction.ACTION_NAME};
|
| 99 | 90 |
}
|
| 100 | 91 |
|
| 92 |
+#duplicateRemoteAction {
|
|
| 93 |
+ _observeAction:{DuplicateRemoteUIAction.ACTION_NAME};
|
|
| 94 |
+}
|
|
| 95 |
+ |
|
| 101 | 96 |
#testRemoteAction {
|
| 102 | 97 |
_observeAction:{TestRemoteUIAction.ACTION_NAME};
|
| 103 | 98 |
}
|
| ... | ... | @@ -120,6 +115,10 @@ |
| 120 | 115 |
_observeAction:{DeleteServerUIAction.ACTION_NAME};
|
| 121 | 116 |
}
|
| 122 | 117 |
|
| 118 |
+#duplicateServerAction {
|
|
| 119 |
+ _observeAction:{DuplicateServerUIAction.ACTION_NAME};
|
|
| 120 |
+}
|
|
| 121 |
+ |
|
| 123 | 122 |
#testServerAction {
|
| 124 | 123 |
_observeAction:{TestServerUIAction.ACTION_NAME};
|
| 125 | 124 |
}
|
| ... | ... | @@ -44,7 +44,7 @@ import javax.swing.JPanel; |
| 44 | 44 |
import javax.swing.JSplitPane;
|
| 45 | 45 |
import javax.swing.KeyStroke;
|
| 46 | 46 |
import javax.swing.SwingUtilities;
|
| 47 |
-import java.awt.BorderLayout;
|
|
| 47 |
+import java.awt.CardLayout;
|
|
| 48 | 48 |
import java.awt.event.KeyEvent;
|
| 49 | 49 |
import java.util.List;
|
| 50 | 50 |
import java.util.Objects;
|
| ... | ... | @@ -105,6 +105,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 105 | 105 |
ui.getModel().setRemoteModified(false);
|
| 106 | 106 |
} else {
|
| 107 | 107 |
ui.getModel().setRemoteDataSourceConfiguration(ui.getRemoteConfigurations().getSelectedValue());
|
| 108 |
+ ui.getRemoteName().requestFocusInWindow();
|
|
| 108 | 109 |
}
|
| 109 | 110 |
});
|
| 110 | 111 |
|
| ... | ... | @@ -124,17 +125,12 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 124 | 125 |
ui.getModel().addPropertyChangeListener("remoteDataSourceConfiguration", evt -> {
|
| 125 | 126 |
|
| 126 | 127 |
RemoteDataSourceConfiguration oldValue = (RemoteDataSourceConfiguration) evt.getOldValue();
|
| 127 |
- |
|
| 128 | 128 |
if (ui.getModel().getRemoteDataSourceConfiguration() == null) {
|
| 129 |
- ui.getRemoteContentPanel().remove(ui.getRemoteForm());
|
|
| 130 |
- ui.getRemoteContentPanel().add(ui.getNoRemoteSelected(), BorderLayout.CENTER);
|
|
| 131 |
- UIHelper.askFocus(ui.getCreateAction());
|
|
| 129 |
+ ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "empty");
|
|
| 130 |
+ ui.getCreateAction().requestFocusInWindow();
|
|
| 132 | 131 |
} else {
|
| 133 | 132 |
if (oldValue == null) {
|
| 134 |
- ui.getRemoteForm().setVisible(true);
|
|
| 135 |
- ui.getRemoteContentPanel().remove(ui.getNoRemoteSelected());
|
|
| 136 |
- ui.getRemoteContentPanel().add(ui.getRemoteForm(), BorderLayout.CENTER);
|
|
| 137 |
- UIHelper.askFocus(ui.getRemoteName());
|
|
| 133 |
+ ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "form");
|
|
| 138 | 134 |
}
|
| 139 | 135 |
ui.getModel().setRemoteModified(false);
|
| 140 | 136 |
}
|
| ... | ... | @@ -146,10 +142,12 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 146 | 142 |
if ((Boolean) evt.getNewValue()) {
|
| 147 | 143 |
remoteActions.remove(ui.getResetRemoteAction());
|
| 148 | 144 |
remoteActions.remove(ui.getDeleteRemoteAction());
|
| 145 |
+ remoteActions.remove(ui.getDuplicateRemoteAction());
|
|
| 149 | 146 |
remoteActions.add(ui.getCancelRemoteAction(), 0);
|
| 150 | 147 |
} else {
|
| 151 | 148 |
remoteActions.add(ui.getResetRemoteAction(), 0);
|
| 152 | 149 |
remoteActions.add(ui.getDeleteRemoteAction(), 2);
|
| 150 |
+ remoteActions.add(ui.getDuplicateRemoteAction());
|
|
| 153 | 151 |
remoteActions.remove(ui.getCancelRemoteAction());
|
| 154 | 152 |
}
|
| 155 | 153 |
});
|
| ... | ... | @@ -169,6 +167,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 169 | 167 |
ui.getModel().setServerModified(false);
|
| 170 | 168 |
} else {
|
| 171 | 169 |
ui.getModel().setServerDataSourceConfiguration(ui.getServerConfigurations().getSelectedValue());
|
| 170 |
+ ui.getServerName().requestFocusInWindow();
|
|
| 172 | 171 |
}
|
| 173 | 172 |
});
|
| 174 | 173 |
|
| ... | ... | @@ -190,15 +189,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 190 | 189 |
ServerDataSourceConfiguration oldValue = (ServerDataSourceConfiguration) evt.getOldValue();
|
| 191 | 190 |
|
| 192 | 191 |
if (ui.getModel().getServerDataSourceConfiguration() == null) {
|
| 193 |
- ui.getServerContentPanel().remove(ui.getServerForm());
|
|
| 194 |
- ui.getServerContentPanel().add(ui.getNoServerSelected(), BorderLayout.CENTER);
|
|
| 195 |
- UIHelper.askFocus(ui.getCreateAction());
|
|
| 192 |
+ ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "empty");
|
|
| 193 |
+ ui.getCreateAction().requestFocusInWindow();
|
|
| 196 | 194 |
} else {
|
| 197 | 195 |
if (oldValue == null) {
|
| 198 |
- ui.getServerForm().setVisible(true);
|
|
| 199 |
- ui.getServerContentPanel().remove(ui.getNoServerSelected());
|
|
| 200 |
- ui.getServerContentPanel().add(ui.getServerForm(), BorderLayout.CENTER);
|
|
| 201 |
- UIHelper.askFocus(ui.getServerName());
|
|
| 196 |
+ ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "form");
|
|
| 202 | 197 |
}
|
| 203 | 198 |
ui.getModel().setServerModified(false);
|
| 204 | 199 |
}
|
| ... | ... | @@ -210,11 +205,13 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 210 | 205 |
if ((Boolean) evt.getNewValue()) {
|
| 211 | 206 |
serverActions.remove(ui.getResetServerAction());
|
| 212 | 207 |
serverActions.remove(ui.getDeleteServerAction());
|
| 208 |
+ serverActions.remove(ui.getDuplicateServerAction());
|
|
| 213 | 209 |
serverActions.add(ui.getCancelServerAction(), 0);
|
| 214 | 210 |
} else {
|
| 215 | 211 |
|
| 216 | 212 |
serverActions.add(ui.getResetServerAction(), 0);
|
| 217 | 213 |
serverActions.add(ui.getDeleteServerAction(), 2);
|
| 214 |
+ serverActions.add(ui.getDuplicateServerAction());
|
|
| 218 | 215 |
serverActions.remove(ui.getCancelServerAction());
|
| 219 | 216 |
}
|
| 220 | 217 |
});
|
| ... | ... | @@ -222,6 +219,13 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 222 | 219 |
ui.getServerActions().remove(0);
|
| 223 | 220 |
UIHelper.askFocus(ui.getCreateAction());
|
| 224 | 221 |
|
| 222 |
+ if (ui.getRemoteConfigurations().getModel().getSize()>0) {
|
|
| 223 |
+ ui.getRemoteConfigurations().setSelectedIndex(0);
|
|
| 224 |
+ }
|
|
| 225 |
+ |
|
| 226 |
+ if (ui.getServerConfigurations().getModel().getSize()>0) {
|
|
| 227 |
+ ui.getServerConfigurations().setSelectedIndex(0);
|
|
| 228 |
+ }
|
|
| 225 | 229 |
}
|
| 226 | 230 |
|
| 227 | 231 |
protected void init(JSplitPane editor) {
|
| ... | ... | @@ -243,8 +247,33 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 243 | 247 |
log.debug("init common action " + actionId);
|
| 244 | 248 |
}
|
| 245 | 249 |
|
| 250 |
+ if (actionId.contains("Remote")) {
|
|
| 251 |
+ inputMap = ui.getRemoteContentPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
| 252 |
+ actionMap = ui.getRemoteContentPanel().getActionMap();
|
|
| 253 |
+ } else if (actionId.contains("Server")) {
|
|
| 254 |
+ inputMap = ui.getServerContentPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
| 255 |
+ actionMap = ui.getServerContentPanel().getActionMap();
|
|
| 256 |
+ } else {
|
|
| 257 |
+ inputMap = ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
| 258 |
+ actionMap = ui.getActionMap();
|
|
| 259 |
+ }
|
|
| 246 | 260 |
action.initForMainUi(editor, inputMap, actionMap);
|
| 247 | 261 |
editor.putClientProperty(UIActionSupport.CLIENT_PROPERTY_UI, ui);
|
| 248 | 262 |
|
| 249 | 263 |
}
|
| 264 |
+ |
|
| 265 |
+ protected void setServerModified(KeyEvent event) {
|
|
| 266 |
+ if (event.isActionKey()) {
|
|
| 267 |
+ return;
|
|
| 268 |
+ }
|
|
| 269 |
+ ui.getModel().setServerModified(true);
|
|
| 270 |
+ }
|
|
| 271 |
+ |
|
| 272 |
+ protected void setRemoteModified(KeyEvent event) {
|
|
| 273 |
+ if (event.isActionKey()) {
|
|
| 274 |
+ return;
|
|
| 275 |
+ }
|
|
| 276 |
+ ui.getModel().setRemoteModified(true);
|
|
| 277 |
+ }
|
|
| 278 |
+ |
|
| 250 | 279 |
}
|
| ... | ... | @@ -72,6 +72,9 @@ observe.action.delete.tip=Delete |
| 72 | 72 |
observe.action.detail=Details
|
| 73 | 73 |
observe.action.do.backup=Backup local database
|
| 74 | 74 |
observe.action.do.backup.tip=Make a backup of local database before applying modifications.
|
| 75 |
+observe.action.duplicate=Duplicate
|
|
| 76 |
+observe.action.duplicate.remote.tip=Duplicate remote
|
|
| 77 |
+observe.action.duplicate.server.tip=Duplicate server
|
|
| 75 | 78 |
observe.action.exit=Quit
|
| 76 | 79 |
observe.action.exit.tip=quit Observe
|
| 77 | 80 |
observe.action.floatingObjectPresets=Floating Object references
|
| ... | ... | @@ -72,6 +72,9 @@ observe.action.delete.tip=Eliminar |
| 72 | 72 |
observe.action.detail=Ver detalles
|
| 73 | 73 |
observe.action.do.backup=Guardar la base local
|
| 74 | 74 |
observe.action.do.backup.tip=Hacer copia de seguridad de la base local antes de aplicar los cambios
|
| 75 |
+observe.action.duplicate=Duplicate \#TODO
|
|
| 76 |
+observe.action.duplicate.remote.tip=Duplicate remote \#TODO
|
|
| 77 |
+observe.action.duplicate.server.tip=Duplicate server \#TODO
|
|
| 75 | 78 |
observe.action.exit=Salir
|
| 76 | 79 |
observe.action.exit.tip=Salir de ObServe
|
| 77 | 80 |
observe.action.floatingObjectPresets=Referencias de objetos flotantes
|
| ... | ... | @@ -72,6 +72,9 @@ observe.action.delete.tip=Supprimer |
| 72 | 72 |
observe.action.detail=Voir les détails
|
| 73 | 73 |
observe.action.do.backup=Sauver la base locale
|
| 74 | 74 |
observe.action.do.backup.tip=Effectuer une sauvegarde de la base locale avant d'appliquer les changements
|
| 75 |
+observe.action.duplicate=Dupliquer
|
|
| 76 |
+observe.action.duplicate.remote.tip=Duplicate la connexion distante
|
|
| 77 |
+observe.action.duplicate.server.tip=Duplicate la connexion server
|
|
| 75 | 78 |
observe.action.exit=Quitter
|
| 76 | 79 |
observe.action.exit.tip=Quitter ObServe
|
| 77 | 80 |
observe.action.floatingObjectPresets=Objets flottants de références
|