Get Drag Drop Data

The HELP text for the GET DRAG DROP DATA function says this:
"Only use this function when it is necessary to access the drag data, not just to examine the data type."
Can anyone explain why this is?
Is it costly, in terms of time, or memory, or something else?
Is it destructive to the data ?
Why?
I have a situation where dragging ONE of something is OK, but dragging TWO or more is not, in certain circumstances.
In other circumstances, dragging one or more is OK.
So how do I detect (in the DRAG OVER event) whether the drag data has one or two items in it?
If I change the DATA NAME to ITEM 1 or ITEM 2, then I don't know what name to look for when I do fetch the data.
Do I create a different item called DRAG COUNT SINGLE or DRAG COUNT MULTIPLE and look for the existence of one or the other of those?
I could use some outside-the-drag storage places, but that seems yucky - it's not self-contained.
Ideas?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks

For the record, here's one way around the issue.
At DRAG STARTING time, I compose the DRAG DATA NAME with a FORMAT STRING of "My Items %d", embedding the count in the name itself.
At DRAG OVER or DROP time, instead of searching the AVAILABLE DATA NAMES for an exact match to a fixed name, I SCAN STRING on each available data name, using the same FORMAT STRING.  If I scan without error, then I have the number of items dragged and I can make appropriate decisions.
Tech Support says that I might be reading the warning a bit too seriously anyway.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks

