Drag and drop issue testing DataFlavor using TransferHandler

Hello all,
I hope someone can help me. I need to add logic to my TransferHandler to prevent specific DataFlavors from being imported (some of the time) based on various tests. I am attempting to use the canImport(TransferSupport support) method to enforce this logic, but I'm not sure how to find out which specific DataFlavor the "canImport" method refers to. Is this the correct way to do this? Any advice / suggestions would be great.

Hi, me again (the one who posted this topic)...
I am considering adding many, separate "drag listener" for each object type so my drop can know exactly what the object type is by it's single supported flavor. This approach doesn't seem very elegant :-(. I just need to know what type of DataFlavor (from a range of acceptable DataFlavors) is being dragged across the screen so I can update the mouse pointer and provide real-time user feedback during the drag.
Is there any way of specifying exactly what DataFlavors are acceptable when the Drag begins (so I can reuse the same code, rather than have many, many listeners)?
Has anyone out there got a better solution? I'm attempting to setup a "standard" for our project, so I want to make sure it's the best approach.

Similar Messages

  • Drag and Drop issue from Explorer folder to Music Library

    Hello
    I just updated my iTunes to 8.0.0.20 but something unexpected happened. I can’t drag and drop anymore songs from an explorer folder into my music library when my view mode is set to Grid (Album, Artist, Genre or Composer).
    When I try I have a kind of interdiction circle under my pointer.
    I can only perform this operation in list mode view. Few hours ago it was still possible to perform it but not after I updated. I reinstalled my iTunes but the problem persists.
    I have read the forums I know I can add to my playlist as usual by using the menu. But is it possible to get drag and drop operation when I drags song directly from a folder on my explorer window?
    It would be very appreciated if someone has an answer. I really messed up my library trying to fix this

    I fixed the drag and drop issues I had! Turns out they were caused by the permission problems of Vista. To fix it I just made sure all the files in the iTunes folder and sub folders were full control by my account.
    Make sure you check the properties of the iTunes database specifically because before, the iTunes folder had the correct permissions but they hadn't actually been inherited correctly by the iTunes DB files. Hope this helps anyone else.

  • Mail attachment drag and drop issue

    Been facing serious mail attachment drag-and-drop issue since 10.8 (if not from 10.7) and was disappointed to find the same behaviour still in 10.9.
    When I drag and drop a picture file (from Finder for example) into a message window or onto the Mail.app Dock icon, the system's window management somehow gets confused: my next step is to click on the message window in order to start typing. However, the mouse click causes that very window to escape under all other open applications / windows. Further on, I dig under to find the escapee and click again: once more it escapes. This can go on for a few annoying rounds until gets solved in an unexplainable way. This behaviour in not consistent, but has happens in about 8 cases out of 10.
    Apart from Mail.app I do not experience drag and drop issues of any kind.
    Anyone else suffering from this?

    I'd be interested in the answer to this too.
    It only just started happening to me a day or so ago, about the time that I think I did an OS upgrade.
    I'm on OSX 10.8.2.
    Its annoying.
    I can drop and drag in Finder but it just affects email.

  • Drag and drop issue alternatives

    Hello
    i'm having the same drag and drop issue as the other guys here. basically cant drag and drop to the desktop. Im looking for a workaround that doesnt involve making temporary backups or repairing iphoto libraries. My library is 260gb and even though it is being backed up i dont have a spare 260gb.

    That does not exist - the workaround (maybe permanent solution - who knows) is
    File menu ==> export
    And BTW if you are not backingup all the time you are 100% guarenteed to lose all of your files and photos sooner or later
    LN

  • Drag and Drop issue in Jlist - Transferhandler not working

    Hi all,
    I have a problem associated with the drag and drop of components into a Jlist.
    When I drag component out of a Jlist, the control reaches inside transfer handler, but when I try to insert a component into the Jlist, the control does not reach inside Jlist transfer handler.
         jlist.setDropMode(DropMode.INSERT);
         jlist.setDragEnabled(true);
         jlist.setTransferHandler(new TransferHandler()
                   List fileList;
                   boolean export = false;
                   List<File> newList = null;
                   protected Transferable createTransferable(JComponent c)
                        System.out.println("inside handler");
                                    ..............................Please help me with this issue.
    Any help in this regard will be well appreciated with dukes.
    Regards,
    Anees

    AneesAhamed wrote:
    Hi all,
    I have a problem associated with the drag and drop of components into a Jlist.
    When I drag component out of a Jlist, the control reaches inside transfer handler, but when I try to insert a component into the Jlist, the control does not reach inside Jlist transfer handler.
    jlist.setDropMode(DropMode.INSERT);
    jlist.setDragEnabled(true);
    jlist.setTransferHandler(new TransferHandler()
                   List fileList;
                   boolean export = false;
                   List<File> newList = null;
                   protected Transferable createTransferable(JComponent c)
                        System.out.println("inside handler");
    ..............................Please help me with this issue.
    Any help in this regard will be well appreciated with dukes.If you're wondering why your createTransferable() method is not called when you drag from some other component and drop into the list it is because createTransferable() is called when you start dragging. So it would be the TransferHandler of the source component, not your target list, that has its createTransferable() called in that case.
    When the list is the target of a drag&drop you should see the canImport() method of your TransferHandler being called. Do a System.out(0 in that method as well and see if that is the case.

  • Drag-and-drop issue with Linux, KDE

    My application used to work fine, but when i tested it on Linux drag and drop stopped working.
    I used snippet that would take list of supported DataFlavors of Transferable and used for loop to find a javafilelist one. (isJavaFileListType()).
    Well, now, it does that flava scan, but it doesn't find javafilelisttype in the list!
    I tried to retrieve String, serializedobject.. no use. It throws and illegal action exception of DnD or something like that.
    Does anybody know what's wrong, or had similar issues? I use j2 of v 1.5.2
    I shall provide you with more info if it's something totally new.

    I'd be interested in the answer to this too.
    It only just started happening to me a day or so ago, about the time that I think I did an OS upgrade.
    I'm on OSX 10.8.2.
    Its annoying.
    I can drop and drag in Finder but it just affects email.

  • Wacky Drag and Drop issue with JNLP

    I'm sure I'll have to be a bit more descriptive but I'll just throw this out and see if anyone has any suggestions.
    I've got a swing app which is an administration tool to a rules engine I have built. I distribute the app to users using JNLP 1.2.
    Here's the problem. When I launch the app using JNLP, a portion of the app does not work. There is a panel in which I allow users to drag items off of a tree and onto a panel. They can drag and drop one item but when they attempt to drag and drop a second item it doesn't drop. If I take that same code which is being distributed via JNLP, copy it to the local machine and run it, it works. I can drag and drop all day long.
    There are no exceptions, no errors or funny gooey state things going on. I start the drag, the mouse pointer changes, I hover of the drop zone and let go of the mouse and it appears to drop, but the component does not show. Wacky.
    Does this set off any bells to anyone?
    Thanks,
    - Jay
    App compiled using 1.4.1_01.

    Ah ha.. Yes this does seem to the issue. Thanks for the response. I've tested it on a couple of machines and it works on the one's with 1.4.1 and it doesn't seem to work on 1.4.0 jre machines.
    NEW Question though, if I set my .jnlp to:
    <j2se version="1.4.1+"/>
    I get the 'ol 'Error Code 11 (11 Could not locate requested version'
    Is there any way to get this guy to auto-install???
    I've installed JRE 1.4.1 manually and it doesn't seem to pick that up either.
    Thanks...

  • Preview Drag and Drop Issue

    I use preview in school a lot. Converting lectures to PDF is a lot easier to use and i us a program called iFlash to make flash cards.
    What I want to do is use the text tool to highlight sections of text, drag them to the flash card window and then drop the text there. This is a really quick and easy way to make the flash cards.
    This works except when i click back to the card all the text that i dragged is deleted.
    Does anyone else have this issue. I have checked, this feature (highlight and drag...) works well in other programs (mail, pages) but not with my flash card program.
    Any ideas?

    I have checked, this feature (highlight and drag...) works well in other programs (mail, pages) but not with my flash card program.
    That suggests that the problem is with iFlash. Will it accept drags from other programs, besides Preview? If not, it probably doesn't support drag and drop at all. If it does, then its implementation is probably buggy, and you should contact the developer.

  • About Drag and drop issue

    As title, i am a newbie to flash using ActionScript 2.0 , and currently i enounter the problem with drag and drop coding. Below is my code:
    function dragSetup(clip, targ, position) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    this.onTarget=true;
    gotoAndStop(position);
    } else {
    this.onTarget=false;
    gotoAndStop(position);
    clip.myHomeX=clip._x;
    clip.myHomeY=clip._y;
    clip.onEnterFrame = function() {
    if(this.onTarget)
              this._x-=(this._x-this.myHomeX)/5;
              this._y-=(this._y-this.myHomeY)/5;
    function dragSetup2(clip, targ, correct) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    clip._visible = false;
    this.onTarget=false;
    gotoAndStop(correct+1);
    } else {
    this.onTarget=false;
    gotoAndStop(correct);
    var frame:Number = 1;
    dragSetup2(flexibleTxt, questionBox, frame);
    dragSetup(transparentTxt, questionBox, frame);
    dragSetup(blueTxt, questionBox, frame);
    dragSetup(TIRTxt, questionBox, frame);
    dragSetup(TRTxt, questionBox, frame);
    dragSetup(ssmTxt, questionBox, frame);
    dragSetup(siliconTxt, questionBox, frame);
    dragSetup(silicaTxt, questionBox, frame);
    dragSetup(silicateTxt, questionBox, frame);
    dragSetup(infraTxt, questionBox, frame);
    dragSetup(radioTxt, questionBox, frame);
    dragSetup(lightTxt, questionBox, frame);
    dragSetup(copperTxt, questionBox, frame);
    dragSetup(gopTxt, questionBox, frame);
    dragSetup(liquidTxt, questionBox, frame);
    The scenario is , whenever correct mc was drag and drop on the target mc , it move to the next frame with new target mc(new question) , for example "questionBox2".
    By applying the code above, everything work fine but i would like that whenever i "throw" the answer mc (flexibleTxt, blueTxt etc) , i want it to slide or glide for little more distance, jz like how u throw a card in real life on a smooth surface.
    I also prefer that when draging it's "angle?" change according to the direction of draging. For example if u point ur finger on north side of a card and drag to the east, it's "angle?" will change according to the direction u drag, in this case, means east.
    I know my description seem abit complicated but i really someone can undestand and help me solve this issue.
    This is the link i reference to for the code above,but i modify it to my own preference :http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37 /
    PS : can i attach my fla file in this forum? if can, why i cant found any attach button?

    I am having a similar but reverse problem: Under 10.5.2, when trying to push or pull files from my wireless MacBook Pro via my Airport Extreme base station to or from my wired G5 Power PC, files hang in mid copy then stall.
    The other way around -- working from the G5 -- I have no problem at all.
    This started with 10.5, but I'm not sure if it was .1 or .2 because I upgraded from 10.4 just recently and did the combined 10.5 updates all at once on both machines.
    Thanks

  • Drag and Drop- Can it be used in a responsive project?

    The drag and drop interaction is not clickable in a responsive project, is there a way I can still use it? I have tried to copy and paste it, but it doesn't work very well...

    Drag & Drop is not yet possible in Responsive Projects: Top issues | Adobe Captivate 8
    Lilybiri

  • My 'drag and drop' doesn't work using Mountain Lion OS X 10.8.2 on iMac

    Drag and drop occasionally works between folders but very rarely - and now not at all. I have tried various remedies suggested onthis forum, but they didn't work.
    Copy and paste is a real drag (sorry!)
    Hugh

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up guest users” (without the quotes) in the search box. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
    When you see the gray Apple logo, release the shift key.
    If you are prompted to log in, type your password, and then hold down the shift key again as you click Log in.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.  The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode.
    Test while in safe mode. Same problem?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

  • Drag and drop issue, please help.

    I can no longer drag and drop photos within photoshop elements 12.  When working with a layer, I want to move it to a layer within another existing file, and no longer have the option.  The only way I have fixed the issue in the past is uninstall and reinstall the program.  I've read other forum posts and followed the instructions by resetting preferences and it does not work.
    Does anyone have any solutions to this issue?  Please help!

    With both files open, simplest to tile them side by side, you should be able to drag the layer from the source file onto the target file. So long as it shows the 'grasping hand' you can release the mouse and it should add the layer to the target.
    So what is happening now on your system? When you drag the layer to the target what icon is shown - 'grasping hand', 'no entry', something else?
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • Organizer Drag and Drop Issue

    In PSE4 I am in Folder Location view working in Folder A. I drag and drop a few files to Folder B. Unfortunately now PSE puts me in Folder B. "I" didn't want to go to Folder B, I just wanted to put some files there. Other programs don't change the focus to the new folder. How can I get PSE4 not to do that?
    Thanks for any help.
    Dale

    Colin is right, but I have also been very frustrated by the behavior you mention, Michael. Thanks for that tip.
    Here is the weirdest thing. I am in Folder Location view and I have selected Folder 20070501 in the lefthand pane. On the right hand pane a band shows with that name followed by only one of the 97 pictures in the folder. Then comes a band by the name of the next directory and instead of showing any of the pictures actually in that directory, it shows a couple of pictures that are actually in the 2007501 directory. And so on it continues. Finally, the next directory in order is listed followed by the pictures actually in the 20070501 directory. It is nothing short of bizarre.
    HOWEVER, when I did what you suggested, Michael, everything was as it should be when I came back. So this seems to be just another variation of what you mentioned.
    Colin, you said you don't use Folder View much. Granted you can have pictures located anywhere and organize them with PSE4 but I've found for when I'm in Win Explorer and need to see something that having them organized by folders is helpful for me. Have either of you found a process for managing pictures that works well for you, because I'm still looking for the best way to do it including when to remove pictures from my hard drive.
    Dale

  • Album Artwork Drag and Drop issue

    Good morning all,
    After struggling with this last evening for some time I have decided it's time to ask the pros.
    In iTunes I used to be able to drag and drop album artwork. So, for instance, I would just go and google the album image I was looking for and then take that jpg and drop it in to whichever album is missing that particular cover on the main album screen.
    What seems to be happening now though is that iTunes thinks every jpg I try to drag over is actually a podcast and it takes that album cover and places it under "Podcasts"
    I know I could just go into the album properties and add the album art that way but this was just so much simpler.
    Any thoughts? Writing this in a hurry as well so please let me know if I need to be more specific.
    Thanks
    Chu

    That does not exist - the workaround (maybe permanent solution - who knows) is
    File menu ==> export
    And BTW if you are not backingup all the time you are 100% guarenteed to lose all of your files and photos sooner or later
    LN

  • Drag and drop issue: got an exception

    Hi there,
    I'm facing a problem with drag and drop. Basically I try to drag an AnchorPane (and all its children), representing a sticky note, from an AnchorPane to another. While trying to do it I got an exception. I followed some steps from the Oracle's documentation, but didn't help me.
    I created a method that reacts on the DRAG_DETECTED event which is the following:
    @FXML private void stickyDragDetected(MouseEvent event) {
      System.out.println("Drag detected");
      Dragboard db = ((Node) event.getSource()).startDragAndDrop(TransferMode.COPY_OR_MOVE);
      ClipboardContent cc = new ClipboardContent();
      cc.put(new DataFormat(PojoTask.class.getName()), task.get().convertToPojo());
      db.setContent(cc);
      event.consume();
      System.out.println("End drag detected");
    }Some explanations:
    - PojoTask a simple Pojo without any properties (because they're not serializable)
    - The variable task is declared like this: ObjectProperty<Task> task = new SimpleObjectProperty<Task>();
    - Task is a class similar to PojoTask but with properties
    - I use the PojoTask's class name because it's a custom drag'n'drop
    When I drag the AnchorPane, i got this exception, repeated multiple times (and nothing else):
    Glass detected outstanding Java exception at -[GlassViewDelegate sendJavaDndEvent:type:]:src/com/sun/mat/ui/GlassViewDelegate.m:774
    Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: PrismEventUtils.convertToTransferMode: ambiguous drop action: 3
         at com.sun.javafx.tk.quantum.PrismEventUtils.convertToTransferMode(PrismEventUtils.java:193)
         at com.sun.javafx.tk.quantum.PrismEventUtils.glassDragEventToFX(PrismEventUtils.java:147)
         at com.sun.javafx.tk.quantum.PrismEventUtils.glassDragSourceEventToFX(PrismEventUtils.java:167)
         at com.sun.javafx.tk.quantum.QuantumToolkit.convertDragSourceEventToFX(QuantumToolkit.java:1141)
         at javafx.scene.Scene$DragSourceListener.dragDropEnd(Scene.java:2971)
         at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragEnd(GlassSceneDnDEventHandler.java:199)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragEnd(GlassViewEventHandler.java:420)
         at com.sun.glass.ui.View.handleDragEnd(View.java:685)
         at com.sun.glass.ui.View.notifyDragEnd(View.java:990)
         at com.sun.glass.ui.mac.MacPasteboard._putItemsFromArray(Native Method)
         at com.sun.glass.ui.mac.MacPasteboard.putItemsFromArray(MacPasteboard.java:148)
         at com.sun.glass.ui.mac.MacPasteboard.putItems(MacPasteboard.java:176)
         at com.sun.glass.ui.mac.MacSystemClipboard.pushToSystem(MacSystemClipboard.java:248)
         at com.sun.glass.ui.SystemClipboard.flush(SystemClipboard.java:28)
         at com.sun.glass.ui.ClipboardAssistance.flush(ClipboardAssistance.java:34)
         at com.sun.javafx.tk.quantum.QuantumClipboard.flush(QuantumClipboard.java:196)
         at com.sun.javafx.tk.quantum.QuantumToolkit.startDrag(QuantumToolkit.java:1189)
         at javafx.scene.Scene$DnDGesture.dragDetectedProcessed(Scene.java:2648)
         at javafx.scene.Scene$DnDGesture.process(Scene.java:2709)
         at javafx.scene.Scene$DnDGesture.access$8700(Scene.java:2603)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3340)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
         at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
         at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
         at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
         at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
         at com.sun.glass.ui.View.notifyMouse(View.java:922)If i remove in my method everything that deals with the ClipboardContent I don't get the exception (but of course nothing is dragged). I also tried provided DataFormats, as well as trying to only pass a String as value for the ClipboardContent, but I still get the exception.
    Does anybody have an idea? Thanks!
    PS: I'm running on OS X 10.7.5, with JDK7u10 (with JavaFX 2.2.4).

    That does not exist - the workaround (maybe permanent solution - who knows) is
    File menu ==> export
    And BTW if you are not backingup all the time you are 100% guarenteed to lose all of your files and photos sooner or later
    LN

Maybe you are looking for