📄 jimmui.java.svn-base
字号:
public static void fillStatusesInList(TextList list, int type, int flags, int showFlags) { boolean showDescr = (showFlags&SHOW_STATUSES_DESCR) != 0; boolean showName = (showFlags&SHOW_STATUSES_NAME) != 0; for (int i = 0; i < statusInfos.length; i++) { StatusInfo info = statusInfos[i]; if (info.getType() != type) continue; if ((info.getFlags()&flags) == 0) continue; if (showName) { addTextListItem ( list, info.getText(), info.getImage(), info.getValue(), true, -1, showDescr||((info.getFlags()&StatusInfo.FLAG_STD) != 0) ? Font.STYLE_BOLD : Font.STYLE_PLAIN ); } if (showDescr) { int value = info.getValue(); String descr = Options.getStatusString(type, value); if (descr == null) descr = info.getText(); addTextListItem ( list, descr, (!showName) ? info.getImage() : null, info.getValue(), true, -1, (!showName)&&((info.getFlags()&StatusInfo.FLAG_STD) != 0) ? Font.STYLE_BOLD : Font.STYLE_PLAIN ); } } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static final int SHS_TYPE_ALL = 1; public static final int SHS_TYPE_EMPTY = 2; public static TextList showGroupSelector(String caption, CommandListener listener, int type, int excludeGroupId) { TextList tlGroups = new TextList (ResourceBundle.getString(caption)); tlGroups.lock(); JimmUI.setColorScheme(tlGroups, false, -1, true); tlGroups.setMode(VirtualList.CURSOR_MODE_DISABLED); tlGroups.addCommandEx(cmdOk, VirtualList.MENU_TYPE_RIGHT_BAR); tlGroups.addCommandEx(cmdCancel, VirtualList.MENU_TYPE_LEFT_BAR); ContactListGroupItem[] groups = ContactList.getGroupItems(); boolean found = false; int id; for (int i = 0; i < groups.length; i++) { id = groups[i].getId(); if ((id == excludeGroupId) || (id == 0x0000)) continue; if (type == SHS_TYPE_EMPTY) { ContactItem[] cItems = ContactList.getGroupItems(id); if (cItems.length != 0)continue; } addTextListItem(tlGroups, groups[i].getName(), null, id, false, -1, Font.STYLE_PLAIN); found = true; } if (!found) addTextListItem(tlGroups, "No groups found", null, -1, false, -1, Font.STYLE_PLAIN); tlGroups.setCommandListener(listener); tlGroups.activate(Jimm.display); tlGroups.unlock(); return tlGroups; } public static int[] showGroupSelector(String caption, int tag, CommandListener listener, int type, int excludeGroupId) { ContactListGroupItem[] groups = ContactList.getGroupItems(); String[] groupNamesTmp = new String[groups.length]; int[] groupIdsTmp = new int[groups.length]; int index = 0; int groupId; ContactItem[] cItems; for (int i = 0; i < groups.length; i++) { groupId = groups[i].getId(); if (groupId == excludeGroupId) continue; switch (type) { case SHS_TYPE_EMPTY: cItems = ContactList.getGroupItems(groupId); if (cItems.length != 0) continue; break; } groupIdsTmp[index] = groupId; groupNamesTmp[index] = groups[i].getName(); index++; } cItems = null; if (index == 0) { Alert alert = new Alert("", ResourceBundle.getString("no_availible_groups"), null, AlertType.INFO); alert.setTimeout(Alert.FOREVER); Jimm.display.setCurrent(alert); Jimm.setBkltOn(false); return null; } String[] groupNames = new String[index]; int[] groupIds = new int[index]; System.arraycopy(groupIdsTmp, 0, groupIds, 0, index); System.arraycopy(groupNamesTmp, 0, groupNames, 0, index); showSelector(ResourceBundle.getString(caption), groupNames, listener, tag, false); return groupIds; } /////// public static void addTextListItem(TextList list, String text, Image image, int value, boolean translate, int textColor, int fontStyle) { if (image != null) list.addImage(image, null, value); String textToAdd = translate ? ResourceBundle.getString(text) : text; if (textColor == -1) textColor = list.getTextColor(); else if (textColor == -2) textColor = Options.getSchemeColor(Options.CLRSCHHEME_OUTGOING, -1); if (fontStyle == -1) fontStyle = Font.STYLE_PLAIN; list.addBigText((image != null) ? (" "+textToAdd) : textToAdd, textColor, fontStyle, value); list.doCRLF(value); } ////// static public boolean isControlActive(VirtualList list) { if (list == null) return false; return list.isActive(); } // // Text editor for messages // /* Size of text area for entering mesages */ final public static int MAX_EDITOR_TEXT_SIZE = 2000; /* Textbox for entering messages */ private static TextBox messageTextbox; /* receiver for text message */ private static ContactItem textMessReceiver; /* Modes constant for text editor */ final private static int EDITOR_MODE_MESSAGE = 200001; /* Current text editor mode */ private static int textMessCurMode; private static void removeTextMessageCommands() { messageTextbox.removeCommand(cmdSend); messageTextbox.removeCommand(cmdCancel); } /* Write message */ public static void writeMessage(ContactItem receiver, String initText) { String formCap = Options.getBoolean(Options.OPTION_FULL_TEXTBOX) ? null : receiver.getStringValue(ContactItem.CONTACTITEM_NAME)+" - "+ResourceBundle.getString("message"); int mode = TextField.ANY;//#sijapp cond.if target is "MIDP2" | target is "MOTOROLA" | target is "SIEMENS2"# if (messageTextbox == null) messageTextbox = new TextBox(formCap, null, MAX_EDITOR_TEXT_SIZE, mode); else messageTextbox.setTitle(formCap);//#sijapp cond.else# messageTextbox = new TextBox(formCap, null, MAX_EDITOR_TEXT_SIZE, mode);//#sijapp cond.end# //#sijapp cond.if target!="DEFAULT"# try { if (Options.getBoolean(Options.OPTION_INIT_CAPS)) mode |= TextField.INITIAL_CAPS_SENTENCE; messageTextbox.setConstraints(mode); } catch (Exception ignore) { /* Do nothing */ }//#sijapp cond.end# textMessReceiver = receiver; textMessCurMode = EDITOR_MODE_MESSAGE; removeTextMessageCommands(); messageTextbox.addCommand(cmdSend); messageTextbox.addCommand(cmdCancel); messageTextbox.addCommand(cmdClearText); //#sijapp cond.if modules_SMILES_STD="true" | modules_SMILES_ANI="true" # messageTextbox.addCommand(cmdInsertEmo); //#sijapp cond.end# messageTextbox.addCommand(cmdInsTemplate); if (initText != null) messageTextbox.setString(initText); messageTextbox.setCommandListener(_this); Jimm.display.setCurrent(messageTextbox); Jimm.setBkltOn(true); sendTypeingNotify(true); } private static void sendTypeingNotify(boolean value) { //#sijapp cond.if target isnot "DEFAULT"# if ( (Options.getInt(Options.OPTION_TYPING_MODE) > 0) && textMessReceiver.hasCapability(Icq.CAPF_TYPING) && ((Options.getLong(Options.OPTION_ONLINE_STATUS) != ContactList.STATUS_INVISIBLE) && (Options.getLong(Options.OPTION_ONLINE_STATUS) != ContactList.STATUS_INVIS_ALL)) ){ try { System.out.println("sendTypeingNotify()"); Icq.beginTyping(textMessReceiver.getStringValue(ContactItem.CONTACTITEM_UIN), value); } catch (JimmException e) {} } //#sijapp cond.end# } public static void sendMessage(String text, ContactItem textMessReceiver) { /* Construct plain message object and request new SendMessageAction Add the new message to the chat history */ if (text == null) return; if (text.length() == 0) return; PlainMessage plainMsg = new PlainMessage(Options.getString(Options.OPTION_UIN), textMessReceiver, Message.MESSAGE_TYPE_NORM, Util.createCurrentDate(false), text); SendMessageAction sendMsgAct = new SendMessageAction(plainMsg); int messId = sendMsgAct.getMessId(); ChatHistory.addMyMessage(textMessReceiver, text, plainMsg.getNewDate(), textMessReceiver.getStringValue(ContactItem.CONTACTITEM_NAME), messId); try { Icq.requestAction(sendMsgAct); } catch (JimmException e) { JimmException.handleException(e); if (e.isCritical()) return; } //#sijapp cond.if modules_HISTORY is "true" # if (Options.getBoolean(Options.OPTION_HISTORY)) HistoryStorage.addText(textMessReceiver.getStringValue(ContactItem.CONTACTITEM_UIN), text, (byte) 1, ResourceBundle.getString("me"), plainMsg .getNewDate()); //#sijapp cond.end# } ///////////////////////////////////////////////////// //#sijapp cond.if target is "MIDP2" | target is "MOTOROLA" | target is "SIEMENS2"# private static TextList URLList; public static void gotoURL(String msg) { Vector v = Util.parseMessageForURL(msg); if (v.size() == 1) { try { Jimm.jimm.platformRequest((String) v.elementAt(0)); } catch (Exception e) {} } else { URLList = JimmUI.getInfoTextList(ResourceBundle.getString("goto_url"), false); URLList.addCommandEx(cmdSelect, VirtualList.MENU_TYPE_RIGHT_BAR); URLList.addCommandEx(cmdBack, VirtualList.MENU_TYPE_LEFT_BAR); URLList.setCommandListener(_this); for (int i = 0; i < v.size(); i++) { URLList.addBigText((String) v.elementAt(i), URLList.getTextColor(), Font.STYLE_PLAIN, i).doCRLF(i); } JimmUI.showInfoTextList(URLList); } } //#sijapp cond.end# /////////////////////////////////////////////////////////// private static int authType; private static TextBox authTextbox; private static ContactItem authContactItem; public static final int AUTH_TYPE_DENY = 10001; public static final int AUTH_TYPE_REQ_AUTH = 10002; public static void authMessage(int authType, ContactItem contactItem, String caption, String text) { JimmUI.authType = authType; authContactItem = contactItem; //#sijapp cond.if target is "MIDP2" | target is "MOTOROLA" | target is "SIEMENS2"# authTextbox = new TextBox(ResourceBundle.getString(caption), ResourceBundle.getString(text), 500, TextField.ANY | TextField.INITIAL_CAPS_SENTENCE); //#sijapp cond.else# authTextbox = new TextBox(ResourceBundle.getString(caption), ResourceBundle.getString(text), 500, TextField.ANY); //#sijapp cond.end# authTextbox.addCommand(cmdSend); authTextbox.addCommand(cmdCancel); authTextbox.setCommandListener(_this); Jimm.display.setCurrent(authTextbox); Jimm.setBkltOn(true); } ///////////////////////////////////////////////////////////// private static final int USER_MENU_MESSAGE = 1; private static final int USER_MENU_STATUS_MESSAGE = 3; private static final int USER_MENU_REQU_AUTH = 4; private static final int USER_MENU_FILE_TRANS = 5; private static final int USER_MENU_CAM_TRANS = 6; private static final int USER_MENU_USER_REMOVE = 7; private static final int USER_MENU_REMOVE_ME = 8; private static final int USER_MENU_RENAME = 9; private static final int USER_MENU_HISTORY = 10; private static final int USER_MENU_LOCAL_INFO = 11; private static final int USER_MENU_USER_INFO = 12; private static final int USER_MENU_QUOTA = 14; private static final int USER_MENU_MOVE_TO_GROUP = 15; private static final int USER_MENU_TO_IGN_LIST = 16; private static final int USER_MENU_REM_IGN_LIST = 17; private static final int USER_MENU_TO_INV_LIST = 18; private static final int USER_MENU_REM_INV_LIST = 19; private static final int USER_MENU_TO_VIS_LIST =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -