Changeset 7527 in josm for trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
- Timestamp:
- 2014-09-11T19:27:03+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r7524 r7527 29 29 import org.openstreetmap.josm.tools.WindowGeometry; 30 30 31 /** 32 * Manager allowing to show/hide history dialogs. 33 * @since 2019 34 */ 31 35 public class HistoryBrowserDialogManager implements MapView.LayerChangeListener { 36 32 37 private static HistoryBrowserDialogManager instance; 38 39 /** 40 * Replies the unique instance. 41 * @return the unique instance 42 */ 33 43 public static HistoryBrowserDialogManager getInstance() { 34 44 if (instance == null) { … … 45 55 } 46 56 57 /** 58 * Determines if an history dialog exists for the given object id. 59 * @param id the object id 60 * @return {@code true} if an history dialog exists for the given object id, {@code false} otherwise 61 */ 47 62 public boolean existsDialog(long id) { 48 63 return dialogs.containsKey(id); 49 64 } 50 65 51 p ublicvoid show(long id, HistoryBrowserDialog dialog) {66 protected void show(long id, HistoryBrowserDialog dialog) { 52 67 if (dialogs.values().contains(dialog)) { 53 68 show(id); … … 60 75 Main.debug("#10462 - JFrame.isDefaultLookAndFeelDecorated: "+JFrame.isDefaultLookAndFeelDecorated()); 61 76 Main.debug("#10462 - dialog.isUndecorated: "+dialog.isUndecorated()); 77 Main.debug("#10462 - UIManager.getLookAndFeel: "+UIManager.getLookAndFeel()); 62 78 Main.debug("#10462 - LookAndFeel.getSupportsWindowDecorations: "+UIManager.getLookAndFeel().getSupportsWindowDecorations()); 63 79 Main.debug("#10462 - JRootPane.getWindowDecorationStyle: "+dialog.getRootPane().getWindowDecorationStyle()); 64 80 Main.debug("#10462 - Window.getIconImages: "+dialog.getIconImages()); 65 81 Main.debug("#10462 - Dialog.getTitle: "+dialog.getTitle()); 82 Main.debug("#10462 - Dialog.getInsets: "+dialog.getInsets()); 66 83 } 67 84 dialogs.put(id, dialog); … … 69 86 } 70 87 71 p ublicvoid show(long id) {88 protected void show(long id) { 72 89 if (dialogs.keySet().contains(id)) { 73 90 dialogs.get(id).toFront(); … … 87 104 final String WINDOW_GEOMETRY_PREF = getClass().getName() + ".geometry"; 88 105 89 p ublicvoid placeOnScreen(HistoryBrowserDialog dialog) {106 protected void placeOnScreen(HistoryBrowserDialog dialog) { 90 107 WindowGeometry geometry = new WindowGeometry(WINDOW_GEOMETRY_PREF, WindowGeometry.centerOnScreen(new Dimension(850, 500))); 91 108 geometry.applySafe(dialog); 92 109 Point p = dialog.getLocation(); 93 while (hasDialogWithCloseUpperLeftCorner(p)) {110 while (hasDialogWithCloseUpperLeftCorner(p)) { 94 111 p.x += 20; 95 112 p.y += 20; … … 98 115 } 99 116 117 /** 118 * Hides the specified history dialog and cleans associated resources. 119 * @param dialog History dialog to hide 120 */ 100 121 public void hide(HistoryBrowserDialog dialog) { 101 122 long id = 0; … … 129 150 } 130 151 152 /** 153 * Show history dialog for the given history. 154 * @param h History to show 155 */ 131 156 public void show(History h) { 132 157 if (h == null) … … 151 176 public void layerRemoved(Layer oldLayer) { 152 177 // remove all history browsers if the number of layers drops to 0 153 //154 178 if (Main.isDisplayingMapView() && Main.map.mapView.getNumLayers() == 0) { 155 179 hideAll(); … … 157 181 } 158 182 183 /** 184 * Show history dialog(s) for the given primitive(s). 185 * @param primitives The primitive(s) for which history will be displayed 186 */ 159 187 public void showHistory(final Collection<? extends PrimitiveId> primitives) { 160 188 final Collection<? extends PrimitiveId> notNewPrimitives = Utils.filter(primitives, notNewPredicate);
Note:
See TracChangeset
for help on using the changeset viewer.