Why does not drag and drop work?!

Hello,
I am trying to implent a drag and drop from a table to an icon representing a trash.
The drop handler fails in converting the selected rows to a list:
com.sun.el.MethodExpressionImpl@87d9c00d javax.el.ELException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
Could you help me to understand why? Below are the details.
This is the af:table:
<af:table var="row" rowBandingInterval="0" id="t1"
value="#{bindings.MyView1.collectionModel}"
rowSelection="multiple"
columnStretching="last"
horizontalGridVisible="false"
verticalGridVisible="false" fetchSize="-1"
autoHeightRows="6" width="190"
disableColumnReordering="true">
<af:column sortable="true" headerText="Entry" id="c1"
align="start">
<af:outputText value="#{row.Description}" id="ot1"/>
</af:column>
<af:dragSource actions="MOVE" defaultAction="MOVE"
discriminant="delete"/>
</af:table>
This is the drop area:
<af:image source="Images/empty_trash_32.png" id="i2">
<af:dropTarget dropListener="#{backingBeanScope.DropHandlerBean.dropHandler}"
actions="MOVE">
<af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet"
discriminant="delete"/>
</af:dropTarget>
</af:image>
This is the failing listener listener (the failing point is bold):
public DnDAction dropHandler(DropEvent dropEvent) {
DnDAction dnda = DnDAction.NONE;
if (dropEvent.getProposedAction() == DnDAction.MOVE) { // delete
RichTable table = (RichTable)dropEvent.getDragComponent();
//determine the rows that are dragged over
Transferable t = dropEvent.getTransferable();
//when looking for data, use the same discriminator as defined
//on the drag source
DataFlavor<RowKeySet> df =
DataFlavor.getDataFlavor(RowKeySet.class, "delete");
RowKeySet rks = t.getData(df);
if (rks == null) {
return DnDAction.NONE;
Iterator iter = rks.iterator();
while (iter.hasNext()) {
//get next selected row key
System.out.println(rks.toArray().length); // the number of selected rows is ok
List key = (List)iter.next(); // here gives: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
//make row current so we can access it
table.setRowKey(key);
//the table model represents its row by the ADF binding class,
//which is JUCtrlHierNodeBinding
JUCtrlHierNodeBinding rowBinding =
(JUCtrlHierNodeBinding)table.getRowData();
Row row = (Row)rowBinding.getRow();
//delete row;
row.remove();
//activate animation
dnda = DnDAction.MOVE;
return dnda;
thanks.

I did try, I obtained this:
java.lang.NullPointerException
Why NullPointerException?
I don't know if this helps, but consider that the collection model comes from a ViewObject built on three EOs with many fields, although the table only shows one column.
This is the Iterator in my pageDef:
<table IterBinding="MyView1Iterator" id="MyView1">
<AttrNames>
<Item Value="Cod1"/>
<Item Value="Cod2"/>
<Item Value="Cod3"/>
<Item Value="Cod4"/>
<Item Value="Description"/>
<Item Value="Cod5"/>
</AttrNames>
</table>
Any idea?
I will see the Key content with the debugger.

Similar Messages

  • Why does the drag and drop feature not work?

    I have several files on my desktop.  When I try to move them o a new location, they just 'snap back' to their original position.  Why doesn't the drag and drop feature not function properly?

    I'm just trying to move some files to a new position on the desktop.

  • Why does the drag and drop context menu always popup when dragging files between windows explorer instances ?

    I have fusion 7.1.1 on an iMac 27 inch retina. 32GB ram of which 6GB assigned to Fusion and 2 cores. Windows 7 Home Premium installed. Mostly working fine but a few funnies. First and foremost: Whenever I drag and drop between instances of windows explorer, I get the little pop-up context menu offering me Copy Here / Move Here etc.  etc. I have never known Windows to ask me what I want to do when I drag stuff - why is this happening ? I have scoured the net for info on this and found nothing. Please note that this is NOT associated with the Start Menu (For which I found a zillion solutions to whatever that problem is). Also, It is NOT to do with stopping drag & drop and Context menus: yes, I know how to do that but that is NOT what I'm asking to get rid of. This may not be related but I have also had to set my Internet Properties / Explorer settings / Launching-applications-and-unsafe-files to "Enable" to prevent every shortcut I create causing a "Do you want to run this ... ?" message every time I click on them. Doing this has caused WIndows 7 to turn into a finger-wagging safety-nanny glaring at me over its demi-lune spectacles.

    Ok ... fixed
    Here is the way http://forums.creativecow.net/thread/3/944828
    In your sequence, on the left most column you should see a V1 (left of the Lock Track button). Click that to make sure its highlighted, it allows you to drop video to the sequence.

  • Why won't drag and drop work with Library Assets in Illustrator or InDesign?

    I've read a couple of threads with people having this issue, some dating back to late summer last year. I tried the fixes offered up in the responses, but haven't had success yet.
    All my programs are up-to-date, but I cannot drag and drop graphics from my library into InDesign or Illustrator. Photoshop is working fine.
    Are there any actual solutions to this yet?

    What kind of graphic are you talking about? In the Library panel (Illustrator) or CC Library panel (InDesign) graphics are identified with a small label to tell what their source is (Ai, ID, PS, SVG, etc.)
    And even though you say you have the latest version, exactly what version of InDesign do you have? You can see it in the About InDesign choice under the InDesign menu (Mac) or Help menu (Windows).

  • HELP! Why does my Drag and Drop not work Completely?

    Hello! I'm working on an ActionScript 3 movie clip in Adobe Flash. In the interactive movie I want the user to create a snowman with the parts on the left side. (Picture below.)
    On the right side I have the snowman slightly visible, so the user knows where to put the parts. Most of it seems to work... but after I put on the body, hat, and arms the other pieces don't work; like the eyes, nose, mouth, etc. Why does it not work? Can someone help me?
    This is how it should look at the end, when the user complets it.
    I think I coded this correctly. But I'm not sure. Please take a look at my code and see what the problem is. Thanks!!!
    var startX:Number;
    var startY:Number;
    var counter:Number = 0;
    SNOWMAN1_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    SNOWMAN1_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    SNOWMAN2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    SNOWMAN2_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    SNOWMAN3_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    SNOWMAN3_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    LEFTARM_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    LEFTARM_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    HAT_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    HAT_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    RIGHTARM_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    RIGHTARM_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    SCARF_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    SCARF_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    EYES_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    EYES_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    MOUTH_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    MOUTH_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    CARROT_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    CARROT_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    COLE1_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    COLE1_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    COLE2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    COLE2_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    COLE3_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    COLE3_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    function pickUp(event:MouseEvent):void {
    event.target.startDrag(true);
    MYTEXTBOX.text = "";
    event.target.parent.addChild(event.target);
    startX = event.target.x;
    startY = event.target.y;
    function dropIt(event:MouseEvent):void {
    event.target.stopDrag();
    var myTargetName:String = "T" + event.target.name;
    var myTarget:DisplayObject = getChildByName(myTargetName);
    if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
    MYTEXTBOX.text = "Good Job!";
    event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
    event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
    event.target.buttonMode = false;
    event.target.x = myTarget.x;
    event.target.y = myTarget.y;
    counter++;
    } else {
    MYTEXTBOX.text = "Try Again!";
    event.target.x = startX;
    event.target.y = startY;
    if(counter == 13){
            MYTEXTBOX.text = "Congrats, you're finished!";
    SNOWMAN1_mc.buttonMode = true;
    SNOWMAN2_mc.buttonMode = true;
    SNOWMAN3_mc.buttonMode = true;
    LEFTARM_mc.buttonMode = true;
    HAT_mc.buttonMode = true;
    RIGHTARM_mc.buttonMode = true;
    SCARF_mc.buttonMode = true;
    EYES_mc.buttonMode = true;
    MOUTH_mc.buttonMode = true;
    CARROT_mc.buttonMode = true;
    COLE1_mc.buttonMode = true;
    COLE2_mc.buttonMode = true;
    COLE3_mc.buttonMode = true;

    Below is a more efficient code. I am not sure about chasing parents you do in the code (always bad idea) so this code may be buggy:
    var startX:Number;
    var startY:Number;
    var counter:Number = 0;
    // reference to currently dragged object
    var currentTarget:Sprite;
    var objectCollection:Array = [SNOWMAN1_mc, SNOWMAN2_mc, SNOWMAN3_mc, LEFTARM_mc, HAT_mc, RIGHTARM_mc, SCARF_mc, EYES_mc, MOUTH_mc, CARROT_mc, COLE1_mc, COLE2_mc, COLE3_mc];
    activateObjects();
    function activateObjects():void {
         for (var i:int = 0; i < objectCollection.length; i++) {
              currentObject = objectCollection[i] as Sprite;
              currentObject.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
              currentObject.buttonMode = true;
    function pickUp(event:MouseEvent):void {
         currentTarget = event.currentTarget as Sprite;
         currentTarget.startDrag(true);
         MYTEXTBOX.text = "";
         currentTarget.parent.addChild(currentTarget);
         startX = currentTarget.x;
         startY = currentTarget.y;
         stage.addEventListener(MouseEvent.MOUSE_UP, dropIt);
    function dropIt(event:MouseEvent):void {
         stage.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
         stopDrag();
         var myTarget:DisplayObject = getChildByName("T" + currentTarget.name);
         if (currentTarget.dropTarget != null && currentTarget.dropTarget.parent == myTarget){
              MYTEXTBOX.text = "Good Job!";
              currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
              currentTarget.buttonMode = false;
              currentTarget.x = myTarget.x;
              currentTarget.y = myTarget.y;
              counter++;
         } else {
              MYTEXTBOX.text = "Try Again!";
              currentTarget.x = startX;
              currentTarget.y = startY;
         if (counter == 13) MYTEXTBOX.text = "Congrats, you're finished!";
         currentTarget = null;

  • Why doesn't drag and drop work?

    I want to re-arrange files on my desktop.  When I use 'drag & drop' the file I moved just snaps back to its original location.  How do I get 'drag & drop'  to work properly?

    Hi Probie 1983!
    Nope, there are no such options/menu items in my menus, and I did not click 'Arrange By' as you stated.
    My version of Lion came with the Mac Pro I purchased; it was not an upgrade, so maybe that's part of the problem.
    I'm going to call Apple and use the support 'contract' I purchased when I bought the MacPro.  I'll let anyone know what they say if there's an interest.
    Cheers,
    Dave P.

  • I bought a 5th Gen Touch. I use iTunes 12 on two computers. One computer allows me to drag and drop. The other does not.The one that allows it has problems. Any idea as to why I can drag and drop on one and not the other. Both are authorized.

    I bought a 5th Gen Touch. I use iTunes 12 on my two computers. I first connected the Touch to my desktop and it allows me to drag and drop mp3 files from my old Classic, which is backed up to a directory. Unfortunately, that computer has gone down before I got a chance to fill the Touch. I have the files on another computer but when I connect the Touch to it, it doesn't allow me to drag and drop the files. I have iCloud set on both systems and I have manual management check marked. I'm not understanding why it allows drag and drop on one PC and not the other when they are both set the same way. My question? What do I need to do to be able to drag and drop in iTunes 12? I didn't do anything special on the computer that allows it so I am at a loss.
    Thank you!

    Oh, also want to add that the PC I'm currently using is:
    Windows Vista Home Premium Service Pack 2
    My other PC was:
    Windows 7 Ultimate
    My MacBook is:
    Max OSX 10.5.something (the last update available for it. .8 maybe? haha)
    Not sure if this stuff is important, but I thought I'd add it.

  • Hello, does anyone know why when i drag and drop from the internet,why my images never show up?

    hello, does anyone know why when i drag and drop from the internet,why my images never show up?

    I'm wanting to drag images from the internet into a folder on my desktop or hard drive. I am used to being able to drag just about any image from any website off the web and into a folder on my old mac, but since I got my laptop, I've noticed I cannot do that. Is it a preference?

  • Why can I drag and drop a file into A3, but not import it?

    With A2+ I've scanned images (Epson flatbed) and imported them as TIFF, JPG, PNG, whatever.
    Same scanner, software, and A3 refuses to import any of the above formats. However, I can drag and drop the image on a project and it works.
    Any ideas? I looked for relevant threads but didn't see any immediately.
    Thanks

    Image appears in import pane; I can assign metadata, click "import," wait about 10 seconds and it says "import completed with errors," though the file doesn't show up in project.
    I have to say it's inconsistent. I just spend 20 minutes trying to import a one scan in PNG, TIF, JPG formats, and eventually gave up and dragged it in as TIF.
    Just now, I tried importing it into a different A3 project, and the TIF worked. However the PNG (which I didn't drag into A3, still gives the above error.
    I can live with this as long as drag and drop works, but seems like a bug.

  • Why cant I drag and drop into playlists

    I used to be able to drop and drag inrto playlists. Now I get a message which says press + button to add, but there seems no way of doing it. I'm using windows 7

    Apple Support Communities updatesI’ve tried the control-I route and then tried to locate the file without success. What I get as a file location starts with //localhost/C:/Users. It may also be useful to know that most/all the missing files seem to have been copied from CDs. I can’t be sure if it’s all because the whole music file has nearly 9000 entries! The ones that still seem to work were copied from an external hard drive.
    From: Apple Support Communities Updates
    Sent: Wednesday, April 01, 2015 7:30 PM
    To: couffin
    Subject: - why cant I drag and drop into playlists
                                                                                    You received a reply 
                                    turingtest2 has replied to your question. You can view the full discussion in Apple Support Communities.                                                                                
    why cant I drag and drop into playlists 
                                    The "missing file" error happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, one of its parent folders, or the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place. (In the case of a library moved from one system to another there are also potential permissions issues. See Repair security permissions for iTunes for Windows if this might apply.)
                                    Select a track with an exclamation mark, use Ctrl-I to Get Info, then click No when asked to try to locate the track. (Due to a bug in iTunes 12 you currently have to say No twice!) Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, a folder renamed, or a drive letter has changed, it should be possible to reverse the actions. If the difference between the two paths is an additional Music folder in one path then this is a layout issue. I can explain further if that is the case.
                                    In some cases iTunes may be able to repair itself if you go through the same steps with Get Info but this time click Locate and browse to the lost track. It may then offer to attempt to automatically fix other broken links. Although it says something like "use the same location" it expects to find the tracks in the same artist & album layout that it generates, not all in one big folder.
                                    If another application like Windows Media Player has moved/renamed the files then the chances are that subtle differences in naming strategies will make it hard to restore the media to the precise path that iTunes is expecting. In such cases, as long as the missing files can be found somewhere, you should be able to use my FindTracks script to reconnect them to iTunes. See this post for an explanation of how it works.
                                    tt2
                                                                                    Correct Answer Helpful Answer 
                                  Use the buttons above to tell turingtest2 and the rest of the community if this reply solved your question or helped you get closer to finding a solution. 
                                  To reply to turingtest2, go to the discussion in Apple Support Communities. 
                                  You are receiving this email from Apple Support Communities. You can change your email preferences in your Apple Support Communities Profile. 
                                  TM and copyright © 2014 Apple Inc. 1 Infinite Loop, MS 96-DM. Cupertino, CA 95014. 
                                  All Rights Reserved | Privacy Policy | Terms of Use | Apple Support

  • Can not drag and drop or copy and paste

    It is as simmple as the title. I can not drag and drop icons or text or folders. Nothing. As for cut, copy, and paste they do not work either. I am trying to back up my files so I can do a clean install of snow leopard. I have leopard currently.

    So Copy/Paste, etc. isn't working in say Text Edit?
    On the Drag & Drop, where are you trying to drop them, & does the icon move but just not copy?

  • "Could not drag and drop" smart symbol in FW CS4

    When I drag a smart symbol from the common library over to my document, I get the message "Could not drag and drop. An error occured."  I see this error whether or not I see the library conflict message.  However, the symbol is placed in my document despite the error.
    Why am I receiving this error when it seems to be working OK?

    Was just reading another post about the CS4 bugs - afraid this is one of them!
    http://forums.adobe.com/message/204302#204302
    At least it completes the action you want?? (Looking on the brightside!)
    I think we all have our fingers crossed for an update ASAP to fix some of these issues?

  • XfinityConnect Email attachments will not drag and drop.

    DATE (yyyy-mm-dd) : 2015-04-10 15:00PM Email attachments will not drag and drop.   This feature was working for years, then suddenly I only can attach files to an Email by opening up the directory browser to.... aaarg... go get one - file - at - a - time, or zip 'em up for the one fetch, yet still... drag and drop is soooooo much better. Specifications:Using XfinityConnect 'full' version.Do not use an email client.Browser/version Windows Explorer V11Cleared browser cache.Operating system: Windows 7 Ultimate 

    I have the same complaint.  Drag and drop worked until last week, 2015-04-05!    Must now do one at a time through the ATTACH button at top of E-mail.   Why change a good process?

  • My macbook pro with OS x Lion will not drag and drop files from finder or iTunes

    My macbook pro with OS x Lion will not drag and drop files from finder or iTunes. Can anyone help?

    Hi, I just have same problem.. I can't drag and drop file /folder.. please help.. I can drag the file/folder and move it , but I can't drop it after move it please help...!!!
    It is happen just after I re-start my computer.. I tried to repair and anything but just don't work. Actually the old style one finger double tab and lock is much better rather the 3 fingers.
    Please help to fix the drag and drop for file/folder/itunes.

  • Why cant i drag and drop movies into itunes?

    why cant i drag and drop movies into itunes?

    To make it display on the desktop, Finder > Preferences > General tab > check external disks.
    The drive might be formatted NTFS for Windows which is treated as read-only on the Mac.  Need to reformat it using disk utility.

Maybe you are looking for

  • Siri is not working on brand new phone. (4s)

    I first tried it out.  I said "Hello Siri"  Siri responded "Hello" Then every request after that... "I'm really sorry about this, but I cant take any requests righgt now. Please try again in a little while" or "There's something wrong and I can't ans

  • Is it possible to create sequence shots in aperture

    Digital Photography magazine had an article about sequence shots using Photoshop.  Does Aperture have the tools to create a sequence shot?

  • Anchor object

    Is it possible to anchor an object on a different spread from the text reference? That seems to be a restriction in practice, but I can't find mention of it or a way round it (in CS5.5).

  • Rotating image

    I want to create a Christmas eCard with a rotating bauble. Can anyone suggest a way to do this or a tutorial to follow?

  • Skype Version 7.2.0.103 just keep crashing

    I have upgraded Skype which is bacially an automatice upgrade to a version Skype Version 7.2.0.103. Since I have upgraded my Skype Application just simply crashing. I am using WIndows 8.1 Verson. I can open the application. Then it stays up for about