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

📄 spstoolpanel.java

📁 打印管理程序,测试完全通过.windows开发环境.
💻 JAVA
字号:
package jp.co.ntl.swing.ext.spstool;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JApplet;
import javax.swing.JFrame;

import jp.co.ntl.ActionEventConstants;
import jp.co.ntl.NetworkException;
import jp.co.ntl.ServerException;
import jp.co.ntl.TimeOutException;
import jp.co.ntl.preference.PreferenceInfo;
import jp.co.ntl.spkey.SPKeyInfo;
import jp.co.ntl.swing.BasePanel;
import jp.co.ntl.swing.ext.SPSMainBasePanel;
import jp.co.ntl.swing.ext.user.spkey.SPKeyRegisterPanel;
import jp.co.ntl.Util;

public class SPSToolPanel extends SPSMainBasePanel implements ActionListener {
	/**
	 * 
	 */
	private static final long	serialVersionUID	= 1L;
	
	public SPSToolPanel(JFrame frame, int kind) {
		super(frame, kind);
	}
		
	public SPSToolPanel(JApplet applet, int kind) {
		super(applet, kind);
	}
	
	protected void buildComponents() {
		super.buildComponents();
		
		Resource.load(Util.getCurrentLocale());
		
		if (Util.getPreferenceInfo().getAuthType() == PreferenceInfo.AUTH_LOGIN) {
			checkLoginUserPanel = new CheckLoginUserPanel(frame, net);
			checkLoginUserPanel.setFont(frame.getFont());
			add(CHECK_LOGIN_USER_PANEL, checkLoginUserPanel);
			checkLoginUserPanel.addActionListener(this);
		} else {
			checkSPKeyPanel = new CheckSPKeyPanel(frame, net);
			checkSPKeyPanel.setFont(frame.getFont());
			add(CHECK_SPKEY_PANEL, checkSPKeyPanel);
	
			switch (Util.getPreferenceInfo().getAuthType()) {
			case PreferenceInfo.AUTH_USB:
				msgIdle = Resource.getString(Resource.CHECK_SP_KEY_PANEL_ADMIN_MESSAGE);
				msgNotAdminCard = Resource.getString(Resource.STATUS_INSERT_ADMIN_SPKEY);
				msgOperation = Resource.getString(Resource.INSERT_USB);
				break;
			case PreferenceInfo.AUTH_NET_FELICA:
			case PreferenceInfo.AUTH_FELICA:
				msgIdle = Resource.getString(Resource.CHECK_SP_KEY_PANEL_PUT_ADMIN_MESSAGE);
				msgNotAdminCard = Resource.getString(Resource.STATUS_PUT_ADMIN_SPKEY);
				msgOperation = Resource.getString(Resource.PUT_FELICA);
				break;
			}
		}
		
		spsAdminUserPanel = new SPSAdminUserPanel(frame, net);
		spsAdminUserPanel.setFont(frame.getFont());
		add(ADMIN_USER_PANEL, spsAdminUserPanel);
		spsAdminUserPanel.addActionListener(this);

///		Util.debugPrint("authType = " + Util.getPreferenceInfo().getAuthType());
		
		if (Util.getPreferenceInfo().getAuthType() != PreferenceInfo.AUTH_LOGIN) {
			spKeyRegisterPanel = new SPKeyRegisterPanel(frame, net);
			spKeyRegisterPanel.setFont(frame.getFont());
			add(SP_KEY_REGISTER_PANEL, spKeyRegisterPanel);

			startCheckSPKeyTimer(net, Resource.getString(Resource.CONNECT_SERVER_MESSAGE), CHECKUSER_PERIOD);
		}
		
///		Util.debugPrint("spKeyRegisterPanel = " + spKeyRegisterPanel);
	}
	
	public void finalize() throws Throwable {
		if (Util.getPreferenceInfo().getAuthType() != PreferenceInfo.AUTH_LOGIN) {
			cancelCheckSPKeyTimer();
		}

		super.finalize();
	}
	
	public SPSAdminUserPanel getAdminUserPanelObject() {
		return spsAdminUserPanel;
	}
	
	public void goCheckSPKeyPanel() {
		if (!checkSPKeyPanel.isShowing()) {
			spsAdminUserPanel.setIgnoreGetSpoolerInfo();
			super.goCheckSPKeyPanel(msgIdle);
			sendActionEvent("");
		}
	}
	
	public void goSPSAdminUserPanel(Object info) {
		if (!spsAdminUserPanel.isShowing()) {
			frame.setTitle(Resource.getString(Resource.TITLE_ADMIN));

			spsAdminUserPanel.setExecGetSpoolerInfo();
			
			try {
				spsAdminUserPanel.beginPanel(info);
			} catch (NetworkException e) {
			} catch (ServerException e) {
			} catch (TimeOutException e) {
			}

			layout.show(this, ADMIN_USER_PANEL);

			sendActionEvent("");
		}
	}
	
	public void goSPKeySettingPanel(SPKeyInfo spKeyInfo) {
///		Util.debugPrint("spKeyRegisterPanel = " + spKeyRegisterPanel);

		if (spKeyRegisterPanel != null) {
			if (!spKeyRegisterPanel.isShowing()) {
				try {
					spKeyRegisterPanel.beginPanel(spKeyInfo);
				} catch (NetworkException e) {
				} catch (ServerException e) {
				} catch (TimeOutException e) {
				}
			
///				Util.debugPrint("layout = " + layout);
			
				layout.show(this, SP_KEY_REGISTER_PANEL);
				sendActionEvent("");
			}
		} else {
///			Util.debugPrint("spKeyRegisterPanel is null");
		}
	}
	
	public void goCheckLoginUserPanel() {
		if (!checkLoginUserPanel.isShowing()) {
			spsAdminUserPanel.setIgnoreGetSpoolerInfo();
			super.goCheckLoginUserPanel("");
			sendActionEvent("");
		}
	}
	
	public SPSAdminUserPanel getSPSAdminUserPanel() {
		return spsAdminUserPanel;
	}
	
	protected void goMainPanel(Object info) {
		goSPSAdminUserPanel(info);
	}
	
	protected void goCheckPanel() {
		goCheckSPKeyPanel();
	}
	
	protected void goRegPanel(Object info) {
		goSPKeySettingPanel((SPKeyInfo)info);
	}
	
	protected BasePanel getMainPanel() {
		return spsAdminUserPanel;
	}
	
	protected BasePanel getCheckPanel() {
		return checkSPKeyPanel;
	}
	
	protected BasePanel getRegPanel() {
		return spKeyRegisterPanel;
	}
	
	public void actionPerformed(ActionEvent ae) {
		Object	obj = ae.getSource();
		
		if (checkLoginUserPanel != null && obj == checkLoginUserPanel) {
			String	command = checkLoginUserPanel.getActionCommand();
			if (command.equals(ActionEventConstants.ACTCMD_DO_LOGIN)) {		// 儘僌僀儞
				AuthenticateUserThread	th = new AuthenticateUserThread();
				th.start();
			}
		} else if (spsAdminUserPanel != null && obj == spsAdminUserPanel) {
			String	command = spsAdminUserPanel.getActionCommand();
			if (command.equals(ActionEventConstants.ACTCMD_LOGOUT)) {		// 儘僌傾僂僩
				Util.debugPrint("Logout");
				preError = false;
				goCheckLoginUserPanel();
			}
		}
	}
}

⌨️ 快捷键说明

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