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

          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.
          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 -

          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'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>
          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
          Adnan Durrani added a comment -

          revision: 15964

          Show
          Adnan Durrani added a comment - revision: 15964
          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.)
          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
          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 .
          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
          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 -

          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
          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
          Adnan Durrani added a comment -

          Changes looks good. closing this case.

          Show
          Adnan Durrani added a comment - Changes looks good. closing this case.
          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());
          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.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: