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

Commits:

28 changed files:

Changes:

  • client-datasource-actions/src/main/i18n/getters/java.getter
    ... ... @@ -3,6 +3,8 @@ observe.Id.validation.field.tip
    3 3
     observe.Id.validation.message.tip
    
    4 4
     observe.Id.validation.scope.tip
    
    5 5
     observe.common.none
    
    6
    +observe.constant.AdminStep.SELECT_DATA
    
    7
    +observe.constant.AdminStep.SELECT_DATA.description
    
    6 8
     observe.ui.action.admin.cancel
    
    7 9
     observe.ui.action.admin.close
    
    8 10
     observe.ui.action.apply
    

  • client-datasource-actions/src/main/i18n/getters/jaxx.getter
    ... ... @@ -23,6 +23,7 @@ observe.ui.datasource.editor.actions.report.select
    23 23
     observe.ui.datasource.editor.actions.report.select.file
    
    24 24
     observe.ui.datasource.editor.actions.report.select.file.tip
    
    25 25
     observe.ui.datasource.editor.actions.report.variables
    
    26
    +observe.ui.datasource.editor.actions.select.loading
    
    26 27
     observe.ui.datasource.editor.actions.synchro.data.actionsToPerform
    
    27 28
     observe.ui.datasource.editor.actions.synchro.referential.config.mode
    
    28 29
     observe.ui.datasource.editor.actions.synchro.referential.obsolete.entities.list
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminStep.java
    ... ... @@ -23,6 +23,7 @@ package fr.ird.observe.client.datasource.actions;
    23 23
     
    
    24 24
     import fr.ird.observe.client.constants.DbMode;
    
    25 25
     import fr.ird.observe.client.datasource.actions.config.ConfigUI;
    
    26
    +import fr.ird.observe.client.datasource.actions.config.SelectDataModel;
    
    26 27
     import fr.ird.observe.client.datasource.actions.config.SelectDataUI;
    
    27 28
     import fr.ird.observe.client.datasource.actions.consolidate.ConsolidateModel;
    
    28 29
     import fr.ird.observe.client.datasource.actions.consolidate.ConsolidateUI;
    
    ... ... @@ -77,9 +78,21 @@ public enum AdminStep implements WizardExtStep {
    77 78
     
    
    78 79
         /** pour selectionner les donnes */
    
    79 80
         SELECT_DATA(
    
    80
    -            null,
    
    81
    +//            null,
    
    82
    +//            SelectDataUI.class,
    
    83
    +//            true
    
    84
    +            n("observe.constant.AdminStep.SELECT_DATA"),
    
    85
    +            n("observe.constant.AdminStep.SELECT_DATA.description"),
    
    86
    +            "synchronizeReferentiel",
    
    87
    +            n("observe.constant.AdminStep.SELECT_DATA"),
    
    88
    +            n("observe.constant.AdminStep.SELECT_DATA.description"),
    
    89
    +            SelectDataModel.class,
    
    81 90
                 SelectDataUI.class,
    
    82
    -            true
    
    91
    +            false,
    
    92
    +            false,
    
    93
    +            false,
    
    94
    +            false,
    
    95
    +            'S'
    
    83 96
         ),
    
    84 97
     
    
    85 98
         /** pour résoudre les entités obosolètes */
    
    ... ... @@ -435,6 +448,16 @@ public enum AdminStep implements WizardExtStep {
    435 448
             return oldStep != null && oldStep.ordinal() < ordinal();
    
    436 449
         }
    
    437 450
     
    
    451
    +    /**
    
    452
    +     * Is this step is the new step and come from a greater step (in ordinal order) ?
    
    453
    +     *
    
    454
    +     * @param oldStep the step before
    
    455
    +     * @return {@code true} if new step is this step and old step has a greater ordinal, {@code false} otherwise
    
    456
    +     */
    
    457
    +    public boolean rewindToThisStep(AdminStep oldStep) {
    
    458
    +        return oldStep != null && oldStep.ordinal() > ordinal();
    
    459
    +    }
    
    460
    +
    
    438 461
         public boolean isNeedReferentiel() {
    
    439 462
             return needReferentiel;
    
    440 463
         }
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminTabUI.jaxx
    ... ... @@ -81,8 +81,12 @@ public void propertyChange(PropertyChangeEvent evt) {
    81 81
         //propertyChange.super(evt);
    
    82 82
     }
    
    83 83
     
    
    84
    -public void onComing(boolean pending) {
    
    85
    -  getHandler().onComing(pending);
    
    84
    +public void onComingFromPreviousStep(boolean pending) {
    
    85
    +  getHandler().onComingFromPreviousStep(pending);
    
    86
    +}
    
    87
    +
    
    88
    +public void onComingFromNextStep(AdminStep oldStep) {
    
    89
    +  getHandler().onComingFromNextStep(oldStep);
    
    86 90
     }
    
    87 91
     
    
    88 92
     ]]>
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminTabUIHandler.java
    ... ... @@ -49,7 +49,11 @@ public class AdminTabUIHandler<U extends AdminTabUI> implements WithClientConfig
    49 49
         protected AdminUI parentUI;
    
    50 50
         protected DecoratorService decoratorService;
    
    51 51
     
    
    52
    -    protected void onComing(boolean pending) {
    
    52
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    53
    +        // by default nothing to do
    
    54
    +    }
    
    55
    +
    
    56
    +    protected void onComingFromNextStep(AdminStep oldStep) {
    
    53 57
             // by default nothing to do
    
    54 58
         }
    
    55 59
     
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminUIHandler.java
    ... ... @@ -188,7 +188,9 @@ public class AdminUIHandler implements UIHandler<AdminUI>, WithClientUIContext {
    188 188
     
    
    189 189
             AdminUIModel model = ui.getModel();
    
    190 190
             if (newStep.forwardToThisStep(oldStep)) {
    
    191
    -            c.onComing(model.getStepState(newStep) == WizardState.PENDING);
    
    191
    +            c.onComingFromPreviousStep(model.getStepState(newStep) == WizardState.PENDING);
    
    192
    +        } else if (newStep.rewindToThisStep(oldStep)) {
    
    193
    +            c.onComingFromNextStep(oldStep);
    
    192 194
             }
    
    193 195
     
    
    194 196
             // selection du nouvel onglet
    
    ... ... @@ -223,7 +225,7 @@ public class AdminUIHandler implements UIHandler<AdminUI>, WithClientUIContext {
    223 225
                 return;
    
    224 226
             }
    
    225 227
     
    
    226
    -        if (selected != null && selected.getStep().isConfig()) {
    
    228
    +        if (selected != null && (selected.getStep().isConfig() || selected.getStep() == AdminStep.SELECT_DATA)) {
    
    227 229
     
    
    228 230
                 log.debug("Selected step is config : " + selected.getStep());
    
    229 231
                 while (itr.hasNext()) {
    
    ... ... @@ -231,7 +233,7 @@ public class AdminUIHandler implements UIHandler<AdminUI>, WithClientUIContext {
    231 233
                     Component tab = itr.next();
    
    232 234
                     AdminTabUI tabUI = (AdminTabUI) tab;
    
    233 235
                     AdminStep synchroStep = tabUI.getStep();
    
    234
    -                if (synchroStep.isConfig()) {
    
    236
    +                if (synchroStep.isConfig() || (synchroStep == AdminStep.SELECT_DATA && ui.getModel().getStepState(synchroStep) == WizardState.SUCCESSED)) {
    
    235 237
                         log.debug("Test config panel : " + synchroStep);
    
    236 238
                         boolean valid = ui.getModel().validate(synchroStep);
    
    237 239
                         if (valid) {
    
    ... ... @@ -274,8 +276,6 @@ public class AdminUIHandler implements UIHandler<AdminUI>, WithClientUIContext {
    274 276
                 // on demarre le modele
    
    275 277
                 ui.getModel().start(ui);
    
    276 278
     
    
    277
    -            ui.onWasInit();
    
    278
    -
    
    279 279
                 // affichage ui
    
    280 280
                 ui.setVisible(true);
    
    281 281
     
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminUIModel.java
    ... ... @@ -38,8 +38,6 @@ import org.apache.logging.log4j.Logger;
    38 38
     import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardExtModel;
    
    39 39
     import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
    
    40 40
     
    
    41
    -import java.beans.PropertyChangeEvent;
    
    42
    -import java.beans.PropertyChangeListener;
    
    43 41
     import java.util.ArrayList;
    
    44 42
     import java.util.Arrays;
    
    45 43
     import java.util.EnumSet;
    
    ... ... @@ -65,13 +63,10 @@ public class AdminUIModel extends WizardExtModel<AdminStep> {
    65 63
     
    
    66 64
         private final EnumSet<DbMode> availableIncomingModes;
    
    67 65
     
    
    68
    -    private final PropertyChangeListener listenStepChanged;
    
    69
    -
    
    70 66
         public AdminUIModel(AdminStep adminStep) {
    
    71 67
             super(AdminStep.class);
    
    72 68
             this.adminStep = Objects.requireNonNull(adminStep);
    
    73 69
             this.availableIncomingModes = EnumSet.noneOf(DbMode.class);
    
    74
    -        this.listenStepChanged = this::onStepChanged;
    
    75 70
             log.debug(String.format("model [%s] is instantiated.", this));
    
    76 71
         }
    
    77 72
     
    
    ... ... @@ -79,43 +74,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> {
    79 74
             return adminStep;
    
    80 75
         }
    
    81 76
     
    
    82
    -    private void onStepChanged(PropertyChangeEvent evt) {
    
    83
    -        if (isWasStarted()) {
    
    84
    -
    
    85
    -            // on ne propage plus rien (il n'y a plus de configuration possible...)
    
    86
    -            log.debug("Stop propagation, was started... " + evt.getPropertyName());
    
    87
    -            return;
    
    88
    -        }
    
    89
    -
    
    90
    -        AdminStep oldStep = (AdminStep) evt.getOldValue();
    
    91
    -        AdminStep newStep = (AdminStep) evt.getNewValue();
    
    92
    -
    
    93
    -        if (oldStep != null && oldStep != AdminStep.CONFIG) {
    
    94
    -
    
    95
    -            // on fait rien si on ne vient pas de la configuration
    
    96
    -            return;
    
    97
    -        }
    
    98
    -
    
    99
    -        // on était sur l'écran de configuration
    
    100
    -
    
    101
    -        // mise à jour des modèles de sélection si on arrive sur une étape
    
    102
    -        // qui le requière
    
    103
    -
    
    104
    -        boolean needSelect = needSelect();
    
    105
    -
    
    106
    -        if (!needSelect) {
    
    107
    -
    
    108
    -            // pas besoin d'agir sur le model de sélection de données
    
    109
    -            return;
    
    110
    -        }
    
    111
    -
    
    112
    -        if (newStep == AdminStep.SELECT_DATA) {
    
    113
    -
    
    114
    -            getSelectDataModel().initSelectionModel(this);
    
    115
    -
    
    116
    -        }
    
    117
    -    }
    
    118
    -
    
    119 77
         @Override
    
    120 78
         public void firePropertyChange(String propertyName, Object newValue) {
    
    121 79
             super.firePropertyChange(propertyName, newValue);
    
    ... ... @@ -282,13 +240,12 @@ public class AdminUIModel extends WizardExtModel<AdminStep> {
    282 240
                 getReferentialSynchroModel().start(ui);
    
    283 241
             }
    
    284 242
     
    
    285
    -        removePropertyChangeListener(STEP_PROPERTY_NAME, listenStepChanged);
    
    286
    -        addPropertyChangeListener(STEP_PROPERTY_NAME, listenStepChanged);
    
    287
    -
    
    288 243
             log.info("End of start...");
    
    289 244
     
    
    290 245
             // on revalide le modèle (tout est prêt)
    
    291 246
             validate();
    
    247
    +
    
    248
    +        ui.onWasInit();
    
    292 249
         }
    
    293 250
     
    
    294 251
         @Override
    
    ... ... @@ -308,6 +265,9 @@ public class AdminUIModel extends WizardExtModel<AdminStep> {
    308 265
     
    
    309 266
         @Override
    
    310 267
         public AdminUIModel addOperation(AdminStep step) {
    
    268
    +        if (step.isNeedSelect()) {
    
    269
    +            getOperations().add(AdminStep.SELECT_DATA);
    
    270
    +        }
    
    311 271
             if (AdminStep.EXPORT_DATA == step) {
    
    312 272
     
    
    313 273
                 // pour exporter les données utilisateurs
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/config/ConfigModel.java
    ... ... @@ -31,7 +31,6 @@ import fr.ird.observe.client.datasource.actions.report.ReportModel;
    31 31
     import fr.ird.observe.client.datasource.actions.synchronize.referential.ng.ReferentialSynchronizeMode;
    
    32 32
     import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
    
    33 33
     import fr.ird.observe.client.datasource.editor.tree.selection.SelectionTreeModel;
    
    34
    -import fr.ird.observe.client.datasource.editor.wizard.StorageUIModel;
    
    35 34
     import fr.ird.observe.client.datasource.editor.wizard.connexion.DataSourceSelectorModel;
    
    36 35
     import fr.ird.observe.client.util.ObserveKeyStrokesSupport;
    
    37 36
     import fr.ird.observe.client.util.UIHelper;
    
    ... ... @@ -83,6 +82,17 @@ public class ConfigModel extends AdminActionModel {
    83 82
                     ConfigModel.this.firePropertyChange(AdminUIModel.VALID_STEP_PROPERTY_NAME, isValidStep());
    
    84 83
                     ConfigModel.this.firePropertyChange("valid", isValid());
    
    85 84
                 }
    
    85
    +
    
    86
    +            @Override
    
    87
    +            public void start(DbMode dbMode) {
    
    88
    +                super.start(dbMode);
    
    89
    +                if (isValid()) {
    
    90
    +                    // load at once
    
    91
    +                    setDataSourceInformation(null);
    
    92
    +                    getSourceInformation();
    
    93
    +                    getSafeSource(true);
    
    94
    +                }
    
    95
    +            }
    
    86 96
             };
    
    87 97
     
    
    88 98
             centralSourceModel = new DataSourceSelectorModel(ObserveKeyStrokesSupport.KEY_STROKE_CONFIGURE_REMOTE_SOURCE) {
    
    ... ... @@ -106,8 +116,8 @@ public class ConfigModel extends AdminActionModel {
    106 116
     
    
    107 117
             boolean validate = true;
    
    108 118
     
    
    109
    -        StorageUIModel centralSourceModel = getCentralSourceModel();
    
    110
    -        StorageUIModel localSourceModel = getLocalSourceModel();
    
    119
    +        DataSourceSelectorModel centralSourceModel = getCentralSourceModel();
    
    120
    +        DataSourceSelectorModel localSourceModel = getLocalSourceModel();
    
    111 121
     
    
    112 122
             if (uiModel.isNeedIncomingDataSource()) {
    
    113 123
                 if (!localSourceModel.isValid()) {
    
    ... ... @@ -215,9 +225,9 @@ public class ConfigModel extends AdminActionModel {
    215 225
                     atLeastOneWrite = true;
    
    216 226
                 }
    
    217 227
     
    
    218
    -            if (centralSourceModel.getDataSourceInformation() != null) {
    
    228
    +            if (centralSourceModel.getSourceInformation() != null) {
    
    219 229
     
    
    220
    -                ObserveDataSourceInformation rightDataSourceInformation = centralSourceModel.getDataSourceInformation();
    
    230
    +                ObserveDataSourceInformation rightDataSourceInformation = centralSourceModel.getSourceInformation();
    
    221 231
                     if (!(rightDataSourceInformation.canReadData())) {
    
    222 232
                         log.debug("can not read data on right data source");
    
    223 233
                         return false;
    
    ... ... @@ -253,7 +263,7 @@ public class ConfigModel extends AdminActionModel {
    253 263
                     return false;
    
    254 264
                 }
    
    255 265
     
    
    256
    -            ObserveDataSourceInformation rightDataSourceInformation = centralSourceModel.getDataSourceInformation();
    
    266
    +            ObserveDataSourceInformation rightDataSourceInformation = centralSourceModel.getSourceInformation();
    
    257 267
                 if (rightDataSourceInformation == null) {
    
    258 268
                     return false;
    
    259 269
                 }
    
    ... ... @@ -297,7 +307,7 @@ public class ConfigModel extends AdminActionModel {
    297 307
                     return false;
    
    298 308
                 }
    
    299 309
     
    
    300
    -            ObserveDataSourceInformation rightDataSourceInformation = centralSourceModel.getDataSourceInformation();
    
    310
    +            ObserveDataSourceInformation rightDataSourceInformation = centralSourceModel.getSourceInformation();
    
    301 311
                 if (rightDataSourceInformation == null) {
    
    302 312
                     return false;
    
    303 313
                 }
    
    ... ... @@ -319,8 +329,8 @@ public class ConfigModel extends AdminActionModel {
    319 329
     
    
    320 330
                 // il faut une base locale et une connexion distante
    
    321 331
                 // avec des droits d'écriture de données
    
    322
    -            validate &= centralSourceModel.getDataSourceInformation() != null
    
    323
    -                    && centralSourceModel.getDataSourceInformation().canWriteData();
    
    332
    +            validate &= centralSourceModel.getSourceInformation() != null
    
    333
    +                    && centralSourceModel.getSourceInformation().canWriteData();
    
    324 334
     
    
    325 335
             }
    
    326 336
     
    
    ... ... @@ -333,8 +343,8 @@ public class ConfigModel extends AdminActionModel {
    333 343
                 validate &= reportFile != null && reportFile.exists() && reports != null && !reports.isEmpty();
    
    334 344
             }
    
    335 345
             if (uiModel.containsOperation(AdminStep.ACTIVITY_LONGLINE_PAIRING)) {
    
    336
    -            validate &= localSourceModel.getDataSourceInformation() != null
    
    337
    -                    && localSourceModel.getDataSourceInformation().canWriteData();
    
    346
    +            validate &= localSourceModel.getSourceInformation() != null
    
    347
    +                    && localSourceModel.getSourceInformation().canWriteData();
    
    338 348
             }
    
    339 349
     
    
    340 350
             return validate;
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/config/ConfigUIHandler.java
    ... ... @@ -61,6 +61,9 @@ public class ConfigUIHandler extends AdminTabUIHandler<ConfigUI> implements UIHa
    61 61
                 JPanel operations = ui.getOperations();
    
    62 62
                 operations.removeAll();
    
    63 63
                 for (AdminStep operation : model.getOperations()) {
    
    64
    +                if (AdminStep.SELECT_DATA == operation) {
    
    65
    +                    continue;
    
    66
    +                }
    
    64 67
                     log.info("Add operation: " + operation);
    
    65 68
                     JLabel label = new JLabel(operation.getLabel());
    
    66 69
                     label.setFont(label.getFont().deriveFont(Font.ITALIC).deriveFont(13f));
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/config/SelectDataModel.java
    ... ... @@ -66,7 +66,6 @@ public class SelectDataModel extends AdminActionModel {
    66 66
             this.selectionDataModel = selectionDataModel;
    
    67 67
         }
    
    68 68
     
    
    69
    -
    
    70 69
         public void initSelectionModel(AdminUIModel uiModel) {
    
    71 70
     
    
    72 71
             SelectionTreeModel selectionDataModel = getSelectionDataModel();
    
    ... ... @@ -128,14 +127,14 @@ public class SelectDataModel extends AdminActionModel {
    128 127
     
    
    129 128
         }
    
    130 129
     
    
    131
    -    public DataDtoReference getSelectedTrip() {
    
    130
    +    public DataDtoReference<?,?> getSelectedTrip() {
    
    132 131
             Set<DataDtoReference<?, ?>> data = getSelectionDataModel().getSelectedData();
    
    133 132
             if (data.isEmpty()) {
    
    134 133
     
    
    135 134
                 // pas de Trip selectionne
    
    136 135
                 return null;
    
    137 136
             }
    
    138
    -        DataDtoReference dto = data.iterator().next();
    
    137
    +        DataDtoReference<?,?> dto = data.iterator().next();
    
    139 138
             if (dto instanceof fr.ird.observe.dto.data.ps.common.TripReference) {
    
    140 139
                 return dto;
    
    141 140
             }
    
    ... ... @@ -158,8 +157,6 @@ public class SelectDataModel extends AdminActionModel {
    158 157
         public void start(AdminUIModel uiModel) {
    
    159 158
     
    
    160 159
             if (!uiModel.needSelect()) {
    
    161
    -
    
    162
    -            // pas d'opération avec une sélection de données, rien a faire ici
    
    163 160
                 return;
    
    164 161
             }
    
    165 162
     
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/config/SelectDataUI.jaxx
    ... ... @@ -34,6 +34,16 @@ public static SelectDataUI get(AdminUI ui) {
    34 34
     
    
    35 35
       <SelectDataModel id='stepModel' initializer='getModel().getSelectDataModel()'/>
    
    36 36
       <JPanel id='PENDING_content' layout="{new BorderLayout()}">
    
    37
    -    <SelectionTreePane id='selectTreePane' decorator='boxed' constraints='BorderLayout.CENTER'/>
    
    37
    +    <Table constraints='BorderLayout.CENTER' fill='both' weightx='1' weighty='1'>
    
    38
    +      <row>
    
    39
    +        <cell>
    
    40
    +          <JButton id='selectData'/>
    
    41
    +        </cell>
    
    42
    +      </row>
    
    43
    +    </Table>
    
    38 44
       </JPanel>
    
    45
    +  <JPanel id='invisiblePanel' >
    
    46
    +    <SelectionTreePane id='selectTreePane'/>
    
    47
    +  </JPanel>
    
    48
    +
    
    39 49
     </fr.ird.observe.client.datasource.actions.AdminTabUI>

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/config/SelectDataUIHandler.java
    ... ... @@ -22,11 +22,17 @@ package fr.ird.observe.client.datasource.actions.config;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import fr.ird.observe.client.datasource.actions.AdminStep;
    
    25 26
     import fr.ird.observe.client.datasource.actions.AdminTabUIHandler;
    
    26
    -import fr.ird.observe.client.datasource.actions.actions.SelectData;
    
    27 27
     import fr.ird.observe.client.datasource.editor.tree.selection.SelectionTree;
    
    28 28
     import fr.ird.observe.client.util.UIHelper;
    
    29 29
     import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    30
    +import org.nuiton.jaxx.runtime.swing.SwingUtil;
    
    31
    +import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
    
    32
    +
    
    33
    +import javax.swing.SwingUtilities;
    
    34
    +import java.awt.GridBagConstraints;
    
    35
    +import java.awt.Insets;
    
    30 36
     
    
    31 37
     /**
    
    32 38
      * Created on 28/11/16.
    
    ... ... @@ -36,27 +42,42 @@ import org.nuiton.jaxx.runtime.spi.UIHandler;
    36 42
      */
    
    37 43
     public class SelectDataUIHandler extends AdminTabUIHandler<SelectDataUI> implements UIHandler<SelectDataUI> {
    
    38 44
     
    
    45
    +    boolean fix;
    
    46
    +
    
    39 47
         @Override
    
    40
    -    protected void onComing(boolean pending) {
    
    48
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    41 49
             if (pending) {
    
    42
    -            SelectData action = SelectData.init(ui, null, SelectData.class);
    
    43
    -            action.run();
    
    50
    +            SwingUtilities.invokeLater(ui.getSelectData()::doClick);
    
    44 51
             }
    
    45 52
         }
    
    46 53
     
    
    47 54
         @Override
    
    48 55
         public void afterInit(SelectDataUI ui) {
    
    49 56
             super.afterInit(ui);
    
    50
    -
    
    51
    -        UIHelper.setLayerUI(ui.getContent(), null);
    
    52
    -        UIHelper.setLayerUI(ui.getSelectTreePane(), parentUI.getConfigBlockLayerUI());
    
    53
    -
    
    54 57
             SelectionTree tree = ui.getSelectTreePane().getTree();
    
    55 58
             getModel().getSelectDataModel().setSelectionDataModel(tree.getTreeModel());
    
    56
    -
    
    57 59
             tree.installUI(ui.getSelectTreePane());
    
    58
    -        //FIXME Init tree ?
    
    59
    -//        UIHelper.initUI(ui.getSelectTreePane(), tree);
    
    60 60
         }
    
    61 61
     
    
    62
    +    @Override
    
    63
    +    protected void onComingFromNextStep(AdminStep oldStep) {
    
    64
    +        WizardState stepState = getModel().getStepState(oldStep);
    
    65
    +        if (stepState != WizardState.PENDING && !fix) {
    
    66
    +            UIHelper.setLayerUI(ui.getContent(), null);
    
    67
    +            UIHelper.setLayerUI(ui.getSelectTreePane(), parentUI.getConfigBlockLayerUI());
    
    68
    +            fix = true;
    
    69
    +        }
    
    70
    +    }
    
    71
    +
    
    72
    +    @Override
    
    73
    +    protected void onStateChangeToRunning() {
    
    74
    +        super.onStateChangeToRunning();
    
    75
    +    }
    
    76
    +
    
    77
    +    @Override
    
    78
    +    protected void onStateChangeToSuccess() {
    
    79
    +        super.onStateChangeToSuccess();
    
    80
    +        ui.getSUCCESSED_panel().removeAll();
    
    81
    +        ui.getSUCCESSED_panel().add(SwingUtil.boxComponentWithJxLayer(ui.getSelectTreePane()), new GridBagConstraints(0, 0, 1, 1, 1.0, 1, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
    
    82
    +    }
    
    62 83
     }

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/actions/SelectData.javaclient-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/config/actions/SelectData.java
    1
    -package fr.ird.observe.client.datasource.actions.actions;
    
    1
    +package fr.ird.observe.client.datasource.actions.config.actions;
    
    2 2
     
    
    3 3
     /*-
    
    4 4
      * #%L
    
    ... ... @@ -22,19 +22,33 @@ package fr.ird.observe.client.datasource.actions.actions;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import fr.ird.observe.client.datasource.actions.AdminUIModel;
    
    26
    +import fr.ird.observe.client.datasource.actions.actions.AdminTabUIActionSupport;
    
    25 27
     import fr.ird.observe.client.datasource.actions.config.SelectDataUI;
    
    26 28
     import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
    
    27 29
     import fr.ird.observe.client.datasource.editor.tree.selection.SelectionTree;
    
    30
    +import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
    
    28 31
     
    
    32
    +import javax.swing.ActionMap;
    
    33
    +import javax.swing.InputMap;
    
    29 34
     import javax.swing.SwingUtilities;
    
    30 35
     import java.awt.event.ActionEvent;
    
    31 36
     
    
    37
    +import static io.ultreia.java4all.i18n.I18n.t;
    
    38
    +
    
    32 39
     public class SelectData extends AdminTabUIActionSupport<SelectDataUI> implements Runnable {
    
    33 40
     
    
    34 41
         public SelectData() {
    
    35
    -        super(null, null, null, null);
    
    42
    +        super(null, null, "wizard-start", 'D');
    
    36 43
         }
    
    37 44
     
    
    45
    +    @Override
    
    46
    +    protected void defaultInit(InputMap inputMap, ActionMap actionMap) {
    
    47
    +        setText(t("observe.ui.datasource.editor.actions.synchro.launch.operation", t(ui.getStep().getOperationLabel())));
    
    48
    +        setTooltipText(t("observe.ui.datasource.editor.actions.synchro.launch.operation", t(ui.getStep().getOperationLabel())));
    
    49
    +        super.defaultInit(inputMap, actionMap);
    
    50
    +    }
    
    51
    +    
    
    38 52
         @Override
    
    39 53
         protected void doActionPerformed(ActionEvent e, SelectDataUI ui) {
    
    40 54
             run();
    
    ... ... @@ -45,24 +59,28 @@ public class SelectData extends AdminTabUIActionSupport<SelectDataUI> implements
    45 59
             if (getParentUI().getConfigBlockLayerUI().isBlock()) {
    
    46 60
                 return;
    
    47 61
             }
    
    48
    -        getParentUI().getModel().setBusy(true);
    
    49
    -        try {
    
    50
    -            SwingUtilities.invokeLater(this::run0);
    
    51
    -        } finally {
    
    52
    -            getParentUI().getModel().setBusy(false);
    
    53
    -        }
    
    62
    +        addAdminWorker(ui.getSelectData().getToolTipText(), this::run0);
    
    54 63
         }
    
    55 64
     
    
    56
    -    private void run0() {
    
    65
    +    private WizardState run0() {
    
    66
    +        AdminUIModel model = ui.getModel();
    
    67
    +        WizardState stepState = model.getStepState(ui.getStep());
    
    68
    +        if (stepState != WizardState.PENDING) {
    
    69
    +            return stepState;
    
    70
    +        }
    
    57 71
             SelectionTree selectTree = ui.getSelectTreePane().getTree();
    
    58 72
             selectTree.clearSelection();
    
    73
    +
    
    74
    +        ui.getStepModel().initSelectionModel(model);
    
    75
    +
    
    59 76
             SwingUtilities.invokeLater(selectTree::grabFocus);
    
    60 77
             if (selectTree.getTreeModel().isNotEmpty()) {
    
    61 78
                 selectTree.setSelectionRow(0);
    
    62 79
             }
    
    63
    -        ObserveSwingDataSource localSource = ui.getModel().getConfigModel().getLocalSourceModel().getSafeSource(true);
    
    80
    +        ObserveSwingDataSource localSource = model.getConfigModel().getLocalSourceModel().getSafeSource(true);
    
    64 81
             if (localSource.isLocal()) {
    
    65 82
                 SwingUtilities.invokeLater(selectTree::expandAll);
    
    66 83
             }
    
    84
    +        return WizardState.SUCCESSED;
    
    67 85
         }
    
    68 86
     }

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateUI.jaxx
    ... ... @@ -34,7 +34,7 @@ public static ConsolidateUI get(AdminUI ui) {
    34 34
     
    
    35 35
       <ConsolidateModel id='stepModel' initializer='getModel().getConsolidateModel()'/>
    
    36 36
     
    
    37
    -  <JPanel id='PENDING_content'>
    
    37
    +  <JPanel id='PENDING_content' layout="{new BorderLayout()}">
    
    38 38
         <Table constraints='BorderLayout.CENTER' fill='both' weightx='1' weighty='1'>
    
    39 39
           <row>
    
    40 40
             <cell>
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateUI.jcss deleted
    1
    -/*
    
    2
    - * #%L
    
    3
    - * ObServe :: Client DataSource Actions
    
    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
    -
    
    24
    -#PENDING_content {
    
    25
    -  layout:{new BorderLayout()};
    
    26
    -}
    
    27
    -
    
    28
    -#NEED_FIX_content {
    
    29
    -  layout:{new BorderLayout()};
    
    30
    -}

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateUIHandler.java
    ... ... @@ -35,7 +35,7 @@ import static io.ultreia.java4all.i18n.I18n.t;
    35 35
     public class ConsolidateUIHandler extends AdminTabUIHandler<ConsolidateUI> implements UIHandler<ConsolidateUI> {
    
    36 36
     
    
    37 37
         @Override
    
    38
    -    protected void onComing(boolean pending) {
    
    38
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    39 39
             if (pending) {
    
    40 40
                 SwingUtilities.invokeLater(ui.getStart()::doClick);
    
    41 41
             }
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/export/ExportUIHandler.java
    ... ... @@ -52,7 +52,7 @@ public class ExportUIHandler extends AdminTabUIHandler<ExportUI> implements UIHa
    52 52
         private static final Logger log = LogManager.getLogger(ExportUIHandler.class);
    
    53 53
     
    
    54 54
         @Override
    
    55
    -    protected void onComing(boolean pending) {
    
    55
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    56 56
             if (pending) {
    
    57 57
                 SwingUtilities.invokeLater(ui.getPrepare()::doClick);
    
    58 58
             }
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/longline/pairing/ActivityLonglinePairingUIHandler.java
    ... ... @@ -35,7 +35,7 @@ import javax.swing.SwingUtilities;
    35 35
     public class ActivityLonglinePairingUIHandler extends AdminTabUIHandler<ActivityLonglinePairingUI> implements UIHandler<ActivityLonglinePairingUI> {
    
    36 36
     
    
    37 37
         @Override
    
    38
    -    protected void onComing(boolean pending) {
    
    38
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    39 39
             if (pending) {
    
    40 40
                 SwingUtilities.invokeLater(ui.getPrepare()::doClick);
    
    41 41
             }
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/save/SaveLocalUIHandler.java
    ... ... @@ -40,7 +40,7 @@ import static io.ultreia.java4all.i18n.I18n.t;
    40 40
     public class SaveLocalUIHandler extends AdminTabUIHandler<SaveLocalUI> implements UIHandler<SaveLocalUI> {
    
    41 41
     
    
    42 42
         @Override
    
    43
    -    protected void onComing(boolean pending) {
    
    43
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    44 44
             updateText();
    
    45 45
             if (pending && !ui.getStepModel().isLocalSourceNeedSave()) {
    
    46 46
                 SwingUtilities.invokeLater(ui.getContinueAction()::doClick);
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/data/DataSynchroUIHandler.java
    ... ... @@ -45,7 +45,7 @@ import java.awt.Color;
    45 45
     public class DataSynchroUIHandler extends AdminTabUIHandler<DataSynchroUI> implements UIHandler<DataSynchroUI> {
    
    46 46
     
    
    47 47
         @Override
    
    48
    -    protected void onComing(boolean pending) {
    
    48
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    49 49
             if (pending) {
    
    50 50
                 SwingUtilities.invokeLater(ui.getStart()::doClick);
    
    51 51
             }
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/legacy/SynchronizeUIHandler.java
    ... ... @@ -56,7 +56,7 @@ public class SynchronizeUIHandler extends AdminTabUIHandler<SynchronizeUI> imple
    56 56
         }
    
    57 57
     
    
    58 58
         @Override
    
    59
    -    protected void onComing(boolean pending) {
    
    59
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    60 60
             if (pending) {
    
    61 61
                 SwingUtilities.invokeLater(ui.getStart()::doClick);
    
    62 62
             }
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/ng/ReferentialSynchroUIHandler.java
    ... ... @@ -53,7 +53,7 @@ public class ReferentialSynchroUIHandler extends AdminTabUIHandler<ReferentialSy
    53 53
         }
    
    54 54
     
    
    55 55
         @Override
    
    56
    -    protected void onComing(boolean pending) {
    
    56
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    57 57
             if (pending) {
    
    58 58
                 SwingUtilities.invokeLater(ui.getStart()::doClick);
    
    59 59
             }
    

  • client-datasource-actions/src/main/java/fr/ird/observe/client/datasource/actions/validate/ValidateUIHandler.java
    ... ... @@ -68,7 +68,7 @@ public class ValidateUIHandler extends AdminTabUIHandler<ValidateUI> implements
    68 68
         private static final Logger log = LogManager.getLogger(ValidateUIHandler.class);
    
    69 69
     
    
    70 70
         @Override
    
    71
    -    protected void onComing(boolean pending) {
    
    71
    +    protected void onComingFromPreviousStep(boolean pending) {
    
    72 72
             if (pending) {
    
    73 73
                 ui.setEnabled(true);
    
    74 74
                 SwingUtilities.invokeLater(ui.getStart()::doClick);
    

  • client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/StorageUIModel.java
    ... ... @@ -181,8 +181,8 @@ public class StorageUIModel extends WizardModel<StorageStep> implements WithClie
    181 181
         protected String serverUrl;
    
    182 182
         /** Les information de connextion a la base **/
    
    183 183
         protected ObserveDataSourceInformation dataSourceInformation;
    
    184
    -    /** Les information de connextion a la base **/
    
    185
    -    protected ObserveDataSourceInformation h2DataSourceInformation;
    
    184
    +//    /** Les information de connextion a la base **/
    
    185
    +//    protected ObserveDataSourceInformation h2DataSourceInformation;
    
    186 186
         /** le fichier d'import des données */
    
    187 187
         protected File dumpFile;
    
    188 188
         /** le mode de creation d'une base */
    
    ... ... @@ -419,7 +419,7 @@ public class StorageUIModel extends WizardModel<StorageStep> implements WithClie
    419 419
     
    
    420 420
                 // on est actuellement connecte sur une base locale
    
    421 421
                 fromStorageConfig((ObserveDataSourceConfigurationTopiaH2) previousConfig);
    
    422
    -            h2DataSourceInformation = previousInfo;
    
    422
    +//            h2DataSourceInformation = previousInfo;
    
    423 423
             } else if (previousConfig instanceof ObserveDataSourceConfigurationTopiaPG) {
    
    424 424
     
    
    425 425
                 if (!isLocalStorageExist) {
    
    ... ... @@ -1946,9 +1946,9 @@ public class StorageUIModel extends WizardModel<StorageStep> implements WithClie
    1946 1946
         }
    
    1947 1947
     
    
    1948 1948
         public ObserveDataSourceInformation getDataSourceInformation() {
    
    1949
    -        if (DbMode.USE_LOCAL.equals(dbMode)) {
    
    1950
    -            return getH2DataSourceInformation();
    
    1951
    -        }
    
    1949
    +//        if (DbMode.USE_LOCAL.equals(dbMode)) {
    
    1950
    +//            return getH2DataSourceInformation();
    
    1951
    +//        }
    
    1952 1952
     
    
    1953 1953
             return dataSourceInformation;
    
    1954 1954
         }
    
    ... ... @@ -1957,18 +1957,18 @@ public class StorageUIModel extends WizardModel<StorageStep> implements WithClie
    1957 1957
             this.dataSourceInformation = dataSourceInformation;
    
    1958 1958
         }
    
    1959 1959
     
    
    1960
    -    public ObserveDataSourceInformation getH2DataSourceInformation() {
    
    1961
    -        if (h2DataSourceInformation == null && localStorageExist) {
    
    1962
    -            ObserveSwingDataSource dataSource = ClientUIContextApplicationComponent.value().getDataSourcesManager().newDataSource(h2Config);
    
    1963
    -            try {
    
    1964
    -                h2DataSourceInformation = dataSource.checkCanConnect(false);
    
    1965
    -            } catch (Exception e) {
    
    1966
    -                log.debug("error on load data source information for local storage", e);
    
    1967
    -            }
    
    1968
    -        }
    
    1969
    -
    
    1970
    -        return h2DataSourceInformation;
    
    1971
    -    }
    
    1960
    +//    public ObserveDataSourceInformation getH2DataSourceInformation() {
    
    1961
    +//        if (h2DataSourceInformation == null && localStorageExist) {
    
    1962
    +//            ObserveSwingDataSource dataSource = ClientUIContextApplicationComponent.value().getDataSourcesManager().newDataSource(h2Config);
    
    1963
    +//            try {
    
    1964
    +//                h2DataSourceInformation = dataSource.checkCanConnect(false);
    
    1965
    +//            } catch (Exception e) {
    
    1966
    +//                log.debug("error on load data source information for local storage", e);
    
    1967
    +//            }
    
    1968
    +//        }
    
    1969
    +//
    
    1970
    +//        return h2DataSourceInformation;
    
    1971
    +//    }
    
    1972 1972
     
    
    1973 1973
         private boolean isValidDumpFile(File dumpFile) {
    
    1974 1974
             return dumpFile != null &&
    

  • client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/wizard/connexion/DataSourceSelectorModel.java
    ... ... @@ -30,7 +30,7 @@ import org.apache.logging.log4j.Logger;
    30 30
     
    
    31 31
     import javax.swing.KeyStroke;
    
    32 32
     
    
    33
    -public class DataSourceSelectorModel extends StorageUIModel  {
    
    33
    +public class DataSourceSelectorModel extends StorageUIModel {
    
    34 34
     
    
    35 35
         private static final Logger log = LogManager.getLogger(DataSourceSelectorModel.class);
    
    36 36
     
    
    ... ... @@ -64,12 +64,17 @@ public class DataSourceSelectorModel extends StorageUIModel {
    64 64
     
    
    65 65
         public ObserveDataSourceInformation getSourceInformation() {
    
    66 66
             if (sourceInformation == null) {
    
    67
    -            ObserveSwingDataSource localSource = getSafeSource(false);
    
    68
    -            try {
    
    69
    -                sourceInformation = localSource.checkCanConnect(false);
    
    70
    -            } catch (Exception e) {
    
    71
    -                //FIXME ! il faut faire quelque chose dans ce cas précis, au moins avertir l'utilisateur
    
    72
    -                log.error("unable to find local source information", e);
    
    67
    +            ObserveDataSourceInformation dataSourceInformation = getDataSourceInformation();
    
    68
    +            if (dataSourceInformation != null) {
    
    69
    +                sourceInformation = dataSourceInformation;
    
    70
    +            } else {
    
    71
    +                try {
    
    72
    +                    sourceInformation = getSafeSource(false).checkCanConnect(false);
    
    73
    +                    setDataSourceInformation(sourceInformation);
    
    74
    +                } catch (Exception e) {
    
    75
    +                    //FIXME ! il faut faire quelque chose dans ce cas précis, au moins avertir l'utilisateur
    
    76
    +                    log.error("unable to find local source information", e);
    
    77
    +                }
    
    73 78
                 }
    
    74 79
             }
    
    75 80
             return sourceInformation;
    

  • observe-i18n/src/main/i18n/translations/observe_en_GB.properties
    ... ... @@ -2218,6 +2218,7 @@ observe.ui.datasource.editor.actions.report.title.tip=Help to generate reports
    2218 2218
     observe.ui.datasource.editor.actions.report.variables=Variables configuration
    
    2219 2219
     observe.ui.datasource.editor.actions.saveLocal=Save local database
    
    2220 2220
     observe.ui.datasource.editor.actions.saveLocal.description=Save modifcations on local database
    
    2221
    +observe.ui.datasource.editor.actions.select.loading=< Data source select tree is loading >
    
    2221 2222
     observe.ui.datasource.editor.actions.synchro.cancel.tip=Cancel
    
    2222 2223
     observe.ui.datasource.editor.actions.synchro.copy.tip=Copy result of report in clipboard
    
    2223 2224
     observe.ui.datasource.editor.actions.synchro.data=Advanced data management
    

  • observe-i18n/src/main/i18n/translations/observe_es_ES.properties
    ... ... @@ -2218,6 +2218,7 @@ observe.ui.datasource.editor.actions.report.title.tip=Ayuda a la generación del
    2218 2218
     observe.ui.datasource.editor.actions.report.variables=Configuración de variables
    
    2219 2219
     observe.ui.datasource.editor.actions.saveLocal=Copia de seguridad de la base local
    
    2220 2220
     observe.ui.datasource.editor.actions.saveLocal.description=Guardar las modificationes realizadas en la base locale
    
    2221
    +observe.ui.datasource.editor.actions.select.loading=< Data source select tree is loading > \#TODO
    
    2221 2222
     observe.ui.datasource.editor.actions.synchro.cancel.tip=Cancelar
    
    2222 2223
     observe.ui.datasource.editor.actions.synchro.copy.tip=Copiar el informe en el portapapeles
    
    2223 2224
     observe.ui.datasource.editor.actions.synchro.data=Gestión avanzada de los datos
    

  • observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
    ... ... @@ -2218,6 +2218,7 @@ observe.ui.datasource.editor.actions.report.title.tip=Aide à la génération du
    2218 2218
     observe.ui.datasource.editor.actions.report.variables=Configuration des variables
    
    2219 2219
     observe.ui.datasource.editor.actions.saveLocal=Sauvegarde de la base locale
    
    2220 2220
     observe.ui.datasource.editor.actions.saveLocal.description=Sauvegarder les modifications effectuées vers la base locale
    
    2221
    +observe.ui.datasource.editor.actions.select.loading=< L'arbre de sélection de données est en cours de chargement >
    
    2221 2222
     observe.ui.datasource.editor.actions.synchro.cancel.tip=Annuler
    
    2222 2223
     observe.ui.datasource.editor.actions.synchro.copy.tip=Copier le rapport dans le presse-papier
    
    2223 2224
     observe.ui.datasource.editor.actions.synchro.data=Gestion avancée de données