Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.call
Class CallPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by net.java.sip.communicator.util.swing.TransparentPanel
                      extended by net.java.sip.communicator.impl.gui.main.call.CallPanel
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, PluginComponentListener, CallChangeListener, CallListener, CallPeerConferenceListener, Skinnable

public class CallPanel
extends TransparentPanel
implements ActionListener, CallChangeListener, CallPeerConferenceListener, PluginComponentListener, Skinnable, CallListener

The dialog created for a given call. Ordered buttons we are adding/removing, numbers are the index we have set. And the order that will be kept. 0 dialButton 1 conferenceButton 2 holdButton 3 recordButton 4 mergeButton 5 transferCallButton 6 localLevel 7 remoteLevel 8 desktopSharingButton 9 resizeVideoButton 10 fullScreenButton 11 videoButton 12 showHideVideoButton 19 chatButton 20 infoButton

Author:
Yana Stamcheva, Adam Netocny
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CallPanel()
          Creates an empty constructor allowing to extend this panel.
CallPanel(Call call, CallContainer callWindow)
          Creates a CallDialog by specifying the underlying call panel.
 
Method Summary
 void actionPerformed(ActionEvent evt)
          Handles action events.
 void actionPerformedOnHangupButton(boolean isCloseWait)
          Executes the action associated with the "Hang up" button which may be invoked by clicking the button in question or closing this dialog.
 void addCallTitleListener(CallTitleListener l)
          Adds the given CallTitleListener to the list of listeners, notified for call title changes.
 void addRemoteVideoSpecificComponents(CallPeer callPeer)
          Adds remote video specific components.
 void callEnded(CallEvent event)
          Indicates that all peers have left the source call and that it has been ended.
 void callPeerAdded(CallPeerEvent evt)
          Implements the CallChangeListener.callPeerAdded method.
 void callPeerRemoved(CallPeerEvent evt)
          Implements the CallChangeListener.callPeerRemoved method.
 void callStateChanged(CallChangeEvent evt)
          Indicates that a change has occurred in the state of the source call.
 void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent)
          Updates CallPeer related components to fit the new focus state.
 void conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent)
          Notifies this listener about the addition of a specific ConferenceMember to the list of ConferenceMembers of a specific CallPeer acting as a conference focus.
 void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent)
          Notifies this listener about the removal of a specific ConferenceMember from the list of ConferenceMembers of a specific CallPeer acting as a conference focus.
 void disposeCallInfoFrame()
          Disposes the call info frame if it exists.
 void enableButtons(boolean enable)
          Enables or disable all setting buttons.
 void enableButtonsWhileOnHold(boolean hold)
          Enables or disable some setting buttons when we get on/off hold.
 Call getCall()
          Returns the Call corresponding to this CallDialog.
 String getCallTitle()
          Returns the initial call title.
 CallContainer getCallWindow()
          Returns the parent call window.
 CallRenderer getCurrentCallRenderer()
          Returns the currently used CallRenderer.
 int getMinimumButtonWidth()
          Returns the minimum width needed to show buttons.
 void incomingCallReceived(CallEvent event)
          This method is called by a protocol provider whenever an incoming call is received.
 boolean isCallTimerStarted()
          Returns true if the call timer has been started, otherwise returns false.
 boolean isConference()
          Checks if the contained call is a conference call.
 boolean isRecordingStarted()
          Checks whether recording is currently enabled or not, state retrieved from call record button state.
 boolean isShowHideVideoButtonSelected()
          Returns true if the show/hide video button is currently selected, false - otherwise.
 boolean isVideoButtonSelected()
          Returns true if the video button is currently selected, false - otherwise.
 void loadSkin()
          Reloads icons.
 void outgoingCallCreated(CallEvent event)
          This method is called by a protocol provider upon initiation of an outgoing call.
 void pluginComponentAdded(PluginComponentEvent event)
          Indicates that a plugin component has been successfully added to the container.
 void pluginComponentRemoved(PluginComponentEvent event)
          Indicates that a plugin component has been successfully removed from the container.
 void refreshContainer()
          Refreshes the content of this dialog.
 void removeCallTitleListener(CallTitleListener l)
          Removes the given CallTitleListener to the list of listeners, notified for call title changes.
 void removeRemoteVideoSpecificComponents()
          Remove remote video specific components.
 void setDesktopSharingButtonSelected(boolean isSelected)
          Selects or unselects the desktop sharing button in this call dialog.
 void setShowHideVideoButtonSelected(boolean isSelected)
          Selects or unselects the show/hide video button in this call dialog.
 void setVideoButtonSelected(boolean isSelected)
          Selects or unselects the video button in this call dialog.
 void startCallTimer()
          Starts the timer that counts call duration.
 void stopCallTimer()
          Stops the timer that counts call duration.
 void updateHoldButtonState()
          Updates the state of the general hold button.
 void updateMergeButtonState()
          Updates the mergeButton visible status.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CallPanel

