3 Replies Latest reply on May 28, 2007 1:54 PM by nbelaevski

    DnD bug when using multiple accepted types

    jamu

      Hi,

      I think I found a bug in org.richfaces.renderkit.DnDEventsExchangeMailer.

      The line 134 looks like this:

      DnDValidator.validateAcceptTypes(facesContext, draggable, dropzone, acceptedTypes, dragType);
      


      but when taking a look at the DnDValidator code, there's

      static void validateAcceptTypes(FacesContext context, Draggable draggable, Dropzone dropzone, Object dragType, Object acceptedTypes) {
      


      When looking closely, the dragType and acceptedTypes are in wrong order in the DnDEventsExchangeMailer.

      This makes the method validateAcceptTypes() function correctly when there's only one acceptedType, but when using multiple types, the method does not function correctly. Instead this kind or error messages are shown:

      Dropzone [theForm:restrictions:_id560] with accepted types [removeDependency] cannot accept Draggable [theForm:restrictions:_id571:0:_id576] with dragType [removeDependency, removeExclusion]
      


      Even the error message shows that dragType and accepted types are in wrong order ("accepted type [removeDependency]" and "with dragType [removeDependency, removeExclusion]" when dragType should only contain one element and acceptedTypes should contain the list of types)

      What I am trying to accomplish is that I have three lists of elements, each list being inside a rich:panel. Let's call them lists A, B and C. I want to be able to drag elements in this way:

      from A to B
      from A to C
      from B to A
      from C to A
      NOT from B to C
      NOT from C to B

      - Janne


        • 1. Re: DnD bug when using multiple accepted types
          nbelaevski

          Hello!

          What RichFaces version are you using? As I can remember, there was such bug in 3.0.0, however it should have been fixed for now.

          • 2. Re: DnD bug when using multiple accepted types
            jamu

            Hi,

            Yes, I'm using 3.0.0. I downloaded the 3.0.1 snapshot sources and in that package the defect seems to still be there. I didn't try the binaries because I found a workaround and I've got it working now.

            I took the source package from here:
            http://maven.exadel.com/org/richfaces/richfaces/3.0.1-SNAPSHOT/richfaces-3.0.1-20070528.001449-67-sources.jar

            (That's where the wiki pages pointed me to)

            BUT when I browse the source from http://anonsvn.jboss.org/repos/richfaces/trunk/ the bug seems to be fixed.

            Which one is the correct one?

            Well, anyways I found a workaround already so I'm in no such a hurry with the fix anymore. I added different parameters (using a4j:actionparam) to the drag sources. The dropListener method in the managed bean checks the parameter value and thus knows what was the actual source for the drag even though the dragType is the same always.

            I guess I'll remove this workaround as soon as the 3.0.1 is final.

            Thank's for the advice!

            • 3. Re: DnD bug when using multiple accepted types
              nbelaevski

              Ok, looks like the problem is resolved :). I'm thankful for your assistance!

              Unfortunately, parameter names got mistyped when the problem has been resolved, so confusing names were still in code while the functionality was working properly. I've changed names today in order not to confuse somebody else, and maven-built sources still contain legacy code, but the problem is fixed in trunk so the fix will appear in the next build.