diff options
author | Yana Stamcheva <yana@jitsi.org> | 2012-10-15 19:45:08 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2012-10-15 19:45:08 +0000 |
commit | 52680ff85f47f9e1e3b3a9d01f1125be187e4d30 (patch) | |
tree | 09a5055bd699dfb2ffb901590e7b58de59e29168 /src/net/java/sip/communicator | |
parent | 8ab5ddd1bdf897612cc098bf3fe0caf610b4e40e (diff) | |
download | jitsi-52680ff85f47f9e1e3b3a9d01f1125be187e4d30.zip jitsi-52680ff85f47f9e1e3b3a9d01f1125be187e4d30.tar.gz jitsi-52680ff85f47f9e1e3b3a9d01f1125be187e4d30.tar.bz2 |
Fixes tool tips in conference and transfer invite windows.
Diffstat (limited to 'src/net/java/sip/communicator')
20 files changed, 81 insertions, 100 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/SingleWindowContainer.java b/src/net/java/sip/communicator/impl/gui/main/SingleWindowContainer.java index 44b558e..3df56cc 100644 --- a/src/net/java/sip/communicator/impl/gui/main/SingleWindowContainer.java +++ b/src/net/java/sip/communicator/impl/gui/main/SingleWindowContainer.java @@ -76,8 +76,7 @@ public class SingleWindowContainer setPreferredSize(new Dimension(620, 580)); tabbedPane = new ConversationTabbedPane(); - contactPhotoPanel = new ContactPhotoPanel( - GuiActivator.getUIService().getMainFrame()); + contactPhotoPanel = new ContactPhotoPanel(); add(createToolbar(), BorderLayout.NORTH); tabbedPane.addChangeListener(this); diff --git a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java index 1e7ec82..a03eda2 100755 --- a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java @@ -136,7 +136,7 @@ public class DialPanel */ public void paintComponent(Graphics g) { - // do the superclass behavior first + // do the superclass behavior first super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java index c9ce15b..465c72a 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java @@ -98,6 +98,8 @@ public class ConferenceInviteDialog { public void run() { + initContactListSources(); + // Initialize the list of contacts to select from. initContactListData( (ProtocolProviderService) accountSelectorBox @@ -222,9 +224,7 @@ public class ConferenceInviteDialog ProtocolProviderService pps = ConfigurationManager.getLastCallConferenceProvider(); - if (pps != null) - accountSelectorBox.setSelectedItem(pps); - else if (conference != null) + if (pps == null && conference != null) { /* * Pick up the first account from the ones participating in the @@ -244,21 +244,18 @@ public class ConferenceInviteDialog } } } + + if (pps != null) + accountSelectorBox.setSelectedItem(pps); + else if (accountSelectorBox.getItemCount() > 0) + accountSelectorBox.setSelectedIndex(0); } /** - * Initializes the left contact list with the contacts that could be added - * to the current chat session. - * @param protocolProvider the protocol provider from which to initialize - * the contact list data + * Initializes contact sources for the source contact list. */ - private void initContactListData(ProtocolProviderService protocolProvider) + private void initContactListSources() { - this.setCurrentProvider(protocolProvider); - - srcContactList.removeContactSource(currentProviderContactSource); - srcContactList.removeContactSource(currentStringContactSource); - Iterator<UIContactSource> sourcesIter = new ArrayList<UIContactSource>( srcContactList.getContactSources()).iterator(); @@ -273,6 +270,20 @@ public class ConferenceInviteDialog srcContactList.addContactSource( new DemuxContactSource(contactSource)); } + } + + /** + * Initializes the left contact list with the contacts that could be added + * to the current chat session. + * @param protocolProvider the protocol provider from which to initialize + * the contact list data + */ + private void initContactListData(ProtocolProviderService protocolProvider) + { + this.setCurrentProvider(protocolProvider); + + srcContactList.removeContactSource(currentProviderContactSource); + srcContactList.removeContactSource(currentStringContactSource); currentProviderContactSource = new ProtocolContactSourceServiceImpl( diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java index f8e7acb..7ddc8a7 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java @@ -698,8 +698,7 @@ public class ChatPanel FileRecord fileRecord = (FileRecord) o; FileHistoryConversationComponent component - = new FileHistoryConversationComponent( - chatContainer.getFrame(), fileRecord); + = new FileHistoryConversationComponent(fileRecord); conversationPanel.addComponent(component); } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java index fcb0413..fb39da6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java @@ -114,7 +114,7 @@ public class ChatWindow menuBar = new MessageWindowMenuBar(this); - contactPhotoPanel = new ContactPhotoPanel(this); + contactPhotoPanel = new ContactPhotoPanel(); this.setJMenuBar(menuBar); diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ContactPhotoPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ContactPhotoPanel.java index 1f5f1da..e36fe19 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ContactPhotoPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ContactPhotoPanel.java @@ -34,18 +34,14 @@ public class ContactPhotoPanel extends JLayeredPane private ChatSession chatSession; - private final Window parentWindow; - /** * Creates an instance of <tt>ContactPhotoPanel</tt> by specifying the * parent window where the photo panel will be added. * * @param parentWindow the parent window */ - public ContactPhotoPanel(Window parentWindow) + public ContactPhotoPanel() { - this.parentWindow = parentWindow; - this.setLayout(null); this.setPreferredSize( @@ -143,7 +139,7 @@ public class ContactPhotoPanel extends JLayeredPane */ public JToolTip createToolTip() { - ExtendedTooltip tip = new ExtendedTooltip(parentWindow, true); + ExtendedTooltip tip = new ExtendedTooltip(true); if (tooltipIcon != null) tip.setImage(tooltipIcon); diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileHistoryConversationComponent.java b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileHistoryConversationComponent.java index db05df4..6967009 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileHistoryConversationComponent.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileHistoryConversationComponent.java @@ -6,7 +6,6 @@ */ package net.java.sip.communicator.impl.gui.main.chat.filetransfer; -import java.awt.*; import java.util.*; import net.java.sip.communicator.service.filehistory.*; @@ -22,11 +21,8 @@ public class FileHistoryConversationComponent { private final FileRecord fileRecord; - public FileHistoryConversationComponent(Window parentWindow, - FileRecord fileRecord) + public FileHistoryConversationComponent(FileRecord fileRecord) { - super(parentWindow); - this.fileRecord = fileRecord; String contactName = fileRecord.getContact().getDisplayName(); diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileTransferConversationComponent.java b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileTransferConversationComponent.java index 69fab91..3801fba 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileTransferConversationComponent.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/FileTransferConversationComponent.java @@ -181,9 +181,9 @@ public abstract class FileTransferConversationComponent /** * Creates a file conversation component. */ - public FileTransferConversationComponent(Window parentWindow) + public FileTransferConversationComponent() { - imageLabel = new FileImageLabel(parentWindow); + imageLabel = new FileImageLabel(); constraints.gridx = 0; constraints.gridy = 0; diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/ReceiveFileConversationComponent.java b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/ReceiveFileConversationComponent.java index 8a53fcb..6631cc0 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/ReceiveFileConversationComponent.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/ReceiveFileConversationComponent.java @@ -61,8 +61,6 @@ public class ReceiveFileConversationComponent final IncomingFileTransferRequest request, final Date date) { - super(chatPanel.getChatContainer().getFrame()); - this.chatPanel = chatPanel; this.fileTransferOpSet = opSet; this.fileTransferRequest = request; diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/SendFileConversationComponent.java b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/SendFileConversationComponent.java index d8e1ce9..f6328be 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/SendFileConversationComponent.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/SendFileConversationComponent.java @@ -49,8 +49,6 @@ public class SendFileConversationComponent String toContactName, final File file) { - super(chatPanel.getChatContainer().getFrame()); - this.parentChatPanel = chatPanel; this.toContactName = toContactName; this.file = file; diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java index 093fb9f..743b459 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/history/HistoryWindow.java @@ -340,8 +340,7 @@ public class HistoryWindow = fileRecord.getContact().getProtocolProvider(); FileHistoryConversationComponent component - = new FileHistoryConversationComponent( - this, fileRecord); + = new FileHistoryConversationComponent(fileRecord); chatConvPanel.addComponent(component); } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java index 7113a6a..dc0ea34 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java @@ -128,8 +128,7 @@ public class DefaultContactList Object element = getModel().getElementAt(index); - ExtendedTooltip tip = new ExtendedTooltip( - GuiActivator.getUIService().getMainFrame(), true); + ExtendedTooltip tip = new ExtendedTooltip(true); if (element instanceof MetaContact) { diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultTreeContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultTreeContactList.java index 08964d1..9febdba 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultTreeContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultTreeContactList.java @@ -165,8 +165,6 @@ public class DefaultTreeContactList Object element = path.getLastPathComponent(); - MainFrame mainWindow = GuiActivator.getUIService().getMainFrame(); - ExtendedTooltip tip = null; if (element instanceof ContactNode) { @@ -179,7 +177,7 @@ public class DefaultTreeContactList && ((SIPCommButton) cellComponent) .getToolTipText().length() > 0) { - tip = new ExtendedTooltip(mainWindow, true); + tip = new ExtendedTooltip(true); tip.setTitle(((SIPCommButton)cellComponent).getToolTipText()); } else @@ -190,7 +188,7 @@ public class DefaultTreeContactList tip = contact.getToolTip(); if (tip == null) { - tip = new ExtendedTooltip(mainWindow, true); + tip = new ExtendedTooltip(true); tip.setTitle(contact.getDisplayName()); } } @@ -200,7 +198,7 @@ public class DefaultTreeContactList UIGroup group = ((GroupNode) element).getGroupDescriptor(); - tip = new ExtendedTooltip(mainWindow, true); + tip = new ExtendedTooltip(true); tip.setTitle(group.getDisplayName()); } else if (element instanceof ChatContact<?>) @@ -209,7 +207,7 @@ public class DefaultTreeContactList ImageIcon avatarImage = chatContact.getAvatar(); - tip = new ExtendedTooltip(mainWindow, true); + tip = new ExtendedTooltip(true); if (avatarImage != null) tip.setImage(avatarImage); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java index 085351e..2352b9c 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java @@ -408,8 +408,7 @@ public class MetaUIContact */ public ExtendedTooltip getToolTip() { - ExtendedTooltip tip = new ExtendedTooltip( - GuiActivator.getUIService().getMainFrame(), true); + ExtendedTooltip tip = new ExtendedTooltip(true); byte[] avatarImage = metaContact.getAvatar(); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java index 0c16357..b3563bd 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ShowMoreContact.java @@ -152,8 +152,7 @@ public class ShowMoreContact */ public ExtendedTooltip getToolTip() { - ExtendedTooltip tooltip = new ExtendedTooltip( - GuiActivator.getUIService().getMainFrame(), false); + ExtendedTooltip tooltip = new ExtendedTooltip(false); tooltip.setTitle(GuiActivator.getResources() .getI18NString("service.gui.SHOW_MORE_TOOLTIP")); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java index 4f891d8..c43ddb7 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java @@ -374,8 +374,7 @@ public class SourceUIContact */ public ExtendedTooltip getToolTip() { - ExtendedTooltip tip = new ExtendedTooltip( - GuiActivator.getUIService().getMainFrame(), true); + ExtendedTooltip tip = new ExtendedTooltip(true); byte[] avatarImage = sourceContact.getImage(); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContact.java index e65ae28..e949c96 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContact.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContact.java @@ -256,8 +256,7 @@ public class NotificationContact */ public ExtendedTooltip getToolTip() { - ExtendedTooltip tip = new ExtendedTooltip( - GuiActivator.getUIService().getMainFrame(), true); + ExtendedTooltip tip = new ExtendedTooltip(true); ImageIcon avatarImage = getAvatar(true, 64, 64); diff --git a/src/net/java/sip/communicator/impl/gui/utils/FileImageLabel.java b/src/net/java/sip/communicator/impl/gui/utils/FileImageLabel.java index 6ff6b06..097139d 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/FileImageLabel.java +++ b/src/net/java/sip/communicator/impl/gui/utils/FileImageLabel.java @@ -6,7 +6,6 @@ */ package net.java.sip.communicator.impl.gui.utils; -import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; @@ -33,22 +32,6 @@ public class FileImageLabel private String tooltipTitle; /** - * The parent window where this component will be added. - */ - private final Window parentWindow; - - /** - * Creates an instance of <tt>FileImageLabel</tt> by specifying the parent - * window where this label would be added. - * - * @param parentWindow the parent window - */ - public FileImageLabel(Window parentWindow) - { - this.parentWindow = parentWindow; - } - - /** * Sets the icon to show in the tool tip. * * @param icon the icon to show in the tool tip. @@ -75,7 +58,7 @@ public class FileImageLabel */ public JToolTip createToolTip() { - ExtendedTooltip tip = new ExtendedTooltip(parentWindow, false); + ExtendedTooltip tip = new ExtendedTooltip(false); if (tooltipIcon != null) tip.setImage(tooltipIcon); diff --git a/src/net/java/sip/communicator/impl/gui/utils/InviteContactListFilter.java b/src/net/java/sip/communicator/impl/gui/utils/InviteContactListFilter.java index 0c90fd0..e4be99c 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/InviteContactListFilter.java +++ b/src/net/java/sip/communicator/impl/gui/utils/InviteContactListFilter.java @@ -47,6 +47,9 @@ public class InviteContactListFilter { filterSources.addAll(sourceContactList .getContactSources(ContactSourceService.SEARCH_TYPE)); + + filterSources.addAll(sourceContactList + .getContactSources(ContactSourceService.HISTORY_TYPE)); } Iterator<UIContactSource> filterSourceIter = filterSources.iterator(); diff --git a/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java b/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java index 2c24646..077c4c1 100644 --- a/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java +++ b/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java @@ -59,7 +59,7 @@ public class ExtendedTooltip * Created a <tt>MetaContactTooltip</tt>. * @param isListViewEnabled indicates if the list view is enabled */ - public ExtendedTooltip(final Window parentWindow, boolean isListViewEnabled) + public ExtendedTooltip(boolean isListViewEnabled) { this.isListViewEnabled = isListViewEnabled; @@ -99,6 +99,10 @@ public class ExtendedTooltip bottomTextArea.setFont(bottomTextArea.getFont().deriveFont(10f)); mainPanel.add(bottomTextArea, BorderLayout.SOUTH); + final Window parentWindow + = KeyboardFocusManager.getCurrentKeyboardFocusManager() + .getActiveWindow(); + // Hide the tooltip when the parent window hides. /* * FIXME The parentWindow will surely outlive this ExtendedTooltip so @@ -130,34 +134,36 @@ public class ExtendedTooltip public void windowGainedFocus(WindowEvent e) {} }); + // Comments this code as it hides the tool tip once it's opened and this + // appears as a buggy behavior. // Hide the tooltip if the parent window isn't active - addComponentListener(new ComponentAdapter() - { - public void componentResized(ComponentEvent evt) - { - if (!parentWindow.isActive()) - { - Window popupWindow - = SwingUtilities.getWindowAncestor( - ExtendedTooltip.this); - - if (popupWindow != null - && popupWindow.isVisible() - && !(popupWindow instanceof JFrame) - // The popup window should normally be a JWindow, so we - // check here explicitly if for some reason we didn't get - // something else. - && (popupWindow instanceof JWindow)) - { - if (logger.isInfoEnabled()) - logger.info("Tooltip window ancestor to hide: " - + popupWindow); - - popupWindow.setVisible(false); - } - } - } - }); +// addComponentListener(new ComponentAdapter() +// { +// public void componentResized(ComponentEvent evt) +// { +// if (!parentWindow.isActive()) +// { +// Window popupWindow +// = SwingUtilities.getWindowAncestor( +// ExtendedTooltip.this); +// +// if (popupWindow != null +// && popupWindow.isVisible() +// && !(popupWindow instanceof JFrame) +// // The popup window should normally be a JWindow, so we +// // check here explicitly if for some reason we didn't +// // get something else. +// && (popupWindow instanceof JWindow)) +// { +// if (logger.isInfoEnabled()) +// logger.info("Tooltip window ancestor to hide: " +// + popupWindow); +// +// popupWindow.setVisible(false); +// } +// } +// } +// }); this.add(mainPanel); } |