Example usage for com.google.gwt.user.cellview.client CellBrowser CellBrowser

List of usage examples for com.google.gwt.user.cellview.client CellBrowser CellBrowser

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client CellBrowser CellBrowser.

Prototype

public <T> CellBrowser(TreeViewModel viewModel, T rootValue) 

Source Link

Document

Construct a new CellBrowser .

Usage

From source file:com.google.gwt.examples.cellview.CellBrowserExample.java

License:Apache License

public void onModuleLoad() {
    // Create a model for the browser.
    TreeViewModel model = new CustomTreeModel();

    /*//from  w ww .  j  a v a  2 s .c  om
     * Create the browser using the model. We specify the default value of the
     * hidden root node as "Item 1".
     */
    CellBrowser tree = new CellBrowser(model, "Item 1");

    // Add the tree to the root layout panel.
    RootLayoutPanel.get().add(tree);
}

From source file:com.google.gwt.examples.cellview.CellBrowserExample2.java

License:Apache License

public void onModuleLoad() {
    // Create a model for the browser.
    TreeViewModel model = new CustomTreeModel();

    /*//from w  w  w  .j a  v a  2  s.c  o m
     * Create the browser using the model. We use <code>null</code> as the
     * default value of the root node. The default value will be passed to
     * CustomTreeModel#getNodeInfo();
     */
    CellBrowser browser = new CellBrowser(model, null);
    browser.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);

    // Add the browser to the root layout panel.
    RootLayoutPanel.get().add(browser);
}

From source file:com.google.gwt.sample.showcase.client.content.cell.CwCellBrowser.java

License:Apache License

/**
 * Initialize this example.//from  ww  w . j  a  v a2 s. com
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
    final MultiSelectionModel<ContactInfo> selectionModel = new MultiSelectionModel<ContactInfo>(
            ContactDatabase.ContactInfo.KEY_PROVIDER);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            StringBuilder sb = new StringBuilder();
            boolean first = true;
            List<ContactInfo> selected = new ArrayList<ContactInfo>(selectionModel.getSelectedSet());
            Collections.sort(selected);
            for (ContactInfo value : selected) {
                if (first) {
                    first = false;
                } else {
                    sb.append(", ");
                }
                sb.append(value.getFullName());
            }
            selectedLabel.setText(sb.toString());
        }
    });

    cellBrowser = new CellBrowser(new ContactTreeViewModel(selectionModel), null);
    cellBrowser.setAnimationEnabled(true);

    // Create the UiBinder.
    Binder uiBinder = GWT.create(Binder.class);
    Widget widget = uiBinder.createAndBindUi(this);
    return widget;
}