public class RelationDialogManager extends java.awt.event.WindowAdapter implements LayerManager.LayerChangeListener
Modifier and Type | Class and Description |
---|---|
private static class |
RelationDialogManager.DialogContext
Helper class for keeping the context of a relation editor.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<RelationDialogManager.DialogContext,RelationEditor> |
openDialogs
the map of open dialogs
|
private static RelationDialogManager |
relationDialogManager
keeps track of open relation editors
|
Constructor and Description |
---|
RelationDialogManager()
constructor
|
Modifier and Type | Method and 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 singleton
RelationDialogManager |
protected boolean |
hasEditorWithCloseUpperLeftCorner(java.awt.Point p,
RelationEditor thisEditor)
Replies true, if there is another open
RelationEditor whose
upper left corner is close to p . |
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 is about to be removed.
|
void |
positionOnScreen(RelationEditor editor)
Positions a
RelationEditor on the screen. |
void |
register(OsmDataLayer layer,
Relation relation,
RelationEditor editor)
Register the relation editor for a relation managed by a
OsmDataLayer . |
void |
updateContext(OsmDataLayer layer,
Relation relation,
RelationEditor editor) |
void |
windowClosed(java.awt.event.WindowEvent e) |
private static RelationDialogManager relationDialogManager
private final java.util.Map<RelationDialogManager.DialogContext,RelationEditor> openDialogs
public RelationDialogManager()
public static RelationDialogManager getRelationDialogManager()
RelationDialogManager
RelationDialogManager
public void register(OsmDataLayer layer, Relation relation, RelationEditor editor)
OsmDataLayer
.layer
- the layerrelation
- the relationeditor
- the editorpublic void updateContext(OsmDataLayer layer, Relation relation, RelationEditor editor)
public void close(OsmDataLayer layer, Relation relation)
layer
- the layerrelation
- the relationpublic boolean isOpenInEditor(OsmDataLayer layer, Relation relation)
layer
- the layerrelation
- the relation. May be null.public RelationEditor getEditorForRelation(OsmDataLayer layer, Relation relation)
layer
- the layerrelation
- the relationisOpenInEditor(OsmDataLayer, Relation)
public void layerRemoving(LayerManager.LayerRemoveEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
layerRemoving
in interface LayerManager.LayerChangeListener
e
- The layer to be removed (as event)public void layerAdded(LayerManager.LayerAddEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
layerAdded
in interface LayerManager.LayerChangeListener
e
- The new added layer eventpublic void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
layerOrderChanged
in interface LayerManager.LayerChangeListener
e
- The order change event.public void windowClosed(java.awt.event.WindowEvent e)
windowClosed
in interface java.awt.event.WindowListener
windowClosed
in class java.awt.event.WindowAdapter
protected boolean hasEditorWithCloseUpperLeftCorner(java.awt.Point p, RelationEditor thisEditor)
RelationEditor
whose
upper left corner is close to p
.p
- the reference point to checkthisEditor
- the current editorRelationEditor
whose
upper left corner is close to p
.public void positionOnScreen(RelationEditor editor)
RelationEditor
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 reposition editor
by moving it slightly down and
slightly to the right.editor
- the editor