|
GWT 2.4.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.view.client.AbstractDataProvider<T>
com.google.gwt.view.client.ListDataProvider<T>
T - the data type of the listpublic class ListDataProvider<T>
A concrete subclass of AbstractDataProvider that is backed by an
in-memory list.
public class ListDataProviderExample implements EntryPoint {
public void onModuleLoad() {
// Create a CellList.
CellList<String> cellList = new CellList<String>(new TextCell());
// Create a list data provider.
final ListDataProvider<String> dataProvider = new ListDataProvider<String>();
// Add the cellList to the dataProvider.
dataProvider.addDataDisplay(cellList);
// Create a form to add values to the data provider.
final TextBox valueBox = new TextBox();
valueBox.setText("Enter new value");
Button addButton = new Button("Add value", new ClickHandler() {
public void onClick(ClickEvent event) {
// Get the value from the text box.
String newValue = valueBox.getText();
// Get the underlying list from data dataProvider.
List<String> list = dataProvider.getList();
// Add the value to the list. The dataProvider will update the cellList.
list.add(newValue);
}
});
// Add the widgets to the root panel.
VerticalPanel vPanel = new VerticalPanel();
vPanel.add(valueBox);
vPanel.add(addButton);
vPanel.add(cellList);
RootPanel.get().add(vPanel);
}
}
| Constructor Summary | |
|---|---|
ListDataProvider()
Creates an empty model. |
|
ListDataProvider(java.util.List<T> listToWrap)
Creates a list model that wraps the given list. |
|
ListDataProvider(java.util.List<T> listToWrap,
ProvidesKey<T> keyProvider)
Creates a list model that wraps the given list. |
|
ListDataProvider(ProvidesKey<T> keyProvider)
Creates an empty list model that wraps the given collection. |
|
| Method Summary | |
|---|---|
void |
flush()
Flush pending list changes to the displays. |
java.util.List<T> |
getList()
Get the list that backs this model. |
protected void |
onRangeChanged(HasData<T> display)
Called when a display changes its range of interest. |
void |
refresh()
Refresh all of the displays listening to this adapter. |
void |
setList(java.util.List<T> listToWrap)
Replace this model's list. |
| Methods inherited from class com.google.gwt.view.client.AbstractDataProvider |
|---|
addDataDisplay, getDataDisplays, getKey, getKeyProvider, getRanges, removeDataDisplay, updateRowCount, updateRowData, updateRowData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ListDataProvider()
public ListDataProvider(java.util.List<T> listToWrap)
listToWrap - the List to be wrappedpublic ListDataProvider(ProvidesKey<T> keyProvider)
keyProvider - an instance of ProvidesKey
public ListDataProvider(java.util.List<T> listToWrap,
ProvidesKey<T> keyProvider)
listToWrap - the List to be wrappedkeyProvider - an instance of ProvidesKey| Method Detail |
|---|
public void flush()
public java.util.List<T> getList()
setList(List)public void refresh()
public void setList(java.util.List<T> listToWrap)
listToWrap - the model's new listgetList()protected void onRangeChanged(HasData<T> display)
AbstractDataProvider
onRangeChanged in class AbstractDataProvider<T>display - the display whose range has changed
|
GWT 2.4.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||