/**
 * 
 */
package net.sf.taverna.t2.component.ui.preference;

import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.TreeMap;

import javax.swing.table.DefaultTableModel;

import net.sf.taverna.t2.component.api.Registry;

/**
 * @author alanrw
 * 
 */
public class RegistryTableModel extends DefaultTableModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7789666945764974370L;
	private SortedMap<String, Registry> registryMap = new TreeMap<String, Registry>();

	public RegistryTableModel() {
		super(new String[] { "Registry name", "Registry location" }, 0);
	}

	public void setRegistryMap(SortedMap<String, Registry> registries) {
		registryMap.clear();
		registryMap.putAll(registries);
		updateRows();
	}

	public void updateRows() {
		super.setRowCount(0);
		for (Entry<String, Registry> entry : registryMap.entrySet()) {
			super.addRow(new Object[] { entry.getKey(),
					entry.getValue().getRegistryBase().toExternalForm() });
		}
	}

	public boolean isCellEditable(int row, int column) {
		return false;
	}

	public void removeRow(int row) {
		String key = (String) super.getValueAt(row, 0);
		registryMap.remove(key);
		super.removeRow(row);
	}

	public void insertRegistry(String name, Registry newRegistry) {
		registryMap.put(name, newRegistry);
		updateRows();
	}

	/**
	 * @return the registryMap
	 */
	public SortedMap<String, Registry> getRegistryMap() {
		return registryMap;
	}

}

@@ -328,24 +328,8 @@
 el %7B
-%0A%0A%09/**%0A%09 * %0A%09 */
 %0A%09pr
@@ -842,18 +842,16 @@
 rySet())
- %7B
 %0A%09%09%09supe
@@ -916,54 +916,37 @@
 e().
-getRegistryBase().toExternalForm() %7D);%0A%09%09%7D%0A%09%7D%0A
+toString() %7D);%0A%09%7D%0A%0A%09@Override
 %0A%09pu
@@ -1012,24 +1012,35 @@
  false;%0A%09%7D%0A%0A
+%09@Override%0A
 %09public void

Improve logging/reporting.