org.jivesoftware.spark.ui
Class ContactList

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 org.jivesoftware.spark.ui.ContactList
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, org.jivesoftware.smack.ConnectionListener, org.jivesoftware.smack.RosterListener, Plugin, ContactGroupListener

public final class ContactList
extends javax.swing.JPanel
implements java.awt.event.ActionListener, ContactGroupListener, Plugin, org.jivesoftware.smack.RosterListener, org.jivesoftware.smack.ConnectionListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String RETRY_PANEL
           
 
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
ContactList()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addContactListListener(ContactListListener listener)
           
 void addContextMenuListener(ContextMenuListener listener)
           
 void addFileDropListener(FileDropListener listener)
           
 void addSubscriptionListener()
           
 boolean canShutDown()
          This method is invoked by the PluginManager before Spark terminates.
 void clientReconnected()
           
 void connectionClosed()
           
 void connectionClosedOnError(java.lang.Exception ex)
           
 void contactGroupPopup(java.awt.event.MouseEvent e, ContactGroup group)
          Notifies the user that a Popup event has occured on the ContactGroup title bar.
 void contactItemAdded(ContactItem item)
          Notifies a user that a new ContactItem has been added to the ContactGroup.
 void contactItemClicked(ContactItem item)
          Notifies the user that a ContactItem within the ContactGroup has been clicked.
 void contactItemDoubleClicked(ContactItem item)
          Notifies the user that a ContactItem within the ContactGroup has been double-clicked.
 void contactItemRemoved(ContactItem item)
          Notifies the user that a ContactItem has been removed from a ContactGroup.
 void entriesAdded(java.util.Collection addresses)
          Called when NEW entries are added.
 void entriesDeleted(java.util.Collection addresses)
          Called when users are removed from the roster.
 void entriesUpdated(java.util.Collection addresses)
          Handle when the Roster changes based on subscription notices.
 void fireContactGroupAdded(ContactGroup group)
           
 void fireContactGroupRemoved(ContactGroup group)
           
 void fireContactItemAdded(ContactItem item)
           
 void fireContactItemRemoved(ContactItem item)
           
 void fireContextMenuListenerPopup(javax.swing.JPopupMenu popup, java.lang.Object object)
           
 void fireFilesDropped(java.util.Collection files, ContactItem item)
           
 ContactGroup getActiveGroup()
           
 ContactGroup getContactGroup(java.lang.String groupName)
           
 java.util.List<ContactGroup> getContactGroups()
           
 ContactItem getContactItemByJID(java.lang.String jid)
          Retrieve the ContactItem by it's jid.
 ContactItem getContactItemByNickname(java.lang.String nickname)
          Retrieve the ContactItem by their nickname.
 java.util.Collection<ContactItem> getContactItemsByJID(java.lang.String jid)
          Returns a Collection of ContactItems in a ContactList.
 javax.swing.JComponent getGUI()
           
 javax.swing.JPanel getMainPanel()
           
 ContactGroup getParentGroup(java.lang.String groupName)
           
 java.util.Collection getSelectedUsers()
           
 void initialize()
          Invoked by the PluginManager after the instance of the Plugin is instantiated.
 void presenceChanged(java.lang.String user)
           
 void reconnectingIn(int i)
           
 void reconnectionFailed(java.lang.Exception exception)
           
 void reconnectionSuccessful()
           
 void removeContactListListener(ContactListListener listener)
           
 void removeContextMenuListener(ContextMenuListener listener)
           
 void removeFileDropListener(FileDropListener listener)
           
 void setIconFor(java.lang.String jid, javax.swing.Icon icon)
          Set an Icon for all ContactItems that match the given jid.
 void showPopup(java.awt.event.MouseEvent e, java.util.Collection items)
          Notifies the user that a popup call has occured on the ContactGroup.
 void showPopup(java.awt.event.MouseEvent e, ContactItem item)
          Shows popup for right-clicking of ContactItem.
 void shutdown()
          This method is invoked by the PluginManager when Spark wishes you to remove any temporary resources (in memory) such as installed components, or settings.
 void toggleGroupVisibility(java.lang.String groupName, boolean visible)
           
 void uninstall()
          This method is invoked by the PluginManager when a Spark user asks that this plugin be uninstalled.
 void useDefaults(java.lang.String jid)
          Sets the default settings for a ContactItem.
 
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, 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, 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
 

