/** * Update the view with any required view events to create a clean initial state (all * initialisation will have completed) * * <p>Default implementation is to disable the "next" button */ public void fireInitialStateViewEvents() { // Default is to disable the Next button ViewEvents.fireWizardButtonEnabledEvent(getPanelName(), WizardButton.NEXT, false); }
/** Handle the process of restoring a wallet */ private void handleRestoreWallet() { WelcomeWizardModel model = getWizardModel(); log.debug("The select wallet choice is {}", model.getSelectWalletChoice()); log.debug("The restore method is {}", model.getRestoreMethod()); // There are two sorts of restore wallet method: // RESTORE_WALLET_SEED_PHRASE = restore from a seed phrase and timestamp (MBHD soft wallet or // Trezor soft wallet) // RESTORE_WALLET_BACKUP = restore from a seed phrase and wallet backup final boolean backupLocationStatus = handleBackupLocation(); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LabelDecorator.applyStatusLabel( backupLocationStatusLabel, Optional.of(backupLocationStatus)); backupLocationStatusLabel.setVisible(true); // Hide the header view (switching back on is done in // MainController#onBitcoinNetworkChangedEvent ViewEvents.fireViewChangedEvent(ViewKey.HEADER, false); } }); // Give the user the impression of work being done Uninterruptibles.sleepUninterruptibly(250, TimeUnit.MILLISECONDS); final boolean walletCreatedStatus = handleCreateWalletStatus(model); log.debug("Wallet created status: {}", walletCreatedStatus); // Update created wallet status SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LabelDecorator.applyStatusLabel( walletCreatedStatusLabel, Optional.of(walletCreatedStatus)); walletCreatedStatusLabel.setVisible(true); } }); // Give the user the impression of work being done Uninterruptibles.sleepUninterruptibly(250, TimeUnit.MILLISECONDS); final boolean caCertificatesStatus = handleCACertificateStatus(); // Update the UI SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LabelDecorator.applyStatusLabel( caCertificateStatusLabel, Optional.of(caCertificatesStatus)); caCertificateStatusLabel.setVisible(true); } }); // Give the user the impression of work being done Uninterruptibles.sleepUninterruptibly(250, TimeUnit.MILLISECONDS); // Allow the Finish button at this point since the Bitcoin network may fail and the user will be // trapped ViewEvents.fireWizardButtonEnabledEvent( WelcomeWizardState.RESTORE_WALLET_REPORT.name(), WizardButton.FINISH, true); final boolean walletSynchronizationStatus = handleSynchronizationStatus(); // Update the UI SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LabelDecorator.applyStatusLabel( synchronizationStatusLabel, Optional.of(walletSynchronizationStatus)); synchronizationStatusLabel.setVisible(true); } }); }
@Subscribe public void onVerificationStatusChangedEvent(VerificationStatusChangedEvent event) { ViewEvents.fireWizardButtonEnabledEvent(event.getPanelName(), WizardButton.NEXT, event.isOK()); }
@Override public void fireInitialStateViewEvents() { // Enable the finish button ViewEvents.fireWizardButtonEnabledEvent(getPanelName(), WizardButton.FINISH, false); }