1 | public CalendarList() {↵ | | 1 | public ContactList() {↵
|
2 | super();↵ | | 2 | super();↵
|
|
3 | setCellRenderer(new MyListCellRenderer());↵ | | 3 | setCellRenderer(new MyListCellRenderer());↵
|
|
4 | setBorder(null);↵ | | 4 | setBorder(null);↵
|
5 | setHighlighters(new HighlighterPipeline(↵ | | 5 | setHighlighters(new HighlighterPipeline(↵
|
6 | new Highlighter[] { new RolloverHighlighter(new Color(248, 248,↵ | | 6 | new Highlighter[] { new RolloverHighlighter(new Color(248, 248,↵
|
7 | 248), Color.white) }));↵ | | 7 | 248), Color.white) }));↵
|
8 | setRolloverEnabled(true);↵ | | 8 | setRolloverEnabled(true);↵
|
|
9 | }↵ | | 9 | }↵
|
|
10 | public void addAll(List<IEventInfo> list) {↵ | | 10 | public void addAll(List<IContactModelPartial> list) {↵
|
11 | Iterator<IEventInfo> it = list.iterator();↵ | | 11 | Iterator<IContactModelPartial> it = list.iterator();↵
|
12 | while (it.hasNext()) {↵ | | 12 | while (it.hasNext()) {↵
|
13 | addElement(it.next());↵ | | 13 | addElement(it.next());↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
|
16 | public void add(IEventInfo result) {↵ | | 16 | public void add(IContactModelPartial result) {↵
|
17 | addElement(result);↵ | | 17 | addElement(result);↵
|
18 | }↵ | | 18 | }↵
|
|
19 | /**↵ | | 19 | /**↵
|
20 | * ********************** filtering↵ | | 20 | * ********************** filtering↵
|
21 | * *********************************************↵ | | 21 | * *********************************************↵
|
22 | */↵ | | 22 | */↵
|
|
23 | /**↵ | | 23 | /**↵
|
24 | * Associates filtering document listener to text component.↵ | | 24 | * Associates filtering document listener to text component.↵
|
25 | */↵ | | 25 | */↵
|
|
26 | public void installJTextField(JTextField input) {↵ | | 26 | public void installJTextField(JTextField input) {↵
|
27 | if (input != null) {↵ | | 27 | if (input != null) {↵
|
28 | FilteringModel model = (FilteringModel) getModel();↵ | | 28 | FilteringModel model = (FilteringModel) getModel();↵
|
29 | input.getDocument().addDocumentListener(model);↵ | | 29 | input.getDocument().addDocumentListener(model);↵
|
30 | }↵ | | 30 | }↵
|
31 | }↵ | | 31 | }↵
|
|
32 | /**↵ | | 32 | /**↵
|
33 | * Disassociates filtering document listener from text component.↵ | | 33 | * Disassociates filtering document listener from text component.↵
|
34 | */↵ | | 34 | */↵
|
|
35 | public void uninstallJTextField(JTextField input) {↵ | | 35 | public void uninstallJTextField(JTextField input) {↵
|
36 | if (input != null) {↵ | | 36 | if (input != null) {↵
|
37 | FilteringModel model = (FilteringModel) getModel();↵ | | 37 | FilteringModel model = (FilteringModel) getModel();↵
|
38 | input.getDocument().removeDocumentListener(model);↵ | | 38 | input.getDocument().removeDocumentListener(model);↵
|
39 | }↵ | | 39 | }↵
|
40 | }↵ | | 40 | }↵
|
|
41 | /**↵ | | 41 | /**↵
|
42 | * Doesn't let model change to non-filtering variety↵ | | 42 | * Doesn't let model change to non-filtering variety↵
|
43 | */↵ | | 43 | */↵
|
|
44 | public void setModel(ListModel model) {↵ | | 44 | public void setModel(ListModel model) {↵
|
45 | if (!(model instanceof FilteringModel)) {↵ | | 45 | if (!(model instanceof FilteringModel)) {↵
|
46 | throw new IllegalArgumentException();↵ | | 46 | throw new IllegalArgumentException();↵
|
47 | } else {↵ | | 47 | } else {↵
|
48 | super.setModel(model);↵ | | 48 | super.setModel(model);↵
|
49 | }↵ | | 49 | }↵
|
50 | }↵ | | 50 | }↵
|
|
51 | /**↵ | | 51 | /**↵
|
52 | * Adds item to model of list↵ | | 52 | * Adds item to model of list↵
|
53 | */↵ | | 53 | */↵
|
54 | public void addElement(IEventInfo element) {↵ | | 54 | public void addElement(IContactModelPartial element) {↵
|
55 | ((FilteringModel) getModel()).addElement(element); | | 55 | ((FilteringModel) getModel()).addElement(element);
|