Changeset 11996 in josm
- Timestamp:
- 2017-04-24T21:35:09+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NotificationManager.java
r11396 r11996 40 40 import org.openstreetmap.josm.gui.help.HelpBrowser; 41 41 import org.openstreetmap.josm.gui.help.HelpUtil; 42 import org.openstreetmap.josm.gui.util.GuiHelper; 42 43 import org.openstreetmap.josm.tools.ImageProvider; 43 44 … … 103 104 if (currentNotification == null) return; 104 105 105 currentNotificationPanel = new NotificationPanel(currentNotification, new FreezeMouseListener(), e -> this.stopHideTimer()); 106 currentNotificationPanel.validate(); 107 108 int margin = 5; 109 JFrame parentWindow = (JFrame) Main.parent; 110 Dimension size = currentNotificationPanel.getPreferredSize(); 111 if (parentWindow != null) { 112 int x; 113 int y; 114 if (Main.isDisplayingMapView() && Main.map.mapView.getHeight() > 0) { 115 MapView mv = Main.map.mapView; 116 Point mapViewPos = SwingUtilities.convertPoint(mv.getParent(), mv.getX(), mv.getY(), Main.parent); 117 x = mapViewPos.x + margin; 118 y = mapViewPos.y + mv.getHeight() - Main.map.statusLine.getHeight() - size.height - margin; 119 } else { 120 x = margin; 121 y = parentWindow.getHeight() - Main.toolbar.control.getSize().height - size.height - margin; 122 } 123 parentWindow.getLayeredPane().add(currentNotificationPanel, JLayeredPane.POPUP_LAYER, 0); 124 125 currentNotificationPanel.setLocation(x, y); 126 } 127 currentNotificationPanel.setSize(size); 128 129 currentNotificationPanel.setVisible(true); 106 GuiHelper.runInEDTAndWait(() -> { 107 currentNotificationPanel = new NotificationPanel(currentNotification, new FreezeMouseListener(), e -> this.stopHideTimer()); 108 currentNotificationPanel.validate(); 109 110 int margin = 5; 111 JFrame parentWindow = (JFrame) Main.parent; 112 Dimension size = currentNotificationPanel.getPreferredSize(); 113 if (parentWindow != null) { 114 int x; 115 int y; 116 if (Main.isDisplayingMapView() && Main.map.mapView.getHeight() > 0) { 117 MapView mv = Main.map.mapView; 118 Point mapViewPos = SwingUtilities.convertPoint(mv.getParent(), mv.getX(), mv.getY(), Main.parent); 119 x = mapViewPos.x + margin; 120 y = mapViewPos.y + mv.getHeight() - Main.map.statusLine.getHeight() - size.height - margin; 121 } else { 122 x = margin; 123 y = parentWindow.getHeight() - Main.toolbar.control.getSize().height - size.height - margin; 124 } 125 parentWindow.getLayeredPane().add(currentNotificationPanel, JLayeredPane.POPUP_LAYER, 0); 126 127 currentNotificationPanel.setLocation(x, y); 128 } 129 currentNotificationPanel.setSize(size); 130 currentNotificationPanel.setVisible(true); 131 }); 130 132 131 133 running = true;
Note:
See TracChangeset
for help on using the changeset viewer.