Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Enable user to reorder items in new docs-lb listbox by drag and drop

  • Loading branch information...
commit ef12a4d5ab5945cd9f32c4c1ea120889912fc895 1 parent 44051d2
@jafingerhut jafingerhut authored
Showing with 21 additions and 1 deletion.
  1. +21 −1 src/clj_ns_browser/browser.clj
22 src/clj_ns_browser/browser.clj
@@ -602,7 +602,27 @@
(config! (id :ns-lb) :selection-mode :multi-interval) ;; experimental...
(config! (id :vars-lb) :model [])
(config! (id :ns-entries-lbl) :text "0")
- (config! (id :doc-lb) :model doc-lb-value-list)
+ (config! (id :doc-lb)
+ :model doc-lb-value-list
+ :drag-enabled? true
+ :drop-mode :insert
+ :transfer-handler
+ (seesaw.dnd/default-transfer-handler
+ :import [seesaw.dnd/string-flavor
+ (fn [{:keys [target data drop? drop-location] :as m}]
+ ;; Ignore anything dropped onto the list that is
+ ;; not in the original set of list elements.
+ (if (and drop?
+ (:insert? drop-location)
+ (:index drop-location)
+ (doc-lb-value-set data))
+ (let [new-order (list-with-elem-at-index
+ @doc-lb-cur-order data
+ (:index drop-location))]
+ (reset! doc-lb-cur-order new-order)
+ (config! target :model new-order))))]
+ :export {:actions (constantly :copy)
+ :start (fn [c] [seesaw.dnd/string-flavor (selection c)])}))
(config! (id :edit-btn) :enabled? false)
(config! (id :browse-btn) :enabled? false)
(config! (id :clojuredocs-online-rb) :selected? true)

0 comments on commit ef12a4d

Please sign in to comment.
Something went wrong with that request. Please try again.