Commits

shemnon  committed 8ebcfcb Merge

Merge branch 'master' into JavaFX8

  • Participants
  • Parent commits 58d8835, fd31aa5

Comments (0)

Files changed (5)

File gradle-javafx-plugin/src/main/groovy/org/bitbucket/shemnon/javafxplugin/JavaFXPlugin.groovy

 
         configureConfigurations(project.configurations)
 
-        def jfxrtJarFile = project.files(findJFXJar())
+        def jfxrtJarFile = project.javafx.jfxrtJar ?: project.files(findJFXJar())
         project.javafx {
             jfxrtJar = jfxrtJarFile
-            antJavaFXJar = project.files(findAntJavaFXJar())
+            antJavaFXJar = antJavaFXJar ?: project.files(findAntJavaFXJar())
             appName = project.name //FIXME capatalize
             packaging = 'all'
             signingMode = 'release'
                 project.logger.debug("$k not set")
             } else {
                 project.logger.debug("$k is $dir")
-                try {
-                    result = project.fileTree(dir: dir, include: searchPaths).singleFile
-                    project.logger.debug("found $searchID as $result")
-                } catch (IllegalStateException ignore) {
-                    // no file or two files
-                    project.logger.debug("either zero files or more than one file matched $searchID, ignoring");
+                searchPaths.each { s ->
+                    if (result != null) return;
+                    File f = new File(dir, s);
+                    project.logger.debug("Trying $f.path")
+                    if (f.exists() && f.file) {
+                        project.logger.debug("found $searchID as $result")
+                        result = f; 
+                    }
                 }
             }
         }
         if (!result?.file) {
-            println("""    Could not find $searchID, please set one of $places.keys""")
-            throw new GradleException("$searchID not found.\n ${log.join('\n')}");
+            throw new GradleException("Could not find $searchID, please set one of ${places.keySet()}");
         } else {
             project.logger.info("$searchID: ${result}")
             return result
                     'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
                     'java.home in JVM properties': {System.properties['java.home']}
                 ],
-                ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt/jar', 'jre/lib/jfxrt.jar', 'jre/lib/ext/jfxrt.jar'],
+                ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar', 'jre/lib/ext/jfxrt.jar'],
                 'JavaFX Runtime Jar')
     }
 
                     'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
                     'java.home in JVM properties': {System.properties['java.home']}
                  ],
-                ['lib/ant-javafx.jar'],
+                ['lib/ant-javafx.jar', '../lib/ant-javafx.jar'],
                 'JavaFX Packager Tools')
     }
 }

File gradle-javafx-plugin/src/main/groovy/org/bitbucket/shemnon/javafxplugin/tasks/JavaFXJarTask.groovy

     processResources() {
         CreateJarParams createJarParams = new CreateJarParams();
 
-        if (JavaVersion.current().java8Compatible) {
-            createJarParams.addResource(null, getJarFile())
-        } else {
-            // Boo!  Hiss!  Under JDK7 we must explode!
-            File exploded = "build/jdk7Compat/${getJarFile().name}" as File
-            exploded.mkdirs()
-            project.copy {
-                from project.zipTree(getJarFile())
-                into exploded
-            }
-            createJarParams.addResource(exploded, ".")
-        }
-
+        createJarParams.addResource(null, getJarFile())
         createJarParams.applicationClass = getMainClass()
         createJarParams.arguments = getArguments()
         createJarParams.classpath = getClasspath().files.collect {it.name}.join ' '

File samples/FullyExpressed/build.gradle

     validity=1
 }
 
+jar {
+    manifest {
+        attributes('-x-bogus': 'a bogus attribute',
+                   '-x-bogus-2': 'a second bogus attribute')
+    }
+}

File samples/Modena/src/main/java/modena/Modena.java

 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.lang.Override;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 import javafx.scene.transform.Scale;
 import javafx.stage.FileChooser;
 import javafx.stage.Stage;
+import javafx.stage.WindowEvent;
+
 import javax.imageio.ImageIO;
 
 public class Modena extends Application {
         }
     }
     
-    private final BorderPane outerRoot = new BorderPane();
+    private BorderPane outerRoot;
     private BorderPane root;
     private SamplePageNavigation samplePageNavigation;
     private SamplePage samplePage;
         // set user agent stylesheet
         updateUserAgentStyleSheet(true);
         // build Menu Bar
+        outerRoot = new BorderPane();
         outerRoot.setTop(buildMenuBar());
         outerRoot.setCenter(root);
         // build UI
 //        stage.setIconified(test); // TODO: Blocked by http://javafx-jira.kenai.com/browse/JMY-203
         stage.show(); // see SamplePage.java:110 comment on how test fails without having stage shown
         instance = this;
