From 0701e74c80c96c0b6996c970b21f0f383345ff0e Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Mon, 17 Feb 2003 15:26:30 +0000 Subject: 2003-02-17 Michael Koch * java/awt/dnd/DragSourceContext.java (addDragSourceListener): Added documentation. * java/awt/dnd/DragSourceDragEvent.java (serialVersionUID): New member variable. (getDropAction): Reformated. * java/awt/dnd/DragSourceDropEvent.java (serialVersionUID): New member variable. (dropSuccess): Renamed from success for serialization issues. * java/awt/dnd/DragSourceEvent.java (serialVersionUID): New member variable. * java/awt/dnd/DropTarget.java (serialVersionUID): New member variable. (DropTarget): Implemented, documentation reworked. (setComponent): Documentation added. (getComponent): Documentation added. (setDefaultActions): Documentation added. (getDefaultActions): Documentation added. (addDropTargetListener): Documentation added. * java/awt/dnd/DropTargetContext.java (DropTargetContext): Documentation added. (TransferableProxy.TransferableProxy): New method. (dropComplete): Fixed documentation. (getTransferable): Fixed documentation. (createTransferableProxy): Implemented. * java/awt/dnd/DropTargetDragEvent.java (DropTargetDragEvent): Documentation added. (serialVersionUID): New member variable. (DropTargetDragEvent): Throw exceptions, documentation added. (acceptDrag): Implemented. (getCurrentDataFlavors): Implemented.3yy (getCurrentDataFlavorsAsList): Implemented. (isDataFlavorSupported): Implemented. (rejectDrag): Implemented. * java/awt/dnd/DropTargetDropEvent.java (DropTargetDropEvent): Documentation added. (serialVersionUID): New member variable. (actions): Renamed from srcActions for serialization issues. (isLocalTx): Renamed from isLocalTx for serialization issues. (DropTargetDropEvent): New implementation, throw exceptions, documentation added. (getCurrentDataFlavors): Implemented. (getCurrentDataFlavorsAsList): Implemented. (isDataFlavorSupported): Implemented. (getSourceActions): Implemented. (getDropAction): Implemented. (getTransferable): Implemented. (acceptDrop): Implemented. (rejectDrop): Implemented. * java/awt/dnd/DropTargetListener.java (drop): Fixed documentation. * java/awt/dnd/MouseDragGestureRecognizer.java (MouseDragGestureRecognizer): Documentation added. 2003-02-17 Michael Koch * java/awt/font/FontRenderContext.java, java/awt/font/ShapeGraphicAttribute.java, java/awt/font/MultipleMaster.java, java/awt/font/TransformAttribute.java, java/awt/font/GlyphJustificationInfo.java, java/awt/font/LineBreakMeasurer.java, java/awt/font/TextMeasurer.java, java/awt/font/TextLayout.java, java/awt/font/LineMetrics.java, java/awt/font/TextAttribute.java, java/awt/font/GlyphMetrics.java, java/awt/font/OpenType.java, java/awt/font/GlyphVector.java, java/awt/font/GraphicAttribute.java, java/awt/font/ImageGraphicAttribute.java, java/awt/font/NumericShaper.java: New files. * Makefile.am (awt_java_source_files): Added the following files: java/awt/font/FontRenderContext.java java/awt/font/ShapeGraphicAttribute.java java/awt/font/MultipleMaster.java java/awt/font/TransformAttribute.java java/awt/font/GlyphJustificationInfo.java java/awt/font/LineBreakMeasurer.java java/awt/font/TextMeasurer.java java/awt/font/TextLayout.java java/awt/font/LineMetrics.java java/awt/font/TextAttribute.java java/awt/font/GlyphMetrics.java java/awt/font/OpenType.java java/awt/font/GlyphVector.java java/awt/font/GraphicAttribute.java java/awt/font/ImageGraphicAttribute.java java/awt/font/NumericShaper.java * Makefile.in: Regenerated. 2003-02-17 Michael Koch * java/awt/print/Paper.java (Paper): Implements Cloneable. * java/awt/print/PrinterJob.java (setJobName): Return value must be void. (print): Throws PrinterException. From-SVN: r62999 --- libjava/java/awt/dnd/DropTargetDropEvent.java | 90 +++++++++++++++++++-------- 1 file changed, 64 insertions(+), 26 deletions(-) (limited to 'libjava/java/awt/dnd/DropTargetDropEvent.java') 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 DropTargetDropEvent. 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 DropTargetDropEvent. + * + * @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 -- cgit v1.1