📄 printauthtoolpanel.java
字号:
package jp.co.ntl.swing.ext.printauth;
import java.awt.AWTEvent;
import java.awt.AWTEventMulticaster;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import jp.co.ntl.ActionEventConstants;
import jp.co.ntl.ComResource;
import jp.co.ntl.NetworkException;
import jp.co.ntl.ServerException;
import jp.co.ntl.TimeOutException;
import jp.co.ntl.spkey.SPKeyInfo;
import jp.co.ntl.swing.BasePanel;
import jp.co.ntl.swing.ext.spstool.Resource;
import jp.co.ntl.Util;
import jp.co.ntl.swing.ext.FullScreenFrame;
import jp.co.ntl.swing.ext.SPSMainBasePanel;
import jp.co.ntl.preference.PreferenceInfo;
import jp.co.ntl.swing.ext.ImagePanel;
import jp.co.ntl.user.UserInfo2;
public class PrintAuthToolPanel extends SPSMainBasePanel implements ActionListener {
private static final long serialVersionUID = 1L;
public static final int WIDTH = 950;
public static final int HEIGHT = 480;
// 2007.10.22 lium 暋悢僾儕儞僞懳墳 add start
public static final int BODY_HEIGHT = 198;
public static final int HEAD_HEIGHT = 85;
// 2007.10.22 lium 暋悢僾儕儞僞懳墳 add end
private SPSGeneralUserPanel spsGeneralUserPanel;
private transient ActionListener actionListener;
public PrintAuthToolPanel(FullScreenFrame frame, int kind, ImagePanel pnlBackground) {
super(frame, kind, pnlBackground);
}
public PrintAuthToolPanel(JApplet applet, int kind, ImagePanel pnlBackground) {
super(applet, kind, pnlBackground);
}
protected void buildComponents() {
super.buildComponents();
setOpaque(false);
Resource.load(Util.getCurrentLocale());
if (Util.getPreferenceInfo().getAuthType() == PreferenceInfo.AUTH_LOGIN) {
checkLoginUserPanel = new CheckLoginUserPanel(frame, net);
checkLoginUserPanel.setOpaque(false);
//checkLoginUserPanel.setFont(frame.getFont());
add(CHECK_LOGIN_USER_PANEL, checkLoginUserPanel);
checkLoginUserPanel.addActionListener(this);
/*
checkLoginUserPanel = new CheckLoginUserPanel(applet, net);
checkLoginUserPanel.setOpaque(false);
checkLoginUserPanel.setFont(applet.getFont());
add(CHECK_LOGIN_USER_PANEL, checkLoginUserPanel);
checkLoginUserPanel.addActionListener(this);
*/
} else {
checkSPKeyPanel = new CheckSPKeyPanel(frame, net);
checkSPKeyPanel.setOpaque(false);
//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_MESSAGE);
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_MESSAGE);
msgOperation = Resource.getString(Resource.PUT_FELICA);
break;
}
}
spsGeneralUserPanel = new SPSGeneralUserPanel(frame, net, pnlBackground);
//spsGeneralUserPanel.setFont(frame.getFont());
// spsGeneralUserPanel = new SPSGeneralUserPanel(applet, net, pnlBackground);
// spsGeneralUserPanel.setFont(applet.getFont());
add(GENERAL_USER_PANEL, spsGeneralUserPanel);
spsGeneralUserPanel.addActionListener(this);
spsGeneralUserPanel.getWaitQuePanel().addActionListener(this);
spsGeneralUserPanel.getEndQuePanel().addActionListener(this);
sendActionEvent("");
if (Util.getPreferenceInfo().getAuthType() != PreferenceInfo.AUTH_LOGIN) {
startCheckSPKeyTimer(net, Resource.getString(Resource.CONNECT_SERVER_MESSAGE), CHECKUSER_PERIOD);
}
if (frame != null) {
frame.requestFocus();
}
}
public synchronized void addActionListener(ActionListener l) {
if (l == null) {
return;
}
actionListener = AWTEventMulticaster.add(actionListener, l);
}
public synchronized void removeActionListener(ActionListener l) {
if (l == null) {
return;
}
actionListener = AWTEventMulticaster.remove(actionListener, l);
}
protected void processEvent(AWTEvent e) {
if (e instanceof ActionEvent) {
processActionEvent((ActionEvent)e);
return;
}
super.processEvent(e);
}
protected void processActionEvent(ActionEvent e) {
if (actionListener != null) {
actionListener.actionPerformed(e);
}
}
public void finalize() throws Throwable {
if (Util.getPreferenceInfo().getAuthType() != PreferenceInfo.AUTH_LOGIN) {
cancelCheckSPKeyTimer();
}
super.finalize();
}
public void goCheckSPKeyPanel() {
if (!checkSPKeyPanel.isShowing()) {
spsGeneralUserPanel.setSpoolerThreadSetSendEvent(false);
if (Util.getPreferenceInfo().getClientKind() == PreferenceInfo.CLIENT_MAC) {
((FullScreenFrame)frame).repaintFullScreen();
}
super.goCheckSPKeyPanel(msgIdle);
if (frame != null) {
frame.requestFocus();
}
}
}
public void goCheckLoginUserPanel() {
if (!checkLoginUserPanel.isShowing()) {
spsGeneralUserPanel.setSpoolerThreadSetSendEvent(false);
if (Util.getPreferenceInfo().getClientKind() == PreferenceInfo.CLIENT_MAC) {
((FullScreenFrame)frame).repaintFullScreen();
}
super.goCheckLoginUserPanel("");
if (frame != null) {
frame.requestFocus();
}
}
}
public void goSPSGeneralUserPanel(Object info) {
if (!spsGeneralUserPanel.isShowing()) {
if (Util.getPreferenceInfo().getClientKind() == PreferenceInfo.CLIENT_MAC) {
((FullScreenFrame)frame).repaintFullScreen();
}
// 2007.11.07 lium 儘僌弌椡 add start
if (info instanceof SPKeyInfo) {
if (keyKind == SPSMainBasePanel.KEY_USB) {
// SP Key丂偑憓擖偝傟傑偟偨丅(儐乕僓丗{0})
} else if (keyKind == SPSMainBasePanel.KEY_FELICA) {
// Felica丂僇乕僪偑闳偝傟傑偟偨丅(儐乕僓丗{1})
}
} else if (info instanceof UserInfo2) {
}
// 2007.11.07 lium 儘僌弌椡 add end
try {
spsGeneralUserPanel.beginPanel(info);
} catch (NetworkException e) {
} catch (ServerException e) {
} catch (TimeOutException e) {
}
if (frame != null) {
frame.requestFocus();
}
layout.show(this, GENERAL_USER_PANEL);
}
}
public void setKeyboardFocus() {
if (checkLoginUserPanel != null) {
checkLoginUserPanel.setKeyboardFocus();
}
}
protected void goMainPanel(Object info) {
goSPSGeneralUserPanel(info);
}
protected void goCheckPanel() {
goCheckSPKeyPanel();
}
protected void goRegPanel(Object spKinfo) {
}
protected BasePanel getMainPanel() {
return spsGeneralUserPanel;
}
protected BasePanel getCheckPanel() {
return checkSPKeyPanel;
}
protected BasePanel getRegPanel() {
return null;
}
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 (command.equals(ActionEventConstants.ACTCMD_EXIT)) { // 廔椆
sendActionEvent(ActionEventConstants.ACTCMD_EXIT);
}
} else if (obj == spsGeneralUserPanel) {
String command = spsGeneralUserPanel.getActionCommand();
if (command.equals(ActionEventConstants.ACTCMD_LOGOUT)) { // 儘僌傾僂僩
preError = false;
goCheckLoginUserPanel();
}
/// ((FullScreenFrame)frame).repaintFullScreen();
/// repaint();
} else if (obj == spsGeneralUserPanel.getWaitQuePanel() || obj == spsGeneralUserPanel.getEndQuePanel()) {
if (Util.getPreferenceInfo().getClientKind() == PreferenceInfo.CLIENT_MAC || Util.getPreferenceInfo().isDebug()) {
repaint();
} else {
((FullScreenFrame)frame).repaintFullScreen();
sendActionEvent(ActionEventConstants.ACTCMD_REFRESH_SCREEN);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -