1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.cb.cardboard;
21
22 import javax.swing.*;
23 import javax.swing.event.EventListenerList;
24
25 /***
26 * Default data model for board selections.
27 * <p>
28 * we shamely reuse the DefaultListSelectionModel interface & adapts its implementation.
29 *
30 * @author jerome@coffeebreaks.org - last modified by $LastModifiedBy$
31 * @version $Id: DefaultBoardSelectionModel.java 123 2004-04-14 23:45:53Z jerome $
32 */
33 public class DefaultBoardSelectionModel implements BoardSelectionModel
34 {
35 /*** the adapted <code>DefaultListSelectionModel</code> instance. */
36 private final DefaultListSelectionModel _adaptee = new DefaultListSelectionModel();
37 /*** the listener list. */
38 private final EventListenerList _listenerList = new EventListenerList();
39
40 public void setSelectionInterval(final int index0, final int index1)
41 {
42 _adaptee.setSelectionInterval(index0, index1);
43 }
44
45 public void addSelectionInterval(final int index0, final int index1)
46 {
47 _adaptee.addSelectionInterval(index0, index1);
48 }
49
50 public void removeSelectionInterval(final int index0, final int index1)
51 {
52 _adaptee.removeSelectionInterval(index0, index1);
53 }
54
55 public int getMinSelectionIndex()
56 {
57 return _adaptee.getMinSelectionIndex();
58 }
59
60 public int getMaxSelectionIndex()
61 {
62 return _adaptee.getMaxSelectionIndex();
63 }
64
65 public boolean isSelectedIndex(final int index)
66 {
67 return _adaptee.isSelectedIndex(index);
68 }
69
70 public int getAnchorSelectionIndex()
71 {
72 return _adaptee.getAnchorSelectionIndex();
73 }
74
75 public void setAnchorSelectionIndex(final int index)
76 {
77 _adaptee.setAnchorSelectionIndex(index);
78 }
79
80 public int getLeadSelectionIndex()
81 {
82 return _adaptee.getLeadSelectionIndex();
83 }
84
85 public void setLeadSelectionIndex(final int index)
86 {
87 _adaptee.setLeadSelectionIndex(index);
88 }
89
90 public void clearSelection()
91 {
92 _adaptee.clearSelection();
93 }
94
95 public boolean isSelectionEmpty()
96 {
97 return _adaptee.isSelectionEmpty();
98 }
99
100 public void insertIndexInterval(final int index, final int length, final boolean before)
101 {
102 _adaptee.insertIndexInterval(index, length, before);
103 }
104
105 public void removeIndexInterval(final int index0, final int index1)
106 {
107 _adaptee.removeIndexInterval(index0, index1);
108 }
109
110 public void setValueIsAdjusting(final boolean valueIsAdjusting)
111 {
112 _adaptee.setValueIsAdjusting(valueIsAdjusting);
113 }
114
115 public boolean getValueIsAdjusting()
116 {
117 return _adaptee.getValueIsAdjusting();
118 }
119
120 public void setSelectionMode(final int selectionMode)
121 {
122 _adaptee.setSelectionMode(selectionMode);
123 }
124
125 public int getSelectionMode()
126 {
127 return _adaptee.getSelectionMode();
128 }
129
130 public void addBoardSelectionListener(final BoardSelectionListener x)
131 {
132 _listenerList.add(BoardSelectionListener.class, x);
133 }
134
135 public void removeBoardSelectionListener(final BoardSelectionListener x)
136 {
137 _listenerList.remove(BoardSelectionListener.class, x);
138 }
139 }