View Javadoc

1   /*
2    * @(#) SimpleDragSourceListener.java Oct 17, 2003
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  package nl.tudelft.simulation.naming.context;
11  
12  import java.awt.dnd.DragSource;
13  import java.awt.dnd.DragSourceContext;
14  import java.awt.dnd.DragSourceDragEvent;
15  import java.awt.dnd.DragSourceDropEvent;
16  import java.awt.dnd.DragSourceEvent;
17  import java.awt.dnd.DragSourceListener;
18  
19  /***
20   * A DragSourceListener listens to context objects selected for DndDrop
21   * operations.
22   * <p>
23   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
24   * University of Technology </a>, the Netherlands. <br>
25   * See for project information <a href="http://www.simulation.tudelft.nl">
26   * www.simulation.tudelft.nl </a> <br>
27   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
28   * License (GPL) </a>, no warranty <br>
29   * 
30   * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
31   *         Jacobs </a>
32   * @version 1.2 2004-03-24
33   * @since 1.0
34   */
35  public class SimpleDragSourceListener implements DragSourceListener
36  {
37  	/***
38  	 * constructs a new SimpleDragSourceListener
39  	 */
40  	public SimpleDragSourceListener()
41  	{
42  		super();
43  	}
44  
45  	/***
46  	 * @see java.awt.dnd.DragSourceListener
47  	 *      #dragEnter(java.awt.dnd.DragSourceDragEvent)
48  	 */
49  	public void dragEnter(final DragSourceDragEvent dsde)
50  	{
51  		DragSourceContext context = dsde.getDragSourceContext();
52  		context.setCursor(DragSource.DefaultCopyDrop);
53  	}
54  
55  	/***
56  	 * @see java.awt.dnd.DragSourceListener
57  	 *      #dragOver(java.awt.dnd.DragSourceDragEvent)
58  	 */
59  	public void dragOver(final DragSourceDragEvent dsde)
60  	{
61  		DragSourceContext context = dsde.getDragSourceContext();
62  		context.setCursor(DragSource.DefaultCopyDrop);
63  	}
64  
65  	/***
66  	 * @see java.awt.dnd.DragSourceListener
67  	 *      #dropActionChanged(java.awt.dnd.DragSourceDragEvent)
68  	 */
69  	public void dropActionChanged(final DragSourceDragEvent dsde)
70  	{
71  		DragSourceContext context = dsde.getDragSourceContext();
72  		context.setCursor(DragSource.DefaultCopyDrop);
73  	}
74  
75  	/***
76  	 * @see java.awt.dnd.DragSourceListener
77  	 *      #dragExit(java.awt.dnd.DragSourceEvent)
78  	 */
79  	public void dragExit(final DragSourceEvent dse)
80  	{
81  		DragSourceContext context = dse.getDragSourceContext();
82  		context.setCursor(DragSource.DefaultCopyDrop);
83  	}
84  
85  	/***
86  	 * @see java.awt.dnd.DragSourceListener
87  	 *      #dragDropEnd(java.awt.dnd.DragSourceDropEvent)
88  	 */
89  	public void dragDropEnd(final DragSourceDropEvent dsde)
90  	{
91  		DragSourceContext context = dsde.getDragSourceContext();
92  		context.setCursor(DragSource.DefaultCopyDrop);
93  	}
94  }