diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-08-14 23:12:35 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-08-14 23:12:35 +0000 |
commit | ac1ed908de999523efc36f38e69bca1aadfe0808 (patch) | |
tree | 97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/java/awt/dnd | |
parent | abab460491408e05ea93fb85e1975296a87df504 (diff) | |
download | gcc-ac1ed908de999523efc36f38e69bca1aadfe0808.zip gcc-ac1ed908de999523efc36f38e69bca1aadfe0808.tar.gz gcc-ac1ed908de999523efc36f38e69bca1aadfe0808.tar.bz2 |
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
Diffstat (limited to 'libjava/classpath/java/awt/dnd')
9 files changed, 438 insertions, 105 deletions
diff --git a/libjava/classpath/java/awt/dnd/DragGestureEvent.java b/libjava/classpath/java/awt/dnd/DragGestureEvent.java index 9f2bc7c..351ae54 100644 --- a/libjava/classpath/java/awt/dnd/DragGestureEvent.java +++ b/libjava/classpath/java/awt/dnd/DragGestureEvent.java @@ -48,13 +48,6 @@ 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 { /** @@ -66,52 +59,121 @@ public class DragGestureEvent extends EventObject private Component component; private final Point origin; private final int action; + private List events; + private DragGestureRecognizer dgr; + /** + * Constructs a new DragGestureEvent. + * @param dgr - DragGestureRecognizer firing this event + * @param action - user's preferred action + * @param origin - origin of the drag + * @param events - List of events that make up the gesture + * @throws IllegalArgumentException - if input parameters are null + */ public DragGestureEvent(DragGestureRecognizer dgr, int action, Point origin, List events) - { + { super(dgr); - if (origin == null || events == null) + if (origin == null || events == null || dgr == null) throw new IllegalArgumentException(); + this.origin = origin; this.action = action; + this.events = events; + this.dgr = dgr; + this.component = dgr.getComponent(); + this.dragSource = dgr.getDragSource(); } + /** + * Returns the source casted as a DragGestureRecognizer. + * + * @return the source casted as a DragGestureRecognizer. + */ public DragGestureRecognizer getSourceAsDragGestureRecognizer() { - return (DragGestureRecognizer) source; + return (DragGestureRecognizer) getSource(); } + + /** + * Returns the Component corresponding to this. + * + * @return the Component corresponding to this. + */ public Component getComponent() { - return null; + return component; } + + /** + * Gets the DragSource corresponding to this. + * + * @return the DragSource corresponding to this. + */ public DragSource getDragSource() { - return null; + return dragSource; } + + /** + * Returns the origin of the drag. + * + * @return the origin of the drag. + */ public Point getDragOrigin() { return origin; } + + /** + * Gets an iterator representation of the List of events. + * + * @return an iterator representation of the List of events. + */ public Iterator iterator() { - return null; + return events.iterator(); } + + /** + * Gets an array representation of the List of events. + * + * @return an array representation of the List of events. + */ public Object[] toArray() { - return null; + return events.toArray(); } + + /** + * Gets an array representation of the List of events. + * + * @param array - the array to store the events in. + * @return an array representation of the List of events. + */ public Object[] toArray(Object[] array) { - return array; + return events.toArray(array); } + + /** + * Gets the user's preferred action. + * + * @return the user's preferred action. + */ public int getDragAction() { - return 0; + return action; } + + /** + * Get the event that triggered this gesture. + * + * @return the event that triggered this gesture. + */ public InputEvent getTriggerEvent() { - return null; + return dgr.getTriggerEvent(); } /** @@ -152,5 +214,6 @@ public class DragGestureEvent extends EventObject public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable trans, DragSourceListener l) { + dragSource.startDrag(this, dragCursor, dragImage, imageOffset, trans, l); } } // class DragGestureEvent diff --git a/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java b/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java index 145a24a..32bbc56 100644 --- a/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java +++ b/libjava/classpath/java/awt/dnd/DragGestureRecognizer.java @@ -131,6 +131,7 @@ public abstract class DragGestureRecognizer implements Serializable throws NotImplementedException { events = new ArrayList(); + // FIXME: Not implemented fully. } /** diff --git a/libjava/classpath/java/awt/dnd/DragSource.java b/libjava/classpath/java/awt/dnd/DragSource.java index 05eb670..48fa238 100644 --- a/libjava/classpath/java/awt/dnd/DragSource.java +++ b/libjava/classpath/java/awt/dnd/DragSource.java @@ -38,6 +38,8 @@ exception statement from your version. */ package java.awt.dnd; +import gnu.classpath.NotImplementedException; + import java.awt.Component; import java.awt.Cursor; import java.awt.GraphicsEnvironment; @@ -70,9 +72,12 @@ public class DragSource implements Serializable public static final Cursor DefaultLinkNoDrop = null; private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap (); - private transient DragSourceListener dragSourceListener; private transient DragSourceMotionListener dragSourceMotionListener; + + private static DragSource ds; + private DragSourceContextPeer peer; + private DragSourceContext context; /** * Initializes the drag source. @@ -82,19 +87,34 @@ public class DragSource implements Serializable public DragSource() { if (GraphicsEnvironment.isHeadless()) - throw new HeadlessException (); + { + ds = null; + throw new HeadlessException(); + } } /** + * Gets the default drag source. + * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public static DragSource getDefaultDragSource() { - return new DragSource(); + if (GraphicsEnvironment.isHeadless()) + { + ds = null; + throw new HeadlessException(); + } + + if (ds == null) + ds = new DragSource(); + return ds; } public static boolean isDragImageSupported() + throws NotImplementedException { + // FIXME: Implement this return false; } @@ -110,6 +130,43 @@ public class DragSource implements Serializable Transferable trans, DragSourceListener dsl, FlavorMap map) { + // http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html + + // This function creates a DragSourceContext object. This object tracks the + // state of the operation by listening to a native peer. In this situation, + // the DragSource may be obtained from the event or by an instance variable. + // This function also creates a new DragSourceContextPeer. + + // This function sends the same message to the context, which then forwards + // it to the peer, passing itself as a parameter. Now, the native system has + // access to the Transferable through the context. + + // FIXME: Add check to determine if dragging. + + try + { + flavorMap = map; + + if (peer == null) + peer = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger); + + if (context == null) + context = createDragSourceContext(peer, trigger, + dragCursor, + dragImage, + imageOffset, trans, + dsl); + + if (peer == null) + throw new InvalidDnDOperationException(); + + peer.startDrag(context, dragCursor, dragImage, imageOffset); + } + catch (Exception e) + { + throw new InvalidDnDOperationException("Drag and Drop system is " + + "unable to initiate a drag operation."); + } } /** @@ -156,7 +213,7 @@ public class DragSource implements Serializable /** * Creates the DragSourceContext to handle this drag. * - * @exception IllegalArgumentException FIXME + * @exception IllegalArgumentException * @exception NullPointerException If dscp, dgl, dragImage or t is null. */ protected DragSourceContext @@ -164,7 +221,7 @@ public class DragSource implements Serializable Cursor cursor, Image image, Point offset, Transferable t, DragSourceListener dsl) { - return null; + return new DragSourceContext(peer, dge, cursor, image, offset, t, dsl); } public FlavorMap getFlavorMap() @@ -172,42 +229,22 @@ public class DragSource implements Serializable return flavorMap; } - /** - * Dummy DragGestureRecognizer when Toolkit doesn't support drag and drop. - */ - static class NoDragGestureRecognizer extends DragGestureRecognizer - { - NoDragGestureRecognizer(DragSource ds, Component c, int actions, - DragGestureListener dgl) - { - super(ds, c, actions, dgl); - } - - protected void registerListeners() { } - protected void unregisterListeners() { } - } - - public DragGestureRecognizer - createDragGestureRecognizer(Class recognizer, Component c, int actions, - DragGestureListener dgl) + public DragGestureRecognizer createDragGestureRecognizer(Class recognizer, + Component c, + int actions, + DragGestureListener dgl) { - DragGestureRecognizer dgr; - dgr = Toolkit.getDefaultToolkit () - .createDragGestureRecognizer (recognizer, this, c, actions, - dgl); - - if (dgr == null) - dgr = new NoDragGestureRecognizer(this, c, actions, dgl); - - return dgr; + return Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer, + this, c, + actions, dgl); } - public DragGestureRecognizer - createDefaultDragGestureRecognizer(Component c, int actions, - DragGestureListener dgl) + public DragGestureRecognizer createDefaultDragGestureRecognizer(Component c, + int actions, + DragGestureListener dgl) { - return createDragGestureRecognizer (MouseDragGestureRecognizer.class, c, - actions, dgl); + return createDragGestureRecognizer(MouseDragGestureRecognizer.class, c, + actions, dgl); } /** @@ -275,4 +312,17 @@ public class DragSource implements Serializable // Return an empty EventListener array. return new EventListener [0]; } + + /** + * TODO + * @return + * + * @since 1.5 + */ + public static int getDragThreshold() + throws NotImplementedException + { + // FIXME: Not implemented. + return 4; + } } // class DragSource diff --git a/libjava/classpath/java/awt/dnd/DragSourceContext.java b/libjava/classpath/java/awt/dnd/DragSourceContext.java index 88607b0..1fee5c0 100644 --- a/libjava/classpath/java/awt/dnd/DragSourceContext.java +++ b/libjava/classpath/java/awt/dnd/DragSourceContext.java @@ -70,8 +70,8 @@ public class DragSourceContext 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 boolean useCustomCursor; + private int sourceActions; private Image image; private Point offset; @@ -82,16 +82,17 @@ public class DragSourceContext * 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. + * @exception NullPointerException If peer, trans or trigger is null or if the + * image is not null but the offset is. */ public DragSourceContext (DragSourceContextPeer peer, DragGestureEvent trigger, Cursor cursor, Image image, Point offset, Transferable trans, DragSourceListener dsl) - throws NotImplementedException - { + { if (peer == null - || trigger == null) + || trigger == null || trans == null + || (image != null && offset == null)) throw new NullPointerException (); if (trigger.getComponent () == null @@ -108,37 +109,77 @@ public class DragSourceContext this.offset = offset; this.transferable = trans; this.dragSourceListener = dsl; + this.sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions(); - throw new Error ("not implemented"); + setCursor(cursor); + updateCurrentCursor(trigger.getDragAction(), sourceActions, DEFAULT); } + /** + * Returns the DragSource object associated with the + * DragGestureEvent. + * + * @return the DragSource associated with the trigger. + */ public DragSource getDragSource() { return trigger.getDragSource (); } + /** + * Returns the component associated with this. + * + * @return the component associated with the trigger. + */ public Component getComponent() { return trigger.getComponent (); } + /** + * Gets the trigger associated with this. + * + * @return the trigger. + */ public DragGestureEvent getTrigger() { return trigger; } + /** + * Returns the source actions for the DragGestureRecognizer. + * + * @return the source actions for DragGestureRecognizer. + */ public int getSourceActions() { - return trigger.getSourceAsDragGestureRecognizer ().getSourceActions (); + if (sourceActions == 0) + sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions(); + return sourceActions; } - public void setCursor (Cursor cursor) - throws NotImplementedException + /** + * Sets the cursor for this drag operation to the specified cursor. + * + * @param cursor c - the Cursor to use, or null to use the default drag + * cursor. + */ + public void setCursor(Cursor cursor) { + if (cursor == null) + useCustomCursor = false; + else + useCustomCursor = true; this.cursor = cursor; - // FIXME: Check if we need to do more here + peer.setCursor(cursor); } + /** + * Returns the current cursor or null if the default + * drag cursor is used. + * + * @return the current cursor or null. + */ public Cursor getCursor() { return cursor; @@ -165,48 +206,160 @@ public class DragSourceContext dragSourceListener = null; } + /** + * This function tells the peer that the DataFlavors have been modified. + */ public void transferablesFlavorsChanged() - throws NotImplementedException { + peer.transferablesFlavorsChanged(); } + /** + * Calls dragEnter on the listeners registered with this + * and with the DragSource. + * + * @param e - the DragSourceDragEvent + */ public void dragEnter(DragSourceDragEvent e) - throws NotImplementedException { + if (dragSourceListener != null) + dragSourceListener.dragEnter(e); + + DragSource ds = getDragSource(); + DragSourceListener[] dsl = ds.getDragSourceListeners(); + for (int i = 0; i < dsl.length; i++) + dsl[i].dragEnter(e); + + updateCurrentCursor(e.getDropAction(), e.getTargetActions(), ENTER); } + /** + * Calls dragOver on the listeners registered with this + * and with the DragSource. + * + * @param e - the DragSourceDragEvent + */ public void dragOver(DragSourceDragEvent e) - throws NotImplementedException { + if (dragSourceListener != null) + dragSourceListener.dragOver(e); + + DragSource ds = getDragSource(); + DragSourceListener[] dsl = ds.getDragSourceListeners(); + for (int i = 0; i < dsl.length; i++) + dsl[i].dragOver(e); + + updateCurrentCursor(e.getDropAction(), e.getTargetActions(), OVER); } - + + /** + * Calls dragExit on the listeners registered with this + * and with the DragSource. + * + * @param e - the DragSourceEvent + */ public void dragExit(DragSourceEvent e) - throws NotImplementedException { + if (dragSourceListener != null) + dragSourceListener.dragExit(e); + + DragSource ds = getDragSource(); + DragSourceListener[] dsl = ds.getDragSourceListeners(); + for (int i = 0; i < dsl.length; i++) + dsl[i].dragExit(e); + + updateCurrentCursor(0, 0, DEFAULT); } + /** + * Calls dropActionChanged on the listeners registered with this + * and with the DragSource. + * + * @param e - the DragSourceDragEvent + */ public void dropActionChanged(DragSourceDragEvent e) - throws NotImplementedException { + if (dragSourceListener != null) + dragSourceListener.dropActionChanged(e); + + DragSource ds = getDragSource(); + DragSourceListener[] dsl = ds.getDragSourceListeners(); + for (int i = 0; i < dsl.length; i++) + dsl[i].dropActionChanged(e); + + updateCurrentCursor(e.getDropAction(), e.getTargetActions(), CHANGED); } + /** + * Calls dragDropEnd on the listeners registered with this + * and with the DragSource. + * + * @param e - the DragSourceDropEvent + */ public void dragDropEnd(DragSourceDropEvent e) - throws NotImplementedException { + if (dragSourceListener != null) + dragSourceListener.dragDropEnd(e); + + DragSource ds = getDragSource(); + DragSourceListener[] dsl = ds.getDragSourceListeners(); + for (int i = 0; i < dsl.length; i++) + dsl[i].dragDropEnd(e); } + /** + * Calls dragMouseMoved on the listeners registered with the DragSource. + * + * @param e - the DragSourceDragEvent + */ public void dragMouseMoved(DragSourceDragEvent e) - throws NotImplementedException { + DragSource ds = getDragSource(); + DragSourceMotionListener[] dsml = ds.getDragSourceMotionListeners(); + for (int i = 0; i < dsml.length; i++) + dsml[i].dragMouseMoved(e); } + /** + * Returns the Transferable set with this object. + * + * @return the transferable. + */ public Transferable getTransferable() { return transferable; } + /** + * This function sets the drag cursor for the specified operation, actions and + * status if the default drag cursor is active. Otherwise, the cursor is not + * updated in any way. + * + * @param dropOp - the current operation. + * @param targetAct - the supported actions. + * @param status - the status of the cursor (constant). + */ protected void updateCurrentCursor(int dropOp, int targetAct, int status) throws NotImplementedException { + // FIXME: Not implemented fully + if (!useCustomCursor) + { + Cursor cursor = null; + switch (status) + { + case ENTER: + break; + case CHANGED: + break; + case OVER: + break; + default: + break; + } + + this.cursor = cursor; + peer.setCursor(cursor); + } } } // class DragSourceContext diff --git a/libjava/classpath/java/awt/dnd/DropTarget.java b/libjava/classpath/java/awt/dnd/DropTarget.java index b0d4c2a..a365056 100644 --- a/libjava/classpath/java/awt/dnd/DropTarget.java +++ b/libjava/classpath/java/awt/dnd/DropTarget.java @@ -38,13 +38,18 @@ exception statement from your version. */ package java.awt.dnd; +import gnu.classpath.NotImplementedException; + import java.awt.Component; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; import java.awt.Point; import java.awt.datatransfer.FlavorMap; +import java.awt.dnd.peer.DropTargetPeer; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.peer.ComponentPeer; +import java.awt.peer.LightweightPeer; import java.io.Serializable; import java.util.EventListener; import java.util.TooManyListenersException; @@ -79,19 +84,25 @@ public class DropTarget } protected void stop () + throws NotImplementedException { + // FIXME: implement this } public void actionPerformed (ActionEvent e) + throws NotImplementedException { + // FIXME: implement this } } private Component component; private FlavorMap flavorMap; private int actions; + private DropTargetPeer peer; private DropTargetContext dropTargetContext; private DropTargetListener dropTargetListener; + private DropTarget.DropTargetAutoScroller autoscroller; private boolean active = true; /** @@ -150,12 +161,15 @@ public class DropTarget if (GraphicsEnvironment.isHeadless ()) throw new HeadlessException (); - component = c; - actions = i; + setComponent(c); + setDefaultActions(i); dropTargetListener = dtl; flavorMap = fm; setActive (b); + + if (c != null) + c.setDropTarget(this); } /** @@ -211,33 +225,46 @@ public class DropTarget public void addDropTargetListener (DropTargetListener dtl) throws TooManyListenersException { + if (dropTargetListener != null) + throw new TooManyListenersException (); + dropTargetListener = dtl; } public void removeDropTargetListener(DropTargetListener dtl) { - // FIXME: Do we need to do something with dtl ? - dropTargetListener = null; + if (dropTargetListener != null) + dropTargetListener = null; } public void dragEnter(DropTargetDragEvent dtde) { + if (dropTargetListener != null) + dropTargetListener.dragEnter(dtde); } public void dragOver(DropTargetDragEvent dtde) { + if (dropTargetListener != null) + dropTargetListener.dragOver(dtde); } public void dropActionChanged(DropTargetDragEvent dtde) { + if (dropTargetListener != null) + dropTargetListener.dropActionChanged(dtde); } public void dragExit(DropTargetEvent dte) { + if (dropTargetListener != null) + dropTargetListener.dragExit(dte); } public void drop(DropTargetDropEvent dtde) { + if (dropTargetListener != null) + dropTargetListener.drop(dtde); } public FlavorMap getFlavorMap() @@ -250,12 +277,29 @@ public class DropTarget flavorMap = fm; } - public void addNotify(java.awt.peer.ComponentPeer peer) + public void addNotify(ComponentPeer p) { + Component c = component; + while (c != null && p instanceof LightweightPeer) + { + p = c.getPeer(); + c = c.getParent(); + } + + if (p instanceof DropTargetPeer) + { + peer = ((DropTargetPeer) p); + peer.addDropTarget(this); + } + else + peer = null; } - public void removeNotify(java.awt.peer.ComponentPeer peer) + public void removeNotify(ComponentPeer p) { + ((DropTargetPeer) peer).removeDropTarget(this); + peer = null; + p = null; } public DropTargetContext getDropTargetContext() @@ -268,24 +312,34 @@ public class DropTarget protected DropTargetContext createDropTargetContext() { - return new DropTargetContext (this); + if (dropTargetContext == null) + dropTargetContext = new DropTargetContext (this); + + return dropTargetContext; } protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller (Component c, Point p) { - return new DropTarget.DropTargetAutoScroller (c, p); + if (autoscroller == null) + autoscroller = new DropTarget.DropTargetAutoScroller (c, p); + + return autoscroller; } protected void initializeAutoscrolling(Point p) { + createDropTargetAutoScroller (component, p); } protected void updateAutoscroll(Point dragCursorLocn) { + if (autoscroller != null) + autoscroller.updateLocation(dragCursorLocn); } protected void clearAutoscroll() { + autoscroller = null; } } // class DropTarget diff --git a/libjava/classpath/java/awt/dnd/DropTargetContext.java b/libjava/classpath/java/awt/dnd/DropTargetContext.java index 4a26d90..31945c3 100644 --- a/libjava/classpath/java/awt/dnd/DropTargetContext.java +++ b/libjava/classpath/java/awt/dnd/DropTargetContext.java @@ -37,12 +37,11 @@ exception statement from your version. */ package java.awt.dnd; -import gnu.classpath.NotImplementedException; - import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.peer.DropTargetContextPeer; import java.io.IOException; import java.io.Serializable; import java.util.Arrays; @@ -86,7 +85,7 @@ public class DropTargetContext implements Serializable private DropTarget dropTarget; private int targetActions; - private java.awt.dnd.peer.DropTargetContextPeer dtcp; + private DropTargetContextPeer dtcp; // package private DropTargetContext(DropTarget dropTarget) @@ -104,7 +103,7 @@ public class DropTargetContext implements Serializable return dropTarget.getComponent(); } - public void addNotify(java.awt.dnd.peer.DropTargetContextPeer dtcp) + public void addNotify(DropTargetContextPeer dtcp) { this.dtcp = dtcp; } @@ -130,39 +129,39 @@ public class DropTargetContext implements Serializable * @exception InvalidDnDOperationException If a drop is not outstanding. */ public void dropComplete(boolean success) - throws NotImplementedException { - // FIXME: implement this + if (dtcp != null) + dtcp.dropComplete(success); } protected void acceptDrag(int dragOperation) - throws NotImplementedException { - // FIXME: implement this + if (dtcp != null) + dtcp.acceptDrag(dragOperation); } protected void rejectDrag() - throws NotImplementedException { - // FIXME: implement this + if (dtcp != null) + dtcp.rejectDrag(); } protected void acceptDrop(int dropOperation) - throws NotImplementedException { - // FIXME: implement this + if (dtcp != null) + dtcp.acceptDrop(dropOperation); } protected void rejectDrop() - throws NotImplementedException { - // FIXME: implement this + if (dtcp != null) + dtcp.rejectDrop(); } protected DataFlavor[] getCurrentDataFlavors() - throws NotImplementedException { - // FIXME: implement this + if (dtcp != null) + dtcp.getTransferDataFlavors(); return null; } @@ -182,9 +181,11 @@ public class DropTargetContext implements Serializable * @exception InvalidDnDOperationException If a drag is not outstanding. */ protected Transferable getTransferable() - throws InvalidDnDOperationException, NotImplementedException + throws InvalidDnDOperationException { - // FIXME: implement this + // FIXME: Implement this + if (dtcp != null) + return dtcp.getTransferable(); return null; } diff --git a/libjava/classpath/java/awt/dnd/DropTargetDragEvent.java b/libjava/classpath/java/awt/dnd/DropTargetDragEvent.java index 6cdc3a2..89bf177 100644 --- a/libjava/classpath/java/awt/dnd/DropTargetDragEvent.java +++ b/libjava/classpath/java/awt/dnd/DropTargetDragEvent.java @@ -40,6 +40,7 @@ package java.awt.dnd; import java.awt.Point; import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; import java.util.List; /** @@ -114,8 +115,7 @@ public class DropTargetDragEvent extends DropTargetEvent public int getDropAction() { - return 0; - //return dropAction & ((DropTargetContext) source).getTargetActions(); + return dropAction & ((DropTargetContext) source).getTargetActions(); } public Point getLocation () @@ -137,4 +137,17 @@ public class DropTargetDragEvent extends DropTargetEvent { context.rejectDrag (); } + + /** + * TODO + * + * @return + * + * @since 1.5 + */ + public Transferable getTransferable() + { + // FIXME: Not implemented + return null; + } } // class DropTargetDragEvent diff --git a/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java b/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java index a745bd2..9754bb1 100644 --- a/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java +++ b/libjava/classpath/java/awt/dnd/DropTargetDropEvent.java @@ -37,8 +37,6 @@ exception statement from your version. */ package java.awt.dnd; -import gnu.classpath.NotImplementedException; - import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; @@ -161,9 +159,8 @@ public class DropTargetDropEvent extends DropTargetEvent } public void dropComplete(boolean success) - throws NotImplementedException { - // FIXME: implement this + context.dropComplete(success); } public boolean isLocalTransfer() diff --git a/libjava/classpath/java/awt/dnd/InvalidDnDOperationException.java b/libjava/classpath/java/awt/dnd/InvalidDnDOperationException.java index 2fd9767..4a75610 100644 --- a/libjava/classpath/java/awt/dnd/InvalidDnDOperationException.java +++ b/libjava/classpath/java/awt/dnd/InvalidDnDOperationException.java @@ -59,6 +59,7 @@ public class InvalidDnDOperationException extends IllegalStateException */ public InvalidDnDOperationException() { + super(); } /** |