Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.main.contactlist.CListKeySearchListener
All Implemented Interfaces:
KeyListener, EventListener

public class CListKeySearchListener
extends Object
implements KeyListener

The main goal of the CListKeySearchListener is to listen for key events and to search the ContactList when a key is typed over it. It selects the Contact name closest to the typed string. The time between two button presses is checked to determine whether the user makes a new search or a continious search. When user types the same letter consecutively the search mechanism selects the next Contact name starting with the same letter. The CListKeySearchListener is added to the MainFrame and the ContactListPanel to provide a search functionality over the contact list when one of them is focused. The 'space' key, the '+' and the '-' keys are proccess seperately to provide another functionality completely different from the search. When user types a '-' or 'space' and there's currently a group selected, the selected group is closed. When user types '+' the selected group is opened.

Author:
Yana Stamcheva

Constructor Summary
CListKeySearchListener(JList contactList)
          Creates an instance of CListKeySearchListener for the given ContactList.
 
Method Summary
 void closeGroup()
          Closes a group when it's opened.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
          Searches the contact list when any key, different from "space", "+" or "-" is typed.
 void openGroup()
          Opens a group when it's closed.
 void openOrCloseGroup()
          Opens or closes a group depending the state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CListKeySearchListener

public CListKeySearchListener(JList contactList)
Creates an instance of CListKeySearchListener for the given ContactList.

Parameters:
contactList - The contact list.
Method Detail

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent e)
Searches the contact list when any key, different from "space", "+" or "-" is typed. Selects the Contact name closest to the typed string. The time between two button presses is checked to determine whether the user makes a new search or a continuous search. When user types the same letter consecutively the search mechanism selects the next Contact name starting with the same letter.

Specified by:
keyTyped in interface KeyListener

closeGroup

public void closeGroup()
Closes a group when it's opened.


openGroup

public void openGroup()
Opens a group when it's closed.


openOrCloseGroup

public void openOrCloseGroup()
Opens or closes a group depending the state.


Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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