diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-09-02 10:40:06 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-09-02 10:40:06 +0000 |
commit | c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3 (patch) | |
tree | e31537f4f524656809fe4775d8f7e33a4776298c | |
parent | 400fe1b68bcc3dbd72733053193fc6722e3a8451 (diff) | |
download | jitsi-c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3.zip jitsi-c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3.tar.gz jitsi-c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3.tar.bz2 |
Commits the second patch of Sebastien Vincent in the dev mailing list thread "Fix lot of warnings in the code" which fixes multiple compiler warnings.
37 files changed, 476 insertions, 631 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java index 8fe9b0e..1a8d84c 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java @@ -32,7 +32,7 @@ public class SIPCommSmartComboBox */ public SIPCommSmartComboBox() { - setModel(new FilterableComboBoxModel(new ArrayList())); + setModel(new FilterableComboBoxModel()); setEditor(new CallComboEditor()); setEditable(true); setFocusable(true); @@ -46,16 +46,16 @@ public class SIPCommSmartComboBox extends AbstractListModel implements MutableComboBoxModel { - - private List items; + private final List<Object> items; private Filter filter; - private List filteredItems; + private final List<Object> filteredItems; private Object selectedItem; - public FilterableComboBoxModel(List items) + public FilterableComboBoxModel() { - this.items = new ArrayList(items); - filteredItems = new ArrayList(items.size()); + this.items = new ArrayList<Object>(); + this.filteredItems = new ArrayList<Object>(this.items.size()); + updateFilteredItems(); } diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java index 7ffdb7b..7621940 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java @@ -288,24 +288,21 @@ public class NotificationServiceImpl * an event with the specified name has occurred, or null if no actions * have been defined for <tt>eventType</tt>. */ - public Map getEventNotifications(String eventType) + public Map<String, NotificationActionHandler> getEventNotifications(String eventType) { EventNotification notification = notificationsTable.get(eventType); if(notification == null) return null; - // TODO: cleanup mixed usage of different classes/objects in hashtable - // Cleanup together with NotificationService and NotificationConfigurationPanel - Hashtable actions = new Hashtable(); + Hashtable<String, NotificationActionHandler> actions = new Hashtable<String, NotificationActionHandler>(); for (Object value : notification.getActions().values()) { Action action = (Action) value; NotificationActionHandler handler = action.getActionHandler(); - actions.put(action.getActionType(), (handler == null) ? "" - : handler); + actions.put(action.getActionType(), handler); } return actions; @@ -1059,41 +1056,28 @@ public class NotificationServiceImpl */ public void restoreDefaults() { - Set<String> eventTypes = - ((Hashtable<String, EventNotification>) notificationsTable.clone()) - .keySet(); - - for (String eventType : eventTypes) + for (String eventType : new Vector<String>(notificationsTable.keySet())) { EventNotification notification = notificationsTable.get(eventType); - Vector<String> actionsToRemove = new Vector<String>(notification.getActions().keySet()); - Iterator<String> actionIter = actionsToRemove.iterator(); - while (actionIter.hasNext()) - { - String actionType = actionIter.next(); - + for (String actionType + : new Vector<String>(notification.getActions().keySet())) removeEventNotificationAction(eventType, actionType); - } removeEventNotification(eventType); } - for (Map.Entry<String, EventNotification> entry : defaultNotificationsTable.entrySet()) + for (Map.Entry<String, EventNotification> entry + : defaultNotificationsTable.entrySet()) { String eventType = entry.getKey(); EventNotification notification = entry.getValue(); - Iterator<String> actionIter = notification.getActions().keySet().iterator(); - while (actionIter.hasNext()) - { - String actionType = actionIter.next(); - + for (String actionType : notification.getActions().keySet()) registerNotificationForEvent( eventType, actionType, notification.getAction(actionType).getActionHandler()); - } } } } diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java index 3e85a41..94d8233 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java @@ -20,7 +20,6 @@ import net.kano.joustsim.oscar.oscar.service.chatrooms.*; * * @author Rupert Burchardi */ -@SuppressWarnings("unchecked") public class ChatRoomIcqImpl implements ChatRoom { private static final Logger logger = Logger @@ -30,45 +29,52 @@ public class ChatRoomIcqImpl implements ChatRoom * Listeners that will be notified of changes in member status in the * room such as member joined, left or being kicked or dropped. */ - private Vector memberListeners = new Vector(); + private final List<ChatRoomMemberPresenceListener> memberListeners + = new Vector<ChatRoomMemberPresenceListener>(); /** * Listeners that will be notified of changes in member role in the * room such as member being granted admin permissions, or revoked admin * permissions. */ - private Vector memberRoleListeners = new Vector(); + private final List<ChatRoomMemberRoleListener> memberRoleListeners + = new Vector<ChatRoomMemberRoleListener>(); /** * Listeners that will be notified of changes in local user role in the * room such as member being granted admin permissions, or revoked admin * permissions. */ - private Vector localUserRoleListeners = new Vector(); + private final List<ChatRoomLocalUserRoleListener> localUserRoleListeners + = new Vector<ChatRoomLocalUserRoleListener>(); /** * Listeners that will be notified every time * a new message is received on this chat room. */ - private Vector messageListeners = new Vector(); + private final List<ChatRoomMessageListener> messageListeners + = new Vector<ChatRoomMessageListener>(); /** * Listeners that will be notified every time * a chat room property has been changed. */ - private Vector propertyChangeListeners = new Vector(); + private Vector<ChatRoomPropertyChangeListener> propertyChangeListeners + = new Vector<ChatRoomPropertyChangeListener>(); /** * Listeners that will be notified every time * a chat room member property has been changed. */ - private Vector memberPropChangeListeners = new Vector(); + private final List<ChatRoomMemberPropertyChangeListener> memberPropChangeListeners + = new Vector<ChatRoomMemberPropertyChangeListener>(); /** * Chat room invitation from the icq provider, needed for joining a * chat room. */ private ChatInvitation chatInvitation = null; + /** * Chat room session from the icq provider, we get this after joining a * chat room. @@ -79,7 +85,7 @@ public class ChatRoomIcqImpl implements ChatRoom /** * The list of members of this chat room. */ - private Hashtable members = new Hashtable(); + private Hashtable<String, ChatRoomMember> members = new Hashtable<String, ChatRoomMember>(); /** * The operation set that created us. @@ -90,12 +96,11 @@ public class ChatRoomIcqImpl implements ChatRoom * The protocol provider that created us */ private ProtocolProviderServiceIcqImpl provider = null; - /** * List with invitations. */ - private Hashtable<String, String> inviteUserList = new Hashtable(); + private Hashtable<String, String> inviteUserList = new Hashtable<String, String>(); /** * Invitation message text. @@ -175,10 +180,10 @@ public class ChatRoomIcqImpl implements ChatRoom */ public void addLocalUserRoleListener(ChatRoomLocalUserRoleListener listener) { - synchronized (propertyChangeListeners) + synchronized (localUserRoleListeners) { - if (!propertyChangeListeners.contains(listener)) - propertyChangeListeners.add(listener); + if (!localUserRoleListeners.contains(listener)) + localUserRoleListeners.add(listener); } } @@ -218,7 +223,7 @@ public class ChatRoomIcqImpl implements ChatRoom /** * Adds a listener that will be notified of changes of a member role in the - * room such as being granded operator. + * room such as being granted operator. * * @param listener a member role listener. */ @@ -310,17 +315,18 @@ public class ChatRoomIcqImpl implements ChatRoom */ public Message createMessage(String messageText) { - Message msg = new MessageIcqImpl(messageText, - OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE, - OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING, null); - - return msg; + return + new MessageIcqImpl( + messageText, + OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE, + OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING, + null); } /** * Returns the list of banned users. */ - public Iterator getBanList() throws OperationFailedException + public Iterator<ChatRoomMember> getBanList() throws OperationFailedException { throw new OperationFailedException( "This operation cannot be performed in the ICQ network.", @@ -363,9 +369,9 @@ public class ChatRoomIcqImpl implements ChatRoom * @return a <tt>List</tt> of <tt>Contact</tt> corresponding to all room * members. */ - public List getMembers() + public List<ChatRoomMember> getMembers() { - return new LinkedList(members.values()); + return new LinkedList<ChatRoomMember>(members.values()); } /** @@ -522,7 +528,7 @@ public class ChatRoomIcqImpl implements ChatRoom public void joinAs(String nickname, byte[] password) throws OperationFailedException { - + // TODO Auto-generated method stub } /** @@ -592,18 +598,11 @@ public class ChatRoomIcqImpl implements ChatRoom chatRoomSession = null; } - Iterator membersSet = members.entrySet().iterator(); - - while (membersSet.hasNext()) - { - Map.Entry memberEntry = (Map.Entry) membersSet.next(); - - ChatRoomMember member = (ChatRoomMember) memberEntry.getValue(); - - fireMemberPresenceEvent(member, - ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, - "Local user has left the chat room."); - } + for (ChatRoomMember member : members.values()) + fireMemberPresenceEvent( + member, + ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, + "Local user has left the chat room."); // Delete the list of members members.clear(); @@ -777,17 +776,14 @@ public class ChatRoomIcqImpl implements ChatRoom */ public void fireMessageEvent(EventObject evt) { - Iterator listeners = null; + Iterable<ChatRoomMessageListener> listeners; synchronized (messageListeners) { - listeners = new ArrayList(messageListeners).iterator(); + listeners = new ArrayList<ChatRoomMessageListener>(messageListeners); } - while (listeners.hasNext()) + for (ChatRoomMessageListener listener : listeners) { - ChatRoomMessageListener listener - = (ChatRoomMessageListener) listeners.next(); - if (evt instanceof ChatRoomMessageDeliveredEvent) { listener.messageDelivered((ChatRoomMessageDeliveredEvent) evt); @@ -824,19 +820,15 @@ public class ChatRoomIcqImpl implements ChatRoom logger.trace("Will dispatch the following ChatRoom event: " + evt); - Iterator listeners = null; + Iterable<ChatRoomMemberPresenceListener> listeners; synchronized (memberListeners) { - listeners = new ArrayList(memberListeners).iterator(); + listeners + = new ArrayList<ChatRoomMemberPresenceListener>(memberListeners); } - while (listeners.hasNext()) - { - ChatRoomMemberPresenceListener listener - = (ChatRoomMemberPresenceListener) listeners.next(); - + for (ChatRoomMemberPresenceListener listener : listeners) listener.memberPresenceChanged(evt); - } } /** @@ -844,14 +836,13 @@ public class ChatRoomIcqImpl implements ChatRoom * users that leave or join the chat room. * */ - - private class ChatRoomSessionListenerImpl implements - ChatRoomSessionListener + private class ChatRoomSessionListenerImpl + implements ChatRoomSessionListener { /** * The chat room this listener is for. */ - private ChatRoomIcqImpl chatRoom = null; + private final ChatRoomIcqImpl chatRoom; /** * Constructor for this listener, needed to set the chatRoom. @@ -987,11 +978,8 @@ public class ChatRoomIcqImpl implements ChatRoom private void updateMemberList( Set<ChatRoomUser> chatRoomUserSet, boolean removeMember) { - Iterator it = chatRoomUserSet.iterator(); - - while (it.hasNext()) + for (ChatRoomUser user : chatRoomUserSet) { - ChatRoomUser user = (ChatRoomUser) it.next(); String uid = user.getScreenname().getFormatted(); //we want to add a member and he/she is not in our member list diff --git a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java index 46994dc..da5b19a 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java @@ -151,7 +151,7 @@ public class InfoRetreiver */ private class UserInfoResponseRetriever extends SnacRequestAdapter { - int requestID; + private final int requestID; List<GenericDetail> result = null; UserInfoResponseRetriever(int requestID) @@ -588,6 +588,6 @@ public class InfoRetreiver */ private void readAffilationsUserInfo(MetaAffiliationsInfoCmd cmd) { -// Vector infoData = getInfoForRequest(cmd.getId()); +// Vector<GenericDetail> infoData = getInfoForRequest(cmd.getId()); } } diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java index b177031..38d7c88 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java @@ -126,4 +126,4 @@ public class OperationSetServerStoredContactInfoIcqImpl "The icq provider must be signed on the ICQ service before " +"being able to communicate."); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java b/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java index 9b2ea0e..a8df083 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java @@ -17,9 +17,12 @@ import net.kano.joustsim.oscar.oscar.service.ssi.*; class VolatileGroup implements MutableGroup { - private String groupName = new String("NotInContactList"); + private final String groupName; - VolatileGroup(){} + VolatileGroup() + { + this("NotInContactList"); + } VolatileGroup(String groupName) { @@ -38,12 +41,11 @@ class VolatileGroup public void addGroupListener(GroupListener listener){} - public List getBuddiesCopy(){return null;} + public List<Buddy> getBuddiesCopy(){return null;} public void removeGroupListener(GroupListener listener){} - public void copyBuddies(List buddies){} - public void deleteBuddies(List ingroup){} + public void deleteBuddies(List<Buddy> ingroup){} public void addBuddy(String screenname){} - public void copyBuddies(Collection buddies){} + public void copyBuddies(Collection<? extends Buddy> buddies){} public void deleteBuddy(Buddy buddy){} public void rename(String newName){} } diff --git a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java index 490861f..baba58e 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java @@ -10,7 +10,6 @@ import java.util.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; -import net.java.sip.communicator.util.*; /** * Allows creating, configuring, joining and administering of individual @@ -24,9 +23,6 @@ import net.java.sip.communicator.util.*; public class OperationSetMultiUserChatIrcImpl extends AbstractOperationSetMultiUserChat { - private static final Logger logger - = Logger.getLogger(OperationSetMultiUserChatIrcImpl.class); - /** * A call back to the IRC provider that created us. */ @@ -90,18 +86,18 @@ public class OperationSetMultiUserChatIrcImpl * @return a <tt>List</tt> of the rooms where the user has joined using a * given connection. */ - public List getCurrentlyJoinedChatRooms() + public List<ChatRoom> getCurrentlyJoinedChatRooms() { synchronized(chatRoomCache) { - List joinedRooms - = new LinkedList(this.chatRoomCache.values()); + List<ChatRoom> joinedRooms + = new LinkedList<ChatRoom>(this.chatRoomCache.values()); - Iterator joinedRoomsIter = joinedRooms.iterator(); + Iterator<ChatRoom> joinedRoomsIter = joinedRooms.iterator(); while (joinedRoomsIter.hasNext()) { - if ( !( (ChatRoom) joinedRoomsIter.next()).isJoined()) + if (!joinedRoomsIter.next().isJoined()) joinedRoomsIter.remove(); } @@ -118,7 +114,7 @@ public class OperationSetMultiUserChatIrcImpl * @return a list of the chat rooms that <tt>chatRoomMember</tt> has joined * and is currently active in. */ - public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) + public List<String> getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) { //TODO: Implement "who is" for the IRC stack. return null; diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java index 3795e2f..5312817 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java @@ -8,6 +8,10 @@ package net.java.sip.communicator.impl.protocol.jabber; import java.util.*; +import net.java.sip.communicator.service.protocol.*; + +import org.jivesoftware.smack.*; + /** * The Jabber implementation of the Volatile ContactGroup interface. * @@ -19,7 +23,7 @@ public class VolatileContactGroupJabberImpl /** * This contact group name */ - private String contactGroupName = null; + private final String contactGroupName; /** * Creates an Jabber group using the specified group name @@ -31,7 +35,8 @@ public class VolatileContactGroupJabberImpl String groupName, ServerStoredContactListJabberImpl ssclCallback) { - super(null, new Vector().iterator(), ssclCallback, false); + super(null, new Vector<RosterEntry>().iterator(), ssclCallback, false); + this.contactGroupName = groupName; } @@ -55,10 +60,10 @@ public class VolatileContactGroupJabberImpl buff.append(getGroupName()); buff.append(", childContacts="+countContacts()+":["); - Iterator contacts = contacts(); + Iterator<Contact> contacts = contacts(); while (contacts.hasNext()) { - ContactJabberImpl contact = (ContactJabberImpl) contacts.next(); + Contact contact = contacts.next(); buff.append(contact.toString()); if(contacts.hasNext()) buff.append(", "); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java index bbc2d20..2698b29 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java @@ -37,12 +37,14 @@ public class WhiteboardSessionJabberImpl /** * A list of listeners registered for message events. */ - private Vector messageListeners = new Vector(); + private Vector<WhiteboardObjectListener> messageListeners + = new Vector<WhiteboardObjectListener>(); /** * A list containing all <tt>WhiteboardParticipant</tt>s of this session. */ - private Hashtable wbParticipants = new Hashtable(); + private Hashtable<String, WhiteboardParticipant> wbParticipants + = new Hashtable<String, WhiteboardParticipant>(); /** * The state that this white-board is currently in. @@ -64,13 +66,14 @@ public class WhiteboardSessionJabberImpl * A list of all listeners currently registered for * <tt>WhiteboardChangeEvent</tt>s */ - private Vector whiteboardListeners = new Vector(); + private Vector<WhiteboardChangeListener> whiteboardListeners + = new Vector<WhiteboardChangeListener>(); /** * Stores all white board objects contained in this session. */ - private final Vector<WhiteboardObjectJabberImpl> whiteboardObjects - = new Vector<WhiteboardObjectJabberImpl>(); + private final Vector<WhiteboardObject> whiteboardObjects + = new Vector<WhiteboardObject>(); /** * The <tt>OperationSet</tt> charged with the whiteboarding. @@ -107,9 +110,11 @@ public class WhiteboardSessionJabberImpl * @return an Iterator over all participants currently involved in the * white-board. */ - public Iterator getWhiteboardParticipants() + public Iterator<WhiteboardParticipant> getWhiteboardParticipants() { - return new LinkedList(wbParticipants.values()).iterator(); + return + new LinkedList<WhiteboardParticipant>(wbParticipants.values()) + .iterator(); } /** @@ -279,10 +284,9 @@ public class WhiteboardSessionJabberImpl */ public void participantStateChanged(WhiteboardParticipantChangeEvent evt) { - if (((WhiteboardParticipantState) evt.getNewValue()) - == WhiteboardParticipantState.DISCONNECTED - || ((WhiteboardParticipantState) evt.getNewValue()) - == WhiteboardParticipantState.FAILED) + Object newValue = evt.getNewValue(); + if ((newValue== WhiteboardParticipantState.DISCONNECTED) + || (newValue == WhiteboardParticipantState.FAILED)) { removeWhiteboardParticipant((WhiteboardParticipantJabberImpl) evt .getSourceWhiteboardParticipant()); @@ -564,13 +568,13 @@ public class WhiteboardSessionJabberImpl public void deleteWhiteboardObject(WhiteboardObject obj) throws OperationFailedException { - Iterator participants = getWhiteboardParticipants(); + Iterator<WhiteboardParticipant> participants + = getWhiteboardParticipants(); if (!participants.hasNext()) return; WhiteboardParticipantJabberImpl participant = (WhiteboardParticipantJabberImpl) participants.next(); - Contact contact = participant.getContact(); try @@ -601,7 +605,7 @@ public class WhiteboardSessionJabberImpl int i = 0; while (i < whiteboardObjects.size()) { - WhiteboardObjectJabberImpl wbObj = whiteboardObjects.get(i); + WhiteboardObjectJabberImpl wbObj = (WhiteboardObjectJabberImpl)whiteboardObjects.get(i); if (wbObj.getID().equals(obj.getID())) whiteboardObjects.remove(i); else @@ -629,14 +633,14 @@ public class WhiteboardSessionJabberImpl public void sendWhiteboardObject(WhiteboardObject message) throws OperationFailedException { - Iterator participants = getWhiteboardParticipants(); + Iterator<WhiteboardParticipant> participants + = getWhiteboardParticipants(); if (!participants.hasNext()) return; WhiteboardParticipantJabberImpl participant = (WhiteboardParticipantJabberImpl) participants.next(); - Contact contact = participant.getContact(); try @@ -786,7 +790,6 @@ public class WhiteboardSessionJabberImpl public void fireWhiteboardParticipantEvent( WhiteboardParticipant sourceWhiteboardParticipant, int eventID) { - WhiteboardParticipantEvent cpEvent = new WhiteboardParticipantEvent(this, sourceWhiteboardParticipant, eventID); @@ -795,17 +798,15 @@ public class WhiteboardSessionJabberImpl + whiteboardListeners.size() + " listeners. event is: " + cpEvent.toString()); - Iterator listeners = null; + Iterable<WhiteboardChangeListener> listeners; synchronized (whiteboardListeners) { - listeners = new ArrayList(whiteboardListeners).iterator(); + listeners + = new ArrayList<WhiteboardChangeListener>(whiteboardListeners); } - while (listeners.hasNext()) + for (WhiteboardChangeListener listener : listeners) { - WhiteboardChangeListener listener = - (WhiteboardChangeListener) listeners.next(); - if (eventID == WhiteboardParticipantEvent .WHITEBOARD_PARTICIPANT_ADDED) @@ -818,7 +819,6 @@ public class WhiteboardSessionJabberImpl { listener.whiteboardParticipantRemoved(cpEvent); } - } } @@ -844,17 +844,15 @@ public class WhiteboardSessionJabberImpl + whiteboardListeners.size() + " listeners. event is: " + ccEvent.toString()); - Iterator listeners = null; + Iterable<WhiteboardChangeListener> listeners; synchronized (whiteboardListeners) { - listeners = new ArrayList(whiteboardListeners).iterator(); + listeners + = new ArrayList<WhiteboardChangeListener>(whiteboardListeners); } - while (listeners.hasNext()) + for (WhiteboardChangeListener listener : listeners) { - WhiteboardChangeListener listener = - (WhiteboardChangeListener) listeners.next(); - if (type.equals(WhiteboardChangeEvent.WHITEBOARD_STATE_CHANGE)) listener.whiteboardStateChanged(ccEvent); } @@ -865,7 +863,7 @@ public class WhiteboardSessionJabberImpl * @return an <tt>Vector</tt> of WhiteboardObjects associated * with this whiteboard. */ - public Vector getWhiteboardObjects() + public Vector<WhiteboardObject> getWhiteboardObjects() { return whiteboardObjects; } @@ -903,17 +901,15 @@ public class WhiteboardSessionJabberImpl + messageListeners.size() + " listeners. event is: " + evt.toString()); - Iterator listeners = null; + Iterable<WhiteboardObjectListener> listeners; synchronized (messageListeners) { - listeners = new ArrayList(messageListeners).iterator(); + listeners + = new ArrayList<WhiteboardObjectListener>(messageListeners); } - while (listeners.hasNext()) + for (WhiteboardObjectListener listener : listeners) { - WhiteboardObjectListener listener = - (WhiteboardObjectListener) listeners.next(); - if (evt instanceof WhiteboardObjectDeliveredEvent) { listener.whiteboardObjectDelivered( @@ -940,7 +936,7 @@ public class WhiteboardSessionJabberImpl int i = 0; while (i < whiteboardObjects.size()) { - WhiteboardObjectJabberImpl wbObj = whiteboardObjects.get(i); + WhiteboardObjectJabberImpl wbObj = (WhiteboardObjectJabberImpl)whiteboardObjects.get(i); if (wbObj.getID().equals(wbObjID)) whiteboardObjects.remove(i); else @@ -975,7 +971,7 @@ public class WhiteboardSessionJabberImpl int i = 0; while (i < whiteboardObjects.size()) { - WhiteboardObjectJabberImpl wbObjTmp = whiteboardObjects.get(i); + WhiteboardObjectJabberImpl wbObjTmp = (WhiteboardObjectJabberImpl)whiteboardObjects.get(i); if (wbObjTmp.getID().equals(ws.getID())) { wbObj = wbObjTmp; @@ -1259,17 +1255,9 @@ public class WhiteboardSessionJabberImpl private WhiteboardParticipant findWhiteboardParticipantFromContactAddress( String contactAddress) { - Enumeration participants = wbParticipants.elements(); - - while(participants.hasMoreElements()) - { - WhiteboardParticipant participant - = (WhiteboardParticipant) participants.nextElement(); - + for (WhiteboardParticipant participant : wbParticipants.values()) if (participant.getContactAddress().equals(contactAddress)) return participant; - } - return null; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java index a943a40..f715378 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java @@ -4,20 +4,21 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; -import net.java.sip.communicator.util.*; -import java.awt.Color; +import java.awt.*; import java.io.*; -import java.util.LinkedList; +import java.util.*; import java.util.List; import java.util.regex.*; + import javax.xml.parsers.*; -import org.w3c.dom.*; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; +import net.java.sip.communicator.util.*; + +import org.w3c.dom.*; /** * WhiteboardObjectPathJabberImpl @@ -38,7 +39,8 @@ public class WhiteboardObjectPathJabberImpl /** * List of WhiteboardPoint */ - private LinkedList listPoints = new LinkedList (); + private List<WhiteboardPoint> listPoints + = new LinkedList<WhiteboardPoint>(); /** * Default WhiteboardObjectPathJabberImpl constructor. @@ -101,9 +103,9 @@ public class WhiteboardObjectPathJabberImpl * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points) + public void setPoints (List<WhiteboardPoint> points) { - this.listPoints = new LinkedList (points); + this.listPoints = new LinkedList<WhiteboardPoint>(points); } /** @@ -112,7 +114,7 @@ public class WhiteboardObjectPathJabberImpl * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints () + public List<WhiteboardPoint> getPoints () { return this.listPoints; } @@ -125,9 +127,9 @@ public class WhiteboardObjectPathJabberImpl * of WhiteboardPoint. * @return a LinkedList (WhiteboardPoint) of the String points parameter */ - private List getPathPoints (String points) + private List<WhiteboardPoint> getPathPoints (String points) { - List list = new LinkedList (); + List<WhiteboardPoint> list = new LinkedList<WhiteboardPoint>(); if (points == null) { return list; @@ -149,7 +151,7 @@ public class WhiteboardObjectPathJabberImpl } /** - * Returns the XML reppresentation of the PacketExtension. + * Returns the XML representation of the PacketExtension. * * @return the packet extension as XML. * @todo Implement this org.jivesoftware.smack.packet.PacketExtension @@ -169,7 +171,7 @@ public class WhiteboardObjectPathJabberImpl int size = listPoints.size (); for (int i = 0; i < size; i++) { - WhiteboardPoint point = (WhiteboardPoint) listPoints.get (i); + WhiteboardPoint point = listPoints.get (i); sb.append ((i == 0) ? "M" : "L"); sb.append (point.getX ()); sb.append (" "); @@ -179,4 +181,4 @@ public class WhiteboardObjectPathJabberImpl s = s.replaceAll ("#p", sb.toString ()); return s; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java index d29feae..cba8dae 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java @@ -4,17 +4,20 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard; -import net.java.sip.communicator.util.*; -import java.awt.Color; +import java.awt.*; import java.io.*; import java.util.*; +import java.util.List; + import javax.xml.parsers.*; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; -import org.w3c.dom.*; + +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; +import net.java.sip.communicator.util.*; + +import org.w3c.dom.*; /** * WhiteboardObjectPolyLineJabberImpl @@ -35,7 +38,8 @@ public class WhiteboardObjectPolyLineJabberImpl /** * list of WhiteboardPoint */ - private LinkedList listPoints = new LinkedList (); + private List<WhiteboardPoint> listPoints + = new LinkedList<WhiteboardPoint>(); /** * Default WhiteboardObjectPolyLineJabberImpl constructor. @@ -99,9 +103,9 @@ public class WhiteboardObjectPolyLineJabberImpl * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points) + public void setPoints (List<WhiteboardPoint> points) { - this.listPoints = new LinkedList (points); + this.listPoints = new LinkedList<WhiteboardPoint>(points); } /** @@ -110,7 +114,7 @@ public class WhiteboardObjectPolyLineJabberImpl * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints () + public List<WhiteboardPoint> getPoints () { return this.listPoints; } @@ -124,9 +128,9 @@ public class WhiteboardObjectPolyLineJabberImpl * * @return a List of the String points parameter */ - private List getPolyPoints (String points) + private List<WhiteboardPoint> getPolyPoints (String points) { - List list = new LinkedList (); + List<WhiteboardPoint> list = new LinkedList<WhiteboardPoint>(); if (points == null) { return list; @@ -167,7 +171,7 @@ public class WhiteboardObjectPolyLineJabberImpl for (int i = 0; i < listPoints.size (); i++) { - WhiteboardPoint point = (WhiteboardPoint) listPoints.get (i); + WhiteboardPoint point = listPoints.get (i); sb.append (point.getX ()); sb.append (","); sb.append (point.getY ()); @@ -176,4 +180,4 @@ public class WhiteboardObjectPolyLineJabberImpl s = s.replaceAll ("#p", sb.toString ()); return s; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java index 0f94550..7ea722d 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java @@ -4,17 +4,20 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard; -import net.java.sip.communicator.util.*; -import java.awt.Color; +import java.awt.*; import java.io.*; import java.util.*; +import java.util.List; + import javax.xml.parsers.*; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; -import org.w3c.dom.*; + +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; +import net.java.sip.communicator.util.*; + +import org.w3c.dom.*; /** * WhiteboardObjectPolygonJabberImpl @@ -35,7 +38,8 @@ public class WhiteboardObjectPolygonJabberImpl /** * list of WhiteboardPoint */ - private LinkedList listPoints = new LinkedList (); + private List<WhiteboardPoint> listPoints + = new LinkedList<WhiteboardPoint>(); /** * True is filled, false is unfilled. @@ -110,9 +114,9 @@ public class WhiteboardObjectPolygonJabberImpl * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points) + public void setPoints (List<WhiteboardPoint> points) { - this.listPoints = new LinkedList (points); + this.listPoints = new LinkedList<WhiteboardPoint>(points); } /** @@ -121,7 +125,7 @@ public class WhiteboardObjectPolygonJabberImpl * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints () + public List<WhiteboardPoint> getPoints () { return this.listPoints; } @@ -134,9 +138,9 @@ public class WhiteboardObjectPolygonJabberImpl * List of <tt>WhiteboardPoint</tt>. * @return a List of the String points parameter */ - private List getPolyPoints (String points) + private List<WhiteboardPoint> getPolyPoints (String points) { - List list = new LinkedList (); + List<WhiteboardPoint> list = new LinkedList<WhiteboardPoint>(); if (points == null) { return list; @@ -204,7 +208,7 @@ public class WhiteboardObjectPolygonJabberImpl } /** - * Returns the XML reppresentation of the PacketExtension. + * Returns the XML representation of the PacketExtension. * * @return the packet extension as XML. * @todo Implement this org.jivesoftware.smack.packet.PacketExtension @@ -223,7 +227,7 @@ public class WhiteboardObjectPolygonJabberImpl for (int i = 0; i < listPoints.size (); i++) { - WhiteboardPoint point = (WhiteboardPoint) listPoints.get (i); + WhiteboardPoint point = listPoints.get (i); sb.append (point.getX ()); sb.append (","); sb.append (point.getY ()); @@ -232,4 +236,4 @@ public class WhiteboardObjectPolygonJabberImpl s = s.replaceAll ("#p", sb.toString ()); return s; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java index 51021f0..ecf6015 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java @@ -413,34 +413,21 @@ public class ContactGroupRssImpl return buff.append("]").toString(); } - public Vector getRssURLList(Vector rssURLList){ - //private Vector rssURLList; - //StringBuffer buff = new StringBuffer(getGroupName()); - //buff.append(".subGroups=" + countSubgroups() + ":\n"); - + public void getRssURLList(List<ContactRssImpl> rssURLList) + { Iterator<ContactGroup> subGroups = subgroups(); while (subGroups.hasNext()) { ContactGroupRssImpl group = (ContactGroupRssImpl)subGroups.next(); - //buff.append( - group.getRssURLList(rssURLList); - // if (subGroups.hasNext()) - // buff.append("\n"); + group.getRssURLList(rssURLList); } - //buff.append("\nChildContacts="+countContacts()+":["); - Iterator<Contact> contacts = contacts(); while (contacts.hasNext()) { ContactRssImpl contact = (ContactRssImpl) contacts.next(); - //buff.append(contact.getDisplayName()); - rssURLList.addElement(contact); - //if(contacts.hasNext()) - // buff.append(", "); + rssURLList.add(contact); } - //return buff.append("]").toString(); - return rssURLList; } /** diff --git a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java index 2585fc3..9b4bce5 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java @@ -203,13 +203,11 @@ public class OperationSetBasicInstantMessagingRssImpl */ public void refreshAllRssFeeds() { - Vector rssContactList = new Vector(); - rssContactList = opSetPersPresence.getContactListRoot(). - getRssURLList(rssContactList); - Iterator rssContact = rssContactList.iterator(); - while(rssContact.hasNext()) + Vector<ContactRssImpl> rssContactList = new Vector<ContactRssImpl>(); + opSetPersPresence.getContactListRoot().getRssURLList(rssContactList); + + for (ContactRssImpl contact : rssContactList) { - ContactRssImpl contact = (ContactRssImpl)rssContact.next(); try { submitRssQuery(contact, false); diff --git a/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java b/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java index de522ca..bb775b8 100644 --- a/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java +++ b/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java @@ -17,9 +17,9 @@ import javax.swing.*; */ public class CallListModel extends AbstractListModel { - private LinkedList callList = new LinkedList(); + private final LinkedList<Object> callList = new LinkedList<Object>(); - private Hashtable closedDates = new Hashtable(); + private final Map<Object, Object> closedDates = new Hashtable<Object, Object>(); /** * Closes the given date by hiding all containing calls. @@ -31,7 +31,7 @@ public class CallListModel extends AbstractListModel int startIndex = this.indexOf(date); int endIndex = startIndex; int currentSize = getSize(); - Collection c = new ArrayList(); + Collection<Object> c = new ArrayList<Object>(); for(int i = startIndex + 1; i < currentSize; i ++) { Object o = this.getElementAt(i); @@ -57,19 +57,22 @@ public class CallListModel extends AbstractListModel { int startIndex = this.indexOf(date); int endIndex = startIndex; - Hashtable closedDatesCopy = (Hashtable)closedDates.clone(); - - if(closedDatesCopy.containsValue(date)) { - Iterator dates = closedDatesCopy.entrySet().iterator(); + + if (closedDates.containsValue(date)) + { + Iterator<Map.Entry<Object, Object>> dates + = closedDates.entrySet().iterator(); - while(dates.hasNext()) { - Map.Entry entry = (Map.Entry)dates.next(); + while (dates.hasNext()) + { + Map.Entry<Object, Object> entry = dates.next(); Object callRecord = entry.getKey(); Object callDate = entry.getValue(); - if(callDate.equals(date)) { + if (callDate.equals(date)) + { endIndex++; - closedDates.remove(callRecord); + dates.remove(); this.addElement(endIndex, callRecord); } } @@ -84,10 +87,7 @@ public class CallListModel extends AbstractListModel * @return True if the date is closed, false - otherwise. */ public boolean isDateClosed(Object date) { - if (this.closedDates.containsValue(date)) - return true; - else - return false; + return this.closedDates.containsValue(date); } public int getSize() @@ -128,7 +128,7 @@ public class CallListModel extends AbstractListModel } } - public void removeAll(Collection c) + public void removeAll(Collection<Object> c) { synchronized (callList) { callList.removeAll(c); diff --git a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java index a094cb6..87c97af 100644 --- a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java @@ -613,7 +613,7 @@ public class NotificationConfigurationPanel { notificationService.registerNotificationForEvent( tmpNTE.getEvent(), - notificationService.ACTION_SOUND, + NotificationService.ACTION_SOUND, tmpNTE.getSoundFile(), ""); logger.debug("Adding Sound"); @@ -622,7 +622,7 @@ public class NotificationConfigurationPanel { notificationService.removeEventNotificationAction( tmpNTE.getEvent(), - notificationService.ACTION_SOUND); + NotificationService.ACTION_SOUND); logger.debug("Deleting Sound"); } @@ -630,7 +630,7 @@ public class NotificationConfigurationPanel { notificationService.registerNotificationForEvent( tmpNTE.getEvent(), - notificationService.ACTION_COMMAND, + NotificationService.ACTION_COMMAND, tmpNTE.getProgramFile(), ""); logger.debug("Program"); @@ -639,7 +639,7 @@ public class NotificationConfigurationPanel { notificationService.removeEventNotificationAction( tmpNTE.getEvent(), - notificationService.ACTION_COMMAND); + NotificationService.ACTION_COMMAND); logger.debug("Deleting Program"); } @@ -647,7 +647,7 @@ public class NotificationConfigurationPanel { notificationService.registerNotificationForEvent( tmpNTE.getEvent(), - notificationService.ACTION_POPUP_MESSAGE, + NotificationService.ACTION_POPUP_MESSAGE, "", ""); logger.debug("Popup"); @@ -656,7 +656,7 @@ public class NotificationConfigurationPanel { notificationService.removeEventNotificationAction( tmpNTE.getEvent(), - notificationService.ACTION_POPUP_MESSAGE); + NotificationService.ACTION_POPUP_MESSAGE); logger.debug("Deleting Popup"); } tmpNTE.setModify(false); @@ -804,7 +804,7 @@ public class NotificationConfigurationPanel tmpNTE.setPopup(isActionEnabled); } else if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgram(isActionEnabled); @@ -843,7 +843,7 @@ public class NotificationConfigurationPanel } else if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgram(isActionEnabled); tmpNTE.setProgramFile(((CommandNotificationHandler)event @@ -877,7 +877,7 @@ public class NotificationConfigurationPanel tmpNTE.setPopup(isActionEnabled); } else if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgram(isActionEnabled); tmpNTE.setProgramFile(((CommandNotificationHandler)event @@ -954,7 +954,7 @@ public class NotificationConfigurationPanel if(tmpNTE.getEvent().equals(eventName)) { if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgramFile(((CommandNotificationHandler)event .getActionHandler()).getDescriptor()); @@ -1060,8 +1060,6 @@ public class NotificationConfigurationPanel Iterator<String> it = notificationService.getRegisteredEvents(); NotificationsTableEntry tmpNTE = null; String event = null; - Map actionsMap = null; - dataVector.removeAllElements(); while(it.hasNext()) @@ -1078,34 +1076,24 @@ public class NotificationConfigurationPanel event, false); - actionsMap = notificationService.getEventNotifications(event); + Map<String, NotificationActionHandler> actionsMap + = notificationService.getEventNotifications(event); if(actionsMap != null) { - Set entry = actionsMap.entrySet(); - Iterator itEntry = entry.iterator(); - - while(itEntry.hasNext()) + for (Map.Entry<String, NotificationActionHandler> mEntry + : actionsMap.entrySet()) { - Map.Entry mEntry = (Map.Entry) itEntry.next(); - String actionType = (String) mEntry.getKey(); - - NotificationActionHandler handler = null; - - boolean isActionEnabled = false; - - if(mEntry.getValue() instanceof NotificationActionHandler) - { - handler = (NotificationActionHandler)mEntry.getValue(); - isActionEnabled = handler.isEnabled(); - } + String actionType = mEntry.getKey(); + NotificationActionHandler handler = mEntry.getValue(); + boolean isActionEnabled = (handler == null) ? false : handler.isEnabled(); if(actionType - .equals(notificationService.ACTION_POPUP_MESSAGE)) + .equals(NotificationService.ACTION_POPUP_MESSAGE)) { tmpNTE.setPopup(isActionEnabled); } else if(actionType - .equals(notificationService.ACTION_SOUND) && + .equals(NotificationService.ACTION_SOUND) && handler != null) { tmpNTE.setSound(isActionEnabled); @@ -1113,7 +1101,7 @@ public class NotificationConfigurationPanel ((SoundNotificationHandler) handler).getDescriptor()); } else if(actionType - .equals(notificationService.ACTION_COMMAND) && + .equals(NotificationService.ACTION_COMMAND) && handler != null) { tmpNTE.setProgram(isActionEnabled); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java index 0079077..87bd8c5 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java @@ -82,9 +82,10 @@ public class WhiteboardActivator implements BundleActivator * @return all <tt>OperationSetWhiteboarding</tt>s obtained from the bundle * context */ - public static List getWhiteboardOperationSets() + public static List<OperationSetWhiteboarding> getWhiteboardOperationSets() { - List<OperationSet> whiteboardOpSets = new ArrayList<OperationSet>(); + List<OperationSetWhiteboarding> whiteboardOpSets + = new ArrayList<OperationSetWhiteboarding>(); ServiceReference[] serRefs = null; try @@ -102,15 +103,15 @@ public class WhiteboardActivator implements BundleActivator if (serRefs == null) return null; - for (int i = 0; i < serRefs.length; i++) + for (ServiceReference serRef : serRefs) { ProtocolProviderService protocolProvider - = (ProtocolProviderService) bundleContext - .getService(serRefs[i]); + = (ProtocolProviderService) bundleContext.getService(serRef); - OperationSet opSet - = protocolProvider.getOperationSet( - OperationSetWhiteboarding.class); + OperationSetWhiteboarding opSet + = (OperationSetWhiteboarding) + protocolProvider + .getOperationSet(OperationSetWhiteboarding.class); if(opSet != null) whiteboardOpSets.add(opSet); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java index 775f3b7..b635542 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.plugin.whiteboard; import java.awt.*; import java.util.*; +import java.util.List; import net.java.sip.communicator.plugin.whiteboard.gui.*; import net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.*; @@ -38,18 +39,14 @@ public class WhiteboardSessionManager public WhiteboardSessionManager() { - if (WhiteboardActivator - .getWhiteboardOperationSets() == null) - return; + List<OperationSetWhiteboarding> whiteboardOpSets + = WhiteboardActivator.getWhiteboardOperationSets(); - Iterator opSets = WhiteboardActivator - .getWhiteboardOperationSets().iterator(); + if (whiteboardOpSets == null) + return; - while (opSets.hasNext()) + for (OperationSetWhiteboarding whiteboardOpSet : whiteboardOpSets) { - OperationSetWhiteboarding whiteboardOpSet - = (OperationSetWhiteboarding) opSets.next(); - whiteboardOpSet.addInvitationListener(new InvitationListener()); whiteboardOpSet.addPresenceListener(new PresenceListener()); } @@ -130,7 +127,7 @@ public class WhiteboardSessionManager WhiteboardShape ws) throws OperationFailedException { - Vector supportedWBO = new Vector ( + Vector<String> supportedWBO = new Vector<String>( Arrays.asList (wbSession.getSupportedWhiteboardObjects ())); if(ws instanceof WhiteboardObjectPath) diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java index 6ac01b8..cc29ff6 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java @@ -157,11 +157,6 @@ public class WhiteboardFrame private WhiteboardShape selectedShape = null; /** - * The current selected point (null if nothing is seleted) - */ - private Point2D selectedPoint = null; - - /** * The current preselected shape (null if nothing is preseleted) A shape is * preselected when the mouse move on. */ @@ -220,12 +215,12 @@ public class WhiteboardFrame /** * List of WhiteboardShape */ - private List displayList = new CopyOnWriteArrayList(); + private List<WhiteboardShape> displayList = new CopyOnWriteArrayList<WhiteboardShape>(); /** * Aarray of WhiteboardPoint */ - private List pathList = new ArrayList(); + private List<WhiteboardPoint> pathList = new ArrayList<WhiteboardPoint>(); /** * WhiteboardPanel where the shapes are drawn @@ -462,8 +457,7 @@ public class WhiteboardFrame deselect(); for (int i = displayList.size() - 1; i >= 0; i--) { - WhiteboardShape shape = - (WhiteboardShape) displayList.get(i); + WhiteboardShape shape = displayList.get(i); if (shape.contains(s2w.transform(e.getPoint(), null))) { @@ -482,8 +476,7 @@ public class WhiteboardFrame deselect(); for (int i = displayList.size() - 1; i >= 0; i--) { - WhiteboardShape shape = - (WhiteboardShape) displayList.get(i); + WhiteboardShape shape = displayList.get(i); WhiteboardPoint point = shape.getSelectionPoint( s2w.transform(e.getPoint(), null)); @@ -661,7 +654,7 @@ public class WhiteboardFrame WhiteboardShape shape; for (int i = 0; i < displayList.size(); i++) { - shape = (WhiteboardShape) displayList.get(i); + shape = displayList.get(i); if (shape.contains(s2w.transform(e.getPoint(), null))) { @@ -811,7 +804,6 @@ public class WhiteboardFrame newMenuItem = new JMenuItem(); openMenuItem = new JMenuItem(); saveMenuItem = new JMenuItem(); - sendMenuItem = new JMenuItem(); printMenuItem = new JMenuItem(); exitMenuItem = new JMenuItem(); editMenu = new JMenu(); @@ -831,7 +823,7 @@ public class WhiteboardFrame if (session != null) { - Iterator participants = session.getWhiteboardParticipants(); + Iterator<?> participants = session.getWhiteboardParticipants(); while (participants.hasNext()) { @@ -1531,8 +1523,6 @@ public class WhiteboardFrame private javax.swing.JToggleButton selectionButton; - private javax.swing.JMenuItem sendMenuItem; - private javax.swing.JToggleButton textButton; private JPanel toolBar; @@ -2215,7 +2205,7 @@ public class WhiteboardFrame WhiteboardShape shape; for (int i = 0; i < displayList.size(); i++) { - shape = (WhiteboardShape) displayList.get(i); + shape = displayList.get(i); shape.setSelected(false); shape.setModifyPoint(null); } @@ -2287,7 +2277,7 @@ public class WhiteboardFrame WhiteboardShape ws = createWhiteboardShape(wbo); for (int i = 0; i < displayList.size(); i++) { - WhiteboardShape wbs = (WhiteboardShape) displayList.get(i); + WhiteboardShape wbs = displayList.get(i); if (wbs.getID().equals(wbo.getID())) { displayList.set(i, ws); @@ -2310,7 +2300,7 @@ public class WhiteboardFrame int i = 0; while (i < displayList.size()) { - WhiteboardShape wbs = (WhiteboardShape) displayList.get(i); + WhiteboardShape wbs = displayList.get(i); if (id.equals(wbs.getID())) displayList.remove(i); else @@ -2339,7 +2329,7 @@ public class WhiteboardFrame WhiteboardObjectPath path = (WhiteboardObjectPath) wbo; logger.debug("[log] : WB_PATH"); Color c = Color.getColor("", color); - List points = path.getPoints(); + List<WhiteboardPoint> points = path.getPoints(); wShape = new WhiteboardShapePath(id, t, c, points); } else if (wbo instanceof WhiteboardObjectPolyLine) @@ -2347,7 +2337,7 @@ public class WhiteboardFrame WhiteboardObjectPolyLine pLine = (WhiteboardObjectPolyLine) wbo; logger.debug("[log] : WB_POLYLINE"); Color c = Color.getColor("", color); - List points = pLine.getPoints(); + List<WhiteboardPoint> points = pLine.getPoints(); wShape = new WhiteboardShapePolyLine(id, t, c, points, false); } @@ -2356,7 +2346,7 @@ public class WhiteboardFrame WhiteboardObjectPolygon polygon = (WhiteboardObjectPolygon) wbo; logger.debug("[log] : WB_POLYGON"); Color c = Color.getColor("", color); - List points = polygon.getPoints(); + List<WhiteboardPoint> points = polygon.getPoints(); boolean fill = polygon.isFill(); wShape = new WhiteboardShapePolygon(id, t, c, points, fill); @@ -2401,11 +2391,8 @@ public class WhiteboardFrame logger.debug("[log] : WB_TEXT"); Color c = Color.getColor("", color); WhiteboardPoint p = text.getWhiteboardPoint(); - int size; - String txt, fontFamily; - size = text.getFontSize(); - txt = text.getText(); - fontFamily = text.getFontName(); + int size = text.getFontSize(); + String txt = text.getText(); wShape = new WhiteboardShapeText(id, c, p, size, txt); } @@ -2413,7 +2400,6 @@ public class WhiteboardFrame { WhiteboardObjectImage img = (WhiteboardObjectImage) wbo; logger.debug("[log] : WB_IMAGE"); - Color c = Color.getColor("", color); double height, width; WhiteboardPoint p = img.getWhiteboardPoint(); width = img.getWidth(); @@ -2433,7 +2419,7 @@ public class WhiteboardFrame int i = 0; while (i < displayList.size()) { - s = (WhiteboardShape) displayList.get(i); + s = displayList.get(i); if (s.isSelected()) { this.sendDeleteShape(s); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java index 71c826b..6eccc81 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java @@ -4,17 +4,14 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes; import java.awt.*; -import java.awt.geom.AffineTransform; -import java.awt.geom.Ellipse2D; -import java.awt.geom.Point2D; +import java.awt.geom.*; import java.util.*; import java.util.List; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; /** @@ -49,7 +46,7 @@ public class WhiteboardShapeCircle /** * Stores all selection points for this shape. */ - private ArrayList selectionPoints = new ArrayList(); + private ArrayList<WhiteboardPoint> selectionPoints = new ArrayList<WhiteboardPoint>(); /** * WhiteboardShapeCircle constructor @@ -207,14 +204,9 @@ public class WhiteboardShapeCircle { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); - for (int i = 0; i < selectionPoints.size(); i ++) - { - WhiteboardPoint point = (WhiteboardPoint) selectionPoints.get(i); - + for (WhiteboardPoint point : selectionPoints) if (point.distance(givenPoint) < 10) return point; - } - return null; } /** @@ -222,7 +214,7 @@ public class WhiteboardShapeCircle * * @return list of selected points */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { return selectionPoints; } @@ -398,4 +390,4 @@ public class WhiteboardShapeCircle new WhiteboardPoint ( whiteboardPoint.getX(), whiteboardPoint.getY() + radius)); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java index 0660864..242aa28 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java @@ -55,7 +55,7 @@ public class WhiteboardShapeImage /** * Stores all selection points for this shape. */ - private ArrayList selectionPoints = new ArrayList(); + private ArrayList<WhiteboardPoint> selectionPoints = new ArrayList<WhiteboardPoint>(); /** * WhiteboardShapImage constructor @@ -117,7 +117,7 @@ public class WhiteboardShapeImage * * @return list of selected points */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { return selectionPoints; } @@ -262,14 +262,9 @@ public class WhiteboardShapeImage { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); - for (int i = 0; i < selectionPoints.size(); i ++) - { - WhiteboardPoint point = (WhiteboardPoint) selectionPoints.get(i); - + for (WhiteboardPoint point : selectionPoints) if (point.distance(givenPoint) < 18) return point; - } - return null; } @@ -343,4 +338,4 @@ public class WhiteboardShapeImage new WhiteboardPoint ( whiteboardPoint.getX() + width, whiteboardPoint.getY() + height)); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java index 0dadb57..0801c5b 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java @@ -131,9 +131,9 @@ public class WhiteboardShapeLine * * @return list of selected points */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { - ArrayList selectionPoints = new ArrayList(); + ArrayList<WhiteboardPoint> selectionPoints = new ArrayList<WhiteboardPoint>(); selectionPoints.add (startPoint); selectionPoints.add (endPoint); @@ -246,4 +246,4 @@ public class WhiteboardShapeLine { this.endPoint = whiteboardPointEnd; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java index 9d58a87..74f3c2b 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java @@ -4,15 +4,14 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Graphics2D; +import java.awt.*; import java.awt.geom.*; import java.util.*; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; +import java.util.List; + +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; /** @@ -28,7 +27,7 @@ public class WhiteboardShapePath /** * List of WhiteboardPoint */ - private ArrayList points; + private ArrayList<WhiteboardPoint> points; /** * WhiteboardShapePath constructor. @@ -39,12 +38,12 @@ public class WhiteboardShapePath * @param c WhiteboardShapePath's color (or rather it's border) * @param points list of WhiteboardPoint. */ - public WhiteboardShapePath (String id, int t, Color c, List points) + public WhiteboardShapePath (String id, int t, Color c, List<WhiteboardPoint> points) { super (id); this.setThickness (t); setColor (c.getRGB ()); - this.points = new ArrayList (points); + this.points = new ArrayList<WhiteboardPoint>(points); } /** @@ -57,17 +56,15 @@ public class WhiteboardShapePath * @param v2w 2D affine transform */ public WhiteboardShapePath (String id, int t, Color c, - List points, AffineTransform v2w) + List<WhiteboardPoint> points, AffineTransform v2w) { super (id); this.setThickness (t); setColor (c.getRGB ()); - this.points = new ArrayList (); - WhiteboardPoint p = null; - for (int i = 0; i < points.size ();i++) + this.points = new ArrayList<WhiteboardPoint>(); + for (WhiteboardPoint p : points) { - p = (WhiteboardPoint) points.get (i); Point2D w = v2w.transform ( new Point2D.Double (p.getX (), p.getY ()), null); this.points.add (new WhiteboardPoint (w.getX (), w.getY ())); @@ -80,7 +77,7 @@ public class WhiteboardShapePath * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints () + public List<WhiteboardPoint> getPoints () { return points; } @@ -90,15 +87,12 @@ public class WhiteboardShapePath * * @return list of selected points */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { - List list = new ArrayList (); - WhiteboardPoint p ; - for(int i =0; i< points.size (); i++) - { - p = (WhiteboardPoint) points.get (i); + List<WhiteboardPoint> list = new ArrayList<WhiteboardPoint>(); + + for(WhiteboardPoint p : points) list.add (new WhiteboardPoint (p.getX (), p.getY ())); - } return list; } @@ -116,7 +110,7 @@ public class WhiteboardShapePath int size = points.size (); for (int i = 0; i < size; i++) { - WhiteboardPoint point = (WhiteboardPoint) points.get (i); + WhiteboardPoint point = points.get (i); Point2D p0 = t.transform ( new Point2D.Double (startX, startY), null); Point2D p1 = t.transform ( @@ -151,7 +145,7 @@ public class WhiteboardShapePath int size = points.size (); for (int i = 0; i < size; i++) { - WhiteboardPoint point = (WhiteboardPoint) points.get (i); + WhiteboardPoint point = points.get (i); if (i > 0) { @@ -177,9 +171,9 @@ public class WhiteboardShapePath * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points) + public void setPoints (List<WhiteboardPoint> points) { - this.points = new ArrayList (points); + this.points = new ArrayList<WhiteboardPoint>(points); } /** @@ -193,7 +187,7 @@ public class WhiteboardShapePath WhiteboardPoint point; for (int i = 0; i< points.size ();i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); points.set (i, new WhiteboardPoint ( point.getX () + deltaX, point.getY () + deltaY)); @@ -216,7 +210,7 @@ public class WhiteboardShapePath for (int i = 0; i < points.size (); i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); if(getModifyPoint().equals(point)) { @@ -239,17 +233,10 @@ public class WhiteboardShapePath */ public WhiteboardPoint getSelectionPoint (Point2D p) { - WhiteboardPoint point; - for (int i = 0; i < points.size (); i++) - { - point = (WhiteboardPoint) points.get (i); - - if((new Point2D.Double ( - point.getX (), point.getY ())).distance (p) < 18) - { + for (WhiteboardPoint point : points) + if((new Point2D.Double (point.getX (), point.getY ())).distance (p) + < 18) return point; - } - } return null; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java index f8e2156..d43fd62 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java @@ -31,7 +31,7 @@ public class WhiteboardShapePolyLine /** * list of WhiteboardPoint */ - private List points; + private List<WhiteboardPoint> points; /** * True is filled, false is unfilled. */ @@ -50,7 +50,7 @@ public class WhiteboardShapePolyLine public WhiteboardShapePolyLine (String id, int thickness, Color color, - List points, + List<WhiteboardPoint> points, boolean fill) { super (id); @@ -72,18 +72,18 @@ public class WhiteboardShapePolyLine public WhiteboardShapePolyLine (String id, int thickness, Color color, - List m_points, + List<WhiteboardPoint> m_points, boolean fill, AffineTransform at) { super (id); - ArrayList pointsList = new ArrayList (); + ArrayList<WhiteboardPoint> pointsList = new ArrayList<WhiteboardPoint>(); WhiteboardPoint p; for (int i = 0; i<m_points.size ();i++) { - p = (WhiteboardPoint) m_points.get (i); + p = m_points.get (i); Point2D w = at.transform ( new Point2D.Double (p.getX (), p.getY ()), null); pointsList.add (new WhiteboardPoint (w.getX (), w.getY ())); @@ -103,14 +103,14 @@ public class WhiteboardShapePolyLine */ private void initShape (int thickness, Color color, - List points, + List<WhiteboardPoint> points, boolean fill) { this.setThickness (thickness); this.setColor (color); // need to clone because passed by reference - this.points = new ArrayList (points); + this.points = new ArrayList<WhiteboardPoint>(points); this.fill = fill; } @@ -160,13 +160,13 @@ public class WhiteboardShapePolyLine * * @return list of selected WhiteboardPoints */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { - List list = new ArrayList (); - WhiteboardPoint p ; + List<WhiteboardPoint> list = new ArrayList<WhiteboardPoint>(); + WhiteboardPoint p; for(int i =0; i< points.size (); i++) { - p = (WhiteboardPoint) points.get (i); + p = points.get (i); list.add (new WhiteboardPoint (p.getX (), p.getY ())); } return list; @@ -196,14 +196,14 @@ public class WhiteboardShapePolyLine GeneralPath.WIND_EVEN_ODD, points.size ()); if(points.size ()<=0) return polyline; - WhiteboardPoint start = (WhiteboardPoint) points.get (0); + WhiteboardPoint start = points.get (0); Point2D w = new Point2D.Double (start.getX (), start.getY ()); Point2D v = w2v.transform (w, null); polyline.moveTo ((int) v.getX (), (int) v.getY ()); WhiteboardPoint p; for (int i =0; i<points.size ();i++) { - p = (WhiteboardPoint) points.get (i); + p = points.get (i); w = new Point2D.Double (p.getX (), p.getY ()); v = w2v.transform (w, null); polyline.lineTo ((int) v.getX (), (int) v.getY ()); @@ -224,13 +224,13 @@ public class WhiteboardShapePolyLine GeneralPath.WIND_EVEN_ODD, points.size ()); if(points.size ()<=0) return polyline; - WhiteboardPoint start = (WhiteboardPoint) points.get (0); + WhiteboardPoint start = points.get (0); polyline.moveTo ((float) start.getX (), (float) start.getY ()); WhiteboardPoint p; for (int i =0; i<points.size ();i++) { - p = (WhiteboardPoint) points.get (i); + p = points.get (i); polyline.lineTo ((float) p.getX (), (float) p.getY ()); } @@ -243,7 +243,7 @@ public class WhiteboardShapePolyLine * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints () + public List<WhiteboardPoint> getPoints () { return points; } @@ -255,9 +255,9 @@ public class WhiteboardShapePolyLine * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points) + public void setPoints (List<WhiteboardPoint> points) { - this.points = new ArrayList (points); + this.points = new ArrayList<WhiteboardPoint> (points); } /** @@ -271,7 +271,7 @@ public class WhiteboardShapePolyLine WhiteboardPoint point ; for (int i =0; i<points.size ();i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); points.set (i, new WhiteboardPoint(point.getX () + deltaX, point.getY () + deltaY)); @@ -292,7 +292,7 @@ public class WhiteboardShapePolyLine WhiteboardPoint point; for (int i = 0; i < points.size (); i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); if(getModifyPoint().equals(point)) { @@ -318,7 +318,7 @@ public class WhiteboardShapePolyLine WhiteboardPoint point; for (int i = 0; i < points.size (); i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); if(( new Point2D.Double ( point.getX (), point.getY ())).distance (p) < 18) { @@ -328,4 +328,4 @@ public class WhiteboardShapePolyLine return null; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java index 3234d5e..b47a11a 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolygon.java @@ -32,7 +32,7 @@ public class WhiteboardShapePolygon /** * list of WhiteboardPoint */ - private List points; + private List<WhiteboardPoint> points; /** * True is filled, false is unfilled. */ @@ -55,7 +55,7 @@ public class WhiteboardShapePolygon public WhiteboardShapePolygon ( String id, int thickness, Color color, - List points, + List<WhiteboardPoint> points, boolean fill) { super (id); @@ -77,17 +77,17 @@ public class WhiteboardShapePolygon public WhiteboardShapePolygon ( String id, int t, Color c, - List m_points, + List<WhiteboardPoint> m_points, boolean fill, AffineTransform at) { super (id); - ArrayList pointsList = new ArrayList (); + ArrayList<WhiteboardPoint> pointsList = new ArrayList<WhiteboardPoint>(); WhiteboardPoint p; for (int i = 0; i < m_points.size (); i++) { - p = (WhiteboardPoint) m_points.get (i); + p = m_points.get (i); Point2D w = at.transform ( new Point2D.Double (p.getX (), p.getY ()), null); pointsList.add (new WhiteboardPoint (w.getX (), w.getY ())); @@ -107,13 +107,13 @@ public class WhiteboardShapePolygon */ private void initShape (int thickness, Color color, - List points, + List<WhiteboardPoint> points, boolean fill) { this.setThickness (thickness); setColor (color); this.backgroundColor = color; - this.points = new ArrayList (points); + this.points = new ArrayList<WhiteboardPoint>(points); this.fill = fill; } @@ -163,7 +163,7 @@ public class WhiteboardShapePolygon * * @return list of selected WhiteboardPoints */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { return points; } @@ -193,7 +193,7 @@ public class WhiteboardShapePolygon if(points.size ()<=0) return polygon; - WhiteboardPoint start = (WhiteboardPoint) points.get (0); + WhiteboardPoint start = points.get (0); Point2D w = new Point2D.Double (start.getX (), start.getY ()); Point2D v = w2v.transform (w, null); polygon.moveTo ((int) v.getX (), (int) v.getY ()); @@ -201,7 +201,7 @@ public class WhiteboardShapePolygon WhiteboardPoint p; for (int i =0; i<points.size ();i++) { - p = (WhiteboardPoint) points.get (i); + p = points.get (i); w = new Point2D.Double (p.getX (), p.getY ()); v = w2v.transform (w, null); polygon.lineTo ((int) v.getX (), (int) v.getY ()); @@ -224,13 +224,13 @@ public class WhiteboardShapePolygon if(points.size ()<=0) return polygon; - WhiteboardPoint start = (WhiteboardPoint) points.get (0); + WhiteboardPoint start = points.get (0); polygon.moveTo ((float) start.getX (), (float) start.getY ()); WhiteboardPoint p; for (int i =0; i<points.size ();i++) { - p = (WhiteboardPoint) points.get (i); + p = points.get (i); polygon.lineTo ((float) p.getX (), (float) p.getY ()); } @@ -244,7 +244,7 @@ public class WhiteboardShapePolygon * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints () + public List<WhiteboardPoint> getPoints () { return points; } @@ -256,9 +256,9 @@ public class WhiteboardShapePolygon * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points) + public void setPoints (List<WhiteboardPoint> points) { - this.points = new ArrayList (points); + this.points = new ArrayList<WhiteboardPoint>(points); } /** @@ -272,7 +272,7 @@ public class WhiteboardShapePolygon WhiteboardPoint point ; for (int i =0; i<points.size ();i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); points.set (i, new WhiteboardPoint (point.getX () + deltaX, point.getY () + deltaY)); @@ -294,7 +294,7 @@ public class WhiteboardShapePolygon WhiteboardPoint point; for (int i = 0; i < points.size (); i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); if(getModifyPoint().equals(point)) { WhiteboardPoint newPoint @@ -320,7 +320,7 @@ public class WhiteboardShapePolygon WhiteboardPoint point; for (int i = 0; i< points.size ();i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); if(( new Point2D.Double ( point.getX (), point.getY ())).distance (p) < 18) @@ -355,4 +355,4 @@ public class WhiteboardShapePolygon { return this.backgroundColor.getRGB (); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java index 88c1729..772fb22 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeRect.java @@ -4,16 +4,14 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Graphics2D; +import java.awt.*; import java.awt.geom.*; import java.util.*; +import java.util.List; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; /** @@ -53,7 +51,8 @@ public class WhiteboardShapeRect /** * Stores all selection points for this shape. */ - private ArrayList selectionPoints = new ArrayList(); + private List<WhiteboardPoint> selectionPoints + = new ArrayList<WhiteboardPoint>(); /** * WhiteboardShapeRect constructor. @@ -234,7 +233,7 @@ public class WhiteboardShapeRect * * @return list of selected points */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { return selectionPoints; } @@ -340,14 +339,9 @@ public class WhiteboardShapeRect { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); - for (int i = 0; i < selectionPoints.size(); i ++) - { - WhiteboardPoint point = (WhiteboardPoint) selectionPoints.get(i); - + for (WhiteboardPoint point : selectionPoints) if (point.distance(givenPoint) < 18) return point; - } - return null; } @@ -440,4 +434,4 @@ public class WhiteboardShapeRect new WhiteboardPoint ( point.getX() + width, point.getY() + height)); } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java index cbe90e0..ce17fda 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java @@ -153,9 +153,9 @@ public class WhiteboardShapeText * * @return list of selected points */ - public List getSelectionPoints () + public List<WhiteboardPoint> getSelectionPoints () { - List list = new ArrayList (); + List<WhiteboardPoint> list = new ArrayList<WhiteboardPoint>(); list.add (point); return list; @@ -319,4 +319,4 @@ public class WhiteboardShapeText { this.fontName = fontName; } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/service/notification/NotificationService.java b/src/net/java/sip/communicator/service/notification/NotificationService.java index d547716..20c6739 100644 --- a/src/net/java/sip/communicator/service/notification/NotificationService.java +++ b/src/net/java/sip/communicator/service/notification/NotificationService.java @@ -280,7 +280,8 @@ public interface NotificationService * an event with the specified name has occurred, or null if no actions * have been defined for <tt>eventType</tt>. */ - public Map getEventNotifications(String eventType); + public Map<String, NotificationActionHandler> getEventNotifications( + String eventType); /** * Returns the <tt>NotificationActionHandler</tt> corresponding to the given diff --git a/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java b/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java index 62a8dba..3e5781e 100644 --- a/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java +++ b/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java @@ -9,8 +9,7 @@ package net.java.sip.communicator.service.protocol; import java.util.*; import net.java.sip.communicator.service.protocol.event.*; - -import net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObject; +import net.java.sip.communicator.service.protocol.whiteboardobjects.*; /** * A represenation of a <tt>WhiteboardSession</tt>. @@ -34,7 +33,7 @@ public interface WhiteboardSession * @return an Iterator over all participants currently involved in the * whiteboard. */ - public Iterator getWhiteboardParticipants (); + public Iterator<WhiteboardParticipant> getWhiteboardParticipants (); /** * Returns the number of participants currently associated @@ -224,7 +223,7 @@ public interface WhiteboardSession * @return an <tt>Vector</tt> of WhiteboardObjects associated * with this whiteboard. */ - public Vector getWhiteboardObjects (); + public Vector<WhiteboardObject> getWhiteboardObjects (); /** * Sets the state of this whiteboard diff --git a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java index 8adeeb5..bf30763 100644 --- a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java +++ b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java @@ -4,11 +4,12 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.service.protocol.whiteboardobjects; import java.util.List; +import net.java.sip.communicator.service.protocol.*; + /** * Used to access the content of instant whiteboard objects that are sent or * received via the WhiteboardOperationSet. @@ -28,7 +29,7 @@ public interface WhiteboardObjectPath extends WhiteboardObject * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints(); + public List<WhiteboardPoint> getPoints(); /** * Sets the list of <tt>WhiteboardPoint</tt> instances that this @@ -37,5 +38,5 @@ public interface WhiteboardObjectPath extends WhiteboardObject * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints(List points); -}
\ No newline at end of file + public void setPoints(List<WhiteboardPoint> points); +} diff --git a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java index 5259705..172da6b 100644 --- a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java +++ b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java @@ -4,10 +4,11 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.service.protocol.whiteboardobjects; -import java.util.List; +import java.util.*; + +import net.java.sip.communicator.service.protocol.*; /** * Used to access the content of instant whiteboard objects that are sent or @@ -28,7 +29,7 @@ public interface WhiteboardObjectPolyLine extends WhiteboardObject * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints (); + public List<WhiteboardPoint> getPoints (); /** * Sets the list of <tt>WhiteboardPoint</tt> instances that this @@ -37,5 +38,5 @@ public interface WhiteboardObjectPolyLine extends WhiteboardObject * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points); -}
\ No newline at end of file + public void setPoints (List<WhiteboardPoint> points); +} diff --git a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java index 69523ef..70e1df9 100644 --- a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java +++ b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java @@ -4,11 +4,12 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.service.protocol.whiteboardobjects; import java.util.List; +import net.java.sip.communicator.service.protocol.*; + /** * Used to access the content of instant whiteboard objects that are sent or * received via the WhiteboardOperationSet. @@ -43,7 +44,7 @@ public interface WhiteboardObjectPolygon extends WhiteboardObject * * @return the list of <tt>WhiteboardPoint</tt>s composing this object. */ - public List getPoints (); + public List<WhiteboardPoint> getPoints (); /** * Sets the list of <tt>WhiteboardPoint</tt> instances that this @@ -52,7 +53,7 @@ public interface WhiteboardObjectPolygon extends WhiteboardObject * @param points the list of <tt>WhiteboardPoint</tt> instances that this * <tt>WhiteboardObject</tt> is composed of. */ - public void setPoints (List points); + public void setPoints (List<WhiteboardPoint> points); /** * Specifies the background color for this object. The color parameter @@ -72,4 +73,4 @@ public interface WhiteboardObjectPolygon extends WhiteboardObject * @return the RGB value of the background color of this object. */ public int getBackgroundColor (); -}
\ No newline at end of file +} diff --git a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java index db01212..3db3d3b 100644 --- a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java +++ b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java @@ -165,7 +165,7 @@ public class TestCallHistoryService iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } @@ -212,14 +212,14 @@ public class TestCallHistoryService assertEquals("Calls must be 2", rs.size(), 2); - CallRecord rec = (CallRecord)resultIter.next(); + CallRecord rec = resultIter.next(); CallPeerRecord participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -234,7 +234,7 @@ public class TestCallHistoryService assertEquals("Calls must be 1", rs.size(), 1); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -249,21 +249,21 @@ public class TestCallHistoryService assertEquals("Calls must be 3", rs.size(), 3); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(3))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -304,7 +304,7 @@ public class TestCallHistoryService iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } diff --git a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java index f2d5e30..641a859 100644 --- a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java +++ b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java @@ -300,7 +300,7 @@ public class TestMetaHistoryService iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } @@ -704,7 +704,7 @@ public class TestMetaHistoryService it = rs.iterator(); assertTrue("Filetransfers not found", - ((FileRecord)it.next()).getFile().getName(). + it.next().getFile().getName(). equals(files[2].getName())); rs = getFileRecords( diff --git a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java index 22e3871..c00ad3b 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java @@ -166,8 +166,7 @@ public class FullUserInfoCmd private Hashtable<String, Object> getInfoForRequest(int requestID) { Hashtable<String, Object> res - = (Hashtable<String, Object>) - retreivedInfo.get(new Integer(requestID)); + = retreivedInfo.get(new Integer(requestID)); if (res == null) { diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java index 605df86..f7fcfe5 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java @@ -24,13 +24,10 @@ import net.kano.joscar.snaccmd.ssi.*; import net.kano.joscar.tlv.*; import net.kano.joustsim.*; import net.kano.joustsim.oscar.*; -import net.kano.joustsim.oscar.State; import net.kano.joustsim.oscar.oscar.service.bos.*; import net.kano.joustsim.oscar.oscar.service.buddy.*; import net.kano.joustsim.oscar.oscar.service.icbm.*; -import net.kano.joustsim.oscar.oscar.service.info.*; import net.kano.joustsim.oscar.oscar.service.ssi.*; -import net.kano.joustsim.trust.*; /** * An utility that we use to test AIM/ICQ implementations of the @@ -656,18 +653,16 @@ public class IcqTesterAgent public Object extraInfoLock = new Object(); public Object infoLock = new Object(); - public List lastExtraInfos = null; public FullUserInfo lastUserInfo = null; /** * Saves the extraInfos list and calls a notifyAll on the extraInfoLock * @param extraInfos the list of extraInfos that the AIM server sent */ - public void handleYourExtraInfo(List extraInfos) + public void handleYourExtraInfo(List<ExtraInfoBlock> extraInfos) { logger.debug("Bosiat.extrainfo=" + extraInfos); synchronized(extraInfoLock){ - lastExtraInfos = extraInfos; extraInfoLock.notifyAll(); } } @@ -697,7 +692,7 @@ public class IcqTesterAgent { public Vector<Group> addedGroups = new Vector<Group>(); public Vector<Buddy> addedBuddies = new Vector<Buddy>(); - public Vector removedBuddies = new Vector(); + public Vector<Buddy> removedBuddies = new Vector<Buddy>(); /** * The method would wait until at least one new buddy is collected by @@ -807,22 +802,28 @@ public class IcqTesterAgent } //we don't use this one so far. - public void groupsReordered(BuddyList list, List oldOrder, List newOrder) + public void groupsReordered( + BuddyList list, + List<? extends Group> oldOrder, + List<? extends Group> newOrder) { logger.debug("groupsReordered"); } //we don't use this one so far. - public void groupRemoved(BuddyList list, - List oldItems, List newItems, Group group) + public void groupRemoved( + BuddyList list, + List<? extends Group> oldItems, + List<? extends Group> newItems, + Group group) { logger.debug("removedGroup="+group.getName()); } // we don't use this one so far. public void buddyRemoved(BuddyList list, Group group, - List oldItems, - List newItems, + List<? extends Buddy> oldItems, + List<? extends Buddy> newItems, Buddy buddy) { logger.debug("removed buddy=" + buddy); @@ -830,8 +831,8 @@ public class IcqTesterAgent //we don't use this one public void buddiesReordered(BuddyList list, Group group, - List oldBuddies, - List newBuddies) + List<? extends Buddy> oldBuddies, + List<? extends Buddy> newBuddies) { logger.debug("buddiesReordered in group " + group.getName()); } @@ -844,7 +845,7 @@ public class IcqTesterAgent { System.out.println("BuddyListener.gotBuddyStatus " + buddy.toString() +" and status is : " + info.getIcqStatus()); - List eInfoBlocks = info.getExtraInfoBlocks(); + List<ExtraInfoBlock> eInfoBlocks = info.getExtraInfoBlocks(); if (eInfoBlocks != null) { System.out.println("printing extra info blocks (" @@ -907,71 +908,36 @@ public class IcqTesterAgent } - private class ServiceListener implements OpenedServiceListener - { - - public void closedServices(AimConnection conn, Collection services) - { - - } - - public void openedServices(AimConnection conn, Collection services) - { - conn.getBuddyInfoManager().addGlobalBuddyInfoListener(new GlobalBuddyListener()); - conn.getBuddyService().addBuddyListener(new BuddyListener()); - } - - } - - private static class InfoRespListener implements InfoResponseListener{ - - public void handleAwayMessage(InfoService service, Screenname buddy, - String awayMessage) - { - System.out.println("InfoResponseListener.handleAwayMessage " + awayMessage); - } - - public void handleCertificateInfo(InfoService service, - Screenname buddy, - BuddyCertificateInfo certInfo) - { - System.out.println("InfoResponseListener.handleCertificateInfo " + certInfo); - } - - public void handleDirectoryInfo(InfoService service, - Screenname buddy, DirInfo dirInfo) - { - System.out.println("InfoResponseListener.handleDirectoryInfo " + dirInfo); - } - - public void handleUserProfile(InfoService service, Screenname buddy, - String userInfo) - { - System.out.println("InfoResponseListener.handleUserProfile " + userInfo); - } - - public void handleInvalidCertificates(InfoService service, - Screenname buddy, - CertificateInfo origCertInfo, - Throwable ex) - { - System.out.println("InfoResponseListener.handleInvalidCertificates " + origCertInfo); - } - - } +// private class ServiceListener +// implements OpenedServiceListener +// { +// public void closedServices(AimConnection conn, Collection services) +// { +// } +// +// public void openedServices(AimConnection conn, Collection services) +// { +// conn.getBuddyInfoManager() +// .addGlobalBuddyInfoListener(new GlobalBuddyListener()); +// conn.getBuddyService().addBuddyListener(new BuddyListener()); +// } +// } private class RetroListener implements BuddyListLayoutListener, GroupListener { - public void groupsReordered(BuddyList list, List oldOrder, - List newOrder) + public void groupsReordered(BuddyList list, + List<? extends Group> oldOrder, + List<? extends Group> newOrder) { System.out.println(" RetroListener.groupReordered"); } - public void groupAdded(BuddyList list, List oldItems, - List newItems, - Group group, List buddies) + public void groupAdded(BuddyList list, + List<? extends Group> oldItems, + List<? extends Group> newItems, + Group group, + List<? extends Buddy> buddies) { System.out.println("RetroListener.groupAdded"); System.out.println(" group.name is="+group.getName()); @@ -989,36 +955,42 @@ public class IcqTesterAgent group.addGroupListener(this); } - public void groupRemoved(BuddyList list, List oldItems, - List newItems, - Group group) + public void groupRemoved(BuddyList list, + List<? extends Group> oldItems, + List<? extends Group> newItems, + Group group) { System.out.println(" RetroListener.groupRemoved"); } - public void buddyAdded(BuddyList list, Group group, List oldItems, - List newItems, - Buddy buddy) + public void buddyAdded(BuddyList list, + Group group, + List<? extends Buddy> oldItems, + List<? extends Buddy> newItems, + Buddy buddy) { System.out.println(" RetroListener.buddyAdded="+buddy); } - public void buddyRemoved(BuddyList list, Group group, - List oldItems, - List newItems, - Buddy buddy) + public void buddyRemoved(BuddyList list, + Group group, + List<? extends Buddy> oldItems, + List<? extends Buddy> newItems, + Buddy buddy) { System.out.println(" RetroListener.buddyRemoved"+buddy); } - public void buddiesReordered(BuddyList list, Group group, - List oldBuddies, - List newBuddies) + public void buddiesReordered(BuddyList list, + Group group, + List<? extends Buddy> oldBuddies, + List<? extends Buddy> newBuddies) { System.out.println(" RetroListener.buddiesReordered"); } - public void groupNameChanged(Group group, String oldName, + public void groupNameChanged(Group group, + String oldName, String newName) { System.out.println( @@ -1028,23 +1000,22 @@ public class IcqTesterAgent + newName + " group is="+group.getName()); System.out.println("GroupContains="+group.getBuddiesCopy()); - } - } ////////////////////////// ugly unused testing code ////////////////////////// private RetroListener rl = new RetroListener(); public static void main(String[] args) throws Throwable { -java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level.FINEST); + java.util.logging.Logger.getLogger("net.kano") + .setLevel(java.util.logging.Level.FINEST); + IcqTesterAgent icqtests = new IcqTesterAgent("319305099"); if (!icqtests.register("6pC0mmtt")) { System.out.println("registration failed"); ; return; } - MainBosService bos = icqtests.conn.getBosService(); Thread.sleep(1000); icqtests.conn.getSsiService() .getBuddyList().addRetroactiveLayoutListener(icqtests.rl); @@ -1056,19 +1027,13 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. MutableBuddyList list = icqtests.conn.getSsiService().getBuddyList(); - MutableGroup dupeGroup = null; MutableGroup grpGroup = null; Buddy buddyToMove = null; - List groups = list.getGroups(); - Iterator groupsIter = groups.iterator(); - while(groupsIter.hasNext()) + for (Group group : list.getGroups()) { - MutableGroup group = (MutableGroup)groupsIter.next(); - if (group.getName().equals("dupe")) - dupeGroup = group; if (group.getName().equals("grp")) - grpGroup = group; + grpGroup = (MutableGroup) group; List<? extends Buddy> buddies = group.getBuddiesCopy(); System.out.println("Printing buddies for group " + group.getName()); Thread.sleep(1000); @@ -1091,10 +1056,8 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. //find the buddy again. Buddy movedBuddy = null; - groupsIter = list.getGroups().iterator(); - while(groupsIter.hasNext()) + for (Group group : list.getGroups()) { - MutableGroup group = (MutableGroup)groupsIter.next(); List<? extends Buddy> buddies = group.getBuddiesCopy(); for (Buddy buddy : buddies) { @@ -1105,28 +1068,6 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. if (buddyToMove == movedBuddy) System.out.println("hahaha"); - - } - - private class TestSnacCmd extends SnacCommand - { - /** The SNAC family code for the location family. */ - public static final int FAMILY_ICQ = 0x0015; - - protected TestSnacCmd(int command) { - super(FAMILY_ICQ, command); - } - - /** - * Writes this command's SNAC data block to the given stream. The SNAC data - * block is the data after the first ten bytes of a SNAC packet. - * - * @param out the stream to which to write the SNAC data - * @throws IOException if an I/O error occurs - */ - public void writeData(OutputStream out) throws IOException - { - } } public void deleteBuddy(String screenname) @@ -1331,7 +1272,7 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. extends ServerSsiCmdFactory implements SnacResponseListener { - List SUPPORTED_TYPES = null; + List<CmdType> SUPPORTED_TYPES = null; public String responseReasonStr = null; public String requestReasonStr = null; @@ -1342,15 +1283,15 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. public AuthCmdFactory() { - List types = super.getSupportedTypes(); - ArrayList tempTypes = new ArrayList(types); + List<CmdType> types = super.getSupportedTypes(); + ArrayList<CmdType> tempTypes = new ArrayList<CmdType>(types); tempTypes.add(new CmdType(SsiCommand.FAMILY_SSI, 0x001b)); // 1b auth request reply tempTypes.add(new CmdType(SsiCommand.FAMILY_SSI, 0x0019)); // 19 auth request this.SUPPORTED_TYPES = DefensiveTools.getUnmodifiable(tempTypes); } - public List getSupportedTypes() + public List<CmdType> getSupportedTypes() {return SUPPORTED_TYPES;} public SnacCommand genSnacCommand(SnacPacket packet) @@ -1402,9 +1343,9 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. (SsiDataModResponse) e.getSnacCommand(); int[] results = dataModResponse.getResults(); - List items = ( (ItemsCmd) e.getRequest().getCommand()). + List<SsiItem> items = ( (ItemsCmd) e.getRequest().getCommand()). getItems(); - items = new LinkedList(items); + items = new LinkedList<SsiItem>(items); for (int i = 0; i < results.length; i++) { @@ -1415,11 +1356,11 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. isErrorAddingReceived = true; // authorisation required for user - SsiItem buddyItem = (SsiItem) items.get(i); + SsiItem buddyItem = items.get(i); String uinToAskForAuth = buddyItem.getName(); - Vector buddiesToBeAdded = new Vector(); + Vector<SsiItem> buddiesToBeAdded = new Vector<SsiItem>(); BuddyAwaitingAuth newBuddy = new BuddyAwaitingAuth( buddyItem); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java index d65f588..225df3e 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java @@ -10,6 +10,7 @@ import java.util.*; import junit.framework.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.*; import net.java.sip.communicator.util.*; /** @@ -192,14 +193,15 @@ public class TestOperationSetServerStoredInfo = opSetPresence.findContactByID(fixture.testerAgent.getIcqUIN()); // Get the last name info - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredContactInfo. getDetails(testerAgentContact, ServerStoredDetails.LastNameDetail.class); while (iter.hasNext()) { - ServerStoredDetails.LastNameDetail item = (ServerStoredDetails.LastNameDetail) iter.next(); + ServerStoredDetails.LastNameDetail item + = (ServerStoredDetails.LastNameDetail) iter.next(); assertEquals("The LastName we set is not set or not read properly" , item.getName() @@ -227,10 +229,11 @@ public class TestOperationSetServerStoredInfo opSetServerStoredContactInfo. getDetails(testerAgentContact, ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList spokenLanguagesServer = new ArrayList(); + List<Locale> spokenLanguagesServer = new ArrayList<Locale>(); while (iter.hasNext()) { - ServerStoredDetails.SpokenLanguageDetail item = (ServerStoredDetails.SpokenLanguageDetail)iter.next(); + ServerStoredDetails.SpokenLanguageDetail item + = (ServerStoredDetails.SpokenLanguageDetail)iter.next(); spokenLanguagesServer.add(item.getLocale()); } @@ -254,7 +257,8 @@ public class TestOperationSetServerStoredInfo ServerStoredDetails.CountryDetail.class); while (iter.hasNext()) { - ServerStoredDetails.CountryDetail item = (ServerStoredDetails.CountryDetail) iter.next(); + ServerStoredDetails.CountryDetail item + = (ServerStoredDetails.CountryDetail) iter.next(); logger.info("read item value: " + item.getLocale().getDisplayCountry()); @@ -282,7 +286,7 @@ public class TestOperationSetServerStoredInfo ServerStoredDetails.CountryDetail homeCountryDetail = null; // Get Last name info detail - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.LastNameDetail.class); if (iter.hasNext()) @@ -485,7 +489,7 @@ public class TestOperationSetServerStoredInfo logger.trace("Proceeding to Testing values!"); // make the tests here - Hashtable userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID); + Hashtable<String, Object> userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID); assertEquals("The LastName we set is not set or not read properly" , newLastName @@ -495,13 +499,17 @@ public class TestOperationSetServerStoredInfo , newPhoneNumber , userInfo.get(FullUserInfoCmd.PHONE_NUMBER)); - ArrayList languageCodes = (ArrayList)userInfo.get(FullUserInfoCmd.SPEAK_LANG); - ArrayList languages = new ArrayList(); + List<?> languageCodes + = (ArrayList<?>) userInfo.get(FullUserInfoCmd.SPEAK_LANG); + ArrayList<Locale> languages = new ArrayList<Locale>(); // convert language codes to locales in the list - iter = languageCodes.iterator(); - while (iter.hasNext()) + Iterator<?> languageCodeIter = languageCodes.iterator(); + while (languageCodeIter.hasNext()) { - languages.add(spokenLanguages[((Integer)iter.next()).intValue()]); + languages + .add( + spokenLanguages[ + ((Integer) languageCodeIter.next()).intValue()]); } // assertEquals("The number of spoken languages dowsn't match", // newLanguages.length, @@ -525,15 +533,14 @@ public class TestOperationSetServerStoredInfo */ public void errorHandling() { - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList initialLanguages = new ArrayList(); + ArrayList<GenericDetail> initialLanguages + = new ArrayList<GenericDetail>(); while (iter.hasNext()) - { initialLanguages.add(iter.next()); - } assertEquals("There must be 3 language details!", 3, initialLanguages.size()); @@ -607,23 +614,22 @@ public class TestOperationSetServerStoredInfo try { - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList initialLanguages = new ArrayList(); + List<GenericDetail> initialLanguages + = new ArrayList<GenericDetail>(); while (iter.hasNext()) - { initialLanguages.add(iter.next()); - } // now remove those languages iter = initialLanguages.iterator(); while (iter.hasNext()) { - assertTrue("Error removing language!", - opSetServerStoredAccountInfo.removeDetail( - (ServerStoredDetails.SpokenLanguageDetail)iter.next())); + assertTrue( + "Error removing language!", + opSetServerStoredAccountInfo.removeDetail(iter.next())); synchronized (lock) { try{ @@ -648,14 +654,12 @@ public class TestOperationSetServerStoredInfo opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList languages = new ArrayList(); + List<GenericDetail> languages = new ArrayList<GenericDetail>(); while (iter.hasNext()) - { languages.add(iter.next()); - } logger.trace("languages " + languages.size()); - // there must be no languages after the last retreive + // there must be no languages after the last retrieve assertEquals("There must be no language details!", 0, languages.size()); } catch (OperationFailedException ex) |