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

📄 treenode.java

📁 struts+spring+hibernate自创框架
💻 JAVA
字号:
package com.pegasus.framework.web.tree;

import java.io.Serializable;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.pegasus.framework.util.StringUtil;

/**
 * Title: TreeNode.java
 * <p/>
 * Copyright: Copyright (c) 2005
 * <p/>
 * Company: CHIIC Systems
 * <p/>
 *
 * @author ForeverZ
 * @version 1.0
 * @since Aug 17, 2006 8:58:00 AM
 */
public class TreeNode implements Serializable {
    private Log logger = LogFactory.getLog(TreeNode.class);

    private String parentid;

    private String node_type = "node";

    private String node_id;

    private String node_title;

    private String url;

    private String image_leaf = "leaf.gif";

    private String image_open = "folderOpen.gif";

    private String image_close = "folderClosed.gif";

    private static final String NODE = "{0}||<id>{1}</id>";

    /**
     * .
     */
    public TreeNode() {
    }

    /**
     * @param parentid   parentid
     * @param node_id    nodeid
     * @param node_title nodettile;
     */
    public TreeNode(String parentid, String node_id, String node_title) {
        this.parentid = parentid;
        this.node_id = node_id;
        this.node_title = node_title;
    }

    /**
     * @param data the treenode
     */
    public TreeNode(TreeNode data) {

        try {
            BeanUtils.copyProperties(this, data);
        }
        catch (Exception e) {
            logger.warn(e);
        }
    }

    /**
     * @return the image_close
     */
    public String getImage_close() {
        return image_close;
    }

    /**
     * @param image_close the image_close
     */
    public void setImage_close(String image_close) {
        this.image_close = image_close;
    }

    /**
     * @return the image_leaf
     */
    public String getImage_leaf() {
        return image_leaf;
    }

    /**
     * @param image_leaf the image_leaf
     */
    public void setImage_leaf(String image_leaf) {
        this.image_leaf = image_leaf;
    }

    /**
     * @return image_open
     */
    public String getImage_open() {
        return image_open;
    }

    /**
     * @param image_open the image_open
     */
    public void setImage_open(String image_open) {
        this.image_open = image_open;
    }

    /**
     * @return format node_id
     */
    public String getNode_id() {
        return node_id;
    }

    /**
     * @return FORMAT NODE ID SUCH AS "node_type||<id>node_id</id>"
     */
    public String getFromatNodeId() {
        return formatNodeId(node_type, node_id);
    }

    /**
     * @param node_id the node_id
     */
    public void setNode_id(String node_id) {
        this.node_id = node_id;
    }

    /**
     * @return node_title
     */
    public String getNode_title() {
        return node_title;
    }

    /**
     * @param node_title the node_title
     */
    public void setNode_title(String node_title) {
        this.node_title = node_title;
    }

    /**
     * @return parentid
     */
    public String getParentid() {
        return parentid;
    }

    /**
     * @param parentid the parentid
     */
    public void setParentid(String parentid) {
        this.parentid = parentid;
    }

    /**
     * @return url
     */
    public String getUrl() {
        return url;
    }

    /**
     * @param url the url
     */
    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * @return node type
     */
    public String getNode_type() {
        return node_type;
    }

    /**
     * @param node_type nodetype
     */
    public void setNode_type(String node_type) {
        this.node_type = node_type;
    }

    /**
     * @param node_type node type
     * @param node_id   nodeid
     * @return format nodeid
     */
    public static String formatNodeId(String node_type, String node_id) {
        return StringUtil.format(NODE, node_type, node_id);
    }

    /**
     * @return xml
     */
    public String toXMLString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("<").append(TreeNode.class.getName()).append(">\r");
        buffer.append("<parentid>").append(parentid).append("</parentid>");
        buffer.append("<node_id>").append(node_id).append("</node_id>");
        buffer.append("<node_title>").append(node_title).append("</node_title>");
        buffer.append("<node_type>").append(node_type).append("</node_type>");
        buffer.append("<image_open>").append(image_open).append("</image_open>");
        buffer.append("<image_close>").append(image_close).append("</image_close>");
        buffer.append("<image_leaf>").append(image_leaf).append("</image_leaf>");
        buffer.append("<url>").append(url).append("</url>");
        buffer.append("</").append(TreeNode.class.getName()).append(">\r");
        return buffer.toString();
    }

}

⌨️ 快捷键说明

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