业务处理类:DynamicTreeAction.java
package com.jdframe.sys.biz.org;
import com.jdframe.sys.core.model.User;
import com.jdframe.sys.core.model.tree.AjaxDynamicTreeAction;
// TODO: Auto-generated Javadoc
/**
* The Path : com.jdframe.sys.biz.org.DynamicTreeAction.java
* The DynamicTreeAction
* Last-Modified-Time : 2014-2-20 9:55:53
*
* @author support@jdframe.com
* @version 2.0.3.0
* http://www.jdframe.com
* @see
*/
public class DynamicTreeAction extends AjaxDynamicTreeAction {
/* (非 Javadoc)
* Title: perform
* Description:
* @return
* @see com.jdframe.sys.core.action.JdframeAction#perform()
*/
/* (non-Javadoc)
* @see com.jdframe.sys.core.model.tree.AjaxDynamicTreeAction#perform()
*/
@Override
protected String perform() {
// TODO Auto-generated method stub
User user = this.getUserProfileFromSession().getUser();
CategoryImpl cat = new CategoryImpl();
if(nodeId == null ){
nodeId = user.getUser_zzjg_dm();
category = cat.getRootById(nodeId);
}else{
category = cat.getById(nodeId);
}
return SUCCESS;
}
/**
* Select tree node.
*
* @return the string
*/
public String selectTreeNode() {
// TODO Auto-generated method stub
//category = OrgCategory.getInstance().getById(nodeId);
CategoryImpl cat = new CategoryImpl();
category = cat.getById(nodeId);
return SUCCESS;
}
/* (非 Javadoc)
* Title: validators
* Description:
* @see com.jdframe.sys.core.action.JdframeAction#validators()
*/
/* (non-Javadoc)
* @see com.jdframe.sys.core.model.tree.AjaxDynamicTreeAction#validators()
*/
@Override
protected void validators() {
// TODO Auto-generated method stub
}
/* (非 Javadoc)
* Title: initial
* Description:
* @return
* @see com.jdframe.sys.core.action.JdframeAction#initial()
*/
/* (non-Javadoc)
* @see com.jdframe.sys.core.model.tree.AjaxDynamicTreeAction#initial()
*/
@Override
protected String initial() {
// TODO Auto-generated method stub
return null;
}
}
TREE对象类: Category.java
package com.jdframe.sys.core.model.tree;
import java.util.*;
// TODO: Auto-generated Javadoc
/**
* The Path : com.jdframe.sys.core.model.Category.java
* The Class Category.
* Last-Modified-Time : 2013-12-25 21:32:41
*
* @author support@jdframe.com
* @see
* @version 2.0.3.0 www.jdframe.com
*/
public abstract class Category {
/** The id. */
protected String id;
/** The name. */
protected String name;
/** The children. */
protected List children;
/** The cat map. */
public Category(){}
/**
*
* Title: getById
* Description: TODO(返回包含下级节点的树,初始化后展开节点时执行,一般情况下id为为当前选中的节点)
* @param
* @return Category
*
*/
public abstract Category getById(String id);
/**
*
* Title: getRootById
* Description: TODO(返回包含当前节点的树,初始化时执行,一般情况下id为空)
* @param
* @return Category
*
*/
public abstract Category getRootById(String id);
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name th