- Timestamp:
- 2006-04-21T20:05:14+02:00 (19 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/Main.java
r89 r90 270 270 main.setVisible(true); 271 271 272 273 if (arguments.remove("--show-modifiers")) {274 Point p = main.getLocationOnScreen();275 Dimension s = main.getSize();276 new ShowModifiers(p.x + s.width - 3, p.y + s.height - 32);277 main.setVisible(true);278 }279 280 272 if (!arguments.remove("--no-fullscreen")) { 281 273 if (Toolkit.getDefaultToolkit().isFrameStateSupported(MAXIMIZED_BOTH)) … … 316 308 } 317 309 } 318 310 311 if (arguments.remove("--show-modifiers")) { 312 Point p = main.getLocationOnScreen(); 313 Dimension s = main.getSize(); 314 new ShowModifiers(p.x + s.width - 3, p.y + s.height - 32); 315 main.setVisible(true); 316 } 317 319 318 for (String s : arguments) 320 319 main.openAction.openFile(new File(s)); -
src/org/openstreetmap/josm/actions/UploadAction.java
r86 r90 53 53 int cutPos = osmDataServer.endsWith("/0.2") ? 4 : 5; 54 54 Main.pref.put("osm-server.url", osmDataServer.substring(0, osmDataServer.length()-cutPos)); 55 } 56 57 if (!Main.main.getMapFrame().conflictDialog.conflicts.isEmpty()) { 58 JOptionPane.showMessageDialog(Main.main, "There are unresolved conflicts. You have to resolve these first."); 59 Main.main.getMapFrame().conflictDialog.action.button.setSelected(true); 60 Main.main.getMapFrame().conflictDialog.action.actionPerformed(null); 61 return; 55 62 } 56 63 -
src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java
r86 r90 72 72 73 73 if (numberOfSelectedWays > 0) { 74 String ways = "way" + (numberOfSelectedWays==1?" ":"s");75 int answer = JOptionPane.showConfirmDialog(Main.main, numberOfSelectedWays+" "+ways+" havebeen selected.\n" +74 String ways = "way" + (numberOfSelectedWays==1?" has":"s have"); 75 int answer = JOptionPane.showConfirmDialog(Main.main, numberOfSelectedWays+" "+ways+" been selected.\n" + 76 76 "Do you wish to select all segments belonging to the "+ways+" instead?"); 77 77 if (answer == JOptionPane.CANCEL_OPTION) … … 83 83 } 84 84 } 85 86 if (segments.isEmpty()) 87 return; 85 88 86 89 // sort the segments in best possible order. This is done by: -
src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r86 r90 39 39 super.executeCommand(); // save old 40 40 if (value == null) { 41 for (OsmPrimitive osm : objects) 41 for (OsmPrimitive osm : objects) { 42 osm.modified = true; 42 43 osm.remove(key); 44 } 43 45 } else { 44 for (OsmPrimitive osm : objects) 46 for (OsmPrimitive osm : objects) { 47 osm.modified = true; 45 48 osm.put(key, value); 49 } 46 50 } 47 51 } -
src/org/openstreetmap/josm/command/ConflictResolveCommand.java
r86 r90 9 9 import java.util.Map.Entry; 10 10 11 import javax.swing.DefaultListModel;12 13 11 import org.openstreetmap.josm.Main; 14 12 import org.openstreetmap.josm.data.conflict.ConflictItem; 15 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 14 import org.openstreetmap.josm.gui.ConflictResolver; 15 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 17 16 18 17 public class ConflictResolveCommand extends Command { … … 21 20 private final Map<OsmPrimitive, OsmPrimitive> resolved; 22 21 private Map<OsmPrimitive, OsmPrimitive> origAllConflicts; 22 private final ConflictDialog conflictDialog; 23 23 24 24 public ConflictResolveCommand(List<ConflictItem> conflicts, Map<OsmPrimitive, OsmPrimitive> resolved) { 25 25 this.conflicts = conflicts; 26 26 this.resolved = resolved; 27 conflictDialog = Main.main.getMapFrame().conflictDialog; 27 28 } 28 29 … … 30 31 super.executeCommand(); 31 32 32 origAllConflicts = new HashMap<OsmPrimitive, OsmPrimitive>(Main.main.getMapFrame().conflictDialog.conflicts); 33 33 origAllConflicts = new HashMap<OsmPrimitive, OsmPrimitive>(conflictDialog.conflicts); 34 34 35 35 Set<OsmPrimitive> completed = new HashSet<OsmPrimitive>(resolved.keySet()); … … 44 44 } 45 45 } 46 for (OsmPrimitive k : completed) {47 Main.main.getMapFrame().conflictDialog.conflicts.remove(k);48 Main.main.getMapFrame().conflictDialog.model.removeElement(k);49 }46 for (OsmPrimitive k : completed) 47 conflictDialog.conflicts.remove(k); 48 if (!completed.isEmpty()) 49 conflictDialog.rebuildList(); 50 50 } 51 51 52 52 @Override public void undoCommand() { 53 53 super.undoCommand(); 54 Map<OsmPrimitive, OsmPrimitive> c = Main.main.getMapFrame().conflictDialog.conflicts; 55 DefaultListModel m = Main.main.getMapFrame().conflictDialog.model; 56 57 c.clear(); 58 c.putAll(origAllConflicts); 59 m.removeAllElements(); 60 for (Entry<OsmPrimitive, OsmPrimitive> e : c.entrySet()) 61 m.addElement(e.getKey()); 54 Main.main.getMapFrame().conflictDialog.conflicts.clear(); 55 Main.main.getMapFrame().conflictDialog.conflicts.putAll(origAllConflicts); 56 Main.main.getMapFrame().conflictDialog.rebuildList(); 62 57 } 63 58 -
src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r86 r90 1 1 package org.openstreetmap.josm.data.osm; 2 2 3 import java.text.SimpleDateFormat; 3 4 import java.util.Collection; 4 5 import java.util.Collections; … … 161 162 (keys == null ? osm.keys==null : keys.equals(osm.keys)); 162 163 } 164 165 public String getTimeStr() { 166 return timestamp == null ? null : new SimpleDateFormat("y-M-d H:m:s").format(timestamp); 167 } 163 168 } -
src/org/openstreetmap/josm/gui/IconToggleButton.java
r80 r90 22 22 setText(null); 23 23 24 // Tooltip25 String toolTipText = "";26 24 Object o = action.getValue(Action.SHORT_DESCRIPTION); 27 25 if (o != null) 28 toolTipText = o.toString(); 29 setToolTipText(toolTipText); 26 setToolTipText(o.toString()); 30 27 31 28 action.addPropertyChangeListener(this); -
src/org/openstreetmap/josm/gui/MapFrame.java
r86 r90 4 4 import java.awt.Component; 5 5 import java.awt.Container; 6 import java.awt.event.ActionEvent; 6 7 import java.beans.PropertyChangeEvent; 7 8 import java.beans.PropertyChangeListener; … … 14 15 import javax.swing.JToolBar; 15 16 17 import org.openstreetmap.josm.Main; 16 18 import org.openstreetmap.josm.actions.AutoScaleAction; 17 19 import org.openstreetmap.josm.actions.mapmode.AddSegmentAction; … … 116 118 117 119 private void addIconToggle(JPanel toggleDialogs, ToggleDialog dlg) { 118 toolBarActions.add(new IconToggleButton(dlg.action)); 120 IconToggleButton button = new IconToggleButton(dlg.action); 121 dlg.action.button = button; 122 toolBarActions.add(button); 119 123 toggleDialogs.add(dlg); 124 if (Main.pref.getBoolean(dlg.action.prefname+".visible")) 125 dlg.action.actionPerformed(new ActionEvent(this, 0, "")); 120 126 } 121 127 -
src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r86 r90 44 44 45 45 public final Map<OsmPrimitive, OsmPrimitive> conflicts = new HashMap<OsmPrimitive, OsmPrimitive>(); 46 p ublicfinal DefaultListModel model = new DefaultListModel();46 private final DefaultListModel model = new DefaultListModel(); 47 47 private final JList displaylist = new JList(model); 48 48 … … 120 120 } 121 121 122 public final void rebuildList() { 123 model.removeAllElements(); 124 for (OsmPrimitive osm : this.conflicts.keySet()) 125 if (osm instanceof Node) 126 model.addElement(osm); 127 for (OsmPrimitive osm : this.conflicts.keySet()) 128 if (osm instanceof Segment) 129 model.addElement(osm); 130 for (OsmPrimitive osm : this.conflicts.keySet()) 131 if (osm instanceof Way) 132 model.addElement(osm); 133 } 134 122 135 public final void add(Map<OsmPrimitive, OsmPrimitive> conflicts) { 123 136 this.conflicts.putAll(conflicts); 124 model.removeAllElements(); 125 for (OsmPrimitive osm : this.conflicts.keySet()) 126 model.addElement(osm); 137 rebuildList(); 127 138 } 128 139 -
src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r86 r90 117 117 }; 118 118 pane.createDialog(Main.main, "Search").setVisible(true); 119 System.out.println(pane.getValue());120 119 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue())) 121 120 return; -
src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r86 r90 2 2 3 3 import java.awt.BorderLayout; 4 import java.awt.EventQueue;5 4 import java.awt.event.ActionEvent; 6 5 import java.awt.event.KeyEvent; … … 23 22 public class ToggleDialog extends JPanel { 24 23 24 public final class ToggleDialogAction extends JosmAction { 25 public final String prefname; 26 public AbstractButton button; 27 28 private ToggleDialogAction(String name, String iconName, String tooltip, String shortcut, KeyStroke cut, String prefname) { 29 super(name, iconName, tooltip, shortcut, cut); 30 this.prefname = prefname; 31 } 32 33 public void actionPerformed(ActionEvent e) { 34 if (e != null && !(e.getSource() instanceof AbstractButton)) 35 button.setSelected(!button.isSelected()); 36 setVisible(button.isSelected()); 37 Main.pref.put(prefname+".visible", button.isSelected()); 38 } 39 } 40 25 41 /** 26 42 * The action to toggle this dialog. 27 43 */ 28 public JosmAction action;29 44 public ToggleDialogAction action; 45 30 46 /** 31 47 * Create a new ToggleDialog. … … 34 50 */ 35 51 public ToggleDialog(String title, String name, String iconName, String tooltip, String shortCutName, int shortCut, final String prefName) { 36 action = new JosmAction(name, "dialogs/"+iconName, tooltip, "Alt-"+shortCutName, KeyStroke.getKeyStroke(shortCut, KeyEvent.ALT_MASK)){ 37 public void actionPerformed(ActionEvent e) { 38 boolean show = !isVisible(); 39 if (e != null && e.getSource() instanceof AbstractButton) 40 show = ((AbstractButton)e.getSource()).isSelected(); 41 setVisible(show); 42 Main.pref.put(prefName+".visible", show); 43 } 44 }; 52 action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, "Alt-"+shortCutName, KeyStroke.getKeyStroke(shortCut, KeyEvent.ALT_MASK), prefName); 45 53 setLayout(new BorderLayout()); 46 54 add(new JLabel(title), BorderLayout.NORTH); 47 55 setVisible(false); 48 56 setBorder(BorderFactory.createEtchedBorder()); 49 if (Main.pref.getBoolean(prefName+".visible")) {50 EventQueue.invokeLater(new Runnable(){51 public void run() {52 action.putValue("active", true);53 action.actionPerformed(null);54 }55 });56 }57 57 } 58 58 } -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r86 r90 3 3 import java.awt.Graphics; 4 4 import java.awt.GridBagLayout; 5 import java.awt.event.ActionEvent; 5 6 import java.util.Collection; 6 7 import java.util.HashSet; … … 13 14 import javax.swing.JLabel; 14 15 import javax.swing.JMenuItem; 16 import javax.swing.JOptionPane; 15 17 import javax.swing.JPanel; 16 18 import javax.swing.JPopupMenu; … … 30 32 import org.openstreetmap.josm.data.osm.visitor.Visitor; 31 33 import org.openstreetmap.josm.gui.MapView; 34 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 32 35 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 33 36 import org.openstreetmap.josm.tools.GBC; … … 159 162 if (visitor.conflicts.isEmpty()) 160 163 return; 161 Main.main.getMapFrame().conflictDialog.add(visitor.conflicts); 164 ConflictDialog dlg = Main.main.getMapFrame().conflictDialog; 165 dlg.add(visitor.conflicts); 166 JOptionPane.showMessageDialog(Main.main, "There were conflicts during import."); 167 if (!dlg.isVisible()) 168 dlg.action.actionPerformed(new ActionEvent(this, 0, "")); 162 169 } 163 170 -
src/org/openstreetmap/josm/io/OsmWriter.java
r86 r90 3 3 import java.io.PrintWriter; 4 4 import java.io.Writer; 5 import java.text.SimpleDateFormat;6 5 import java.util.HashMap; 7 6 import java.util.Map.Entry; 8 7 9 8 import org.openstreetmap.josm.data.osm.DataSet; 10 import org.openstreetmap.josm.data.osm.Segment;11 9 import org.openstreetmap.josm.data.osm.Node; 12 10 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 import org.openstreetmap.josm.data.osm.Segment; 13 12 import org.openstreetmap.josm.data.osm.Way; 14 13 import org.openstreetmap.josm.data.osm.visitor.Visitor; … … 138 137 } 139 138 if (osm.timestamp != null) { 140 String time = new SimpleDateFormat("y-M-d H:m:s").format(osm.timestamp);139 String time = osm.getTimeStr(); 141 140 out.print(" timestamp='"+time+"'"); 142 141 } -
src/org/openstreetmap/josm/tools/SearchCompiler.java
r86 r90 6 6 import java.util.Map.Entry; 7 7 8 import org.openstreetmap.josm.data.osm.Segment;9 8 import org.openstreetmap.josm.data.osm.Node; 10 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 10 import org.openstreetmap.josm.data.osm.Segment; 11 11 import org.openstreetmap.josm.data.osm.Way; 12 12 … … 71 71 public KeyValue(String key, String value, boolean notValue) {this.key = key; this.value = value; this.notValue = notValue;} 72 72 @Override public boolean match(OsmPrimitive osm) { 73 String value = osm.get(key); 73 String value = null; 74 if (key.equals("timestamp")) 75 value = osm.getTimeStr(); 76 else 77 value = osm.get(key); 74 78 if (value == null) 75 return false;79 return notValue; 76 80 return (value.indexOf(this.value) != -1) != notValue; 77 81 } 78 82 @Override public String toString() {return key+"="+(notValue?"!":"")+value;} 79 83 } 80 84 81 85 private static class Any extends Match { 82 86 private String s;
Note:
See TracChangeset
for help on using the changeset viewer.