Changeset 2657 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2009-12-19T12:55:50+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2656 r2657 849 849 } 850 850 851 void fireTagsChanged(OsmPrimitive prim ) {852 fireEvent(new TagsChangedEvent(this, prim ));851 void fireTagsChanged(OsmPrimitive prim, Map<String, String> originalKeys) { 852 fireEvent(new TagsChangedEvent(this, prim, originalKeys)); 853 853 } 854 854 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2656 r2657 717 717 */ 718 718 public void setKeys(Map<String, String> keys) { 719 Map<String, String> originalKeys = getKeys(); 719 720 if (keys == null) { 720 721 this.keys = null; 722 keysChangedImpl(originalKeys); 721 723 return; 722 724 } … … 728 730 } 729 731 this.keys = newKeys; 730 keysChangedImpl( );732 keysChangedImpl(originalKeys); 731 733 } 732 734 … … 741 743 */ 742 744 public final void put(String key, String value) { 745 Map<String, String> originalKeys = getKeys(); 743 746 if (key == null) 744 747 return; … … 747 750 } else if (keys == null || keys.length == 0){ 748 751 keys = new String[] {key, value}; 749 keysChangedImpl( );752 keysChangedImpl(originalKeys); 750 753 } else { 751 754 for (int i=0; i<keys.length;i+=2) { 752 755 if (keys[i].equals(key)) { 753 756 keys[i+1] = value; 754 keysChangedImpl( );757 keysChangedImpl(originalKeys); 755 758 return; 756 759 } … … 764 767 newKeys[keys.length + 1] = value; 765 768 keys = newKeys; 766 keysChangedImpl( );769 keysChangedImpl(originalKeys); 767 770 } 768 771 } … … 776 779 if (!hasKey(key)) 777 780 return; 781 Map<String, String> originalKeys = getKeys(); 778 782 if (keys.length == 2) { 779 783 keys = null; 780 keysChangedImpl( );784 keysChangedImpl(originalKeys); 781 785 return; 782 786 } … … 790 794 } 791 795 keys = newKeys; 792 keysChangedImpl( );796 keysChangedImpl(originalKeys); 793 797 } 794 798 … … 799 803 */ 800 804 public final void removeAll() { 801 keys = null; 802 keysChangedImpl(); 805 if (keys != null) { 806 Map<String, String> originalKeys = getKeys(); 807 keys = null; 808 keysChangedImpl(originalKeys); 809 } 803 810 } 804 811 … … 854 861 } 855 862 856 private void keysChangedImpl( ) {863 private void keysChangedImpl(Map<String, String> originalKeys) { 857 864 clearCached(); 858 865 updateHasDirectionKeys(); 859 866 updateTagged(); 860 867 if (dataSet != null) { 861 dataSet.fireTagsChanged(this );868 dataSet.fireTagsChanged(this, originalKeys); 862 869 } 863 870 } -
trunk/src/org/openstreetmap/josm/data/osm/event/TagsChangedEvent.java
r2645 r2657 4 4 import java.util.Collections; 5 5 import java.util.List; 6 import java.util.Map; 6 7 7 8 import org.openstreetmap.josm.data.osm.DataSet; … … 11 12 12 13 private final OsmPrimitive primitive; 14 private final Map<String, String> originalKeys; 13 15 14 public TagsChangedEvent(DataSet dataSet, OsmPrimitive primitive ) {16 public TagsChangedEvent(DataSet dataSet, OsmPrimitive primitive, Map<String, String> originalKeys) { 15 17 super(dataSet); 16 18 this.primitive = primitive; 19 this.originalKeys = originalKeys; 17 20 } 18 21 … … 36 39 } 37 40 41 public Map<String, String> getOriginalKeys() { 42 return originalKeys; 43 } 44 38 45 }
Note:
See TracChangeset
for help on using the changeset viewer.