Revision 38514 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/gui/AbstractViewPanel.java
AbstractViewPanel.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.awt.Graphics; |
31 | 31 |
import java.awt.image.BufferedImage; |
32 |
import java.beans.PropertyChangeEvent; |
|
33 |
import java.beans.PropertyChangeListener; |
|
32 | 34 |
|
33 | 35 |
import javax.swing.JPanel; |
34 | 36 |
import javax.swing.JSplitPane; |
... | ... | |
39 | 41 |
import org.gvsig.andami.messages.NotificationManager; |
40 | 42 |
import org.gvsig.andami.ui.mdiManager.IWindowTransform; |
41 | 43 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
44 |
import org.gvsig.app.project.ProjectManager; |
|
42 | 45 |
import org.gvsig.app.project.documents.gui.WindowLayout; |
43 | 46 |
import org.gvsig.app.project.documents.view.MapOverview; |
44 | 47 |
import org.gvsig.app.project.documents.view.ViewDocument; |
... | ... | |
54 | 57 |
*/ |
55 | 58 |
|
56 | 59 |
public abstract class AbstractViewPanel extends JPanel implements IView, |
57 |
IWindowTransform { |
|
60 |
IWindowTransform, PropertyChangeListener {
|
|
58 | 61 |
|
59 | 62 |
private static final long serialVersionUID = -259620280790490262L; |
60 | 63 |
|
... | ... | |
118 | 121 |
* @see initialize() |
119 | 122 |
*/ |
120 | 123 |
public AbstractViewPanel() { |
121 |
// Do nothing
|
|
124 |
ProjectManager.getInstance().getCurrentProject().addPropertyChangeListener(this);
|
|
122 | 125 |
} |
123 | 126 |
|
124 | 127 |
/** |
... | ... | |
305 | 308 |
public void setWindowLayout(WindowLayout data) { |
306 | 309 |
windowLayout = data; |
307 | 310 |
} |
311 |
|
|
312 |
public void propertyChange(PropertyChangeEvent evt) { |
|
313 |
// Detect when the related document has been removed |
|
314 |
// and close or dispose whatever is needed |
|
315 |
if ("delDocument".equals(evt.getPropertyName())) { |
|
316 |
if (evt.getOldValue() != null |
|
317 |
&& evt.getOldValue() instanceof ViewDocument) { |
|
318 |
ViewDocument viewDocument = (ViewDocument) evt.getOldValue(); |
|
319 |
ViewDocument myViewDocument = getViewDocument(); |
|
320 |
if (myViewDocument != null |
|
321 |
&& myViewDocument.equals(viewDocument)) { |
|
322 |
m_MapControl.dispose(); |
|
323 |
m_MapLoc.dispose(); |
|
324 |
} |
|
325 |
} |
|
326 |
} |
|
327 |
} |
|
308 | 328 |
} |
Also available in: Unified diff