Field Detail

RETRY_PANEL

public static final java.lang.String RETRY_PANEL
See Also:
Constant Field Values
Constructor Detail

ContactList

public ContactList()
Method Detail

entriesAdded

public void entriesAdded(java.util.Collection addresses)
Called when NEW entries are added.

Specified by:
entriesAdded in interface org.jivesoftware.smack.RosterListener
Parameters:
addresses - the address added.

entriesUpdated

public void entriesUpdated(java.util.Collection addresses)
Handle when the Roster changes based on subscription notices.

Specified by:
entriesUpdated in interface org.jivesoftware.smack.RosterListener
Parameters:
addresses -

entriesDeleted

public void entriesDeleted(java.util.Collection addresses)
Called when users are removed from the roster.

Specified by:
entriesDeleted in interface org.jivesoftware.smack.RosterListener
Parameters:
addresses - the addresses removed from the roster.

presenceChanged

public void presenceChanged(java.lang.String user)
Specified by:
presenceChanged in interface org.jivesoftware.smack.RosterListener

getContactItemByJID

public ContactItem getContactItemByJID(java.lang.String jid)
Retrieve the ContactItem by it's jid.

Parameters:
jid - the JID of the user.
Returns:
the "first" contact item found.

getContactItemsByJID

public java.util.Collection<ContactItem> getContactItemsByJID(java.lang.String jid)
Returns a Collection of ContactItems in a ContactList.

Parameters:
jid - the users JID.
Returns:
a Collection of ContactItem items.

setIconFor

public void setIconFor(java.lang.String jid,
                       javax.swing.Icon icon)
Set an Icon for all ContactItems that match the given jid.

Parameters:
jid - the users jid.
icon - the icon to use.

useDefaults

public void useDefaults(java.lang.String jid)
Sets the default settings for a ContactItem.

Parameters:
jid - the users jid.

getContactItemByNickname

public ContactItem getContactItemByNickname(java.lang.String nickname)
Retrieve the ContactItem by their nickname.

Parameters:
nickname - the users nickname in the contact list.
Returns:
the "first" contact item found.

getContactGroup

public ContactGroup getContactGroup(java.lang.String groupName)

getParentGroup

public ContactGroup getParentGroup(java.lang.String groupName)

toggleGroupVisibility

public void toggleGroupVisibility(java.lang.String groupName,
                                  boolean visible)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

contactItemClicked

public void contactItemClicked(ContactItem item)
Description copied from interface: ContactGroupListener
Notifies the user that a ContactItem within the ContactGroup has been clicked.

Specified by:
contactItemClicked in interface ContactGroupListener
Parameters:
item - the ContactItem clicked.

contactItemDoubleClicked

public void contactItemDoubleClicked(ContactItem item)
Description copied from interface: ContactGroupListener
Notifies the user that a ContactItem within the ContactGroup has been double-clicked.

Specified by:
contactItemDoubleClicked in interface ContactGroupListener
Parameters:
item - the ContactItem double clicked.

contactGroupPopup

public void contactGroupPopup(java.awt.event.MouseEvent e,
                              ContactGroup group)
Description copied from interface: ContactGroupListener
Notifies the user that a Popup event has occured on the ContactGroup title bar.

Specified by:
contactGroupPopup in interface ContactGroupListener
Parameters:
e - the MouseEvent that triggered the event.
group - the ContactGroup.

showPopup

public void showPopup(java.awt.event.MouseEvent e,
                      ContactItem item)
Shows popup for right-clicking of ContactItem.

Specified by:
showPopup in interface ContactGroupListener
Parameters:
e - the MouseEvent
item - the ContactItem

showPopup

public void showPopup(java.awt.event.MouseEvent e,
                      java.util.Collection items)
Description copied from interface: ContactGroupListener
Notifies the user that a popup call has occured on the ContactGroup.

Specified by:
showPopup in interface ContactGroupListener
Parameters:
e - the MouseEvent that triggered the event.
items - the ContactItems within the ContactGroup.

initialize

