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

📄 simpletreemodel.java

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JAVA
字号:
/* SimpleTreeModel.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;

/**
 * A simple implementation of {@link TreeModel}.
 * Note: It assumes the content is immutable.
 *
 * @author Jeff Liu
 * @since ZK 3.0.0
 */
public class SimpleTreeModel extends AbstractTreeModel {
	
	/**
	 * Constructor
	 * @param root - the root of tree 
	 */
	public SimpleTreeModel(SimpleTreeNode root) {
		super(root);
	}
	
	//--TreeModel--//
	public Object getChild(Object parent, int index) {
		SimpleTreeNode node = (SimpleTreeNode)parent;
		return node.getChildAt(index);
	}
	
	//--TreeModel--//
	public int getChildCount(Object parent) {
		SimpleTreeNode node = (SimpleTreeNode)parent;
		return node.getChildCount();
	}
	
	//--TreeModel--//
	public boolean isLeaf(Object node) {
		if(node instanceof SimpleTreeNode){
			SimpleTreeNode node_ = (SimpleTreeNode)node;
			return node_.isLeaf();
		}else{
			return true;
		}
	}

}

⌨️ 快捷键说明

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