root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / gui / ProjectElementListModel.java @ 38608
History | View | Annotate | Download (1.91 KB)
1 | 36411 | cordinyana | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | 7304 | caballero | *
|
3 | 36411 | cordinyana | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 | * of the Valencian Government (CIT)
|
||
5 | *
|
||
6 | 7304 | caballero | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | 36411 | cordinyana | *
|
11 | 7304 | caballero | * This program is distributed in the hope that it will be useful,
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | 36411 | cordinyana | *
|
16 | 7304 | caballero | * You should have received a copy of the GNU General Public License
|
17 | * along with this program; if not, write to the Free Software
|
||
18 | 36411 | cordinyana | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | 7304 | caballero | */
|
22 | 29598 | jpiera | package org.gvsig.app.project.documents.gui; |
23 | 7304 | caballero | |
24 | import java.util.ArrayList; |
||
25 | |||
26 | import javax.swing.AbstractListModel; |
||
27 | |||
28 | /**
|
||
29 | * Modelo para presentar los ProjectElement's (vistas, mapas, tablas) en un
|
||
30 | * JList
|
||
31 | 36411 | cordinyana | *
|
32 | 7304 | caballero | * @author Fernando Gonz?lez Cort?s
|
33 | */
|
||
34 | public class ProjectElementListModel extends AbstractListModel { |
||
35 | 36411 | cordinyana | |
36 | private static final long serialVersionUID = 5224594892273078623L; |
||
37 | 7304 | caballero | private ArrayList els; |
38 | |||
39 | /**
|
||
40 | * Creates a new MyListModel object.
|
||
41 | 36411 | cordinyana | *
|
42 | * @param els
|
||
43 | * Elementos del modelo
|
||
44 | 7304 | caballero | */
|
45 | public ProjectElementListModel(ArrayList els) { |
||
46 | this.els = els;
|
||
47 | } |
||
48 | |||
49 | /**
|
||
50 | * Obtiene el tama?o de la lista
|
||
51 | 36411 | cordinyana | *
|
52 | 7304 | caballero | * @return tama?o de la lista
|
53 | */
|
||
54 | public int getSize() { |
||
55 | if (els == null) { |
||
56 | return 0; |
||
57 | } |
||
58 | |||
59 | return els.size();
|
||
60 | } |
||
61 | |||
62 | /**
|
||
63 | * @see javax.swing.ListModel#getElementAt(int)
|
||
64 | */
|
||
65 | public Object getElementAt(int index) { |
||
66 | if (els == null) { |
||
67 | return ""; |
||
68 | } |
||
69 | |||
70 | return els.get(index);
|
||
71 | } |
||
72 | } |