- Changed createAdHocChatRoom(*, List<Contact>, *) to createAdHocChatRoom(*, List<String>, *)

(Contact are never used, only their address/ID. +More convenient for unit tests)
  
- Removed tabs (reported by Yana)
cusax-fix
Valentin Martinet 16 years ago
parent 030f0ea5b3
commit d92b387243

@ -30,9 +30,9 @@ public class ChatContactRightButtonMenu
extends JPopupMenu
implements ActionListener
{
private static final long serialVersionUID = -4069653895234333083L;
private static final long serialVersionUID = -4069653895234333083L;
private Logger logger = Logger.getLogger(ChatContactRightButtonMenu.class);
private Logger logger = Logger.getLogger(ChatContactRightButtonMenu.class);
private final JMenuItem kickItem
= new JMenuItem(GuiActivator.getResources().getI18NString(
@ -341,7 +341,7 @@ else if (menuItemName.equals("changeRoomSubjectItem"))
{
ChatOperationReasonDialog reasonDialog
= new ChatOperationReasonDialog(
chatPanel.getChatWindow(),
chatPanel.getChatWindow(),
GuiActivator.getResources().getI18NString(
"service.gui.CHANGE_ROOM_SUBJECT"),
GuiActivator.getResources().getI18NString(
@ -350,7 +350,7 @@ else if (menuItemName.equals("changeRoomSubjectItem"))
false);
//reasonDialog.setIconImage(
// ImageLoader.getImage(ImageLoader.CHANGE_ROOM_SUBJECT_ICON_16x16));
//ImageLoader.getImage(ImageLoader.CHANGE_ROOM_SUBJECT_ICON_16x16));
reasonDialog.setReasonFieldText(room.getSubject());
int result = reasonDialog.showDialog();
@ -371,7 +371,7 @@ else if (menuItemName.equals("changeNicknameItem"))
{
ChatOperationReasonDialog reasonDialog
= new ChatOperationReasonDialog(
chatPanel.getChatWindow(),
chatPanel.getChatWindow(),
GuiActivator.getResources().getI18NString(
"service.gui.CHANGE_NICKNAME"),
GuiActivator.getResources().getI18NString(
@ -380,7 +380,7 @@ else if (menuItemName.equals("changeNicknameItem"))
false);
// reasonDialog.setIconImage(ImageLoader.getImage(
// ImageLoader.CHANGE_NICKNAME_ICON_16x16));
// ImageLoader.CHANGE_NICKNAME_ICON_16x16));
reasonDialog.setReasonFieldText(chatContact.getName());
int result = reasonDialog.showDialog();

@ -19,9 +19,9 @@
*/
public class ChatOperationReasonDialog extends MessageDialog
{
private static final long serialVersionUID = 3290030744711759011L;
private static final long serialVersionUID = 3290030744711759011L;
private final JLabel reasonLabel = new JLabel(
private final JLabel reasonLabel = new JLabel(
GuiActivator.getResources()
.getI18NString("service.gui.REASON") + ":");
@ -67,7 +67,7 @@ public ChatOperationReasonDialog(String title, String message)
* @param showReasonLabel specify if we want the "Reason:" label
*/
public ChatOperationReasonDialog(ChatWindow chatWindow, String title,
String message, String okButtonName, boolean showReasonLabel)
String message, String okButtonName, boolean showReasonLabel)
{
super(chatWindow, title, message, okButtonName, false);
@ -75,7 +75,7 @@ public ChatOperationReasonDialog(ChatWindow chatWindow, String title,
if(showReasonLabel)
{
reasonPanel.add(reasonLabel, BorderLayout.WEST);
reasonPanel.add(reasonLabel, BorderLayout.WEST);
}
reasonPanel.add(new JLabel(" "), BorderLayout.WEST);
@ -104,6 +104,6 @@ public String getReason()
*/
public void setReasonFieldText(String value)
{
reasonField.setText(value);
reasonField.setText(value);
}
}

@ -252,28 +252,28 @@ void closeWindow(ChatWindow chatWindow)
ChatPanel activePanel = null;
synchronized (chatPanels)
{
for (ChatPanel chatPanel : chatPanels)
{
if (chatPanel.getChatSession() instanceof
AdHocConferenceChatSession)
{
AdHocConferenceChatSession adHocSession
= (AdHocConferenceChatSession) chatPanel
.getChatSession();
GuiActivator.getUIService().getConferenceChatManager()
.leaveChatRoom((AdHocChatRoomWrapper)
adHocSession.getDescriptor());
}
if (!chatPanel.isWriteAreaEmpty()
|| chatPanel.containsActiveFileTransfers()
|| System.currentTimeMillis() - chatWindow
.getLastIncomingMsgTimestamp(chatPanel) < 2 * 1000)
{
activePanel = chatPanel;
}
}
for (ChatPanel chatPanel : chatPanels)
{
if (chatPanel.getChatSession() instanceof
AdHocConferenceChatSession)
{
AdHocConferenceChatSession adHocSession
= (AdHocConferenceChatSession) chatPanel
.getChatSession();
GuiActivator.getUIService().getConferenceChatManager()
.leaveChatRoom((AdHocChatRoomWrapper)
adHocSession.getDescriptor());
}
if (!chatPanel.isWriteAreaEmpty()
|| chatPanel.containsActiveFileTransfers()
|| System.currentTimeMillis() - chatWindow
.getLastIncomingMsgTimestamp(chatPanel) < 2 * 1000)
{
activePanel = chatPanel;
}
}
}
if (activePanel == null)

@ -56,7 +56,7 @@ public Component getListCellRendererComponent( JList list,
ChatRoomMember member = null;
if (chatContact.getDescriptor() instanceof ChatRoomMember)
member = (ChatRoomMember) chatContact.getDescriptor();
member = (ChatRoomMember) chatContact.getDescriptor();
this.setPreferredSize(new Dimension(20, 30));
@ -72,9 +72,9 @@ public Component getListCellRendererComponent( JList list,
this.nameLabel.setText(displayName);
if(member != null)
if(member.getRole() != null)
this.nameLabel.setIcon(
ChatContactRoleIcon.getRoleIcon(member.getRole()));
if(member.getRole() != null)
this.nameLabel.setIcon(
ChatContactRoleIcon.getRoleIcon(member.getRole()));
if (contactForegroundColor != null)
this.nameLabel.setForeground(contactForegroundColor);

@ -30,9 +30,9 @@
public class ChatRoomMemberListPanel
extends JPanel
{
private static final long serialVersionUID = -8250816784228586068L;
private static final long serialVersionUID = -8250816784228586068L;
/**
/**
* The list of members.
*/
private final DefaultContactList memberList = new DefaultContactList();
@ -62,10 +62,10 @@ public ChatRoomMemberListPanel(final ChatPanel chat)
// It's pertinent to add the ChatContactRightButtonMenu only we aren't
// in an ad-hoc multi user chat (which support roles)
if(this.chatPanel.getChatSession().getCurrentChatTransport()
.getProtocolProvider().getSupportedOperationSets().containsKey(
OperationSetMultiUserChat.class.getName()))
.getProtocolProvider().getSupportedOperationSets().containsKey(
OperationSetMultiUserChat.class.getName()))
{
this.memberList.addMouseListener(new MouseAdapter()
this.memberList.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
@ -73,7 +73,7 @@ public void mouseClicked(MouseEvent e)
{
new ChatContactRightButtonMenu(
chat, (ChatContact)memberList.getSelectedValue())
.show( memberList, e.getX(), e.getY());
.show( memberList, e.getX(), e.getY());
}
}
});

@ -128,9 +128,7 @@ public void invitationReceived(ChatRoomInvitationReceivedEvent evt)
{
InvitationReceivedDialog dialog
= new InvitationReceivedDialog(
this,
evt.getSourceOperationSet(),
evt.getInvitation());
this, evt.getSourceOperationSet(), evt.getInvitation());
dialog.setVisible(true);
}
@ -152,11 +150,8 @@ public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
logger.trace(
"MESSAGE DELIVERED to chat room: " + sourceChatRoom.getName());
ChatPanel chatPanel
= GuiActivator
.getUIService()
.getChatWindowManager()
.getMultiChat(sourceChatRoom, false);
ChatPanel chatPanel = GuiActivator.getUIService().getChatWindowManager()
.getMultiChat(sourceChatRoom, false);
if(chatPanel != null)
{
@ -177,14 +172,12 @@ public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
Message msg = evt.getMessage();
chatPanel
.addMessage(
sourceChatRoom
.getParentProvider().getAccountID().getUserID(),
evt.getTimestamp(),
messageType,
msg.getContent(),
msg.getContentType());
chatPanel.addMessage(
sourceChatRoom.getParentProvider().getAccountID().getUserID(),
evt.getTimestamp(),
messageType,
msg.getContent(),
msg.getContentType());
}
}
@ -236,20 +229,13 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt)
= chatRoomList.findServerWrapperFromProvider(
sourceChatRoom.getParentProvider());
chatPanel
= chatWindowManager
.getMultiChat(
serverWrapper.getSystemRoomWrapper(),
true);
chatPanel = chatWindowManager.getMultiChat(
serverWrapper.getSystemRoomWrapper(), true);
}
else
{
chatPanel
= chatWindowManager
.getMultiChat(
sourceChatRoom,
true,
message.getMessageUID());
chatPanel = chatWindowManager.getMultiChat(
sourceChatRoom, true, message.getMessageUID());
}
String messageContent = message.getContent();
@ -272,8 +258,8 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt)
* the nickname of the local user.
*/
if (sourceChatRoom.isSystem()
|| isPrivate(sourceChatRoom)
|| (messageContent == null))
|| isPrivate(sourceChatRoom)
|| (messageContent == null))
fireChatNotification = true;
else
{
@ -282,14 +268,14 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt)
fireChatNotification =
(nickname == null)
|| messageContent.toLowerCase().contains(
nickname.toLowerCase());
nickname.toLowerCase());
}
if (fireChatNotification)
{
String title
= GuiActivator.getResources().getI18NString(
"service.gui.MSG_RECEIVED",
new String[] { sourceMember.getName() });
"service.gui.MSG_RECEIVED",
new String[] { sourceMember.getName() });
NotificationManager.fireChatNotification(
sourceChatRoom,
@ -315,8 +301,8 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt)
static boolean isPrivate(ChatRoom chatRoom)
{
if (!chatRoom.isSystem()
&& chatRoom.isJoined()
&& (chatRoom.getMembersCount() == 1))
&& chatRoom.isJoined()
&& (chatRoom.getMembersCount() == 1))
{
String nickname = chatRoom.getUserNickname();
@ -359,33 +345,33 @@ public void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt)
ChatRoomMember destMember = evt.getDestinationChatRoomMember();
if (evt.getErrorCode()
== MessageDeliveryFailedEvent.OFFLINE_MESSAGES_NOT_SUPPORTED)
== MessageDeliveryFailedEvent.OFFLINE_MESSAGES_NOT_SUPPORTED)
{
errorMsg = GuiActivator.getResources().getI18NString(
"service.gui.MSG_DELIVERY_NOT_SUPPORTED");
"service.gui.MSG_DELIVERY_NOT_SUPPORTED");
}
else if (evt.getErrorCode()
== MessageDeliveryFailedEvent.NETWORK_FAILURE)
== MessageDeliveryFailedEvent.NETWORK_FAILURE)
{
errorMsg = GuiActivator.getResources()
.getI18NString("service.gui.MSG_NOT_DELIVERED");
}
else if (evt.getErrorCode()
== MessageDeliveryFailedEvent.PROVIDER_NOT_REGISTERED)
== MessageDeliveryFailedEvent.PROVIDER_NOT_REGISTERED)
{
errorMsg = GuiActivator.getResources().getI18NString(
"service.gui.MSG_SEND_CONNECTION_PROBLEM");
"service.gui.MSG_SEND_CONNECTION_PROBLEM");
}
else if (evt.getErrorCode()
== MessageDeliveryFailedEvent.INTERNAL_ERROR)
== MessageDeliveryFailedEvent.INTERNAL_ERROR)
{
errorMsg = GuiActivator.getResources().getI18NString(
"service.gui.MSG_DELIVERY_INTERNAL_ERROR");
"service.gui.MSG_DELIVERY_INTERNAL_ERROR");
}
else
{
errorMsg = GuiActivator.getResources().getI18NString(
"service.gui.MSG_DELIVERY_UNKNOWN_ERROR");
"service.gui.MSG_DELIVERY_UNKNOWN_ERROR");
}
ChatWindowManager chatWindowManager
@ -394,15 +380,15 @@ else if (evt.getErrorCode()
= chatWindowManager.getMultiChat(sourceChatRoom, true);
chatPanel.addMessage(
destMember.getName(),
System.currentTimeMillis(),
Chat.OUTGOING_MESSAGE,
sourceMessage.getContent(),
sourceMessage.getContentType());
destMember.getName(),
System.currentTimeMillis(),
Chat.OUTGOING_MESSAGE,
sourceMessage.getContent(),
sourceMessage.getContentType());
chatPanel.addErrorMessage(
destMember.getName(),
errorMsg);
destMember.getName(),
errorMsg);
chatWindowManager.openChat(chatPanel, false);
}
@ -449,7 +435,7 @@ public void localUserAdHocPresenceChanged(
else
chatWindowManager.openChat(chatPanel, true);
}
sourceAdHocChatRoom.addMessageListener(this);
}
else if (evt.getEventType().equals(
@ -785,19 +771,13 @@ public AdHocChatRoomWrapper createAdHocChatRoom(
try
{
List<Contact> members = new LinkedList<Contact>();
OperationSetPersistentPresence opSet =
protocolProvider.getOperationSet(
OperationSetPersistentPresence.class);
for(String contact : contacts)
{
members.add(opSet.findContactByID(contact));
}
List<String> members = new LinkedList<String>();
for(String address : contacts)
members.add(address);
chatRoom = groupChatOpSet.createAdHocChatRoom(
"chatroom-" + new Date().getTime(), members, reason);
"chatroom-" + new Date().getTime(), members, reason);
}
catch (OperationFailedException ex)
{

@ -41,9 +41,9 @@ public class MainToolBar
ChatChangeListener,
ChatSessionChangeListener
{
private static final long serialVersionUID = -5572510509556499465L;
private static final long serialVersionUID = -5572510509556499465L;
private final ChatToolbarButton inviteButton
private final ChatToolbarButton inviteButton
= new ChatToolbarButton(
ImageLoader.getImage(ImageLoader.ADD_TO_CHAT_ICON));
@ -213,17 +213,16 @@ else if (buttonText.equals("next"))
}
else if (buttonText.equals("sendFile"))
{
SipCommFileChooser scfc = GenericFileDialog.create(
null, "Send file...",
SipCommFileChooser.LOAD_FILE_OPERATION,
ConfigurationManager.getSendFileLastDir());
File selectedFile = scfc.getFileFromDialog();
if(selectedFile != null)
{
ConfigurationManager.setSendFileLastDir(
selectedFile.getParent());
messageWindow.getCurrentChatPanel().sendFile(selectedFile);
}
SipCommFileChooser scfc = GenericFileDialog.create(
null, "Send file...", SipCommFileChooser.LOAD_FILE_OPERATION,
ConfigurationManager.getSendFileLastDir());
File selectedFile = scfc.getFileFromDialog();
if(selectedFile != null)
{
ConfigurationManager.setSendFileLastDir(
selectedFile.getParent());
messageWindow.getCurrentChatPanel().sendFile(selectedFile);
}
}
else if (buttonText.equals("history"))
{

@ -524,19 +524,19 @@ public void run()
super.run();
SipCommFileChooser scfc = GenericFileDialog.create(
null, "Send file...",
SipCommFileChooser.LOAD_FILE_OPERATION,
ConfigurationManager.getSendFileLastDir());
File selectedFile = scfc.getFileFromDialog();
if(selectedFile != null)
{
ConfigurationManager.setSendFileLastDir(
selectedFile.getParent());
GuiActivator.getUIService().
null, "Send file...",
SipCommFileChooser.LOAD_FILE_OPERATION,
ConfigurationManager.getSendFileLastDir());
File selectedFile = scfc.getFileFromDialog();
if(selectedFile != null)
{
ConfigurationManager.setSendFileLastDir(
selectedFile.getParent());
GuiActivator.getUIService().
getChatWindowManager().getSelectedChat().
sendFile(selectedFile);
}
}
}
});
}

