Index: trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java	(revision 3140)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java	(revision 3141)
@@ -7,5 +7,4 @@
 
 import javax.swing.BorderFactory;
-import javax.swing.DefaultListSelectionModel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -27,9 +26,6 @@
         setLayout(new BorderLayout());
         setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-        DefaultListSelectionModel rowSelectionModel = new DefaultListSelectionModel();
-        DefaultListSelectionModel colSelectionModel = new DefaultListSelectionModel();
-
-        model = new TagEditorModel(rowSelectionModel, colSelectionModel);
-        tblTags = new TagTable(model, rowSelectionModel, colSelectionModel);
+        model = new TagEditorModel();
+        tblTags = new TagTable(model);
         tblTags.setEnabled(false);
         add(new JScrollPane(tblTags), BorderLayout.CENTER);
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 3140)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 3141)
@@ -24,4 +24,5 @@
 import org.openstreetmap.josm.data.osm.TagCollection;
 import org.openstreetmap.josm.data.osm.Tagged;
+import org.openstreetmap.josm.tools.CheckParameterUtil;
 
 /**
@@ -37,18 +38,41 @@
 
     /** the list holding the tags */
-    protected ArrayList<TagModel> tags = null;
+    protected final ArrayList<TagModel> tags =new ArrayList<TagModel>();
 
     /** indicates whether the model is dirty */
     private boolean dirty =  false;
-    private PropertyChangeSupport propChangeSupport = null;
+    private final PropertyChangeSupport propChangeSupport = new PropertyChangeSupport(this);
+
     private DefaultListSelectionModel rowSelectionModel;
     private DefaultListSelectionModel colSelectionModel;
 
     /**
-     * constructor
-     */
-    public TagEditorModel(DefaultListSelectionModel rowSelectionModel, DefaultListSelectionModel colSelectionModel){
-        tags = new ArrayList<TagModel>();
-        propChangeSupport = new PropertyChangeSupport(this);
+     * Creates a new tag editor model. Internally allocates two selection models
+     * for row selection and column selection.
+     * 
+     * To create a {@see JTable} with this model:
+     * <pre>
+     *    TagEditorModel model = new TagEditorModel();
+     *    TagTable tbl  = new TagTabel(model);
+     * </pre>
+     * 
+     * @see #getRowSelectionModel()
+     * @see #getColumnSelectionModel()
+     */
+    public TagEditorModel() {
+        this.rowSelectionModel = new DefaultListSelectionModel();
+        this.colSelectionModel  = new DefaultListSelectionModel();
+    }
+    /**
+     * Creates a new tag editor model.
+     * 
+     * @param rowSelectionModel the row selection model. Must not be null.
+     * @param colSelectionModel the column selection model. Must not be null.
+     * @throws IllegalArgumentException thrown if {@code rowSelectionModel} is null
+     * @throws IllegalArgumentException thrown if {@code colSelectionModel} is null
+     */
+    public TagEditorModel(DefaultListSelectionModel rowSelectionModel, DefaultListSelectionModel colSelectionModel) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(rowSelectionModel, "rowSelectionModel");
+        CheckParameterUtil.ensureParameterNotNull(colSelectionModel, "colSelectionModel");
         this.rowSelectionModel = rowSelectionModel;
         this.colSelectionModel  = colSelectionModel;
@@ -57,4 +81,22 @@
     public void addPropertyChangeListener(PropertyChangeListener listener) {
         propChangeSupport.addPropertyChangeListener(listener);
+    }
+
+    /**
+     * Replies the row selection model used by this tag editor model
+     * 
+     * @return the row selection model used by this tag editor model
+     */
+    public DefaultListSelectionModel getRowSelectionModel() {
+        return rowSelectionModel;
+    }
+
+    /**
+     * Replies the column selection model used by this tag editor model
+     * 
+     * @return the column selection model used by this tag editor model
+     */
+    public DefaultListSelectionModel getColumnSelectionModel() {
+        return colSelectionModel;
     }
 
@@ -167,9 +209,10 @@
         if (tag == null) {
             tag = new TagModel(name, value);
-            add(tag);
+            tags.add(tag);
         } else {
             tag.addValue(value);
         }
         setDirty(true);
+        fireTableDataChanged();
     }
 
