Adds some javadocs and formattings.

cusax-fix
yanas 13 years ago
parent 4bed7e4e66
commit 9b0d7d1b12

@ -225,8 +225,7 @@ public MainFrame()
clKeyDispatcher = new ContactListSearchKeyDispatcher( keyManager,
searchField,
this,
menu);
this);
keyManager.addKeyEventDispatcher(clKeyDispatcher);
/*
@ -1065,6 +1064,18 @@ public OperationSetMultiUserChat getMultiUserChatOpSet(
: null;
}
/**
* Returns <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise.
*
* @return <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise
*/
public boolean isMenuSelected()
{
return menu.isSelected();
}
/**
* Listens for all providerStatusChanged and providerStatusMessageChanged
* events in order to refresh the account status panel, when a status is

@ -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

@ -235,8 +235,7 @@ public void actionPerformed(ActionEvent e)
ContactListSearchKeyDispatcher clKeyDispatcher
= new ContactListSearchKeyDispatcher( keyManager,
searchField,
this,
null);
this);
clKeyDispatcher.setContactList(srcContactList);
@ -501,4 +500,17 @@ public void clearCurrentSearchText()
{
searchField.setText("");
}
/**
* Returns <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise.
*
* @return <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise
*/
public boolean isMenuSelected()
{
// This dialog has no menu bar so it will never be selected
return false;
}
}

@ -138,8 +138,7 @@ public void focusGained(FocusEvent e)
ContactListSearchKeyDispatcher clKeyDispatcher
= new ContactListSearchKeyDispatcher( keyManager,
searchField,
this,
null);
this);
clKeyDispatcher.setContactList(contactList);
@ -327,4 +326,17 @@ public void clearCurrentSearchText()
* depending on the current state of the contained contact list.
*/
public void ctrlEnterKeyTyped() {}
/**
* Returns <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise.
*
* @return <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise
*/
public boolean isMenuSelected()
{
// This dialog has no menu bar so it will never be selected
return false;
}
}

@ -37,6 +37,15 @@ public interface ContactListContainer
*/
public boolean isFocused();
/**
* Returns <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise.
*
* @return <tt>true</tt> if there's any currently selected menu related to
* this <tt>ContactListContainer</tt>, <tt>false</tt> - otherwise
*/
public boolean isMenuSelected();
/**
* Clears the current text in the search field.
*/

Loading…
Cancel
Save