OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [java/] [awt/] [dnd/] [DragSource.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* DragSource.java --
2
   Copyright (C) 2002 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package java.awt.dnd;
40
 
41
import java.awt.Component;
42
import java.awt.Cursor;
43
import java.awt.GraphicsEnvironment;
44
import java.awt.HeadlessException;
45
import java.awt.Image;
46
import java.awt.Point;
47
import java.awt.Toolkit;
48
import java.awt.datatransfer.FlavorMap;
49
import java.awt.datatransfer.SystemFlavorMap;
50
import java.awt.datatransfer.Transferable;
51
import java.awt.dnd.peer.DragSourceContextPeer;
52
import java.io.Serializable;
53
import java.util.EventListener;
54
 
55
/**
56
 * @since 1.2
57
 */
58
public class DragSource implements Serializable
59
{
60
  /**
61
   * Compatible with JDK 1.2+.
62
   */
63
  private static final long serialVersionUID = 6236096958971414066L;
64
 
65
  public static final Cursor DefaultCopyDrop = null;
66
  public static final Cursor DefaultMoveDrop = null;
67
  public static final Cursor DefaultLinkDrop = null;
68
  public static final Cursor DefaultCopyNoDrop = null;
69
  public static final Cursor DefaultMoveNoDrop = null;
70
  public static final Cursor DefaultLinkNoDrop = null;
71
 
72
  private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap ();
73
 
74
  private transient DragSourceListener dragSourceListener;
75
  private transient DragSourceMotionListener dragSourceMotionListener;
76
 
77
  /**
78
   * Initializes the drag source.
79
   *
80
   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
81
   */
82
  public DragSource()
83
  {
84
    if (GraphicsEnvironment.isHeadless())
85
      throw new HeadlessException ();
86
  }
87
 
88
  /**
89
   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
90
   */
91
  public static DragSource getDefaultDragSource()
92
  {
93
    return null;
94
  }
95
 
96
  public static boolean isDragImageSupported()
97
  {
98
    return false;
99
  }
100
 
101
  /**
102
   * Start a drag, given the DragGestureEvent that initiated the drag.
103
   *
104
   * @exception InvalidDnDOperationException If the Drag and Drop system is
105
   * unable to initiate a drag operation, or if the user attempts to start
106
   * a drag while an existing drag operation is still executing.
107
   */
108
  public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
109
                        Image dragImage, Point imageOffset,
110
                        Transferable trans, DragSourceListener dsl,
111
                        FlavorMap map)
112
  {
113
  }
114
 
115
  /**
116
   * Start a drag, given the DragGestureEvent that initiated the drag.
117
   *
118
   * @exception InvalidDnDOperationException If the Drag and Drop system is
119
   * unable to initiate a drag operation, or if the user attempts to start
120
   * a drag while an existing drag operation is still executing.
121
   */
122
  public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
123
                        Transferable trans, DragSourceListener dsl,
124
                        FlavorMap map)
125
  {
126
    startDrag(trigger, dragCursor, null, null, trans, dsl, map);
127
  }
128
 
129
  /**
130
   * Start a drag, given the DragGestureEvent that initiated the drag.
131
   *
132
   * @exception InvalidDnDOperationException If the Drag and Drop system is
133
   * unable to initiate a drag operation, or if the user attempts to start
134
   * a drag while an existing drag operation is still executing.
135
   */
136
  public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
137
                        Image dragImage, Point imageOffset,
138
                        Transferable trans, DragSourceListener dsl)
139
  {
140
    startDrag(trigger, dragCursor, dragImage, imageOffset, trans, dsl, null);
141
  }
142
 
143
  /**
144
   * Start a drag, given the DragGestureEvent that initiated the drag.
145
   *
146
   * @exception InvalidDnDOperationException If the Drag and Drop system is
147
   * unable to initiate a drag operation, or if the user attempts to start
148
   * a drag while an existing drag operation is still executing.
149
   */
150
  public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
151
                        Transferable trans, DragSourceListener dsl)
152
  {
153
    startDrag(trigger, dragCursor, null, null, trans, dsl, null);
154
  }
155
 
156
  /**
157
   * Creates the DragSourceContext to handle this drag.
158
   *
159
   * @exception IllegalArgumentException FIXME
160
   * @exception NullPointerException If dscp, dgl, dragImage or t is null.
161
   */
162
  protected DragSourceContext
163
    createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
164
                            Cursor cursor, Image image, Point offset,
165
                            Transferable t, DragSourceListener dsl)
166
  {
167
    return null;
168
  }
169
 
170
  public FlavorMap getFlavorMap()
171
  {
172
    return flavorMap;
173
  }
174
 
175
  public DragGestureRecognizer
176
    createDragGestureRecognizer(Class recognizer, Component c, int actions,
177
                                DragGestureListener dgl)
178
  {
179
    return Toolkit.getDefaultToolkit ()
180
                  .createDragGestureRecognizer (recognizer, this, c, actions,
181
                                                dgl);
182
  }
183
 
184
  public DragGestureRecognizer
185
    createDefaultDragGestureRecognizer(Component c, int actions,
186
                                       DragGestureListener dgl)
187
  {
188
    return createDragGestureRecognizer (MouseDragGestureRecognizer.class, c,
189
                                        actions, dgl);
190
  }
191
 
192
  /**
193
   * @since 1.4
194
   */
195
  public void addDragSourceListener(DragSourceListener l)
196
  {
197
    DnDEventMulticaster.add (dragSourceListener, l);
198
  }
199
 
200
  /**
201
   * @since 1.4
202
   */
203
  public void removeDragSourceListener(DragSourceListener l)
204
  {
205
    DnDEventMulticaster.remove (dragSourceListener, l);
206
  }
207
 
208
  /**
209
   * @since 1.4
210
   */
211
  public DragSourceListener[] getDragSourceListeners()
212
  {
213
    return (DragSourceListener[]) getListeners (DragSourceListener.class);
214
  }
215
 
216
  /**
217
   * @since 1.4
218
   */
219
  public void addDragSourceMotionListener(DragSourceMotionListener l)
220
  {
221
    DnDEventMulticaster.add (dragSourceMotionListener, l);
222
  }
223
 
224
  /**
225
   * @since 1.4
226
   */
227
  public void removeDragSourceMotionListener(DragSourceMotionListener l)
228
  {
229
    DnDEventMulticaster.remove (dragSourceMotionListener, l);
230
  }
231
 
232
  /**
233
   * @since 1.4
234
   */
235
  public DragSourceMotionListener[] getDragSourceMotionListeners ()
236
  {
237
    return (DragSourceMotionListener[]) getListeners
238
                                         (DragSourceMotionListener.class);
239
  }
240
 
241
  /**
242
   * @since 1.4
243
   */
244
  public EventListener[] getListeners (Class listenerType)
245
  {
246
    if (listenerType == DragSourceListener.class)
247
      return DnDEventMulticaster.getListeners (dragSourceListener,
248
                                               listenerType);
249
 
250
    if (listenerType == DragSourceMotionListener.class)
251
      return DnDEventMulticaster.getListeners (dragSourceMotionListener,
252
                                               listenerType);
253
 
254
    // Return an empty EventListener array.
255
    return new EventListener [0];
256
  }
257
} // class DragSource

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.