日期:2014-05-16  浏览次数:20498 次

自己写的一个动态从后台数据库加载Ext.tree的json数据工具类
总共两个class(TreeLoader.java,TreeNode.java)一个接口(TreeNodeConfig.java),使用时是:比如Action中调用TreeLoader.loadTree(..),TreeLoader再回调接口TreeNodeConfig的实现,具体看代码:
1、TreeNode.java 这是一个Ext.tree.TreeNode的配置信息的bean

package com.test.util;

import java.io.Serializable;

public class TreeNode implements Serializable {

	private static final long serialVersionUID = 3932457248824817931L;

	private boolean allowChildren;
	
	private boolean allowDrag;
	
	private boolean allowDrop;
	
	private boolean checked;
	
	private String cls;
	
	private boolean disabled;
	
	private boolean draggable;
	
	private boolean editable;
	
	private boolean expandable;
	
	private boolean expanded;
	
	private boolean hidden;
	
	private String href;
	
	private String hrefTarget;
	
	private String icon;
	
	private String iconCls;
	
	private String id;//not null
	
	private boolean isTarget;
	
	private boolean leaf;//not null
	
	private String listeners;
	
	private String qtip;
	
	private String qtipCfg;
	
	private boolean singleClickExpand;
	
	private String text;
	
	private String uiProvider;
	
	private String superId;//not null

	public String getSuperId() {
		return superId;
	}

	public void setSuperId(String superId) {
		this.superId = superId;
	}

	public boolean isAllowChildren() {
		return allowChildren;
	}

	public void setAllowChildren(boolean allowChildren) {
		this.allowChildren = allowChildren;
	}

	public boolean isAllowDrag() {
		return allowDrag;
	}

	public void setAllowDrag(boolean allowDrag) {
		this.allowDrag = allowDrag;
	}

	public boolean isAllowDrop() {
		return allowDrop;
	}

	public void setAllowDrop(boolean allowDrop) {
		this.allowDrop = allowDrop;
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public String getCls() {
		return cls;
	}

	public void setCls(String cls) {
		this.cls = cls;
	}

	public boolean isDisabled() {
		return disabled;
	}

	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}

	public boolean isDraggable() {
		return draggable;
	}

	public void setDraggable(boolean draggable) {
		this.draggable = draggable;
	}

	public boolean isEditable() {
		return editable;
	}

	public void setEditable(boolean editable) {
		this.editable = editable;
	}

	public boolean isExpandable() {
		return expandable;
	}

	public void setExpandable(boolean expandable) {
		this.expandable = expandable;
	}

	public boolean isExpanded() {
		return expanded;
	}

	public void setExpanded(boolean expanded) {
		this.expanded = expanded;
	}

	public boolean isHidden() {
		return hidden;
	}

	public void setHidden(boolean hidden) {
		this.hidden = hidden;
	}

	public String getHref() {
		return href;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public String getHrefTarget() {
		return hrefTarget;
	}

	public void setHrefTarget(String hrefTarget) {
		this.hrefTarget = hrefTarget;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getIconCls() {
		return iconCls;
	}

	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}

	public String getId() {
		return id;
	}

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

	public boolean isTarget() {
		return isTarget;
	}

	public void setTarget(boolean isTarget) {
		this.isTarget = isTarget;
	}

	public boolean isLeaf() {
		return leaf;
	}

	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}

	public String getListeners() {
		return listeners;
	}

	public void setListeners(String listeners) {
		this.listeners = listeners;
	}

	public String getQtip() {
		return qtip;
	}

	public void setQtip(String qtip) {
		this.qtip = qtip;
	}

	public String getQtipCfg() {
		return qtipCfg;
	}

	public void setQtipCfg(String qtipCfg) {
		this.qtipCfg = qtipCfg;
	}

	public boolean isSingleClickExpand() {
		return singleClickExpand;
	}

	pub