diff --git a/src/net/java/sip/communicator/impl/gui/i18n/messages.properties b/src/net/java/sip/communicator/impl/gui/i18n/messages.properties index 21be10ece..da1695a85 100644 --- a/src/net/java/sip/communicator/impl/gui/i18n/messages.properties +++ b/src/net/java/sip/communicator/impl/gui/i18n/messages.properties @@ -66,6 +66,7 @@ cut=C&ut date=Date description=Description dial=&Dial +dialpad=Dialpad doNotAskAgain=Don't ask again dontSupportWebInfo=This contact doesn't support web contact info duration=Duration 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 2b9f7c19a..36e630ae7 100755 --- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java @@ -729,7 +729,11 @@ public void addCallPanel(CallPanel callPanel) */ public void removeCallPanel(CallPanel callPanel) { - this.tabbedPane.remove(callPanel); + // Should remove all participant panels explicetly, thus removing also + // all related dialogs (like dialpad for example). + callPanel.removeDialogs(); + + tabbedPane.remove(callPanel); Component c = getSelectedTab(); diff --git a/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java b/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java index 4a8677704..f8e0d3b5b 100755 --- a/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java @@ -45,7 +45,7 @@ public MainTabbedPane(MainFrame parent) { callHistoryPanel = new CallListPanel(parent); - dialPanel = new DialPanel(parent); + dialPanel = new DialPanel(parent.getCallManager()); chatRoomsListPanel = new ChatRoomsListPanel(parent); @@ -55,8 +55,7 @@ public MainTabbedPane(MainFrame parent) { //chatRoomsListPanel); this.addTab(Messages.getI18NString("callList").getText(), callHistoryPanel); - this.addTab(Messages.getI18NString("dial").getText(), dialPanel); - + this.addTab(Messages.getI18NString("dial").getText(), dialPanel); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java index 12a7df090..0a176dd3b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java @@ -606,6 +606,19 @@ else if (phoneNumberCombo.isComboFieldEmpty()) public void stateChanged(ChangeEvent e) { this.updateButtonsStateAccordingToSelectedPanel(); + + Component selectedPanel = mainFrame.getSelectedTab(); + if (selectedPanel == null || !(selectedPanel instanceof CallPanel)) + { + Iterator callPanels = activeCalls.values().iterator(); + + while(callPanels.hasNext()) + { + CallPanel callPanel = (CallPanel) callPanels.next(); + + callPanel.removeDialogs(); + } + } } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java index 21d70ebe0..4b967bfd2 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java @@ -147,10 +147,14 @@ private CallParticipantPanel addCallParticipant( if(participantPanel == null) { participantPanel - = new CallParticipantPanel(participantName); + = new CallParticipantPanel(callManager, participantName); this.mainPanel.add(participantPanel); + // The participant panel should know when it is removed in order + // to hide all related open dialogs. + this.mainPanel.addContainerListener(participantPanel); + participantPanel.setCallType(callType); this.participantsPanels.put( @@ -176,10 +180,14 @@ private CallParticipantPanel addCallParticipant( if(participantPanel == null) { participantPanel - = new CallParticipantPanel(participant); + = new CallParticipantPanel(callManager, participant); this.mainPanel.add(participantPanel); + // The participant panel should know when it is removed in order + // to hide all related open dialogs. + this.mainPanel.addContainerListener(participantPanel); + participantPanel.setCallType(callType); this.participantsPanels.put( @@ -367,6 +375,7 @@ public void setCall(Call call, String callType) // Remove all previously added participant panels, because they do not // correspond to real participants. this.mainPanel.removeAll(); + this.participantsPanels.clear(); Iterator participants = call.getCallParticipants(); @@ -416,7 +425,7 @@ public void actionPerformed(ActionEvent e) //remove the participant panel from the list of panels participantsPanels.remove(participantWrapper); - } + } } /** @@ -429,6 +438,22 @@ public Iterator getParticipantsPanels() return participantsPanels.values().iterator(); } + /** + * Removes all participant panels and related dialogs. + */ + public void removeDialogs() + { + Iterator i = getParticipantsPanels(); + + while(i.hasNext()) + { + CallParticipantPanel participantPanel + = (CallParticipantPanel) i.next(); + + participantPanel.removeDialogs(); + } + } + /** * Returns the CallParticipantPanel, which correspond to the given * participant. @@ -507,5 +532,5 @@ private CallParticipantWrapper getParticipantWrapper( } return null; - } + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantDialpadDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantDialpadDialog.java new file mode 100644 index 000000000..2798fc222 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantDialpadDialog.java @@ -0,0 +1,85 @@ +/* + * 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.call; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; + +import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.service.protocol.*; + +/** + * The ContactInfoPanel is a popup dialog containing the contact + * detailed info. + * + * @author Yana Stamcheva + */ +public class CallParticipantDialpadDialog + extends JDialog +{ + private DialPanel dialPanel; + + private BackgroundPanel bgPanel; + + /** + * Creates an instance of the ContactInfoPanel. + * + * @param owner The frame owner of this dialog. + * @param contactItem The MetaContact for the info. + */ + public CallParticipantDialpadDialog(CallManager callManager, + CallParticipant callParticipant) + { + super(callManager.getMainFrame(), false); + + dialPanel = new DialPanel(callManager, callParticipant); + + this.setUndecorated(true); + + this.dialPanel.setOpaque(false); + + this.bgPanel = new BackgroundPanel(); + + this.bgPanel.setLayout(new BorderLayout()); + + this.bgPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + + this.getContentPane().setLayout(new BorderLayout()); + + this.getContentPane().add(bgPanel, BorderLayout.CENTER); + + this.bgPanel.add(dialPanel, BorderLayout.CENTER); + + this.pack(); + } + + private class BackgroundPanel extends JPanel + { + public void paintComponent(Graphics g) + { + super.paintComponent(g); + + Graphics2D g2 = (Graphics2D) g; + + GradientPaint p = new GradientPaint(this.getWidth() / 2, 0, + Constants.MOVER_START_COLOR, this.getWidth() / 2, + getHeight(), + Color.WHITE); + + g2.setPaint(p); + + g2.fillRoundRect(0, 0, getWidth(), getHeight(), 10, 10); + + g2.setColor(Constants.LIGHT_GRAY_COLOR); + + g2.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 10, 10); + } + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java index a7d69570c..262935b6e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java @@ -13,6 +13,7 @@ import javax.swing.*; import javax.swing.Timer; +import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; @@ -23,9 +24,11 @@ * * @author Yana Stamcheva */ -public class CallParticipantPanel extends JPanel +public class CallParticipantPanel + extends JPanel + implements ContainerListener { - private JPanel contactPanel = new JPanel(new BorderLayout()); + private JLayeredPane contactPanel = new JLayeredPane(); private JPanel namePanel = new JPanel(new GridLayout(0, 1)); @@ -37,6 +40,12 @@ public class CallParticipantPanel extends JPanel private JLabel photoLabel = new JLabel(new ImageIcon( ImageLoader.getImage(ImageLoader.DEFAULT_USER_PHOTO))); + + private DialButton dialButton; + + private JPanel northPanel = new JPanel(); + + private CallParticipantDialpadDialog dialpadDialog; private Date callStartTime; @@ -50,29 +59,48 @@ public class CallParticipantPanel extends JPanel private String participantName; + private CallManager callManager; + + private CallParticipant callParticipant; + /** * Creates a CallParticipantPanel for the given call participant. * + * @param callManager the CallManager that manages the call * @param callParticipant a call participant */ - public CallParticipantPanel(CallParticipant callParticipant) + public CallParticipantPanel(CallManager callManager, + CallParticipant callParticipant) { - this(callParticipant.getAddress()); + this(callManager, callParticipant.getAddress()); + + this.callParticipant = callParticipant; + this.stateLabel.setText(callParticipant.getState().getStateString()); + + dialButton = new DialButton(callManager, + new ImageIcon(ImageLoader.getImage(ImageLoader.DIAL_BUTTON))); + + dialButton.setBounds(94, 74, 36, 36); + + contactPanel.add(dialButton, new Integer(1)); } /** * Creates a CallParticipantPanel for the given participant name. * + * @param callManager the CallManager that manages the call * @param participantName a string representing the participant name */ - public CallParticipantPanel(String participantName) - { + public CallParticipantPanel(CallManager callManager, String participantName) + { super(new BorderLayout()); + this.callManager = callManager; + // Initialize the call start time. This date is meant to be used in // the GuiCallParticipantRecord, which is added to the CallList after - // a call. + // a call. this.callStartTime = new Date(System.currentTimeMillis()); this.participantName = participantName; @@ -92,14 +120,22 @@ public CallParticipantPanel(String participantName) namePanel.add(nameLabel); namePanel.add(stateLabel); namePanel.add(timeLabel); + + contactPanel.setPreferredSize(new Dimension(130, 150)); + + photoLabel.setBounds(20, 0, 90, 100); + namePanel.setBounds(0, 110, 130, 40); - contactPanel.add(photoLabel, BorderLayout.CENTER); - contactPanel.add(namePanel, BorderLayout.SOUTH); + contactPanel.add(photoLabel, new Integer(0)); + contactPanel.add(namePanel, new Integer(0)); - this.add(contactPanel, BorderLayout.NORTH); - this.setPreferredSize(new Dimension(100, 200)); + northPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); + + northPanel.add(contactPanel); + + this.add(northPanel, BorderLayout.NORTH); } - + /** * Sets the state of the contained call participant. * @param state the state of the contained call participant @@ -151,7 +187,7 @@ public void actionPerformed(ActionEvent e) * @return the start time of the conversation */ public Date getConversationStartTime() - { + { return conversationStartTime; } @@ -212,5 +248,71 @@ public void setCallType(String callType) public String getParticipantName() { return participantName; - } + } + + /** + * Customized button for dialpad. + */ + private class DialButton extends JButton + { + private CallManager callManager; + + public DialButton(CallManager manager, ImageIcon iconImage) + { + super(iconImage); + + this.callManager = manager; + + this.setOpaque(false); + + this.setToolTipText(Messages.getI18NString("dialpad").getText()); + + dialpadDialog + = new CallParticipantDialpadDialog(callManager, callParticipant); + + this.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + if(!dialpadDialog.isVisible()) + { + dialpadDialog.setSize( + callManager.getMainFrame().getWidth() - 20, 200); + + dialpadDialog.setLocation( + callManager.getMainFrame().getX() + 10, + getLocationOnScreen().y + getHeight()); + + dialpadDialog.setVisible(true); + } + else + { + dialpadDialog.setVisible(false); + } + } + }); + } + } + + public void componentAdded(ContainerEvent e) + {} + + /** + * Remove all dialogs open by this participant panel. + */ + public void componentRemoved(ContainerEvent e) + { + this.removeDialogs(); + + e.getContainer().removeContainerListener(this); + } + + /** + * Removes all dialogs open by this participant panel. + */ + public void removeDialogs() + { + if(dialpadDialog != null && dialpadDialog.isVisible()) + dialpadDialog.setVisible(false); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java index f2e8414e5..3d1efc65b 100755 --- a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java @@ -13,13 +13,14 @@ 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.utils.*; import net.java.sip.communicator.service.audionotifier.*; +import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.*; /** - * The DialPanel is the panel that contains the buttons to - * dial a phone number. + * The DialPanel is the panel that contains the buttons to dial a + * phone number. * * @author Yana Stamcheva */ @@ -29,71 +30,84 @@ public class DialPanel implements ActionListener, MouseListener { - + private Logger logger = Logger.getLogger(DialPanel.class); + private JComboBox phoneNumberCombo; private JButton oneButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.ONE_DIAL_BUTTON))); + .getImage(ImageLoader.ONE_DIAL_BUTTON))); private JButton twoButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.TWO_DIAL_BUTTON))); + .getImage(ImageLoader.TWO_DIAL_BUTTON))); private JButton threeButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.THREE_DIAL_BUTTON))); + .getImage(ImageLoader.THREE_DIAL_BUTTON))); private JButton fourButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.FOUR_DIAL_BUTTON))); + .getImage(ImageLoader.FOUR_DIAL_BUTTON))); private JButton fiveButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.FIVE_DIAL_BUTTON))); + .getImage(ImageLoader.FIVE_DIAL_BUTTON))); private JButton sixButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.SIX_DIAL_BUTTON))); + .getImage(ImageLoader.SIX_DIAL_BUTTON))); private JButton sevenButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.SEVEN_DIAL_BUTTON))); + .getImage(ImageLoader.SEVEN_DIAL_BUTTON))); private JButton eightButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.EIGHT_DIAL_BUTTON))); + .getImage(ImageLoader.EIGHT_DIAL_BUTTON))); private JButton nineButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.NINE_DIAL_BUTTON))); + .getImage(ImageLoader.NINE_DIAL_BUTTON))); private JButton starButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.STAR_DIAL_BUTTON))); + .getImage(ImageLoader.STAR_DIAL_BUTTON))); private JButton zeroButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.ZERO_DIAL_BUTTON))); + .getImage(ImageLoader.ZERO_DIAL_BUTTON))); private JButton diezButton = new JButton(new ImageIcon(ImageLoader - .getImage(ImageLoader.DIEZ_DIAL_BUTTON))); + .getImage(ImageLoader.DIEZ_DIAL_BUTTON))); private JPanel dialPadPanel = new JPanel(new GridLayout(4, 3, 5, 5)); - private MainFrame mainFrame; + private CallManager callManager; + + private CallParticipant callParticipant; + /** * Creates an instance of DialPanel. */ - public DialPanel(MainFrame mainFrame) { + public DialPanel(CallManager callManager) + { super(new FlowLayout(FlowLayout.CENTER)); - this.mainFrame = mainFrame; + this.callManager = callManager; - this.phoneNumberCombo = mainFrame.getCallManager() - .getCallComboBox(); + this.dialPadPanel.setOpaque(false); + + this.phoneNumberCombo = callManager.getCallComboBox(); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - + this.dialPadPanel.setPreferredSize(new Dimension(140, 140)); this.init(); } + public DialPanel(CallManager callManager, CallParticipant callParticipant) + { + this(callManager); + + this.callParticipant = callParticipant; + } + /** * Initializes this panel by adding all dial buttons to it. */ - public void init() { - oneButton.setLayout(null); + public void init() + { oneButton.setAlignmentY(JButton.LEFT_ALIGNMENT); twoButton.setAlignmentY(JButton.LEFT_ALIGNMENT); threeButton.setAlignmentY(JButton.LEFT_ALIGNMENT); @@ -106,7 +120,7 @@ public void init() { zeroButton.setAlignmentY(JButton.LEFT_ALIGNMENT); diezButton.setAlignmentY(JButton.LEFT_ALIGNMENT); starButton.setAlignmentY(JButton.LEFT_ALIGNMENT); - + oneButton.setName("one"); twoButton.setName("two"); threeButton.setName("three"); @@ -132,7 +146,7 @@ public void init() { zeroButton.addActionListener(this); diezButton.addActionListener(this); starButton.addActionListener(this); - + oneButton.addMouseListener(this); twoButton.addMouseListener(this); threeButton.addMouseListener(this); @@ -146,6 +160,19 @@ public void init() { diezButton.addMouseListener(this); starButton.addMouseListener(this); + oneButton.setOpaque(false); + twoButton.setOpaque(false); + threeButton.setOpaque(false); + fourButton.setOpaque(false); + fiveButton.setOpaque(false); + sixButton.setOpaque(false); + sevenButton.setOpaque(false); + eightButton.setOpaque(false); + nineButton.setOpaque(false); + zeroButton.setOpaque(false); + diezButton.setOpaque(false); + starButton.setOpaque(false); + dialPadPanel.add(oneButton); dialPadPanel.add(twoButton); dialPadPanel.add(threeButton); @@ -163,54 +190,133 @@ public void init() { } /** - * Handles the ActionEvent triggered when user presses one of - * the dial buttons. + * Handles the ActionEvent triggered when user presses one of the + * dial buttons. */ - public void actionPerformed(ActionEvent e) { + public void actionPerformed(ActionEvent e) + { JButton button = (JButton) e.getSource(); String buttonName = button.getName(); String phoneNumber = ""; + OperationSetDTMF dtmfOpSet = null; + DTMFTone dtmfTone = null; + + if(callParticipant != null + && callParticipant.getProtocolProvider() + .getOperationSet(OperationSetDTMF.class) != null) + { + dtmfOpSet = (OperationSetDTMF) callParticipant.getProtocolProvider() + .getOperationSet(OperationSetDTMF.class); + } + if (this.phoneNumberCombo.getEditor().getItem() != null) phoneNumber = (String) this.phoneNumberCombo.getEditor().getItem(); - if (buttonName.equals("one")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "1"); + if (buttonName.equals("one")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_1; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "1"); } - else if (buttonName.equals("two")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "2"); + else if (buttonName.equals("two")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_2; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "2"); } - else if (buttonName.equals("three")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "3"); + else if (buttonName.equals("three")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_3; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "3"); } - else if (buttonName.equals("four")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "4"); + else if (buttonName.equals("four")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_4; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "4"); } - else if (buttonName.equals("five")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "5"); + else if (buttonName.equals("five")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_5; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "5"); } - else if (buttonName.equals("six")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "6"); + else if (buttonName.equals("six")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_6; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "6"); } - else if (buttonName.equals("seven")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "7"); + else if (buttonName.equals("seven")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_7; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "7"); } - else if (buttonName.equals("eight")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "8"); + else if (buttonName.equals("eight")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_8; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "8"); } - else if (buttonName.equals("nine")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "9"); + else if (buttonName.equals("nine")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_9; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "9"); } - else if (buttonName.equals("zero")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "0"); + else if (buttonName.equals("zero")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_0; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "0"); } - else if (buttonName.equals("diez")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "#"); + else if (buttonName.equals("diez")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_SHARP; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "#"); } - else if (buttonName.equals("star")) { - this.phoneNumberCombo.getEditor().setItem(phoneNumber + "*"); + else if (buttonName.equals("star")) + { + if(dtmfOpSet != null) + dtmfTone = DTMFTone.DTMF_STAR; + else + this.phoneNumberCombo.getEditor().setItem(phoneNumber + "*"); } - this.phoneNumberCombo.requestFocus(); + + if(dtmfTone != null) + try + { + dtmfOpSet.sendDTMF(callParticipant, dtmfTone); + } + catch (NullPointerException e1) + { + logger.error("Failed to send a DTMF tone.", e1); + } + catch (ClassCastException e1) + { + logger.error("Failed to send a DTMF tone.", e1); + } + catch (OperationFailedException e1) + { + logger.error("Failed to send a DTMF tone.", e1); + } + else + this.phoneNumberCombo.requestFocus(); } public void mouseClicked(MouseEvent e) @@ -218,11 +324,11 @@ public void mouseClicked(MouseEvent e) } public void mouseEntered(MouseEvent e) - { + { } public void mouseExited(MouseEvent e) - { + { } public void mousePressed(MouseEvent e) @@ -231,46 +337,58 @@ public void mousePressed(MouseEvent e) String buttonName = button.getName(); AudioNotifierService audioNotifier = GuiActivator.getAudioNotifier(); - - if (buttonName.equals("one")) { + + if (buttonName.equals("one")) + { audioNotifier.createAudio(Sounds.DIAL_ONE).play(); } - else if (buttonName.equals("two")) { + else if (buttonName.equals("two")) + { audioNotifier.createAudio(Sounds.DIAL_TWO).play(); } - else if (buttonName.equals("three")) { + else if (buttonName.equals("three")) + { audioNotifier.createAudio(Sounds.DIAL_THREE).play(); } - else if (buttonName.equals("four")) { + else if (buttonName.equals("four")) + { audioNotifier.createAudio(Sounds.DIAL_FOUR).play(); } - else if (buttonName.equals("five")) { + else if (buttonName.equals("five")) + { audioNotifier.createAudio(Sounds.DIAL_FIVE).play(); } - else if (buttonName.equals("six")) { + else if (buttonName.equals("six")) + { audioNotifier.createAudio(Sounds.DIAL_SIX).play(); } - else if (buttonName.equals("seven")) { + else if (buttonName.equals("seven")) + { audioNotifier.createAudio(Sounds.DIAL_SEVEN).play(); } - else if (buttonName.equals("eight")) { + else if (buttonName.equals("eight")) + { audioNotifier.createAudio(Sounds.DIAL_EIGHT).play(); } - else if (buttonName.equals("nine")) { + else if (buttonName.equals("nine")) + { audioNotifier.createAudio(Sounds.DIAL_NINE).play(); } - else if (buttonName.equals("zero")) { + else if (buttonName.equals("zero")) + { audioNotifier.createAudio(Sounds.DIAL_ZERO).play(); } - else if (buttonName.equals("diez")) { + else if (buttonName.equals("diez")) + { audioNotifier.createAudio(Sounds.DIAL_DIEZ).play(); } - else if (buttonName.equals("star")) { + else if (buttonName.equals("star")) + { audioNotifier.createAudio(Sounds.DIAL_STAR).play(); } } public void mouseReleased(MouseEvent e) - { + { } } diff --git a/src/net/java/sip/communicator/impl/gui/resources/buttons/src/dialNumbers.svg b/src/net/java/sip/communicator/impl/gui/resources/buttons/src/dialNumbers.svg index 30b244d84..fe7be2cca 100644 --- a/src/net/java/sip/communicator/impl/gui/resources/buttons/src/dialNumbers.svg +++ b/src/net/java/sip/communicator/impl/gui/resources/buttons/src/dialNumbers.svg @@ -6,15 +6,17 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="210mm" height="297mm" id="svg2" sodipodi:version="0.32" - inkscape:version="0.42.2" - sodipodi:docbase="/home/yana" - sodipodi:docname="dialNumbers.svg"> + inkscape:version="0.45" + sodipodi:docbase="/home/yana/workspace/DtmfGui4Sc/src/net/java/sip/communicator/impl/gui/resources/buttons/src" + sodipodi:docname="dialNumbers.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + sodipodi:modified="true"> xyz 1 + style="font-size:16.000000px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;fill:#ac9393;fill-opacity:1.0000000;font-family:Bitstream Vera Sans">1 4 ghi 7 pqrs 3