Class RelationDialogManager
- java.lang.Object
-
- java.awt.event.WindowAdapter
-
- org.openstreetmap.josm.gui.dialogs.relation.RelationDialogManager
-
- All Implemented Interfaces:
java.awt.event.WindowFocusListener
,java.awt.event.WindowListener
,java.awt.event.WindowStateListener
,java.util.EventListener
,LayerManager.LayerChangeListener
public class RelationDialogManager extends java.awt.event.WindowAdapter implements LayerManager.LayerChangeListener
RelationDialogManager keeps track of the open relation editors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RelationDialogManager.DialogContext
Helper class for keeping the context of a relation editor.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<RelationDialogManager.DialogContext,RelationEditor>
openDialogs
the map of open dialogsprivate static RelationDialogManager
relationDialogManager
keeps track of open relation editors
-
Constructor Summary
Constructors Constructor Description RelationDialogManager()
constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close(OsmDataLayer layer, Relation relation)
Closes the editor open for a specific layer and a specific relation.RelationEditor
getEditorForRelation(OsmDataLayer layer, Relation relation)
Replies the editor for the relation managed by layer.static RelationDialogManager
getRelationDialogManager()
Replies the singletonRelationDialogManager
protected boolean
hasEditorWithCloseUpperLeftCorner(java.awt.Point p, RelationEditor thisEditor)
Replies true, if there is another openRelationEditor
whose upper left corner is close top
.boolean
isOpenInEditor(OsmDataLayer layer, Relation relation)
Replies true if there is an open relation editor for the relation managed by the given layer.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.void
positionOnScreen(RelationEditor editor)
Positions aRelationEditor
on the screen.void
register(OsmDataLayer layer, Relation relation, RelationEditor editor)
Register the relation editor for a relation managed by aOsmDataLayer
.void
updateContext(OsmDataLayer layer, Relation relation, RelationEditor editor)
void
windowClosed(java.awt.event.WindowEvent e)
-
-
-
Field Detail
-
relationDialogManager
private static RelationDialogManager relationDialogManager
keeps track of open relation editors
-
openDialogs
private final java.util.Map<RelationDialogManager.DialogContext,RelationEditor> openDialogs
the map of open dialogs
-
-
Constructor Detail
-
RelationDialogManager
public RelationDialogManager()
constructor
-
-
Method Detail
-
getRelationDialogManager
public static RelationDialogManager getRelationDialogManager()
Replies the singletonRelationDialogManager
- Returns:
- the singleton
RelationDialogManager
-
register
public void register(OsmDataLayer layer, Relation relation, RelationEditor editor)
Register the relation editor for a relation managed by aOsmDataLayer
.- Parameters:
layer
- the layerrelation
- the relationeditor
- the editor
-
updateContext
public void updateContext(OsmDataLayer layer, Relation relation, RelationEditor editor)
-
close
public void close(OsmDataLayer layer, Relation relation)
Closes the editor open for a specific layer and a specific relation.- Parameters:
layer
- the layerrelation
- the relation
-
isOpenInEditor
public boolean isOpenInEditor(OsmDataLayer layer, Relation relation)
Replies true if there is an open relation editor for the relation managed by the given layer. Replies false if relation is null.- Parameters:
layer
- the layerrelation
- the relation. May be null.- Returns:
- true if there is an open relation editor for the relation managed by the given layer; false otherwise
-
getEditorForRelation
public RelationEditor getEditorForRelation(OsmDataLayer layer, Relation relation)
Replies the editor for the relation managed by layer. Null, if no such editor is currently open. Returns null, if relation is null.- Parameters:
layer
- the layerrelation
- the relation- Returns:
- the editor for the relation managed by layer. Null, if no such editor is currently open.
- See Also:
isOpenInEditor(OsmDataLayer, Relation)
-
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)
-
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
-
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.
-
windowClosed
public void windowClosed(java.awt.event.WindowEvent e)
- Specified by:
windowClosed
in interfacejava.awt.event.WindowListener
- Overrides:
windowClosed
in classjava.awt.event.WindowAdapter
-
hasEditorWithCloseUpperLeftCorner
protected boolean hasEditorWithCloseUpperLeftCorner(java.awt.Point p, RelationEditor thisEditor)
Replies true, if there is another openRelationEditor
whose upper left corner is close top
.- Parameters:
p
- the reference point to checkthisEditor
- the current editor- Returns:
- true, if there is another open
RelationEditor
whose upper left corner is close top
.
-
positionOnScreen
public void positionOnScreen(RelationEditor editor)
Positions aRelationEditor
on the screen. Tries to center it on the screen. If it hide another instance of an editor at the same position this method tries to repositioneditor
by moving it slightly down and slightly to the right.- Parameters:
editor
- the editor
-
-