gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.swing / org.gvsig.raster.wmts.swing.impl / src / main / java / org / gvsig / raster / wmts / swing / impl / wizard / WMTSParametersListModel.java @ 2608
History | View | Annotate | Download (2.06 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* 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 |
*
|
11 |
* 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 |
*
|
16 |
* 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 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
package org.gvsig.raster.wmts.swing.impl.wizard; |
24 |
|
25 |
import java.util.ArrayList; |
26 |
import java.util.Collection; |
27 |
import java.util.List; |
28 |
import java.util.TreeSet; |
29 |
|
30 |
import javax.swing.AbstractListModel; |
31 |
|
32 |
|
33 |
/**
|
34 |
* Data model for a list of SRSs
|
35 |
*/
|
36 |
public class WMTSParametersListModel extends AbstractListModel { |
37 |
private static final long serialVersionUID = 1L; |
38 |
|
39 |
ArrayList<Object> srs = new ArrayList<Object>(); |
40 |
|
41 |
public WMTSParametersListModel(ArrayList<Object> obj) { |
42 |
srs = obj; |
43 |
} |
44 |
|
45 |
public WMTSParametersListModel(List<String> obj) { |
46 |
for (int i = 0; i < obj.size(); i++) |
47 |
srs.add(obj.get(i)); |
48 |
} |
49 |
|
50 |
public WMTSParametersListModel() {
|
51 |
} |
52 |
|
53 |
public int getSize() { |
54 |
return srs.size();
|
55 |
} |
56 |
|
57 |
public Object getElementAt(int index) { |
58 |
if(srs.size() > 0 && index >= 0 && index < srs.size()) |
59 |
return srs.get(index);
|
60 |
return null; |
61 |
} |
62 |
|
63 |
public void removeAllItems() { |
64 |
srs.clear(); |
65 |
} |
66 |
|
67 |
public void setAll(Collection<Object> c) { |
68 |
srs.clear(); |
69 |
srs.addAll(c); |
70 |
} |
71 |
|
72 |
public Collection<Object> intersect(Collection<Object> c) { |
73 |
TreeSet<Object> resul = new TreeSet<Object>(); |
74 |
for (int i = 0; i < srs.size(); i++) { |
75 |
if (c.contains(srs.get(i)))
|
76 |
resul.add(srs.get(i)); |
77 |
} |
78 |
return resul;
|
79 |
} |
80 |
} |