2013-10-17 36 views
1

PrimeFaces JSF組件庫中有PickList widgetGWT中有一個PickList小部件嗎?

GWT(或任何其他GWT組件庫)是否有這樣的小部件?

+0

沒什麼,我聽說過,你可能需要創建一個自己。 http://www.sencha.com/examples/#ExamplePlace:listtolist – Zeus

+1

GXT有DualListView:http://www.sencha.com/examples/#ExamplePlace:duallistfield – SlightlyCuban

+0

我認爲這可以很容易地通過使用CellLists創建。 http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCellList –

回答

2

查看SmartGWT在Databound Dragging上的特色示例。你也可以查看它的來源。但由於gwt沒有這樣的小部件,最好的解決方案是在CellList的幫助下創建自己的自定義組件。

+0

我一直在尋找同樣的東西,但是我找不到任何好東西,所以我用'CellList'做了我自己的東西。 – enrybo

+0

這個答案看起來很有用,因爲SmartGWT的小部件提供了我正在尋找的東西。但是,由於我使用gwt-bootstrap,切換到SmartGWT對於我的情況似乎並不實際。 – Halil

0

我喜歡創建自己的選擇列表,因爲它很容易和簡單,下面是什麼樣子:

public abstract class PickList<T> extends Composite { 
    //The renderer provide the flexibility for client class customize the cell 
    public PickList(SafeHtmlRenderer<T> renderer) { 
     ... 
    } 

    public void setCandidates(List<T> candidates, List<T> selected) { 
     //todo 
    } 

    public List<T> getSelectedValues() { 
     //todo 
    } 

    //Below two abstract method can facilitate getting values from view or rendering view from value 
    protected abstract T fromIdentity(String identity); 
    protected abstract String toIdentity(T value); 
}