Class RelationDialogManager
java.lang.Object
java.awt.event.WindowAdapter
org.openstreetmap.josm.gui.dialogs.relation.RelationDialogManager
- All Implemented Interfaces:
WindowFocusListener,WindowListener,WindowStateListener,EventListener,LayerManager.LayerChangeListener
public class RelationDialogManager
extends WindowAdapter
implements LayerManager.LayerChangeListener
RelationDialogManager keeps track of the open relation editors.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classHelper class for keeping the context of a relation editor. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<RelationDialogManager.DialogContext,RelationEditor> the map of open dialogsprivate static RelationDialogManagerkeeps track of open relation editors -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(OsmDataLayer layer, Relation relation) Closes the editor open for a specific layer and a specific relation.getEditorForRelation(OsmDataLayer layer, Relation relation) Replies the editor for the relation managed by layer.static RelationDialogManagerReplies the singletonRelationDialogManagerprotected booleanhasEditorWithCloseUpperLeftCorner(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.voidNotifies this listener that a layer has been added.voidNotifies this listener that the order of layers was changed.voidNotifies 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) voidMethods inherited from class java.awt.event.WindowAdapter
windowActivated, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
-
Field Details
-
relationDialogManager
keeps track of open relation editors -
openDialogs
the map of open dialogs
-
-
Constructor Details
-
RelationDialogManager
public RelationDialogManager()constructor
-
-
Method Details
-
getRelationDialogManager
Replies the singletonRelationDialogManager- Returns:
- the singleton
RelationDialogManager
-
register
Register the relation editor for a relation managed by aOsmDataLayer.- Parameters:
layer- the layerrelation- the relationeditor- the editor
-
updateContext
-
close
Closes the editor open for a specific layer and a specific relation.- Parameters:
layer- the layerrelation- the relation
-
isOpenInEditor
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
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:
-
layerRemoving
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
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
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
- Specified by:
windowClosedin interfaceWindowListener- Overrides:
windowClosedin classWindowAdapter
-
hasEditorWithCloseUpperLeftCorner
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
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
-