|
|
|
|
@ -31,15 +31,13 @@
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.MetaContactEvent;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.MetaContactGroupEvent;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.MetaContactListListener;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.MetaContactMovedEvent;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.MetaContactRenamedEvent;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.ProtoContactEvent;
|
|
|
|
|
import net.java.sip.communicator.service.protocol.Contact;
|
|
|
|
|
import net.java.sip.communicator.service.protocol.PresenceStatus;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.ProtoContactEvent;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.
|
|
|
|
|
MetaContactRenamedEvent;
|
|
|
|
|
import net.java.sip.communicator.service.contactlist.event.
|
|
|
|
|
MetaContactMovedEvent;
|
|
|
|
|
|
|
|
|
|
public class ContactList extends JList
|
|
|
|
|
public class ContactList extends JList
|
|
|
|
|
implements MetaContactListListener {
|
|
|
|
|
|
|
|
|
|
private MetaContactListService contactList;
|
|
|
|
|
@ -47,13 +45,13 @@ public class ContactList extends JList
|
|
|
|
|
private ContactListModel listModel;
|
|
|
|
|
|
|
|
|
|
private Hashtable removedContacts = new Hashtable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContactList(MetaContactListService contactList){
|
|
|
|
|
|
|
|
|
|
this.contactList = contactList;
|
|
|
|
|
|
|
|
|
|
this.listModel = new ContactListModel(contactList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setModel(listModel);
|
|
|
|
|
|
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
|
|
|
|
|
@ -68,41 +66,41 @@ public ContactList(MetaContactListService contactList){
|
|
|
|
|
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
|
|
|
|
|
|
|
|
|
this.addKeyListener(new CListKeySearchListener(this));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.contactList.addContactListListener(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes all offline contacts from the contact list.
|
|
|
|
|
*/
|
|
|
|
|
public void removeOfflineContacts(){
|
|
|
|
|
/*
|
|
|
|
|
for(int i = 0; i < listModel.getSize(); i++){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object element = listModel.get(i);
|
|
|
|
|
|
|
|
|
|
if(element instanceof MetaContactNode){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MetaContactNode contactNode = (MetaContactNode)element;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(contactNode.getStatus().equals(Constants.OFFLINE_STATUS)){
|
|
|
|
|
|
|
|
|
|
MetaContactGroup group
|
|
|
|
|
|
|
|
|
|
MetaContactGroup group
|
|
|
|
|
= this.contactList.findParentMetaContactGroup(contactNode.getContact());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.removedContacts.put(contactNode, group);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enumeration removedNodes = this.removedContacts.keys();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(removedNodes.hasMoreElements()){
|
|
|
|
|
this.listModel.removeElement(removedNodes.nextElement());
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds all offline contacts back to the contact list.
|
|
|
|
|
*/
|
|
|
|
|
@ -111,19 +109,19 @@ public void addOfflineContacts(){
|
|
|
|
|
Iterator i = this.removedContacts.entrySet().iterator();
|
|
|
|
|
while(i.hasNext()){
|
|
|
|
|
Map.Entry entry = (Map.Entry)i.next();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.addChild((MetaContactGroup)entry.getValue(), (MetaContactNode)entry.getKey());
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a MetaContact has been added to the
|
|
|
|
|
* MetaContactList.
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactAdded(MetaContactEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -132,7 +130,7 @@ public void metaContactAdded(MetaContactEvent evt) {
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactModified(MetaContactEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -141,7 +139,7 @@ public void metaContactModified(MetaContactEvent evt) {
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactRemoved(MetaContactEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -150,17 +148,16 @@ public void metaContactRemoved(MetaContactEvent evt) {
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactMoved(MetaContactEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a MetaContactGroup has been added.
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactGroupAdded(MetaContactGroupEvent evt) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MetaContactGroup sourceGroup = evt.getSourceMetaContactGroup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.listModel.groupAdded(sourceGroup, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -177,78 +174,73 @@ public void metaContactGroupModified(MetaContactGroupEvent evt) {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a MetaContactGroup has been removed.
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactPropertyChange(MetaContactEvent evt)
|
|
|
|
|
{
|
|
|
|
|
/**@todo implement metaContactModified() */
|
|
|
|
|
System.out.println("@todo implement metaContactModified()");
|
|
|
|
|
public void metaContactGroupRemoved(MetaContactGroupEvent evt) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a MetaContactGroup has been removed.
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactGroupRemoved(MetaContactGroupEvent evt) {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a MetaContact has been modified.
|
|
|
|
|
* @param evt the MetaContactListEvent containing the corresponding contact
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactRenamed(MetaContactRenamedEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a protocol specific <tt>Contact</tt> instance has been
|
|
|
|
|
* added to the list of protocol specific buddies in this
|
|
|
|
|
* <tt>MetaContact</tt>
|
|
|
|
|
* @param evt a reference to the corresponding
|
|
|
|
|
* <tt>ProtoContactEvent</tt>
|
|
|
|
|
*/
|
|
|
|
|
public void protoContactAdded(ProtoContactEvent evt)
|
|
|
|
|
{
|
|
|
|
|
public void protoContactAdded(ProtoContactEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a protocol specific <tt>Contact</tt> instance has been
|
|
|
|
|
* removed from the list of protocol specific buddies in this
|
|
|
|
|
* <tt>MetaContact</tt>
|
|
|
|
|
* @param evt a reference to the corresponding
|
|
|
|
|
* <tt>ProtoContactEvent</tt>
|
|
|
|
|
*/
|
|
|
|
|
public void protoContactRemoved(ProtoContactEvent evt)
|
|
|
|
|
{
|
|
|
|
|
public void protoContactRemoved(ProtoContactEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the order under which the child contacts were ordered
|
|
|
|
|
* inside the source group has changed.
|
|
|
|
|
* @param evt the <tt>MetaContactGroupEvent</tt> containind details of this
|
|
|
|
|
* event.
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a protocol specific <tt>Contact</tt> instance has been
|
|
|
|
|
* moved from within one <tt>MetaContact</tt> to another.
|
|
|
|
|
* @param evt a reference to the <tt>ProtoContactMovedEvent</tt> instance.
|
|
|
|
|
*/
|
|
|
|
|
public void childContactsReordered(MetaContactGroupEvent evt)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public void protoContactMoved(ProtoContactEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a MetaContact has been moved inside the MetaContact list.
|
|
|
|
|
* @param evt the MetaContactListEvent containing the corresponding contact
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactMoved(MetaContactMovedEvent evt)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public void metaContactMoved(MetaContactMovedEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a MetaContact has been modified.
|
|
|
|
|
* @param evt the MetaContactListEvent containing the corresponding contact
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the order under which the child contacts were ordered
|
|
|
|
|
* inside the source group has changed.
|
|
|
|
|
* @param evt the <tt>MetaContactGroupEvent</tt> containind details of this
|
|
|
|
|
* event.
|
|
|
|
|
*/
|
|
|
|
|
public void metaContactRenamed(MetaContactRenamedEvent evt)
|
|
|
|
|
{
|
|
|
|
|
public void childContactsReordered(MetaContactGroupEvent evt) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that a protocol specific <tt>Contact</tt> instance has been
|
|
|
|
|
* moved from within one <tt>MetaContact</tt> to another.
|
|
|
|
|
* @param evt a reference to the <tt>ProtoContactMovedEvent</tt> instance.
|
|
|
|
|
*/
|
|
|
|
|
public void protoContactMoved(ProtoContactEvent evt)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|