public class ContactList extends javax.swing.JPanel implements java.awt.event.ActionListener, ContactGroupListener, Plugin, org.jivesoftware.smack.roster.RosterListener, org.jivesoftware.smack.ConnectionListener
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.awt.event.KeyEvent |
activeKeyEvent |
static java.util.Comparator<ContactItem> |
ContactItemComparator
Sorts ContactItems.
|
static java.util.Comparator<ContactGroup> |
GROUP_COMPARATOR
Sorts ContactGroups
|
static java.lang.String |
RETRY_PANEL |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ContactList()
Creates a new instance of ContactList.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
void |
addContactListListener(ContactListListener listener) |
void |
addContextMenuListener(ContextMenuListener listener) |
void |
addFileDropListener(FileDropListener listener) |
void |
addSubscriptionListener() |
void |
authenticated(org.jivesoftware.smack.XMPPConnection xmppConnection,
boolean b) |
boolean |
canShutDown()
This method is invoked by the
PluginManager before Spark
terminates. |
void |
clientReconnected() |
void |
connected(org.jivesoftware.smack.XMPPConnection xmppConnection) |
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<java.lang.String> addresses)
Called when NEW entries are added.
|
void |
entriesDeleted(java.util.Collection<java.lang.String> addresses)
Called when users are removed from the roster.
|
void |
entriesUpdated(java.util.Collection<java.lang.String> addresses)
Handle when the Roster changes based on subscription notices.
|
void |
fireContactGroupAdded(ContactGroup group) |
void |
fireContactGroupRemoved(ContactGroup group) |
void |
fireContactItemAdded(ContactItem item) |
void |
fireContactItemClicked(ContactItem item) |
void |
fireContactItemDoubleClicked(ContactItem item) |
void |
fireContactItemRemoved(ContactItem item) |
void |
fireContextMenuListenerPopup(javax.swing.JPopupMenu popup,
java.lang.Object object) |
void |
fireFilesDropped(java.util.Collection<java.io.File> files,
ContactItem item) |
ContactGroup |
getActiveGroup() |
ContactItem |
getActiveItem() |
ContactGroup |
getContactGroup(java.lang.String groupName)
Returns a ContactGroup based on its name.
|
java.util.List<ContactGroup> |
getContactGroups() |
ContactItem |
getContactItemByDisplayName(java.lang.String displayName)
Retrieve the ContactItem by their displayed name (either alias, nickname or username).
|
ContactItem |
getContactItemByJID(java.lang.String jid)
Retrieve the ContactItem by it's jid.
|
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)
For traversing of a nested group.
|
java.util.Collection<ContactItem> |
getSelectedUsers() |
void |
initialize()
Invoked by the
PluginManager after the instance of the
Plugin is instantiated. |
void |
presenceChanged(org.jivesoftware.smack.packet.Presence presence) |
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 |
saveState() |
void |
setIconFor(java.lang.String jid,
javax.swing.Icon icon)
Set an Icon for all ContactItems that match the given jid.
|
void |
setSelectedUser(java.lang.String jid)
Selects the first user found with specified jid
|
void |
showAddContact(java.lang.String contact) |
void |
showPopup(java.awt.Component component,
java.awt.event.MouseEvent e,
ContactItem item)
Shows popup for right-clicking of ContactItem.
|
void |
showPopup(java.awt.event.MouseEvent e,
java.util.Collection<ContactItem> items)
Notifies the user that a popup call has occured on the ContactGroup.
|
void |
showPopup(java.awt.event.MouseEvent e,
ContactItem item)
Notifies the user that a popup call has occured on the ContactGroup.
|
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)
Toggles the visiblity of a ContactGroup.
|
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.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String RETRY_PANEL
public static java.awt.event.KeyEvent activeKeyEvent
public static final java.util.Comparator<ContactGroup> GROUP_COMPARATOR
public static final java.util.Comparator<ContactItem> ContactItemComparator
public void entriesAdded(java.util.Collection<java.lang.String> addresses)
entriesAdded
in interface org.jivesoftware.smack.roster.RosterListener
addresses
- the address added.public void entriesUpdated(java.util.Collection<java.lang.String> addresses)
entriesUpdated
in interface org.jivesoftware.smack.roster.RosterListener
addresses
- List of entries that were updated.public void entriesDeleted(java.util.Collection<java.lang.String> addresses)
entriesDeleted
in interface org.jivesoftware.smack.roster.RosterListener
addresses
- the addresses removed from the roster.public void presenceChanged(org.jivesoftware.smack.packet.Presence presence)
presenceChanged
in interface org.jivesoftware.smack.roster.RosterListener
public ContactItem getContactItemByJID(java.lang.String jid)
jid
- the JID of the user.public java.util.Collection<ContactItem> getContactItemsByJID(java.lang.String jid)
jid
- the users JID.ContactItem
items.public void setIconFor(java.lang.String jid, javax.swing.Icon icon)
jid
- the users jid.icon
- the icon to use.public void useDefaults(java.lang.String jid)
jid
- the users jid.public ContactItem getContactItemByDisplayName(java.lang.String displayName)
displayName
- the users nickname in the contact list.public ContactGroup getContactGroup(java.lang.String groupName)
groupName
- the name of the ContactGroup.public ContactGroup getParentGroup(java.lang.String groupName)
groupName
- the name of the nested contact group.public void toggleGroupVisibility(java.lang.String groupName, boolean visible)
groupName
- the name of the ContactGroup.visible
- true to show, otherwise false.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void contactItemClicked(ContactItem item)
ContactGroupListener
contactItemClicked
in interface ContactGroupListener
item
- the ContactItem clicked.public void contactItemDoubleClicked(ContactItem item)
ContactGroupListener
contactItemDoubleClicked
in interface ContactGroupListener
item
- the ContactItem double clicked.public void contactGroupPopup(java.awt.event.MouseEvent e, ContactGroup group)
ContactGroupListener
contactGroupPopup
in interface ContactGroupListener
e
- the MouseEvent that triggered the event.group
- the ContactGroup.public void showPopup(java.awt.event.MouseEvent e, ContactItem item)
ContactGroupListener
showPopup
in interface ContactGroupListener
e
- the MouseEvent that triggered the event.item
- the ContactItem clicked within the ContactGroup.public void showPopup(java.awt.Component component, java.awt.event.MouseEvent e, ContactItem item)
e
- the MouseEventitem
- the ContactItemcomponent
- the owning componentpublic void showPopup(java.awt.event.MouseEvent e, java.util.Collection<ContactItem> items)
ContactGroupListener
showPopup
in interface ContactGroupListener
e
- the MouseEvent that triggered the event.items
- the ContactItems within the ContactGroup.public void initialize()
Plugin
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.initialize
in interface Plugin
PluginManager
public void addSubscriptionListener()
public void shutdown()
Plugin
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.public boolean canShutDown()
Plugin
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.canShutDown
in interface Plugin
public javax.swing.JPanel getMainPanel()
public java.util.List<ContactGroup> getContactGroups()
public void addContextMenuListener(ContextMenuListener listener)
public void removeContextMenuListener(ContextMenuListener listener)
public void fireContextMenuListenerPopup(javax.swing.JPopupMenu popup, java.lang.Object object)
public javax.swing.JComponent getGUI()
public ContactGroup getActiveGroup()
public java.util.Collection<ContactItem> getSelectedUsers()
public void setSelectedUser(java.lang.String jid)
jid,
- the Users JIDpublic void addFileDropListener(FileDropListener listener)
public void removeFileDropListener(FileDropListener listener)
public void fireFilesDropped(java.util.Collection<java.io.File> files, ContactItem item)
public void contactItemAdded(ContactItem item)
ContactGroupListener
ContactItem
has been added to the ContactGroup.contactItemAdded
in interface ContactGroupListener
item
- the ContactItem.public void contactItemRemoved(ContactItem item)
ContactGroupListener
ContactItem
has been removed from a ContactGroup.contactItemRemoved
in interface ContactGroupListener
item
- the ContactItem removed.public void addContactListListener(ContactListListener listener)
public void removeContactListListener(ContactListListener listener)
public void fireContactItemAdded(ContactItem item)
public void fireContactItemRemoved(ContactItem item)
public void fireContactGroupAdded(ContactGroup group)
public void fireContactGroupRemoved(ContactGroup group)
public void fireContactItemClicked(ContactItem item)
public void fireContactItemDoubleClicked(ContactItem item)
public void uninstall()
Plugin
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.public void saveState()
public void connected(org.jivesoftware.smack.XMPPConnection xmppConnection)
connected
in interface org.jivesoftware.smack.ConnectionListener
public void authenticated(org.jivesoftware.smack.XMPPConnection xmppConnection, boolean b)
authenticated
in interface org.jivesoftware.smack.ConnectionListener
public void connectionClosed()
connectionClosed
in interface org.jivesoftware.smack.ConnectionListener
public void clientReconnected()
public void connectionClosedOnError(java.lang.Exception ex)
connectionClosedOnError
in interface org.jivesoftware.smack.ConnectionListener
public void reconnectingIn(int i)
reconnectingIn
in interface org.jivesoftware.smack.ConnectionListener
public void reconnectionSuccessful()
reconnectionSuccessful
in interface org.jivesoftware.smack.ConnectionListener
public void reconnectionFailed(java.lang.Exception exception)
reconnectionFailed
in interface org.jivesoftware.smack.ConnectionListener
public void showAddContact(java.lang.String contact)
public ContactItem getActiveItem()