diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index c85d89d9d..290393f78 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -278,6 +278,7 @@ service.gui.NEW_NAME=New name
service.gui.NEW_STATUS_MESSAGE=New status message
service.gui.NO=No
service.gui.NO_AVAILABLE_ROOMS=The list of rooms for this server is currently not available.
+service.gui.NO_CONTACTS_FOUND=No matching contacts found. Press Ctrl+Enter to call {0} or use the buttons below.
service.gui.NO_MESSAGE=No message
service.gui.NO_GROUP_CHAT_ACCOUNT_AVAILABLE=No accounts, supporting multi user chat found. Check sip-communicator.org for more information on which protocols support multi user chat.
service.gui.NO_ONLINE_TELEPHONY_ACCOUNT=At least one online telephony account is needed in order to make a call. Please login to one of your telephony accounts and try again.
diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
index f6d71024f..a30762c19 100644
--- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
+++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
@@ -13,6 +13,7 @@
import java.util.List;
import javax.swing.*;
+import javax.swing.event.*;
import javax.swing.tree.*;
import net.java.sip.communicator.impl.gui.*;
@@ -35,6 +36,7 @@
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
+import net.java.sip.communicator.util.swing.event.*;
import org.osgi.framework.*;
@@ -729,6 +731,26 @@ public void clearCurrentSearchText()
searchField.setText("");
}
+ /**
+ * Adds the given TextFieldChangeListener to listen for any changes
+ * that occur in the search field.
+ * @param l the TextFieldChangeListener to add
+ */
+ public void addSearchFieldListener(TextFieldChangeListener l)
+ {
+ searchField.addTextChangeListener(l);
+ }
+
+ /**
+ * Removes the given TextFieldChangeListener that listens for any
+ * changes that occur in the search field.
+ * @param l the TextFieldChangeListener to remove
+ */
+ public void removeSearchFieldListener(TextFieldChangeListener l)
+ {
+ searchField.addTextChangeListener(l);
+ }
+
/**
* Checks in the configuration xml if there is already stored index for
* this provider and if yes, returns it, otherwise creates a new account
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java
index 9db2fb00e..df702ee69 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java
@@ -6,16 +6,19 @@
*/
package net.java.sip.communicator.impl.gui.main.contactlist;
+import java.awt.*;
import java.awt.event.*;
-import java.util.*;
+import java.util.List;
import javax.swing.*;
+import javax.swing.text.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.call.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
+import net.java.sip.communicator.util.swing.event.*;
/**
* The UnknownContactPanel replaces the contact list, when a
@@ -27,6 +30,7 @@
*/
public class UnknownContactPanel
extends TransparentPanel
+ implements TextFieldChangeListener
{
private final JButton addContact = new JButton(
GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT"),
@@ -38,6 +42,8 @@ public class UnknownContactPanel
GuiActivator.getResources()
.getImage("service.gui.icons.CALL_16x16_ICON"));
+ private final JTextPane textArea = new JTextPane();
+
/**
* The main application window.
*/
@@ -61,6 +67,9 @@ public UnknownContactPanel(MainFrame window)
callContact.setMnemonic(GuiActivator.getResources()
.getI18nMnemonic("service.gui.CALL_CONTACT"));
+ initTextArea(parentWindow.getCurrentSearchText());
+
+ this.add(textArea);
this.add(addContact);
this.add(callContact);
@@ -123,4 +132,61 @@ public void addUnknownContact()
{
addContact.doClick();
}
+
+ /**
+ * Invoked when any text is inserted in the search field.
+ */
+ public void textInserted()
+ {
+ updateTextArea(parentWindow.getCurrentSearchText());
+ }
+
+ /**
+ * Invoked when any text is removed from the search field.
+ */
+ public void textRemoved()
+ {
+ updateTextArea(parentWindow.getCurrentSearchText());
+ }
+
+ /**
+ * Creates the text area.
+ * @param searchText the searched text
+ */
+ private void initTextArea(String searchText)
+ {
+ textArea.setText(GuiActivator.getResources()
+ .getI18NString( "service.gui.NO_CONTACTS_FOUND",
+ new String[]{'"' + searchText + '"'}));
+ textArea.setOpaque(false);
+ StyledDocument doc = textArea.getStyledDocument();
+
+ MutableAttributeSet standard = new SimpleAttributeSet();
+ StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER);
+ StyleConstants.setFontFamily(standard, textArea.getFont().getFamily());
+ StyleConstants.setFontSize(standard, 12);
+ doc.setParagraphAttributes(0, 0, standard, true);
+
+ textArea.setPreferredSize(
+ new Dimension(parentWindow.getWidth() - 40, 70));
+ textArea.setMinimumSize(
+ new Dimension(parentWindow.getWidth() - 40, 70));
+ textArea.setMaximumSize(
+ new Dimension(parentWindow.getWidth() - 40, 70));
+
+ parentWindow.addSearchFieldListener(this);
+ }
+
+ /**
+ * Updates the text area to take into account the new search text.
+ * @param searchText the search text to update
+ */
+ private void updateTextArea(String searchText)
+ {
+ textArea.setText(GuiActivator.getResources()
+ .getI18NString("service.gui.NO_CONTACTS_FOUND",
+ new String[]{'"' + searchText + '"'}));
+ this.revalidate();
+ this.repaint();
+ }
}