@ -193,7 +193,7 @@ public AdHocChatRoom createAdHocChatRoom(String roomName,
* the specified list of <tt>contacts</tt>.
*
* @param adHocRoomName the name of the ad-hoc room
* @param contacts the list of contacts
* @param contacts the list of contacts ID
* @param reason the reason to be sent with the invitation for contacts.
*
* @return the ad-hoc room that has been just created
@ -201,20 +201,18 @@ public AdHocChatRoom createAdHocChatRoom(String roomName,
* @throws OperationNotSupportedException
*/
public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
List<Contact> contacts, String reason)
List<String> contacts, String reason)
throws OperationFailedException,
OperationNotSupportedException
{
AdHocChatRoom adHocChatRoom = createAdHocChatRoom(
adHocRoomName, new Hashtable<String, Object>());
adHocRoomName, new Hashtable<String, Object>());
if (adHocChatRoom != null && contacts != null)
{
for (Contact contact : contacts)
for (String address : contacts)
{
ContactIcqImpl newContact = (ContactIcqImpl) contact;
adHocChatRoom.invite(newContact.getAddress(), reason);
adHocChatRoom.invite(address, reason);
}
}

@ -21,19 +21,19 @@
* @author Valentin Martinet
*/
public class OperationSetAdHocMultiUserChatMsnImpl
implements OperationSetAdHocMultiUserChat
implements OperationSetAdHocMultiUserChat
{
/**
* The logger used to log messages.
*/
private static final Logger logger
= Logger.getLogger(OperationSetAdHocMultiUserChatMsnImpl.class);
private static final Logger logger
= Logger.getLogger(OperationSetAdHocMultiUserChatMsnImpl.class);
/**
* Listeners that will be notified of changes in our status in the room.
*/
private Vector<LocalUserAdHocChatRoomPresenceListener> presenceListeners
= new Vector<LocalUserAdHocChatRoomPresenceListener>();
= new Vector<LocalUserAdHocChatRoomPresenceListener>();
/**
* The currently valid MSN protocol provider service implementation.
@ -44,28 +44,28 @@ public class OperationSetAdHocMultiUserChatMsnImpl
* The ad-hoc rooms we currently are in.
*/
private Hashtable<MsnSwitchboard, AdHocChatRoomMsnImpl> adHocChatRoomCache
= new Hashtable<MsnSwitchboard, AdHocChatRoomMsnImpl>();
= new Hashtable<MsnSwitchboard, AdHocChatRoomMsnImpl>();
/**
* A list of listeners subscribed for invitations multi user chat events.
*/
private Vector<AdHocChatRoomInvitationListener> invitationListeners
= new Vector<AdHocChatRoomInvitationListener>();
= new Vector<AdHocChatRoomInvitationListener>();
/**
* A list of listeners subscribed for events indicating rejection of a multi
* user chat invitation sent by us.
*/
private Vector<AdHocChatRoomInvitationRejectionListener>
invitationRejectionListeners
= new Vector<AdHocChatRoomInvitationRejectionListener>();
invitationRejectionListeners
= new Vector<AdHocChatRoomInvitationRejectionListener>();
/**
* A list of the ad-hoc rooms that are currently open and created by this
* account.
*/
private Hashtable<Object, AdHocChatRoom> pendingAdHocChatRoomList
= new Hashtable<Object, AdHocChatRoom>();
= new Hashtable<Object, AdHocChatRoom>();
/**
* Creates an <tt>OperationSetAdHocMultiUserChatMsnImpl</tt> by specifying
@ -73,11 +73,11 @@ public class OperationSetAdHocMultiUserChatMsnImpl
* @param provider the Msn provider
*/
public OperationSetAdHocMultiUserChatMsnImpl(
ProtocolProviderServiceMsnImpl provider)
ProtocolProviderServiceMsnImpl provider)
{
this.provider = provider;
this.provider.addRegistrationStateChangeListener(
new RegistrationStateListener());
new RegistrationStateListener());
}
/**
@ -86,7 +86,7 @@ public OperationSetAdHocMultiUserChatMsnImpl(
* @param listener the listener to add
*/
public void addPresenceListener(
LocalUserAdHocChatRoomPresenceListener listener)
LocalUserAdHocChatRoomPresenceListener listener)
{
synchronized(presenceListeners)
{
@ -95,7 +95,7 @@ public void addPresenceListener(
}
}
/**
/**
* Adds a listener to invitation notifications.
*
* @param listener an invitation listener.
@ -116,7 +116,7 @@ public void addInvitationListener(AdHocChatRoomInvitationListener listener)
* @param listener the invitation listener to remove.
*/
public void removeInvitationListener(
AdHocChatRoomInvitationListener listener)
AdHocChatRoomInvitationListener listener)
{
synchronized (invitationListeners)
{
@ -172,7 +172,7 @@ public Message createMessage(String messageText)
* including to the specified <tt>contacts</tt>.
*
* @param adHocRoomName the name of the ad-hoc room
* @param contacts the list of contacts
* @param contacts the list of contacts ID
* @param reason the reason (will not be used since MSN does not support
* invitation with the possibility to reject it)
*
@ -180,21 +180,19 @@ public Message createMessage(String messageText)
* @throws OperationFailedException
* @throws OperationNotSupportedException
*/
public AdHocChatRoom createAdHocChatRoom( String adHocRoomName,
List<Contact> contacts,
String reason)
throws OperationFailedException, OperationNotSupportedException
public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
List<String> contacts,
String reason)
throws OperationFailedException, OperationNotSupportedException
{
AdHocChatRoom adHocChatRoom = createAdHocChatRoom(
adHocRoomName, new Hashtable<String, Object>());
adHocRoomName, new Hashtable<String, Object>());
if (adHocChatRoom != null && contacts != null)
{
for (Contact contact : contacts)
for (String address : contacts)
{
ContactMsnImpl newContact = (ContactMsnImpl) contact;
adHocChatRoom.invite(newContact.getAddress(), reason);
adHocChatRoom.invite(address, reason);
}
}
@ -213,8 +211,8 @@ public AdHocChatRoom createAdHocChatRoom( String adHocRoomName,
* @throws OperationNotSupportedException
*/
public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
Map<String, Object> adHocRoomProperties)
throws OperationFailedException, OperationNotSupportedException
Map<String, Object> adHocRoomProperties)
throws OperationFailedException, OperationNotSupportedException
{
AdHocChatRoom adHocRoom = adHocChatRoomCache.get(adHocRoomName);
@ -230,7 +228,7 @@ public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
// when the room hasn't been created, we create it.
adHocRoom = createLocalAdHocChatRoomInstance(adHocRoomName, id);
}
return adHocRoom;
}
@ -242,13 +240,13 @@ public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
* @return the ad-hoc chat room that we've just created.
*/
private AdHocChatRoomMsnImpl createLocalAdHocChatRoomInstance(
String adHocChatRoomName, Object switchboardId)
String adHocChatRoomName, Object switchboardId)
{
synchronized (this.pendingAdHocChatRoomList)
{
AdHocChatRoomMsnImpl adHocChatRoom =
new AdHocChatRoomMsnImpl(adHocChatRoomName, this.provider);
// We put it to the pending ad hoc chat rooms, waiting for the
// switchboard to be created.
this.pendingAdHocChatRoomList.put(switchboardId, adHocChatRoom);
@ -269,7 +267,7 @@ private AdHocChatRoomMsnImpl createLocalAdHocChatRoomInstance(
* <tt>switchboard</tt>, otherwise null
*/
private AdHocChatRoomMsnImpl getLocalAdHocChatRoomInstance(
MsnSwitchboard switchboard)
MsnSwitchboard switchboard)
{
return adHocChatRoomCache.get(switchboard);
}
@ -283,22 +281,22 @@ private AdHocChatRoomMsnImpl getLocalAdHocChatRoomInstance(
* <tt>switchboard</tt>
*/
private AdHocChatRoomMsnImpl createLocalAdHocChatRoomInstance(
MsnSwitchboard switchboard)
MsnSwitchboard switchboard)
{
AdHocChatRoomMsnImpl adHocChatRoom
= adHocChatRoomCache.get(switchboard);
= adHocChatRoomCache.get(switchboard);
if (adHocChatRoom == null)
{
String name = String.valueOf(switchboard.hashCode());
adHocChatRoom
= new AdHocChatRoomMsnImpl(name, provider, switchboard);
= new AdHocChatRoomMsnImpl(name, provider, switchboard);
this.adHocChatRoomCache.put(switchboard, adHocChatRoom);
Object attachment = switchboard.getAttachment();
if (attachment != null && pendingAdHocChatRoomList
.containsKey(attachment))
.containsKey(attachment))
{
pendingAdHocChatRoomList.remove(attachment);
}
@ -319,25 +317,25 @@ private AdHocChatRoomMsnImpl createLocalAdHocChatRoomInstance(
* @param reason the reason
*/
public void fireLocalUserPresenceEvent( AdHocChatRoom adHocChatRoom,
String eventType,
String reason)
String eventType,
String reason)
{
LocalUserAdHocChatRoomPresenceChangeEvent evt
= new LocalUserAdHocChatRoomPresenceChangeEvent(this,
adHocChatRoom,
eventType,
reason);
= new LocalUserAdHocChatRoomPresenceChangeEvent(this,
adHocChatRoom,
eventType,
reason);
Iterator<LocalUserAdHocChatRoomPresenceListener> listeners = null;
synchronized(this.presenceListeners)
{
listeners = new ArrayList<LocalUserAdHocChatRoomPresenceListener>
(this.presenceListeners).iterator();
(this.presenceListeners).iterator();
}
while (listeners.hasNext())
{
LocalUserAdHocChatRoomPresenceListener listener = listeners.next();
LocalUserAdHocChatRoomPresenceListener listener = listeners.next();
listener.localUserAdHocPresenceChanged(evt);
}
@ -379,7 +377,7 @@ public boolean isGroupChatMessage(MsnSwitchboard switchboard)
* @param listener the listener to remove
*/
public void removePresenceListener(
LocalUserAdHocChatRoomPresenceListener listener)
LocalUserAdHocChatRoomPresenceListener listener)
{
synchronized (this.presenceListeners)
{
@ -398,24 +396,24 @@ public void removePresenceListener(
* the server.
*/
private void assertConnected()
throws OperationFailedException,
OperationNotSupportedException
throws OperationFailedException,
OperationNotSupportedException
{
if (this.provider == null)
throw new IllegalStateException(
"The provider must be non-null and signed on the "
+ "service before being able to communicate.");
+ "service before being able to communicate.");
if (!this.provider.isRegistered())
throw new IllegalStateException(
"The provider must be signed on the service before "
+ "being able to communicate.");
+ "being able to communicate.");
}
/**
* Our listener that will tell us when we're registered to msn.
*/
private class RegistrationStateListener
implements RegistrationStateChangeListener
implements RegistrationStateChangeListener
{
/**
* The method is called by a ProtocolProvider implementation whenever a
@ -443,8 +441,8 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
* the the jml library.
*/
private class MsnMessageListener
extends MsnMessageAdapter
implements MsnEmailListener
extends MsnMessageAdapter
implements MsnEmailListener
{
/**
* Indicates that an instant message has been received.
@ -453,8 +451,8 @@ private class MsnMessageListener
* @param contact the contact sending the message
*/
public void instantMessageReceived( MsnSwitchboard switchboard,
MsnInstantMessage message,
MsnContact contact)
MsnInstantMessage message,
MsnContact contact)
{
if (!isGroupChatMessage(switchboard))
return;
@ -464,7 +462,7 @@ public void instantMessageReceived( MsnSwitchboard switchboard,
logger.debug("Group chat message received.");
AdHocChatRoomMsnImpl chatRoom
= getLocalAdHocChatRoomInstance(switchboard);
= getLocalAdHocChatRoomInstance(switchboard);
if (chatRoom == null)
{
@ -481,7 +479,7 @@ public void instantMessageReceived( MsnSwitchboard switchboard,
System.currentTimeMillis(),
newMessage,
AdHocChatRoomMessageReceivedEvent
.CONVERSATION_MESSAGE_RECEIVED);
.CONVERSATION_MESSAGE_RECEIVED);
chatRoom.fireMessageEvent(msgReceivedEvent);
}
@ -523,7 +521,7 @@ public void activityEmailNotificationReceived(
*
*/
private class MsnSwitchboardListener
extends MsnSwitchboardAdapter
extends MsnSwitchboardAdapter
{
/**
* Indicates that the given <tt>msnContact</tt> has joined the given
@ -532,39 +530,39 @@ private class MsnSwitchboardListener
* @param msnContact the contact that has joined
*/
public void contactJoinSwitchboard( MsnSwitchboard switchboard,
MsnContact msnContact)
MsnContact msnContact)
{
if (!isGroupChatMessage(switchboard))
return;
try
{
AdHocChatRoomMsnImpl chatRoom
= getLocalAdHocChatRoomInstance(switchboard);
= getLocalAdHocChatRoomInstance(switchboard);
if (chatRoom == null)
{
chatRoom = createLocalAdHocChatRoomInstance(switchboard);
}
OperationSetPersistentPresenceMsnImpl presenceOpSet
= (OperationSetPersistentPresenceMsnImpl) provider
.getOperationSet(OperationSetPersistentPresence.class);
= (OperationSetPersistentPresenceMsnImpl) provider
.getOperationSet(OperationSetPersistentPresence.class);
ContactMsnImpl contact
= presenceOpSet.getServerStoredContactList()
.findContactById(
msnContact.getEmail().getEmailAddress());
= presenceOpSet.getServerStoredContactList()
.findContactById(
msnContact.getEmail().getEmailAddress());
if (contact == null)
contact = new ContactMsnImpl(
msnContact,
presenceOpSet.getServerStoredContactList(),
false,
false);
msnContact,
presenceOpSet.getServerStoredContactList(),
false,
false);
chatRoom.addAdHocChatRoomParticipant( msnContact.getId(),
contact);
contact);
}
catch (Exception e)
{
@ -579,13 +577,13 @@ public void contactJoinSwitchboard( MsnSwitchboard switchboard,
* @param contact the contact that has left
*/
public void contactLeaveSwitchboard(MsnSwitchboard switchboard,
MsnContact contact)
MsnContact contact)
{
logger
.debug(contact.getDisplayName() + " has left the Switchboard");
.debug(contact.getDisplayName() + " has left the Switchboard");
AdHocChatRoomMsnImpl chatRoom
= getLocalAdHocChatRoomInstance(switchboard);
= getLocalAdHocChatRoomInstance(switchboard);
if (chatRoom == null)
return;
@ -593,7 +591,7 @@ public void contactLeaveSwitchboard(MsnSwitchboard switchboard,
String participantId = contact.getId();
Contact participant
= chatRoom.getAdHocChatRoomParticipant(participantId);
= chatRoom.getAdHocChatRoomParticipant(participantId);
if (participant != null)
{
@ -608,7 +606,7 @@ public void contactLeaveSwitchboard(MsnSwitchboard switchboard,
public void switchboardClosed(MsnSwitchboard switchboard)
{
AdHocChatRoomMsnImpl adHocChatRoom
= getLocalAdHocChatRoomInstance(switchboard);
= getLocalAdHocChatRoomInstance(switchboard);
if (adHocChatRoom == null)
return;
@ -619,7 +617,7 @@ public void switchboardClosed(MsnSwitchboard switchboard)
adHocChatRoom.leave();
fireLocalUserPresenceEvent(adHocChatRoom,
LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_DROPPED ,
"Switchboard closed.");
"Switchboard closed.");
}
}
@ -629,15 +627,15 @@ public void switchboardClosed(MsnSwitchboard switchboard)
*/
public void switchboardStarted(MsnSwitchboard switchboard)
{
Object switchboardID = switchboard.getAttachment();
Object switchboardID = switchboard.getAttachment();
AdHocChatRoomMsnImpl adHocChatRoom = null;
if (switchboardID != null
&& pendingAdHocChatRoomList.containsKey(switchboardID))
&& pendingAdHocChatRoomList.containsKey(switchboardID))
{
adHocChatRoom
= (AdHocChatRoomMsnImpl) pendingAdHocChatRoomList
.get(switchboardID);
= (AdHocChatRoomMsnImpl) pendingAdHocChatRoomList
.get(switchboardID);
// Remove this room from the list of pending chat rooms.
pendingAdHocChatRoomList.remove(switchboardID);
@ -656,7 +654,7 @@ public void switchboardStarted(MsnSwitchboard switchboard)
* Note: Not supported inside the MSN.
*/
public void rejectInvitation(AdHocChatRoomInvitation invitation,
String rejectReason)
String rejectReason)
{
// there is no way to block invitations, because there arn't any
// invitations.

@ -25,7 +25,7 @@
* @author Yana Stamcheva
*/
public class OperationSetAdHocMultiUserChatYahooImpl
implements OperationSetAdHocMultiUserChat
implements OperationSetAdHocMultiUserChat
{
private static final Logger logger =
Logger.getLogger(OperationSetAdHocMultiUserChatYahooImpl.class);
@ -34,28 +34,28 @@ public class OperationSetAdHocMultiUserChatYahooImpl
* A list of listeners subscribed for invitations multi user chat events.
*/
private final List<AdHocChatRoomInvitationListener> invitationListeners
= new Vector<AdHocChatRoomInvitationListener>();
= new Vector<AdHocChatRoomInvitationListener>();
/**
* A list of listeners subscribed for events indicating rejection of a multi
* user chat invitation sent by us.
*/
private final List<AdHocChatRoomInvitationRejectionListener>
invitationRejectionListeners
= new Vector<AdHocChatRoomInvitationRejectionListener>();
invitationRejectionListeners
= new Vector<AdHocChatRoomInvitationRejectionListener>();
/**
* Listeners that will be notified of changes in our status in the room such
* as us being kicked, banned, or granted admin permissions.
*/
private final List<LocalUserAdHocChatRoomPresenceListener> presenceListeners
= new Vector<LocalUserAdHocChatRoomPresenceListener>();
= new Vector<LocalUserAdHocChatRoomPresenceListener>();
/**
* A list of the rooms that are currently open by this account.
*/
private final Hashtable<String, AdHocChatRoomYahooImpl> chatRoomCache
= new Hashtable<String, AdHocChatRoomYahooImpl>();
= new Hashtable<String, AdHocChatRoomYahooImpl>();
/**
* The currently valid Yahoo protocol provider service implementation.
@ -87,11 +87,11 @@ public class OperationSetAdHocMultiUserChatYahooImpl
this.yahooProvider = yahooProvider;
yahooProvider
.addRegistrationStateChangeListener(new RegistrationStateListener());
.addRegistrationStateChangeListener(new RegistrationStateListener());
opSetBasic =
(OperationSetBasicInstantMessagingYahooImpl) yahooProvider
.getOperationSet(OperationSetBasicInstantMessaging.class);
.getOperationSet(OperationSetBasicInstantMessaging.class);
}
/**
@ -206,8 +206,8 @@ public void removePresenceListener(
* @return ChatRoom the chat room that we've just created.
*/
public AdHocChatRoom createAdHocChatRoom(String roomName,
Map<String, Object> roomProperties)
throws OperationFailedException
Map<String, Object> roomProperties)
throws OperationFailedException
{
return createAdHocChatRoom(roomName, (String[]) null, "");
}
@ -219,27 +219,29 @@ public AdHocChatRoom createAdHocChatRoom(String roomName,
*
* @return the ad-hoc room that has been just created
* @param adHocRoomName the name of the room to be created
* @param contacts the list of contacts
* @param contacts the list of contacts ID
* @param reason the reason for contacts' invitation
* @throws OperationFailedException if the room couldn't be created for
* some reason
*/
public AdHocChatRoom createAdHocChatRoom( String adHocRoomName,
List<Contact> contacts,
String reason)
throws OperationFailedException
List<String> contacts,
String reason)
throws OperationFailedException
{
String[] contactsToInvite = new String[contacts.size()];
for(int i=0; i<contacts.size(); i++)
{ System.out.println(contacts.get(i).getAddress()+" is being invited");
contactsToInvite[i] = contacts.get(i).getAddress();
}
String[] contactsToInvite = new String[contacts.size()];
for(int i=0; i<contacts.size(); i++)
{
contactsToInvite[i] = contacts.get(i);
}
return createAdHocChatRoom(
adHocRoomName, contactsToInvite, reason);
adHocRoomName, contactsToInvite, reason);
}
/**
*
* Creates an ad-hoc room with the named <tt>adHocRoomName</tt> and in
* including to the specified <tt>contacts</tt>. When the method returns the
* ad-hoc room the local user will have joined it.
*
* @param roomName name of the chatroom
* @param invitedContacts contacts to be invited to this room
@ -248,10 +250,10 @@ public AdHocChatRoom createAdHocChatRoom( String adHocRoomName,
* @throws OperationFailedException
*/
private AdHocChatRoom createAdHocChatRoom(
String roomName,
String[] invitedContacts,
String reason)
throws OperationFailedException
String roomName,
String[] invitedContacts,
String reason)
throws OperationFailedException
{
if (invitedContacts == null)
invitedContacts = new String[0];
@ -271,7 +273,7 @@ private AdHocChatRoom createAdHocChatRoom(
catch (Exception e)
{
String errorMessage
= "Failed to create chat room with name: " + roomName;
= "Failed to create chat room with name: " + roomName;
logger.debug(errorMessage, e);
throw new OperationFailedException(errorMessage,
@ -295,14 +297,14 @@ private AdHocChatRoomYahooImpl createLocalChatRoomInstance(
synchronized (chatRoomCache)
{
AdHocChatRoomYahooImpl newChatRoom
= new AdHocChatRoomYahooImpl(yahooConference, yahooProvider);
= new AdHocChatRoomYahooImpl(yahooConference, yahooProvider);
chatRoomCache.put(yahooConference.getName(), newChatRoom);
return newChatRoom;
}
}
/**
* Creates a <tt>AdHocChatRoom</tt> instance (where the inviter is
* represented by inviterID parameter) from the specified Yahoo conference.
@ -318,14 +320,14 @@ private AdHocChatRoomYahooImpl createLocalChatRoomInstance(
synchronized (chatRoomCache)
{
AdHocChatRoomYahooImpl newChatRoom
= new AdHocChatRoomYahooImpl(yahooConference, yahooProvider);
= new AdHocChatRoomYahooImpl(yahooConference, yahooProvider);
OperationSetPersistentPresenceYahooImpl opSetPresence =
(OperationSetPersistentPresenceYahooImpl) yahooProvider
.getOperationSet(OperationSetPersistentPresence.class);
(OperationSetPersistentPresenceYahooImpl) yahooProvider
.getOperationSet(OperationSetPersistentPresence.class);
newChatRoom.addChatRoomParticipant(
opSetPresence.findContactByID(inviterID));
opSetPresence.findContactByID(inviterID));
chatRoomCache.put(yahooConference.getName(), newChatRoom);
return newChatRoom;
@ -342,7 +344,7 @@ private AdHocChatRoomYahooImpl createLocalChatRoomInstance(
* <tt>conference</tt> if such exists, otherwise returns null
*/
private AdHocChatRoomYahooImpl getLocalChatRoomInstance(
YahooConference conference)
YahooConference conference)
{
synchronized (chatRoomCache)
{
@ -402,8 +404,8 @@ public void fireInvitationEvent(AdHocChatRoom targetChatRoom,
synchronized (invitationListeners)
{
listeners
= new ArrayList<AdHocChatRoomInvitationListener>(
invitationListeners);
= new ArrayList<AdHocChatRoomInvitationListener>(
invitationListeners);
}
for (AdHocChatRoomInvitationListener listener : listeners)
@ -430,8 +432,8 @@ public void fireInvitationRejectedEvent(AdHocChatRoom sourceChatRoom,
synchronized (invitationRejectionListeners)
{
listeners
= new ArrayList<AdHocChatRoomInvitationRejectionListener>(
invitationRejectionListeners);
= new ArrayList<AdHocChatRoomInvitationRejectionListener>(
invitationRejectionListeners);
}
for (AdHocChatRoomInvitationRejectionListener listener : listeners)
@ -460,7 +462,7 @@ public void fireLocalUserPresenceEvent(AdHocChatRoom chatRoom,
{
listeners =
new ArrayList<LocalUserAdHocChatRoomPresenceListener>(
presenceListeners);
presenceListeners);
}
for (LocalUserAdHocChatRoomPresenceListener listener : listeners)
@ -502,7 +504,7 @@ public Message createMessage(String messageText)
*
*/
private class RegistrationStateListener
implements RegistrationStateChangeListener
implements RegistrationStateChangeListener
{
/**
* The method is called by a ProtocolProvider implementation whenever a
@ -528,7 +530,7 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
*
*/
private class YahooMessageListener
extends SessionAdapter
extends SessionAdapter
{
public void conferenceInviteDeclinedReceived(SessionConferenceEvent ev)
@ -555,16 +557,16 @@ public void conferenceInviteReceived(SessionConferenceEvent ev)
try
{
AdHocChatRoom chatRoom = getLocalChatRoomInstance(ev.getRoom());
if (chatRoom == null)
{
chatRoom =
createLocalChatRoomInstance(ev.getRoom(), ev.getFrom());
createLocalChatRoomInstance(ev.getRoom(), ev.getFrom());
fireInvitationEvent(
chatRoom, ev.getFrom(), ev.getMessage());
chatRoom, ev.getFrom(), ev.getMessage());
}
}
catch (Exception e)
{
@ -579,7 +581,7 @@ public void conferenceLogoffReceived(SessionConferenceEvent ev)
try
{
AdHocChatRoomYahooImpl chatRoom
= getLocalChatRoomInstance(ev.getRoom());
= getLocalChatRoomInstance(ev.getRoom());
if (chatRoom != null)
{
@ -592,7 +594,7 @@ public void conferenceLogoffReceived(SessionConferenceEvent ev)
catch (Exception e)
{
logger
.debug("Failed to remove a user from the chat room. " + e);
.debug("Failed to remove a user from the chat room. " + e);
}
}
@ -603,14 +605,14 @@ public void conferenceLogonReceived(SessionConferenceEvent ev)
try
{
AdHocChatRoomYahooImpl chatRoom
= getLocalChatRoomInstance(ev.getRoom());
= getLocalChatRoomInstance(ev.getRoom());
if (chatRoom != null)
{
OperationSetPersistentPresenceYahooImpl presenceOpSet =
(OperationSetPersistentPresenceYahooImpl) chatRoom
.getParentProvider().getOperationSet(
OperationSetPersistentPresence.class);
.getParentProvider().getOperationSet(
OperationSetPersistentPresence.class);
Contact participant =
presenceOpSet.findContactByID(ev.getFrom());
@ -637,7 +639,7 @@ public void conferenceMessageReceived(SessionConferenceEvent ev)
// first.
if (formattedMessage.startsWith("\u001b"))
formattedMessage
= messageDecoder.decodeToHTML(formattedMessage);
= messageDecoder.decodeToHTML(formattedMessage);
formattedMessage = opSetBasic.processLinks(formattedMessage);
@ -646,11 +648,11 @@ public void conferenceMessageReceived(SessionConferenceEvent ev)
// here, the zero 0 correspond to 10px
formattedMessage =
formattedMessage.replaceAll("(<font) (.*) size=\"0\">",
"$1 $2 size=\"10\">");
"$1 $2 size=\"10\">");
formattedMessage =
formattedMessage.replaceAll(
"(<font) (.*) size=\"(\\d+)\">",
"$1 $2 style=\"font-size: $3px;\">");
"$1 $2 style=\"font-size: $3px;\">");
logger.debug("formatted Message : " + formattedMessage);
// As no indications in the protocol is it html or not. No harm
@ -679,7 +681,7 @@ public void conferenceMessageReceived(SessionConferenceEvent ev)
System.currentTimeMillis(),
newMessage,
AdHocChatRoomMessageReceivedEvent
.CONVERSATION_MESSAGE_RECEIVED);
.CONVERSATION_MESSAGE_RECEIVED);
chatRoom.fireMessageEvent(msgReceivedEvent);
}
@ -687,8 +689,8 @@ public void conferenceMessageReceived(SessionConferenceEvent ev)
catch (Exception e)
{
logger
.debug("Error while receiving a multi user chat message: "
+ e);
.debug("Error while receiving a multi user chat message: "
+ e);
}
}

@ -28,11 +28,11 @@
* @author Yana Stamcheva
*/
public class AccountDetailsPanel
extends TransparentPanel
extends TransparentPanel
{
private static final long serialVersionUID = 5524135388175045624L;
private static final long serialVersionUID = 5524135388175045624L;
private Logger logger = Logger.getLogger(AccountDetailsPanel.class);
private Logger logger = Logger.getLogger(AccountDetailsPanel.class);
/**
* The operation set giving access to the server stored account details.
@ -63,7 +63,7 @@ public class AccountDetailsPanel
private JLabel avatarLabel = new JLabel();
private JButton applyButton
= new JButton(Resources.getString("service.gui.APPLY"));
= new JButton(Resources.getString("service.gui.APPLY"));
private JPanel buttonPanel =
new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
@ -108,11 +108,10 @@ public AccountDetailsPanel(ProtocolProviderService protocolProvider)
super(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// this.setPreferredSize(new Dimension(500, 400));
// this.setPreferredSize(new Dimension(500, 400));
accountInfoOpSet
= protocolProvider
.getOperationSet(OperationSetServerStoredAccountInfo.class);
accountInfoOpSet = protocolProvider
.getOperationSet(OperationSetServerStoredAccountInfo.class);
this.protocolProvider = protocolProvider;
@ -143,7 +142,7 @@ private void initSummaryPanel()
JPanel avatarPanel = new TransparentPanel(new BorderLayout());
JButton changeAvatarButton = new JButton(Resources.getString("plugin.accountinfo.CHANGE"));
JPanel changeButtonPanel
= new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
= new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
changeAvatarButton.addActionListener(new ChangeAvatarActionListener());
@ -169,7 +168,7 @@ private void initSummaryPanel()
labelsPanel.add(new JLabel(
Resources.getString("plugin.accountinfo.FIRST_NAME")));
// labelsPanel.add(new JLabel(Resources.getString("plugin.accountinfo.MIDDLE_NAME")));
// labelsPanel.add(new JLabel(Resources.getString("plugin.accountinfo.MIDDLE_NAME")));
labelsPanel.add(new JLabel(
Resources.getString("plugin.accountinfo.LAST_NAME")));
labelsPanel.add(new JLabel(
@ -189,7 +188,7 @@ private void initSummaryPanel()
JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1, 5, 5));
valuesPanel.add(firstNameField);
// valuesPanel.add(middleNameField);
// valuesPanel.add(middleNameField);
valuesPanel.add(lastNameField);
valuesPanel.add(genderField);
valuesPanel.add(ageField);
@ -264,7 +263,7 @@ private void loadSummaryDetails()
// Avatar details.
contactDetails
= accountInfoOpSet.getDetails(BinaryDetail.class);
= accountInfoOpSet.getDetails(BinaryDetail.class);
byte[] avatarImage = null;
if (contactDetails.hasNext())
@ -331,7 +330,7 @@ private void loadSummaryDetails()
{
genderDetail = (GenderDetail) contactDetails.next();
genderDetailString = genderDetailString + " "
+ genderDetail.getDetailValue();
+ genderDetail.getDetailValue();
}
genderField.setText(genderDetailString);
@ -375,7 +374,7 @@ private void loadSummaryDetails()
{
emailDetail = (EmailAddressDetail) contactDetails.next();
emailDetailString = emailDetailString + " "
+ emailDetail.getDetailValue();
+ emailDetail.getDetailValue();
}
emailField.setText(emailDetailString);
@ -466,14 +465,14 @@ else if (detail instanceof LocaleDetail)
detailLabel.setText(detail.getDetailDisplayName() + ": ");
detailValueArea.setText(((Locale) detail.getDetailValue())
.getDisplayName().trim());
.getDisplayName().trim());
}
else if (detail instanceof TimeZoneDetail)
{
detailLabel.setText(detail.getDetailDisplayName() + ": ");
detailValueArea.setText(((TimeZone) detail.getDetailValue())
.getDisplayName().trim());
.getDisplayName().trim());
}
else
{
@ -487,15 +486,15 @@ else if (detail instanceof TimeZoneDetail)
// If the contact's protocol supports web info, give them a button to
// get it
if (protocolProvider.getOperationSet(
OperationSetWebContactInfo.class) != null)
OperationSetWebContactInfo.class) != null)
{
final String urlString
= protocolProvider
.getOperationSet(OperationSetWebContactInfo.class)
.getWebContactInfo(
protocolProvider
.getAccountID().getAccountAddress())
.toString();
= protocolProvider
.getOperationSet(OperationSetWebContactInfo.class)
.getWebContactInfo(
protocolProvider
.getAccountID().getAccountAddress())
.toString();
JLabel webInfoLabel = new JLabel("Click to see web info: ");
JEditorPane webInfoValue = new JEditorPane();
@ -510,19 +509,19 @@ else if (detail instanceof TimeZoneDetail)
webInfoValue.setContentType("text/html");
webInfoValue.setEditable(false);
webInfoValue.setText( "<a href='"
+ urlString + "'>"
+ protocolProvider.getAccountID().getUserID()
+ " web info</a>");
+ urlString + "'>"
+ protocolProvider.getAccountID().getUserID()
+ " web info</a>");
webInfoValue.addHyperlinkListener(new HyperlinkListener()
{
public void hyperlinkUpdate(HyperlinkEvent e)
{
if (e.getEventType()
.equals(HyperlinkEvent.EventType.ACTIVATED))
.equals(HyperlinkEvent.EventType.ACTIVATED))
{
AccountInfoActivator
.getBrowserLauncher().openURL(urlString);
.getBrowserLauncher().openURL(urlString);
}
}
});
@ -544,7 +543,7 @@ private class SubmitActionListener implements ActionListener
public void actionPerformed(ActionEvent e)
{
String firstName = firstNameField.getText();
// String middleName = middleNameField.getText();
// String middleName = middleNameField.getText();
String lastName = lastNameField.getText();
String gender = genderField.getText();
String email = emailField.getText();
@ -558,7 +557,7 @@ public void actionPerformed(ActionEvent e)
try
{
DateFormat dateFormat
= DateFormat.getDateInstance(DateFormat.DEFAULT);
= DateFormat.getDateInstance(DateFormat.DEFAULT);
Date birthDate = dateFormat.parse(birthdayField.getText());
@ -573,25 +572,25 @@ public void actionPerformed(ActionEvent e)
try
{
FirstNameDetail newFirstNameDetail
= new ServerStoredDetails.FirstNameDetail(firstName);
= new ServerStoredDetails.FirstNameDetail(firstName);
if (firstNameDetail == null)
accountInfoOpSet.addDetail(newFirstNameDetail);
else
accountInfoOpSet.replaceDetail( firstNameDetail,
newFirstNameDetail);
newFirstNameDetail);
// MiddleNameDetail newMiddleNameDetail
// = new ServerStoredDetails.MiddleNameDetail(middleName);
//
// if (middleNameDetail == null)
// accountInfoOpSet.addDetail(newMiddleNameDetail);
// else
// accountInfoOpSet.replaceDetail( middleNameDetail,
// newMiddleNameDetail);
// MiddleNameDetail newMiddleNameDetail
// = new ServerStoredDetails.MiddleNameDetail(middleName);
//
// if (middleNameDetail == null)
// accountInfoOpSet.addDetail(newMiddleNameDetail);
// else
// accountInfoOpSet.replaceDetail( middleNameDetail,
// newMiddleNameDetail);
LastNameDetail newLastNameDetail
= new ServerStoredDetails.LastNameDetail(lastName);
= new ServerStoredDetails.LastNameDetail(lastName);
if (lastNameDetail == null)
accountInfoOpSet.addDetail(newLastNameDetail);
@ -600,51 +599,51 @@ public void actionPerformed(ActionEvent e)
newLastNameDetail);
GenderDetail newGenderDetail
= new ServerStoredDetails.GenderDetail(gender);
= new ServerStoredDetails.GenderDetail(gender);
if (genderDetail == null)
accountInfoOpSet.addDetail(newGenderDetail);
else
accountInfoOpSet.replaceDetail( genderDetail,
newGenderDetail);
newGenderDetail);
BirthDateDetail newBirthDateDetail
= new ServerStoredDetails.BirthDateDetail(birthDateCalendar);
= new ServerStoredDetails.BirthDateDetail(birthDateCalendar);
if (birthDateDetail == null)
accountInfoOpSet.addDetail(newBirthDateDetail);
else
accountInfoOpSet.replaceDetail( birthDateDetail,
newBirthDateDetail);
newBirthDateDetail);
EmailAddressDetail newEmailDetail
= new ServerStoredDetails.EmailAddressDetail(email);
= new ServerStoredDetails.EmailAddressDetail(email);
if (emailDetail == null)
accountInfoOpSet.addDetail(newEmailDetail);
else
accountInfoOpSet.replaceDetail( emailDetail,
newEmailDetail);
newEmailDetail);
PhoneNumberDetail newPhoneDetail
= new ServerStoredDetails.PhoneNumberDetail(phoneNumber);
= new ServerStoredDetails.PhoneNumberDetail(phoneNumber);
if (phoneDetail == null)
accountInfoOpSet.addDetail(newPhoneDetail);
else
accountInfoOpSet.replaceDetail( phoneDetail,
newPhoneDetail);
newPhoneDetail);
BinaryDetail newAvatarDetail
= new ServerStoredDetails.BinaryDetail(
"Avatar",
newAvatarImage);
= new ServerStoredDetails.BinaryDetail(
"Avatar",
newAvatarImage);
if (avatarDetail == null)
accountInfoOpSet.addDetail(newAvatarDetail);
else
accountInfoOpSet.replaceDetail( avatarDetail,
newAvatarDetail);
newAvatarDetail);
}
catch (ClassCastException e1)
{
@ -662,9 +661,9 @@ private class ChangeAvatarActionListener implements ActionListener
public void actionPerformed(ActionEvent e)
{
SipCommFileChooser chooser = GenericFileDialog.create(
null, "Change avatar...",
SipCommFileChooser.LOAD_FILE_OPERATION,
lastAvatarDir.getAbsolutePath());
null, "Change avatar...",
SipCommFileChooser.LOAD_FILE_OPERATION,
lastAvatarDir.getAbsolutePath());
chooser.addFilter(new ImageFilter());
File file = chooser.getFileFromDialog();
@ -699,14 +698,14 @@ public void actionPerformed(ActionEvent e)
* A custom filter that would accept only image files.
*/
private static class ImageFilter extends SipCommFileFilter
{
{
/**
* Accept all directories and all gif, jpg, tiff, or png files.
* Method implemented from FileFilter abstract class.
*
* @param f a file to accept or not
*/
@Override
@Override
public boolean accept(File f)
{
if (f.isDirectory())
@ -774,7 +773,7 @@ private Image getScaledImageInstance(byte[] image)
try
{
resultImage = ImageIO.read(
new ByteArrayInputStream(image));
new ByteArrayInputStream(image));
}
catch (Exception e)
{

@ -36,9 +36,9 @@ public class NotificationConfigurationPanel
DocumentListener,
NotificationChangeListener
{
private static final long serialVersionUID = 5784331951722787598L;
private static final long serialVersionUID = 5784331951722787598L;
private final Logger logger
private final Logger logger
= Logger.getLogger(NotificationConfigurationPanel.class);
// Declaration of variables on the table notifications
@ -324,9 +324,9 @@ public NotificationConfigurationPanel()
fileChooserSound = GenericFileDialog.create(null, "Choose a sound...",
SipCommFileChooser.LOAD_FILE_OPERATION);
SipCommFileChooser.LOAD_FILE_OPERATION);
fileChooserProgram = GenericFileDialog.create(null,
"Choose a program...", SipCommFileChooser.LOAD_FILE_OPERATION);
"Choose a program...", SipCommFileChooser.LOAD_FILE_OPERATION);
//fileChooserSound.setMultiSelectionEnabled(false);
//fileChooserProgram.setMultiSelectionEnabled(false);
fileChooserSound.addFilter(new SoundFilter());
@ -410,7 +410,7 @@ else if(e.getSource() == deactivate)
}
else if(e.getSource() == soundFileChooser)
{
File file = fileChooserSound.getFileFromDialog();
File file = fileChooserSound.getFileFromDialog();
noListener = true;
if (file != null)
@ -443,7 +443,7 @@ else if(e.getSource() == soundFileChooser)
}
else if(e.getSource() == programFileChooser)
{
File file = fileChooserProgram.getFileFromDialog();
File file = fileChooserProgram.getFileFromDialog();
noListener = true;
if (file != null)

@ -23,7 +23,7 @@ public class NewBundleDialog
implements ActionListener
{private static final long serialVersionUID = 7638976584338100969L;
private JButton installButton
private JButton installButton
= new JButton(Resources.getString("plugin.pluginmanager.INSTALL"));
private JButton cancelButton
@ -103,8 +103,8 @@ public void actionPerformed (ActionEvent e)
else if (sourceButton.equals(fileChooserButton))
{
SipCommFileChooser chooser = GenericFileDialog.create(
null, "New bundle...",
SipCommFileChooser.LOAD_FILE_OPERATION);
null, "New bundle...",
SipCommFileChooser.LOAD_FILE_OPERATION);
File newBundleFile
= chooser.getFileFromDialog();

@ -34,9 +34,9 @@ public class FirstWizardPage
extends TransparentPanel
implements WizardPage, DocumentListener
{
private static final long serialVersionUID = 8576006544813706541L;
private static final long serialVersionUID = 8576006544813706541L;
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
private JPanel accountPanel = new TransparentPanel(new BorderLayout(10, 10));
@ -214,12 +214,12 @@ private void init()
{
public void actionPerformed(ActionEvent event)
{
identityFileChooser = GenericFileDialog.create(
null, "Select Identify File",
SipCommFileChooser.LOAD_FILE_OPERATION);
File f = identityFileChooser.getFileFromDialog();
identityFileChooser = GenericFileDialog.create(
null, "Select Identify File",
SipCommFileChooser.LOAD_FILE_OPERATION);
File f = identityFileChooser.getFileFromDialog();
if(f != null)
if(f != null)
identityFileField.setText(f.getAbsolutePath());
}
}
@ -229,13 +229,13 @@ public void actionPerformed(ActionEvent event)
{
public void actionPerformed(ActionEvent event)
{
knownHostsFileChooser = GenericFileDialog.create(
null, "Select SSH Known Hosts File",
SipCommFileChooser.LOAD_FILE_OPERATION);
File f = knownHostsFileChooser.getFileFromDialog();
knownHostsFileChooser = GenericFileDialog.create(
null, "Select SSH Known Hosts File",
SipCommFileChooser.LOAD_FILE_OPERATION);
File f = knownHostsFileChooser.getFileFromDialog();
if(f != null)
knownHostsFileField.setText(f.getAbsolutePath());
if(f != null)
knownHostsFileField.setText(f.getAbsolutePath());
}
}
);

@ -34,9 +34,9 @@
public class WhiteboardFrame
extends SIPCommFrame
{
private static final long serialVersionUID = 5441329948483907247L;
private static final long serialVersionUID = 5441329948483907247L;
private static final Logger logger =
private static final Logger logger =
Logger.getLogger(WhiteboardFrame.class);
/**
@ -219,7 +219,7 @@ public class WhiteboardFrame
* List of WhiteboardShape
*/
private List<WhiteboardShape> displayList =
new CopyOnWriteArrayList<WhiteboardShape>();
new CopyOnWriteArrayList<WhiteboardShape>();
/**
* Aarray of WhiteboardPoint
@ -699,7 +699,7 @@ else if (shape.getSelectionPoint(s2w.transform(e
{
setCursor(Cursor.getPredefinedCursor(
Cursor.CROSSHAIR_CURSOR));
Cursor.CROSSHAIR_CURSOR));
if (preselected == null)
{
@ -859,7 +859,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
jToolBar1.add(jButtonSave);
jButtonOpen.setToolTipText(
Resources.getString("plugin.whiteboard.OPEN"));
Resources.getString("plugin.whiteboard.OPEN"));
jButtonOpen.setEnabled(false);
jToolBar1.add(jButtonOpen);
@ -881,7 +881,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(selectionButton);
selectionButton.setToolTipText(
Resources.getString("plugin.whiteboard.SELECT"));
Resources.getString("plugin.whiteboard.SELECT"));
selectionButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -894,7 +894,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(modifButton);
modifButton.setToolTipText(
Resources.getString("plugin.whiteboard.MODIFICATION"));
Resources.getString("plugin.whiteboard.MODIFICATION"));
modifButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -931,7 +931,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(lineButton);
lineButton.setToolTipText(
Resources.getString("plugin.whiteboard.LINE"));
Resources.getString("plugin.whiteboard.LINE"));
lineButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -944,7 +944,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(polylineButton);
polylineButton.setToolTipText(
Resources.getString("plugin.whiteboard.POLYLINE"));
Resources.getString("plugin.whiteboard.POLYLINE"));
polylineButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -969,7 +969,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(fillRectangleButton);
fillRectangleButton.setToolTipText(
Resources.getString("plugin.whiteboard.FILLED_RECTANGLE"));
Resources.getString("plugin.whiteboard.FILLED_RECTANGLE"));
fillRectangleButton
.addActionListener(new java.awt.event.ActionListener()
{
@ -983,7 +983,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(imageButton);
imageButton.setToolTipText(
Resources.getString("plugin.whiteboard.IMAGE"));
Resources.getString("plugin.whiteboard.IMAGE"));
imageButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -996,7 +996,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(polygonButton);
polygonButton.setToolTipText(
Resources.getString("plugin.whiteboard.POLYGON"));
Resources.getString("plugin.whiteboard.POLYGON"));
polygonButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -1009,7 +1009,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(fillPolygonButton);
fillPolygonButton.setToolTipText(
Resources.getString("plugin.whiteboard.FILLEDPOLYGON"));
Resources.getString("plugin.whiteboard.FILLEDPOLYGON"));
fillPolygonButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -1022,7 +1022,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(circleButton);
circleButton.setToolTipText(
Resources.getString("plugin.whiteboard.CIRCLE"));
Resources.getString("plugin.whiteboard.CIRCLE"));
circleButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -1035,7 +1035,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
buttonGroup.add(fillCircleButton);
fillCircleButton.setToolTipText(
Resources.getString("plugin.whiteboard.FILLED_CIRCLE"));
Resources.getString("plugin.whiteboard.FILLED_CIRCLE"));
fillCircleButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -1047,7 +1047,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
toolBar.add(fillCircleButton);
colorChooserButton.setToolTipText(
Resources.getString("plugin.whiteboard.COLOR"));
Resources.getString("plugin.whiteboard.COLOR"));
colorChooserButton
.addActionListener(new java.awt.event.ActionListener()
{
@ -1069,7 +1069,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
jPanel2.setLayout(new GridBagLayout());
jLabelThickness.setText(
Resources.getString("plugin.whiteboard.THICKNESS"));
Resources.getString("plugin.whiteboard.THICKNESS"));
jPanel2.add(jLabelThickness);
@ -1149,7 +1149,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
editMenu.add(gridMenuItem);
deselectMenuItem.setText(
Resources.getString("plugin.whiteboard.DESELECT"));
Resources.getString("plugin.whiteboard.DESELECT"));
deselectMenuItem.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
@ -1182,7 +1182,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt)
editMenu.add(deleteMenuItem);
propertiesMenuItem.setText(
Resources.getString("plugin.whiteboard.PROPERTIES"));
Resources.getString("plugin.whiteboard.PROPERTIES"));
propertiesMenuItem.setEnabled(false);
editMenu.add(propertiesMenuItem);
@ -1223,9 +1223,9 @@ private void jButtonSaveActionPerformed(java.awt.event.ActionEvent evt)
{
SipCommFileChooser chooser = GenericFileDialog.create(
WhiteboardFrame.this,
"Save file...",
SipCommFileChooser.SAVE_FILE_OPERATION);
WhiteboardFrame.this,
"Save file...",
SipCommFileChooser.SAVE_FILE_OPERATION);
//chooser.removeChoosableFileFilter(chooser.getAcceptAllFileFilter());
WhiteboardFileFilter filterJpg =
@ -1293,7 +1293,7 @@ private void deselectMenuItemActionPerformed(java.awt.event.ActionEvent evt)
* @param evt
*/
private void jSpinnerThicknessStateChanged(
javax.swing.event.ChangeEvent evt)
javax.swing.event.ChangeEvent evt)
{// GEN-FIRST:event_jSpinnerThicknessStateChanged
if (selectedShape != null)
{
@ -1309,7 +1309,7 @@ private void jSpinnerThicknessStateChanged(
* @param evt
*/
private void fillCircleButtonActionPerformed(
java.awt.event.ActionEvent evt)
java.awt.event.ActionEvent evt)
{// GEN-FIRST:event_fillCircleButtonActionPerformed
if (fillCircleButton.isSelected())
currentTool = FILL_CIRCLE;
@ -1343,7 +1343,7 @@ private void polylineButtonActionPerformed(java.awt.event.ActionEvent evt)
* @param evt
*/
private void fillPolygonButtonActionPerformed(
java.awt.event.ActionEvent evt)
java.awt.event.ActionEvent evt)
{// GEN-FIRST:event_fillPolygonButtonActionPerformed
if (fillPolygonButton.isSelected())
currentTool = FILL_POLYGON;
@ -2049,9 +2049,9 @@ private void releasedImage()
doneDrawing = true;
SipCommFileChooser chooser = GenericFileDialog.create(
WhiteboardFrame.this,
"Choose image...",
SipCommFileChooser.LOAD_FILE_OPERATION);
WhiteboardFrame.this,
"Choose image...",
SipCommFileChooser.LOAD_FILE_OPERATION);
File file = chooser.getFileFromDialog();
WhiteboardFileFilter filter =

@ -52,7 +52,7 @@ public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
* @param adHocRoomName
* the name of the <tt>AdHocChatRoom</tt> to create.
* @param contacts
* the contacts who are added to the room when it's created;
* the contacts (ID) who are added to the room when it's created;
* <tt>null</tt> for no contacts
* @param reason the reason for this invitation
* @throws OperationFailedException
@ -63,7 +63,7 @@ public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
* @return the newly created <tt>AdHocChatRoom</tt> named <tt>roomName</tt>.
*/
public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
List<Contact> contacts, String reason)
List<String> contacts, String reason)
throws OperationFailedException, OperationNotSupportedException;
/**

@ -16,87 +16,86 @@
/**
* This class is the entry point for creating a file dialog regarding to the OS.
*
* If the current operating system is Apple Mac OS X, we create an AWT
* FileDialog (user interface is more practical under Mac OS than a
* JFileChooser), else, a Swing JFileChooser.
* If the current operating system is Apple Mac OS X, we create an AWT
* FileDialog (user interface is more practical under Mac OS than a
* JFileChooser), else, a Swing JFileChooser.
*
* @author Valentin Martinet
*/
public class GenericFileDialog
{
/**
* Creates a file dialog (AWT's FileDialog or Swing's JFileChooser) regarding to
* user's operating system.
*
* @param parent the parent Frame/JFrame of this dialog
* @param title dialog's title
* @return SipCommFileChooser an implementation of SipCommFileChooser
*/
public static SipCommFileChooser create(
Frame parent, String title, int fileOperation)
{
int operation = -1;
if(OSUtils.IS_MAC)
{
if(fileOperation == SipCommFileChooser.LOAD_FILE_OPERATION)
operation = FileDialog.LOAD;
else if(fileOperation == SipCommFileChooser.SAVE_FILE_OPERATION)
operation = FileDialog.SAVE;
else
try
{
throw new Exception("UnknownFileOperation");
}
catch (Exception e)
{
e.printStackTrace();
}
if (parent == null)
parent = new Frame();
return new SipCommFileDialogImpl(parent, title, operation);
}
else
{
if(fileOperation == SipCommFileChooser.LOAD_FILE_OPERATION)
operation = JFileChooser.OPEN_DIALOG;
else if(fileOperation == SipCommFileChooser.SAVE_FILE_OPERATION)
operation = JFileChooser.SAVE_DIALOG;
else
try
{
throw new Exception("UnknownFileOperation");
}
catch (Exception e)
{
e.printStackTrace();
}
return new SipCommFileChooserImpl(title, operation);
}
}
/**
* Creates a file dialog (AWT FileDialog or Swing JFileChooser) regarding to
* user's operating system.
*
* @param parent the parent Frame/JFrame of this dialog
* @param title dialog's title
* @param path start path of this dialog
* @return SipCommFileChooser an implementation of SipCommFileChooser
*/
public static SipCommFileChooser create(
Frame parent, String title, int fileOperation, String path)
{
SipCommFileChooser scfc =
GenericFileDialog.create(parent, title, fileOperation);
if(path != null)
scfc.setStartPath(path);
return scfc;
}
/**
* Creates a file dialog (AWT's FileDialog or Swing's JFileChooser)
* regarding to user's operating system.
*
* @param parent the parent Frame/JFrame of this dialog
* @param title dialog's title
* @return SipCommFileChooser an implementation of SipCommFileChooser
*/
public static SipCommFileChooser create(
Frame parent, String title, int fileOperation)
{
int operation = -1;
if(OSUtils.IS_MAC)
{
if(fileOperation == SipCommFileChooser.LOAD_FILE_OPERATION)
operation = FileDialog.LOAD;
else if(fileOperation == SipCommFileChooser.SAVE_FILE_OPERATION)
operation = FileDialog.SAVE;
else
try
{
throw new Exception("UnknownFileOperation");
}
catch (Exception e)
{
e.printStackTrace();
}
if (parent == null)
parent = new Frame();
return new SipCommFileDialogImpl(parent, title, operation);
}
else
{
if(fileOperation == SipCommFileChooser.LOAD_FILE_OPERATION)
operation = JFileChooser.OPEN_DIALOG;
else if(fileOperation == SipCommFileChooser.SAVE_FILE_OPERATION)
operation = JFileChooser.SAVE_DIALOG;
else
try
{
throw new Exception("UnknownFileOperation");
}
catch (Exception e)
{
e.printStackTrace();
}
return new SipCommFileChooserImpl(title, operation);
}
}
/**
* Creates a file dialog (AWT FileDialog or Swing JFileChooser) regarding to
* user's operating system.
*
* @param parent the parent Frame/JFrame of this dialog
* @param title dialog's title
* @param path start path of this dialog
* @return SipCommFileChooser an implementation of SipCommFileChooser
*/
public static SipCommFileChooser create(
Frame parent, String title, int fileOperation, String path)
{
SipCommFileChooser scfc =
GenericFileDialog.create(parent, title, fileOperation);
if(path != null)
scfc.setStartPath(path);
return scfc;
}
}

@ -24,49 +24,49 @@
*/
public interface SipCommFileChooser
{
/**
* Allows to request a 'load file' dialog (optional)
*/
public static int LOAD_FILE_OPERATION = 0;
/**
* Allows to request a 'save file' dialog (optional)
*/
public static int SAVE_FILE_OPERATION = 1;
/**
* Returns the selected file by the user from the dialog.
*
* @return File the selected file from the dialog
*/
public File getApprovedFile();
/**
* Sets the default path to be considered for browsing among files.
*
* @param path the default start path for this dialog
*/
public void setStartPath(String path);
/**
* Shows the dialog and returns the selected file.
*
* @return File the selected file in this dialog
*/
public File getFileFromDialog();
/**
* Adds a file filter to this dialog.
*
* @param filter the filter to add
*/
public void addFilter(SipCommFileFilter filter);
/**
* Returns the filter the user has chosen for saving a file.
*
* @return SipCommFileFilter the used filter when saving a file
*/
public SipCommFileFilter getUsedFilter();
/**
* Allows to request a 'load file' dialog (optional)
*/
public static int LOAD_FILE_OPERATION = 0;
/**
* Allows to request a 'save file' dialog (optional)
*/
public static int SAVE_FILE_OPERATION = 1;
/**
* Returns the selected file by the user from the dialog.
*
* @return File the selected file from the dialog
*/
public File getApprovedFile();
/**
* Sets the default path to be considered for browsing among files.
*
* @param path the default start path for this dialog
*/
public void setStartPath(String path);
/**
* Shows the dialog and returns the selected file.
*
* @return File the selected file in this dialog
*/
public File getFileFromDialog();
/**
* Adds a file filter to this dialog.
*
* @param filter the filter to add
*/
public void addFilter(SipCommFileFilter filter);
/**
* Returns the filter the user has chosen for saving a file.
*
* @return SipCommFileFilter the used filter when saving a file
*/
public SipCommFileFilter getUsedFilter();
}

@ -19,122 +19,122 @@ public class SipCommFileChooserImpl
extends JFileChooser
implements SipCommFileChooser
{
private static final long serialVersionUID = 6858528563334885869L;
private static final long serialVersionUID = 6858528563334885869L;
/**
* Parent component of this dialog (JFrame, Frame, etc)
*/
private Component parent;
/**
* Constructor
*
* @param title title for this dialog
* @param operation 'Save file' or 'Load file' operation
*/
public SipCommFileChooserImpl(String title, int operation)
{
super();
this.setDialogTitle(title);
this.setDialogType(operation);
}
/**
* Constructor
*
* @param path
*/
public SipCommFileChooserImpl(
Component pparent, String path, String title, int operation)
{
this(title, operation);
this.setStartPath(path);
this.parent = pparent;
}
/**
* Parent component of this dialog (JFrame, Frame, etc)
*/
private Component parent;
/**
* Returns the selected file by the user from the dialog.
*
* @return File the selected file from the dialog
*/
public File getApprovedFile()
{
return this.getSelectedFile();
}
/**
* Constructor
*
* @param title title for this dialog
* @param operation 'Save file' or 'Load file' operation
*/
public SipCommFileChooserImpl(String title, int operation)
{
super();
this.setDialogTitle(title);
this.setDialogType(operation);
}
/**
* Sets the default path to be considered for browsing among files.
*
* @param path the default start path for this dialog
*/
public void setStartPath(String path)
{
if(path == null)
{
// passing null makes file chooser points to user's default dir
this.setCurrentDirectory(null);
}
else
{
this.setCurrentDirectory(new File(path));
}
}
/**
* Shows the dialog and returns the selected file.
*
* @return File the selected file in this dialog
*/
public File getFileFromDialog()
{
int choice = -1;
if(this.getDialogType() == JFileChooser.OPEN_DIALOG)
{
choice = this.showOpenDialog(this.getParentComponent());
}
else
{
choice = this.showSaveDialog(this.getParentComponent());
}
if(choice == JFileChooser.APPROVE_OPTION)
{
return this.getSelectedFile();
}
else
{
return null;
}
}
/**
* Returns the parent component of this dialog
*
* @return Component dialog's parent component
*/
public Component getParentComponent()
{
return this.parent;
}
/**
* Constructor
*
* @param path
*/
public SipCommFileChooserImpl(
Component pparent, String path, String title, int operation)
{
this(title, operation);
this.setStartPath(path);
this.parent = pparent;
}
/**
* Adds a file filter to this dialog.
*
* @param filter the filter to add
*/
public void addFilter(SipCommFileFilter filter)
{
this.addChoosableFileFilter(filter);
}
/**
* Returns the filter the user has chosen for saving a file.
*
* @return SipCommFileFilter the used filter when saving a file
*/
public SipCommFileFilter getUsedFilter()
{
return (SipCommFileFilter)this.getFileFilter();
}
/**
* Returns the selected file by the user from the dialog.
*
* @return File the selected file from the dialog
*/
public File getApprovedFile()
{
return this.getSelectedFile();
}
/**
* Sets the default path to be considered for browsing among files.
*
* @param path the default start path for this dialog
*/
public void setStartPath(String path)
{
if(path == null)
{
// passing null makes file chooser points to user's default dir
this.setCurrentDirectory(null);
}
else
{
this.setCurrentDirectory(new File(path));
}
}
/**
* Shows the dialog and returns the selected file.
*
* @return File the selected file in this dialog
*/
public File getFileFromDialog()
{
int choice = -1;
if(this.getDialogType() == JFileChooser.OPEN_DIALOG)
{
choice = this.showOpenDialog(this.getParentComponent());
}
else
{
choice = this.showSaveDialog(this.getParentComponent());
}
if(choice == JFileChooser.APPROVE_OPTION)
{
return this.getSelectedFile();
}
else
{
return null;
}
}
/**
* Returns the parent component of this dialog
*
* @return Component dialog's parent component
*/
public Component getParentComponent()
{
return this.parent;
}
/**
* Adds a file filter to this dialog.
*
* @param filter the filter to add
*/
public void addFilter(SipCommFileFilter filter)
{
this.addChoosableFileFilter(filter);
}
/**
* Returns the filter the user has chosen for saving a file.
*
* @return SipCommFileFilter the used filter when saving a file
*/
public SipCommFileFilter getUsedFilter()
{
return (SipCommFileFilter)this.getFileFilter();
}
}

@ -19,87 +19,87 @@ public class SipCommFileDialogImpl
extends FileDialog
implements SipCommFileChooser
{
private static final long serialVersionUID = 8176923801105539356L;
private static final long serialVersionUID = 8176923801105539356L;
/**
* Constructor
*
* @param parent the parent frame of this dialog
* @param title the title for this dialog
*/
public SipCommFileDialogImpl(Frame parent, String title)
{
super(parent, title);
}
/**
* Constructor
*
* @param parent the parent frame of this dialog
* @param title the title for this dialog
* @param fileOperation request a 'load file' or 'save file' dialog
*/
public SipCommFileDialogImpl(Frame parent, String title, int fileOperation)
{
super(parent, title, fileOperation);
}
/**
* Constructor
*
* @param parent the parent frame of this dialog
* @param title the title for this dialog
*/
public SipCommFileDialogImpl(Frame parent, String title)
{
super(parent, title);
}
/**
* Returns the selected file by the user from the dialog.
*
* @return File the selected file from the dialog
*/
public File getApprovedFile()
{
if(this.getFile() != null)
{
return new File(this.getDirectory(), this.getFile());
}
else
{
return null;
}
}
/**
* Constructor
*
* @param parent the parent frame of this dialog
* @param title the title for this dialog
* @param fileOperation request a 'load file' or 'save file' dialog
*/
public SipCommFileDialogImpl(Frame parent, String title, int fileOperation)
{
super(parent, title, fileOperation);
}
/**
* Sets the default path to be considered for browsing among files.
*
* @param path the default start path for this dialog
*/
public void setStartPath(String path)
{
this.setDirectory(path);
}
/**
* Shows the dialog and returns the selected file.
*
* @return File the selected file in this dialog
*/
public File getFileFromDialog()
{
this.setVisible(true);
return this.getApprovedFile();
}
/**
* Adds a file filter to this dialog.
*
* @param filter the filter to add
*/
public void addFilter(SipCommFileFilter filter)
{
this.setFilenameFilter(filter);
}
/**
* Returns the filter the user has chosen for saving a file.
*
* @return SipCommFileFilter the used filter when saving a file
*/
public SipCommFileFilter getUsedFilter()
{
return (SipCommFileFilter)this.getFilenameFilter();
}
/**
* Returns the selected file by the user from the dialog.
*
* @return File the selected file from the dialog
*/
public File getApprovedFile()
{
if(this.getFile() != null)
{
return new File(this.getDirectory(), this.getFile());
}
else
{
return null;
}
}
/**
* Sets the default path to be considered for browsing among files.
*
* @param path the default start path for this dialog
*/
public void setStartPath(String path)
{
this.setDirectory(path);
}
/**
* Shows the dialog and returns the selected file.
*
* @return File the selected file in this dialog
*/
public File getFileFromDialog()
{
this.setVisible(true);
return this.getApprovedFile();
}
/**
* Adds a file filter to this dialog.
*
* @param filter the filter to add
*/
public void addFilter(SipCommFileFilter filter)
{
this.setFilenameFilter(filter);
}
/**
* Returns the filter the user has chosen for saving a file.
*
* @return SipCommFileFilter the used filter when saving a file
*/
public SipCommFileFilter getUsedFilter()
{
return (SipCommFileFilter)this.getFilenameFilter();
}
}

@ -36,17 +36,17 @@ public abstract class SipCommFileFilter
implements FilenameFilter
{
/**
* Avoid to be obliged to implement
* 'public boolean accept(File dir, String name)'
* in your own file filter.
*
* @param dir file's parent directory
* @param name file's name
* @return boolean if the file is accepted or not
*/
public boolean accept(File dir, String name)
{
return accept(new File(dir.getAbsolutePath(), name));
}
/**
* Avoid to be obliged to implement
* 'public boolean accept(File dir, String name)'
* in your own file filter.
*
* @param dir file's parent directory
* @param name file's name
* @return boolean if the file is accepted or not
*/
public boolean accept(File dir, String name)
{
return accept(new File(dir.getAbsolutePath(), name));
}
}

@ -454,8 +454,8 @@ public void testInviteReject()
ChatRoomInvitation invitation = invitationReceivedEvent.getInvitation();
assertEquals("The inviter is not the expected user",
StringUtils.parseBareAddress(fixture.userID1),
StringUtils.parseBareAddress(invitation.getInviter()));
StringUtils.parseBareAddress(fixture.userID1),
StringUtils.parseBareAddress(invitation.getInviter()));
assertEquals("The invitation reason received differs from the one sent"
, "testInviteReject", invitation.getReason());

Loading…
Cancel
Save