Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.contactlist
Class DefaultContactList

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JList
                  extended by net.java.sip.communicator.impl.gui.main.contactlist.DefaultContactList
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, Skinnable
Direct Known Subclasses:
ContactList

public class DefaultContactList
extends JList
implements Skinnable

DeafultContactlist used to display JLists with contacts.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JList
JList.AccessibleJList, JList.DropLocation
 
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
(package private)  ContactListCellRenderer renderer
          List cell renderer.
 
Fields inherited from class javax.swing.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
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
DefaultContactList()
          Creates an instance of DefaultContactList.
 
Method Summary
 JToolTip createToolTip()
          Creates a customized tooltip for this contact list.
protected  void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
          Processes the MouseEvent we have previously cached before invoking the parent fireSelectionValueChanged which would notify the JList ListSelectionListeners that the selection model has changed.
 PresenceStatus getMetaContactStatus(MetaContact metaContact)
          Returns the general status of the given MetaContact.
 int getNextMatch(String prefix, int startIndex, Position.Bias bias)
          Returns the next list element that starts with a prefix.
 String getToolTipText(MouseEvent event)
          Returns the string to be used as the tooltip for event.
 boolean isGroupClosed(MetaContactGroup group)
          Checks whether the group is closed.
 boolean isMetaContactActive(MetaContact metaContact)
          Checks if the given contact is currently active.
 void loadSkin()
          Reloads skin information stored in render class.
protected  void processMouseEvent(MouseEvent event)
          Caches the incoming mouse event before passing it to the parent implementation of processMouseEvent.
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, 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, 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, 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

renderer

ContactListCellRenderer renderer
List cell renderer.

Constructor Detail

DefaultContactList

public DefaultContactList()
Creates an instance of DefaultContactList.

Method Detail

isMetaContactActive

public boolean isMetaContactActive(MetaContact metaContact)
Checks if the given contact is currently active. Dummy method used and overridden from classes extending this functionality such as ContactList.

Parameters:
metaContact - the MetaContact to verify
Returns:
TRUE if the given MetaContact is active, FALSE - otherwise

isGroupClosed

public boolean isGroupClosed(MetaContactGroup group)
Checks whether the group is closed. Dummy method used and overridden from classes extending this functionality such as ContactList.

Parameters:
group - The group to check.
Returns:
True if the group is closed, false - otherwise.

getMetaContactStatus

public PresenceStatus getMetaContactStatus(MetaContact metaContact)
Returns the general status of the given MetaContact. Detects the status using the priority status table. The priority is defined on the "availability" factor and here the most "available" status is returned.

Parameters:
metaContact - The metaContact for which the status is asked.
Returns:
PresenceStatus The most "available" status from all subcontact statuses.

createToolTip

public JToolTip createToolTip()
Creates a customized tooltip for this contact list.

Overrides:
createToolTip in class JComponent
Returns:
The customized tooltip.

getToolTipText

public String getToolTipText(MouseEvent event)
Returns the string to be used as the tooltip for event. We don't really use this string, but we need to return a different string each time in order to make the TooltipManager change the tooltip over the different cells in the JList.

Overrides:
getToolTipText in class JList
Parameters:
event - the MouseEvent that notified us
Returns:
the string to be used as the tooltip for event.

getNextMatch

public int getNextMatch(String prefix,
                        int startIndex,
                        Position.Bias bias)
Returns the next list element that starts with a prefix.

Overrides:
getNextMatch in class JList
Parameters:
prefix - the string to test for a match
startIndex - the index for starting the search
bias - the search direction, either Position.Bias.Forward or Position.Bias.Backward.
Returns:
the index of the next list element that starts with the prefix; otherwise -1

fireSelectionValueChanged

protected void fireSelectionValueChanged(int firstIndex,
                                         int lastIndex,
                                         boolean isAdjusting)
Processes the MouseEvent we have previously cached before invoking the parent fireSelectionValueChanged which would notify the JList ListSelectionListeners that the selection model has changed.

Workaround provided by simon@tardell.se on 29-DEC-2002 for bug 4521075 http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=a13e98ab2364524506eb91505565?bug_id=4521075 "Drag gesture in JAVA different from Windows". The bug is also noticed on Mac Leopard.

Overrides:
fireSelectionValueChanged in class JList
Parameters:
firstIndex - the first selected index
lastIndex - the last selected index
isAdjusting - true if multiple changes are being made

processMouseEvent

protected void processMouseEvent(MouseEvent event)
Caches the incoming mouse event before passing it to the parent implementation of processMouseEvent.

Workaround provided by simon@tardell.se on 29-DEC-2002 for bug 4521075 http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=a13e98ab2364524506eb91505565?bug_id=4521075 "Drag gesture in JAVA different from Windows". The bug is also noticed on Mac Leopard.

Overrides:
processMouseEvent in class JComponent
Parameters:
event - the MouseEvent to process

loadSkin

public void loadSkin()
Reloads skin information stored in render class.

Specified by:
loadSkin in interface Skinnable

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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