Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ private void settingsAction() {
logger.info("Showing the SettingsWindow");
primaryStage.show();
primaryStage.setWidth(450);
primaryStage.setHeight(320);
primaryStage.setHeight(350);
} catch (final IOException ex) {
logger.error("Unable to open the SettingsWindow", ex);
FxUtils.showErrorAlert(translationBundle.getString("SettingsWindowError"), ex.toString(), getClass().getResourceAsStream(SharedVariables.ICON_URL));
Expand Down Expand Up @@ -510,7 +510,7 @@ private void aboutAction() {
logger.info("Showing the AboutWindow");
primaryStage.show();
primaryStage.setWidth(450);
primaryStage.setHeight(250);
primaryStage.setHeight(280);
} catch (final IOException ex) {
logger.error("Unable to open the AboutWindow", ex);
FxUtils.showErrorAlert(translationBundle.getString("AboutWindowError"), ex.toString(), getClass().getResourceAsStream(SharedVariables.ICON_URL));
Expand Down Expand Up @@ -549,7 +549,7 @@ public void fired() {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append(System.getProperty("line.separator"));
builder.append(System.lineSeparator());
}
final String result = builder.toString();
logger.info("Shutdown command result: {}", result);
Expand Down Expand Up @@ -606,7 +606,7 @@ private void onDragDropped(final DragEvent dragEvent) {
boolean success = false;

if (db.hasFiles()) {
openSoundPreset(db.getFiles().get(0).getAbsolutePath());
openSoundPreset(db.getFiles().getFirst().getAbsolutePath());
success = true;
}

Expand Down
17 changes: 9 additions & 8 deletions src/main/java/com/codedead/opal/controller/UpdateController.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,18 @@ private int versionCompare(final String v1, final String v2) {
public List<PlatformUpdate> getUpdates() throws IOException, InterruptedException, InvalidHttpResponseCodeException {
logger.info("Attempting to retrieve List of PlatformUpdate objects from {}", getUpdateUrl());

final HttpClient client = HttpClient.newHttpClient();
final HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(getUpdateUrl()))
.build();
try (final HttpClient client = HttpClient.newHttpClient()) {
final HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(getUpdateUrl()))
.build();

final HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
final HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

if (response.statusCode() == 200)
return Arrays.asList(objectMapper.readValue(response.body(), PlatformUpdate[].class));
if (response.statusCode() == 200)
return Arrays.asList(objectMapper.readValue(response.body(), PlatformUpdate[].class));

throw new InvalidHttpResponseCodeException(String.format("Invalid HTTP response code (%s)", response.statusCode()));
throw new InvalidHttpResponseCodeException(String.format("Invalid HTTP response code (%s)", response.statusCode()));
}
}

/**
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/com/codedead/opal/utils/FxUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ public static void showInformationAlert(final String content, final InputStream
throw new NullPointerException("Content cannot be null!");

final Alert alert = new Alert(Alert.AlertType.INFORMATION, content, ButtonType.OK);
alert.setResizable(true);

final Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();

if (imageStream != null) {
if (imageStream != null)
stage.getIcons().add(new Image(imageStream));
}

alert.showAndWait();
}
Expand All @@ -50,13 +47,10 @@ public static void showInformationAlert(final String content, final InputStream
*/
public static boolean showConfirmationAlert(final String content, final InputStream imageStream) {
final Alert alert = new Alert(Alert.AlertType.CONFIRMATION, content, ButtonType.YES, ButtonType.NO);
alert.setResizable(true);

final Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();

if (imageStream != null) {
if (imageStream != null)
stage.getIcons().add(new Image(imageStream));
}

alert.showAndWait();

Expand Down Expand Up @@ -110,9 +104,7 @@ private static Alert getErrorAlert(final String content) {
GridPane.setHgrow(textArea, Priority.ALWAYS);

expContent.add(textArea, 0, 0);

alert.getDialogPane().setExpandableContent(expContent);
alert.setResizable(true);

return alert;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/windows/AboutWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xmlns:fx="http://javafx.com/fxml"
alignment="CENTER"
fx:controller="com.codedead.opal.controller.AboutWindowController"
prefHeight="250.0" prefWidth="450.0">
prefHeight="280.0" prefWidth="450.0">

<rowConstraints>
<RowConstraints/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/windows/SettingsWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<GridPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="com.codedead.opal.controller.SettingsWindowController"
prefHeight="320.0" prefWidth="450.0">
prefHeight="350.0" prefWidth="450.0">

<rowConstraints>
<RowConstraints vgrow="ALWAYS"/>
Expand Down