Finally replaced the hideous JFXpanel hack.

This commit is contained in:
Daniel Ziltener 2017-01-07 16:20:27 +00:00
parent bf030f500e
commit f659e88fa8
4 changed files with 40 additions and 55 deletions

View file

@ -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)))

View file

@ -1,8 +1,7 @@
(defproject clojurefx "0.1.0-SNAPSHOT"
(defproject clojurefx "0.0.16"
:dependencies [[org.clojure/clojure "1.8.0"]
[com.taoensso/timbre "4.7.4" :exclusions [com.taoensso/carmine]]
[org.clojure/core.typed "0.3.26"]
[clojure-jsr-223 "0.1.0"]]
:injections [(require 'clojure.core.typed)
(clojure.core.typed/install)]
:profiles {:uberjar {:aot :all}})
:profiles {:uberjar {:aot :all}}
:source-paths ["src"]
:java-source-paths ["src"])

View 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);
}
}

View file

@ -1,11 +1,14 @@
1(ns clojurefx.clojurefx
(ns clojurefx.clojurefx
(:require [taoensso.timbre :as timbre]
[clojure.java.io :as io]
[clojure.zip :as zip]
[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