Revision 36679 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

View differences:

GvSIGAnnotationWindowManager.java
32 32
import org.gvsig.annotation.swing.AnnotationWizardPanelActionListener;
33 33
import org.gvsig.annotation.swing.JAnnotationCreationServicePanel;
34 34
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel;
35
import org.gvsig.annotation.swing.thread.AnnotationCreationTask;
36 35

  
37 36
/**
38 37
 * {@link AnnotationWindowManager} implementation to show Annotation
......
46 45
    public void showWindow(JAnnotationCreationServicePanel panel, String title, int mode) {
47 46
        AnnotationWindow window =
48 47
            new AnnotationWindow(panel, title, mode);
49
        
48

  
50 49
        panel.setAnnotationServicePanelActionListener(new AnnotationWizardListener(window));        
51 50

  
52 51
        window.addComponentListener(this);
......
57 56
    public void componentHidden(ComponentEvent componentEvent) {
58 57
        AnnotationWindow window =
59 58
            (AnnotationWindow) componentEvent.getSource();
60
        PluginServices.getMDIManager().closeWindow(window);
59
        if (window.isVisible()){
60
            PluginServices.getMDIManager().closeWindow(window);
61
        }
61 62
    }
62 63

  
63 64
    public void componentMoved(ComponentEvent e) {
......
71 72
    public void componentShown(ComponentEvent e) {
72 73
        // Nothing to do
73 74
    }
74
    
75

  
75 76
    public class AnnotationWizardListener implements AnnotationWizardPanelActionListener{
76
    	private AnnotationWindow annotationWindow = null;
77
    	
78
    	public AnnotationWizardListener(AnnotationWindow annotationWindow) {
79
    		super();
80
    		this.annotationWindow = annotationWindow;
81
    	}
77
        private AnnotationWindow annotationWindow = null;
82 78

  
83
    	public void cancel(
84
    			JAnnotationCreationServicePanel annotationCreationServicePanel) {
85
    		PluginServices.getMDIManager().closeWindow(annotationWindow);	
86
    	}
79
        public AnnotationWizardListener(AnnotationWindow annotationWindow) {
80
            super();
81
            this.annotationWindow = annotationWindow;
82
        }
87 83

  
88
    	public void finish(
89
    			JAnnotationCreationServicePanel annotationCreationServicePanel) {
90
    		PluginServices.getMDIManager().closeWindow(annotationWindow);		
91
    	}
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
        }
92 97
    }
93 98

  
94
	public void showWindow(AnnotationCreationTask annotationCreationTask) {
95
		PluginServices.cancelableBackgroundExecution(annotationCreationTask);			
96
	}
97 99

  
98
	public boolean showFileExistsPopup(String title, String text) {
99
		int resp = JOptionPane.showConfirmDialog(
100
				(Component)PluginServices.getMainFrame(), text,
101
				title, JOptionPane.YES_NO_OPTION);
102
		if (resp == JOptionPane.YES_OPTION) {
103
			return true;
104
		}
105
		return false;
106
	}
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
    }
107 109

  
108
	public void showPreferencesWindow(JAnnotationPreferencesPanel panel,
109
			String title, int mode) {
110
		// TODO Auto-generated method stub
111
		
112
	}
110
    public void showPreferencesWindow(JAnnotationPreferencesPanel panel,
111
        String title, int mode) {
112
        // TODO Auto-generated method stub
113

  
114
    }
113 115
}

Also available in: Unified diff