Added drag support breaks drop support

I have a Swing app (running on WIndows), which consists mainly of a Jtable with a list of files in it, one file per row. I wanted to be able to open files in the JTable using drag and drop, so Ive created a subclass of DropTarget and set it for my frame with setDropTarget() and it works fine, I can now drag and drop files from Windows Explorer. I set the drop target for the frame rather than the table because I wanted the user to be able to drop the files anywhere on the application.
I then wanted to add dragging files from the Jtable to other applications to be able to make copies of the file. So I setDragEnabled() on the table and setTransferHandler() on the table and created appropriate TransferHandler and Tranferable subclasses. Now I can can drag files from the table ok, but unfortunatelly I can no longer drop files onto the frame, it just shows the no-entry sign when I try to. I don't see why enabling drag support in the table breaks drop support in the frame, but it does - what am I doing wrong?
thanks Paul

paultaylor wrote:
setTransferHandler() on the table ... I can no longer drop filesTry overriding "importData" in TransferHandler.

Similar Messages

  • Error using Richfaces Drag and Drop  support in JSF 1.1 application

    Iam using rich faces drag n drop support in my JSF application . The jsp works as expected but I get this weird exception while navigating through my pages.
    Scenario : User logs into the application , from the home page ---> when the user click on a button he is navigated to the jsp which has the drag n drop support. This was working fine till , I have added a menu_incl .jsp inthe sub view . The code snippet is as shown below :
    <body>
         <div id="wrap">
         <f:view>
         <f:subview id="menu">
              <jsp:include page="/search/incld/menu.incl.jsp" />
         </f:subview>
         <rich:dragIndicator id="indicator" />
         <h:form id="myfolder">
              <h:panelGrid columnClasses="panelc,panelc,panelc,panelc" columns="4" width="100%">
                   <!-- Panel for Queries -->     
                   <rich:panel style="width:133px">
                   <f:verbatim>
                             <div style="overflow-x: scroll; overflow-y: scroll; height: 400px;">
                   </f:verbatim>
                        <f:facet name="header">
                             <h:outputText value="Queries" />
                        </f:facet>
                        <h:dataTable id="querytable" value="#{dndBean.queryList}"
                             var="query" binding="#{workSpaceBean.queryData}" >
                             <h:column>
                                  <a4j:outputPanel style="width:100px;border:1px solid gray;padding:2px" layout="block">
                                       <rich:dragSupport dragIndicator=":indicator"
                                            dragType="Query" dragValue="#{query}">
                                            <rich:dndParam name="label" value="#{query.name}" />
                                       </rich:dragSupport>
                                       <h:commandLink value="#{query.name}"
                                       action="#{workSpaceBean.populateQuery}">
                                       </h:commandLink>
                                  </a4j:outputPanel>
                             </h:column>
                        </h:dataTable>
                        <f:verbatim></div> </f:verbatim>
                   </rich:panel>
    Now when I click on the button in my home page , and expect to be navigated to the page which has dran drop support components, I get the following error :
    Error Message: Duplicate component ID 'myfolder:querytable:_id34' found in view.
    Error Code: 500
    Target Servlet: Faces Servlet
    Error Stack:
    java.lang.IllegalStateException: Duplicate component ID 'myfolder:querytable:_id34' found in view.
    at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:171)
    at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:179)
    at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:179)
    at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:179)
    at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:179)
    at com.sun.faces.application.StateManagerImpl.removeTransientChildrenAndFacets(StateManagerImpl.java:179)
    at com.sun.faces.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:86)
    at org.ajax4jsf.framework.ajax.AjaxStateManager.saveSerializedView(AjaxStateManager.java:90)
    at com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:170)
    Iam getting this error only when I include this jsp in the parent jsp :
    <f:subview id="menu">
              <jsp:include page="/search/incld/menu.incl.jsp" />
    </f:subview>
    Iam including the same way in all other jsps of my application , they are all working fine expect for this jsp which has ajax components (rich faces drag m drop support components ) .
    From the error I deduce that the view component is being generated twice , why is this so???
    I would appreciate if some one coulkd guide me through this .... I hope I was able to explain my issu properly , please let me know if it is now clear

    I've tinkered a bit with DnD before in the past. Actually, it's all related to the topic of Data Transfer. You have to provide a source and destination for the transferrable, and your transferrable object must provide the "data flavors" that it supports.
    In theory it doesn't sound too hard, and it works reasonably well within a java application, but to be honest your time might be better spent simply implementing cut n' paste, which is easier. Cut n' paste doesn't require all the fancy UI work, but does the job reasonably well.
    There's a DnD spec available on the documentation web-site, if you haven't already found it. I also discovered that the O'Reilly book (I think it's the AWT book, not the swing one) has a good chapter on data transfer that you might want to read.

  • [svn:fx-trunk] 10600: Adding drag support to List - dragInitiator.

    Revision: 10600
    Author:   [email protected]
    Date:     2009-09-25 13:38:22 -0700 (Fri, 25 Sep 2009)
    Log Message:
    Adding drag support to List - dragInitiator. Currently can't drop the dragged items yet.
    - ListItemDragProxy class - default drag proxy for List (through a new style "dragIndicatorClass")
    - Added dragEnabled, dragMoveEnabled properties to List
    QE notes: Dragging from List is now possible. Dropping to different containers will come with subsequent check-in.
    Doc notes: None
    Bugs: None
    Reviewer: Ryan
    Tests run: checkintests
    Is noteworthy for integration: No
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/defaults.css
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as
        flex/sdk/trunk/frameworks/spark-manifest.xml
    Added Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ListItemDrag Proxy.as

  • Drag and drop support freeze after OSX 10.9.4 update...

    The "Drag and Drop" support stop working after updating my OS X Mavericks today...updated to version 10.9.4
    Any file / folder / trying to drag an email from my inbox / or even an image from Adobe Bridge CC....NOT WORKING...it's freeze!!! 
    You can left/right click onto any file/folder to open or read...it's working perfect.... but when trying to move it...IMPOSSIBLE...
    Try relaunch finder or any desktop view option...none working. 
    Upon restart...its back to normal...BUT of only a few minutes!!!! then same issue again....
    Any idea how to fix this BUG please???
    Am using a Mac Pro Quad-Core Intel Xeon

    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. 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 documents or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this behavior; 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, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Please take this step regardless of the results of Step 1.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup 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.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2.

  • Adding drop support for JPanel in 1.4

    Hi there.
    I'm sorry for this naive question, but I just had to...
    For implementing drop support in a JPanel can we use the new dnd features of 1.4 or do we have to do it using the "old style"?
    I mean, do we have to implement the DropTargetListener interface and define it as a DropTarget or is there a simpler way?
    Cheers,
    /rp

    Hi there.
    I'm sorry for this naive question, but I just had to...
    For implementing drop support in a JPanel can we use the new dnd features of 1.4 or do we have to do it using the "old style"?
    I mean, do we have to implement the DropTargetListener interface and define it as a DropTarget or is there a simpler way?
    Cheers,
    /rp

  • HT6510 Mid-2011 Macbook Air doesn't support Air Drop/Continuity/Handoff?

    Why does my mid-2011 Macbook Air not support Air Drop/Continuity/Handoff?  It has Bluetooth 4.0, which is what I thought was the main requirement for getting these devices to work together. I also have an iPhone 6 Plus and a 4th gen iPad.

    If you check your "System Information", it will tell you if Handoff is supported:
    Click on  > About This Mac > System Report...
    Under Hardware, click Bluetooth and check the "Handoff Supported" line

  • I've been reading the comments re FCPX on MacBook Pro and now I'm scared. I'm taking a class now and thinking about buying to do videos for nonprofits. Won't be fancy stuff, but now wonder if it's a good choice. Also, heard Apple will drop support. Help?

    I've been reading the comments re FCPX on MacBook Pro and now I'm scared. I'm taking a class in FCPX and thinking about buying to do videos for nonprofits. Won't be fancy stuff, but now wonder if it's a good choice. Also, a classmate who was in CA last weekend said he heard that Apple will drop support of FCPX. Any truth? Advice?. I'm on 10.7.4 with 2.4 GHz Intel Core 2 Duo, 4 GB 1067 MHz. Thanks.    

    dkstj wrote:
    Also, a classmate who was in CA last weekend said he heard that Apple will drop support of FCPX.  
    While it is against the TOU of these boards to speculate on future products/updates what Thomas said is right: FCPX is quite a new product and it doesn't make any sense to drop it now.
    The only thing that MIGHT get dropped at a certain point is support for older hardware/OS as FCP X progresses.

  • Why is Adobe dropping support for pre 3GS phones?!

    I think it's a bad decision to drop support for pre 3GS devices. There are still many out there and if support is dropped we're forced to still use the old PFI to reach the complete audience.
    It's clear that OpenGL ES 2 offers a lot more fancy stuff than OpenGL ES 1.5 does, but still, things like GPU_VECTOR or sophisticated blending are perfectly doable with OpenGL ES 1.5.
    And if a clean implementation is really not possible, Adobe should at least allow to publish for old devices even if this means that not all optimization techniques can be used.
    I develop iPhone apps using different technologies and AIR is attractive for me because I can target with one project a big range of different plattforms. If Adobe drops support for old phones, this advantage is heavily shortened!
    What is your opinion on the this development?

    Apple have dropped support for pre-3GS because to pull of the features and performance in iOS 4.3 they had to develop just for the ARM7 chip, and not for the ARM6. They probably have a good sense of the number of people that have the older devices, and think it's ok to not update the software on those devices.
    The same may be true for Adobe.
    I am trying to find out how to make AIR 2.6 and AIR 2.0 live together in Flash CS5. If I work it out I'll let you know.

  • Drop support only works on the second drop

    Hi,
    I created an ImageComponent that accepts drops and displays images. The problem I'm facing is that the drop is only accepted on the second try. For some reason the getDataFlavors() method on the TransferSupport returns an empty array on the first drop.
    I'm dropping a JPG file from the desktop on my ImageComponent. I'm running it in debug mode with the latest version of Eclipse on Mac OS X 10.6.
    I hope someone can help me solve this problem.
    Thanks in advance,
    Stef
    Here is my source code:
    public class ImageComponent extends JComponent {
         private static final long serialVersionUID = 1L;
         private BufferedImage image;
         private final Vector<ImageChangeListener> listeners = new Vector<ImageChangeListener>();
         public ImageComponent() {
              setTransferHandler(new ImageTransferHandler());
         public synchronized void addImageChangeListener(ImageChangeListener listener) {
              listeners.add(listener);
         public synchronized void removeImageChangeListener(ImageChangeListener listener) {
              listeners.remove(listener);
         public void setImage(BufferedImage image) {
              this.image = image;
              paint(getGraphics());
         @Override
         public Dimension getPreferredSize() {
              if (image != null) {
                   BufferedImage scaledImage = Utils.scaleImage(image, getWidth(), getHeight());
                   return new Dimension(scaledImage.getWidth(), scaledImage.getHeight());
              } else {
                   return super.getPreferredSize();
         @Override
         public void paint(Graphics g) {
              if (g != null) {
                   g.clearRect(0, 0, getWidth(), getHeight());
                   super.paint(g);
                   if (image != null) {
                        BufferedImage scaledImage = Utils.scaleImage(image, getWidth(), getHeight());
                        int x = ((getWidth() - scaledImage.getWidth()) / 2);
                        int y = ((getHeight() - scaledImage.getHeight()) / 2);
                        g.drawImage(scaledImage, x, y, null);
         private void fireImageChange() {
              ImageChangeEvent event = new ImageChangeEvent(this, image);
              for (ImageChangeListener listener : listeners) {
                   listener.imageChanged(event);
              setImage(image);
         private class ImageTransferHandler extends TransferHandler {
              @Override
              public boolean canImport(TransferSupport support) {
                   for (DataFlavor dataFlavor : support.getDataFlavors()) { // Returns an empty array on the first drop
                        System.out.println(dataFlavor);
                   return support.isDataFlavorSupported(DataFlavor.javaFileListFlavor); // returns false on the first drop, true on consecutive drops
              @Override
              public boolean importData(TransferSupport support) {
                   if (canImport(support)) {
                        BufferedImage newImage = readFirstImage(support);
                        if (newImage != null) {
                             setImage(newImage);
                             fireImageChange();
                             return true;
                        } else {
                             return false;
                   } else {
                        return false;
              private BufferedImage readFirstImage(TransferSupport support) {
                   try {
                        List<File> fileList = (List<File>) support.getTransferable().getTransferData(
                                  DataFlavor.javaFileListFlavor);
                        if (fileList != null && fileList.size() > 0) {
                             File file = fileList.get(0);
                             return ImageIO.read(file);
                        } else {
                             return null;
                   catch (IIOException exception) {
                        return null;
                   catch (IOException exception) {
                        exception.printStackTrace();
                        return null;
                   catch (UnsupportedFlavorException exception) {
                        return null;
                   catch (Exception e) {
                        return null;
    }

    I'm on a relatively new system, where I haven't set much up, but I don't get any package-name completion which highlights the point that this is shell (and shell config) dependent.  What shell are you using?  Have you done anything to configure completion?  Do you have any pacman related aliases (or functions)?
    I do, by default bash settings it seems, get filename completion with pacman -R, so the options are files in the current directory.
    EDIT: (duh) just installing bash-completion now - new results momentarily - but more on point, this further highlghts the shell + config dependent nature of this.  EDIT2: works as expected with bash-completion installed.
    Last edited by Trilby (2013-07-15 21:58:12)

  • Does anyone know when T-Mobile will be added to the list of supported networks?

    Does anyone know when T-Mobile willbe added to the list of supported networks?

    <http://appleinsider.com/articles/13/03/26/t-mobiles-iphone-5-to-support-aws-will -ship-unlocked-in-april>

  • Appletv not updating podcasts - has apple sold a product then dropped support after 1 year?  May 2014

    appletv not updating podcasts - has apple sold a product then dropped support after 1 yera?  May 2014 - None of the podcasts are being updated on appletv.  Running itunes 11.2 and it shows podcasts there.  Apple looks more like windows every day.

    Before blaming Apple, was any troubleshooting actually attempted?  If so, what was done?
    Or was it simply easier to jump to conclusions?

  • [svn] 4018: Adding templates-path as a supported attribute of asdoc

    Revision: 4018<br />Author:   [email protected]<br />Date:     2008-11-04 14:43:47 -0800 (Tue, 04 Nov 2008)<br /><br />Log Message:<br />-----------<br />Adding templates-path as a supported attribute of <asdoc> <br /><br />QE Notes: None<br />Doc Notes: None <br />tests: checkintests<br /><br />Modified Paths:<br />--------------<br />    flex/sdk/trunk/modules/antTasks/src/flex/ant/AsDocTask.java

    [list]
    [*]. is an abbreviated syntax for self::node(). It's not correct syntax to use the dot after an explicit axis name.
    [*] self::foo matches the current node if it is a <foo> element. self::* matches the current node if it is an element. self:node() matches the current node.
    C. parent::node() is the "long form" which has .. as its abbreviated syntax. They are designed to give the same results.
    [*]OracleXSL does not current implement the namespace axis yet.
    [list]

  • Firefox dropping support for optgroups?

    It seems that Firefox 4 has dropped support for <optgroup> elements? Why would such a great web development browser do this? Also, the box model has changed with this release.
    Not good guys.

    Plugin are installed outside the control of Firefox and Firefox usually scan specific registry keys to find a specific plugin.
    As long as MS makes a Silverlight plugin available for Firefox then you can use Silverlight in Firefox.

  • Pentax K20D firmware upgrade 1.01 breaks Aperture support

    I upgraded my Pentax K20D to a new firmware, 1.01
    I used the PEF format since white balance in Aperture worked better with this format than with DNG.
    Now I get the "Image format not supported" square in Aperture again.
    Sigh!
    I really want to use Aperture since it is a good program. But I do not want to use DNG
    since this format has some white balance problems with Aperture.
    I hope Apple will update the Raw format support to again support the K20D format.
    Maybe Pentax changed a version number or something.
    I think the format has not changed since both Photoshop and Pentax Photo Laborotory
    can read the images without problems.
    Anyone know how to report this problem to Apple engineers so that they may fix this?
    Eskil...

    Here is an easier "fix" from the Pentax SLR Talk Forum: (from timo)
    http://forums.dpreview.com/forums/read.asp?forum=1036&message=28475746
    "OK -- putting some stuff together from another helpful UNIX Pentaxian, Mac users can do the following.
    1. Go here: http://www.sno.phy.queensu.ca/~phil/exiftool/
    2. Download the Mac OS X package ExifTool-7.34.
    3. The ExifTool installer should open up. Install, with your admin password
    Now you have ExifTools installed. As mentioned previously, Windows users can use a GUI (graphic user interface) wrapper, but Mac users have to use the command line.
    4. Download from your card the .PEF files to a folder. Download to a folder on the desktop, called "x" .
    5. BACK UP THIS FOLDER NOW. Important: put the backed up .PEFs in a different folder.
    6. In Applications -> Utilities, open up "Terminal"
    7. In terminal type "cd" and the spacebar. Now, from the desktop, drag the folder with the .PEFs on to the Terminal window. The Mac will auto-complete for you the address. (We are going into a directory with the images.)
    8. Now copy and paste the following (much easier than typing):
    exiftool -Make="PENTAX Corporation" ~/Desktop/x/*.PEF
    If you have the folder "x" open, you can watch ExifTool make copies of the original .PEF files and update the files with the new metadata that let's Aperture or iPhoto process those images.
    9. Import into Aperture or iPhoto. Back up your vault or whatever.
    10. Delete the contents of "x" when you're satisfied the .PEFs are what you want them to be."
    Worked nicely for me - assuming the ONLY problem is the simple text change from PENTAX Corporation to PENTAX in the EXIF data.
    Message was edited by: dfly

  • Dropped support for high-def dvd?

    Does anyone know if Mavericks dropped support for the HD DVD format offered by Compressor 3?
    A DVD authored with this format will not play on an iMac (2.4 Intel Core 2 Duo) running Mavericks, but will play on a Mac Pro (2x2Ghz Dual-Core Intel Xeon) running Mac OS 10.6.8. Other DVDs play fine on the iMac.
    Thanks in advance for any information regarding this.

    The CalDigit card is not rated to work on the NEWEST MacPros...the ones with different processors and other internal circuitry. It works fine on previous models. The big reason I suggest the Caldigit card over the rest is:
    1) It is half the price with all the same features
    2) It can be installed and removed by the customer. The Apple card can only be installed and removed by a certified Apple dealer.
    Now, Raid 5 is good as it offers PROTECTION...where RAID 0 does not. If one drive dies, the RAID 5 still works. If the same happened to Raid 0, all info is lost...ALL. Raid 5 will lower the capacity of all the drives, as it uses one for this protection, where Raid 0 is larger. Give and take.
    FYI...I cut DVCPRO HD and ProRes on internal drives...no raid. Firewire 800 drives are good for this format too. Raids are only needed for multiple streams of ProRes, and the uncompressed formats. And for protection.
    Shane

Maybe you are looking for

  • Arranging charts in one row

    Hi, How should I go about aligning 3 line charts in one row? What I plan to do is have a report containing data on the first row and on the second row I'll have 3 charts to represent the data above. Right now my charts are occupying rows 2,3,4 and ar

  • Plz..answer how to solve the errors

    HI to all,    I am preparing for an Interview and i know some errors and but i dont know how we can solve them... I want to know the solution for these errors... 1)No Sid value found 2)Ale remote lock 3)Transact Trfc 4)Special Chars 5)errors in Sourc

  • ITunes 10.x mouse disabled when visualizer running

    Ever since I updated to iTunes 10.x my mouse no longer functions when the visualizer is running. Was totally fine in earlier versions of iTunes. Why remove this ability? Or is something wrong with my installation?

  • Transactional Data Field Change

    Hi SDNites, I am trying to identify all the field changes (Transactional Data) which has been done into CRM for a specific transaction (Ex: Service request). Could you please suggest any BADI or any function module which will provide me the same. Reg

  • Changes between MII 12.0.2 and 12.0.9 (patch 7)

    Hi, We've upgraded one of our non-production MII environments from MII 12.0.2 (build 88) to 12.0.9 (build 23), and some of our dashboard apps are not working correctly. One issue that I've tracked down sounds similar to this post: [Re: java.io.EOFExc