Initial revision

From-SVN: r102074
This commit is contained in:
Tom Tromey
2005-07-16 00:30:23 +00:00
parent 6f4434b39b
commit f911ba985a
4557 changed files with 1000262 additions and 0 deletions
@@ -0,0 +1,70 @@
/* Autoscroll.java --
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Insets;
import java.awt.Point;
/**
* During DnD operations it is possible that a user may wish to drop the
* subject of the operation on a region of a scrollable GUI control that
* is not currently visible to the user.
*
* @author Michael Koch (konqueror@gmx.de)
* @since 1.2
* @status updated to 1.4
*/
public interface Autoscroll
{
/**
* This method returns the Insets describing the autoscrolling region or
* border relative to the geometry of the implementing Component
*/
Insets getAutoscrollInsets ();
/**
* Notify the Component to autoscroll
*
* @param location A Point indicating the location of the cursor that
* triggered this operation
*/
void autoscroll (Point location);
} // interface Autoscroll
@@ -0,0 +1,77 @@
/* DnDConstants.java -- constants for drag-and-drop operations
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
/**
* This class contains various constants used in drag-and-drop operations.
* Why it is not an interface is beyond me.
*
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
public final class DnDConstants
{
/** No action takes place. */
public static final int ACTION_NONE = 0;
/** The copy action. */
public static final int ACTION_COPY = 1;
/** The move action. */
public static final int ACTION_MOVE = 2;
/** Either a copy or a move. */
public static final int ACTION_COPY_OR_MOVE = 3;
/**
* A link action. This does not copy or move, but creates a reference back
* to the original. However, since platforms differ on how a reference should
* behave, this action is not recommended for common use.
*/
public static final int ACTION_LINK = 1073741824;
/** A synonym for {@link #ACTION_LINK}. */
public static final int ACTION_REFERENCE = ACTION_LINK;
private DnDConstants()
{
// Do nothing here.
}
}
@@ -0,0 +1,74 @@
/* DnDEventMulticaster.java -- helper class for listener chains in java.awt.dnd
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.AWTEventMulticaster;
import java.util.EventListener;
class DnDEventMulticaster extends AWTEventMulticaster
{
protected DnDEventMulticaster (EventListener a, EventListener b)
{
super (a, b);
}
public static DragSourceListener add (DragSourceListener a,
DragSourceListener b)
{
return (DragSourceListener) addInternal (a, b);
}
public static DragSourceMotionListener add (DragSourceMotionListener a,
DragSourceMotionListener b)
{
return (DragSourceMotionListener) addInternal (a, b);
}
public static DragSourceListener remove (DragSourceListener a,
DragSourceListener b)
{
return (DragSourceListener) removeInternal (a, b);
}
public static DragSourceMotionListener remove (DragSourceMotionListener a,
DragSourceMotionListener b)
{
return (DragSourceMotionListener) removeInternal (a, b);
}
}
@@ -0,0 +1,156 @@
/* DragGestureEvent.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Image;
import java.awt.Point;
import java.awt.datatransfer.Transferable;
import java.awt.event.InputEvent;
import java.util.EventObject;
import java.util.Iterator;
import java.util.List;
/**
* STUBBED
* @see DragGestureRecognizer
* @see DragGestureListener
* @see DragSource
* @since 1.2
*/
public class DragGestureEvent extends EventObject
{
/**
* Compatible with JDK 1.2+.
*/
private static final long serialVersionUID = 9080172649166731306L;
private DragSource dragSource;
private Component component;
private final Point origin;
private final int action;
public DragGestureEvent(DragGestureRecognizer dgr, int action, Point origin,
List events)
{
super(dgr);
if (origin == null || events == null)
throw new IllegalArgumentException();
this.origin = origin;
this.action = action;
}
public DragGestureRecognizer getSourceAsDragGestureRecognizer()
{
return (DragGestureRecognizer) source;
}
public Component getComponent()
{
return null;
}
public DragSource getDragSource()
{
return null;
}
public Point getDragOrigin()
{
return origin;
}
public Iterator iterator()
{
return null;
}
public Object[] toArray()
{
return null;
}
public Object[] toArray(Object[] array)
{
return array;
}
public int getDragAction()
{
return 0;
}
public InputEvent getTriggerEvent()
{
return null;
}
/**
* Starts the drag given the initial Cursor to display, the Transferable
* object, and the DragSourceListener to use.
*
* @exception InvalidDnDOperationException If the Drag and Drop system is
* unable to initiate a drag operation, or if the user attempts to start
* a drag while an existing drag operation is still executing.
*/
public void startDrag(Cursor dragCursor, Transferable trans)
{
startDrag(dragCursor, null, null, trans, null);
}
/**
* Starts the drag given the initial Cursor to display, the Transferable
* object, and the DragSourceListener to use.
*
* @exception InvalidDnDOperationException If the Drag and Drop system is
* unable to initiate a drag operation, or if the user attempts to start
* a drag while an existing drag operation is still executing.
*/
public void startDrag(Cursor dragCursor, Transferable trans,
DragSourceListener l)
{
startDrag(dragCursor, null, null, trans, l);
}
/**
* Starts the drag given the initial Cursor to display, the Transferable
* object, and the DragSourceListener to use.
*
* @exception InvalidDnDOperationException If the Drag and Drop system is
* unable to initiate a drag operation, or if the user attempts to start
* a drag while an existing drag operation is still executing.
*/
public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset,
Transferable trans, DragSourceListener l)
{
}
} // class DragGestureEvent
@@ -0,0 +1,63 @@
/* DragGestureListener.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.util.EventListener;
/**
* This is a listener for starting a drag-and-drop gesture. Upon receiving
* notification, the implementor then starts the drag operation.
*
* @author Eric Blake (ebb9@email.byu.edu)
* @see DragGestureRecognizer
* @see DragGestureEvent
* @see DragSource
* @since 1.2
* @status updated to 1.4
*/
public interface DragGestureListener extends EventListener
{
/**
* Called when the native platform notifies the virtual machine that a
* drag-and-drop has been initiated.
*
* @param e the event
*/
void dragGestureRecognized(DragGestureEvent e);
} // interface DragGestureListener
@@ -0,0 +1,179 @@
/* DragGestureRecognizer.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Component;
import java.awt.Point;
import java.awt.event.InputEvent;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.TooManyListenersException;
/**
* STUBBED
* @since 1.2
*/
public abstract class DragGestureRecognizer implements Serializable
{
/**
* Compatible with JDK 1.2+.
*/
private static final long serialVersionUID = 8996673345831063337L;
protected DragSource dragSource;
protected Component component;
protected transient DragGestureListener dragGestureListener;
protected int sourceActions;
protected ArrayList events = new ArrayList();
protected DragGestureRecognizer(DragSource ds, Component c, int sa,
DragGestureListener dgl)
{
if (ds == null)
throw new IllegalArgumentException();
dragSource = ds;
component = c;
sourceActions = sa;
dragGestureListener = dgl;
}
protected DragGestureRecognizer(DragSource ds, Component c, int sa)
{
this(ds, c, sa, null);
}
protected DragGestureRecognizer(DragSource ds, Component c)
{
this(ds, c, 0, null);
}
protected DragGestureRecognizer(DragSource ds)
{
this(ds, null, 0, null);
}
protected abstract void registerListeners();
protected abstract void unregisterListeners();
public DragSource getDragSource()
{
return dragSource;
}
public Component getComponent()
{
return component;
}
public void setComponent(Component c)
{
component = c;
}
public int getSourceActions()
{
return sourceActions;
}
public void setSourceActions(int sa)
{
sourceActions = sa;
}
public InputEvent getTriggerEvent()
{
return events.size() > 0 ? (InputEvent) events.get(0) : null;
}
public void resetRecognizer()
{
throw new Error("not implemented");
}
/**
* Register a new DragGestureListener.
*
* @exception TooManyListenersException If a DragGestureListener has already
* been added.
*/
public void addDragGestureListener(DragGestureListener dgl)
throws TooManyListenersException
{
if (dragGestureListener != null)
throw new TooManyListenersException();
dragGestureListener = dgl;
}
public void removeDragGestureListener(DragGestureListener dgl)
{
if (dragGestureListener != dgl)
throw new IllegalArgumentException();
dragGestureListener = null;
}
protected void fireDragGestureRecognized(int dragAction, Point p)
{
throw new Error("not implemented");
}
protected void appendEvent(InputEvent e)
{
if (e == null)
return;
events.add(e);
}
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException
{
s.defaultReadObject();
dragGestureListener = (DragGestureListener) s.readObject();
}
private void writeObject(ObjectOutputStream s) throws IOException
{
s.defaultWriteObject();
s.writeObject(dragGestureListener instanceof Serializable
? dragGestureListener : null);
}
} // class DragGestureRecognizer
@@ -0,0 +1,257 @@
/* DragSource.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.datatransfer.FlavorMap;
import java.awt.datatransfer.SystemFlavorMap;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.peer.DragSourceContextPeer;
import java.io.Serializable;
import java.util.EventListener;
/**
* @since 1.2
*/
public class DragSource implements Serializable
{
/**
* Compatible with JDK 1.2+.
*/
private static final long serialVersionUID = 6236096958971414066L;
public static final Cursor DefaultCopyDrop = null;
public static final Cursor DefaultMoveDrop = null;
public static final Cursor DefaultLinkDrop = null;
public static final Cursor DefaultCopyNoDrop = null;
public static final Cursor DefaultMoveNoDrop = null;
public static final Cursor DefaultLinkNoDrop = null;
private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap ();
private transient DragSourceListener dragSourceListener;
private transient DragSourceMotionListener dragSourceMotionListener;
/**
* Initializes the drag source.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public DragSource()
{
if (GraphicsEnvironment.isHeadless())
throw new HeadlessException ();
}
/**
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public static DragSource getDefaultDragSource()
{
return null;
}
public static boolean isDragImageSupported()
{
return false;
}
/**
* Start a drag, given the DragGestureEvent that initiated the drag.
*
* @exception InvalidDnDOperationException If the Drag and Drop system is
* unable to initiate a drag operation, or if the user attempts to start
* a drag while an existing drag operation is still executing.
*/
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Image dragImage, Point imageOffset,
Transferable trans, DragSourceListener dsl,
FlavorMap map)
{
}
/**
* Start a drag, given the DragGestureEvent that initiated the drag.
*
* @exception InvalidDnDOperationException If the Drag and Drop system is
* unable to initiate a drag operation, or if the user attempts to start
* a drag while an existing drag operation is still executing.
*/
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Transferable trans, DragSourceListener dsl,
FlavorMap map)
{
startDrag(trigger, dragCursor, null, null, trans, dsl, map);
}
/**
* Start a drag, given the DragGestureEvent that initiated the drag.
*
* @exception InvalidDnDOperationException If the Drag and Drop system is
* unable to initiate a drag operation, or if the user attempts to start
* a drag while an existing drag operation is still executing.
*/
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Image dragImage, Point imageOffset,
Transferable trans, DragSourceListener dsl)
{
startDrag(trigger, dragCursor, dragImage, imageOffset, trans, dsl, null);
}
/**
* Start a drag, given the DragGestureEvent that initiated the drag.
*
* @exception InvalidDnDOperationException If the Drag and Drop system is
* unable to initiate a drag operation, or if the user attempts to start
* a drag while an existing drag operation is still executing.
*/
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Transferable trans, DragSourceListener dsl)
{
startDrag(trigger, dragCursor, null, null, trans, dsl, null);
}
/**
* Creates the DragSourceContext to handle this drag.
*
* @exception IllegalArgumentException FIXME
* @exception NullPointerException If dscp, dgl, dragImage or t is null.
*/
protected DragSourceContext
createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
Cursor cursor, Image image, Point offset,
Transferable t, DragSourceListener dsl)
{
return null;
}
public FlavorMap getFlavorMap()
{
return flavorMap;
}
public DragGestureRecognizer
createDragGestureRecognizer(Class recognizer, Component c, int actions,
DragGestureListener dgl)
{
return Toolkit.getDefaultToolkit ()
.createDragGestureRecognizer (recognizer, this, c, actions,
dgl);
}
public DragGestureRecognizer
createDefaultDragGestureRecognizer(Component c, int actions,
DragGestureListener dgl)
{
return createDragGestureRecognizer (MouseDragGestureRecognizer.class, c,
actions, dgl);
}
/**
* @since 1.4
*/
public void addDragSourceListener(DragSourceListener l)
{
DnDEventMulticaster.add (dragSourceListener, l);
}
/**
* @since 1.4
*/
public void removeDragSourceListener(DragSourceListener l)
{
DnDEventMulticaster.remove (dragSourceListener, l);
}
/**
* @since 1.4
*/
public DragSourceListener[] getDragSourceListeners()
{
return (DragSourceListener[]) getListeners (DragSourceListener.class);
}
/**
* @since 1.4
*/
public void addDragSourceMotionListener(DragSourceMotionListener l)
{
DnDEventMulticaster.add (dragSourceMotionListener, l);
}
/**
* @since 1.4
*/
public void removeDragSourceMotionListener(DragSourceMotionListener l)
{
DnDEventMulticaster.remove (dragSourceMotionListener, l);
}
/**
* @since 1.4
*/
public DragSourceMotionListener[] getDragSourceMotionListeners ()
{
return (DragSourceMotionListener[]) getListeners
(DragSourceMotionListener.class);
}
/**
* @since 1.4
*/
public EventListener[] getListeners (Class listenerType)
{
if (listenerType == DragSourceListener.class)
return DnDEventMulticaster.getListeners (dragSourceListener,
listenerType);
if (listenerType == DragSourceMotionListener.class)
return DnDEventMulticaster.getListeners (dragSourceMotionListener,
listenerType);
// Return an empty EventListener array.
return new EventListener [0];
}
} // class DragSource
@@ -0,0 +1,126 @@
/* DragSourceAdapter.java -- drag-and-drop listener adapter
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
/**
* This class implements <code>DragSourceListener</code> and
* <code>DragSourceMotionListener</code>, and implements all methods
* with empty bodies. This allows a listener interested in implementing only
* a subset of these interfaces to extend this class and override only the
* desired methods.
*
* @author Eric Blake (ebb9@email.byu.edu)
* @see DragSourceEvent
* @see DragSourceListener
* @see DragSourceMotionListener
* @since 1.4
* @status updated to 1.4
*/
public abstract class DragSourceAdapter
implements DragSourceListener, DragSourceMotionListener
{
/**
* Default constructor.
*/
public DragSourceAdapter()
{
}
/**
* Called when the cursor hotspot enters a drop site which will accept the
* drag.
*
* @param e the event
*/
public void dragEnter(DragSourceDragEvent e)
{
}
/**
* Called when the cursor hotspot moves inside of a drop site which will
* accept the drag.
*
* @param e the event
*/
public void dragOver(DragSourceDragEvent e)
{
}
/**
* Called whenever the mouse is moved during a drag-and-drop operation.
*
* @param e the event
*/
public void dragMouseMoved(DragSourceDragEvent e)
{
}
/**
* Called when the user modifies the drop gesture. This is often the case
* when additional mouse or key events are received during the drag.
*
* @param e the event
*/
public void dropActionChanged(DragSourceDragEvent e)
{
}
/**
* Called when the cursor hotspot moves outside of a drop site which will
* accept the drag. This could also happen if the drop site is no longer
* active, or no longer accepts the drag.
*
* @param e the event
*/
public void dragExit(DragSourceEvent e)
{
}
/**
* Called when the drag and drop operation is complete. After this event,
* <code>getDropSuccess</code> of the event is valid, and
* <code>getDropAction</code> holds the action requested by the drop site.
* Furthermore, the <code>DragSourceContext</code> is invalidated.
*
* @param e the event
*/
public void dragDropEnd(DragSourceDropEvent e)
{
}
} // class DragSourceAdapter
@@ -0,0 +1,200 @@
/* DragSourceContext.java --
Copyright (C) 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Image;
import java.awt.Point;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.peer.DragSourceContextPeer;
import java.io.Serializable;
import java.util.TooManyListenersException;
/**
* @since 1.2
*/
public class DragSourceContext
implements DragSourceListener, DragSourceMotionListener, Serializable
{
/**
* Compatible with JDK 1.2+
*/
static final long serialVersionUID = -115407898692194719L;
protected static final int DEFAULT = 0;
protected static final int ENTER = 1;
protected static final int OVER = 2;
protected static final int CHANGED = 3;
private DragSourceContextPeer peer;
private Cursor cursor;
private Transferable transferable;
private DragGestureEvent trigger;
private DragSourceListener dragSourceListener;
private boolean useCustomCursor; // FIXME: currently unused but needed for serialization.
private int sourceActions; // FIXME: currently unused but needed for serialization.
private Image image;
private Point offset;
/**
* Initializes a drag source context.
*
* @exception IllegalArgumentException If Component or DragSource of trigger
* are null, the drag action for the trigger event is DnDConstants.ACTION_NONE
* or if the source actions for the DragGestureRecognizer associated with the
* trigger event are equal to DnDConstants.ACTION_NONE.
* @exception NullPointerException If peer or trigger is null.
*/
public DragSourceContext (DragSourceContextPeer peer,
DragGestureEvent trigger, Cursor cursor,
Image image, Point offset, Transferable trans,
DragSourceListener dsl)
{
if (peer == null
|| trigger == null)
throw new NullPointerException ();
if (trigger.getComponent () == null
|| trigger.getDragSource () == null
|| trigger.getDragAction () == DnDConstants.ACTION_NONE
|| trigger.getSourceAsDragGestureRecognizer ()
.getSourceActions () == DnDConstants.ACTION_NONE)
throw new IllegalArgumentException ();
this.peer = peer;
this.trigger = trigger;
this.cursor = cursor;
this.image = image;
this.offset = offset;
this.transferable = trans;
this.dragSourceListener = dsl;
throw new Error ("not implemented");
}
public DragSource getDragSource()
{
return trigger.getDragSource ();
}
public Component getComponent()
{
return trigger.getComponent ();
}
public DragGestureEvent getTrigger()
{
return trigger;
}
public int getSourceActions()
{
return trigger.getSourceAsDragGestureRecognizer ().getSourceActions ();
}
public void setCursor (Cursor cursor)
{
this.cursor = cursor;
// FIXME: Check if we need to do more here
}
public Cursor getCursor()
{
return cursor;
}
/**
* Adds a <code>DragSourceListener</code>.
*
* @exception TooManyListenersException If a <code>DragSourceListener</code>
* has already been added.
*/
public void addDragSourceListener (DragSourceListener dsl)
throws TooManyListenersException
{
if (dragSourceListener != null)
throw new TooManyListenersException ();
dragSourceListener = dsl;
}
public void removeDragSourceListener (DragSourceListener dsl)
{
if (dragSourceListener == dsl)
dragSourceListener = null;
}
public void transferablesFlavorsChanged()
{
}
public void dragEnter(DragSourceDragEvent e)
{
}
public void dragOver(DragSourceDragEvent e)
{
}
public void dragExit(DragSourceEvent e)
{
}
public void dropActionChanged(DragSourceDragEvent e)
{
}
public void dragDropEnd(DragSourceDropEvent e)
{
}
public void dragMouseMoved(DragSourceDragEvent e)
{
}
public Transferable getTransferable()
{
return transferable;
}
protected void updateCurrentCursor(int dropOp, int targetAct, int status)
{
}
} // class DragSourceContext
@@ -0,0 +1,102 @@
/* DragSourceDragEvent.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import gnu.java.awt.EventModifier;
/**
* @author Michael Koch
* @since 1.2
*/
public class DragSourceDragEvent extends DragSourceEvent
{
/**
* Compatible with JDK 1.2+
*/
private static final long serialVersionUID = 481346297933902471L;
private final int dropAction;
private final int targetActions;
private final int gestureModifiers;
public DragSourceDragEvent(DragSourceContext context, int dropAction,
int actions, int modifiers)
{
super(context);
this.dropAction = dropAction;
targetActions = actions;
gestureModifiers = EventModifier.extend(modifiers);
}
public DragSourceDragEvent(DragSourceContext context, int dropAction,
int actions, int modifiers, int x, int y)
{
super(context, x, y);
this.dropAction = dropAction;
targetActions = actions;
gestureModifiers = EventModifier.extend(modifiers);
}
public int getTargetActions()
{
return targetActions;
}
public int getGestureModifiers()
{
return EventModifier.revert(gestureModifiers);
}
public int getGestureModifiersEx()
{
return gestureModifiers;
}
public int getUserAction()
{
return dropAction;
}
public int getDropAction()
{
return (dropAction
& targetActions
& ((DragSourceContext) source).getSourceActions());
}
} // class DragSourceDragEvent
@@ -0,0 +1,89 @@
/* DragSourceDragEvent.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
/**
* @author Michael Koch (konqueror@gmx.de)
* @since 1.2
*
* Written using JDK 1.4.1 Online API
* Status: JDK 1.4 complete
*/
public class DragSourceDropEvent extends DragSourceEvent
{
/**
* Compatible with JDK 1.2+
*/
private static final long serialVersionUID = -5571321229470821891L;
private final int dropAction;
private final boolean dropSuccess;
public DragSourceDropEvent (DragSourceContext context)
{
super (context);
this.dropAction = 0;
this.dropSuccess = false;
}
public DragSourceDropEvent (DragSourceContext context, int dropAction,
boolean dropSuccess)
{
super (context);
this.dropAction = dropAction;
this.dropSuccess = dropSuccess;
}
public DragSourceDropEvent (DragSourceContext context, int dropAction,
boolean dropSuccess, int x, int y)
{
super (context, x, y);
this.dropAction = dropAction;
this.dropSuccess = dropSuccess;
}
public int getDropAction()
{
return dropAction & ((DragSourceContext) source).getSourceActions();
}
public boolean getDropSuccess()
{
return dropSuccess;
}
} // class DragSourceDropEvent
@@ -0,0 +1,93 @@
/* DragSourceEvent.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Point;
import java.util.EventObject;
/**
* @since 1.2
*/
public class DragSourceEvent extends EventObject
{
/**
* Compatible with JDK 1.2+
*/
private static final long serialVersionUID = -763287114604032641L;
private final boolean locationSpecified;
private final int x;
private final int y;
public DragSourceEvent(DragSourceContext context)
{
super(context);
locationSpecified = false;
x = 0;
y = 0;
}
public DragSourceEvent(DragSourceContext context, int x, int y)
{
super(context);
locationSpecified = true;
this.x = x;
this.y = y;
}
public DragSourceContext getDragSourceContext()
{
return (DragSourceContext) source;
}
public Point getLocation()
{
return locationSpecified ? new Point(x, y) : null;
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
} // class DragSourceEvent
@@ -0,0 +1,97 @@
/* DragSourceListener.java -- listen to events during the drag
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.util.EventListener;
/**
* This class allows an object to listen for drag and drop events. It can
* be used to provide appropriate feedback for "drag over" actions. You can
* also use a <code>DragSourceAdapter</code> to filter the events you are
* interested in.
*
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
public interface DragSourceListener extends EventListener
{
/**
* Called when the cursor hotspot enters a drop site which will accept the
* drag.
*
* @param e the drag source drag event
*/
void dragEnter(DragSourceDragEvent e);
/**
* Called when the cursor hotspot moves inside of a drop site which will
* accept the drag.
*
* @param e the drag source drag event
*/
void dragOver(DragSourceDragEvent e);
/**
* Called when the user modifies the drop gesture. This is often the case
* when additional mouse or key events are received during the drag.
*
* @param e the drag source drag event
*/
void dropActionChanged(DragSourceDragEvent e);
/**
* Called when the cursor hotspot moves outside of a drop site which will
* accept the drag. This could also happen if the drop site is no longer
* active, or no longer accepts the drag.
*
* @param e the drag source drag event
*/
void dragExit(DragSourceEvent e);
/**
* Called when the drag and drop operation is complete. After this event,
* <code>getDropSuccess</code> of the event is valid, and
* <code>getDropAction</code> holds the action requested by the drop site.
* Furthermore, the <code>DragSourceContext</code> is invalidated.
*
* @param e the drag source drag event
*/
void dragDropEnd(DragSourceDropEvent e);
} // interface DragSourceListener
@@ -0,0 +1,64 @@
/* DragSourceMotionListener.java -- tracks motion in the drag source
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.util.EventListener;
/**
* This is a listener for mouse motion in the drag source before the drop
* event occurs. You can also use a <code>DragSourceAdapter</code> to filter
* the events you are interested in.
*
* @author Eric Blake (ebb9@email.byu.edu)
* @see DragSourceDragEvent
* @see DragSource
* @see DragSourceListener
* @see DragSourceAdapter
* @since 1.4
* @status updated to 1.4
*/
public interface DragSourceMotionListener extends EventListener
{
/**
* Called whenever the mouse is moved during a drag-and-drop operation.
*
* @param e the event
*/
void dragMouseMoved(DragSourceDragEvent e);
} // interface DragSourceMotionListener
@@ -0,0 +1,293 @@
/* DropTarget.java --
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.Point;
import java.awt.datatransfer.FlavorMap;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.EventListener;
import java.util.TooManyListenersException;
/**
* @author Michael Koch
* @since 1.2
*/
public class DropTarget
implements DropTargetListener, EventListener, Serializable
{
/**
* Compatible with JDK 1.2+
*/
private static final long serialVersionUID = -6283860791671019047L;
/** @specnote According to the online documentation, this is
* protected, but in reality it is public. */
public static class DropTargetAutoScroller
implements ActionListener
{
private Component component;
private Point point;
protected DropTargetAutoScroller (Component c, Point p)
{
component = c;
point = p;
}
protected void updateLocation (Point newLocn)
{
point = newLocn;
}
protected void stop ()
{
}
public void actionPerformed (ActionEvent e)
{
}
}
private Component component;
private FlavorMap flavorMap;
private int actions;
private DropTargetContext dropTargetContext;
private DropTargetListener dropTargetListener;
private boolean active = true;
/**
* Creates a <code>DropTarget</code> object.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless()
* returns true.
*/
public DropTarget ()
{
this (null, 0, null, true, null);
}
/**
* Creates a <code>DropTarget</code> object.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless()
* returns true.
*/
public DropTarget (Component c, DropTargetListener dtl)
{
this (c, 0, dtl, true, null);
}
/**
* Creates a <code>DropTarget</code> object.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless()
* returns true.
*/
public DropTarget (Component c, int i, DropTargetListener dtl)
{
this (c, i, dtl, true, null);
}
/**
* Creates a <code>DropTarget</code> object.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless()
* returns true.
*/
public DropTarget (Component c, int i, DropTargetListener dtl, boolean b)
{
this (c, i, dtl, b, null);
}
/**
* Creates a <code>DropTarget</code> object.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless()
* returns true.
*/
public DropTarget (Component c, int i, DropTargetListener dtl, boolean b,
FlavorMap fm)
{
if (GraphicsEnvironment.isHeadless ())
throw new HeadlessException ();
component = c;
actions = i;
dropTargetListener = dtl;
flavorMap = fm;
setActive (b);
}
/**
* Sets the component associated with this drop target object.
*/
public void setComponent (Component c)
{
component = c;
}
/**
* Returns the component associated with this drop target object.
*/
public Component getComponent ()
{
return component;
}
/**
* Sets the default actions.
*/
public void setDefaultActions (int ops)
{
actions = ops;
}
/**
* Returns the default actions.
*/
public int getDefaultActions ()
{
return actions;
}
public void setActive (boolean active)
{
this.active = active;
}
public boolean isActive()
{
return active;
}
/**
* Adds a new <code>DropTargetListener</code>.
*
* @exception TooManyListenersException Sun's JDK does not, despite
* documentation, throw this exception here when you install an additional
* <code>DropTargetListener</code>. So to be compatible, we do the same
* thing.
*/
public void addDropTargetListener (DropTargetListener dtl)
throws TooManyListenersException
{
dropTargetListener = dtl;
}
public void removeDropTargetListener(DropTargetListener dtl)
{
// FIXME: Do we need to do something with dtl ?
dropTargetListener = null;
}
public void dragEnter(DropTargetDragEvent dtde)
{
}
public void dragOver(DropTargetDragEvent dtde)
{
}
public void dropActionChanged(DropTargetDragEvent dtde)
{
}
public void dragExit(DropTargetEvent dte)
{
}
public void drop(DropTargetDropEvent dtde)
{
}
public FlavorMap getFlavorMap()
{
return flavorMap;
}
public void setFlavorMap(FlavorMap fm)
{
flavorMap = fm;
}
public void addNotify(java.awt.peer.ComponentPeer peer)
{
}
public void removeNotify(java.awt.peer.ComponentPeer peer)
{
}
public DropTargetContext getDropTargetContext()
{
if (dropTargetContext == null)
dropTargetContext = createDropTargetContext ();
return dropTargetContext;
}
protected DropTargetContext createDropTargetContext()
{
return new DropTargetContext (this);
}
protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller
(Component c, Point p)
{
return new DropTarget.DropTargetAutoScroller (c, p);
}
protected void initializeAutoscrolling(Point p)
{
}
protected void updateAutoscroll(Point dragCursorLocn)
{
}
protected void clearAutoscroll()
{
}
} // class DropTarget
@@ -0,0 +1,100 @@
/* DragSourceAdapter.java -- drag-and-drop listener adapter
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
/**
* This class implements <code>DropTargetListener</code>, and implements all methods
* with empty bodies. This allows a listener interested in implementing only
* a subset of these interfaces to extend this class and override only the
* desired methods.
*
* @author Michael Koch (konqueror@gmx.de)
* @since 1.4
* @status updated to 1.4
*/
public abstract class DropTargetAdapter
implements DropTargetListener
{
/**
* Default constructor.
*/
public DropTargetAdapter()
{
}
/**
* Called when the cursor hotspot enters a drop site which will accept the
* drag.
*
* @param e the event
*/
public void dragEnter (DropTargetDragEvent e)
{
}
/**
* Called when the cursor hotspot moves inside of a drop site which will
* accept the drag.
*
* @param e the event
*/
public void dragOver (DropTargetDragEvent e)
{
}
/**
* Called when the user modifies the drop gesture. This is often the case
* when additional mouse or key events are received during the drag.
*
* @param e the event
*/
public void dropActionChanged (DropTargetDragEvent e)
{
}
/**
* Called when the cursor hotspot moves outside of a drop site which will
* accept the drag. This could also happen if the drop site is no longer
* active, or no longer accepts the drag.
*
* @param e the event
*/
public void dragExit(DropTargetEvent e)
{
}
} // class DropTargetAdapter
@@ -0,0 +1,188 @@
/* DropTargetContext.java --
Copyright (C) 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
/**
* @author Michael Koch (konqueror@gmx.de)
* @since 1.2
*/
public class DropTargetContext implements Serializable
{
static final long serialVersionUID = -634158968993743371L;
/** @specnote According to the online documentation, this is
* protected, but in reality it is public. */
public class TransferableProxy implements Transferable
{
protected boolean isLocal;
protected Transferable transferable;
TransferableProxy (Transferable t, boolean local)
{
this.transferable = t;
this.isLocal = local;
}
public DataFlavor[] getTransferDataFlavors ()
{
return transferable.getTransferDataFlavors ();
}
public boolean isDataFlavorSupported (DataFlavor flavor)
{
return transferable.isDataFlavorSupported (flavor);
}
public Object getTransferData (DataFlavor flavor)
throws UnsupportedFlavorException, IOException
{
return transferable.getTransferData (flavor);
}
}
private DropTarget dropTarget;
private int targetActions;
private java.awt.dnd.peer.DropTargetContextPeer dtcp;
// package private
DropTargetContext (DropTarget dropTarget)
{
this.dropTarget = dropTarget;
}
public DropTarget getDropTarget ()
{
return dropTarget;
}
public Component getComponent ()
{
return dropTarget.getComponent ();
}
public void addNotify (java.awt.dnd.peer.DropTargetContextPeer dtcp)
{
this.dtcp = dtcp;
}
public void removeNotify ()
{
this.dtcp = null;
}
protected void setTargetActions (int actions)
{
targetActions = actions;
}
protected int getTargetActions()
{
return targetActions;
}
/**
* Signals that the drop is completed.
*
* @exception InvalidDnDOperationException If a drop is not outstanding.
*/
public void dropComplete (boolean success)
{
// FIXME: implement this
}
protected void acceptDrag (int dragOperation)
{
// FIXME: implement this
}
protected void rejectDrag ()
{
// FIXME: implement this
}
protected void acceptDrop (int dropOperation)
{
// FIXME: implement this
}
protected void rejectDrop ()
{
// FIXME: implement this
}
protected DataFlavor[] getCurrentDataFlavors ()
{
// FIXME: implement this
return null;
}
protected List getCurrentDataFlavorsAsList ()
{
return Arrays.asList (getCurrentDataFlavors ());
}
protected boolean isDataFlavorSupported (DataFlavor flavor)
{
return getCurrentDataFlavorsAsList ().contains (flavor);
}
/**
* Return the <code>Transferable</code> operandof this operation.
*
* @exception InvalidDnDOperationException If a drag is not outstanding.
*/
protected Transferable getTransferable() throws InvalidDnDOperationException
{
// FIXME: implement this
return null;
}
protected Transferable createTransferableProxy(Transferable t, boolean local)
{
return new TransferableProxy (t, local);
}
} // class DropTargetContext
@@ -0,0 +1,140 @@
/* DropTargetDragEvent.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
import java.util.List;
/**
* @since 1.2
*/
public class DropTargetDragEvent extends DropTargetEvent
{
/**
* Compatible with 1.2+
*/
private static final long serialVersionUID = -8422265619058953682L;
private final int dropAction;
private final int srcActions;
private final Point location;
/**
* Initializes a <code>DropTargetDragEvent</code>.
*
* @exception IllegalArgumentException If dropAction is not one of DnDConstants,
* srcActions is not a bitwise mask of DnDConstants, or dtc is null.
* @exception NullPointerException If location is null.
*/
public DropTargetDragEvent (DropTargetContext context, Point location,
int dropAction, int srcActions)
{
super (context);
if (location == null)
throw new NullPointerException ();
if (context == null)
throw new IllegalArgumentException ();
if (dropAction != DnDConstants.ACTION_NONE
&& dropAction != DnDConstants.ACTION_COPY
&& dropAction != DnDConstants.ACTION_MOVE
&& dropAction != DnDConstants.ACTION_COPY_OR_MOVE
&& dropAction != DnDConstants.ACTION_LINK
&& dropAction != DnDConstants.ACTION_REFERENCE)
throw new IllegalArgumentException ();
int srcActionsMask = DnDConstants.ACTION_NONE
| DnDConstants.ACTION_COPY
| DnDConstants.ACTION_MOVE
| DnDConstants.ACTION_COPY_OR_MOVE
| DnDConstants.ACTION_LINK
| DnDConstants.ACTION_REFERENCE;
if (~(srcActions ^ srcActionsMask) != 0)
throw new IllegalArgumentException ();
this.dropAction = dropAction;
this.srcActions = srcActions;
this.location = location;
}
public void acceptDrag (int dragOperation)
{
context.acceptDrag (dragOperation);
}
public DataFlavor[] getCurrentDataFlavors ()
{
return context.getCurrentDataFlavors ();
}
public List getCurrentDataFlavorsAsList ()
{
return context.getCurrentDataFlavorsAsList ();
}
public int getDropAction()
{
return 0;
//return dropAction & ((DropTargetContext) source).getTargetActions();
}
public Point getLocation ()
{
return location;
}
public int getSourceActions ()
{
return srcActions;
}
public boolean isDataFlavorSupported (DataFlavor df)
{
return context.isDataFlavorSupported (df);
}
public void rejectDrag ()
{
context.rejectDrag ();
}
} // class DropTargetDragEvent
@@ -0,0 +1,170 @@
/* DropTargetDropEvent.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.util.List;
/**
* @since 1.2
*/
public class DropTargetDropEvent extends DropTargetEvent
{
/**
* Compatible with JDK 1.2+
*/
private static final long serialVersionUID = -1721911170440459322L;
private final int dropAction;
private final int actions;
private final Point location;
private final boolean isLocalTx;
/**
* Initializes a <code>DropTargetDropEvent</code>. By default this constructor
* assumes that the target is not int same JVM.
*
* @exception IllegalArgumentException If dropAction is not one of DnDConstants,
* actions is not a bitwise mask of DnDConstants, or dtc is null.
* @exception NullPointerException If location is null.
*/
public DropTargetDropEvent (DropTargetContext dtc, Point location,
int dropAction, int actions)
{
this (dtc, location, dropAction, actions, false);
}
/**
* Initializes a <code>DropTargetDropEvent</code>.
*
* @exception IllegalArgumentException If dropAction is not one of DnDConstants,
* actions is not a bitwise mask of DnDConstants, or dtc is null.
* @exception NullPointerException If location is null.
*/
public DropTargetDropEvent (DropTargetContext dtc, Point location,
int dropAction, int actions, boolean isLocalTx)
{
super (dtc);
if (location == null)
throw new NullPointerException ();
if (dtc == null)
throw new IllegalArgumentException ();
if (dropAction != DnDConstants.ACTION_NONE
&& dropAction != DnDConstants.ACTION_COPY
&& dropAction != DnDConstants.ACTION_MOVE
&& dropAction != DnDConstants.ACTION_COPY_OR_MOVE
&& dropAction != DnDConstants.ACTION_LINK
&& dropAction != DnDConstants.ACTION_REFERENCE)
throw new IllegalArgumentException ();
int actionsMask = DnDConstants.ACTION_NONE
| DnDConstants.ACTION_COPY
| DnDConstants.ACTION_MOVE
| DnDConstants.ACTION_COPY_OR_MOVE
| DnDConstants.ACTION_LINK
| DnDConstants.ACTION_REFERENCE;
if (~(actions ^ actionsMask) != 0)
throw new IllegalArgumentException ();
this.dropAction = dropAction;
this.actions = actions;
this.location = location;
this.isLocalTx = isLocalTx;
}
public Point getLocation ()
{
return location;
}
public DataFlavor[] getCurrentDataFlavors ()
{
return context.getCurrentDataFlavors ();
}
public List getCurrentDataFlavorsAsList ()
{
return context.getCurrentDataFlavorsAsList ();
}
public boolean isDataFlavorSupported (DataFlavor flavor)
{
return context.isDataFlavorSupported (flavor);
}
public int getSourceActions ()
{
return actions;
}
public int getDropAction ()
{
return dropAction;
}
public Transferable getTransferable ()
{
return context.getTransferable ();
}
public void acceptDrop (int dropAction)
{
context.acceptDrop (dropAction);
}
public void rejectDrop ()
{
context.rejectDrop ();
}
public void dropComplete (boolean success)
{
// FIXME: implement this
}
public boolean isLocalTransfer()
{
return isLocalTx;
}
} // class DropTargetDropEvent
@@ -0,0 +1,56 @@
/* DropTarget.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.util.EventObject;
public class DropTargetEvent extends EventObject
{
protected DropTargetContext context;
public DropTargetEvent (DropTargetContext context)
{
super (context);
this.context = context;
}
public DropTargetContext getDropTargetContext ()
{
return context;
}
}
@@ -0,0 +1,89 @@
/* DropTargetListener.java -- listen to events during the drop
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.util.EventListener;
/**
* @author Michael Koch (konqueror@gmx.de)
* @since 1.2
* @status updated to 1.4
*/
public interface DropTargetListener extends EventListener
{
/**
* Called when the cursor hotspot enters a drop site which will accept the
* drag.
*
* @param e the drag source drag event
*/
void dragEnter (DropTargetDragEvent e);
/**
* Called when the cursor hotspot moves inside of a drop site which will
* accept the drag.
*
* @param e the drag source drag event
*/
void dragOver (DropTargetDragEvent e);
/**
* Called when the user modifies the drop gesture. This is often the case
* when additional mouse or key events are received during the drag.
*
* @param e the drag source drag event
*/
void dropActionChanged (DropTargetDragEvent e);
/**
* Called when the cursor hotspot moves outside of a drop site which will
* accept the drag. This could also happen if the drop site is no longer
* active, or no longer accepts the drag.
*
* @param e the drag source drag event
*/
void dragExit (DropTargetEvent e);
/**
* Called when the drag operation has terminated with a drop.
*
* @param e the drag source drag event
*/
void drop (DropTargetDropEvent e);
} // interface DropTargetListener
@@ -0,0 +1,73 @@
/* InvalidDnDOperationException.java -- thrown when drag-and-drop fails
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
/**
* Thrown when a method in the java.awt.dnd package is unable to perform a
* requested operation, usually because the underlying DnD system is in the
* wrong state.
*
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
public class InvalidDnDOperationException extends IllegalStateException
{
/**
* Compatible with JDK 1.2+.
*/
private static final long serialVersionUID = -6062568741193956678L;
/**
* Create an exception without a message.
*/
public InvalidDnDOperationException()
{
}
/**
* Create an exception with a message.
*
* @param s the message
*/
public InvalidDnDOperationException(String s)
{
super(s);
}
} // class InvalidDnDOperationException
@@ -0,0 +1,131 @@
/* MouseDragGestureRecognizer.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd;
import java.awt.Component;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
/**
* @author Michael Koch (konqueror@gmx.de)
*/
public abstract class MouseDragGestureRecognizer
extends DragGestureRecognizer
implements MouseListener, MouseMotionListener
{
/**
* Creates a <code>MouseDragGestureRecognizer</code> object.
*/
protected MouseDragGestureRecognizer (DragSource ds, Component c, int act,
DragGestureListener dgl)
{
super (ds, c, act, dgl);
}
/**
* Creates a <code>MouseDragGestureRecognizer</code> object.
*/
protected MouseDragGestureRecognizer (DragSource ds, Component c, int act)
{
super (ds, c, act);
}
/**
* Creates a <code>MouseDragGestureRecognizer</code> object.
*/
protected MouseDragGestureRecognizer (DragSource ds, Component c)
{
super (ds, c);
}
/**
* Creates a <code>MouseDragGestureRecognizer</code> object.
*/
protected MouseDragGestureRecognizer (DragSource ds)
{
super (ds);
}
protected void registerListeners ()
{
component.addMouseListener (this);
component.addMouseMotionListener (this);
}
protected void unregisterListeners ()
{
component.removeMouseListener (this);
component.removeMouseMotionListener (this);
}
public void mouseClicked (MouseEvent e)
{
// Do nothing in here by default.
}
public void mousePressed (MouseEvent e)
{
// Do nothing in here by default.
}
public void mouseReleased (MouseEvent e)
{
// Do nothing in here by default.
}
public void mouseEntered (MouseEvent e)
{
// Do nothing in here by default.
}
public void mouseExited (MouseEvent e)
{
// Do nothing in here by default.
}
public void mouseDragged (MouseEvent e)
{
// Do nothing in here by default.
}
public void mouseMoved (MouseEvent e)
{
// Do nothing in here by default.
}
} // class MouseDragGestureRecognizer
@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in java.awt.dnd package.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. -->
<html>
<head><title>GNU Classpath - java.awt.dnd</title></head>
<body>
<p>Events and listeners for drag and drop sources and targets.</p>
</body>
</html>
@@ -0,0 +1,57 @@
/* DragSourceContextPeer.java -- interface for drag-and-drop peers
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd.peer;
import java.awt.Cursor;
import java.awt.Image;
import java.awt.Point;
import java.awt.dnd.DragSourceContext;
import java.awt.dnd.InvalidDnDOperationException;
/**
* STUBBED
*/
public interface DragSourceContextPeer
{
void startDrag(DragSourceContext context, Cursor c, Image i, Point p)
throws InvalidDnDOperationException;
Cursor getCursor();
void setCursor(Cursor c) throws InvalidDnDOperationException;
void transferablesFlavorsChanged();
} // interface DragSourceContextPeer
@@ -0,0 +1,68 @@
/* DropTargetContextPeer.java -- interface for drag-and-drop peers
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd.peer;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DropTarget;
import java.awt.dnd.InvalidDnDOperationException;
/**
* Used to control state of recipient protocol from the
* <code>DropTargetListener</code>. Occurs when a <code>Component</code>
* with an associated <code>DropTarget</code> and visible geometry is first
* intersected by a logical cursor.
*
* @author Michael Koch (konqueror@gmx.de)
*/
public interface DropTargetContextPeer
{
void setTargetActions(int actions);
int getTargetActions();
DropTarget getDropTarget();
DataFlavor[] getTransferDataFlavors();
Transferable getTransferable() throws InvalidDnDOperationException;
boolean isTransferableJVMLocal();
void acceptDrag(int dragAction);
void rejectDrag();
void acceptDrop(int dropAction);
void rejectDrop();
void dropComplete(boolean success);
}
@@ -0,0 +1,48 @@
/* DropTargetPeer.java -- interface for drag-and-drop peers
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.dnd.peer;
import java.awt.dnd.DropTarget;
/**
*/
public interface DropTargetPeer
{
void addDropTarget (DropTarget target);
void removeDropTarget (DropTarget target);
} // interface DropTargetContextPeer
@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in java.awt.dnd.peer package.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. -->
<html>
<head><title>GNU Classpath - java.awt.dnd.peer</title></head>
<body>
<p>Interfaces for using native interface components.</p>
</body>
</html>