   (:import [javax.swing DefaultListModel JFrame JList JPanel JTable DefaultListSelectionModel
                         JScrollPane JViewport ListSelectionModel SpringLayout]
            [javax.swing.event CellEditorListener ListSelectionListener]
+           [java.awt.event MouseAdapter]
            [javax.swing.table AbstractTableModel]
            [java.awt Color Dimension])
   (:use [org.micromanager.mm :only [load-mm gui core edt get-config]]))
-
-(def widgets (atom nil))
-
-(defn get-selected-group []
-  (let [row (.getSelectedRow (@widgets :groups-table))]
-    (when (<= 0 row)
-      (nth @groups row))))
 
 ;; swing layout 
 

        ;TODO: finish
        )))

(defn link-table-row-selection [table-src table-dest]
  (let [model (proxy [DefaultListSelectionModel] [])]
    ;TODO: Fix!
    (.setListSelectionModel table-src model)
    (.setListSelectionModel table-dest model)))
  
(defn require-single-selection [table]
  (.. table getSelectionModel (setSelectionMode ListSelectionModel/SINGLE_SELECTION)))

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


(def group-data (atom nil))

(def widgets (atom nil))

(defn get-selected-group []
  (let [row (.getSelectedRow (@widgets :groups-table))]
    (when (<= 0 row)
      (nth @groups row))))


(defn update-group-data []
    (reset! group-data 
            (when-let [group (get-selected-group)]
