     (getValueAt [row column] (nth (nth @current-data row) column))
     (getColumnName [column] (nth tags column))))
 
-(defn add-browser-table-row [s]
-  (swap! current-data conj (vec s))
-  (let [r (dec (count @current-data))]
-    (.fireTableRowsInserted (.getModel (@browser :table)) r r)))
+(defn get-row-path [row]
+  (nth row (.indexOf tags "Path")))
+
+(defn refresh-row [rows new-row]
+  (let [changed (atom false)
+        new-path (get-row-path new-row)
+        data
+          (vec
+            (for [row rows]
+              (if (= (get-row-path row) new-path)
+                (do (reset! changed true) new-row)
+                row)))]
+    (if @changed
+      data
+      (conj data new-row))))
+
+(defn add-browser-table-row [new-row]
+  (swap! current-data refresh-row (vec new-row))
+  (.fireTableDataChanged (.getModel (@browser :table))))
 
 (defn remove-browser-table-row [n]
   (swap! current-data remove-nth n)


(defn apply-data-and-settings [settings]
  (awt-event
  (let [table (@browser :table)
        model (.getModel table)
        {:keys [browser-model-data
                browser-model-headings
                window-size display-columns
                locations sorted-column]} settings]
    (println "apply:" display-columns)
    (reset! current-data browser-model-data)
    (doto model (.fireTableDataChanged) (.fireTableStructureChanged))
    (-> @settings-window :locations :table .getModel
      (.setDataVector
        (Vector. (map #(Vector. (list %)) (seq locations)))
        (Vector. (list "Locations"))))
    (let [column-model (-> @settings-window :columns :table .getModel)]
      (doseq [row (range (.getRowCount column-model))]
        (.setValueAt column-model
          (not (nil? (some #{(.getValueAt column-model row 1)}
                           (map :title display-columns))))
          row 0))
      (show-columns display-columns)
      (update-all-columns))
    (println display-columns)
    (println window-size)
    )))

(defn save-data-and-settings [collection-name]
  (println "save-data-and-settings" collection-name)

    (gen-map frame table scroll-pane settings-button search-field
             collection-menu)))

(defn init-columns []
  (vec (map #(vec (list % false)) tags)))

(defn start-browser []
  (load-mm)
  (read-collection-map)
  (reset! settings-window (create-settings-window))
  (reset! browser (create-browser))
  (MMImageCache/addImageStorageListener (create-image-storage-listener))
  (.setModel (:table @browser) (create-browser-table-model tags))
  (load-data-and-settings (load-last-collection))
  (.show (@browser :frame))
  browser)

