Statistics
| Revision:

root / trunk / extensions / extPublish / src / org / gvsig / publish / infoproject / gvsig19 / ProjectInfo.java @ 29308

History | View | Annotate | Download (4.16 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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
/**
42
 * This class implements IProjectInfo in order to give information about the gvSIG project
43
 * 
44
 * @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
45
 */
46
package org.gvsig.publish.infoproject.gvsig19;
47

    
48
import java.util.ArrayList;
49
import java.util.Iterator;
50

    
51
import org.gvsig.publish.PublishLogger;
52
import org.gvsig.publish.infoproject.ILayerInfo;
53
import org.gvsig.publish.infoproject.IProjectInfo;
54
import org.gvsig.publish.infoproject.IViewInfo;
55
import org.gvsig.publish.infoproject.filter.FilterProjectInfo;
56

    
57
import com.iver.cit.gvsig.project.Project;
58
import com.iver.cit.gvsig.project.documents.view.ProjectView;
59
import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory;
60

    
61
/**
62
 * This class represents a gvSIG project information. 
63
 * 
64
 * @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
65
 *
66
 */
67
public class ProjectInfo implements IProjectInfo {
68
        //associations
69
        private Project gvProject = null;
70
        private ViewInfo[] views = null;
71
        private FilterProjectInfo filter;
72
        /**
73
         * Constructor
74
         * 
75
         * @param prj gvSIG Project
76
         * 
77
         */
78
        public ProjectInfo(Project gvProj){
79
                this.gvProject = gvProj;        
80
                ArrayList aux = gvProject.getDocumentsByType(ProjectViewFactory.registerName);
81
                views = new ViewInfo[aux.size()];
82
                int i = 0;                
83
                for (Iterator it = aux.iterator(); it.hasNext(); i++){
84
                        ProjectView v = (ProjectView) it.next();
85
                        views[i] = new ViewInfo(v,this);
86
                }
87
        }
88
        /**
89
         * 
90
         * @see {@link IProjectInfo#getName()}
91
         */
92
        public String getName() {
93
                return this.gvProject.getName();
94
        }
95
        /**
96
         * @return the gvSIG project owner
97
         * @see org.gvsig.publish.infoproject.IProjectInfo#getOwner()
98
         */
99
        public String getOwner() {
100
                return this.gvProject.getOwner();
101
        }
102
        /**
103
         * Creates an array of view information each time is called.
104
         * 
105
         * @return an array of gvSIG views information
106
         * @see org.gvsig.publish.infoproject.IProjectInfo#getViewsInfo()
107
         */
108
        public IViewInfo[] getViewsInfo() {                
109
                
110
                return views;
111
        }
112
        /**
113
         * 
114
         * @see java.lang.Object#toString()
115
         */
116
        public String toString(){
117
                return getName();
118
        }
119
        /**
120
         * 
121
         * @see org.gvsig.publish.infoproject.IProjectInfo#findLayer(java.lang.String)
122
         */
123
        public ILayerInfo findLayer(String layerName) {
124
                IViewInfo[] iview = getViewsInfo();
125
                for (int i = 0; i < iview.length; i++ ){
126
                        ILayerInfo ilayer = iview[i].findLayer(layerName);
127
                        if (ilayer != null){
128
                                return ilayer;
129
                        }
130
                }
131
                return null;
132
        }
133
        /**
134
         * 
135
         * @see org.gvsig.publish.infoproject.IProjectInfo#setFilter(org.gvsig.publish.infoproject.filter.FilterProjectInfo)
136
         */
137
        public void setFilter(FilterProjectInfo filter) {
138
                this.filter = filter;                
139
        }
140
        /**
141
         * 
142
         * @see org.gvsig.publish.infoproject.IProjectInfo#getFilterProjectInfo()
143
         */
144
        public FilterProjectInfo getFilterProjectInfo() {
145
                return this.filter;
146
        }
147
        /**
148
         * Clones object
149
         */
150
        public Object clone(){        
151
                Object obj=null;
152
                try{
153
                        obj=super.clone();
154
                }catch(CloneNotSupportedException ex){
155
                        PublishLogger.getLog().error("ERROR " + getClass().getName() + ":I can't clone projectinfo", ex);
156
                }
157
                return obj;
158
        }
159
}