Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
a4408bcb
by Tony Chemit at 2020-05-07T12:49:38+02:00
-
ce1e84ab
by Tony Chemit at 2020-05-07T13:22:48+02:00
12 changed files:
- client-core/src/main/java/fr/ird/observe/client/util/ObserveKeyStrokesSupport.java
- client-datasource-editor-api/src/main/i18n/getters/java.getter
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUI.jaxx
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUI.jcss
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUIHandler.java
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DeleteRemote.java
- client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DeleteServer.java
- + client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DuplicateRemote.java
- + client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DuplicateServer.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:
| ... | ... | @@ -100,6 +100,7 @@ public abstract class ObserveKeyStrokesSupport { |
| 100 | 100 |
public static final KeyStroke KEY_STROKE_NEW_DATA = KeyStroke.getKeyStroke("pressed F4");
|
| 101 | 101 |
public static final KeyStroke KEY_STROKE_NEW_NEXT_DATA = KeyStroke.getKeyStroke("pressed F9");
|
| 102 | 102 |
public static final KeyStroke KEY_STROKE_DELETE_DATA_GLOBAL = KeyStroke.getKeyStroke("pressed F6");
|
| 103 |
+ public static final KeyStroke KEY_STROKE_DUPLICATE = KeyStroke.getKeyStroke("pressed F2");
|
|
| 103 | 104 |
public static final KeyStroke KEY_STROKE_MOVE_DATA_GLOBAL = KeyStroke.getKeyStroke("pressed F8");
|
| 104 | 105 |
public static final KeyStroke KEY_STROKE_OPEN_DATA = KeyStroke.getKeyStroke("pressed F2");
|
| 105 | 106 |
public static final KeyStroke KEY_STROKE_CLOSE_DATA = KeyStroke.getKeyStroke("pressed F3");
|
| ... | ... | @@ -32,6 +32,9 @@ observe.action.delete.tip |
| 32 | 32 |
observe.action.detail
|
| 33 | 33 |
observe.action.do.backup
|
| 34 | 34 |
observe.action.do.backup.tip
|
| 35 |
+observe.action.duplicate
|
|
| 36 |
+observe.action.duplicate.remote.tip
|
|
| 37 |
+observe.action.duplicate.server.tip
|
|
| 35 | 38 |
observe.action.goDown
|
| 36 | 39 |
observe.action.goDown.tip
|
| 37 | 40 |
observe.action.goUp
|
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 |
<JLabel text='observe.storage.remote.name'/>
|
| 40 | 40 |
</cell>
|
| 41 | 41 |
<cell weightx='1' fill="both" anchor='east'>
|
| 42 |
- <JTextField id="remoteName" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 42 |
+ <JTextField id="remoteName" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 43 | 43 |
</cell>
|
| 44 | 44 |
</row>
|
| 45 | 45 |
<row>
|
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 |
<JLabel text='observe.storage.remote.url'/>
|
| 48 | 48 |
</cell>
|
| 49 | 49 |
<cell weightx='1' fill="both" anchor='east'>
|
| 50 |
- <JTextField id="remoteUrl" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 50 |
+ <JTextField id="remoteUrl" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 51 | 51 |
</cell>
|
| 52 | 52 |
</row>
|
| 53 | 53 |
<row>
|
| ... | ... | @@ -55,7 +55,7 @@ |
| 55 | 55 |
<JLabel text='observe.storage.remote.login'/>
|
| 56 | 56 |
</cell>
|
| 57 | 57 |
<cell weightx='1' fill="both" anchor='east'>
|
| 58 |
- <JTextField id="remoteLogin" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 58 |
+ <JTextField id="remoteLogin" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 59 | 59 |
</cell>
|
| 60 | 60 |
</row>
|
| 61 | 61 |
<row>
|
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 |
<JLabel text='observe.storage.remote.password'/>
|
| 64 | 64 |
</cell>
|
| 65 | 65 |
<cell weightx='1' fill="both" anchor='east'>
|
| 66 |
- <JTextField id="remotePassword" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 66 |
+ <JTextField id="remotePassword" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 67 | 67 |
</cell>
|
| 68 | 68 |
</row>
|
| 69 | 69 |
<row>
|
| ... | ... | @@ -80,6 +80,7 @@ |
| 80 | 80 |
<JButton id="saveRemoteAction"/>
|
| 81 | 81 |
<JButton id="deleteRemoteAction"/>
|
| 82 | 82 |
<JButton id="testRemoteAction"/>
|
| 83 |
+ <JButton id="duplicateRemoteAction"/>
|
|
| 83 | 84 |
</JPanel>
|
| 84 | 85 |
</cell>
|
| 85 | 86 |
</row>
|
| ... | ... | @@ -99,7 +100,7 @@ |
| 99 | 100 |
<JLabel text='observe.storage.remote.name'/>
|
| 100 | 101 |
</cell>
|
| 101 | 102 |
<cell weightx='1' fill="both" anchor='east'>
|
| 102 |
- <JTextField id="serverName" onKeyReleased="model.setServerModified(true);"/>
|
|
| 103 |
+ <JTextField id="serverName" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 103 | 104 |
</cell>
|
| 104 | 105 |
</row>
|
| 105 | 106 |
<row>
|
| ... | ... | @@ -107,7 +108,7 @@ |
| 107 | 108 |
<JLabel text='observe.storage.remote.url'/>
|
| 108 | 109 |
</cell>
|
| 109 | 110 |
<cell weightx='1' fill="both" anchor='east'>
|
| 110 |
- <JTextField id="serverUrl" onKeyReleased="model.setServerModified(true);"/>
|
|
| 111 |
+ <JTextField id="serverUrl" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 111 | 112 |
</cell>
|
| 112 | 113 |
</row>
|
| 113 | 114 |
<row>
|
| ... | ... | @@ -115,7 +116,7 @@ |
| 115 | 116 |
<JLabel text='observe.storage.remote.login'/>
|
| 116 | 117 |
</cell>
|
| 117 | 118 |
<cell weightx='1' fill="both" anchor='east'>
|
| 118 |
- <JTextField id="serverLogin" onKeyReleased="model.setServerModified(true);"/>
|
|
| 119 |
+ <JTextField id="serverLogin" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 119 | 120 |
</cell>
|
| 120 | 121 |
</row>
|
| 121 | 122 |
<row>
|
| ... | ... | @@ -123,7 +124,7 @@ |
| 123 | 124 |
<JLabel text='observe.storage.remote.password'/>
|
| 124 | 125 |
</cell>
|
| 125 | 126 |
<cell weightx='1' fill="both" anchor='east'>
|
| 126 |
- <JTextField id="serverPassword" onKeyReleased="model.setServerModified(true);"/>
|
|
| 127 |
+ <JTextField id="serverPassword" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 127 | 128 |
</cell>
|
| 128 | 129 |
</row>
|
| 129 | 130 |
<row>
|
| ... | ... | @@ -131,7 +132,7 @@ |
| 131 | 132 |
<JLabel id="serverDataBaseLabel" text='observe.storage.server.dataBase'/>
|
| 132 | 133 |
</cell>
|
| 133 | 134 |
<cell weightx='1' fill="both" anchor='east'>
|
| 134 |
- <JTextField id="serverDataBase" onKeyReleased="model.setServerModified(true);"/>
|
|
| 135 |
+ <JTextField id="serverDataBase" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 135 | 136 |
</cell>
|
| 136 | 137 |
</row>
|
| 137 | 138 |
|
| ... | ... | @@ -143,6 +144,7 @@ |
| 143 | 144 |
<JButton id="saveServerAction"/>
|
| 144 | 145 |
<JButton id="deleteServerAction"/>
|
| 145 | 146 |
<JButton id="testServerAction"/>
|
| 147 |
+ <JButton id="duplicateServerAction"/>
|
|
| 146 | 148 |
</JPanel>
|
| 147 | 149 |
</cell>
|
| 148 | 150 |
</row>
|
| ... | ... | @@ -85,6 +85,10 @@ |
| 85 | 85 |
text:{SwingUtil.getStringValue(model.getServerDataSourceConfiguration().getDatabaseName())};
|
| 86 | 86 |
}
|
| 87 | 87 |
|
| 88 |
+#resetRemoteAction {
|
|
| 89 |
+ enabled:{model.isRemoteModified()};
|
|
| 90 |
+}
|
|
| 91 |
+ |
|
| 88 | 92 |
#saveRemoteAction {
|
| 89 | 93 |
enabled:{model.isRemoteModified()};
|
| 90 | 94 |
}
|
| ... | ... | @@ -55,11 +55,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 55 | 55 |
|
| 56 | 56 |
private static final Logger log = LogManager.getLogger(RemotePresetsUIHandler.class);
|
| 57 | 57 |
|
| 58 |
-// private RemotePresetsUI ui;
|
|
| 58 |
+ private RemotePresetsUI ui;
|
|
| 59 | 59 |
|
| 60 | 60 |
@Override
|
| 61 | 61 |
public void beforeInit(RemotePresetsUI ui) {
|
| 62 |
-// this.ui = ui;
|
|
| 62 |
+ this.ui = ui;
|
|
| 63 | 63 |
RemotePresetsUIModel model = new RemotePresetsUIModel();
|
| 64 | 64 |
ClientConfig config = getClientConfig();
|
| 65 | 65 |
model.setServerDataSourceConfigurations(config.getServerDataSourceConfigurationList());
|
| ... | ... | @@ -98,6 +98,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 98 | 98 |
ui.getModel().setRemoteModified(false);
|
| 99 | 99 |
} else {
|
| 100 | 100 |
ui.getModel().setRemoteDataSourceConfiguration(ui.getRemoteConfigurations().getSelectedValue());
|
| 101 |
+ ui.getRemoteName().requestFocusInWindow();
|
|
| 101 | 102 |
}
|
| 102 | 103 |
});
|
| 103 | 104 |
|
| ... | ... | @@ -126,7 +127,6 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 126 | 127 |
ui.getRemoteForm().setVisible(true);
|
| 127 | 128 |
ui.getRemoteContentPanel().remove(ui.getNoRemoteSelected());
|
| 128 | 129 |
ui.getRemoteContentPanel().add(ui.getRemoteForm(), BorderLayout.CENTER);
|
| 129 |
- ui.getRemoteName().requestFocusInWindow();
|
|
| 130 | 130 |
}
|
| 131 | 131 |
ui.getModel().setRemoteModified(false);
|
| 132 | 132 |
}
|
| ... | ... | @@ -137,10 +137,12 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 137 | 137 |
if ((Boolean) evt.getNewValue()) {
|
| 138 | 138 |
remoteActions.remove(ui.getResetRemoteAction());
|
| 139 | 139 |
remoteActions.remove(ui.getDeleteRemoteAction());
|
| 140 |
+ remoteActions.remove(ui.getDuplicateRemoteAction());
|
|
| 140 | 141 |
remoteActions.add(ui.getCancelRemoteAction(), 0);
|
| 141 | 142 |
} else {
|
| 142 | 143 |
remoteActions.add(ui.getResetRemoteAction(), 0);
|
| 143 | 144 |
remoteActions.add(ui.getDeleteRemoteAction(), 2);
|
| 145 |
+ remoteActions.add(ui.getDeleteRemoteAction());
|
|
| 144 | 146 |
remoteActions.remove(ui.getCancelRemoteAction());
|
| 145 | 147 |
}
|
| 146 | 148 |
});
|
| ... | ... | @@ -160,6 +162,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 160 | 162 |
ui.getModel().setServerModified(false);
|
| 161 | 163 |
} else {
|
| 162 | 164 |
ui.getModel().setServerDataSourceConfiguration(ui.getServerConfigurations().getSelectedValue());
|
| 165 |
+ ui.getServerName().requestFocusInWindow();
|
|
| 163 | 166 |
}
|
| 164 | 167 |
});
|
| 165 | 168 |
|
| ... | ... | @@ -188,7 +191,6 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 188 | 191 |
ui.getServerForm().setVisible(true);
|
| 189 | 192 |
ui.getServerContentPanel().remove(ui.getNoServerSelected());
|
| 190 | 193 |
ui.getServerContentPanel().add(ui.getServerForm(), BorderLayout.CENTER);
|
| 191 |
- ui.getServerName().requestFocusInWindow();
|
|
| 192 | 194 |
}
|
| 193 | 195 |
ui.getModel().setServerModified(false);
|
| 194 | 196 |
}
|
| ... | ... | @@ -200,11 +202,13 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 200 | 202 |
if ((Boolean) evt.getNewValue()) {
|
| 201 | 203 |
serverActions.remove(ui.getResetServerAction());
|
| 202 | 204 |
serverActions.remove(ui.getDeleteServerAction());
|
| 205 |
+ serverActions.remove(ui.getDuplicateServerAction());
|
|
| 203 | 206 |
serverActions.add(ui.getCancelServerAction(), 0);
|
| 204 | 207 |
} else {
|
| 205 | 208 |
|
| 206 | 209 |
serverActions.add(ui.getResetServerAction(), 0);
|
| 207 | 210 |
serverActions.add(ui.getDeleteServerAction(), 2);
|
| 211 |
+ serverActions.add(ui.getDuplicateServerAction());
|
|
| 208 | 212 |
serverActions.remove(ui.getCancelServerAction());
|
| 209 | 213 |
}
|
| 210 | 214 |
});
|
| ... | ... | @@ -218,7 +222,21 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC |
| 218 | 222 |
editor.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
|
| 219 | 223 |
.put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none");
|
| 220 | 224 |
}
|
| 221 |
-//
|
|
| 225 |
+ |
|
| 226 |
+ protected void setServerModified(KeyEvent event) {
|
|
| 227 |
+ if (event.isActionKey()) {
|
|
| 228 |
+ return;
|
|
| 229 |
+ }
|
|
| 230 |
+ ui.getModel().setServerModified(true);
|
|
| 231 |
+ }
|
|
| 232 |
+ |
|
| 233 |
+ protected void setRemoteModified(KeyEvent event) {
|
|
| 234 |
+ if (event.isActionKey()) {
|
|
| 235 |
+ return;
|
|
| 236 |
+ }
|
|
| 237 |
+ ui.getModel().setRemoteModified(true);
|
|
| 238 |
+ }
|
|
| 239 |
+ |
|
| 222 | 240 |
// protected void init(InputMap inputMap, ActionMap actionMap, AbstractButton editor) {
|
| 223 | 241 |
// String actionId = (String) editor.getClientProperty(OBSERVE_ACTION);
|
| 224 | 242 |
// if (actionId == null) {
|
| ... | ... | @@ -65,6 +65,8 @@ public class DeleteRemote extends RemoteActionSupport { |
| 65 | 65 |
ui.getModel().setRemoteDataSourceConfigurations(configurations);
|
| 66 | 66 |
getClientConfig().removeRemoteDataSourceConfiguration(configuration);
|
| 67 | 67 |
ui.getModel().setRemoteDataSourceConfiguration(null);
|
| 68 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 69 |
+ ui.getRemoteConfigurations().setSelectedIndex(newConfiguration);
|
|
| 68 | 70 |
}
|
| 69 | 71 |
}
|
| 70 | 72 |
}
|
| ... | ... | @@ -31,6 +31,7 @@ import javax.swing.JOptionPane; |
| 31 | 31 |
import java.awt.event.ActionEvent;
|
| 32 | 32 |
import java.util.ArrayList;
|
| 33 | 33 |
import java.util.List;
|
| 34 |
+import java.util.Objects;
|
|
| 34 | 35 |
|
| 35 | 36 |
import static io.ultreia.java4all.i18n.I18n.n;
|
| 36 | 37 |
import static io.ultreia.java4all.i18n.I18n.t;
|
| ... | ... | @@ -67,6 +68,8 @@ public class DeleteServer extends ServerActionSupport { |
| 67 | 68 |
ui.getModel().setServerDataSourceConfigurations(configurations);
|
| 68 | 69 |
getClientConfig().removeServerDataSourceConfiguration(configuration);
|
| 69 | 70 |
ui.getModel().setServerDataSourceConfiguration(null);
|
| 71 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 72 |
+ ui.getServerConfigurations().setSelectedIndex(newConfiguration);
|
|
| 70 | 73 |
}
|
| 71 | 74 |
|
| 72 | 75 |
}
|
| 1 |
+package fr.ird.observe.client.datasource.editor.wizard.presets.actions;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client DataSource Editor API
|
|
| 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.datasource.editor.wizard.presets.RemotePresetsUI;
|
|
| 26 |
+import fr.ird.observe.client.util.ObserveKeyStrokesSupport;
|
|
| 27 |
+import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
|
|
| 28 |
+ |
|
| 29 |
+import java.awt.event.ActionEvent;
|
|
| 30 |
+import java.util.ArrayList;
|
|
| 31 |
+import java.util.List;
|
|
| 32 |
+ |
|
| 33 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 34 |
+ |
|
| 35 |
+public class DuplicateRemote extends RemoteActionSupport {
|
|
| 36 |
+ |
|
| 37 |
+ public DuplicateRemote() {
|
|
| 38 |
+ super(n("observe.action.duplicate"), n("observe.action.duplicate.remote.tip"), "mode-create", ObserveKeyStrokesSupport.KEY_STROKE_DUPLICATE);
|
|
| 39 |
+ }
|
|
| 40 |
+ |
|
| 41 |
+ @Override
|
|
| 42 |
+ protected void doActionPerformed(ActionEvent event, RemotePresetsUI ui) {
|
|
| 43 |
+ |
|
| 44 |
+ RemoteDataSourceConfiguration incomingConfiguration = ui.getModel().getRemoteDataSourceConfiguration();
|
|
| 45 |
+ |
|
| 46 |
+ RemoteDataSourceConfiguration configuration = new RemoteDataSourceConfiguration();
|
|
| 47 |
+ |
|
| 48 |
+ configuration.setLogin(incomingConfiguration.getLogin());
|
|
| 49 |
+ configuration.setPassword(incomingConfiguration.getPassword());
|
|
| 50 |
+ configuration.setName(incomingConfiguration.getName() + " (Copie)");
|
|
| 51 |
+ configuration.setUrl(incomingConfiguration.getUrl());
|
|
| 52 |
+ |
|
| 53 |
+ List<RemoteDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getRemoteDataSourceConfigurations());
|
|
| 54 |
+ configurations.add(configuration);
|
|
| 55 |
+ ui.getModel().setRemoteDataSourceConfigurations(configurations);
|
|
| 56 |
+ ui.getModel().setRemoteCreateMode(true);
|
|
| 57 |
+ ui.getRemoteConfigurations().setSelectedValue(configuration, true);
|
|
| 58 |
+ }
|
|
| 59 |
+}
|
| 1 |
+package fr.ird.observe.client.datasource.editor.wizard.presets.actions;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client DataSource Editor API
|
|
| 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.datasource.editor.wizard.presets.RemotePresetsUI;
|
|
| 26 |
+import fr.ird.observe.client.util.ObserveKeyStrokesSupport;
|
|
| 27 |
+import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
|
|
| 28 |
+ |
|
| 29 |
+import java.awt.event.ActionEvent;
|
|
| 30 |
+import java.util.ArrayList;
|
|
| 31 |
+import java.util.List;
|
|
| 32 |
+ |
|
| 33 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 34 |
+ |
|
| 35 |
+public class DuplicateServer extends ServerActionSupport {
|
|
| 36 |
+ |
|
| 37 |
+ public DuplicateServer() {
|
|
| 38 |
+ super(n("observe.action.duplicate"), n("observe.action.duplicate.server.tip"), "mode-create", ObserveKeyStrokesSupport.KEY_STROKE_DUPLICATE);
|
|
| 39 |
+ }
|
|
| 40 |
+ |
|
| 41 |
+ @Override
|
|
| 42 |
+ protected void doActionPerformed(ActionEvent event, RemotePresetsUI ui) {
|
|
| 43 |
+ |
|
| 44 |
+ ServerDataSourceConfiguration incomingConfiguration = ui.getModel().getServerDataSourceConfiguration();
|
|
| 45 |
+ ServerDataSourceConfiguration configuration = new ServerDataSourceConfiguration();
|
|
| 46 |
+ |
|
| 47 |
+ configuration.setDatabaseName(incomingConfiguration.getDatabaseName());
|
|
| 48 |
+ configuration.setLogin(incomingConfiguration.getLogin());
|
|
| 49 |
+ configuration.setPassword(incomingConfiguration.getPassword());
|
|
| 50 |
+ configuration.setName(incomingConfiguration.getName()+" (Copie)");
|
|
| 51 |
+ configuration.setUrl(incomingConfiguration.getUrl());
|
|
| 52 |
+ |
|
| 53 |
+ List<ServerDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getServerDataSourceConfigurations());
|
|
| 54 |
+ configurations.add(configuration);
|
|
| 55 |
+ ui.getModel().setServerDataSourceConfigurations(configurations);
|
|
| 56 |
+ ui.getModel().setServerCreateMode(true);
|
|
| 57 |
+ ui.getServerConfigurations().setSelectedValue(configuration, true);
|
|
| 58 |
+ |
|
| 59 |
+ }
|
|
| 60 |
+ |
|
| 61 |
+ |
|
| 62 |
+}
|
| ... | ... | @@ -98,6 +98,9 @@ observe.action.delete.tip=Delete |
| 98 | 98 |
observe.action.detail=Details
|
| 99 | 99 |
observe.action.do.backup=Backup local database
|
| 100 | 100 |
observe.action.do.backup.tip=Make a backup of local database before applying modifications.
|
| 101 |
+observe.action.duplicate=Duplicate
|
|
| 102 |
+observe.action.duplicate.remote.tip=Duplicate remote
|
|
| 103 |
+observe.action.duplicate.server.tip=Duplicate server
|
|
| 101 | 104 |
observe.action.exit=Quit
|
| 102 | 105 |
observe.action.exit.tip=quit Observe
|
| 103 | 106 |
observe.action.export.requiredInsertMissingReferentials=Insert into central source missing referentials
|
| ... | ... | @@ -98,6 +98,9 @@ observe.action.delete.tip=Eliminar |
| 98 | 98 |
observe.action.detail=Ver detalles
|
| 99 | 99 |
observe.action.do.backup=Guardar la base local
|
| 100 | 100 |
observe.action.do.backup.tip=Hacer copia de seguridad de la base local antes de aplicar los cambios
|
| 101 |
+observe.action.duplicate=Duplicate \#TODO
|
|
| 102 |
+observe.action.duplicate.remote.tip=Duplicate remote \#TODO
|
|
| 103 |
+observe.action.duplicate.server.tip=Duplicate server \#TODO
|
|
| 101 | 104 |
observe.action.exit=Salir
|
| 102 | 105 |
observe.action.exit.tip=Salir de ObServe
|
| 103 | 106 |
observe.action.export.requiredInsertMissingReferentials=Insérer les référentiels manquant dans la source centrale. \#TODO
|
| ... | ... | @@ -98,6 +98,9 @@ observe.action.delete.tip=Supprimer |
| 98 | 98 |
observe.action.detail=Voir les détails
|
| 99 | 99 |
observe.action.do.backup=Sauver la base locale
|
| 100 | 100 |
observe.action.do.backup.tip=Effectuer une sauvegarde de la base locale avant d'appliquer les changements
|
| 101 |
+observe.action.duplicate=Dupliquer
|
|
| 102 |
+observe.action.duplicate.remote.tip=Duplicate la connexion distante
|
|
| 103 |
+observe.action.duplicate.server.tip=Duplicate la connexion server
|
|
| 101 | 104 |
observe.action.exit=Quitter
|
| 102 | 105 |
observe.action.exit.tip=Quitter ObServe
|
| 103 | 106 |
observe.action.export.requiredInsertMissingReferentials=Insérer les référentiels manquant dans la source centrale.
|