Saturday, July 17, 2010

Implementing Drag and Drop functionaly in Oracle ADF

Hi,

Drag and Drop is one of the core feature of Oracle ADF. In this post we will see how simple is to achieve this functionality.


Example Use Case:
We need to select few employee to visit Oracle Open world 2010, but management will choose only their favorite employees :) so they will drag employees images from left pane (Drag from) to the Selected employees List box. Employee Id can also be seen under the Image.


I will just shortly summarized the technical expect in the example. Rest you can explore by downloading the workspace.  

Components and Methods used in this example:
  • af:attributeDragSource :  Under Image component allows to drag the image to dropTraget area.
  • af:clientAttribute : Under Image component sets as employee full name as its value.
  • af:dropTarget: Sets the drop target area on the List box and allows to call Drag and Drop handler method.
  • af:attributeDropTarget: set its value as source's value if dropped on it.
  • DnDHandler class has a
  • Private variable called choices of type List which binded into the List Box
  • Drop event handler method called handleItemDrop which returns DnDAction type adds an element in the list box component.
Explore more in the example

feel free to comment

Happy JDeveloping,
Baig

5 comments:

  1. Hello, do you know of anyone who has implemented drag and drop form external files (ie - windows explorer) into an AFD panel?

    ReplyDelete
  2. @james i have not did anything similar, try OTN forums somebody might help you

    ReplyDelete
  3. I have tried to implement drag and drop feature on components using handler with drag source and drop target but failed and got this Exception on runtime when i dragged table row from one panel to another panel using flavor rowkeyset
    Attempt to validate an already invalid RegionSite:

    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR

    ReplyDelete
    Replies
    1. Hi,

      Is this happening on all browsers? I remember there was some API missing in FireFox also Make sure your code is valid.

      Zeeshan

      Delete
  4. can you give me valid link to check example well.

    ReplyDelete