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 191168 - Visual Library Drop Event Problem
Summary: Visual Library Drop Event Problem
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Graph (show other bugs)
Version: 6.x
Hardware: All All
: P1 normal (vote)
Assignee: khurram_shahzad_pk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-20 09:22 UTC by khurram_shahzad_pk
Modified: 2010-10-25 16:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
DND sample (14.01 KB, application/zip)
2010-10-22 15:38 UTC, David Kaspar
Details
The GraphPinScene file (36.98 KB, application/octet-stream)
2010-10-24 11:46 UTC, khurram_shahzad_pk
Details
DND sample 2 (19.92 KB, application/zip)
2010-10-25 16:27 UTC, David Kaspar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description khurram_shahzad_pk 2010-10-20 09:22:08 UTC
I am working with visual library and i want to have drag and drop facility. I have included AcceptAction in my Scene Class. The method isAcceptable works fine but method accept is never invoked. I have also tried to overwrite the adapter class drop method but it is also not invoked. Other overwritten functions like drag, drag enter.... they work fine but drop method is never invoked.

Please fix this as soon as possible.

Warmest Regards,
Khurram
Comment 1 Antonin Nebuzelsky 2010-10-22 13:17:26 UTC
Davide, could you help evaluating this issue?
Comment 2 David Kaspar 2010-10-22 15:36:30 UTC
I have tried to reproduce your issue but it works correctly. See the attached suite. It contains a single sample module with a single window which contains a simple Scene - see DNDScene class.
It works correctly.
Note that I have my AcceptAction set to the Scene instance directly.

For example I have added even one LayerWidget into the scene. Note that it assign the actions to this LayerWidget instance - it will not work. It is because the LayerWidget does not contains any sub-Widgets and therefore its size is [0,0]. Therefore you cannot point the LayerWidget instance on the scene. With the scene itself it is working because the Scenee is automatically spread across the whole JScrollPane viewport area even if there is item inside.

Resolving as Invalid. If you find you use-case different from the one that is mentioned in the attached suite, please, reopen the issue and attach your test-case there. Thank you.
Comment 3 David Kaspar 2010-10-22 15:38:03 UTC
Created attachment 102575 [details]
DND sample
Comment 4 khurram_shahzad_pk 2010-10-24 11:46:23 UTC
Created attachment 102598 [details]
The GraphPinScene file

Hi,

I have attached my GraphPinScene file and i am adding the acceptaction at line 398 and onwards, please have a look and let me know whats wrong with this. I will be very thankful to you.

warmest regards,
khurram
Comment 5 David Kaspar 2010-10-25 16:27:27 UTC
I have looked at your GraphPinScene.java file. It uses a lot of external classes that I do not have. Therefore I have stripped it down to bare minimum and tested it.

The only issue has been:
1) Do not call "Scene.addNode" method from the AcceptProvider.isAcceptable method since the isAcceptable method should just check whether you can accept the data flavor.
2) Do not call validate from "attachNodeWidget" and similar methods.
3) Transferable.getTransferData method is throwing exception when a drop is not accepted yet. Therefore just check for the DataFlavor but do not call "getTransferData"... The getTransferData can be called from the AcceptProvider.accept method only.

I am attaching a DND sample with the strip down version of your GraphPinScene.java file included and renamed to the DNDScene.java file.

Resolving the issue as WORKSFORME.

If your issue still remains, please, reopen the issue again and attach the strip down version of your GraphPinScene which depends only on classes from NetBeans Platform (the best if it would depend only on Visual Library classes).
Comment 6 David Kaspar 2010-10-25 16:27:59 UTC
Created attachment 102620 [details]
DND sample 2