📄 abstractscreen.java
字号:
/* * JRemCntl - Copyright (C) 2007 Filippo Di Vattimo <fildiv@gmail.com> * See COPYING */package fildiv.jremcntl.client.ui;import javax.microedition.lcdui.Display;import javax.microedition.lcdui.Form;import fildiv.jremcntl.client.core.AppContext;import fildiv.jremcntl.client.util.WaitGauge;import fildiv.jremcntl.common.core.Logger;public abstract class AbstractScreen implements Screen { private AppContext appCtx; private Logger log; private Screen backScreen; private int waitIndex = -1; private boolean active; private WaitGauge waitGauge = null; private Form gaugeForm; public AbstractScreen(AppContext appCtx) { this(appCtx, null); } public AbstractScreen(AppContext appCtx, Screen backScreen) { this.appCtx = appCtx; this.log = appCtx.getLogger(); this.backScreen = backScreen; } public AppContext getAppCtx() { return appCtx; } public Screen getBackScreen() { return backScreen; } public void setBackScreen(Screen backScreen) { this.backScreen = backScreen; } public Logger getLogger() { return log; } public void setLogger(Logger logger) { this.log = logger; } public Display getDisplay() { return appCtx.getDisplay(); } public boolean isActive() { return active; } public void show() { setActive(true); } public void hide() { hide(true); } public void hide(boolean showBack) { setActive(false); if (backScreen != null && showBack) backScreen.show(); } private void setActive(boolean active) { this.active = active; if (this.active) { onActivate(); } else { onDeactivate(); } } protected void onActivate() { } protected void onDeactivate() { } protected synchronized void showWait(Form f, String msg) { if (waitGauge != null) return; gaugeForm = f; waitGauge = new WaitGauge(msg, 10, 0); getDisplay().setCurrent(gaugeForm); waitIndex = gaugeForm.append(waitGauge); } protected void stopWait() { if (waitGauge != null) waitGauge.setDone(); if (waitIndex >= 0) gaugeForm.delete(waitIndex); waitGauge = null; gaugeForm = null; waitIndex = -1; } protected void showLogs() { Screen loggerScreen = (Screen) getLogger(); loggerScreen.setBackScreen(this); loggerScreen.show(); } protected void log(String m) { if (log == null) return; log.info(m); } protected void logln(String m) { if (log == null) return; log.info(m); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -