Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SitesListModel |
|
| 1.0;1 |
1 | package org.jtheque.films.view.impl.models.list; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import org.jtheque.films.utils.Constants.Site; | |
20 | ||
21 | import javax.swing.DefaultListModel; | |
22 | ||
23 | /** | |
24 | * A list model for sites. | |
25 | * | |
26 | * @author Baptiste Wicht | |
27 | */ | |
28 | public final class SitesListModel extends DefaultListModel { | |
29 | private static final long serialVersionUID = 7060472242015464173L; | |
30 | ||
31 | private final Site[] sites; | |
32 | ||
33 | /** | |
34 | * Construct a new SitesListModel. | |
35 | */ | |
36 | public SitesListModel() { | |
37 | 0 | super(); |
38 | ||
39 | 0 | sites = Site.values(); |
40 | 0 | } |
41 | ||
42 | @Override | |
43 | public Object getElementAt(int index) { | |
44 | 0 | return sites[index]; |
45 | } | |
46 | ||
47 | @Override | |
48 | public Object get(int index) { | |
49 | 0 | return sites[index]; |
50 | } | |
51 | ||
52 | @Override | |
53 | public int getSize() { | |
54 | 0 | return sites.length; |
55 | } | |
56 | } |