diff --git a/.gitignore b/.gitignore index ecfc575..da1beee 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ pom.xml .lein-deps-sum *~ *class +/docs/ \ No newline at end of file diff --git a/README.md b/README.md index 58399c1..696fd45 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ clojurefx ========= -A Clojure JavaFX wrapper. +A Clojure JavaFX wrapper. [Documentation can be found here](http://zilti.github.io/clojurefx). \ No newline at end of file diff --git a/project.clj b/project.clj index 8de286e..67be34d 100644 --- a/project.clj +++ b/project.clj @@ -1,7 +1,9 @@ (defproject clojurefx "0.1.0-SNAPSHOT" - :description "FIXME: write description" - :url "http://example.com/FIXME" + :description "Helper functions and probably a wrapper to simplify usage of JavaFX in Clojure.
+You'll need to have jfxrt.jar in your local maven repository. See [this coderwall protip](https://coderwall.com/p/4yjy1a) for how to make this happen." + :url "https://www.github.com/zilti/clojurefx" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] - [com.oracle/javafx-runtime "2.2.0"]]) + [com.oracle/javafx-runtime "2.2.0"]] + :plugins [[lein-marginalia "0.7.1"]]) diff --git a/src/clojurefx/core.clj b/src/clojurefx/core.clj index 87a9525..b1013bd 100644 --- a/src/clojurefx/core.clj +++ b/src/clojurefx/core.clj @@ -1,7 +1,10 @@ (ns clojurefx.core (:require [clojure.string :as str])) +(defonce force-toolkit-init (javafx.embed.swing.JFXPanel.)) + (defn run-later* + "Simple wrapper for Platform/runLater. You should use run-later." [f] (javafx.application.Platform/runLater f)) @@ -10,6 +13,7 @@ `(run-later* (fn [] ~@body))) (defn run-now* + "A modification of run-later waiting for the running method to return. You should use run-now." [f] (let [result (promise)] (run-later @@ -28,30 +32,6 @@ (defmacro event-handler [arg & body] `(event-handler* (fn ~arg ~@body))) -(def build-reference - '{accordion "javafx.scene.control" - - affine "javafx.scene.transform" - - anchor "javafx.scene.layout" - border-pane "javafx.scene.layout" - - arc "javafx.scene.shape" - arc-to "javafx.scene.shape" - - blend "javafx.scene.effect" - bloom "javafx.scene.effect" - box-blur "javafx.scene.effect" - - area-chart "javafx.scene.chart" - bar-chart "javafx.scene.chart" - bubble-chart "javafx.scene.chart" - axis "javafx.scene.chart" - - audio-clip "javafx.scene.media" - - bounding-box "javafx.geometry"}) - (defn- camel [in] (let [in (name in) in (str/split in #"-") @@ -60,7 +40,10 @@ in (conj (into [] in) "Builder")] (apply str in))) -(defn- get-qualified [builder] +(defn- get-qualified " +An exhaustive list of [everything implementing the builder pattern](http://docs.oracle.com/javafx/2/api/javafx/util/Builder.html). In the future it will be possible to add entries yourself.
+Don't use this yourself; See the macros \"build\" and \"deffx\" below. +" [builder] (let [pkgs {"javafx.scene.control" '[accordion button cell check-box check-box-tree-item check-menu-item choice-box color-picker combo-box context-menu custom-menu-item hyperlink indexed-cell index-range label list-cell list-view menu-bar menu menu-button menu-item @@ -106,11 +89,15 @@ (if (not (empty? (filter #(= % builder) (get pkgs k)))) (symbol (str k "." (camel (name builder)))))))))) -(defmacro build [what & args] +(defmacro build + "This helper macro makes it easier to use the [JavaFX builder classes](http://docs.oracle.com/javafx/2/api/javafx/util/Builder.html). Example: (build button (text \"Close me.\") (cancelButton true))." + [what & args] `(.. ~(get-qualified what) create ~@args build)) -(defmacro deffx [name what & args] +(defmacro deffx + "Uses build and assigns the result to a symbol." + [name what & args] `(def ~name (build ~what ~@args))) diff --git a/target/stale/extract-native.dependencies b/target/stale/extract-native.dependencies new file mode 100644 index 0000000..44a79c7 --- /dev/null +++ b/target/stale/extract-native.dependencies @@ -0,0 +1 @@ +([:dependencies ([marginalia "0.7.1"] [org.clojure/clojure "1.5.1"] [com.oracle/javafx-runtime "2.2.0"] [org.clojure/tools.nrepl "0.2.3"] [clojure-complete/clojure-complete "0.2.3"])]) \ No newline at end of file