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

Commits:

4 changed files:

Changes:

  • application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseRemoteConfigurationUIAction.java
    ... ... @@ -78,7 +78,8 @@ public class UseRemoteConfigurationUIAction extends AbstractUIAction {
    78 78
             SwingUtilities.invokeLater(() -> {
    
    79 79
                 configUI.getTestRemoteAction().doClick();
    
    80 80
                 if (ConnexionStatus.SUCCESS == configUI.getModel().getConnexionStatus()) {
    
    81
    -                parentContainer.getNextAction().requestFocusInWindow();
    
    81
    +                parentContainer.getNextAction().doClick();
    
    82
    +                parentContainer.getApplyAction().doClick();
    
    82 83
                 }
    
    83 84
             });
    
    84 85
         }
    

  • application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseServerConfigurationUIAction.java
    ... ... @@ -79,7 +79,8 @@ public class UseServerConfigurationUIAction extends AbstractUIAction {
    79 79
             SwingUtilities.invokeLater(() -> {
    
    80 80
                 configUI.getTestRemoteAction().doClick();
    
    81 81
                 if (ConnexionStatus.SUCCESS == configUI.getModel().getConnexionStatus()) {
    
    82
    -                parentContainer.getNextAction().requestFocusInWindow();
    
    82
    +                parentContainer.getNextAction().doClick();
    
    83
    +                parentContainer.getApplyAction().doClick();
    
    83 84
                 }
    
    84 85
             });
    
    85 86
     
    

  • application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUI.jcss
    ... ... @@ -37,6 +37,7 @@
    37 37
       text:{I18nEnumHelper.getLabel(DbMode.USE_LOCAL)};
    
    38 38
       enabled:{model.isCanUseLocalService()};
    
    39 39
       selected:{model.getDbMode() ==  DbMode.USE_LOCAL};
    
    40
    +  _changeStep:true;
    
    40 41
     }
    
    41 42
     
    
    42 43
     #createLocalMode {
    
    ... ... @@ -51,6 +52,7 @@
    51 52
       text:{I18nEnumHelper.getLabel(DbMode.USE_REMOTE)};
    
    52 53
       enabled:{model.isCanUseRemoteService()};
    
    53 54
       selected:{model.getDbMode() ==  DbMode.USE_REMOTE};
    
    55
    +  _changeStep:true;
    
    54 56
     }
    
    55 57
     
    
    56 58
     #useServerMode {
    
    ... ... @@ -58,6 +60,7 @@
    58 60
       text:{I18nEnumHelper.getLabel(DbMode.USE_SERVER)};
    
    59 61
       enabled:{model.isCanUseServerService()};
    
    60 62
       selected:{model.getDbMode() ==  DbMode.USE_SERVER};
    
    63
    +  _changeStep:true;
    
    61 64
     }
    
    62 65
     
    
    63 66
     #dbModeContent {
    
    ... ... @@ -87,12 +90,14 @@
    87 90
       text:{getHandler().updateInternalDumpModeLabel(config.isInitialDumpExist())};
    
    88 91
       visible:{getHandler().updateCreationModeLayout(config.isInitialDumpExist(), importInternalDumpMode)};
    
    89 92
       selected:{model.getCreationMode() ==  CreationMode.IMPORT_INTERNAL_DUMP};
    
    93
    +  _changeStep:true;
    
    90 94
     }
    
    91 95
     
    
    92 96
     #importExternalDumpMode {
    
    93 97
       value:{CreationMode.IMPORT_EXTERNAL_DUMP};
    
    94 98
       text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_EXTERNAL_DUMP)};
    
    95 99
       selected:{model.getCreationMode() ==  CreationMode.IMPORT_EXTERNAL_DUMP};
    
    100
    +  _changeStep:true;
    
    96 101
     }
    
    97 102
     
    
    98 103
     /** non utilisé dans cette version d'ObServe */
    
    ... ... @@ -102,18 +107,21 @@
    102 107
       value:{CreationMode.IMPORT_LOCAL_STORAGE};
    
    103 108
       text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_LOCAL_STORAGE)};
    
    104 109
       selected:{model.getCreationMode() ==  CreationMode.IMPORT_LOCAL_STORAGE};
    
    110
    +  _changeStep:true;
    
    105 111
     }
    
    106 112
     
    
    107 113
     #importRemoteStorageMode {
    
    108 114
       value:{CreationMode.IMPORT_REMOTE_STORAGE};
    
    109 115
       text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_REMOTE_STORAGE)};
    
    110 116
       selected:{model.getCreationMode() ==  CreationMode.IMPORT_REMOTE_STORAGE};
    
    117
    +  _changeStep:true;
    
    111 118
     }
    
    112 119
     
    
    113 120
     #importServerStorageMode {
    
    114 121
       value:{CreationMode.IMPORT_SERVER_STORAGE};
    
    115 122
       text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_SERVER_STORAGE)};
    
    116 123
       selected:{model.getCreationMode() ==  CreationMode.IMPORT_SERVER_STORAGE};
    
    124
    +  _changeStep:true;
    
    117 125
     }
    
    118 126
     
    
    119 127
     #migrationContent {
    

  • application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUIHandler.java
    ... ... @@ -26,15 +26,26 @@ import fr.ird.observe.application.swing.I18nEnumHelper;
    26 26
     import fr.ird.observe.application.swing.ObserveSwingApplicationContext;
    
    27 27
     import fr.ird.observe.application.swing.ObserveTextGenerator;
    
    28 28
     import fr.ird.observe.application.swing.configuration.constants.CreationMode;
    
    29
    +import fr.ird.observe.application.swing.ui.ObserveKeyStrokes;
    
    29 30
     import fr.ird.observe.application.swing.ui.storage.StorageStep;
    
    31
    +import fr.ird.observe.application.swing.ui.storage.StorageUI;
    
    30 32
     import fr.ird.observe.application.swing.ui.storage.StorageUIModel;
    
    31 33
     import java.awt.Component;
    
    34
    +import java.awt.event.ActionEvent;
    
    32 35
     import java.beans.PropertyChangeListener;
    
    33 36
     import java.io.File;
    
    34 37
     import java.util.Date;
    
    38
    +import java.util.Enumeration;
    
    39
    +import javax.swing.AbstractAction;
    
    40
    +import javax.swing.AbstractButton;
    
    41
    +import javax.swing.ActionMap;
    
    42
    +import javax.swing.InputMap;
    
    43
    +import javax.swing.JComponent;
    
    35 44
     import javax.swing.JPanel;
    
    36 45
     import javax.swing.JRadioButton;
    
    46
    +import javax.swing.KeyStroke;
    
    37 47
     import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    48
    +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup;
    
    38 49
     
    
    39 50
     
    
    40 51
     import static org.nuiton.i18n.I18n.t;
    
    ... ... @@ -61,6 +72,35 @@ public class ChooseDbModeUIHandler extends StorageTabUIHandler<ChooseDbModeUI> i
    61 72
             model.addPropertyChangeListener(StorageUIModel.DB_MODE_PROPERTY_NAME, listener);
    
    62 73
             model.addPropertyChangeListener(StorageUIModel.CREATION_MODE_PROPERTY_NAME, listener);
    
    63 74
             ui.setDescriptionText(t(StorageStep.CHOOSE_DB_MODE.getDescription()));
    
    75
    +
    
    76
    +        addGroupMnemonic(ui.getDbMode(), "pressed F");
    
    77
    +        addGroupMnemonic(ui.getCreationMode(), "ctrl F");
    
    78
    +
    
    79
    +    }
    
    80
    +
    
    81
    +    private void addGroupMnemonic(JAXXButtonGroup buttonGroup, String keystrokePrefix) {
    
    82
    +        Enumeration<AbstractButton> elements = buttonGroup.getElements();
    
    83
    +        int index = 1;
    
    84
    +        InputMap inputMap = ui.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    
    85
    +        ActionMap actionMap = ui.getActionMap();
    
    86
    +        while (elements.hasMoreElements()) {
    
    87
    +            AbstractButton abstractButton = elements.nextElement();
    
    88
    +            KeyStroke k = KeyStroke.getKeyStroke(keystrokePrefix + (index++));
    
    89
    +            String actionName = abstractButton.getName();
    
    90
    +            inputMap.put(k, actionName);
    
    91
    +            actionMap.put(actionName, new AbstractAction() {
    
    92
    +                @Override
    
    93
    +                public void actionPerformed(ActionEvent e) {
    
    94
    +                    abstractButton.doClick();
    
    95
    +                    Boolean changeStep = (Boolean) abstractButton.getClientProperty("changeStep");
    
    96
    +                    if (changeStep != null && changeStep) {
    
    97
    +                        StorageUI parentContainer = ui.getParentContainer(StorageUI.class);
    
    98
    +                        parentContainer.getNextAction().doClick();
    
    99
    +                    }
    
    100
    +                }
    
    101
    +            });
    
    102
    +            ObserveKeyStrokes.addKeyStroke(abstractButton, k);
    
    103
    +        }
    
    64 104
         }
    
    65 105
     
    
    66 106
         protected String updateInternalDumpModeLabel(@SuppressWarnings("unused") boolean dumpExist) {