]>
Commit | Line | Data |
---|---|---|
a13899c5 | 1 | /** @file\r |
2 | \r | |
3 | The file is used to override DefaultListModel to create ICheckBoxListModel\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;\r | |
16 | \r | |
17 | import javax.swing.*;\r | |
18 | import java.util.Vector;\r | |
19 | \r | |
20 | public class ICheckBoxListModel extends DefaultListModel {\r | |
21 | ///\r | |
22 | /// Define class Serial Version UID\r | |
23 | ///\r | |
24 | private static final long serialVersionUID = -8617800969723991017L;\r | |
25 | \r | |
26 | /**\r | |
27 | This is the default Constructor for the CheckBoxListModel object\r | |
28 | \r | |
29 | **/\r | |
30 | public ICheckBoxListModel() {\r | |
31 | }\r | |
32 | \r | |
33 | /**\r | |
34 | override DefaultListModel's add method\r | |
35 | \r | |
36 | @param index\r | |
37 | @param item\r | |
38 | \r | |
39 | **/\r | |
40 | public void add(int index, ICheckBoxListItem item) {\r | |
41 | super.add(index, item);\r | |
42 | }\r | |
43 | \r | |
44 | /**\r | |
45 | Add one item at tail\r | |
46 | \r | |
47 | @param item\r | |
48 | \r | |
49 | **/\r | |
50 | public void addElement(ICheckBoxListItem item) {\r | |
51 | super.addElement(item);\r | |
52 | }\r | |
53 | \r | |
54 | /**\r | |
55 | Get all elements of the list\r | |
56 | \r | |
57 | **/\r | |
58 | public Vector<ICheckBoxListItem> getAllElements() {\r | |
59 | Vector<ICheckBoxListItem> items = new Vector<ICheckBoxListItem>();\r | |
60 | ICheckBoxListItem[] objs = new ICheckBoxListItem[this.size()];\r | |
61 | this.copyInto(objs);\r | |
62 | for (int i = 0; i < size(); i++) {\r | |
63 | items.addElement(objs[i]);\r | |
64 | }\r | |
65 | return items;\r | |
66 | }\r | |
67 | }\r |