Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / Project.java @ 1837

History | View | Annotate | Download (18.8 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.hardcode.gdbms.engine.data.db.DBDriverInfo;
44
import com.hardcode.gdbms.engine.data.db.DBTableDriverInfo;
45
import com.hardcode.gdbms.engine.data.driver.DriverInfo;
46
import com.hardcode.gdbms.engine.data.file.FileDriverInfo;
47
import com.hardcode.gdbms.engine.data.object.ObjectDriverInfo;
48

    
49
import com.iver.andami.PluginServices;
50

    
51
import com.iver.cit.gvsig.fmap.DriverException;
52
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
53
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
54
import com.iver.cit.gvsig.fmap.layers.FLayer;
55
import com.iver.cit.gvsig.fmap.layers.FLayers;
56
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
57
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
58
import com.iver.cit.gvsig.fmap.layers.XMLException;
59
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
60

    
61
import com.iver.utiles.StringUtilities;
62
import com.iver.utiles.XMLEntity;
63

    
64
import org.cresques.cts.IProjection;
65
import org.cresques.cts.ProjectionPool;
66

    
67
import java.awt.Color;
68
import java.awt.geom.Rectangle2D;
69

    
70
import java.beans.PropertyChangeEvent;
71
import java.beans.PropertyChangeListener;
72
import java.beans.PropertyChangeSupport;
73

    
74
import java.io.File;
75
import java.io.Serializable;
76

    
77
import java.text.DateFormat;
78

    
79
import java.util.ArrayList;
80
import java.util.Date;
81
import java.util.Iterator;
82

    
83

    
84
/**
85
 * Clase que representa un proyecto de openSIG
86
 *
87
 * @author Fernando Gonz?lez Cort?s
88
 */
89
public class Project implements Serializable, PropertyChangeListener {
90
        public static String VERSION = "0.3";
91
        static private IProjection defaultProjection = ProjectionPool.get(
92
                        "EPSG:23030");
93
        private PropertyChangeSupport change;
94
        boolean modified = false;
95
        private String name;
96
        private String path;
97
        private String creationDate;
98
        private String modificationDate;
99
        private String owner;
100
        private String comments;
101
        private Color selectionColor = new Color(255, 255, 0);
102
        private ArrayList views = new ArrayList();
103
        private ArrayList tables = new ArrayList();
104
        private ArrayList maps = new ArrayList();
105
        private ArrayList extents = new ArrayList();
106

    
107
        /**
108
         * Creates a new Project object.
109
         */
110
        public Project() {
111
                change = new PropertyChangeSupport(this);
112

    
113
                //        change.addPropertyChangeListener(this);
114
                creationDate = DateFormat.getDateInstance().format(new Date());
115
                modificationDate = creationDate;
116
/*                LayerFactory.setDriversPath(PluginServices.getPluginServices(this)
117
                                                                                                  .getPluginDirectory()
118
                                                                                                  .getAbsolutePath() +
119
                        File.separator + "drivers");
120
        */}
121

    
122
        /**
123
         * Obtiene la fecha de creaci?n del proyecto
124
         *
125
         * @return
126
         */
127
        public String getCreationDate() {
128
                return creationDate;
129
        }
130

    
131
        /**
132
         * Obtiene el nombre del proyecto
133
         *
134
         * @return
135
         */
136
        public String getName() {
137
                return name;
138
        }
139

    
140
        /**
141
         * Obtiene la ruta completa del fichero donde se guardo por ?ltima vez el
142
         * proyecto
143
         *
144
         * @return
145
         */
146
        public String getPath() {
147
                return path;
148
        }
149

    
150
        /**
151
         * Asigna la fecha de creaci?n del proyecto. Este m?todo tiene sentido s?lo
152
         * por que al recuperar la fecha del XML hay que asignarla al objeto
153
         * proyecto de alguna manera. La fecha se asigna en el constructor y no se
154
         * deber?a de modificar nunca
155
         *
156
         * @param string
157
         */
158
        public void setCreationDate(String string) {
159
                creationDate = string;
160
                modified = true;
161
                change.firePropertyChange("", null, null);
162
        }
163

    
164
        /**
165
         * A?ade un mapa al proyecto
166
         *
167
         * @param m
168
         */
169
        public void addMap(ProjectMap m) {
170
                maps.add(m);
171
                m.addPropertyChangeListener(this);
172
                modified = true;
173
                change.firePropertyChange("", null, null);
174
                m.setProject(this, maps.size()-1);
175
        }
176

    
177
        /**
178
         * Elimina un mapa del proyecto
179
         *
180
         * @param i indice del mapa
181
         */
182
        public void delMap(int i) {
183
                maps.remove(i);
184
                modified = true;
185
                change.firePropertyChange("", null, null);
186
        }
187

    
188
        /**
189
         * Establece el nombre del proyecto
190
         *
191
         * @param string
192
         */
193
        public void setName(String string) {
194
                name = string;
195
                modified = true;
196
                change.firePropertyChange("", null, null);
197
        }
198

    
199
        /**
200
         * establece la ruta completa de donde se encuentra guardado el proyecto
201
         *
202
         * @param string
203
         */
204
        public void setPath(String string) {
205
                path = string;
206
                modified = true;
207
                change.firePropertyChange("", null, null);
208
        }
209

    
210
        /**
211
         * DOCUMENT ME!
212
         *
213
         * @param co DOCUMENT ME!
214
         *
215
         * @return DOCUMENT ME!
216
         */
217
        public ProjectTable getTable(AlphanumericData co) {
218
                /**
219
                 * Como las tablas se pueden a?adir cuando se pincha en "ver tabla" de
220
                 * una capa, se puede intentar a?adir dos veces la misma tabla
221
                 */
222
                for (int i = 0; i < tables.size(); i++) {
223
                        if (((ProjectTable) tables.get(i)).getAssociatedTable() == co) {
224
                                return (ProjectTable) tables.get(i);
225
                        }
226
                }
227

    
228
                return null;
229
        }
230

    
231
        /**
232
         * A?ade una tabla al proyecto
233
         *
234
         * @param t
235
         */
236
        public void addTable(ProjectTable t) {
237
                tables.add(t);
238
                t.addPropertyChangeListener(this);
239
                modified = true;
240
                change.firePropertyChange("", null, null);
241
                t.setProject(this, tables.size()-1);
242
        }
243
        
244
        /**
245
         * Elimina una tabla del proyecto
246
         *
247
         * @param i indice de la tabla
248
         */
249
        public void delTable(int i) {
250
                tables.remove(i);
251
                modified = true;
252
                change.firePropertyChange("", null, null);
253
        }
254

    
255
        /**
256
         * A?ade una vista al proyecto
257
         *
258
         * @param v
259
         */
260
        public void addView(ProjectView v) {
261
                views.add(v);
262
                v.addPropertyChangeListener(this);
263
                modified = true;
264
                change.firePropertyChange("", null, null);
265
                v.setProject(this, views.size() - 1);
266
        }
267

    
268
        /**
269
         * Elimina una tabla del proyecto
270
         *
271
         * @param i indice del proyecto
272
         */
273
        public void delView(int i) {
274
                views.remove(i);
275
                modified = true;
276
                change.firePropertyChange("", null, null);
277
        }
278

    
279
        /**
280
         * Devuelve true si el proyecto (o alguna tabla, vista o mapa que contiene)
281
         * fue modificado
282
         *
283
         * @return
284
         */
285
        public boolean isModified() {
286
                return modified;
287
        }
288

    
289
        /**
290
         * Obtiene los comentarios
291
         *
292
         * @return
293
         */
294
        public String getComments() {
295
                return comments;
296
        }
297

    
298
        /**
299
         * Obtiene la fecha de la ?ltima modificaci?n
300
         *
301
         * @return
302
         */
303
        public String getModificationDate() {
304
                return modificationDate;
305
        }
306

    
307
        /**
308
         * Obtiene el propietario del proyecto
309
         *
310
         * @return
311
         */
312
        public String getOwner() {
313
                return owner;
314
        }
315

    
316
        /**
317
         * Establece una cadena como comentarios al proyecto
318
         *
319
         * @param string
320
         */
321
        public void setComments(String string) {
322
                comments = string;
323
                modified = true;
324
                change.firePropertyChange("", null, null);
325
        }
326

    
327
        /**
328
         * Establece la fecha de la ?ltima modificaci?n
329
         *
330
         * @param string
331
         */
332
        public void setModificationDate(String string) {
333
                modificationDate = string;
334
                modified = true;
335
                change.firePropertyChange("", null, null);
336
        }
337

    
338
        /**
339
         * Establece el propietario del proyecto
340
         *
341
         * @param string
342
         */
343
        public void setOwner(String string) {
344
                owner = string;
345
                modified = true;
346
                change.firePropertyChange("", null, null);
347
        }
348

    
349
        /**
350
         * Establece el flag de modificado del proyecto
351
         *
352
         * @param b
353
         */
354
        public void setModified(boolean b) {
355
                modified = b;
356
        }
357

    
358
        /**
359
         * Obtiene el color de selecci?n que se usar? en el proyecto
360
         *
361
         * @return
362
         */
363
        public Color getSelectionColor() {
364
                return selectionColor;
365
        }
366

    
367
        /**
368
         * Establece el color de selecci?n
369
         *
370
         * @param color
371
         */
372
        public void setSelectionColor(Color color) {
373
                selectionColor = color;
374
                FSymbol.setSelectionColor(color);
375
                modified = true;
376
                change.firePropertyChange("selectionColor", null, color);
377
        }
378

    
379
        /**
380
         * Obtiene el color como un entero para su serializaci?n a XML
381
         *
382
         * @return
383
         */
384
        public String getColor() {
385
                return StringUtilities.color2String(selectionColor);
386
        }
387

    
388
        /**
389
         * M?todo invocado al recuperar de XML para establecer el color de
390
         * seleccion del proyecto
391
         *
392
         * @param color Entero que representa un color
393
         */
394
        public void setColor(String color) {
395
                modified = true;
396
                selectionColor = StringUtilities.string2Color(color);
397
        }
398

    
399
        /* (non-Javadoc)
400
         * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
401
         */
402
        public void propertyChange(PropertyChangeEvent evt) {
403
                this.modified = true;
404
                change.firePropertyChange(evt);
405
        }
406

    
407
        /**
408
         * DOCUMENT ME!
409
         *
410
         * @param arg1
411
         */
412
        public void addExtent(ProjectExtent arg1) {
413
                extents.add(arg1);
414
                modified = true;
415
                change.firePropertyChange("addExtent", null, null);
416
        }
417

    
418
        /**
419
         * DOCUMENT ME!
420
         *
421
         * @param arg0
422
         *
423
         * @return
424
         */
425
        public Object removeExtent(int arg0) {
426
                modified = true;
427
                change.firePropertyChange("delExtent", null, null);
428

    
429
                return extents.remove(arg0);
430
        }
431

    
432
        /**
433
         * DOCUMENT ME!
434
         *
435
         * @return DOCUMENT ME!
436
         */
437
        public ProjectExtent[] getExtents() {
438
                return (ProjectExtent[]) extents.toArray(new ProjectExtent[0]);
439
        }
440

    
441
        /**
442
         * DOCUMENT ME!
443
         *
444
         * @param arg0
445
         */
446
        public synchronized void addPropertyChangeListener(
447
                PropertyChangeListener arg0) {
448
                change.addPropertyChangeListener(arg0);
449
        }
450

    
451
        /**
452
         * DOCUMENT ME!
453
         *
454
         * @return
455
         */
456
        public ArrayList getMaps() {
457
                return maps;
458
        }
459

    
460
        /**
461
         * DOCUMENT ME!
462
         *
463
         * @return
464
         */
465
        public ArrayList getTables() {
466
                return tables;
467
        }
468

    
469
        /**
470
         * DOCUMENT ME!
471
         *
472
         * @return
473
         */
474
        public ArrayList getViews() {
475
                return views;
476
        }
477

    
478
        /**
479
         * DOCUMENT ME!
480
         *
481
         * @return DOCUMENT ME!
482
         *
483
         * @throws DriverException
484
         * @throws XMLException
485
         */
486
        public XMLEntity getXMLEntity() throws DriverException, XMLException {
487
                XMLEntity xml = new XMLEntity();
488
                xml.putProperty("className", this.getClass().getName());
489
                xml.putProperty("VERSION", VERSION);
490
                xml.putProperty("comments", comments);
491
                xml.putProperty("creationDate", creationDate);
492

    
493
                int numExtents = extents.size();
494

    
495
                /*double[] xs = new double[size];
496
                   double[] ys = new double[size];
497
                   double[] ws = new double[size];
498
                   double[] hs = new double[size];
499
                 */
500
                xml.putProperty("numExtents", numExtents);
501

    
502
                for (int i = 0; i < numExtents; i++) {
503
                        /*        Rectangle2D rect = (Rectangle2D) extents.get(i);
504
                           xs[i] = rect.getX();
505
                           ys[i] = rect.getY();
506
                           ws[i] = rect.getWidth();
507
                           hs[i] = rect.getHeight();
508
                         */
509
                        xml.addChild(((ProjectExtent) extents.get(i)).getXMLEntity());
510
                }
511

    
512
                DriverInfo[] infos = LayerFactory.getDataSourceFactory().getDriverInfos();
513
                xml.putProperty("data-source-count", infos.length);
514

    
515
                for (int i = 0; i < infos.length; i++) {
516
                        XMLEntity child = new XMLEntity();
517
                        DriverInfo di = infos[i];
518

    
519
                        if (di instanceof ObjectDriverInfo) {
520
                                ObjectDriverInfo driver = (ObjectDriverInfo) di;
521
                                child.putProperty("type", "sameDriverFile");
522
                                child.putProperty("gdbmsname", driver.name);
523
                        } else if (di instanceof FileDriverInfo) {
524
                                FileDriverInfo vfdi = (FileDriverInfo) di;
525
                                child.putProperty("type", "otherDriverFile");
526
                                child.putProperty("gdbmsname", vfdi.name);
527
                                child.putProperty("dbms", vfdi.dbms);
528
                                child.putProperty("file", vfdi.file);
529
                                child.putProperty("driverName", vfdi.driverName);
530
                        } else if (di instanceof DBDriverInfo) {
531
                                DBTableDriverInfo dbdi = (DBTableDriverInfo) di;
532
                                child.putProperty("type", "db");
533
                                child.putProperty("gdbmsname", dbdi.name);
534
                                child.putProperty("dbms", dbdi.dbms);
535
                                child.putProperty("host", dbdi.host);
536
                                child.putProperty("port", dbdi.port);
537
                                child.putProperty("user", dbdi.user);
538
                                child.putProperty("password", dbdi.password);
539
                                child.putProperty("dbName", dbdi.dbName);
540
                                child.putProperty("tableName", dbdi.tableName);
541
                                child.putProperty("driverInfo", dbdi.driverInfo);
542
                        }
543

    
544
                        xml.addChild(child);
545
                }
546

    
547
                /*
548
                   xml.putProperty("extentsX", xs);
549
                   xml.putProperty("extentsY", ys);
550
                   xml.putProperty("extentsW", ws);
551
                   xml.putProperty("extentsH", hs);
552
                 */
553
                xml.putProperty("numViews", views.size());
554

    
555
                for (int i = 0; i < views.size(); i++) {
556
                        xml.addChild(((ProjectView) views.get(i)).getXMLEntity());
557
                }
558

    
559
                xml.putProperty("numMaps", maps.size());
560

    
561
                for (int i = 0; i < maps.size(); i++) {
562
                        xml.addChild(((ProjectMap) maps.get(i)).getXMLEntity());
563
                }
564

    
565
                xml.putProperty("modificationDate", modificationDate);
566
                xml.putProperty("modified", modified);
567
                xml.putProperty("name", name);
568
                xml.putProperty("owner", owner);
569
                xml.putProperty("path", path);
570
                xml.putProperty("selectionColor",
571
                        StringUtilities.color2String(selectionColor));
572
                xml.putProperty("numTables", tables.size());
573

    
574
                for (int i = 0; i < tables.size(); i++) {
575
                        xml.addChild(((ProjectTable) tables.get(i)).getXMLEntity());
576
                }
577

    
578
                xml.putProperty("projection", defaultProjection.getAbrev());
579

    
580
                return xml;
581
        }
582

    
583
        /**
584
         * DOCUMENT ME!
585
         *
586
         * @param xml DOCUMENT ME!
587
         *
588
         * @return DOCUMENT ME!
589
         *
590
         * @throws XMLException
591
         * @throws DriverException
592
         * @throws DriverIOException
593
         */
594
        public static Project createFromXML(XMLEntity xml)
595
                throws XMLException, DriverException, DriverIOException {
596
                int childNumber = 0;
597
                Project p = new Project();
598
                p.comments = xml.getStringProperty("comments");
599
                p.creationDate = xml.getStringProperty("creationDate");
600

    
601
                /*
602
                   double[] xs = xml.getDoubleArrayProperty("extentsX");
603
                   double[] ys = xml.getDoubleArrayProperty("extentsY");
604
                   double[] ws = xml.getDoubleArrayProperty("extentsW");
605
                   double[] hs = xml.getDoubleArrayProperty("extentsH");
606
                 */
607
                int numExtents = xml.getIntProperty("numExtents");
608

    
609
                for (int i = 0; i < numExtents; i++) {
610
                        ProjectExtent pe = ProjectExtent.createFromXML(xml.getChild(i));
611
                        p.extents.add(pe);
612
                }
613

    
614
                childNumber = numExtents;
615

    
616
                int numDataSources = xml.getIntProperty("data-source-count");
617

    
618
                for (int i = childNumber; i < (childNumber + numDataSources); i++) {
619
                        XMLEntity child = xml.getChild(i);
620

    
621
                        if (child.getStringProperty("type").equals("otherDriverFile")) {
622
                                LayerFactory.getDataSourceFactory().addFileDataSource(child.getStringProperty(
623
                                                "driverName"), child.getStringProperty("gdbmsname"),
624
                                        child.getStringProperty("file"),
625
                                        child.getStringProperty("dbms"), null);
626
                        } else if (child.getStringProperty("type").equals("sameDriverFile")) {
627
                                /*                                String layerName = child.getStringProperty("layerName");
628
                                   ProjectView vista = project.getViewByName(child.getStringProperty(
629
                                   "viewName"));
630
                                   FLayer layer = vista.getMapContext().getLayers().getLayer(layerName);
631
                                
632
                                   modelo = ((AlphanumericData) layer).getRecordset();
633
                                   associatedTable = (AlphanumericData) layer;
634
                                 */
635
                        } else if (child.getStringProperty("type").equals("db")) {
636
                                LayerFactory.getDataSourceFactory().addDBDataSourceByTable(child.getStringProperty(
637
                                                "gdbmsname"), child.getStringProperty("host"),
638
                                        child.getIntProperty("port"),
639
                                        child.getStringProperty("user"),
640
                                        child.getStringProperty("password"),
641
                                        child.getStringProperty("dbName"),
642
                                        child.getStringProperty("tableName"),
643
                                        child.getStringProperty("driverInfo"), null);
644
                        }
645
                }
646

    
647
                childNumber += numDataSources;
648

    
649
                int numViews = xml.getIntProperty("numViews");
650

    
651
                for (int i = childNumber; i < (numViews + childNumber); i++) {
652
                        p.views.add(ProjectView.createFromXML(xml.getChild(i), p));
653
                }
654

    
655
                childNumber += numViews;
656

    
657
                int numMaps = xml.getIntProperty("numMaps");
658

    
659
                for (int i = childNumber; i < (numMaps + childNumber); i++) {
660
                        p.maps.add(ProjectMap.createFromXML(xml.getChild(i), p));
661
                }
662

    
663
                childNumber += numMaps;
664
                p.modificationDate = xml.getStringProperty("modificationDate");
665
                p.modified = xml.getBooleanProperty("modified");
666
                p.name = xml.getStringProperty("name");
667
                p.owner = xml.getStringProperty("owner");
668
                p.path = xml.getStringProperty("path");
669
                p.selectionColor = StringUtilities.string2Color(xml.getStringProperty(
670
                                        "selectionColor"));
671

    
672
                int numTables = xml.getIntProperty("numTables");
673

    
674
                for (int i = childNumber; i < (childNumber + numTables); i++) {
675
                        p.tables.add(ProjectTable.createFromXML(xml.getChild(i), p));
676
                }
677

    
678
                String strProj = xml.getStringProperty("projection");
679

    
680
                if (strProj != null) {
681
                        Project.setProjection(ProjectionPool.get(strProj));
682
                }
683

    
684
                return p;
685
        }
686

    
687
        /**
688
         * Obtiene la vista que contiene a la capa que se pasa como par?metro
689
         *
690
         * @param layer Capa cuya vista se quiere obtener
691
         *
692
         * @return
693
         *
694
         * @throws RuntimeException Si la capa que se pasa como par?metro no se
695
         *                    encuentra en ninguna vista
696
         */
697
        public String getView(FLayer layer) {
698
                for (int v = 0; v < views.size(); v++) {
699
                        ProjectView pView = (ProjectView) views.get(v);
700
                        FLayers layers = pView.getMapContext().getLayers();
701

    
702
                        for (int i = 0; i < layers.getLayersCount(); i++) {
703
                                if (layers.getLayer(i) == layer) {
704
                                        return pView.getName();
705
                                }
706
                        }
707
                }
708

    
709
                throw new RuntimeException("The layer is not in a view");
710
        }
711

    
712
        /**
713
         * Devuelve la vista cuyo nombre coincide (sensible a mayusculas) con el
714
         * que se pasa como par?metro. Devuelve null si no hay ninguna vista con
715
         * ese nombre
716
         *
717
         * @param viewName Nombre de la vista que se quiere obtener
718
         *
719
         * @return DOCUMENT ME!
720
         */
721
        public ProjectView getViewByName(String viewName) {
722
                Object o = getProjectElementByName(viewName, views);
723

    
724
                if (o == null) {
725
                        return null;
726
                }
727

    
728
                return (ProjectView) o;
729
        }
730

    
731
        /**
732
         * DOCUMENT ME!
733
         *
734
         * @return DOCUMENT ME!
735
         */
736
        public static IProjection getProjection() {
737
                return defaultProjection;
738
        }
739

    
740
        /**
741
         * DOCUMENT ME!
742
         *
743
         * @param defaultProjection DOCUMENT ME!
744
         */
745
        public static void setProjection(IProjection defaultProjection) {
746
                Project.defaultProjection = defaultProjection;
747
        }
748

    
749
        /**
750
         * DOCUMENT ME!
751
         *
752
         * @param name DOCUMENT ME!
753
         * @param l DOCUMENT ME!
754
         *
755
         * @return DOCUMENT ME!
756
         */
757
        private Object getProjectElementByName(String name, ArrayList l) {
758
                for (Iterator iter = l.iterator(); iter.hasNext();) {
759
                        ProjectElement elem = (ProjectElement) iter.next();
760

    
761
                        if (elem.getName().equals(name)) {
762
                                return elem;
763
                        }
764
                }
765

    
766
                return null;
767
        }
768

    
769
        /**
770
         * DOCUMENT ME!
771
         *
772
         * @param name
773
         *
774
         * @return
775
         */
776
        public ProjectTable getTableByName(String name) {
777
                Object o = getProjectElementByName(name, tables);
778

    
779
                if (o == null) {
780
                        return null;
781
                }
782

    
783
                return (ProjectTable) o;
784
        }
785

    
786
        /**
787
         * DOCUMENT ME!
788
         *
789
         * @param name
790
         *
791
         * @return
792
         */
793
        public ProjectMap getLayoutByName(String name) {
794
                Object o = getProjectElementByName(name, maps);
795

    
796
                if (o == null) {
797
                        return null;
798
                }
799

    
800
                return (ProjectMap) o;
801
        }
802
}