Overriding java superclass method in Clojure -
i'm doing javafx stuff, following tableview example. in original java author @override
s several of tablecell
class methods he's deriving directly from, @override
s updateitem
method 2 levels in class hierarchy , belongs cell
class.
is there way in clojure? i'm doing proxy
i'm okay using :gen-class
if necessary. thought read somewhere can override immediate base class in clojure.
(defn make-editing-cell [] (let [textfield (atom nil)] (proxy [tablecell] [] (startedit [] (proxy-super startedit) (println "start editing")) (canceledit [] (proxy-super canceledit) (println "cancel editing")) (updateitem [item empty] ;(proxy-super updateitem ) ;; causes runtime error no matching field found (if empty (do (println "empty!") (doto (.settext nil) (.setgraphic nil))) (do (println "not empty!") (if (.isediting this) (do (println "editing") (if (not @textfield) (.settext @textfield (.tostring (.getitem this)))) (doto (.setgraphic @textfield) (.setcontentdisplay contentdisplay/graphic_only))) (do (println "not editing") (println this) (println (.getitem this)) (comment (doto (.settext (.tostring (.getitem this))) (.setcontentdisplay contentdisplay/graphic_only))))))) (println "updating item" item empty)))))
i needed pass arguments item
, empty
proxy-super
call... (proxy-super updateitem item empty)
Comments
Post a Comment