Hey Yana and Everybody,
It's only a small example, but here's the current code of the new style of contact information. I had different ideas about how to do things, so before continuing with what I've done, I wanted to see what everyone thinks of my approach. The final idea I ended up going with seemed like a good method, but as I got going, it started to feel a bit explicit, and I'd really appreciate it if people could look at it to see if it is too specific. In the attached zip there are all the Java files that I used and the manifest. To access it within the program, just right click on a contact, pick "New Contact Info" at the bottom, and it'll pop up. As it is now, only ICQ works because that's the only protocol with the OperationSet implemented, but the other's will still pop up a default view.
Here's the basic idea: When activated, a JFrame is created with a left panel, the ContactInfoSearchPanel, and a right panel, the ContactInfoProtocolPanel. In the SearchPanel, there is a text field that will in the future be used to search for other contacts, but for now, it doesn't do anything. Below that, there is a JTable that lists all of the respective protocols and account names of all of the subcontacts of the selected MetaContact. Although it isn't set to do so now, in the future, you'll be able to select each contact from the list, and it will update the information in the ProtocolPanel. I originally made the list sortable, but that was using some convenient methods from a more recent JDK, so I'll have to reimplement that.
The ProtocolPanel is currently split into two areas, but I'm thinking in the future of making it three. At the moment, the top panel contains what should be rather standard information - First name, middle name, last name, gender, and e-mail address. Also, if they have an image associated with them, it will add that to the left side. Below that panel, there is extended information which is just the toString of all other ServerStoredDetails display name and value. Most protocols tend to have one detail that is a generic profile, like Notes in ICQ or the text you have in AIM, so I think I will put a text area below the standard information that shows that. Underneath that area, I'll put the extended information, and I think I'll make it collapsible.
What I'm hoping you'll look at in the ProtocolPanel is how explicit I'm being. I specifically look for certain Details and handle things certain ways and I just want to be sure it's not too specific and I'm not doing anything stupid that seemed like a good idea at the time, but really isn't. I looked through all of the ServerStoredDetails and I made a list of all types that exist that are not just an extension of StringDetail. What I'm planning on doing is adding them in a certain order of priority to extended info, and then finishing with all of the random StringDetails afterwards. Right now, I haven't stylized the special cases yet because I want to be sure that's the right approach and that others agree with me on the priority I set. Here's the list that I made:
BinaryDetail - Special method = byte getBytes()
CalendarDetail - Special method = java.util.Calendar getCalendar()
BooleanDetail - Special method = boolean getBoolean()
LocaleDetail - Special method = java.util.Locale getLocale()
NumberDetail - Special method = java.math.BigDecimal getNumber()
TimeZoneDetail - Special method = java.util.TimeZone getTimeZone()
URLDetail - Special method = java.net.URL
This is the priority I was thinking of:
A question I had in terms of details is, why doesn't ImageDetail extend BinaryDetail? It seems like ImageDetail is maybe referring to a specific avatar of the account and a random BinaryDetail may just be additional pictures associated with the user, but it isn't really clear. I wasn't quite sure how to handle that. Also, if the ProtocolPanel is split into three parts and there's a standardized Notes panel, I think it would be useful to make that into it's own ServerStoredDetail class.
Another thing I noticed is that ICQ users have avatars associated with their accounts, but the ICQ implementation of OperationSetServerStoredContactInfo does not seem to retrieve any pictures. I don't know if that's a mistake or if that's just not finished or what.
There is no functionality for setting your own account information, but I was thinking of adding that next. Rather than having a separate GUI, I was planning on using the same frame and just setting it so that if the user being queried is one of your own accounts, then you will be able to edit the information. My plan, if you agree with how I have been doing it so far, is to display all of the information in TextFields rather than JLabels and just turning edit on and off, depending on whether or not it is your own account, and adding a submit button to the bottom.
I hope this runs alright for you and I'm sorry if it's a bit open ended, too basic, or if I've made terrible mistakes. Thank you very much for looking at all of this and please let me know whatever you think of it.
Contact Info 06-25-2007.zip (179 KB)