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>
dialogs
private static java.util.List<HistoryHook>
hooks
private static HistoryBrowserDialogManager
instance
private static java.lang.String
WINDOW_GEOMETRY_PREF
-
Constructor Summary
Constructors Modifier Constructor Description private
HistoryBrowserDialogManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
addHistoryHook(HistoryHook hook)
Adds a newHistoryHook
.boolean
existsDialog(long id)
Determines if an history dialog exists for the given object id.static HistoryBrowserDialogManager
getInstance()
Replies the unique instance.private boolean
hasDialogWithCloseUpperLeftCorner(java.awt.Point p)
void
hide(HistoryBrowserDialog dialog)
Hides the specified history dialog and cleans associated resources.void
hideAll()
Hides and destroys all currently visible history browser dialogsprivate static boolean
isUnloaded(PrimitiveId p)
void
layerAdded(LayerManager.LayerAddEvent e)
Notifies this listener that a layer has been added.void
layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Notifies this listener that the order of layers was changed.void
layerRemoving(LayerManager.LayerRemoveEvent e)
Notifies this listener that a layer was just removed.private void
placeOnScreen(HistoryBrowserDialog dialog)
static boolean
removeHistoryHook(HistoryHook hook)
Removes an existingHistoryHook
.void
show(History h)
Show history dialog for the given history.void
showHistory(java.awt.Component parent, java.util.Collection<? extends PrimitiveId> primitives)
Show history dialog(s) for the given primitive(s).void
showHistory(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:
true
if an history dialog exists for the given object id,false
otherwise
-
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.LayerChangeListener
Notifies 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:
layerAdded
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The new added layer event
-
layerRemoving
public void layerRemoving(LayerManager.LayerRemoveEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies 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:
layerRemoving
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The layer to be removed (as event)
-
layerOrderChanged
public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies 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:
layerOrderChanged
in 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:
true
if 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
-
-