Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SelectableList |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport | |
3 | * (http://www.vbs.admin.ch) | |
4 | * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch) | |
5 | * All rights reserved. | |
6 | * | |
7 | * Licensed under the Open Permis License which accompanies this distribution, | |
8 | * and is available at http://www.openpermis.org/BSDlicenceKent.txt | |
9 | */ | |
10 | package org.openpermis.editor.policy.gui; | |
11 | ||
12 | import java.util.Vector; | |
13 | ||
14 | import javax.swing.JList; | |
15 | import javax.swing.ListModel; | |
16 | ||
17 | ||
18 | /** | |
19 | * Extended JList that supports {@link #setSelectedElement}. | |
20 | * @since 0.1.0 | |
21 | */ | |
22 | public class SelectableList extends JList { | |
23 | ||
24 | ||
25 | //---- Static | |
26 | ||
27 | /** | |
28 | * @since 0.1.0 | |
29 | */ | |
30 | private static final long serialVersionUID = 399754452111687091L; | |
31 | ||
32 | //---- Constructors | |
33 | ||
34 | /** | |
35 | * @since 0.1.0 | |
36 | */ | |
37 | public SelectableList () { | |
38 | 0 | super(); |
39 | 0 | } |
40 | ||
41 | /** | |
42 | * @since 0.1.0 | |
43 | */ | |
44 | public SelectableList (ListModel dataModel) { | |
45 | 0 | super(dataModel); |
46 | 0 | } |
47 | ||
48 | /** | |
49 | * @since 0.1.0 | |
50 | */ | |
51 | public SelectableList (Object[] listData) { | |
52 | 0 | super(listData); |
53 | 0 | } |
54 | ||
55 | /** | |
56 | * @since 0.1.0 | |
57 | */ | |
58 | public SelectableList (Vector<?> listData) { | |
59 | 0 | super(listData); |
60 | 0 | } |
61 | ||
62 | //---- Methods | |
63 | ||
64 | /** | |
65 | * @since 0.1.0 | |
66 | */ | |
67 | public void setSelectedElement (Object element) { | |
68 | 0 | setSelectedValue(element, true); |
69 | 0 | } |
70 | ||
71 | } |