You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2021/01/28 15:11:11 UTC
[sis] 01/03: Disable "Download" button if browser is not available.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit a29d04cc5a8706f584be743b4f1b2ee4c8c148e4
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Thu Jan 28 11:34:16 2021 +0100
Disable "Download" button if browser is not available.
---
.../src/main/java/org/apache/sis/internal/setup/Wizard.java | 13 +++++--------
.../main/java/org/apache/sis/internal/setup/WizardPage.java | 2 +-
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/Wizard.java b/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/Wizard.java
index 6ef160e..fe62296 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/Wizard.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/Wizard.java
@@ -328,7 +328,9 @@ final class Wizard extends FileFilter implements ActionListener, PropertyChangeL
content.add(Box.createVerticalStrut(30));
switch (page) {
case DOWNLOAD_JAVAFX: {
- createButton(content, JAVAFX_HOME).setToolTipText(FXFinder.JAVAFX_HOME);
+ final JButton button = createButton(content, JAVAFX_HOME);
+ button.setToolTipText(FXFinder.JAVAFX_HOME);
+ button.setEnabled(Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE));
final JLabel instruction = new JLabel(WizardPage.downloadSteps());
instruction.setFont(font.deriveFont(12f));
content.add(instruction);
@@ -520,15 +522,10 @@ final class Wizard extends FileFilter implements ActionListener, PropertyChangeL
* for opening the {@value Constants#JAVAFX_HOME} URL in a browser.
*/
private void openJavafxHomePage() {
- if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) try {
+ try {
Desktop.getDesktop().browse(new URI(FXFinder.JAVAFX_HOME));
- nextOrPreviousPage(1);
- } catch (URISyntaxException | IOException e) {
+ } catch (URISyntaxException | IOException | RuntimeException e) {
JOptionPane.showMessageDialog(wizard, e.toString(), "Error", JOptionPane.ERROR_MESSAGE);
- } else {
- JOptionPane.showMessageDialog(wizard, "Can not find internet browser on this computer.\n"
- + "See " + FXFinder.JAVAFX_HOME + " for download information.",
- "JavaFX download", JOptionPane.INFORMATION_MESSAGE);
}
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/WizardPage.java b/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/WizardPage.java
index 29cf5ef..a5ba9ab 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/WizardPage.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/setup/WizardPage.java
@@ -50,7 +50,7 @@ enum WizardPage {
+ "This application requires <i>JavaFX</i> (or <i>OpenJFX</i>) version " + FXFinder.JAVAFX_VERSION + " or later. "
+ "OpenJFX is free software, licensed under the GPL with the class path exception. "
+ "Click on <u>Open JavaFX home page</u> for opening the JavaFX home page. "
- + "If JavaFX or OpenJFX has already been downloaded on this computer, "
+ + "If JavaFX has already been downloaded on this computer, "
+ "skip download and click on <u>Next</u> for specifying its installation directory."
+ "</p></html>"),