Skip to content
Merged
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 @@ -89,38 +89,52 @@ public static void showView(final Class<? extends AbstractFxmlView> window, fina
newStage.showAndWait();
}

/*
* (non-Javadoc)
*
* @see javafx.application.Application#init()
*/
@Override
public void init() throws Exception {
CompletableFuture.supplyAsync(() -> {
final ConfigurableApplicationContext ctx = SpringApplication.run(this.getClass(), savedArgs);

final List<String> fsImages = PropertyReaderHelper.get(ctx.getEnvironment(), "javafx.appicons");

if (!fsImages.isEmpty()) {
fsImages.forEach((s) -> icons.add(new Image(getClass().getResource(s).toExternalForm())));
} else { // add factory images
icons.add(new Image(getClass().getResource("/icons/gear_16x16.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_24x24.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_36x36.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_42x42.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_64x64.png").toExternalForm()));
}
return ctx;
}).whenComplete((ctx, throwable) -> {
if(throwable != null) {
LOGGER.error("Failed to load spring application context: ", throwable);
Platform.runLater(() -> showErrorAlert(throwable));
}
else {
launchApplicationView(ctx);
}
});
}
private void loadIcons(ConfigurableApplicationContext ctx)
{
try {
final List<String> fsImages = PropertyReaderHelper.get(ctx.getEnvironment(), "javafx.appicons");

if (!fsImages.isEmpty()) {
fsImages.forEach((s) ->
{
Image img = new Image(getClass().getResource(s).toExternalForm());
icons.add(img);
}
);
} else { // add factory images
icons.add(new Image(getClass().getResource("/icons/gear_16x16.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_24x24.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_36x36.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_42x42.png").toExternalForm()));
icons.add(new Image(getClass().getResource("/icons/gear_64x64.png").toExternalForm()));
}
} catch (Exception e) {
LOGGER.error("Failed to load icons: ", e);
}


}
/*
* (non-Javadoc)
*
* @see javafx.application.Application#init()
*/
@Override
public void init() throws Exception
{
CompletableFuture.supplyAsync(() -> {
return SpringApplication.run(this.getClass(), savedArgs);
}).whenComplete((ctx, throwable) -> {
if (throwable != null) {
LOGGER.error("Failed to load spring application context: ", throwable);
Platform.runLater(() -> showErrorAlert(throwable));
} else {
Platform.runLater(() -> {
loadIcons(ctx);
launchApplicationView(ctx);});
}
});
}

/*
* (non-Javadoc)
Expand Down