01: package org.apache.ojb.tools.mapping.reversedb2.dnd2;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * 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: import java.awt.Component;
19: import java.awt.Image;
20: import java.awt.datatransfer.Transferable;
21:
22: /** Implementers of this interface are used by DragHelper to query the possible
23: * actions for a drag gesture and to export the data into a Transferable
24: * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
25: * @version $Id: DragCopyCutWorkerInterface.java,v 1.1.2.1 2005/12/21 22:32:42 tomdz Exp $
26: */
27: public interface DragCopyCutWorkerInterface {
28: /** Return a Transferable with the data you whish to export. You also get
29: * the Component the DnD actions has been started for. If the component
30: * supports selection you must first check which items are selected and
31: * afterwards put those items in the Transferable.
32: * @param c The component that acts as the drag source
33: * @return a Transferable containing the exported data
34: */
35: public Transferable getTransferable(Component c);
36:
37: /** Return a bitmask of acceptable actions. In most cases you will only support
38: * DRAG_COPY, but sometimes you might support DRAG_LINK or DRAG_MOVE as well.
39: * @param c The component that acts as the drag source
40: * @return A bitmask of possible drag actions for the given Component
41: */
42: public int getAcceptableActions(Component c);
43:
44: /** Is called to notify you that the export has started. This is always
45: * called after getTransferable, so you should know which items are exported.
46: * This method is currently not called by the framework, but may be in future.
47: * @param c The component that acts as the drag source
48: * @param action The drag action that is going to be performed
49: */
50: public void exportStarted(Component c, int action);
51:
52: /** Is called to notify you that the export this Worker has been notified of
53: * has finished. action shows you which action has been performed, e.g. if it
54: * is DRAG_MOVE you can remove the dragged items from your model.
55: * @param c The component that acts as the drag source
56: * @param action The drag action that has been performed
57: */
58: public void exportDone(Component c, int action);
59:
60: /** DnD on some platforms supports displaying a drag image in addition
61: * to the drag cursor (Windows is known not to support it, so if you are
62: * on Windows you might be doing all right, but still see no image)
63: * @return an Image that shall be displayed with the cursor.
64: * @param c The component that acts as the drag source
65: * @param t The transferable that is used in this DnD process
66: * @param action The currently requested action for the ongoing drag process
67: */
68: public Image getDragImage(Component c, Transferable t, int action);
69:
70: }
|