svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / gui / ProjectElementListModel.java @ 44644
History | View | Annotate | Download (1.96 KB)
1 | 40558 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40558 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 40435 | jjdelcerro | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40558 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | 40558 | jjdelcerro | *
|
11 | 40435 | jjdelcerro | * 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 | 40558 | jjdelcerro | *
|
16 | 40435 | jjdelcerro | * 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 | 40558 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 40435 | jjdelcerro | * MA 02110-1301, USA.
|
20 | 40558 | jjdelcerro | *
|
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | package org.gvsig.app.project.documents.gui; |
||
25 | |||
26 | import java.util.ArrayList; |
||
27 | |||
28 | import javax.swing.AbstractListModel; |
||
29 | |||
30 | /**
|
||
31 | * Modelo para presentar los ProjectElement's (vistas, mapas, tablas) en un
|
||
32 | * JList
|
||
33 | *
|
||
34 | * @author Fernando Gonz?lez Cort?s
|
||
35 | */
|
||
36 | public class ProjectElementListModel extends AbstractListModel { |
||
37 | |||
38 | private static final long serialVersionUID = 5224594892273078623L; |
||
39 | private ArrayList els; |
||
40 | |||
41 | /**
|
||
42 | * Creates a new MyListModel object.
|
||
43 | *
|
||
44 | * @param els
|
||
45 | * Elementos del modelo
|
||
46 | */
|
||
47 | public ProjectElementListModel(ArrayList els) { |
||
48 | this.els = els;
|
||
49 | } |
||
50 | |||
51 | /**
|
||
52 | * Obtiene el tama?o de la lista
|
||
53 | *
|
||
54 | * @return tama?o de la lista
|
||
55 | */
|
||
56 | public int getSize() { |
||
57 | if (els == null) { |
||
58 | return 0; |
||
59 | } |
||
60 | |||
61 | return els.size();
|
||
62 | } |
||
63 | |||
64 | /**
|
||
65 | * @see javax.swing.ListModel#getElementAt(int)
|
||
66 | */
|
||
67 | public Object getElementAt(int index) { |
||
68 | if (els == null) { |
||
69 | return ""; |
||
70 | } |
||
71 | |||
72 | return els.get(index);
|
||
73 | } |
||
74 | } |