Changeset 1783 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-07-13T18:47:57+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r1775 r1783 50 50 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 51 51 import org.openstreetmap.josm.gui.SideButton; 52 import org.openstreetmap.josm.gui.dialogs.ConflictDialog;53 52 import org.openstreetmap.josm.gui.dialogs.relation.ac.AutoCompletionCache; 54 53 import org.openstreetmap.josm.gui.dialogs.relation.ac.AutoCompletionList; … … 536 535 */ 537 536 private void applyChanges() { 537 System.out.println("applying changes ..."); 538 538 if (getRelation()== null) { 539 539 // If the user wanted to create a new relation, but hasn't added any members or … … 880 880 Main.worker.submit(new DownloadTask()); 881 881 } 882 883 @Override 884 public void setVisible(boolean visible) { 885 super.setVisible(visible); 886 if (!visible) { 887 dispose(); 888 } 889 } 882 890 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java
r1772 r1783 17 17 * 18 18 */ 19 public class RelationDialogManager extends WindowAdapter implements LayerChangeListener { 19 public class RelationDialogManager extends WindowAdapter implements LayerChangeListener{ 20 21 /** 22 * Helper class for keeping the context of a relation editor. A relation editor 23 * is open for a specific relation managed by a specific {@see OsmDataLayer} 24 * 25 */ 20 26 static private class DialogContext { 21 27 public Relation relation; … … 61 67 return this.layer.equals(layer); 62 68 } 69 70 @Override 71 public String toString() { 72 return "[Context: layer=" + layer.getName() + ",relation=" + relation.id + "]"; 73 } 63 74 } 64 75 76 /** the map of open dialogs */ 65 77 private HashMap<DialogContext, RelationEditor> openDialogs; 66 78 79 /** 80 * constructor 81 */ 67 82 public RelationDialogManager(){ 83 System.out.println("RelationDialogManager: creating"); 68 84 openDialogs = new HashMap<DialogContext, RelationEditor>(); 69 85 } 70 86 87 /** 88 * Register the relation editor for a relation managed by a 89 * {@see OsmDataLayer}. 90 * 91 * @param layer the layer 92 * @param relation the relation 93 * @param editor the editor 94 */ 71 95 public void register(OsmDataLayer layer, Relation relation, RelationEditor editor) { 72 96 DialogContext context = new DialogContext(layer, relation); … … 75 99 } 76 100 101 /** 102 * Replies true if there is an open relation editor for the relation managed 103 * by the given layer 104 * 105 * @param layer the layer 106 * @param relation the relation 107 * @return true if there is an open relation editor for the relation managed 108 * by the given layer; false otherwise 109 */ 77 110 public boolean isOpenInEditor(OsmDataLayer layer, Relation relation) { 78 111 DialogContext context = new DialogContext(layer, relation); 79 112 return openDialogs.keySet().contains(context); 113 80 114 } 81 115 116 /** 117 * Replies the editor for the relation managed by layer. Null, if no such editor 118 * is currently open. 119 * 120 * @param layer the layer 121 * @param relation the relation 122 * @return the editor for the relation managed by layer. Null, if no such editor 123 * is currently open. 124 * 125 * @see #isOpenInEditor(OsmDataLayer, Relation) 126 */ 82 127 public RelationEditor getEditorForRelation(OsmDataLayer layer, Relation relation) { 83 128 DialogContext context = new DialogContext(layer, relation); … … 85 130 } 86 131 87 @Override 88 public void windowClosed(WindowEvent e) { 89 RelationEditor editor = ((RelationEditor)e.getWindow()); 90 DialogContext context = null; 91 for (DialogContext c : openDialogs.keySet()) { 92 if (openDialogs.get(c).equals(editor)) { 93 context = c; 94 break; 95 } 96 } 97 if (context != null) { 98 openDialogs.remove(context); 99 } 100 } 101 132 /** 133 * called when a layer is removed 134 * 135 */ 102 136 public void layerRemoved(Layer oldLayer) { 103 137 if (oldLayer == null || ! (oldLayer instanceof OsmDataLayer)) … … 124 158 // do nothing 125 159 } 160 161 @Override 162 public void windowClosed(WindowEvent e) { 163 RelationEditor editor = (RelationEditor)e.getWindow(); 164 DialogContext context = null; 165 for (DialogContext c : openDialogs.keySet()) { 166 if (openDialogs.get(c).equals(editor)) { 167 context = c; 168 break; 169 } 170 } 171 if (context != null) { 172 openDialogs.remove(context); 173 } 174 } 126 175 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r1773 r1783 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.data.osm.OsmPrimitive;13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;14 12 import org.openstreetmap.josm.data.osm.Relation; 15 13 import org.openstreetmap.josm.data.osm.RelationMember;
Note:
See TracChangeset
for help on using the changeset viewer.