2 Replies Latest reply on Sep 5, 2008 2:54 PM by Nick Belaevski

    dynamic drag and drop

    Grzegorz Matuszewski Newbie

      I'm trying to create dynamic drag and drop support. When I define drop support in .jsp it works ok. Every time method processDrop is invoked in the same instance managed bean - what is expected of an session managed bean.

      .jsp sample

      <rich:panel binding="#{bean.panel}">
      <rich:dropSupport action="#{bean.drop}" acceptedTypes="all" reRender="table" dropListener="#{bean.processDrop}"></rich:dropSupport>
      </rich:panel>
      




      But when I declare drop support in java code then every time the processDrop method is invoked in a different instance of managed bean.

      .jsp sample:
      <rich:panel binding="#{bean.panel}"/>
      


      managed bean code
      class Bean implements DropListener {
       private HtmlPanel panel;
      
       public HtmlPanel getPanel(){
       return panel;
       }
      
       public void setPanel(HtmlPanel panel) {
       if (this.panel == null){
       // create drop support for the first reload
       this.panel = panel;
       dropSupport.setAcceptedTypes("all");
       dropSupport.setReRender("table");
       dropSupport.addDropListener(this);
       panel.getChildren().add(dropSupport);
       } else
       this.panel = panel;
       }
      
       public void processDrop(DropEvent event) {
       }
      
      }
      



      What am I doing wrong?