void login() { try { logoutBtn.setEnabled(true); contactList.setEditable(false); loginBtn.setEnabled(false); loginId.setEnabled(false); password.setEnabled(false); // plugin.login( getMyLoginId(), password.getText(), getContactList(), MessagingNetwork.STATUS_ONLINE); logoutBtn.setEnabled(true); } catch (Throwable tr) { printException(tr); boolean loggedIn = false; try { loggedIn = plugin.getClientStatus(getMyLoginId()) != MessagingNetwork.STATUS_OFFLINE; } catch (Throwable tr2) { printException(tr2); } if (!loggedIn) { enableLoginUI(); } } }
void enableLoginUI() { try { logoutBtn.setEnabled(false); contactList.setEditable(true); loginBtn.setEnabled(true); loginId.setEnabled(true); password.setEnabled(true); } catch (Throwable tr) { CAT.error("exception", tr); } }
{ removeFromContactList.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { try { String cl = contactList.getText(); for (; ; ) { int pos = cl.indexOf(contactListEntry.getText()); if (pos == -1) break; cl = cl.substring(0, pos) + cl.substring(pos + contactListEntry.getText().length()); } for (; ; ) { int pos = cl.indexOf("\n\n"); if (pos == -1) break; cl = cl.substring(0, pos) + cl.substring(pos + "\n\n".length()); } if (cl.startsWith("\n")) cl = cl.substring("\n".length()); if (cl.endsWith("\n")) cl = cl.substring(0, cl.length() - "\n".length()); contactList.setText(cl); // plugin.removeFromContactList(getMyLoginId(), contactListEntry.getText()); } catch (Throwable tr) { printException(tr); } } }); }
{ closeBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { try { quit(); } catch (Throwable tr) { CAT.error("exception", tr); } } }); }
private Button getSendContactsButton() { if (sendContactsButton == null) { sendContactsButton = new Button("send random contacts"); sendContactsButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { sendContacts(); } }); } return sendContactsButton; }
{ loginBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { new Thread("icqtest/login button handler") { public void run() { try { login(); } catch (Throwable tr) { CAT.error("exception", tr); } } }.start(); } }); }
private Button getUserDetailsButton() { if (userDetailsButton == null) { userDetailsButton = new Button("user info"); userDetailsButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { fetchUserDetails(); } catch (Throwable tr) { CAT.error("exception", tr); } } }); } return userDetailsButton; }