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

📄 systemmanager.java.svn-base

📁 梦界家园程序开发基底框架
💻 SVN-BASE
字号:
package jm.form.gui.swing.game.system;

import javax.swing.JOptionPane;

import jm.entity.command.DBCommandKeys;
import jm.entity.command.SystemCommandKeys;
import jm.form.gui.swing.game.form.MainFrame;
import jm.form.gui.swing.game.sy.sy00.SY000000;
import jm.form.gui.swing.game.sy.sy00.SY00000B;
import jm.form.gui.swing.game.sy.sy00.SY000100;
import jm.form.gui.swing.game.sy.sy00.SY000200;
import jm.form.gui.swing.game.util.UserInfo;
import jm.form.gui.swing.game.util.Utils;
import jm.form.gui.swing.game.util.model.BaseFrame;
import jm.framework.gui.Message;
import jm.framework.util.SimpleEntityTable;

/**
 * <p>Title: JM 整合Swing控件,使用配置信息</p>
 *
 * <p>Copyright: Copyright (c) 2004-2006</p>
 *
 * <p>Company: 1SHome</p>
 *
 * <p>@author Spook</p>
 *
 * @since 1.3
 * @see JDK 1.5.0.6
 */
public class SystemManager implements Message {
    public String CLASS_NAME = "SystemManager";
    private static SystemManager instance_ = null;
    public static SystemManager getInstance () {
        if (instance_ == null) {
            instance_ = new SystemManager();
        }
        return instance_;
    }

    private SystemManager () {
    }

    /////////////////////////////////////////////////////////////////////////////////
    /**
     * 登录用户
     */
    private UserInfo loginUser = null;
    public void setLoginUser (UserInfo login) {
        loginUser = login;
    }

    public UserInfo getLoginUser () {
        return loginUser;
    }

    ///////////////////////////////////////////////////////////////////
    /**
     * 获得密码
     */
    private SY000200 getPassWorld = null;
    public void getPasword () {
        getPassWorld = new SY000200();
        loginframe.setVisible(false);
        getPassWorld.setOwner(loginframe);
        getPassWorld.setSize(400, 300);
        getPassWorld.setTitle(TITLE);
        getPassWorld.actionPerformed(null, loginframe.getReturnData());
        getPassWorld.init("", "");
        //载入成功
        if (!getPassWorld.reLoad()) {
            //失败
            showErrorMessageDialog(SystemCommandKeys.MAIN_ERROR);
            this.exit();
        }
        Utils.showAtCenterInScreen(getPassWorld);
    }

    /**
     * 获得密码
     */
    public void setPasword () {
        if (getPassWorld != null) {
            loginframe.setUser((SY00000B) getPassWorld.getReturnData(0));
            getPassWorld.dispose();
            loginframe.setVisible(true);
            getPassWorld = null;
        }
    }

    ///////////////////////////////////////////////////////////////////
    /**
     * 关闭系统
     */
    public void exit () {
        if(loginUser!=null){
            try {
                SimpleEntityTable _EntityTable = new SimpleEntityTable(loginUser);
                _EntityTable.setName(DBCommandKeys.DBTABLE_LOGINPEOPLE);
//               DBOutValue out =
                        _EntityTable.delete();
//System.out.println(out.getResult());
//System.out.println(out.getResultCount());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        System.exit(0);
    }

    /**
     * 系统标题
     */
    public static final String TITLE = "梦界 v0.0.1";

    /////////////////////////////////////////////
    private MainFrame mainBackGround = null;

    public MainFrame getMainBackGround () {
        return mainBackGround;
    }

    /**
     * 登录成功显示主界面
     */
    public void login () {
        loginframe.setVisible(false);
        //系统启动
        {
            SY000100 loginProcess = new SY000100();
            loginProcess.setSize(400, 68);
            loginProcess.setOwner(loginframe);
            loginProcess.setTitle(TITLE);
            loginProcess.actionPerformed(null, null);
            loginProcess.init("", "");
            //载入成功
            if (!loginProcess.reLoad()) {
                //失败
                showErrorMessageDialog(SystemCommandKeys.MAIN_ERROR);
                this.exit();
            }
            Utils.showAtCenterInScreen(loginProcess);
            loginProcess.dispose();
        }

        //启动主画面
        if (mainBackGround == null) {
            mainBackGround = new MainFrame();
            mainBackGround.setTitle(TITLE);
            boolean reLoad = mainBackGround.reLoad();
            if (!reLoad) {
                //失败
                showErrorMessageDialog(SystemCommandKeys.MAIN_ERROR);
                this.exit();
            }
            mainBackGround.init(CLASS_NAME, "");
        }
        loginframe.dispose();
        loginframe = null;
        Utils.showAtCenterInScreen(mainBackGround);
    }

    /**
     * 显示提示信息
     * @param message String
     */
    public void clearMessage () {
        mainBackGround.setMessage("");
    }

    /////////////////////////////////////////////
    /**
     * 登录画面
     */
    private SY000000 loginframe = null;
    public void run () {
        if (loginframe == null) {
            loginframe = new SY000000();
            loginframe.setTitle(TITLE);
            loginframe.init(CLASS_NAME, ""); ;
        }
        loginframe.clear();
        Utils.showAtCenterInScreen(loginframe);
    }

    //////////////////////////////////////////////////////
    /**
     * 显示警告信息
     * @param message String
     */
    public  static void showErrorMessageDialog (String message) {
        JOptionPane.showMessageDialog(null, message,
                                      SystemCommandKeys.MESSAGE_ERROR,
                                      JOptionPane.ERROR_MESSAGE);
    }

    /**
     * 显示确认信息
     * @param message String
     */
    public static int showConfirmMessageDialog (String message) {
        return JOptionPane.showConfirmDialog(null, message,
                                             SystemCommandKeys.MESSAGE_CONFIRM,
                                             JOptionPane.YES_NO_OPTION);
    }

    /**
     * 显示提示信息
     * @param message String
     */
    public  static void showInfoMessageDialog (String message) {
        JOptionPane.showMessageDialog(null, message,
                                      SystemCommandKeys.MESSAGE_INFO,
                                      JOptionPane.INFORMATION_MESSAGE);
    }

    ///////////////////////////////////////////////////////////////////////////////////////
    /**
     * 显示提示信息
     * @param message String
     */
    public void setMessage (String message) {
        mainBackGround.setMessage(message);
    }

    /**
     * 显示提示信息
     * @param message String
     */
    public void setMessageOnSystemError (Exception ex) {
        ex.printStackTrace();
        mainBackGround.setMessage(SystemCommandKeys.SYSTEM_ERROR + ":" + ex.getMessage());
    }
}

⌨️ 快捷键说明

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