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 classRelationDialogManager.DialogContextHelper class for keeping the context of a relation editor.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<RelationDialogManager.DialogContext,RelationEditor>openDialogsthe map of open dialogsprivate static RelationDialogManagerrelationDialogManagerkeeps 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 voidclose(OsmDataLayer layer, Relation relation)Closes the editor open for a specific layer and a specific relation.RelationEditorgetEditorForRelation(OsmDataLayer layer, Relation relation)Replies the editor for the relation managed by layer.static RelationDialogManagergetRelationDialogManager()Replies the singletonRelationDialogManagerprotected booleanhasEditorWithCloseUpperLeftCorner(java.awt.Point p, RelationEditor thisEditor)Replies true, if there is another openRelationEditorwhose upper left corner is close top.booleanisOpenInEditor(OsmDataLayer layer, Relation relation)Replies true if there is an open relation editor for the relation managed by the given layer.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.voidpositionOnScreen(RelationEditor editor)Positions aRelationEditoron the screen.voidregister(OsmDataLayer layer, Relation relation, RelationEditor editor)Register the relation editor for a relation managed by aOsmDataLayer.voidupdateContext(OsmDataLayer layer, Relation relation, RelationEditor editor)voidwindowClosed(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.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)
-
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
-
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.
-
windowClosed
public void windowClosed(java.awt.event.WindowEvent e)
- Specified by:
windowClosedin interfacejava.awt.event.WindowListener- Overrides:
windowClosedin classjava.awt.event.WindowAdapter
-
hasEditorWithCloseUpperLeftCorner
protected boolean hasEditorWithCloseUpperLeftCorner(java.awt.Point p, RelationEditor thisEditor)
Replies true, if there is another openRelationEditorwhose upper left corner is close top.- Parameters:
p- the reference point to checkthisEditor- the current editor- Returns:
- true, if there is another open
RelationEditorwhose upper left corner is close top.
-
positionOnScreen
public void positionOnScreen(RelationEditor editor)
Positions aRelationEditoron 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 repositioneditorby moving it slightly down and slightly to the right.- Parameters:
editor- the editor
-
-