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

📄 maxtreeitemxt.java

📁 VC++
💻 JAVA
字号:
package com.sinosoft.security.util.maxtree.xtree;

import java.util.ArrayList;

import com.sinosoft.security.util.maxtree.MaxTreeItem;

public class MaxTreeItemXt implements MaxTreeItem {
	public MaxTreeItemXt() throws Exception {
	}

	public MaxTreeItemXt(String sText, String sXmlSrc, String sAction,
			String eParent, String sIcon, String sOpenIcon) {
	}

	private String sID = "";

	private String sText = "";

	private String sXmlSrc = "";

	private String sAction = "";

	private String eParent = "";

	private String sIcon = "";

	private String sOpenIcon = "";

	private ArrayList childs = new ArrayList();

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#getEParent()
	 */
	public String getEParent() {
		return eParent;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#setEParent(java.lang.String)
	 */
	public void setEParent(String parent) {
		eParent = parent;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#getSAction()
	 */
	public String getSAction() {
		return sAction;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#setSAction(java.lang.String)
	 */
	public void setSAction(String action) {
		sAction = action;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#getSIcon()
	 */
	public String getSIcon() {
		return sIcon;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#setSIcon(java.lang.String)
	 */
	public void setSIcon(String icon) {
		sIcon = icon;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#getSOpenIcon()
	 */
	public String getSOpenIcon() {
		return sOpenIcon;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#setSOpenIcon(java.lang.String)
	 */
	public void setSOpenIcon(String openIcon) {
		sOpenIcon = openIcon;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#getSText()
	 */
	public String getSText() {
		return sText;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#setSText(java.lang.String)
	 */
	public void setSText(String text) {
		sText = text;

	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#getSXmlSrc()
	 */
	public String getSXmlSrc() {
		return sXmlSrc;
	}

	/*
	 * (非 Javadoc)
	 * 
	 * @see com.sinosoft.security.mazingutil.maxtree.xloadtree.MaxTreeItem#setSXmlSrc(java.lang.String)
	 */
	public void setSXmlSrc(String xmlSrc) {
		sXmlSrc = xmlSrc;
	}

	// public String toXML(Meta[] result,String parent,String rp){
	// String icon = (sIcon.equalsIgnoreCase("")) ? "" : "" + sIcon + "";
	// String oIcon = (sIcon.equalsIgnoreCase("")) ? "" : ""+ sOpenIcon+ "";
	// Document document = DocumentHelper.createDocument();
	// Element treeElement = document.addElement("tree");

	// try{
	// for(int i=0;i<result.length;i++)
	// {
	// this.setSText(result[i].getName());
	// this.setEParent(result[i].getHandle());
	// //System.out.println(""+sText+"");
	// Element tree1Element = treeElement.addElement("tree");
	// tree1Element.addAttribute("text", ""+sText+"");
	// tree1Element.addAttribute("src", ""+sXmlSrc+"");
	// tree1Element.addAttribute("action", "" + sAction + "");
	// tree1Element.addAttribute("icon",icon);
	// tree1Element.addAttribute("openIcon", oIcon);
	// treeElement.add(tree1Element);
	// }
	// document.addDocType("tree",
	// null,"file://E:/CleanClear/WebContent/ui/xloadtree/tree.dtd");

	// OutputFormat format =new OutputFormat();
	// format.setLineSeparator("");
	// format.setEncoding("gb2312");
	// writer = new XMLWriter(format);
	// writer.write(document);
	// System.out.println("0000000000"+rp);
	// OutputFormat format = OutputFormat.createPrettyPrint();
	// format.setEncoding("gb2312");
	// XMLWriter output = new XMLWriter(
	// new FileWriter( new File(rp) ), format);
	// output.write( document );
	// output.close();

	// }catch(Exception e)
	// {}
	// return document.asXML();
	//
	// //StringBuffer xmlbuilder = new StringBuffer();
	// //String icon = (sIcon.equalsIgnoreCase("")) ? "" : "=\"" + sIcon + "\"";
	// //String oIcon = (sIcon.equalsIgnoreCase("")) ? "" : "=\"" + sOpenIcon
	// //+ "\"";
	//
	// //xmlbuilder.append("<tree text=\"" + sText + "\" src=\"" + sXmlSrc
	// //+ "\" action=\"" + sAction + "\" " + icon + " " + oIcon
	// //+ "/>\n");
	// //return xmlbuilder.toString();
	//
	// }

	public void addTreeItem(MaxTreeItem item) {
		childs.add(item);

	}

	public String getSID() {
		return sID;

	}

	public void setSID(String sID) {
		this.sID = sID;
	}

	public String toXML() {

		StringBuffer xmlbuilder = new StringBuffer();
		String icon = (sIcon.equalsIgnoreCase("")) ? "" : "=\"" + sIcon + "\"";
		String oIcon = (sIcon.equalsIgnoreCase("")) ? "" : "=\"" + sOpenIcon
				+ "\"";

		xmlbuilder.append("<node text=\"" + sText + "\" action=\"" + sAction
				+ "\" " + icon + " " + oIcon + ">\n");

		for (int i = 0; i < childs.size(); i++) {
			String childXml = ((MaxTreeItem) childs.get(i)).toXML();
			xmlbuilder.append(childXml);
		}

		xmlbuilder.append("</node>\n");
		return xmlbuilder.toString();

	}

	public String toScript() {
		StringBuffer script = new StringBuffer();
		// System.out.println(childs.size());
		String item = "var treeItem" + sID + " = new WebFXTreeItem(\"" + sText
				+ "\"," + "\"" + sAction + "\");\n";
		script.append(item);
		// script.append("tree.add(\"" + sText + "\")");

		for (int i = 0; i < childs.size(); i++) {
			MaxTreeItem child = (MaxTreeItem) childs.get(i);
			script.append(child.toScript());
			String sub = "treeItem" + sID + ".add(" + "treeItem"
					+ child.getSID() + ");\n";
			script.append(sub);
		}
		return script.toString();
	}

}

⌨️ 快捷键说明

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