From 0de10aed18bdf6dbe6346ee9e2a31eadfc9bccba Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Tue, 23 Sep 2008 09:46:49 +0000 Subject: [PATCH] Fixes refactoring problems --- .../impl/gui/main/call/SecureButton.java | 98 ++++++++++--------- .../mock/MockOperationSetBasicTelephony.java | 4 +- .../OperationSetBasicTelephonySipImpl.java | 4 +- 3 files changed, 57 insertions(+), 49 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java index 402b39b6d..ca0943ffe 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java @@ -17,60 +17,62 @@ /** * The UI button used to toggle on or off call securing - * + * * @author Emanuel Onica * */ -public class SecureButton - extends JButton - implements ActionListener +public class SecureButton + extends JButton + implements ActionListener { - private final CallParticipant callParticipant; - - public SecureButton(CallParticipant callParticipant) + private final CallParticipant callParticipant; + + public SecureButton(CallParticipant callParticipant) { super(new ImageIcon(ImageLoader.getImage(ImageLoader.SECURE_BUTTON_OFF))); this.callParticipant = callParticipant; this.addActionListener(this); } - - public void actionPerformed(ActionEvent evt) + + public void actionPerformed(ActionEvent evt) { - Call call = callParticipant.getCall(); - - if (call != null) - { - String command = evt.getActionCommand(); - if (command.equals("startSecureMode")) - { - OperationSetBasicTelephony telephony = - (OperationSetBasicTelephony) call.getProtocolProvider() - .getOperationSet(OperationSetBasicTelephony.class); - - if (telephony.getSecured(callParticipant)) - { - updateSecureButton(false); - telephony.setSecured(callParticipant, - false, - OperationSetBasicTelephony. - SecureStatusChangeSource.SECURE_STATUS_CHANGE_BY_LOCAL); - } - else - { - updateSecureButton(true); - telephony.setSecured(callParticipant, - true, - OperationSetBasicTelephony. - SecureStatusChangeSource.SECURE_STATUS_CHANGE_BY_LOCAL); - } - } - } + Call call = callParticipant.getCall(); + + if (call != null) + { + String command = evt.getActionCommand(); + if (command.equals("startSecureMode")) + { + OperationSetBasicTelephony telephony = + (OperationSetBasicTelephony) call.getProtocolProvider() + .getOperationSet(OperationSetBasicTelephony.class); + + if (telephony.isSecured(callParticipant)) + { + updateSecureButton(false); + telephony.setSecured(callParticipant, + false, + OperationSetBasicTelephony. + SecureStatusChangeSource + .SECURE_STATUS_CHANGE_BY_LOCAL); + } + else + { + updateSecureButton(true); + telephony.setSecured(callParticipant, + true, + OperationSetBasicTelephony. + SecureStatusChangeSource + .SECURE_STATUS_CHANGE_BY_LOCAL); + } + } + } } - - - /** + + + /** * The method used to update the secure button state (pressed or not pressed) - * + * * @param isSecured parameter reflecting the current button state */ public void updateSecureButton(boolean isSecured) @@ -78,14 +80,18 @@ public void updateSecureButton(boolean isSecured) if(isSecured) { this.setIcon( - new ImageIcon(ImageLoader.getImage(ImageLoader.SECURE_BUTTON_ON))); - this.setToolTipText(Messages.getI18NString("toggleOffSecurity").getText()); + new ImageIcon( + ImageLoader.getImage(ImageLoader.SECURE_BUTTON_ON))); + this.setToolTipText( + Messages.getI18NString("toggleOffSecurity").getText()); } else { this.setIcon( - new ImageIcon(ImageLoader.getImage(ImageLoader.SECURE_BUTTON_OFF))); - this.setToolTipText(Messages.getI18NString("toggleOnSecurity").getText()); + new ImageIcon( + ImageLoader.getImage(ImageLoader.SECURE_BUTTON_OFF))); + this.setToolTipText( + Messages.getI18NString("toggleOnSecurity").getText()); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java b/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java index 3cd525903..325f2da3b 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java @@ -236,6 +236,7 @@ public void callStateChanged(CallChangeEvent evt) * (non-Javadoc) * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#setSecured(net.java.sip.communicator.service.protocol.CallParticipant, boolean, net.java.sip.communicator.service.media.CallSession.SecureStatusChangeSource) */ + @Override public void setSecured(CallParticipant participant, boolean secured, OperationSetBasicTelephony.SecureStatusChangeSource source) { @@ -245,7 +246,8 @@ public void setSecured(CallParticipant participant, boolean secured, * (non-Javadoc) * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#getSecured(net.java.sip.communicator.service.protocol.CallParticipant) */ - public boolean getSecured(CallParticipant participant) + @Override + public boolean isSecured(CallParticipant participant) { return false; } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java index b1d9b0077..688cf7bc7 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -2963,7 +2963,7 @@ public void setMute(CallParticipant participant, boolean mute) ((CallSipImpl) participant.getCall()).getMediaCallSession().setMute( mute); } - + /* * (non-Javadoc) * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#setSecured(net.java.sip.communicator.service.protocol.CallParticipant, boolean, net.java.sip.communicator.service.media.CallSession.SecureStatusChangeSource) @@ -2979,7 +2979,7 @@ public void setSecured(CallParticipant participant, boolean secured, * (non-Javadoc) * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#getSecured(net.java.sip.communicator.service.protocol.CallParticipant) */ - public boolean getSecured(CallParticipant participant) + public boolean isSecured(CallParticipant participant) { return ((CallSipImpl) participant.getCall()).getMediaCallSession(). getSecureCommunicationStatus();