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

📄 contenttreenode.java

📁 用Swing实现的CHM制作工具
💻 JAVA
字号:
package g2w.app.gchm.gui;

import javax.swing.tree.DefaultMutableTreeNode;

import org.jdom.Document;

/**
 * A customized tree node used in tree component ContentTree.
 * The node uses an instance of ContentElement as its user object,
 * the user object also decides which icons of the node.
 * 
 * @author GreatGhoul
 * @version 017 2009-3-20 14:53:56
 */
public class ContentTreeNode extends DefaultMutableTreeNode {
	
	/**
	 * Construct a tree node with a xml element.
	 * 
	 * @param element The element.
	 */
	public ContentTreeNode(ContentElement element)  {
		super(element);
	}
	
	/**
	 * Return the user object.
	 * 
	 * @return The bound ContentElement.
	 */
	public ContentElement getUserObject() {
		return (ContentElement) super.getUserObject();
	}
	
	/**
	 * Remove self from the parent node. 
	 * It dose the same thing in the xml document.
	 */
	public void removeFromparent() {
		getUserObject().removeFromParent();
		super.removeFromParent();
	}

	/**
	 * Create a new tree node with the name "新标题";
	 * 
	 * @return A new topic node.
	 */
	public static ContentTreeNode createNewTopicNode() {
		return new ContentTreeNode(ContentElement.createNewTopic());
	}

	/**
	 * Create a root node using the given document.
	 * 
	 * @param document The given project document.
	 * @return The root node.
	 */
	public static ContentTreeNode createRoot(Document document) {
		return new ContentTreeNode(ContentElement.createRoot(document));
	}
}


⌨️ 快捷键说明

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