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: import java.awt.Point;
23: import java.util.EventObject;
24:
25: import org.apache.harmony.awt.internal.nls.Messages;
26:
27: public class DropTargetEvent extends EventObject {
28:
29: private static final long serialVersionUID = 2821229066521922993L;
30:
31: protected DropTargetContext context;
32:
33: private int userAction;
34: private int sourceAction;
35: private Point location;
36:
37: public DropTargetEvent(DropTargetContext dtc) {
38: super (dtc.getDropTarget());
39:
40: context = dtc;
41: }
42:
43: public DropTargetContext getDropTargetContext() {
44: return context;
45: }
46:
47: DropTargetEvent(DropTargetContext dtc, Point location,
48: int userAction, int sourceAction) {
49: this (dtc);
50:
51: if (!DnDConstants.isValidAction(userAction)) {
52: // awt.177=Invalid user action.
53: throw new IllegalArgumentException(Messages
54: .getString("awt.177")); //$NON-NLS-1$
55: }
56: if (!DnDConstants.isValidAction(sourceAction)) {
57: // awt.178=Invalid source action.
58: throw new IllegalArgumentException(Messages
59: .getString("awt.178")); //$NON-NLS-1$
60: }
61:
62: this .location = (Point) location.clone();
63: this .userAction = userAction;
64: this .sourceAction = sourceAction;
65: }
66:
67: Point getLocation() {
68: return new Point(location);
69: }
70:
71: int getSourceAction() {
72: return sourceAction;
73: }
74:
75: int getUserAction() {
76: return userAction;
77: }
78:
79: }
|