2012-07-19 63 views
1

我最近開始使用JSF並使用richfaces 4.0。我正在尋找一個工作示例來實現Tree中的拖放功能。我有樹的工作,但我無法弄清楚如何得到drang並在樹上工作。我所尋找的是使用JSF拖放 - richfaces4.0

Node1 
Node2 
Node3 
Node4 

所以我應該能夠到另一個地方,比方說,「節點1」中的「節點3」和「節點4」與所有其他節點上面的「節點3」之間應移動1個索引中。

將任何並欣賞幫助這個:)

感謝, Kulpreet

+0

RichFaces [拖放示例](http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=dragDrop&skin=blueSky)i對你的情況來說,這是一個很好的起點。你有沒有嘗試過將它應用到你的Tree中?你有什麼具體問題嗎? – 2012-07-19 14:17:41

回答

2

我能得到這個工作,也有一些小問題在代碼然而,基本功能的作品。

        <rich:dragSource type="#{element.type}" 
                dragValue="#{element}" 
                dragIndicator="actInd" 
                > 

            </rich:dragSource> 
            <rich:dropTarget acceptedTypes="#{element.type}" dropValue="#{element}" 
                dropListener="#{modelTree.activityDropListener}" 
                render="tabs" 
                > 

            </rich:dropTarget> 
            <h:outputText value="#{element}"/> 
           </a4j:outputPanel> 
  • activityDropListener有代碼拿起拖動節點的值和下降位置,並更新其constucts的treeon UI

感謝列表, Kulpreet