+        
+        //threading bugs
+        stage.setOnHiding(new EventHandler<WindowEvent>() {
+            @Override
+            public void handle(WindowEvent windowEvent) {
+                Platform.exit();
+                System.exit(0);
+            }
+        });
     }
     
     private MenuBar buildMenuBar() {

File samples/Modena/src/main/java/modena/SamplePage.java

 import javafx.scene.control.ToggleGroup;
 import javafx.scene.control.Tooltip;
 import javafx.scene.control.TooltipBuilder;
-import javafx.scene.control.TreeTableViewBuilder;
+import javafx.scene.control.TreeTableView;
 import javafx.scene.control.TreeViewBuilder;
 import javafx.scene.layout.GridPane;
 import javafx.scene.layout.HBox;
 import javafx.scene.layout.VBox;
 import javafx.scene.layout.VBoxBuilder;
 import javafx.scene.paint.Color;
-import javafx.scene.web.HTMLEditorBuilder;
+import javafx.scene.web.HTMLEditor;
 
 import static modena.SamplePageChartHelper.*;
 import static modena.SamplePageHelpers.*;
 import static modena.SamplePageTableHelper.*;
-import static modena.SamplePageTreeHelper.*;
-import static modena.SamplePageTreeTableHelper.*;
+import static modena.SamplePageTreeHelper.createTreeView;
+import static modena.SamplePageTreeTableHelper.createTreeTableView;
 
 /**
  * Page showing every control in every state.
         choiceBoxLongList.add(100, "Long List");
         newSection(
                 "ChoiceBox:",
-                ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item A").build(),
-                ChoiceBoxBuilder.create(String.class).items(choiceBoxLongList).value("Long List").build(),
-                withState(ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "hover"),
-                withState(ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "showing"),
-                withState(ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "focused"),
-                ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item C").disable(true).build()
+                ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item A").build(),
+                ChoiceBoxBuilder.<String>create().items(choiceBoxLongList).value("Long List").build(),
+                withState(ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "hover"),
+                withState(ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "showing"),
+                withState(ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "focused"),
+                ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item C").disable(true).build()
         );
         newSection(
                 "ComboBox:",
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item A").build(),
-                ComboBoxBuilder.create(String.class).items(choiceBoxLongList).value("Long List").build(),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "hover"),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "showing"),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "focused"),
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item C").disable(true).build()
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item A").build(),
+                ComboBoxBuilder.<String>create().items(choiceBoxLongList).value("Long List").build(),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "hover"),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "showing"),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "focused"),
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item C").disable(true).build()
                 );
         newSection(
                 "ComboBox\nEditable:",
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item A").editable(true).build(),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "hover"),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "pressed")
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item A").editable(true).build(),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "hover"),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "pressed")
                 );
         newSection(
                 "ComboBox\nEditable\n(More):",
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").editable(true).build(), "editable,contains-focus", ".text-field", "focused"),
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item C").editable(true).disable(true).build()
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").editable(true).build(), "editable,contains-focus", ".text-field", "focused"),
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item C").editable(true).disable(true).build()
                 );
         newSection(
                 "Color Picker:",
         );
         newSection(
                 "HTMLEditor:",
-                HTMLEditorBuilder.create().htmlText("Hello <b>Bold</b> Text").prefWidth(650).prefHeight(120).build()
-                );
+                new HTMLEditor() {{
+                    setHtmlText("Hello <b>Bold</b> Text");
+                    setPrefSize(650, 120);
+                }});
         newSection(
                 "HTMLEditor\nFocused:",
-                withState(HTMLEditorBuilder.create().htmlText("<i>Focused</i>").prefWidth(650).prefHeight(120).build(), "focused")
+                withState(new HTMLEditor() {{
+                    setHtmlText("<i>Focused</i>");
+                    setPrefSize(650, 120);
+                }}, "focused")
                 );
         newDetailedSection(
                 new String[] { "ToolBar (H|TOP):", "normal", "overflow", "disabled" },
                 );
         newDetailedSection(
                 new String[] {"Empty:", "ListView", "TableView", "TreeView", "TreeTableView"},
-                ListViewBuilder.create(String.class).prefWidth(150).prefHeight(100).build(),
-                TableViewBuilder.create(Object.class).prefWidth(150).prefHeight(100).build(),
-                TreeViewBuilder.create(Object.class).prefWidth(150).prefHeight(100).build(),
-                TreeTableViewBuilder.create(Object.class).prefWidth(150).prefHeight(100).build()
+                ListViewBuilder.<String>create().prefWidth(150).prefHeight(100).build(),
+                TableViewBuilder.create().prefWidth(150).prefHeight(100).build(),
+                TreeViewBuilder.create().prefWidth(150).prefHeight(100).build(),
+                new TreeTableView() {{
+                    setPrefSize(150, 100);
+                }}
                 );
         newDetailedSection(
                 new String[] {"ToolTip:","inline","inline + graphic", "popup"},