cfshell.java

来自「CoolFace是基于jxta的P2P系统」· Java 代码 · 共 64 行

JAVA
64
字号
package com.cn.darkblue.window;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import com.cn.darkblue.helper.IGroupChat;
import com.cn.darkblue.helper.IPGResource;
import com.cn.darkblue.util.CFResource;

public class CFShell extends Shell {
	private static final Log log = LogFactory.getLog(CFShell.class);
	/**
	 * Create the shell
	 * @param display
	 * @param style
	 */
	public CFShell(Display display, int style) {
		super(display, style);
		createContents();
		setLayout(new GridLayout());
		
		CFResource.getInstance().getShellCache().add(this);
	}

	/**
	 * Create contents of the window
	 */
	protected void createContents() {
		setText(" 组创建 ");
		setSize(400, 300);
	}

	@Override
	public void close() {
		try{
        CFResource.getInstance().getShellCache().remove(this);//从缓存中移除
        log.info(this.toString()+" UI 已从缓存中移除 ");
        
        if(this instanceof IGroupChat)
        	CFResource.getInstance().getGroupItrtWins().remove(this);
        
        if(this instanceof ChatWin){
        	ChatWin win = (ChatWin)this;
        	IPGResource res = (IPGResource)CFResource.getInstance().getJoinPGMap().get(win.getGroup());
        	res.getOScreens().remove(win.getChater());
        	
        }
		}catch(Exception e){
			e.printStackTrace();
		}
		super.close();
		super.dispose();
	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}

}

⌨️ 快捷键说明

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