src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 37,46 **** --- 37,48 ---- import java.io.Serializable; import java.util.Arrays; import java.util.List; + import sun.awt.AWTAccessor; + import sun.awt.AWTAccessor.DropTargetContextAccessor; /** * A <code>DropTargetContext</code> is created * whenever the logical cursor associated * with a Drag and Drop operation coincides with the visible geometry of
*** 56,65 **** --- 58,80 ---- public class DropTargetContext implements Serializable { private static final long serialVersionUID = -634158968993743371L; + static { + AWTAccessor.setDropTargetContextAccessor(new DropTargetContextAccessor() { + @Override + public void reset(DropTargetContext dtc) { + dtc.reset(); + } + @Override + public void setDropTargetContextPeer(DropTargetContext dtc, + DropTargetContextPeer dtcp) { + dtc.setDropTargetContextPeer(dtcp); + } + }); + } /** * Construct a <code>DropTargetContext</code> * given a specified <code>DropTarget</code>. * * @param dt the DropTarget to associate with
*** 88,111 **** */ public Component getComponent() { return dropTarget.getComponent(); } /** - * Called when associated with the <code>DropTargetContextPeer</code>. - * - * @param dtcp the <code>DropTargetContextPeer</code> - */ - - public void addNotify(DropTargetContextPeer dtcp) { - dropTargetContextPeer = dtcp; - } - - /** * Called when disassociated with the <code>DropTargetContextPeer</code>. */ ! ! public void removeNotify() { dropTargetContextPeer = null; transferable = null; } /** --- 103,115 ---- */ public Component getComponent() { return dropTarget.getComponent(); } /** * Called when disassociated with the <code>DropTargetContextPeer</code>. */ ! void reset() { dropTargetContextPeer = null; transferable = null; } /**
*** 280,295 **** /** * Get the <code>DropTargetContextPeer</code> * * @return the platform peer */ - DropTargetContextPeer getDropTargetContextPeer() { return dropTargetContextPeer; } /** * Creates a TransferableProxy to proxy for the specified * Transferable. * * @param t the <tt>Transferable</tt> to be proxied * @param local <tt>true</tt> if <tt>t</tt> represents --- 284,305 ---- /** * Get the <code>DropTargetContextPeer</code> * * @return the platform peer */ DropTargetContextPeer getDropTargetContextPeer() { return dropTargetContextPeer; } /** + * Sets the {@code DropTargetContextPeer} + */ + void setDropTargetContextPeer(final DropTargetContextPeer dtcp) { + dropTargetContextPeer = dtcp; + } + + /** * Creates a TransferableProxy to proxy for the specified * Transferable. * * @param t the <tt>Transferable</tt> to be proxied * @param local <tt>true</tt> if <tt>t</tt> represents
*** 410,420 **** /** * The DropTarget associated with this DropTargetContext. * * @serial */ ! private DropTarget dropTarget; private transient DropTargetContextPeer dropTargetContextPeer; private transient Transferable transferable; } --- 420,430 ---- /** * The DropTarget associated with this DropTargetContext. * * @serial */ ! private final DropTarget dropTarget; private transient DropTargetContextPeer dropTargetContextPeer; private transient Transferable transferable; }