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

📄 treenode.java

📁 老外的在线考试
💻 JAVA
字号:
/* * CyberTester - J2EE Web application for creating, delivering and managing tests/exams/surveys.  * Copyright (C) 2003 CyberDemia Research and Services Pty Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, write to the * Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * See the COPYING file located in the top-level-directory of * the archive of this program for complete text of license. */package com.cyberdemia.cybertester.common;import com.cyberdemia.school.IHierarchy;/** * TreeNode contains the data required to render a single node in the hierarchy tree. *  * @author Alexander Yap */public class TreeNode{	/**	 * 	 * Creates an instance of TreeNode.	 * @param node Hierarchy node	 * @param expanded true if this node is expanded, false if its collapsed.	 * @param parentNodePos Index to the parent node, or -1 if this is the root node.	 */	public TreeNode(IHierarchy node, boolean expanded, int parentNodePos)	{		m_node = node;		m_expanded = expanded;		m_parentNodePos = parentNodePos;	}		/**	 * Gets this node's ID.	 * @return Node ID.	 */	public int getId()	{		return m_node.getId().intValue();	}		/**	 * Gets this node's hierarchy ID that identifies its path from the	 * root node to itself.	 * @return Hierarchy ID.	 */	public String getHierId()	{		return m_node.getHierarchyId();	}		/**	 * Gets name to be displayed in the tree.	 * @return Display name.	 */	public String getName()	{		return m_node.getName();	}		/**	 * Gets level of this node, with the root node being level 0.	 * @return Node level.	 */	public int getLevel()	{		return m_node.getLevel();	}		/**	 * Checks if this node may be expanded.	 * @return true if node can be expanded, otherwise false.	 */	public boolean isExpandable()	{		return m_node.hasChildren() && (!m_expanded);	}		/**	 * Checks if this node may be collapsed.	 * @return true if node can be collapsed, othersie false.	 */	public boolean isCollapsable()	{		return m_node.hasChildren() && m_expanded;	}		public void setExpanded( boolean expanded )	{		m_expanded = expanded;	}		/**	 * Gets the tree index of the parent of this node.	 * @return Parent node index.	 */		public int getParentNodePos()	{		return m_parentNodePos;	}		/**	 * Gets reference to the parent node.	 * @return Parent node.	 */	public IHierarchy getHierarchyNode()	{		return m_node;	}		/**	 * Checks if this node may be selected in the GUI.	 * @return true if this node may be selected, false if this node may not be selected.	 */	public boolean isSelectable()	{		return m_node.isDeepest();	}		private IHierarchy m_node = null;	private boolean m_expanded = false;	private int m_parentNodePos=-1;}

⌨️ 快捷键说明

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