Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.AbstractButton
                  extended by javax.swing.JMenuItem
                      extended by javax.swing.JMenu
                          extended by net.java.sip.communicator.util.swing.SIPCommMenu
                              extended by net.java.sip.communicator.impl.gui.main.presence.StatusSelectorMenu
                                  extended by net.java.sip.communicator.impl.gui.main.presence.GlobalStatusSelectorBox
All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, MenuElement, SwingConstants, Skinnable

public class GlobalStatusSelectorBox
extends StatusSelectorMenu
implements ActionListener

The GlobalStatusSelectorBox is a global status selector box, which appears in the status panel, when the user has more than one account. It allows to the user to change globally its status with only one click, instead of going through all accounts and selecting the desired status for every one of them.

By default the GlobalStatusSelectorBox will show the most connected status of all registered accounts.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JMenu
JMenu.AccessibleJMenu, JMenu.WinListener
 
Nested classes/interfaces inherited from class javax.swing.JMenuItem
JMenuItem.AccessibleJMenuItem
 
Nested classes/interfaces inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
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 net.java.sip.communicator.impl.gui.main.presence.StatusSelectorMenu
protocolProvider
 
Fields inherited from class javax.swing.JMenu
popupListener
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
GlobalStatusSelectorBox(MainFrame mainFrame)
          Creates an instance of SimpleStatusSelectorBox.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Handles the ActionEvent triggered when one of the items in the list is selected.
 void addAccount(ProtocolProviderService protocolProvider)
          Adds a status menu for the account given by protocolProvider.
 boolean containsAccount(ProtocolProviderService protocolProvider)
          Checks if a menu for the given protocolProvider exists.
 PresenceStatus getLastPresenceStatus(ProtocolProviderService protocolProvider)
          Returns the last status that was stored in the configuration xml for the given protocol provider.
 String getLastStatusString(ProtocolProviderService protocolProvider)
          Returns the last contact status saved in the configuration.
 String getUIClassID()
          Returns the name of the L&F class that renders this component.
 boolean hasSelectedMenus()
          Returns true if there are selected status selector boxes, otherwise returns false.
 void loadSkin()
          Loads all icons and updates global status.
 void paintComponent(Graphics g)
          Overwrites the paintComponent(Graphics g) method in order to provide a new look and the mouse moves over this component.
 void removeAccount(ProtocolProviderService protocolProvider)
          Removes the status menu corresponding to the account given by protocolProvider.
 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 updateStatus(ProtocolProviderService protocolProvider)
          Updates the status of the given protocolProvider.
 void updateStatus(ProtocolProviderService protocolProvider, PresenceStatus presenceStatus)
          Updates the status of the given protocolProvider with the given presenceStatus.
 
Methods inherited from class net.java.sip.communicator.impl.gui.main.presence.StatusSelectorMenu
getAccountIndex, getProtocolProvider, imageUpdate, saveStatusInformation, setAccountIndex, startConnecting, stopConnecting, updateStatus
 
Methods inherited from class net.java.sip.communicator.util.swing.SIPCommMenu
addItem, getSelectedObject, setMouseOver, setSelected, setSelectedObject
 
Methods inherited from class javax.swing.JMenu
add, add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI
 
Methods inherited from class javax.swing.JMenuItem
actionPropertyChanged, addMenuDragMouseListener, addMenuKeyListener, configurePropertiesFromAction, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setEnabled, setUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
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, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, 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, 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
 
Methods inherited from interface javax.swing.MenuElement
processKeyEvent, processMouseEvent
 

Constructor Detail

GlobalStatusSelectorBox

public GlobalStatusSelectorBox(MainFrame mainFrame)
Creates an instance of SimpleStatusSelectorBox.

Parameters:
mainFrame - The main application window.
Method Detail

addAccount

public void addAccount(ProtocolProviderService protocolProvider)
Adds a status menu for the account given by protocolProvider.

Parameters:
protocolProvider - the ProtocolProviderService, for which to add a status menu

removeAccount

public void removeAccount(ProtocolProviderService protocolProvider)
Removes the status menu corresponding to the account given by protocolProvider.

Parameters:
protocolProvider - the ProtocolProviderService, which menu to remove

containsAccount

public boolean containsAccount(ProtocolProviderService protocolProvider)
Checks if a menu for the given protocolProvider exists.

Parameters:
protocolProvider - the ProtocolProviderService to check
Returns:
true to indicate that a status menu for the given protocolProvider already exists, otherwise returns false

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

actionPerformed

public void actionPerformed(ActionEvent e)
Handles the ActionEvent triggered when one of the items in the list is selected.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - the ActionEvent that notified us

updateStatus

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

Parameters:
protocolProvider - the ProtocolProviderService corresponding to the menu to update

updateStatus

public void updateStatus(ProtocolProviderService protocolProvider,
                         PresenceStatus presenceStatus)
Updates the status of the given protocolProvider with the given presenceStatus.

Parameters:
protocolProvider - the ProtocolProviderService corresponding to the menu to update
presenceStatus - the new status to set

getLastPresenceStatus

public PresenceStatus getLastPresenceStatus(ProtocolProviderService protocolProvider)
Returns the last status that was stored in the configuration xml for the given protocol provider.

Parameters:
protocolProvider - the protocol provider
Returns:
the last status that was stored in the configuration xml for the given protocol provider

getLastStatusString

public String getLastStatusString(ProtocolProviderService protocolProvider)
Returns the last contact status saved in the configuration.

Parameters:
protocolProvider - the protocol provider to which the status corresponds
Returns:
the last contact status saved in the configuration.

paintComponent

public void paintComponent(Graphics g)
Overwrites the paintComponent(Graphics g) method in order to provide a new look and the mouse moves over this component.

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

loadSkin

public void loadSkin()
Loads all icons and updates global status.

Specified by:
loadSkin in interface Skinnable
Overrides:
loadSkin in class StatusSelectorMenu

getUIClassID

public String getUIClassID()
Returns the name of the L&F class that renders this component.

Overrides:
getUIClassID in class JMenu
Returns:
the string "TreeUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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