Removed 'get-' prefixes.

This commit is contained in:
Daniel Ziltener 2015-02-03 13:38:53 +00:00
parent b0f3c45a4d
commit 8514fae107
5 changed files with 69 additions and 69 deletions

View file

@ -1,12 +1,12 @@
[![License](//img.shields.io/badge/license-LGPL-blue.svg?style=flat)](https://www.gnu.org/licenses/lgpl-3.0.en.html#content)
[![Clojars](//img.shields.io/badge/clojars-0.0.30--SNAPSHOT-blue.svg?style=flat)](https://clojars.org/clojurefx/versions/0.0.30-SNAPSHOT)
[![Clojars](//img.shields.io/badge/clojars-0.1.0--SNAPSHOT-blue.svg?style=flat)](https://clojars.org/clojurefx/versions/0.1.0-SNAPSHOT)
[![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.0.30-SNAPSHOT"]
[clojurefx "0.1.0-SNAPSHOT"]
```
**Note: This is a complete rewrite, no code has been taken over from the old version on GitHub, and I'm taking a radically different approach.**

View file

@ -1,6 +1,6 @@
;-*- mode: Clojure;-*-
(set-env! :resource-paths #{"src"}
:dependencies '[[org.clojure/clojure "1.7.0-alpha4"]
: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"]
@ -8,14 +8,14 @@
[boot-deps "0.1.2" :scope "test"]
[midje "1.6.3" :scope "test"]
[adzerk/bootlaces "0.1.9" :scope "test"]
[zilti/boot-midje "0.1.2" :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.0.30-SNAPSHOT")
(def +version+ "0.1.0-SNAPSHOT")
(bootlaces! +version+)
(task-options!

View file

@ -89,19 +89,19 @@ nil)
(tc-ignore
(extend-protocol p/FXValue
Labeled
(get-value [this] (.getText ^Label this))
(value [this] (.getText ^Label this))
(set-value! [this value] (tc-assert String value) (.setText ^Label this ^String value) this)
TextField
(get-value [this] (.getText ^TextField this))
(value [this] (.getText ^TextField this))
(set-value! [this value] (tc-assert String value) (.setText ^TextField this ^String value) this)
TextArea
(get-value [this] (.getText ^TextArea this))
(value [this] (.getText ^TextArea this))
(set-value! [this value] (tc-assert String value) (.setText ^TextArea this ^String value) this)
CheckBox
(get-value [this] (.isSelected ^CheckBox this))
(value [this] (.isSelected ^CheckBox this))
(set-value! [this value] (tc-assert Boolean value) (.setSelected ^CheckBox this ^Boolean value) this)
ComboBox
(get-value [this] (let [selection-model (.getSelectionModel ^ComboBox this)
(value [this] (let [selection-model (.getSelectionModel ^ComboBox this)
_ (assert (not (nil? selection-model)))
index (.getSelectedIndex ^javafx.scene.control.SingleSelectionModel selection-model)]
(if (>= index 0)
@ -112,67 +112,67 @@ nil)
(if-not (nil? item)
(tc-ignore (.select ^javafx.scene.control.SingleSelectionModel sel-model item)))) this)
Menu
(get-value [this] (.getText ^Menu this))
(value [this] (.getText ^Menu this))
(set-value! [this value] (tc-assert String value) (.setText ^Menu this ^String value) this)
MenuItem
(get-value [this] (.getText ^MenuItem this))
(value [this] (.getText ^MenuItem this))
(set-value! [this value] (tc-assert String value) (.setText ^MenuItem this ^String value) this)))
(tc-ignore
(extend-protocol p/FXId
Styleable
(get-id [this] (.getId ^Styleable this))
(id [this] (.getId ^Styleable this))
(set-id! [this id] (tc-assert String id) (.setId ^Styleable this ^String id) this)))
(tc-ignore
(extend-protocol p/FXParent
Pane
(get-subnodes [this] (.getChildren ^Pane this))
(subnodes [this] (.getChildren ^Pane this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getChildren ^Pane this) (collize nodes)) this)
TabPane
(get-subnodes [this] (.getTabs ^TabPane this))
(subnodes [this] (.getTabs ^TabPane this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getTabs ^TabPane this) (collize nodes)) this)
MenuBar
(get-subnodes [this] (.getMenus ^MenuBar this))
(subnodes [this] (.getMenus ^MenuBar this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getMenus ^MenuBar this) (collize nodes)) this)
Menu
(get-subnodes [this] (.getItems ^Menu this))
(subnodes [this] (.getItems ^Menu this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getItems ^Menu this) nodes) (collize this))
MenuButton
(get-subnodes [this] (.getItems ^MenuButton this))
(subnodes [this] (.getItems ^MenuButton this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getItems ^MenuButton this) (collize nodes)) this)
ContextMenu
(get-subnodes [this] (.getItems ^ContextMenu this))
(subnodes [this] (.getItems ^ContextMenu this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getItems ^ContextMenu this) (collize nodes)) this)
ToolBar
(get-subnodes [this] (.getItems ^ToolBar this))
(subnodes [this] (.getItems ^ToolBar this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getItems ^ToolBar this) (collize nodes)) this)
SplitPane
(get-subnodes [this] (.getItems ^SplitPane this))
(subnodes [this] (.getItems ^SplitPane this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getItems ^SplitPane this) (collize nodes)) this)
Accordion
(get-subnodes [this] (.getPanes ^Accordion this))
(subnodes [this] (.getPanes ^Accordion this))
(set-subnodes! [this nodes] (.setAll ^ObservableList (.getPanes ^Accordion this) (collize nodes)) this)))
(tc-ignore
(extend-protocol p/FXContainer
Tab
(get-content [this] (.getContent ^Tab this))
(content [this] (.getContent ^Tab this))
(set-content! [this node] (.setContent ^Tab this ^Node node) this)
TitledPane
(get-content [this] (.getContent ^TitledPane this))
(content [this] (.getContent ^TitledPane this))
(set-content! [this node] (.setContent ^TitledPane this ^Node node) this)
ScrollPane
(get-content [this] (.getContent ^ScrollPane this))
(content [this] (.getContent ^ScrollPane this))
(set-content! [this node] (.setContent ^ScrollPane this ^Node node) this)))
(tc-ignore
(extend-protocol p/FXGraphic
Labeled
(get-graphic [this] (.getGraphic ^Labeled this))
(graphic [this] (.getGraphic ^Labeled this))
(set-graphic! [this graphic] (.setGraphic ^Labeled this ^Node graphic))
MenuItem
(get-graphic [this] (.getGraphic ^Menu this))
(graphic [this] (.getGraphic ^Menu this))
(set-graphic! [this graphic] (.setGraphic ^Menu this ^Node graphic))))
(tc-ignore
@ -185,23 +185,23 @@ nil)
(tc-ignore
(extend-type Styleable
p/FXStyleable
(get-css-meta [this] (.getCssMetaData ^Styleable this))
(get-pseudo-class-styles [this] (.getPseudoClassStyles ^Styleable this))
(get-style [this] (.getStyle ^Styleable this))
(get-style-classes [this] (.getStyleClass ^Styleable this))
(css-meta [this] (.getCssMetaData ^Styleable this))
(pseudo-class-styles [this] (.getPseudoClassStyles ^Styleable this))
(style [this] (.getStyle ^Styleable this))
(style-classes [this] (.getStyleClass ^Styleable this))
(set-style-classes! [this classes] (.setAll ^ObservableList (.getStyleClass ^Styleable this) classes) this)
(get-styleable-parent [this] (.getStyleableParent ^Styleable this))
(get-type-selector [this] (.getTypeSelector ^Styleable this))))
(styleable-parent [this] (.getStyleableParent ^Styleable this))
(type-selector [this] (.getTypeSelector ^Styleable this))))
(declare bind-event)
(tc-ignore
(extend-protocol p/FXOnAction
ButtonBase
(get-action [this] (.getOnAction ^ButtonBase this))
(action [this] (.getOnAction ^ButtonBase this))
(set-action! [this action] (.setOnAction ^ButtonBase this (bind-event action)) this)
(fire! [this] (.fire this))
MenuItem
(get-action [this] (.getOnAction ^MenuItem this))
(action [this] (.getOnAction ^MenuItem this))
(set-action! [this action] (.setOnAction ^ButtonBase this (bind-event action)) this)
(fire! [this] (.fire this))))
@ -224,9 +224,9 @@ nil)
(tc-ignore
(extend-type Stage
p/FXStage
(get-title [this] (.getTitle ^Stage this))
(title [this] (.getTitle ^Stage this))
(set-title! [this title] (.setTitle ^Stage this ^String title))
(get-scene [this] (.getScene ^Stage this))
(scene [this] (.getScene ^Stage this))
(set-scene! [this scene] (.setScene ^Stage this ^Scene scene))))
;;### javafx.scene
@ -234,7 +234,7 @@ nil)
(tc-ignore
(extend-type Scene
p/FXScene
(get-root [this] (.getRoot ^Scene this))
(root [this] (.getRoot ^Scene this))
(set-root! [this root] (.setRoot ^Scene this ^Parent root) this)))
;;## Event handling helper
@ -250,8 +250,8 @@ nil)
(or (pred-protocol p/FXParent node) (pred-protocol p/FXContainer node)))
(fn children [node :- (U p/FXParent p/FXContainer)] :- java.util.List
(if (pred-protocol p/FXParent node)
(into [] (p/get-subnodes node))
[(p/get-content node)]))
(into [] (p/subnodes node))
[(p/content node)]))
(fn make-node [node :- (U p/FXParent p/FXContainer) children :- Any] :- (U p/FXParent p/FXContainer)
(if (pred-protocol p/FXParent node)
(p/set-subnodes! node children)
@ -262,7 +262,7 @@ nil)
(defn get-node-by-id [graph id]
(loop [zipper (fxzipper graph)]
(cond (zip/end? zipper) nil
(= (p/get-id (zip/node zipper)) (name id)) (zip/node zipper)
(= (p/id (zip/node zipper)) (name id)) (zip/node zipper)
:else (recur (zip/next zipper))))))
(tc-ignore
@ -272,4 +272,4 @@ nil)
(if (zip/end? zipper)
ids
(recur (zip/next zipper)
(assoc ids (keyword (p/get-id (zip/node zipper))) (zip/node zipper)))))))
(assoc ids (keyword (p/id (zip/node zipper))) (zip/node zipper)))))))

View file

@ -25,25 +25,25 @@
(ann translation-map (Atom1 (Map Keyword (Vec clojure.lang.Var))))
(def translation-map
(atom {;;; FXValue
:text (with-meta [#'get-value #'set-value!] {:argument String :parent FXValue})
:value (with-meta [#'get-value #'set-value!] {:argument Object :parent FXValue})
:text (with-meta [#'value #'set-value!] {:argument String :parent FXValue})
:value (with-meta [#'value #'set-value!] {:argument Object :parent FXValue})
;;; FXId
:id (with-meta [#'get-id #'set-id!] {:argument String :parent FXId})
:id (with-meta [#'id #'set-id!] {:argument String :parent FXId})
;;; FXGraphic
:graphic (with-meta [#'get-graphic #'set-graphic!] {:argument Node :parent FXGraphic})
:graphic (with-meta [#'graphic #'set-graphic!] {:argument Node :parent FXGraphic})
;;; FXContainer
:content (with-meta [#'get-content #'set-content!] {:argument Node :parent FXContainer})
:content (with-meta [#'content #'set-content!] {:argument Node :parent FXContainer})
;;; FXParent
:children (with-meta [#'get-subnodes #'set-subnodes!] {:argument java.util.List :parent FXParent})
:children (with-meta [#'subnodes #'set-subnodes!] {:argument java.util.List :parent FXParent})
;;; FXStyleSetter / FXStyleable
:style (with-meta [#'get-style #'set-style!] {:argument String :parent FXStyleable})
:style (with-meta [#'style #'set-style!] {:argument String :parent FXStyleable})
;;; FXOnAction
:action (with-meta [#'get-action #'set-action!] {:argument clojure.lang.IFn :parent FXOnAction})
:action (with-meta [#'action #'set-action!] {:argument clojure.lang.IFn :parent FXOnAction})
;;; FXStage
:title (with-meta [#'get-title #'set-title!] {:argument String :parent FXStage})
:scene (with-meta [#'get-scene #'set-scene!] {:argument Scene :parent FXStage})
:title (with-meta [#'title #'set-title!] {:argument String :parent FXStage})
:scene (with-meta [#'scene #'set-scene!] {:argument Scene :parent FXStage})
;;; FXScene
:root (with-meta [#'get-root #'set-root!] {:argument Parent :parent FXScene})}))
:root (with-meta [#'root #'set-root!] {:argument Parent :parent FXScene})}))
(def mandatory-constructor-args
(atom {javafx.scene.Scene [:root]}))

View file

@ -15,13 +15,13 @@
(defprotocol [[A :variance :covariant]
[B :variance :covariant]]
FXValue
(get-value [this :- A] :- B)
(value [this :- A] :- B)
(set-value! [this :- A value :- B] :- A))
(defprotocol [[A :variance :covariant]
[x :variance :covariant]]
FXId
(get-id [this :- A] :- (U nil String))
(id [this :- A] :- (U nil String))
(set-id! [this :- A id :- String] :- A))
(defalias FXElement (U FXValue FXId))
@ -30,32 +30,32 @@
[B :variance :covariant :< Seqable]]
FXParent
"The ClojureFX extension to javafx.scene.Parent."
(get-subnodes [this :- A] :- B)
(subnodes [this :- A] :- B)
(set-subnodes! [this :- A nodes :- B] :- A))
(defprotocol [[A :variance :covariant]
[B :variance :covariant]]
FXContainer
(get-content [this :- A] :- B)
(content [this :- A] :- B)
(set-content! [this :- A node :- B] :- A))
(defprotocol [[A :variance :covariant]
[B :variance :covariant :< javafx.scene.Node]]
FXGraphic
(get-graphic [this :- A] :- B)
(graphic [this :- A] :- B)
(set-graphic! [this :- A graphic :- B] :- A))
(defprotocol [[A :variance :covariant :< javafx.css.Styleable]
[B :variance :covariant :< javafx.css.Styleable]]
FXStyleable
"http://download.java.net/jdk8/jfxdocs/javafx/css/Styleable.html"
(get-css-meta [this :- A] :- (java.util.List javafx.css.CssMetaData)) ;; TODO
(get-pseudo-class-styles [this :- A] :- (javafx.collections.ObservableSet javafx.css.PseudoClass))
(get-style [this :- A] :- String)
(get-style-classes [this :- A] :- (javafx.collections.ObservableList String))
(css-meta [this :- A] :- (java.util.List javafx.css.CssMetaData)) ;; TODO
(pseudo-class-styles [this :- A] :- (javafx.collections.ObservableSet javafx.css.PseudoClass))
(style [this :- A] :- String)
(style-classes [this :- A] :- (javafx.collections.ObservableList String))
(set-style-classes! [this :- A classes :- java.util.Collection] :- A)
(get-styleable-parent [this :- A] :- (U nil B))
(get-type-selector [this :- A] :- String))
(styleable-parent [this :- A] :- (U nil B))
(type-selector [this :- A] :- String))
(defprotocol [[A :variance :covariant]]
FXStyleSetter
@ -65,7 +65,7 @@
(defprotocol [[A :variance :covariant]]
FXOnAction
(get-action [this :- A] :- [javafx.event.EventHandler -> Any])
(action [this :- A] :- [javafx.event.EventHandler -> Any])
(set-action! [this :- A action :- [javafx.event.EventHandler -> Any]] :- A)
(fire! [this :- A] :- nil))
@ -87,9 +87,9 @@
(defprotocol [[A :variance :covariant :< javafx.stage.Stage]
[B :variance :covariant :< javafx.scene.Scene]]
FXStage
(get-title [this :- A] :- String)
(title [this :- A] :- String)
(set-title! [this :- A title :- String] :- A)
(get-scene [this :- A] :- B)
(scene [this :- A] :- B)
(set-scene! [this :- A scene :- B] :- A))
;;### javafx.scene
@ -97,5 +97,5 @@
(defprotocol [[A :variance :covariant :< javafx.scene.Scene]
[B :variance :covariant :< javafx.scene.Parent]]
FXScene
(get-root [this :- A] :- B)
(root [this :- A] :- B)
(set-root! [this :- A root :- B] :- A))