Changeset 3182 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-04-14T17:17:36+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r3102 r3182 548 548 } 549 549 super.setVisible(visible); 550 if (!visible) { 550 if (visible) { 551 RelationDialogManager.getRelationDialogManager().positionOnScreen(this); 552 } else { 551 553 // make sure all registered listeners are unregistered 552 554 // -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java
r3083 r3182 226 226 227 227 /** 228 * Positions an {@see RelationEditor} centered on the screen229 *230 * @param editor the editor231 */232 protected void centerOnScreen(RelationEditor editor) {233 Point p = new Point(0,0);234 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();235 p.x = (d.width - editor.getSize().width)/2;236 p.y = (d.height - editor.getSize().height)/2;237 p.x = Math.max(p.x,0);238 p.y = Math.max(p.y,0);239 editor.setLocation(p);240 }241 242 /**243 228 * Replies true, if there is another open {@see RelationEditor} whose 244 229 * upper left corner is close to <code>p</code>. … … 259 244 260 245 /** 261 * Positions a {@see RelationEditor} close to the center of the screen, in such262 * a way, that it doesn't entirely cover another {@see RelationEditor}263 *264 * @param editor265 */266 protected void positionCloseToScreenCenter(RelationEditor editor) {267 Point p = new Point(0,0);268 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();269 p.x = (d.width - editor.getSize().width)/2;270 p.y = (d.height - editor.getSize().height)/2;271 p.x = Math.max(p.x,0);272 p.y = Math.max(p.y,0);273 while(hasEditorWithCloseUpperLeftCorner(p)) {274 p.x += 20;275 p.y += 20;276 }277 editor.setLocation(p);278 }279 280 /**281 246 * Positions a {@see RelationEditor} on the screen. Tries to center it on the 282 247 * screen. If it hide another instance of an editor at the same position this … … 288 253 public void positionOnScreen(RelationEditor editor) { 289 254 if (editor == null) return; 290 if (openDialogs.isEmpty()) { 291 centerOnScreen(editor); 292 } else { 293 positionCloseToScreenCenter(editor); 255 if (!openDialogs.isEmpty()) { 256 Point corner = editor.getLocation(); 257 while(hasEditorWithCloseUpperLeftCorner(corner)) { 258 // shift a little, so that the dialogs are not exactly on top of each other 259 corner.x += 20; 260 corner.y += 20; 261 } 262 editor.setLocation(corner); 294 263 } 295 264 }
Note:
See TracChangeset
for help on using the changeset viewer.