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

📄 clienttreemodel.java

📁 create the email in the server
💻 JAVA
字号:
/*
 * Created on 2004/08/17
 *
 */
package za.co.halo.SecureCommunications.gui.client2;

import java.awt.Component;
import java.util.Vector;

import javax.swing.JTree;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;

import za.co.halo.SecureCommunications.ServerAdmin;
import za.co.halo.SecureCommunications.client.EmailBox;
import za.co.halo.SecureCommunications.gui.client2.Node.Type;

public class ClientTreeModel implements TreeModel {

	private Node node;
	
	public ClientTreeModel(EmailBox box)
	{
		node = new Node("ICAT client",Type.BIG);
		Node emails = new Node("Emails",Type.BIG);
		Node inbox = new Node("Inbox", Type.MEDIUM);
		for (Node n:box.getFolders())
			inbox.addNode(n);
		emails.addNode(inbox);
		emails.addNode(new Node("Outbox", Type.MEDIUM));
		emails.addNode(new Node("Sent mail", Type.MEDIUM));
		emails.addNode(new Node("Junk mail", Type.MEDIUM));
		emails.addNode(new Node("Trash", Type.MEDIUM));
		node.addNode(emails);
		node.addNode(new Node("Addressbook", Type.BIG));
		node.addNode(new Node("Calender", Type.BIG));
		node.addNode(new Node("Accounts", Type.BIG));
	}
	
	public Object getRoot() {
		return node;
	}

	public Object getChild(Object parent, int index) {
		if (parent instanceof Node)
		{
			return ((Node)parent).getNode(index);
		}
		return null;
	}

	public int getChildCount(Object parent) {
		if (parent instanceof Node)
			return ((Node)parent).size();
		ServerAdmin.error.warning("Tree has unidentified nodes.\nPlease reinstall application.");
		return 0;
	}

	public boolean isLeaf(Object node) {
		if (node instanceof Node)
		{
			if (((Node)node).size() == 0)
				return true;
			return false;
		}
		return true;
	}

	public void valueForPathChanged(TreePath path, Object newValue) {
		// TODO Auto-generated method stub

	}

	public int getIndexOfChild(Object parent, Object child) {
		if (parent instanceof Node && child instanceof Node)
		{
			Node p = (Node)parent;
			Node c = (Node)child;
			return p.indexOf(c);
		}
		return -1;
	}

	public void addTreeModelListener(TreeModelListener l) {
		// TODO Auto-generated method stub

	}

	public void removeTreeModelListener(TreeModelListener l) {
		// TODO Auto-generated method stub

	}

}

⌨️ 快捷键说明

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