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 Pavel Dolgov
19: * @version $Revision$
20: */package org.apache.harmony.awt.datatransfer.linux;
21:
22: import java.awt.datatransfer.DataFlavor;
23: import java.awt.datatransfer.Transferable;
24: import java.awt.dnd.DropTarget;
25: import java.awt.dnd.DropTargetContext;
26: import java.awt.dnd.InvalidDnDOperationException;
27: import java.awt.dnd.peer.DropTargetContextPeer;
28:
29: import org.apache.harmony.awt.ContextStorage;
30: import org.apache.harmony.awt.internal.nls.Messages;
31: import org.apache.harmony.awt.wtk.linux.LinuxEventQueue;
32:
33: public class LinuxDropTarget implements DropTargetContextPeer {
34:
35: private final LinuxDTK dtk;
36: private final LinuxEventQueue nativeQueue;
37:
38: private final DropTargetContext context;
39: private Transferable transferable;
40:
41: public LinuxDropTarget(LinuxDTK dtk, DropTargetContext context) {
42: this .dtk = dtk;
43: this .context = context;
44: nativeQueue = (LinuxEventQueue) ContextStorage
45: .getNativeEventQueue();
46: }
47:
48: public void acceptDrag(int dragAction) {
49: }
50:
51: public void acceptDrop(int dropAction) {
52: }
53:
54: public void dropComplete(boolean success) {
55: }
56:
57: public DropTarget getDropTarget() {
58: return context.getDropTarget();
59: }
60:
61: public int getTargetActions() {
62: return context.getDropTarget().getDefaultActions();
63: }
64:
65: public DataFlavor[] getTransferDataFlavors() {
66: return (transferable != null) ? transferable
67: .getTransferDataFlavors() : new DataFlavor[0];
68: }
69:
70: public Transferable getTransferable()
71: throws InvalidDnDOperationException {
72: if (transferable == null) {
73: // awt.07=Transfer data is not available
74: throw new InvalidDnDOperationException(Messages
75: .getString("awt.07")); //$NON-NLS-1$
76: }
77: return transferable;
78: }
79:
80: public boolean isTransferableJVMLocal() {
81: return false;
82: }
83:
84: public void rejectDrag() {
85: }
86:
87: public void rejectDrop() {
88: }
89:
90: public void setTargetActions(int actions) {
91: context.getDropTarget().setDefaultActions(actions);
92: }
93:
94: }
|