Finally replaced the hideous JFXpanel hack.
This commit is contained in:
parent
bf030f500e
commit
f659e88fa8
4 changed files with 40 additions and 55 deletions
43
build.boot
43
build.boot
|
@ -1,43 +0,0 @@
|
||||||
;-*- mode: Clojure;-*-
|
|
||||||
(set-env! :resource-paths #{"src"}
|
|
||||||
:dependencies '[[org.clojure/clojure "1.7.0-alpha5"]
|
|
||||||
[com.taoensso/timbre "3.3.1" :exclusions [com.taoensso/carmine]]
|
|
||||||
[org.clojure/core.typed "0.2.77"]
|
|
||||||
[clojure-jsr-223 "0.1.0"]
|
|
||||||
|
|
||||||
[boot-deps "0.1.2" :scope "test"]
|
|
||||||
[midje "1.6.3" :scope "test"]
|
|
||||||
[adzerk/bootlaces "0.1.9" :scope "test"]
|
|
||||||
[zilti/boot-midje "0.2.1-SNAPSHOT" :scope "test"]
|
|
||||||
[zilti/boot-typed "0.1.1" :scope "test"]])
|
|
||||||
|
|
||||||
(require '[zilti.boot-midje :refer [midje]]
|
|
||||||
'[zilti.boot-typed :refer [typed]]
|
|
||||||
'[adzerk.bootlaces :refer :all])
|
|
||||||
|
|
||||||
(def +version+ "0.1.0-SNAPSHOT")
|
|
||||||
(bootlaces! +version+)
|
|
||||||
|
|
||||||
(task-options!
|
|
||||||
pom {:project 'clojurefx
|
|
||||||
:version +version+
|
|
||||||
:description "A Clojure JavaFX wrapper."
|
|
||||||
:url "https://bitbucket.com/zilti/clojurefx"
|
|
||||||
:scm {:url "https://bitbucket.com/zilti/clojurefx"}
|
|
||||||
:license {"name" "GNU Lesser General Public License 3.0"
|
|
||||||
"url" "http://www.gnu.org/licenses/lgpl-3.0.txt"}}
|
|
||||||
midje {:test-paths #{"test"}
|
|
||||||
:sources #{"src" "test"}}
|
|
||||||
typed {:namespaces #{'clojurefx.clojurefx 'clojurefx.protocols 'clojurefx.scripting}}
|
|
||||||
repl {:server true})
|
|
||||||
|
|
||||||
(deftask develop
|
|
||||||
[]
|
|
||||||
(task-options!
|
|
||||||
midje {:autotest true})
|
|
||||||
|
|
||||||
(comp (repl)
|
|
||||||
(midje)
|
|
||||||
(watch)
|
|
||||||
(typed)))
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
(defproject clojurefx "0.1.0-SNAPSHOT"
|
(defproject clojurefx "0.0.16"
|
||||||
:dependencies [[org.clojure/clojure "1.8.0"]
|
:dependencies [[org.clojure/clojure "1.8.0"]
|
||||||
[com.taoensso/timbre "4.7.4" :exclusions [com.taoensso/carmine]]
|
[com.taoensso/timbre "4.7.4" :exclusions [com.taoensso/carmine]]
|
||||||
[org.clojure/core.typed "0.3.26"]
|
|
||||||
[clojure-jsr-223 "0.1.0"]]
|
[clojure-jsr-223 "0.1.0"]]
|
||||||
:injections [(require 'clojure.core.typed)
|
:profiles {:uberjar {:aot :all}}
|
||||||
(clojure.core.typed/install)]
|
:source-paths ["src"]
|
||||||
:profiles {:uberjar {:aot :all}})
|
:java-source-paths ["src"])
|
||||||
|
|
26
src/clojurefx/AppWrap.java
Normal file
26
src/clojurefx/AppWrap.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package clojurefx;
|
||||||
|
|
||||||
|
import clojure.java.api.Clojure;
|
||||||
|
import clojure.lang.IFn;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zilti on 07.01.2017.
|
||||||
|
*/
|
||||||
|
public class AppWrap extends Application {
|
||||||
|
|
||||||
|
String ns, fn;
|
||||||
|
|
||||||
|
public AppWrap(String ns, String fn) {
|
||||||
|
super();
|
||||||
|
this.ns = ns;
|
||||||
|
this.fn = fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) throws Exception {
|
||||||
|
IFn handler = Clojure.var(ns, fn);
|
||||||
|
handler.invoke(stage);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,14 @@
|
||||||
1(ns clojurefx.clojurefx
|
(ns clojurefx.clojurefx
|
||||||
(:require [taoensso.timbre :as timbre]
|
(:require [taoensso.timbre :as timbre]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
[clojure.zip :as zip]
|
[clojure.zip :as zip]
|
||||||
[clojurefx.protocols :as p]
|
[clojurefx.protocols :as p]
|
||||||
[clojure.java.io :refer :all]))
|
[clojure.java.io :refer :all])
|
||||||
|
(:import (clojurefx AppWrap)))
|
||||||
|
|
||||||
(defonce force-toolkit-init (javafx.embed.swing.JFXPanel.))
|
(defn gen-stage! [nspc fun]
|
||||||
|
(let [appwrap (AppWrap. nspc fun)]
|
||||||
|
(.launch appwrap)))
|
||||||
|
|
||||||
;; ## Threading helpers
|
;; ## Threading helpers
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue