Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.exportto / org.gvsig.exportto.swing / org.gvsig.exportto.swing.impl / src / main / java / org / gvsig / exportto / swing / impl / DefaultExporttoSwingManager.java @ 41492

History | View | Annotate | Download (4.27 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
package org.gvsig.exportto.swing.impl;
25

    
26
import javax.swing.JPanel;
27
import org.cresques.cts.IProjection;
28

    
29
import org.gvsig.exportto.ExporttoLocator;
30
import org.gvsig.exportto.ExporttoManager;
31
import org.gvsig.exportto.ExporttoServiceFinishAction;
32
import org.gvsig.exportto.swing.ExporttoSwingManager;
33
import org.gvsig.exportto.swing.ExporttoWindowManager;
34
import org.gvsig.exportto.swing.JExporttoServicePanel;
35
import org.gvsig.exportto.swing.impl.panel.MessagePanel;
36
import org.gvsig.fmap.dal.feature.Feature;
37
import org.gvsig.fmap.dal.feature.FeatureStore;
38
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
39
import org.gvsig.i18n.Messages;
40
import org.gvsig.tools.swing.api.ToolsSwingLocator;
41
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
42

    
43
import static org.gvsig.exportto.swing.impl.panel.MessagePanel.showMessage;
44

    
45
/**
46
 * Default implementation of the {@link ExporttoSwingManager}.
47
 * 
48
 * @author gvSIG Team
49
 * @version $Id$
50
 */
51
public class DefaultExporttoSwingManager implements ExporttoSwingManager {
52

    
53
    private ExporttoManager manager;
54
    // private I18nManager i18nmanager = null;
55
    private ExporttoWindowManager windowManager;
56

    
57
    public DefaultExporttoSwingManager() {
58
        this.manager = ExporttoLocator.getManager();
59
        // this.i18nmanager = ToolsLocator.getI18nManager();
60
        this.windowManager = new DefaultExporttoWindowManager();
61
    }
62

    
63
    public JExporttoServicePanel createExportto(FeatureStore featureStore,
64
        IProjection projection) {
65
        JExporttoServicePanel panel =
66
            new DefaultJExporttoServicePanel(this, featureStore, projection,
67
                null, new int[0]);
68
        return panel;
69
    }
70

    
71
    public JExporttoServicePanel createExportto(FeatureStore featureStore,
72
        IProjection projection,
73
        ExporttoServiceFinishAction exporttoServiceFinishAction) {
74
        JExporttoServicePanel panel =
75
            new DefaultJExporttoServicePanel(this, featureStore, projection,
76
                exporttoServiceFinishAction, new int[0]);
77
        return panel;
78
    }
79

    
80
    public JExporttoServicePanel createExportto(FeatureStore featureStore,
81
        IProjection projection,
82
        ExporttoServiceFinishAction exporttoServiceFinishAction,
83
        int[] providerTypes) {
84
        return new DefaultJExporttoServicePanel(this, featureStore, projection,
85
            exporttoServiceFinishAction, providerTypes);
86
    }
87
    
88
    public JExporttoServicePanel createExportto(FLyrVect vlayer,
89
        ExporttoServiceFinishAction exporttoServiceFinishAction,
90
        int[] providerTypes) {
91
        
92
        return new DefaultJExporttoServicePanel(this, vlayer,
93
            exporttoServiceFinishAction, providerTypes);
94
    }
95
    
96

    
97
    public ExporttoManager getManager() {
98
        return this.manager;
99
    }
100

    
101
    public String getTranslation(String key) {
102
        return Messages.getText(key);
103
    }
104

    
105
    public void registerWindowManager(ExporttoWindowManager manager) {
106
        this.windowManager = manager;
107
    }
108

    
109
    public ExporttoWindowManager getWindowManager() {
110
        return this.windowManager;
111
    }
112

    
113
    public void showMessage(String title, String header, String html, Feature feature) {
114
        MessagePanel.showMessage(title, header, html, feature);
115
    }
116

    
117
    public void showMessage(String title, String header, Exception ex, Feature feature) {
118
        MessagePanel.showMessage(title, header, ex, feature);
119
    }
120
}