public void initialize()
Description copied from interface: Plugin
Invoked by the PluginManager after the instance of the Plugin is instantiated. When invoked, The Plugin should register with whatever listeners they may need to use or are required for use during this classes lifecycle. Plugin authors should take care to ensure that any extraneous initialization is not preformed on this method, and any startup code that can be delayed until a later time is delayed, as the Plugin's are synchronously initialized during the startup of Spark, and each Plugin has the potential to negatively impact the startup time of the product.

Specified by:
initialize in interface Plugin
See Also:
PluginManager

addSubscriptionListener

public void addSubscriptionListener()

shutdown

public void shutdown()
Description copied from interface: Plugin
This method is invoked by the PluginManager when Spark wishes you to remove any temporary resources (in memory) such as installed components, or settings. Any non java resources (file handles, database connections, etc) which are still being held by this Plugin should be released by this method immediately. This method is not guaranteed to be called, but on normal terminations of Spark, this method will be invoked.

Specified by:
shutdown in interface Plugin

canShutDown

public boolean canShutDown()
Description copied from interface: Plugin
This method is invoked by the PluginManager before Spark terminates. Plugin's should NOT use this method to release resources. They should only use this method to give users the opportunity to cancel the exit process if there is some process started by this plugin still running.

Implementations should return false to cancel the shutdown process.

Specified by:
canShutDown in interface Plugin

getMainPanel

public javax.swing.JPanel getMainPanel()

getContactGroups

public java.util.List<ContactGroup> getContactGroups()

addContextMenuListener

public void addContextMenuListener(ContextMenuListener listener)

removeContextMenuListener

public void removeContextMenuListener(ContextMenuListener listener)

fireContextMenuListenerPopup

public void fireContextMenuListenerPopup(javax.swing.JPopupMenu popup,
                                         java.lang.Object object)

getGUI

public javax.swing.JComponent getGUI()

getActiveGroup

public ContactGroup getActiveGroup()

getSelectedUsers

public java.util.Collection getSelectedUsers()

addFileDropListener

public void addFileDropListener(FileDropListener listener)

removeFileDropListener

public void removeFileDropListener(FileDropListener listener)

fireFilesDropped

public void fireFilesDropped(java.util.Collection files,
                             ContactItem item)

contactItemAdded

public void contactItemAdded(ContactItem item)
Description copied from interface: ContactGroupListener
Notifies a user that a new ContactItem has been added to the ContactGroup.

Specified by:
contactItemAdded in interface ContactGroupListener
Parameters:
item - the ContactItem.

contactItemRemoved

public void contactItemRemoved(ContactItem item)
Description copied from interface: ContactGroupListener
Notifies the user that a ContactItem has been removed from a ContactGroup.

Specified by:
contactItemRemoved in interface ContactGroupListener
Parameters:
item - the ContactItem removed.

addContactListListener

public void addContactListListener(ContactListListener listener)

removeContactListListener

public void removeContactListListener(ContactListListener listener)

fireContactItemAdded

public void fireContactItemAdded(ContactItem item)

fireContactItemRemoved

public void fireContactItemRemoved(ContactItem item)

fireContactGroupAdded

public void fireContactGroupAdded(ContactGroup group)

fireContactGroupRemoved

public void fireContactGroupRemoved(ContactGroup group)

uninstall

public void uninstall()
Description copied from interface: Plugin
This method is invoked by the PluginManager when a Spark user asks that this plugin be uninstalled. Before this method is called, you will need to release all your in-memory resources in the #shutdown method. This method should be used to remove on disk resources such as files, images, etc.

Specified by:
uninstall in interface Plugin

connectionClosed

public void connectionClosed()
Specified by:
connectionClosed in interface org.jivesoftware.smack.ConnectionListener

clientReconnected

public void clientReconnected()

connectionClosedOnError

public void connectionClosedOnError(java.lang.Exception ex)
Specified by:
connectionClosedOnError in interface org.jivesoftware.smack.ConnectionListener

reconnectingIn

public void reconnectingIn(int i)
Specified by:
reconnectingIn in interface org.jivesoftware.smack.ConnectionListener

reconnectionSuccessful

public void reconnectionSuccessful()
Specified by:
reconnectionSuccessful in interface org.jivesoftware.smack.ConnectionListener

reconnectionFailed

public void reconnectionFailed(java.lang.Exception exception)
Specified by:
reconnectionFailed in interface org.jivesoftware.smack.ConnectionListener