root / branches / v2_0_0_prep / extensions / org.gvsig.annotation.app / org.gvsig.annotation.app.extension / src / main / java / org / gvsig / annotation / app / extension / GvSIGAnnotationWindowManager.java @ 36679
History | View | Annotate | Download (3.8 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.annotation.app.extension; |
23 |
|
24 |
import java.awt.Component; |
25 |
import java.awt.event.ComponentEvent; |
26 |
import java.awt.event.ComponentListener; |
27 |
|
28 |
import javax.swing.JOptionPane; |
29 |
|
30 |
import org.gvsig.andami.PluginServices; |
31 |
import org.gvsig.annotation.swing.AnnotationWindowManager; |
32 |
import org.gvsig.annotation.swing.AnnotationWizardPanelActionListener; |
33 |
import org.gvsig.annotation.swing.JAnnotationCreationServicePanel; |
34 |
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel; |
35 |
|
36 |
/**
|
37 |
* {@link AnnotationWindowManager} implementation to show Annotation
|
38 |
* windows as gvSIG windows
|
39 |
*
|
40 |
* @author gvSIG Team
|
41 |
* @version $Id$
|
42 |
*/
|
43 |
public class GvSIGAnnotationWindowManager implements AnnotationWindowManager, ComponentListener { |
44 |
|
45 |
public void showWindow(JAnnotationCreationServicePanel panel, String title, int mode) { |
46 |
AnnotationWindow window = |
47 |
new AnnotationWindow(panel, title, mode);
|
48 |
|
49 |
panel.setAnnotationServicePanelActionListener(new AnnotationWizardListener(window));
|
50 |
|
51 |
window.addComponentListener(this);
|
52 |
|
53 |
PluginServices.getMDIManager().addCentredWindow(window); |
54 |
} |
55 |
|
56 |
public void componentHidden(ComponentEvent componentEvent) { |
57 |
AnnotationWindow window = |
58 |
(AnnotationWindow) componentEvent.getSource(); |
59 |
if (window.isVisible()){
|
60 |
PluginServices.getMDIManager().closeWindow(window); |
61 |
} |
62 |
} |
63 |
|
64 |
public void componentMoved(ComponentEvent e) { |
65 |
// Nothing to do
|
66 |
} |
67 |
|
68 |
public void componentResized(ComponentEvent e) { |
69 |
// Nothing to do
|
70 |
} |
71 |
|
72 |
public void componentShown(ComponentEvent e) { |
73 |
// Nothing to do
|
74 |
} |
75 |
|
76 |
public class AnnotationWizardListener implements AnnotationWizardPanelActionListener{ |
77 |
private AnnotationWindow annotationWindow = null; |
78 |
|
79 |
public AnnotationWizardListener(AnnotationWindow annotationWindow) {
|
80 |
super();
|
81 |
this.annotationWindow = annotationWindow;
|
82 |
} |
83 |
|
84 |
public void cancel( |
85 |
JAnnotationCreationServicePanel annotationCreationServicePanel) { |
86 |
if (annotationWindow.isVisible()){
|
87 |
PluginServices.getMDIManager().closeWindow(annotationWindow); |
88 |
} |
89 |
} |
90 |
|
91 |
public void finish( |
92 |
JAnnotationCreationServicePanel annotationCreationServicePanel) { |
93 |
if (annotationWindow.isVisible()){
|
94 |
PluginServices.getMDIManager().closeWindow(annotationWindow); |
95 |
} |
96 |
} |
97 |
} |
98 |
|
99 |
|
100 |
public boolean showFileExistsPopup(String title, String text) { |
101 |
int resp = JOptionPane.showConfirmDialog( |
102 |
(Component)PluginServices.getMainFrame(), text,
|
103 |
title, JOptionPane.YES_NO_OPTION);
|
104 |
if (resp == JOptionPane.YES_OPTION) { |
105 |
return true; |
106 |
} |
107 |
return false; |
108 |
} |
109 |
|
110 |
public void showPreferencesWindow(JAnnotationPreferencesPanel panel, |
111 |
String title, int mode) { |
112 |
// TODO Auto-generated method stub
|
113 |
|
114 |
} |
115 |
} |