Changeset 23876 in osm for applications/editors/josm
- Timestamp:
- 2010-10-27T21:08:23+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressEditAction.java
r23834 r23876 73 73 } 74 74 75 /* -----------------------------------------*/75 /* This code is abused to generate tag utility code */ 76 76 77 @SuppressWarnings("unused") 77 78 private void generateTagCode(AddressEditContainer addrVisitor) { 78 /* This code is abused to generate tag utility code */79 79 80 for (String tag : addrVisitor.getTags()) { 80 81 String methodName = createMethodName(tag); -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AddressEditDialog.java
r23853 r23876 25 25 import java.awt.event.ActionEvent; 26 26 import java.awt.event.ActionListener; 27 import java.util.Collection; 27 28 import java.util.List; 28 29 … … 34 35 import javax.swing.JSeparator; 35 36 import javax.swing.JSplitPane; 36 import javax.swing.JTabbedPane;37 37 import javax.swing.JTable; 38 38 import javax.swing.ListSelectionModel; … … 43 43 import org.openstreetmap.gui.jmapviewer.MapMarkerDot; 44 44 import org.openstreetmap.josm.data.osm.Node; 45 import org.openstreetmap.josm.data.osm.OsmPrimitive; 46 import org.openstreetmap.josm.data.osm.Tag; 45 47 import org.openstreetmap.josm.data.osm.Way; 48 import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel.PresetHandler; 46 49 import org.openstreetmap.josm.plugins.addressEdit.AddressEditContainer; 47 50 import org.openstreetmap.josm.plugins.addressEdit.AddressNode; … … 52 55 53 56 public class AddressEditDialog extends JFrame implements ActionListener, ListSelectionListener, IAddressEditContainerListener { 54 private static final String INCOMPLETE_HEADER_FMT = tr("Incomplete Addresses (%d)");55 57 private static final String UNRESOLVED_HEADER_FMT = tr("Unresolved Addresses (%d)"); 56 58 private static final String STREET_HEADER_FMT = tr("Streets (%d)"); … … 63 65 private AddressEditContainer editContainer; 64 66 private JTable unresolvedTable; 65 private JTable incompleteTable;66 67 private JTable streetTable; 67 68 … … 72 73 }; 73 74 private JLabel streetLabel; 74 private JLabel incompleteAddressesLabel;75 75 private JLabel unresolvedAddressesLabel; 76 76 private JMapViewer mapViewer; 77 private JLabel mapLabel;77 78 78 79 79 /** … … 126 126 unresolvedPanel.add(unresolvedButtons, BorderLayout.SOUTH); 127 127 128 /* Panel for incomplete addresses */129 JPanel incompletePanel = new JPanel(new BorderLayout());130 incompleteTable = new JTable(new IncompleteAddressesTableModel(editContainer));131 incompleteTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);132 incompleteTable.getSelectionModel().addListSelectionListener(this);133 JScrollPane scroll3 = new JScrollPane(incompleteTable);134 135 incompletePanel.add(scroll3, BorderLayout.CENTER);136 incompleteAddressesLabel = createHeaderLabel(137 INCOMPLETE_HEADER_FMT, editContainer.getNumberOfUnresolvedAddresses());138 incompletePanel.add(incompleteAddressesLabel, BorderLayout.NORTH);139 incompletePanel.setMinimumSize(new Dimension(350, 200));140 141 142 143 /* Edit panel for incomplete addresses */144 JPanel incompleteEditPanel = new JPanel();145 incompleteEditPanel.setMinimumSize(new Dimension(350, 300));146 147 128 /* Map Panel */ 148 129 JPanel mapPanel = new JPanel(new BorderLayout()); … … 151 132 mapPanel.setMinimumSize(new Dimension(200, 200)); 152 133 mapViewer.setVisible(false); 153 154 JTabbedPane tab = new JTabbedPane(); 155 tab.addTab(tr("Properties"), incompleteEditPanel); 156 tab.addTab(tr("Map"), mapPanel); 157 134 158 135 /* Combine panels */ 159 JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel); 160 JSplitPane addrSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tab, incompletePanel); 161 JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, unresSplitPane, addrSplitPane); 136 JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel); 137 JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, unresSplitPane, mapPanel); 162 138 163 139 this.getContentPane().add(pane, BorderLayout.CENTER); … … 182 158 } 183 159 184 private JLabel createHeaderLabel(String text) {185 JLabel label = new JLabel(text);186 label.setFont(label.getFont().deriveFont(Font.BOLD));187 return label;188 }189 190 160 private JLabel createHeaderLabel(String fmtString, int n) { 191 161 JLabel label = new JLabel(String.format(fmtString, n)); … … 197 167 if (editContainer != null) { 198 168 streetLabel.setText(String.format(STREET_HEADER_FMT, editContainer.getNumberOfStreets())); 199 incompleteAddressesLabel.setText(String.format(INCOMPLETE_HEADER_FMT, editContainer.getNumberOfIncompleteAddresses()));200 169 unresolvedAddressesLabel.setText(String.format(UNRESOLVED_HEADER_FMT, editContainer.getNumberOfUnresolvedAddresses())); 201 170 } else { 202 171 streetLabel.setText(String.format(STREET_HEADER_FMT, 0)); 203 incompleteAddressesLabel.setText(String.format(INCOMPLETE_HEADER_FMT, 0));204 172 unresolvedAddressesLabel.setText(String.format(UNRESOLVED_HEADER_FMT, 0)); 205 173 } … … 222 190 223 191 AddressEditSelectionEvent ev = new AddressEditSelectionEvent(e.getSource(), 224 streetTable, unresolvedTable, incompleteTable,editContainer);192 streetTable, unresolvedTable, editContainer); 225 193 226 194 for (AbstractAddressEditAction action : actions) { … … 241 209 } 242 210 } 243 244 List<AddressNode> incAddresses = ev.getSelectedIncompleteAddresses();245 if (incAddresses != null) {246 for (AddressNode aNode : incAddresses) {247 Node node = (Node) aNode.getOsmObject();248 mapViewer.addMapMarker(new MapMarkerDot(Color.RED, node.getCoor().lat(), node.getCoor().lon()));249 }250 }251 211 252 212 List<AddressNode> unrAddresses = ev.getSelectedUnresolvedAddresses(); … … 315 275 316 276 } 317 277 278 class IncompleteAddressPresetHandler implements PresetHandler { 279 private List<OsmPrimitive> osmPrimitives; 280 281 /** 282 * @param osmPrimitives 283 */ 284 public IncompleteAddressPresetHandler(List<OsmPrimitive> osmPrimitives) { 285 super(); 286 this.osmPrimitives = osmPrimitives; 287 } 288 289 @Override 290 public Collection<OsmPrimitive> getSelection() { 291 // TODO Auto-generated method stub 292 return osmPrimitives; 293 } 294 295 @Override 296 public void updateTags(List<Tag> tags) { 297 298 } 299 300 } 318 301 } -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AddressEditSelectionEvent.java
r23849 r23876 31 31 private JTable streetTable; 32 32 private JTable unresolvedAddressTable; 33 private JTable incompleteAddressTable;34 33 private AddressEditContainer addressContainer; 35 34 … … 42 41 * @param container The address container instance holding the entities for streets and addresses. 43 42 */ 44 public AddressEditSelectionEvent(Object source, JTable selStreet, JTable unresolvedAddr, JTable incomplete,AddressEditContainer container) {43 public AddressEditSelectionEvent(Object source, JTable selStreet, JTable unresolvedAddr, AddressEditContainer container) { 45 44 super(source, -1, ""); 46 45 this.streetTable = selStreet; 47 46 this.unresolvedAddressTable = unresolvedAddr; 48 this.incompleteAddressTable = incomplete;49 47 this.addressContainer = container; 50 48 } … … 66 64 } 67 65 68 /**69 * Gets the 'incomplete addresses' table component.70 * @return71 */72 public JTable getIncompleteAddressTable() {73 return incompleteAddressTable;74 }75 76 66 public AddressEditContainer getAddressContainer() { 77 67 return addressContainer; … … 91 81 92 82 return addressContainer.getStreetList().get(selRows); 93 }94 return null;95 }96 97 /**98 * Gets the list containing the selected items of the 'incomplete addresses ' table.99 * @return100 */101 public List<AddressNode> getSelectedIncompleteAddresses() {102 if (incompleteAddressTable != null &&103 addressContainer != null &&104 addressContainer.getIncompleteAddresses() != null) {105 106 int[] selRows = incompleteAddressTable.getSelectedRows();107 108 List<AddressNode> nodes = new ArrayList<AddressNode>();109 for (int i = 0; i < selRows.length; i++) {110 if (i >= 0 && i < addressContainer.getNumberOfIncompleteAddresses()) {111 nodes.add(addressContainer.getIncompleteAddresses().get(selRows[i]));112 }113 }114 return nodes;115 83 } 116 84 return null; -
applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AssignAddressToStreetAction.java
r23834 r23876 23 23 public AssignAddressToStreetAction() { 24 24 super(tr("Assign address to street")); 25 // TODO Auto-generated constructor stub26 25 } 27 26 … … 31 30 private static final long serialVersionUID = -6180491357232121384L; 32 31 32 /* (non-Javadoc) 33 * @see org.openstreetmap.josm.plugins.addressEdit.gui.AbstractAddressEditAction#addressEditActionPerformed(org.openstreetmap.josm.plugins.addressEdit.gui.AddressEditSelectionEvent) 34 */ 33 35 @Override 34 36 public void addressEditActionPerformed(AddressEditSelectionEvent ev) { … … 36 38 37 39 38 if (streetNode != null && ev.getSelected IncompleteAddresses() != null) {40 if (streetNode != null && ev.getSelectedUnresolvedAddresses() != null) { 39 41 for (AddressNode addrNode : ev.getSelectedUnresolvedAddresses()) { 40 42 addrNode.assignStreet(streetNode); … … 44 46 } 45 47 48 /* (non-Javadoc) 49 * @see org.openstreetmap.josm.plugins.addressEdit.gui.AbstractAddressEditAction#updateEnabledState(org.openstreetmap.josm.plugins.addressEdit.gui.AddressEditSelectionEvent) 50 */ 46 51 @Override 47 52 public void updateEnabledState(AddressEditSelectionEvent ev) {
Note:
See TracChangeset
for help on using the changeset viewer.