Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / ProjectFactory.java @ 10626

History | View | Annotate | Download (4 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.project;
42

    
43
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
44
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory;
45
import com.iver.cit.gvsig.project.documents.layout.ProjectMap;
46
import com.iver.cit.gvsig.project.documents.layout.ProjectMapFactory;
47
import com.iver.cit.gvsig.project.documents.table.ProjectTable;
48
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory;
49
import com.iver.cit.gvsig.project.documents.view.ProjectView;
50
import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory;
51
import com.iver.utiles.extensionPoints.ExtensionPoint;
52
import com.iver.utiles.extensionPoints.ExtensionPoints;
53
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
54

    
55

    
56

    
57
public class ProjectFactory {
58
        public static ProjectMap createMap(String baseName){
59
                ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
60
                ExtensionPoint extPoint=((ExtensionPoint)extensionPoints.get("Documents"));
61
                ProjectDocumentFactory pdf=null;
62
                try {
63
                        pdf = (ProjectDocumentFactory)extPoint.create(ProjectMapFactory.registerName);
64
                } catch (InstantiationException e) {
65
                        e.printStackTrace();
66
                } catch (IllegalAccessException e) {
67
                        e.printStackTrace();
68
                }
69
                ProjectMap pm=(ProjectMap)pdf.create((Project)null);
70
                pm.setProjectDocumentFactory(pdf);
71
                pm.setName(baseName);
72
                return pm;
73
        }
74

    
75
        public static ProjectTable createTable(String name, IEditableSource ies){
76
                ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
77
                ExtensionPoint extPoint=((ExtensionPoint)extensionPoints.get("Documents"));
78
                ProjectDocumentFactory pdf=null;
79
                try {
80
                        pdf = (ProjectDocumentFactory)extPoint.create(ProjectTableFactory.registerName);
81
                } catch (InstantiationException e) {
82
                        e.printStackTrace();
83
                } catch (IllegalAccessException e) {
84
                        e.printStackTrace();
85
                }
86

    
87
                ProjectTable pt = ProjectTableFactory.createTable(name, ies);
88
                pt.setProjectDocumentFactory(pdf);
89
                return pt;
90
        }
91

    
92
        //TODO implementar bien
93
/*        public static ProjectTable createTable(String viewName, FTable ftable){
94
                return Table.createTable(viewName, ftable);
95
        }
96
*/
97
        public static ProjectView createView(String viewName){
98
                ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
99
                ExtensionPoint extPoint=((ExtensionPoint)extensionPoints.get("Documents"));
100
                ProjectDocumentFactory pdf=null;
101
                try {
102
                        pdf = (ProjectDocumentFactory)extPoint.create(ProjectViewFactory.registerName);
103
                } catch (InstantiationException e) {
104
                        e.printStackTrace();
105
                } catch (IllegalAccessException e) {
106
                        e.printStackTrace();
107
                }
108
                ProjectView pv=(ProjectView)pdf.create((Project)null);
109
                pv.setProjectDocumentFactory(pdf);
110
                pv.setName(viewName);
111
                return pv;
112
        }
113

    
114
        public static Project createProject(){
115
                return new Project();
116
        }
117

    
118
        public static ProjectExtent createExtent(){
119
                return new ProjectExtent();
120
        }
121

    
122

    
123

    
124
}