@VisibleForTesting JButton getDialogButton(@NotNull Action action) { return dialogWrapper.getButton(action); }
@Override public void onFailure(Throwable throwable) { SwingUtilities.invokeLater( () -> { runningProjectLoaderJobs.remove(user); // validation message should not be null, use exception name if needed. String errorMessage = Optional.ofNullable(throwable.getMessage()) .orElse(throwable.getClass().getName()); dialogWrapper.setErrorText(errorMessage, projectListTable); refreshProjectListUi(user); }); } });
dialogWrapper = new ProjectSelectionDialogWrapper(); dialogWrapper.setTitle( GoogleCloudCoreMessageBundle.getString("cloud.project.selector.dialog.title")); dialogWrapper.setOKActionEnabled(false); .connect(dialogWrapper.getDisposable()) .subscribe( GoogleLoginListener.GOOGLE_LOGIN_LISTENER_TOPIC, int result = dialogWrapper.getExitCode(); return result == DialogWrapper.OK_EXIT_CODE ? getSelectedProject() : null;
private void installProgressBar(ProjectSelectionDialogWrapper dialogWrapper) { dialogWrapper.getRootPane().getLayeredPane().add(progressBar, JLayeredPane.DRAG_LAYER); }
private ProjectSelectionDialogWrapper() { super(false /* cannot be parent */); init(); }
@VisibleForTesting void setLoading(boolean loading) { progressBar.setVisible(loading); int progressBarLength = 150; // center progress bar in the center of table scroll pane. progressBar.setBounds( dialogWrapper.getSize().width / 2 - progressBarLength / 2, dialogWrapper.getSize().height / 2, progressBarLength, progressBar.getPreferredSize().height); }
@Override protected boolean onDoubleClick(MouseEvent event) { dialogWrapper.clickDefaultButton(); return true; } };