Fix issue #687 looses track of some chat windows (when using separate window for every chat).

cusax-fix
Damian Minkov 16 years ago
parent eca3320e17
commit 25cb5d0919

@ -477,6 +477,47 @@ public ChatPanel getCurrentChatPanel()
return null;
}
/**
* Returns the currently available chat panels.
*
* @return the currently available chat panels.
*/
public java.util.List<ChatPanel> getChatPanels()
{
ArrayList<ChatPanel> chatPanels = new ArrayList<ChatPanel>();
if(getChatTabCount() > 0)
{
int componentCount = chatTabbedPane.getComponentCount();
for (int i = 0; i < componentCount; i ++)
{
Component c = chatTabbedPane.getComponent(i);
if(c instanceof ChatPanel)
{
chatPanels.add((ChatPanel)c);
}
}
}
else
{
int componentCount = mainPanel.getComponentCount();
for (int i = 0; i < componentCount; i ++)
{
Component c = mainPanel.getComponent(i);
if(c instanceof ChatPanel)
{
chatPanels.add((ChatPanel)c);
}
}
}
return chatPanels;
}
/**
* Returns the tab count of the chat tabbed pane. Meant to be used when in
* "Group chat windows" mode.

@ -982,12 +982,14 @@ private boolean containsChat(ChatPanel chatPanel)
*/
private void disposeChatWindow(ChatWindow chatWindow)
{
for (ChatPanel chatPanel : chatPanels)
List<ChatPanel> chatPanelsToDispose = chatWindow.getChatPanels();
for (ChatPanel chatPanel : chatPanelsToDispose)
chatPanel.dispose();
synchronized (chatPanels)
{
chatPanels.clear();
chatPanels.removeAll(chatPanelsToDispose);
}
if (chatWindow.getChatCount() > 0)

Loading…
Cancel
Save