svn-gvsig-desktop / tags / Root_v06 / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / fframes / ListViewModel.java @ 4811
History | View | Annotate | Download (2.9 KB)
1 | 312 | fernando | /*
|
---|---|---|---|
2 | * Created on 02-jun-2004
|
||
3 | *
|
||
4 | */
|
||
5 | 1103 | fjp | /* 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 | 312 | fernando | package com.iver.cit.gvsig.gui.layout.fframes; |
46 | |||
47 | 1073 | vcaballero | import com.iver.andami.PluginServices; |
48 | |||
49 | import com.iver.cit.gvsig.ProjectExtension; |
||
50 | import com.iver.cit.gvsig.gui.layout.Layout; |
||
51 | |||
52 | 312 | fernando | import java.util.ArrayList; |
53 | |||
54 | import javax.swing.AbstractListModel; |
||
55 | |||
56 | |||
57 | /**
|
||
58 | * Modelo de la Lista de vistas a seleccionar.
|
||
59 | 1073 | vcaballero | *
|
60 | 312 | fernando | * @author Vicente Caballero Navarro
|
61 | */
|
||
62 | public class ListViewModel extends AbstractListModel { |
||
63 | private ArrayList views = new ArrayList(); |
||
64 | |||
65 | /**
|
||
66 | * A?ade las vistas que tiene el proyecto a la lista.
|
||
67 | */
|
||
68 | public void addViews() { |
||
69 | 1073 | vcaballero | ProjectExtension projectextension = (ProjectExtension) PluginServices.getExtension(com.iver.cit.gvsig.ProjectExtension.class); |
70 | views = projectextension.getProject().getViews(); |
||
71 | 312 | fernando | } |
72 | 1073 | vcaballero | |
73 | /**
|
||
74 | 2915 | caballero | * Add all fframeviews into a list.
|
75 | 1073 | vcaballero | *
|
76 | 2915 | caballero | * @param l Layout.
|
77 | 1073 | vcaballero | */
|
78 | 2915 | caballero | public void addViews(Layout l) { |
79 | 1073 | vcaballero | int num = 0; |
80 | |||
81 | for (int i = 0; i < l.getFFrames().size(); i++) { |
||
82 | IFFrame f = (IFFrame) l.getFFrames().get(i); |
||
83 | |||
84 | if (f instanceof FFrameView) { |
||
85 | 312 | fernando | //((FFrameView)f).getView().setName("FFrameView "+num+((FFrameView)f).getName());
|
86 | 1073 | vcaballero | views.add((FFrameView) f); |
87 | ((FFrameView) f).setNum(num); |
||
88 | num++; |
||
89 | 312 | fernando | } |
90 | } |
||
91 | 1073 | vcaballero | |
92 | 312 | fernando | //ProjectExtension projectextension =(ProjectExtension)App.instance.getPc().getExtension(com.iver.cit.gvsig.ProjectExtension.class);
|
93 | //views=projectextension.getProject().getViews();
|
||
94 | } |
||
95 | 1073 | vcaballero | |
96 | 312 | fernando | /**
|
97 | 1073 | vcaballero | * Devuelve el ArrayList con las FFrameView.
|
98 | *
|
||
99 | * @return DOCUMENT ME!
|
||
100 | */
|
||
101 | //public ArrayList getViews() {
|
||
102 | // return views;
|
||
103 | //}
|
||
104 | |||
105 | /**
|
||
106 | 312 | fernando | * @see javax.swing.ListModel#getSize()
|
107 | */
|
||
108 | public int getSize() { |
||
109 | return views.size();
|
||
110 | } |
||
111 | |||
112 | /**
|
||
113 | * @see javax.swing.ListModel#getElementAt(int)
|
||
114 | */
|
||
115 | public Object getElementAt(int index) { |
||
116 | return views.get(index);
|
||
117 | } |
||
118 | } |