aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/dnd
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/awt/dnd')
-rw-r--r--libjava/java/awt/dnd/DragSourceContext.java8
-rw-r--r--libjava/java/awt/dnd/DragSourceDragEvent.java13
-rw-r--r--libjava/java/awt/dnd/DragSourceDropEvent.java19
-rw-r--r--libjava/java/awt/dnd/DragSourceEvent.java8
-rw-r--r--libjava/java/awt/dnd/DropTarget.java53
-rw-r--r--libjava/java/awt/dnd/DropTargetContext.java21
-rw-r--r--libjava/java/awt/dnd/DropTargetDragEvent.java52
-rw-r--r--libjava/java/awt/dnd/DropTargetDropEvent.java90
-rw-r--r--libjava/java/awt/dnd/DropTargetListener.java2
-rw-r--r--libjava/java/awt/dnd/MouseDragGestureRecognizer.java13
10 files changed, 212 insertions, 67 deletions
diff --git a/libjava/java/awt/dnd/DragSourceContext.java b/libjava/java/awt/dnd/DragSourceContext.java
index ca26b94..45191d2 100644
--- a/libjava/java/awt/dnd/DragSourceContext.java
+++ b/libjava/java/awt/dnd/DragSourceContext.java
@@ -92,7 +92,13 @@ public class DragSourceContext
return null;
}
- public void addDragSourceListener(DragSourceListener l)
+ /**
+ * Adds a <code>DragSourceListener</code>.
+ *
+ * @exception TooManyListenersException If a <code>DragSourceListener</code>
+ * has already been added.
+ */
+ public void addDragSourceListener (DragSourceListener dsl)
throws TooManyListenersException
{
}
diff --git a/libjava/java/awt/dnd/DragSourceDragEvent.java b/libjava/java/awt/dnd/DragSourceDragEvent.java
index 0a1d759..6417492 100644
--- a/libjava/java/awt/dnd/DragSourceDragEvent.java
+++ b/libjava/java/awt/dnd/DragSourceDragEvent.java
@@ -41,10 +41,16 @@ package java.awt.dnd;
import gnu.java.awt.EventModifier;
/**
- * STUBBED
+ * @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;
@@ -89,7 +95,8 @@ public class DragSourceDragEvent extends DragSourceEvent
public int getDropAction()
{
- return dropAction & targetActions
- & ((DragSourceContext) source).getSourceActions();
+ return (dropAction
+ & targetActions
+ & ((DragSourceContext) source).getSourceActions());
}
} // class DragSourceDragEvent
diff --git a/libjava/java/awt/dnd/DragSourceDropEvent.java b/libjava/java/awt/dnd/DragSourceDropEvent.java
index 4b70d1b..a645814 100644
--- a/libjava/java/awt/dnd/DragSourceDropEvent.java
+++ b/libjava/java/awt/dnd/DragSourceDropEvent.java
@@ -46,30 +46,35 @@ package java.awt.dnd;
*/
public class DragSourceDropEvent extends DragSourceEvent
{
+ /**
+ * Compatible with JDK 1.2+
+ */
+ private static final long serialVersionUID = -5571321229470821891L;
+
private final int dropAction;
- private final boolean success;
+ private final boolean dropSuccess;
public DragSourceDropEvent (DragSourceContext context)
{
super (context);
this.dropAction = 0;
- this.success = false;
+ this.dropSuccess = false;
}
public DragSourceDropEvent (DragSourceContext context, int dropAction,
- boolean success)
+ boolean dropSuccess)
{
super (context);
this.dropAction = dropAction;
- this.success = success;
+ this.dropSuccess = dropSuccess;
}
public DragSourceDropEvent (DragSourceContext context, int dropAction,
- boolean success, int x, int y)
+ boolean dropSuccess, int x, int y)
{
super (context, x, y);
this.dropAction = dropAction;
- this.success = success;
+ this.dropSuccess = dropSuccess;
}
public int getDropAction()
@@ -79,6 +84,6 @@ public class DragSourceDropEvent extends DragSourceEvent
public boolean getDropSuccess()
{
- return success;
+ return dropSuccess;
}
} // class DragSourceDropEvent
diff --git a/libjava/java/awt/dnd/DragSourceEvent.java b/libjava/java/awt/dnd/DragSourceEvent.java
index 9d5b00b..60f6eb2 100644
--- a/libjava/java/awt/dnd/DragSourceEvent.java
+++ b/libjava/java/awt/dnd/DragSourceEvent.java
@@ -41,8 +41,16 @@ 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;
diff --git a/libjava/java/awt/dnd/DropTarget.java b/libjava/java/awt/dnd/DropTarget.java
index 53c0917..09c642c 100644
--- a/libjava/java/awt/dnd/DropTarget.java
+++ b/libjava/java/awt/dnd/DropTarget.java
@@ -50,6 +50,11 @@ import java.util.TooManyListenersException;
public class DropTarget
implements DropTargetListener, EventListener, Serializable
{
+ /**
+ * Compatible with JDK 1.2+
+ */
+ private static final long serialVersionUID = -6283860791671019047L;
+
protected static class DropTargetAutoScroller
implements ActionListener
{
@@ -74,64 +79,85 @@ public class DropTarget
private boolean isActive = false;
/**
- * FIXME
+ * Creates a <code>DropTarget</code> object.
*
- * @exception HeadlessException FIXME
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public DropTarget ()
{
+ this (null, 0, null, true, null);
}
/**
- * FIXME
+ * Creates a <code>DropTarget</code> object.
*
- * @exception HeadlessException FIXME
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public DropTarget (Component c, DropTargetListener dtl)
{
+ this (c, 0, dtl, true, null);
}
/**
- * FIXME
+ * Creates a <code>DropTarget</code> object.
*
- * @exception HeadlessException FIXME
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public DropTarget (Component c, int i, DropTargetListener dtl)
{
+ this (c, i, dtl, true, null);
}
/**
- * FIXME
+ * Creates a <code>DropTarget</code> object.
*
- * @exception HeadlessException FIXME
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public DropTarget (Component c, int i, DropTargetListener dtl, boolean b)
{
+ this (c, i, dtl, b, null);
}
/**
- * FIXME
+ * Creates a <code>DropTarget</code> object.
*
- * @exception HeadlessException FIXME
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true.
*/
public DropTarget (Component c, int i, DropTargetListener dtl, boolean b,
- FlavorMap fm)
+ FlavorMap fm)
{
}
+ /**
+ * Sets the component associated with this drop target object.
+ */
public void setComponent (Component c)
{
}
+ /**
+ * Returns the component associated with this drop target object.
+ */
public Component getComponent ()
{
return null;
}
+ /**
+ * Sets the default actions.
+ */
public void setDefaultActions (int ops)
{
}
+ /**
+ * Returns the default actions.
+ */
public int getDefaultActions ()
{
return 0;
@@ -148,7 +174,10 @@ public class DropTarget
}
/**
- * @exception TooManyListenersException FIXME
+ * Adds a new <code>DropTargetListener</code>.
+ *
+ * @exception TooManyListenersException If there is already a
+ * <code>DropTargetListener</code>.
*/
public void addDropTargetListener (DropTargetListener dtl)
throws TooManyListenersException
diff --git a/libjava/java/awt/dnd/DropTargetContext.java b/libjava/java/awt/dnd/DropTargetContext.java
index 86adaad..eca2f6e 100644
--- a/libjava/java/awt/dnd/DropTargetContext.java
+++ b/libjava/java/awt/dnd/DropTargetContext.java
@@ -46,6 +46,10 @@ import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.util.List;
+/**
+ * @author Michael Koch <konqueror@gmx.de>
+ * @since 1.2
+ */
public class DropTargetContext implements Serializable
{
static final long serialVersionUID = -634158968993743371L;
@@ -55,6 +59,12 @@ public class DropTargetContext implements Serializable
protected boolean isLocal;
protected Transferable transferable;
+ TransferableProxy (Transferable t, boolean local)
+ {
+ this.transferable = t;
+ this.isLocal = local;
+ }
+
public DataFlavor[] getTransferDataFlavors ()
{
// FIXME: implement this
@@ -110,9 +120,9 @@ public class DropTargetContext implements Serializable
}
/**
- * FIXME
+ * Signals that the drop is completed.
*
- * @exception InvalidDnDOperationException FIXME
+ * @exception InvalidDnDOperationException If a drop is not outstanding.
*/
public void dropComplete (boolean success)
{
@@ -158,9 +168,9 @@ public class DropTargetContext implements Serializable
}
/**
- * FIXME
+ * Return the <code>Transferable</code> operandof this operation.
*
- * @exception InvalidDnDOperationException FIXME
+ * @exception InvalidDnDOperationException If a drag is not outstanding.
*/
protected Transferable getTransferable() throws InvalidDnDOperationException
{
@@ -170,7 +180,6 @@ public class DropTargetContext implements Serializable
protected Transferable createTransferableProxy(Transferable t, boolean local)
{
- // FIXME: implement this
- return null;
+ return new TransferableProxy (t, local);
}
} // class DropTargetContext
diff --git a/libjava/java/awt/dnd/DropTargetDragEvent.java b/libjava/java/awt/dnd/DropTargetDragEvent.java
index a22ddc8..e95b2d1 100644
--- a/libjava/java/awt/dnd/DropTargetDragEvent.java
+++ b/libjava/java/awt/dnd/DropTargetDragEvent.java
@@ -41,21 +41,56 @@ import java.util.List;
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
+/**
+ * @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;
/**
- * FIXME
+ * Initializes a <code>DropTargetDragEvent</code>.
*
- * @exception NullPointerException FIXME
+ * @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;
@@ -63,19 +98,17 @@ public class DropTargetDragEvent extends DropTargetEvent
public void acceptDrag (int dragOperation)
{
- // FIXME: implement this
+ context.acceptDrag (dragOperation);
}
public DataFlavor[] getCurrentDataFlavors ()
{
- // FIXME: implement this
- return null;
+ return context.getCurrentDataFlavors ();
}
public List getCurrentDataFlavorsAsList ()
{
- // FIXME: implement this
- return null;
+ return context.getCurrentDataFlavorsAsList ();
}
public int getDropAction()
@@ -96,12 +129,11 @@ public class DropTargetDragEvent extends DropTargetEvent
public boolean isDataFlavorSupported (DataFlavor df)
{
- // FIXME: implement this
- return true;
+ return context.isDataFlavorSupported (df);
}
public void rejectDrag ()
{
- // FIXME: implement this
+ context.rejectDrag ();
}
} // class DropTargetDragEvent
diff --git a/libjava/java/awt/dnd/DropTargetDropEvent.java b/libjava/java/awt/dnd/DropTargetDropEvent.java
index 9a14f22..bb57f23 100644
--- a/libjava/java/awt/dnd/DropTargetDropEvent.java
+++ b/libjava/java/awt/dnd/DropTargetDropEvent.java
@@ -42,31 +42,75 @@ 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 srcActions;
+ private final int actions;
private final Point location;
- private final boolean isLocal;
+ 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 srcActions)
+ int dropAction, int actions)
{
- super (dtc);
- this.dropAction = dropAction;
- this.srcActions = srcActions;
- this.location = location;
- this.isLocal = false;
+ 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 srcActions, boolean isLocal)
+ 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.srcActions = srcActions;
+ this.actions = actions;
this.location = location;
- this.isLocal = isLocal;
+ this.isLocalTx = isLocalTx;
}
public Point getLocation ()
@@ -76,48 +120,42 @@ public class DropTargetDropEvent extends DropTargetEvent
public DataFlavor[] getCurrentDataFlavors ()
{
- // FIXME: implement this
- return null;
+ return context.getCurrentDataFlavors ();
}
public List getCurrentDataFlavorsAsList ()
{
- // FIXME: implement this
- return null;
+ return context.getCurrentDataFlavorsAsList ();
}
public boolean isDataFlavorSupported (DataFlavor flavor)
{
- // FIXME: implement this
- return false;
+ return context.isDataFlavorSupported (flavor);
}
public int getSourceActions ()
{
- // FIXME: implement this
- return 0;
+ return actions;
}
public int getDropAction ()
{
- // FIXME: implement this
- return 0;
+ return dropAction;
}
public Transferable getTransferable ()
{
- // FIXME: implement this
- return null;
+ return context.getTransferable ();
}
public void acceptDrop (int dropAction)
{
- // FIXME: implement this
+ context.acceptDrop (dropAction);
}
public void rejectDrop ()
{
- // FIXME: implement this
+ context.rejectDrop ();
}
public void dropComplete (boolean success)
@@ -127,6 +165,6 @@ public class DropTargetDropEvent extends DropTargetEvent
public boolean isLocalTransfer()
{
- return isLocal;
+ return isLocalTx;
}
} // class DropTargetDropEvent
diff --git a/libjava/java/awt/dnd/DropTargetListener.java b/libjava/java/awt/dnd/DropTargetListener.java
index 861aa89..8025ff2 100644
--- a/libjava/java/awt/dnd/DropTargetListener.java
+++ b/libjava/java/awt/dnd/DropTargetListener.java
@@ -81,7 +81,7 @@ public interface DropTargetListener extends EventListener
void dragExit (DropTargetEvent e);
/**
- * FIXME
+ * Called when the drag operation has terminated with a drop.
*
* @param e the drag source drag event
*/
diff --git a/libjava/java/awt/dnd/MouseDragGestureRecognizer.java b/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
index 1ef2e6c..d010324 100644
--- a/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
+++ b/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
@@ -45,27 +45,38 @@ 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);