ICEfaces
  1. ICEfaces
  2. ICE-2680

dragEvent.getTargetDragValue() always null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7DR#3
    • Fix Version/s: 1.7RC1, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      ICEfaces

      Description


      The event passed to the dragListener returns null for event.getTargetDragObject()

      This can be seen in the following code from component-showcase that is far more complex than necessary:

              if (event.getEventType() == DndEvent.DROPPED) {
                  String targetId = event.getTargetClientId(); if ((targetId != null) &&
                      (targetId.indexOf("cartDropTarget") != -1)) {
                      String value = ((HtmlPanelGroup) event.getComponent())
                              .getDragValue().toString();

        Issue Links

          Activity

          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15662 Fri Jan 25 17:33:27 MST 2008 ted.goddard using clientID of dragged component for dragValue (ICE-2680)
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/GroupRenderer.java
          Ted Goddard created issue -
          Hide
          Ted Goddard added a comment -

          Please review change to GroupRenderer.java. component-showcase should also be revised, but that can be a different JIRA.

          Show
          Ted Goddard added a comment - Please review change to GroupRenderer.java. component-showcase should also be revised, but that can be a different JIRA.
          Ted Goddard made changes -
          Field Original Value New Value
          Assignee Adnan Durrani [ adnan.durrani ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15675 Mon Jan 28 14:35:09 MST 2008 ted.goddard simplified dragNdrop code (ICE-2680)
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/src/com/icesoft/icefaces/samples/showcase/components/dragDrop/CartBean.java
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/web/inc/components/dragDrop.jspx
          Hide
          Ted Goddard added a comment -

          Simplified code for component-showcase has been checked in; essentially:

          addToPurchases(event.getTargetDragValue());

          Show
          Ted Goddard added a comment - Simplified code for component-showcase has been checked in; essentially: addToPurchases(event.getTargetDragValue());
          Ted Goddard made changes -
          Fix Version/s 1.7Beta1 [ 10121 ]
          Hide
          Adnan Durrani added a comment -

          Changes looks good. closing this case.

          Show
          Adnan Durrani added a comment - Changes looks good. closing this case.
          Adnan Durrani made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15746 Wed Feb 06 20:03:36 MST 2008 ted.goddard using exchanged objects for DropEvent (ICE-2680)
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/GroupRenderer.java
          Hide
          Harvey McQueen added a comment -

          Is there a reason in you switched the targetDragValue and targetDropValue on the DropEvent?

          Show
          Harvey McQueen added a comment - Is there a reason in you switched the targetDragValue and targetDropValue on the DropEvent?
          Hide
          Harvey McQueen added a comment -

          Feel free to substitute "why" for "in" in my previous question.

          Show
          Harvey McQueen added a comment - Feel free to substitute "why" for "in" in my previous question.
          Hide
          Ted Goddard added a comment -

          The values appear to be reversed, perhaps due to how the ids are encoded from the JavaScript bridge.

          Do you see them reversed in your application code? If so, we should create an additional test case.

          Show
          Ted Goddard added a comment - The values appear to be reversed, perhaps due to how the ids are encoded from the JavaScript bridge. Do you see them reversed in your application code? If so, we should create an additional test case.
          Hide
          Harvey McQueen added a comment -

          I have been testing my application with 1.7Beta1 to try out some of the new features and got some strange behavior out of the DropEvent. The value returned from event.getTargetDragValue() is now the dropValue from the dragged component and event.getTargetDropValue() returns the dragValue of the component it was dropped on.

          I tried out 1.7DR#3 which works fine, so I thought it might have something to do with the changes to the GroupRenderer. After looking at the changes I believe the code to retrieve values for a DropEvent needs to be slightly different than that for a DragEvent:

          targetDragValue = dndCache.getDragValue(targetID);
          targetDropValue = dndCache.getDropValue(panel.getClientId(context));

          The current code in the GroupRenderer works only to get values for a DragEvent.

          The DropEvent instantiation also should to be changed back to:

          DropEvent event = new DropEvent(component, type, targetID,
          targetDragValue,
          targetDropValue);

          I've got a modified version GroupRenderer.java which seems to work for both DragEvents and DropEvents if you would like to see it.

          Show
          Harvey McQueen added a comment - I have been testing my application with 1.7Beta1 to try out some of the new features and got some strange behavior out of the DropEvent. The value returned from event.getTargetDragValue() is now the dropValue from the dragged component and event.getTargetDropValue() returns the dragValue of the component it was dropped on. I tried out 1.7DR#3 which works fine, so I thought it might have something to do with the changes to the GroupRenderer. After looking at the changes I believe the code to retrieve values for a DropEvent needs to be slightly different than that for a DragEvent: targetDragValue = dndCache.getDragValue(targetID); targetDropValue = dndCache.getDropValue(panel.getClientId(context)); The current code in the GroupRenderer works only to get values for a DragEvent. The DropEvent instantiation also should to be changed back to: DropEvent event = new DropEvent(component, type, targetID, targetDragValue, targetDropValue); I've got a modified version GroupRenderer.java which seems to work for both DragEvents and DropEvents if you would like to see it.
          Hide
          Adnan Durrani added a comment -

          It seems like that the fix might introduced a regression ICE-2753.

          Show
          Adnan Durrani added a comment - It seems like that the fix might introduced a regression ICE-2753 .
          Adnan Durrani made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Adnan Durrani made changes -
          Link This issue blocks ICE-2753 [ ICE-2753 ]
          Hide
          Ted Goddard added a comment -

          Harvey, please post your diff of the GroupRenderer so we can take it into consideration.

          Show
          Ted Goddard added a comment - Harvey, please post your diff of the GroupRenderer so we can take it into consideration.
          Hide
          Ted Goddard added a comment -

          Harvey, can you also post a snippet of your page showing which listeners you are using?
          (And whether inclusion in a dataTable, etc is necessary to reproduce the problem.)

          Show
          Ted Goddard added a comment - Harvey, can you also post a snippet of your page showing which listeners you are using? (And whether inclusion in a dataTable, etc is necessary to reproduce the problem.)
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15964 Fri Mar 07 10:12:54 MST 2008 adnan.durrani Fix for ICE-2680 (dragEvent.getTargetDragValue() always null)
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/GroupRenderer.java
          Hide
          Adnan Durrani added a comment -

          revision: 15964

          Show
          Adnan Durrani added a comment - revision: 15964
          Adnan Durrani made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Fix Version/s 1.7 [ 10080 ]
          Fix Version/s 1.7Beta1 [ 10121 ]
          Resolution Fixed [ 1 ]
          Hide
          Adnan Durrani added a comment -

          Hi Harvey,

          Can you please, test your application with the latest change.

          Thanks,

          Show
          Adnan Durrani added a comment - Hi Harvey, Can you please, test your application with the latest change. Thanks,
          Hide
          Harvey McQueen added a comment -

          I'm attaching the patch from the GroupRenderer I am using.

          And here's a snippet of my code. I'm using panelSeries, no dataTables.

          <ice:panelSeries id="prototypes" value="#

          {editLayout.prototypes}

          " var="prototype">
          <ice:panelGroup style="cursor:move;" draggable="true" dragOptions="dragGhost"
          dragValue="#

          {prototype}

          ">
          ...
          </ice:panelGroup>
          </ice:panelSeries>

          <ice:panelSeries id="elements" value="#

          {editLayout.elements}

          " var="element">
          <ice:panelGroup style="cursor:move;" draggable="true" dragOptions="dragGhost"
          dragValue="#

          {element}

          " dropTarget="true"
          dropListener="#

          {editLayout.dropListener}

          "
          dropMask="hover_start" hoverclass="seriesHover">
          ...
          </ice:panelGroup>
          </ice:panelSeries>

          Show
          Harvey McQueen added a comment - I'm attaching the patch from the GroupRenderer I am using. And here's a snippet of my code. I'm using panelSeries, no dataTables. <ice:panelSeries id="prototypes" value="# {editLayout.prototypes} " var="prototype"> <ice:panelGroup style="cursor:move;" draggable="true" dragOptions="dragGhost" dragValue="# {prototype} "> ... </ice:panelGroup> </ice:panelSeries> <ice:panelSeries id="elements" value="# {editLayout.elements} " var="element"> <ice:panelGroup style="cursor:move;" draggable="true" dragOptions="dragGhost" dragValue="# {element} " dropTarget="true" dropListener="# {editLayout.dropListener} " dropMask="hover_start" hoverclass="seriesHover"> ... </ice:panelGroup> </ice:panelSeries>
          Harvey McQueen made changes -
          Attachment GroupRenderer.java.patch [ 10862 ]
          Hide
          Harvey McQueen added a comment -

          I don't see a revision 15964 in subversion.

          Show
          Harvey McQueen added a comment - I don't see a revision 15964 in subversion.
          Hide
          Harvey McQueen added a comment -

          I've got that revision now and will test it Monday.

          Show
          Harvey McQueen added a comment - I've got that revision now and will test it Monday.
          Hide
          Harvey McQueen added a comment -

          Sorry it took me so long to get back to you. I tested it and it still doesn't work. From my debugging, the only to values I see for dndType in GroupRenderer.decode are "dragdrop" and "DRAG".

          If you take a look at the patch file I attached previously, I put the code to retrieve the dragValue and the dropValue inside the if statements that check for a dragListener or a dropListener. I believe this works because the method of retrieving the dragValue and dropValue depends on whether you are creating the event for a dragListener or dropListener. I can't think of all the possible test cases though, so I'm not sure whether this is the best way to do it.

          Show
          Harvey McQueen added a comment - Sorry it took me so long to get back to you. I tested it and it still doesn't work. From my debugging, the only to values I see for dndType in GroupRenderer.decode are "dragdrop" and "DRAG". If you take a look at the patch file I attached previously, I put the code to retrieve the dragValue and the dropValue inside the if statements that check for a dragListener or a dropListener. I believe this works because the method of retrieving the dragValue and dropValue depends on whether you are creating the event for a dragListener or dropListener. I can't think of all the possible test cases though, so I'm not sure whether this is the best way to do it.
          Ken Fyten made changes -
          Fix Version/s 1.7RC1 [ 10123 ]
          Fix Version/s 1.7 [ 10080 ]
          Ken Fyten made changes -
          Fix Version/s 1.7 [ 10080 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Adnan Durrani [ adnan.durrani ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Ted Goddard
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: