- package sql_lab;
- import org.eclipse.jface.action.*;
- import org.eclipse.jface.window.ApplicationWindow;
- import org.eclipse.swt.widgets.*;
- import org.eclipse.swt.events.*;
- import org.eclipse.swt.SWT;
- import JFACE_notepad.FileManager;
- import JFACE_notepad.NewAction;
- import JFACE_notepad.SaveAction;
- import JFACE_notepad.SaveAsAction;
- public class MainWindow extends ApplicationWindow {
- public static boolean log=false;//登陆标志
- public static String user="";
- public static String password="";
- public static int level=1;
- private loginAction loginAction;//登陆菜单
- private logoutAction logoutAction;//注销菜单
- private ExitAction exitAction;//退出菜单
- private HelpAction helpAction;//帮助菜单
- private salequeryAction salequeryAction;//售货单查询
- private maintainqueryAction maintainqueryAction;//维修查询
- private fittingqueryAction fittingqueryAction;//配件查询
- private addproduceAction addproduceAction;//查看所有产品信息
- private producerqueryAction producerqueryAction;//查询所有厂家信息
- private storequeryAction storequeryAction;//查询所有商店信息
- private customerqueryAction customerqueryAction;//查询所有客户信息
- private reparistoreAction reparistoreAction;//查询所有维修店信息
- private allrepairqueryAction allrepairqueryAction;//查询所有的维修单信息
- private Text content;//文本内容
- private static MainWindow app;//主程序窗口
- private MainWindow(){
- super(null);
- app=this;
- loginAction=new loginAction();
- logoutAction=new logoutAction();
- exitAction=new ExitAction();
- salequeryAction=new salequeryAction();
- maintainqueryAction=new maintainqueryAction();
- fittingqueryAction=new fittingqueryAction();
- addproduceAction=new addproduceAction();
- producerqueryAction=new producerqueryAction();
- storequeryAction =new storequeryAction();
- customerqueryAction = new customerqueryAction();
- reparistoreAction = new reparistoreAction();
- allrepairqueryAction=new allrepairqueryAction();
- helpAction=new HelpAction();
- this.addMenuBar();//添加菜单
- this.addToolBar(SWT.FLAT);//添加工具
- this.addStatusLine();//添加状态
- }
- public static MainWindow getApp(){
- return app;
- }
- protected void configureShell(Shell shell){
- super.configureShell(shell);
- shell.setText("JOB");
- shell.setMaximized(true);
- }
- protected Control createContents(Composite parent){
- content=new Text(parent,SWT.MULTI|SWT.V_SCROLL|SWT.H_SCROLL);
- content.setEditable(false);
- return parent;
- }
- protected MenuManager createMenuManager(){
- MenuManager menuBar=new MenuManager();
- MenuManager optionMenu=new MenuManager("操作(&F)");
- MenuManager queryMenu=new MenuManager("查询(&E)");
- MenuManager managerMenu=new MenuManager("管理(&F)");
- MenuManager helpMenu=new MenuManager("帮助(&H)");
- menuBar.add(optionMenu);
- menuBar.add(queryMenu);
- menuBar.add(managerMenu);
- menuBar.add(helpMenu);
- optionMenu.add(this.loginAction);
- optionMenu.add(this.logoutAction);
- optionMenu.add(new Separator());
- optionMenu.add(exitAction);
- queryMenu.add(this.salequeryAction);
- queryMenu.add(this.maintainqueryAction);
- queryMenu.add(this.fittingqueryAction);
- managerMenu.add(this.addproduceAction);
- managerMenu.add(this.producerqueryAction);
- managerMenu.add(this.storequeryAction);
- managerMenu.add(this.customerqueryAction);
- managerMenu.add(this.reparistoreAction);
- managerMenu.add(this.allrepairqueryAction);
- helpMenu.add(helpAction);
- return menuBar;
- }
- protected ToolBarManager createToolBarManager(int style){
- ToolBarManager toolBar=new ToolBarManager(style);
- toolBar.add(this.loginAction);
- toolBar.add(this.logoutAction);
- toolBar.add(new Separator());
- toolBar.add(this.salequeryAction);
- toolBar.add(this.maintainqueryAction);
- toolBar.add(this.fittingqueryAction);
- toolBar.add(new Separator());
- toolBar.add(this.addproduceAction);
- toolBar.add(this.producerqueryAction);
- toolBar.add(this.storequeryAction);
- toolBar.add(this.customerqueryAction);
- toolBar.add(this.reparistoreAction);
- toolBar.add(this.allrepairqueryAction);
- toolBar.add(this.helpAction);
- return toolBar;
- }
- protected StatusLineManager createStatusLineManager(){
- StatusLineManager statusLineManager=new StatusLineManager();
- return statusLineManager;
- }
- public StatusLineManager getStatusLineManager(){
- return super.getStatusLineManager();
- }
- public static void main(String[]args){
- MainWindow main=new MainWindow();
- main.setBlockOnOpen(true);
- main.open();
- Display.getCurrent().dispose();
- sqlManager.closeSqlManager();
- }
- public Text getContent() {
- return content;
- }
- }