📄 jimmui.java.svn-base
字号:
backToLastScreen(); } if (c == cmdEdit) { EditInfo.showEditForm(last_user_info); } // "User info" -> "Copy text, Copy all" else if ((c == cmdCopyText) || (c == cmdCopyAll)) { JimmUI.setClipBoardText("[" + getCaption(infoTextList) + "]\n" + infoTextList.getCurrText(0, (c == cmdCopyAll))); } } // "Selector" else if (isControlActive(lstSelector)) { lastSelectedItemIndex = lstSelector.getCurrTextIndex(); // User have selected new group for contact if (curScreenTag == GROUP_SELECTOR_MOVE_TAG) { lstSelector = null; if ((c == cmdOk) || (c == List.SELECT_COMMAND)) { int currGroupId = clciContactMenu.getIntValue(ContactItem.CONTACTITEM_GROUP); int newGroupId = groupList[JimmUI.getLastSelIndex()]; ContactListGroupItem oldGroup = ContactList.getGroupById(currGroupId); ContactListGroupItem newGroup = ContactList.getGroupById(newGroupId); UpdateContactListAction act = new UpdateContactListAction(clciContactMenu, oldGroup, newGroup); try { Icq.requestAction(act); SplashCanvas.addTimerTask("wait", act, false); } catch (JimmException e) { JimmException.handleException(e); } } else backToLastScreen(); return; } else listener.commandAction(c, d); lstSelector = null; listener = null; curScreenTag = -1; } // Message box else if ((msgForm != null) && (d == msgForm)) { listener.commandAction(c, d); msgForm = null; curScreenTag = -1; } } public static void setCaption(Object ctrl, String caption) { if (ctrl instanceof VirtualList) { VirtualList vl = (VirtualList) ctrl; vl.setCaption(caption); } //#sijapp cond.if target is "MIDP2" | target is "MOTOROLA" | target is "SIEMENS2"# else if (ctrl instanceof Displayable) { ((Displayable)ctrl).setTitle(caption); } //#sijapp cond.end# } public static String getCaption(Object ctrl) { if (ctrl == null) return null; String result = null; if (ctrl instanceof VirtualList) { VirtualList vl = (VirtualList) ctrl; result = vl.getCaption(); } //#sijapp cond.if target is "MIDP2" | target is "MOTOROLA" | target is "SIEMENS2"# else if (ctrl instanceof Displayable) { result = ((Displayable)ctrl).getTitle(); } //#sijapp cond.end# return result; } public static int getCurScreenTag() { if ((msgForm != null) && (msgForm.isShown())) return curScreenTag; if (isControlActive(msgBoxList)) return curScreenTag; if (isControlActive(lstSelector)) return curScreenTag; return -1; } ///////////////////////// // // // Message Box // // // ///////////////////////// static private Form msgForm; static private int curScreenTag = -1; public static int getCommandType(Command testCommand, int testTag) { return (curScreenTag == testTag) ? getCommandIdx(testCommand) : -1; } final public static int MESBOX_YESNO = 1; final public static int MESBOX_OKCANCEL = 2; final public static int MESBOX_OK = 3; static public void messageBox(String cap, String text, int type, CommandListener listener, int tag) { clearAll(); curScreenTag = tag; msgForm = new Form(cap); msgForm.append(text); switch (type) { case MESBOX_YESNO: msgForm.addCommand(cmdYes); msgForm.addCommand(cmdNo); break; case MESBOX_OKCANCEL: msgForm.addCommand(cmdOk); msgForm.addCommand(cmdCancel); break; case MESBOX_OK: msgForm.addCommand(cmdOk); msgForm.addCommand(cmdCancel); break; } JimmUI.listener = listener; msgForm.setCommandListener(_this); Jimm.display.setCurrent(msgForm); Jimm.setBkltOn(true); } static private TextList showMessageBox(String cap, String text, int type) { msgBoxList = new TextList(cap); msgBoxList.setMode(VirtualList.CURSOR_MODE_DISABLED); setColorScheme(msgBoxList, false, -1, true); msgBoxList.setFontSize(Font.SIZE_LARGE); msgBoxList.addBigText(text, msgBoxList.getTextColor(), Font.STYLE_PLAIN, -1); switch (type) { case MESBOX_YESNO: msgBoxList.addCommandEx(cmdYes, VirtualList.MENU_TYPE_RIGHT_BAR); msgBoxList.addCommandEx(cmdNo, VirtualList.MENU_TYPE_LEFT_BAR); break; case MESBOX_OKCANCEL: msgBoxList.addCommandEx(cmdOk, VirtualList.MENU_TYPE_RIGHT_BAR); msgBoxList.addCommandEx(cmdCancel, VirtualList.MENU_TYPE_LEFT_BAR); break; } msgBoxList.setCommandListener(_this); msgBoxList.activate(Jimm.display); return msgBoxList; } ////////////////////////////////////////////////////////////////////////////// private static TextList aboutTextList; // String for recent version static private String version; static private String betaVersion; static private final int ABOUT_JIMM_WAP = 1000; static public void about() { System.gc(); long freeMem = Runtime.getRuntime().freeMemory() / 1024; if (aboutTextList == null) aboutTextList = new TextList(null); aboutTextList.lock(); aboutTextList.clear(); aboutTextList.setMode(VirtualList.CURSOR_MODE_DISABLED); setColorScheme(aboutTextList, false, -1, true); aboutTextList.setCaption(ResourceBundle.getString("about")); aboutTextList.addBigText( ResourceBundle.getString("about_cap"), Options.getSchemeColor(Options.CLRSCHHEME_OUTGOING, -1), Font.STYLE_BOLD, -1 ); aboutTextList.doCRLF(-1); String commaAndSpace = ", "; StringBuffer str = new StringBuffer(); str.append(" ").append(ResourceBundle.getString("about_info")).append("\n"); aboutTextList.addBigText(str.toString(), -1, Font.STYLE_PLAIN, -1); aboutTextList.doCRLF(-1); //#sijapp cond.if target isnot "DEFAULT"# JimmUI.addTextListItem(aboutTextList, "about_visit_wap", JimmUI.eventUrlMessageImg, ABOUT_JIMM_WAP, true, -1, Font.STYLE_BOLD); aboutTextList.doCRLF(-1); aboutTextList.addCommandEx(cmdSelect, VirtualList.MENU_TYPE_RIGHT_BAR);//#sijapp cond.end# str.setLength(0); str .append(ResourceBundle.getString("midp_info")) .append(": ").append(Jimm.microeditionPlatform); if (Jimm.microeditionProfiles != null) str.append(commaAndSpace).append(Jimm.microeditionProfiles); String locale = System.getProperty("microedition.locale"); if (locale != null) str.append(commaAndSpace).append(locale); str .append("\n\n").append(ResourceBundle.getString("free_heap")) .append(": ").append(freeMem).append("kb\n") .append(ResourceBundle.getString("total_mem")).append(": ") .append(Runtime.getRuntime().totalMemory() / 1024).append("kb\n\n") .append(ResourceBundle.getString("latest_ver")).append(":\n"); aboutTextList.addBigText(str.toString(), -1, Font.STYLE_PLAIN, -1); internalShowLastVers(); aboutTextList.addCommandEx(cmdBack, VirtualList.MENU_TYPE_LEFT_BAR); aboutTextList.setCommandListener(_this); aboutTextList.unlock(); aboutTextList.activate(Jimm.display); // request last jimm version if (version == null && betaVersion == null) Threads.requestLastJimmVers(); } static private String readHttpContentFirstString(String url) { HttpConnection httemp = null; InputStream istemp = null; String result = null; try { httemp = (HttpConnection) Connector.open(url); if (httemp.getResponseCode() != HttpConnection.HTTP_OK) throw new IOException(); istemp = httemp.openInputStream(); byte[] versRaw_ = new byte[(int) httemp.getLength()]; istemp.read(versRaw_, 0, versRaw_.length); result = new String(versRaw_); } catch (SecurityException e) { JimmException f = new JimmException(119, 1, true); JimmException.handleException(f); } catch (Exception e) {} finally { if (istemp != null) try {istemp.close();} catch (Exception e) {} if (httemp != null) try {httemp.close();} catch (Exception e) {} } if (result != null) { int pos = result.indexOf("\r"); if (pos != -1) pos = result.indexOf("\n"); if (pos != -1) result = result.substring(0, pos); } return result; } static public void internalReqLastVersThread() { Thread.yield(); Thread.currentThread().setPriority(Thread.MIN_PRIORITY); if (version == null) version = readHttpContentFirstString("http://www.jimm.org/current_ver"); if (betaVersion == null) betaVersion = readHttpContentFirstString("http://www.jimm.org/nightly/current-nightly"); MainThread.showLastJimmVers(); } static private void addVersString(String result, String name) { if (result == null) return; aboutTextList.addBigText(ResourceBundle.getString(name), aboutTextList.getTextColor(), Font.STYLE_PLAIN, -1); aboutTextList.addBigText(": ", aboutTextList.getTextColor(), Font.STYLE_PLAIN, -1); aboutTextList.addBigText(result, aboutTextList.getTextColor(), Font.STYLE_BOLD, -1); aboutTextList.doCRLF(-1); } static public void internalShowLastVers() { if (aboutTextList != null) { addVersString(version, "version_stable"); addVersString(betaVersion, "version_beta"); } } ////////////////////// // // // Clipboard // // // ////////////////////// static private String clipBoardText; static private String insertQuotingChars(String text, String qChars) { StringBuffer result = new StringBuffer(); int size = text.length(); boolean wasNewLine = true; char chr; for (int i = 0; i < size; i++) { chr = text.charAt(i); if (wasNewLine) result.append(qChars); result.append(chr); wasNewLine = (chr == '\n'); } return result.toString(); } static public String getClipBoardText() { return clipBoardText; } static public void setClipBoardText(String text) { clipBoardText = text; } static public void setClipBoardText(boolean incoming, String date, String from, String text) { StringBuffer sb = new StringBuffer(); sb.append('[').append(from).append(' ').append(date).append(']') .append(CRLFstr).append( insertQuotingChars(text, incoming ? ">> " : "<< ")); clipBoardText = sb.toString(); } static public void clearClipBoardText() { clipBoardText = null;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -