Changeset 1650 in josm


Ignore:
Timestamp:
2009-06-07T15:04:28+02:00 (10 years ago)
Author:
Gubaer
Message:

added concept of "merge pairs" (my vs. merged, my vs. their, their vs. merged)
added highlighting of conflicts with colors
now displays number of entries for lists
fixed bugs

Location:
trunk
Files:
3 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/.classpath

    r1595 r1650  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
    4         <classpathentry excluding="build/|dist/|src/|test/" including="images/|presets/|styles/" kind="src" path=""/>
     4        <classpathentry kind="src" path="test/unit"/>
     5        <classpathentry kind="src" path="test/functional"/>
     6        <classpathentry excluding="build/|dist/|src/|test/|test/unit/|test/functional/" including="images/|presets/|styles/" kind="src" path=""/>
    57        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    68        <classpathentry kind="lib" path="lib/metadata-extractor-2.3.1-nosun.jar"/>
     
    911        <classpathentry kind="lib" path="lib/josm-translation.jar"/>
    1012        <classpathentry kind="lib" path="lib/gettext-commons-0.9.6.jar"/>
     13        <classpathentry kind="lib" path="test/lib/fest/debug-1.0.jar"/>
     14        <classpathentry kind="lib" path="test/lib/fest/fest-assert-1.0.jar"/>
     15        <classpathentry kind="lib" path="test/lib/fest/fest-reflect-1.1.jar"/>
     16        <classpathentry kind="lib" path="test/lib/fest/fest-swing-1.1.jar"/>
     17        <classpathentry kind="lib" path="test/lib/fest/fest-util-1.0.jar"/>
     18        <classpathentry kind="lib" path="test/lib/fest/jcip-annotations-1.0.jar"/>
     19        <classpathentry kind="lib" path="test/lib/fest/MRJToolkitStubs-1.0.jar"/>
    1120        <classpathentry kind="output" path="bin"/>
    1221</classpath>
  • trunk/.settings/org.eclipse.jdt.core.prefs

    r981 r1650  
    1 #Sun Sep 07 19:15:59 CEST 2008
     1#Sat Jun 06 11:00:10 CEST 2009
    22eclipse.preferences.version=1
    33org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
     
    101101org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
    102102org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
    103 org.eclipse.jdt.core.formatter.comment.format_block_comments=false
     103org.eclipse.jdt.core.formatter.comment.format_block_comments=true
    104104org.eclipse.jdt.core.formatter.comment.format_comments=true
    105105org.eclipse.jdt.core.formatter.comment.format_header=false
    106106org.eclipse.jdt.core.formatter.comment.format_html=false
    107 org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
    108 org.eclipse.jdt.core.formatter.comment.format_line_comments=false
     107org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
     108org.eclipse.jdt.core.formatter.comment.format_line_comments=true
    109109org.eclipse.jdt.core.formatter.comment.format_source_code=false
    110110org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
  • trunk/.settings/org.eclipse.jdt.ui.prefs

    r608 r1650  
    1 #Wed Apr 16 17:01:39 CEST 2008
     1#Sat Jun 06 11:00:10 CEST 2009
    22eclipse.preferences.version=1
    33formatter_profile=_josm
    4 formatter_settings_version=10
    5 org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">// License\: GPL. \n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">// License\: GPL. For details, see LICENSE file.\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
     4formatter_settings_version=11
     5org.eclipse.jdt.ui.javadoc=false
     6org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">// License\: GPL. \r\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">// License\: GPL. For details, see LICENSE file.\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
  • trunk/build.xml

    r1584 r1650  
    9696                <delete dir="dist" />
    9797        </target>
     98       
     99        <target name="dev-deploy" depends="dist">
     100                <copy file="dist/josm-custom.jar" todir="C:\data\projekte\osm\tag-editor-plugin"/>
     101        </target>
     102
    98103
    99104</project>
  • trunk/src/org/openstreetmap/josm/gui/conflict/ConflictResolver.java

    r1642 r1650  
    9393                tabbedPane.setIconAt(0, mergeIncomplete);
    9494            }
    95         } else if (evt.getPropertyName().equals(ListMergeModel.PROP_FROZEN)) {
     95        } else if (evt.getPropertyName().equals(ListMergeModel.FROZEN_PROP)) {
    9696            boolean frozen = (Boolean)evt.getNewValue();
    9797            if (frozen && evt.getSource() == nodeListMerger.getModel()) {
  • trunk/src/org/openstreetmap/josm/gui/conflict/ListMergeModel.java

    r1642 r1650  
    22package org.openstreetmap.josm.gui.conflict;
    33
     4import static org.openstreetmap.josm.gui.conflict.ComparePairType.MY_WITH_MERGED;
     5import static org.openstreetmap.josm.gui.conflict.ComparePairType.MY_WITH_THEIR;
     6import static org.openstreetmap.josm.gui.conflict.ComparePairType.THEIR_WITH_MERGED;
     7import static org.openstreetmap.josm.gui.conflict.ListRole.MERGED_ENTRIES;
     8import static org.openstreetmap.josm.gui.conflict.ListRole.MY_ENTRIES;
     9import static org.openstreetmap.josm.gui.conflict.ListRole.THEIR_ENTRIES;
    410import static org.openstreetmap.josm.tools.I18n.tr;
    511
     
    713import java.beans.PropertyChangeListener;
    814import java.util.ArrayList;
    9 import java.util.List;
     15import java.util.HashMap;
     16import java.util.Observable;
    1017import java.util.logging.Logger;
    1118
     19import javax.swing.AbstractListModel;
     20import javax.swing.ComboBoxModel;
    1221import javax.swing.DefaultListSelectionModel;
    1322import javax.swing.table.DefaultTableModel;
     
    3645 * ListMergeModel is an abstract class. Three methods have to be implemented by subclasses:
    3746 * <ul>
    38  *   <li>{@see ListMergeModel#cloneEntry(Object)} - clones an entry of type T</li>
     47 *   <li>{@see ListMergeModel#cloneEntryForMergedList(Object)} - clones an entry of type T</li>
    3948 *   <li>{@see ListMergeModel#isEqualEntry(Object, Object)} - checks whether two entries are equals </li>
    4049 *   <li>{@see ListMergeModel#setValueAt(DefaultTableModel, Object, int, int)} - handles values edited in
     
    4655 * @see ListMerger
    4756 */
    48 public abstract class ListMergeModel<T> {
     57public abstract class ListMergeModel<T> extends Observable {
    4958    private static final Logger logger = Logger.getLogger(ListMergeModel.class.getName());
    5059
    51     public static final String PROP_FROZEN = ListMergeModel.class.getName() + ".frozen";
    52 
    53     protected ArrayList<T> myEntries;
    54     protected ArrayList<T> theirEntries;
    55     protected ArrayList<T> mergedEntries;
    56 
     60    public static final String FROZEN_PROP = ListMergeModel.class.getName() + ".frozen";
     61
     62    protected HashMap<ListRole, ArrayList<T>> entries;
    5763
    5864    protected DefaultTableModel myEntriesTableModel;
     
    6066    protected DefaultTableModel mergedEntriesTableModel;
    6167
    62     protected EntriesSelectionModel<T> myEntriesSelectionModel;
    63     protected EntriesSelectionModel<T> theirEntriesSelectionModel;
    64     protected EntriesSelectionModel<T> mergedEntriesSelectionModel;
     68    protected EntriesSelectionModel myEntriesSelectionModel;
     69    protected EntriesSelectionModel theirEntriesSelectionModel;
     70    protected EntriesSelectionModel mergedEntriesSelectionModel;
    6571
    6672    private final ArrayList<PropertyChangeListener> listeners;
    6773    private boolean isFrozen = false;
    68 
    69     /**
    70      * Clones an entry of type T
     74    private final ComparePairListModel comparePairListModel;
     75
     76
     77
     78    /**
     79     * Creates a clone of an entry of type T suitable to be included in the
     80     * list of merged entries
     81     *
    7182     * @param entry the entry
    7283     * @return the cloned entry
    7384     */
    74     protected abstract T cloneEntry(T entry);
     85    protected abstract T cloneEntryForMergedList(T entry);
    7586
    7687    /**
     
    99110
    100111    protected void buildMyEntriesTableModel() {
    101         myEntriesTableModel = new EntriesTableModel<T>(myEntries);
     112        myEntriesTableModel = new EntriesTableModel(MY_ENTRIES);
    102113    }
    103114
    104115    protected void buildTheirEntriesTableModel() {
    105         theirEntriesTableModel = new EntriesTableModel<T>(theirEntries);
     116        theirEntriesTableModel = new EntriesTableModel(THEIR_ENTRIES);
    106117    }
    107118
    108119    protected void buildMergedEntriesTableModel() {
    109         mergedEntriesTableModel = new EntriesTableModel<T>(mergedEntries);
     120        mergedEntriesTableModel = new EntriesTableModel(MERGED_ENTRIES);
     121    }
     122
     123    protected ArrayList<T> getMergedEntries() {
     124        return entries.get(MERGED_ENTRIES);
     125    }
     126    protected ArrayList<T> getMyEntries() {
     127        return entries.get(MY_ENTRIES);
     128    }
     129    protected ArrayList<T> getTheirEntries() {
     130        return entries.get(THEIR_ENTRIES);
     131    }
     132
     133    public int getMyEntriesSize() {
     134        return getMyEntries().size();
     135    }
     136
     137    public int getMergedEntriesSize() {
     138        return getMergedEntries().size();
     139    }
     140
     141    public int getTheirEntriesSize() {
     142        return getTheirEntries().size();
    110143    }
    111144
    112145    public ListMergeModel() {
    113         myEntries = new ArrayList<T>();
    114         theirEntries = new ArrayList<T>();
    115         mergedEntries = new ArrayList<T>();
     146        entries = new HashMap<ListRole, ArrayList<T>>();
     147        for (ListRole role : ListRole.values()) {
     148            entries.put(role, new ArrayList<T>());
     149        }
    116150
    117151        buildMyEntriesTableModel();
     
    119153        buildMergedEntriesTableModel();
    120154
    121         myEntriesSelectionModel = new EntriesSelectionModel<T>(myEntries);
    122         theirEntriesSelectionModel = new EntriesSelectionModel<T>(theirEntries);
    123         mergedEntriesSelectionModel =  new EntriesSelectionModel<T>(mergedEntries);
     155        myEntriesSelectionModel = new EntriesSelectionModel(entries.get(MY_ENTRIES));
     156        theirEntriesSelectionModel = new EntriesSelectionModel(entries.get(THEIR_ENTRIES));
     157        mergedEntriesSelectionModel =  new EntriesSelectionModel(entries.get(MERGED_ENTRIES));
    124158
    125159        listeners = new ArrayList<PropertyChangeListener>();
     160        comparePairListModel = new ComparePairListModel();
    126161
    127162        setFrozen(true);
    128163    }
    129 
    130164
    131165    public void addPropertyChangeListener(PropertyChangeListener listener) {
     
    147181    protected void fireFrozenChanged(boolean oldValue, boolean newValue) {
    148182        synchronized(listeners) {
    149             PropertyChangeEvent evt = new PropertyChangeEvent(this, PROP_FROZEN, oldValue, newValue);
     183            PropertyChangeEvent evt = new PropertyChangeEvent(this, FROZEN_PROP, oldValue, newValue);
    150184            for (PropertyChangeListener listener: listeners) {
    151185                listener.propertyChange(evt);
     
    188222    }
    189223
    190 
    191224    protected void fireModelDataChanged() {
    192225        myEntriesTableModel.fireTableDataChanged();
    193226        theirEntriesTableModel.fireTableDataChanged();
    194227        mergedEntriesTableModel.fireTableDataChanged();
    195     }
    196 
    197     protected void copyToTop(List<T> source, int []rows) {
     228        setChanged();
     229        notifyObservers();
     230    }
     231
     232    protected void copyToTop(ListRole role, int []rows) {
    198233        if (rows == null || rows.length == 0)
    199234            return;
    200235        for (int i = rows.length - 1; i >= 0; i--) {
    201236            int row = rows[i];
    202             T n = source.get(row);
    203             mergedEntries.add(0, cloneEntry(n));
     237            T n = entries.get(role).get(row);
     238            entries.get(MERGED_ENTRIES).add(0, cloneEntryForMergedList(n));
    204239        }
    205240        fireModelDataChanged();
     
    215250     */
    216251    public void copyMyToTop(int [] rows) {
    217         copyToTop(myEntries, rows);
     252        copyToTop(MY_ENTRIES, rows);
    218253    }
    219254
     
    226261     */
    227262    public void copyTheirToTop(int [] rows) {
    228         copyToTop(theirEntries, rows);
     263        copyToTop(THEIR_ENTRIES, rows);
    229264    }
    230265
     
    238273     */
    239274
    240     public void copyToEnd(List<T> source, int [] rows) {
     275    public void copyToEnd(ListRole source, int [] rows) {
    241276        if (rows == null || rows.length == 0)
    242277            return;
     278        ArrayList<T> mergedEntries = getMergedEntries();
    243279        for (int row : rows) {
    244             T n = source.get(row);
    245             mergedEntries.add(cloneEntry(n));
     280            T n = entries.get(source).get(row);
     281            mergedEntries.add(cloneEntryForMergedList(n));
    246282        }
    247283        fireModelDataChanged();
     
    258294     */
    259295    public void copyMyToEnd(int [] rows) {
    260         copyToEnd(myEntries, rows);
     296        copyToEnd(MY_ENTRIES, rows);
    261297    }
    262298
     
    269305     */
    270306    public void copyTheirToEnd(int [] rows) {
    271         copyToEnd(theirEntries, rows);
     307        copyToEnd(THEIR_ENTRIES, rows);
    272308    }
    273309
     
    282318     *
    283319     */
    284     protected void copyBeforeCurrent(List<T> source, int [] rows, int current) {
     320    protected void copyBeforeCurrent(ListRole source, int [] rows, int current) {
    285321        if (rows == null || rows.length == 0)
    286322            return;
     323        ArrayList<T> mergedEntries = getMergedEntries();
    287324        if (current < 0 || current >= mergedEntries.size())
    288325            throw new IllegalArgumentException(tr("parameter current out of range: got {0}", current));
    289326        for (int i=rows.length -1; i>=0; i--) {
    290327            int row = rows[i];
    291             T n = source.get(row);
    292             mergedEntries.add(current, cloneEntry(n));
     328            T n = entries.get(source).get(row);
     329            mergedEntries.add(current, cloneEntryForMergedList(n));
    293330        }
    294331        fireModelDataChanged();
     
    306343     */
    307344    public void copyMyBeforeCurrent(int [] rows, int current) {
    308         copyBeforeCurrent(myEntries,rows,current);
     345        copyBeforeCurrent(MY_ENTRIES,rows,current);
    309346    }
    310347
     
    319356     */
    320357    public void copyTheirBeforeCurrent(int [] rows, int current) {
    321         copyBeforeCurrent(theirEntries,rows,current);
     358        copyBeforeCurrent(THEIR_ENTRIES,rows,current);
    322359    }
    323360
     
    332369     *
    333370     */
    334     protected void copyAfterCurrent(List<T> source, int [] rows, int current) {
     371    protected void copyAfterCurrent(ListRole source, int [] rows, int current) {
    335372        if (rows == null || rows.length == 0)
    336373            return;
     374        ArrayList<T> mergedEntries = getMergedEntries();
     375
    337376        if (current < 0 || current >= mergedEntries.size())
    338377            throw new IllegalArgumentException(tr("parameter current out of range: got {0}", current));
    339378        if (current == mergedEntries.size() -1) {
    340             if (source == myEntries) {
    341                 copyMyToEnd(rows);
    342             } else if (source == theirEntries) {
    343                 copyTheirToEnd(rows);
    344             }
     379            copyToEnd(source, rows);
    345380        } else {
    346381            for (int i=rows.length -1; i>=0; i--) {
    347382                int row = rows[i];
    348                 T n = source.get(row);
    349                 mergedEntries.add(current+1, cloneEntry(n));
     383                T n = entries.get(source).get(row);
     384                mergedEntries.add(current+1, cloneEntryForMergedList(n));
    350385            }
    351386        }
    352387        fireModelDataChanged();
    353388        mergedEntriesSelectionModel.setSelectionInterval(current+1, current + rows.length-1);
     389        notifyObservers();
    354390    }
    355391
     
    364400     */
    365401    public void copyMyAfterCurrent(int [] rows, int current) {
    366         copyAfterCurrent(myEntries, rows, current);
     402        copyAfterCurrent(MY_ENTRIES, rows, current);
    367403    }
    368404
     
    377413     */
    378414    public void copyTheirAfterCurrent(int [] rows, int current) {
    379         copyAfterCurrent(theirEntries, rows, current);
     415        copyAfterCurrent(THEIR_ENTRIES, rows, current);
    380416    }
    381417
     
    393429            // can't move up
    394430            return;
     431        ArrayList<T> mergedEntries = getMergedEntries();
    395432        for (int row: rows) {
    396433            T n = mergedEntries.get(row);
     
    399436        }
    400437        fireModelDataChanged();
     438        notifyObservers();
    401439        mergedEntriesSelectionModel.clearSelection();
    402440        for (int row: rows) {
     
    414452        if (rows == null || rows.length == 0)
    415453            return;
     454        ArrayList<T> mergedEntries = getMergedEntries();
    416455        if (rows[rows.length -1] == mergedEntries.size() -1)
    417456            // can't move down
     
    424463        }
    425464        fireModelDataChanged();
     465        notifyObservers();
    426466        mergedEntriesSelectionModel.clearSelection();
    427467        for (int row: rows) {
     
    439479        if (rows == null || rows.length == 0)
    440480            return;
     481
     482        ArrayList<T> mergedEntries = getMergedEntries();
     483
    441484        for (int i = rows.length-1; i>=0;i--) {
    442485            mergedEntries.remove(rows[i]);
    443486        }
    444487        fireModelDataChanged();
     488        notifyObservers();
    445489        mergedEntriesSelectionModel.clearSelection();
    446490    }
     
    454498     */
    455499    protected boolean myAndTheirEntriesEqual() {
    456         if (myEntries.size() != theirEntries.size())
     500
     501        if (getMyEntries().size() != getTheirEntries().size())
    457502            return false;
    458         for (int i=0; i < myEntries.size(); i++) {
    459             if (! isEqualEntry(myEntries.get(i), theirEntries.get(i)))
     503        for (int i=0; i < getMyEntries().size(); i++) {
     504            if (! isEqualEntry(getMyEntries().get(i), getTheirEntries().get(i)))
    460505                return false;
    461506        }
     
    464509
    465510
    466     protected class EntriesTableModel<T1> extends DefaultTableModel {
    467         private final ArrayList<T1> entries;
    468 
    469         public EntriesTableModel(ArrayList<T1> nodes) {
    470             this.entries = nodes;
     511    /**
     512     * This an adapter between a {@see JTable} and one of the three entry lists
     513     * in the role {@see ListRole} managed by the {@see ListMergeModel}.
     514     *
     515     * From the point of view of the {@see JTable} it is a {@see TableModel}.
     516     *
     517     * @param <T>
     518     * @see ListMergeModel#getMyTableModel()
     519     * @see ListMergeModel#getTheirTableModel()
     520     * @see ListMergeModel#getMergedTableModel()
     521     */
     522    public class EntriesTableModel extends DefaultTableModel {
     523        private final ListRole role;
     524
     525        /**
     526         *
     527         * @param role the role
     528         */
     529        public EntriesTableModel(ListRole role) {
     530            this.role = role;
    471531        }
    472532
    473533        @Override
    474534        public int getRowCount() {
    475             int count = myEntries.size();
    476             count = Math.max(count, mergedEntries.size());
    477             count = Math.max(count, theirEntries.size());
     535            int count = Math.max(getMyEntries().size(), getMergedEntries().size());
     536            count = Math.max(count, getTheirEntries().size());
    478537            return count;
    479538        }
     
    481540        @Override
    482541        public Object getValueAt(int row, int column) {
    483             if (row < entries.size())
    484                 return entries.get(row);
     542            if (row < entries.get(role).size())
     543                return entries.get(role).get(row);
    485544            return null;
    486545        }
     
    495554            ListMergeModel.this.setValueAt(this, value,row,col);
    496555        }
    497     }
    498 
    499     protected class EntriesSelectionModel<T1> extends DefaultListSelectionModel {
    500         private final ArrayList<T1> entries;
    501 
    502         public EntriesSelectionModel(ArrayList<T1> nodes) {
     556
     557        public ListMergeModel getListMergeModel() {
     558            return ListMergeModel.this;
     559        }
     560
     561        /**
     562         * replies true if the {@see ListRole} of this {@see EntriesTableModel}
     563         * participates in the current {@see ComparePairType}
     564         *
     565         * @return true, if the if the {@see ListRole} of this {@see EntriesTableModel}
     566         * participates in the current {@see ComparePairType}
     567         *
     568         * @see ComparePairListModel#getSelectedComparePair()
     569         */
     570        public boolean isParticipatingInCurrentComparePair() {
     571            return getComparePairListModel()
     572            .getSelectedComparePair()
     573            .isParticipatingIn(role);
     574        }
     575
     576        /**
     577         * replies true if the entry at <code>row</code> is equal to the entry at the
     578         * same position in the opposite list of the current {@see ComparePairType}.
     579         *
     580         * @param row  the row number
     581         * @return true if the entry at <code>row</code> is equal to the entry at the
     582         * same position in the opposite list of the current {@see ComparePairType}
     583         * @exception IllegalStateException thrown, if this model is not participating in the
     584         *   current  {@see ComparePairType}
     585         * @see ComparePairType#getOppositeRole(ListRole)
     586         * @see #getRole()
     587         * @see #getOppositeEntries()
     588         */
     589        public boolean isSamePositionInOppositeList(int row) {
     590            if (!isParticipatingInCurrentComparePair())
     591                throw new IllegalStateException(tr("list in role {0} is currently not participating in a compare pair", role.toString()));
     592            if (row >= getEntries().size()) return false;
     593            if (row >= getOppositeEntries().size()) return false;
     594
     595            T e1 = getEntries().get(row);
     596            T e2 = getOppositeEntries().get(row);
     597            return isEqualEntry(e1, e2);
     598        }
     599
     600        /**
     601         * replies true if the entry at the current position is present in the opposite list
     602         * of the current {@see ComparePairType}.
     603         *
     604         * @param row the current row
     605         * @return true if the entry at the current position is present in the opposite list
     606         * of the current {@see ComparePairType}.
     607         * @exception IllegalStateException thrown, if this model is not participating in the
     608         *   current  {@see ComparePairType}
     609         * @see ComparePairType#getOppositeRole(ListRole)
     610         * @see #getRole()
     611         * @see #getOppositeEntries()
     612         */
     613        public boolean isIncludedInOppositeList(int row) {
     614            if (!isParticipatingInCurrentComparePair())
     615                throw new IllegalStateException(tr("list in role {0} is currently not participating in a compare pair", role.toString()));
     616
     617            if (row >= getEntries().size()) return false;
     618            T e1 = getEntries().get(row);
     619            for (T e2: getOppositeEntries()) {
     620                if (isEqualEntry(e1, e2)) return true;
     621            }
     622            return false;
     623        }
     624
     625        protected ArrayList<T> getEntries() {
     626            return entries.get(role);
     627        }
     628
     629        /**
     630         * replies the opposite list of entries with respect to the current {@see ComparePairType}
     631         *
     632         * @return the opposite list of entries
     633         */
     634        protected ArrayList<T> getOppositeEntries() {
     635            ListRole opposite = getComparePairListModel().getSelectedComparePair().getOppositeRole(role);
     636            return entries.get(opposite);
     637        }
     638
     639        public ListRole getRole() {
     640            return role;
     641        }
     642    }
     643
     644    /**
     645     * This is the selection model to be used in a {@see JTable} which displays
     646     * an entry list managed by {@see ListMergeModel}.
     647     *
     648     * The model ensures that only rows displaying an entry in the entry list
     649     * can be selected. "Empty" rows can't be selected.
     650     *
     651     * @see ListMergeModel#getMySelectionModel()
     652     * @see ListMergeModel#getMergedSelectionModel()
     653     * @see ListMergeModel#getTheirSelectionModel()
     654     *
     655     */
     656    protected class EntriesSelectionModel extends DefaultListSelectionModel {
     657        private final ArrayList<T> entries;
     658
     659        public EntriesSelectionModel(ArrayList<T> nodes) {
    503660            this.entries = nodes;
    504661        }
     
    584741        }
    585742    }
     743
     744    public ComparePairListModel getComparePairListModel() {
     745        return this.comparePairListModel;
     746    }
     747
     748    public class ComparePairListModel extends AbstractListModel implements ComboBoxModel {
     749
     750        private  int selectedIdx;
     751        private final ArrayList<ComparePairType> compareModes;
     752
     753        public ComparePairListModel() {
     754            this.compareModes = new ArrayList<ComparePairType>();
     755            compareModes.add(MY_WITH_THEIR);
     756            compareModes.add(MY_WITH_MERGED);
     757            compareModes.add(THEIR_WITH_MERGED);
     758            selectedIdx = 0;
     759        }
     760
     761        public Object getElementAt(int index) {
     762            if (index < compareModes.size())
     763                return compareModes.get(index);
     764            throw new IllegalArgumentException(tr("unexpected value of parameter \"index\". Got {0}", index));
     765        }
     766
     767        public int getSize() {
     768            return compareModes.size();
     769        }
     770
     771        public Object getSelectedItem() {
     772            return compareModes.get(selectedIdx);
     773        }
     774
     775        public void setSelectedItem(Object anItem) {
     776            int i = compareModes.indexOf(anItem);
     777            if (i < 0)
     778                throw new IllegalStateException(tr("item {0} not found in list", anItem));
     779            selectedIdx = i;
     780            fireModelDataChanged();
     781        }
     782
     783        public ComparePairType getSelectedComparePair() {
     784            return compareModes.get(selectedIdx);
     785        }
     786    }
    586787}
  • trunk/src/org/openstreetmap/josm/gui/conflict/ListMerger.java

    r1642 r1650  
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     4import static org.openstreetmap.josm.tools.I18n.trn;
    45
    56import java.awt.Adjustable;
     
    2627import javax.swing.JButton;
    2728import javax.swing.JCheckBox;
     29import javax.swing.JComboBox;
    2830import javax.swing.JLabel;
    2931import javax.swing.JPanel;
     
    4244 * @see ListMergeModel
    4345 */
    44 public abstract class ListMerger<T> extends JPanel implements PropertyChangeListener {
     46public abstract class ListMerger<T> extends JPanel implements PropertyChangeListener, Observer {
    4547    private static final Logger logger = Logger.getLogger(ListMerger.class.getName());
    4648
     
    7274    private  JCheckBox cbLockMergedScrolling;
    7375    private  JCheckBox cbLockTheirScrolling;
     76
     77    private  JLabel lblMyVersion;
     78    private  JLabel lblMergedVersion;
     79    private  JLabel lblTheirVersion;
     80
     81
     82    private  JLabel lblFrozenState;
    7483
    7584    abstract protected JScrollPane buildMyElementsTable();
     
    204213        pnl.add(new JButton(removeMergedAction), gc);
    205214
    206         gc.gridx = 0;
    207         gc.gridy = 1;
    208         gc.gridwidth = 3;
    209         gc.weightx = 1.0;
    210         freezeAction = new FreezeAction();
    211         JToggleButton btn = new JToggleButton(freezeAction);
    212         freezeAction.adapt(btn);
    213         btn.setName("button.freeze");
    214         btn.addItemListener(freezeAction);
    215         pnl.add(btn, gc);
    216 
    217215        return pnl;
    218216    }
     
    224222        panel.add(cb);
    225223        return panel;
     224    }
     225
     226    protected JPanel buildComparePairSelectionPanel() {
     227        JPanel p = new JPanel();
     228        p.setLayout(new FlowLayout(FlowLayout.LEFT));
     229        p.add(new JLabel(tr("Compare ")));
     230        JComboBox cbComparePair =new JComboBox(model.getComparePairListModel());
     231        cbComparePair.setRenderer(new ComparePairListCellRenderer());
     232        p.add(cbComparePair);
     233        return p;
     234    }
     235
     236    protected JPanel buildFrozeStateControlPanel() {
     237        JPanel p = new JPanel();
     238        p.setLayout(new FlowLayout(FlowLayout.LEFT));
     239        lblFrozenState = new JLabel();
     240        p.add(lblFrozenState);
     241        freezeAction = new FreezeAction();
     242        JToggleButton btn = new JToggleButton(freezeAction);
     243        freezeAction.adapt(btn);
     244        btn.setName("button.freeze");
     245        p.add(btn);
     246
     247        return p;
    226248    }
    227249
     
    239261        gc.weightx = 0.0;
    240262        gc.weighty = 0.0;
    241         gc.insets = new Insets(10,0,10,0);
    242         JLabel lbl = new JLabel(tr("My version"));
    243         lbl.setToolTipText(tr("List of elements in my dataset, i.e. the local dataset"));
    244         add(lbl, gc);
     263        gc.insets = new Insets(10,0,0,0);
     264        lblMyVersion = new JLabel(tr("My version"));
     265        lblMyVersion.setToolTipText(tr("List of elements in my dataset, i.e. the local dataset"));
     266        add(lblMyVersion, gc);
    245267
    246268        gc.gridx = 2;
    247269        gc.gridy = 0;
    248         lbl = new JLabel(tr("Merged version"));
    249         lbl.setToolTipText(tr("List of merged elements. They will replace the my elements when the merge decisions are applied."));
    250         add(lbl, gc);
     270        lblMergedVersion = new JLabel(tr("Merged version"));
     271        lblMergedVersion.setToolTipText(tr("List of merged elements. They will replace the my elements when the merge decisions are applied."));
     272        add(lblMergedVersion, gc);
    251273
    252274        gc.gridx = 4;
    253275        gc.gridy = 0;
    254         lbl = new JLabel(tr("Their version"));
    255         lbl.setToolTipText(tr("List of elements in their dataset, i.e. the server dataset"));
    256         add(lbl, gc);
     276        lblTheirVersion = new JLabel(tr("Their version"));
     277        lblTheirVersion.setToolTipText(tr("List of elements in their dataset, i.e. the server dataset"));
     278        add(lblTheirVersion, gc);
    257279
    258280        // ------------------------------
     
    343365        add(buildMergedListControlButtons(), gc);
    344366
     367        // -----------------------------------
     368        gc.gridx = 0;
     369        gc.gridy = 4;
     370        gc.gridwidth = 2;
     371        gc.gridheight = 1;
     372        gc.fill = GridBagConstraints.HORIZONTAL;
     373        gc.anchor = GridBagConstraints.LINE_START;
     374        gc.weightx = 0.0;
     375        gc.weighty = 0.0;
     376        add(buildComparePairSelectionPanel(), gc);
     377
     378        gc.gridx = 2;
     379        gc.gridy = 4;
     380        gc.gridwidth = 3;
     381        gc.gridheight = 1;
     382        gc.fill = GridBagConstraints.HORIZONTAL;
     383        gc.anchor = GridBagConstraints.LINE_START;
     384        gc.weightx = 0.0;
     385        gc.weighty = 0.0;
     386        add(buildFrozeStateControlPanel(), gc);
     387
     388
    345389        wireActionsToSelectionModels();
    346390    }
     
    348392    public ListMerger(ListMergeModel<T> model) {
    349393        this.model = model;
     394        model.addObserver(this);
    350395        build();
    351396        model.addPropertyChangeListener(this);
     
    714759            int state = e.getStateChange();
    715760            if (state == ItemEvent.SELECTED) {
    716                 model.setFrozen(true);
    717761                putValue(Action.NAME, tr("Unfreeze"));
    718762                putValue(Action.SHORT_DESCRIPTION, tr("Unfreeze the list of merged elements and start merging"));
     763                model.setFrozen(true);
    719764            } else if (state == ItemEvent.DESELECTED) {
    720                 model.setFrozen(false);
    721765                putValue(Action.NAME, tr("Freeze"));
    722766                putValue(Action.SHORT_DESCRIPTION, tr("Freeze the current list of merged elements"));
     767                model.setFrozen(false);
    723768            }
    724769            boolean isSelected = (Boolean)getValue(PROP_SELECTED);
     
    737782        mergedEntriesTable.getSelectionModel().clearSelection();
    738783        mergedEntriesTable.setEnabled(!newValue);
    739         freezeAction.putValue(FreezeActionProperties.PROP_SELECTED, newValue);
    740     }
    741 
     784        if (freezeAction != null) {
     785            freezeAction.putValue(FreezeActionProperties.PROP_SELECTED, newValue);
     786        }
     787        if (newValue) {
     788            lblFrozenState.setText(
     789                    tr("<html>Click <strong>{0}</strong> to start merging my and their entries</html>",
     790                            freezeAction.getValue(Action.NAME))
     791            );
     792        } else {
     793            lblFrozenState.setText(
     794                    tr("<html>Click <strong>{0}</strong> to finish merging my and their entries</html>",
     795                            freezeAction.getValue(Action.NAME))
     796            );
     797        }
     798    }
    742799
    743800    public void propertyChange(PropertyChangeEvent evt) {
    744         if (evt.getPropertyName().equals(ListMergeModel.PROP_FROZEN)) {
     801        if (evt.getPropertyName().equals(ListMergeModel.FROZEN_PROP)) {
    745802            handlePropertyChangeFrozen((Boolean)evt.getOldValue(), (Boolean)evt.getNewValue());
    746803        }
     
    749806    public ListMergeModel<T> getModel() {
    750807        return model;
     808    }
     809
     810
     811    public void update(Observable o, Object arg) {
     812        lblMyVersion.setText(
     813                tr("My version ")
     814                + trn("({0} entry)", "({0} entries)", model.getMyEntriesSize(), model.getMyEntriesSize())
     815        );
     816        lblMergedVersion.setText(
     817                tr("Merged version ")
     818                + trn("({0} entry)", "({0} entries)", model.getMergedEntriesSize(), model.getMergedEntriesSize())
     819        );
     820        lblTheirVersion.setText(
     821                tr("Their version ")
     822                + trn("({0} entry)", "({0} entries)", model.getTheirEntriesSize(), model.getTheirEntriesSize())
     823        );
    751824    }
    752825
  • trunk/src/org/openstreetmap/josm/gui/conflict/nodes/NodeListColumnModel.java

    r1642 r1650  
    1717        col = new TableColumn(0);
    1818        col.setHeaderValue("");
    19         col.setResizable(false);
     19        col.setResizable(true);
    2020        col.setWidth(30);
    21         col.setMaxWidth(30);
     21        col.setPreferredWidth(30);
    2222        col.setCellRenderer(renderer);
    2323        addColumn(col);
  • trunk/src/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModel.java

    r1631 r1650  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.conflict.nodes;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import java.util.ArrayList;
     
    1113import org.openstreetmap.josm.data.osm.Way;
    1214import org.openstreetmap.josm.gui.conflict.ListMergeModel;
     15import org.openstreetmap.josm.gui.conflict.ListRole;
    1316
    1417public class NodeListMergeModel extends ListMergeModel<Node>{
     
    2831    public void populate(Way my, Way their) {
    2932        if (my == null)
    30             throw new IllegalArgumentException("parameter 'way' must not be null");
     33            throw new IllegalArgumentException(tr("parameter \"way\" must not be null"));
    3134        if (their == null)
    32             throw new IllegalArgumentException("parameter 'their' must not be null");
    33         mergedEntries.clear();
    34         myEntries.clear();
    35         theirEntries.clear();
     35            throw new IllegalArgumentException(tr("parameter \"their\" must not be null"));
     36        getMergedEntries().clear();
     37        getMyEntries().clear();
     38        getTheirEntries().clear();
    3639        for (Node n : my.nodes) {
    37             myEntries.add(n);
     40            getMyEntries().add(n);
    3841        }
    3942        for (Node n : their.nodes) {
    40             theirEntries.add(n);
     43            getTheirEntries().add(n);
    4144        }
    4245        if (myAndTheirEntriesEqual()) {
    43             mergedEntries = new ArrayList<Node>(myEntries);
     46            entries.put(ListRole.MERGED_ENTRIES, new ArrayList<Node>(getMyEntries()));
    4447            setFrozen(true);
    4548        } else {
     
    6265    public WayNodesConflictResolverCommand buildResolveCommand(Way my, Way their) {
    6366        if (my == null)
    64             throw new IllegalArgumentException("parameter my most not be null");
     67            throw new IllegalArgumentException(tr("parameter \"my\" most not be null"));
    6568        if (their == null)
    66             throw new IllegalArgumentException("parameter my most not be null");
     69            throw new IllegalArgumentException(tr("parameter \"my\" most not be null"));
    6770        if (! isFrozen())
    68             throw new IllegalArgumentException("merged nodes not frozen yet. Can't build resolution command");
    69         return new WayNodesConflictResolverCommand(my, their, mergedEntries);
     71            throw new IllegalArgumentException(tr("Merged nodes not frozen yet. Can't build resolution command"));
     72        return new WayNodesConflictResolverCommand(my, their, getMergedEntries());
    7073    }
    7174
     
    7376    @Override
    7477    public boolean isEqualEntry(Node e1, Node e2) {
    75         return e1.id == e2.id;
     78        if (e1.id > 0)
     79            return e1.id == e2.id;
     80        else
     81            return e1 == e2;
    7682    }
    7783
     
    8288
    8389    @Override
    84     protected Node cloneEntry(Node entry) {
    85         Node n = new Node(entry.id);
    86         n.cloneFrom(entry);
    87         return n;
     90    protected Node cloneEntryForMergedList(Node entry) {
     91        return entry;
    8892    }
    8993}
  • trunk/src/org/openstreetmap/josm/gui/conflict/nodes/NodeListTableCellRenderer.java

    r1642 r1650  
    77import java.awt.Component;
    88import java.text.DecimalFormat;
     9import java.util.ArrayList;
     10import java.util.Collections;
     11import java.util.logging.Logger;
    912
    1013import javax.swing.BorderFactory;
     
    1619
    1720import org.openstreetmap.josm.data.osm.Node;
     21import org.openstreetmap.josm.data.osm.OsmPrimitive;
     22import org.openstreetmap.josm.gui.conflict.ListMergeModel;
    1823import org.openstreetmap.josm.tools.ImageProvider;
    1924
     
    2328 */
    2429public  class NodeListTableCellRenderer extends JLabel implements TableCellRenderer {
     30    static private final Logger logger = Logger.getLogger(NodeListTableCellRenderer.class.getName());
    2531    private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000");
    2632    public final static Color BGCOLOR_SELECTED = new Color(143,170,255);
    2733    public final static Color BGCOLOR_EMPTY_ROW = new Color(234,234,234);
    28 
    29     private ImageIcon icon = null;
    30     private Border rowNumberBorder = null;
     34    public final static Color BGCOLOR_FROZEN = new Color(234,234,234);
     35    public final static Color BGCOLOR_PARTICIPAING_IN_COMPARISON = Color.BLACK;
     36    public final static Color FGCOLOR_PARTICIPAING_IN_COMPARISON = Color.WHITE;
     37
     38    public final static Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255,197,197);
     39    public final static Color BGCOLOR_IN_OPPOSITE = new Color(255,234,213);
     40    public final static Color BGCOLOR_SAME_POSITION_IN_OPPOSITE = new Color(217,255,217);
     41
     42    private final ImageIcon icon;
     43    private final Border rowNumberBorder;
    3144
    3245    /**
     
    6881    }
    6982
     83
     84    public String buildToolTipText(OsmPrimitive primitive) {
     85        StringBuilder sb = new StringBuilder();
     86        sb.append("<html>");
     87        sb.append("<strong>id</strong>=")
     88        .append(primitive.id)
     89        .append("<br>");
     90        ArrayList<String> keyList = new ArrayList<String>(primitive.keySet());
     91        Collections.sort(keyList);
     92        for (int i = 0; i < keyList.size(); i++) {
     93            if (i > 0) {
     94                sb.append("<br>");
     95            }
     96            String key = keyList.get(i);
     97            sb.append("<strong>")
     98            .append(key)
     99            .append("</strong>")
     100            .append("=");
     101            String value = primitive.get(key);
     102            while(value.length() != 0) {
     103                sb.append(value.substring(0,Math.min(50, value.length())));
     104                if (value.length() > 50) {
     105                    sb.append("<br>");
     106                    value = value.substring(50);
     107                } else {
     108                    value = "";
     109                }
     110            }
     111        }
     112        sb.append("</html>");
     113        return sb.toString();
     114    }
     115
    70116    /**
    71117     * reset the renderer
     
    76122    }
    77123
     124
     125
    78126    /**
    79127     * render a node
     128     * @param model  the model
    80129     * @param node the node
    81      * @param isSelected
    82      */
    83     protected  void renderNode(Node node, boolean isSelected) {
     130     * @param isSelected true, if the current row is selected
     131     */
     132    protected  void renderNode(ListMergeModel<Node>.EntriesTableModel model, Node node, int row, boolean isSelected) {
    84133        setIcon(icon);
    85134        setBorder(null);
    86         if (isSelected) {
     135        if (model.getListMergeModel().isFrozen()) {
     136            setBackground(BGCOLOR_FROZEN);
     137        } else if (isSelected) {
    87138            setBackground(BGCOLOR_SELECTED);
     139        } else if (model.isParticipatingInCurrentComparePair()) {
     140            if (model.isSamePositionInOppositeList(row)) {
     141                setBackground(BGCOLOR_SAME_POSITION_IN_OPPOSITE);
     142            } else if (model.isIncludedInOppositeList(row)) {
     143                setBackground(BGCOLOR_IN_OPPOSITE);
     144            } else {
     145                setBackground(BGCOLOR_NOT_IN_OPPOSITE);
     146            }
    88147        }
    89148        setText(getDisplayName(node));
    90     }
    91 
     149        setToolTipText(buildToolTipText(node));
     150    }
     151
     152    /**
     153     * render an empty row
     154     */
    92155    protected void renderEmptyRow() {
    93156        setIcon(null);
     
    98161    /**
    99162     * render the row id
     163     * @param model  the model
    100164     * @param row the row index
    101      * @param isSelected
    102      */
    103     protected  void renderRowId(int row, boolean isSelected) {
     165     * @param isSelected true, if the current row is selected
     166     */
     167    protected  void renderRowId( ListMergeModel<Node>.EntriesTableModel model, int row, boolean isSelected) {
    104168        setIcon(null);
    105169        setBorder(rowNumberBorder);
    106         if (isSelected) {
    107             setBackground(BGCOLOR_SELECTED);
     170        if (model.getListMergeModel().isFrozen()) {
     171            setBackground(BGCOLOR_FROZEN);
     172        } else if (model.isParticipatingInCurrentComparePair()) {
     173            setBackground(BGCOLOR_PARTICIPAING_IN_COMPARISON);
     174            setForeground(FGCOLOR_PARTICIPAING_IN_COMPARISON);
    108175        }
    109176        setText(Integer.toString(row+1));
     
    117184        switch(column) {
    118185        case 0:
    119             renderRowId(row, isSelected);
     186            renderRowId(getModel(table),row, isSelected);
    120187            break;
    121188        case 1:
     
    123190                renderEmptyRow();
    124191            } else {
    125                 renderNode(node,isSelected);
     192                renderNode(getModel(table), node, row, isSelected);
    126193            }
    127194            break;
     
    132199        return this;
    133200    }
     201
     202    /**
     203     * replies the model
     204     * @param table  the table
     205     * @return the table model
     206     */
     207    protected ListMergeModel<Node>.EntriesTableModel getModel(JTable table) {
     208        return (ListMergeModel.EntriesTableModel)table.getModel();
     209    }
    134210}
  • trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberListColumnModel.java

    r1642 r1650  
    1616        col = new TableColumn(0);
    1717        col.setHeaderValue("");
    18         col.setResizable(false);
     18        col.setResizable(true);
    1919        col.setWidth(20);
    20         col.setMaxWidth(20);
     20        col.setPreferredWidth(20);
    2121        col.setCellRenderer(renderer);
    2222        addColumn(col);
  • trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberListMergeModel.java

    r1642 r1650  
    99
    1010import org.openstreetmap.josm.command.RelationMemberConflictResolverCommand;
    11 import org.openstreetmap.josm.data.osm.Node;
    1211import org.openstreetmap.josm.data.osm.Relation;
    1312import org.openstreetmap.josm.data.osm.RelationMember;
    14 import org.openstreetmap.josm.data.osm.Way;
    1513import org.openstreetmap.josm.gui.conflict.ListMergeModel;
     14import org.openstreetmap.josm.gui.conflict.ListRole;
    1615/**
    1716 * The model for merging two lists of relation members
     
    2524    @Override
    2625    public boolean isEqualEntry(RelationMember e1, RelationMember e2) {
    27         return
    28         (    (e1.role == null && e2.role == null)
    29                 || (e1.role != null && e1.role.equals(e2.role))
    30         )
    31         && e1.member.id == e2.member.id;
     26        boolean ret =
     27            (    (e1.role == null && e2.role == null)
     28                    || (e1.role != null && e1.role.equals(e2.role))
     29            );
     30        if (e1.member.id > 0 ) {
     31            ret = ret && (e1.member.id == e2.member.id);
     32        } else {
     33            ret = ret && (e1 == e2);
     34        }
     35        return ret;
    3236    }
    3337
     
    3741        // editing cells in the first column
    3842        //
    39         mergedEntriesTableModel = this.new EntriesTableModel<RelationMember>(mergedEntries) {
     43        mergedEntriesTableModel = this.new EntriesTableModel(ListRole.MERGED_ENTRIES) {
    4044            @Override
    4145            public boolean isCellEditable(int row, int column) {
     
    5155    protected void setValueAt(DefaultTableModel model, Object value, int row, int col) {
    5256        if (model == getMergedTableModel() && col == 1) {
    53             RelationMember member = mergedEntries.get(row);
     57            RelationMember member = getMergedEntries().get(row);
    5458            member.role = (String)value;
    5559            fireModelDataChanged();
     
    7276            throw new IllegalArgumentException(tr("parameter their must not be null"));
    7377
    74         mergedEntries.clear();
    75         myEntries.clear();
    76         theirEntries.clear();
     78        getMergedEntries().clear();
     79        getMyEntries().clear();
     80        getTheirEntries().clear();
    7781
    7882        for (RelationMember n : my.members) {
    79             myEntries.add(n);
     83            getMyEntries().add(n);
    8084        }
    8185        for (RelationMember n : their.members) {
    82             theirEntries.add(n);
     86            getTheirEntries().add(n);
    8387        }
    8488        if (myAndTheirEntriesEqual()) {
    85             for (RelationMember m : myEntries) {
    86                 mergedEntries.add(cloneEntry(m));
     89            for (RelationMember m : getMyEntries()) {
     90                getMergedEntries().add(cloneEntryForMergedList(m));
    8791            }
    8892            setFrozen(true);
     
    9599
    96100    @Override
    97     protected RelationMember cloneEntry(RelationMember entry) {
     101    protected RelationMember cloneEntryForMergedList(RelationMember entry) {
    98102        RelationMember member = new RelationMember();
    99103        member.role = entry.role;
    100         if (entry.member instanceof Node) {
    101             member.member = new Node(entry.member.id);
    102         } else if (entry.member instanceof Way) {
    103             member.member = new Way(entry.member.id);
    104         } else if (entry.member instanceof Relation) {
    105             member.member = new Relation(entry.member.id);
    106         }
    107         member.member.cloneFrom(entry.member);
     104        member.member = entry.member;
    108105        return member;
    109106    }
     
    126123        if (! isFrozen())
    127124            throw new IllegalArgumentException(tr("merged nodes not frozen yet. Can't build resolution command"));
    128         return new RelationMemberConflictResolverCommand(my, their, mergedEntries);
     125        return new RelationMemberConflictResolverCommand(my, their, getMergedEntries());
    129126    }
    130127}
  • trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberTableCellRenderer.java

    r1642 r1650  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.conflict.relation;
    3 
    4 import static org.openstreetmap.josm.tools.I18n.tr;
    53
    64import java.awt.Color;
    75import java.awt.Component;
    86import java.text.DecimalFormat;
     7import java.util.ArrayList;
     8import java.util.Collections;
    99
    1010import javax.swing.BorderFactory;
     
    2020import org.openstreetmap.josm.data.osm.RelationMember;
    2121import org.openstreetmap.josm.data.osm.Way;
     22import org.openstreetmap.josm.gui.conflict.ListMergeModel;
    2223import org.openstreetmap.josm.tools.ImageProvider;
    2324
     
    3132    public final static Color BGCOLOR_EMPTY_ROW = new Color(234,234,234);
    3233
     34    public final static Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255,197,197);
     35    public final static Color BGCOLOR_IN_OPPOSITE = new Color(255,234,213);
     36    public final static Color BGCOLOR_SAME_POSITION_IN_OPPOSITE = new Color(217,255,217);
     37
     38    public final static Color BGCOLOR_PARTICIPAING_IN_COMPARISON = Color.BLACK;
     39    public final static Color FGCOLOR_PARTICIPAING_IN_COMPARISON = Color.WHITE;
     40
     41    public final static Color BGCOLOR_FROZEN = new Color(234,234,234);
     42
    3343    private ImageIcon nodeIcon;
    3444    private ImageIcon wayIcon;
     
    5767    }
    5868
     69
     70    public String buildToolTipText(OsmPrimitive primitive) {
     71        StringBuilder sb = new StringBuilder();
     72        sb.append("<html>");
     73        sb.append("<strong>id</strong>=")
     74        .append(primitive.id)
     75        .append("<br>");
     76        ArrayList<String> keyList = new ArrayList<String>(primitive.keySet());
     77        Collections.sort(keyList);
     78        for (int i = 0; i < keyList.size(); i++) {
     79            if (i > 0) {
     80                sb.append("<br>");
     81            }
     82            String key = keyList.get(i);
     83            sb.append("<strong>")
     84            .append(key)
     85            .append("</strong>")
     86            .append("=");
     87            String value = primitive.get(key);
     88            while(value.length() != 0) {
     89                sb.append(value.substring(0,Math.min(50, value.length())));
     90                if (value.length() > 50) {
     91                    sb.append("<br>");
     92                    value = value.substring(50);
     93                } else {
     94                    value = "";
     95                }
     96            }
     97        }
     98        sb.append("</html>");
     99        return sb.toString();
     100    }
     101
    59102    /**
    60103     * creates the display name for a node. The name is derived from the nodes id,
     
    67110        StringBuilder sb = new StringBuilder();
    68111        OsmPrimitive primitive = member.member;
    69         if (primitive instanceof Node) {
    70             sb.append(tr("Node"));
    71         } else if (primitive instanceof Way) {
    72             sb.append(tr("Way"));
    73         } else if (primitive instanceof Relation) {
    74             sb.append(tr("Relation"));
    75         }
    76         sb.append(" ");
    77112        if (primitive.get("name") != null) {
    78113            sb.append(primitive.get("name"));
     
    110145
    111146
    112     protected void setBackground(boolean isSelected) {
    113         Color bgc = isSelected ?  BGCOLOR_SELECTED : Color.WHITE;
     147    protected void renderBackground(ListMergeModel<Node>.EntriesTableModel model, RelationMember member, int row, int col, boolean isSelected) {
     148        Color bgc = Color.WHITE;
     149        if (col == 0) {
     150            if (model.getListMergeModel().isFrozen()) {
     151                bgc = BGCOLOR_FROZEN;
     152            } else if (model.isParticipatingInCurrentComparePair()) {
     153                bgc = BGCOLOR_PARTICIPAING_IN_COMPARISON;
     154            } else if (isSelected) {
     155                bgc = BGCOLOR_SELECTED;
     156            }
     157        } else {
     158            if (model.getListMergeModel().isFrozen()) {
     159                bgc = BGCOLOR_FROZEN;
     160            } else if (member == null) {
     161                bgc = BGCOLOR_EMPTY_ROW;
     162            } else if (isSelected) {
     163                bgc = BGCOLOR_SELECTED;
     164            } else {
     165                if (model.isParticipatingInCurrentComparePair()) {
     166                    if (model.isSamePositionInOppositeList(row)) {
     167                        bgc = BGCOLOR_SAME_POSITION_IN_OPPOSITE;
     168                    } else if (model.isIncludedInOppositeList(row)) {
     169                        bgc = BGCOLOR_IN_OPPOSITE;
     170                    } else {
     171                        bgc = BGCOLOR_NOT_IN_OPPOSITE;
     172                    }
     173                }
     174            }
     175        }
    114176        setBackground(bgc);
     177    }
     178
     179    protected void renderForeground(ListMergeModel<Node>.EntriesTableModel model, RelationMember member, int row, int col, boolean isSelected) {
     180        Color fgc = Color.BLACK;
     181        if (col == 0 && model.isParticipatingInCurrentComparePair() && ! model.getListMergeModel().isFrozen()) {
     182            fgc = Color.WHITE;
     183        }
     184        setForeground(fgc);
    115185    }
    116186
     
    123193        String displayName = getDisplayName(member);
    124194        setText(displayName);
    125         setToolTipText(displayName);
     195        setToolTipText(buildToolTipText(member.member));
    126196        if (member.member instanceof Node) {
    127197            setIcon(nodeIcon);
     
    141211     * @param isSelected
    142212     */
    143     protected  void renderRowId(int row, boolean isSelected) {
     213    protected  void renderRowId(int row) {
    144214        setBorder(rowNumberBorder);
    145215        setText(Integer.toString(row+1));
     
    158228        RelationMember member = (RelationMember)value;
    159229        reset();
    160         setBackground(isSelected);
     230        renderBackground(getModel(table), member, row, column, isSelected);
     231        renderForeground(getModel(table), member, row, column, isSelected);
    161232        switch(column) {
    162233        case 0:
    163             renderRowId(row, isSelected);
     234            renderRowId(row);
    164235            break;
    165236        case 1:
     
    183254    }
    184255
     256    /**
     257     * replies the model
     258     * @param table  the table
     259     * @return the table model
     260     */
     261    protected ListMergeModel<Node>.EntriesTableModel getModel(JTable table) {
     262        return (ListMergeModel.EntriesTableModel)table.getModel();
     263    }
    185264}
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java

    r1631 r1650  
    33
    44import static org.fest.reflect.core.Reflection.field;
     5import static org.fest.reflect.core.Reflection.method;
    56import static org.junit.Assert.assertEquals;
    67import static org.junit.Assert.assertTrue;
     
    2122
    2223    protected List<Node> inspectNodeList(NodeListMergeModel model, String name) {
    23         return field(name).ofType(ArrayList.class)
     24        return method("get" + name + "Entries")
     25        .withReturnType(List.class)
    2426        .in(model)
    25         .get();
     27        .invoke();
    2628    }
    2729
     
    6971        model.copyMyToTop(new int[]{0});
    7072
    71         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     73        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    7274
    7375        assertEquals(1, mergedNodes.size());
     
    9294        model.populate(myWay, theirWay);
    9395
    94         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     96        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    9597        mergedNodes.add(new Node(1));
    9698
    9799        model.copyMyToTop(new int[]{0});
    98100
    99         mergedNodes = inspectNodeList(model, "mergedEntries");
     101        mergedNodes = inspectNodeList(model, "Merged");
    100102        assertEquals(2, mergedNodes.size());
    101103        assertEquals(2, mergedNodes.get(0).id);
     
    123125        model.populate(myWay, theirWay);
    124126
    125         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     127        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    126128        mergedNodes.add(new Node(1));
    127129
    128130        model.copyMyToTop(new int[]{1}); // copy node 3
    129131
    130         mergedNodes = inspectNodeList(model, "mergedEntries");
     132        mergedNodes = inspectNodeList(model, "Merged");
    131133        assertEquals(2, mergedNodes.size());
    132134        assertEquals(3, mergedNodes.get(0).id); // my node 3 at position 0
     
    150152        model.populate(myWay, theirWay);
    151153
    152         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     154        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    153155        mergedNodes.add(new Node(1));
    154156
    155157        model.copyMyToTop(new int[]{1,2}); // copy node 3 and 4
    156158
    157         mergedNodes = inspectNodeList(model, "mergedEntries");
     159        mergedNodes = inspectNodeList(model, "Merged");
    158160        assertEquals(3, mergedNodes.size());
    159161        assertEquals(3, mergedNodes.get(0).id); // my node 3 at position 0
     
    178180        model.copyMyToEnd(new int[]{0});
    179181
    180         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     182        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    181183
    182184        assertEquals(1, mergedNodes.size());
     
    198200        model.populate(myWay, theirWay);
    199201
    200         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     202        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    201203        mergedNodes.add(new Node(1));
    202204
    203205        model.copyMyToEnd(new int[]{0});
    204206
    205         mergedNodes = inspectNodeList(model, "mergedEntries");
     207        mergedNodes = inspectNodeList(model, "Merged");
    206208        assertEquals(2, mergedNodes.size());
    207209        assertEquals(1, mergedNodes.get(0).id); // already merged node 1 at position 0
     
    224226        model.populate(myWay, theirWay);
    225227
    226         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     228        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    227229        mergedNodes.add(new Node(1));
    228230
    229231        model.copyMyToEnd(new int[]{1}); // copy node 3
    230232
    231         mergedNodes = inspectNodeList(model, "mergedEntries");
     233        mergedNodes = inspectNodeList(model, "Merged");
    232234        assertEquals(2, mergedNodes.size());
    233235        assertEquals(1, mergedNodes.get(0).id); // already merged node 1 at position 0
     
    252254        model.populate(myWay, theirWay);
    253255
    254         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     256        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    255257        mergedNodes.add(new Node(1));
    256258
    257259        model.copyMyToEnd(new int[]{1,2}); // copy node 3 and 4
    258260
    259         mergedNodes = inspectNodeList(model, "mergedEntries");
     261        mergedNodes = inspectNodeList(model, "Merged");
    260262        assertEquals(3, mergedNodes.size());
    261263        assertEquals(1, mergedNodes.get(0).id); // already merged node 1 at position 0
     
    282284
    283285        model.populate(myWay, theirWay);
    284         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     286        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    285287        mergedNodes.add(new Node(10));
    286288        mergedNodes.add(new Node(11));
     
    310312
    311313        model.populate(myWay, theirWay);
    312         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     314        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    313315        mergedNodes.add(new Node(10));
    314316        mergedNodes.add(new Node(11));
     
    338340
    339341        model.populate(myWay, theirWay);
    340         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     342        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    341343        mergedNodes.add(new Node(10));
    342344        mergedNodes.add(new Node(11));
     
    371373
    372374        model.populate(myWay, theirWay);
    373         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     375        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    374376        mergedNodes.add(new Node(10));
    375377        mergedNodes.add(new Node(11));
     
    400402
    401403        model.populate(myWay, theirWay);
    402         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     404        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    403405        mergedNodes.add(new Node(10));
    404406        mergedNodes.add(new Node(11));
     
    430432
    431433        model.populate(myWay, theirWay);
    432         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     434        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    433435        mergedNodes.add(new Node(10));
    434436        mergedNodes.add(new Node(11));
     
    458460
    459461        model.populate(myWay, theirWay);
    460         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     462        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    461463        mergedNodes.add(new Node(10));
    462464        mergedNodes.add(new Node(11));
     
    491493
    492494        model.populate(myWay, theirWay);
    493         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     495        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    494496        mergedNodes.add(new Node(10));
    495497        mergedNodes.add(new Node(11));
     
    517519
    518520        model.populate(myWay, theirWay);
    519         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     521        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    520522        mergedNodes.add(new Node(10));
    521523        mergedNodes.add(new Node(11));
     
    547549
    548550        model.populate(myWay, theirWay);
    549         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     551        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    550552        mergedNodes.add(new Node(10));
    551553        mergedNodes.add(new Node(11));
     
    580582
    581583        model.populate(myWay, theirWay);
    582         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     584        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    583585        mergedNodes.add(new Node(10));
    584586        mergedNodes.add(new Node(11));
     
    606608
    607609        model.populate(myWay, theirWay);
    608         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     610        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    609611        mergedNodes.add(new Node(10));
    610612        mergedNodes.add(new Node(11));
     
    636638
    637639        model.populate(myWay, theirWay);
    638         List<Node> mergedNodes = inspectNodeList(model, "mergedEntries");
     640        List<Node> mergedNodes = inspectNodeList(model, "Merged");
    639641        mergedNodes.add(new Node(10));
    640642        mergedNodes.add(new Node(11));
Note: See TracChangeset for help on using the changeset viewer.