Skip to content

Commit

Permalink
Adding some UI manifest attributes as parameters to the CreateManifest
Browse files Browse the repository at this point in the history
class.

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)
  • Loading branch information
TurekBot committed Apr 14, 2019
1 parent 3024b41 commit 3b051f6
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions src/main/java/fxlauncher/CreateManifest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,6 +45,22 @@ public static void main(String[] args) throws IOException, URISyntaxException {
Map<String, String> 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");
Expand All @@ -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");
Expand Down Expand Up @@ -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);
Expand All @@ -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.
Expand Down Expand Up @@ -155,7 +176,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
/**
* Add the includeExtensions to the default list of "war" and "jar".
* <p>
* Allthough the method is called setIncludeExtensions, it actually does an addAll.
* Although the method is called setIncludeExtensions, it actually does an addAll.
*
* @param includeExtensions
*/
Expand Down

0 comments on commit 3b051f6

Please sign in to comment.