|
|
|
|
@ -8,7 +8,6 @@
|
|
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.awt.event.*;
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
|
|
|
|
import javax.swing.text.*;
|
|
|
|
|
|
|
|
|
|
@ -45,26 +44,18 @@ public class ContactListSearchKeyDispatcher
|
|
|
|
|
* The container of the contact list.
|
|
|
|
|
*/
|
|
|
|
|
private final ContactListContainer contactListContainer;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The menu bar of the parent window.
|
|
|
|
|
*/
|
|
|
|
|
private final JMenuBar menuBar;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an instance of <tt>MainKeyDispatcher</tt>.
|
|
|
|
|
* @param keyManager the parent <tt>KeyboardFocusManager</tt>
|
|
|
|
|
* @param menuBar of the parent window or null if none is used.
|
|
|
|
|
*/
|
|
|
|
|
public ContactListSearchKeyDispatcher( KeyboardFocusManager keyManager,
|
|
|
|
|
SearchField searchField,
|
|
|
|
|
ContactListContainer container,
|
|
|
|
|
JMenuBar menuBar)
|
|
|
|
|
ContactListContainer container)
|
|
|
|
|
{
|
|
|
|
|
this.keyManager = keyManager;
|
|
|
|
|
this.searchField = searchField;
|
|
|
|
|
this.contactListContainer = container;
|
|
|
|
|
this.menuBar = menuBar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -87,7 +78,7 @@ public void setContactList(ContactList contactList)
|
|
|
|
|
public boolean dispatchKeyEvent(KeyEvent e)
|
|
|
|
|
{
|
|
|
|
|
Component focusOwner = keyManager.getFocusOwner();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If this window is not the focus window or if the event is not
|
|
|
|
|
// of type PRESSED we have nothing more to do here.
|
|
|
|
|
// Also don't re-dispatch any events if the menu is active.
|
|
|
|
|
@ -101,7 +92,7 @@ public boolean dispatchKeyEvent(KeyEvent e)
|
|
|
|
|
|| (focusOwner != null
|
|
|
|
|
&& !searchField.isFocusOwner()
|
|
|
|
|
&& focusOwner instanceof JTextComponent)
|
|
|
|
|
|| (menuBar != null && menuBar.isSelected()))
|
|
|
|
|
|| contactListContainer.isMenuSelected())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Ctrl-Enter || Cmd-Enter typed when this window is the focused
|
|
|
|
|
|