Changeset 6070 in josm for trunk/src/org
- Timestamp:
- 2013-07-17T00:01:49+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 200 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r5957 r6070 112 112 return true; 113 113 } 114 114 115 115 /** 116 116 * Global parent component for all dialogs and message boxes 117 117 */ 118 118 public static Component parent; 119 119 120 120 /** 121 121 * Global application. 122 122 */ 123 123 public static Main main; 124 124 125 125 /** 126 126 * Command-line arguments used to run the application. 127 127 */ 128 128 public static String[] commandLineArgs; 129 129 130 130 /** 131 131 * The worker thread slave. This is for executing all long and intensive … … 134 134 */ 135 135 public final static ExecutorService worker = new ProgressMonitorExecutor(); 136 136 137 137 /** 138 138 * Global application preferences … … 144 144 */ 145 145 public static final PrimitiveDeepCopy pasteBuffer = new PrimitiveDeepCopy(); 146 146 147 147 /** 148 148 * The layer source from which {@link Main#pasteBuffer} data comes from. … … 154 154 */ 155 155 public static MapFrame map; 156 156 157 157 /** 158 158 * Set to <code>true</code>, when in applet mode … … 543 543 contentPanePrivate.getActionMap().remove(action); 544 544 } 545 545 546 546 /** 547 547 * Replies the registered action for the given shortcut … … 565 565 566 566 /** 567 * Global panel. 567 * Global panel. 568 568 */ 569 569 public static final JPanel panel = new JPanel(new BorderLayout()); … … 704 704 /** 705 705 * Asks user to perform "save layer" operations (save .osm on disk and/or upload osm data to server) before osm layers deletion. 706 * 706 * 707 707 * @param selectedLayers The layers to check. Only instances of {@link OsmDataLayer} are considered. 708 708 * @param exit {@code true} if JOSM is exiting, {@code false} otherwise. … … 897 897 } 898 898 } 899 899 900 900 protected static void addListener() { 901 901 parent.addComponentListener(new WindowPositionSizeListener()); … … 1046 1046 /** 1047 1047 * Listener for window switch events. 1048 * 1048 * 1049 1049 * These are events, when the user activates a window of another application 1050 1050 * or comes back to JOSM. Window switches from one JOSM window to another -
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r5847 r6070 392 392 return comp; 393 393 394 if (r1.getUniqueId() > r2.getUniqueId()) 394 if (r1.getUniqueId() > r2.getUniqueId()) 395 395 return 1; 396 396 else if (r1.getUniqueId() < r2.getUniqueId()) -
trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
r5584 r6070 247 247 return Main.pref.get("osm-server.auth-method", "basic").equals("oauth"); 248 248 } 249 249 250 250 /** 251 251 * Explains a {@link OsmApiException} which was thrown because the authentication at … … 278 278 */ 279 279 public static void explainAuthorizationFailed(OsmApiException e) { 280 280 281 281 Matcher m; 282 282 String msg; 283 283 String url = e.getAccessedUrl(); 284 284 Pattern p = Pattern.compile("http://.*/api/0.6/(node|way|relation)/(\\d+)/(\\d+)"); 285 285 286 286 // Special case for individual access to redacted versions 287 287 // See http://wiki.openstreetmap.org/wiki/Open_Database_License/Changes_in_the_API … … 298 298 msg = ExceptionUtil.explainFailedAuthorisation(e); 299 299 } 300 300 301 301 HelpAwareOptionPane.showOptionDialog( 302 302 Main.parent, -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r5909 r6070 51 51 * 52 52 * Note: The button indices are counted from 1 and upwards. 53 * So for {@link #getValue()}, {@link #setDefaultButton(int)} and 53 * So for {@link #getValue()}, {@link #setDefaultButton(int)} and 54 54 * {@link #setCancelButton} the first button has index 1. 55 * 55 * 56 56 * Simple example: 57 57 * <pre> … … 274 274 /** 275 275 * Retrieve the user choice after the dialog has been closed. 276 * 276 * 277 277 * @return <ul> <li>The selected button. The count starts with 1.</li> 278 278 * <li>A return value of {@link #DialogClosedOtherwise} means the dialog has been closed otherwise.</li> … … 452 452 } 453 453 } 454 454 455 455 protected final WindowGeometry initWindowGeometry() { 456 456 return new WindowGeometry(rememberSizePref, defaultWindowGeometry); -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r5889 r6070 40 40 41 41 public static class LinkGeneral extends JosmEditorPane implements HyperlinkListener { 42 42 43 43 /** 44 44 * Constructs a new {@code LinkGeneral} with the given HTML text -
trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
r6051 r6070 42 42 public final String helpTopic; 43 43 private boolean enabled; 44 44 45 45 private final Collection<ChangeListener> listeners = new HashSet<ChangeListener>(); 46 46 47 47 /** 48 48 * Constructs a new {@code ButtonSpec}. … … 72 72 setEnabled(enabled); 73 73 } 74 74 75 75 /** 76 76 * Determines if this button spec is enabled … … 81 81 return enabled; 82 82 } 83 83 84 84 /** 85 85 * Enables or disables this button spec, depending on the value of the parameter {@code b}. … … 96 96 } 97 97 } 98 98 99 99 private final boolean addChangeListener(ChangeListener listener) { 100 100 return listener != null ? listeners.add(listener) : false; -
trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java
r5909 r6070 183 183 return userInfo; 184 184 } 185 185 186 186 /** 187 187 * Initializes the user identity manager from Basic Authentication values in the {@link org.openstreetmap.josm.data.Preferences} … … 251 251 } 252 252 return; 253 253 254 254 } else if (evt.getKey().equals("osm-server.url")) { 255 255 if (!(evt.getNewValue() instanceof StringSetting)) return; … … 260 260 setPartiallyIdentified(getUserName()); 261 261 } 262 262 263 263 } else if (evt.getKey().equals("oauth.access-token.key")) { 264 264 accessTokenKeyChanged = true; 265 265 266 266 } else if (evt.getKey().equals("oauth.access-token.secret")) { 267 267 accessTokenSecretChanged = true; 268 268 } 269 269 270 270 if (accessTokenKeyChanged && accessTokenSecretChanged) { 271 271 accessTokenKeyChanged = false; -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r5868 r6070 265 265 System.exit(1); 266 266 } 267 267 268 268 Main.commandLineArgs = argArray; 269 269 -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r5965 r6070 578 578 showAudioMenu(true); 579 579 } 580 580 581 581 Main.pref.addPreferenceChangeListener(new PreferenceChangedListener() { 582 582 @Override … … 600 600 new PresetsMenuEnabler(presetsMenu).refreshEnabled(); 601 601 } 602 602 603 603 protected void showAudioMenu(boolean showMenu) { 604 604 if (showMenu && audioMenu == null) { -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r6056 r6070 145 145 146 146 private final boolean unregisterTab; 147 147 148 148 /** 149 149 * Default width of the toggle dialog area. -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r6056 r6070 83 83 final MapView mv; 84 84 final Collector collector; 85 85 86 86 public class BackgroundProgressMonitor implements ProgressMonitorDialog { 87 87 … … 145 145 final JProgressBar progressBar = new JProgressBar(); 146 146 public final BackgroundProgressMonitor progressMonitor = new BackgroundProgressMonitor(); 147 147 148 148 private final MouseListener jumpToOnLeftClick; 149 149 private final SoMChangeListener somListener; 150 150 151 151 private double distValue; // Distance value displayed in distText, stored if refresh needed after a change of system of measurement 152 152 … … 456 456 EventQueue.invokeLater(new Runnable(){ 457 457 public void run() { 458 staticPopup.hide(); 458 staticPopup.hide(); 459 459 }}); 460 460 } … … 531 531 } 532 532 text.append(name); 533 533 534 534 boolean idShown = Main.pref.getBoolean("osm-primitives.showid"); 535 535 // fix #7557 - do not show ID twice 536 536 537 537 if (!osm.isNew() && !idShown) { 538 538 text.append(" [id="+osm.getId()+"]"); … … 611 611 612 612 private AWTEventListener awtListener = new AWTEventListener() { 613 @Override 613 @Override 614 614 public void eventDispatched(AWTEvent event) { 615 615 if (event instanceof InputEvent && … … 700 700 @Override 701 701 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 702 Component invoker = ((JPopupMenu)e.getSource()).getInvoker(); 702 Component invoker = ((JPopupMenu)e.getSource()).getInvoker(); 703 703 jumpButton.setVisible(invoker == latText || invoker == lonText); 704 704 doNotHide.setSelected(Main.pref.getBoolean("statusbar.always-visible", true)); … … 710 710 } 711 711 }); 712 712 713 713 // also show Jump To dialog on mouse click (except context menu) 714 714 jumpToOnLeftClick = new MouseAdapter() { … … 758 758 add(angleText, GBC.std().insets(3,0,0,0)); 759 759 add(distText, GBC.std().insets(3,0,0,0)); 760 760 761 761 distText.addMouseListener(new MouseAdapter() { 762 762 private final List<String> soms = new ArrayList<String>(new TreeSet<String>(NavigatableComponent.SYSTEMS_OF_MEASUREMENT.keySet())); 763 763 764 764 @Override 765 765 public void mouseClicked(MouseEvent e) { … … 769 769 } 770 770 }); 771 771 772 772 NavigatableComponent.addSoMChangeListener(somListener = new SoMChangeListener() { 773 773 @Override public void systemOfMeasurementChanged(String oldSoM, String newSoM) { … … 775 775 } 776 776 }); 777 777 778 778 latText.addMouseListener(jumpToOnLeftClick); 779 779 lonText.addMouseListener(jumpToOnLeftClick); 780 780 781 781 helpText.setEditable(false); 782 782 add(nameText, GBC.std().insets(3,0,0,0)); … … 803 803 thread.start(); 804 804 } 805 805 806 806 public JPanel getAnglePanel() { 807 807 return angleText; … … 892 892 public void destroy() { 893 893 NavigatableComponent.removeSoMChangeListener(somListener); 894 894 895 895 // MapFrame gets destroyed when the last layer is removed, but the status line background 896 896 // thread that collects the information doesn't get destroyed automatically. -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r6052 r6070 80 80 */ 81 81 public interface LayerChangeListener { 82 82 83 83 /** 84 84 * Notifies this listener that the active layer has changed. … … 87 87 */ 88 88 void activeLayerChange(Layer oldLayer, Layer newLayer); 89 89 90 90 /** 91 91 * Notifies this listener that a layer has been added. … … 93 93 */ 94 94 void layerAdded(Layer newLayer); 95 95 96 96 /** 97 97 * Notifies this listener that a layer has been removed. … … 272 272 @Override public void mouseMoved(MouseEvent e) { 273 273 lastMEvent = e; 274 } 274 } 275 275 @Override 276 276 public void mousePressed(MouseEvent me) { … … 288 288 private Dimension oldSize = null; 289 289 private Point oldLoc = null; 290 290 291 291 /* 292 292 * Call this method to keep map position on screen during next repaint … … 296 296 oldLoc = getLocationOnScreen(); 297 297 } 298 298 299 299 /** 300 300 * Adds a GPX layer. A GPX layer is added below the lowest data layer. … … 432 432 setActiveLayer(determineNextActiveLayer(layersList), false); 433 433 } 434 434 435 435 if (layer instanceof OsmDataLayer) { 436 436 ((OsmDataLayer)layer).removeLayerPropertyChangeListener(this); … … 552 552 zoomTo(newCenter); 553 553 } 554 554 555 555 List<Layer> visibleLayers = getVisibleLayersInZOrder(); 556 556 … … 565 565 566 566 boolean canUseBuffer; 567 567 568 568 synchronized (this) { 569 569 canUseBuffer = !paintPreferencesChanged; -
trunk/src/org/openstreetmap/josm/gui/MenuScroller.java
r5927 r6070 482 482 } 483 483 } 484 484 485 485 private class MenuScrollListener implements PopupMenuListener { 486 486 … … 597 597 } 598 598 } 599 599 600 600 private class MouseScrollListener implements MouseWheelListener { 601 601 public void mouseWheelMoved(MouseWheelEvent mwe) { -
trunk/src/org/openstreetmap/josm/gui/NameFormatterHook.java
r5903 r6070 15 15 */ 16 16 public String checkRelationTypeName(IRelation relation, String defaultName); 17 17 18 18 /** 19 19 * Check the node format. Return the corrected format if needed, null otherwise. … … 23 23 */ 24 24 public String checkFormat(INode node, String defaultName); 25 25 26 26 /** 27 27 * Check the way format. Return the corrected format if needed, null otherwise. -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r6065 r6070 64 64 void zoomChanged(); 65 65 } 66 66 67 67 /** 68 68 * Interface to notify listeners of the change of the system of measurement. … … 77 77 void systemOfMeasurementChanged(String oldSoM, String newSoM); 78 78 } 79 79 80 80 /** 81 81 * Simple data class that keeps map center and scale in one object. … … 150 150 /** 151 151 * Removes a SoM change listener 152 * 152 * 153 153 * @param listener the listener. Ignored if null or already absent 154 154 * @since 6056 … … 160 160 /** 161 161 * Adds a SoM change listener 162 * 162 * 163 163 * @param listener the listener. Ignored if null or already registered. 164 164 * @since 6056 … … 169 169 } 170 170 } 171 171 172 172 protected static void fireSoMChanged(String oldSoM, String newSoM) { 173 173 for (SoMChangeListener l : somChangeListeners) { … … 190 190 private Rectangle paintRect = null; 191 191 private Polygon paintPoly = null; 192 192 193 193 public NavigatableComponent() { 194 194 setLayout(null); … … 728 728 return getNearestNode(p, predicate, use_selected, null); 729 729 } 730 730 731 731 /** 732 732 * The *result* depends on the current map selection state IF use_selected is true … … 734 734 * If more than one node within node.snap-distance pixels is found, 735 735 * the nearest node selected is returned IF use_selected is true. 736 * 736 * 737 737 * If there are no selected nodes near that point, the node that is related to some of the preferredRefs 738 738 * … … 755 755 public final Node getNearestNode(Point p, Predicate<OsmPrimitive> predicate, 756 756 boolean use_selected, Collection<OsmPrimitive> preferredRefs) { 757 757 758 758 Map<Double, List<Node>> nlists = getNearestNodesImpl(p, predicate); 759 759 if (nlists.isEmpty()) return null; 760 760 761 761 if (preferredRefs != null && preferredRefs.isEmpty()) preferredRefs = null; 762 762 Node ntsel = null, ntnew = null, ntref = null; … … 793 793 794 794 // take nearest selected, nearest new or true nearest node to p, in that order 795 if (ntsel != null && useNtsel) 795 if (ntsel != null && useNtsel) 796 796 return ntsel; 797 if (ntref != null) 797 if (ntref != null) 798 798 return ntref; 799 if (ntnew != null) 799 if (ntnew != null) 800 800 return ntnew; 801 801 return nlists.values().iterator().next().get(0); … … 956 956 return (ntsel != null && use_selected) ? ntsel : wayseg; 957 957 } 958 958 959 959 /** 960 960 * The *result* depends on the current map selection state IF use_selected is true. … … 974 974 WaySegment wayseg = null, ntsel = null, ntref = null; 975 975 if (preferredRefs != null && preferredRefs.isEmpty()) preferredRefs = null; 976 976 977 977 searchLoop: for (List<WaySegment> wslist : getNearestWaySegmentsImpl(p, predicate).values()) { 978 978 for (WaySegment ws : wslist) { … … 1003 1003 } 1004 1004 } 1005 if (ntsel != null && use_selected) 1005 if (ntsel != null && use_selected) 1006 1006 return ntsel; 1007 1007 if (ntref != null) … … 1180 1180 */ 1181 1181 public final OsmPrimitive getNearestNodeOrWay(Point p, Predicate<OsmPrimitive> predicate, boolean use_selected) { 1182 Collection<OsmPrimitive> sel = 1182 Collection<OsmPrimitive> sel = 1183 1183 use_selected ? getCurrentDataSet().getSelected() : null; 1184 1184 OsmPrimitive osm = getNearestNode(p, predicate, use_selected, sel); … … 1295 1295 } 1296 1296 } 1297 1297 1298 1298 // add nearby nodes 1299 1299 for (List<Node> nlist : getNearestNodesImpl(p, predicate).values()) { 1300 1300 nearestList.addAll(nlist); 1301 1301 } 1302 1302 1303 1303 // add parent relations of nearby nodes and ways 1304 1304 Set<OsmPrimitive> parentRelations = new HashSet<OsmPrimitive>(); … … 1311 1311 } 1312 1312 nearestList.addAll(parentRelations); 1313 1313 1314 1314 if (ignore != null) { 1315 1315 nearestList.removeAll(ignore); … … 1392 1392 */ 1393 1393 public static class SystemOfMeasurement { 1394 1394 1395 1395 /** First value, in meters, used to translate unit according to above formula. */ 1396 1396 public final double aValue; … … 1404 1404 * @since 5870 */ 1405 1405 public final double areaCustomValue; 1406 /** Specific optional area unit. Set to {@code null} if not used. 1406 /** Specific optional area unit. Set to {@code null} if not used. 1407 1407 * @since 5870 */ 1408 1408 public final String areaCustomName; … … 1413 1413 * If a quantity x is given in m (x_m) and in unit a (x_a) then it translates as 1414 1414 * x_a == x_m / aValue 1415 * 1415 * 1416 1416 * @param aValue First value, in meters, used to translate unit according to above formula. 1417 1417 * @param aName First unit used to format text. … … 1422 1422 this(aValue, aName, bValue, bName, -1, null); 1423 1423 } 1424 1424 1425 1425 /** 1426 1426 * System of measurement. Currently covers only length (and area) units. … … 1428 1428 * If a quantity x is given in m (x_m) and in unit a (x_a) then it translates as 1429 1429 * x_a == x_m / aValue 1430 * 1430 * 1431 1431 * @param aValue First value, in meters, used to translate unit according to above formula. 1432 1432 * @param aName First unit used to format text. 1433 1433 * @param bValue Second value, in meters, used to translate unit according to above formula. 1434 1434 * @param bName Second unit used to format text. 1435 * @param areaCustomValue Specific optional area value, in squared meters, between {@code aValue*aValue} and {@code bValue*bValue}. 1435 * @param areaCustomValue Specific optional area value, in squared meters, between {@code aValue*aValue} and {@code bValue*bValue}. 1436 1436 * Set to {@code -1} if not used. 1437 1437 * @param areaCustomName Specific optional area unit. Set to {@code null} if not used. 1438 * 1438 * 1439 1439 * @since 5870 1440 1440 */ … … 1482 1482 return formatText(a, aName+"\u00b2"); 1483 1483 } 1484 1484 1485 1485 private static String formatText(double v, String unit) { 1486 1486 return String.format(Locale.US, "%." + (v<9.999999 ? 2 : 1) + "f %s", v, unit); … … 1493 1493 */ 1494 1494 public static final SystemOfMeasurement METRIC_SOM = new SystemOfMeasurement(1, "m", 1000, "km", 10000, "ha"); 1495 1495 1496 1496 /** 1497 1497 * Chinese system. … … 1499 1499 */ 1500 1500 public static final SystemOfMeasurement CHINESE_SOM = new SystemOfMeasurement(1.0/3.0, "\u5e02\u5c3a" /* chi */, 500, "\u5e02\u91cc" /* li */); 1501 1501 1502 1502 /** 1503 1503 * Imperial system (British Commonwealth and former British Empire). … … 1505 1505 */ 1506 1506 public static final SystemOfMeasurement IMPERIAL_SOM = new SystemOfMeasurement(0.3048, "ft", 1609.344, "mi", 4046.86, "ac"); 1507 1507 1508 1508 /** 1509 1509 * Nautical mile system (navigation, polar exploration). … … 1579 1579 Cursors = c; 1580 1580 } 1581 1581 1582 1582 @Override 1583 1583 public void paint(Graphics g) { … … 1613 1613 } 1614 1614 } 1615 1615 1616 1616 /** 1617 1617 * Requests to paint the given {@code Polygon} as a polyline (unclosed polygon). … … 1628 1628 } 1629 1629 } 1630 1630 1631 1631 /** 1632 1632 * Requests to clear the rectangled previously drawn. -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
r5895 r6070 81 81 /** 82 82 * Constructs a new {@code PleaseWaitDialog}. 83 * @param parent the {@code Component} from which the dialog is displayed. Can be {@code null}. 83 * @param parent the {@code Component} from which the dialog is displayed. Can be {@code null}. 84 84 */ 85 85 public PleaseWaitDialog(Component parent) { -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r5764 r6070 221 221 nc.requestPaintRect(getSelectionRectangle()); 222 222 } 223 223 224 224 private void paintLasso() { 225 225 if (mousePos == null || mousePosStart == null || mousePos == mousePosStart) { -
trunk/src/org/openstreetmap/josm/gui/ShowHideButtonListener.java
r4609 r6070 4 4 /** 5 5 * When some component (ToggleDialog, for example) is linked to button 6 * and needs information about button showing/hiding events, this interface 6 * and needs information about button showing/hiding events, this interface 7 7 * is used, setting the listener should be implemented by @class HideableButton 8 8 */ -
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r5926 r6070 26 26 public class SideButton extends JButton implements Destroyable { 27 27 private final static int iconHeight = 20; 28 28 29 29 private PropertyChangeListener propertyChangeListener; 30 30 -
trunk/src/org/openstreetmap/josm/gui/actionsupport/AlignImageryPanel.java
r5927 r6070 25 25 /** 26 26 * The panel to nag a user ONCE that he/she has to align imagery. 27 * 27 * 28 28 * @author zverik 29 29 */ … … 33 33 public AlignImageryPanel(boolean oneLine) { 34 34 super(); 35 35 36 36 Font font = getFont().deriveFont(Font.PLAIN, 14.0f); 37 37 JLabel nagLabel = new JLabel(tr("Aerial imagery might be misaligned. Please check its offset using GPS tracks!")); … … 39 39 nagLabel.setFont(font); 40 40 detailsList.setFont(font); 41 41 42 42 JButton closeButton = new JButton(ImageProvider.get("misc", "black_x")); 43 43 closeButton.setContentAreaFilled(false); … … 54 54 } 55 55 }); 56 56 57 57 setLayout(new GridBagLayout()); 58 58 if (!oneLine) { // tune for small screens … … 79 79 } 80 80 } 81 81 82 82 } -
trunk/src/org/openstreetmap/josm/gui/bbox/BBoxChooser.java
r5816 r6070 7 7 * A BBoxChooser is a component which provides a UI for choosing a 8 8 * bounding box. 9 * 9 * 10 10 */ 11 11 public interface BBoxChooser { … … 20 20 * Sets the current bounding box in this BboxChooser. If {@code bbox} 21 21 * is null the current bbox in this BBoxChooser is removed. 22 * 22 * 23 23 * @param bbox the bounding box 24 24 */ … … 29 29 * Replies null, if currently there isn't a bbox choosen in this 30 30 * BBoxChooser. 31 * 31 * 32 32 * @return the currently selected bounding box 33 33 */ -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java
r5925 r6070 56 56 private SizeButton iSizeButton = null; 57 57 private SourceButton iSourceButton = null; 58 58 59 59 private boolean isSelecting; 60 60 … … 79 79 iSizeButton = sizeButton; 80 80 iSourceButton = sourceButton; 81 81 82 82 isSelecting = false; 83 83 … … 158 158 iStartSelectionPoint = null; 159 159 isSelecting = false; 160 160 161 161 } else { 162 162 int sourceButton = iSourceButton.hit(e.getPoint()); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java
r5903 r6070 258 258 selectFirstTabWithConflicts(); 259 259 } 260 260 261 261 public void selectFirstTabWithConflicts() { 262 262 for (int i = 0; i < tabbedPane.getTabCount(); i++) { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java
r5903 r6070 87 87 private boolean isFrozen = false; 88 88 private final ComparePairListModel comparePairListModel; 89 89 90 90 private DataSet myDataset; 91 91 private Map<PrimitiveId, PrimitiveId> mergedMap; … … 130 130 return getMyPrimitiveById(entry); 131 131 } 132 132 133 133 public final OsmPrimitive getMyPrimitiveById(PrimitiveId entry) { 134 134 OsmPrimitive result = myDataset.getPrimitiveById(entry); … … 336 336 fireModelDataChanged(); 337 337 } 338 338 339 339 protected final void initPopulate(OsmPrimitive my, OsmPrimitive their, Map<PrimitiveId, PrimitiveId> mergedMap) { 340 340 CheckParameterUtil.ensureParameterNotNull(my, "my"); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
r5429 r6070 888 888 ); 889 889 } 890 890 891 891 public void unlinkAsListener() { 892 892 myEntriesTable.unlinkAsListener(); … … 1031 1031 } 1032 1032 } 1033 1033 1034 1034 protected final <P extends OsmPrimitive> OsmDataLayer findLayerFor(P primitive) { 1035 1035 if (primitive != null) { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMerger.java
r5335 r6070 60 60 theirEntriesTable.setLayer(findLayerFor(theirWay)); 61 61 } 62 62 63 63 public void deletePrimitive(boolean deleted) { 64 64 if (deleted) { -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
r5998 r6070 463 463 464 464 /** 465 * Replies the list of {@link Command commands} needed to resolve specified conflicts, 465 * Replies the list of {@link Command commands} needed to resolve specified conflicts, 466 466 * by displaying if necessary a {@link CombinePrimitiveResolverDialog} to the user. 467 467 * This dialog will allow the user to choose conflict resolution actions. 468 * 468 * 469 469 * Non-expert users are informed first of the meaning of these operations, allowing them to cancel. 470 * 470 * 471 471 * @param tagsOfPrimitives The tag collection of the primitives to be combined. 472 472 * Should generally be equal to {@code TagCollection.unionOfAllPrimitives(primitives)} … … 480 480 final Collection<? extends OsmPrimitive> primitives, 481 481 final Collection<? extends OsmPrimitive> targetPrimitives) throws UserCancelException { 482 482 483 483 CheckParameterUtil.ensureParameterNotNull(tagsOfPrimitives, "tagsOfPrimitives"); 484 484 CheckParameterUtil.ensureParameterNotNull(primitives, "primitives"); … … 511 511 dialog.getRelationMemberConflictResolverModel().populate(parentRelations, primitives); 512 512 dialog.prepareDefaultDecisions(); 513 513 514 514 // Ensure a proper title is displayed instead of a previous target (fix #7925) 515 515 if (targetPrimitives.size() == 1) { … … 555 555 parentRelations.size(), parentRelations.size(), primitives.size(), 556 556 DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(parentRelations)); 557 557 558 558 if (!ConditionalOptionPaneUtil.showConfirmationDialog( 559 559 "combine_tags", … … 596 596 + "Do you want to continue?", 597 597 primitives.size(), conflicts); 598 598 599 599 if (!ConditionalOptionPaneUtil.showConfirmationDialog( 600 600 "combine_tags", -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r5958 r6070 85 85 private CloseOpenChangesetsAction closeChangesetAction; 86 86 private LaunchChangesetManagerAction launchChangesetManagerAction; 87 87 88 88 private ChangesetDialogPopup popupMenu; 89 89 … … 204 204 launchChangesetManagerAction = new LaunchChangesetManagerAction(); 205 205 cbInSelectionOnly.addItemListener(launchChangesetManagerAction); 206 206 207 207 popupMenu = new ChangesetDialogPopup(lstInActiveDataLayer, lstInSelection); 208 208 … … 210 210 lstInSelection.addMouseListener(popupMenuLauncher); 211 211 lstInActiveDataLayer.addMouseListener(popupMenuLauncher); 212 212 213 213 createLayout(pnl, false, Arrays.asList(new SideButton[] { 214 214 new SideButton(selectObjectsAction, false), -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r5958 r6070 75 75 private SelectAction selectAction = new SelectAction(); 76 76 private SelectAndZoomAction selectAndZoomAction = new SelectAndZoomAction(); 77 77 78 78 public CommandStackDialog(final MapFrame mapFrame) { 79 79 super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), … … 89 89 undoTree.getSelectionModel().addTreeSelectionListener(undoSelectionListener); 90 90 InputMapUtils.unassignCtrlShiftUpDown(undoTree, JComponent.WHEN_FOCUSED); 91 91 92 92 redoTree.addMouseListener(new MouseEventHandler()); 93 93 redoTree.setRootVisible(false); … … 124 124 new SideButton(redoAction) 125 125 })); 126 126 127 127 InputMapUtils.addEnterAction(undoTree, selectAndZoomAction); 128 128 InputMapUtils.addEnterAction(redoTree, selectAndZoomAction); … … 303 303 return node; 304 304 } 305 305 306 306 /** 307 307 * Return primitives that are affected by some command 308 * @param path GUI elements 309 * @return collection of affected primitives, onluy usable ones 308 * @param path GUI elements 309 * @return collection of affected primitives, onluy usable ones 310 310 */ 311 311 protected static FilteredCollection<OsmPrimitive> getAffectedPrimitives(TreePath path) { … … 354 354 Main.map.mapView.getEditLayer().data.setSelected( getAffectedPrimitives(path)); 355 355 } 356 356 357 357 @Override 358 358 public void updateEnabledState() { … … 377 377 } 378 378 } 379 379 380 380 /** 381 381 * undo / redo switch to reduce duplicate code … … 448 448 super(new CommandStackPopup()); 449 449 } 450 450 451 451 @Override 452 452 public void mouseClicked(MouseEvent evt) { … … 456 456 } 457 457 } 458 458 459 459 private class CommandStackPopup extends JPopupMenu { 460 460 public CommandStackPopup(){ -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r6009 r6070 67 67 /** 68 68 * Replies the color used to paint conflicts. 69 * 69 * 70 70 * @return the color used to paint conflicts 71 71 * @since 1221 … … 83 83 /** the list widget for the list of conflicts */ 84 84 private JList lstConflicts; 85 85 86 86 private final JPopupMenu popupMenu = new JPopupMenu(); 87 87 private final PopupMenuHandler popupMenuHandler = new PopupMenuHandler(popupMenu); … … 115 115 btnResolve, btnSelect 116 116 })); 117 117 118 118 popupMenuHandler.addAction(Main.main.menu.autoScaleActions.get("conflict")); 119 119 } … … 143 143 DataSet.removeSelectionListener(this); 144 144 } 145 145 146 146 /** 147 147 * Add a list selection listener to the conflicts list. … … 152 152 lstConflicts.getSelectionModel().addListSelectionListener(listener); 153 153 } 154 154 155 155 /** 156 156 * Remove the given list selection listener from the conflicts list. … … 161 161 lstConflicts.getSelectionModel().removeListSelectionListener(listener); 162 162 } 163 163 164 164 /** 165 165 * Replies the popup menu handler. … … 218 218 /** 219 219 * Paints all conflicts that can be expressed on the main window. 220 * 220 * 221 221 * @param g The {@code Graphics} used to paint 222 222 * @param nc The {@code NavigatableComponent} used to get screen coordinates of nodes … … 294 294 /** 295 295 * returns the first selected item of the conflicts list 296 * 296 * 297 297 * @return Conflict 298 298 */ … … 331 331 return ht("/Dialog/ConflictList"); 332 332 } 333 333 334 334 class MouseEventHandler extends PopupMenuLauncher { 335 335 public MouseEventHandler() { … … 438 438 } 439 439 DataSet ds = Main.main.getCurrentDataSet(); 440 if (ds != null) { // Can't see how it is possible but it happened in #7942 440 if (ds != null) { // Can't see how it is possible but it happened in #7942 441 441 ds.setSelected(sel); 442 442 } … … 450 450 } 451 451 } 452 452 453 453 /** 454 454 * Warns the user about the number of detected conflicts -
trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java
r5360 r6070 108 108 historyTable.getSelectionModel().addListSelectionListener(showHistoryAction); 109 109 historyTable.getSelectionModel().addListSelectionListener(reloadAction); 110 110 111 111 // Show history dialog on Enter/Spacebar 112 112 InputMapUtils.addEnterAction(historyTable, showHistoryAction); -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r6058 r6070 92 92 93 93 private final NewAction newAction; 94 94 95 95 /** the popup menu and its handler */ 96 96 private final JPopupMenu popupMenu = new JPopupMenu(); … … 98 98 99 99 private final JosmTextField filter; 100 100 101 101 // Actions 102 102 /** the edit action */ … … 114 114 /** add all selected primitives to the given relations */ 115 115 private final AddSelectionToRelations addSelectionToRelations = new AddSelectionToRelations(); 116 116 117 117 HighlightHelper highlightHelper = new HighlightHelper(); 118 118 private boolean highlightEnabled = Main.pref.getBoolean("draw.target-highlight", true); … … 158 158 // Setup popup menu handler 159 159 setupPopupMenuHandler(); 160 160 161 161 JPanel pane = new JPanel(new BorderLayout()); 162 162 pane.add(filter, BorderLayout.NORTH); … … 175 175 176 176 InputMapUtils.unassignCtrlShiftUpDown(displaylist, JComponent.WHEN_FOCUSED); 177 177 178 178 // Select relation on Ctrl-Enter 179 179 InputMapUtils.addEnterAction(displaylist, selectRelationAction); … … 182 182 displaylist.getActionMap().put("edit", editAction); 183 183 displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_MASK), "edit"); 184 184 185 185 updateActionsRelationLists(); 186 186 } 187 187 188 188 // inform all actions about list of relations they need 189 189 private void updateActionsRelationLists() { 190 190 List<Relation> sel = model.getSelectedRelations(); 191 191 popupMenuHandler.setPrimitives(sel); 192 192 193 193 Component focused = FocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); 194 194 195 195 //update highlights 196 196 if (highlightEnabled && focused==displaylist && Main.isDisplayingMapView()) { … … 200 200 } 201 201 } 202 202 203 203 @Override public void showNotify() { 204 204 MapView.addLayerChangeListener(newAction); … … 214 214 DataSet.removeSelectionListener(addSelectionToRelations); 215 215 } 216 216 217 217 private void resetFilter() { 218 218 filter.setText(null); … … 309 309 310 310 class MouseEventHandler extends PopupMenuLauncher { 311 311 312 312 public MouseEventHandler() { 313 313 super(popupMenu); … … 318 318 if (highlightEnabled) highlightHelper.clear(); 319 319 } 320 320 321 321 protected void setCurrentRelationAsSelection() { 322 322 Main.main.getCurrentDataSet().setSelected((Relation)displaylist.getSelectedValue()); … … 326 326 EditRelationAction.launchEditor(getSelected()); 327 327 } 328 328 329 329 @Override public void mouseClicked(MouseEvent e) { 330 330 if (Main.main.getEditLayer() == null) return; … … 338 338 } 339 339 } 340 340 341 341 /** 342 342 * The action for creating a new relation … … 493 493 } 494 494 } 495 495 496 496 private void updateFilteredRelations() { 497 497 if (filter != null) { … … 519 519 return filteredRelations == null ? relations : filteredRelations; 520 520 } 521 521 522 522 private Relation getVisibleRelation(int index) { 523 523 if (index < 0 || index >= getVisibleRelations().size()) return null; … … 584 584 return i; 585 585 } 586 586 587 587 private Integer getVisibleRelationIndex(Relation rel) { 588 588 int i = getVisibleRelations().indexOf(rel); … … 604 604 605 605 private final void setupPopupMenuHandler() { 606 606 607 607 // -- select action 608 608 popupMenuHandler.addAction(selectRelationAction); … … 624 624 popupMenuHandler.addAction(duplicateAction).setVisible(false); 625 625 popupMenuHandler.addAction(deleteRelationsAction).setVisible(false); 626 626 627 627 popupMenuHandler.addAction(addSelectionToRelations); 628 628 } 629 629 630 630 /* ---------------------------------------------------------------------------------- */ 631 631 /* Methods that can be called from plugins */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r6058 r6070 155 155 } 156 156 }); 157 157 158 158 lstPrimitives.addMouseListener(new MouseEventHandler()); 159 159 … … 192 192 super(popupMenu); 193 193 } 194 194 195 195 @Override 196 196 public void mouseClicked(MouseEvent e) { … … 727 727 text.append(tr("Unselectable now")); 728 728 this.sel=new ArrayList<OsmPrimitive>(); // empty selection 729 } 729 } 730 730 if(ways + nodes + relations == 1) 731 731 { -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r6061 r6070 144 144 */ 145 145 protected JCheckBoxMenuItem windowMenuItem; 146 146 147 147 /** 148 148 * The linked preferences class (optional). If set, accessible from the title bar with a dedicated button … … 152 152 /** 153 153 * Constructor 154 * 154 * 155 155 * @param name the name of the dialog 156 156 * @param iconName the name of the icon to be displayed … … 493 493 add(buttonsHide); 494 494 } 495 495 496 496 // show the pref button if applicable 497 497 if (preferenceClass != null) { … … 558 558 return lblTitle.getText(); 559 559 } 560 560 561 561 public class DialogPopupMenu extends JPopupMenu { 562 562 public final JMenu buttonHidingMenu = new JMenu(tr("Side buttons")); … … 589 589 } 590 590 } 591 591 592 592 public void registerMouseListener() { 593 593 addMouseListener(new MouseEventHandler()); 594 594 } 595 595 596 596 class MouseEventHandler extends PopupMenuLauncher { 597 597 public MouseEventHandler() { … … 864 864 buttonsHide.setVisible(false); 865 865 } 866 866 867 867 // Register title bar mouse listener only after buttonActions has been initialized to have a complete popup menu 868 868 titleBar.registerMouseListener(); 869 869 870 870 return data; 871 871 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r6009 r6070 77 77 private final JPopupMenu popupMenu = new JPopupMenu(); 78 78 private final PopupMenuHandler popupMenuHandler = new PopupMenuHandler(popupMenu); 79 79 80 80 /** Last selected element */ 81 81 private DefaultMutableTreeNode lastSelectedNode = null; … … 417 417 tree.addTreeSelectionListener(listener); 418 418 } 419 419 420 420 /** 421 421 * Remove the given tree selection listener from the validator tree. … … 426 426 tree.removeTreeSelectionListener(listener); 427 427 } 428 428 429 429 /** 430 430 * Replies the popup menu handler. … … 435 435 return popupMenuHandler; 436 436 } 437 437 438 438 /** 439 439 * Replies the currently selected error, or {@code null}. … … 451 451 return null; 452 452 } 453 453 454 454 /** 455 455 * Watches for double clicks and launches the popup menu. 456 456 */ 457 457 class MouseEventHandler extends PopupMenuLauncher { 458 458 459 459 public MouseEventHandler() { 460 460 super(popupMenu); 461 461 } 462 462 463 463 @Override 464 464 public void mouseClicked(MouseEvent e) { … … 483 483 } 484 484 } 485 485 486 486 @Override public void launch(MouseEvent e) { 487 487 TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); … … 585 585 // do nothing 586 586 } 587 587 588 588 protected void fixError(TestError error) throws InterruptedException, InvocationTargetException { 589 589 if (error.isFixable()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java
r5998 r6070 557 557 558 558 class MouseEventHandler extends PopupMenuLauncher { 559 559 560 560 public MouseEventHandler() { 561 561 super(new ChangesetTablePopupMenu()); 562 562 } 563 563 564 564 @Override 565 565 public void mouseClicked(MouseEvent evt) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/SingleChangesetDownloadPanel.java
r5765 r6070 51 51 tfChangesetId.getDocument().addDocumentListener(actDownload); 52 52 add(btn); 53 54 if (Main.pref.getBoolean("downloadchangeset.autopaste", true)) { 53 54 if (Main.pref.getBoolean("downloadchangeset.autopaste", true)) { 55 55 tfChangesetId.tryToPasteFromClipboard(); 56 56 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialog.java
r5998 r6070 191 191 } 192 192 break; 193 193 194 194 case 2: 195 195 if (getChangesetQuery() == null) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r6068 r6070 152 152 */ 153 153 private final TagEditHelper editHelper = new TagEditHelper(propertyData, valueCount); 154 154 155 155 private final DataSetListenerAdapter dataChangedAdapter = new DataSetListenerAdapter(this); 156 156 private final HelpAction helpAction = new HelpAction(); … … 170 170 private final SelectRelationAction selectRelationAction = new SelectRelationAction(false); 171 171 private final SelectRelationAction addRelationToSelectionAction = new SelectRelationAction(true); 172 172 173 173 private final DownloadMembersAction downloadMembersAction = new DownloadMembersAction(); 174 174 private final DownloadSelectedIncompleteMembersAction downloadSelectedIncompleteMembersAction = new DownloadSelectedIncompleteMembersAction(); 175 175 176 176 private final SelectMembersAction selectMembersAction = new SelectMembersAction(false); 177 177 private final SelectMembersAction addMembersToSelectionAction = new SelectMembersAction(true); 178 178 179 179 private final HighlightHelper highlightHelper= new HighlightHelper(); 180 180 181 181 /** 182 182 * The Add button (needed to be able to disable it) … … 195 195 */ 196 196 private final PresetListPanel presets = new PresetListPanel(); 197 197 198 198 /** 199 199 * Text to display when nothing selected. … … 214 214 } 215 215 }; 216 216 217 217 // <editor-fold defaultstate="collapsed" desc="Dialog construction and helper methods"> 218 218 219 219 /** 220 220 * Create a new PropertiesDialog … … 231 231 setupMembershipMenu(); 232 232 buildMembershipTable(); 233 233 234 234 // combine both tables and wrap them in a scrollPane 235 235 JPanel bothTables = new JPanel(); … … 249 249 bothTables.add(presets, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 2, 5, 2)); 250 250 } 251 251 252 252 setupKeyboardShortcuts(); 253 253 … … 257 257 propertyTable.getSelectionModel().addListSelectionListener(deleteAction); 258 258 membershipTable.getSelectionModel().addListSelectionListener(deleteAction); 259 260 259 260 261 261 JScrollPane scrollPane = (JScrollPane) createLayout(bothTables, true, Arrays.asList(new SideButton[] { 262 262 this.btnAdd, this.btnEdit, this.btnDel … … 273 273 editHelper.loadTagsIfNeeded(); 274 274 } 275 275 276 276 private void buildPropertiesTable() { 277 277 // setting up the properties table … … 280 280 propertyTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 281 281 propertyTable.getTableHeader().setReorderingAllowed(false); 282 282 283 283 propertyTable.getColumnModel().getColumn(1).setCellRenderer(new DefaultTableCellRenderer(){ 284 284 @Override public Component getTableCellRendererComponent(JTable table, Object value, … … 383 383 mod.getColumn(0).setPreferredWidth(200); 384 384 } 385 385 386 386 /** 387 387 * creates the popup menu @field membershipMenu and its launcher on membership table … … 432 432 }); 433 433 } 434 435 /** 436 * creates the popup menu @field propertyMenu and its launcher on property table 434 435 /** 436 * creates the popup menu @field propertyMenu and its launcher on property table 437 437 */ 438 438 private void setupPropertiesMenu() { … … 448 448 propertyTable.addMouseListener(new PopupMenuLauncher(propertyMenu)); 449 449 } 450 450 451 451 /** 452 452 * Assignas all needed keys like Enter and Spacebar to most important actions 453 453 */ 454 454 private void setupKeyboardShortcuts() { 455 455 456 456 // ENTER = editAction, open "edit" dialog 457 457 propertyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) … … 461 461 .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),"onTableEnter"); 462 462 membershipTable.getActionMap().put("onTableEnter",editAction); 463 464 // INSERT button = addAction, open "add property" dialog 463 464 // INSERT button = addAction, open "add property" dialog 465 465 propertyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) 466 466 .put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0),"onTableInsert"); 467 467 propertyTable.getActionMap().put("onTableInsert",addAction); 468 468 469 469 // unassign some standard shortcuts for JTable to allow upload / download 470 470 InputMapUtils.unassignCtrlShiftUpDown(propertyTable, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 471 471 472 472 // unassign some standard shortcuts for correct copy-pasting, fix #8508 473 473 propertyTable.setTransferHandler(null); 474 474 475 475 propertyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) 476 476 .put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),"onCopy"); … … 479 479 // allow using enter to add tags for all look&feel configurations 480 480 InputMapUtils.enableEnter(this.btnAdd); 481 481 482 482 // DEL button = deleteAction 483 483 getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( … … 485 485 ); 486 486 getActionMap().put("delete", deleteAction); 487 487 488 488 // F1 button = custom help action 489 489 getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( … … 491 491 getActionMap().put("onHelp", helpAction); 492 492 } 493 493 494 494 /** 495 495 * This simply fires up an {@link RelationEditor} for the relation shown; everything else … … 506 506 ((MemberInfo) membershipData.getValueAt(row, 1)).role).setVisible(true); 507 507 } 508 508 509 509 private int findRow(TableModel model, Object value) { 510 510 for (int i=0; i<model.getRowCount(); i++) { … … 514 514 return -1; 515 515 } 516 516 517 517 /** 518 518 * Update selection status, call @{link #selectionChanged} function. … … 525 525 } 526 526 } 527 527 528 528 // </editor-fold> 529 529 530 530 // <editor-fold defaultstate="collapsed" desc="Event listeners methods"> 531 531 532 532 @Override 533 533 public void showNotify() { … … 558 558 } 559 559 } 560 560 561 561 @Override 562 562 public void destroy() { … … 625 625 ? e.getValue().keySet().iterator().next() : tr("<different>")); 626 626 } 627 627 628 628 membershipData.setRowCount(0); 629 629 … … 698 698 } 699 699 } 700 700 701 701 /* ---------------------------------------------------------------------------------- */ 702 702 /* EditLayerChangeListener */ … … 721 721 722 722 // <editor-fold defaultstate="collapsed" desc="Methods that are called by plugins to extend fuctionality "> 723 723 724 724 /** 725 725 * Replies the property popup menu handler. … … 752 752 return row > -1 ? (IRelation) membershipData.getValueAt(row, 0) : null; 753 753 } 754 754 755 755 // </editor-fold> 756 756 757 757 /** 758 758 * Class that watches for mouse clicks … … 852 852 } 853 853 }; 854 854 855 855 /** 856 856 * Action handling delete button press in properties dialog. … … 940 940 } else if (membershipTable.getSelectedRowCount() > 0) { 941 941 int[] rows = membershipTable.getSelectedRows(); 942 // delete from last relation to convserve row numbers in the table 942 // delete from last relation to convserve row numbers in the table 943 943 for (int i=rows.length-1; i>=0; i--) { 944 944 deleteFromRelation(rows[i]); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r5925 r6070 415 415 refreshView(r); 416 416 } 417 SwingUtilities.invokeLater(new Runnable() { 418 public void run() { 419 Main.map.repaint(); 420 } 421 }); 417 SwingUtilities.invokeLater(new Runnable() { 418 public void run() { 419 Main.map.repaint(); 420 } 421 }); 422 422 } catch (Exception e) { 423 423 if (canceled) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r6068 r6070 216 216 } 217 217 ); 218 218 219 219 tagEditorPanel.setNextFocusComponent(memberTable); 220 220 selectionTable.setFocusable(false); … … 492 492 tb.add(moveDownAction); 493 493 memberTable.getActionMap().put("moveDown", moveDownAction); 494 494 495 495 tb.addSeparator(); 496 496 … … 499 499 memberTableModel.getSelectionModel().addListSelectionListener(editAction); 500 500 tb.add(editAction); 501 501 502 502 // -- delete action 503 503 RemoveAction removeSelectedAction = new RemoveAction(); … … 505 505 tb.add(removeSelectedAction); 506 506 memberTable.getActionMap().put("removeSelected", removeSelectedAction); 507 507 508 508 tb.addSeparator(); 509 509 // -- sort action … … 536 536 inputMap.put((KeyStroke) moveDownAction.getValue(AbstractAction.ACCELERATOR_KEY),"moveDown"); 537 537 inputMap.put((KeyStroke) downloadIncompleteMembersAction.getValue(AbstractAction.ACCELERATOR_KEY),"downloadIncomplete"); 538 538 539 539 return tb; 540 540 } … … 677 677 } 678 678 679 679 680 680 private void registerCopyPasteAction(AbstractAction action, Object actionName, KeyStroke shortcut) { 681 681 int mods = shortcut.getModifiers(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberRoleCellEditor.java
r4238 r6070 26 26 this.ds = ds; 27 27 editor = new AutoCompletingTextField(); 28 editor.setBorder(BorderFactory.createEmptyBorder(1,1,1,1)); 28 editor.setBorder(BorderFactory.createEmptyBorder(1,1,1,1)); 29 29 autoCompletionList = new AutoCompletionList(); 30 30 editor.setAutoCompletionList(autoCompletionList); … … 57 57 return super.stopCellEditing(); 58 58 } 59 59 60 60 /** Returns the edit field for this cell editor. */ 61 61 public AutoCompletingTextField getEditor() { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
r6064 r6070 63 63 */ 64 64 protected void init() { 65 MemberRoleCellEditor ce = (MemberRoleCellEditor)getColumnModel().getColumn(0).getCellEditor(); 65 MemberRoleCellEditor ce = (MemberRoleCellEditor)getColumnModel().getColumn(0).getCellEditor(); 66 66 setRowHeight(ce.getEditor().getPreferredSize().height); 67 67 setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); … … 75 75 76 76 initHighlighting(); 77 77 78 78 // install custom navigation actions 79 79 // … … 81 81 getActionMap().put("selectPreviousColumnCell", new SelectPreviousColumnCellAction()); 82 82 } 83 83 84 84 @Override 85 85 protected ZoomToAction buildZoomToAction() { 86 86 return new ZoomToAction(this); 87 87 } 88 88 89 89 @Override 90 90 protected JPopupMenu buildPopupMenu() { … … 99 99 return menu; 100 100 } 101 101 102 102 @Override 103 103 public Dimension getPreferredSize(){ … … 140 140 } 141 141 }}; 142 142 143 143 private void initHighlighting() { 144 144 highlightEnabled = Main.pref.getBoolean("draw.target-highlight", true); … … 217 217 MapView.removeLayerChangeListener(zoomToGap); 218 218 } 219 219 220 220 public void stopHighlighting() { 221 221 if (highlighterListener == null) return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r5911 r6070 380 380 return updateCount; 381 381 } 382 382 383 383 private void clearErrors() { 384 384 if (errors != null) { -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r5998 r6070 144 144 145 145 pnl.add(sizeCheck, GBC.eol().anchor(GBC.EAST).insets(5,5,5,2)); 146 146 147 147 if (!ExpertToggleAction.isExpert()) { 148 148 JLabel infoLabel = new JLabel(tr("Use left click&drag to select area, arrows or right mouse button to scroll map, wheel or +/- to zoom.")); … … 165 165 pnl.add(btnDownload = new SideButton(actDownload = new DownloadAction())); 166 166 InputMapUtils.enableEnter(btnDownload); 167 167 168 168 makeCheckBoxRespondToEnter(cbDownloadGpxData); 169 169 makeCheckBoxRespondToEnter(cbDownloadOsmData); … … 308 308 cbDownloadGpxData.setSelected(Main.pref.getBoolean("download.gps", false)); 309 309 cbNewLayer.setSelected(Main.pref.getBoolean("download.newlayer", false)); 310 cbStartup.setSelected( isAutorunEnabled() ); 310 cbStartup.setSelected( isAutorunEnabled() ); 311 311 int idx = Main.pref.getInteger("download.tab", 0); 312 312 if (idx < 0 || idx > tpDownloadAreaSelectors.getTabCount()) { -
trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java
r5898 r6070 63 63 w = iScreenSize.width * 90 / 100; 64 64 h = iScreenSize.height * 90 / 100; 65 iDownloadDialogDimension = iGui.getSize(); 65 iDownloadDialogDimension = iGui.getSize(); 66 66 } 67 67 // shrink … … 73 73 } 74 74 75 // resize and center the DownloadDialog 76 iGui.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h); 75 // resize and center the DownloadDialog 76 iGui.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h); 77 77 repaint(); 78 78 } -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r5356 r6070 259 259 LatLon coord = node.getCoords(); 260 260 LatLon oppositeCoord = oppositeNode.getCoords(); 261 261 262 262 // display the coordinates 263 263 // … … 267 267 // update background color to reflect differences in the coordinates 268 268 // 269 if (coord == oppositeCoord || 269 if (coord == oppositeCoord || 270 270 (coord != null && oppositeCoord != null && coord.lat() == oppositeCoord.lat())) { 271 271 lblLat.setBackground(Color.WHITE); … … 273 273 lblLat.setBackground(BGCOLOR_DIFFERENCE); 274 274 } 275 if (coord == oppositeCoord || 275 if (coord == oppositeCoord || 276 276 (coord != null && oppositeCoord != null && coord.lon() == oppositeCoord.lon())) { 277 277 lblLon.setBackground(Color.WHITE); … … 285 285 } 286 286 } 287 287 288 288 private static class DistanceViewer extends LatLonViewer { 289 289 290 290 private JLabel lblDistance; 291 291 292 292 public DistanceViewer(HistoryBrowserModel model) { 293 293 super(model, PointInTimeType.REFERENCE_POINT_IN_TIME); … … 329 329 LatLon coord = node.getCoords(); 330 330 LatLon oppositeCoord = oppositeNode.getCoords(); 331 331 332 332 // update distance 333 333 // -
trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java
r5302 r6070 28 28 * handles everything on its own, in other words it renders itself and also functions 29 29 * as editor so the checkboxes may be set by the user. 30 * 30 * 31 31 * Intended usage is like this: 32 32 * ActionFlagsTableCell aftc = new ActionFlagsTableCell(); -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetCommentModel.java
r5266 r6070 15 15 * Sets the current changeset comment and notifies observers if the comment 16 16 * has changed. 17 * 17 * 18 18 * @param comment the new upload comment. Empty string assumed if null. 19 19 */ … … 29 29 /** 30 30 * Replies the current changeset comment in this model. 31 * 31 * 32 32 * @return the current changeset comment in this model. 33 33 */ -
trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java
r5874 r6070 49 49 this.mkdir = mkdir; 50 50 this.unpack = unpack; 51 } 52 51 } 52 53 53 private static class DownloadException extends Exception { 54 54 public DownloadException(String msg) { … … 68 68 69 69 70 @Override 70 @Override 71 71 protected void cancel() { 72 72 this.canceled = true; … … 74 74 } 75 75 76 @Override 76 @Override 77 77 protected void finish() {} 78 78 … … 91 91 } 92 92 } 93 93 94 94 URL url = new URL(address); 95 95 int size; … … 100 100 size = downloadConnection.getContentLength(); 101 101 } 102 102 103 103 progressMonitor.setTicksCount(100); 104 104 progressMonitor.subTask(tr("Downloading File {0}: {1} bytes...", file.getName(),size)); 105 105 106 106 in = downloadConnection.getInputStream(); 107 107 out = new FileOutputStream(file); … … 112 112 out.write(buffer, 0, read); 113 113 count+=read; 114 if (canceled) break; 114 if (canceled) break; 115 115 p2 = 100 * count / size; 116 116 if (p2!=p1) { … … 142 142 } 143 143 144 @Override 144 @Override 145 145 protected void realRun() throws SAXException, IOException { 146 146 if (canceled) return; … … 160 160 return canceled; 161 161 } 162 162 163 163 /** 164 164 * Recursive unzipping function … … 166 166 * @param file 167 167 * @param dir 168 * @throws IOException 168 * @throws IOException 169 169 */ 170 170 public static void unzipFileRecursively(File file, String dir) throws IOException { -
trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
r5791 r6070 95 95 if (osm == null) { 96 96 switch (id.getType()) { 97 case NODE: 97 case NODE: 98 98 osm = new Node(id.getUniqueId()); 99 99 break; … … 128 128 DataSetMerger merger = new DataSetMerger(ds, theirDataSet); 129 129 merger.merge(); 130 130 131 131 // if incomplete relation members exist, download them too 132 132 for (Relation r : ds.getRelations()) { … … 165 165 } 166 166 } 167 167 168 168 } catch(Exception e) { 169 169 if (canceled) return; … … 171 171 } 172 172 } 173 173 174 174 /** 175 175 * replies the set of ids of all primitives for which a fetch request to the -
trunk/src/org/openstreetmap/josm/gui/io/RecentlyOpenedFilesMenu.java
r5729 r6070 49 49 }); 50 50 } 51 51 52 52 private void rebuild() { 53 53 removeAll(); -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r5998 r6070 56 56 * This is a dialog for entering upload options like the parameters for 57 57 * the upload changeset and the strategy for opening/closing a changeset. 58 * 58 * 59 59 */ 60 60 public class UploadDialog extends JDialog implements PropertyChangeListener, PreferenceChangedListener{ … … 111 111 // 112 112 pnl.add(pnlUploadedObjects = new UploadedObjectsSummaryPanel(), GBC.eol().fill(GBC.BOTH)); 113 113 114 114 // Custom components 115 115 for (Component c : customComponents) { … … 309 309 public void setDefaultChangesetTags(Map<String, String> tags) { 310 310 pnlTagSettings.setDefaultTags(tags); 311 for (String key: tags.keySet()) { 312 if (key.equals("comment")) { 311 for (String key: tags.keySet()) { 312 if (key.equals("comment")) { 313 313 changesetCommentModel.setComment(tags.get(key)); 314 } 315 } 314 } 315 } 316 316 } 317 317 … … 370 370 super.setVisible(visible); 371 371 } 372 373 /** 374 * Adds a custom component to this dialog. 372 373 /** 374 * Adds a custom component to this dialog. 375 375 * Custom components added at JOSM startup are displayed between the objects list and the properties tab pane. 376 376 * @param c The custom component to add. If {@code null}, this method does nothing. -
trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
r5998 r6070 264 264 putValue(Action.NAME, tr("Cancel")); 265 265 putValue(Action.SMALL_ICON, ImageProvider.get("", "cancel")); 266 getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) 267 .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); 266 getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) 267 .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); 268 268 getRootPane().getActionMap().put("ESCAPE", this); 269 269 setEnabled(true); -
trunk/src/org/openstreetmap/josm/gui/layer/CustomizeColor.java
r4270 r6070 34 34 this(); 35 35 layers = new LinkedList<Layer>(); 36 layers.add(l); 36 layers.add(l); 37 37 } 38 38 -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r5959 r6070 113 113 return new Date[]{earliest.getTime(), latest.getTime()}; 114 114 } 115 115 116 116 /** 117 117 * Returns minimum and maximum timestamps for all tracks … … 138 138 return new Date[]{new Date((long) (min * 1000)), new Date((long) (max * 1000)), }; 139 139 } 140 141 140 141 142 142 /** 143 143 * returns a human readable string that shows the timespan of the given track … … 288 288 new LayerListPopup.InfoAction(this) }; 289 289 } 290 290 291 291 public boolean isLocalFile() { 292 292 return isLocalFile; … … 335 335 return true; 336 336 } 337 337 338 338 public void filterTracksByDate(Date fromDate, Date toDate, boolean showWithoutDate) { 339 339 int i = 0; … … 342 342 for (GpxTrack trk : data.tracks) { 343 343 Date[] t = GpxLayer.getMinMaxTimeForTrack(trk); 344 344 345 345 if (t==null) continue; 346 346 long tm = t[1].getTime(); … … 543 543 } 544 544 } 545 545 546 546 for (GpxTrack trk : data.tracks) { 547 547 for (GpxTrackSegment segment : trk.getSegments()) { … … 880 880 return SaveActionBase.createAndOpenSaveFileChooser(tr("Save GPX file"), GpxImporter.FILE_FILTER); 881 881 } 882 882 883 883 } -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r5963 r6070 130 130 String url = info.getUrl(); 131 131 if (url != null) { 132 panel.add(new JLabel(tr("URL: ")), GBC.std().insets(0, 5, 2, 0)); 132 panel.add(new JLabel(tr("URL: ")), GBC.std().insets(0, 5, 2, 0)); 133 133 panel.add(new UrlLabel(url), GBC.eol().insets(2, 5, 10, 0)); 134 134 } -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r5459 r6070 436 436 // To be overriden if needed 437 437 } 438 438 439 439 /** 440 440 * Replies the savable state of this layer (i.e if it can be saved through a "File->Save" dialog). … … 445 445 return false; 446 446 } 447 447 448 448 /** 449 449 * Checks whether it is ok to launch a save (whether we have data, there is no conflict etc.) … … 454 454 return true; 455 455 } 456 456 457 457 /** 458 458 * Creates a new "Save" dialog for this layer and makes it visible.<br/> -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r6039 r6070 163 163 void commandChanged(int queueSize, int redoSize); 164 164 } 165 165 166 166 /** 167 167 * Listener called when a state of this layer has changed. … … 175 175 void uploadDiscouragedChanged(OsmDataLayer layer, boolean newValue); 176 176 } 177 177 178 178 private final CopyOnWriteArrayList<LayerStateChangeListener> layerStateChangeListeners = new CopyOnWriteArrayList<LayerStateChangeListener>(); 179 179 180 180 /** 181 181 * Adds a layer state change listener … … 189 189 } 190 190 } 191 191 192 192 /** 193 193 * Removes a layer property change listener … … 259 259 return ImageProvider.get("layer", "osmdata_small"); 260 260 } 261 261 262 262 /** 263 263 * TODO: @return Return a dynamic drawn icon of the map data. The icon is … … 355 355 mergeFrom(from, null); 356 356 } 357 357 358 358 /** 359 359 * merges the primitives in dataset <code>from</code> into the dataset of … … 415 415 416 416 @Override public boolean isMergable(final Layer other) { 417 // isUploadDiscouraged commented to allow merging between normal layers and discouraged layers with a warning (see #7684) 417 // isUploadDiscouraged commented to allow merging between normal layers and discouraged layers with a warning (see #7684) 418 418 return other instanceof OsmDataLayer;// && (isUploadDiscouraged() == ((OsmDataLayer)other).isUploadDiscouraged()); 419 419 } … … 781 781 return true; 782 782 } 783 783 784 784 /** 785 785 * Check the data set if it would be empty on save. It is empty, if it contains -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r6042 r6070 128 128 protected TileSource tileSource; 129 129 protected OsmTileLoader tileLoader; 130 130 131 131 public static TileLoaderFactory loaderFactory = new TileLoaderFactory() { 132 132 @Override … … 144 144 } 145 145 }; 146 146 147 147 /** 148 148 * Plugins that wish to set custom tile loader should call this method … … 151 151 TMSLayer.loaderFactory = loaderFactory; 152 152 } 153 153 154 154 HashSet<Tile> tileRequestsOutstanding = new HashSet<Tile>(); 155 155 @Override … … 170 170 }*/ 171 171 } 172 172 173 173 @Override 174 174 public TileCache getTileCache() { 175 175 return tileCache; 176 176 } 177 177 178 178 private class TmsTileClearController implements TileClearController, CancelListener { 179 179 180 180 private final ProgressMonitor monitor; 181 181 private boolean cancel = false; 182 182 183 183 public TmsTileClearController(ProgressMonitor monitor) { 184 184 this.monitor = monitor; … … 219 219 /** 220 220 * Clears the tile cache. 221 * 222 * If the current tileLoader is an instance of OsmTileLoader, a new 223 * TmsTileClearController is created and passed to the according clearCache 221 * 222 * If the current tileLoader is an instance of OsmTileLoader, a new 223 * TmsTileClearController is created and passed to the according clearCache 224 224 * method. 225 * 226 * @param monitor 225 * 226 * @param monitor 227 227 * @see MemoryTileCache#clear() 228 * @see OsmFileCacheTileLoader#clearCache(org.openstreetmap.gui.jmapviewer.interfaces.TileSource, org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader.TileClearController) 228 * @see OsmFileCacheTileLoader#clearCache(org.openstreetmap.gui.jmapviewer.interfaces.TileSource, org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader.TileClearController) 229 229 */ 230 230 void clearTileCache(ProgressMonitor monitor) { … … 257 257 /** 258 258 * Initiates a repaint of Main.map 259 * 259 * 260 260 * @see Main#map 261 * @see MapFrame#repaint() 261 * @see MapFrame#repaint() 262 262 */ 263 263 void redraw() { … … 360 360 * Creates and returns a new TileSource instance depending on the {@link ImageryType} 361 361 * of the passed ImageryInfo object. 362 * 362 * 363 363 * If no appropriate TileSource is found, null is returned. 364 * Currently supported ImageryType are {@link ImageryType#TMS}, 364 * Currently supported ImageryType are {@link ImageryType#TMS}, 365 365 * {@link ImageryType#BING}, {@link ImageryType#SCANEX}. 366 * 366 * 367 367 * @param info 368 368 * @return a new TileSource instance or null if no TileSource for the ImageryInfo/ImageryType could be found. 369 * @throws IllegalArgumentException 369 * @throws IllegalArgumentException 370 370 */ 371 371 public static TileSource getTileSource(ImageryInfo info) throws IllegalArgumentException { … … 706 706 return zia; 707 707 } 708 708 709 709 public boolean increaseZoomLevel() { 710 710 if (zoomIncreaseAllowed()) { … … 739 739 return currentZoomLevel > this.getMinZoomLvl(); 740 740 } 741 741 742 742 /** 743 743 * Zoom out from map. 744 * 744 * 745 745 * @return true, if zoom increasing was successfull, false othervise 746 746 */ … … 774 774 return new Tile(tileSource, x, y, zoom); 775 775 } 776 776 777 777 synchronized Tile getOrCreateTile(int x, int y, int zoom) { 778 778 Tile tile = getTile(x, y, zoom); … … 852 852 return !done; 853 853 } 854 854 855 855 boolean imageLoaded(Image i) { 856 856 if (i == null) … … 861 861 return false; 862 862 } 863 863 864 864 /** 865 * Returns the image for the given tile if both tile and image are loaded. 865 * Returns the image for the given tile if both tile and image are loaded. 866 866 * Otherwise returns null. 867 * 867 * 868 868 * @param tile the Tile for which the image should be returned 869 869 * @return the image of the tile or null. … … 953 953 } 954 954 } 955 955 956 956 // This function is called for several zoom levels, not just 957 957 // the current one. It should not trigger any tiles to be … … 1073 1073 return Main.map.mapView.getPoint(Main.getProjection().latlon2eastNorth(ll).add(getDx(), getDy())); 1074 1074 } 1075 1075 1076 1076 private Point pixelPos(Tile t) { 1077 1077 double lon = tileSource.tileXToLon(t.getXtile(), t.getZoom()); … … 1079 1079 return pixelPos(tmpLL); 1080 1080 } 1081 1081 1082 1082 private LatLon getShiftedLatLon(EastNorth en) { 1083 1083 return Main.getProjection().eastNorth2latlon(en.add(-getDx(), -getDy())); 1084 1084 } 1085 1085 1086 1086 private Coordinate getShiftedCoord(EastNorth en) { 1087 1087 LatLon ll = getShiftedLatLon(en); … … 1138 1138 } 1139 1139 } 1140 1140 1141 1141 boolean tooSmall() { 1142 1142 return this.tilesSpanned() < 2.1; 1143 1143 } 1144 1144 1145 1145 boolean tooLarge() { 1146 1146 return this.tilesSpanned() > 10; 1147 1147 } 1148 1148 1149 1149 boolean insane() { 1150 1150 return this.tilesSpanned() > 100; 1151 1151 } 1152 1152 1153 1153 double tilesSpanned() { 1154 1154 return Math.sqrt(1.0 * this.size()); … … 1168 1168 return this.__allTiles(false); 1169 1169 } 1170 1170 1171 1171 List<Tile> allTilesCreate() { 1172 1172 return this.__allTiles(true); 1173 1173 } 1174 1174 1175 1175 private List<Tile> __allTiles(boolean create) { 1176 1176 // Tileset is either empty or too large … … 1193 1193 return ret; 1194 1194 } 1195 1195 1196 1196 private List<Tile> allLoadedTiles() { 1197 1197 List<Tile> ret = new ArrayList<Tile>(); -
trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
r5907 r6070 64 64 if (root == null || root.getChildCount() == 0) 65 65 return; 66 66 67 67 PaintVisitor paintVisitor = new PaintVisitor(g, mv); 68 68 … … 80 80 severity = severity.getPreviousSibling(); 81 81 } 82 82 83 83 paintVisitor.clearPaintedObjects(); 84 84 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r4698 r6070 37 37 /** The image currently displayed */ 38 38 private Image image = null; 39 39 40 40 /** The image currently displayed */ 41 41 private boolean errorLoading = false; … … 99 99 ImageDisplay.this.image = img; 100 100 visibleRect = new Rectangle(0, 0, img.getWidth(null), img.getHeight(null)); 101 101 102 102 final int w = (int) visibleRect.getWidth(); 103 103 final int h = (int) visibleRect.getHeight(); 104 104 105 105 outer: { 106 106 final int hh, ww, q; … … 131 131 break outer; 132 132 } 133 133 134 134 final BufferedImage rot = new BufferedImage(ww, hh, BufferedImage.TYPE_INT_RGB); 135 135 final AffineTransform xform = AffineTransform.getQuadrantRotateInstance(q, ax, ay); … … 137 137 g.drawImage(image, xform, null); 138 138 g.dispose(); 139 139 140 140 visibleRect.setSize(ww, hh); 141 141 image.flush(); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java
r5927 r6070 43 43 public class ChooseTrackVisibilityAction extends AbstractAction { 44 44 private final GpxLayer layer; 45 45 46 46 DateFilterPanel dateFilter; 47 47 JTable table; 48 48 49 49 public ChooseTrackVisibilityAction(final GpxLayer layer) { 50 50 super(tr("Choose visible tracks"), ImageProvider.get("dialogs/filter")); … … 124 124 return t; 125 125 } 126 126 127 127 boolean noUpdates=false; 128 128 129 129 /** selects all rows (=tracks) in the table that are currently visible on the layer*/ 130 130 private void selectVisibleTracksInTable() { … … 154 154 }); 155 155 } 156 156 157 157 private void updateVisibilityFromTable() { 158 158 ListSelectionModel s = (ListSelectionModel) table.getSelectionModel(); … … 163 163 Main.map.repaint(100); 164 164 } 165 165 166 166 @Override 167 167 public void actionPerformed(ActionEvent arg0) { 168 168 final JPanel msg = new JPanel(new GridBagLayout()); 169 169 170 170 dateFilter = new DateFilterPanel(layer, "gpx.traces", false); 171 171 dateFilter.setFilterAppliedListener(new ActionListener(){ … … 179 179 }); 180 180 dateFilter.loadFromPrefs(); 181 181 182 182 final JToggleButton b = new JToggleButton(new AbstractAction(tr("Select by date")) { 183 183 @Override public void actionPerformed(ActionEvent e) { … … 193 193 msg.add(b, GBC.std().insets(0,0,5,0)); 194 194 msg.add(dateFilter, GBC.eol().insets(0,0,10,0).fill(GBC.HORIZONTAL)); 195 195 196 196 msg.add(new JLabel(tr("<html>Select all tracks that you want to be displayed. You can drag select a " + "range of tracks or use CTRL+Click to select specific ones. The map is updated live in the " + "background. Open the URLs by double clicking them.</html>")), GBC.eop().fill(GBC.HORIZONTAL)); 197 197 // build table … … 236 236 Main.map.repaint(); 237 237 } 238 238 239 239 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java
r5927 r6070 68 68 Main.main.removeLayer(layer); 69 69 } 70 70 71 71 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/CustomizeDrawingAction.java
r5927 r6070 101 101 Main.map.repaint(); 102 102 } 103 103 104 104 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongPanel.java
r6054 r6070 25 25 */ 26 26 public class DownloadAlongPanel extends JPanel { 27 28 29 30 31 32 33 34 35 27 28 // Preferences keys 29 private final String prefOsm; 30 private final String prefGps; 31 private final String prefDist; 32 private final String prefArea; 33 private final String prefNear; 34 35 // Data types to download 36 36 private final JCheckBox cbDownloadOsmData; 37 37 private final JCheckBox cbDownloadGpxData; 38 38 39 39 // Legacy list of values 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 40 private static final Integer dist[] = { 5000, 500, 50 }; 41 private static final Integer area[] = { 20, 10, 5, 1 }; 42 43 private final JList buffer; 44 private final JList maxRect; 45 private final JList downloadNear; 46 47 /** 48 * Constructs a new {@code DownloadPanel}. 49 * @param prefOsm Preference key determining if OSM data should be downloaded 50 * @param prefGps Preference key determining if GPS data should be downloaded 51 * @param prefDist Preference key determining maximum distance 52 * @param prefArea Preference key determining maximum area 53 * @param prefNear Preference key determining "near" parameter. Can be {@code null} 54 */ 55 public DownloadAlongPanel(String prefOsm, String prefGps, String prefDist, String prefArea, String prefNear) { 56 super(new GridBagLayout()); 57 58 this.prefOsm = prefOsm; 59 this.prefGps = prefGps; 60 this.prefDist = prefDist; 61 this.prefArea = prefArea; 62 this.prefNear = prefNear; 63 64 cbDownloadOsmData = new JCheckBox(tr("OpenStreetMap data"), Main.pref.getBoolean(prefOsm, true)); 65 65 cbDownloadOsmData.setToolTipText(tr("Select to download OSM data.")); 66 66 add(cbDownloadOsmData, GBC.std().insets(1,5,1,5)); … … 69 69 add(cbDownloadGpxData, GBC.eol().insets(5,5,1,5)); 70 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 71 add(new JLabel(tr("Download everything within:")), GBC.eol()); 72 String s[] = new String[dist.length]; 73 for (int i = 0; i < dist.length; ++i) { 74 s[i] = tr("{0} meters", dist[i]); 75 } 76 buffer = new JList(s); 77 78 double distanceValue = Main.pref.getDouble(prefDist, dist[0]); 79 int distanceLegacyIndex = 0; 80 for (int i = 0; i < dist.length; i++) { 81 if (dist[i] == (int)distanceValue) { 82 distanceLegacyIndex = i; 83 break; 84 } 85 } 86 87 buffer.setSelectedIndex(distanceLegacyIndex); 88 add(buffer, GBC.eol()); 89 90 add(new JLabel(tr("Maximum area per request:")), GBC.eol()); 91 s = new String[area.length]; 92 for (int i = 0; i < area.length; ++i) { 93 s[i] = tr("{0} sq km", area[i]); 94 } 95 maxRect = new JList(s); 96 97 double areaValue = Main.pref.getDouble(prefArea, area[0]); 98 int areaLegacyIndex = 0; 99 for (int i = 0; i < area.length; i++) { 100 if (area[i] == (int)areaValue) { 101 areaLegacyIndex = i; 102 break; 103 } 104 } 105 106 maxRect.setSelectedIndex(areaLegacyIndex); 107 add(maxRect, GBC.eol()); 108 109 if (prefNear != null) { 110 110 add(new JLabel(tr("Download near:")), GBC.eol()); 111 111 downloadNear = new JList(new String[]{tr("track only"), tr("waypoints only"), tr("track and waypoints")}); 112 112 downloadNear.setSelectedIndex(Main.pref.getInteger(prefNear, 0)); 113 113 add(downloadNear, GBC.eol()); 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 114 } else { 115 downloadNear = null; 116 } 117 } 118 119 /** 120 * Gets the maximum distance in meters 121 * @return The maximum distance, in meters 122 */ 123 public final double getDistance() { 124 return dist[buffer.getSelectedIndex()]; 125 } 126 127 /** 128 * Gets the maximum area in squared kilometers 129 * @return The maximum distance, in squared kilometers 130 */ 131 public final double getArea() { 132 return area[maxRect.getSelectedIndex()]; 133 } 134 135 /** 136 * Gets the "download near" choosen value 137 * @return the "download near" choosen value (0: track only, 1: waypoints only, 2: both) 138 */ 139 public final int getNear() { 140 return downloadNear.getSelectedIndex(); 141 } 142 143 143 /** 144 144 * Replies true if the user selected to download OSM data … … 158 158 return cbDownloadGpxData.isSelected(); 159 159 } 160 160 161 161 /** 162 162 * Remembers the current settings in the download panel 163 163 */ 164 164 protected final void rememberSettings() { 165 166 167 168 169 170 171 165 Main.pref.put(prefOsm, isDownloadOsmData()); 166 Main.pref.put(prefGps, isDownloadGpxData()); 167 Main.pref.putDouble(prefDist, getDistance()); 168 Main.pref.putDouble(prefArea, getArea()); 169 if (prefNear != null) { 170 Main.pref.putInteger(prefNear, getNear()); 171 } 172 172 } 173 173 … … 177 177 */ 178 178 protected final void addChangeListener(ChangeListener listener) { 179 180 179 cbDownloadGpxData.addChangeListener(listener); 180 cbDownloadOsmData.addChangeListener(listener); 181 181 } 182 182 -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackAction.java
r6054 r6070 25 25 */ 26 26 public class DownloadAlongTrackAction extends DownloadAlongAction { 27 27 28 28 static final int NEAR_TRACK = 0; 29 29 static final int NEAR_WAYPOINTS = 1; … … 36 36 private static final String PREF_DOWNLOAD_ALONG_TRACK_AREA = "downloadAlongTrack.area"; 37 37 private static final String PREF_DOWNLOAD_ALONG_TRACK_NEAR = "downloadAlongTrack.near"; 38 38 39 39 private final GpxData data; 40 40 … … 50 50 @Override 51 51 public void actionPerformed(ActionEvent e) { 52 52 53 53 final DownloadAlongPanel panel = new DownloadAlongPanel( 54 54 PREF_DOWNLOAD_ALONG_TRACK_OSM, PREF_DOWNLOAD_ALONG_TRACK_GPS, … … 58 58 return; 59 59 } 60 60 61 61 final int near = panel.getNear(); 62 62 … … 124 124 return; 125 125 } 126 confirmAndDownloadAreas(a, max_area, panel.isDownloadOsmData(), panel.isDownloadGpxData(), 126 confirmAndDownloadAreas(a, max_area, panel.isDownloadOsmData(), panel.isDownloadGpxData(), 127 127 tr("Download from OSM along this track"), progressMonitor); 128 128 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java
r5927 r6070 37 37 38 38 private final GpxData data; 39 39 40 40 public DownloadWmsAlongTrackAction(final GpxData data) { 41 41 super(tr("Precache imagery tiles along this track"), ImageProvider.get("downloadalongtrack")); … … 118 118 JOptionPane.showMessageDialog(Main.parent, tr("There are no imagery layers."), tr("No imagery layers"), JOptionPane.WARNING_MESSAGE); 119 119 } 120 120 121 121 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r5927 r6070 39 39 public class ImportAudioAction extends AbstractAction { 40 40 private final GpxLayer layer; 41 41 42 42 private static class Markers { 43 43 public boolean timedMarkersOmitted = false; … … 114 114 } 115 115 } 116 116 117 117 /** 118 118 * Makes a new marker layer derived from this GpxLayer containing at least one audio marker -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportImagesAction.java
r5927 r6070 62 62 } 63 63 } 64 64 65 65 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/MarkersFromNamedPointsAction.java
r5927 r6070 44 44 } 45 45 } 46 46 47 47 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r5684 r6070 321 321 * 322 322 * Override in subclasses to add all necessary attributes. 323 * 323 * 324 324 * @return the corresponding WayPoint with all relevant attributes 325 325 */ -
trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java
r5926 r6070 18 18 */ 19 19 public class Cascade implements Cloneable { 20 20 21 21 public static final Cascade EMPTY_CASCADE = new Cascade(); 22 22 … … 28 28 return get(key, def, klass, false); 29 29 } 30 30 31 31 /** 32 32 * Get value for the given key … … 182 182 @Override 183 183 public Cascade clone() { 184 @SuppressWarnings("unchecked") 184 @SuppressWarnings("unchecked") 185 185 HashMap<String, Object> clonedProp = (HashMap) ((HashMap) this.prop).clone(); 186 186 Cascade c = new Cascade(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/Environment.java
r5705 r6070 51 51 /** 52 52 * Creates a clone of the environment {@code other} 53 * 53 * 54 54 * @param other the other environment. Must not be null. 55 55 */ … … 112 112 /** 113 113 * Replies the current context. 114 * 114 * 115 115 * @return the current context 116 116 */ -
trunk/src/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategy.java
r4007 r6070 15 15 * strategies on how to compose the text label which can be rendered close to a node 16 16 * or within an area in an OSM map.</p> 17 * 17 * 18 18 * <p>The three strategies below support three rules for composing a label: 19 19 * <ul> 20 20 * <li>{@link StaticLabelCompositionStrategy} - the label is given by a static text 21 21 * specified in the MapCSS style file</li> 22 * 22 * 23 23 * <li>{@link TagLookupCompositionStrategy} - the label is given by the content of a 24 24 * tag whose name specified in the MapCSS style file</li> 25 * 25 * 26 26 * <li>{@link DeriveLabelFromNameTagsCompositionStrategy} - the label is given by the value 27 27 * of one … … 167 167 /** 168 168 * <p>Creates the strategy and initializes its name tags from the preferences.</p> 169 * 169 * 170 170 * <p><strong>Note:</strong> If the list of name tags in the preferences changes, strategy instances 171 171 * are not notified. It's up to the client to listen to preference changes and 172 172 * invoke {@link #initNameTagsFromPreferences()} accordingly.</p> 173 * 173 * 174 174 */ 175 175 public DeriveLabelFromNameTagsCompositionStrategy() { … … 179 179 /** 180 180 * Sets the name tags to be looked up in order to build up the label 181 * 181 * 182 182 * @param nameTags the name tags. null values are ignore. 183 183 */ … … 201 201 /** 202 202 * Replies an unmodifiable list of the name tags used to compose the label. 203 * 203 * 204 204 * @return the list of name tags 205 205 */ -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r5891 r6070 124 124 .setOptional(true).get(); 125 125 } 126 126 127 127 public static ImageIcon getNodeIcon(Tag tag) { 128 128 return getNodeIcon(tag, true); 129 129 } 130 130 131 131 public static ImageIcon getNodeIcon(Tag tag, boolean includeDeprecatedIcon) { 132 132 if (tag != null) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r3865 r6070 28 28 29 29 public final static StyleCache EMPTY_STYLECACHE = (new StyleCache()).intern(); 30 30 31 31 private StyleCache() { 32 32 bd = new ArrayList<Double>(); … … 189 189 bd.add(i, lower); 190 190 data.add(i, sl); 191 191 192 192 // --|--|----|--------|-- 193 193 // i-1 i i+1 i+2 … … 200 200 } 201 201 } 202 202 203 203 public void consistencyTest() { 204 204 if (bd.size() < 2) throw new AssertionError(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java
r5342 r6070 36 36 /** 37 37 * Creates a new text element 38 * 38 * 39 39 * @param strategy the strategy indicating how the text is composed for a specific {@link OsmPrimitive} to be rendered. 40 40 * If null, no label is rendered. … … 60 60 /** 61 61 * Copy constructor 62 * 62 * 63 63 * @param other the other element. 64 64 */ … … 76 76 * Derives a suitable label composition strategy from the style properties in 77 77 * {@code c}. 78 * 78 * 79 79 * @param c the style properties 80 80 * @return the label composition strategy … … 109 109 * Builds a text element from style properties in {@code c} and the 110 110 * default text color {@code defaultTextColor} 111 * 111 * 112 112 * @param c the style properties 113 113 * @param defaultTextColor the default text color. Must not be null. … … 161 161 /** 162 162 * Replies the label to be rendered for the primitive {@code osm}. 163 * 163 * 164 164 * @param osm the OSM object 165 165 * @return the label, or null, if {@code osm} is null or if no label can be -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r4069 r6070 136 136 /** 137 137 * <p>Represents a key/value condition which is either applied to a primitive.</p> 138 * 138 * 139 139 */ 140 140 public static class KeyValueCondition extends Condition { … … 146 146 /** 147 147 * <p>Creates a key/value-condition.</p> 148 * 148 * 149 149 * @param k the key 150 150 * @param v the value … … 208 208 * LINK: the parent is a relation and it has at least one member with the role 209 209 * "a label" referring to the child 210 * 210 * 211 211 * [!"a label"] PRIMITIVE: the primitive doesn't have a tag "a label" 212 212 * LINK: the parent is a relation but doesn't have a member with the role … … 224 224 225 225 /** 226 * 226 * 227 227 * @param label 228 228 * @param exclamationMarkPresent -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Instruction.java
r5801 r6070 38 38 if (key.equals(TEXT)) { 39 39 /* Special case for declaration 'text: ...' 40 * 40 * 41 41 * - Treat the value 'auto' as keyword. 42 42 * - Treat any other literal value 'litval' as as reference to tag with key 'litval' 43 * 43 * 44 44 * - Accept function expressions as is. This allows for 45 45 * tag(a_tag_name) value of a tag -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSException.java
r4069 r6070 7 7 protected Integer line; 8 8 protected Integer column; 9 9 10 10 public MapCSSException(String specialmessage) { 11 11 this.specialmessage = specialmessage; … … 19 19 this.line = line; 20 20 } 21 21 22 22 @Override 23 23 public String getMessage() { -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java
r4074 r6070 8 8 9 9 public class MapCSSRule { 10 10 11 11 public List<Selector> selectors; 12 12 public List<Instruction> declaration; … … 19 19 /** 20 20 * <p>Executes the instructions against the environment {@code env}</p> 21 * 21 * 22 22 * @param env the environment 23 23 */ -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r4252 r6070 47 47 * <p>Creates a new style source from the MapCSS styles supplied in 48 48 * {@code css}</p> 49 * 49 * 50 50 * @param css the MapCSS style declaration. Must not be null. 51 51 * @throws IllegalArgumentException thrown if {@code css} is null -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r5841 r6070 34 34 /** 35 35 * <p>Represents a child selector or a parent selector.</p> 36 * 36 * 37 37 * <p>In addition to the standard CSS notation for child selectors, JOSM also supports 38 38 * an "inverse" notation:</p> … … 40 40 * selector_a > selector_b { ... } // the standard notation (child selector) 41 41 * relation[type=route] > way { ... } // example (all ways of a route) 42 * 42 * 43 43 * selector_a < selector_b { ... } // the inverse notation (parent selector) 44 44 * node[traffic_calming] < way { ... } // example (way that has a traffic calming node) … … 55 55 56 56 /** 57 * 57 * 58 58 * @param a the first selector 59 59 * @param b the second selector … … 69 69 /** 70 70 * <p>Finds the first referrer matching {@link #left}</p> 71 * 71 * 72 72 * <p>The visitor works on an environment and it saves the matching 73 73 * referrer in {@code e.parent} and its relative position in the 74 74 * list referrers "child list" in {@code e.index}.</p> 75 * 75 * 76 76 * <p>If after execution {@code e.parent} is null, no matching 77 77 * referrer was found.</p> … … 196 196 } 197 197 } 198 198 199 199 /** 200 200 * Super class of {@link GeneralSelector} and {@link LinkSelector} … … 204 204 205 205 protected final List<Condition> conds; 206 206 207 207 protected AbstractSelector(List<Condition> conditions) { 208 208 if (conditions == null || conditions.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java
r3836 r6070 6 6 7 7 public class IconPrototype extends Prototype { 8 8 9 9 public IconReference icon; 10 10 public Boolean annotate; -
trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java
r5886 r6070 34 34 * <li>Access token URL</li> 35 35 * <li>Authorize URL</li> 36 * 36 * 37 37 * @see OAuthParameters 38 38 * @since 2746 -
trunk/src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java
r5886 r6070 143 143 public void setApiUrl(String apiUrl) { 144 144 super.setApiUrl(apiUrl); 145 if (pnlMessage != null) { 145 if (pnlMessage != null) { 146 146 pnlMessage.setText(tr("<html><body>" 147 147 + "Please enter an OAuth Access Token which is authorized to access the OSM server " -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r6066 r6070 40 40 41 41 /** 42 * An OAuth 1.0 authorization client. 42 * An OAuth 1.0 authorization client. 43 43 * @since 2746 44 44 */ -
trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java
r5886 r6070 37 37 * In contrast to the fully-automatic procedure the user is dispatched to an 38 38 * external browser for login and authorisation. 39 * 39 * 40 40 * @since 2746 41 41 */ -
trunk/src/org/openstreetmap/josm/gui/preferences/AudioPreference.java
r5886 r6070 34 34 } 35 35 } 36 36 37 37 private AudioPreference() { 38 38 super("audio", tr("Audio Settings"), tr("Settings for the audio player and audio markers.")); … … 57 57 public void addGui(PreferenceTabbedPane gui) { 58 58 JPanel audio = new JPanel(new GridBagLayout()); 59 59 60 60 // audioMenuVisible 61 61 audioMenuVisible.setSelected(! Main.pref.getBoolean("audio.menuinvisible")); -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r5998 r6070 86 86 this.setMaximumSize( Toolkit.getDefaultToolkit().getScreenSize()); 87 87 } 88 88 89 89 /** 90 90 * Replies the preferences tabbed pane. -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceSetting.java
r4989 r6070 3 3 4 4 /** 5 * Base interface of Preferences settings, should not be directly implemented, 5 * Base interface of Preferences settings, should not be directly implemented, 6 6 * see {@link TabPreferenceSetting} and {@link SubPreferenceSetting}. 7 7 */ … … 18 18 */ 19 19 boolean ok(); 20 20 21 21 /** 22 22 * Called to know if the preferences tab has only to be displayed in expert mode. -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r5973 r6070 212 212 }}, clazz); 213 213 } 214 214 215 215 public boolean selectSubTabByPref(Class<? extends SubPreferenceSetting> clazz) { 216 216 for (PreferenceSetting setting : settings) { … … 244 244 return getSetting(ImageryPreference.class); 245 245 } 246 246 247 247 public final ShortcutPreference getShortcutPreference() { 248 248 return getSetting(ShortcutPreference.class); -
trunk/src/org/openstreetmap/josm/gui/preferences/ServerAccessPreference.java
r5899 r6070 25 25 } 26 26 } 27 27 28 28 private ServerAccessPreference() { 29 29 super("connection", tr("Connection Settings"), tr("Connection Settings for the OSM server."), false, new JTabbedPane()); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
r5220 r6070 9 9 10 10 /** 11 * A source entry primarily used to save the user's selection of mappaint styles, 11 * A source entry primarily used to save the user's selection of mappaint styles, 12 12 * but also for preset sources. 13 13 */ … … 61 61 return false; 62 62 final SourceEntry other = (SourceEntry) obj; 63 return equal(other.url, url) && 63 return equal(other.url, url) && 64 64 equal(other.name, name) && 65 65 equal(other.title, title) && -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r6020 r6070 147 147 return new ActionDefinition(null); 148 148 } 149 149 150 150 public boolean hasParameters() { 151 151 if (!(getAction() instanceof ParameterizedAction)) return false; 152 152 for (Object o: parameters.values()) { 153 153 if (o!=null) return true; 154 } 154 } 155 155 return false; 156 156 } … … 412 412 } 413 413 }); 414 414 415 415 JMenuItem configure = new JMenuItem(new AbstractAction(tr("Configure toolbar")) { 416 416 @Override … … 430 430 p.setVisible(true); 431 431 // refresh toolbar to try using changed shortcuts without restart 432 Main.toolbar.refreshToolbarControl(); 432 Main.toolbar.refreshToolbarControl(); 433 433 } 434 434 }); … … 485 485 486 486 private final class Move implements ActionListener { 487 @Override 487 @Override 488 488 public void actionPerformed(ActionEvent e) { 489 489 if (e.getActionCommand().equals("<") && actionsTree.getSelectionCount() > 0) { … … 1032 1032 final JButton b = addButtonAndShortcut(action); 1033 1033 buttonActions.put(b, action); 1034 1034 1035 1035 Icon i = action.getDisplayIcon(); 1036 1036 if (i != null) { … … 1055 1055 control.setVisible(control.getComponentCount() != 0); 1056 1056 } 1057 1057 1058 1058 private JButton addButtonAndShortcut(ActionDefinition action) { 1059 1059 Action act = action.getParametrizedAction(); 1060 1060 JButton b = control.add(act); 1061 1061 1062 1062 Shortcut sc = null; 1063 1063 if (action.getAction() instanceof JosmAction) { … … 1072 1072 paramCode = action.parameters.hashCode(); 1073 1073 } 1074 1074 1075 1075 String tt = action.getDisplayTooltip(); 1076 1076 if (tt==null) { … … 1091 1091 Main.unregisterShortcut(sc); 1092 1092 Main.registerActionShortcut(act, sc); 1093 1093 1094 1094 // add shortcut info to the tooltip if needed 1095 1095 if (sc.getAssignedUser()) { … … 1100 1100 } 1101 1101 } 1102 1102 1103 1103 if (!tt.isEmpty()) { 1104 1104 b.setToolTipText(tt); -
trunk/src/org/openstreetmap/josm/gui/preferences/ValidatorPreference.java
r4976 r6070 32 32 } 33 33 } 34 34 35 35 private ValidatorPreference() { 36 super("validator", tr("Data validator"), 36 super("validator", tr("Data validator"), 37 37 tr("An OSM data validator that checks for common errors made by users and editor programs.")); 38 38 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
r6022 r6070 95 95 }); 96 96 readPreferences(Main.pref); 97 97 98 98 applyFilter(); 99 99 table = new PreferencesTable(displayData); … … 140 140 } 141 141 }); 142 142 143 143 JButton export = new JButton(tr("Export selected items")); 144 144 p.add(export, GBC.std().insets(5,5,0,0)); … … 148 148 } 149 149 }); 150 150 151 151 final JButton more = new JButton(tr("More...")); 152 152 p.add(more, GBC.std().insets(5,5,0,0)); … … 178 178 allData = prepareData(loaded, orig, defaults); 179 179 } 180 180 181 181 private File[] askUserForCustomSettingsFiles(boolean saveFileFlag, String title) { 182 182 FileFilter filter = new FileFilter() { … … 195 195 if (sel.length==1 && !sel[0].getName().contains(".")) sel[0]=new File(sel[0].getAbsolutePath()+".xml"); 196 196 return sel; 197 } 197 } 198 198 return new File[0]; 199 199 } 200 200 201 201 private void exportSelectedToXML() { 202 202 ArrayList<String> keys = new ArrayList<String>(); 203 203 boolean hasLists = false; 204 204 205 205 for (PrefEntry p: table.getSelectedItems()) { 206 206 // preferences with default values are not saved … … 212 212 } 213 213 } 214 214 215 215 if (keys.isEmpty()) { 216 216 JOptionPane.showMessageDialog(Main.parent, … … 233 233 CustomConfigurator.exportPreferencesKeysToFile(files[0].getAbsolutePath(), answer == 0, keys); 234 234 } 235 235 236 236 private void readPreferencesFromXML() { 237 237 File[] files = askUserForCustomSettingsFiles(false, tr("Open JOSM customization file")); … … 262 262 applyFilter(); 263 263 } 264 264 265 265 private Comparator<PrefEntry> customComparator = new Comparator<PrefEntry>() { 266 266 @Override … … 273 273 } 274 274 }; 275 275 276 276 private List<PrefEntry> prepareData(Map<String, Setting> loaded, Map<String, Setting> orig, Map<String, Setting> defaults) { 277 277 List<PrefEntry> data = new ArrayList<PrefEntry>(); … … 306 306 return data; 307 307 } 308 308 309 309 Map<String,String> profileTypes = new LinkedHashMap<String, String>(); 310 310 311 311 private JPopupMenu buildPopupMenu() { 312 312 JPopupMenu menu = new JPopupMenu(); … … 315 315 profileTypes.put(marktr("toolbar"), "toolbar.*"); 316 316 profileTypes.put(marktr("imagery"), "imagery.*"); 317 317 318 318 for (Entry<String,String> e: profileTypes.entrySet()) { 319 319 menu.add(new ExportProfileAction(Main.pref, e.getKey(), e.getValue())); 320 320 } 321 321 322 322 menu.addSeparator(); 323 323 menu.add(getProfileMenu()); … … 340 340 return menu; 341 341 } 342 342 343 343 private JMenu getProfileMenu() { 344 344 final JMenu p =new JMenu(tr("Load profile")); … … 372 372 return p; 373 373 } 374 374 375 375 private class ImportProfileAction extends AbstractAction { 376 376 private final File file; 377 377 private final String type; 378 378 379 379 public ImportProfileAction(String name, File file, String type) { 380 380 super(name); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r5703 r6070 126 126 panel.add(onewayArrow, GBC.eop().insets(20,0,0,0)); 127 127 panel.add(segmentOrderNumber, GBC.eop().insets(20,0,0,0)); 128 128 129 129 panel.add(new JLabel(tr("Select and draw mode options")), 130 130 GBC.eop().insets(5,10,0,0)); 131 131 panel.add(virtualNodes, GBC.eop().insets(20,0,0,0)); 132 132 panel.add(drawHelperLine, GBC.eop().insets(20, 0, 0, 0)); 133 133 134 134 panel.add(performanceLabel, GBC.eop().insets(5,10,0,0)); 135 135 panel.add(useAntialiasing, GBC.eop().insets(20,0,0,0)); … … 137 137 panel.add(useHighlighting, GBC.eop().insets(20,0,0,0)); 138 138 panel.add(outlineOnly, GBC.eol().insets(20,0,0,0)); 139 139 140 140 panel.add(new JLabel(tr("Other options")), 141 141 GBC.eop().insets(5,10,0,0)); 142 142 panel.add(sourceBounds, GBC.eop().insets(20,0,0,0)); 143 143 panel.add(inactive, GBC.eop().insets(20,0,0,0)); 144 144 145 145 ExpertToggleAction.addVisibilitySwitcher(performanceLabel); 146 146 ExpertToggleAction.addVisibilitySwitcher(useAntialiasing); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LanguagePreference.java
r5631 r6070 43 43 model = new LanguageComboBoxModel(); 44 44 // Selecting the language BEFORE the JComboBox listens to model changes speed up initialization by ~35ms (see #7386) 45 // See http://stackoverflow.com/questions/3194958/fast-replacement-for-jcombobox-basiccomboboxui 45 // See http://stackoverflow.com/questions/3194958/fast-replacement-for-jcombobox-basiccomboboxui 46 46 model.selectLanguage(Main.pref.get("language")); 47 47 langCombo = new JosmComboBox(model); … … 54 54 panel.add(langCombo, GBC.eol().fill(GBC.HORIZONTAL)); 55 55 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 56 56 57 57 TabPreferenceSetting tabPref = lafPreference.getTabPreferenceSetting(gui); 58 58 tabPref.registerSubTab(this, tabPref.getSubTab(lafPreference)); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java
r5886 r6070 29 29 protected final JosmTextArea rawUrl = new JosmTextArea(3, 40); 30 30 protected final JosmTextField name = new JosmTextField(); 31 31 32 32 protected final Collection<ContentValidationListener> listeners = new ArrayList<ContentValidationListener>(); 33 33 34 34 /** 35 35 * A listener notified when the validation status of this panel change. … … 38 38 /** 39 39 * Called when the validation status of this panel changed 40 * @param isValid true if the conditions required to close this panel are met 40 * @param isValid true if the conditions required to close this panel are met 41 41 */ 42 42 public void contentChanged(boolean isValid); … … 71 71 return s.replaceAll("[\r\n]+", "").trim(); 72 72 } 73 73 74 74 protected final String getImageryName() { 75 75 return sanitize(name.getText()); … … 79 79 return sanitize(rawUrl.getText()); 80 80 } 81 81 82 82 protected abstract boolean isImageryValid(); 83 83 -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddTMSLayerPanel.java
r5886 r6070 89 89 (int) Math.ceil(view.getPreferredSpan(View.Y_AXIS))); 90 90 } 91 91 92 92 protected final String getTmsUrl() { 93 93 return sanitize(tmsUrl.getText()); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
r6016 r6070 110 110 tree.getLayerTree().addPropertyChangeListener("selectedLayers", new PropertyChangeListener() { 111 111 @Override 112 public void propertyChange(PropertyChangeEvent evt) { 112 public void propertyChange(PropertyChangeEvent evt) { 113 113 onLayerSelectionChanged(); 114 114 } … … 135 135 } 136 136 }); 137 137 138 138 registerValidableComponent(endpoint); 139 139 registerValidableComponent(rawUrl); 140 140 registerValidableComponent(wmsUrl); 141 141 } 142 142 143 143 protected final void onLayerSelectionChanged() { 144 144 if (wms.getServiceUrl() != null) { … … 161 161 return info; 162 162 } 163 163 164 164 protected final String getWmsUrl() { 165 165 return sanitize(wmsUrl.getText()); 166 166 } 167 167 168 168 protected boolean isImageryValid() { 169 169 if (getImageryName().isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r5886 r6070 88 88 addSettingsSection(p, name, section, GBC.eol()); 89 89 } 90 90 91 91 private void addSettingsSection(final JPanel p, String name, JPanel section, GBC gbc) { 92 92 final JLabel lbl = new JLabel(name); … … 436 436 throw new IllegalStateException("Type " + type + " not supported"); 437 437 } 438 438 439 439 final AddImageryDialog addDialog = new AddImageryDialog(gui, p); 440 440 addDialog.showDialog(); 441 441 442 442 if (addDialog.getValue() == 1) { 443 443 try { … … 455 455 } 456 456 } 457 457 458 458 private class RemoveEntryAction extends AbstractAction implements ListSelectionListener { 459 459 -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java
r5609 r6070 88 88 add(hint, gbc); 89 89 } 90 90 91 91 /** 92 92 * A plugin checkbox. … … 102 102 } 103 103 } 104 104 105 105 /** 106 106 * Listener called when the user selects/unselects a plugin checkbox. … … 139 139 for (String s : pi.getRequiredPlugins()) { 140 140 if (s.equals(cb.pi.getName())) { 141 otherPlugins.add(pi.getName()); 141 otherPlugins.add(pi.getName()); 142 142 break; 143 143 } … … 151 151 } 152 152 }; 153 153 154 154 155 155 /** -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r5601 r6070 295 295 return ret; 296 296 } 297 297 298 298 /** 299 299 * Replies the set of all available plugins. -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/AbstractProjectionChoice.java
r5548 r6070 7 7 8 8 abstract public class AbstractProjectionChoice implements ProjectionChoice { 9 9 10 10 protected String name; 11 11 protected String id; … … 52 52 53 53 abstract public String getCurrentCode(); 54 54 55 55 abstract public String getProjectionName(); 56 56 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
r5886 r6070 209 209 public String getCurrentCode() { 210 210 // not needed - getProjection() is overridden 211 throw new UnsupportedOperationException(); 211 throw new UnsupportedOperationException(); 212 212 } 213 213 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/GaussKruegerProjectionChoice.java
r5548 r6070 53 53 return null; 54 54 } 55 55 56 56 @Override 57 57 public String getProjectionName() { -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertCC9ZonesProjectionChoice.java
r5548 r6070 77 77 return null; 78 78 } 79 79 80 80 @Override 81 81 protected String indexToZone(int index) { -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionChoice.java
r5548 r6070 20 20 * 21 21 * Will be used to save the user selection to the preference file. 22 * 22 * 23 23 * @return the string identifier 24 24 */ … … 67 67 /** 68 68 * Get Preferences from projection code. 69 * 69 * 70 70 * @return null when code is not part of this projection choice. 71 71 * An empty Collection as return value indicates, that the code is supported, … … 76 76 /** 77 77 * Short name of the projection choice as shown in the GUI (combo box). 78 * 78 * 79 79 * @return the name 80 80 */ -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r6056 r6070 90 90 * see http://www.epsg-registry.org/ 91 91 */ 92 mercator = registerProjectionChoice(tr("Mercator"), "core:mercator", 92 mercator = registerProjectionChoice(tr("Mercator"), "core:mercator", 93 93 3857); 94 94 95 95 /** 96 96 * UTM. … … 155 155 /** 156 156 * Lambert 93 projection. 157 * 157 * 158 158 * As specified by the IGN in this document 159 159 * http://professionnels.ign.fr/DISPLAY/000/526/702/5267026/NTG_87.pdf … … 471 471 return gui.getMapPreference(); 472 472 } 473 473 474 474 /** 475 475 * Selects the given projection. -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java
r5548 r6070 25 25 26 26 private Hemisphere hemisphere; 27 27 28 28 private final static List<String> cbEntries = new ArrayList<String>(); 29 29 static { -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r5954 r6070 161 161 this.name = name; 162 162 } 163 163 164 164 @Override 165 165 public Component getTableCellRendererComponent(JTable table, Object value, boolean … … 186 186 } 187 187 } 188 188 189 189 private void initComponents() { 190 190 JPanel listPane = new JPanel(); -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreference.java
r5954 r6070 19 19 20 20 private String defaultFilter; 21 21 22 22 public static class Factory implements PreferenceSettingFactory { 23 23 public PreferenceSetting createPreferenceSetting() { … … 25 25 } 26 26 } 27 27 28 28 private ShortcutPreference() { 29 29 // icon source: http://www.iconfinder.net/index.php?q=key&page=icondetails&iconid=8553&size=128&q=key&s12=on&s16=on&s22=on&s32=on&s48=on&s64=on&s128=on … … 35 35 super("shortcuts", tr("Keyboard Shortcuts"), tr("Changing keyboard shortcuts manually.")); 36 36 } 37 37 38 38 @Override 39 39 public void addGui(PreferenceTabbedPane gui) { … … 49 49 return Shortcut.savePrefs(); 50 50 } 51 51 52 52 public void setDefaultFilter(String substring) { 53 53 defaultFilter = substring; -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java
r6068 r6070 64 64 tagTable.setNextFocusComponent(nextFocusComponent); 65 65 } 66 66 67 67 /** 68 68 * builds the panel with the button row … … 123 123 }); 124 124 } 125 125 126 126 addFocusListener(new FocusAdapter() { 127 127 @Override public void focusGained(FocusEvent e) { -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r6064 r6070 47 47 private final TagEditorModel model; 48 48 private Component nextFocusComponent; 49 49 50 50 /** a list of components to which focus can be transferred without stopping 51 51 * cell editing this table. … … 104 104 getCellEditor().stopCellEditing(); 105 105 } 106 106 107 107 if (row==-1 && col==-1) { 108 108 requestFocusInCell(0, 0); 109 109 return; 110 110 } 111 111 112 112 if (col == 0) { 113 113 col++; … … 290 290 if (!key.trim().isEmpty()) { 291 291 model.appendNewTag(); 292 } 292 } 293 293 requestFocusInCell(model.getRowCount()-1, 0); 294 294 } 295 295 296 296 protected void updateEnabledState() { 297 297 setEnabled(TagTable.this.isEnabled()); … … 435 435 this.nextFocusComponent = nextFocusComponent; 436 436 } 437 437 438 438 public TagCellEditor getTableCellEditor() { 439 439 return editor; … … 472 472 } 473 473 // there was a bug here - on older 1.6 Java versions Tab was not working 474 // after such activation. In 1.7 it works OK, 474 // after such activation. In 1.7 it works OK, 475 475 // previous solution of usint awt.Robot was resetting mouse speed on Windows 476 476 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r6068 r6070 75 75 public String locale_name; 76 76 public final static String OPTIONAL_TOOLTIP_TEXT = "Optional tooltip text"; 77 77 78 78 /** 79 79 * The types as preparsed collection. … … 84 84 public TemplateEntry nameTemplate; 85 85 public Match nameTemplateFilter; 86 86 87 87 /** 88 88 * Create an empty tagging preset. This will not have any items and … … 239 239 if (roles != null && osm != null) { 240 240 for (Role i : roles.roles) { 241 if (i.memberExpression != null && i.memberExpression.match(osm) 241 if (i.memberExpression != null && i.memberExpression.match(osm) 242 242 && (i.types == null || i.types.isEmpty() || i.types.contains(TaggingPresetType.forPrimitive(osm)) )) { 243 243 return i.key; -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java
r6068 r6070 46 46 return null; 47 47 } 48 48 49 49 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java
r6068 r6070 465 465 } 466 466 467 public void setClickListener(ActionListener сlickListener) {468 this.clickListener = сlickListener;467 public void setClickListener(ActionListener clickListener) { 468 this.clickListener = clickListener; 469 469 } 470 470 -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetType.java
r6068 r6070 47 47 return null; 48 48 } 49 49 50 50 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r5704 r6070 286 286 287 287 private static InputContext privateInputContext = InputContext.getInstance(); 288 288 289 289 @Override 290 290 public InputContext getInputContext() { -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java
r5886 r6070 36 36 37 37 private Integer maxChars; 38 38 39 39 /** 40 40 * The document model for the editor … … 48 48 @Override 49 49 public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { 50 50 51 51 // If a maximum number of characters is specified, avoid to exceed it 52 52 if (maxChars != null && str != null && getLength() + str.length() > maxChars) { … … 58 58 } 59 59 } 60 60 61 61 if (autoCompletionList == null) { 62 62 super.insertString(offs, str, a); -
trunk/src/org/openstreetmap/josm/gui/util/FileFilterAllFiles.java
r5572 r6070 12 12 */ 13 13 public class FileFilterAllFiles extends FileFilter { 14 14 15 15 private static FileFilterAllFiles INSTANCE; 16 16 -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r5881 r6070 52 52 } 53 53 } 54 54 55 55 public static void executeByMainWorkerInEDT(final Runnable task) { 56 56 Main.worker.submit(new Runnable() { 57 57 public void run() { 58 runInEDTAndWait(task); 58 runInEDTAndWait(task); 59 59 } 60 60 }); … … 82 82 } 83 83 } 84 84 85 85 /** 86 86 * returns true if the user wants to cancel, false if they … … 104 104 return dlg.showDialog().getValue() != 2; 105 105 } 106 106 107 107 /** 108 108 * Replies the disabled (grayed) version of the specified image. … … 125 125 return new ImageIcon(getDisabledImage(icon.getImage())); 126 126 } 127 127 128 128 /** 129 129 * Attaches a {@code HierarchyListener} to the specified {@code Component} that … … 154 154 return pane; 155 155 } 156 156 157 157 /** 158 158 * Schedules a new Timer to be run in the future (once or several times). … … 169 169 return timer; 170 170 } 171 171 172 172 /** 173 173 * Return s new BasicStroke object with given thickness and style … … 177 177 public static Stroke getCustomizedStroke(String code) { 178 178 String[] s = code.trim().split("[^\\.0-9]+"); 179 180 if (s.length==0) return new BasicStroke(); 179 180 if (s.length==0) return new BasicStroke(); 181 181 float w; 182 182 try { … … 215 215 } 216 216 } 217 217 218 218 /** 219 219 * Gets the font used to display JOSM title in about dialog and splash screen. … … 227 227 public static Font getTitleFont() { 228 228 List<String> fonts = Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); 229 // Helvetica is the preferred choice but is not available by default on Windows 229 // Helvetica is the preferred choice but is not available by default on Windows 230 230 // (http://www.microsoft.com/typography/fonts/product.aspx?pid=161) 231 231 if (fonts.contains("Helvetica")) { -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmTextField.java
r5887 r6070 21 21 * <code>createDefaultModel</code> method 22 22 * @param text the initial string to display, or <code>null</code> 23 * @param columns the number of columns to use to calculate 23 * @param columns the number of columns to use to calculate 24 24 * the preferred width >= 0; if <code>columns</code> 25 25 * is set to zero, the preferred width will be whatever … … 37 37 * 38 38 * @param text the text to be displayed, or <code>null</code> 39 * @param columns the number of columns to use to calculate 39 * @param columns the number of columns to use to calculate 40 40 * the preferred width; if columns is set to zero, the 41 41 * preferred width will be whatever naturally results from … … 63 63 * <code>null</code>. 64 64 * 65 * @param columns the number of columns to use to calculate 65 * @param columns the number of columns to use to calculate 66 66 * the preferred width; if columns is set to zero, the 67 67 * preferred width will be whatever naturally results from 68 68 * the component implementation 69 */ 69 */ 70 70 public JosmTextField(int columns) { 71 71 this(null, null, columns); -
trunk/src/org/openstreetmap/josm/gui/widgets/ListPopupMenu.java
r4459 r6070 13 13 */ 14 14 public class ListPopupMenu extends JPopupMenu { 15 15 16 16 private JList[] lists; 17 17 -
trunk/src/org/openstreetmap/josm/gui/widgets/OsmIdTextField.java
r5778 r6070 30 30 * Sets the type of primitive object 31 31 * @param type The type of primitive object ( 32 * {@link OsmPrimitiveType#NODE NODE}, 33 * {@link OsmPrimitiveType#WAY WAY}, 32 * {@link OsmPrimitiveType#NODE NODE}, 33 * {@link OsmPrimitiveType#WAY WAY}, 34 34 * {@link OsmPrimitiveType#RELATION RELATION}) 35 35 */ -
trunk/src/org/openstreetmap/josm/gui/widgets/PopupMenuLauncher.java
r5958 r6070 25 25 26 26 /** 27 * Creates a new {@link PopupMenuLauncher} with no defined menu. 27 * Creates a new {@link PopupMenuLauncher} with no defined menu. 28 28 * It is then needed to override the {@link #launch} method. 29 29 * @see #launch(MouseEvent) … … 55 55 @Override public void mouseClicked(MouseEvent e) {} 56 56 @Override public void mouseReleased(MouseEvent e) { processEvent(e); } 57 57 58 58 private void processEvent(MouseEvent e) { 59 59 if (e.isPopupTrigger() && (!checkEnabled || e.getComponent().isEnabled())) { … … 75 75 } 76 76 } 77 77 78 78 protected boolean checkSelection(Component component, Point p) { 79 79 if (component instanceof JList) { … … 86 86 return true; 87 87 } 88 88 89 89 protected void checkFocusAndShowMenu(final Component component, final MouseEvent evt) { 90 90 if (component != null && component.isFocusable() && !component.hasFocus() && component.requestFocusInWindow()) { … … 100 100 } 101 101 } 102 102 103 103 protected void showMenu(MouseEvent evt) { 104 104 if (menu != null && evt != null) { … … 106 106 } 107 107 } 108 108 109 109 protected int checkListSelection(JList list, Point p) { 110 110 int idx = list.locationToIndex(p); … … 122 122 return row; 123 123 } 124 124 125 125 protected TreePath checkTreeSelection(JTree tree, Point p) { 126 126 TreePath path = tree.getPathForLocation(p.x, p.y); … … 130 130 return path; 131 131 } 132 132 133 133 protected static boolean isDoubleClick(MouseEvent e) { 134 134 return e != null && SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2; 135 135 } 136 136 137 137 /** 138 138 * @return the popup menu if defined, {@code null} otherwise. -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r5874 r6070 59 59 return result; 60 60 } 61 61 62 62 /** 63 63 * Retrieve raw gps waypoints from the server API. … … 131 131 return null; 132 132 ds.mergeFrom(ds2); 133 133 134 134 } else { 135 135 // Simple request -
trunk/src/org/openstreetmap/josm/io/CacheFiles.java
r5881 r6070 65 65 */ 66 66 public CacheFiles(String ident, boolean isPlugin) { 67 String pref = isPlugin ? 67 String pref = isPlugin ? 68 68 Main.pref.getPluginsDirectory().getPath() + File.separator + "cache" : 69 69 Main.pref.getCacheDirectory().getPath(); -
trunk/src/org/openstreetmap/josm/io/Capabilities.java
r4063 r6070 13 13 * 14 14 * Example capabilites document: 15 * 15 * 16 16 * <osm version="0.6" generator="OpenStreetMap server"> 17 17 * <api> … … 32 32 * </policy> 33 33 * </osm> 34 * 34 * 35 35 * This class is used in conjunction with a very primitive parser 36 36 * and simply stuffs the each tag and its attributes into a hash -
trunk/src/org/openstreetmap/josm/io/FileExporter.java
r5459 r6070 12 12 13 13 public abstract class FileExporter implements LayerChangeListener { 14 14 15 15 public final ExtensionFileFilter filter; 16 16 … … 31 31 32 32 /** 33 * Returns the enabled state of this {@code FileExporter}. When enabled, it is listed and usable in "File->Save" dialogs. 33 * Returns the enabled state of this {@code FileExporter}. When enabled, it is listed and usable in "File->Save" dialogs. 34 34 * @return true if this {@code FileExporter} is enabled 35 35 * @since 5459 -
trunk/src/org/openstreetmap/josm/io/FileImporter.java
r5459 r6070 24 24 25 25 public final ExtensionFileFilter filter; 26 26 27 27 private boolean enabled; 28 28 … … 106 106 return (new Double(this.getPriority())).compareTo(other.getPriority()); 107 107 } 108 108 109 109 public static CBZip2InputStream getBZip2InputStream(InputStream in) throws IOException { 110 110 if (in == null) { … … 129 129 130 130 /** 131 * Returns the enabled state of this {@code FileImporter}. When enabled, it is listed and usable in "File->Open" dialog. 131 * Returns the enabled state of this {@code FileImporter}. When enabled, it is listed and usable in "File->Open" dialog. 132 132 * @return true if this {@code FileImporter} is enabled 133 133 * @since 5459 -
trunk/src/org/openstreetmap/josm/io/GeoJSONExporter.java
r5874 r6070 20 20 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 21 21 "json,geojson", "json", tr("GeoJSON Files") + " (*.json *.geojson)"); 22 22 23 23 public GeoJSONExporter() { 24 24 super(FILE_FILTER); -
trunk/src/org/openstreetmap/josm/io/GpxImporter.java
r5679 r6070 32 32 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 33 33 "gpx,gpx.gz", "gpx", tr("GPX Files") + " (*.gpx *.gpx.gz)"); 34 34 35 35 /** 36 * Utility class containing imported GPX and marker layers, and a task to run after they are added to MapView. 36 * Utility class containing imported GPX and marker layers, and a task to run after they are added to MapView. 37 37 */ 38 38 public static class GpxImporterData { … … 85 85 } 86 86 String fileName = file.getName(); 87 87 88 88 try { 89 89 GpxReader r = new GpxReader(is); … … 96 96 } 97 97 } 98 98 99 99 /** 100 100 * Adds the specified GPX and marker layers to Map.main … … 126 126 * @see #addLayers 127 127 */ 128 public static GpxImporterData loadLayers(final GpxData data, final boolean parsedProperly, 128 public static GpxImporterData loadLayers(final GpxData data, final boolean parsedProperly, 129 129 final String gpxLayerName, String markerLayerName) { 130 130 GpxLayer gpxLayer = null; -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r5854 r6070 34 34 /** 35 35 * Read a gpx file. 36 * 36 * 37 37 * Bounds are not read, as we caluclate them. @see GpxData.recalculateBounds() 38 38 * Both GPX version 1.0 and 1.1 are supported. -
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r5874 r6070 63 63 } 64 64 } 65 65 66 66 out.println("<?xml version='1.0' encoding='UTF-8'?>"); 67 67 out.println("<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" + -
trunk/src/org/openstreetmap/josm/io/InvalidXmlCharacterFilter.java
r5889 r6070 24 24 25 25 public static final boolean[] INVALID_CHARS; 26 26 27 27 static { 28 28 INVALID_CHARS = new boolean[0x20]; -
trunk/src/org/openstreetmap/josm/io/JpgImporter.java
r5438 r6070 23 23 public class JpgImporter extends FileImporter { 24 24 private GpxLayer gpx; 25 25 26 26 /** 27 27 * The default file filter (only *.jpg files). … … 29 29 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 30 30 "jpg", "jpg", tr("Image Files") + " (*.jpg)"); 31 31 32 32 /** 33 33 * An alternate file filter that also includes folders. -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r5387 r6070 124 124 /** 125 125 * appends a {@link OsmPrimitive} id to the list of ids which will be fetched from the server. 126 * 126 * 127 127 * @param ds the {@link DataSet} to which the primitive belongs 128 128 * @param id the primitive id … … 416 416 return missingPrimitives; 417 417 } 418 419 /** 420 * The class holding the results given by {@link Fetcher}. 418 419 /** 420 * The class holding the results given by {@link Fetcher}. 421 421 * It is only a wrapper of the resulting {@link DataSet} and the collection of {@link PrimitiveId} that could not have been loaded. 422 422 */ 423 423 protected static class FetchResult { 424 424 425 425 /** 426 426 * The resulting data set 427 427 */ 428 428 public final DataSet dataSet; 429 429 430 430 /** 431 431 * The collection of primitive ids that could not have been loaded 432 432 */ 433 433 public final Set<PrimitiveId> missingPrimitives; 434 434 435 435 /** 436 436 * Constructs a {@code FetchResult} … … 443 443 } 444 444 } 445 445 446 446 /** 447 447 * The class that actually download data from OSM API. Several instances of this class are used by {@link MultiFetchServerObjectReader} (one per set of primitives to fetch). … … 472 472 return fetch(progressMonitor).dataSet; 473 473 } 474 474 475 475 @Override 476 476 public FetchResult call() throws Exception { 477 477 return fetch(progressMonitor); 478 478 } 479 479 480 480 /** 481 481 * fetches the requested primitives and updates the specified progress monitor. … … 496 496 } 497 497 } 498 498 499 499 /** 500 500 * invokes a Multi Get for a set of ids and a given {@link OsmPrimitiveType}. -
trunk/src/org/openstreetmap/josm/io/NMEAImporter.java
r5452 r6070 22 22 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 23 23 "nmea,nme,nma,log,txt", "nmea", tr("NMEA-0183 Files") + " (*.nmea *.nme *.nma *.log *.txt)"); 24 24 25 25 public NMEAImporter() { 26 26 super(FILE_FILTER); -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r6009 r6070 54 54 */ 55 55 public class OsmApi extends OsmConnection { 56 57 /** 58 * Maximum number of retries to send a request in case of HTTP 500 errors or timeouts 56 57 /** 58 * Maximum number of retries to send a request in case of HTTP 500 errors or timeouts 59 59 */ 60 60 static public final int DEFAULT_MAX_NUM_RETRIES = 5; 61 61 62 62 /** 63 * Maximum number of concurrent download threads, imposed by 63 * Maximum number of concurrent download threads, imposed by 64 64 * <a href="http://wiki.openstreetmap.org/wiki/API_usage_policy#Technical_Usage_Requirements"> 65 65 * OSM API usage policy.</a> … … 67 67 */ 68 68 static public final int MAX_DOWNLOAD_THREADS = 2; 69 70 /** 71 * Default URL of the standard OSM API. 69 70 /** 71 * Default URL of the standard OSM API. 72 72 * @since 5422 73 73 */ … … 93 93 return api; 94 94 } 95 95 96 96 /** 97 97 * Replies the {@link OsmApi} for the URL given by the preference <code>osm-server.url</code> … … 187 187 this.fastFail = fastFail; 188 188 } 189 189 190 190 @Override 191 191 protected byte[] updateData() throws OsmTransferException { … … 196 196 /** 197 197 * Initializes this component by negotiating a protocol version with the server. 198 * 198 * 199 199 * @param monitor the progress monitor 200 200 * @throws OsmTransferCanceledException If the initialisation has been cancelled by user. … … 204 204 initialize(monitor, false); 205 205 } 206 207 /** 208 * Initializes this component by negotiating a protocol version with the server, with the ability to control the timeout. 206 207 /** 208 * Initializes this component by negotiating a protocol version with the server, with the ability to control the timeout. 209 209 * 210 210 * @param monitor the progress monitor … … 269 269 } 270 270 } 271 271 272 272 private void initializeCapabilities(String xml) throws SAXException, IOException, ParserConfigurationException { 273 273 InputSource inputSource = new InputSource(new StringReader(xml)); … … 734 734 throw new OsmTransferException(tr("ID of current changeset > 0 required. Current ID is {0}.", changeset.getId())); 735 735 } 736 736 737 737 /** 738 738 * Replies the changeset data uploads are currently directed to -
trunk/src/org/openstreetmap/josm/io/OsmApiException.java
r5584 r6070 28 28 this.accessedUrl = accessedUrl; 29 29 } 30 30 31 31 /** 32 32 * Constructs an {@code OsmApiException} with the specified response code, error header and error body … … 52 52 53 53 /** 54 * Constructs an {@code OsmApiException} with the specified cause and a detail message of 55 * <tt>(cause==null ? null : cause.toString())</tt> 54 * Constructs an {@code OsmApiException} with the specified cause and a detail message of 55 * <tt>(cause==null ? null : cause.toString())</tt> 56 56 * (which typically contains the class and detail message of <tt>cause</tt>). 57 57 * 58 * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method). 58 * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method). 59 59 * A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown. 60 60 */ … … 66 66 * Constructs an {@code OsmApiException} with the specified detail message and cause. 67 67 * 68 * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated 68 * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated 69 69 * into this exception's detail message. 70 70 * -
trunk/src/org/openstreetmap/josm/io/OsmApiInitializationException.java
r5386 r6070 19 19 20 20 /** 21 * Constructs an {@code OsmApiInitializationException} with the specified cause and a detail message of 22 * <tt>(cause==null ? null : cause.toString())</tt> 21 * Constructs an {@code OsmApiInitializationException} with the specified cause and a detail message of 22 * <tt>(cause==null ? null : cause.toString())</tt> 23 23 * (which typically contains the class and detail message of <tt>cause</tt>). 24 24 * 25 * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method). 25 * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method). 26 26 * A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown. 27 27 */ … … 33 33 * Constructs an {@code OsmApiInitializationException} with the specified detail message and cause. 34 34 * 35 * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated 35 * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated 36 36 * into this exception's detail message. 37 37 * -
trunk/src/org/openstreetmap/josm/io/OsmBzip2Importer.java
r5859 r6070 15 15 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 16 16 "osm.bz2,osm.bz", "osm.bz2", tr("OSM Server Files bzip2 compressed") + " (*.osm.bz2 *.osm.bz)"); 17 17 18 18 public OsmBzip2Importer() { 19 19 super(FILE_FILTER); -
trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java
r5859 r6070 24 24 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 25 25 "osc,osc.bz2,osc.bz,osc.gz", "osc", tr("OsmChange File") + " (*.osc *.osc.bz2 *.osc.bz *.osc.gz)"); 26 26 27 27 public OsmChangeImporter() { 28 28 super(FILE_FILTER); … … 36 36 try { 37 37 FileInputStream in = new FileInputStream(file); 38 38 39 39 if (file.getName().endsWith(".osc")) { 40 40 importData(in, file, progressMonitor); … … 44 44 importData(getBZip2InputStream(in), file, progressMonitor); 45 45 } 46 46 47 47 } catch (FileNotFoundException e) { 48 48 e.printStackTrace(); … … 54 54 importData(in, associatedFile, NullProgressMonitor.INSTANCE); 55 55 } 56 56 57 57 protected void importData(InputStream in, final File associatedFile, ProgressMonitor progressMonitor) throws IllegalDataException { 58 58 final DataSet dataSet = OsmChangeReader.parseDataSet(in, progressMonitor); 59 59 final OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile); 60 addDataLayer(dataSet, layer, associatedFile.getPath()); 60 addDataLayer(dataSet, layer, associatedFile.getPath()); 61 61 } 62 63 protected void addDataLayer(final DataSet dataSet, final OsmDataLayer layer, final String filePath) { 62 63 protected void addDataLayer(final DataSet dataSet, final OsmDataLayer layer, final String filePath) { 64 64 // FIXME: remove UI stuff from IO subsystem 65 65 // -
trunk/src/org/openstreetmap/josm/io/OsmChangesetContentParser.java
r5346 r6070 44 44 private ChangesetDataSet data; 45 45 46 // FIXME: this class has many similarities with OsmHistoryReader.Parser and should be merged 46 // FIXME: this class has many similarities with OsmHistoryReader.Parser and should be merged 47 47 private class Parser extends DefaultHandler { 48 48 … … 143 143 long changesetId = getMandatoryAttributeLong(atts,"changeset"); 144 144 boolean visible= getMandatoryAttributeBoolean(atts, "visible"); 145 145 146 146 Long uid = getAttributeLong(atts, "uid"); 147 147 String userStr = atts.getValue("user"); -
trunk/src/org/openstreetmap/josm/io/OsmGzipImporter.java
r5859 r6070 15 15 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 16 16 "osm.gz", "osm.gz", tr("OSM Server Files gzip compressed") + " (*.osm.gz)"); 17 17 18 18 public OsmGzipImporter() { 19 19 super(FILE_FILTER); -
trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java
r5881 r6070 42 42 private final HistoryDataSet data; 43 43 44 // FIXME: this class has many similarities with OsmChangesetContentParser.Parser and should be merged 44 // FIXME: this class has many similarities with OsmChangesetContentParser.Parser and should be merged 45 45 private class Parser extends DefaultHandler { 46 46 -
trunk/src/org/openstreetmap/josm/io/OsmImporter.java
r5874 r6070 25 25 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 26 26 "osm,xml", "osm", tr("OSM Server Files") + " (*.osm *.xml)"); 27 27 28 28 public static class OsmImporterData { 29 29 … … 80 80 importData(in, associatedFile, NullProgressMonitor.INSTANCE); 81 81 } 82 82 83 83 /** 84 84 * Imports OSM data from stream -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r5996 r6070 130 130 while (true) { 131 131 int event = parser.next(); 132 132 133 133 if (cancel) { 134 134 cancel = false; 135 135 throwException(tr("Reading was canceled")); 136 136 } 137 137 138 138 if (event == XMLStreamConstants.START_ELEMENT) { 139 139 if (parser.getLocalName().equals("bounds")) { -
trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java
r5874 r6070 81 81 }, progressMonitor); 82 82 } 83 83 84 84 /** 85 85 * Method to download GZip-compressed OSM files from somewhere … … 117 117 }, progressMonitor); 118 118 } 119 119 120 120 /** 121 121 * Method to download BZip2-compressed OSM Change files from somewhere … … 135 135 }, progressMonitor); 136 136 } 137 137 138 138 /** 139 139 * Method to download GZip-compressed OSM Change files from somewhere -
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r5874 r6070 23 23 * It can either download the object including or not including its immediate children. 24 24 * The former case is called a "full download". 25 * 25 * 26 26 * It can also download a specific version of the object (however, "full" download is not possible 27 27 * in that case). -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r5863 r6070 209 209 this.doAuthenticate = doAuthenticate; 210 210 } 211 211 212 212 /** 213 213 * Determines if the GPX data has been parsed properly. -
trunk/src/org/openstreetmap/josm/io/OsmTransferException.java
r5386 r6070 27 27 28 28 /** 29 * Constructs an {@code OsmTransferException} with the specified cause and a detail message of 30 * <tt>(cause==null ? null : cause.toString())</tt> 29 * Constructs an {@code OsmTransferException} with the specified cause and a detail message of 30 * <tt>(cause==null ? null : cause.toString())</tt> 31 31 * (which typically contains the class and detail message of <tt>cause</tt>). 32 32 * 33 * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method). 33 * @param cause the cause (which is saved for later retrieval by the {@link #getCause} method). 34 34 * A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown. 35 35 */ … … 41 41 * Constructs an {@code OsmTransferException} with the specified detail message and cause. 42 42 * 43 * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated 43 * <p> Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated 44 44 * into this exception's detail message. 45 45 * -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r5874 r6070 71 71 header(null); 72 72 } 73 73 74 74 public void header(Boolean upload) { 75 75 out.println("<?xml version='1.0' encoding='UTF-8'?>"); … … 82 82 out.println("' generator='JOSM'>"); 83 83 } 84 84 85 85 public void footer() { 86 86 out.println("</osm>"); … … 99 99 return result; 100 100 } 101 101 102 102 public void writeLayer(OsmDataLayer layer) { 103 103 header(!layer.isUploadDiscouraged()); … … 116 116 writeRelations(ds.getRelations()); 117 117 } 118 118 119 119 /** 120 120 * Writes the given nodes sorted by id … … 129 129 } 130 130 } 131 131 132 132 /** 133 133 * Writes the given ways sorted by id … … 142 142 } 143 143 } 144 144 145 145 /** 146 146 * Writes the given relations sorted by id -
trunk/src/org/openstreetmap/josm/io/OsmWriterFactory.java
r4645 r6070 7 7 * This factory is called by everyone who needs an OsmWriter object, 8 8 * instead of directly calling the OsmWriter constructor. 9 * 9 * 10 10 * This enables plugins to substitute the original OsmWriter with 11 11 * their own version, altering the way JOSM writes objects to the 12 12 * server, and to disk. 13 * 13 * 14 14 * @author Frederik Ramm 15 15 * -
trunk/src/org/openstreetmap/josm/io/WMSLayerExporter.java
r5874 r6070 13 13 14 14 /** 15 * Export a WMS layer to a serialized binary file that can be imported later via {@link WMSLayerImporter}. 16 * 15 * Export a WMS layer to a serialized binary file that can be imported later via {@link WMSLayerImporter}. 16 * 17 17 * @since 5457 18 18 */ -
trunk/src/org/openstreetmap/josm/io/WMSLayerImporter.java
r5874 r6070 28 28 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter( 29 29 "wms", "wms", tr("WMS Files (*.wms)")); 30 30 31 31 private final WMSLayer wmsLayer; 32 32 … … 58 58 Utils.close(ois); 59 59 } 60 60 61 61 // FIXME: remove UI stuff from IO subsystem 62 62 GuiHelper.runInEDT(new Runnable() { -
trunk/src/org/openstreetmap/josm/io/XmlWriter.java
r5874 r6070 76 76 encoding.put('\t', "	"); 77 77 } 78 78 79 79 @Override 80 80 public void close() throws IOException { -
trunk/src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java
r5889 r6070 52 52 if (requestorType.equals(RequestorType.PROXY)) 53 53 dialog = CredentialDialog.getHttpProxyCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText()); 54 else 54 else 55 55 dialog = CredentialDialog.getOsmApiCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText()); 56 56 dialog.setVisible(true); -
trunk/src/org/openstreetmap/josm/io/auth/CredentialsManager.java
r5266 r6070 18 18 */ 19 19 public class CredentialsManager implements CredentialsAgent { 20 20 21 21 private static CredentialsManager instance; 22 22 … … 38 38 return instance; 39 39 } 40 40 41 41 private static CredentialsAgentFactory agentFactory; 42 42 … … 44 44 CredentialsAgent getCredentialsAgent(); 45 45 } 46 46 47 47 /** 48 48 * Plugins can register a CredentialsAgentFactory, thereby overriding … … 59 59 * non-static fields and methods 60 60 */ 61 61 62 62 private CredentialsAgent delegate; 63 63 -
trunk/src/org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java
r5863 r6070 145 145 return pnlMessage; 146 146 } 147 147 148 148 @Override 149 149 public String getSaveUsernameAndPasswordCheckboxText() { 150 150 return tr("Save user and password (unencrypted)"); 151 151 } 152 152 153 153 } -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r6000 r6070 67 67 String buildRootUrl() { 68 68 if (serviceUrl == null) { 69 return null; 69 return null; 70 70 } 71 71 StringBuilder a = new StringBuilder(serviceUrl.getProtocol()); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
r5880 r6070 40 40 41 41 /** 42 * 42 * 43 43 * @author master 44 * 44 * 45 45 * Dialog to add tags as part of the remotecontrol 46 46 * Existing Keys get grey color and unchecked selectboxes so they will not overwrite the old Key-Value-Pairs by default. … … 52 52 53 53 /** initially given tags **/ 54 String[][] tags; 55 54 String[][] tags; 55 56 56 private final JTable propertyTable; 57 57 private Collection<? extends OsmPrimitive> sel; … … 60 60 String sender; 61 61 static Set<String> trustedSenders = new HashSet<String>(); 62 62 63 63 /** 64 64 * Class for displaying "delete from ... objects" in the table … … 73 73 } 74 74 } 75 75 76 76 /** 77 77 * Class for displaying list of existing tag values in the table … … 83 83 this.tag=tag; valueCount=new HashMap<String, Integer>(); 84 84 } 85 85 86 86 int addValue(String val) { 87 87 Integer c = valueCount.get(val); … … 117 117 sb.append("</html>"); 118 118 return sb.toString(); 119 120 } 121 } 122 119 120 } 121 } 122 123 123 public AddTagsDialog(String[][] tags, String senderName) { 124 124 super(Main.parent, tr("Add tags to selected objects"), new String[] { tr("Add selected tags"), tr("Add all tags"), tr("Cancel")}, … … 128 128 129 129 this.sender = senderName; 130 130 131 131 DataSet.addSelectionListener(this); 132 132 … … 142 142 sel = Main.main.getCurrentDataSet().getSelected(); 143 143 count = new int[tags.length]; 144 144 145 145 for (int i = 0; i<tags.length; i++) { 146 146 count[i] = 0; … … 164 164 tm.setValueAt(old , i, 3); 165 165 } 166 166 167 167 propertyTable = new JTable(tm) { 168 168 … … 200 200 return tr("Enable the checkbox to accept the value"); 201 201 } 202 202 203 203 }; 204 204 205 205 propertyTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); 206 206 // a checkbox has a size of 15 px … … 213 213 propertyTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_MASK), "shiftenter"); 214 214 propertyTable.getActionMap().put("shiftenter", new AbstractAction() { 215 @Override public void actionPerformed(ActionEvent e) { 215 @Override public void actionPerformed(ActionEvent e) { 216 216 buttonAction(1, e); // add all tags on Shift-Enter 217 217 } 218 218 }); 219 219 220 220 // set the content of this AddTagsDialog consisting of the tableHeader and the table itself. 221 221 JPanel tablePanel = new JPanel(); … … 229 229 if (c.isSelected()) 230 230 trustedSenders.add(sender); 231 else 231 else 232 232 trustedSenders.remove(sender); 233 233 } … … 275 275 } 276 276 } 277 } 277 } 278 278 if (buttonIndex == 2) { 279 279 trustedSenders.remove(sender); … … 287 287 findExistingTags(); 288 288 } 289 289 290 290 /* 291 291 * parse addtags parameters Example URL (part): … … 314 314 for (String tag : tagSet) { 315 315 // support a = b===c as "a"="b===c" 316 String [] pair = tag.split("\\s*=\\s*",2); 316 String [] pair = tag.split("\\s*=\\s*",2); 317 317 keyValue[i][0] = pair[0]; 318 318 keyValue[i][1] = pair.length<2 ? "": pair[1]; … … 323 323 } 324 324 325 325 326 326 }); 327 327 } 328 328 } 329 329 330 330 /** 331 331 * Ask user and add the tags he confirm -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java
r5861 r6070 45 45 * Adds external request handler. 46 46 * Can be used by plugins that want to use remote control. 47 * 47 * 48 48 * @param command The command name. 49 49 * @param handlerClass The additional request handler. -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r5889 r6070 92 92 * Add external request handler. Message can be suppressed. 93 93 * (for internal use) 94 * 94 * 95 95 * @param command The command to handle. 96 96 * @param handler The additional request handler. … … 138 138 out = new OutputStreamWriter(raw); 139 139 BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), "ASCII")); 140 140 141 141 String get = in.readLine(); 142 142 if (get == null) { … … 162 162 return; 163 163 } 164 164 165 165 int questionPos = url.indexOf('?'); 166 166 167 167 String command = questionPos < 0 ? url : url.substring(0, questionPos); 168 168 169 169 Map <String,String> headers = new HashMap<String, String>(); 170 170 int k=0, MAX_HEADERS=20; … … 178 178 } else break; 179 179 } 180 180 181 181 // Who sent the request: trying our best to detect 182 182 // not from localhost => sender = IP 183 183 // from localhost: sender = referer header, if exists 184 184 String sender = null; 185 185 186 186 if (!request.getInetAddress().isLoopbackAddress()) { 187 187 sender = request.getInetAddress().getHostAddress(); … … 197 197 if (sender == null) { 198 198 sender = "localhost"; 199 } 200 } 201 199 } 200 } 201 202 202 // find a handler for this command 203 203 Class<? extends RequestHandler> handlerClass = handlers.get(command); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
r5876 r6070 26 26 */ 27 27 public static final String command = "add_node"; 28 28 29 29 private double lat; 30 30 private double lon; … … 69 69 70 70 Node nd = null; 71 71 72 72 if (Main.map != null && Main.map.mapView != null) { 73 73 Point p = Main.map.mapView.getPoint(ll); … … 83 83 Main.main.undoRedo.add(new AddCommand(nd)); 84 84 } 85 85 86 86 Main.main.getCurrentDataSet().setSelected(nd); 87 87 if (PermissionPrefWithDefault.CHANGE_VIEWPORT.isAllowed()) { … … 91 91 } 92 92 // parse parameter addtags=tag1=value1|tag2=vlaue2 93 AddTagsDialog.addTags(args, sender); 93 AddTagsDialog.addTags(args, sender); 94 94 } 95 95 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
r5927 r6070 34 34 */ 35 35 public static final String command = "add_way"; 36 36 37 37 private final List<LatLon> allCoordinates = new ArrayList<LatLon>(); 38 38 … … 55 55 }); 56 56 // parse parameter addtags=tag1=value1|tag2=value2 57 AddTagsDialog.addTags(args, sender); 57 AddTagsDialog.addTags(args, sender); 58 58 } 59 59 … … 94 94 } 95 95 } 96 96 97 97 /** 98 * Find the node with almost the same ccords in dataset or in already added nodes 98 * Find the node with almost the same ccords in dataset or in already added nodes 99 99 * @since 5845 100 100 **/ 101 101 Node findOrCreateNode(LatLon ll, List<Command> commands) { 102 Node nd = null; 103 102 Node nd = null; 103 104 104 if (Main.map != null && Main.map.mapView != null) { 105 105 Point p = Main.map.mapView.getPoint(ll); … … 109 109 } 110 110 } 111 111 112 112 Node prev = null; 113 113 for (LatLon lOld: addedNodes.keySet()) { … … 128 128 return nd; 129 129 } 130 130 131 131 /* 132 132 * This function creates the way with given coordinates of nodes -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r5889 r6070 23 23 */ 24 24 public static final String command = "import"; 25 25 26 26 private URL url; 27 27 private Collection<DownloadTask> suitableDownloadTasks; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r5876 r6070 38 38 */ 39 39 public static final String command = "load_and_zoom"; 40 40 41 41 /** 42 42 * The remote control command name used to zoom. -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java
r5927 r6070 26 26 */ 27 27 public static final String command = "load_object"; 28 28 29 29 private final List<PrimitiveId> ps = new LinkedList<PrimitiveId>(); 30 30 … … 51 51 public void run() { 52 52 Main.main.getCurrentDataSet().setSelected(ps); 53 AddTagsDialog.addTags(args, sender); 53 AddTagsDialog.addTags(args, sender); 54 54 ps.clear(); 55 55 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r5876 r6070 43 43 /** will be filled with the command assigned to the subclass */ 44 44 protected String myCommand; 45 45 46 46 /** 47 47 * who send th request? … … 251 251 this.sender = sender; 252 252 } 253 253 254 254 public static class RequestHandlerException extends Exception { 255 255 -
trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionExporter.java
r5505 r6070 68 68 69 69 for (ImageEntry entry : layer.getImages()) { 70 70 71 71 Element imgElem = support.createElement("geoimage"); 72 72 -
trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java
r5684 r6070 86 86 } 87 87 } 88 88 89 89 return new GeoImageLayer(entries, gpxLayer); 90 90 } -
trunk/src/org/openstreetmap/josm/io/session/ImagerySessionExporter.java
r5684 r6070 31 31 private ImageryLayer layer; 32 32 private JCheckBox export; 33 33 34 34 public ImagerySessionExporter(ImageryLayer layer) { 35 35 this.layer = layer; -
trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java
r5684 r6070 48 48 return layer; 49 49 } 50 50 51 51 } -
trunk/src/org/openstreetmap/josm/io/session/MarkerSessionImporter.java
r5684 r6070 57 57 MarkerLayer markerLayer = importData.getMarkerLayer(); 58 58 markerLayer.fromLayer = gpxLayer; 59 59 60 60 return markerLayer; 61 61 -
trunk/src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java
r5886 r6070 68 68 public LayerSaveAction() { 69 69 putValue(SMALL_ICON, new ImageProvider("save").setWidth(16).get()); 70 putValue(SHORT_DESCRIPTION, layer.requiresSaveToFile() ? 70 putValue(SHORT_DESCRIPTION, layer.requiresSaveToFile() ? 71 71 tr("Layer contains unsaved data - save to file.") : 72 72 tr("Layer does not contain unsaved data.")); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r6041 r6070 151 151 152 152 final public static String [] UNMAINTAINED_PLUGINS = new String[] {"gpsbabelgui", "Intersect_way"}; 153 153 154 154 /** 155 155 * Default time-based update interval, in days (pluginmanager.time-based-update.interval) … … 425 425 return false; 426 426 } 427 427 428 428 // Add all plugins already loaded (to include early plugins when checking late ones) 429 429 Collection<PluginInformation> allPlugins = new HashSet<PluginInformation>(plugins); … … 449 449 450 450 String requires = local ? plugin.localrequires : plugin.requires; 451 451 452 452 // make sure the dependencies to other plugins are not broken 453 453 // … … 483 483 List<URL> allPluginLibraries = new LinkedList<URL>(); 484 484 File pluginDir = Main.pref.getPluginsDirectory(); 485 485 486 486 // Add all plugins already loaded (to include early plugins in the classloader, allowing late plugins to rely on early ones) 487 487 Collection<PluginInformation> allPlugins = new HashSet<PluginInformation>(plugins); … … 489 489 allPlugins.add(proxy.getPluginInformation()); 490 490 } 491 491 492 492 for (PluginInformation info : allPlugins) { 493 493 if (info.libraries == null) { … … 760 760 ); 761 761 } 762 762 763 763 private static Set<PluginInformation> findRequiredPluginsToDownload( 764 764 Collection<PluginInformation> pluginsToUpdate, List<PluginInformation> allPlugins, Set<PluginInformation> pluginsToDownload) { … … 818 818 Future<?> future = service.submit(task1); 819 819 List<PluginInformation> allPlugins = null; 820 820 821 821 try { 822 822 future.get(); … … 841 841 } 842 842 } 843 843 844 844 if (!pluginsToUpdate.isEmpty()) { 845 845 846 846 Set<PluginInformation> pluginsToDownload = new HashSet<PluginInformation>(pluginsToUpdate); 847 847 848 848 if (allPlugins != null) { 849 849 // Updated plugins may need additional plugin dependencies currently not installed … … 851 851 Set<PluginInformation> additionalPlugins = findRequiredPluginsToDownload(pluginsToUpdate, allPlugins, pluginsToDownload); 852 852 pluginsToDownload.addAll(additionalPlugins); 853 853 854 854 // Iterate on required plugins, if they need themselves another plugins (i.e A needs B, but B needs C) 855 855 while (!additionalPlugins.isEmpty()) { … … 881 881 return plugins; 882 882 } 883 883 884 884 // Update Plugin info for downloaded plugins 885 885 // 886 886 refreshLocalUpdatedPluginInfo(task2.getDownloadedPlugins()); 887 887 888 888 // notify user if downloading a locally installed plugin failed 889 889 // … … 1005 1005 return; 1006 1006 } 1007 1007 1008 1008 /** 1009 1009 * Determines if the specified file is a valid and accessible JAR file. … … 1023 1023 return false; 1024 1024 } 1025 1025 1026 1026 /** 1027 1027 * Replies the updated jar file for the given plugin name. … … 1043 1043 return downloadedPluginFile; 1044 1044 } 1045 1045 1046 1046 /** 1047 1047 * Refreshes the given PluginInformation objects with new contents read from their corresponding jar file. -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r5874 r6070 58 58 public List<URL> libraries = new LinkedList<URL>(); 59 59 public final Map<String, String> attr = new TreeMap<String, String>(); 60 60 61 61 private static final ImageIcon emptyIcon = new ImageIcon(new BufferedImage(24, 24, BufferedImage.TYPE_INT_ARGB)); 62 62 … … 154 154 this.attr.putAll(other.attr); 155 155 } 156 156 157 157 /** 158 158 * Updates the plugin information of this plugin information object with the … … 173 173 this.stage = other.stage; 174 174 } 175 175 176 176 private void scanManifest(Manifest manifest, boolean oldcheck){ 177 177 String lang = LanguageInfo.getLanguageCodeManifest(); … … 495 495 return requiredPlugins; 496 496 } 497 498 /** 499 * Replies the list of plugins required by the up-to-date version of this plugin. 497 498 /** 499 * Replies the list of plugins required by the up-to-date version of this plugin. 500 500 * @return List of plugins required. Empty if no plugin is required. 501 501 * @since 5601 … … 504 504 return getRequiredPlugins(requires); 505 505 } 506 507 /** 508 * Replies the list of plugins required by the local instance of this plugin. 506 507 /** 508 * Replies the list of plugins required by the local instance of this plugin. 509 509 * @return List of plugins required. Empty if no plugin is required. 510 510 * @since 5601 … … 513 513 return getRequiredPlugins(localrequires); 514 514 } 515 516 /** 517 * Updates the local fields ({@link #localversion}, {@link #localmainversion}, {@link #localrequires}) 518 * to values contained in the up-to-date fields ({@link #version}, {@link #mainversion}, {@link #requires}) 515 516 /** 517 * Updates the local fields ({@link #localversion}, {@link #localmainversion}, {@link #localrequires}) 518 * to values contained in the up-to-date fields ({@link #version}, {@link #mainversion}, {@link #requires}) 519 519 * of the given PluginInformation. 520 520 * @param info The plugin information to get the data from. -
trunk/src/org/openstreetmap/josm/tools/AlphanumComparator.java
r5087 r6070 31 31 * 32 32 * The Alphanum Algorithm is discussed at http://www.DaveKoelle.com 33 * 33 * 34 34 * This is an updated version with enhancements made by Daniel Migowski, Andre 35 35 * Bogus, and David Koelle. -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r5874 r6070 342 342 343 343 /** 344 * Shows a popup audio error message for the given exception. 344 * Shows a popup audio error message for the given exception. 345 345 * @param ex The exception used as error reason. Cannot be {@code null}. 346 346 */ -
trunk/src/org/openstreetmap/josm/tools/AudioUtil.java
r5874 r6070 18 18 */ 19 19 public class AudioUtil { 20 20 21 21 /** 22 22 * Returns calibrated length of recording in seconds. -
trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r5886 r6070 129 129 urltext += "...<snip>...\n"; 130 130 } 131 131 132 132 JPanel p = new JPanel(new GridBagLayout()); 133 133 p.add(new JMultilineLabel( … … 173 173 } 174 174 } 175 175 176 176 /** 177 177 * Determines if an exception is currently being handled … … 181 181 return handlingInProgress; 182 182 } 183 183 184 184 /** 185 185 * Replies the URL to create a JOSM bug report with the given debug text … … 194 194 gzip.write(debugText.getBytes("UTF-8")); 195 195 Utils.close(gzip); 196 196 197 197 return new URL("http://josm.openstreetmap.de/josmticket?" + 198 198 "gdata="+Base64.encode(ByteBuffer.wrap(out.toByteArray()), true)); … … 202 202 } 203 203 } 204 204 205 205 /** 206 206 * Replies the URL label to create a JOSM bug report with the given debug text -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r5584 r6070 279 279 msg = body; 280 280 } 281 281 282 282 if (msg != null && !msg.isEmpty()) { 283 283 return tr("<html>" … … 546 546 return message; 547 547 } 548 548 549 549 /** 550 550 * Explains a {@link OsmApiException} which was thrown because of 551 * bandwidth limit exceeded (HTTP error 509) 551 * bandwidth limit exceeded (HTTP error 509) 552 552 * 553 553 * @param e the exception … … 559 559 return message; 560 560 } 561 561 562 562 563 563 /** … … 694 694 return msg; 695 695 } 696 696 697 697 /** 698 698 * Replaces some HTML reserved characters (<, > and &) by their equivalent entity (<, > and &); -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r6049 r6070 39 39 * 40 40 * Prerequisite: no two nodes have the same coordinates. 41 * 41 * 42 42 * @param ways a list of ways to test 43 43 * @param test if false, do not build list of Commands, just return nodes … … 247 247 */ 248 248 public static EastNorth getSegmentSegmentIntersection(EastNorth p1, EastNorth p2, EastNorth p3, EastNorth p4) { 249 249 250 250 CheckParameterUtil.ensureValidCoordinates(p1, "p1"); 251 251 CheckParameterUtil.ensureValidCoordinates(p2, "p2"); 252 252 CheckParameterUtil.ensureValidCoordinates(p3, "p3"); 253 253 CheckParameterUtil.ensureValidCoordinates(p4, "p4"); 254 254 255 255 double x1 = p1.getX(); 256 256 double y1 = p1.getY(); … … 270 270 // (x2-x1,y2-y1)*u - (x4-x3,y4-y3)*v = (x3-x1,y3-y1) 271 271 // if 0<= u,v <=1, intersection exists at ( x1+ (x2-x1)*u, y1 + (y2-y1)*u ) 272 272 273 273 double a1 = x2 - x1; 274 274 double b1 = x3 - x4; … … 281 281 // Solve the equations 282 282 double det = a1*b2 - a2*b1; 283 283 284 284 double uu = b2*c1 - b1*c2 ; 285 285 double vv = a1*c2 - a2*c1; 286 286 double mag = Math.abs(uu)+Math.abs(vv); 287 287 288 288 if (Math.abs(det) > 1e-12 * mag) { 289 289 double u = uu/det, v = vv/det; … … 298 298 // parallel lines 299 299 return null; 300 } 300 } 301 301 } 302 302 … … 312 312 CheckParameterUtil.ensureValidCoordinates(p3, "p3"); 313 313 CheckParameterUtil.ensureValidCoordinates(p4, "p4"); 314 314 315 315 if (!p1.isValid()) throw new IllegalArgumentException(); 316 316 317 317 // Convert line from (point, point) form to ax+by=c 318 318 double a1 = p2.getY() - p1.getY(); … … 376 376 return new EastNorth(p1.getX() + ldx * offset, p1.getY() + ldy * offset); 377 377 } 378 378 379 379 /** 380 380 * Calculates closest point to a line segment. … … 418 418 */ 419 419 public static boolean angleIsClockwise(EastNorth commonNode, EastNorth firstNode, EastNorth secondNode) { 420 420 421 421 CheckParameterUtil.ensureValidCoordinates(commonNode, "commonNode"); 422 422 CheckParameterUtil.ensureValidCoordinates(firstNode, "firstNode"); 423 423 CheckParameterUtil.ensureValidCoordinates(secondNode, "secondNode"); 424 424 425 425 double dy1 = (firstNode.getY() - commonNode.getY()); 426 426 double dy2 = (secondNode.getY() - commonNode.getY()); … … 446 446 path.closePath(); 447 447 } 448 448 449 449 return new Area(path); 450 450 } 451 451 452 452 /** 453 453 * Tests if two polygons intersect. … … 457 457 */ 458 458 public static PolygonIntersection polygonIntersection(List<Node> first, List<Node> second) { 459 459 460 460 Area a1 = getArea(first); 461 461 Area a2 = getArea(second); 462 462 463 463 Area inter = new Area(a1); 464 464 inter.intersect(a2); 465 465 466 466 Rectangle bounds = inter.getBounds(); 467 467 468 468 if (inter.isEmpty() || bounds.getHeight()*bounds.getWidth() <= 1.0) { 469 469 return PolygonIntersection.OUTSIDE; … … 622 622 */ 623 623 public static double getSegmentAngle(EastNorth p1, EastNorth p2) { 624 624 625 625 CheckParameterUtil.ensureValidCoordinates(p1, "p1"); 626 626 CheckParameterUtil.ensureValidCoordinates(p2, "p2"); 627 627 628 628 return Math.atan2(p2.north() - p1.north(), p2.east() - p1.east()); 629 629 } … … 638 638 */ 639 639 public static double getCornerAngle(EastNorth p1, EastNorth p2, EastNorth p3) { 640 640 641 641 CheckParameterUtil.ensureValidCoordinates(p1, "p1"); 642 642 CheckParameterUtil.ensureValidCoordinates(p2, "p2"); 643 643 CheckParameterUtil.ensureValidCoordinates(p3, "p3"); 644 644 645 645 Double result = getSegmentAngle(p2, p1) - getSegmentAngle(p2, p3); 646 646 if (result <= -Math.PI) { … … 654 654 return result; 655 655 } 656 656 657 657 public static EastNorth getCentroid(List<Node> nodes) { 658 658 // Compute the centroid of nodes … … 672 672 BigDecimal x1 = new BigDecimal(n1.east()); 673 673 BigDecimal y1 = new BigDecimal(n1.north()); 674 674 675 675 BigDecimal k = x0.multiply(y1, MathContext.DECIMAL128).subtract(y0.multiply(x1, MathContext.DECIMAL128)); 676 676 677 677 area = area.add(k, MathContext.DECIMAL128); 678 678 east = east.add(k.multiply(x0.add(x1, MathContext.DECIMAL128), MathContext.DECIMAL128)); … … 702 702 */ 703 703 public static EastNorth getSegmentAltituteIntersection(EastNorth sp1, EastNorth sp2, EastNorth ap) { 704 704 705 705 CheckParameterUtil.ensureValidCoordinates(sp1, "sp1"); 706 706 CheckParameterUtil.ensureValidCoordinates(sp2, "sp2"); -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r5946 r6070 198 198 return this; 199 199 } 200 200 201 201 /** 202 202 * Convenience method, see {@link #setMaxSize(Dimension)}. -
trunk/src/org/openstreetmap/josm/tools/ImageResource.java
r5830 r6070 13 13 * Holds data for one particular image. 14 14 * It can be backed by a svg or raster image. 15 * 16 * In the first case, 'svg' is not null and in the latter case, 'imgCache' has 15 * 16 * In the first case, 'svg' is not null and in the latter case, 'imgCache' has 17 17 * at least one entry for the key DEFAULT_DIMENSION. 18 18 */ 19 19 class ImageResource { 20 20 21 21 /** 22 22 * Caches the image data for resized versions of the same image. … … 25 25 private SVGDiagram svg; 26 26 public static final Dimension DEFAULT_DIMENSION = new Dimension(-1, -1); 27 27 28 28 public ImageResource(BufferedImage img) { 29 29 CheckParameterUtil.ensureParameterNotNull(img); … … 63 63 BufferedImage base = imgCache.get(DEFAULT_DIMENSION); 64 64 if (base == null) throw new AssertionError(); 65 65 66 66 int width = dim.width; 67 67 int height = dim.height; -
trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java
r5927 r6070 13 13 14 14 /** 15 * Tools to work with Swing InputMap 15 * Tools to work with Swing InputMap 16 16 * 17 17 */ … … 25 25 SwingUtilities.replaceUIInputMap(cmp,JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,inputMap); 26 26 } 27 28 27 28 29 29 /** 30 30 * Enable activating button on Enter (which is replaced with spacebar for certain Look-And-Feels) … … 35 35 b.getActionMap().put("enter",b.getAction()); 36 36 } 37 37 38 38 public static void addEnterAction(JComponent c, Action a) { 39 39 c.getActionMap().put("enter", a); 40 40 c.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter"); 41 41 } 42 42 43 43 public static void addSpacebarAction(JComponent c, Action a) { 44 44 c.getActionMap().put("spacebar", a); 45 45 c.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "spacebar"); 46 46 } 47 47 48 48 } -
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r5926 r6070 25 25 * case (or Xy_AB: for sub languages). 26 26 * 27 * @param type the type 27 * @param type the type 28 28 * @return the wiki language prefix or {@code null} for {@link LocaleType#BASELANGUAGE}, when 29 29 * base language is identical to default or english -
trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java
r5266 r6070 27 27 Main.platform.openUrl(uri.toString()); 28 28 } 29 29 30 30 /** 31 31 * @return <code>null</code> for success or a string in case of an error. -
trunk/src/org/openstreetmap/josm/tools/PlatformHook.java
r5850 r6070 92 92 93 93 public boolean rename(File from, File to); 94 94 95 95 /** 96 96 * Returns a detailed OS description (at least family + version). -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r5879 r6070 250 250 return false; 251 251 } 252 252 253 253 /* (non-Javadoc) 254 254 * @see org.openstreetmap.josm.tools.PlatformHookUnixoid#getOSDescription() -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r5994 r6070 21 21 */ 22 22 public class PlatformHookUnixoid implements PlatformHook { 23 23 24 24 private String osDescription; 25 25 26 26 @Override 27 27 public void preStartupHook(){ … … 127 127 return osName; 128 128 } 129 129 130 130 @Override 131 131 public String getOSDescription() { … … 135 135 return osDescription; 136 136 } 137 137 138 138 protected static class LinuxReleaseInfo { 139 139 private final String path; … … 143 143 private final boolean plainText; 144 144 private final String prefix; 145 145 146 146 public LinuxReleaseInfo(String path, String descriptionField, String idField, String releaseField) { 147 147 this(path, descriptionField, idField, releaseField, false, null); … … 155 155 this(path, null, null, null, true, prefix); 156 156 } 157 157 158 158 private LinuxReleaseInfo(String path, String descriptionField, String idField, String releaseField, boolean plainText, String prefix) { 159 159 this.path = path; … … 166 166 167 167 @Override public String toString() { 168 return "ReleaseInfo [path=" + path + ", descriptionField=" + descriptionField + 168 return "ReleaseInfo [path=" + path + ", descriptionField=" + descriptionField + 169 169 ", idField=" + idField + ", releaseField=" + releaseField + "]"; 170 170 } 171 171 172 172 /** 173 173 * Extracts OS detailed information from a Linux release file (/etc/xxx-release) -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r5850 r6070 44 44 //Shortcut.registerSystemCut("system:menuexit", tr("reserved"), VK_Q, CTRL_DOWN_MASK); 45 45 Shortcut.registerSystemShortcut("system:duplicate", tr("reserved"), VK_D, CTRL_DOWN_MASK); // not really system, but to avoid odd results 46 46 47 47 // Windows 7 shortcuts: http://windows.microsoft.com/en-US/windows7/Keyboard-shortcuts 48 48 … … 56 56 Shortcut.registerSystemShortcut("microsoft-reserved-02", tr("reserved"), VK_NUM_LOCK, ALT_DOWN_MASK | SHIFT_DOWN_MASK).setAutomatic(); // Turn Mouse Keys on or off 57 57 //Shortcut.registerSystemCut("microsoft-reserved-03", tr("reserved"), VK_U, );// Open the Ease of Access Center (TODO: Windows-U, how to handle it in Java ?) 58 58 59 59 // General keyboard shortcuts 60 60 //Shortcut.registerSystemShortcut("system:help", tr("reserved"), VK_F1, 0); // Display Help … … 129 129 @Override 130 130 public String getOSDescription() { 131 return Utils.strip(System.getProperty("os.name")) + " " + 131 return Utils.strip(System.getProperty("os.name")) + " " + 132 132 ((System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit"; 133 133 } -
trunk/src/org/openstreetmap/josm/tools/UrlLabel.java
r5440 r6070 28 28 this (url, url, 0); 29 29 } 30 30 31 31 public UrlLabel(String url, int fontPlus) { 32 32 this (url, url, fontPlus); … … 36 36 this (url, url, 0); 37 37 } 38 38 39 39 public UrlLabel(String url, String description, int fontPlus) { 40 40 this(); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r5887 r6070 249 249 */ 250 250 public static void copyFile(File in, File out) throws IOException { 251 // TODO: remove this function when we move to Java 7 (use Files.copy instead) 251 // TODO: remove this function when we move to Java 7 (use Files.copy instead) 252 252 FileInputStream inStream = null; 253 253 FileOutputStream outStream = null; … … 266 266 } 267 267 } 268 268 269 269 public static int copyStream(InputStream source, OutputStream destination) throws IOException { 270 270 int count = 0; … … 306 306 } 307 307 } 308 308 309 309 /** 310 310 * <p>Utility method for closing a {@link ZipFile}.</p> … … 357 357 try { 358 358 t = clipboard.getContents(null); 359 } catch (IllegalStateException e) { 359 } catch (IllegalStateException e) { 360 360 // Clipboard currently unavailable. On some platforms, the system clipboard is unavailable while it is accessed by another application. 361 361 try { … … 561 561 return new Color(Integer.parseInt(clr, 16)); 562 562 } 563 563 564 564 /** 565 565 * Opens a HTTP connection to the given URL and sets the User-Agent property to JOSM's one. … … 577 577 return connection; 578 578 } 579 579 580 580 /** 581 581 * Opens a connection to the given URL and sets the User-Agent property to JOSM's one. … … 618 618 * Opens a HTTP connection to the given URL, sets the User-Agent property to JOSM's one and optionnaly disables Keep-Alive. 619 619 * @param httpURL The HTTP url to open (must use http:// or https://) 620 * @param keepAlive 620 * @param keepAlive 621 621 * @return An open HTTP connection to the given URL 622 622 * @throws IOException if an I/O exception occurs. … … 630 630 return connection; 631 631 } 632 632 633 633 /** 634 634 * An alternative to {@link String#trim()} to effectively remove all leading and trailing white characters, including Unicode ones. 635 635 * @see <a href="http://closingbraces.net/2008/11/11/javastringtrim/">Java’s String.trim has a strange idea of whitespace</a> 636 * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4080617">JDK bug 4080617</a> 636 * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4080617">JDK bug 4080617</a> 637 637 * @param str The string to strip 638 * @return <code>str</code>, without leading and trailing characters, according to 638 * @return <code>str</code>, without leading and trailing characters, according to 639 639 * {@link Character#isWhitespace(char)} and {@link Character#isSpaceChar(char)}. 640 640 * @since 5772 -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r5926 r6070 110 110 /** 111 111 * Creates a window geometry from a rectangle 112 * 112 * 113 113 * @param rect the position 114 114 */ … … 286 286 * Applies this geometry to a window. Makes sure that the window is not 287 287 * placed outside of the coordinate range of all available screens. 288 * 288 * 289 289 * @param window the window 290 290 */ … … 322 322 * Find the size and position of the screen for given coordinates. Use first screen, 323 323 * when no coordinates are stored or null is passed. 324 * 324 * 325 325 * @param preferenceKey the key to get size and position from 326 326 * @return bounds of the screen … … 336 336 * Find the size and position of the screen for given coordinates. Use first screen, 337 337 * when no coordinates are stored or null is passed. 338 * 338 * 339 339 * @param g coordinates to check 340 340 * @return bounds of the screen
Note:
See TracChangeset
for help on using the changeset viewer.