1 Reply Latest reply on Jul 30, 2013 9:53 AM by Brian Leathem

    drag and drop not work at all ,please help

    jim wang Newbie

      tree is ok ,but when i add drag and drop functinality into this tree,it just donesnot work at all , version of richfaces is 5.

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                xmlns:h="http://java.sun.com/jsf/html"

                xmlns:f="http://java.sun.com/jsf/core"

                xmlns:ui="http://java.sun.com/jsf/facelets"

                xmlns:r="http://richfaces.org/rich">

                <h:head></h:head>

                <h:outputStylesheet>

              .top{

              vertical-align: top;

              width: 50%;

              }

              .bold{

              font-weight: bold;

              }

              .rf-ind-drag{

              font-size:11px;

              cursor:pointer;

              width:100px;

              border:1px solid gray;

              padding:2px

              }

              .rf-ind-acpt{border:2px solid green}

              .rf-ind-rejt{border:2px solid red}

          </h:outputStylesheet>

          <r:dragIndicator id="ind" acceptClass="accept" rejectClass="reject" draggingClass="default">

                          <h:outputText value="#{node.name}" />

                </r:dragIndicator>

                <h:form>

                <h:panelGrid columns="2" columnClasses="top,top" width="60%">

                 <r:panel style="width:133px">

                                    <r:tree id="tree" var="node"

                                              value="#{treeBean.rootNodes}" toggleType="client"

                                              selectionType="ajax"

                                              selectionChangeListener="#{treeBean.selectionChanged}">

                                              <r:treeNode type="firstproduct">

                                              <r:outputPanel>

                                                                  <r:dropTarget acceptedTypes="company" dropValue="#{node}"

                                                                            dropListener="#{treebean.adjustNodePosition}" render="tree" />

                                                                  <h:outputText value="#{node.name}"></h:outputText>

                                                                  </r:outputPanel>

                                              </r:treeNode>

                                              <r:treeNode type="company"

                                                        iconExpanded="../../resources/images/tree/disc.gif"

                                                        iconCollapsed="../../resources/images/tree/disc.gif">

                                                         <r:outputPanel>

                                                                  <r:dragSource type="company" dragValue="#{node}" dragIndicator="ind"/>

                                                                  <h:outputText value="#{node.name}"></h:outputText>

                                                                  </r:outputPanel>

                                              </r:treeNode>

                                    </r:tree>

                                    </r:panel>

                          </h:panelGrid>

                </h:form>

                          <r:outputPanel ajaxRendered="true" layout="block">

                                    <r:panel header="Current Selection"

                                              rendered="#{not empty treeBean.currentSelection}">

                                              <h:outputText value="Name:" />

                                              <h:outputText value="#{treeBean.currentSelection.name}" />

                                              <h:panelGroup rendered="#{treeBean.currentSelection.leaf}">

                                                        <fieldset>

                                                                  <legend>Details</legend>

                                                                  <h:panelGrid columnClasses="bold" columns="2">

                                                                            <h:outputText value="Dijing:" />

                                                                            <h:outputText value="#{treeBean.currentSelection.dijing}" />

                                                                            <h:outputText value="Productid:" />

                                                                            <h:outputText value="#{treeBean.currentSelection.productid}" />

                                                                            <h:outputText value="Plant description:" />

                                                                            <h:outputText value="#{treeBean.currentSelection.productdesc}" />

                                                                            <h:outputText value="Price:" />

                                                                            <h:outputText value="#{treeBean.currentSelection.price}">

                                                                                      <f:convertNumber type="currency" currencyCode="CNY" />

                                                                            </h:outputText>

                                                                            <h:outputText value="Height:" />

                                                                            <h:outputText value="#{treeBean.currentSelection.height}" />

                                                                  </h:panelGrid>

                                                        </fieldset>

                                              </h:panelGroup>

                                    </r:panel>

                          </r:outputPanel>

      </ui:composition>