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

📄 euseritemnode.java

📁 jrc-src0.4.00源代码发布版(Java客户端框架)
💻 JAVA
字号:
package efly.clientframe.feature.enterprise;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

/**
 * @author efly
 * @version 1.0.0,12/14/02
 */
public class EUserItemNode extends TreeItem {
	private Image icon;
	private String icon_path;
	private EUserCompound eUserCompound;

	/**
	 * Constructor for EUserItemNode.
	 * @param arg0
	 * @param arg1
	 */
	public EUserItemNode(Tree arg0, EUserCompound eUserCompound)
		throws EUserNodeException {
		super(arg0, SWT.NONE);
		this.eUserCompound = eUserCompound;
		decorate(eUserCompound.getGenericType());

	}

	/**
	 * Constructor for EUserItemNode.
	 * @param arg0
	 * @param arg1
	 * @param arg2
	 */
	private EUserItemNode(Tree arg0, int arg1, int arg2) {
		super(arg0, arg1, arg2);
	}

	/**
	 * Constructor for EUserItemNode.
	 * @param arg0
	 * @param arg1
	 */
	public EUserItemNode(TreeItem arg0, EUserCompound eUserCompound)
		throws EUserNodeException {
		super(arg0, SWT.NONE);
		this.eUserCompound = eUserCompound;
		decorate(eUserCompound.getGenericType());
	}

	/**
	 * Constructor for EUserItemNode.
	 * @param arg0
	 * @param arg1
	 * @param arg2
	 */
	private EUserItemNode(TreeItem arg0, int arg1, int arg2) {
		super(arg0, arg1, arg2);
	}

	public EUserCompound getEUserCompound() {
		return eUserCompound;
	}

	public int getGenericType() {
		return eUserCompound.getGenericType();
	}

	private void decorate(int genericType) throws EUserNodeException {
		switch (genericType) {
			case EUserCompound.ORGANIZATION :
				{
					icon_path = "images/organization.bmp";
					break;
				}
			case EUserCompound.DEPARTMENT :
				{
					icon_path = "images/department.bmp";
					break;
				}
			case EUserCompound.USER_GROUP :
				{
					icon_path = "images/group.bmp";
					break;
				}
			case EUserCompound.INDIVIDUAL :
				{
					icon_path = "images/user.bmp";
					break;
				}
			default :
				{
					throw new EUserNodeException("No matches generic type");
				}

		}
		icon = new Image(getDisplay(), icon_path);
		setImage(icon);
		addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent event) {
				EUserItemNode.this.widgetDisposed(event);
			}
		});
	}

	protected void checkSubclass() {
	}

	private void widgetDisposed(DisposeEvent event) {
		if (icon != null)
			icon.dispose();
		if (eUserCompound != null)
			eUserCompound.remove();
	}
}

⌨️ 快捷键说明

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