5 Replies Latest reply on Jul 13, 2007 10:35 AM by Pete Muir

    drag and drop problems with parameters

    lee jones Newbie

      hello ive been trying to get the drag and drop working for a while now and have run into a few problems.

      I have created a bean based on the one i found in the rich faces source

      
      import java.util.ArrayList;
      import java.util.List;
      
      import org.jboss.seam.annotations.Name;
      
      @Name("dndBean")
      public class DragAndDropBean {
      
      
       private List<String> types = new ArrayList<String>();
      
       private Object dragValue;
      
       private Object testParam;
      
       private List<String> container = new ArrayList<String>();
      
       private List<String> sourceList = new ArrayList<String>();
      
      
      
       public DragAndDropBean() {
       super();
      
       types.add("PHP");
       types.add("JAVA");
      
      
       sourceList.add("item1");
       sourceList.add("item2");
       }
      
       public void processDrop(org.ajax4jsf.dnd.event.DropEvent event) {
       System.out.println("Bean.processDrop()");
       this.dragValue = event.getDragValue();
       }
      
       public void processDrag(org.ajax4jsf.dnd.event.DragEvent dragEvent) {
       System.out.println("Bean.processDrag()");
       }
      
       public List getTypes() {
       return types;
       }
      
       public String dragAction() {
       System.out.println("Bean.dragAction()");
       return null;
       }
      
       public String dropAction() {
       System.out.println("Bean.dropAction()");
       return null;
       }
      
       public Object getDragValue() {
       return dragValue;
       }
      
       public Object getTestParam() {
       return testParam;
       }
      
       public void setTestParam(Object testParam) {
       this.testParam = testParam;
       System.out.println("Bean.setTestParam()" + testParam);
       }
      
       public List<String> getContainer() {
       return container;
       }
      
       public void setContainer(List<String> container) {
       this.container = container;
       System.out.println("Bean.setContainer()" + container);
       }
      
       public List<String> getSourceList() {
       return sourceList;
       }
      
       public void setSourceList(List<String> sourceList) {
       this.sourceList = sourceList;
       System.out.println("Bean.setSourceList()" + sourceList);
       }
      
       public void reset(){
       System.out.println("RESET");
       }
      }
      
      


      and this is the front

      
      <ui:composition
       xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:a="https://ajax4jsf.dev.java.net/ajax"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       id="testComponent"
       styleClass="edit">
      
       <rich:dragIndicator id="indicator"></rich:dragIndicator>
      
      <h:form id="form">
      
       <h:panelGrid columnClasses="panelc" columns="2" width="50%">
      
       <rich:panel style="width:100px">
       <f:facet name="header">
       <h:outputText value="Source List" />
       </f:facet>
      
       <h:dataTable id="src" columns="1" value="#{dndBean.sourceList}"
       var="source" >
      
       <h:column>
       <a:outputPanel style="border:1px solid gray;padding:2px;"
       layout="block">
      
      
       <rich:dragSupport dragType="employee"
       dragValue="#{source}"
      
      
       >
      
       <rich:dndParam name="label" value="#{source}" />
      
       </rich:dragSupport>
      
      
      
       <h:outputText value="#{source}"></h:outputText>
       </a:outputPanel>
       </h:column>
      
       </h:dataTable>
      
      
       </rich:panel>
      
       <rich:panel>
       <f:facet name="header">
       <h:outputText value="Destination" />
       </f:facet>
      
       <rich:dropSupport id="php"
       reRender="src, php, destinationtable"
       acceptedTypes="employee"
       dropValue="employee"
       dropListener="#{dndBean.processDrop}"
       >
       </rich:dropSupport>
       <h:dataTable id="destinationtable" columns="1" value="#{dndBean.container}" var="destination">
       <h:column>
       <h:outputText value="#{destination}"></h:outputText>
       </h:column>
       </h:dataTable>
      
      
       </rich:panel>
       </h:panelGrid>
       <a:commandButton action="#{dndBean.reset}" value="Start Over"
       reRender="src,destinationtable" />
      </h:form>
      
       </ui:composition>
      
      
      


      now here comes the problem. i cant seem to find the method i call on the dropListener="#{dndBean.processDrop} section.. if i change this to dropListener="#{dndBean.dropAction} i get the correct output.. here is the actual stack trace. looks like its a problem with passing parameters..

      
      21:36:45,421 ERROR [ExceptionFilter] uncaught exception
      javax.servlet.ServletException: /DragAndDropComponent.xhtml @62,20 dropListener="#{dndBean.processDrop}": Method not found: uk.co.anotion.entity.jobs.DragAndDropBean@183fc68.processDrop(org.ajax4jsf.dnd.event.DropEvent)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      21:36:45,421 ERROR [ExceptionFilter] exception root cause
      javax.faces.el.MethodNotFoundException: /DragAndDropComponent.xhtml @62,20 dropListener="#{dndBean.processDrop}": Method not found: uk.co.anotion.entity.jobs.DragAndDropBean@183fc68.processDrop(org.ajax4jsf.dnd.event.DropEvent)
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:71)
       at org.richfaces.component.UIDropSupport.broadcast(UIDropSupport.java:79)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:156)
       at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:62)
       at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.processDecodes(AjaxViewRoot.java:267)
       at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:219)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChai
      


      cheers