KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > dnd > DropTargetEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.dnd;
12
13 import org.eclipse.swt.events.TypedEvent;
14 import org.eclipse.swt.widgets.Widget;
15
16 /**
17  * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener.
18  */

19 public class DropTargetEvent extends TypedEvent {
20     /**
21      * The x-cordinate of the cursor relative to the <code>Display</code>
22      */

23     public int x;
24     
25     /**
26      * The y-cordinate of the cursor relative to the <code>Display</code>
27      */

28     public int y;
29     
30     /**
31      * The operation being performed.
32      * @see DND#DROP_NONE
33      * @see DND#DROP_MOVE
34      * @see DND#DROP_COPY
35      * @see DND#DROP_LINK
36      */

37     public int detail;
38     
39     /**
40      * A bitwise OR'ing of the operations that the DragSource can support
41      * (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK).
42      * The detail value must be a member of this list or DND.DROP_NONE.
43      * @see DND#DROP_NONE
44      * @see DND#DROP_MOVE
45      * @see DND#DROP_COPY
46      * @see DND#DROP_LINK
47      */

48     public int operations;
49     
50     /**
51      * A bitwise OR'ing of the drag under effect feedback to be displayed to the user
52      * (e.g. DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND).
53      * <p>A value of DND.FEEDBACK_NONE indicates that no drag under effect will be displayed.</p>
54      * <p>Feedback effects will only be applied if they are applicable.</p>
55      * <p>The default value is DND.FEEDBACK_SELECT.</p>
56      * @see DND#FEEDBACK_NONE
57      * @see DND#FEEDBACK_SELECT
58      * @see DND#FEEDBACK_INSERT_BEFORE
59      * @see DND#FEEDBACK_INSERT_AFTER
60      * @see DND#FEEDBACK_SCROLL
61      * @see DND#FEEDBACK_EXPAND
62      */

63     public int feedback;
64     
65     /**
66      * If the associated control is a table or tree, this field contains the item located
67      * at the cursor coordinates.
68      */

69     public Widget item;
70     
71     /**
72      * The type of data that will be dropped.
73      */

74     public TransferData currentDataType;
75     
76     /**
77      * A list of the types of data that the DragSource is capable of providing.
78      * The currentDataType must be a member of this list.
79      */

80     public TransferData[] dataTypes;
81
82     static final long serialVersionUID = 3256727264573338678L;
83     
84 /**
85  * Constructs a new instance of this class based on the
86  * information in the given untyped event.
87  *
88  * @param e the untyped event containing the information
89  */

90 public DropTargetEvent(DNDEvent e) {
91     super(e);
92     this.data = e.data;
93     this.x = e.x;
94     this.y = e.y;
95     this.detail = e.detail;
96     this.currentDataType = e.dataType;
97     this.dataTypes = e.dataTypes;
98     this.operations = e.operations;
99     this.feedback = e.feedback;
100     this.item = e.item;
101 }
102 void updateEvent(DNDEvent e) {
103     e.widget = this.widget;
104     e.time = this.time;
105     e.data = this.data;
106     e.x = this.x;
107     e.y = this.y;
108     e.detail = this.detail;
109     e.dataType = this.currentDataType;
110     e.dataTypes = this.dataTypes;
111     e.operations = this.operations;
112     e.feedback = this.feedback;
113     e.item = this.item;
114 }
115 }
116
Popular Tags