1 | DropTarget dropTarget = null;↵ | | 1 | DropTarget dropTarget = null;↵
|
|
2 | /**↵ | | 2 | /**↵
|
3 | * enables this component to be a Drag Source↵ | | 3 | * enables this component to be a Drag Source↵
|
4 | */↵ | | 4 | */↵
|
5 | DragSource dragSource = null;↵ | | 5 | DragSource dragSource = null;↵
|
|
6 | boolean acceptDrop = true;↵ | | 6 | boolean acceptDrop = true;↵
|
|
7 | private IBasicModelPartial[] selection1;↵ | | 7 | private IHeaderItem[] selection1;↵
|
|
8 | private IBasicModelPartial[] selection2;↵ | | 8 | private IHeaderItem[] selection2;↵
|
|
9 | int index = -1;↵ | | 9 | int index = -1;↵
|
|
10 | private boolean dndAction = false;↵ | | 10 | private boolean dndAction = false;↵
|
|
11 | // Where, in the drag image, the mouse was clicked↵ | | 11 | // Where, in the drag image, the mouse was clicked↵
|
12 | public AddressbookDNDListView() {↵ | | 12 | public ContactDNDListView() {↵
|
13 | super();↵ | | 13 | super();↵
|
|
14 | addListSelectionListener(this);↵ | | 14 | addListSelectionListener(this);↵
|
|
15 | dropTarget = new DropTarget(this, this);↵ | | 15 | dropTarget = new DropTarget(this, this);↵
|
16 | dragSource = DragSource.getDefaultDragSource();↵ | | 16 | dragSource = DragSource.getDefaultDragSource();↵
|
|
17 | if (acceptDrop == true) {↵ | | 17 | if (acceptDrop == true) {↵
|
18 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 18 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
19 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵ | | 19 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵
|
20 | } else {↵ | | 20 | } else {↵
|
21 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 21 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
22 | DnDConstants.ACTION_COPY, this);↵ | | 22 | DnDConstants.ACTION_COPY, this);↵
|
23 | }↵ | | 23 | }↵
|
24 | }↵ | | 24 | }↵
|
|
25 | public AddressbookDNDListView(AddressbookListModel model) {↵ | | 25 | public ContactDNDListView(ContactListModel model) {↵
|
26 | super(model);↵ | | 26 | super(model);↵
|
|
27 | addListSelectionListener(this);↵ | | 27 | addListSelectionListener(this);↵
|
|
28 | dropTarget = new DropTarget(this, this);↵ | | 28 | dropTarget = new DropTarget(this, this);↵
|
29 | dragSource = new DragSource();↵ | | 29 | dragSource = new DragSource();↵
|
|
30 | if (acceptDrop == true) {↵ | | 30 | if (acceptDrop == true) {↵
|
31 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 31 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
32 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵ | | 32 | DnDConstants.ACTION_COPY_OR_MOVE, this);↵
|
33 | } else {↵ | | 33 | } else {↵
|
34 | dragSource.createDefaultDragGestureRecognizer(this,↵ | | 34 | dragSource.createDefaultDragGestureRecognizer(this,↵
|
35 | DnDConstants.ACTION_COPY, this);↵ | | 35 | DnDConstants.ACTION_COPY, this);↵
|
36 | }↵ | | 36 | }↵
|
37 | }↵ | | 37 | }↵
|
|
38 | public void setAcceptDrop(boolean b) {↵ | | 38 | public void setAcceptDrop(boolean b) {↵
|
39 | acceptDrop = b;↵ | | 39 | acceptDrop = b;↵
|
40 | }↵ | | 40 | }↵
|
|
41 | /**↵ | | 41 | /**↵
|
42 | * is invoked when you are dragging over the DropSite↵ | | 42 | * is invoked when you are dragging over the DropSite↵
|
43 | * ↵ | | 43 | * ↵
|
44 | */↵ | | 44 | */↵
|
45 | public void dragEnter(DropTargetDragEvent event) {↵ | | 45 | public void dragEnter(DropTargetDragEvent event) {↵
|
46 | // debug messages for diagnostics↵ | | 46 | // debug messages for diagnostics↵
|
47 | if (acceptDrop == true) {↵ | | 47 | if (acceptDrop == true) {↵
|
48 | event.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);↵ | | 48 | event.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);↵
|
49 | } else {↵ | | 49 | } else {↵
|
50 | event.acceptDrag(DnDConstants.ACTION_COPY);↵ | | 50 | event.acceptDrag(DnDConstants.ACTION_COPY);↵
|
51 | }↵ | | 51 | }↵
|
52 | }↵ | | 52 | }↵
|
|
53 | /**↵ | | 53 | /**↵
|
54 | * is invoked when you are exit the DropSite without dropping↵ | | 54 | * is invoked when you are exit the DropSite without dropping↵
|
55 | * ↵ | | 55 | * ↵
|
56 | */↵ | | 56 | */↵
|
57 | public void dragExit(DropTargetEvent event) {↵ | | 57 | public void dragExit(DropTargetEvent event) {↵
|
58 | }↵ | | 58 | }↵
|
|
59 | /**↵ | | 59 | /**↵
|
60 | * is invoked when a drag operation is going on↵ | | 60 | * is invoked when a drag operation is going on↵
|
61 | * ↵ | | 61 | * ↵
|
62 | */↵ | | 62 | */↵
|
63 | public void dragOver(DropTargetDragEvent event) | | 63 | public void dragOver(DropTargetDragEvent event)
|