4 Replies Latest reply on Oct 27, 2008 8:59 AM by ben27

    Drag and Drop ProblemHi

    ben27

      Hi everyone,

      I have the following Problem:

      I try to implement a simple Drag and Drop scenario, but the dragValue which I try to catch in a bean method is always null.

      Configuration:
      Richfaces 3.1.4. GA
      Seam 2.0.2 SP1
      JBoss AS 4.2

      My JSF code:

      <ui:define name="body">
      <h:form id="dragDropForm">
      <h:panelGrid columns="4">

      <h:outputText value="No Structures Found"
      rendered="#{chemAxonList.searched and chemAxonList.numberOfResults==0}"/>


      <rich:panel id="resultpanel" rendered="#{chemAxonList.numberOfResults>0}">
      <f:facet name="header">
      <h:outputText value="Chemical Structures"></h:outputText>
      </f:facet>

      <rich:dataTable value="#{chemAxonList.resultList}" var="cs">
      <rich:column id="col1">
      <f:facet name="header">
      Formula
      </f:facet>

      <a4j:outputPanel style="width:100px;border:1px solid gray;padding:2px" layout="block">
      <rich:dragSupport dragIndicator=":indicator" dragType="PubChem" dragValue="#{cs}">
      <rich:dndParam type="drag" name="label" value="#{cs.cdFormula}" />
      </rich:dragSupport>
      <h:outputText value="#{cs.cdFormula}"></h:outputText>
      </a4j:outputPanel>

      </rich:column>
      <rich:column id="col2">
      <f:facet name="header">
      Traditional Name
      </f:facet>
      <h:outputText value="#{cs.pubchemIupacTraditionalName}" />
      </rich:column>
      <rich:column id="col3">
      <f:facet name="header">
      Details
      </f:facet>
      <s:link view="/detailsPage.xhtml" value="Select" id="pubChem">
      <f:param name="pubChemCdId" value="#{cs.cdId}"/>
      </s:link>
      <!-- <a4j:commandLink id="showItem" oncomplete="Richfaces.showModalPanel('resultVisuPanel',{width:550, top:200});" reRender="testDIV">
      show Details
      </a4j:commandLink> -->
      </rich:column>

      </rich:dataTable>
      </rich:panel>

      <rich:panel styleClass="dropTargetPanel">
      <f:facet name="header">
      <h:outputText value="TEST" />
      </f:facet>
      <rich:dropSupport id="Droppanel" acceptedTypes="PubChem" dropValue="TEST" dropListener="#{personalFolder.processDrop}"/>
      </rich:panel>

      </h:panelGrid>
      </h:form>
      </ui:define>


      The method in the Java Bean:

      @Scope(ScopeType.SESSION)
      @Name("personalFolder")
      public class PersonalFolder implements DropListener {
      ...

      public void processDrop(DropEvent dropEvent) {
      System.out.println("DRAG and DROP ");
      System.out.println("Drop Value " + dropEvent.getDropValue());
      System.out.println("Drag Value " + dropEvent.getDragValue());
      }
      }


      So, as I said, the problem is that the DropValue is null!?
      Somebody out there who can help me?


      Regards,
      Ben

        • 1. Re: Drag and Drop ProblemHi
          nbelaevski

          Ben,

          So, what value is null: drag or drop?

          I've tried 3.1.4 - works nice. Can you please try to remove

          rendered="#{chemAxonList.numberOfResults>0}"
          and check?




          • 2. Re: Drag and Drop Problem
            ben27

            Hi,

            I am sorry for the conflicting statements in my first post. The dropValue works fine, but the dragValue is null.


            If I let the

            rendered="#{chemAxonList.numberOfResults>0}"
            out I get a number of exceptions:

            Exception during request processing:
            Caused by javax.servlet.ServletException with message: "javax.el.ELException: /resultPage.xhtml @31,67 value="#{chemAxonList.resultList}": Error reading 'resultList' on type de.l3s.HelloWorldSeamProjekt.session.ChemAxonList_$$_javassist_1"
            
            ...
            
            Caused by javax.faces.FacesException with message: "javax.el.ELException: /resultPage.xhtml @31,67 value="#{chemAxonList.resultList}": Error reading 'resultList' on type de.l3s.HelloWorldSeamProjekt.session.ChemAxonList_$$_javassist_1"
            
            ...
            
            Caused by javax.el.ELException with message: "/resultPage.xhtml @31,67 value="#{chemAxonList.resultList}": Error reading 'resultList' on type de.l3s.HelloWorldSeamProjekt.session.ChemAxonList_$$_javassist_1"
            
            ...
            
            Caused by java.lang.NullPointerException with message: ""
            de.l3s.HelloWorldSeamProjekt.session.ChemAxonList.getMaxResults(ChemAxonList.java:379)
            org.jboss.seam.framework.EntityQuery.createQuery(EntityQuery.java:179)
            org.jboss.seam.framework.EntityQuery.initResultList(EntityQuery.java:73)
            org.jboss.seam.framework.EntityQuery.getResultList(EntityQuery.java:65)
            ...


            Since I try to drag an object to the dropPanel, it seems to me that the resultList is empty.

            Does somebody have an idea?


            • 3. Re: Drag and Drop ProblemHi
              nbelaevski

              Does this work if you use list of some simple objects and not entities?

              • 4. Re: Drag and Drop ProblemHi
                ben27

                I created a simple String in my Session Bean:

                private String test = "bla1";
                
                 public String getTest() {
                 return test;
                 }
                
                 public void setTest(String test) {
                 this.test = test;
                 }


                I set this as dragValue: dragValue="#{chemAxonList.test}"


                But the result is still the same :(