Example usage for com.google.gwt.view.client ListDataProvider ListDataProvider

List of usage examples for com.google.gwt.view.client ListDataProvider ListDataProvider

Introduction

In this page you can find the example usage for com.google.gwt.view.client ListDataProvider ListDataProvider.

Prototype

public ListDataProvider(List<T> listToWrap, ProvidesKey<T> keyProvider) 

Source Link

Document

Creates a list model that wraps the given list.

Usage

From source file:org.mindinformatics.gwt.domeo.plugins.annotation.persistence.ui.existingsets.AnnotationSetTreeViewModel.java

License:Apache License

@Override
public <T> NodeInfo<?> getNodeInfo(T value) {
    if (value == null) {
        // Return top level categories.
        return new DefaultNodeInfo<Category>(categoryDataProvider, new CategoryCell());
    } else if (value instanceof Category) {
        // Return the first letters of each first name.
        Category category = (Category) value;
        List<AnnotationSetInfo> contacts = parent.queryContactsByCategory(category);

        ListDataProvider<AnnotationSetInfo> dataProvider = new ListDataProvider<AnnotationSetInfo>(contacts,
                AnnotationSetInfo.KEY_PROVIDER);

        return new DefaultNodeInfo<AnnotationSetInfo>(dataProvider, contactCell, selectionModel,
                selectionManager, null);
    }/*from   w  ww  .java  2 s.  co  m*/

    // Unhandled type.
    String type = value.getClass().getName();
    throw new IllegalArgumentException("Unsupported object type: " + type);
}