Changeset 23816 in osm for applications/editors
- Timestamp:
- 2010-10-24T19:57:27+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/AddressEdit
- Files:
-
- 1 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressNode.java
r23808 r23816 94 94 */ 95 95 public String getCountry() { 96 if (!TagUtils.hasAddrCountryTag(osmObject)) { 97 return MISSING_TAG; 98 } 96 99 return TagUtils.getAddrCountryValue(osmObject); 97 100 } 98 101 102 103 104 @Override 105 public int compareTo(INodeEntity o) { 106 if (o == null || !(o instanceof AddressNode)) { 107 return -1; 108 } 109 AddressNode other = (AddressNode) o; 110 111 int cc = 0; 112 cc = this.getCountry().compareTo(other.getCountry()); 113 if ( cc == 0) { 114 cc = this.getState().compareTo(other.getState()); 115 116 if (cc == 0) { 117 cc = this.getCity().compareTo(other.getCity()); 118 119 if (cc == 0) { 120 cc = this.getStreet().compareTo(other.getStreet()); 121 122 if (cc == 0) { 123 cc = this.getHouseNumber().compareTo(other.getHouseNumber()); 124 } 125 } 126 } 127 } 128 129 return cc; 130 } 131 99 132 @Override 100 133 public String toString() { -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressVisitor.java
r23814 r23816 30 30 31 31 import java.util.ArrayList; 32 import java.util.Collections; 32 33 import java.util.HashMap; 33 34 import java.util.HashSet; … … 131 132 132 133 public List<StreetNode> getStreetList() { 133 return new ArrayList<StreetNode>(streetDict.values()); 134 135 ArrayList<StreetNode> sortedList = new ArrayList<StreetNode>(streetDict.values()); 136 Collections.sort(sortedList); 137 return sortedList; 134 138 } 135 139 -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/INodeEntity.java
r23808 r23816 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 19 20 public interface INodeEntity {20 public interface INodeEntity extends Comparable<INodeEntity> { 21 21 /** 22 22 * Gets the underlying OSM object. -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/NodeEntityBase.java
r23808 r23816 20 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 21 22 public class NodeEntityBase implements INodeEntity {22 public class NodeEntityBase implements INodeEntity, Comparable<INodeEntity> { 23 23 public static final String ANONYMOUS = tr("No name"); 24 24 … … 74 74 } 75 75 76 @Override 77 public int compareTo(INodeEntity o) { 78 if (o == null || !(o instanceof NodeEntityBase)) return -1; 79 return this.getName().compareTo(o.getName()); 80 } 81 76 82 77 83 } -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/StreetNode.java
r23814 r23816 15 15 16 16 import java.util.ArrayList; 17 import java.util.Collections; 17 18 import java.util.List; 18 19 … … 48 49 49 50 children.add(segment); 51 Collections.sort(children); 50 52 } 51 53 -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AddressEditDialog.java
r23815 r23816 36 36 import javax.swing.tree.DefaultMutableTreeNode; 37 37 import javax.swing.tree.DefaultTreeModel; 38 import javax.swing.tree.Tree Node;38 import javax.swing.tree.TreeSelectionModel; 39 39 40 40 public class AddressEditDialog extends JFrame implements ActionListener, TreeSelectionListener { … … 72 72 setLocation(100, 100); 73 73 74 // TODO: Proper init, if model is null 74 75 if (model != null) { 75 76 JPanel streetPanel = new JPanel(new BorderLayout()); 76 77 streetsTree = new JTree(new DefaultTreeModel(model.getStreetsTree())); 78 streetsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); 77 79 streetsTree.addTreeSelectionListener(this); 80 streetsTree.setCellRenderer(new StreetTreeCellRenderer()); 81 78 82 JScrollPane scroll1 = new JScrollPane(streetsTree); 79 83 streetPanel.add(scroll1, BorderLayout.CENTER); … … 84 88 unresolvedTree = new JTree(new DefaultTreeModel(model.getUnresolvedAddressesTree())); 85 89 unresolvedTree.addTreeSelectionListener(this); 90 86 91 JScrollPane scroll2 = new JScrollPane(unresolvedTree); 87 92 unresolvedPanel.add(scroll2, BorderLayout.CENTER);
Note:
See TracChangeset
for help on using the changeset viewer.