7 Replies Latest reply on Aug 27, 2007 1:14 PM by Joe Greene

    drag indicator z-index??

    Joe Greene Novice

      Here?s a code snippet of how I use drag support:

      <a4j:outputPanel>
      <rich:dragSupport dragType="genItem" dragValue="general.ico"
      action="#{dragDropBean.dragAction}"
       ondragstart="applyMapDropProxy();"
      ondragend="removeMapDropProxy();" />
      <h:graphicImage id="icon_1" url="images/general.ico" />
      </a4j:outputPanel>



      In IE7, the default dashed line drag indicator appears behind the divs I use on the page. Only when I drag past the div boundaries does the indicator become visible. I don?t have this problem in Firefox. Has anyone seen this before? Is there an easy way to apply a z-index to the drag indicator?

      Also, maybe I'm doing something wrong, but my drop action fires no matter where on my page I do the drop, even though I only have one div on the page designated as a drop target. See this code snippet below.

      <div id="map" style="width: 600px; height: 428px;">
       <a:map value="#{mapContext.webMap}" id="map1" width="600" height="428" />
       <div id="dropProxy">
       <rich:dropSupport id="mapDropProxy" acceptedTypes="genItem" dropValue="genIcon" dropListener="#{dragDropBean.processDrop}" reRender="map" ondrop="alert('just dropped icon');">
       </rich:dropSupport>
       </div>
      </div>



      Any help on these issues will be greatly appreciated. Thank you.


        • 2. Re: drag indicator z-index??
          Joe Greene Novice

          Hi Sergey -
          Yes, I experienced this "position" problem before with a menubar, and indeed solved it by explicitly setting the position to "absolute". But the problem I'm having now seems to pertain only to a drag indicator in my rich:dragSupport code. If I'm using the default drag indicator, how do I access its position attribute?

          Oh, one more thing, is there a preferred way to get the (x,y) on a drop event?

          • 3. Re: drag indicator z-index??
            Nick Belaevski Master

            1. Could you please try to replace div with <a4j:outputPanel layout="block"> and check if only the outputPanel div is accepting drops?

            2. Add argument to ondrop() function and extract coordinates from there, as it is a regular browser mouse event

            • 4. Re: drag indicator z-index??
              Joe Greene Novice

              Thanks, Nick.

              I'll try your suggestion first thing Monday, as I'm home right now. Should I be able to position and size the a4j:outputPanel just like I do the div?

              About the x,y coordinates of the drop event - I've done this kind of thing before when everything was being managed on the client via javascript, but I was wondering how to get these coordinates back to the server through the normal ajax functionality of the Richfaces component or ajax4jsf, because I have to use these coordinates on the server. I've rolled my own ajax framework before, but I'm hoping RF and a4j will provide an easy alternative.

              Maybe there's something obvious here - but its been long week. Thanks for your help.

              - Joe

              • 5. Re: drag indicator z-index??
                Nick Belaevski Master

                Joe,

                got the point on coordinates! Here is the sample:

                <rich:dropSupport id="php" acceptedTypes="PHP" dropValue="PHP"
                 dropListener="#{eventBean.processDrop}" reRender="phptable, src">
                 <a4j:actionparam value="event.clientX" noEscape="true" assignTo="#{userBean.x}" />
                 <a4j:actionparam value="event.clientY" noEscape="true" assignTo="#{userBean.y}" />
                 </rich:dropSupport>

                Refer to http://labs.jboss.com/file-access/default/members/jbossajax4jsf/freezone/docs/tlddoc/a4j/actionparam.html for more info.

                a4j:outputPanel with "block" layout is actually a DIV so it should accept any style attributes that DIV understands.

                • 6. Re: drag indicator z-index??
                  Joe Greene Novice

                  Nick -
                  I hope you meant your first line to be a "one-liner". Nice!

                  thanks for this response. Yep. This looks like what I need. I'll try it out
                  first thing this morning when I get to work. Will post results.

                  - Joe

                  • 7. Re: drag indicator z-index??
                    Joe Greene Novice

                    Hi Nick -
                    I've added the a4j:actionparam tags as you suggested, and this seems like it is supposed to work. But what happens is that the bean gets updated with the values one drop too late. In other words, on my first drop, no matter where it is, my x,y in the bean is 0,0. On the next drop, no matter where, my x,y has been updated with the x,y of the first drop - and so on...

                    I took a guess and tried setting immediate="true", but this did not work. I also tried using the dropValue attribute, but that didn't work either. What's the trick here to make sure the current values get processed when they should?

                    Also, about the drag indicator z-index issue - I've done more work on that, too, using the a4j:outputPanel. This did not fix everything. It did not always prevent other areas of the page from receiving a drop event. But even worse for me, I was using this div as a drop proxy layer, and applying an opacity style to it, then laying it over my map. Changing the proxy layer to an a4j:outputPanel for some reason either prevents it from appearing or prevents its style from being applied. I even made it wider in its style definition to see if it was simply underneath another div, but I don't see it at all. Having the a4j:ouptutPanel there causes the id to be different by prepending the id of the enclosing form, but I think I've taken that into account.

                    If you have any ideas about the drop coordinates issue, I'll get that solved first, then concentrate on the a4j:outputPanel issue.

                    Thanks again for any help.

                    Best regards,
                    Joe