java new ContactList()
java -3374609151465534159L
java for (java.util.Enumeration ns = getNetworks(); ns.hasMoreElements();) { Object n = ns.nextElement(); if (n instanceof ExceptionReporter) { ((ExceptionReporter) n).report(e); return; } } System.err.println(e.getMessage()); e.printStackTrace();
java try { // ViewFactory setViewFactory(ViewFactory.getDefault()); // Network Network.discoverNetworks(); // Create and register edit/view new ContactListEdit(contactList); } catch (Exception e) { e.printStackTrace(); }
java for (java.util.Enumeration ns = getNetworks(); ns.hasMoreElements();) { Network n = (Network) ns.nextElement(); Identity id = getContactList().getIdentity(n); if (id != null) { n.login(id.getUserId(), id.getPassword()); } }
java for (java.util.Enumeration ns = getNetworks(); ns.hasMoreElements();) { Network n = (Network) ns.nextElement(); if (getContactList().getIdentity(n) != null) { n.logout(); } }
java for (java.util.Enumeration cs = getContactList().getContacts(); cs .hasMoreElements();) { Contact listed = (Contact) cs.nextElement(); if (listed.getUserId().equals(c.getUserId())) { if (c.getStatus() != null) { listed.setStatus(c.getStatus()); } if (c.getName() != null) { listed.setName(c.getName()); } return; } } getContactList().addContact(c);
java for (java.util.Enumeration cs = getConversations(); cs .hasMoreElements();) { Conversation c = (Conversation) cs.nextElement(); String contact = c.getContact().getUserId(); if (contact.equals(r.getSender())) { c.setMessage(r); return; } } Conversation conv = new Conversation(); new ConversationEdit(conv); addConversation(conv); for (java.util.Enumeration cs = getContactList().getContacts(); cs .hasMoreElements();) { Contact c = (Contact) cs.nextElement(); if (c.getUserId().equals(r.getSender())) { conv.setContact(c); break; } } if (conv.getContact() == null) { conv.setContact(new Contact()); conv.getContact().setUserId(r.getSender()); } conv.setMessage(r); java return network.elements(); java return contactList; java return conversation.elements(); java return viewFactory; java this.contactList = contactList; java this.viewFactory = viewFactory; java if (! this.network.contains(network)) { this.network.addElement(network); } if (network != null) network.addObserver(this); java if (! this.conversation.contains(conversation)) { this.conversation.addElement(conversation); } java if (network != null) network.deleteObserver(this); this.network.removeElement(network); java this.conversation.removeElement(conversation); java try { return (im.networking.Network) network.elementAt(index); } catch (ArrayIndexOutOfBoundsException e) { return null; } java return this.network.indexOf(network); java if (! this.network.contains(network)) { try { this.network.insertElementAt(network, index); } catch (ArrayIndexOutOfBoundsException e) { this.network.addElement(network); } } if (network != null) network.addObserver(this); java if (arg instanceof java.util.Hashtable) { java.util.Hashtable e = (java.util.Hashtable) arg; String mName = "on" + ((String) e.get("name")) + "Change"; Class[] parmTypes = { (Class) e.get("class") }; try { java.lang.reflect.Method m = getClass().getDeclaredMethod(mName, parmTypes); Object[] args = { e.get("value") }; m.invoke(this, args); } catch (NoSuchMethodException nex) { // no handler } catch (Exception ex) { // wrong handler configuration ex.printStackTrace(); } }
java return userId; java return name; java return status; java if (this.userId != userId) { this.userId = userId; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "UserId"); e.put("class", String.class); if (userId != null) { e.put("value", userId); } notifyObservers(e); } java if (this.name != name) { this.name = name; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Name"); e.put("class", String.class); if (name != null) { e.put("value", name); } notifyObservers(e); } java if (this.status != status) { this.status = status; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Status"); e.put("class", String.class); if (status != null) { e.put("value", status); } notifyObservers(e); } java final StringBuffer fmt = new StringBuffer(); final String name = getName(); final String status = getStatus(); fmt.append(" "); fmt.append((name == null) ? getUserId() : name); if (getNetwork() != null) { fmt.append(" - "); fmt.append(getNetwork().getName()); } fmt.append(" ("); fmt.append((status == null) ? "offline" : status); fmt.append(")"); return fmt.toString();
java for (java.util.Enumeration cs = getContacts(); cs.hasMoreElements();) { Contact contact = (Contact) cs.nextElement(); if ((contact instanceof Identity) && (contact.getNetwork() == forNw)) { return (Identity) contact; } } return null;
java for (java.util.Enumeration cs = getContacts(); cs.hasMoreElements();) { Contact contact = (Contact) cs.nextElement(); if (contact.getUserId().equals(userId)) { if (contact.getName() == null) { return contact.getUserId(); } else { return contact.getName(); } } } return userId; java return contact.elements(); java if (! this.contact.contains(contact)) { if (! this.contact.contains(contact)) { this.contact.addElement(contact); } setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Contact"); e.put("class", im.model.Contact.class); if (contact != null) { e.put("value", contact); } notifyObservers(e); } java if (this.contact.contains(contact)) { this.contact.removeElement(contact); setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Contact"); e.put("class", im.model.Contact.class); if (contact != null) { e.put("value", contact); } notifyObservers(e); } java try { return (im.model.Contact) contact.elementAt(index); } catch (ArrayIndexOutOfBoundsException e) { return null; } java return this.contact.indexOf(contact); java if (! this.contact.contains(contact)) { if (! this.contact.contains(contact)) { try { this.contact.insertElementAt(contact, index); } catch (ArrayIndexOutOfBoundsException e) { this.contact.addElement(contact); } } setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Contact"); e.put("class", im.model.Contact.class); if (contact != null) { e.put("value", contact); } notifyObservers(e); }
java return message; java return contact; java if (this.message != message) { this.message = message; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Message"); e.put("class", im.model.Message.class); if (message != null) { e.put("value", message); } notifyObservers(e); } java if (this.contact != contact) { this.contact = contact; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Contact"); e.put("class", im.model.Contact.class); if (contact != null) { e.put("value", contact); } notifyObservers(e); }
java return "* " + super.toString().substring(2); java return password; java if (this.password != password) { this.password = password; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Password"); e.put("class", String.class); if (password != null) { e.put("value", password); } notifyObservers(e); }
java if (getNetwork() != null) { getNetwork().send(this); } java return sender; java return recipient; java return content; java if (this.sender != sender) { this.sender = sender; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Sender"); e.put("class", String.class); if (sender != null) { e.put("value", sender); } notifyObservers(e); } java if (this.recipient != recipient) { this.recipient = recipient; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Recipient"); e.put("class", String.class); if (recipient != null) { e.put("value", recipient); } notifyObservers(e); } java if (this.content != content) { this.content = content; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Content"); e.put("class", Object.class); if (content != null) { e.put("value", content); } notifyObservers(e); }
java return network; java if (this.network != network) { this.network = network; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Network"); e.put("class", im.networking.Network.class); if (network != null) { e.put("value", network); } notifyObservers(e); }
java String[] options = {"im.networking.jabber.mejabber.MEJabber", "im.networking.jabber.defaultjabber.DefaultJabber", "im.networking.sms.SMS", "im.networking.local.Local"}; im.InstantMessagingClient client = im.InstantMessagingClient .getInstance(); for (int i = 0; i < options.length; i++) { try { client.addNetwork((Network) Class.forName(options[i]) .newInstance()); } catch (Exception e) { } } java throw new RuntimeException("login not supported"); java return name; java return recvContact; java return recvMsg; java if (this.name != name) { this.name = name; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "Name"); e.put("class", String.class); if (name != null) { e.put("value", name); } notifyObservers(e); } java if (this.recvContact != recvContact) { this.recvContact = recvContact; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "RecvContact"); e.put("class", im.model.Contact.class); if (recvContact != null) { e.put("value", recvContact); } notifyObservers(e); } java if (this.recvMsg != recvMsg) { this.recvMsg = recvMsg; setChanged(); java.util.Hashtable e = new java.util.Hashtable(); e.put("name", "RecvMsg"); e.put("class", im.model.Message.class); if (recvMsg != null) { e.put("value", recvMsg); } notifyObservers(e); }
java setModel(c); InstantMessagingClient client = InstantMessagingClient.getInstance(); setView(client.getViewFactory().createContactListView()); getView().addListener(this); onContactListAdd();
java int index = getModel().getIndexOfContact(c); if (index > -1) { ContactEdit edit = new ContactEdit(c); insertContactEdit(edit, index); getView().addContact(c, index); } else { ContactEdit edit = getContactEditFor(c); index = getIndexOfContactEdit(edit); getView().removeContact(index); removeContactEdit(edit); }
java getView().setEnabled(false); im.InstantMessagingClient client = im.InstantMessagingClient .getInstance(); im.view.NewContactDialog dlg = client.getViewFactory() .createNewContactDialog(); for (java.util.Enumeration ns = client.getNetworks(); ns .hasMoreElements();) { dlg .addNetwork(((im.networking.Network) ns.nextElement()) .getName()); } dlg.addListener(this);
java int index = getView().getSelectedContact(); if (index > -1) { im.model.Contact c = getModel().getContactAt(index); if (c instanceof im.model.Identity) { im.model.Identity id = (im.model.Identity) c; id.getNetwork().logout(); } else { c.getNetwork().removeContact(c); } getModel().removeContact(c); }
java int index = getView().getSelectedContact(); if (index > -1) { im.model.Contact c = getModel().getContactAt(index); im.InstantMessagingClient client = im.InstantMessagingClient .getInstance(); // reuse existing conversation, if any for (java.util.Enumeration cs = client.getConversations(); cs .hasMoreElements();) { im.model.Conversation conv = (im.model.Conversation) cs .nextElement(); im.model.Contact contact = conv.getContact(); if (contact.equals(c)) { conv.setContact(new im.model.Contact()); conv.setContact(c); return; } } // else new conversation im.model.Conversation conv = new im.model.Conversation(); new ConversationEdit(conv); client.addConversation(conv); conv.setContact(c); }
java if (okClicked) { im.model.Contact c; im.networking.Network n = im.InstantMessagingClient.getInstance() .getNetworkAt(dlg.getNetwork()); if (getModel().getIdentity(n) == null) { im.model.Identity id = new im.model.Identity(); id.setNetwork(n); id.setUserId(dlg.getUid()); id.setName(dlg.getName()); id.setPassword(dlg.getPassword()); c = id; getModel().addContact(c); id.getNetwork().login(id.getUserId(), id.getPassword()); } else { c = new im.model.Contact(); c.setNetwork(n); c.setUserId(dlg.getUid()); c.setName(dlg.getName()); getModel().addContact(c); c.getNetwork().addContact(c); } } getView().setEnabled(true);
java for (java.util.Enumeration ces = getContactEdits(); ces .hasMoreElements();) { ContactEdit ce = (ContactEdit) ces.nextElement(); if (ce.getModel().equals(c)) { return ce; } } return null; java return model; java return view; java return contactEdit.elements(); java if (this.model != null) this.model.deleteObserver(this); this.model = model; if (model != null) model.addObserver(this); java this.view = view; java if (! this.contactEdit.contains(contactEdit)) { this.contactEdit.addElement(contactEdit); contactEdit.setListEdit(this); } java if (this.contactEdit.contains(contactEdit)) { this.contactEdit.removeElement(contactEdit); contactEdit.setListEdit(null); } java try { return (im.edit.ContactEdit) contactEdit.elementAt(index); } catch (ArrayIndexOutOfBoundsException e) { return null; } java return this.contactEdit.indexOf(contactEdit); java if (! this.contactEdit.contains(contactEdit)) { try { this.contactEdit.insertElementAt(contactEdit, index); } catch (ArrayIndexOutOfBoundsException e) { this.contactEdit.addElement(contactEdit); } contactEdit.setListEdit(this); } java if (arg instanceof java.util.Hashtable) { java.util.Hashtable e = (java.util.Hashtable) arg; String mName = "on" + ((String) e.get("name")) + "Change"; Class[] parmTypes = { (Class) e.get("class") }; try { java.lang.reflect.Method m = getClass().getDeclaredMethod(mName, parmTypes); Object[] args = { e.get("value") }; m.invoke(this, args); } catch (NoSuchMethodException nex) { // no handler } catch (Exception ex) { // wrong handler configuration ex.printStackTrace(); } }
java setModel(c);
java onChange();
java onChange();
java int index = getListEdit().getIndexOfContactEdit(this); if (index > -1) { getListEdit().getView().removeContact(index); getListEdit().getView().addContact(getModel(), index); } java return model; java return listEdit; java if (this.model != null) this.model.deleteObserver(this); this.model = model; if (model != null) model.addObserver(this); java if (this.listEdit != listEdit) { if (this.listEdit != null) this.listEdit.removeContactEdit(this); this.listEdit = listEdit; if (listEdit != null) listEdit.addContactEdit(this); } java if (arg instanceof java.util.Hashtable) { java.util.Hashtable e = (java.util.Hashtable) arg; String mName = "on" + ((String) e.get("name")) + "Change"; Class[] parmTypes = { (Class) e.get("class") }; try { java.lang.reflect.Method m = getClass().getDeclaredMethod(mName, parmTypes); Object[] args = { e.get("value") }; m.invoke(this, args); } catch (NoSuchMethodException nex) { // no handler } catch (Exception ex) { // wrong handler configuration ex.printStackTrace(); } }
java setModel(c); im.InstantMessagingClient client = im.InstantMessagingClient .getInstance(); setView(client.getViewFactory().createConversationView()); getView().addListener(this);
java if (m.getContent() instanceof String) { im.model.ContactList list = im.InstantMessagingClient.getInstance() .getContactList(); getView().addContent( list.getUserName(m.getSender()) + ": " + m.getContent()); } else { getView().addContent(m.getContent()); } getView().toFront();
java if (c.getName() != null) { getView().setTitle(c.getName()); } else if (c.getUserId() != null) { getView().setTitle(c.getUserId()); } getView().toFront();
java im.InstantMessagingClient.getInstance().removeConversation(getModel());
java try { im.model.Contact recipient = getModel().getContact(); if (recipient == null) { throw new NullPointerException( "No recipient available in ConversationEdit.onConversationSend()"); } im.model.Contact sender = getSender(recipient); if (sender == null) { throw new NullPointerException( "No sender available in ConversationEdit.onConversationSend()"); } im.model.Message msg = new im.model.Message(); msg.setNetwork(recipient.getNetwork()); msg.setSender(sender.getUserId()); msg.setRecipient(recipient.getUserId()); msg.setContent(getView().getContent()); msg.send(); getModel().setMessage(msg); } catch (Exception e) { im.InstantMessagingClient.getInstance().report(e); }
java im.InstantMessagingClient c = im.InstantMessagingClient.getInstance(); return c.getContactList().getIdentity(recipient.getNetwork()); java return model; java return view; java if (this.model != null) this.model.deleteObserver(this); this.model = model; if (model != null) model.addObserver(this); java this.view = view; java if (arg instanceof java.util.Hashtable) { java.util.Hashtable e = (java.util.Hashtable) arg; String mName = "on" + ((String) e.get("name")) + "Change"; Class[] parmTypes = { (Class) e.get("class") }; try { java.lang.reflect.Method m = getClass().getDeclaredMethod(mName, parmTypes); Object[] args = { e.get("value") }; m.invoke(this, args); } catch (NoSuchMethodException nex) { // no handler } catch (Exception ex) { // wrong handler configuration ex.printStackTrace(); } }
java String[] options = {"im.view.swing.SwingViewFactory", "im.view.awt.AWTViewFactory", "im.view.lcdui.LCDUIViewFactory"}; ViewFactory factory = null; for (int i = 0; i < options.length && factory == null; i++) { try { factory = (ViewFactory) Class.forName(options[i]).newInstance(); } catch (Exception e) { } } return factory;