com.extjs.gxt.ui.client.data.TreeModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gxt Show documentation
Show all versions of gxt Show documentation
Rich Internet Application Framework for GWT
/*
* Ext GWT 2.2.0 - Ext for GWT
* Copyright(c) 2007-2010, Ext JS, LLC.
* [email protected]
*
* http://extjs.com/license
*/
package com.extjs.gxt.ui.client.data;
import java.util.List;
/**
* A Model that supports parent and children. Change events bubble to parent
* elements.
*
*
* - Events:
*
* - Update : ChangeEvent(source)
* Fires after the the model is updated.
*
* - source : this
*
*
*
* - Add : ChangeEvent(source, parent, item, index)
* Fires after a child model is added.
*
* - source : this (events bubble)
* - parent : the parent model
* - item : the item that was added
* - index : the insert location
*
*
*
* - Remove : ChangeEvent(source, parent, item)
* Fires after a child model is added.
*
* - source : this (events bubble)
* - parent : the parent model
* - item : the item that was removed
*
*
*
*
*/
public interface TreeModel extends Model {
/**
* Adds a child to the model.
*
* @param child the model to add
*/
public void add(ModelData child);
/**
* Returns the child at the given index.
*
* @param index the index
* @return the child
*/
public ModelData getChild(int index);
/**
* Returns the child count.
*
* @return the child count
*/
public int getChildCount();
/**
* Returns the model's children.
*
* @return the children
*/
public List getChildren();
/**
* Returns the model's parent.
*
* @return the parent
*/
public TreeModel getParent();
/**
* Returns the index of the child.
*
* @param child the child
* @return the index
*/
public int indexOf(ModelData child);
/**
* Inserts a child.
*
* @param child the child to add
* @param index the insert location
*/
public void insert(ModelData child, int index);
/**
* Returns true if the model is a leaf and has children. The method provides
* the ability to mark a model as having children before the children have
* been added.
*
* @return true for leaf
*/
public boolean isLeaf();
/**
* Removes a child.
*
* @param child the child to remove
*/
public void remove(ModelData child);
/**
* Removes all the children.
*/
public void removeAll();
/**
* Sets the model's parent.
*
* @param parent the new parent
*/
public void setParent(TreeModel parent);
}