5.开发者的Adapter
public abstract class TreeListViewAdapter extends BaseAdapter
{
protected Context mContext;
protected List mAllNodes;
protected List mVisibleNodes;
protected LayoutInflater mInflater;
protected ListView mTree;
public interface OnTreeNodeClickListener
{
void onClick(Node node, int position);
}
private OnTreeNodeClickListener mListener;
public void setOnTreeNodeClickListen
er(OnTreeNodeClickListener mListener)
{
this.mListener = mListener;
}
public TreeListViewAdapter(ListView tree, Context context, List datas,
int defaultExpandLevel) throws IllegalArgumentException
,
IllegalAccessException
{
mContext = context;
mInflater = LayoutInflater.from(mContext);
mAllNodes = TreeHelper.getSortedNodes(datas, defaultExpandLevel);
mVisibleNodes = TreeHelper.filterVisibleNodes(mAllNodes);
mTree = tree;
mTree.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView
public abstract class TreeListViewAdapter extends BaseAdapter
{