public void commandAction(Command c, Displayable d) { if (c == cmdCancel) { destroyView(); } // if (c==cmdBookmarks) { new Bookmarks(display, null); } if (c == cmdJoin || c == cmdAdd) { String nick = nickField.getString().trim(); String host = hostField.getString().trim(); String room = roomField.getString().trim(); String pass = passField.getString(); int msgLimit = msgLimitField.getValue(); if (nick.length() == 0) return; if (room.length() == 0) return; if (host.length() == 0) return; StringBuffer gchat = new StringBuffer(room.trim()); gchat.append('@'); gchat.append(host.trim()); // sd.roster.mucContact(gchat.toString(), Contact.ORIGIN_GROUPCHAT); if (c == cmdAdd) new Bookmarks(display, new BookmarkItem(gchat.toString(), nick, pass)); else { try { gchat.append('/'); gchat.append(nick); join(gchat.toString(), pass, msgLimit); display.setCurrent(sd.roster); } catch (Exception e) { e.printStackTrace(); // display.setCurrent(new Alert("Exception", e.toString(), null, AlertType.ERROR), // sd.roster); } } } }
public void commandAction(Command c, Displayable d) { if (c == cmdCancel) { destroyView(); return; } if (c == cmdOk) { try { int type = choiseType.getSelectedIndex(); String value = textValue.getString(); if (type == 2) value = PrivacyItem.subscrs[choiceSubscr.getSelectedIndex()]; if (type != PrivacyItem.ITEM_ANY) if (value.length() == 0) return; // int order=Integer.parseInt(textOrder.getString()); item.action = choiceAction.getSelectedIndex(); item.type = type; item.value = value; // item.order=order; choiseStanzas.getSelectedFlags(item.stanzasSet); if (targetList != null) if (!targetList.rules.contains(item)) { targetList.addRule(item); item.order = targetList.rules.indexOf(item) * 10; } destroyView(); } catch (Exception e) { e.printStackTrace(); } } }
private void switchType() { int index = choiseType.getSelectedIndex(); try { Object rfocus = StaticData.getInstance().roster.getFocusedObject(); switch (index) { case 0: // jid if (targetList != null) if (rfocus instanceof Contact) { textValue.setString(((Contact) rfocus).getBareJid()); } form.set(2, textValue); break; case 1: // group if (targetList != null) textValue.setString( ((rfocus instanceof Group) ? (Group) rfocus : ((Contact) rfocus).getGroup()) .getName()); form.set(2, textValue); break; case 2: // subscription form.set(2, choiceSubscr); break; case 3: form.set(2, new StringItem(null, "(ANY)")); } /*if (index==2) { form.set(2, choiceSubscr); } else { textValue.setLabel(PrivacyItem.types[index]); form.set(2, textValue); } */ } catch (Exception e) { /* При смене на самого себя */ } }