Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: b01ded0c by Tony CHEMIT at 2017-07-31T11:22:30+02:00 Speed up connection opening (See #805) - - - - - 4 changed files: - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseRemoteConfigurationUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseServerConfigurationUIAction.java - application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUI.jcss - application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUIHandler.java Changes: ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseRemoteConfigurationUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseRemoteConfigurationUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseRemoteConfigurationUIAction.java @@ -78,7 +78,8 @@ public class UseRemoteConfigurationUIAction extends AbstractUIAction { SwingUtilities.invokeLater(() -> { configUI.getTestRemoteAction().doClick(); if (ConnexionStatus.SUCCESS == configUI.getModel().getConnexionStatus()) { - parentContainer.getNextAction().requestFocusInWindow(); + parentContainer.getNextAction().doClick(); + parentContainer.getApplyAction().doClick(); } }); } ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseServerConfigurationUIAction.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseServerConfigurationUIAction.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/storage/UseServerConfigurationUIAction.java @@ -79,7 +79,8 @@ public class UseServerConfigurationUIAction extends AbstractUIAction { SwingUtilities.invokeLater(() -> { configUI.getTestRemoteAction().doClick(); if (ConnexionStatus.SUCCESS == configUI.getModel().getConnexionStatus()) { - parentContainer.getNextAction().requestFocusInWindow(); + parentContainer.getNextAction().doClick(); + parentContainer.getApplyAction().doClick(); } }); ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUI.jcss ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUI.jcss +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUI.jcss @@ -37,6 +37,7 @@ text:{I18nEnumHelper.getLabel(DbMode.USE_LOCAL)}; enabled:{model.isCanUseLocalService()}; selected:{model.getDbMode() == DbMode.USE_LOCAL}; + _changeStep:true; } #createLocalMode { @@ -51,6 +52,7 @@ text:{I18nEnumHelper.getLabel(DbMode.USE_REMOTE)}; enabled:{model.isCanUseRemoteService()}; selected:{model.getDbMode() == DbMode.USE_REMOTE}; + _changeStep:true; } #useServerMode { @@ -58,6 +60,7 @@ text:{I18nEnumHelper.getLabel(DbMode.USE_SERVER)}; enabled:{model.isCanUseServerService()}; selected:{model.getDbMode() == DbMode.USE_SERVER}; + _changeStep:true; } #dbModeContent { @@ -87,12 +90,14 @@ text:{getHandler().updateInternalDumpModeLabel(config.isInitialDumpExist())}; visible:{getHandler().updateCreationModeLayout(config.isInitialDumpExist(), importInternalDumpMode)}; selected:{model.getCreationMode() == CreationMode.IMPORT_INTERNAL_DUMP}; + _changeStep:true; } #importExternalDumpMode { value:{CreationMode.IMPORT_EXTERNAL_DUMP}; text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_EXTERNAL_DUMP)}; selected:{model.getCreationMode() == CreationMode.IMPORT_EXTERNAL_DUMP}; + _changeStep:true; } /** non utilisé dans cette version d'ObServe */ @@ -102,18 +107,21 @@ value:{CreationMode.IMPORT_LOCAL_STORAGE}; text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_LOCAL_STORAGE)}; selected:{model.getCreationMode() == CreationMode.IMPORT_LOCAL_STORAGE}; + _changeStep:true; } #importRemoteStorageMode { value:{CreationMode.IMPORT_REMOTE_STORAGE}; text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_REMOTE_STORAGE)}; selected:{model.getCreationMode() == CreationMode.IMPORT_REMOTE_STORAGE}; + _changeStep:true; } #importServerStorageMode { value:{CreationMode.IMPORT_SERVER_STORAGE}; text:{I18nEnumHelper.getLabel(CreationMode.IMPORT_SERVER_STORAGE)}; selected:{model.getCreationMode() == CreationMode.IMPORT_SERVER_STORAGE}; + _changeStep:true; } #migrationContent { ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUIHandler.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/tabs/ChooseDbModeUIHandler.java +++ b/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; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; import fr.ird.observe.application.swing.ObserveTextGenerator; import fr.ird.observe.application.swing.configuration.constants.CreationMode; +import fr.ird.observe.application.swing.ui.ObserveKeyStrokes; import fr.ird.observe.application.swing.ui.storage.StorageStep; +import fr.ird.observe.application.swing.ui.storage.StorageUI; import fr.ird.observe.application.swing.ui.storage.StorageUIModel; import java.awt.Component; +import java.awt.event.ActionEvent; import java.beans.PropertyChangeListener; import java.io.File; import java.util.Date; +import java.util.Enumeration; +import javax.swing.AbstractAction; +import javax.swing.AbstractButton; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JRadioButton; +import javax.swing.KeyStroke; import org.nuiton.jaxx.runtime.spi.UIHandler; +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import static org.nuiton.i18n.I18n.t; @@ -61,6 +72,35 @@ public class ChooseDbModeUIHandler extends StorageTabUIHandler<ChooseDbModeUI> i model.addPropertyChangeListener(StorageUIModel.DB_MODE_PROPERTY_NAME, listener); model.addPropertyChangeListener(StorageUIModel.CREATION_MODE_PROPERTY_NAME, listener); ui.setDescriptionText(t(StorageStep.CHOOSE_DB_MODE.getDescription())); + + addGroupMnemonic(ui.getDbMode(), "pressed F"); + addGroupMnemonic(ui.getCreationMode(), "ctrl F"); + + } + + private void addGroupMnemonic(JAXXButtonGroup buttonGroup, String keystrokePrefix) { + Enumeration<AbstractButton> elements = buttonGroup.getElements(); + int index = 1; + InputMap inputMap = ui.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + ActionMap actionMap = ui.getActionMap(); + while (elements.hasMoreElements()) { + AbstractButton abstractButton = elements.nextElement(); + KeyStroke k = KeyStroke.getKeyStroke(keystrokePrefix + (index++)); + String actionName = abstractButton.getName(); + inputMap.put(k, actionName); + actionMap.put(actionName, new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + abstractButton.doClick(); + Boolean changeStep = (Boolean) abstractButton.getClientProperty("changeStep"); + if (changeStep != null && changeStep) { + StorageUI parentContainer = ui.getParentContainer(StorageUI.class); + parentContainer.getNextAction().doClick(); + } + } + }); + ObserveKeyStrokes.addKeyStroke(abstractButton, k); + } } protected String updateInternalDumpModeLabel(@SuppressWarnings("unused") boolean dumpExist) { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/b01ded0cb48f1b1a669dbef4bd10... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/b01ded0cb48f1b1a669dbef4bd10... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT