This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 57037 - Explorer Drag & Drop works poorly
Summary: Explorer Drag & Drop works poorly
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords: UI
: 58005 (view as bug list)
Depends on:
Blocks: 70468
  Show dependency tree
 
Reported: 2005-03-26 06:30 UTC by Torbjorn Norbye
Modified: 2008-12-22 19:18 UTC (History)
6 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjorn Norbye 2005-03-26 06:30:46 UTC
This is a more general issue, but I will begin by describing a couple of visible
problems because of it.

The bug is most severe on the Mac, but has problems on other platforms too so
I've marked OS "All".

First on a Mac, try this - go to the Files view, and start dragging a file. Drag
it slowly so you can see what is going on.  First note that there are TWO
cursors (!) offset by about 30 pixels. Second notice how the cursor occasionally
flickers.

Second, on Windows, if you drag over a surface that calls
DropTargetDragEvent.rejectDrag(), the cursor will flicker as the mouse as being
dragged. (By "flicker" I mean it the cursor will quickly change shapes between
the native cursor and the NetBeans cursor.) 

Third, notice how the cursor used for drag & drop in NetBeans is not the system
one used by other applications. This is not the case for "normal" drag & drop
java code where you just enable dragging on components like JTree.

I'm working on an application built on top of Netbeans which relies heavily on
Drag & Drop, so this is a problem.

As far as I understand it, the drag/drop support in the openide explorer code
was written before the big DND cleanup in JDK1.4. So the code is not using any
of the new drag & drop apis, like TransferHandler.

I think what is needed is to rewrite portions of this to use the 1.4 APIs
instead. This will probably mostly mean just removing code, since doing drag &
drop is a lot simpler now with 1.4. The special glasspane code you have for the
explorer trees is fine and can be left alone.  In my application, I had a
separate window (not using explorer but a straight JTree) and I added drag &
drop to it very simply (by using the builtin drag & drop support provided by
JTree (as of JDK1.4), and I ported the NetBeans glasspane code to run with it.
So you get the best of both worlds - both NetBeans drop target feedback allowing
you to drop not just on nodes but between nodes, as well as "native" drag & drop.
Comment 1 Petr Nejedly 2005-03-26 18:00:02 UTC
Jirka maintains explorer DnD..
Comment 2 Jan Chalupa 2005-03-29 11:23:24 UTC
I would agree that the DnD experience is not the same as with native apps on
Windows, but I don't see any flickering, two cursor and severe redrawing
problems. This probably *is* platform specific. Does Mac JDK support the
-Dsun.java2d.noddraw=true options or its equivalent? If so, can you try what
happens when you turn it on?

While I also agree that DnD support in NetBeans should be revisited and possibly
reimplemented, I don't think we have time to make it for 4.1. We'll do some more
experiments and try to see if there are any obvious bugs that could still be
fixed. Otherwise, this issue will be a candidate for waiver.
Comment 3 Jiri Rechtacek 2005-03-30 12:07:04 UTC
Tor, this issue contains two defect and one request for enhancement. See my
comments bellow:

> First note that there are TWO
cursors (!) offset by about 30 pixels. Second notice how the cursor occasionally
flickers.

It's really bug with cursors on Mac, probably something wrong in merging the
images in Utilities.createCustomCursor(). I'll investigate else possibilities to
set custom cursor for DnD operation, already reported as issue 56558.

> Second, on Windows, if you drag over a surface that calls
DropTargetDragEvent.rejectDrag(), the cursor will flicker as the mouse as being
dragged.

Yes, the cursor slightly flickers. I'm going to look on it. Maybe reduction of
calling of rejectDrop() would help. But I don't see as some significant problem
  of usability of DnD.

> Third, notice how the cursor used for drag & drop in NetBeans is not the system
one used by other applications. This is not the case for "normal" drag & drop
java code where you just enable dragging on components like JTree.

Definitely, it's a should have feature, it's needs to implemented it. In
general, DnD support in Netbeans is candidate for revisit, possible code
simplification and MIME types support. It's at least asked by task 35027.

It change this as task, 1) is duplicate of issue 56558, 2) will be investigate
ASAP, 3) as new feature.

