fixes!
This commit is contained in:
@@ -79,11 +79,11 @@ public class SPdfApplication {
|
||||
|
||||
Properties props = new Properties();
|
||||
|
||||
if ("true".equals(System.getenv("STIRLING_PDF_DESKTOP_UI"))) {
|
||||
if (Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false"))) {
|
||||
System.setProperty("java.awt.headless", "false");
|
||||
app.setHeadless(false);
|
||||
// props.put("java.awt.headless", "false");
|
||||
// props.put("spring.main.web-application-type", "servlet");
|
||||
props.put("java.awt.headless", "false");
|
||||
props.put("spring.main.web-application-type", "servlet");
|
||||
}
|
||||
|
||||
app.setAdditionalProfiles("default");
|
||||
@@ -118,7 +118,7 @@ public class SPdfApplication {
|
||||
propertyFiles.get("spring.config.additional-location")));
|
||||
}
|
||||
|
||||
if (props.isEmpty()) {
|
||||
if (!props.isEmpty()) {
|
||||
finalProps.putAll(props);
|
||||
}
|
||||
app.setDefaultProperties(finalProps);
|
||||
@@ -147,9 +147,13 @@ public class SPdfApplication {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
log.info(
|
||||
"1 STIRLING_PDF_DESKTOP_UI={}",
|
||||
Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false")));
|
||||
baseUrlStatic = this.baseUrl;
|
||||
String url = baseUrl + ":" + getStaticPort();
|
||||
if (webBrowser != null && "true".equals(System.getenv("STIRLING_PDF_DESKTOP_UI"))) {
|
||||
if (webBrowser != null
|
||||
&& Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false"))) {
|
||||
|
||||
webBrowser.initWebUI(url);
|
||||
}
|
||||
|
||||
@@ -58,10 +58,12 @@ public class DesktopBrowser implements WebBrowser {
|
||||
private static SystemTray systemTray;
|
||||
|
||||
public DesktopBrowser() {
|
||||
log.info("DesktopBrowser 1");
|
||||
SwingUtilities.invokeLater(
|
||||
() -> {
|
||||
loadingWindow = new LoadingWindow(null, "Initializing...");
|
||||
loadingWindow.setVisible(true);
|
||||
log.info("DesktopBrowser 2");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -69,6 +71,7 @@ public class DesktopBrowser implements WebBrowser {
|
||||
CompletableFuture.runAsync(
|
||||
() -> {
|
||||
try {
|
||||
log.info("DesktopBrowser 4");
|
||||
CefAppBuilder builder = new CefAppBuilder();
|
||||
configureCefSettings(builder);
|
||||
|
||||
@@ -91,7 +94,7 @@ public class DesktopBrowser implements WebBrowser {
|
||||
// Show the frame immediately but transparent
|
||||
frame.setVisible(true);
|
||||
});
|
||||
|
||||
log.info("DesktopBrowser 5");
|
||||
} catch (Exception e) {
|
||||
log.error("Error initializing JCEF browser: ", e);
|
||||
cleanup();
|
||||
@@ -153,27 +156,28 @@ public class DesktopBrowser implements WebBrowser {
|
||||
Objects.requireNonNull(state, "state cannot be null");
|
||||
SwingUtilities.invokeLater(
|
||||
() -> {
|
||||
log.info("state {}", state.name());
|
||||
if (loadingWindow != null) {
|
||||
switch (state) {
|
||||
case LOCATING:
|
||||
loadingWindow.setStatus("Locating Chromium...");
|
||||
loadingWindow.setStatus("Locating Files...");
|
||||
loadingWindow.setProgress(0);
|
||||
break;
|
||||
case DOWNLOADING:
|
||||
if (percent >= 0) {
|
||||
loadingWindow.setStatus(
|
||||
String.format(
|
||||
"Downloading Chromium: %.0f%%",
|
||||
"Downloading additional files: %.0f%%",
|
||||
percent));
|
||||
loadingWindow.setProgress((int) percent);
|
||||
}
|
||||
break;
|
||||
case EXTRACTING:
|
||||
loadingWindow.setStatus("Extracting Chromium...");
|
||||
loadingWindow.setStatus("Extracting files...");
|
||||
loadingWindow.setProgress(60);
|
||||
break;
|
||||
case INITIALIZING:
|
||||
loadingWindow.setStatus("Initializing browser...");
|
||||
loadingWindow.setStatus("Initializing UI...");
|
||||
loadingWindow.setProgress(80);
|
||||
break;
|
||||
case INITIALIZED:
|
||||
|
||||
Reference in New Issue
Block a user