 
 (load-mm)
 
-(defn update-list [list data]
-  (let [model (.getModel list)]
-    (.clear model)
-    (doseq [datum data]
-      (.addElement model datum)))
-  list)
-
-(defn groups []
-  (sort (seq (core getAvailableConfigGroups))))
-
-(defn update-group-list [list]
-  (update-list list (sort (seq (core getAvailableConfigGroups)))))
-
-(defn group-list []
-  (update-group-list (JList. (DefaultListModel.))))
+(def groups (atom nil))
+
+(defn update-groups []
+  (reset! groups (seq (core getAvailableConfigGroups)))
+  (.refreshGUI gui))
 
 (defn presets [group]
   (when-not (empty? group)

  
(defn group-table-model []
  (proxy [AbstractTableModel] []
    (getColumnCount [] 1)
    (getRowCount [] (count (groups)))
    (isCellEditable [_ _] true)
    (getValueAt [row column] (nth (groups) row))
    (setValueAt [val row column]
      (let [old-val (nth (groups) row)]
        (println old-val val row column)
        (core renameConfigGroup old-val val)))))

(defn show []
  (let [f (JFrame. "Micro-Manager Configuration Preset Editor")


(defn add-group [components group]
  (core defineConfigGroup group)
 ; (update-groups-table (:groups-table components))
  )

(defn rename-group [components group-old group-new]
  (core renameConfigGroup group-old group-new)
  ;(update-groups-table (:groups-table components))
  )

(defn delete-group [components group]
  (core deleteConfigGroup group)
  ;(update-groups-table (:groups-table components))
  )

;; editing presets
