当前位置:编程学习 > JS >>

利用ztree js插件,产生一个异步的文件目录树

ztree这个js插件大家可以网上参考。这里不多讲:只将例子;

1.treeNode的model类


[html]
/** 
 * @FILE:TreeNode.java 
 * @AUTHOR:yehui 
 * @DATE:2013-3-21 上午10:23:58 
 **/ 
package jp.co.tsh.model; 
 
import jp.co.tsh.common.BaseModel; 
 
/******************************************* 
 * @CLASS:TreeNode 
 * @DESCRIPTION:treenode的model 
 * @AUTHOR:yehui 
 * @VERSION:v1.0 
 * @DATE:2013-3-21 午前10:23:58 
 *******************************************/ 
public class TreeNode extends BaseModel { 
 
    /** 
     * id 
     */ 
    private String id; 
    /** 
     * pid,父节点的id 
     */ 
    private String pid; 
    /** 
     * 是否展开 
     */ 
    private boolean open; 
    /** 
     * 是否有子节点 
     */ 
    private boolean isParent; 
    /** 
     * 节点名称 
     */ 
    private String name; 
    /** 
     * 点击事情 
     */ 
    private String click; 
    /**    
     *   节点所指向的文件路径 
     */    
    private String path; 
 
    public TreeNode(String id, String pid, boolean open, boolean isParent, 
            String name, String click, String path) { 
        this.id = id; 
        this.pid = pid; 
        this.open = open; 
        this.isParent = isParent; 
        this.name = name; 
        this.click = click; 
        this.path = path; 
    } 
 
    public String getId() { 
        return id; 
    } 
 
    public void setId(String id) { 
        this.id = id; 
    } 
 
    public String getPid() { 
        return pid; 
    } 
 
    public void setPid(String pid) { 
        this.pid = pid; 
    } 
 
    public boolean isOpen() { 
        return open; 
    } 
 
    public void setOpen(boolean open) { 
        this.open = open; 
    } 
 
    public boolean isParent() { 
        return isParent; 
    } 
 
    public void setParent(boolean isParent) { 
        this.isParent = isParent; 
    } 
 
    public String getName() { 
        return name; 
    } 
 
    public void setName(String name) { 
        this.name = name; 
    } 
 
    public String getClick() { 
        return click; 
    } 
 
    public void setClick(String click) { 
        this.click = click; 
    } 
 
    @Override 
    public String toString() { 
        return super.toString(); 
    } 
 
    public String getPath() { 
        return path; 
    } 
 
    public void setPath(String path) { 
        this.path = path; 
    } 
 

/**
 * @FILE:TreeNode.java
 * @AUTHOR:yehui
 * @DATE:2013-3-21 上午10:23:58
 **/
package jp.co.tsh.model;

import jp.co.tsh.common.BaseModel;

/*******************************************
 * @CLASS:TreeNode
 * @DESCRIPTION:treenode的model
 * @AUTHOR:yehui
 * @VERSION:v1.0
 * @DATE:2013-3-21 午前10:23:58
 *******************************************/
public class TreeNode extends BaseModel {

 /**
  * id
  */
 private String id;
 /**
  * pid,父节点的id
  */
 private String pid;
 /**
  * 是否展开
  */
 private boolean open;
 /**
  * 是否有子节点
  */
 private boolean isParent;
 /**
  * 节点名称
  */
 private String name;
 /**
  * 点击事情
  */
 private String click;
 /**  
  *   节点所指向的文件路径
  */  
 private String path;

 public TreeNode(String id, String pid, boolean open, boolean isParent,
   String name, String click, String path) {
  this.id = id;
  this.pid = pid;
  this.open = open;
  this.isParent = isParent;
  this.name = name;
  this.click = click;
  this.path = path;
 }

 public String getId() {
  return id;
 }

 public void setId(String id) {
  this.id = id;
 }

 public String getPid() {
  return pid;
 }

 public void setPid(String pid) {
  this.pid = pid;
 }

 public boolean isOpen() {
  return open;
 }

 public void setOpen(boolean open) {
  this.open = open;
 }

 public boolean isParent() {
  return isParent;
 }

 public void setParent(boolean isParent) {
  this.isParent = isParent;
 }

 public String getNam

补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,