All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sencha.gxt.data.shared.loader.ChildTreeStoreBinding Maven / Gradle / Ivy

/**
 * Ext GWT 3.0.0-rc - Ext for GWT
 * Copyright(c) 2007-2011, Sencha, Inc.
 * [email protected]
 *
 * http://sencha.com/license
 */
package com.sencha.gxt.data.shared.loader;

import java.util.List;

import com.sencha.gxt.data.shared.TreeStore;
import com.sencha.gxt.data.shared.TreeStore.TreeNode;

/**
 * Event handler for the {@link LoadEvent} fired when a {@link Loader} has
 * finished loading data. It expects {@link LoadEvent#getLoadConfig} to return a
 * parent and {@link LoadEvent#getLoadResult} to return a list of new children.
 * It replaces the children of the given parent with the list of new children.
 * The children are expected to be of type {@code }. For children of type
 * {@link TreeNode} see {@link SubTreeStoreBinding}.
 * 
 * @param  the type of objects that populate the store
 */
public class ChildTreeStoreBinding implements LoadHandler> {
  private final TreeStore store;

  /**
   * Creates a {@link LoadEvent} handler for the given {@link TreeStore}.
   * 
   * @param store the store whose events will be handled
   */
  public ChildTreeStoreBinding(TreeStore store) {
    this.store = store;
  }

  @Override
  public void onLoad(LoadEvent> event) {
    M parent = event.getLoadConfig();

    store.replaceChildren(parent, event.getLoadResult());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy