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

📄 composewindow.java

📁 Eclipse RCP下编写的工作管理软件代码
💻 JAVA
字号:
package net.sf.pim.mail.compose;

import java.util.Map;

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class ComposeWindow extends ApplicationWindow{
	//发送按钮
	private SendMailAction mailAction;
	//附件按钮
	private AttachementAction attachementAction;
	
	private MessageComposer messageComposer;
	
	private Map<String, String> mail; //回复的邮件
	
	private String title;	//窗口标题
	public ComposeWindow(Shell parentShell) {
		super(parentShell);
		setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL |SWT.RESIZE);
		setBlockOnOpen(true);
		//创建toolBar
		makeActions();
		title="新邮件";
	}
	private void makeActions() {
		addToolBar(SWT.FLAT);
		mailAction = new SendMailAction();
		mailAction.setComposeWindow(this);
		attachementAction=new AttachementAction();
		attachementAction.setComposeWindow(this);
		getToolBarManager().add(mailAction);
		getToolBarManager().add(attachementAction);
	}
    protected void configureShell(Shell shell) {
        super.configureShell(shell);
        shell.setText(title);
    }
	protected Point getInitialSize() {
		return new Point(640, 480);
	}
	
	@Override
	protected Point getInitialLocation(Point initialSize) {
		Point p=super.getInitialLocation(initialSize);
		//让弹出窗口在主窗口的下方,缺省在上方
		return new Point(p.x,p.y*2);
	}
	@Override
	public Control createContents(Composite parent) {
		messageComposer = new MessageComposer(parent,SWT.NULL);
		if(mail != null)
			messageComposer.setMail(mail);
		messageComposer.create();
		mailAction.setMessageComposer(messageComposer);
		attachementAction.setMessageComposer(messageComposer);
		return messageComposer;
	}
	
	public MessageComposer getMessageComposer() {
		return messageComposer;
	}
	public Map<String, String> getMail() {
		return mail;
	}
	public void setMail(Map<String, String> mail) {
		this.mail = mail;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
}

⌨️ 快捷键说明

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