diff options
author | Yana Stamcheva <yana@jitsi.org> | 2010-06-14 14:44:42 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2010-06-14 14:44:42 +0000 |
commit | 971cc0ecee7f02f0c4b20db7a101e80d8e9ddbf4 (patch) | |
tree | d8aa661733f13f81c30a0897a40772f61b4d8eb6 /src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java | |
parent | bf4d3f5ef66c3f17585953eb3b56084a0cdff14d (diff) | |
download | jitsi-971cc0ecee7f02f0c4b20db7a101e80d8e9ddbf4.zip jitsi-971cc0ecee7f02f0c4b20db7a101e80d8e9ddbf4.tar.gz jitsi-971cc0ecee7f02f0c4b20db7a101e80d8e9ddbf4.tar.bz2 |
Text tip added in the no contact view.
Diffstat (limited to 'src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java')
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java | 68 |
1 files changed, 67 insertions, 1 deletions
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 9db2fb0..df702ee 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 <tt>UnknownContactPanel</tt> replaces the contact list, when a @@ -27,6 +30,7 @@ import net.java.sip.communicator.util.swing.*; */ 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 class UnknownContactPanel 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 class UnknownContactPanel { 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(); + } } |