Commits

shemnon committed 9a4fdf2

Add some JNLP params

Comments (0)

Files changed (7)

plugin/src/main/groovy/com/bitbucket/shemnon/javafxplugin/tasks/JavaFXDeployTask.groovy

 package com.bitbucket.shemnon.javafxplugin.tasks
 
 import com.sun.javafx.tools.packager.DeployParams
+import com.sun.javafx.tools.packager.DeployParams.RunMode;
 import com.sun.javafx.tools.packager.PackagerLib
 import com.sun.javafx.tools.packager.bundlers.Bundler;
 import org.gradle.api.tasks.InputFiles
 import org.gradle.api.tasks.OutputDirectory
 import org.gradle.api.internal.ConventionTask
 import org.gradle.api.file.FileCollection
+import org.gradle.util.ConfigureUtil
 
 class JavaFXDeployTask extends ConventionTask {
 
         //java.util.List<com.sun.javafx.tools.packager.HtmlParam> htmlParams;
         //java.util.List<java.lang.String> arguments;
         //boolean embedCertificates;
-        //java.lang.String updateMode;
         //boolean isExtension;
         //boolean isSwingApp;
         //boolean includeDT;
         //java.lang.String placeholder;
         //java.lang.String appId;
-        //boolean offlineAllowed;
         //java.util.List<com.sun.javafx.tools.ant.Callback> callbacks;
         //java.util.List<com.sun.javafx.tools.packager.DeployParams.Template> templates;
         //java.lang.String jrePlatform;
                 deployParams.targetFormat = getPackaging()
 
         }
-
+        
         deployParams.verbose = getVerbose()
 
         deployParams.id = getAppID()
 
         deployParams.allPermissions = true //FIXME hardcoded
 
+        deployParams.updateMode = getUpdateMode()
+        deployParams.offlineAllowed = getOfflineAllowed()
+        for (IconInfo ii : icons) {
+            deployParams.addIcon(ii.href, ii.kind, ii.width, ii.height, ii.depth, ii.mode);
+        }
+        if (getCodebase() != null) {
+            try {
+                deployParams.codebase = getCodebase()
+            } catch (MissingPropertyException moe) {
+                getLogger().error("JavaFXDeployTask.codebase is only available in JavaFX 8 or later, codebase setting is ignored")
+            }
+        }
+
+
         PackagerLib packager = new PackagerLib();
         packager.generateDeploymentPackages(deployParams)
     }
 
+    def icon(Closure closure) {
+         icons.add(new IconInfo(closure))
+    }
+
     String packaging
 
     FileCollection antJavaFXJar
 
     String appID
     String appName
-    String mainClass
 
+    boolean verbose = false
+
+    String mainClass
     int width = 1024
     int height = 768
     boolean embedJNLP = false
-    boolean verbose = false
-
+    String updateMode = "background"
+    boolean offlineAllowed = true
+    String codebase
 
     // deplpy/info attributes
     String category
     String description
     String licenseType
     String vendor
+    List<IconInfo> icons = []
 
     // deploy/preferences attributes
     Boolean installSystemWide
     boolean menu
     boolean shortcut
 
-
     @InputFiles
     FileCollection inputFiles
 
 
     @OutputDirectory
     File distsDir
+}
+
+class IconInfo {
+    String href
+    String kind = 'default'
+    int width = DeployParams.Icon.UNDEFINED
+    int height = DeployParams.Icon.UNDEFINED
+    int depth = DeployParams.Icon.UNDEFINED
+    RunMode mode = RunMode.ALL
 
+
+    public IconInfo(Closure configure) {
+        ConfigureUtil.configure(configure, this)
+    }
 }

samples/FullyExpressed/build.gradle

     installSystemWide = true
     menu = true
     shortcut = true
+
+    codebase = 'http://example.com/bogus/JNLP/Codebase'
+    icon {
+        href = 'src/main/resources/javafx-icon.png'
+        kind = 'default'
+        width = 128
+        height = 128
+        depth = 8
+        mode = 'ALL'
+    }
+    icon {
+        href = 'src/main/resources/javafx-icon.png'
+        kind = 'shortcut'
+        width = 128
+        height = 128
+        depth = 8
+        mode = 'ALL'
+    }
 }

samples/FullyExpressed/src/main/resources/com/bitbucket/shemnon/jfx/sample/fullyexpressed/theResources.properties

-hello=Hello! I'm Dora!
+hello=Prepare for takeoff

samples/FullyExpressed/src/main/resources/com/bitbucket/shemnon/jfx/sample/fullyexpressed/theResources_de.properties

-hello=Hallo! Ich bin Dora!
+hello=Startvorbereitungen

samples/FullyExpressed/src/main/resources/com/bitbucket/shemnon/jfx/sample/fullyexpressed/theResources_es.properties

-hello=Hola! Yo soy Dora!
+hello=Prep�rate para despegar

samples/FullyExpressed/src/main/resources/com/bitbucket/shemnon/jfx/sample/fullyexpressed/theResources_pt.properties

-hello=Ol�! Eu sou Dora!
+hello=Prepare-se para a decolagem

samples/FullyExpressed/src/main/resources/javafx-icon.png

Added
New image