Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: de1041b9 by Tony Chemit at 2020-05-10T08:57:07+02:00 update pom - - - - - 110d6cd0 by Tony Chemit at 2020-05-10T08:57:09+02:00 Fichiers de traductions manquants - Closes #1478 - - - - - dd5eadd9 by Tony Chemit at 2020-05-10T08:57:09+02:00 Absence du gestionnaire de connexions - Closes #1476 - - - - - 94dc03fe by Tony Chemit at 2020-05-10T08:57:09+02:00 Dans le gestionnaire de connexions, un bouton 'dupliquer le profil' serait pratique - Closes #1477 - - - - - 8495b35d by Tony Chemit at 2020-05-10T08:57:09+02:00 Quelques améliorations dans le gestionnaire de connexion - Closes #1479 - - - - - 5c0030fc by Tony Chemit at 2020-05-10T09:41:40+02:00 L'écran de gestion des connexions pourrait être présenté en partage horizontal - Closes #1480 - - - - - 17 changed files: - + client-core/src/main/i18n/templates/initStorage_en_GB.ftl - + client-core/src/main/i18n/templates/initStorage_es_ES.ftl - + client-core/src/main/i18n/templates/initStorage_fr_FR.ftl - 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/DataSourceEditorBodyContent.java - 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 - pom.xml Changes: ===================================== client-core/src/main/i18n/templates/initStorage_en_GB.ftl ===================================== @@ -0,0 +1,43 @@ +<#-- + #%L + ObServe :: Client Core + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> + +<html> +<body> + +<h3>Loading a data sourced</h3> + +<p> + The local database does not exist (path ${localDb.absolutePath}). +</p> + +You can now: + +<ul> +<#if withBackup> + <li>use last automatic backup (${backupDate})</li> +</#if> + <li>create a new local database</li> + <li>connect to a remote database</li> +</ul> + +</body> +</html> ===================================== client-core/src/main/i18n/templates/initStorage_es_ES.ftl ===================================== @@ -0,0 +1,42 @@ +<#-- + #%L + ObServe :: Client Core + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> + +<h3>Importar una base de datos</h3> + +<p> + La base local no existe (ruta ${localDb.absolutePath}). +</p> + +Ahora puede: + +<ul> +<#if withBackup> + <li>Utilizar la última copia de seguridad automática (${backupDate})</li> +</#if> + <li>Crear una base local nueva</li> + <li>Conectar a una base remota</li> +</ul> + +</body> +</html> ===================================== client-core/src/main/i18n/templates/initStorage_fr_FR.ftl ===================================== @@ -0,0 +1,42 @@ +<#-- + #%L + ObServe :: Client Core + %% + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> +<html> +<body> + +<h3>Chargement d'une source de donnée</h3> + +<p> + La base locale n'existe pas (emplacement ${localDb.absolutePath}). +</p> + +Vous pouvez à ce stade + +<ul> +<#if withBackup> + <li>utiliser la dernière sauvegarde automatique (${backupDate})</li> +</#if> + <li>créer la base locale</li> + <li>vous connecter à une base distante.</li> +</ul> + +</body> +</html> ===================================== client-core/src/main/java/fr/ird/observe/client/util/ObserveKeyStrokesSupport.java ===================================== @@ -100,6 +100,7 @@ public abstract class ObserveKeyStrokesSupport { public static final KeyStroke KEY_STROKE_NEW_DATA = KeyStroke.getKeyStroke("pressed F4"); public static final KeyStroke KEY_STROKE_NEW_NEXT_DATA = KeyStroke.getKeyStroke("pressed F9"); public static final KeyStroke KEY_STROKE_DELETE_DATA_GLOBAL = KeyStroke.getKeyStroke("pressed F6"); + public static final KeyStroke KEY_STROKE_DUPLICATE = KeyStroke.getKeyStroke("pressed F2"); public static final KeyStroke KEY_STROKE_MOVE_DATA_GLOBAL = KeyStroke.getKeyStroke("pressed F8"); public static final KeyStroke KEY_STROKE_OPEN_DATA = KeyStroke.getKeyStroke("pressed F2"); public static final KeyStroke KEY_STROKE_CLOSE_DATA = KeyStroke.getKeyStroke("pressed F3"); ===================================== client-datasource-editor-api/src/main/i18n/getters/java.getter ===================================== @@ -32,6 +32,9 @@ observe.action.delete.tip observe.action.detail observe.action.do.backup observe.action.do.backup.tip +observe.action.duplicate +observe.action.duplicate.remote.tip +observe.action.duplicate.server.tip observe.action.goDown observe.action.goDown.tip observe.action.goUp ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/DataSourceEditorBodyContent.java ===================================== @@ -94,7 +94,7 @@ public class DataSourceEditorBodyContent extends MainUIBodyContent<DataSourceEdi navigationMenu.getUiModel().init(); getClientUIContext().getBusyModel().addPropertyChangeListener(BusyModel.BUSY_PROPERTY_NAME, evt -> reload()); - ShowDataSourcePresetsAction.init(mainUI, mainUI.getShowDataSourcePresets()); + ShowDataSourcePresetsAction.init(mainUI, mainUI.getShowDataSourcePresets(), ShowDataSourcePresetsAction.class); } // @Override ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUI.jaxx ===================================== @@ -23,23 +23,26 @@ fr.ird.observe.dto.presets.RemoteDataSourceConfiguration fr.ird.observe.dto.presets.ServerDataSourceConfiguration org.nuiton.jaxx.widgets.select.BeanComboBox + java.awt.CardLayout </import> <RemotePresetsUIModel id="model" initializer="getContextValue(RemotePresetsUIModel.class)"/> <JTabbedPane id='tabs' constraints='BorderLayout.CENTER'> <tab id='remoteTab' title="observe.storage.remote.presets.title"> - <JSplitPane id="remotePanel"> - <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/> - <JPanel id="remoteContentPanel" layout="{new BorderLayout()}"> - <JLabel id="noRemoteSelected" constraints='BorderLayout.CENTER'/> - <Table id="remoteForm" constraints='BorderLayout.SOUTH' fill="both"> + <JPanel id="remotePanel" layout="{new BorderLayout()}"> + <JScrollPane id='remoteConfigurationsPane' constraints='BorderLayout.CENTER'> + <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/> + </JScrollPane> + <JPanel id="remoteContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'> + <JLabel id="noRemoteSelected" constraints='"empty"'/> + <Table id="remoteForm" constraints='"form"' fill="both"> <row> <cell anchor='west'> <JLabel text='observe.storage.remote.name'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="remoteName" onKeyReleased="model.setRemoteModified(true);"/> + <JTextField id="remoteName" onKeyReleased="handler.setRemoteModified(event);"/> </cell> </row> <row> @@ -47,7 +50,7 @@ <JLabel text='observe.storage.remote.url'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="remoteUrl" onKeyReleased="model.setRemoteModified(true);"/> + <JTextField id="remoteUrl" onKeyReleased="handler.setRemoteModified(event);"/> </cell> </row> <row> @@ -55,7 +58,7 @@ <JLabel text='observe.storage.remote.login'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="remoteLogin" onKeyReleased="model.setRemoteModified(true);"/> + <JTextField id="remoteLogin" onKeyReleased="handler.setRemoteModified(event);"/> </cell> </row> <row> @@ -63,7 +66,7 @@ <JLabel text='observe.storage.remote.password'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="remotePassword" onKeyReleased="model.setRemoteModified(true);"/> + <JTextField id="remotePassword" onKeyReleased="handler.setRemoteModified(event);"/> </cell> </row> <row> @@ -80,26 +83,29 @@ <JButton id="saveRemoteAction"/> <JButton id="deleteRemoteAction"/> <JButton id="testRemoteAction"/> + <JButton id="duplicateRemoteAction"/> </JPanel> </cell> </row> </Table> </JPanel> - </JSplitPane> + </JPanel> </tab> <tab id='serverTab' title="observe.storage.server.presets.title"> - <JSplitPane id="serverPanel"> - <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/> - <JPanel id="serverContentPanel" layout="{new BorderLayout()}"> - <JLabel id="noServerSelected" constraints='BorderLayout.CENTER'/> - <Table id="serverForm" constraints='BorderLayout.SOUTH' fill="both"> + <JPanel id="serverPanel" layout="{new BorderLayout()}" > + <JScrollPane id='serverConfigurationsPane' constraints='BorderLayout.CENTER'> + <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/> + </JScrollPane> + <JPanel id="serverContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'> + <JLabel id="noServerSelected" constraints='"empty"'/> + <Table id="serverForm" constraints='"form"' fill="both"> <row> <cell anchor='west'> <JLabel text='observe.storage.remote.name'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="serverName" onKeyReleased="model.setServerModified(true);"/> + <JTextField id="serverName" onKeyReleased="handler.setServerModified(event);"/> </cell> </row> <row> @@ -107,7 +113,7 @@ <JLabel text='observe.storage.remote.url'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="serverUrl" onKeyReleased="model.setServerModified(true);"/> + <JTextField id="serverUrl" onKeyReleased="handler.setServerModified(event);"/> </cell> </row> <row> @@ -115,7 +121,7 @@ <JLabel text='observe.storage.remote.login'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="serverLogin" onKeyReleased="model.setServerModified(true);"/> + <JTextField id="serverLogin" onKeyReleased="handler.setServerModified(event);"/> </cell> </row> <row> @@ -123,7 +129,7 @@ <JLabel text='observe.storage.remote.password'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="serverPassword" onKeyReleased="model.setServerModified(true);"/> + <JTextField id="serverPassword" onKeyReleased="handler.setServerModified(event);"/> </cell> </row> <row> @@ -131,7 +137,7 @@ <JLabel id="serverDataBaseLabel" text='observe.storage.server.dataBase'/> </cell> <cell weightx='1' fill="both" anchor='east'> - <JTextField id="serverDataBase" onKeyReleased="model.setServerModified(true);"/> + <JTextField id="serverDataBase" onKeyReleased="handler.setServerModified(event);"/> </cell> </row> @@ -143,12 +149,13 @@ <JButton id="saveServerAction"/> <JButton id="deleteServerAction"/> <JButton id="testServerAction"/> + <JButton id="duplicateServerAction"/> </JPanel> </cell> </row> </Table> </JPanel> - </JSplitPane> + </JPanel> </tab> </JTabbedPane> ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUI.jcss ===================================== @@ -25,15 +25,10 @@ } #noRemoteSelected { - visible: true; text:"observe.storage.presets.no.selected"; horizontalAlignment: center; } -#remoteForm { - visible: false; -} - #remoteName { text:{SwingUtil.getStringValue(model.getRemoteDataSourceConfiguration().getName())}; } @@ -56,15 +51,10 @@ } #noServerSelected { - visible: true; text:"observe.storage.presets.no.selected"; horizontalAlignment: center; } -#serverForm { - visible: false; -} - #serverName { text:{SwingUtil.getStringValue(model.getServerDataSourceConfiguration().getName())}; } @@ -85,6 +75,10 @@ text:{SwingUtil.getStringValue(model.getServerDataSourceConfiguration().getDatabaseName())}; } +#resetRemoteAction { + enabled:{model.isRemoteModified()}; +} + #saveRemoteAction { enabled:{model.isRemoteModified()}; } ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUIHandler.java ===================================== @@ -42,6 +42,7 @@ import javax.swing.JSplitPane; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.event.KeyEvent; import java.util.List; @@ -55,11 +56,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC private static final Logger log = LogManager.getLogger(RemotePresetsUIHandler.class); -// private RemotePresetsUI ui; + private RemotePresetsUI ui; @Override public void beforeInit(RemotePresetsUI ui) { -// this.ui = ui; + this.ui = ui; RemotePresetsUIModel model = new RemotePresetsUIModel(); ClientConfig config = getClientConfig(); model.setServerDataSourceConfigurations(config.getServerDataSourceConfigurationList()); @@ -98,6 +99,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC ui.getModel().setRemoteModified(false); } else { ui.getModel().setRemoteDataSourceConfiguration(ui.getRemoteConfigurations().getSelectedValue()); + ui.getRemoteName().requestFocusInWindow(); } }); @@ -118,15 +120,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC RemoteDataSourceConfiguration oldValue = (RemoteDataSourceConfiguration) evt.getOldValue(); if (ui.getModel().getRemoteDataSourceConfiguration() == null) { - ui.getRemoteContentPanel().remove(ui.getRemoteForm()); - ui.getRemoteContentPanel().add(ui.getNoRemoteSelected(), BorderLayout.CENTER); + ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "empty"); ui.getCreateAction().requestFocusInWindow(); } else { if (oldValue == null) { - ui.getRemoteForm().setVisible(true); - ui.getRemoteContentPanel().remove(ui.getNoRemoteSelected()); - ui.getRemoteContentPanel().add(ui.getRemoteForm(), BorderLayout.CENTER); - ui.getRemoteName().requestFocusInWindow(); + ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "form"); } ui.getModel().setRemoteModified(false); } @@ -137,10 +135,12 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC if ((Boolean) evt.getNewValue()) { remoteActions.remove(ui.getResetRemoteAction()); remoteActions.remove(ui.getDeleteRemoteAction()); + remoteActions.remove(ui.getDuplicateRemoteAction()); remoteActions.add(ui.getCancelRemoteAction(), 0); } else { remoteActions.add(ui.getResetRemoteAction(), 0); remoteActions.add(ui.getDeleteRemoteAction(), 2); + remoteActions.add(ui.getDeleteRemoteAction()); remoteActions.remove(ui.getCancelRemoteAction()); } }); @@ -160,6 +160,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC ui.getModel().setServerModified(false); } else { ui.getModel().setServerDataSourceConfiguration(ui.getServerConfigurations().getSelectedValue()); + ui.getServerName().requestFocusInWindow(); } }); @@ -180,15 +181,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC ServerDataSourceConfiguration oldValue = (ServerDataSourceConfiguration) evt.getOldValue(); if (ui.getModel().getServerDataSourceConfiguration() == null) { - ui.getServerContentPanel().remove(ui.getServerForm()); - ui.getServerContentPanel().add(ui.getNoServerSelected(), BorderLayout.CENTER); + ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "empty"); ui.getCreateAction().requestFocusInWindow(); } else { if (oldValue == null) { - ui.getServerForm().setVisible(true); - ui.getServerContentPanel().remove(ui.getNoServerSelected()); - ui.getServerContentPanel().add(ui.getServerForm(), BorderLayout.CENTER); - ui.getServerName().requestFocusInWindow(); + ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "form"); } ui.getModel().setServerModified(false); } @@ -200,11 +197,13 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC if ((Boolean) evt.getNewValue()) { serverActions.remove(ui.getResetServerAction()); serverActions.remove(ui.getDeleteServerAction()); + serverActions.remove(ui.getDuplicateServerAction()); serverActions.add(ui.getCancelServerAction(), 0); } else { serverActions.add(ui.getResetServerAction(), 0); serverActions.add(ui.getDeleteServerAction(), 2); + serverActions.add(ui.getDuplicateServerAction()); serverActions.remove(ui.getCancelServerAction()); } }); @@ -218,23 +217,18 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC editor.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none"); } -// -// protected void init(InputMap inputMap, ActionMap actionMap, AbstractButton editor) { -// String actionId = (String) editor.getClientProperty(OBSERVE_ACTION); -// if (actionId == null) { -// -// return; -// } -// -// UIActionSupport action = (UIActionSupport) actionMap.get(actionId); -// Objects.requireNonNull(action, "action [" + actionId + "] not found for ui " + ui.getClass().getName()); -// -// if (log.isDebugEnabled()) { -// log.debug("init common action " + actionId); -// } -// -// action.initForMainUi(editor, inputMap, actionMap); -// editor.putClientProperty(UIActionSupport.CLIENT_PROPERTY_UI, ui); -// -// } + + protected void setServerModified(KeyEvent event) { + if (event.isActionKey()) { + return; + } + ui.getModel().setServerModified(true); + } + + protected void setRemoteModified(KeyEvent event) { + if (event.isActionKey()) { + return; + } + ui.getModel().setRemoteModified(true); + } } ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DeleteRemote.java ===================================== @@ -65,6 +65,8 @@ public class DeleteRemote extends RemoteActionSupport { ui.getModel().setRemoteDataSourceConfigurations(configurations); getClientConfig().removeRemoteDataSourceConfiguration(configuration); ui.getModel().setRemoteDataSourceConfiguration(null); + int newConfiguration = configurations.isEmpty() ? -1 : 0; + ui.getRemoteConfigurations().setSelectedIndex(newConfiguration); } } } ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DeleteServer.java ===================================== @@ -31,6 +31,7 @@ import javax.swing.JOptionPane; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static io.ultreia.java4all.i18n.I18n.n; import static io.ultreia.java4all.i18n.I18n.t; @@ -67,6 +68,8 @@ public class DeleteServer extends ServerActionSupport { ui.getModel().setServerDataSourceConfigurations(configurations); getClientConfig().removeServerDataSourceConfiguration(configuration); ui.getModel().setServerDataSourceConfiguration(null); + int newConfiguration = configurations.isEmpty() ? -1 : 0; + ui.getServerConfigurations().setSelectedIndex(newConfiguration); } } ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DuplicateRemote.java ===================================== @@ -0,0 +1,59 @@ +package fr.ird.observe.client.datasource.editor.wizard.presets.actions; + +/*- + * #%L + * ObServe :: Client DataSource Editor API + * %% + * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.client.datasource.editor.wizard.presets.RemotePresetsUI; +import fr.ird.observe.client.util.ObserveKeyStrokesSupport; +import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.List; + +import static io.ultreia.java4all.i18n.I18n.n; + +public class DuplicateRemote extends RemoteActionSupport { + + public DuplicateRemote() { + super(n("observe.action.duplicate"), n("observe.action.duplicate.remote.tip"), "mode-create", ObserveKeyStrokesSupport.KEY_STROKE_DUPLICATE); + } + + @Override + protected void doActionPerformed(ActionEvent event, RemotePresetsUI ui) { + + RemoteDataSourceConfiguration incomingConfiguration = ui.getModel().getRemoteDataSourceConfiguration(); + + RemoteDataSourceConfiguration configuration = new RemoteDataSourceConfiguration(); + + configuration.setLogin(incomingConfiguration.getLogin()); + configuration.setPassword(incomingConfiguration.getPassword()); + configuration.setName(incomingConfiguration.getName() + " (Copie)"); + configuration.setUrl(incomingConfiguration.getUrl()); + + List<RemoteDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getRemoteDataSourceConfigurations()); + configurations.add(configuration); + ui.getModel().setRemoteDataSourceConfigurations(configurations); + ui.getModel().setRemoteCreateMode(true); + ui.getRemoteConfigurations().setSelectedValue(configuration, true); + } +} ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DuplicateServer.java ===================================== @@ -0,0 +1,62 @@ +package fr.ird.observe.client.datasource.editor.wizard.presets.actions; + +/*- + * #%L + * ObServe :: Client DataSource Editor API + * %% + * Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.client.datasource.editor.wizard.presets.RemotePresetsUI; +import fr.ird.observe.client.util.ObserveKeyStrokesSupport; +import fr.ird.observe.dto.presets.ServerDataSourceConfiguration; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.List; + +import static io.ultreia.java4all.i18n.I18n.n; + +public class DuplicateServer extends ServerActionSupport { + + public DuplicateServer() { + super(n("observe.action.duplicate"), n("observe.action.duplicate.server.tip"), "mode-create", ObserveKeyStrokesSupport.KEY_STROKE_DUPLICATE); + } + + @Override + protected void doActionPerformed(ActionEvent event, RemotePresetsUI ui) { + + ServerDataSourceConfiguration incomingConfiguration = ui.getModel().getServerDataSourceConfiguration(); + ServerDataSourceConfiguration configuration = new ServerDataSourceConfiguration(); + + configuration.setDatabaseName(incomingConfiguration.getDatabaseName()); + configuration.setLogin(incomingConfiguration.getLogin()); + configuration.setPassword(incomingConfiguration.getPassword()); + configuration.setName(incomingConfiguration.getName()+" (Copie)"); + configuration.setUrl(incomingConfiguration.getUrl()); + + List<ServerDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getServerDataSourceConfigurations()); + configurations.add(configuration); + ui.getModel().setServerDataSourceConfigurations(configurations); + ui.getModel().setServerCreateMode(true); + ui.getServerConfigurations().setSelectedValue(configuration, true); + + } + + +} ===================================== observe-i18n/src/main/i18n/translations/observe_en_GB.properties ===================================== @@ -98,6 +98,9 @@ observe.action.delete.tip=Delete observe.action.detail=Details observe.action.do.backup=Backup local database observe.action.do.backup.tip=Make a backup of local database before applying modifications. +observe.action.duplicate=Duplicate +observe.action.duplicate.remote.tip=Duplicate remote +observe.action.duplicate.server.tip=Duplicate server observe.action.exit=Quit observe.action.exit.tip=quit Observe observe.action.export.requiredInsertMissingReferentials=Insert into central source missing referentials ===================================== observe-i18n/src/main/i18n/translations/observe_es_ES.properties ===================================== @@ -98,6 +98,9 @@ observe.action.delete.tip=Eliminar observe.action.detail=Ver detalles observe.action.do.backup=Guardar la base local observe.action.do.backup.tip=Hacer copia de seguridad de la base local antes de aplicar los cambios +observe.action.duplicate=Duplicate \#TODO +observe.action.duplicate.remote.tip=Duplicate remote \#TODO +observe.action.duplicate.server.tip=Duplicate server \#TODO observe.action.exit=Salir observe.action.exit.tip=Salir de ObServe observe.action.export.requiredInsertMissingReferentials=Insérer les référentiels manquant dans la source centrale. \#TODO ===================================== observe-i18n/src/main/i18n/translations/observe_fr_FR.properties ===================================== @@ -98,6 +98,9 @@ observe.action.delete.tip=Supprimer observe.action.detail=Voir les détails observe.action.do.backup=Sauver la base locale observe.action.do.backup.tip=Effectuer une sauvegarde de la base locale avant d'appliquer les changements +observe.action.duplicate=Dupliquer +observe.action.duplicate.remote.tip=Duplicate la connexion distante +observe.action.duplicate.server.tip=Duplicate la connexion server observe.action.exit=Quitter observe.action.exit.tip=Quitter ObServe observe.action.export.requiredInsertMissingReferentials=Insérer les référentiels manquant dans la source centrale. ===================================== pom.xml ===================================== @@ -24,7 +24,7 @@ <parent> <groupId>io.ultreia.maven</groupId> <artifactId>pom</artifactId> - <version>2020.19</version> + <version>2020.23</version> </parent> <groupId>fr.ird.observe</groupId> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ce1e84ab8f301184758a4376e... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ce1e84ab8f301184758a4376e... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT