diff options
author | Yana Stamcheva <yana@jitsi.org> | 2011-06-21 15:55:58 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2011-06-21 15:55:58 +0000 |
commit | b5fc3329e7d3ae3d802090348ab2b41fe0e2f9b6 (patch) | |
tree | 6b6d9925dec70a05df6081ef2292c8e201fdb5cd /src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java | |
parent | e5f9af2237ab395b8144a32fdef6357b2071fa13 (diff) | |
download | jitsi-b5fc3329e7d3ae3d802090348ab2b41fe0e2f9b6.zip jitsi-b5fc3329e7d3ae3d802090348ab2b41fe0e2f9b6.tar.gz jitsi-b5fc3329e7d3ae3d802090348ab2b41fe0e2f9b6.tar.bz2 |
Adjusts contact list unknown contact view in the case when calling and/or contact adding are disabled.
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 | 85 |
1 files changed, 54 insertions, 31 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 21f50a8..38662cf 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 @@ -8,6 +8,7 @@ package net.java.sip.communicator.impl.gui.main.contactlist; import java.awt.*; import java.awt.event.*; +import java.util.List; import javax.swing.*; import javax.swing.text.*; @@ -16,6 +17,7 @@ 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.utils.*; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; import net.java.sip.communicator.util.swing.event.*; @@ -66,10 +68,6 @@ public class UnknownContactPanel this.add(mainPanel, BorderLayout.NORTH); - initTextArea(parentWindow.getCurrentSearchText()); - - mainPanel.add(textArea, BorderLayout.CENTER); - TransparentPanel buttonPanel = new TransparentPanel(new GridLayout(0, 1)); @@ -96,31 +94,56 @@ public class UnknownContactPanel }); } - callContact.setAlignmentX(JButton.CENTER_ALIGNMENT); + List<ProtocolProviderService> telephonyProviders + = CallManager.getTelephonyProviders(); + + if (telephonyProviders!= null && telephonyProviders.size() > 0) + { + callContact.setAlignmentX(JButton.CENTER_ALIGNMENT); + + callContact.setMnemonic(GuiActivator.getResources() + .getI18nMnemonic("service.gui.CALL_CONTACT")); - callContact.setMnemonic(GuiActivator.getResources() - .getI18nMnemonic("service.gui.CALL_CONTACT")); + buttonPanel.add(callContact); - buttonPanel.add(callContact); + callContact.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + String searchText = parentWindow.getCurrentSearchText(); - TransparentPanel southPanel - = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); - southPanel.add(buttonPanel); + if (searchText == null) + return; - mainPanel.add(southPanel, BorderLayout.SOUTH); + CallManager.createCall(searchText, callContact); + } + }); + } - callContact.addActionListener(new ActionListener() + initTextArea(); + mainPanel.add(textArea, BorderLayout.CENTER); + + if (callContact.getParent() != null) { - public void actionPerformed(ActionEvent e) - { - String searchText = parentWindow.getCurrentSearchText(); + textArea.setText(GuiActivator.getResources() + .getI18NString( "service.gui.NO_CONTACTS_FOUND", + new String[]{'"' + + parentWindow.getCurrentSearchText() + '"'})); + } + else + { + textArea.setText(GuiActivator.getResources() + .getI18NString( "service.gui.NO_CONTACTS_FOUND_SHORT")); + } - if (searchText == null) - return; + if (buttonPanel.getComponentCount() > 0) + { + TransparentPanel southPanel + = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); + southPanel.add(buttonPanel); - CallManager.createCall(searchText, callContact); - } - }); + mainPanel.add(southPanel, BorderLayout.SOUTH); + } loadSkin(); } @@ -160,13 +183,9 @@ public class UnknownContactPanel /** * Creates the text area. - * @param searchText the searched text */ - private void initTextArea(String searchText) + private void initTextArea() { - textArea.setText(GuiActivator.getResources() - .getI18NString( "service.gui.NO_CONTACTS_FOUND", - new String[]{'"' + searchText + '"'})); textArea.setOpaque(false); textArea.setEditable(false); StyledDocument doc = textArea.getStyledDocument(); @@ -186,11 +205,15 @@ public class UnknownContactPanel */ private void updateTextArea(String searchText) { - textArea.setText(GuiActivator.getResources() - .getI18NString("service.gui.NO_CONTACTS_FOUND", - new String[]{'"' + searchText + '"'})); - this.revalidate(); - this.repaint(); + if (callContact.getParent() != null) + { + textArea.setText(GuiActivator.getResources() + .getI18NString("service.gui.NO_CONTACTS_FOUND", + new String[]{'"' + searchText + '"'})); + + this.revalidate(); + this.repaint(); + } } /** |