Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / ext3Dgui / src / com / iver / ai2 / gvsig3dgui / layout / fframe / ListView3DModel.java @ 20450

History | View | Annotate | Download (3.76 KB)

1 20450 jcampos
/*
2
 * Created on 02-jun-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package com.iver.ai2.gvsig3dgui.layout.fframe;
46
47
import java.util.ArrayList;
48
49
import javax.swing.AbstractListModel;
50
51
import com.iver.andami.PluginServices;
52
import com.iver.cit.gvsig.ProjectExtension;
53
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame;
54
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
55
import com.iver.cit.gvsig.project.documents.view.ProjectViewBase;
56
57
58
/**
59
 * Modelo de la Lista de vistas a seleccionar.
60
 *
61
 * @author Vicente Caballero Navarro
62
 */
63
public class ListView3DModel extends AbstractListModel {
64
        private ArrayList views = new ArrayList();
65
66
        /**
67
         * A?ade las vistas que tiene el proyecto a la lista.
68
         */
69
//        public void addViews() {
70
//                ProjectExtension projectextension = (ProjectExtension) PluginServices.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
71
//                views = projectextension.getProject().getDocumentsByType(ProjectViewFactory.registerName);
72
//        }
73
74
75
        public void addViews() {
76
                  ProjectExtension projectextension = (ProjectExtension) PluginServices.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
77
                //  views = projectextension.getProject().getDocumentsByType(ProjectViewFactory.registerName);
78
                  ArrayList todos=projectextension.getProject().getDocuments();
79
                  views.clear();
80
                  for (int i = 0; i < todos.size(); i++) {
81
                   if (todos.get(i) instanceof ProjectViewBase){
82
                    views.add(todos.get(i));
83
                   }
84
                  }
85
                 }
86
87
        /**
88
         * Add all fframeviews into a list.
89
         *
90
         * @param l Layout.
91
         */
92
        public void addViews(Layout l) {
93
                int num = 0;
94
                l.getLayoutContext().updateFFrames();
95
                IFFrame[] fframes=l.getLayoutContext().getFFrames();
96
                for (int i = 0; i < fframes.length; i++) {
97
                        IFFrame f = fframes[i];
98
99
                        if (f instanceof FFrameView3D) {
100
                                //((FFrameView)f).getView().setName("FFrameView "+num+((FFrameView)f).getName());
101
                                views.add(f);
102
                                ((FFrameView3D) f).setNum(num);
103
                                num++;
104
                        }
105
                }
106
107
                //ProjectExtension projectextension =(ProjectExtension)App.instance.getPc().getExtension(com.iver.cit.gvsig.ProjectExtension.class);
108
                //views=projectextension.getProject().getViews();
109
        }
110
111
        /**
112
         * Devuelve el ArrayList con las FFrameView.
113
         *
114
         * @return DOCUMENT ME!
115
         */
116
        //public ArrayList getViews() {
117
        //        return views;
118
        //}
119
120
        /**
121
         * @see javax.swing.ListModel#getSize()
122
         */
123
        public int getSize() {
124
                return views.size();
125
        }
126
127
        /**
128
         * @see javax.swing.ListModel#getElementAt(int)
129
         */
130
        public Object getElementAt(int index) {
131
                return views.get(index);
132
        }
133
}