Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

17 changed files:

Changes:

  • client-core/src/main/i18n/templates/initStorage_en_GB.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client Core
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +
    
    23
    +<html>
    
    24
    +<body>
    
    25
    +
    
    26
    +<h3>Loading a data sourced</h3>
    
    27
    +
    
    28
    +<p>
    
    29
    +    The local database does not exist (path ${localDb.absolutePath}).
    
    30
    +</p>
    
    31
    +
    
    32
    +You can now:
    
    33
    +
    
    34
    +<ul>
    
    35
    +<#if withBackup>
    
    36
    +    <li>use last automatic backup (${backupDate})</li>
    
    37
    +</#if>
    
    38
    +    <li>create a new local database</li>
    
    39
    +    <li>connect to a remote database</li>
    
    40
    +</ul>
    
    41
    +
    
    42
    +</body>
    
    43
    +</html>

  • client-core/src/main/i18n/templates/initStorage_es_ES.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client Core
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +
    
    25
    +<h3>Importar una base de datos</h3>
    
    26
    +
    
    27
    +<p>
    
    28
    +    La base local no existe (ruta ${localDb.absolutePath}).
    
    29
    +</p>
    
    30
    +
    
    31
    +Ahora puede:
    
    32
    +
    
    33
    +<ul>
    
    34
    +<#if withBackup>
    
    35
    +    <li>Utilizar la última copia de seguridad automática (${backupDate})</li>
    
    36
    +</#if>
    
    37
    +    <li>Crear una base local nueva</li>
    
    38
    +    <li>Conectar a una base remota</li>
    
    39
    +</ul>
    
    40
    +
    
    41
    +</body>
    
    42
    +</html>

  • client-core/src/main/i18n/templates/initStorage_fr_FR.ftl
    1
    +<#--
    
    2
    + #%L
    
    3
    + ObServe :: Client Core
    
    4
    + %%
    
    5
    + Copyright (C) 2008 - 2020 IRD, Code Lutin, Ultreia.io
    
    6
    + %%
    
    7
    + This program is free software: you can redistribute it and/or modify
    
    8
    + it under the terms of the GNU General Public License as
    
    9
    + published by the Free Software Foundation, either version 3 of the
    
    10
    + License, or (at your option) any later version.
    
    11
    +
    
    12
    + This program is distributed in the hope that it will be useful,
    
    13
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + GNU General Public License for more details.
    
    16
    +
    
    17
    + You should have received a copy of the GNU General Public
    
    18
    + License along with this program.  If not, see
    
    19
    + <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + #L%
    
    21
    +-->
    
    22
    +<html>
    
    23
    +<body>
    
    24
    +
    
    25
    +<h3>Chargement d'une source de donnée</h3>
    
    26
    +
    
    27
    +<p>
    
    28
    +    La base locale n'existe pas (emplacement ${localDb.absolutePath}).
    
    29
    +</p>
    
    30
    +
    
    31
    +Vous pouvez à ce stade
    
    32
    +
    
    33
    +<ul>
    
    34
    +<#if withBackup>
    
    35
    +    <li>utiliser la dernière sauvegarde automatique (${backupDate})</li>
    
    36
    +</#if>
    
    37
    +    <li>créer la base locale</li>
    
    38
    +    <li>vous connecter à une base distante.</li>
    
    39
    +</ul>
    
    40
    +
    
    41
    +</body>
    
    42
    +</html>

  • client-core/src/main/java/fr/ird/observe/client/util/ObserveKeyStrokesSupport.java
    ... ... @@ -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");
    

  • client-datasource-editor-api/src/main/i18n/getters/java.getter
    ... ... @@ -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
    

  • 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
    94 94
             navigationMenu.getUiModel().init();
    
    95 95
     
    
    96 96
             getClientUIContext().getBusyModel().addPropertyChangeListener(BusyModel.BUSY_PROPERTY_NAME, evt -> reload());
    
    97
    -        ShowDataSourcePresetsAction.init(mainUI, mainUI.getShowDataSourcePresets());
    
    97
    +        ShowDataSourcePresetsAction.init(mainUI, mainUI.getShowDataSourcePresets(), ShowDataSourcePresetsAction.class);
    
    98 98
         }
    
    99 99
     
    
    100 100
     //    @Override
    

  • client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUI.jaxx
    ... ... @@ -23,23 +23,26 @@
    23 23
         fr.ird.observe.dto.presets.RemoteDataSourceConfiguration
    
    24 24
         fr.ird.observe.dto.presets.ServerDataSourceConfiguration
    
    25 25
         org.nuiton.jaxx.widgets.select.BeanComboBox
    
    26
    +    java.awt.CardLayout
    
    26 27
       </import>
    
    27 28
     
    
    28 29
       <RemotePresetsUIModel id="model" initializer="getContextValue(RemotePresetsUIModel.class)"/>
    
    29 30
     
    
    30 31
       <JTabbedPane id='tabs' constraints='BorderLayout.CENTER'>
    
    31 32
         <tab id='remoteTab' title="observe.storage.remote.presets.title">
    
    32
    -      <JSplitPane id="remotePanel">
    
    33
    -        <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/>
    
    34
    -        <JPanel id="remoteContentPanel" layout="{new BorderLayout()}">
    
    35
    -          <JLabel id="noRemoteSelected" constraints='BorderLayout.CENTER'/>
    
    36
    -          <Table id="remoteForm" constraints='BorderLayout.SOUTH' fill="both">
    
    33
    +      <JPanel id="remotePanel" layout="{new BorderLayout()}">
    
    34
    +        <JScrollPane id='remoteConfigurationsPane' constraints='BorderLayout.CENTER'>
    
    35
    +          <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/>
    
    36
    +        </JScrollPane>
    
    37
    +        <JPanel id="remoteContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'>
    
    38
    +          <JLabel id="noRemoteSelected" constraints='"empty"'/>
    
    39
    +          <Table id="remoteForm" constraints='"form"' fill="both">
    
    37 40
                 <row>
    
    38 41
                   <cell anchor='west'>
    
    39 42
                     <JLabel text='observe.storage.remote.name'/>
    
    40 43
                   </cell>
    
    41 44
                   <cell weightx='1' fill="both" anchor='east'>
    
    42
    -                <JTextField id="remoteName" onKeyReleased="model.setRemoteModified(true);"/>
    
    45
    +                <JTextField id="remoteName" onKeyReleased="handler.setRemoteModified(event);"/>
    
    43 46
                   </cell>
    
    44 47
                 </row>
    
    45 48
                 <row>
    
    ... ... @@ -47,7 +50,7 @@
    47 50
                     <JLabel text='observe.storage.remote.url'/>
    
    48 51
                   </cell>
    
    49 52
                   <cell weightx='1' fill="both" anchor='east'>
    
    50
    -                <JTextField id="remoteUrl" onKeyReleased="model.setRemoteModified(true);"/>
    
    53
    +                <JTextField id="remoteUrl" onKeyReleased="handler.setRemoteModified(event);"/>
    
    51 54
                   </cell>
    
    52 55
                 </row>
    
    53 56
                 <row>
    
    ... ... @@ -55,7 +58,7 @@
    55 58
                     <JLabel text='observe.storage.remote.login'/>
    
    56 59
                   </cell>
    
    57 60
                   <cell weightx='1' fill="both" anchor='east'>
    
    58
    -                <JTextField id="remoteLogin" onKeyReleased="model.setRemoteModified(true);"/>
    
    61
    +                <JTextField id="remoteLogin" onKeyReleased="handler.setRemoteModified(event);"/>
    
    59 62
                   </cell>
    
    60 63
                 </row>
    
    61 64
                 <row>
    
    ... ... @@ -63,7 +66,7 @@
    63 66
                     <JLabel text='observe.storage.remote.password'/>
    
    64 67
                   </cell>
    
    65 68
                   <cell weightx='1' fill="both" anchor='east'>
    
    66
    -                <JTextField id="remotePassword" onKeyReleased="model.setRemoteModified(true);"/>
    
    69
    +                <JTextField id="remotePassword" onKeyReleased="handler.setRemoteModified(event);"/>
    
    67 70
                   </cell>
    
    68 71
                 </row>
    
    69 72
                 <row>
    
    ... ... @@ -80,26 +83,29 @@
    80 83
                       <JButton id="saveRemoteAction"/>
    
    81 84
                       <JButton id="deleteRemoteAction"/>
    
    82 85
                       <JButton id="testRemoteAction"/>
    
    86
    +                  <JButton id="duplicateRemoteAction"/>
    
    83 87
                     </JPanel>
    
    84 88
                   </cell>
    
    85 89
                 </row>
    
    86 90
               </Table>
    
    87 91
             </JPanel>
    
    88
    -      </JSplitPane>
    
    92
    +      </JPanel>
    
    89 93
         </tab>
    
    90 94
         <tab id='serverTab' title="observe.storage.server.presets.title">
    
    91 95
     
    
    92
    -      <JSplitPane id="serverPanel">
    
    93
    -        <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/>
    
    94
    -        <JPanel id="serverContentPanel" layout="{new BorderLayout()}">
    
    95
    -          <JLabel id="noServerSelected" constraints='BorderLayout.CENTER'/>
    
    96
    -          <Table id="serverForm" constraints='BorderLayout.SOUTH' fill="both">
    
    96
    +      <JPanel id="serverPanel" layout="{new BorderLayout()}" >
    
    97
    +        <JScrollPane id='serverConfigurationsPane' constraints='BorderLayout.CENTER'>
    
    98
    +          <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/>
    
    99
    +        </JScrollPane>
    
    100
    +        <JPanel id="serverContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'>
    
    101
    +          <JLabel id="noServerSelected" constraints='"empty"'/>
    
    102
    +          <Table id="serverForm" constraints='"form"' fill="both">
    
    97 103
                 <row>
    
    98 104
                   <cell anchor='west'>
    
    99 105
                     <JLabel text='observe.storage.remote.name'/>
    
    100 106
                   </cell>
    
    101 107
                   <cell weightx='1' fill="both" anchor='east'>
    
    102
    -                <JTextField id="serverName" onKeyReleased="model.setServerModified(true);"/>
    
    108
    +                <JTextField id="serverName" onKeyReleased="handler.setServerModified(event);"/>
    
    103 109
                   </cell>
    
    104 110
                 </row>
    
    105 111
                 <row>
    
    ... ... @@ -107,7 +113,7 @@
    107 113
                     <JLabel text='observe.storage.remote.url'/>
    
    108 114
                   </cell>
    
    109 115
                   <cell weightx='1' fill="both" anchor='east'>
    
    110
    -                <JTextField id="serverUrl" onKeyReleased="model.setServerModified(true);"/>
    
    116
    +                <JTextField id="serverUrl" onKeyReleased="handler.setServerModified(event);"/>
    
    111 117
                   </cell>
    
    112 118
                 </row>
    
    113 119
                 <row>
    
    ... ... @@ -115,7 +121,7 @@
    115 121
                     <JLabel text='observe.storage.remote.login'/>
    
    116 122
                   </cell>
    
    117 123
                   <cell weightx='1' fill="both" anchor='east'>
    
    118
    -                <JTextField id="serverLogin" onKeyReleased="model.setServerModified(true);"/>
    
    124
    +                <JTextField id="serverLogin" onKeyReleased="handler.setServerModified(event);"/>
    
    119 125
                   </cell>
    
    120 126
                 </row>
    
    121 127
                 <row>
    
    ... ... @@ -123,7 +129,7 @@
    123 129
                     <JLabel text='observe.storage.remote.password'/>
    
    124 130
                   </cell>
    
    125 131
                   <cell weightx='1' fill="both" anchor='east'>
    
    126
    -                <JTextField id="serverPassword" onKeyReleased="model.setServerModified(true);"/>
    
    132
    +                <JTextField id="serverPassword" onKeyReleased="handler.setServerModified(event);"/>
    
    127 133
                   </cell>
    
    128 134
                 </row>
    
    129 135
                 <row>
    
    ... ... @@ -131,7 +137,7 @@
    131 137
                     <JLabel id="serverDataBaseLabel" text='observe.storage.server.dataBase'/>
    
    132 138
                   </cell>
    
    133 139
                   <cell weightx='1' fill="both" anchor='east'>
    
    134
    -                <JTextField id="serverDataBase" onKeyReleased="model.setServerModified(true);"/>
    
    140
    +                <JTextField id="serverDataBase" onKeyReleased="handler.setServerModified(event);"/>
    
    135 141
                   </cell>
    
    136 142
                 </row>
    
    137 143
     
    
    ... ... @@ -143,12 +149,13 @@
    143 149
                       <JButton id="saveServerAction"/>
    
    144 150
                       <JButton id="deleteServerAction"/>
    
    145 151
                       <JButton id="testServerAction"/>
    
    152
    +                  <JButton id="duplicateServerAction"/>
    
    146 153
                     </JPanel>
    
    147 154
                   </cell>
    
    148 155
                 </row>
    
    149 156
               </Table>
    
    150 157
             </JPanel>
    
    151
    -      </JSplitPane>
    
    158
    +      </JPanel>
    
    152 159
         </tab>
    
    153 160
       </JTabbedPane>
    
    154 161
     
    

  • client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/RemotePresetsUI.jcss
    ... ... @@ -25,15 +25,10 @@
    25 25
     }
    
    26 26
     
    
    27 27
     #noRemoteSelected {
    
    28
    -  visible: true;
    
    29 28
       text:"observe.storage.presets.no.selected";
    
    30 29
       horizontalAlignment: center;
    
    31 30
     }
    
    32 31
     
    
    33
    -#remoteForm {
    
    34
    -  visible: false;
    
    35
    -}
    
    36
    -
    
    37 32
     #remoteName {
    
    38 33
       text:{SwingUtil.getStringValue(model.getRemoteDataSourceConfiguration().getName())};
    
    39 34
     }
    
    ... ... @@ -56,15 +51,10 @@
    56 51
     }
    
    57 52
     
    
    58 53
     #noServerSelected {
    
    59
    -  visible: true;
    
    60 54
       text:"observe.storage.presets.no.selected";
    
    61 55
       horizontalAlignment: center;
    
    62 56
     }
    
    63 57
     
    
    64
    -#serverForm {
    
    65
    -  visible: false;
    
    66
    -}
    
    67
    -
    
    68 58
     #serverName {
    
    69 59
       text:{SwingUtil.getStringValue(model.getServerDataSourceConfiguration().getName())};
    
    70 60
     }
    
    ... ... @@ -85,6 +75,10 @@
    85 75
       text:{SwingUtil.getStringValue(model.getServerDataSourceConfiguration().getDatabaseName())};
    
    86 76
     }
    
    87 77
     
    
    78
    +#resetRemoteAction {
    
    79
    +  enabled:{model.isRemoteModified()};
    
    80
    +}
    
    81
    +
    
    88 82
     #saveRemoteAction {
    
    89 83
       enabled:{model.isRemoteModified()};
    
    90 84
     }
    

  • 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;
    42 42
     import javax.swing.KeyStroke;
    
    43 43
     import javax.swing.SwingUtilities;
    
    44 44
     import java.awt.BorderLayout;
    
    45
    +import java.awt.CardLayout;
    
    45 46
     import java.awt.event.KeyEvent;
    
    46 47
     import java.util.List;
    
    47 48
     
    
    ... ... @@ -55,11 +56,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    55 56
     
    
    56 57
         private static final Logger log = LogManager.getLogger(RemotePresetsUIHandler.class);
    
    57 58
     
    
    58
    -//    private RemotePresetsUI ui;
    
    59
    +    private RemotePresetsUI ui;
    
    59 60
     
    
    60 61
         @Override
    
    61 62
         public void beforeInit(RemotePresetsUI ui) {
    
    62
    -//        this.ui = ui;
    
    63
    +        this.ui = ui;
    
    63 64
             RemotePresetsUIModel model = new RemotePresetsUIModel();
    
    64 65
             ClientConfig config = getClientConfig();
    
    65 66
             model.setServerDataSourceConfigurations(config.getServerDataSourceConfigurationList());
    
    ... ... @@ -98,6 +99,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    98 99
                     ui.getModel().setRemoteModified(false);
    
    99 100
                 } else {
    
    100 101
                     ui.getModel().setRemoteDataSourceConfiguration(ui.getRemoteConfigurations().getSelectedValue());
    
    102
    +                ui.getRemoteName().requestFocusInWindow();
    
    101 103
                 }
    
    102 104
             });
    
    103 105
     
    
    ... ... @@ -118,15 +120,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    118 120
                 RemoteDataSourceConfiguration oldValue = (RemoteDataSourceConfiguration) evt.getOldValue();
    
    119 121
     
    
    120 122
                 if (ui.getModel().getRemoteDataSourceConfiguration() == null) {
    
    121
    -                ui.getRemoteContentPanel().remove(ui.getRemoteForm());
    
    122
    -                ui.getRemoteContentPanel().add(ui.getNoRemoteSelected(), BorderLayout.CENTER);
    
    123
    +                ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "empty");
    
    123 124
                     ui.getCreateAction().requestFocusInWindow();
    
    124 125
                 } else {
    
    125 126
                     if (oldValue == null) {
    
    126
    -                    ui.getRemoteForm().setVisible(true);
    
    127
    -                    ui.getRemoteContentPanel().remove(ui.getNoRemoteSelected());
    
    128
    -                    ui.getRemoteContentPanel().add(ui.getRemoteForm(), BorderLayout.CENTER);
    
    129
    -                    ui.getRemoteName().requestFocusInWindow();
    
    127
    +                    ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "form");
    
    130 128
                     }
    
    131 129
                     ui.getModel().setRemoteModified(false);
    
    132 130
                 }
    
    ... ... @@ -137,10 +135,12 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    137 135
                 if ((Boolean) evt.getNewValue()) {
    
    138 136
                     remoteActions.remove(ui.getResetRemoteAction());
    
    139 137
                     remoteActions.remove(ui.getDeleteRemoteAction());
    
    138
    +                remoteActions.remove(ui.getDuplicateRemoteAction());
    
    140 139
                     remoteActions.add(ui.getCancelRemoteAction(), 0);
    
    141 140
                 } else {
    
    142 141
                     remoteActions.add(ui.getResetRemoteAction(), 0);
    
    143 142
                     remoteActions.add(ui.getDeleteRemoteAction(), 2);
    
    143
    +                remoteActions.add(ui.getDeleteRemoteAction());
    
    144 144
                     remoteActions.remove(ui.getCancelRemoteAction());
    
    145 145
                 }
    
    146 146
             });
    
    ... ... @@ -160,6 +160,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    160 160
                     ui.getModel().setServerModified(false);
    
    161 161
                 } else {
    
    162 162
                     ui.getModel().setServerDataSourceConfiguration(ui.getServerConfigurations().getSelectedValue());
    
    163
    +                ui.getServerName().requestFocusInWindow();
    
    163 164
                 }
    
    164 165
             });
    
    165 166
     
    
    ... ... @@ -180,15 +181,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    180 181
                 ServerDataSourceConfiguration oldValue = (ServerDataSourceConfiguration) evt.getOldValue();
    
    181 182
     
    
    182 183
                 if (ui.getModel().getServerDataSourceConfiguration() == null) {
    
    183
    -                ui.getServerContentPanel().remove(ui.getServerForm());
    
    184
    -                ui.getServerContentPanel().add(ui.getNoServerSelected(), BorderLayout.CENTER);
    
    184
    +                ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "empty");
    
    185 185
                     ui.getCreateAction().requestFocusInWindow();
    
    186 186
                 } else {
    
    187 187
                     if (oldValue == null) {
    
    188
    -                    ui.getServerForm().setVisible(true);
    
    189
    -                    ui.getServerContentPanel().remove(ui.getNoServerSelected());
    
    190
    -                    ui.getServerContentPanel().add(ui.getServerForm(), BorderLayout.CENTER);
    
    191
    -                    ui.getServerName().requestFocusInWindow();
    
    188
    +                    ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "form");
    
    192 189
                     }
    
    193 190
                     ui.getModel().setServerModified(false);
    
    194 191
                 }
    
    ... ... @@ -200,11 +197,13 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    200 197
                 if ((Boolean) evt.getNewValue()) {
    
    201 198
                     serverActions.remove(ui.getResetServerAction());
    
    202 199
                     serverActions.remove(ui.getDeleteServerAction());
    
    200
    +                serverActions.remove(ui.getDuplicateServerAction());
    
    203 201
                     serverActions.add(ui.getCancelServerAction(), 0);
    
    204 202
                 } else {
    
    205 203
     
    
    206 204
                     serverActions.add(ui.getResetServerAction(), 0);
    
    207 205
                     serverActions.add(ui.getDeleteServerAction(), 2);
    
    206
    +                serverActions.add(ui.getDuplicateServerAction());
    
    208 207
                     serverActions.remove(ui.getCancelServerAction());
    
    209 208
                 }
    
    210 209
             });
    
    ... ... @@ -218,23 +217,18 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI>, WithC
    218 217
             editor.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
    
    219 218
                     .put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none");
    
    220 219
         }
    
    221
    -//
    
    222
    -//    protected void init(InputMap inputMap, ActionMap actionMap, AbstractButton editor) {
    
    223
    -//        String actionId = (String) editor.getClientProperty(OBSERVE_ACTION);
    
    224
    -//        if (actionId == null) {
    
    225
    -//
    
    226
    -//            return;
    
    227
    -//        }
    
    228
    -//
    
    229
    -//        UIActionSupport action = (UIActionSupport) actionMap.get(actionId);
    
    230
    -//        Objects.requireNonNull(action, "action [" + actionId + "] not found for ui " + ui.getClass().getName());
    
    231
    -//
    
    232
    -//        if (log.isDebugEnabled()) {
    
    233
    -//            log.debug("init common action " + actionId);
    
    234
    -//        }
    
    235
    -//
    
    236
    -//        action.initForMainUi(editor, inputMap, actionMap);
    
    237
    -//        editor.putClientProperty(UIActionSupport.CLIENT_PROPERTY_UI, ui);
    
    238
    -//
    
    239
    -//    }
    
    220
    +
    
    221
    +    protected void setServerModified(KeyEvent event) {
    
    222
    +        if (event.isActionKey()) {
    
    223
    +            return;
    
    224
    +        }
    
    225
    +        ui.getModel().setServerModified(true);
    
    226
    +    }
    
    227
    +
    
    228
    +    protected void setRemoteModified(KeyEvent event) {
    
    229
    +        if (event.isActionKey()) {
    
    230
    +            return;
    
    231
    +        }
    
    232
    +        ui.getModel().setRemoteModified(true);
    
    233
    +    }
    
    240 234
     }

  • 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 {
    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
     }

  • 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;
    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
         }
    

  • client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DuplicateRemote.java
    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
    +}

  • client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/presets/actions/DuplicateServer.java
    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
    +}

  • observe-i18n/src/main/i18n/translations/observe_en_GB.properties
    ... ... @@ -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
    

  • observe-i18n/src/main/i18n/translations/observe_es_ES.properties
    ... ... @@ -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
    

  • observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
    ... ... @@ -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.
    

  • pom.xml
    ... ... @@ -24,7 +24,7 @@
    24 24
       <parent>
    
    25 25
         <groupId>io.ultreia.maven</groupId>
    
    26 26
         <artifactId>pom</artifactId>
    
    27
    -    <version>2020.19</version>
    
    27
    +    <version>2020.23</version>
    
    28 28
       </parent>
    
    29 29
     
    
    30 30
       <groupId>fr.ird.observe</groupId>