This commit is contained in:
Daniel Ziltener 2017-12-10 05:49:14 +00:00
parent e99ba08836
commit cc4adfe725
4 changed files with 10 additions and 50 deletions

View file

@ -1,12 +1,12 @@
[![License](//img.shields.io/badge/license-EPLv1-blue.svg?style=flat)](https://opensource.org/licenses/EPL-1.0)
[![Clojars](//img.shields.io/badge/clojars-0.3.0-blue.svg?style=flat)](https://clojars.org/clojurefx/versions/0.3.0)
[![Clojars](//img.shields.io/badge/clojars-0.4.0-blue.svg?style=flat)](https://clojars.org/clojurefx/versions/0.4.0)
[![Gratipay](//img.shields.io/gratipay/zilti.svg?style=flat)](//gratipay.com/zilti)
[![Flattr this](//api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=zilti&url=https%3A%2F%2Fbitbucket.org%2Fzilti%2Fclojurefx)
# ClojureFX
```clojure
[clojurefx "0.3.0"]
[clojurefx "0.4.0"]
```
A Clojure extension to make working with [JavaFX](http://download.java.net/jdk8/jfxdocs/index.html) simpler and more idiomatic. It allows you to naturally work with stock JavaFX components through use of extended protocols. Should a feature be missing you can easily extend ClojureFX in your own codebase or just fall back to standard JavaFX methods.
@ -16,7 +16,7 @@ A Clojure extension to make working with [JavaFX](http://download.java.net/jdk8/
Take a look at the [ClojureFX manual](http://lyrion.ch/share/clojurefx.html).
* FXML loading and scripting
* **NEW** Automatic FXML controller generation
* Automatic FXML controller generation
* Declarative EDN GUI structure compilation
* Simplified event binding (bind a Clojure function to an event trigger)

View file

@ -3,7 +3,7 @@
@settitle ClojureFX Manual
@copying
This manual is for ClojureFX, version 0.3.0.
This manual is for ClojureFX, version 0.4.0.
Copyright @copyright{} 2017 Daniel Ziltener.
@end copying
@ -24,7 +24,7 @@ Copyright @copyright{} 2017 Daniel Ziltener.
@node Top
@top ClojureFX
This is the documentation to ClojureFX, version 0.3.0.
This is the documentation to ClojureFX, version 0.4.0.
@c@end ifnottex
@menu
@ -40,11 +40,9 @@ This is the documentation to ClojureFX, version 0.3.0.
@node Installation and deployment
@chapter Installation and deployment
The first, straightforward part of this is to add the dependency to your @file{project.clj} or @file{build.boot}, which consists simply of adding @code{[clojurefx "0.3.0"]}.
The first, straightforward part of this is to add the dependency to your @file{project.clj} or @file{build.boot}, which consists simply of adding @code{[clojurefx "0.4.0"]}.
In case you are planning to use the FXML controller generator (and in my opinion, you really should!), you have to add @file{tools.jar} to your classpath. For Leiningen, there is a @uref{https://github.com/pallet/lein-jdk-tools, plugin}. The gist of it is to add @file{$JAVA_HOME/../lib/tools.jar} to your @code{:resource-paths} and if possible put it into an exclusions list for the main jar; that way it will still be packed into the uberjar.
For the users of @emph{OpenJDK} 7 and 8, @emph{OpenJFX}, the opensource implementation of JavaFX, is not included yet (it will be starting with OpenJDK 9). Luckily, many Linux distributions ship a separate OpenJFX package by now, but for those that don't, the OpenJDK wiki has an article @uref{https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX, ``Building OpenJFX''}.
For the users of @emph{OpenJDK} 7 and 8, @emph{OpenJFX}, the opensource implementation of JavaFX, is not included yet (it will be starting with OpenJDK 9). Luckily, many Linux distributions ship a separate OpenJFX package by now, but for those that don't, the OpenJDK wiki has an article @uref{https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX, ``Building OpenJFX''}. Alternatively, you can of course install the Oracle JDK manually.
@node Getting started
@chapter Getting started
@ -117,7 +115,7 @@ Turns the Hiccup-like tree into a JavaFX-Node.
@acronym{FXML} is an @acronym{XML} format describing a JavaFX user interface. It also allows defining action handlers and, similar to HTML, inline scripting via script tags. You can find an introduction @uref{https://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html, on this site}.
ClojureFX provides an idiomatic interface to load FXML files, and in this new version can even generate a controller class for you at runtime. For the latter, the user has to have @file{tools.jar} on his classpath (@pxref{Installation and deployment}).
ClojureFX provides an idiomatic interface to load FXML files, and in this new version can even generate a controller class for you at runtime.
@node Loading FXML files
@section Loading FXML files

View file

@ -1,9 +1,9 @@
(defproject clojurefx/clojurefx "0.3.9-SNAPSHOT"
(defproject clojurefx/clojurefx "0.4.0"
:description "A Clojure wrapper for JavaFX."
:license "Like Clojure."
:url "https://www.bitbucket.org/zilti/clojurefx"
:signing {:gpg-key "68484437"}
:dependencies [[org.clojure/clojure "1.9.0-RC1"]
:dependencies [[org.clojure/clojure "1.9.0-RC2"]
[swiss-arrows "1.0.0"]
[camel-snake-kebab "0.4.0"]
[org.controlsfx/controlsfx "8.40.13"]

View file

@ -10,8 +10,6 @@
(timbre/refer-timbre)
;; (defonce force-toolkit-init (javafx.embed.swing.JFXPanel.))
;; ## Scenegraph
(defmacro fi
@ -40,42 +38,6 @@
code (drop 2 fun)]
`(.setValue (~(symbol (str (name obj) "/" (name prop)))) (fi javafx.event.ActionEvent ~argument ~@code))))
;; (defn branch? [obj]
;; (or (and (instance? javafx.scene.Parent obj)
;; (not (instance? org.controlsfx.control.StatusBar obj)))
;; (instance? javafx.scene.control.MenuBar obj)
;; (instance? javafx.scene.control.Menu obj)))
;; (defn make-node [node children]
;; nil)
;; (defn down [x]
;; (cond
;; (instance? javafx.scene.control.Label x) (.getGraphic x)
;; (instance? javafx.scene.control.ProgressIndicator x) (.getContextMenu x)
;; (instance? javafx.scene.control.ScrollPane x) (.getContent x)
;; (instance? javafx.scene.control.MenuBar x) (.getMenus x)
;; (instance? javafx.scene.control.Menu x) (.getItems x)
;; (instance? javafx.scene.Parent x) (.getChildren x)
;; :else nil))
;; (defn sgzipper [root]
;; (zip/zipper branch? down make-node root))
;; (defn by-id [root id]
;; (try
;; (cond
;; (not (instance? clojure.lang.IFn root)) (do (trace "Raw input confirmed. Starting.")
;; (by-id (sgzipper root) id))
;; (zip/end? root) (do (trace "Search ended without result.")
;; nil)
;; (nil? (zip/node root)) (by-id (zip/next root) id)
;; (= id (.getId (zip/node root))) (do (debug "Found item:" (zip/node root))
;; (zip/node root))
;; :else (do (trace "id of" (zip/node root) "does not match, proceeding to" (zip/node (zip/next root)))
;; (by-id (zip/next root) id)))
;; (catch Exception e (error e))))
;; ## Data
(def constructor-args