From 3b051f6678f5704c9699056168f1ca45f9035a68 Mon Sep 17 00:00:00 2001 From: Bradley Turek Date: Sat, 13 Apr 2019 22:56:31 -0600 Subject: [PATCH] Adding some UI manifest attributes as parameters to the CreateManifest class. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should allow easier customization of the launcher UI because you can tell FXLauncher to put the UI customizations in the manifest for you. The parameters that I added—which already existed in Manifest—are * updateText (--update-text) * updateLabelStyle (--update-label-style) * progressBarStyle (--progress-bar-style) * wrapperStyle (--wrapper-style) --- src/main/java/fxlauncher/CreateManifest.java | 37 +++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/main/java/fxlauncher/CreateManifest.java b/src/main/java/fxlauncher/CreateManifest.java index afc8b42..ab010b1 100644 --- a/src/main/java/fxlauncher/CreateManifest.java +++ b/src/main/java/fxlauncher/CreateManifest.java @@ -24,8 +24,11 @@ public static void main(String[] args) throws IOException, URISyntaxException { String launchClass = args[1]; Path appPath = Paths.get(args[2]); - String cacheDir = null; String updateText = null; + String updateLabelStyle = null; + String progressBarStyle = null; + String wrapperStyle = null; + String cacheDir = null; Boolean acceptDowngrade = null; Boolean stopOnUpdateErrors = null; String parameters = null; @@ -42,6 +45,22 @@ public static void main(String[] args) throws IOException, URISyntaxException { Map named = params.getNamed(); if (named != null) { + // Configure updateText + if (named.containsKey("update-text")) + updateText = named.get("update-text"); + + // Configure updateLabelStyle + if (named.containsKey("update-label-style")) + updateLabelStyle = named.get("update-label-style"); + + // Configure progressBarStyle + if (named.containsKey("progress-bar-style")) + progressBarStyle = named.get("progress-bar-style"); + + // Configure wrapperStyle + if (named.containsKey("wrapper-style")) + wrapperStyle = named.get("wrapper-style"); + // Configure cacheDir if (named.containsKey("cache-dir")) cacheDir = named.get("cache-dir"); @@ -54,10 +73,6 @@ public static void main(String[] args) throws IOException, URISyntaxException { if (named.containsKey("stop-on-update-errors")) stopOnUpdateErrors = Boolean.valueOf(named.get("stop-on-update-errors")); - // Configure updateText - if (named.containsKey("update-text")) - updateText = named.get("update-text"); - // Configure preload native libraries if (named.containsKey("preload-native-libraries")) preloadNativeLibraries = named.get("preload-native-libraries"); @@ -87,13 +102,16 @@ public static void main(String[] args) throws IOException, URISyntaxException { stopOnUpdateErrorsDeprecated = true; continue; } + if (raw.startsWith("--update-text=")) continue; + if (raw.startsWith("--update-label-style=")) continue; + if (raw.startsWith("--progress-bar-style=")) continue; + if (raw.startsWith("--wrapper-style=")) continue; if (raw.startsWith("--cache-dir=")) continue; if (raw.startsWith("--accept-downgrade=")) continue; if (raw.startsWith("--stop-on-update-errors=")) continue; if (raw.startsWith("--include-extensions=")) continue; if (raw.startsWith("--preload-native-libraries=")) continue; if (raw.startsWith("--whats-new")) continue; - if (raw.startsWith("--update-text")) continue; if (raw.startsWith("--lingering-update-screen")) continue; if (rest.length() > 0) rest.append(" "); rest.append(raw); @@ -105,12 +123,15 @@ public static void main(String[] args) throws IOException, URISyntaxException { } FXManifest manifest = create(baseURI, launchClass, appPath); + if (updateText != null) manifest.updateText = updateText; + if (updateLabelStyle != null) manifest.updateLabelStyle = updateLabelStyle; + if (progressBarStyle != null) manifest.progressBarStyle = progressBarStyle; + if (wrapperStyle != null) manifest.wrapperStyle = wrapperStyle; if (cacheDir != null) manifest.cacheDir = cacheDir; if (acceptDowngrade != null) manifest.acceptDowngrade = acceptDowngrade; if (parameters != null) manifest.parameters = parameters; if (preloadNativeLibraries != null) manifest.preloadNativeLibraries = preloadNativeLibraries; if (whatsNew != null) manifest.whatsNewPage = whatsNew; - if (updateText != null) manifest.updateText = updateText; manifest.lingeringUpdateScreen = lingeringUpdateScreen; // Use --stop-on-update-errors if it was specified. @@ -155,7 +176,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO /** * Add the includeExtensions to the default list of "war" and "jar". *

- * Allthough the method is called setIncludeExtensions, it actually does an addAll. + * Although the method is called setIncludeExtensions, it actually does an addAll. * * @param includeExtensions */