public class RelationDialogManager extends java.awt.event.WindowAdapter implements MapView.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 |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
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(Layer newLayer)
Notifies this listener that a layer has been added.
|
void |
layerRemoved(Layer oldLayer)
called when a layer is 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 layerRemoved(Layer oldLayer)
layerRemoved
in interface MapView.LayerChangeListener
oldLayer
- The old removed layerpublic void activeLayerChange(Layer oldLayer, Layer newLayer)
MapView.LayerChangeListener
activeLayerChange
in interface MapView.LayerChangeListener
oldLayer
- The previous active layernewLayer
- The new activer layerpublic void layerAdded(Layer newLayer)
MapView.LayerChangeListener
layerAdded
in interface MapView.LayerChangeListener
newLayer
- The new added layerpublic 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