Does not show call info if there is nothing to show. Patch contributed by Tom Denham.

cusax-fix
Damian Minkov 13 years ago
parent 6104713520
commit 6b4f9cbc15

@ -63,6 +63,11 @@ public class CallInfoFrame
private final ResourceManagementService resources
= GuiActivator.getResources();
/**
* Indicates if the info window has any text to display.
*/
private boolean hasCallInfo;
/**
* Creates a new frame containing the statistical information for a specific
* telephony conference.
@ -88,7 +93,7 @@ public CallInfoFrame(CallConference callConference)
callInfoWindow.getContentPane().add(scrollPane);
this.constructCallInfo();
hasCallInfo = this.constructCallInfo();
}
/**
@ -164,8 +169,9 @@ private String getLineString(String labelText, String infoText)
/**
* Constructs the call info text.
* @return true if call info could be found, false otherwise
*/
private void constructCallInfo()
private boolean constructCallInfo()
{
StringBuffer stringBuffer = new StringBuffer();
@ -181,49 +187,58 @@ private void constructCallInfo()
* TODO A telephony conference may consist of a single Call with
* multiple CallPeers but it may as well consist of multiple Calls.
*/
Call aCall = calls.get(0);
stringBuffer.append(
getLineString(
resources.getI18NString(
"service.gui.callinfo.CALL_IDENTITY"),
aCall.getProtocolProvider().getAccountID()
.getDisplayName()));
int callPeerCount = callConference.getCallPeerCount();
if (callPeerCount > 1)
if (calls.size() <= 0)
{
stringBuffer.append(
getLineString(resources.getI18NString(
"service.gui.callinfo.PEER_COUNT"),
String.valueOf(callPeerCount)));
return false;
}
else
{
Call aCall = calls.get(0);
boolean isConfFocus = callConference.isConferenceFocus();
stringBuffer.append(
getLineString(
resources.getI18NString(
"service.gui.callinfo.CALL_IDENTITY"),
aCall.getProtocolProvider().getAccountID()
.getDisplayName()));
int callPeerCount = callConference.getCallPeerCount();
if (callPeerCount > 1)
{
stringBuffer.append(
getLineString(resources.getI18NString(
"service.gui.callinfo.PEER_COUNT"),
String.valueOf(callPeerCount)));
}
if (isConfFocus)
{
stringBuffer.append(getLineString(
resources.getI18NString(
"service.gui.callinfo.IS_CONFERENCE_FOCUS"),
String.valueOf(isConfFocus)));
}
boolean isConfFocus = callConference.isConferenceFocus();
if (isConfFocus)
{
stringBuffer.append(getLineString(
resources.getI18NString(
"service.gui.callinfo.IS_CONFERENCE_FOCUS"),
String.valueOf(isConfFocus)));
}
TransportProtocol preferredTransport
= aCall.getProtocolProvider().getTransportProtocol();
TransportProtocol preferredTransport
= aCall.getProtocolProvider().getTransportProtocol();
if (preferredTransport != TransportProtocol.UNKNOWN)
stringBuffer.append(getLineString(
resources.getI18NString("service.gui.callinfo.CALL_TRANSPORT"),
preferredTransport.toString()));
if (preferredTransport != TransportProtocol.UNKNOWN)
stringBuffer.append(getLineString(
resources.getI18NString("service.gui.callinfo.CALL_TRANSPORT"),
preferredTransport.toString()));
constructCallPeersInfo(stringBuffer);
constructCallPeersInfo(stringBuffer);
stringBuffer.append("</font></p></body></html>");
stringBuffer.append("</font></p></body></html>");
infoTextPane.setText(stringBuffer.toString());
infoTextPane.revalidate();
infoTextPane.repaint();
infoTextPane.setText(stringBuffer.toString());
infoTextPane.revalidate();
infoTextPane.repaint();
return true;
}
}
/**
@ -620,7 +635,7 @@ public void callTitleChanged(CallPanel callContainer)
if (selectedText != null && selectedText.length() > 0)
return;
constructCallInfo();
hasCallInfo = this.constructCallInfo();
callInfoWindow.pack();
}
@ -654,6 +669,17 @@ public boolean isVisible()
return callInfoWindow.isVisible();
}
/**
* Indicates if the call info window has any text to display
*
* @return <tt>true</tt> if the window contains call info,
* <tt>false</tt> otherwise
*/
public boolean hasCallInfo()
{
return hasCallInfo;
}
/**
* Disposes the corresponding window.
*/
@ -696,7 +722,7 @@ private void appendStreamEncryptionMethod(
if(srtpControl != null)
{
String info;
if (srtpControl instanceof ZrtpControl)
if (srtpControl instanceof ZrtpControl)
{
info = "ZRTP " + ((ZrtpControl)srtpControl).getCipherString();
}
@ -707,7 +733,7 @@ private void appendStreamEncryptionMethod(
rtpType = resources.getI18NString(
"service.gui.callinfo.MEDIA_STREAM_SRTP")
+ " ("
+ " ("
+ resources.getI18NString(
"service.gui.callinfo.KEY_EXCHANGE_PROTOCOL")
+ ": "

@ -440,7 +440,15 @@ else if (buttonName.equals(INFO_BUTTON))
this.callInfoFrame = new CallInfoFrame(callConference);
this.addCallTitleListener(callInfoFrame);
}
callInfoFrame.setVisible(!callInfoFrame.isVisible());
if (callInfoFrame.hasCallInfo())
{
callInfoFrame.setVisible(!callInfoFrame.isVisible());
}
else
{
callInfoFrame.setVisible(false);
}
}
}
@ -575,7 +583,7 @@ private JComponent createBottomBar()
* disposal (e.g. any listeners added to the depicted
* <tt>CallConference</tt>, the participating <tt>Call</tt>s, and their
* associated <tt>CallPeer</tt>s). Invoked by <tt>CallManager</tt> when it
* determines that this <tt>CallPanel</tt> is no longer necessary.
* determines that this <tt>CallPanel</tt> is no longer necessary.
*/
void dispose()
{
@ -619,7 +627,7 @@ public void disposeCallInfoFrame()
* or audio/video) because, otherwise, the switch will leave it
* <tt>null</tt> and this view will remain blank. In such a case,
* <tt>settingsPanel</tt> may wish to do pretty much the same but disable
* and/or hide the buttons it contains.
* and/or hide the buttons it contains.
*/
private void doUpdateSettingsPanelInEventDispatchThread(
boolean callConferenceIsEnded)
@ -806,7 +814,6 @@ private void doUpdateViewFromModelInEventDispatchThread()
removeCallPanel
= !((OneToOneCallPanel) callPanel).getCallPeer().equals(
callPeer);
}
else
removeCallPanel = true;
@ -879,7 +886,7 @@ private void doUpdateViewFromModelInEventDispatchThread()
/*
* It seems that AWT/Swing does not validate and/or repaint this
* Container (enough) and, consequently, its display may not update
* itself with an up-to-date drawing of the current callPanel.
* itself with an up-to-date drawing of the current callPanel.
*/
if (validateAndRepaint)
{
@ -1341,7 +1348,7 @@ public void loadSkin()
* @param ev a <tt>VideoEvent</tt> which represents the cause of the
* notification and specifies the visual <tt>Component</tt> displaying video
* which may need an adjustment of a Frame's size in order to be displayed
* without scaling
* without scaling
*/
private void maybeEnsureSize(final VideoEvent ev)
{
@ -1913,7 +1920,7 @@ else if (!conferences.contains(conference))
* or audio/video) because, otherwise, the switch will leave it
* <tt>null</tt> and this view will remain blank. In such a case,
* <tt>settingsPanel</tt> may wish to do pretty much the same but disable
* and/or hide the buttons it contains.
* and/or hide the buttons it contains.
*/
private void updateSettingsPanelInEventDispatchThread(
boolean callConferenceIsEnded)
@ -1956,7 +1963,7 @@ private void updateViewFromModelInEventDispatchThread()
* interface hierarchy of this instance bellow. Consequently, this view
* may become larger in width and/or height than its current Frame has
* dedicated to it. Try to detect such cases and attempt to adjust the
* Frame's size accordingly.
* Frame's size accordingly.
*/
Dimension oldPreferredSize = getPreferredSize();
@ -1967,7 +1974,7 @@ private void updateViewFromModelInEventDispatchThread()
* the user interface hierarchy of this instance above. Consequently,
* this view may have become larger in width and/or height than its
* current Frame has dedicated to it. Try to detect such cases and
* attempt to adjust the Frame's size accordingly.
* attempt to adjust the Frame's size accordingly.
*/
Dimension newPreferredSize = getPreferredSize();

Loading…
Cancel
Save