Similar Messages

  • Drag-drop data column sorting

    Hey guys,
    Does any one know how to achieve drag-drop data column
    sorting? I tried, but could not find an efficient way to do this.
    It would be an awesome spry feature if possible, but if someone
    else knows how to do this already it would help.
    Thanks,
    Timothy D Farrar

    Hey guys,
    We aim to be as compatible as possible with the other
    frameworks but sometimes problem may exists. We need to see the
    crashing pages to be able to determine the causes for the JS error
    message and where the incompatibilities are located and either fix
    the problems or help you to change your pages to work.
    In this situation I suspect the issue appears because the
    spry region is generated after the drag and drop code from the
    script.aculo.us is instantiated and we destroy the initial elements
    to which this widget is binded. In this situation the solution is
    to instantiate the drag and drop after the region generate its
    content by using the region observers. You'll have to put the drag
    and into a separated function and register the code so the region
    will call it automatically onPostUpdate.
    We include in our documentation more details about the
    Region
    observer notifications. Please search the dedicated chapter
    inside this doc: "Region observer notifications"
    Regards,
    Cristian MARIN

  • Drag drop from bridge to InDesign.

    I am having problems with getting drag drop to work from bridge to InDesign. I have made an extension that reads information from ouer dam and shows it in bridge. I wont to bee able to drag a node from that data from bridge(It shows fine in bridge with thumbs) to InDesign. I have enabled:
                   if(infosetName == "item" || infosetName == "all")
                        infoset.cacheData.status = "good";
                            if(!currentNode.isContainer())
                                infoset.canBeDragSource  = true;
                                infoset.canBeDropTarget  = true;
    in
            dbiModel.refreshInfoset = function(infosetName)
    And made
            dbiModel.addToDrag = function(pointerToOsDragObject)
                return true;
            dbiModel.wouldAcceptDrop = function(type, sources, osDragRef)
                return false;
    And are able to drag the node but other applications dosent accept it as valid.
    Whot am i missing?

    cynglas wrote:
    ... so I don't see why it couldn't do it directly from within ID through CTRL+D. The fact that it has never done it before is no reason why it couldn't or shouldn't be able to do it...
    ...... It would just mean that I wanted faster as well as  etter intergrated software.
    It has just never worked that way and I've never seen a request for it either.
    In the Control Panel you have got a Bridge Icon
    At the bottom of the document window you have the Browse in Bridge
    The Default Shortcut for Bridge is CTRL+ALT+o (CMD+OPT+o)
    In Edit>Keyboard Shortcuts under
    Product area : Panel Menus
    Layout Window Status: Reveal in Bridge --- [none defined]
    or
    Layout Window Status: Reveal in Mini Bridge --- [none defined]
    to add your own shortcut to Reveal in Bridge command
    But I just don't see a way to go "Place from Bridge"
    In fact - in all the years I've been on the forums I have never seen the request.
    However you can make feature requests here
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    And there's a feature request forum
    http://forums.adobe.com/community/indesign/indesign_feature_requests
    And in the end - someone might be able to script an option to go to Bridge for File>Place
    http://forums.adobe.com/community/indesign/indesign_scripting

  • I deleted the "desktop" in tiger, can't "alias", "copy" or "drag & drop" anything to it now, I get a message that "desktop can not be changed"

    I was trying to make an alias of "SAFARI" icon to have on the desktop & in the dock as well, I managed to make the safari icon appear on the desktop, but when I wanted to switch from firefox to safari it wouldn't open / start safari, so OK, no big deal, I moved it the trash, ( by rt. click,>move to trash>click ) the horror starts here, everything on the desktop disappeared into the trash !!!!! ......
      So I have tried to "drag & drop", "alias", "copy", "duplicate" to get things back out of the trash, but every attempt is met with a message "the desktop con not be changed",   and whatever I try to bring anything out of the trash window, it gets a "minus - sign" added to it when it crosses over the edge of the trash window, and of course it jumps right back into the trash when the mouse button is released.
    I think (barely) I will need the do a "clean install", or a "restore" from the install DVD to restore / get the desktop back.
    And while the only thing on the desktop now is the HDD icon, clicking it open does not show the desktop in the Lf. column of the window where it should be, or any OS X folders when clicking on anything, but the OS is is running for this post and yahoo, etc., and there is a upward facing arrow next to the "network" name in the left column, that doesn't go away, like after installing some software, this is weird !!
    Any solid ideas welcomed, and Thanks for reading my driveling post,  .....  wayne146  .........
    this is happening on my back-up machine, a G4 400mhz PCI, OS X TIGER 10.4.11 & 9.2.2 in classic ( all the 9.2.2 stuff does still show in the hdd when clicked )
    I am having bigger troubles with my QS 800 dp, so I need this one to stay online, Please help !!!

    to safari it wouldn't open / start safari, so OK, no big deal, I moved it the trash, ( by rt. click,>move to trash>click ) the horror starts here, everything on the desktop disappeared into the trash !!!!!
    I am confused by what you did.
    open / start safari
    What did you do?  This looks like a terminal command.
    Or, did you click on the safari icon then right click on the safari icon then click on open? 
    I do not understand how you that moving to the trash would be helpful.
    I suspect disk corruptions.
    I run disk utility verify the file system on your starup disk.  See below.
    verify & repair your startup drive
    To verify & repair you file system on the startup drive, you will need to run disk utility from you installation DVD.
    This article  will tell you how to get to disk utility.  Once in a disk utility, you can go and attempt to recover the disk.
    http://support.apple.com/kb/TS1417
    To repair your startup drive, you will need to run disk utility from your startup DVD.
    Mac OS X 10.4: About the utilities available on the Mac OS X 10.4 Install DVD
    http://support.apple.com/kb/HT2055
    How to run disk utility from your startup DVD.
    Insert your  startup DVD  into your reader.  Power down your machine.  Hold down to the c key.  Power on your machine.  This will bootup your startup DVD.
    This will bring you to a panel asking you for your language.  Pick your language.
    You you come to the Install Mac OS panel.  Do not install.
    Click on Utilities menu item.  This will give you a pulldown list of utilities.
    Click on the disk utility.
    You are now in disk utility.  Pick your disk.  Click on repair it should be on the lower right of the panel.
    Once the repair completes successfully, you should update your permissions.
    Verify a disk
    As an alternative, you can verify that the filesystem on the disk is correct. You will not be able to repair the file system.
    I suggest that you use disk utility to verify that your startup disk is OK.  Macintosh-HD -> Applications -> Utilities -> Disk Utility  Start up disk utility.  On the left pane view, you will see a list of all your disks.   click on your startup disk.  Click on the First Aid  Tab.  Click on verify.   Hopefully your disk will verify.  If not, you have to boot from your installation DVD and run Disk First Aid from there to attempt to repair your file-system.

  • How can cocoa app get attachment in Drag & Drop email(s) from Mail?

    HI all,
    I would like to drag and drop one or more emails from Apple's Mail application to a cocoa application and have the cocoa application find the path to the attachments in those emails. If I drag & drop a message from Mail to Text Edit, it creates a link with the message subject. If I hold the pointer over the link in Text Edit, it shows the contents of the link, which has the form:
    message:%[email protected]%3E
    If I click that link, it opens a new Mail window with the message. None of that is the message number as shown in Mail's viewer window.
    I've also looked at what Pasteboard Peeker shows given a Drag & Drop from Mail. The above link data is from the public.url pasteboard type. Some of the others look interesting, but Pasteboard Peeker truncates the data read from the pasteboard, and the pasteboard types are probably nothing that we "supposed" to have access to since they have names like "Someone's super-secret pasteboard type". Any other ideas?

    Thanks, a brody.
    That tip takes me further down the field. And, I am able to do stuff like indent and change font color of my comments which is very helpful.
    However, the big disappointment is that by dragging the original message to the Draft mailbox and then back to the original one after the edits is that it removes the original sender's name and puts mine in along with changing the heading info on date and time. That is, it creates a new message, rather than allowing me to modify the original one to suit my needs.
    All the same, this was a very helpful tip. Thanks again.
    Anyone know of a plugin?..............or two?....

  • The bookmarks toolbar is there but has no item buttons on it. How do I get the items back for this toolbar? Also would like to know if the toolbars can be put on the same line to make more room on the page (drag & drop) ??

    The bookmarks toolbar is there but has no item buttons on it. How do I get the items back for this toolbar?
    Also would like to know if the toolbar can be put on the same line to make more room on the page (drag & drop) ?? Like the menu & bookmarks toolbar could/should fit on same line. This would add more page view...
    Floyd Perry
    Thanks

    Check that you still have the "Bookmarks Toolbar items" placed on the Bookmarks Toolbar
    * Make sure that you have the "Bookmarks Toolbar" visible: "View > Toolbars"
    * Check in "View > Toolbars > Customize" that the "Bookmarks Toolbar items" is on the Bookmarks Toolbar
    * If the "Bookmarks Toolbar items" is not on the Bookmarks Toolbar then drag it back from the Customize window onto the Bookmarks Toolbar
    * If you do not see the "Bookmarks Toolbar items" then click the "Restore Default Set" button
    You can only move the content from a toolbar onto other toolbars if all toolbars support that feature. You need to check that in the options of each toolbar.

  • How can I get drag and drop to work again in iphoto11?

    I have created a photo book in iphoto 11 (version 9.3.2) on my imac running os 10.7.5.  The drag and drop feature suddenly quit working. I cannot drag/drop photos from an event into the photo book OR within the photo book.
    I've restarted the computer to no avail. I've also quit and restarted iphoto.
    When I run Console, I see the following errors: iphoto: coredragcrete error -4960 and error in coredragdispose -1850
    What should I do to get my drag and drop working again?

    Repair permissions with Disk Utility.

  • Drag and drop data from Numeric Control or Numeric Array to excel file

    I have two inquirries about drag and drop:
    1. How to drag and drop data from a Numeric Array or Numeric control to excel file
    2. How to drag and drop data from a Numeric Array or Numeric control to an Numeric array Indicator?
    The item 2, I tried it with the event structure, but it didnt work.
    Please do reply.
    mytestautomation.com
    ...unleashed the power, explore and share ideas on power supply testing
    nissanskyline.org
    ...your alternative nissan skyline information site

    There are very good drag and drop examples that ship with LabVIEW.  Have you looked these over to see if they can be modified for your needs?
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

  • Having trouble dragging/dropping files from my MacAir to a shared drive window, when I try to drag/drop gets bounced out. Can anyone help with advice on how to drag/drop or otherwise copy files to a shared drive? thanks in advance

    I am having trouble dragging/dropping or otherwise copying files from my MacAir to a window for a shared drive.
    When I try to drag/drop, files get bounced out.
    Anyone know how to drag/drop in such a case, or otherwise copy files from MacAir to a shared drive (which I do  not believe is on a Mac, not sure if that matters).
    Any help much appreciated, thanks in advance
    J.

    I am having trouble dragging/dropping or otherwise copying files from my MacAir to a window for a shared drive.
    When I try to drag/drop, files get bounced out.
    Anyone know how to drag/drop in such a case, or otherwise copy files from MacAir to a shared drive (which I do  not believe is on a Mac, not sure if that matters).
    Any help much appreciated, thanks in advance
    J.

  • Drag&Drop Custom Data?

    Hello, my fellow JavaFXsians :)
    I'm trying to implement a Drag&Drop of an Object. But, as you could guess, I'm not really successful. I'm being hit with the +"java.lang.IllegalArgumentException: Only serializable objects or ByteBuffer can be used as data with data format [model.jfxwrappers.VezaDjetetaWrapper]"+ exception. Why is this wrong:
    DataFormat dataFormatVDW = new DataFormat("model.jfxwrappers.VezaDjetetaWrapper");  //A Class
    myListView.setOnDragDetected(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent dragEvent) {
            Dragboard db= myListView.startDragAndDrop(TransferMode.COPY);
            ClipboardContent content= new ClipboardContent();
            content.put(dataFormatVDW, db);
            db.setContent(content);
            dragEvent.consume();
    I've read that the model.jfxwrappers.VezaDjetetaWrapper has to be Serializable, so it is. What am I missing, please?

    Oh, I'm embarrassed. :) Yes, that was the error, but now I'm having some other difficulties.
    When I tried D&D after making the appropriate change suggested above, I've got some more exceptions. First it was:
    java.lang.IllegalArgumentException: Could not serialize the data
         at com.sun.javafx.tk.quantum.QuantumClipboard.putContent(Unknown Source)
         at javafx.scene.input.Clipboard.setContent(Unknown Source)
         at java.lang.Thread.run(Thread.java:722)
    Caused by: java.io.NotSerializableException: javafx.beans.property.SimpleObjectProperty
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
         ... 40 morebut then I've commented out the SimpleObjectProperty (although I've made it's value Serializable as well) and got this exception:
    java.lang.IllegalArgumentException: Could not serialize the data
         at com.sun.javafx.tk.quantum.QuantumClipboard.putContent(Unknown Source)
         at javafx.scene.input.Clipboard.setContent(Unknown Source)
         at java.lang.Thread.run(Thread.java:722)
    Caused by: java.io.NotSerializableException: javafx.beans.property.SimpleStringProperty
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
         ... 40 moreI'm using JavaFX 2.2b06 and presuming that these properties are indeed Serializable (although I couldn't find a confirmation in the API) don't know what could it be.
    The only change I've made in my code listed above is this:
    content.put(dataFormatVDW, vezeDjetetaList.getSelectionModel().getSelectedItem());

  • How can I get quiz scripts to pull properly.... Using CP 6 with Infosemantics Drag & Drop Widget

    I'm modifying a course which is composed of 4 mini-quizzes with each section having a results slide which gives you your cummulative score. This course was created by my predecessor. The course was previously published, loaded to our LMS, and used by new hires to test their knowledge and abitliy to locate information. In it's original state the course works and the Results slides score and coaching messages display as they should.
    Now that I need to update the course, I've discovered that the first section was built using a Drag&Drop widget. I didn't make any changes to the section built using the widget. Unfortunately, the Results slide for this mini-quiz section has become a problem when the user gets a score of 0 or 10 points. Instead of getting a message that reads, "Keep Trying!" (0 points) or "You're Doing OK!" (10 Points) they get a "Perfect Score!" message.
    Notice the scoring is correct for the section it's the messaging that's wrong. Since this is only happening with this one part of the quiz I'm assuming that there could be something wrong with the widegt.
    Any input would be appreciated.

    Rod Ward was very helpful in aiding in the fixing widgets that outdated due to a version update. However, this fix does note resovle my original problem. In short, the widget Drag/Drop was never the problem with the scoring/scripting issue. Can anyone give me insight as to why a course that has used by our learner population previously would stop functioning properly.
    Reminder:
    1. I made minor edits to the course in question. none of my edits impacted the section that is not functioning properly.
    2. Currently, learners would get a "Perfect Score" script if they scored 0, 10, or 30 points. "Perfect Score", in this first section should only display at 30 points while 0 points should yield "Keep Trying" and 10 points should yield "You're Doing Ok" responses.
    Any Thoughts!

  • Output xml file from data in a drag/drop AIR app.

    I am interested in creating a WYSIWYG drag/drop AIR app. in
    which I can drag art and other components, then export the (x,y)
    positions of the components and other info into an xml file. I am
    interested in using .ai files instead of raster based art. Will
    Flex/AIR app. support this format? I am just starting to work with
    Flash, Flex, etc. Is this way over my head? Possible?
    Thanks,
    Nate

    I don't think you can manipulate .ai files in Flex /
    AIR.

  • Drag & Drop of a file not working in Ubuntu & other linux

    Hi All,
    I am working on a project,in which it has the requirement of dragging the files
    from a JList present inside a JFrame to the desktop.
    First I tried to get a solution using dnd API but could not. Then i googled and i got an application which is
    working perfectly in both Windows and MAC Operating systems, after I made few minor changes to suit my requirements.
    Below is the URL of that application:
    http://stackoverflow.com/questions/1204580/swing-application-drag-drop-to-the-desktop-folder
    The problem is the same application when I executed on Ubuntu, its not working at all. I tried all available options but could not trace out the exact reason.
    Can anybody help me to overcome this issue?
    Thanks in advance

    Hi,
    With the information you provided and through some information found on google i coded an application. This application is able to do the drag and drop of an item from the Desktop to Java application on Linux Platform, but i am unble to do the viceversa by this application.
    I am including the application and the URL of the information i got.
    [URL Of Information Found|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4899516]
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.Transferable;
    import java.awt.datatransfer.UnsupportedFlavorException;
    import java.awt.dnd.DropTarget;
    import java.awt.dnd.DropTargetDragEvent;
    import java.awt.dnd.DropTargetDropEvent;
    import java.awt.dnd.DropTargetEvent;
    import java.awt.dnd.DropTargetListener;
    import java.io.File;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.DefaultListModel;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    import javax.swing.TransferHandler;
    import javax.swing.WindowConstants;
    public class DnDFrame extends JFrame implements DropTargetListener {
         private DefaultListModel listModel = new DefaultListModel();
         private DropTarget dropTarget;
         private JLabel jLabel1;
         private JScrollPane jScrollPane1;
         private JList list;
         List<File> files;
         /** Creates new form DnDFrame */
         public DnDFrame() {
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              initComponents();
              dropTarget = new DropTarget(list, this);
              list.setModel(listModel);
              list.setDragEnabled(true);
              list.setTransferHandler(new FileTransferHandler());
         @SuppressWarnings("unchecked")
         private void initComponents() {
              GridBagConstraints gridBagConstraints;
              jLabel1 = new JLabel();
              jScrollPane1 = new JScrollPane();
              list = new JList();
              setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              getContentPane().setLayout(new GridBagLayout());
              jLabel1.setText("Files:");
              gridBagConstraints = new GridBagConstraints();
              gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
              gridBagConstraints.anchor = GridBagConstraints.WEST;
              getContentPane().add(jLabel1, gridBagConstraints);
              jScrollPane1.setViewportView(list);
              gridBagConstraints = new GridBagConstraints();
              gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
              gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
              getContentPane().add(jScrollPane1, gridBagConstraints);
              pack();
         public void dragEnter(DropTargetDragEvent arg0) {
         public void dragOver(DropTargetDragEvent arg0) {
         public void dropActionChanged(DropTargetDragEvent arg0) {
         public void dragExit(DropTargetEvent arg0) {
         public void drop(DropTargetDropEvent evt) {
              System.out.println(evt);
              int action = evt.getDropAction();
              evt.acceptDrop(action);
              try {
                   Transferable data = evt.getTransferable();
                   DataFlavor uriListFlavor = null;
                   try {
                        uriListFlavor = new DataFlavor("text/uri-list;class=java.lang.String");
                   } catch (ClassNotFoundException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                   System.out.println("data.isDataFlavorSupported(DataFlavor.javaFileListFlavor: " +
                             data.isDataFlavorSupported(DataFlavor.javaFileListFlavor) );
                   if (data.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                        files = (List<File>) data.getTransferData(DataFlavor.javaFileListFlavor);
                        for (File file : files) {
                             listModel.addElement(file);
                   }else if (data.isDataFlavorSupported(uriListFlavor)) {
                        String data1 = (String)data.getTransferData(uriListFlavor);
                        files = (List<File>) textURIListToFileList(data1);
                        for (File file : files) {
                             listModel.addElement(file);
                        System.out.println(textURIListToFileList(data1));
              } catch (UnsupportedFlavorException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
              } finally {
                   evt.dropComplete(true);
         private static java.util.List textURIListToFileList(String data) {
              java.util.List list = new java.util.ArrayList(1);
              for (java.util.StringTokenizer st = new java.util.StringTokenizer(data,"\r\n");
              st.hasMoreTokens();) {
                   String s = st.nextToken();
                   if (s.startsWith("#")) {
                        continue;
                   try {
                        java.net.URI uri = new java.net.URI(s);
                        java.io.File file = new java.io.File(uri);
                        list.add(file);
                   } catch (java.net.URISyntaxException e) {
                   } catch (IllegalArgumentException e) {
              return list;
         private class FileTransferHandler extends TransferHandler {
              @Override
              protected Transferable createTransferable(JComponent c) {
                   JList list = (JList) c;
                   List<File> files = new ArrayList<File>();
                   for (Object obj: list.getSelectedValues()) {
                        files.add((File)obj);
                   return new FileTransferable(files);
              @Override
              public int getSourceActions(JComponent c) {
                   return COPY;
         static {
              try {
                   uriListFlavor = new
                   DataFlavor("text/uri-list;class=java.lang.String");
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
         private class FileTransferable implements Transferable {
              private List<File> files;
              public FileTransferable(List<File> files) {
                   this.files = files;
              public DataFlavor[] getTransferDataFlavors() {
                   return new DataFlavor[]{DataFlavor.javaFileListFlavor,uriListFlavor};
              public boolean isDataFlavorSupported(DataFlavor flavor) {
                   if(flavor.equals(DataFlavor.javaFileListFlavor) || flavor.equals(uriListFlavor))
                        return true;
                   else
                        return false;
              public Object getTransferData(DataFlavor flavor) throws
              UnsupportedFlavorException, java.io.IOException {
                      if (isDataFlavorSupported(flavor) && flavor.equals(DataFlavor.javaFileListFlavor)) {
                        return files;
                   }else if (isDataFlavorSupported(flavor) && flavor.equals(uriListFlavor)) {
                        java.io.File file = new java.io.File("file.txt");
                        String data = file.toURI() + "\r\n";
                        return data;
                   }else {
                        throw new UnsupportedFlavorException(flavor);
         private static DataFlavor uriListFlavor;
         static {
              try {
                   uriListFlavor = new
                   DataFlavor("text/uri-list;class=java.lang.String");
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
         public static void dumpProperty(String name) {
              System.out.println(name + " \t" + System.getProperty(name) );
         public static void main(String[] args) {
              String[] props = {
                        "java.version",
                        "java.vm.version",
                        "java.vendor",
                        "os.name",
              "os.version"};
              for (String prop : props) {
                   dumpProperty(prop);
              Runnable r = new Runnable() {
                   public void run() {
                        DnDFrame f = new DnDFrame();
                        f.setVisible(true);
              SwingUtilities.invokeLater(r);
    }Please Suggest me in this.

  • Issue with Drag/Drop of multiple rows from ListView

    I am working on a sample application with 2 list views i.e. players and team, and implement drop and drop such that players can be dropped from one list view to the other. Everything is working as expected when there is single selection model is enabled on the source list view. However, if I enabled Multiple selection model and drag 2 or more rows from source list view to target list view, seeing the following exception after the drop is completed.
    Exception:
    java.lang.IllegalArgumentException: Only serializable objects or ByteBuffer can be used as data with data format [subListPlayers]
      at com.sun.javafx.tk.quantum.QuantumClipboard.putContent(QuantumClipboard.java:513)
      at javafx.scene.input.Clipboard.setContent(Clipboard.java:230)
    1) What should be the DataFormat used in order to be able to drag and drop multiple rows? Looks like we do not have for Object type, so I have created the following one which does not solve the problem.
       private DataFormat dataFormat = new DataFormat("subListPlayers");
    2) I have made changes to support serialization on the data object which also does not seem to solve the issue. Tried by implementing Serializable interface as well as by implementing Externalize interface.
    Can someone please guide if there is an easy way to implement this behavior?
    Code:
    public class Player
       private String name;
       public Player(String name)
          this.name = name;
       public String getName()
          return name;
       public void setName(String name)
          this.name = name;
       @Override
       public boolean equals(Object o)
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          Player player = (Player) o;
          if (name != null ? !name.equals(player.name) : player.name != null) return false;
          return true;
       @Override
       public int hashCode()
          return name != null ? name.hashCode() : 0;
    public class JavaFXDnDApplication extends Application
       private static final ListView<Player> playersListView = new ListView<Player>();
       private static final ObservableList<Player> playersList = FXCollections.observableArrayList();
       private static final ListView<Player> teamListView = new ListView<Player>();
       private static final GridPane rootPane = new GridPane();
       private DataFormat dataFormat = new DataFormat("subListPlayers");
       public static void main(String[] args)
          launch(args);
       @Override
       public void start(Stage primaryStage)
          primaryStage.setTitle("Drag and Drop Application");
          initializeComponents();
          initializeListeners();
          buildGUI();
          populateData();
          primaryStage.setScene(new Scene(rootPane, 400, 325));
          primaryStage.show();
       private void initializeListeners()
          playersListView.setOnDragDetected(new EventHandler<MouseEvent>()
             @Override
             public void handle(MouseEvent event)
                System.out.println("setOnDragDetected");
                Dragboard dragBoard = playersListView.startDragAndDrop(TransferMode.MOVE);
                ClipboardContent content = new ClipboardContent();
    //            content.putString(playersListView.getSelectionModel().getSelectedItem().getName());
                content.put(dataFormat, playersListView.getSelectionModel().getSelectedItems());
                dragBoard.setContent(content);
          teamListView.setOnDragOver(new EventHandler<DragEvent>()
             @Override
             public void handle(DragEvent dragEvent)
                dragEvent.acceptTransferModes(TransferMode.MOVE);
          teamListView.setOnDragDropped(new EventHandler<DragEvent>()
             @Override
             public void handle(DragEvent dragEvent)
    //            String player = dragEvent.getDragboard().getString();
    //            ObservableList<Player> player = (ObservableList<Player>) dragEvent.getDragboard().getContent(dataFormat);
                String player = dragEvent.getDragboard().getString();
                teamListView.getItems().addAll(new Player(player));
                playersList.remove(new Player(player));
                dragEvent.setDropCompleted(true);
       private void buildGUI()
    //      rootPane.setGridLinesVisible(true);
          rootPane.setPadding(new Insets(10));
          rootPane.setPrefHeight(30);
          rootPane.setPrefWidth(100);
          rootPane.setVgap(20);
          rootPane.setHgap(20);
          rootPane.add(playersListView, 0, 0);
          rootPane.add(teamListView, 1, 0);
       private void populateData()
          playersList.addAll(
                new Player("Adam"), new Player("Alex"), new Player("Alfred"), new Player("Albert"),
                new Player("Brenda"), new Player("Connie"), new Player("Derek"), new Player("Donny"),
                new Player("Lynne"), new Player("Myrtle"), new Player("Rose"), new Player("Rudolph"),
                new Player("Tony"), new Player("Trudy"), new Player("Williams"), new Player("Zach")
          playersListView.setItems(playersList);
       private void initializeComponents()
          playersListView.setPrefSize(250, 290);
          playersListView.setEditable(true);
          playersListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
          playersListView.setCellFactory(new Callback<ListView<Player>, ListCell<Player>>()
             @Override
             public ListCell<Player> call(ListView<Player> playerListView)
                return new ListCell<Player>()
                   @Override
                   protected void updateItem(Player player, boolean b)
                      super.updateItem(player, b);
                      if (player != null)
                         setText(player.getName());
          teamListView.setPrefSize(250, 290);
          teamListView.setEditable(true);
          teamListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
          teamListView.setCellFactory(new Callback<ListView<Player>, ListCell<Player>>()
             @Override
             public ListCell<Player> call(ListView<Player> playerListView)
                return new ListCell<Player>()
                   @Override
                   protected void updateItem(Player player, boolean b)
                      super.updateItem(player, b);
                      if (player != null)
                         setText(player.getName());

    Yeah, this is a pain. I filed https://javafx-jira.kenai.com/browse/RT-29082 a while back. Go ahead and vote for it if you are inclined...
    I think the issue in your case is that the observable list provided by MultipleSelectionModel.getSelectedItems() is not Serializable. So even if you make your Player class Serializable, the list itself isn't. The first thing I would try, I think, is to make Player implement Serializable and then pass in an ArrayList instead of the observable list. So you can do
    content.put(dataFormat, new ArrayList<Player>(playersListView.getSelectionModel().getSelectedItems()));
    and
    List<Player> player = (List<Player>) dragEvent.getDragboard().getContent(dataFormat);
    teamListView.getItems().addAll(player);
    If that doesn't work, a workaround is just to store the "dragged list" in a property:
    final ListProperty<Player> draggedPlayers = new SimpleListProperty<Player>();
    // Drag detected handler:
    content.putString("players");
    draggedPlayers.set(playersListView.getSelectionMode().getSelectedItems());
    // Drag dropped handler:
    if (dragboard.hasString() && dragboard.getString().equals("players")) {
         teamListView.getItems().addAll(draggedPlayers.get());
         draggedPlayers.set(null);

  • Drag & Drop on singleCell in Advanced Datagrid

    Hi There
    Is it posible to make a "Exel" like flex app where you drag from one cell to another cell to organise you data ?
    Regards
    T

    Hello Cedric,
    I'm sorry but I had the confirm from people at NI France support that you can't trigger an event drag&drop on the whole XCTL.
    You can only trigger this kind of event concerning individual controls inside the XCTL. It trigger the event structure in "facade.vi". from there if you can get a queue to communicate between the xctl and the containing VI, you can get your state machine doing the event you want (with a producer-consumer structure).
    It's not perfect but it is the only workaround we found at Nerys.
    Sebastien DEVISSCHER - Nerys

Maybe you are looking for

  • Using list values

    I would like to know if there is a way to do pass a parameter p_Parameter having a value of say A1, A2,A3,....An for a query in PL/SQL stored procedure for a query such as : Select * From Employee where EmpId in (p_Parameter) I was able to resolve th

  • Help copying files from external drive to another external drive

    I'm trying to backup the files I have on an external drive and this has turned into ****, I feel I'm a Windows user all over again. First I tried to encrypt an external drive, just as I've encrypted several others. The solution was to pay for a new O

  • Maill always send from default account when using multiple accounts

    I have a gmail account as my default account. I also have a work imap account. When sending an email from my work account, it initially fails to send. On making it retry, the message is sent. The message ends up in the recipient's mailbox as having b

  • HT203167 how can I download my itunes library in a Android phone?

    How can I download my itunes library to my phone?

  • No servers configured for repository?

    Hi, I just recently reinstalled arch, and I don't even have a DE or WM installed yet. I was just trying to install wicd to get my wifi to work, when I got this: :: Retrieving packages from core... warning; failed to retrieve some files from core erro