5 Replies Latest reply on May 5, 2010 6:35 AM by geoffreylalloue

    dragValue is null when drag and drop in two different forms

      hi,

      i have tried to make a drag and drop between two different forms, but the drag value in the droplistener is always null in the second one.

      (when i try it in the same form, everything is good).

       

      i know that there was some troubles with the drag and drop in twho different forms but i think it's fixed.

       

      please, help me

       

      Thanks ain advance.

       

      Geoffrey

       

      --------------------------------------------

       

      Here is my code:

       

      I'm currently working with the 3.3.1.GA version of the richfaces library.

       

      fiche_projet.jsp

       

      <f:facet name="menu">
                      <h:form id="formMenu"
                          onkeydown="returnPressed(event,'formMenu:rechercher');"
                           onsubmit="return validerForm(this);" >
                          <div style="position: absolute; width:100%">
                              <rich:panelBar    id="pnlbarPanier"
                                              width="100%"
                                              selectedPanel="#{cms_projet_handler.panelBarSelectionne}"
                                              rendered="#{cms_projet_handler.tabHandler.afficherPanier}">
                                  <rich:panelBarItem id="selectionMesureUp" name="selectionMesureUp"
                                                      label="#{libelles.LBL_SELECTION_ITEM_UP}"
                                                      rendered="#{cms_projet_handler.tabHandler.afficherPanier}"
                                                       headerClass="pnlbar-selectpage-head" contentClass="pnlbar-selectpage-body">
                                      <c:if test="${cms_projet_handler.tabHandler.afficherPanier}">
                                          <t:aliasBean alias="#{panier}" value="#{cms_projet_handler.tabHandler.panier}">
                                             <jsp:include page="/inc/panier.selection.inc.jsp"/>
                                          </t:aliasBean>
                                      </c:if

       

                                  </rich:panelBarItem>
                              </rich:panelBar>
                          </div>
                         
                      </h:form>
                  </f:facet>
                  <f:facet name="page">

                      <h:form id="formPage" onsubmit="return validerForm(this);">

       

                  <a4j:outputPanel ajaxRendered="true">
                                 <h:inputHidden    id="_modifForm" value="#{cms_projet_handler.pageModifiee}" />
                          </a4j:outputPanel>
                             <h:inputHidden    id="_msg_alerte_modification" value="#{libelles.MSG_CONFIRMATION_FERMETURE_PROJET}" />
                          <%-- Rappel du projet --%>
                          <h:panelGrid    columns="3"
                                          width="100%" >
                              <h:panelGroup id="titreTemporaire">
                                  <h:panelGroup    rendered="#{cms_projet_handler.beanProjet.nouveau}"
                                                  styleClass="nowrap">
                                      <h:outputText    value="#{libelles.LBL_NOUVEAU_PROJET}"
                                                      rendered="#{!cms_projet_handler.beanProjet.typeGabarit}"
                                                      styleClass="titreMajeur" />
                                      <h:outputText    value="#{libelles.LBL_NOUVEAU_GABARIT}"
                                                      rendered="#{cms_projet_handler.beanProjet.typeGabarit}"
                                                      styleClass="titreMajeur" />
                                      <h:outputText    value=" ("
                                                      rendered="#{cms_projet_handler.beanProjet.libelleRenseigne}"/>
                                      <h:outputText    value="#{cms_projet_handler.beanProjet.libelle}"/>
                                      <h:outputText    value=")"
                                                      rendered="#{cms_projet_handler.beanProjet.libelleRenseigne}"/>
                                  </h:panelGroup>
                              </h:panelGroup>
                              <h:panelGroup>
                                  <h:outputText    rendered="#{!cms_projet_handler.beanProjet.nouveau}"
                                                  value="#{cms_projet_handler.beanProjet.libelle}"
                                                  styleClass="titreMajeur" />
                                  <rich:spacer width="8"/>
                                  <h:graphicImage rendered="#{cms_projet_handler.instanceProcessusEnCours}"
                                                  title="#{libelles.LBL_PROCESSUS_EN_COURS}"
                                                  url='#{contexte.icones["Config.png"]}'/>
                              </h:panelGroup>                           
                              <h:panelGroup style="float:right">
                                  <jsp:include page="/gerer/projets/fiche_admin/actions.fiche.inc.jsp"/>
                              </h:panelGroup>
                          </h:panelGrid>

       

                          <rich:tabPanel switchType="ajax" width="100%"
                                      selectedTab="#{cms_projet_handler.tabSelectionne}"
                                      styleClass="onglets"
                                      id="onglets_projet">
                              <rich:tab    id="tab_budgets"
                                          label="#{libelles.ONG_MODULE_BUDGET_PROJET}"
                                          onlabelclick="typeLien=L_GROUPE;"
                                          reRender="formMenu, formPage"

       

                                          disabled="#{!droitsProjet.ACT_CONSULTER_BUDGET}"
                                          rendered='#{cms_projet_handler.beanProjet.moduleActive["MOD_BUDGET"]}' >
                                  <%-- a4j:actionparam assignTo="#{cms_projet_handler.tabSelectionne}"  value="tab_budgets" name="tabSelectionne" /--%>
                                  <c:if test="${cms_projet_handler.tabSelectionne == 'tab_budgets'}">
                                      <c:set target="${contexte}" property="idEcran"  value="203"></c:set>
                                      <jsp:include page="/modules/budget/cms_budget.inc.jsp" />
                                  </c:if>
                              </rich:tab>

                          </rich:tabPanel>
                      </h:form>
                  </f:facet>

       

      /inc/panier.selection.inc.jsp

       

      <h:panelGroup id="panierSelection" >

       

          <%--  Panier avec REGROUPEMENT --%>
          <c:if test="${panier.regroupement}">
              <%--  ligne-paire puisque la premiere ligne de la sous table est impaire --%>
              <rich:dataTable value="#{panier.panierRegroupement}" var="regroupement"
                              styleClass="liste" width="100%" rowClasses="ligne-paire">
                  <f:facet name="header">
                      <rich:columnGroup>
                          <%--  SELECTIONNER TOUT --%>
                          <rich:column style="width:10%;align:center;text-align:center">
                              <h:selectBooleanCheckbox     id="selectionnerTous"
                                                          value="#{panier.allSelectionnes}"
                                                          styleClass="checkbox"
                                                          onclick="blur();"
                                                          onchange="typeLien=L_LOOKUP;#{panier.panierId}onChangeModifierAllSelections(this.checked);"
                                                           title="#{panier.allSelectionnesDescription}"
                                                           disabled="#{panier.disabled}">
                              </h:selectBooleanCheckbox>
                          </rich:column>

       

                          <rich:column style="width:90%">
                              <h:outputText value="#{libelles.LBL_TOUT_SELECTIONNER}" />
                          </rich:column>
                      </rich:columnGroup>
                  </f:facet>

       

                  <rich:column>
                      <h:selectBooleanCheckbox id="selectionRegroupement" value="#{regroupement.allSelectionnes}"
                              styleClass="checkbox" disabled="#{panier.disabled}"
                              onclick="blur();" onchange="typeLien=L_LOOKUP;#{panier.panierId}onChangeModifierSelectionRegroupement(#{regroupement.id},this.checked)">
                      </h:selectBooleanCheckbox>
                  </rich:column>
                  <rich:column>
                      <h:outputText value="#{regroupement.libelle}" rendered="#{regroupement.libelle!=''}" styleClass="rupture"/>
                      <h:outputText value="#{panier.libelleRegroupementVide}" rendered="#{regroupement.libelle==''}" styleClass="rupture"/>
                     
                  </rich:column>
                  <rich:subTable id="row1" value="#{regroupement.detailListe}" var="item" rowClasses="ligne-impaire, ligne-paire" >
                      <rich:column style="width:10%;align:center;text-align:center">

                          <h:selectBooleanCheckbox id="selectionItem" value="#{item.selectionne}"
                                  styleClass="checkbox" disabled="#{! item.selectionnable || panier.disabled }"
                                  onclick="blur();" title="#{item.descriptionSelectionne}">
                              <a4j:support event="onchange" reRender="#{panier.reRenderOnSelect},dragZonePanel,selectionRegroupement,selectionnerTous"
                                          onsubmit="typeLien=L_PANIER;"  action="#{panier.onChangeModifierSelectionItems}"
                                            ignoreDupResponses="true" requestDelay="450"
                                            onbeforedomupdate="closeMCE();"
                                            similarityGroupingId="chkbx_item_panier">
                              </a4j:support>
                          </h:selectBooleanCheckbox>
                       </rich:column>
                      <rich:column style="width:90%">
                          <a4j:outputPanel layout="block" id="dragZonePanel" style="#{item.selectionnable && !item.selectionne && !panier.disabled ? 'cursor:move' : ''}" >
                              <rich:dragSupport    dragType="#{panier.panierId}SELECTION"
                                                  dragIndicator="selectionIndicator"
                                                     dragValue="#{item}"
                                                     reRender="#{panier.reRenderOnSelect},selectionItem,dragZonePanel,selectionRegroupement,selectionnerTous"  
                                                      rendered="#{item.selectionnable && !item.selectionne && !panier.disabled}"

                                                   >
                                  <rich:dndParam name="label" value="#{item.libelle}" />
                              </rich:dragSupport>

                              <h:outputText value="#{item.libelle}" title="desc=#{item.libelleDescription}--selectionnable=#{item.selectionnable}--selectionne=#{item.selectionne}--disabled=#{panier.disabled}"/>
                           </a4j:outputPanel>
                      </rich:column>
                  </rich:subTable>
               </rich:dataTable>
          </c:if>

       

      /modules/budget/cms_budget.inc.jsp

       

      <h:panelGroup id="conteneurBudgets">

           // some code

           <rich:dropSupport     acceptedTypes="SELECTION"
                                  ondrop="typeLien=L_INFO;"
                                  dropListener="#{cms_projet_handler.tabHandler.panier.onDropItem}"
                                  reRender="formMenu,formPage"
                                  >
           </rich:dropSupport>

           // some code

      </h:panelGroup>

       

      panierSelection.java (just the dropListener)


          public void onDropItem(DropEvent de) {
              if (de.getDragValue() != null) {
                  PanierSelectionItem item = ((PanierSelectionItem) de.getDragValue());
                  majPanierActif(item);

       

                 
                 for (Iterator<PanierSelectionItem> it = panierSelectionnes.iterator(); it.hasNext();) {
                      PanierSelectionItem itemActif = it.next();
                      itemActif.setSelectionne(true);
                      PanierSelectionItem itemPanier = chercheItemDansPanier(itemActif.getId());
                      if (itemPanier != null)
                          itemPanier.setSelectionne(true);
                  }

       

                  verifSelectionsGroupes();

       

                  if (listenerModification != null)
                      listenerModification.onModificationPanierSelection(new PanierSelectionEvent(item, item.isSelectionne()));
              }