?? abstractspoolerpanel.java
字號(hào):
package jp.co.ntl.swing.ext.spooler;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JApplet;
import javax.swing.JFrame;
import jp.co.ntl.Net;
import jp.co.ntl.NetworkException;
import jp.co.ntl.ServerException;
import jp.co.ntl.TimeOutException;
import jp.co.ntl.swing.BasePanel;
public abstract class AbstractSpoolerPanel extends BasePanel {
public static final int SPOOLERTHREAD_PERIOD = 5000;
protected Object keyInfo = null;
protected boolean admin;
protected boolean[] bInit = {false, false};
protected String targetPrinterName = null;
private Timer getSpoolerInfoTimer = null;
private GetSpoolerInfoTimerTask getSpoolerInfoTimerTask = null;
public AbstractSpoolerPanel() {
}
public AbstractSpoolerPanel(JFrame parent, Net net, boolean admin, Object info) {
this.parent = parent;
commonConstractor(net, admin, info);
}
public AbstractSpoolerPanel(JApplet appl, Net net, boolean admin, Object info) {
this.app = appl;
commonConstractor(net, admin, info);
}
protected void commonConstractor(Net net, boolean admin, Object info) {
this.net = net;
this.admin = admin;
this.keyInfo = info;
this.bInit = new boolean[] {false, false};
buildComponents();
}
public void beginPanel() throws NetworkException, ServerException, TimeOutException {
}
protected boolean doDelete() throws NetworkException, ServerException, TimeOutException {
return true;
}
protected boolean doModify() throws NetworkException, ServerException, TimeOutException {
return true;
}
protected boolean doRegister() throws NetworkException, ServerException, TimeOutException {
return true;
}
protected void setPopupMenuState() {
}
public Object getKeyInfo() {
return keyInfo;
}
public void setKeyInfo(Object info) {
this.keyInfo = info;
}
public boolean isAdmin() {
return admin;
}
public void setAdmin(boolean admin) {
this.admin = admin;
}
public void startGetSpoolerInfoTimer(boolean ignoreGetSpoolerInfo, int period) {
getSpoolerInfoTimer = new Timer(true);
getSpoolerInfoTimerTask = new GetSpoolerInfoTimerTask(ignoreGetSpoolerInfo);
getSpoolerInfoTimer.schedule(getSpoolerInfoTimerTask, 0, period);
}
public void cancelGetSpoolerInfoTimer() {
if (getSpoolerInfoTimer != null) {
getSpoolerInfoTimer.cancel();
}
}
public boolean isGetSpoolerInfoTimerStarted() {
if (getSpoolerInfoTimer != null) {
return true;
}
return false;
}
public void setIgnoreGetSpoolerInfo() {
getSpoolerInfoTimerTask.setIgnoreGetSpoolerInfo();
}
public void setExecGetSpoolerInfo() {
getSpoolerInfoTimerTask.setExecGetSpoolerInfo();
}
private class GetSpoolerInfoTimerTask extends TimerTask {
private boolean ignoreGetSpoolerInfo = false;
public GetSpoolerInfoTimerTask(boolean ignoreGetSpoolerInfo) {
this.ignoreGetSpoolerInfo = ignoreGetSpoolerInfo;
}
public void run() {
if (!ignoreGetSpoolerInfo) {
getInfosFromServer();
}
}
public void setIgnoreGetSpoolerInfo() {
ignoreGetSpoolerInfo = true;
}
public void setExecGetSpoolerInfo() {
ignoreGetSpoolerInfo = false;
}
}
public abstract void beginPanel(Object info, boolean bInit, String targetPrinterName) throws NetworkException, ServerException, TimeOutException;
public abstract boolean start();
protected abstract void buildComponents();
public abstract int getInfosFromServer();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -