⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpletreenode.java

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JAVA
字号:
/* SimpleTreeNode.java

{{IS_NOTE
	Purpose:
		
	Description:
		
	History:
		Aug 10 2007, Created by Jeff Liu
}}IS_NOTE

Copyright (C) 2005 Potix Corporation. All Rights Reserved.

{{IS_RIGHT
	This program is distributed under GPL Version 2.0 in the hope that
	it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zul;

import java.util.List;

/**
 * 
 * The treenode for {@link SimpleTreeModel}
 * Note: It assumes the content is immutable
 * 
 * @author Jeff
 * @since ZK 3.0.0
 */
public class SimpleTreeNode {

	private Object _data;
	
	private List _children;
	
	/**
	 * Constructor
	 * @param data  data of the receiver
	 * @param children children of the receiver
	 * <br>
	 * Notice: Only <code>SimpleTreeNode</code> can be contained in The List <code>children</code>
	 */
	public SimpleTreeNode(Object data, List children){
		_data = data;
		_children = children;
	}
	
	/**
	 * Return data of the receiver
	 * @return data of the receiver
	 */
	public Object getData(){
		return _data;
	}
	
	/**
	 * Return children of the receiver
	 * @return children of the receiver
	 */
	public List getChildren(){
		return _children;
	}
	
	/**
	 * Return data.toString(). If data is null, return String "Data is null"
	 * @return data.toString(). If data is null, return String "Data is null"
	 */
	public String toString(){
		return (_data == null)?"Data is null":_data.toString();
	}
	
	/**
	 * Returns true if the receiver is a leaf.
	 * @return true if the receiver is a leaf.
	 */
	public boolean isLeaf(){
		return (_children.size() == 0);
	}
	
	/**
	 * Returns the child SimpleTreeNode at index childIndex.
	 * @return the child SimpleTreeNode at index childIndex.
	 */
	public Object getChildAt(int childIndex){
		return _children.get(childIndex);
	}
	
	/**
	 * Returns the number of children SimpleTreeNodes the receiver contains.
	 * @return the number of children SimpleTreeNodes the receiver contains.
	 */
	public int getChildCount(){
		return _children.size();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -