1 | ContactDNDListView() {↵ | | 1 | AddressbookDNDListView() {↵
|
2 | super();↵ | | 2 | super();↵
|
|
3 | addListSelectionListener(this);↵ | | 3 | addListSelectionListener(this);↵
|
|
4 | dropTarget = new DropTarget(this, this);↵ | | 4 | dropTarget = new DropTarget(this, this);↵
|
5 | dragSource = DragSource.getDefaultDragSource();↵ | | 5 | dragSource = DragSource.getDefaultDragSource();↵
|
|
6 | if (acceptDrop == true) {↵ | | 6 | if (acceptDrop == true) {↵
|
7 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 7 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
8 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵ | | 8 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵
|
9 | } else {↵ | | 9 | } else {↵
|
10 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 10 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
11 | DnDConstants.ACTION_COPY, this);↵ | | 11 | DnDConstants.ACTION_COPY, this);↵
|
12 | }↵ | | 12 | }↵
|
13 | }↵ | | 13 | }↵
|
|
14 | public ContactDNDListView(ContactListModel model) {↵ | | 14 | public AddressbookDNDListView(AddressbookListModel model) {↵
|
15 | super(model);↵ | | 15 | super(model);↵
|
|
16 | addListSelectionListener(this);↵ | | 16 | addListSelectionListener(this);↵
|
|
17 | dropTarget = new DropTarget(this, this);↵ | | 17 | dropTarget = new DropTarget(this, this);↵
|
18 | dragSource = new DragSource();↵ | | 18 | dragSource = new DragSource();↵
|
|
19 | if (acceptDrop == true) {↵ | | 19 | if (acceptDrop == true) {↵
|
20 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 20 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
21 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵ | | 21 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵
|
22 | } else {↵ | | 22 | } else {↵
|
23 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 23 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
24 | DnDConstants.ACTION_COPY, this);↵ | | 24 | DnDConstants.ACTION_COPY, this);↵
|
25 | }↵ | | 25 | }↵
|
26 | }↵ | | 26 | }↵
|
|
27 | public void setAcceptDrop(boolean b) {↵ | | 27 | public void setAcceptDrop(boolean b) {↵
|
28 | acceptDrop = b;↵ | | 28 | acceptDrop = b;↵
|
29 | }↵ | | 29 | }↵
|
|
30 | /**↵ | | 30 | /**↵
|
31 | * is invoked when you are dragging over the DropSite↵ | | 31 | * is invoked when you are dragging over the DropSite↵
|
32 | * ↵ | | 32 | * ↵
|
33 | */↵ | | 33 | */↵
|
34 | public void dragEnter(DropTargetDragEvent event) {↵ | | 34 | public void dragEnter(DropTargetDragEvent event) {↵
|
35 | // debug messages for diagnostics↵ | | 35 | // debug messages for diagnostics↵
|
36 | if (acceptDrop == true) {↵ | | 36 | if (acceptDrop == true) {↵
|
37 | event.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);↵ | | 37 | event.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);↵
|
38 | } else {↵ | | 38 | } else {↵
|
39 | event.acceptDrag(DnDConstants.ACTION_COPY);↵ | | 39 | event.acceptDrag(DnDConstants.ACTION_COPY);↵
|
40 | }↵ | | 40 | }↵
|
41 | }↵ | | 41 | }↵
|
|
42 | /**↵ | | 42 | /**↵
|
43 | * is invoked when you are exit the DropSite without dropping↵ | | 43 | * is invoked when you are exit the DropSite without dropping↵
|
44 | * ↵ | | 44 | * ↵
|
45 | */↵ | | 45 | */↵
|
46 | public void dragExit(DropTargetEvent event) {↵ | | 46 | public void dragExit(DropTargetEvent event) {↵
|
47 | }↵ | | 47 | }↵
|
|
48 | /**↵ | | 48 | /**↵
|
49 | * is invoked when a drag operation is going on↵ | | 49 | * is invoked when a drag operation is going on↵
|
50 | * ↵ | | 50 | * ↵
|
51 | */↵ | | 51 | */↵
|
52 | public void dragOver(DropTargetDragEvent event) {↵ | | 52 | public void dragOver(DropTargetDragEvent event) {↵
|
53 | }↵ | | 53 | }↵
|
|
54 | /**↵ | | 54 | /**↵
|
55 | * a drop has occurred↵ | | 55 | * a drop has occurred↵
|
56 | * ↵ | | 56 | * ↵
|
57 | */↵ | | 57 | */↵
|
58 | public void drop(DropTargetDropEvent event) {↵ | | 58 | public void drop(DropTargetDropEvent event) {↵
|
59 | if (acceptDrop == false) {↵ | | 59 | if (acceptDrop == false) {↵
|
60 | event.rejectDrop();↵ | | 60 | event.rejectDrop();↵
|
|
61 | clearSelection();↵ | | 61 | clearSelection();↵
|
|
62 | return;↵ | | 62 | return;↵
|
63 | }↵ | | 63 | }↵
|
|
64 | IHeaderItem[] items = HeaderItemDNDManager.getInstance()↵ | | 64 | IBasicModelPartial[] items = HeaderItemDNDManager.getInstance()↵
|
65 | .getHeaderItemList();↵ | | 65 | .getHeaderItemList();↵
|
|
66 | for (int i = 0; i < items.length; i++ | | 66 | for (int i = 0; i < items.length; i++
|