diff options
author | Yana Stamcheva <yana@jitsi.org> | 2010-02-04 11:31:53 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2010-02-04 11:31:53 +0000 |
commit | b1b3e4992e18b8002f237cdba1966d87f8fce524 (patch) | |
tree | 3af704f0886cc50bd9e4a3c1e7e0ac818f9895f4 /src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java | |
parent | d855fdda93722ac2d7b4c61fe2834c6e305787ea (diff) | |
download | jitsi-b1b3e4992e18b8002f237cdba1966d87f8fce524.zip jitsi-b1b3e4992e18b8002f237cdba1966d87f8fce524.tar.gz jitsi-b1b3e4992e18b8002f237cdba1966d87f8fce524.tar.bz2 |
First version of the modified contact list interface. Modifications include a new search box allowing to filter the contact list, contact expansion on select, different approach for calling contacts and more.
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 | 113 |
1 files changed, 113 insertions, 0 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 new file mode 100644 index 0000000..36e932b --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java @@ -0,0 +1,113 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main.contactlist; + +import java.awt.event.*; +import java.util.*; + +import javax.swing.*; + +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.impl.gui.main.contactlist.addcontact.*; +import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.swing.*; + +/** + * The <tt>UnknownContactPanel</tt> replaces the contact list, when a + * <tt>SearchFilter</tt> founds no matches. It is meant to propose the user + * some alternatives if she's looking for a contact, which is not contained in + * the contact list. + * + * @author Yana Stamcheva + */ +public class UnknownContactPanel + extends TransparentPanel +{ + private final JButton addContact = new JButton( + GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT"), + GuiActivator.getResources() + .getImage("service.gui.icons.ADD_CONTACT_16x16_ICON")); + + private final JButton callContact = new JButton( + GuiActivator.getResources().getI18NString("service.gui.CALL_CONTACT"), + GuiActivator.getResources() + .getImage("service.gui.icons.CALL_16x16_ICON")); + + /** + * The main application window. + */ + private final MainFrame parentWindow; + + /** + * Creates the <tt>UnknownContactPanel</tt> by specifying the parent window. + * @param window the parent window + */ + public UnknownContactPanel(MainFrame window) + { + this.parentWindow = window; + + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + + addContact.setAlignmentX(JButton.CENTER_ALIGNMENT); + callContact.setAlignmentX(JButton.CENTER_ALIGNMENT); + + addContact.setMnemonic(GuiActivator.getResources() + .getI18nMnemonic("service.gui.ADD_CONTACT")); + callContact.setMnemonic(GuiActivator.getResources() + .getI18nMnemonic("service.gui.CALL_CONTACT")); + + this.add(addContact); + this.add(callContact); + + addContact.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AddContactWizard wizard + = new AddContactWizard(parentWindow, + parentWindow.getCurrentSearchText()); + + wizard.showDialog(false); + } + }); + + callContact.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + String searchText = parentWindow.getCurrentSearchText(); + + if (searchText == null) + return; + + Vector<ProtocolProviderService> telephonyProviders + = CallManager.getTelephonyProviders(); + + ProtocolProviderService callProvider = null; + + if (telephonyProviders.size() == 1) + { + callProvider = telephonyProviders.get(0); + } + else if (telephonyProviders.size() > 1) + { + ChooseCallAccountDialog chooseAccountDialog + = new ChooseCallAccountDialog(telephonyProviders); + + callProvider = chooseAccountDialog.showDialog(); + } + + // We have nothing to do if the user has cancel the operation + // or if the callProvider is null. + if (callProvider != null) + CallManager.createCall(callProvider, searchText); + } + }); + } +} |