public CallPanel()
Creates an empty constructor allowing to extend this panel.


CallPanel

public CallPanel(Call call,
                 CallContainer callWindow)
Creates a CallDialog by specifying the underlying call panel.

Parameters:
call - the call that this dialog represents
callWindow - the parent call window, where this container is added
Method Detail

actionPerformed

public void actionPerformed(ActionEvent evt)
Handles action events.

Specified by:
actionPerformed in interface ActionListener
Parameters:
evt - the ActionEvent that was triggered

actionPerformedOnHangupButton

public void actionPerformedOnHangupButton(boolean isCloseWait)
Executes the action associated with the "Hang up" button which may be invoked by clicking the button in question or closing this dialog.

Parameters:
isCloseWait - true to schedule close after some seconds, false to close immediately

getCall

public Call getCall()
Returns the Call corresponding to this CallDialog.

Returns:
the Call corresponding to this CallDialog.

getCallWindow

public CallContainer getCallWindow()
Returns the parent call window.

Returns:
the parent call window

updateHoldButtonState

public void updateHoldButtonState()
Updates the state of the general hold button. The hold button is selected only if all call peers are locally or mutually on hold at the same time. In all other cases the hold button is unselected.


setVideoButtonSelected

public void setVideoButtonSelected(boolean isSelected)
Selects or unselects the video button in this call dialog.

Parameters:
isSelected - indicates if the video button should be selected or not

isVideoButtonSelected

public boolean isVideoButtonSelected()
Returns true if the video button is currently selected, false - otherwise.

Returns:
true if the video button is currently selected, false - otherwise

setShowHideVideoButtonSelected

public void setShowHideVideoButtonSelected(boolean isSelected)
Selects or unselects the show/hide video button in this call dialog.

Parameters:
isSelected - indicates if the show/hide video button should be selected or not

isShowHideVideoButtonSelected

public boolean isShowHideVideoButtonSelected()
Returns true if the show/hide video button is currently selected, false - otherwise.

Returns:
true if the show/hide video button is currently selected, false - otherwise

setDesktopSharingButtonSelected

public void setDesktopSharingButtonSelected(boolean isSelected)
Selects or unselects the desktop sharing button in this call dialog.

Parameters:
isSelected - indicates if the video button should be selected or not

enableButtonsWhileOnHold

public void enableButtonsWhileOnHold(boolean hold)
Enables or disable some setting buttons when we get on/off hold.

Parameters:
hold - true if we are on hold, false otherwise

enableButtons

public void enableButtons(boolean enable)
Enables or disable all setting buttons.

Parameters:
enable - true to enable all setting buttons, false to disable them

callPeerAdded

public void callPeerAdded(CallPeerEvent evt)
Implements the CallChangeListener.callPeerAdded method. Adds the according user interface when a new peer is added to the call.

Specified by:
callPeerAdded in interface CallChangeListener
Parameters:
evt - the CallPeerEvent that notifies us for the change

callPeerRemoved

public void callPeerRemoved(CallPeerEvent evt)
Implements the CallChangeListener.callPeerRemoved method. Removes all related user interface when a peer is removed from the call.

Specified by:
callPeerRemoved in interface CallChangeListener
Parameters:
evt - the CallPeerEvent that has been triggered

callStateChanged

public void callStateChanged(CallChangeEvent evt)
Description copied from interface: CallChangeListener
Indicates that a change has occurred in the state of the source call.

Specified by:
callStateChanged in interface CallChangeListener
Parameters:
evt - the CallChangeEvent instance containing the source calls and its old and new state.

conferenceFocusChanged

public void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent)
Updates CallPeer related components to fit the new focus state.

Specified by:
conferenceFocusChanged in interface CallPeerConferenceListener
Parameters:
conferenceEvent - the event that notified us of the change

conferenceMemberAdded

public void conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent)
Description copied from interface: CallPeerConferenceListener
Notifies this listener about the addition of a specific ConferenceMember to the list of ConferenceMembers of a specific CallPeer acting as a conference focus.

