Ticket #2954: relation.patch
| File relation.patch, 4.0 KB (added by , 17 years ago) |
|---|
-
test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.data.osm; 3 4 import org.junit.Test; 5 6 import static org.junit.Assert.*; 7 8 public class RelationTest { 9 @Test(expected=NullPointerException.class) 10 public void createNewRelation() { 11 new Relation(null); 12 } 13 14 @Test 15 public void equalSemenaticsToNull() { 16 Relation relation = new Relation(); 17 assertFalse(relation.hasEqualTechnicalAttributes(null)); 18 } 19 20 } -
src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
112 112 members.set(row-1, member1); 113 113 } 114 114 fireTableDataChanged(); 115 getSelectionModel(); 115 116 listSelectionModel.clearSelection(); 116 117 for (int row : selectedRows) { 117 118 row--; … … 132 133 members.set(row+1, member1); 133 134 } 134 135 fireTableDataChanged(); 136 getSelectionModel(); 135 137 listSelectionModel.clearSelection(); 136 138 for (int row : selectedRows) { 137 139 row++; … … 208 210 for (RelationMember member: selectedMembers) { 209 211 int row = members.indexOf(member); 210 212 if (row >= 0) { 213 getSelectionModel(); 211 214 listSelectionModel.addSelectionInterval(row,row); 212 215 min = Math.min(row, min); 213 216 } -
src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
540 540 // tags, don't add an empty relation 541 541 if(memberTableModel.getRowCount() == 0 && tagEditorModel.getKeys().isEmpty()) 542 542 return; 543 Relation clone = new Relation(getRelation());544 tagEditorModel.applyToPrimitive( clone);545 memberTableModel.applyToRelation( clone);546 Main.main.undoRedo.add(new AddCommand( clone));543 Relation newRelation = new Relation(); 544 tagEditorModel.applyToPrimitive(newRelation); 545 memberTableModel.applyToRelation(newRelation); 546 Main.main.undoRedo.add(new AddCommand(newRelation)); 547 547 DataSet.fireSelectionChanged(Main.ds.getSelected()); 548 548 } else if (! memberTableModel.hasSameMembersAs(getRelation()) || tagEditorModel.isDirty()) { 549 549 Relation editedRelation = new Relation(getRelation()); -
src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
40 40 */ 41 41 private Relation relation; 42 42 43 /** The version of the relation when editing is started. */ 43 /** 44 * The version of the relation when editing is started. This is 45 * null if a new relation is created. */ 44 46 private Relation relationSnapshot; 45 47 46 48 /** the data layer the relation belongs to */ … … 101 103 false 102 104 ); 103 105 104 this.relationSnapshot = new Relation(relation);106 this.relationSnapshot = (relation == null) ? null : new Relation(relation); 105 107 this.relation = relation; 106 108 this.layer = layer; 107 109 }
