Changeset 733 in josm for trunk/src/org
- Timestamp:
- 2008-07-22T09:21:04+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenAction.java
r693 r733 68 68 69 69 private void openAsData(File file) throws SAXException, IOException, FileNotFoundException { 70 String fn = file.getName(); 71 if (ExtensionFileFilter.filters[ExtensionFileFilter.OSM].acceptName(fn)) { 72 DataSet dataSet = OsmReader.parseDataSet(new FileInputStream(file), null, Main.pleaseWaitDlg); 73 OsmDataLayer layer = new OsmDataLayer(dataSet, file.getName(), file); 74 Main.main.addLayer(layer); 75 } 76 else 77 JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("Unknown file extension: {0}", fn.substring(file.getName().lastIndexOf('.')+1))); 78 } 70 String fn = file.getName(); 71 if (ExtensionFileFilter.filters[ExtensionFileFilter.OSM].acceptName(fn)) { 72 DataSet dataSet = OsmReader.parseDataSet(new FileInputStream(file), null, Main.pleaseWaitDlg); 73 OsmDataLayer layer = new OsmDataLayer(dataSet, file.getName(), file); 74 Main.main.addLayer(layer); 75 layer.fireDataChange(); 76 } 77 else 78 JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("Unknown file extension: {0}", fn.substring(file.getName().lastIndexOf('.')+1))); 79 } 79 80 80 81 private void openFileAsGpx(File file) throws SAXException, IOException, FileNotFoundException { -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r729 r733 61 61 Main.main.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c)); 62 62 if (propertiesUpdated) 63 Main. map.getPropertiesDialog().selectionChanged(Main.ds.getSelected());63 Main.ds.fireSelectionChanged(Main.ds.getSelected()); 64 64 Main.map.repaint(); 65 65 } -
trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
r627 r733 66 66 try { 67 67 URL u = new URL(getPreferencesDir()); 68 System.out.println("upl aoding preferences to "+u);68 System.out.println("uploading preferences to "+u); 69 69 HttpURLConnection con = (HttpURLConnection)u.openConnection(); 70 70 con.addRequestProperty("Authorization", "Basic "+Base64.encode(get("osm-server.username")+":"+get("osm-server.password"))); -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r729 r733 67 67 public final ButtonGroup toolGroup = new ButtonGroup(); 68 68 69 private PropertiesDialog propertiesDialog;70 71 69 public MapFrame() { 72 70 setSize(400,400); … … 96 94 97 95 addToggleDialog(new LayerListDialog(this)); 98 addToggleDialog( propertiesDialog =new PropertiesDialog(this));96 addToggleDialog(new PropertiesDialog(this)); 99 97 addToggleDialog(new HistoryDialog()); 100 98 addToggleDialog(new SelectionListDialog()); … … 189 187 panel.add(statusLine, BorderLayout.SOUTH); 190 188 } 191 192 public final PropertiesDialog getPropertiesDialog() {193 return propertiesDialog;194 }195 189 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r725 r733 47 47 import org.openstreetmap.josm.Main; 48 48 import org.openstreetmap.josm.command.ChangePropertyCommand; 49 import org.openstreetmap.josm.command.ChangeCommand; 49 50 import org.openstreetmap.josm.command.Command; 50 51 import org.openstreetmap.josm.command.SequenceCommand; … … 96 97 @Override public void mouseClicked(MouseEvent e) { 97 98 if (e.getClickCount() < 2) 98 return; 99 100 if (e.getSource() == propertyTable) 99 { 100 if (e.getSource() == propertyTable) 101 membershipTable.clearSelection(); 102 else if (e.getSource() == membershipTable) 103 propertyTable.clearSelection(); 104 } 105 else if (e.getSource() == propertyTable) 101 106 { 102 107 int row = propertyTable.rowAtPoint(e.getPoint()); 103 if (row > -1) {108 if (row > -1) 104 109 propertyEdit(row); 105 return;106 }107 110 } else if (e.getSource() == membershipTable) { 108 111 int row = membershipTable.rowAtPoint(e.getPoint()); 109 if (row > -1) {112 if (row > -1) 110 113 membershipEdit(row); 111 return; 112 } 113 } 114 add(); 114 } 115 else 116 { 117 add(); 118 } 115 119 } 116 120 } … … 475 479 476 480 membershipData.setColumnIdentifiers(new String[]{tr("Member Of"),tr("Role")}); 477 membershipTable.set RowSelectionAllowed(false);481 membershipTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 478 482 479 483 membershipTable.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer() { … … 506 510 ActionListener buttonAction = new ActionListener(){ 507 511 public void actionPerformed(ActionEvent e) { 508 int sel = propertyTable.getSelectedRow();512 int row = membershipTable.getSelectedRow(); 509 513 if (e.getActionCommand().equals("Add")) 510 514 add(); 511 else if (e.getActionCommand().equals("Edit")) { 512 if(propertyTable.getRowCount() == 1) 513 sel = 0; 514 if (sel == -1) 515 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit.")); 516 else 517 propertyEdit(sel); 518 } else if (e.getActionCommand().equals("Delete")) { 519 if (sel == -1) 520 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete.")); 521 else 522 delete(sel); 515 else if(row >= 0) 516 { 517 if (e.getActionCommand().equals("Edit")) 518 membershipEdit(row); 519 else if (e.getActionCommand().equals("Delete")) { 520 Relation cur = (Relation)membershipData.getValueAt(row, 0); 521 NameVisitor n = new NameVisitor(); 522 cur.visit(n); 523 if(JOptionPane.showConfirmDialog(Main.parent, tr("Really delete selection from relation {0}?", n.name), 524 tr("Change relation"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) 525 { 526 Relation rel = new Relation(cur); 527 Collection<OsmPrimitive> sel = Main.ds.getSelected(); 528 for (RelationMember rm : cur.members) { 529 for (OsmPrimitive osm : sel) { 530 if (rm.member == osm) 531 { 532 RelationMember mem = new RelationMember(); 533 mem.role = rm.role; 534 mem.member = rm.member; 535 rel.members.remove(mem); 536 break; 537 } 538 } 539 } 540 Main.main.undoRedo.add(new ChangeCommand(cur, rel)); 541 selectionChanged(sel); // update whole table 542 } 543 544 } 545 } 546 else 547 { 548 int sel = propertyTable.getSelectedRow(); 549 if (e.getActionCommand().equals("Edit")) { 550 if(propertyTable.getRowCount() == 1) 551 sel = 0; 552 if (sel == -1) 553 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit.")); 554 else 555 propertyEdit(sel); 556 } else if (e.getActionCommand().equals("Delete")) { 557 if (sel == -1) 558 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete.")); 559 else 560 delete(sel); 561 } 523 562 } 524 563 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java
r674 r733 65 65 private final Relation relation; 66 66 private final Relation clone; 67 private JLabel status; 67 68 68 69 /** … … 137 138 if (RelationEditor.this.relation == null) { 138 139 Main.main.undoRedo.add(new AddCommand(clone)); 140 Main.ds.fireSelectionChanged(Main.ds.getSelected()); 139 141 } else if (!RelationEditor.this.relation.realEqual(clone, true)) { 140 142 Main.main.undoRedo.add(new ChangeCommand(RelationEditor.this.relation, clone)); 143 Main.ds.fireSelectionChanged(Main.ds.getSelected()); 141 144 } 142 145 } … … 150 153 "as well as the members. In addition to this we should have a smart editor that " + 151 154 "detects the type of relationship and limits your choices in a sensible way.")+"</em></html>"); 152 153 getContentPane().add(help, BorderLayout.NORTH); 155 getContentPane().add(help, BorderLayout.NORTH); 154 156 try { setAlwaysOnTop(true); } catch (SecurityException sx) {} 155 157 … … 182 184 // setting up the member table 183 185 184 186 memberData.setColumnIdentifiers(new String[]{tr("Role"),tr("Occupied By")}); 185 187 memberTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 186 188 memberTable.getColumnModel().getColumn(1).setCellRenderer(new OsmPrimitivRenderer()); … … 213 215 bothTables.add(new JLabel(tr("Tags (empty value deletes tag)")), GBC.eol().fill(GBC.HORIZONTAL)); 214 216 bothTables.add(new JScrollPane(propertyTable), GBC.eop().fill(GBC.BOTH)); 215 bothTables.add( new JLabel(tr("Members")), GBC.eol().fill(GBC.HORIZONTAL));217 bothTables.add(status = new JLabel(tr("Members")), GBC.eol().fill(GBC.HORIZONTAL)); 216 218 bothTables.add(new JScrollPane(memberTable), GBC.eol().fill(GBC.BOTH)); 217 219 … … 251 253 } 252 254 })); 253 buttonPanel.add(createButton(marktr("Download Members"),"down", tr("Download all incomplete ways and nodes in relation"), KeyEvent.VK_L, new ActionListener() { 254 public void actionPerformed(ActionEvent e) { 255 downloadRelationMembers(); 256 refreshTables(); 257 } 258 })); 259 260 255 buttonPanel.add(createButton(marktr("Download Members"),"down", tr("Download all incomplete ways and nodes in relation"), KeyEvent.VK_L, new ActionListener() { 256 public void actionPerformed(ActionEvent e) { 257 downloadRelationMembers(); 258 refreshTables(); 259 } 260 })); 261 261 262 bothTables.add(buttonPanel, GBC.eop().fill(GBC.HORIZONTAL)); 262 263 263 264 tabPane.add(bothTables, "Basic"); 264 265 265 266 refreshTables(); 266 267 267 268 setSize(new Dimension(600, 500)); 268 269 setLocationRelativeTo(Main.parent); … … 285 286 memberData.addRow(new Object[]{em.role, em.member}); 286 287 } 288 status.setText(tr("Members: {0}", clone.members.size())); 287 289 } 288 290 -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r627 r733 42 42 43 43 JPanel dlg = new JPanel(new GridBagLayout()); 44 gui.tabpane.addTab( "Bookmarks", dlg);44 gui.tabpane.addTab(tr("Bookmarks"), dlg); 45 45 46 46 bookmarks = new BookmarkList(); -
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r679 r733 133 133 dlg.add(sizeCheck, GBC.eop().insets(10,0,5,20)); 134 134 135 gui.tabpane.addTab( "Bounding Box", dlg);135 gui.tabpane.addTab(tr("Bounding Box"), dlg); 136 136 } 137 137 -
trunk/src/org/openstreetmap/josm/gui/download/WorldChooser.java
r627 r733 99 99 temp.add(this, BorderLayout.CENTER); 100 100 temp.add(new JLabel(tr("You can use the mouse or Ctrl+Arrow keys/./ to zoom and pan.")), BorderLayout.SOUTH); 101 gui.tabpane.add(temp, "Map");102 new MapMover(this, temp); 101 gui.tabpane.add(temp, tr("Map")); 102 new MapMover(this, temp); 103 103 SelectionEnded selListener = new SelectionEnded(){ 104 104 public void selectionEnded(Rectangle r, boolean alt, boolean shift, boolean ctrl) {
Note:
See TracChangeset
for help on using the changeset viewer.