1. /*
  2. * @(#)DropTarget.java 1.46 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.dnd;
  8. import java.util.TooManyListenersException;
  9. import java.io.IOException;
  10. import java.io.ObjectInputStream;
  11. import java.io.ObjectOutputStream;
  12. import java.io.Serializable;
  13. import java.awt.AWTEvent;
  14. import java.awt.Component;
  15. import java.awt.Dimension;
  16. import java.awt.GraphicsEnvironment;
  17. import java.awt.HeadlessException;
  18. import java.awt.Insets;
  19. import java.awt.Point;
  20. import java.awt.Rectangle;
  21. import java.awt.Toolkit;
  22. import java.awt.event.ActionEvent;
  23. import java.awt.event.ActionListener;
  24. import java.awt.datatransfer.FlavorMap;
  25. import java.awt.datatransfer.SystemFlavorMap;
  26. import javax.swing.Timer;
  27. import java.awt.peer.ComponentPeer;
  28. import java.awt.peer.LightweightPeer;
  29. import java.awt.dnd.peer.DropTargetPeer;
  30. /**
  31. * The <code>DropTarget</code> is associated
  32. * with a <code>Component</code> when that <code>Component</code>
  33. * wishes
  34. * to accept drops during Drag and Drop operations.
  35. * <P>
  36. * Each
  37. * <code>DropTarget</code> is associated with a <code>FlavorMap</code>.
  38. * The default <code>FlavorMap</code> hereafter designates the
  39. * <code>FlavorMap</code> returned by <code>SystemFlavorMap.getDefaultFlavorMap()</code>.
  40. *
  41. * @version 1.46, 01/23/03
  42. * @since 1.2
  43. */
  44. public class DropTarget implements DropTargetListener, Serializable {
  45. private static final long serialVersionUID = -6283860791671019047L;
  46. /**
  47. * Creates a new DropTarget given the <code>Component</code>
  48. * to associate itself with, an <code>int</code> representing
  49. * the default acceptable action(s) to
  50. * support, a <code>DropTargetListener</code>
  51. * to handle event processing, a <code>boolean</code> indicating
  52. * if the <code>DropTarget</code> is currently accepting drops, and
  53. * a <code>FlavorMap</code> to use (or null for the default <CODE>FlavorMap</CODE>).
  54. * <P>
  55. * The Component will receive drops only if it is enabled.
  56. * @param c The <code>Component</code> with which this <code>DropTarget</code> is associated
  57. * @param ops The default acceptable actions for this <code>DropTarget</code>
  58. * @param dtl The <code>DropTargetListener</code> for this <code>DropTarget</code>
  59. * @param act Is the <code>DropTarget</code> accepting drops.
  60. * @param fm The <code>FlavorMap</code> to use, or null for the default <CODE>FlavorMap</CODE>
  61. * @exception HeadlessException if GraphicsEnvironment.isHeadless()
  62. * returns true
  63. * @see java.awt.GraphicsEnvironment#isHeadless
  64. */
  65. public DropTarget(Component c, int ops, DropTargetListener dtl,
  66. boolean act, FlavorMap fm)
  67. throws HeadlessException
  68. {
  69. if (GraphicsEnvironment.isHeadless()) {
  70. throw new HeadlessException();
  71. }
  72. component = c;
  73. setDefaultActions(ops);
  74. if (dtl != null) try {
  75. addDropTargetListener(dtl);
  76. } catch (TooManyListenersException tmle) {
  77. // do nothing!
  78. }
  79. if (c != null) {
  80. c.setDropTarget(this);
  81. setActive(act);
  82. }
  83. if (fm != null) flavorMap = fm;
  84. }
  85. /**
  86. * Creates a <code>DropTarget</code> given the <code>Component</code>
  87. * to associate itself with, an <code>int</code> representing
  88. * the default acceptable action(s)
  89. * to support, a <code>DropTargetListener</code>
  90. * to handle event processing, and a <code>boolean</code> indicating
  91. * if the <code>DropTarget</code> is currently accepting drops.
  92. * <P>
  93. * The Component will receive drops only if it is enabled.
  94. * @param c The <code>Component</code> with which this <code>DropTarget</code> is associated
  95. * @param ops The default acceptable actions for this <code>DropTarget</code>
  96. * @param dtl The <code>DropTargetListener</code> for this <code>DropTarget</code>
  97. * @param act Is the <code>DropTarget</code> accepting drops.
  98. * @exception HeadlessException if GraphicsEnvironment.isHeadless()
  99. * returns true
  100. * @see java.awt.GraphicsEnvironment#isHeadless
  101. */
  102. public DropTarget(Component c, int ops, DropTargetListener dtl,
  103. boolean act)
  104. throws HeadlessException
  105. {
  106. this(c, ops, dtl, act, null);
  107. }
  108. /**
  109. * Creates a <code>DropTarget</code>.
  110. * @exception HeadlessException if GraphicsEnvironment.isHeadless()
  111. * returns true
  112. * @see java.awt.GraphicsEnvironment#isHeadless
  113. */
  114. public DropTarget() throws HeadlessException {
  115. this(null, DnDConstants.ACTION_COPY_OR_MOVE, null, true, null);
  116. }
  117. /**
  118. * Creates a <code>DropTarget</code> given the <code>Component</code>
  119. * to associate itself with, and the <code>DropTargetListener</code>
  120. * to handle event processing.
  121. * <P>
  122. * The Component will receive drops only if it is enabled.
  123. * @param c The <code>Component</code> with which this <code>DropTarget</code> is associated
  124. * @param dtl The <code>DropTargetListener</code> for this <code>DropTarget</code>
  125. * @exception HeadlessException if GraphicsEnvironment.isHeadless()
  126. * returns true
  127. * @see java.awt.GraphicsEnvironment#isHeadless
  128. */
  129. public DropTarget(Component c, DropTargetListener dtl)
  130. throws HeadlessException
  131. {
  132. this(c, DnDConstants.ACTION_COPY_OR_MOVE, dtl, true, null);
  133. }
  134. /**
  135. * Creates a <code>DropTarget</code> given the <code>Component</code>
  136. * to associate itself with, an <code>int</code> representing
  137. * the default acceptable action(s) to support, and a
  138. * <code>DropTargetListener</code> to handle event processing.
  139. * <P>
  140. * The Component will receive drops only if it is enabled.
  141. * @param c The <code>Component</code> with which this <code>DropTarget</code> is associated
  142. * @param ops The default acceptable actions for this <code>DropTarget</code>
  143. * @param dtl The <code>DropTargetListener</code> for this <code>DropTarget</code>
  144. * @exception HeadlessException if GraphicsEnvironment.isHeadless()
  145. * returns true
  146. * @see java.awt.GraphicsEnvironment#isHeadless
  147. */
  148. public DropTarget(Component c, int ops, DropTargetListener dtl)
  149. throws HeadlessException
  150. {
  151. this(c, ops, dtl, true);
  152. }
  153. /**
  154. * Note: this interface is required to permit the safe association
  155. * of a DropTarget with a Component in one of two ways, either:
  156. * <code> component.setDropTarget(droptarget); </code>
  157. * or <code> droptarget.setComponent(component); </code>
  158. * <P>
  159. * The Component will receive drops only if it is enabled.
  160. * @param c The new <code>Component</code> this <code>DropTarget</code>
  161. * is to be associated with.<P>
  162. */
  163. public synchronized void setComponent(Component c) {
  164. if (component == c || component != null && component.equals(c))
  165. return;
  166. Component old;
  167. ComponentPeer oldPeer = null;
  168. if ((old = component) != null) {
  169. clearAutoscroll();
  170. component = null;
  171. if (componentPeer != null) {
  172. oldPeer = componentPeer;
  173. removeNotify(componentPeer);
  174. }
  175. old.setDropTarget(null);
  176. }
  177. if ((component = c) != null) try {
  178. c.setDropTarget(this);
  179. } catch (Exception e) { // undo the change
  180. if (old != null) {
  181. old.setDropTarget(this);
  182. addNotify(oldPeer);
  183. }
  184. }
  185. }
  186. /**
  187. * Gets the <code>Component</code> associated
  188. * with this <code>DropTarget</code>.
  189. * <P>
  190. * @return the current </code>Component</code>
  191. */
  192. public synchronized Component getComponent() {
  193. return component;
  194. }
  195. /**
  196. * Sets the default acceptable actions for this <code>DropTarget</code>
  197. * <P>
  198. * @param ops the default actions
  199. * <P>
  200. * @see java.awt.dnd.DnDConstants
  201. */
  202. public void setDefaultActions(int ops) {
  203. getDropTargetContext().setTargetActions(ops & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_REFERENCE));
  204. }
  205. /*
  206. * Called by DropTargetContext.setTargetActions()
  207. * with appropriate synchronization.
  208. */
  209. void doSetDefaultActions(int ops) {
  210. actions = ops;
  211. }
  212. /**
  213. * Gets an <code>int</code> representing the
  214. * current action(s) supported by this <code>DropTarget</code>.
  215. * <P>
  216. * @return the current default actions
  217. */
  218. public int getDefaultActions() {
  219. return actions;
  220. }
  221. /**
  222. * Sets the DropTarget active if <code>true</code>,
  223. * inactive if <code>false</code>.
  224. * <P>
  225. * @param isActive sets the <code>DropTarget</code> (in)active.
  226. */
  227. public synchronized void setActive(boolean isActive) {
  228. if (isActive != active) {
  229. active = isActive;
  230. }
  231. if (!active) clearAutoscroll();
  232. }
  233. /**
  234. * Reports whether or not
  235. * this <code>DropTarget</code>
  236. * is currently active (ready to accept drops).
  237. * <P>
  238. * @return <CODE>true</CODE> if active, <CODE>false</CODE> if not
  239. */
  240. public boolean isActive() {
  241. return active;
  242. }
  243. /**
  244. * Adds a new <code>DropTargetListener</code> (UNICAST SOURCE).
  245. * <P>
  246. * @param dtl The new <code>DropTargetListener</code>
  247. * <P>
  248. * @throws <code>TooManyListenersException</code> if a
  249. * <code>DropTargetListener</code> is already added to this
  250. * <code>DropTarget</code>.
  251. */
  252. public synchronized void addDropTargetListener(DropTargetListener dtl) throws TooManyListenersException {
  253. if (dtl == null) return;
  254. if (equals(dtl)) throw new IllegalArgumentException("DropTarget may not be its own Listener");
  255. if (dtListener == null)
  256. dtListener = dtl;
  257. else
  258. throw new TooManyListenersException();
  259. }
  260. /**
  261. * Removes the current <code>DropTargetListener</code> (UNICAST SOURCE).
  262. * <P>
  263. * @param dtl the DropTargetListener to deregister.
  264. */
  265. public synchronized void removeDropTargetListener(DropTargetListener dtl) {
  266. if (dtl != null && dtListener != null) {
  267. if(dtListener.equals(dtl))
  268. dtListener = null;
  269. else
  270. throw new IllegalArgumentException("listener mismatch");
  271. }
  272. }
  273. /**
  274. * The <code>DropTarget</code> intercepts
  275. * dragEnter() notifications before the
  276. * registered <code>DropTargetListener</code> gets them.
  277. * <P>
  278. * @param dtde the <code>DropTargetDragEvent</code>
  279. */
  280. public synchronized void dragEnter(DropTargetDragEvent dtde) {
  281. if (!active) return;
  282. if (dtListener != null) {
  283. dtListener.dragEnter(dtde);
  284. } else
  285. dtde.getDropTargetContext().setTargetActions(DnDConstants.ACTION_NONE);
  286. initializeAutoscrolling(dtde.getLocation());
  287. }
  288. /**
  289. * The <code>DropTarget</code>
  290. * intercepts dragOver() notifications before the
  291. * registered <code>DropTargetListener</code> gets them.
  292. * <P>
  293. * @param dtde the <code>DropTargetDragEvent</code>
  294. */
  295. public synchronized void dragOver(DropTargetDragEvent dtde) {
  296. if (!active) return;
  297. if (dtListener != null && active) dtListener.dragOver(dtde);
  298. updateAutoscroll(dtde.getLocation());
  299. }
  300. /**
  301. * The <code>DropTarget</code> intercepts
  302. * dropActionChanged() notifications before the
  303. * registered <code>DropTargetListener</code> gets them.
  304. * <P>
  305. * @param dtde the DropTargetDragEvent
  306. */
  307. public synchronized void dropActionChanged(DropTargetDragEvent dtde) {
  308. if (!active) return;
  309. if (dtListener != null) dtListener.dropActionChanged(dtde);
  310. updateAutoscroll(dtde.getLocation());
  311. }
  312. /**
  313. * The <code>DropTarget</code> intercepts
  314. * dragExit() notifications before the
  315. * registered <code>DropTargetListener</code> gets them.
  316. * <P>
  317. * @param dte the <code>DropTargetEvent</code>
  318. */
  319. public synchronized void dragExit(DropTargetEvent dte) {
  320. if (!active) return;
  321. if (dtListener != null && active) dtListener.dragExit(dte);
  322. clearAutoscroll();
  323. }
  324. /**
  325. * The <code>DropTarget</code> intercepts drop() notifications before the
  326. * registered <code>DropTargetListener</code> gets them.
  327. * <P>
  328. * @param dtde the <code>DropTargetDropEvent</code>
  329. */
  330. public synchronized void drop(DropTargetDropEvent dtde) {
  331. clearAutoscroll();
  332. if (dtListener != null && active)
  333. dtListener.drop(dtde);
  334. else { // we should'nt get here ...
  335. dtde.rejectDrop();
  336. }
  337. }
  338. /**
  339. * Gets the <code>FlavorMap</code>
  340. * associated with this <code>DropTarget</code>.
  341. * If no <code>FlavorMap</code> has been set for this
  342. * <code>DropTarget</code>, it is associated with the default
  343. * <code>FlavorMap</code>.
  344. * <P>
  345. * @return the FlavorMap for this DropTarget
  346. */
  347. public FlavorMap getFlavorMap() { return flavorMap; }
  348. /**
  349. * Sets the <code>FlavorMap</code> associated
  350. * with this <code>DropTarget</code>.
  351. * <P>
  352. * @param fm the new <code>FlavorMap</code>, or null to
  353. * associate the default FlavorMap with this DropTarget.
  354. */
  355. public void setFlavorMap(FlavorMap fm) {
  356. flavorMap = fm == null ? SystemFlavorMap.getDefaultFlavorMap() : fm;
  357. }
  358. /**
  359. * Notify the DropTarget that it has been associated with a Component
  360. *
  361. **********************************************************************
  362. * This method is usually called from java.awt.Component.addNotify() of
  363. * the Component associated with this DropTarget to notify the DropTarget
  364. * that a ComponentPeer has been associated with that Component.
  365. *
  366. * Calling this method, other than to notify this DropTarget of the
  367. * association of the ComponentPeer with the Component may result in
  368. * a malfunction of the DnD system.
  369. **********************************************************************
  370. * <P>
  371. * @param peer The Peer of the Component we are associated with!
  372. *
  373. */
  374. public void addNotify(ComponentPeer peer) {
  375. if (peer == componentPeer) return;
  376. componentPeer = peer;
  377. for (Component c = component;
  378. c != null && peer instanceof LightweightPeer; c = c.getParent()) {
  379. peer = c.getPeer();
  380. }
  381. if (peer instanceof DropTargetPeer) {
  382. nativePeer = peer;
  383. ((DropTargetPeer)peer).addDropTarget(this);
  384. } else {
  385. nativePeer = null;
  386. }
  387. }
  388. /**
  389. * Notify the DropTarget that it has been disassociated from a Component
  390. *
  391. **********************************************************************
  392. * This method is usually called from java.awt.Component.removeNotify() of
  393. * the Component associated with this DropTarget to notify the DropTarget
  394. * that a ComponentPeer has been disassociated with that Component.
  395. *
  396. * Calling this method, other than to notify this DropTarget of the
  397. * disassociation of the ComponentPeer from the Component may result in
  398. * a malfunction of the DnD system.
  399. **********************************************************************
  400. * <P>
  401. * @param peer The Peer of the Component we are being disassociated from!
  402. */
  403. public void removeNotify(ComponentPeer peer) {
  404. if (nativePeer != null)
  405. ((DropTargetPeer)nativePeer).removeDropTarget(this);
  406. componentPeer = nativePeer = null;
  407. }
  408. /**
  409. * Gets the <code>DropTargetContext</code> associated
  410. * with this <code>DropTarget</code>.
  411. * <P>
  412. * @return the <code>DropTargetContext</code> associated with this <code>DropTarget</code>.
  413. */
  414. public DropTargetContext getDropTargetContext() {
  415. return dropTargetContext;
  416. }
  417. /**
  418. * Creates the DropTargetContext associated with this DropTarget.
  419. * Subclasses may override this method to instantiate their own
  420. * DropTargetContext subclass.
  421. *
  422. * This call is typically *only* called by the platform's
  423. * DropTargetContextPeer as a drag operation encounters this
  424. * DropTarget. Accessing the Context while no Drag is current
  425. * has undefined results.
  426. */
  427. protected DropTargetContext createDropTargetContext() {
  428. return new DropTargetContext(this);
  429. }
  430. /**
  431. * Serializes this <code>DropTarget</code>. Performs default serialization,
  432. * and then writes out this object's <code>DropTargetListener</code> if and
  433. * only if it can be serialized. If not, <code>null</code> is written
  434. * instead.
  435. *
  436. * @serialData The default serializable fields, in alphabetical order,
  437. * followed by either a <code>DropTargetListener</code>
  438. * instance, or <code>null</code>.
  439. * @since 1.4
  440. */
  441. private void writeObject(ObjectOutputStream s) throws IOException {
  442. s.defaultWriteObject();
  443. s.writeObject(SerializationTester.test(dtListener)
  444. ? dtListener : null);
  445. }
  446. /**
  447. * Deserializes this <code>DropTarget</code>. This method first performs
  448. * default deserialization for all non-<code>transient</code> fields. An
  449. * attempt is then made to deserialize this object's
  450. * <code>DropTargetListener</code> as well. This is first attempted by
  451. * deserializing the field <code>dtListener</code>, because, in releases
  452. * prior to 1.4, a non-<code>transient</code> field of this name stored the
  453. * <code>DropTargetListener</code>. If this fails, the next object in the
  454. * stream is used instead.
  455. *
  456. * @since 1.4
  457. */
  458. private void readObject(ObjectInputStream s)
  459. throws ClassNotFoundException, IOException
  460. {
  461. ObjectInputStream.GetField f = s.readFields();
  462. try {
  463. dropTargetContext =
  464. (DropTargetContext)f.get("dropTargetContext", null);
  465. } catch (IllegalArgumentException e) {
  466. // Pre-1.4 support. 'dropTargetContext' was previoulsy transient
  467. }
  468. if (dropTargetContext == null) {
  469. dropTargetContext = createDropTargetContext();
  470. }
  471. component = (Component)f.get("component", null);
  472. actions = f.get("actions", DnDConstants.ACTION_COPY_OR_MOVE);
  473. active = f.get("active", true);
  474. // Pre-1.4 support. 'dtListener' was previously non-transient
  475. try {
  476. dtListener = (DropTargetListener)f.get("dtListener", null);
  477. } catch (IllegalArgumentException e) {
  478. // 1.4-compatible byte stream. 'dtListener' was written explicitly
  479. dtListener = (DropTargetListener)s.readObject();
  480. }
  481. }
  482. /*********************************************************************/
  483. /**
  484. * this protected nested class implements autoscrolling
  485. */
  486. protected static class DropTargetAutoScroller implements ActionListener {
  487. /**
  488. * construct a DropTargetAutoScroller
  489. * <P>
  490. * @param c the <code>Component</code>
  491. * @param p the <code>Point</code>
  492. */
  493. protected DropTargetAutoScroller(Component c, Point p) {
  494. super();
  495. component = c;
  496. autoScroll = (Autoscroll)component;
  497. Toolkit t = Toolkit.getDefaultToolkit();
  498. Integer initial = new Integer(100);
  499. Integer interval = new Integer(100);
  500. try {
  501. initial = (Integer)t.getDesktopProperty("DnD.Autoscroll.initialDelay");
  502. } catch (Exception e) {
  503. // ignore
  504. }
  505. try {
  506. interval = (Integer)t.getDesktopProperty("DnD.Autoscroll.interval");
  507. } catch (Exception e) {
  508. // ignore
  509. }
  510. timer = new Timer(interval.intValue(), this);
  511. timer.setCoalesce(true);
  512. timer.setInitialDelay(initial.intValue());
  513. locn = p;
  514. prev = p;
  515. try {
  516. hysteresis = ((Integer)t.getDesktopProperty("DnD.Autoscroll.cursorHysteresis")).intValue();
  517. } catch (Exception e) {
  518. // ignore
  519. }
  520. timer.start();
  521. }
  522. /**
  523. * update the geometry of the autoscroll region
  524. */
  525. private void updateRegion() {
  526. Insets i = autoScroll.getAutoscrollInsets();
  527. Dimension size = component.getSize();
  528. if (size.width != outer.width || size.height != outer.height)
  529. outer.reshape(0, 0, size.width, size.height);
  530. if (inner.x != i.left || inner.y != i.top)
  531. inner.setLocation(i.left, i.top);
  532. int newWidth = size.width - (i.left + i.right);
  533. int newHeight = size.height - (i.top + i.bottom);
  534. if (newWidth != inner.width || newHeight != inner.height)
  535. inner.setSize(newWidth, newHeight);
  536. }
  537. /**
  538. * cause autoscroll to occur
  539. * <P>
  540. * @param newLocn the <code>Point</code>
  541. */
  542. protected synchronized void updateLocation(Point newLocn) {
  543. prev = locn;
  544. locn = newLocn;
  545. if (Math.abs(locn.x - prev.x) > hysteresis ||
  546. Math.abs(locn.y - prev.y) > hysteresis) {
  547. if (timer.isRunning()) timer.stop();
  548. } else {
  549. if (!timer.isRunning()) timer.start();
  550. }
  551. }
  552. /**
  553. * cause autoscrolling to stop
  554. */
  555. protected void stop() { timer.stop(); }
  556. /**
  557. * cause autoscroll to occur
  558. * <P>
  559. * @param e the <code>ActionEvent</code>
  560. */
  561. public synchronized void actionPerformed(ActionEvent e) {
  562. updateRegion();
  563. if (outer.contains(locn) && !inner.contains(locn))
  564. autoScroll.autoscroll(locn);
  565. }
  566. /*
  567. * fields
  568. */
  569. private Component component;
  570. private Autoscroll autoScroll;
  571. private Timer timer;
  572. private Point locn;
  573. private Point prev;
  574. private Rectangle outer = new Rectangle();
  575. private Rectangle inner = new Rectangle();
  576. private int hysteresis = 10;
  577. }
  578. /*********************************************************************/
  579. /**
  580. * create an embedded autoscroller
  581. * <P>
  582. * @param c the <code>Component</code>
  583. * @param p the <code>Point</code>
  584. */
  585. protected DropTargetAutoScroller createDropTargetAutoScroller(Component c, Point p) {
  586. return new DropTargetAutoScroller(c, p);
  587. }
  588. /**
  589. * initialize autoscrolling
  590. * <P>
  591. * @param p the <code>Point</code>
  592. */
  593. protected void initializeAutoscrolling(Point p) {
  594. if (component == null || !(component instanceof Autoscroll)) return;
  595. autoScroller = createDropTargetAutoScroller(component, p);
  596. }
  597. /**
  598. * update autoscrolling with current cursor locn
  599. * <P>
  600. * @param dragCursorLocn the <code>Point</code>
  601. */
  602. protected void updateAutoscroll(Point dragCursorLocn) {
  603. if (autoScroller != null) autoScroller.updateLocation(dragCursorLocn);
  604. }
  605. /**
  606. * clear autoscrolling
  607. */
  608. protected void clearAutoscroll() {
  609. if (autoScroller != null) {
  610. autoScroller.stop();
  611. autoScroller = null;
  612. }
  613. }
  614. /**
  615. * The DropTargetContext associated with this DropTarget.
  616. *
  617. * @serial
  618. */
  619. private DropTargetContext dropTargetContext = createDropTargetContext();
  620. /**
  621. * The Component associated with this DropTarget.
  622. *
  623. * @serial
  624. */
  625. private Component component;
  626. /*
  627. * That Component's Peer
  628. */
  629. private transient ComponentPeer componentPeer;
  630. /*
  631. * That Component's "native" Peer
  632. */
  633. private transient ComponentPeer nativePeer;
  634. /**
  635. * Default permissible actions supported by this DropTarget.
  636. *
  637. * @see #setDefaultActions
  638. * @see #getDefaultActions
  639. * @serial
  640. */
  641. int actions = DnDConstants.ACTION_COPY_OR_MOVE;
  642. /**
  643. * <code>true</code> if the DropTarget is accepting Drag & Drop operations.
  644. *
  645. * @serial
  646. */
  647. boolean active = true;
  648. /*
  649. * the auto scrolling object
  650. */
  651. private transient DropTargetAutoScroller autoScroller;
  652. /*
  653. * The delegate
  654. */
  655. private transient DropTargetListener dtListener;
  656. /*
  657. * The FlavorMap
  658. */
  659. private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap();
  660. }