📄 contenttreenode.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 + -