Class HistoryBrowserDialogManager
- java.lang.Object
-
- org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager
-
- All Implemented Interfaces:
LayerManager.LayerChangeListener
public final class HistoryBrowserDialogManager extends java.lang.Object implements LayerManager.LayerChangeListener
Manager allowing to show/hide history dialogs.- Since:
- 2019
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.LinkedHashMap<java.lang.Long,HistoryBrowserDialog>dialogsprivate static java.util.List<HistoryHook>hooksprivate static HistoryBrowserDialogManagerinstanceprivate static java.lang.StringWINDOW_GEOMETRY_PREF
-
Constructor Summary
Constructors Modifier Constructor Description privateHistoryBrowserDialogManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaddHistoryHook(HistoryHook hook)Adds a newHistoryHook.booleanexistsDialog(long id)Determines if an history dialog exists for the given object id.static HistoryBrowserDialogManagergetInstance()Replies the unique instance.private booleanhasDialogWithCloseUpperLeftCorner(java.awt.Point p)voidhide(HistoryBrowserDialog dialog)Hides the specified history dialog and cleans associated resources.voidhideAll()Hides and destroys all currently visible history browser dialogsprivate static booleanisUnloaded(PrimitiveId p)voidlayerAdded(LayerManager.LayerAddEvent e)Notifies this listener that a layer has been added.voidlayerOrderChanged(LayerManager.LayerOrderChangeEvent e)Notifies this listener that the order of layers was changed.voidlayerRemoving(LayerManager.LayerRemoveEvent e)Notifies this listener that a layer was just removed.private voidplaceOnScreen(HistoryBrowserDialog dialog)static booleanremoveHistoryHook(HistoryHook hook)Removes an existingHistoryHook.voidshow(History h)Show history dialog for the given history.voidshowHistory(java.awt.Component parent, java.util.Collection<? extends PrimitiveId> primitives)Show history dialog(s) for the given primitive(s).voidshowHistory(java.util.Collection<? extends PrimitiveId> primitives)Show history dialog(s) for the given primitive(s).
-
-
-
Field Detail
-
WINDOW_GEOMETRY_PREF
private static final java.lang.String WINDOW_GEOMETRY_PREF
-
instance
private static HistoryBrowserDialogManager instance
-
dialogs
private final java.util.LinkedHashMap<java.lang.Long,HistoryBrowserDialog> dialogs
-
hooks
private static final java.util.List<HistoryHook> hooks
-
-
Constructor Detail
-
HistoryBrowserDialogManager
private HistoryBrowserDialogManager()
-
-
Method Detail
-
isUnloaded
private static boolean isUnloaded(PrimitiveId p)
-
getInstance
public static HistoryBrowserDialogManager getInstance()
Replies the unique instance.- Returns:
- the unique instance
-
existsDialog
public boolean existsDialog(long id)
Determines if an history dialog exists for the given object id.- Parameters:
id- the object id- Returns:
trueif an history dialog exists for the given object id,falseotherwise
-
hasDialogWithCloseUpperLeftCorner
private boolean hasDialogWithCloseUpperLeftCorner(java.awt.Point p)
-
placeOnScreen
private void placeOnScreen(HistoryBrowserDialog dialog)
-
hide
public void hide(HistoryBrowserDialog dialog)
Hides the specified history dialog and cleans associated resources.- Parameters:
dialog- History dialog to hide
-
hideAll
public void hideAll()
Hides and destroys all currently visible history browser dialogs- Since:
- 2448
-
show
public void show(History h)
Show history dialog for the given history.- Parameters:
h- History to show- Since:
- 2448
-
layerAdded
public void layerAdded(LayerManager.LayerAddEvent e)
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer has been added.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerAddedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The new added layer event
-
layerRemoving
public void layerRemoving(LayerManager.LayerRemoveEvent e)
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer was just removed.Listeners are called in the EDT thread after the layer was removed. Use
LayerManager.LayerRemoveEvent.scheduleRemoval(Collection)to remove more layers. You should not do blocking or long-running tasks in this method.- Specified by:
layerRemovingin interfaceLayerManager.LayerChangeListener- Parameters:
e- The layer to be removed (as event)
-
layerOrderChanged
public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that the order of layers was changed.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerOrderChangedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The order change event.
-
addHistoryHook
public static boolean addHistoryHook(HistoryHook hook)
Adds a newHistoryHook.- Parameters:
hook- hook to add- Returns:
true(as specified byCollection.add(E))- Since:
- 13947
-
removeHistoryHook
public static boolean removeHistoryHook(HistoryHook hook)
Removes an existingHistoryHook.- Parameters:
hook- hook to remove- Returns:
trueif this list contained the specified element- Since:
- 13947
-
showHistory
public void showHistory(java.util.Collection<? extends PrimitiveId> primitives)
Show history dialog(s) for the given primitive(s).- Parameters:
primitives- The primitive(s) for which history will be displayed
-
showHistory
public void showHistory(java.awt.Component parent, java.util.Collection<? extends PrimitiveId> primitives)
Show history dialog(s) for the given primitive(s).- Parameters:
parent- Parent component for displayed dialog boxesprimitives- The primitive(s) for which history will be displayed- Since:
- 16123
-
-