Tor, are you fine with this evaluation?
Thanks for feedback.
Comment 4 Torbjorn Norbye 2005-04-18 21:55:36 UTC
For some reason, I'm no longer getting any notifications when bugs I've filed
are updated in issuezilla. That's happened on several issues I thought I was
tracking. So sorry for not noticing this earlier.

Yes, the evaluation looks good.  Just to clarify: the two-cursors problem is an
issue on the mac.  The flicker is an issue on Windows.

And there is a separate issue (but related) I've also noted: the drop position
is wrong. This is noticeable when you drag over nodes in a JTree when the drag
is initiated from an explorer. If I drag from the desktop (or any other
non-NetBeans DND, such as a normal JDK initiated drag) the positions are correct
- as soon as the pointer points to a node, it's highlighted. With NetBeans DND
however it is several pixels off - not until I've pointed about a third of the
node height into the node does it get highlighted as a drop target.
Comment 5 ssffleming 2005-04-18 21:58:49 UTC
*** Issue 58005 has been marked as a duplicate of this issue. ***
Comment 6 ssffleming 2005-04-18 22:09:36 UTC
We had worked around this issue by avoiding showing no drop feedback, but this 
creates some problems for usability with our new components.  A fix would be 
desired ideally in the next 6 weeks, but this is not top priority.
Comment 7 ssffleming 2005-05-03 06:00:11 UTC
This problem is serious because some components are so small that the error
between the hotspot and the graphical pointer position is bigger than the 
component size.  In other words if you position the mouse pointer anywhere
on the object, the drop will miss.  Would it be possible to get a patch?
Just aligning the hotspot and the graphical pointer arrow would really help.
Note the hotspot problem is on XP and is not a Mac only bug.
Comment 8 _ oracmpalmer 2005-11-01 05:21:29 UTC
Has any work been done on this. I am having some similiar challenges in my
application as well.
Comment 9 gwaldon 2005-11-03 18:46:47 UTC
I am implementing a DnD support in my custom editor and I am having a similar
issue with the cursor position. I think the problem lies in the gif images used
to draw these cursors; the tip of the arrow should be on the upper left corner
of the image; see  gifs in org.openide.resources and compare e.g. with MS word. 
Comment 10 Stanislav Aubrecht 2006-02-10 11:02:55 UTC
i replaced the custom drag cursors with native ones. that should fix the
flickering windows and the 'double' cursors on mac os.
the only drawback is that users don't have visual feedback for 'no drop'
operation because on mac this cursor is the same as the regular 'drag over'
cursor. on the other hand it is consistent with drag and drop behavior on mac
os. but if there's enough interest i have a solution ready that can force a
custom 'no drop' cursor on mac.


Checking in ListViewDropSupport.java;
/cvs/openide/explorer/src/org/openide/explorer/view/ListViewDropSupport.java,v 
<--  ListViewDropSupport.java
new revision: 1.4; previous revision: 1.3
done
Checking in TreeViewDropSupport.java;
/cvs/openide/explorer/src/org/openide/explorer/view/TreeViewDropSupport.java,v 
<--  TreeViewDropSupport.java
new revision: 1.4; previous revision: 1.3
done
Checking in ExplorerDragSupport.java;
/cvs/openide/explorer/src/org/openide/explorer/view/ExplorerDragSupport.java,v 
<--  ExplorerDragSupport.java
new revision: 1.2; previous revision: 1.1
done
Comment 11 Stanislav Aubrecht 2006-02-23 11:25:42 UTC
tor, can you please verify how the drag and drop behaves now after my fix?
i think this issue can be closed as fixed.
Comment 12 Stanislav Aubrecht 2006-03-20 16:31:18 UTC
since there were no comments i'm closing this as fixed.
please feel free to reopen.