private void createForm( final Display display, String room, String server, String nick, final String password) { this.display = display; parentView = display.getCurrent(); Form formJoin = new Form(SR.MS_JOIN_CONFERENCE); roomField = new TextField(SR.MS_ROOM, room, 64, ConstMIDP.TEXTFIELD_URL); TextFieldCombo.setLowerCaseLatin(roomField); formJoin.append(roomField); hostField = new TextField(SR.MS_AT_HOST, server, 64, ConstMIDP.TEXTFIELD_URL); TextFieldCombo.setLowerCaseLatin(hostField); formJoin.append(hostField); if (nick == null) nick = sd.account.getNickName(); nickField = new TextFieldCombo(SR.MS_NICKNAME, nick, 32, TextField.ANY, "roomnick", display); formJoin.append(nickField); passField = new TextField(SR.MS_PASSWORD, password, 32, TextField.ANY | ConstMIDP.TEXTFIELD_SENSITIVE); formJoin.append(passField); msgLimitField = new NumberField(SR.MS_MSG_LIMIT, 20, 0, 20); formJoin.append(msgLimitField); formJoin.addCommand(cmdJoin); // formJoin.addCommand(cmdBookmarks); formJoin.addCommand(cmdAdd); formJoin.addCommand(cmdCancel); formJoin.setCommandListener(this); display.setCurrent(formJoin); }
/** Creates a new instance of PrivacyForm */ public PrivacyForm(Display display, PrivacyItem item, PrivacyList plist) { this.display = display; parentView = display.getCurrent(); this.item = item; targetList = plist; textValue = new TextField(null, item.value, 64, ConstMIDP.TEXTFIELD_URL); TextFieldCombo.setLowerCaseLatin(textValue); form.append(choiceAction); choiceAction.setSelectedIndex(item.action, true); form.append(choiseType); form.append(textValue); choiseType.setSelectedIndex(item.type, true); switchType(); form.append(choiseStanzas); choiseStanzas.setSelectedFlags(item.stanzasSet); // form.append("Order: "+item.order); form.setItemStateListener(this); form.setCommandListener(this); form.addCommand(cmdOk); form.addCommand(cmdCancel); display.setCurrent(form); }
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) { /* При смене на самого себя */ } }