History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/java/awt/dnd/DragSourceDropEvent.java (1 of 18352 files). Show all

Unified · Split

java/pkg/java/awt/dnd/DragSourceDropEvent.java+168−0
@@ -0,0 +1,168 @@
1+/*
2+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * This code is free software; you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License version 2 only, as
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package java.awt.dnd;
27+
28+/**
29+ * The <code>DragSourceDropEvent</code> is delivered
30+ * from the <code>DragSourceContextPeer</code>,
31+ * via the <code>DragSourceContext</code>, to the <code>dragDropEnd</code>
32+ * method of <code>DragSourceListener</code>s registered with that
33+ * <code>DragSourceContext</code> and with its associated
34+ * <code>DragSource</code>.
35+ * It contains sufficient information for the
36+ * originator of the operation
37+ * to provide appropriate feedback to the end user
38+ * when the operation completes.
39+ * <P>
40+ * <P>
41+ * @since 1.2
42+ */
43+
44+public class DragSourceDropEvent extends DragSourceEvent {
45+
46+ private static final long serialVersionUID = -5571321229470821891L;
47+
48+ /**
49+ * Construct a <code>DragSourceDropEvent</code> for a drop,
50+ * given the
51+ * <code>DragSourceContext</code>, the drop action,
52+ * and a <code>boolean</code> indicating if the drop was successful.
53+ * The coordinates for this <code>DragSourceDropEvent</code>
54+ * are not specified, so <code>getLocation</code> will return
55+ * <code>null</code> for this event.
56+ * <p>
57+ * The argument <code>action</code> should be one of <code>DnDConstants</code>
58+ * that represents a single action.
59+ * This constructor does not throw any exception for invalid <code>action</code>.
60+ *
61+ * @param dsc the <code>DragSourceContext</code>
62+ * associated with this <code>DragSourceDropEvent</code>
63+ * @param action the drop action
64+ * @param success a boolean indicating if the drop was successful
65+ *
66+ * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
67+ *
68+ * @see DragSourceEvent#getLocation
69+ */
70+
71+ public DragSourceDropEvent(DragSourceContext dsc, int action, boolean success) {
72+ super(dsc);
73+
74+ dropSuccess = success;
75+ dropAction = action;
76+ }
77+
78+ /**
79+ * Construct a <code>DragSourceDropEvent</code> for a drop, given the
80+ * <code>DragSourceContext</code>, the drop action, a <code>boolean</code>
81+ * indicating if the drop was successful, and coordinates.
82+ * <p>
83+ * The argument <code>action</code> should be one of <code>DnDConstants</code>
84+ * that represents a single action.
85+ * This constructor does not throw any exception for invalid <code>action</code>.
86+ *
87+ * @param dsc the <code>DragSourceContext</code>
88+ * associated with this <code>DragSourceDropEvent</code>
89+ * @param action the drop action
90+ * @param success a boolean indicating if the drop was successful
91+ * @param x the horizontal coordinate for the cursor location
92+ * @param y the vertical coordinate for the cursor location
93+ *
94+ * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
95+ *
96+ * @since 1.4
97+ */
98+ public DragSourceDropEvent(DragSourceContext dsc, int action,
99+ boolean success, int x, int y) {
100+ super(dsc, x, y);
101+
102+ dropSuccess = success;
103+ dropAction = action;
104+ }
105+
106+ /**
107+ * Construct a <code>DragSourceDropEvent</code>
108+ * for a drag that does not result in a drop.
109+ * The coordinates for this <code>DragSourceDropEvent</code>
110+ * are not specified, so <code>getLocation</code> will return
111+ * <code>null</code> for this event.
112+ *
113+ * @param dsc the <code>DragSourceContext</code>
114+ *
115+ * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
116+ *
117+ * @see DragSourceEvent#getLocation
118+ */
119+
120+ public DragSourceDropEvent(DragSourceContext dsc) {
121+ super(dsc);
122+
123+ dropSuccess = false;
124+ }
125+
126+ /**
127+ * This method returns a <code>boolean</code> indicating
128+ * if the drop was successful.
129+ *
130+ * @return <code>true</code> if the drop target accepted the drop and
131+ * successfully performed a drop action;
132+ * <code>false</code> if the drop target rejected the drop or
133+ * if the drop target accepted the drop, but failed to perform
134+ * a drop action.
135+ */
136+
137+ public boolean getDropSuccess() { return dropSuccess; }
138+
139+ /**
140+ * This method returns an <code>int</code> representing
141+ * the action performed by the target on the subject of the drop.
142+ *
143+ * @return the action performed by the target on the subject of the drop
144+ * if the drop target accepted the drop and the target drop action
145+ * is supported by the drag source; otherwise,
146+ * <code>DnDConstants.ACTION_NONE</code>.
147+ */
148+
149+ public int getDropAction() { return dropAction; }
150+
151+ /*
152+ * fields
153+ */
154+
155+ /**
156+ * <code>true</code> if the drop was successful.
157+ *
158+ * @serial
159+ */
160+ private boolean dropSuccess;
161+
162+ /**
163+ * The drop action.
164+ *
165+ * @serial
166+ */
167+ private int dropAction = DnDConstants.ACTION_NONE;
168+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t