Ongoing work on the MetaContactList service

cusax-fix
Emil Ivov 20 years ago
parent 7d65d52b54
commit 1ae591087e

@ -3,6 +3,7 @@
import java.util.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*;
/**
* A Default implementation of a MetaContactGroup. Note that this implementation
@ -26,6 +27,11 @@ public class MetaContactGroupImpl
*/
private final List dummySubgroupsList = new LinkedList();
/**
* The protocol specific group that this groups encapsulates.
*/
private Vector protoGroups = new Vector();
private String groupName = null;
protected MetaContactGroupImpl(String groupName)
@ -161,6 +167,32 @@ public Iterator getSubgroups()
return dummySubgroupsList.iterator();
}
/**
* Returns an <tt>Iterator</tt> over all protocol specific groups that
* this group encapsulates.
* @return Iterator
*/
Iterator getProtoGroups()
{
return protoGroups.iterator();
}
// public void addProtoGroup(ContactGroup group)
/**
* Verifies whether a protocol specific ContactGroup with the specified
* name and originating from the specified provider is encapsulated by this
* MetaContactGroup and if so returns it.
* <p>
* <p>
* @return the <tt>ContactGroup</tt> with the specified name and provider
* or null if no such group exists.
*/
// ContactGroup findContactGroup(String groupName, )
// {
// /** @todo implement findContactGroup() */
// }
/**
* Adds the specified <tt>metaContact</tt> to ths local list of child
* contacts.

@ -50,6 +50,11 @@ public class MetaContactListServiceImpl
*/
Vector currentlyInstalledProviders = new Vector();
/**
* The root of the meta contact list.
*/
RootMetaContactGroupImpl rootMetaGroup = new RootMetaContactGroupImpl();
/**
* Creates an instance of this class.
*/
@ -76,6 +81,8 @@ public MetaContactListServiceImpl()
* This implementation would also start listening for any newly registered
* protocol provider implementations and perform the same algorithm with
* them.
* <p>
* @param bc the currently valid osgi bundle context.
*/
public void start(BundleContext bc)
{
@ -297,6 +304,8 @@ public void removeMetaContactGroup(MetaContactGroup groupToRemove) throws
* <tt>Contact</tt> as its author.
* @return the MetaContact containing the speicified contact or null
* if no such contact is present in this contact list.
* @param contact the protocol specific <tt>contact</tt> that we're looking
* for.
*/
public MetaContact findMetaContactByContact(Contact contact)
{
@ -324,14 +333,16 @@ public MetaContact findMetaContactByID(String metaContactID)
* @param presenceOpSet the presence operation set whose contact list we'd
* like to synchronize with the local contact list.
*/
private void synchronizeWithServerContactList(
private void synchronizeOpSetWithServerContactList(
OperationSetPersistentPresence presenceOpSet)
{
ContactGroup root = presenceOpSet.getServerStoredContactListRoot();
ContactGroup rootProtoGroup
= presenceOpSet.getServerStoredContactListRoot();
// rootMetaGroup.addSubgroup();
logger.trace("subgroups: " + root.countSubGroups());
logger.trace("subgroups: " + rootProtoGroup.countSubGroups());
}
/**
@ -356,7 +367,7 @@ private void handleProviderAdded(ProtocolProviderService provider)
//If we have a persistent presence op set - then retrieve its contat
//list and merge it with the local one.
if( opSetPersPresence != null ){
synchronizeWithServerContactList(opSetPersPresence);
synchronizeOpSetWithServerContactList(opSetPersPresence);
}
/** @todo implement handling non persistent presence operation sets */

@ -158,6 +158,13 @@ public String getGroupName()
return groupName;
}
void addProtocolSpecificGroup()
{
}
/**
* Adds the specified meta group to the subgroups of this one.
* @param subgroup the MetaContactGroup to register as a subgroup to this

@ -26,77 +26,78 @@
/**
* @author Yana Stamcheva
*
* Starts the GUI application using the SkinLookAndFeel of l2fprod.
*
* Starts the GUI application using the SkinLookAndFeel of l2fprod.
*/
public class CommunicatorMain {
private MainFrame mainFrame;
//private MetaContactListService contactList;
public CommunicatorMain(){
this.setDefaultThemePack();
ConfigurationFrame configFrame = new ConfigurationFrame();
mainFrame = new MainFrame(this.getUser(), getContactList());
mainFrame.setConfigFrame(configFrame);
//In order to have the same icon when using option panes
JOptionPane.getRootFrame().setIconImage(ImageLoader.getImage(ImageLoader.SIP_LOGO));
}
/**
* To be removed after the real contact
* To be removed after the real contact
* list is implemented.
*/
public ContactList getContactList(){
ContactList clist = new ContactList();
ContactItem citem1 = new ContactItem("Ivancho");
ContactItem citem2 = new ContactItem("Traiancho");
ContactItem citem3 = new ContactItem("Glupancho");
citem1.setUserIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.USER_ONLINE_ICON)));
citem2.setUserIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.USER_ONLINE_ICON)));
citem3.setUserIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.USER_ONLINE_ICON)));
citem1.setPhoto(ImageLoader.getImage(ImageLoader.DEFAULT_CHAT_USER_PHOTO));
citem2.setPhoto(ImageLoader.getImage(ImageLoader.DEFAULT_CHAT_USER_PHOTO));
citem3.setPhoto(ImageLoader.getImage(ImageLoader.DEFAULT_CHAT_USER_PHOTO));
clist.addContact(citem1);
clist.addContact(citem2);
clist.addContact(citem3);
citem1.setProtocolList(new String[]{"SIP", "ICQ", "MSN"});
citem2.setProtocolList(new String[]{"ICQ"});
citem3.setProtocolList(new String[]{"SIP", "ICQ", "MSN"});
return clist;
}
}
public User getUser(){
User user = new User();
user.setName("Yana");
user.setProtocols(new String[]{"SIP", "ICQ"});
return user;
}
public void setDefaultThemePack(){
try {
SkinLookAndFeel.setSkin(
SkinLookAndFeel.loadThemePackDefinition(new File("src/net/java/sip/communicator/impl/gui/themepacks/aquathemepack/skinlf-themepack.xml").toURL()));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader());
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -105,37 +106,37 @@ public void setDefaultThemePack(){
e.printStackTrace();
}
}
public void setThemePack(String themePack){
try {
if (themePack.endsWith(".xml")) {
SkinLookAndFeel.setSkin(
SkinLookAndFeel.loadThemePackDefinition(new File(themePack).toURL()));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
} else if (themePack.startsWith("class:")) {
String classname = themePack.substring("class:".length());
SkinLookAndFeel.setSkin((Skin)Class.forName(classname).newInstance());
SkinLookAndFeel.setSkin((Skin)Class.forName(classname).newInstance());
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
} else if (themePack.startsWith("theme:")) {
String classname = themePack.substring("theme:".length());
MetalTheme theme = (MetalTheme)Class.forName(classname).newInstance();
MetalLookAndFeel metal = new MetalLookAndFeel();
MetalLookAndFeel metal = new MetalLookAndFeel();
MetalLookAndFeel.setCurrentTheme(theme);
UIManager.setLookAndFeel(metal);
} else {
SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(themePack));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
}
// Decorates the frames and dialogs if we are running with jdk1.4 +
/*
if (OS.isOneDotFourOrMore()) {
java.lang.reflect.Method method = JFrame.class.getMethod(
@ -147,8 +148,8 @@ public void setThemePack(String themePack){
"setDefaultLookAndFeelDecorated",
new Class[] { boolean.class });
method.invoke(null, neif (args.length > 0) {
}*/
}*/
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -157,25 +158,25 @@ public void setThemePack(String themePack){
e.printStackTrace();
}
}
public void show(){
mainFrame.pack();
mainFrame.setVisible(true);
mainFrame.setVisible(true);
}
public static void main(String args[]){
CommunicatorMain communicatorMain = new CommunicatorMain();
communicatorMain.show();
}
/*
public void setContactList(MetaContactListService contactList) {
this.contactList = contactList;
this.mainFrame.setContactList(contactList);
}
*/

