diff --git a/pom.xml b/pom.xml index 0e66cae0..5123fcc7 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ jar UTF-8 - 1.8 - 1.8 + 11 + 11 com.rohitawate.everest.Main @@ -65,11 +65,26 @@ + + org.openjfx + javafx-controls + 11.0.2 + + + org.openjfx + javafx-fxml + 11.0.2 + + + jakarta.xml.bind + jakarta.xml.bind-api + 2.3.3 + com.jfoenix jfoenix - 1.4.0 + 9.0.10 diff --git a/src/main/java/com/rohitawate/everest/controllers/DashboardController.java b/src/main/java/com/rohitawate/everest/controllers/DashboardController.java index e0c14df1..a8e0efcf 100644 --- a/src/main/java/com/rohitawate/everest/controllers/DashboardController.java +++ b/src/main/java/com/rohitawate/everest/controllers/DashboardController.java @@ -18,6 +18,7 @@ import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXProgressBar; import com.jfoenix.controls.JFXSnackbar; +import com.jfoenix.controls.JFXSnackbarLayout; import com.rohitawate.everest.controllers.auth.AuthTabController; import com.rohitawate.everest.controllers.codearea.EverestCodeArea; import com.rohitawate.everest.controllers.codearea.highlighters.HighlighterFactory; @@ -68,6 +69,7 @@ import java.util.HashMap; import java.util.List; import java.util.ResourceBundle; +import javafx.util.Duration; public class DashboardController implements Initializable { @FXML @@ -184,7 +186,8 @@ public void initialize(URL url, ResourceBundle rb) { responseArea.selectAll(); responseArea.copy(); responseArea.deselect(); - snackbar.show("Response body copied to clipboard.", 5000); + snackbar.enqueue(new JFXSnackbar.SnackbarEvent(new Label("Response body copied to clipboard."), + Duration.seconds(5), null)); }); responseTypeBox.getItems().addAll( @@ -232,7 +235,8 @@ void sendRequest() { if (address.equals("")) { showLayer(ResponseLayer.PROMPT); - snackbar.show("Please enter an address.", 3000); + snackbar.enqueue(new JFXSnackbar.SnackbarEvent(new Label("Please enter an address."), + Duration.seconds(3), null)); return; } @@ -306,7 +310,8 @@ void sendRequest() { syncManager.saveState(getState().composer); } catch (MalformedURLException MURLE) { showLayer(ResponseLayer.PROMPT); - snackbar.show("Invalid address. Please verify and try again.", 3000); + snackbar.enqueue(new JFXSnackbar.SnackbarEvent(new Label("Invalid address. Please verify and try again."), + Duration.seconds(3), null)); } catch (Exception E) { LoggingService.logSevere("Request execution failed.", E, LocalDateTime.now()); errorTitle.setText("Oops... That's embarrassing!"); @@ -332,7 +337,8 @@ private void onFailed(Event event) { } else if (throwable.getClass() == RedirectException.class) { RedirectException redirect = (RedirectException) throwable; addressField.setText(redirect.getNewLocation()); - snackbar.show("Resource moved permanently. Redirecting...", 3000); + snackbar.enqueue(new JFXSnackbar.SnackbarEvent(new Label("Resource moved permanently. Redirecting..."), + Duration.seconds(3), null)); requestManager = null; sendRequest(); return; @@ -461,16 +467,17 @@ private void prettifyResponseBody(String body, String contentType) { case "text/html": simplifiedContentType = HTTPConstants.HTML; if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { - snackbar.show("Open link in browser?", "YES", 5000, e -> { - snackbar.close(); - new Thread(() -> { - try { - Desktop.getDesktop().browse(new URI(addressField.getText())); - } catch (Exception ex) { - LoggingService.logWarning("Invalid URL encountered while opening in browser.", ex, LocalDateTime.now()); - } - }).start(); - }); + snackbar.enqueue(new JFXSnackbar.SnackbarEvent(new JFXSnackbarLayout("Open link in browser?", "YES", + e -> { + snackbar.close(); + new Thread(() -> { + try { + Desktop.getDesktop().browse(new URI(addressField.getText())); + } catch (Exception ex) { + LoggingService.logWarning("Invalid URL encountered while opening in browser.", ex, LocalDateTime.now()); + } + }).start(); + }), Duration.seconds(5), null)); } break; default: @@ -490,7 +497,8 @@ private void prettifyResponseBody(String body, String contentType) { responseTypeBox.setValue(simplifiedContentType); } catch (Exception e) { String errorMessage = "Response could not be parsed."; - snackbar.show(errorMessage, 5000); + snackbar.enqueue(new JFXSnackbar.SnackbarEvent(new Label(errorMessage), + Duration.seconds(5), null)); LoggingService.logSevere(errorMessage, e, LocalDateTime.now()); errorTitle.setText("Parsing Error"); errorDetails.setText(errorMessage);