aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2009-11-17 14:41:49 +0000
committerYana Stamcheva <yana@jitsi.org>2009-11-17 14:41:49 +0000
commitf5f5a87b871fb9a2e9e6a4eff3e84948e50c2caa (patch)
tree96b7daafa3cc24b7a4bec396547f39f7af1551a5
parentd89b89d290b625e7cb69fe458707908c60b3cb23 (diff)
downloadjitsi-f5f5a87b871fb9a2e9e6a4eff3e84948e50c2caa.zip
jitsi-f5f5a87b871fb9a2e9e6a4eff3e84948e50c2caa.tar.gz
jitsi-f5f5a87b871fb9a2e9e6a4eff3e84948e50c2caa.tar.bz2
Fix incorrect handling of ConferenceFocusChangedEvents.
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java80
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java22
2 files changed, 73 insertions, 29 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java
index 2a4d532..33c5697 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java
@@ -32,7 +32,8 @@ public class CallDialog
extends SIPCommFrame
implements ActionListener,
MouseListener,
- CallChangeListener
+ CallChangeListener,
+ CallPeerConferenceListener
{
private static final String DIAL_BUTTON = "DIAL_BUTTON";
@@ -373,17 +374,21 @@ public class CallDialog
*/
public void callPeerAdded(final CallPeerEvent evt)
{
+ if (evt.getSourceCall() != call)
+ return;
+
+ final CallPeer callPeer = evt.getSourceCallPeer();
+
+ callPeer.addCallPeerConferenceListener(this);
+
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
- if (evt.getSourceCall() != call)
- return;
-
if (isLastConference)
{
((ConferenceCallPanel) callPanel)
- .addCallPeerPanel(evt.getSourceCallPeer());
+ .addCallPeerPanel(callPeer);
}
else
{
@@ -424,23 +429,68 @@ public class CallDialog
*/
public void callPeerRemoved(CallPeerEvent evt)
{
- if (evt.getSourceCall() == call)
+ if (evt.getSourceCall() != call)
+ return;
+
+ CallPeer callPeer = evt.getSourceCallPeer();
+
+ callPeer.addCallPeerConferenceListener(this);
+
+ Timer timer = new Timer(5000,
+ new RemovePeerPanelListener(callPeer));
+
+ timer.setRepeats(false);
+ timer.start();
+
+ // The call is finished when that last peer is removed.
+ if (call.getCallPeerCount() == 0)
{
- Timer timer = new Timer(5000,
- new RemovePeerPanelListener(evt.getSourceCallPeer()));
+ this.stopCallTimer();
+ }
+ }
+
+ public void callStateChanged(CallChangeEvent evt) {}
- timer.setRepeats(false);
- timer.start();
+ /**
+ * Updates <tt>CallPeer</tt> related components to fit the new focus state.
+ * @param conferenceEvent the event that notified us of the change
+ */
+ public void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent)
+ {
+ final CallPeer callPeer = conferenceEvent.getSourceCallPeer();
- // The call is finished when that last peer is removed.
- if (call.getCallPeerCount() == 0)
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
- this.stopCallTimer();
+ if (isLastConference)
+ {
+ ((ConferenceCallPanel) callPanel)
+ .updateCallPeerPanel(callPeer);
+ }
+ else
+ {
+ isLastConference = isConference();
+
+ // We've been in one-to-one call and we're now in a
+ // conference.
+ if (isLastConference)
+ {
+ contentPane.remove(callPanel);
+ callPanel
+ = new ConferenceCallPanel(CallDialog.this, call);
+ contentPane.add(callPanel, BorderLayout.CENTER);
+ }
+ }
+
+ refreshWindow();
}
- }
+ });
}
- public void callStateChanged(CallChangeEvent evt) {}
+ public void conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent) {}
+
+ public void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent) {}
/**
* Checks if the contained call is a conference call.
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java
index 240c5c5..6cba997 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java
@@ -14,7 +14,6 @@ import javax.swing.*;
import net.java.sip.communicator.impl.gui.main.call.*;
import net.java.sip.communicator.impl.gui.main.call.CallPeerAdapter;
import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.swing.*;
/**
@@ -26,7 +25,6 @@ import net.java.sip.communicator.util.swing.*;
*/
public class ConferenceCallPanel
extends JScrollPane
- implements CallPeerConferenceListener
{
/**
* The conference call.
@@ -219,21 +217,17 @@ public class ConferenceCallPanel
}
/**
- * Updates <tt>CallPeer</tt> related components to fit the new focus state.
- * @param conferenceEvent the event that notified us of the change
+ * Updates the current call peer panel to represent correctly the new state
+ * of the peer.
+ * @param peer the <tt>CallPeer</tt>, which panel to update
*/
- public void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent)
+ public void updateCallPeerPanel(CallPeer peer)
{
- CallPeer callPeer = conferenceEvent.getSourceCallPeer();
-
// Removes the previously used panel for the peer.
- this.removeCallPeerPanel(callPeer);
+ this.removeCallPeerPanel(peer);
- // Create a new panel which should fit the new state of the peer.
- this.addCallPeerPanel(callPeer);
+ // Create a new panel which should fit the new state of
+ // the peer.
+ this.addCallPeerPanel(peer);
}
-
- public void conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent) {}
-
- public void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent) {}
}