Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.annotation / org.gvsig.annotation.swing / org.gvsig.annotation.swing.impl / src / main / java / org / gvsig / annotation / swing / impl / WizardListenerAdapter.java @ 42071

History | View | Annotate | Download (2.97 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

    
29
package org.gvsig.annotation.swing.impl;
30

    
31
import java.io.File;
32

    
33
import org.gvsig.annotation.swing.AnnotationSwingLocator;
34
import org.gvsig.annotation.swing.AnnotationSwingManager;
35
import org.gvsig.gui.beans.wizard.WizardPanel;
36
import org.gvsig.gui.beans.wizard.WizardPanelActionListener;
37
import org.gvsig.i18n.Messages;
38
import org.gvsig.tools.task.SimpleTaskStatus;
39
import org.gvsig.tools.task.TaskStatus;
40

    
41

    
42

    
43
/**
44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
45
 */
46
public class WizardListenerAdapter implements WizardPanelActionListener {
47
        private DefaultJAnnotationCreationServicePanel annotationCreationServicePanel;
48
        private AnnotationSwingManager annotationSwingManager = null;
49

    
50
        public WizardListenerAdapter(
51
                        DefaultJAnnotationCreationServicePanel annotationCreationServicePanel) {
52
                super();
53
                this.annotationCreationServicePanel = annotationCreationServicePanel;
54
                this.annotationSwingManager = AnnotationSwingLocator.getSwingManager();
55
        }
56

    
57
        public void cancel(WizardPanel wizardPanel) {
58
                TaskStatus taskStatus = annotationCreationServicePanel.getAnnotationCreationService().getTaskStatus();
59
                if(taskStatus instanceof SimpleTaskStatus){
60
                        ((SimpleTaskStatus)taskStatus).cancel();
61
                }
62
                if (annotationCreationServicePanel.getAnnotationServicePanelActionListener() != null){
63
                        annotationCreationServicePanel.getAnnotationServicePanelActionListener().cancel(annotationCreationServicePanel);        
64
                }
65
        }
66

    
67
        public void finish(WizardPanel wizardPanel) {
68
                if (annotationCreationServicePanel.getAnnotationServicePanelActionListener() != null){
69
                        File file = new File(annotationCreationServicePanel.getDestinationShapeFile());
70

    
71
                        boolean continueIfExists = true;
72

    
73
                        if (file.exists()){
74
                                continueIfExists = annotationSwingManager.getWindowManager().showFileExistsPopup(Messages.getText("guardar"),
75
                                                Messages.getText("fichero_ya_existe_seguro_desea_guardarlo"));
76
                        }
77

    
78
                        if (continueIfExists){
79
                            annotationCreationServicePanel.createAnnotation();
80
                        }
81
                }
82
        }
83
}
84