01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.addressbook.gui.list;
17:
18: import java.util.List;
19:
20: import javax.swing.BorderFactory;
21: import javax.swing.JList;
22:
23: import org.columba.addressbook.model.IBasicModelPartial;
24:
25: public class AddressbookListView extends JList {
26: private AddressbookListModel model;
27:
28: public AddressbookListView(AddressbookListModel model) {
29: super (model);
30:
31: this .model = model;
32:
33: //setCellRenderer(new AddressbookListRenderer());
34:
35: setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
36: }
37:
38: public AddressbookListView() {
39: super ();
40:
41: model = new AddressbookListModel();
42: setModel(model);
43:
44: //setCellRenderer(new AddressbookListRenderer());
45:
46: setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
47: }
48:
49: public void setHeaderItemList(List<IBasicModelPartial> list) {
50: removeAll();
51:
52: model.setHeaderItemList(list);
53: }
54:
55: public void setModel(AddressbookListModel model) {
56: this .model = model;
57: super .setModel(model);
58: }
59:
60: public void addElement(IBasicModelPartial item) {
61: model.addElement(item);
62: }
63:
64: public IBasicModelPartial get(int index) {
65: IBasicModelPartial item = (IBasicModelPartial) model.get(index);
66:
67: return item;
68: }
69: }
|