euseritemnode.java
来自「jrc-src0.4.00源代码发布版(Java客户端框架)」· Java 代码 · 共 119 行
JAVA
119 行
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 + =
减小字号Ctrl + -
显示快捷键?