01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Michael Danilov
19: * @version $Revision$
20: */package java.awt.dnd;
21:
22: public class DragSourceDropEvent extends DragSourceEvent {
23:
24: private static final long serialVersionUID = -5571321229470821891L;
25: private int action;
26: private boolean success;
27:
28: public DragSourceDropEvent(DragSourceContext dsc, int action,
29: boolean success, int x, int y) {
30: super (dsc, x, y);
31:
32: initFields(action, success);
33: }
34:
35: public DragSourceDropEvent(DragSourceContext dsc, int action,
36: boolean success) {
37: super (dsc);
38:
39: initFields(action, success);
40: }
41:
42: public DragSourceDropEvent(DragSourceContext dsc) {
43: this (dsc, DnDConstants.ACTION_NONE, false);
44: }
45:
46: private void initFields(int action, boolean success) {
47: this .success = success;
48: this .action = action;
49: }
50:
51: public boolean getDropSuccess() {
52: return success;
53: }
54:
55: public int getDropAction() {
56: int ret = DnDConstants.ACTION_NONE;
57:
58: if (success) {
59: ret = (action & getDragSourceContext().getSourceActions());
60: }
61:
62: return ret;
63: }
64:
65: }
|