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

📄 treeobject.java

📁 J2EE eclipse 下开发数据库一个插件
💻 JAVA
字号:
/*
 * Created on 2003-4-10
 *
 */
package com.tanghan.plugin.dbviews.elements;


import org.eclipse.core.runtime.IAdaptable;


/** 树的节点类型 
 * @author Jerry Tang
 * @version v0.1.0
 * @copyright  (C) 2003 Tanghan工作组
 *  */
public class TreeObject implements IAdaptable{

	/**
	 * 默认树节点的类型
	 */
	public static final int DEFAULT_ITEM = 0;
	/**
	 * 数据库连接类型
	 */
	public static final int CONNECTION_ITEM = 1;
	/**
	 * 数据库中所有表的总的节点类型
	 */
	public static final int TABLE_NOTE_ITEM = 2;
	/**
	 * 表
	 */
	public static final int TABLE_ITEM =3;
	/**
	 * 数据库中所有视图的总的节点类型
	 */
	public static final int VIEW_NOTE_ITEM =4;
	/**
	 * 表
	 */
	public static final int VIEW_ITEM =5;
	/**
	 * 表或视图的子段类型
	 */
	public static final int TABLEFIELD_ITEM =6;
	/**
	 * 数据库的总的节点类型
	 */
	public static final int DATABASE_NOTE_ITEM =7;
	/**
	 * 驱动的总的节点类型
	 */
	public static final int DRIVERS_NOTE_ITEM =100;
	/**
	 * 驱动的节点类型
	 */
	public static final int DRIVER_NOTE_ITEM =101;
	
	/** 该节点对应的对象实例 */
	private Object object = null;
	
	/**节点类型*/
	private int type = DEFAULT_ITEM;
	/**该节点的名称*/
	private String name = "";
	/**节点的父节点*/
	private TreeParent parent = null;
	
	/** 构造函数
	 * @param name 节点名称
	 */
	public TreeObject(String name,int type) {
		this.name = name;
		this.type = type;
	}
	/** 构造函数
	 * @param name 节点名称
	 * @param obj 节点对应的对象实例
	 */
	public TreeObject(String name,Object obj,int type) {
		this.name = name;
		this.object = obj;
		this.type = type;
	}
	
	public String getName() {
		return name;
	}
	public void setParent(TreeParent parent) {
		this.parent = parent;
	}
	public TreeParent getParent() {
		return parent;
	}
	public String toString() {
		return getName();
	}
	/**
	 * @return
	 */
	public Object getObject() {
		return object;
	}

	/**
	 * @return
	 */
	public int getType() {
		return type;
	}

	/**
	 * @param object
	 */
	public void setObject(Object object) {
		this.object = object;
	}

	/**
	 * @param i
	 */
	public void setType(int i) {
		type = i;
	}

	/**
	 * @param string
	 */
	public void setName(String string) {
		name = string;
	}

	public Object getAdapter(Class key) {
		if (key.toString().equals("interface org.eclipse.ui.views.properties.IPropertySource")
				&& this.getObject()!=null){
			return new TanghanProperty(this);
		}
		else return null;
	}	
}

⌨️ 快捷键说明

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