3 Replies Latest reply on May 27, 2008 4:53 AM by samtherecordman

    Drag and drop in different forms drag value always null - 3.

    samtherecordman

      Drag and drop when the drag/drop tags are in different forms always results in drag value is null in processDrop() method.

      Test case
      -------------

      The code below has two drag and drop areas.

      1. Drag [Drag me A] onto [Drop zone A] and drag value is always null. The drag zone is in a different form to the drop zone.

      INFO: org.richfaces.event.DropEvent[source=org.richfaces.component.html.HtmlDropSupport@13ed2fc]
      May 23, 2008 10:25:22 AM dashboard.Test processDrop
      INFO: drag value null
      May 23, 2008 10:25:22 AM dashboard.Test processDrop
      INFO: drop value bar

      2. Drag [Drag me B] onto [Drop zone B] and drag value is correct. The zones are in a single form.

      INFO: org.richfaces.event.DropEvent[source=org.richfaces.component.html.HtmlDropSupport@bc9d1a]
      May 23, 2008 10:26:16 AM dashboard.Test processDrop
      INFO: drag value foo
      May 23, 2008 10:26:16 AM dashboard.Test processDrop
      INFO: drop value bar


      This looks like a bug. Regards

      Sam Elstob
      Triometric


      Test.java

      package dashboard;

      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      import org.richfaces.event.DropEvent;
      import org.richfaces.event.DropListener;

      public class Test implements DropListener
      {
      private Log log = LogFactory.getLog(Dashboard.class);


      @Override
      public void processDrop(DropEvent event)
      {
      // TODO Auto-generated method stub
      log.info(event);
      log.info("drag value " + event.getDragValue());
      log.info("drop value " + event.getDropValue());

      }

      }


      test.jsp

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>


      <f:view>


      <rich:dragIndicator id="drag_indicator_1">

      </rich:dragIndicator>
      <h:form id="drag_form">
      <a4j:outputPanel>
      <h:outputText value="Drag me (A)" />
      <rich:dragSupport dragType="drag_type_1" dragValue="foo" dragIndicator="drag_indicator_1">

      </rich:dragSupport>
      </a4j:outputPanel>
      </h:form>

      <h:form id="drop_form">
      <rich:panel style="height: 200px; width: 200px">
      <h:outputText value="Drop zone A" />
      <rich:dropSupport acceptedTypes="drag_type_1"
      dropListener="#{test.processDrop}" dropValue="bar">
      </rich:dropSupport>
      </rich:panel>
      </h:form>

      <h:form id="single_form">
      <a4j:outputPanel>
      <h:outputText value="Drag me (B)" />

      <rich:dragSupport dragType="drag_type_1" dragValue="foo" dragIndicator="drag_indicator_1">

      </rich:dragSupport>
      </a4j:outputPanel>

      <rich:panel style="height: 200px; width: 200px">
      <h:outputText value="Drop zone B" />
      <rich:dropSupport acceptedTypes="drag_type_1"
      dropListener="#{test.processDrop}" dropValue="bar">
      </rich:dropSupport>
      </rich:panel>
      </h:form>

      <%-- --%>
      <%-- --%>
      <%-- Debugging panels below here--%>
      <!-- a4j debug log -->
      <a4j:outputPanel layout="block" rendered="true" id="panel_debug">
      <rich:simpleTogglePanel switchType="client" label="a4j debug log"
      opened="false" id="panel_debug_a4j">
      <a4j:log popup="false" level="ALL" style="width: 800px; height: 300px;" />
      </rich:simpleTogglePanel>
      </a4j:outputPanel>



      </f:view>

        • 1. Re: Drag and drop in different forms drag value always null
          samtherecordman

          Apologies - the subject line cut short which library version I am using:

          3.2.0-SR1 / myfaces 1.2.3

          Full list of libs:

          antlr-2.7.6.jar facestrace-0.9.0.jar
          asm-attrs.jar hibernate3.jar
          asm.jar hibernate-annotations.jar
          c3p0-0.9.1.jar hibernate-commons-annotations.jar
          cglib-2.1.3.jar jakarta-oro.jar
          jcommon-1.0.12.jar
          commons-beanutils-1.7.0.jar jfreechart-1.0.9.jar
          commons-chain-1.1.jar jstl-1.2.jar
          commons-codec-1.3.jar jta.jar
          commons-collections-3.2.jar myfaces-api-1.2.3.jar
          commons-dbcp.jar myfaces-api-1.2.3-javadoc.jar
          commons-digester-1.8.jar myfaces-impl-1.2.3.jar
          commons-discovery-0.4.jar myfaces-impl-1.2.3-javadoc.jar
          commons-fileupload-1.1.1.jar phaseTracker.jar
          commons-io-1.1.jar portlet-api-1.0.jar
          commons-logging-1.1.1.jar richfaces-api-3.2.0.SR1.jar
          commons-pool.jar richfaces-impl-3.2.0.SR1.jar
          commons-resources.jar richfaces-ui-3.2.0.SR1.jar
          commons-validator-1.3.1.jar rowset.jar
          struts-core-1.3.8.jar
          dom4j-1.6.1.jar struts-faces-1.3.8.jar
          ejb3-persistence.jar struts-taglib-1.3.8.jar

          • 2. Re: Drag and drop in different forms drag value always null
            ayanul

            Your problem was added in JIRA: http://jira.jboss.com/jira/browse/RF-3519

            • 3. Re: Drag and drop in different forms drag value always null
              samtherecordman

              I see this bug has been marked as closed since dragging between forms is not supported. Fair enough, that seems a reasonable limitation.

              1. It would be good if the RichFaces manual made this clear.

              2. It would also be good if an error message was given when this occurred.

              As it stands it sort of half works (drop value is correct) with no indication that something is wrong.