Specified by:
conferenceMemberAdded in interface CallPeerConferenceListener
Parameters:
conferenceEvent - a CallPeerConferenceEvent with ID CallPeerConferenceEvent#CONFERENCE_MEMBER_ADDED and conferenceMember property specifying the ConferenceMember which was added

conferenceMemberRemoved

public void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent)
Description copied from interface: CallPeerConferenceListener
Notifies this listener about the removal of a specific ConferenceMember from the list of ConferenceMembers of a specific CallPeer acting as a conference focus.

Specified by:
conferenceMemberRemoved in interface CallPeerConferenceListener
Parameters:
conferenceEvent - a CallPeerConferenceEvent with ID CallPeerConferenceEvent#CONFERENCE_MEMBER_REMOVED and conferenceMember property specifying the ConferenceMember which was removed

isConference

public boolean isConference()
Checks if the contained call is a conference call.

Returns:
true if the contained Call is a conference call, otherwise - returns false.

startCallTimer

public void startCallTimer()
Starts the timer that counts call duration.


stopCallTimer

public void stopCallTimer()
Stops the timer that counts call duration.


isCallTimerStarted

public boolean isCallTimerStarted()
Returns true if the call timer has been started, otherwise returns false.

Returns:
true if the call timer has been started, otherwise returns false

loadSkin

public void loadSkin()
Reloads icons.

Specified by:
loadSkin in interface Skinnable

getCallTitle

public String getCallTitle()
Returns the initial call title. The call title could be then changed by call setCallTitle.

Returns:
the call title

refreshContainer

public void refreshContainer()
Refreshes the content of this dialog.


getCurrentCallRenderer

public CallRenderer getCurrentCallRenderer()
Returns the currently used CallRenderer.

Returns:
the currently used CallRenderer

addRemoteVideoSpecificComponents

public void addRemoteVideoSpecificComponents(CallPeer callPeer)
Adds remote video specific components.

Parameters:
callPeer - the CallPeer

removeRemoteVideoSpecificComponents

public void removeRemoteVideoSpecificComponents()
Remove remote video specific components.


pluginComponentAdded

public void pluginComponentAdded(PluginComponentEvent event)
Indicates that a plugin component has been successfully added to the container.

Specified by:
pluginComponentAdded in interface PluginComponentListener
Parameters:
event - the PluginComponentEvent containing the corresponding plugin component

pluginComponentRemoved

public void pluginComponentRemoved(PluginComponentEvent event)
Indicates that a plugin component has been successfully removed from the container.

Specified by:
pluginComponentRemoved in interface PluginComponentListener
Parameters:
event - the PluginComponentEvent containing the corresponding plugin component

isRecordingStarted

public boolean isRecordingStarted()
Checks whether recording is currently enabled or not, state retrieved from call record button state.

Returns:
true if the recording is already started, false otherwise

addCallTitleListener

public void addCallTitleListener(CallTitleListener l)
Adds the given CallTitleListener to the list of listeners, notified for call title changes.

Parameters:
l - the CallTitleListener to add

removeCallTitleListener

public void removeCallTitleListener(CallTitleListener l)
Removes the given CallTitleListener to the list of listeners, notified for call title changes.

Parameters:
l - the CallTitleListener to remove

disposeCallInfoFrame

public void disposeCallInfoFrame()
Disposes the call info frame if it exists.


incomingCallReceived

public void incomingCallReceived(CallEvent event)
This method is called by a protocol provider whenever an incoming call is received.

Specified by:
incomingCallReceived in interface CallListener
Parameters:
event - a CallEvent instance describing the new incoming call

outgoingCallCreated

public void outgoingCallCreated(CallEvent event)
This method is called by a protocol provider upon initiation of an outgoing call.

Specified by:
outgoingCallCreated in interface CallListener
Parameters:
event - a CalldEvent instance describing the new incoming call.

callEnded

public void callEnded(CallEvent event)
Indicates that all peers have left the source call and that it has been ended. The event may be considered redundant since there are already events issued upon termination of a single call peer but we've decided to keep it for listeners that are only interested in call duration and don't want to follow other call details.

Specified by:
callEnded in interface CallListener
Parameters:
event - the CallEvent containing the source call.

updateMergeButtonState

public void updateMergeButtonState()
Updates the mergeButton visible status.


getMinimumButtonWidth

public int getMinimumButtonWidth()
Returns the minimum width needed to show buttons. Used to calculate the minimum size of the call dialog.

Returns:
the minimum width for the buttons.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.