org.jivesoftware.spark.ui
Class ContactGroup

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.component.panes.CollapsiblePane
                      extended by org.jivesoftware.spark.ui.ContactGroup
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class ContactGroup
extends CollapsiblePane
implements java.awt.event.MouseListener

Container representing a RosterGroup within the Contact List.

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
 
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
ContactGroup(java.lang.String groupName)
          Create a new ContactGroup.
 
Method Summary
 void addContactGroup(ContactGroup contactGroup)
           
 void addContactGroupListener(ContactGroupListener listener)
          Add a ContactGroupListener.
 void addContactItem(ContactItem item)
          Adds a ContactItem to the ContactGroup.
 void clearSelection()
          Clears all selections within this group.
 void fireContactGroupUpdated()
          Call whenever the UI needs to be updated.
 ContactGroup getContactGroup(java.lang.String groupName)
          Returns a ContactGroup based on it's name.
 java.util.Collection getContactGroups()
           
 ContactItem getContactItemByJID(java.lang.String bareJID)
          Returns a ContactItem by the users bare bareJID.
 ContactItem getContactItemByNickname(java.lang.String nickname)
          Returns a ContactItem by the nickname the user has been assigned.
 java.util.List<ContactItem> getContactItems()
          Returns all ContactItems in the ContactGroup.
 javax.swing.JPanel getContainerPanel()
           
 java.lang.String getGroupName()
          Returns the name of the ContactGroup.
 java.lang.String getGroupTitle(java.lang.String title)
           
 javax.swing.JList getList()
          Returns the containing JList of the ContactGroup.
 javax.swing.JPanel getListPanel()
           
 java.awt.Dimension getPreferredSize()
          Lets make sure that the panel doesn't stretch past the scrollpane view pane.
 java.util.List getSelectedContacts()
          Returns all Selected Contacts within the ContactGroup.
 boolean hasAvailableContacts()
          Returns true if the ContactGroup contains available users.
 boolean isOfflineGroup()
          Returns true if this ContactGroup is the Offline Group.
 boolean isSharedGroup()
          Returns true if ContactGroup is a Shared Group.
 boolean isSubGroup()
           
 boolean isSubGroup(java.lang.String groupName)
           
 boolean isUnfiledGroup()
          Returns true if this ContactGroup is the Unfiled Group.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void removeContactGroup(ContactGroup contactGroup)
          Removes a child ContactGroup.
 void removeContactGroupListener(ContactGroupListener listener)
          Removes a ContactGroupListener.
 void removeContactItem(ContactItem item)
          Removes a ContactItem.
 void setGroupName(java.lang.String groupName)
           
 void setPanelBackground(java.awt.Color color)
           
protected  void setSharedGroup(boolean sharedGroup)
          Set to true if this ContactGroup is a shared Group.
 java.lang.String toString()
           
 
Methods inherited from class org.jivesoftware.spark.component.panes.CollapsiblePane
addCollapsiblePaneListener, getTitlePane, isCollapsed, isSubPane, removeCollapsiblePaneListener, setCollapsed, setContentPane, setIcon, setSubPane, setTitle
 
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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContactGroup

public ContactGroup(java.lang.String groupName)
Create a new ContactGroup.

Parameters:
groupName - the name of the new ContactGroup.
Method Detail

addContactItem

public void addContactItem(ContactItem item)
Adds a ContactItem to the ContactGroup.

Parameters:
item - the ContactItem.

fireContactGroupUpdated

public void fireContactGroupUpdated()
Call whenever the UI needs to be updated.


addContactGroup

public void addContactGroup(ContactGroup contactGroup)

removeContactGroup

public void removeContactGroup(ContactGroup contactGroup)
Removes a child ContactGroup.

Parameters:
contactGroup - the contact group to remove.

setPanelBackground

public void setPanelBackground(java.awt.Color color)

getContactGroup

public ContactGroup getContactGroup(java.lang.String groupName)
Returns a ContactGroup based on it's name.

Parameters:
groupName - the name of the group.
Returns:
the ContactGroup.

removeContactItem

public void removeContactItem(ContactItem item)
Removes a ContactItem.

Parameters:
item - the ContactItem to remove.

getContactItemByNickname

public ContactItem getContactItemByNickname(java.lang.String nickname)
Returns a ContactItem by the nickname the user has been assigned.

Parameters:
nickname - the nickname of the user.
Returns:
the ContactItem.

getContactItemByJID

public ContactItem getContactItemByJID(java.lang.String bareJID)
Returns a ContactItem by the users bare bareJID.

Parameters:
bareJID - the bareJID of the user.
Returns:
the ContactItem.

getContactItems

public java.util.List<ContactItem> getContactItems()
Returns all ContactItems in the ContactGroup.

Returns:
all ContactItems.

getGroupName

public java.lang.String getGroupName()
Returns the name of the ContactGroup.

Returns:
the name of the ContactGroup.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

addContactGroupListener

public void addContactGroupListener(ContactGroupListener listener)
Add a ContactGroupListener.

Parameters:
listener - the ContactGroupListener.

removeContactGroupListener

public void removeContactGroupListener(ContactGroupListener listener)
Removes a ContactGroupListener.

Parameters:
listener - the ContactGroupListener.

getList

public javax.swing.JList getList()
Returns the containing JList of the ContactGroup.

Returns:
the JList.

clearSelection

public void clearSelection()
Clears all selections within this group.


hasAvailableContacts

public boolean hasAvailableContacts()
Returns true if the ContactGroup contains available users.

Returns:
true if the ContactGroup contains available users.

isOfflineGroup

public boolean isOfflineGroup()
Returns true if this ContactGroup is the Offline Group.

Returns:
true if OfflineGroup.

isUnfiledGroup

public boolean isUnfiledGroup()
Returns true if this ContactGroup is the Unfiled Group.

Returns:
true if UnfiledGroup.

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

isSharedGroup

public boolean isSharedGroup()
Returns true if ContactGroup is a Shared Group.

Returns:
true if Shared Group.

setSharedGroup

protected void setSharedGroup(boolean sharedGroup)
Set to true if this ContactGroup is a shared Group.

Parameters:
sharedGroup - true if shared group.

getSelectedContacts

public java.util.List getSelectedContacts()
Returns all Selected Contacts within the ContactGroup.

Returns:
all selected ContactItems.

getContainerPanel

public javax.swing.JPanel getContainerPanel()

getContactGroups

public java.util.Collection getContactGroups()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Lets make sure that the panel doesn't stretch past the scrollpane view pane.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
the preferred dimension

setGroupName

public void setGroupName(java.lang.String groupName)

getGroupTitle

public java.lang.String getGroupTitle(java.lang.String title)

isSubGroup

public boolean isSubGroup(java.lang.String groupName)

isSubGroup

public boolean isSubGroup()

getListPanel

public javax.swing.JPanel getListPanel()