@@ -306,5 +349,5 @@
         for (String key : primitive.keySet()) {
             String value = primitive.get(key);
-            add(key,value);
+            this.tags.add(new TagModel(key,value));
         }
         TagModel tag = new TagModel();
@@ -323,8 +366,8 @@
         for (String key : tags.keySet()) {
             String value = tags.get(key);
-            add(key,value);
-        }
+            this.tags.add(new TagModel(key,value));
+        }
+        sort();
         TagModel tag = new TagModel();
-        sort();
         this.tags.add(tag);
         setDirty(false);
@@ -345,5 +388,5 @@
         for (String key : tags.getKeys()) {
             String value = tags.getJoinedValues(key);
-            add(key,value);
+            this.tags.add(new TagModel(key,value));
         }
         sort();
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java	(revision 3140)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java	(revision 3141)
@@ -9,5 +9,4 @@
 
 import javax.swing.BoxLayout;
-import javax.swing.DefaultListSelectionModel;
 import javax.swing.JButton;
 import javax.swing.JPanel;
@@ -17,4 +16,5 @@
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionCache;
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList;
+import org.openstreetmap.josm.tools.CheckParameterUtil;
 
 /**
@@ -42,12 +42,6 @@
      */
     protected JPanel buildTagTableEditorPanel() {
-
         JPanel pnl = new JPanel();
-        DefaultListSelectionModel rowSelectionModel = new DefaultListSelectionModel();
-        DefaultListSelectionModel colSelectionModel = new DefaultListSelectionModel();
-
-        model = new TagEditorModel(rowSelectionModel, colSelectionModel);
-        tagTable = new TagTable(model, rowSelectionModel, colSelectionModel);
-
+        tagTable = new TagTable(model);
         pnl.setLayout(new BorderLayout());
         pnl.add(new JScrollPane(tagTable), BorderLayout.CENTER);
@@ -107,7 +101,22 @@
 
     /**
-     * constructor
+     * Creates a new tag editor panel. The editor model is created
+     * internally and can be retrieved with {@see #getModel()}.
      */
     public TagEditorPanel() {
+        this(null);
+    }
+
+    /**
+     * Creates a new tag editor panel with a supplied model. If
+     * {@code model} is null, a new model is created.
+     * 
+     * @param model the tag editor model
+     */
+    public TagEditorPanel(TagEditorModel model) {
+        this.model = model;
+        if (this.model == null) {
+            this.model = new TagEditorModel();
+        }
         build();
     }
@@ -122,5 +131,14 @@
     }
 
-    public void initAutoCompletion(OsmDataLayer layer) {
+    /**
+     * Initializes the auto completion infrastructure used in this
+     * tag editor panel. {@code layer} is the data layer from whose data set
+     * tag values are proposed as auto completion items.
+     * 
+     * @param layer the data layer. Must not be null.
+     * @throws IllegalArgumentException thrown if {@code layer} is null
+     */
+    public void initAutoCompletion(OsmDataLayer layer) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(layer, "layer");
         // initialize the autocompletion infrastructure
         //
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java	(revision 3140)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java	(revision 3141)
@@ -39,5 +39,4 @@
 import javax.swing.table.DefaultTableColumnModel;
 import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
 
 import org.openstreetmap.josm.gui.dialogs.relation.RunnableAction;
@@ -356,11 +355,10 @@
 
     /**
-     * constructor
-     *
-     * @param model
-     * @param columnModel
-     */
-    public TagTable(TableModel model, DefaultListSelectionModel rowSelectionModel, DefaultListSelectionModel colSelectionModel) {
-        super(model, new TagTableColumnModel(colSelectionModel), rowSelectionModel);
+     * Creates a new tag table
+     *
+     * @param model the tag editor model
+     */
+    public TagTable(TagEditorModel model) {
+        super(model, new TagTableColumnModel(model.getColumnSelectionModel()), model.getRowSelectionModel());
         init();
     }
