Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.presence
Class AccountStatusPanel

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.presence.AccountStatusPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, PluginComponentListener, AvatarListener, RegistrationStateChangeListener, ServerStoredDetailsChangeListener, Skinnable

public class AccountStatusPanel
extends TransparentPanel
implements RegistrationStateChangeListener, ServerStoredDetailsChangeListener, PluginComponentListener, AvatarListener, Skinnable

The panel shown on the top of the contact list. It contains user name, current status menu and the avatar of the user.

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
AccountStatusPanel(MainFrame mainFrame)
          Creates an instance of AccountStatusPanel by specifying the main window, where this panel is added.
 
Method Summary
 void addAccount(ProtocolProviderService protocolProvider)
          Adds the account given by protocolProvider in the contained status combo box.
 void avatarChanged(AvatarEvent event)
          Called whenever a new avatar is defined for one of the protocols that we have subscribed for.
 boolean containsAccount(ProtocolProviderService protocolProvider)
          Checks if an account corresponding to the given protocolProvider is contained in the contained status combo box.
static byte[] getGlobalAccountImage()
          Returns the global account image currently shown on the top of the application window.
 Object getLastPresenceStatus(ProtocolProviderService protocolProvider)
          Returns the last used presence status for the given protocolProvider.
 String getLastStatusString(ProtocolProviderService protocolProvider)
          Returns the last used status for the given protocolProvider as a String.
 boolean hasSelectedMenus()
          Returns true if there are selected status selector boxes, otherwise returns false.
 void loadSkin()
          Loads images for the account status panel.
 void paintComponent(Graphics g)
          Paints this component.
 void pluginComponentAdded(PluginComponentEvent event)
          Indicates that a plug-in component is registered to be added in a container.
 void pluginComponentRemoved(PluginComponentEvent event)
          Indicates that a plug-in component is registered to be removed from a container.
 void registrationStateChanged(RegistrationStateChangeEvent evt)
          Updates account information when a protocol provider is registered.
 void removeAccount(ProtocolProviderService protocolProvider)
          Removes the account given by protocolProvider from the contained status combo box.
 void serverStoredDetailsChanged(ServerStoredDetailsChangeEvent evt)
          Registers a ServerStoredDetailsChangeListener with the operation sets of the providers, if a provider change its name we use it in the UI.
 void startConnecting(ProtocolProviderService protocolProvider)
          Starts connecting user interface for the given protocolProvider.
 void stopConnecting(ProtocolProviderService protocolProvider)
          Stops connecting user interface for the given protocolProvider.
 void updateImage(ImageIcon img)
          Updates the image that is shown.
 void updateStatus(ProtocolProviderService protocolProvider)
          Updates the current status of the protocolProvider.
 void updateStatus(ProtocolProviderService protocolProvider, PresenceStatus newStatus)
          Updates the current status of the protocolProvider with the newStatus.
 
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, 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

AccountStatusPanel

public AccountStatusPanel(MainFrame mainFrame)
Creates an instance of AccountStatusPanel by specifying the main window, where this panel is added.

Parameters:
mainFrame - the main window, where this panel is added
Method Detail

addAccount

public void addAccount(ProtocolProviderService protocolProvider)
Adds the account given by protocolProvider in the contained status combo box.

Parameters:
protocolProvider - the ProtocolProviderService corresponding to the account to add

removeAccount

public void removeAccount(ProtocolProviderService protocolProvider)
Removes the account given by protocolProvider from the contained status combo box.

Parameters:
protocolProvider - the ProtocolProviderService corresponding to the account to remove

containsAccount

public boolean containsAccount(ProtocolProviderService protocolProvider)
Checks if an account corresponding to the given protocolProvider is contained in the contained status combo box.

Parameters:
protocolProvider - the ProtocolProviderService corresponding to the account to check for
Returns:
true to indicate that an account corresponding to the given protocolProvider is contained in the status box, false - otherwise

getLastPresenceStatus

public Object getLastPresenceStatus(ProtocolProviderService protocolProvider)
Returns the last used presence status for the given protocolProvider.

Parameters:
protocolProvider - the ProtocolProviderService corresponding to the account we're looking for
Returns:
the last used presence status for the given protocolProvider

getLastStatusString

public String getLastStatusString(ProtocolProviderService protocolProvider)
Returns the last used status for the given protocolProvider as a String.

Parameters:
protocolProvider - the ProtocolProviderService corresponding to the account we're looking for
Returns:
a String representation of the last used status for the given protocolProvider

updateStatus

public void updateStatus(ProtocolProviderService protocolProvider,
                         PresenceStatus newStatus)
Updates the current status of the protocolProvider with the newStatus.

Parameters:
protocolProvider - the ProtocolProviderService to update
newStatus - the new status to set

updateStatus

public void updateStatus(ProtocolProviderService protocolProvider)
Updates the current status of the protocolProvider.

Parameters:
protocolProvider - the ProtocolProviderService to update

updateImage

public void updateImage(ImageIcon img)
Updates the image that is shown.

Parameters:
img - the new image.

startConnecting

public void startConnecting(ProtocolProviderService protocolProvider)
Starts connecting user interface for the given protocolProvider.

Parameters:
protocolProvider - the ProtocolProviderService to start connecting for

stopConnecting

public void stopConnecting(ProtocolProviderService protocolProvider)
Stops connecting user interface for the given protocolProvider.

Parameters:
protocolProvider - the ProtocolProviderService to stop connecting for

hasSelectedMenus

public boolean hasSelectedMenus()
Returns true if there are selected status selector boxes, otherwise returns false.

Returns:
true if there are selected status selector boxes, otherwise returns false

registrationStateChanged

public void registrationStateChanged(RegistrationStateChangeEvent evt)
Updates account information when a protocol provider is registered.

Specified by:
registrationStateChanged in interface RegistrationStateChangeListener
Parameters:
evt - the RegistrationStateChangeEvent that notified us of the change

paintComponent

public void paintComponent(Graphics g)
Paints this component.

Overrides:
paintComponent in class JComponent
Parameters:
g - the Graphics object used for painting

pluginComponentAdded

public void pluginComponentAdded(PluginComponentEvent event)
Indicates that a plug-in component is registered to be added in a container. If the plug-in component in the given event is registered for this container then we add it.

Specified by:
pluginComponentAdded in interface PluginComponentListener
Parameters:
event - PluginComponentEvent that notified us

pluginComponentRemoved

public void pluginComponentRemoved(PluginComponentEvent event)
Indicates that a plug-in component is registered to be removed from a container. If the plug-in component in the given event is registered for this container then we remove it.

Specified by:
pluginComponentRemoved in interface PluginComponentListener
Parameters:
event - PluginComponentEvent that notified us

getGlobalAccountImage

public static byte[] getGlobalAccountImage()
Returns the global account image currently shown on the top of the application window.

Returns:
the global account image

avatarChanged

public void avatarChanged(AvatarEvent event)
Called whenever a new avatar is defined for one of the protocols that we have subscribed for.

Specified by:
avatarChanged in interface AvatarListener
Parameters:
event - the event containing the new image

loadSkin

public void loadSkin()
Loads images for the account status panel.

Specified by:
loadSkin in interface Skinnable

serverStoredDetailsChanged

public void serverStoredDetailsChanged(ServerStoredDetailsChangeEvent evt)
Registers a ServerStoredDetailsChangeListener with the operation sets of the providers, if a provider change its name we use it in the UI.

Specified by:
serverStoredDetailsChanged in interface ServerStoredDetailsChangeListener
Parameters:
evt - the ServerStoredDetailsChangeEvent the event for name change.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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