@ -20,7 +20,16 @@ public class RootContactGroupIcqImpl
*/
private List dummyContacts = new LinkedList();
// private ProtocolProviderServiceIcqImpl ownerProvider = null;
/**
* Creates a ContactGroup instance.
* @param ownerProvider ProtocolProviderServiceIcqImpl
*/
RootContactGroupIcqImpl()//ProtocolProviderServiceIcqImpl ownerProvider)
{
// this.ownerProvider = ownerProvider;
}
/**
* The ContactListRoot in ICQ is the only group that can contain subgroups.
*
@ -219,4 +228,14 @@ public String toString()
return buff.toString();
}
/**
* Returns the protocol provider that this group belongs to.
* @return a regerence to the ProtocolProviderService instance that this
* ContactGroup belongs to.
*/
// public ProtocolProviderService getProtocolProvider()
// {
// return this.ownerProvider;
// }
}

@ -112,5 +112,4 @@ public MetaContact getMetaContact(int index)
public MetaContactGroup getMetaContactSubgroup(int index)
throws IndexOutOfBoundsException;
}

@ -96,4 +96,11 @@ public interface ContactGroup
* @return a String containing the name of this group.
*/
public String getGroupName();
/**
* Returns the protocol provider that this group belongs to.
* @return a regerence to the ProtocolProviderService instance that this
* ContactGroup belongs to.
*/
// public ProtocolProviderService getProtocolProvider();
}

Loading…
Cancel
Save