diff --git a/resources/images/images.properties b/resources/images/images.properties
index 9f1a35298..bc1376f0c 100644
--- a/resources/images/images.properties
+++ b/resources/images/images.properties
@@ -121,6 +121,7 @@ service.gui.buttons.EDIT_TOOLBAR_BUTTON_PRESSED=resources/images/impl/gui/button
service.gui.buttons.DIAL_BUTTON=resources/images/impl/gui/buttons/dialButton.png
service.gui.buttons.HOLD_BUTTON=resources/images/impl/gui/buttons/holdButton.png
service.gui.buttons.MUTE_BUTTON=resources/images/impl/gui/buttons/muteButton.png
+service.gui.buttons.LOCAL_VIDEO_BUTTON=resources/images/impl/gui/buttons/localVideoButton.png
service.gui.buttons.TRANSFER_CALL_BUTTON=resources/images/impl/gui/buttons/transferCallButton.png
service.gui.buttons.SECURE_BUTTON_ON=resources/images/impl/gui/buttons/secureOn.png
service.gui.buttons.SECURE_BUTTON_OFF=resources/images/impl/gui/buttons/secureOff.png
diff --git a/resources/images/impl/gui/buttons/localVideoButton.png b/resources/images/impl/gui/buttons/localVideoButton.png
new file mode 100644
index 000000000..9e75497d3
Binary files /dev/null and b/resources/images/impl/gui/buttons/localVideoButton.png differ
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index a6db50cfc..8a34e09aa 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -314,6 +314,7 @@ service.gui.ENTER_FULL_SCREEN_TOOL_TIP=Enter Fullscreen
service.gui.EXIT_FULL_SCREEN_TOOL_TIP=Exit Fullscreen
service.gui.HOLD_BUTTON_TOOL_TIP=Toggle Hold
service.gui.MUTE_BUTTON_TOOL_TIP=Toggle Mute
+service.gui.LOCAL_VIDEO_BUTTON_TOOL_TIP=Toggle Video
service.gui.TRANSFER_BUTTON_TOOL_TIP=Transfer Call
service.gui.SECURITY_INFO=Security information
service.gui.SECURITY_WARNING=Security warning
diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java
index 12a1128fe..81f21f8fc 100644
--- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java
+++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java
@@ -333,7 +333,6 @@ public SIPCommDefaultTheme()
public void addCustomEntriesToTable(UIDefaults table)
{
-
List buttonGradient
= Arrays.asList(new Object[]
{ new Float(.3f), new Float(0f), BUTTON_GRADIENT_DARK_COLOR,
@@ -400,9 +399,9 @@ public void addCustomEntriesToTable(UIDefaults table)
"SplitPane.oneTouchButtonsOpaque", Boolean.FALSE,
"SplitPane.dividerFocusColor", SPLIT_PANE_DEVIDER_FOCUS_COLOR,
- "SplitPane.dividerSize", new Integer(5),
+ "SplitPane.dividerSize", Integer.valueOf(5),
- "ScrollBar.width", new Integer(12),
+ "ScrollBar.width", Integer.valueOf(12),
"ScrollBar.horizontalThumbIcon",
ImageLoader.getImage(ImageLoader.SCROLLBAR_THUMB_HORIZONTAL),
"ScrollBar.verticalThumbIcon",
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 36342e4c9..1b3c183ea 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
@@ -359,6 +359,33 @@ public void createSecurityPanel(
}
}
+ private class VideoTelephonyListener
+ implements PropertyChangeListener,
+ VideoListener
+ {
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(
+ event.getPropertyName()))
+ {
+ handleLocalVideoStreamingChange(
+ this,
+ (Boolean) event.getOldValue(),
+ (Boolean) event.getNewValue());
+ }
+ }
+
+ public void videoAdded(VideoEvent event)
+ {
+ handleVideoEvent(event);
+ }
+
+ public void videoRemoved(VideoEvent event)
+ {
+ handleVideoEvent(event);
+ }
+ }
+
/**
* Sets up listening to notifications about adding or removing video for the
* CallParticipant this panel depicts and displays the video in
@@ -379,18 +406,8 @@ private OperationSetVideoTelephony addVideoListener()
if (telephony == null)
return null;
- final VideoListener videoListener = new VideoListener()
- {
- public void videoAdded(VideoEvent event)
- {
- handleVideoEvent(event);
- }
-
- public void videoRemoved(VideoEvent event)
- {
- handleVideoEvent(event);
- }
- };
+ final VideoTelephonyListener videoTelephonyListener
+ = new VideoTelephonyListener();
/*
* The video is only available while the #callParticipant is in a Call
@@ -403,23 +420,24 @@ public void videoRemoved(VideoEvent event)
private void addVideoListener()
{
- telephony.addVideoListener(callParticipant, videoListener);
- try
- {
- telephony.createLocalVisualComponent(callParticipant,
- videoListener);
- }
- catch (OperationFailedException ex)
- {
- logger.error(
- "Failed to create local video/visual Component.", ex);
- }
+ telephony.addVideoListener(
+ callParticipant, videoTelephonyListener);
+ telephony.addPropertyChangeListener(
+ call, videoTelephonyListener);
videoListenerIsAdded = true;
synchronized (videoContainers)
{
videoTelephony = telephony;
+
handleVideoEvent(null);
+
+ boolean localVideoStreaming
+ = videoTelephony.isLocalVideoStreaming(call);
+ handleLocalVideoStreamingChange(
+ videoTelephonyListener,
+ !localVideoStreaming,
+ localVideoStreaming);
}
}
@@ -432,13 +450,13 @@ public synchronized void callParticipantAdded(
CallParticipantEvent event)
{
if (callParticipant.equals(event.getSourceCallParticipant())
- && !videoListenerIsAdded)
+ && !videoListenerIsAdded)
{
Call call = callParticipant.getCall();
if ((call != null)
- && CallState.CALL_IN_PROGRESS.equals(call
- .getCallState()))
+ && CallState.CALL_IN_PROGRESS.equals(
+ call.getCallState()))
addVideoListener();
}
}
@@ -487,13 +505,20 @@ else if (CallState.CALL_IN_PROGRESS.equals(newCallState))
private void removeVideoListener()
{
- telephony.removeVideoListener(callParticipant, videoListener);
- if (localVideo != null)
- telephony.disposeLocalVisualComponent(callParticipant,
- localVideo);
+ telephony.removeVideoListener(
+ callParticipant, videoTelephonyListener);
+ telephony.removePropertyChangeListener(
+ call, videoTelephonyListener);
videoListenerIsAdded = false;
- synchronized (videoTelephony)
+ if (localVideo != null)
+ {
+ telephony.disposeLocalVisualComponent(
+ callParticipant, localVideo);
+ localVideo = null;
+ }
+
+ synchronized (videoContainers)
{
if (telephony.equals(videoTelephony))
videoTelephony = null;
@@ -599,6 +624,37 @@ public void run()
}
}
+ private void handleLocalVideoStreamingChange(
+ VideoTelephonyListener listener, boolean oldValue, boolean newValue)
+ {
+ synchronized (videoContainers)
+ {
+ if (videoTelephony == null)
+ return;
+
+ if (videoTelephony.isLocalVideoStreaming(callParticipant.getCall()))
+ {
+ try
+ {
+ videoTelephony.createLocalVisualComponent(
+ callParticipant, listener);
+ }
+ catch (OperationFailedException ex)
+ {
+ logger.error(
+ "Failed to create local video/visual Component.",
+ ex);
+ }
+ }
+ else if (localVideo != null)
+ {
+ videoTelephony.disposeLocalVisualComponent(
+ callParticipant, localVideo);
+ localVideo = null;
+ }
+ }
+ }
+
/**
* Sets the state of the contained call participant by specifying the
* state name and icon.
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java b/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java
index 0402bef05..79ab2ddd2 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java
@@ -54,8 +54,6 @@ public HoldButton( Call call,
boolean isFullScreenMode,
boolean isSelected)
{
- super();
-
if (isFullScreenMode)
{
this.setBgImage(
@@ -91,6 +89,7 @@ public HoldButton( Call call,
*/
private static class HoldButtonModel
extends ToggleButtonModel
+ implements ActionListener
{
/**
@@ -112,21 +111,10 @@ public HoldButtonModel(Call call)
{
this.call = call;
- InternalListener listener = new InternalListener();
-
- addActionListener(listener);
+ addActionListener(this);
}
- /**
- * Handles actions performed on this model on behalf of a specific
- * ActionListener.
- *
- * @param listener the ActionListener notified about the
- * performing of the action
- * @param evt the ActionEvent containing the data associated
- * with the action and the act of its performing
- */
- private void actionPerformed(ActionListener listener, ActionEvent evt)
+ public void actionPerformed(ActionEvent evt)
{
if (call != null)
{
@@ -155,25 +143,5 @@ private void actionPerformed(ActionListener listener, ActionEvent evt)
}
}
}
-
- /**
- * Represents the set of EventListeners this instance uses
- * to track the changes in its CallParticipant model.
- */
- private class InternalListener
- implements ActionListener
- {
- /**
- * Invoked when an action occurs.
- *
- * @param evt the ActionEvent instance containing the data
- * associated with the action and the act of its
- * performing
- */
- public void actionPerformed(ActionEvent evt)
- {
- HoldButtonModel.this.actionPerformed(this, evt);
- }
- }
}
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/LocalVideoButton.java b/src/net/java/sip/communicator/impl/gui/main/call/LocalVideoButton.java
new file mode 100644
index 000000000..5bf43217f
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/gui/main/call/LocalVideoButton.java
@@ -0,0 +1,117 @@
+/*
+ * 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.event.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.utils.*;
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
+import net.java.sip.communicator.util.swing.*;
+
+/**
+ * @author Lubomir Marinov
+ */
+public class LocalVideoButton
+ extends SIPCommToggleButton
+{
+ private static final Logger logger
+ = Logger.getLogger(LocalVideoButton.class);
+
+ private static final long serialVersionUID = 0L;
+
+ public LocalVideoButton(Call call)
+ {
+ setBgImage(ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG));
+ setBgRolloverImage(
+ ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG));
+ setIconImage(ImageLoader.getImage(ImageLoader.LOCAL_VIDEO_BUTTON));
+ setPressedImage(
+ ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_PRESSED_BG));
+
+ setModel(new LocalVideoButtonModel(call));
+ setToolTipText(GuiActivator.getResources().getI18NString(
+ "service.gui.LOCAL_VIDEO_BUTTON_TOOL_TIP"));
+ }
+
+ private static class LocalVideoButtonModel
+ extends ToggleButtonModel
+ implements ActionListener,
+ Runnable
+ {
+ private final Call call;
+
+ private Thread runner;
+
+ public LocalVideoButtonModel(Call call)
+ {
+ this.call = call;
+
+ addActionListener(this);
+ }
+
+ public boolean isSelected()
+ {
+ return false;
+ }
+
+ public synchronized void actionPerformed(ActionEvent event)
+ {
+ if (runner == null)
+ {
+ runner = new Thread(this, LocalVideoButton.class.getName());
+ runner.setDaemon(true);
+
+ setEnabled(false);
+ runner.start();
+ }
+ }
+
+ public void run()
+ {
+ try
+ {
+ doRun();
+ }
+ finally
+ {
+ synchronized (this)
+ {
+ if (Thread.currentThread().equals(runner))
+ {
+ runner = null;
+ setEnabled(true);
+ }
+ }
+ }
+ }
+
+ private void doRun()
+ {
+ OperationSetVideoTelephony telephony = (OperationSetVideoTelephony)
+ call.getProtocolProvider()
+ .getOperationSet(OperationSetVideoTelephony.class);
+
+ if (telephony != null)
+ {
+ try
+ {
+ telephony.setLocalVideoAllowed(
+ call,
+ !telephony.isLocalVideoAllowed(call));
+ }
+ catch (OperationFailedException ex)
+ {
+ logger.error(
+ "Failed to toggle the streaming of local video.",
+ ex);
+ }
+ }
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java b/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java
index 1d1fa53c2..8b5cfe3e0 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java
@@ -51,8 +51,6 @@ public MuteButton(Call call)
*/
public MuteButton(Call call, boolean isFullScreenMode, boolean isSelected)
{
- super();
-
if (isFullScreenMode)
{
this.setBgImage(
@@ -87,6 +85,7 @@ public MuteButton(Call call, boolean isFullScreenMode, boolean isSelected)
*/
private static class MuteButtonModel
extends ToggleButtonModel
+ implements ActionListener
{
/**
@@ -106,33 +105,10 @@ public MuteButtonModel(Call call)
{
this.call = call;
- addActionListener(new ActionListener()
- {
-
- /**
- * Invoked when an action occurs.
- *
- * @param evt the ActionEvent instance containing the
- * data associated with the action and the act of its
- * performing
- */
- public void actionPerformed(ActionEvent evt)
- {
- MuteButtonModel.this.actionPerformed(this, evt);
- }
- });
+ addActionListener(this);
}
- /**
- * Handles actions performed on this model on behalf of a specific
- * ActionListener.
- *
- * @param listener the ActionListener notified about the
- * performing of the action
- * @param evt the ActionEvent containing the data associated
- * with the action and the act of its performing
- */
- private void actionPerformed(ActionListener listener, ActionEvent evt)
+ public void actionPerformed(ActionEvent evt)
{
if (call != null)
{
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java b/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java
index 932be4760..6a9ea41c2 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java
@@ -219,17 +219,16 @@ private CallParticipant findCallParticipant(String address)
OperationFailedException.INTERNAL_ERROR, ex);
}
- Class telephonyClass = OperationSetBasicTelephony.class;
+ Class telephonyClass
+ = OperationSetBasicTelephony.class;
CallParticipant participant = null;
- for (int i = 0; i < serviceReferences.length; i++)
+ for (ServiceReference serviceReference : serviceReferences)
{
- ProtocolProviderService service =
- (ProtocolProviderService) bundleContext
- .getService(serviceReferences[i]);
- OperationSetBasicTelephony telephony =
- (OperationSetBasicTelephony) service
- .getOperationSet(telephonyClass);
+ ProtocolProviderService service = (ProtocolProviderService)
+ bundleContext.getService(serviceReference);
+ OperationSetBasicTelephony telephony = (OperationSetBasicTelephony)
+ service.getOperationSet(telephonyClass);
if (telephony != null)
{
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java
index 640c48a61..e442c405c 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java
@@ -128,11 +128,11 @@ else if (italicButton.isSelected())
ActionEvent fontSizeActionEvent
= new ActionEvent( chatEditorPane,
ActionEvent.ACTION_PERFORMED,
- new Integer(fontSize).toString());
+ Integer.toString(fontSize));
action
= new StyledEditorKit.FontSizeAction(
- new Integer(fontSize).toString(),
+ Integer.toString(fontSize),
fontSize);
action.actionPerformed(fontSizeActionEvent);
@@ -204,8 +204,8 @@ public void mousePressed(MouseEvent event)
ActionEvent.ACTION_PERFORMED, "");
Action action =
- new HTMLEditorKit.ForegroundAction(new Integer(newColor
- .getRGB()).toString(), newColor);
+ new HTMLEditorKit.ForegroundAction(Integer.toString(newColor
+ .getRGB()), newColor);
action.actionPerformed(evt);
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/CListKeySearchListener.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/CListKeySearchListener.java
index 65f334143..cea3ca679 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/CListKeySearchListener.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/CListKeySearchListener.java
@@ -64,7 +64,7 @@ public void keyReleased(KeyEvent e) {
* Searches the contact list when any key, different from "space", "+" or
* "-" is typed. Selects the Contact name closest to the typed string. The
* time between two button presses is checked to determine whether the user
- * makes a new search or a continious search. When user types the same
+ * makes a new search or a continuous search. When user types the same
* letter consecutively the search mechanism selects the next Contact name
* starting with the same letter.
*/
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java
index 0fe9d4c1d..65e1ea84c 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java
@@ -983,7 +983,7 @@ public Image createContactStatusImage(Contact protoContact)
g.setFont(Constants.FONT.deriveFont(Font.BOLD, 9));
g.drawImage(statusImage, 0, 0, null);
g.setComposite(ac);
- g.drawString(new Integer(index+1).toString(), 14, 8);
+ g.drawString(Integer.toString(index+1), 14, 8);
img = buffImage;
}
diff --git a/src/net/java/sip/communicator/impl/gui/utils/Constants.java b/src/net/java/sip/communicator/impl/gui/utils/Constants.java
index 0859ca637..ec38df0fa 100755
--- a/src/net/java/sip/communicator/impl/gui/utils/Constants.java
+++ b/src/net/java/sip/communicator/impl/gui/utils/Constants.java
@@ -223,7 +223,7 @@ public class Constants
* The default Font object used through this ui implementation.
*/
public static final Font FONT = new Font(Constants.FONT_NAME, Font.PLAIN,
- new Integer(Constants.FONT_SIZE).intValue());
+ Integer.parseInt(Constants.FONT_SIZE));
/*
* ======================================================================
@@ -290,14 +290,14 @@ public class Constants
/**
* A list of all special chars that should be escaped for some reasons.
*/
- private static final ArrayList specialCharsList = new ArrayList();
- static{
- specialCharsList.add(new Integer(KeyEvent.VK_PLUS));
- specialCharsList.add(new Integer(KeyEvent.VK_MINUS));
- specialCharsList.add(new Integer(KeyEvent.VK_SPACE));
- specialCharsList.add(new Integer(KeyEvent.VK_ENTER));
- specialCharsList.add(new Integer(KeyEvent.VK_LEFT));
- specialCharsList.add(new Integer(KeyEvent.VK_RIGHT));
+ private static final int[] specialChars = new int[]
+ {
+ KeyEvent.VK_PLUS,
+ KeyEvent.VK_MINUS,
+ KeyEvent.VK_SPACE,
+ KeyEvent.VK_ENTER,
+ KeyEvent.VK_LEFT,
+ KeyEvent.VK_RIGHT
};
/**
@@ -306,10 +306,11 @@ public class Constants
* @param charCode The char code.
*/
public static boolean isSpecialChar(int charCode) {
- if(specialCharsList.contains(new Integer(charCode)))
- return true;
- else
- return false;
+ for (int specialChar : specialChars) {
+ if (specialChar == charCode)
+ return true;
+ }
+ return false;
}
/**
diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
index 22d1d24f6..2da305939 100644
--- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
+++ b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
@@ -395,6 +395,12 @@ public class ImageLoader
public static final ImageID MUTE_BUTTON
= new ImageID("service.gui.buttons.MUTE_BUTTON");
+ /**
+ * A local video button icon. The icon shown in the CallParticipant panel.
+ */
+ public static final ImageID LOCAL_VIDEO_BUTTON
+ = new ImageID("service.gui.buttons.LOCAL_VIDEO_BUTTON");
+
/**
* A call-transfer button icon. The icon shown in the CallParticipant panel.
*/
@@ -1360,7 +1366,7 @@ public static Image getAccountStatusImage(ProtocolProviderService pps)
g.setFont(Constants.FONT.deriveFont(Font.BOLD, 9));
g.drawImage(statusImage, 0, 0, null);
g.setComposite(ac);
- g.drawString(new Integer(index + 1).toString(), 14, 8);
+ g.drawString(Integer.toString(index + 1), 14, 8);
img = buffImage;
}
diff --git a/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java b/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java
index 44f1d8261..3c618b711 100644
--- a/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java
+++ b/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java
@@ -715,7 +715,7 @@ private Vector filterFilesByDate(
String filename = (String)filelist.next();
files.add(
- new Long(filename.substring(0, filename.length() - 4)));
+ Long.parseLong(filename.substring(0, filename.length() - 4)));
}
TreeSet resultAsLong = new TreeSet();
@@ -737,7 +737,7 @@ private Vector filterFilesByDate(
// if there is no startDate limit only to end date
if(startDate == null)
{
- Long endLong = new Long(endDate.getTime());
+ Long endLong = Long.valueOf(endDate.getTime());
files.add(endLong);
resultAsLong.addAll(files.subSet(files.first(), endLong));
@@ -747,7 +747,7 @@ private Vector filterFilesByDate(
else if(endDate == null)
{
// end date is null get all the inclusive the one record before the startdate
- Long startLong = new Long(startDate.getTime());
+ Long startLong = Long.valueOf(startDate.getTime());
if(files.size() > 0 &&
(startLong.longValue() < ((Long)files.first()).longValue()))
@@ -772,8 +772,8 @@ else if(endDate == null)
{
// if both are present we must return all the elements between
// the two dates and the one before the start date
- Long startLong = new Long(startDate.getTime());
- Long endLong = new Long(endDate.getTime());
+ Long startLong = Long.valueOf(startDate.getTime());
+ Long endLong = Long.valueOf(endDate.getTime());
files.add(startLong);
files.add(endLong);
diff --git a/src/net/java/sip/communicator/impl/media/CallSessionImpl.java b/src/net/java/sip/communicator/impl/media/CallSessionImpl.java
index 6f9e9e6a8..2b54d6105 100644
--- a/src/net/java/sip/communicator/impl/media/CallSessionImpl.java
+++ b/src/net/java/sip/communicator/impl/media/CallSessionImpl.java
@@ -72,6 +72,7 @@
* @author Emanuel Onica
*/
public class CallSessionImpl
+ extends PropertyChangeNotifier
implements CallSession
, CallParticipantListener
, CallChangeListener
@@ -80,7 +81,6 @@ public class CallSessionImpl
, SessionListener
, ControllerListener
// , SecureEventListener
-
{
private static final Logger logger
= Logger.getLogger(CallSessionImpl.class);
@@ -223,12 +223,6 @@ public class CallSessionImpl
private final Map localVisualComponents =
new HashMap();
- /**
- * Indicates whether current call is sending video data.
- * Used to suppress or not video events for local video.
- */
- private boolean sendingVideo = false;
-
/**
* List of RTP format strings which are supported by SIP Communicator in addition
* to the JMF standard formats.
@@ -296,6 +290,12 @@ public static enum ZRTPCustomInfoCodes
*/
private InetAddress lastIntendedDestination;
+ /**
+ * The indicator which determines whether this instance is currently
+ * streaming the local video (to remote destinations).
+ */
+ private boolean localVideoStreaming = false;
+
/**
* Creates a new session for the specified call with a custom
* destination for incoming data.
@@ -315,7 +315,7 @@ public CallSessionImpl(Call call,
registerCustomCodecFormats(audioRtpManager);
// not currently needed, we don't have any custom video formats.
- registerCustomVideoCodecFormats(videoRtpManager);
+ registerCustomVideoCodecFormats(videoRtpManager);
call.addCallChangeListener(this);
initializePortNumbers();
@@ -391,15 +391,15 @@ public RTPManager getVideoRtpManager()
*
* @throws MediaException if start() fails for all send streams.
*/
- private void startStreaming()
+ public void startStreaming()
throws MediaException
{
//start all audio streams
boolean startedAtLeastOneStream = false;
RTPManager rtpManager = getAudioRtpManager();
- Vector sendStreams = rtpManager.getSendStreams();
- if(sendStreams != null && sendStreams.size() > 0)
+ List sendStreams = rtpManager.getSendStreams();
+ if((sendStreams != null) && (sendStreams.size() > 0))
{
logger.trace("Will be starting " + sendStreams.size()
+ " audio send streams.");
@@ -426,8 +426,9 @@ private void startStreaming()
//start video streams
rtpManager = getVideoRtpManager();
- sendStreams = rtpManager.getSendStreams();
- if(sendStreams != null && sendStreams.size() > 0)
+ if(mediaServCallback.getMediaControl(getCall()).isLocalVideoAllowed()
+ && ((sendStreams = rtpManager.getSendStreams()) != null)
+ && (sendStreams.size() > 0))
{
logger.trace("Will be starting " + sendStreams.size()
+ " video send streams.");
@@ -444,6 +445,9 @@ private void startStreaming()
logger.warn("Failed to start stream.", ex);
}
}
+
+ if (startedAtLeastOneStream)
+ setLocalVideoStreaming(true);
}
else
{
@@ -457,6 +461,8 @@ private void startStreaming()
throw new MediaException("Failed to start streaming"
, MediaException.INTERNAL_ERROR);
}
+
+ applyOnHold();
}
/**
@@ -485,18 +491,27 @@ public boolean stopStreaming()
return stoppedStreaming;
}
- /**
- * Stops and closes all streams currently handled by rtpManager.
- *
- * @param rtpManager the rtpManager whose streams we'll be stopping.
- * @return true if there was an actual change in the streaming i.e.
- * the streaming wasn't already stopped before this request;
- * false, otherwise
- */
- private boolean stopStreaming(RTPManager rtpManager)
+ private boolean stopSendStreaming()
{
boolean stoppedAtLeastOneStream = false;
+
+ RTPManager audioRtpManager = getAudioRtpManager();
+ if ((audioRtpManager != null)
+ && stopSendStreaming(audioRtpManager))
+ stoppedAtLeastOneStream = true;
+
+ RTPManager videoRtpManager = getVideoRtpManager();
+ if ((videoRtpManager != null)
+ && stopSendStreaming(videoRtpManager))
+ stoppedAtLeastOneStream = true;
+
+ return stoppedAtLeastOneStream;
+ }
+
+ private boolean stopSendStreaming(RTPManager rtpManager)
+ {
List sendStreams = rtpManager.getSendStreams();
+ boolean stoppedAtLeastOneStream = false;
for (SendStream stream : sendStreams)
{
@@ -512,6 +527,20 @@ private boolean stopStreaming(RTPManager rtpManager)
}
stoppedAtLeastOneStream = true;
}
+ return stoppedAtLeastOneStream;
+ }
+
+ /**
+ * Stops and closes all streams currently handled by rtpManager.
+ *
+ * @param rtpManager the rtpManager whose streams we'll be stopping.
+ * @return true if there was an actual change in the streaming i.e.
+ * the streaming wasn't already stopped before this request;
+ * false, otherwise
+ */
+ private boolean stopStreaming(RTPManager rtpManager)
+ {
+ boolean stoppedAtLeastOneStream = stopSendStreaming(rtpManager);
List receiveStreams;
try
@@ -519,7 +548,7 @@ private boolean stopStreaming(RTPManager rtpManager)
receiveStreams = rtpManager.getReceiveStreams();
}
//it appears that in early call states, when there are no streams
- //this method could throug a null pointer exception. Make sure we handle
+ //this method could throw a null pointer exception. Make sure we handle
//it gracefully
catch (Exception e)
{
@@ -671,6 +700,26 @@ public String createSdpOffer(InetAddress intendedDestination)
return createSessionDescription(null, intendedDestination).toString();
}
+ public String createSdpOffer(String participantSdpDescription)
+ throws MediaException
+ {
+ SessionDescription participantDescription = null;
+ try
+ {
+ participantDescription =
+ mediaServCallback.getSdpFactory().createSessionDescription(
+ participantSdpDescription);
+ }
+ catch (SdpParseException ex)
+ {
+ throw new MediaException(
+ "Failed to parse the SDP description of the participant.",
+ MediaException.INTERNAL_ERROR, ex);
+ }
+
+ return createSessionDescription(participantDescription, null).toString();
+ }
+
/**
* The method is meant for use by protocol service implementations when
* willing to send an in-dialog invitation to a remote callee to put her
@@ -1017,6 +1066,11 @@ public void processSdpAnswer(CallParticipant responder,
//create and init the streams (don't start streaming just yet but wait
//for the call to enter the connected state).
createSendStreams(mediaDescriptions);
+
+ CallParticipantState responderState = responder.getState();
+ if (CallParticipantState.CONNECTED.equals(responderState)
+ || CallParticipantState.isOnHold(responderState))
+ startStreaming();
}
/**
@@ -1157,8 +1211,6 @@ private void createSendStreams(Vector mediaDescriptions)
PushBufferStream[] streams
= ((PushBufferDataSource)dataSource).getStreams();
- sendingVideo = false;
-
//for each stream - determine whether it is a video or an audio
//stream and assign it to the corresponding rtpmanager
for (int i = 0; i < streams.length; i++)
@@ -1170,7 +1222,6 @@ private void createSendStreams(Vector mediaDescriptions)
if(format instanceof VideoFormat)
{
rtpManager = getVideoRtpManager();
- sendingVideo = true;
}
else if (format instanceof AudioFormat)
{
@@ -1315,12 +1366,12 @@ private void initStreamTargets(Connection globalConnParam,
}
/**
- * Creates an SDP description of this session using the offer descirption
+ * Creates an SDP description of this session using the offer description
* (if not null) for limiting. The intendedDestination parameter, which may
* contain the address that the offer is to be sent to, will only be used if
* the offer or its connection parameter are null. In the
- * oposite case we are using the address provided in the connection param as
- * an intended destination.
+ * opposite case we are using the address provided in the connection param
+ * as an intended destination.
*
* @param offer the call participant meant to receive the offer or null if
* we are to construct our own offer.
@@ -1442,10 +1493,7 @@ private SessionDescription createSessionDescription(
lastIntendedDestination = intendedDestination;
if (startStreaming)
- {
startStreaming();
- applyOnHold();
- }
}
InetAddress publicIpAddress = audioPublicAddress.getAddress();
@@ -1673,8 +1721,7 @@ else if (mediaType.equalsIgnoreCase("audio"))
byte onHold = this.onHold;
- if (!mediaServCallback.getDeviceConfiguration()
- .isVideoCaptureSupported())
+ if (!mediaControl.isLocalVideoAllowed())
{
/* We don't have anything to send. */
onHold |= ON_HOLD_REMOTELY;
@@ -1942,8 +1989,6 @@ private InetSocketAddress allocatePort(InetAddress intendedDestination,
NetworkAddressManagerService netAddressManager
= MediaActivator.getNetworkAddressManagerService();
-
-
//try to initialize a public address for the rtp manager.
for (int i = bindRetries; i > 0; i--)
{
@@ -2406,6 +2451,13 @@ else if (newValue == CallState.CALL_ENDED)
* here shouldn't be necessary because #stopStreaming() should've
* already take care of it.
*/
+
+ // Clean up after the support for viewing the local video.
+ Component[] localVisualComponents
+ = this.localVisualComponents.keySet().toArray(
+ new Component[this.localVisualComponents.size()]);
+ for (Component localVisualComponent : localVisualComponents)
+ disposeLocalVisualComponent(localVisualComponent);
}
}
@@ -2667,7 +2719,6 @@ else if (ce instanceof RealizeCompleteEvent)
// logger.debug("Player does not have gain control.");
logger.debug("A player was realized and will be started.");
- player.start();
if (dataSink != null)
{
@@ -2939,9 +2990,12 @@ public void addVideoListener(VideoListener listener)
public Component createLocalVisualComponent(final VideoListener listener)
throws MediaException
{
- DataSource dataSource =
- mediaServCallback.getMediaControl(getCall())
- .createLocalVideoDataSource();
+ if (!isLocalVideoStreaming())
+ return null;
+
+ final MediaControl mediaControl
+ = mediaServCallback.getMediaControl(getCall());
+ DataSource dataSource = mediaControl.createLocalVideoDataSource();
if (dataSource != null)
{
@@ -2968,9 +3022,8 @@ public Component createLocalVisualComponent(final VideoListener listener)
{
public void controllerUpdate(ControllerEvent event)
{
- if(sendingVideo)
- controllerUpdateForCreateLocalVisualComponent(event,
- listener);
+ controllerUpdateForCreateLocalVisualComponent(
+ event, listener, mediaControl);
}
});
player.start();
@@ -2979,7 +3032,8 @@ public void controllerUpdate(ControllerEvent event)
}
private void controllerUpdateForCreateLocalVisualComponent(
- ControllerEvent controllerEvent, VideoListener listener)
+ ControllerEvent controllerEvent, VideoListener listener,
+ MediaControl mediaControl)
{
if (controllerEvent instanceof RealizeCompleteEvent)
{
@@ -2988,16 +3042,26 @@ private void controllerUpdateForCreateLocalVisualComponent(
if (visualComponent != null)
{
- VideoEvent videoEvent =
- new VideoEvent(this, VideoEvent.VIDEO_ADDED,
- visualComponent, VideoEvent.LOCAL);
+ VideoEvent videoEvent = new VideoEvent(
+ this,
+ VideoEvent.VIDEO_ADDED,
+ visualComponent,
+ VideoEvent.LOCAL);
listener.videoAdded(videoEvent);
if (videoEvent.isConsumed())
{
- localVisualComponents.put(visualComponent,
- new LocalVisualComponentData(player, listener));
+ localVisualComponents.put(
+ visualComponent,
+ new LocalVisualComponentData(
+ player, listener, mediaControl));
+ }
+ else
+ {
+ player.stop();
+ player.deallocate();
+ player.close();
}
}
}
@@ -3008,22 +3072,19 @@ public void disposeLocalVisualComponent(Component component)
if (component == null)
throw new IllegalArgumentException("component");
- LocalVisualComponentData data = localVisualComponents.get(component);
+ LocalVisualComponentData data = localVisualComponents.remove(component);
if (data != null)
{
- Player player = data.player;
-
- player.stop();
- player.deallocate();
- player.close();
- localVisualComponents.remove(component);
-
VideoListener listener = data.listener;
+ data.dispose();
+
if (listener != null)
{
- VideoEvent videoEvent =
- new VideoEvent(this, VideoEvent.VIDEO_REMOVED, component,
+ VideoEvent videoEvent = new VideoEvent(
+ this,
+ VideoEvent.VIDEO_REMOVED,
+ component,
VideoEvent.LOCAL);
listener.videoRemoved(videoEvent);
@@ -3133,16 +3194,101 @@ protected void fireVideoEvent(int type, Component visualComponent,
}
}
- private static class LocalVisualComponentData
+ /*
+ * Implements CallSession#setLocalVideoAllowed(boolean).
+ */
+ public void setLocalVideoAllowed(boolean allowed)
+ throws MediaException
+ {
+ stopSendStreaming();
+ mediaServCallback.getMediaControl(getCall())
+ .setLocalVideoAllowed(allowed);
+ }
+
+ /*
+ * Implements CallSession#isLocalVideoAllowed().
+ */
+ public boolean isLocalVideoAllowed()
+ {
+ return mediaServCallback.getMediaControl(getCall())
+ .isLocalVideoAllowed();
+ }
+
+ /**
+ * Sets the indicator which determine whether this CallSession
+ * is currently streaming the local video (to remote destinations). If the
+ * setting causes a change in the current state, registered
+ * PropertyChangeListeners are notified about a change in the
+ * value of the property {@link CallSession#LOCAL_VIDEO_STREAMING}.
+ *
+ * @param streaming true to indicate that this instance is
+ * currently streaming the local video (to remote destinations);
+ * otherwise, false
+ */
+ private void setLocalVideoStreaming(boolean streaming)
+ {
+ if (localVideoStreaming != streaming)
+ {
+ boolean oldValue = localVideoStreaming;
+
+ localVideoStreaming = streaming;
+
+ firePropertyChange(
+ LOCAL_VIDEO_STREAMING, oldValue, localVideoStreaming);
+ }
+ }
+
+ /*
+ * Implements CallSession#isLocalVideoStreaming().
+ */
+ public boolean isLocalVideoStreaming()
+ {
+ return localVideoStreaming;
+ }
+
+ private class LocalVisualComponentData
{
public final VideoListener listener;
+ private final MediaControl mediaControl;
+
+ private PropertyChangeListener mediaControlListener;
+
public final Player player;
- public LocalVisualComponentData(Player player, VideoListener listener)
+ public LocalVisualComponentData(Player player, VideoListener listener,
+ MediaControl mediaControl)
{
this.player = player;
this.listener = listener;
+
+ this.mediaControl = mediaControl;
+ this.mediaControlListener = new PropertyChangeListener()
+ {
+ private final Component component
+ = LocalVisualComponentData.this.player.getVisualComponent();
+
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ if (MediaControl.VIDEO_DATA_SOURCE.equals(event.getPropertyName()))
+ disposeLocalVisualComponent(component);
+ }
+ };
+ this.mediaControl.addPropertyChangeListener(
+ this.mediaControlListener);
+ }
+
+ public void dispose()
+ {
+ if (mediaControlListener != null)
+ {
+ mediaControl.removePropertyChangeListener(mediaControlListener);
+ mediaControlListener = null;
+ }
+
+ player.stop();
+ player.deallocate();
+ player.close();
}
}
diff --git a/src/net/java/sip/communicator/impl/media/MediaControl.java b/src/net/java/sip/communicator/impl/media/MediaControl.java
index c56e2a698..3ace374b0 100644
--- a/src/net/java/sip/communicator/impl/media/MediaControl.java
+++ b/src/net/java/sip/communicator/impl/media/MediaControl.java
@@ -32,6 +32,7 @@
* @author Lubomir Marinov
*/
public class MediaControl
+ extends PropertyChangeNotifier
{
private static final Logger logger = Logger.getLogger(MediaControl.class);
@@ -51,11 +52,21 @@ public class MediaControl
private DataSource avDataSource = null;
/**
- * The audio DataSource which provides mute support.
+ * The audio DataSource which provides mute support.
*/
private MutePushBufferDataSource muteAudioDataSource;
- private SourceCloneable cloneableVideoDataSource;
+ /**
+ * The current video DataSource. If present, it's available in
+ * {@link #avDataSource} either directly or as a merged
+ * DataSource.
+ */
+ private SourceCloneable videoDataSource;
+
+ /**
+ * The property which represents the current video DataSource.
+ */
+ public static final String VIDEO_DATA_SOURCE = "VIDEO_DATA_SOURCE";
/**
* SDP Codes of all video formats that JMF supports for current datasource.
@@ -98,6 +109,15 @@ public class MediaControl
private static final String DEBUG_DATA_SOURCE_URL_PROPERTY_NAME
= "net.java.sip.communicator.impl.media.DEBUG_DATA_SOURCE_URL";
+ /**
+ * The indicator which determines whether the streaming of local video
+ * through this MediaControl is allowed. The setting does not
+ * reflect the availability of actual video capture devices, it just
+ * expresses the desire of the user to have the local video streamed in the
+ * case the system is actually able to do so.
+ */
+ private boolean localVideoAllowed = true;
+
/**
* The default constructor.
*/
@@ -182,14 +202,11 @@ private void initCaptureDevices()
if (avDataSource != null)
avDataSource.disconnect();
- // Init Capture devices
+ // Init audio device
+ CaptureDeviceInfo audioDeviceInfo
+ = deviceConfiguration.getAudioCaptureDevice();
DataSource audioDataSource = null;
- DataSource videoDataSource = null;
- CaptureDeviceInfo audioDeviceInfo = null;
- CaptureDeviceInfo videoDeviceInfo = null;
- // audio device
- audioDeviceInfo = deviceConfiguration.getAudioCaptureDevice();
muteAudioDataSource = null;
if (audioDeviceInfo != null)
{
@@ -203,25 +220,33 @@ private void initCaptureDevices()
(PushBufferDataSource) audioDataSource);
}
- // video device
- videoDeviceInfo = deviceConfiguration.getVideoCaptureDevice();
- cloneableVideoDataSource = null;
- if (videoDeviceInfo != null)
+ // Init video device
+ CaptureDeviceInfo videoDeviceInfo
+ = localVideoAllowed
+ ? deviceConfiguration.getVideoCaptureDevice()
+ : null;
+ DataSource videoDataSource = null;
+
+ DataSource cloneableVideoDataSource = null;
+ try
{
- videoDataSource = createDataSource(videoDeviceInfo.getLocator());
+ if (videoDeviceInfo != null)
+ {
+ videoDataSource = createDataSource(videoDeviceInfo.getLocator());
- // we will check video sizes and will set the most appropriate one
- selectVideoSize(videoDataSource);
+ // we will check video sizes and will set the most appropriate one
+ selectVideoSize(videoDataSource);
- DataSource cloneableVideoDataSource =
- Manager.createCloneableDataSource(videoDataSource);
- if (cloneableVideoDataSource != null)
- {
- videoDataSource = cloneableVideoDataSource;
- this.cloneableVideoDataSource =
- (SourceCloneable) cloneableVideoDataSource;
+ cloneableVideoDataSource =
+ Manager.createCloneableDataSource(videoDataSource);
+ if (cloneableVideoDataSource != null)
+ videoDataSource = cloneableVideoDataSource;
}
}
+ finally
+ {
+ setVideoDataSource((SourceCloneable) cloneableVideoDataSource);
+ }
// Create the av data source
if (audioDataSource != null && videoDataSource != null)
@@ -276,7 +301,6 @@ public void initDebugDataSource(String debugMediaSource)
{
logger.fatal("Failed to Create the Debug Media Data Source!",e);
}
-
}
/**
@@ -1079,10 +1103,80 @@ public int compare(FormatInfo info0, FormatInfo info1)
return ((VideoFormat) selectedFormat).getSize();
}
+ /**
+ * Sets the DataSource to be used by this instance to capture
+ * video. The DataSource is to be provided in the form of a
+ * SourceCloneable so that it can give access to the local
+ * video both as a stand-alone DataSource and a merged one with
+ * audio. If the setting changes the state of this instance, registered
+ * PropertyChangeListeners are notified about the change of the
+ * value of the property {@link #VIDEO_DATA_SOURCE}.
+ *
+ * @param videoDataSource a SourceCloneable representing the
+ * DataSource to be used by this instance to capture
+ * video.
+ */
+ private void setVideoDataSource(SourceCloneable videoDataSource)
+ {
+ Object oldValue = this.videoDataSource;
+
+ this.videoDataSource = videoDataSource;
+
+ firePropertyChange(VIDEO_DATA_SOURCE, oldValue, this.videoDataSource);
+ }
+
+ /**
+ * Creates a DataSource which gives access to the local video
+ * this instance captures and controls.
+ *
+ * @return a DataSource which gives access to the local video
+ * this instance captures and controls; null if video is
+ * not utilized by this instance
+ */
public DataSource createLocalVideoDataSource()
{
- return (cloneableVideoDataSource == null)
+ return (videoDataSource == null)
? null
- : cloneableVideoDataSource.createClone();
+ : videoDataSource.createClone();
+ }
+
+ /**
+ * Sets the indicator which determines whether the streaming of local video
+ * through this MediaControl is allowed. The setting does not
+ * reflect the availability of actual video capture devices, it just
+ * expresses the desire of the user to have the local video streamed in the
+ * case the system is actually able to do so.
+ *
+ * @param allowed true to allow the streaming of local video for
+ * this MediaControl; false to disallow it
+ */
+ public void setLocalVideoAllowed(boolean allowed)
+ throws MediaException
+ {
+ if (localVideoAllowed != allowed)
+ {
+ localVideoAllowed = allowed;
+
+ if (sourceProcessor != null)
+ sourceProcessor.stop();
+ initCaptureDevices();
+ if (sourceProcessor.getState() != Processor.Started)
+ sourceProcessor.start();
+ }
+ }
+
+ /**
+ * Gets the indicator which determines whether the streaming of local video
+ * through this MediaControl is allowed. The setting does not
+ * reflect the availability of actual video capture devices, it just
+ * expresses the desire of the user to have the local video streamed in the
+ * case the system is actually able to do so.
+ *
+ * @return true if the streaming of local video for this
+ * MediaControl is allowed; false, otherwise
+ */
+ public boolean isLocalVideoAllowed()
+ {
+ return localVideoAllowed;
}
}
diff --git a/src/net/java/sip/communicator/impl/media/MediaServiceImpl.java b/src/net/java/sip/communicator/impl/media/MediaServiceImpl.java
index fb39d20aa..da517bb95 100644
--- a/src/net/java/sip/communicator/impl/media/MediaServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/media/MediaServiceImpl.java
@@ -343,7 +343,7 @@ public MediaControl getMediaControl()
* call is not mapped to a particular MediaControl
* instance, the default instance will be returned
*
- * @param call the call whose MediaControl we will fetch
+ * @param call the call to fetch the MediaControl of
* @return the instance of MediaControl that is mapped to call
* or the defaultMediaControl if no custom one is registered for
* call.
diff --git a/src/net/java/sip/communicator/impl/media/ProcessorUtility.java b/src/net/java/sip/communicator/impl/media/ProcessorUtility.java
index f62b0e3bd..00158c59d 100644
--- a/src/net/java/sip/communicator/impl/media/ProcessorUtility.java
+++ b/src/net/java/sip/communicator/impl/media/ProcessorUtility.java
@@ -4,9 +4,6 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-
-
-
package net.java.sip.communicator.impl.media;
//~--- non-JDK imports --------------------------------------------------------
@@ -24,14 +21,15 @@
* @author Ken Larson
*/
public class ProcessorUtility implements ControllerListener {
- private Logger logger = Logger.getLogger(ProcessorUtility.class);
+ private final Logger logger = Logger.getLogger(ProcessorUtility.class);
/**
* The object that we use for syncing when waiting for a processor
* to enter a specific state.
*/
- private Object stateLock = new Object();
- private boolean failed = false;
+ private final Object stateLock = new Object();
+
+ private boolean failed = false;
/**
* Default constructor, creates an instance of the of the Processor utility.
@@ -83,8 +81,9 @@ public void controllerUpdate(ControllerEvent ce) {
}
if (ce instanceof ControllerEvent) {
- synchronized (getStateLock()) {
- getStateLock().notifyAll();
+ Object stateLock = getStateLock();
+ synchronized (stateLock) {
+ stateLock.notifyAll();
}
}
}
@@ -113,9 +112,10 @@ public synchronized boolean waitForState(Processor processor, int state)
// success of the method, or a failure event.
// See StateListener inner class
while ((processor.getState() < state) &&!failed) {
- synchronized (getStateLock()) {
+ Object stateLock = getStateLock();
+ synchronized (stateLock) {
try {
- getStateLock().wait();
+ stateLock.wait();
} catch (InterruptedException ie) {
return false;
}
diff --git a/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java b/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java
index 975e2a74c..d22188208 100644
--- a/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java
+++ b/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java
@@ -25,6 +25,7 @@
* @author Lubomir Marinov
*/
public class DeviceConfiguration
+ extends PropertyChangeNotifier
{
/**
@@ -68,13 +69,6 @@ public class DeviceConfiguration
*/
private CaptureDeviceInfo videoCaptureDevice;
- /**
- * Listeners that will be notified every time
- * a device has been changed.
- */
- private final List propertyChangeListeners =
- new Vector();
-
/**
* Default constructor.
*/
@@ -82,23 +76,6 @@ public DeviceConfiguration()
{
}
- public void addPropertyChangeListener(PropertyChangeListener listener)
- {
- synchronized(propertyChangeListeners)
- {
- if (!propertyChangeListeners.contains(listener))
- propertyChangeListeners.add(listener);
- }
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener)
- {
- synchronized(propertyChangeListeners)
- {
- propertyChangeListeners.remove(listener);
- }
- }
-
/**
* Initializes capture devices.
*/
@@ -331,15 +308,6 @@ public void setAudioCaptureDevice(CaptureDeviceInfo device)
}
}
- protected void firePropertyChange(String property, Object oldValue,
- Object newValue)
- {
- PropertyChangeEvent event =
- new PropertyChangeEvent(this, property, oldValue, newValue);
- for (PropertyChangeListener listener : propertyChangeListeners)
- listener.propertyChange(event);
- }
-
/**
* Enable or disable Audio stream transmission.
*
diff --git a/src/net/java/sip/communicator/impl/media/transform/TransformOutputStream.java b/src/net/java/sip/communicator/impl/media/transform/TransformOutputStream.java
index 90060b3bb..8f7f7c5b6 100755
--- a/src/net/java/sip/communicator/impl/media/transform/TransformOutputStream.java
+++ b/src/net/java/sip/communicator/impl/media/transform/TransformOutputStream.java
@@ -70,7 +70,7 @@ public TransformOutputStream(DatagramSocket socket,
public void addTarget(InetAddress remoteAddr, int remotePort)
{
this.remoteAddrs.add(remoteAddr);
- this.remotePorts.add(new Integer(remotePort));
+ this.remotePorts.add(remotePort);
}
/**
@@ -84,7 +84,7 @@ public void addTarget(InetAddress remoteAddr, int remotePort)
public boolean removeTarget(InetAddress remoteAddr, int remotePort)
{
return remoteAddrs.remove(remoteAddr)
- && remotePorts.remove(new Integer(remotePort));
+ && remotePorts.remove(Integer.valueOf(remotePort));
}
/**
diff --git a/src/net/java/sip/communicator/impl/media/transform/srtp/SRTPTransformer.java b/src/net/java/sip/communicator/impl/media/transform/srtp/SRTPTransformer.java
index 0aecaa9bd..f35d723ed 100755
--- a/src/net/java/sip/communicator/impl/media/transform/srtp/SRTPTransformer.java
+++ b/src/net/java/sip/communicator/impl/media/transform/srtp/SRTPTransformer.java
@@ -73,7 +73,7 @@ public RawPacket transform(RawPacket pkt)
long ssrc = PacketManipulator.GetRTPSSRC(pkt);
SRTPCryptoContext context =
- (SRTPCryptoContext) this.contexts.get(new Long(ssrc));
+ (SRTPCryptoContext) this.contexts.get(ssrc);
if (context == null)
{
@@ -81,7 +81,7 @@ public RawPacket transform(RawPacket pkt)
if (context != null)
{
context.deriveSrtpKeys(0);
- this.contexts.put(new Long(ssrc), context);
+ this.contexts.put(ssrc, context);
}
}
@@ -102,7 +102,7 @@ public RawPacket reverseTransform(RawPacket pkt)
long ssrc = PacketManipulator.GetRTPSSRC(pkt);
int seqNum = PacketManipulator.GetRTPSequenceNumber(pkt);
SRTPCryptoContext context =
- (SRTPCryptoContext) this.contexts.get(new Long(ssrc));
+ (SRTPCryptoContext) this.contexts.get(ssrc);
if (context == null)
{
@@ -111,7 +111,7 @@ public RawPacket reverseTransform(RawPacket pkt)
if (context != null)
{
context.deriveSrtpKeys(seqNum);
- this.contexts.put(new Long(ssrc), context);
+ this.contexts.put(ssrc, context);
}
}
diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java
index 51f062c2b..c639eab8c 100644
--- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java
@@ -530,7 +530,7 @@ private void saveNotification( String eventType,
configService.setProperty(
actionTypeNodeName + ".loopInterval",
- new Integer(soundHandler.getLoopInterval()));
+ soundHandler.getLoopInterval());
configService.setProperty(
actionTypeNodeName + ".enabled",
@@ -632,7 +632,7 @@ private void loadNotifications()
handler = new SoundNotificationHandlerImpl(
soundFileDescriptor,
- new Integer(loopInterval).intValue());
+ Integer.parseInt(loopInterval));
handler.setEnabled(
isEnabled(actionPropName + ".enabled"));
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java
index 63b002203..c14a9ee9e 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java
@@ -303,7 +303,7 @@ public String getNickName(String uin)
*/
private List getInfoForRequest(int requestID)
{
- List res = (List) retreivedInfo.get(new Integer(requestID));
+ List res = (List) retreivedInfo.get(requestID);
if (res == null)
{
@@ -312,7 +312,7 @@ private List getInfoForRequest(int requestID)
// from the sequence (basic info)
res = new LinkedList();
- retreivedInfo.put(new Integer(requestID), res);
+ retreivedInfo.put(requestID, res);
}
return res;
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
index 2bd51f059..3191b34ca 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
@@ -629,8 +629,7 @@ public void run()
// check till we find a correct message
// or if NoSuchElementException is thrown
// there is no message
- while(!checkFirstPacket())
- {}
+ while(!checkFirstPacket());
}
catch (Exception ex)
{
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
index 03fdd7134..3fca252c6 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
@@ -143,36 +143,34 @@ public class OperationSetPersistentPresenceIcqImpl
* A map containing bindings between SIP Communicator's icq presence status
* instances and ICQ status codes
*/
- private static Map scToIcqStatusMappings = new Hashtable();
+ private static final Map scToIcqStatusMappings
+ = new Hashtable();
static{
-
scToIcqStatusMappings.put(IcqStatusEnum.AWAY,
- new Long(FullUserInfo.ICQSTATUS_AWAY));
+ FullUserInfo.ICQSTATUS_AWAY);
scToIcqStatusMappings.put(IcqStatusEnum.DO_NOT_DISTURB,
- new Long(FullUserInfo.ICQSTATUS_DND ));
+ FullUserInfo.ICQSTATUS_DND);
scToIcqStatusMappings.put(IcqStatusEnum.FREE_FOR_CHAT,
- new Long(FullUserInfo.ICQSTATUS_FFC ));
+ FullUserInfo.ICQSTATUS_FFC);
scToIcqStatusMappings.put(IcqStatusEnum.INVISIBLE,
- new Long(FullUserInfo.ICQSTATUS_INVISIBLE));
+ FullUserInfo.ICQSTATUS_INVISIBLE);
scToIcqStatusMappings.put(IcqStatusEnum.NOT_AVAILABLE,
- new Long(FullUserInfo.ICQSTATUS_NA));
+ FullUserInfo.ICQSTATUS_NA);
scToIcqStatusMappings.put(IcqStatusEnum.OCCUPIED,
- new Long(FullUserInfo.ICQSTATUS_OCCUPIED));
+ FullUserInfo.ICQSTATUS_OCCUPIED);
scToIcqStatusMappings.put(IcqStatusEnum.ONLINE,
- new Long(ICQ_ONLINE_MASK));
-
+ ICQ_ONLINE_MASK);
}
- private static Map scToAimStatusMappings = new Hashtable();
+ private static final Map scToAimStatusMappings
+ = new Hashtable();
static{
-
scToAimStatusMappings.put(AimStatusEnum.AWAY,
- new Long(FullUserInfo.ICQSTATUS_AWAY));
+ FullUserInfo.ICQSTATUS_AWAY);
scToAimStatusMappings.put(AimStatusEnum.INVISIBLE,
- new Long(FullUserInfo.ICQSTATUS_INVISIBLE));
+ FullUserInfo.ICQSTATUS_INVISIBLE);
scToAimStatusMappings.put(AimStatusEnum.ONLINE,
- new Long(ICQ_ONLINE_MASK));
-
+ ICQ_ONLINE_MASK);
}
/**
@@ -377,9 +375,9 @@ else if ( (icqStatus & FullUserInfo.ICQSTATUS_AWAY ) != 0)
private long presenceStatusToStatusLong(PresenceStatus status)
{
if(parentProvider.USING_ICQ)
- return ((Long)scToIcqStatusMappings.get(status)).longValue();
+ return scToIcqStatusMappings.get(status).longValue();
else
- return ((Long)scToAimStatusMappings.get(status)).longValue();
+ return scToAimStatusMappings.get(status).longValue();
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java
index 69267c236..ab49b22de 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredAccountInfoIcqImpl.java
@@ -824,14 +824,9 @@ static Locale getCountry(int code)
if (code == 0 || code == 9999) // not specified or other
return null;
- String cryStr = (String) countryIndexToLocaleString.get(new Integer(
- code));
+ String cryStr = countryIndexToLocaleString.get(code);
- // if no such country
- if (cryStr == null)
- return null;
-
- return new Locale("", cryStr);
+ return (cryStr == null) ? null : new Locale("", cryStr);
}
/**
@@ -844,13 +839,11 @@ static int getCountryCode(Locale cLocale)
if (cLocale == null)
return 0; // not specified
- Iterator iter = countryIndexToLocaleString.keySet().iterator();
- while (iter.hasNext())
+ for (Map.Entry entry : countryIndexToLocaleString.entrySet())
{
- Integer key = (Integer) iter.next();
+ Integer key = entry.getKey();
+ String countryString = entry.getValue().toUpperCase();
- String countryString = ( (String) countryIndexToLocaleString.get(
- key)).toUpperCase();
if (countryString.equals(cLocale.getCountry()))
return key.intValue();
}
@@ -1224,254 +1217,255 @@ public OriginCountryDetail(Locale locale)
// Hashtable holding the country index
// corresponding to the country locale string
- private static Hashtable countryIndexToLocaleString = new Hashtable();
+ private static final Map countryIndexToLocaleString
+ = new Hashtable();
static
{
-// countryIndexToLocaleString.put(new Integer(0),""); //not specified
- countryIndexToLocaleString.put(new Integer(1), "us"); //USA
- countryIndexToLocaleString.put(new Integer(101), "ai"); //Anguilla
- countryIndexToLocaleString.put(new Integer(102), "ag"); //Antigua
- countryIndexToLocaleString.put(new Integer(1021), "ag"); //Antigua & Barbuda
- countryIndexToLocaleString.put(new Integer(103), "bs"); //Bahamas
- countryIndexToLocaleString.put(new Integer(104), "bb"); //Barbados
- countryIndexToLocaleString.put(new Integer(105), "bm"); //Bermuda
- countryIndexToLocaleString.put(new Integer(106), "vg"); //British Virgin Islands
- countryIndexToLocaleString.put(new Integer(107), "ca"); //Canada
- countryIndexToLocaleString.put(new Integer(108), "ky"); //Cayman Islands
- countryIndexToLocaleString.put(new Integer(109), "dm"); //Dominica
- countryIndexToLocaleString.put(new Integer(110), "do"); //Dominican Republic
- countryIndexToLocaleString.put(new Integer(111), "gd"); //Grenada
- countryIndexToLocaleString.put(new Integer(112), "jm"); //Jamaica
- countryIndexToLocaleString.put(new Integer(113), "ms"); //Montserrat
- countryIndexToLocaleString.put(new Integer(114), "kn"); //Nevis
- countryIndexToLocaleString.put(new Integer(1141), "kn"); //Saint Kitts and Nevis
- countryIndexToLocaleString.put(new Integer(115), "kn"); //St. Kitts
- countryIndexToLocaleString.put(new Integer(116), "vc"); //St. Vincent & the Grenadines
- countryIndexToLocaleString.put(new Integer(117), "tt"); //Trinidad & Tobago
- countryIndexToLocaleString.put(new Integer(118), "tc"); //Turks & Caicos Islands
- countryIndexToLocaleString.put(new Integer(120), "ag"); //Barbuda
- countryIndexToLocaleString.put(new Integer(121), "pr"); //Puerto Rico
- countryIndexToLocaleString.put(new Integer(122), "lc"); //Saint Lucia
- countryIndexToLocaleString.put(new Integer(123), "vi"); //Virgin Islands (USA)
- countryIndexToLocaleString.put(new Integer(178), "es"); //Canary Islands ???
- countryIndexToLocaleString.put(new Integer(20), "eg"); //Egypt
- countryIndexToLocaleString.put(new Integer(212), "ma"); //Morocco
- countryIndexToLocaleString.put(new Integer(213), "dz"); //Algeria
- countryIndexToLocaleString.put(new Integer(216), "tn"); //Tunisia
- countryIndexToLocaleString.put(new Integer(218), "ly"); //Libyan Arab Jamahiriya
- countryIndexToLocaleString.put(new Integer(220), "gm"); //Gambia
- countryIndexToLocaleString.put(new Integer(221), "sn"); //Senegal
- countryIndexToLocaleString.put(new Integer(222), "mr"); //Mauritania
- countryIndexToLocaleString.put(new Integer(223), "ml"); //Mali
- countryIndexToLocaleString.put(new Integer(224), "pg"); //Guinea
- countryIndexToLocaleString.put(new Integer(225), "ci"); //Cote d'Ivoire
- countryIndexToLocaleString.put(new Integer(226), "bf"); //Burkina Faso
- countryIndexToLocaleString.put(new Integer(227), "ne"); //Niger
- countryIndexToLocaleString.put(new Integer(228), "tg"); //Togo
- countryIndexToLocaleString.put(new Integer(229), "bj"); //Benin
- countryIndexToLocaleString.put(new Integer(230), "mu"); //Mauritius
- countryIndexToLocaleString.put(new Integer(231), "lr"); //Liberia
- countryIndexToLocaleString.put(new Integer(232), "sl"); //Sierra Leone
- countryIndexToLocaleString.put(new Integer(233), "gh"); //Ghana
- countryIndexToLocaleString.put(new Integer(234), "ng"); //Nigeria
- countryIndexToLocaleString.put(new Integer(235), "td"); //Chad
- countryIndexToLocaleString.put(new Integer(236), "cf"); //Central African Republic
- countryIndexToLocaleString.put(new Integer(237), "cm"); //Cameroon
- countryIndexToLocaleString.put(new Integer(238), "cv"); //Cape Verde Islands
- countryIndexToLocaleString.put(new Integer(239), "st"); //Sao Tome & Principe
- countryIndexToLocaleString.put(new Integer(240), "gq"); //Equatorial Guinea
- countryIndexToLocaleString.put(new Integer(241), "ga"); //Gabon
- countryIndexToLocaleString.put(new Integer(242), "cg"); //Congo, (Rep. of the)
- countryIndexToLocaleString.put(new Integer(243), "cd"); //Congo, Democratic Republic of
- countryIndexToLocaleString.put(new Integer(244), "ao"); //Angola
- countryIndexToLocaleString.put(new Integer(245), "gw"); //Guinea-Bissau
-// countryIndexToLocaleString.put(new Integer(246),""); //Diego Garcia ???
-// countryIndexToLocaleString.put(new Integer(247),""); //Ascension Island ???
- countryIndexToLocaleString.put(new Integer(248), "sc"); //Seychelles
- countryIndexToLocaleString.put(new Integer(249), "sd"); //Sudan
- countryIndexToLocaleString.put(new Integer(250), "rw"); //Rwanda
- countryIndexToLocaleString.put(new Integer(251), "et"); //Ethiopia
- countryIndexToLocaleString.put(new Integer(252), "so"); //Somalia
- countryIndexToLocaleString.put(new Integer(253), "dj"); //Djibouti
- countryIndexToLocaleString.put(new Integer(254), "ke"); //Kenya
- countryIndexToLocaleString.put(new Integer(255), "tz"); //Tanzania
- countryIndexToLocaleString.put(new Integer(256), "ug"); //Uganda
- countryIndexToLocaleString.put(new Integer(257), "bi"); //Burundi
- countryIndexToLocaleString.put(new Integer(258), "mz"); //Mozambique
- countryIndexToLocaleString.put(new Integer(260), "zm"); //Zambia
- countryIndexToLocaleString.put(new Integer(261), "mg"); //Madagascar
-// countryIndexToLocaleString.put(new Integer(262),""); //Reunion Island ???
- countryIndexToLocaleString.put(new Integer(263), "zw"); //Zimbabwe
- countryIndexToLocaleString.put(new Integer(264), "na"); //Namibia
- countryIndexToLocaleString.put(new Integer(265), "mw"); //Malawi
- countryIndexToLocaleString.put(new Integer(266), "ls"); //Lesotho
- countryIndexToLocaleString.put(new Integer(267), "bw"); //Botswana
- countryIndexToLocaleString.put(new Integer(268), "sz"); //Swaziland
- countryIndexToLocaleString.put(new Integer(269), "yt"); //Mayotte Island
- countryIndexToLocaleString.put(new Integer(2691), "km"); //Comoros
- countryIndexToLocaleString.put(new Integer(27), "za"); //South Africa
- countryIndexToLocaleString.put(new Integer(290), "sh"); //St. Helena
- countryIndexToLocaleString.put(new Integer(291), "er"); //Eritrea
- countryIndexToLocaleString.put(new Integer(297), "aw"); //Aruba
-// countryIndexToLocaleString.put(new Integer(298),""); //Faeroe Islands ???
- countryIndexToLocaleString.put(new Integer(299), "gl"); //Greenland
- countryIndexToLocaleString.put(new Integer(30), "gr"); //Greece
- countryIndexToLocaleString.put(new Integer(31), "nl"); //Netherlands
- countryIndexToLocaleString.put(new Integer(32), "be"); //Belgium
- countryIndexToLocaleString.put(new Integer(33), "fr"); //France
- countryIndexToLocaleString.put(new Integer(34), "es"); //Spain
- countryIndexToLocaleString.put(new Integer(350), "gi"); //Gibraltar
- countryIndexToLocaleString.put(new Integer(351), "pt"); //Portugal
- countryIndexToLocaleString.put(new Integer(352), "lu"); //Luxembourg
- countryIndexToLocaleString.put(new Integer(353), "ie"); //Ireland
- countryIndexToLocaleString.put(new Integer(354), "is"); //Iceland
- countryIndexToLocaleString.put(new Integer(355), "al"); //Albania
- countryIndexToLocaleString.put(new Integer(356), "mt"); //Malta
- countryIndexToLocaleString.put(new Integer(357), "cy"); //Cyprus
- countryIndexToLocaleString.put(new Integer(358), "fi"); //Finland
- countryIndexToLocaleString.put(new Integer(359), "bg"); //Bulgaria
- countryIndexToLocaleString.put(new Integer(36), "hu"); //Hungary
- countryIndexToLocaleString.put(new Integer(370), "lt"); //Lithuania
- countryIndexToLocaleString.put(new Integer(371), "lv"); //Latvia
- countryIndexToLocaleString.put(new Integer(372), "ee"); //Estonia
- countryIndexToLocaleString.put(new Integer(373), "md"); //Moldova, Republic of
- countryIndexToLocaleString.put(new Integer(374), "am"); //Armenia
- countryIndexToLocaleString.put(new Integer(375), "by"); //Belarus
- countryIndexToLocaleString.put(new Integer(376), "ad"); //Andorra
- countryIndexToLocaleString.put(new Integer(377), "mc"); //Monaco
- countryIndexToLocaleString.put(new Integer(378), "sm"); //San Marino
- countryIndexToLocaleString.put(new Integer(379), "va"); //Vatican City
- countryIndexToLocaleString.put(new Integer(380), "ua"); //Ukraine
-// countryIndexToLocaleString.put(new Integer(381),""); //Yugoslavia ???
- countryIndexToLocaleString.put(new Integer(3811), "cs"); //Yugoslavia - Serbia
- countryIndexToLocaleString.put(new Integer(382), "cs"); //Yugoslavia - Montenegro
- countryIndexToLocaleString.put(new Integer(385), "hr"); //Croatia
- countryIndexToLocaleString.put(new Integer(386), "si"); //Slovenia
- countryIndexToLocaleString.put(new Integer(387), "ba"); //Bosnia & Herzegovina
- countryIndexToLocaleString.put(new Integer(389), "mk"); //Macedonia (F.Y.R.O.M.)
- countryIndexToLocaleString.put(new Integer(39), "it"); //Italy
- countryIndexToLocaleString.put(new Integer(40), "ro"); //Romania
- countryIndexToLocaleString.put(new Integer(41), "ch"); //Switzerland
- countryIndexToLocaleString.put(new Integer(4101), "li"); //Liechtenstein
- countryIndexToLocaleString.put(new Integer(42), "cz"); //Czech Republic
- countryIndexToLocaleString.put(new Integer(4201), "sk"); //Slovakia
- countryIndexToLocaleString.put(new Integer(43), "at"); //Austria
- countryIndexToLocaleString.put(new Integer(44), "gb"); //United Kingdom
-// countryIndexToLocaleString.put(new Integer(441),""); //Wales ???
-// countryIndexToLocaleString.put(new Integer(442),""); //Scotland ???
- countryIndexToLocaleString.put(new Integer(45), "dk"); //Denmark
- countryIndexToLocaleString.put(new Integer(46), "se"); //Sweden
- countryIndexToLocaleString.put(new Integer(47), "no"); //Norway
- countryIndexToLocaleString.put(new Integer(48), "pl"); //Poland
- countryIndexToLocaleString.put(new Integer(49), "de"); //Germany
-// countryIndexToLocaleString.put(new Integer(500),""); //Falkland Islands ???
- countryIndexToLocaleString.put(new Integer(501), "bz"); //Belize
- countryIndexToLocaleString.put(new Integer(502), "gt"); //Guatemala
- countryIndexToLocaleString.put(new Integer(503), "sv"); //El Salvador
- countryIndexToLocaleString.put(new Integer(504), "hn"); //Honduras
- countryIndexToLocaleString.put(new Integer(505), "ni"); //Nicaragua
- countryIndexToLocaleString.put(new Integer(506), "cr"); //Costa Rica
- countryIndexToLocaleString.put(new Integer(507), "pa"); //Panama
- countryIndexToLocaleString.put(new Integer(508), "pm"); //St. Pierre & Miquelon
- countryIndexToLocaleString.put(new Integer(509), "ht"); //Haiti
- countryIndexToLocaleString.put(new Integer(51), "pe"); //Peru
- countryIndexToLocaleString.put(new Integer(52), "mx"); //Mexico
- countryIndexToLocaleString.put(new Integer(53), "cu"); //Cuba
- countryIndexToLocaleString.put(new Integer(54), "ar"); //Argentina
- countryIndexToLocaleString.put(new Integer(55), "br"); //Brazil
- countryIndexToLocaleString.put(new Integer(56), "cl"); //Chile, Republic of
- countryIndexToLocaleString.put(new Integer(57), "co"); //Colombia
- countryIndexToLocaleString.put(new Integer(58), "ve"); //Venezuela
- countryIndexToLocaleString.put(new Integer(590), "gp"); //Guadeloupe
- countryIndexToLocaleString.put(new Integer(5901), "an"); //French Antilles
- countryIndexToLocaleString.put(new Integer(5902), "an"); //Antilles
- countryIndexToLocaleString.put(new Integer(591), "bo"); //Bolivia
- countryIndexToLocaleString.put(new Integer(592), "gy"); //Guyana
- countryIndexToLocaleString.put(new Integer(593), "ec"); //Ecuador
- countryIndexToLocaleString.put(new Integer(594), "gy"); //French Guyana
- countryIndexToLocaleString.put(new Integer(595), "py"); //Paraguay
- countryIndexToLocaleString.put(new Integer(596), "mq"); //Martinique
- countryIndexToLocaleString.put(new Integer(597), "sr"); //Suriname
- countryIndexToLocaleString.put(new Integer(598), "uy"); //Uruguay
- countryIndexToLocaleString.put(new Integer(599), "an"); //Netherlands Antilles
- countryIndexToLocaleString.put(new Integer(60), "my"); //Malaysia
- countryIndexToLocaleString.put(new Integer(61), "au"); //Australia
- countryIndexToLocaleString.put(new Integer(6101), "cc"); //Cocos-Keeling Islands
- countryIndexToLocaleString.put(new Integer(6102), "cc"); //Cocos (Keeling) Islands
- countryIndexToLocaleString.put(new Integer(62), "id"); //Indonesia
- countryIndexToLocaleString.put(new Integer(63), "ph"); //Philippines
- countryIndexToLocaleString.put(new Integer(64), "nz"); //New Zealand
- countryIndexToLocaleString.put(new Integer(65), "sg"); //Singapore
- countryIndexToLocaleString.put(new Integer(66), "th"); //Thailand
-// countryIndexToLocaleString.put(new Integer(670),""); //Saipan Island ???
-// countryIndexToLocaleString.put(new Integer(6701),""); //Rota Island ???
-// countryIndexToLocaleString.put(new Integer(6702),""); //Tinian Island ???
- countryIndexToLocaleString.put(new Integer(671), "gu"); //Guam, US Territory of
- countryIndexToLocaleString.put(new Integer(672), "cx"); //Christmas Island
- countryIndexToLocaleString.put(new Integer(6722), "nf"); //Norfolk Island
- countryIndexToLocaleString.put(new Integer(673), "bn"); //Brunei
- countryIndexToLocaleString.put(new Integer(674), "nr"); //Nauru
- countryIndexToLocaleString.put(new Integer(675), "pg"); //Papua New Guinea
- countryIndexToLocaleString.put(new Integer(676), "to"); //Tonga
- countryIndexToLocaleString.put(new Integer(677), "sb"); //Solomon Islands
- countryIndexToLocaleString.put(new Integer(678), "vu"); //Vanuatu
- countryIndexToLocaleString.put(new Integer(679), "fj"); //Fiji
- countryIndexToLocaleString.put(new Integer(680), "pw"); //Palau
- countryIndexToLocaleString.put(new Integer(681), "wf"); //Wallis & Futuna Islands
- countryIndexToLocaleString.put(new Integer(682), "ck"); //Cook Islands
- countryIndexToLocaleString.put(new Integer(683), "nu"); //Niue
- countryIndexToLocaleString.put(new Integer(684), "as"); //American Samoa
- countryIndexToLocaleString.put(new Integer(685), "ws"); //Western Samoa
- countryIndexToLocaleString.put(new Integer(686), "ki"); //Kiribati
- countryIndexToLocaleString.put(new Integer(687), "nc"); //New Caledonia
- countryIndexToLocaleString.put(new Integer(688), "tv"); //Tuvalu
- countryIndexToLocaleString.put(new Integer(689), "pf"); //French Polynesia
- countryIndexToLocaleString.put(new Integer(690), "tk"); //Tokelau
- countryIndexToLocaleString.put(new Integer(691), "fm"); //Micronesia, Federated States of
- countryIndexToLocaleString.put(new Integer(692), "mh"); //Marshall Islands
- countryIndexToLocaleString.put(new Integer(7), "ru"); //Russia
- countryIndexToLocaleString.put(new Integer(705), "kz"); //Kazakhstan
- countryIndexToLocaleString.put(new Integer(706), "kg"); //Kyrgyzstan
- countryIndexToLocaleString.put(new Integer(708), "tj"); //Tajikistan
- countryIndexToLocaleString.put(new Integer(709), "tm"); //Turkmenistan
- countryIndexToLocaleString.put(new Integer(711), "uz"); //Uzbekistan
- countryIndexToLocaleString.put(new Integer(81), "jp"); //Japan
- countryIndexToLocaleString.put(new Integer(82), "kr"); //Korea, South
- countryIndexToLocaleString.put(new Integer(84), "vn"); //Viet Nam
- countryIndexToLocaleString.put(new Integer(850), "kp"); //Korea, North
- countryIndexToLocaleString.put(new Integer(852), "hk"); //Hong Kong
- countryIndexToLocaleString.put(new Integer(853), "mo"); //Macau
- countryIndexToLocaleString.put(new Integer(855), "kh"); //Cambodia
- countryIndexToLocaleString.put(new Integer(856), "la"); //Laos
- countryIndexToLocaleString.put(new Integer(86), "cn"); //China
- countryIndexToLocaleString.put(new Integer(880), "bd"); //Bangladesh
- countryIndexToLocaleString.put(new Integer(886), "tw"); //Taiwan
- countryIndexToLocaleString.put(new Integer(90), "tr"); //Turkey
- countryIndexToLocaleString.put(new Integer(91), "in"); //India
- countryIndexToLocaleString.put(new Integer(92), "pk"); //Pakistan
- countryIndexToLocaleString.put(new Integer(93), "af"); //Afghanistan
- countryIndexToLocaleString.put(new Integer(94), "lk"); //Sri Lanka
- countryIndexToLocaleString.put(new Integer(95), "mm"); //Myanmar
- countryIndexToLocaleString.put(new Integer(960), "mv"); //Maldives
- countryIndexToLocaleString.put(new Integer(961), "lb"); //Lebanon
- countryIndexToLocaleString.put(new Integer(962), "jo"); //Jordan
- countryIndexToLocaleString.put(new Integer(963), "sy"); //Syrian Arab Republic
- countryIndexToLocaleString.put(new Integer(964), "iq"); //Iraq
- countryIndexToLocaleString.put(new Integer(965), "kw"); //Kuwait
- countryIndexToLocaleString.put(new Integer(966), "sa"); //Saudi Arabia
- countryIndexToLocaleString.put(new Integer(967), "ye"); //Yemen
- countryIndexToLocaleString.put(new Integer(968), "om"); //Oman
- countryIndexToLocaleString.put(new Integer(971), "ae"); //United Arabian Emirates
- countryIndexToLocaleString.put(new Integer(972), "il"); //Israel
- countryIndexToLocaleString.put(new Integer(973), "bh"); //Bahrain
- countryIndexToLocaleString.put(new Integer(974), "qa"); //Qatar
- countryIndexToLocaleString.put(new Integer(975), "bt"); //Bhutan
- countryIndexToLocaleString.put(new Integer(976), "mn"); //Mongolia
- countryIndexToLocaleString.put(new Integer(977), "np"); //Nepal
- countryIndexToLocaleString.put(new Integer(98), "ir"); //Iran (Islamic Republic of)
- countryIndexToLocaleString.put(new Integer(994), "az"); //Azerbaijan
- countryIndexToLocaleString.put(new Integer(995), "ge"); //Georgia
-// countryIndexToLocaleString.put(new Integer(9999),""); //other
+// countryIndexToLocaleString.put((0),""); //not specified
+ countryIndexToLocaleString.put((1), "us"); //USA
+ countryIndexToLocaleString.put((101), "ai"); //Anguilla
+ countryIndexToLocaleString.put((102), "ag"); //Antigua
+ countryIndexToLocaleString.put((1021), "ag"); //Antigua & Barbuda
+ countryIndexToLocaleString.put((103), "bs"); //Bahamas
+ countryIndexToLocaleString.put((104), "bb"); //Barbados
+ countryIndexToLocaleString.put((105), "bm"); //Bermuda
+ countryIndexToLocaleString.put((106), "vg"); //British Virgin Islands
+ countryIndexToLocaleString.put((107), "ca"); //Canada
+ countryIndexToLocaleString.put((108), "ky"); //Cayman Islands
+ countryIndexToLocaleString.put((109), "dm"); //Dominica
+ countryIndexToLocaleString.put((110), "do"); //Dominican Republic
+ countryIndexToLocaleString.put((111), "gd"); //Grenada
+ countryIndexToLocaleString.put((112), "jm"); //Jamaica
+ countryIndexToLocaleString.put((113), "ms"); //Montserrat
+ countryIndexToLocaleString.put((114), "kn"); //Nevis
+ countryIndexToLocaleString.put((1141), "kn"); //Saint Kitts and Nevis
+ countryIndexToLocaleString.put((115), "kn"); //St. Kitts
+ countryIndexToLocaleString.put((116), "vc"); //St. Vincent & the Grenadines
+ countryIndexToLocaleString.put((117), "tt"); //Trinidad & Tobago
+ countryIndexToLocaleString.put((118), "tc"); //Turks & Caicos Islands
+ countryIndexToLocaleString.put((120), "ag"); //Barbuda
+ countryIndexToLocaleString.put((121), "pr"); //Puerto Rico
+ countryIndexToLocaleString.put((122), "lc"); //Saint Lucia
+ countryIndexToLocaleString.put((123), "vi"); //Virgin Islands (USA)
+ countryIndexToLocaleString.put((178), "es"); //Canary Islands ???
+ countryIndexToLocaleString.put((20), "eg"); //Egypt
+ countryIndexToLocaleString.put((212), "ma"); //Morocco
+ countryIndexToLocaleString.put((213), "dz"); //Algeria
+ countryIndexToLocaleString.put((216), "tn"); //Tunisia
+ countryIndexToLocaleString.put((218), "ly"); //Libyan Arab Jamahiriya
+ countryIndexToLocaleString.put((220), "gm"); //Gambia
+ countryIndexToLocaleString.put((221), "sn"); //Senegal
+ countryIndexToLocaleString.put((222), "mr"); //Mauritania
+ countryIndexToLocaleString.put((223), "ml"); //Mali
+ countryIndexToLocaleString.put((224), "pg"); //Guinea
+ countryIndexToLocaleString.put((225), "ci"); //Cote d'Ivoire
+ countryIndexToLocaleString.put((226), "bf"); //Burkina Faso
+ countryIndexToLocaleString.put((227), "ne"); //Niger
+ countryIndexToLocaleString.put((228), "tg"); //Togo
+ countryIndexToLocaleString.put((229), "bj"); //Benin
+ countryIndexToLocaleString.put((230), "mu"); //Mauritius
+ countryIndexToLocaleString.put((231), "lr"); //Liberia
+ countryIndexToLocaleString.put((232), "sl"); //Sierra Leone
+ countryIndexToLocaleString.put((233), "gh"); //Ghana
+ countryIndexToLocaleString.put((234), "ng"); //Nigeria
+ countryIndexToLocaleString.put((235), "td"); //Chad
+ countryIndexToLocaleString.put((236), "cf"); //Central African Republic
+ countryIndexToLocaleString.put((237), "cm"); //Cameroon
+ countryIndexToLocaleString.put((238), "cv"); //Cape Verde Islands
+ countryIndexToLocaleString.put((239), "st"); //Sao Tome & Principe
+ countryIndexToLocaleString.put((240), "gq"); //Equatorial Guinea
+ countryIndexToLocaleString.put((241), "ga"); //Gabon
+ countryIndexToLocaleString.put((242), "cg"); //Congo, (Rep. of the)
+ countryIndexToLocaleString.put((243), "cd"); //Congo, Democratic Republic of
+ countryIndexToLocaleString.put((244), "ao"); //Angola
+ countryIndexToLocaleString.put((245), "gw"); //Guinea-Bissau
+// countryIndexToLocaleString.put((246),""); //Diego Garcia ???
+// countryIndexToLocaleString.put((247),""); //Ascension Island ???
+ countryIndexToLocaleString.put((248), "sc"); //Seychelles
+ countryIndexToLocaleString.put((249), "sd"); //Sudan
+ countryIndexToLocaleString.put((250), "rw"); //Rwanda
+ countryIndexToLocaleString.put((251), "et"); //Ethiopia
+ countryIndexToLocaleString.put((252), "so"); //Somalia
+ countryIndexToLocaleString.put((253), "dj"); //Djibouti
+ countryIndexToLocaleString.put((254), "ke"); //Kenya
+ countryIndexToLocaleString.put((255), "tz"); //Tanzania
+ countryIndexToLocaleString.put((256), "ug"); //Uganda
+ countryIndexToLocaleString.put((257), "bi"); //Burundi
+ countryIndexToLocaleString.put((258), "mz"); //Mozambique
+ countryIndexToLocaleString.put((260), "zm"); //Zambia
+ countryIndexToLocaleString.put((261), "mg"); //Madagascar
+// countryIndexToLocaleString.put((262),""); //Reunion Island ???
+ countryIndexToLocaleString.put((263), "zw"); //Zimbabwe
+ countryIndexToLocaleString.put((264), "na"); //Namibia
+ countryIndexToLocaleString.put((265), "mw"); //Malawi
+ countryIndexToLocaleString.put((266), "ls"); //Lesotho
+ countryIndexToLocaleString.put((267), "bw"); //Botswana
+ countryIndexToLocaleString.put((268), "sz"); //Swaziland
+ countryIndexToLocaleString.put((269), "yt"); //Mayotte Island
+ countryIndexToLocaleString.put((2691), "km"); //Comoros
+ countryIndexToLocaleString.put((27), "za"); //South Africa
+ countryIndexToLocaleString.put((290), "sh"); //St. Helena
+ countryIndexToLocaleString.put((291), "er"); //Eritrea
+ countryIndexToLocaleString.put((297), "aw"); //Aruba
+// countryIndexToLocaleString.put((298),""); //Faeroe Islands ???
+ countryIndexToLocaleString.put((299), "gl"); //Greenland
+ countryIndexToLocaleString.put((30), "gr"); //Greece
+ countryIndexToLocaleString.put((31), "nl"); //Netherlands
+ countryIndexToLocaleString.put((32), "be"); //Belgium
+ countryIndexToLocaleString.put((33), "fr"); //France
+ countryIndexToLocaleString.put((34), "es"); //Spain
+ countryIndexToLocaleString.put((350), "gi"); //Gibraltar
+ countryIndexToLocaleString.put((351), "pt"); //Portugal
+ countryIndexToLocaleString.put((352), "lu"); //Luxembourg
+ countryIndexToLocaleString.put((353), "ie"); //Ireland
+ countryIndexToLocaleString.put((354), "is"); //Iceland
+ countryIndexToLocaleString.put((355), "al"); //Albania
+ countryIndexToLocaleString.put((356), "mt"); //Malta
+ countryIndexToLocaleString.put((357), "cy"); //Cyprus
+ countryIndexToLocaleString.put((358), "fi"); //Finland
+ countryIndexToLocaleString.put((359), "bg"); //Bulgaria
+ countryIndexToLocaleString.put((36), "hu"); //Hungary
+ countryIndexToLocaleString.put((370), "lt"); //Lithuania
+ countryIndexToLocaleString.put((371), "lv"); //Latvia
+ countryIndexToLocaleString.put((372), "ee"); //Estonia
+ countryIndexToLocaleString.put((373), "md"); //Moldova, Republic of
+ countryIndexToLocaleString.put((374), "am"); //Armenia
+ countryIndexToLocaleString.put((375), "by"); //Belarus
+ countryIndexToLocaleString.put((376), "ad"); //Andorra
+ countryIndexToLocaleString.put((377), "mc"); //Monaco
+ countryIndexToLocaleString.put((378), "sm"); //San Marino
+ countryIndexToLocaleString.put((379), "va"); //Vatican City
+ countryIndexToLocaleString.put((380), "ua"); //Ukraine
+// countryIndexToLocaleString.put((381),""); //Yugoslavia ???
+ countryIndexToLocaleString.put((3811), "cs"); //Yugoslavia - Serbia
+ countryIndexToLocaleString.put((382), "cs"); //Yugoslavia - Montenegro
+ countryIndexToLocaleString.put((385), "hr"); //Croatia
+ countryIndexToLocaleString.put((386), "si"); //Slovenia
+ countryIndexToLocaleString.put((387), "ba"); //Bosnia & Herzegovina
+ countryIndexToLocaleString.put((389), "mk"); //Macedonia (F.Y.R.O.M.)
+ countryIndexToLocaleString.put((39), "it"); //Italy
+ countryIndexToLocaleString.put((40), "ro"); //Romania
+ countryIndexToLocaleString.put((41), "ch"); //Switzerland
+ countryIndexToLocaleString.put((4101), "li"); //Liechtenstein
+ countryIndexToLocaleString.put((42), "cz"); //Czech Republic
+ countryIndexToLocaleString.put((4201), "sk"); //Slovakia
+ countryIndexToLocaleString.put((43), "at"); //Austria
+ countryIndexToLocaleString.put((44), "gb"); //United Kingdom
+// countryIndexToLocaleString.put((441),""); //Wales ???
+// countryIndexToLocaleString.put((442),""); //Scotland ???
+ countryIndexToLocaleString.put((45), "dk"); //Denmark
+ countryIndexToLocaleString.put((46), "se"); //Sweden
+ countryIndexToLocaleString.put((47), "no"); //Norway
+ countryIndexToLocaleString.put((48), "pl"); //Poland
+ countryIndexToLocaleString.put((49), "de"); //Germany
+// countryIndexToLocaleString.put((500),""); //Falkland Islands ???
+ countryIndexToLocaleString.put((501), "bz"); //Belize
+ countryIndexToLocaleString.put((502), "gt"); //Guatemala
+ countryIndexToLocaleString.put((503), "sv"); //El Salvador
+ countryIndexToLocaleString.put((504), "hn"); //Honduras
+ countryIndexToLocaleString.put((505), "ni"); //Nicaragua
+ countryIndexToLocaleString.put((506), "cr"); //Costa Rica
+ countryIndexToLocaleString.put((507), "pa"); //Panama
+ countryIndexToLocaleString.put((508), "pm"); //St. Pierre & Miquelon
+ countryIndexToLocaleString.put((509), "ht"); //Haiti
+ countryIndexToLocaleString.put((51), "pe"); //Peru
+ countryIndexToLocaleString.put((52), "mx"); //Mexico
+ countryIndexToLocaleString.put((53), "cu"); //Cuba
+ countryIndexToLocaleString.put((54), "ar"); //Argentina
+ countryIndexToLocaleString.put((55), "br"); //Brazil
+ countryIndexToLocaleString.put((56), "cl"); //Chile, Republic of
+ countryIndexToLocaleString.put((57), "co"); //Colombia
+ countryIndexToLocaleString.put((58), "ve"); //Venezuela
+ countryIndexToLocaleString.put((590), "gp"); //Guadeloupe
+ countryIndexToLocaleString.put((5901), "an"); //French Antilles
+ countryIndexToLocaleString.put((5902), "an"); //Antilles
+ countryIndexToLocaleString.put((591), "bo"); //Bolivia
+ countryIndexToLocaleString.put((592), "gy"); //Guyana
+ countryIndexToLocaleString.put((593), "ec"); //Ecuador
+ countryIndexToLocaleString.put((594), "gy"); //French Guyana
+ countryIndexToLocaleString.put((595), "py"); //Paraguay
+ countryIndexToLocaleString.put((596), "mq"); //Martinique
+ countryIndexToLocaleString.put((597), "sr"); //Suriname
+ countryIndexToLocaleString.put((598), "uy"); //Uruguay
+ countryIndexToLocaleString.put((599), "an"); //Netherlands Antilles
+ countryIndexToLocaleString.put((60), "my"); //Malaysia
+ countryIndexToLocaleString.put((61), "au"); //Australia
+ countryIndexToLocaleString.put((6101), "cc"); //Cocos-Keeling Islands
+ countryIndexToLocaleString.put((6102), "cc"); //Cocos (Keeling) Islands
+ countryIndexToLocaleString.put((62), "id"); //Indonesia
+ countryIndexToLocaleString.put((63), "ph"); //Philippines
+ countryIndexToLocaleString.put((64), "nz"); //New Zealand
+ countryIndexToLocaleString.put((65), "sg"); //Singapore
+ countryIndexToLocaleString.put((66), "th"); //Thailand
+// countryIndexToLocaleString.put((670),""); //Saipan Island ???
+// countryIndexToLocaleString.put((6701),""); //Rota Island ???
+// countryIndexToLocaleString.put((6702),""); //Tinian Island ???
+ countryIndexToLocaleString.put((671), "gu"); //Guam, US Territory of
+ countryIndexToLocaleString.put((672), "cx"); //Christmas Island
+ countryIndexToLocaleString.put((6722), "nf"); //Norfolk Island
+ countryIndexToLocaleString.put((673), "bn"); //Brunei
+ countryIndexToLocaleString.put((674), "nr"); //Nauru
+ countryIndexToLocaleString.put((675), "pg"); //Papua New Guinea
+ countryIndexToLocaleString.put((676), "to"); //Tonga
+ countryIndexToLocaleString.put((677), "sb"); //Solomon Islands
+ countryIndexToLocaleString.put((678), "vu"); //Vanuatu
+ countryIndexToLocaleString.put((679), "fj"); //Fiji
+ countryIndexToLocaleString.put((680), "pw"); //Palau
+ countryIndexToLocaleString.put((681), "wf"); //Wallis & Futuna Islands
+ countryIndexToLocaleString.put((682), "ck"); //Cook Islands
+ countryIndexToLocaleString.put((683), "nu"); //Niue
+ countryIndexToLocaleString.put((684), "as"); //American Samoa
+ countryIndexToLocaleString.put((685), "ws"); //Western Samoa
+ countryIndexToLocaleString.put((686), "ki"); //Kiribati
+ countryIndexToLocaleString.put((687), "nc"); //New Caledonia
+ countryIndexToLocaleString.put((688), "tv"); //Tuvalu
+ countryIndexToLocaleString.put((689), "pf"); //French Polynesia
+ countryIndexToLocaleString.put((690), "tk"); //Tokelau
+ countryIndexToLocaleString.put((691), "fm"); //Micronesia, Federated States of
+ countryIndexToLocaleString.put((692), "mh"); //Marshall Islands
+ countryIndexToLocaleString.put((7), "ru"); //Russia
+ countryIndexToLocaleString.put((705), "kz"); //Kazakhstan
+ countryIndexToLocaleString.put((706), "kg"); //Kyrgyzstan
+ countryIndexToLocaleString.put((708), "tj"); //Tajikistan
+ countryIndexToLocaleString.put((709), "tm"); //Turkmenistan
+ countryIndexToLocaleString.put((711), "uz"); //Uzbekistan
+ countryIndexToLocaleString.put((81), "jp"); //Japan
+ countryIndexToLocaleString.put((82), "kr"); //Korea, South
+ countryIndexToLocaleString.put((84), "vn"); //Viet Nam
+ countryIndexToLocaleString.put((850), "kp"); //Korea, North
+ countryIndexToLocaleString.put((852), "hk"); //Hong Kong
+ countryIndexToLocaleString.put((853), "mo"); //Macau
+ countryIndexToLocaleString.put((855), "kh"); //Cambodia
+ countryIndexToLocaleString.put((856), "la"); //Laos
+ countryIndexToLocaleString.put((86), "cn"); //China
+ countryIndexToLocaleString.put((880), "bd"); //Bangladesh
+ countryIndexToLocaleString.put((886), "tw"); //Taiwan
+ countryIndexToLocaleString.put((90), "tr"); //Turkey
+ countryIndexToLocaleString.put((91), "in"); //India
+ countryIndexToLocaleString.put((92), "pk"); //Pakistan
+ countryIndexToLocaleString.put((93), "af"); //Afghanistan
+ countryIndexToLocaleString.put((94), "lk"); //Sri Lanka
+ countryIndexToLocaleString.put((95), "mm"); //Myanmar
+ countryIndexToLocaleString.put((960), "mv"); //Maldives
+ countryIndexToLocaleString.put((961), "lb"); //Lebanon
+ countryIndexToLocaleString.put((962), "jo"); //Jordan
+ countryIndexToLocaleString.put((963), "sy"); //Syrian Arab Republic
+ countryIndexToLocaleString.put((964), "iq"); //Iraq
+ countryIndexToLocaleString.put((965), "kw"); //Kuwait
+ countryIndexToLocaleString.put((966), "sa"); //Saudi Arabia
+ countryIndexToLocaleString.put((967), "ye"); //Yemen
+ countryIndexToLocaleString.put((968), "om"); //Oman
+ countryIndexToLocaleString.put((971), "ae"); //United Arabian Emirates
+ countryIndexToLocaleString.put((972), "il"); //Israel
+ countryIndexToLocaleString.put((973), "bh"); //Bahrain
+ countryIndexToLocaleString.put((974), "qa"); //Qatar
+ countryIndexToLocaleString.put((975), "bt"); //Bhutan
+ countryIndexToLocaleString.put((976), "mn"); //Mongolia
+ countryIndexToLocaleString.put((977), "np"); //Nepal
+ countryIndexToLocaleString.put((98), "ir"); //Iran (Islamic Republic of)
+ countryIndexToLocaleString.put((994), "az"); //Azerbaijan
+ countryIndexToLocaleString.put((995), "ge"); //Georgia
+// countryIndexToLocaleString.put((9999),""); //other
}
/**
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 5995d2544..67484a80e 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
@@ -453,7 +453,7 @@ else if (on)
* specified call participant with the sent invite
* @throws OperationFailedException
*/
- private void sendInviteRequest(CallParticipantSipImpl sipParticipant,
+ void sendInviteRequest(CallParticipantSipImpl sipParticipant,
String sdpOffer) throws OperationFailedException
{
Dialog dialog = sipParticipant.getDialog();
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java
index 9fc2051f2..c597f9313 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java
@@ -1,230 +1,364 @@
-/*
- * 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.protocol.sip;
-
-import java.awt.*;
-
-import net.java.sip.communicator.service.media.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-
-/**
- * Implements OperationSetVideoTelephony in order to give access to
- * video-specific functionality in the SIP protocol implementation such as
- * visual Components displaying video and listening to dynamic
- * availability of such Components. Because the video in the SIP
- * protocol implementation is provided by the CallSession, this
- * OperationSetVideoTelephony just delegates to the
- * CallSession while hiding the CallSession as the
- * provider of the video and pretending this
- * OperationSetVideoTelephony is the provider because other
- * implementation may not provider their video through the
- * CallSession.
- *
- * @author Lubomir Marinov
- */
-public class OperationSetVideoTelephonySipImpl
- implements OperationSetVideoTelephony
-{
-
- /*
- * Delegates to the CallSession of the Call of the specified CallParticipant
- * because the video is provided by the CallSession in the SIP protocol
- * implementation. Because other OperationSetVideoTelephony implementations
- * may not provide their video through the CallSession, this implementation
- * promotes itself as the provider of the video by replacing the CallSession
- * in the VideoEvents it fires.
- */
- public void addVideoListener(CallParticipant participant,
- VideoListener listener)
- {
- if (listener == null)
- throw new NullPointerException("listener");
-
- ((CallSipImpl) participant.getCall()).getMediaCallSession()
- .addVideoListener(
- new InternalVideoListener(this, participant, listener));
- }
-
- public Component createLocalVisualComponent(CallParticipant participant,
- VideoListener listener) throws OperationFailedException
- {
- CallSession callSession =
- ((CallSipImpl) participant.getCall()).getMediaCallSession();
-
- if (callSession != null)
- {
- try
- {
- return callSession.createLocalVisualComponent(listener);
- }
- catch (MediaException ex)
- {
- throw new OperationFailedException(
- "Failed to create visual Component for local video (capture).",
- OperationFailedException.INTERNAL_ERROR, ex);
- }
- }
- return null;
- }
-
- public void disposeLocalVisualComponent(CallParticipant participant,
- Component component)
- {
- CallSession callSession =
- ((CallSipImpl) participant.getCall()).getMediaCallSession();
-
- if (callSession != null)
- {
- callSession.disposeLocalVisualComponent(component);
- }
- }
-
- /*
- * Delegates to the CallSession of the Call of the specified CallParticipant
- * because the video is provided by the CallSession in the SIP protocol
- * implementation.
- */
- public Component[] getVisualComponents(CallParticipant participant)
- {
- CallSession callSession =
- ((CallSipImpl) participant.getCall()).getMediaCallSession();
-
- return (callSession != null) ? callSession.getVisualComponents()
- : new Component[0];
- }
-
- /*
- * Delegates to the CallSession of the Call of the specified CallParticipant
- * because the video is provided by the CallSession in the SIP protocol
- * implementation. Because other OperationSetVideoTelephony implementations
- * may not provide their video through the CallSession, this implementation
- * promotes itself as the provider of the video by replacing the CallSession
- * in the VideoEvents it fires.
- */
- public void removeVideoListener(CallParticipant participant,
- VideoListener listener)
- {
- if (listener != null)
- {
- ((CallSipImpl) participant.getCall()).getMediaCallSession()
- .removeVideoListener(
- new InternalVideoListener(this, participant, listener));
- }
- }
-
- /**
- * Represents a VideoListener which forwards notifications to a
- * specific delegate VideoListener and hides the original
- * VideoEvent sender from it by pretending the sender is a
- * specific OperationSetVideoTelephony. It's necessary in order
- * to hide from the VideoListeners the fact that the video of
- * the SIP protocol implementation is managed by CallSession.
- */
- private static class InternalVideoListener
- implements VideoListener
- {
-
- /**
- * The VideoListener this implementation hides the original
- * VideoEvent source from.
- */
- private final VideoListener delegate;
-
- /**
- * The CallParticipant whose videos {@link #delegate} is
- * interested in.
- */
- private final CallParticipant participant;
-
- /**
- * The OperationSetVideoTelephony which is to be presented
- * as the source of the VideoEvents forwarded to
- * {@link #delegate}.
- */
- private final OperationSetVideoTelephony telephony;
-
- /**
- * Initializes a new InternalVideoListener which is to
- * impersonate the sources of VideoEvents with a specific
- * OperationSetVideoTelephony for a specific
- * VideoListener interested in the videos of a specific
- * CallParticipant.
- *
- * @param telephony the OperationSetVideoTelephony which is
- * to be stated as the source of the VideoEvent
- * sent to the specified delegate VideoListener
- * @param participant the CallParticipant whose videos the
- * specified delegate VideoListener is
- * interested in
- * @param delegate the VideoListener which shouldn't know
- * that the videos in the SIP protocol implementation is
- * managed by the CallSession and not by the specified
- * telephony
- */
- public InternalVideoListener(OperationSetVideoTelephony telephony,
- CallParticipant participant, VideoListener delegate)
- {
- if (participant == null)
- throw new NullPointerException("participant");
-
- this.telephony = telephony;
- this.participant = participant;
- this.delegate = delegate;
- }
-
- /*
- * Two InternalVideoListeners are equal if they impersonate the sources
- * of VideoEvents with equal OperationSetVideoTelephonies for equal
- * delegate VideoListeners added to equal CallParticipants.
- */
- public boolean equals(Object other)
- {
- if (other == this)
- return true;
- if ((other == null) || !other.getClass().equals(getClass()))
- return false;
-
- InternalVideoListener otherListener = (InternalVideoListener) other;
-
- return otherListener.telephony.equals(telephony)
- && otherListener.participant.equals(participant)
- && otherListener.delegate.equals(delegate);
- }
-
- public int hashCode()
- {
- return (telephony.hashCode() << 16) + (delegate.hashCode() >> 16);
- }
-
- /*
- * Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
- * the same type and with the same visual Component but with the source
- * of the event being set to #telephony. Thus the fact that the
- * CallSession is the original source is hidden from the clients of
- * OperationSetVideoTelephony.
- */
- public void videoAdded(VideoEvent event)
- {
- delegate.videoAdded(new VideoEvent(this, event.getType(), event
- .getVisualComponent(), event.getOrigin()));
- }
-
- /*
- * Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
- * the same type and with the same visual Component but with the source
- * of the event being set to #telephony. Thus the fact that the
- * CallSession is the original source is hidden from the clients of
- * OperationSetVideoTelephony.
- */
- public void videoRemoved(VideoEvent event)
- {
- delegate.videoAdded(new VideoEvent(this, event.getType(), event
- .getVisualComponent(), event.getOrigin()));
- }
- }
-}
+/*
+ * 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.protocol.sip;
+
+import java.awt.*;
+import java.util.*;
+
+import net.java.sip.communicator.service.media.*;
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.event.*;
+import net.java.sip.communicator.util.*;
+
+/**
+ * Implements OperationSetVideoTelephony in order to give access to
+ * video-specific functionality in the SIP protocol implementation such as
+ * visual Components displaying video and listening to dynamic
+ * availability of such Components. Because the video in the SIP
+ * protocol implementation is provided by the CallSession, this
+ * OperationSetVideoTelephony just delegates to the
+ * CallSession while hiding the CallSession as the
+ * provider of the video and pretending this
+ * OperationSetVideoTelephony is the provider because other
+ * implementation may not provider their video through the
+ * CallSession.
+ *
+ * @author Lubomir Marinov
+ */
+public class OperationSetVideoTelephonySipImpl
+ implements OperationSetVideoTelephony
+{
+
+ /**
+ * The telephony-related functionality this extension builds upon.
+ */
+ private final OperationSetBasicTelephonySipImpl basicTelephony;
+
+ /**
+ * Initializes a new OperationSetVideoTelephonySipImpl instance
+ * which builds upon the telephony-related functionality of a specific
+ * OperationSetBasicTelephonySipImpl.
+ *
+ * @param basicTelephony the OperationSetBasicTelephonySipImpl
+ * the new extension should build upon
+ */
+ public OperationSetVideoTelephonySipImpl(
+ OperationSetBasicTelephonySipImpl basicTelephony)
+ {
+ this.basicTelephony = basicTelephony;
+ }
+
+ /*
+ * Delegates to the CallSession of the Call of the specified CallParticipant
+ * because the video is provided by the CallSession in the SIP protocol
+ * implementation. Because other OperationSetVideoTelephony implementations
+ * may not provide their video through the CallSession, this implementation
+ * promotes itself as the provider of the video by replacing the CallSession
+ * in the VideoEvents it fires.
+ */
+ public void addVideoListener(CallParticipant participant,
+ VideoListener listener)
+ {
+ if (listener == null)
+ throw new NullPointerException("listener");
+
+ ((CallSipImpl) participant.getCall()).getMediaCallSession()
+ .addVideoListener(
+ new InternalVideoListener(this, participant, listener));
+ }
+
+ /*
+ * Implements OperationSetVideoTelephony#createLocalVisualComponent(
+ * CallParticipant, VideoListener). Delegates to CallSession#createLocalVisualComponent(
+ * VideoListener) of the Call of the specified CallParticipant because the
+ * CallSession manages the visual components which represent local video.
+ */
+ public Component createLocalVisualComponent(CallParticipant participant,
+ VideoListener listener) throws OperationFailedException
+ {
+ CallSession callSession =
+ ((CallSipImpl) participant.getCall()).getMediaCallSession();
+
+ if (callSession != null)
+ {
+ try
+ {
+ return callSession.createLocalVisualComponent(listener);
+ }
+ catch (MediaException ex)
+ {
+ throw new OperationFailedException(
+ "Failed to create visual Component for local video (capture).",
+ OperationFailedException.INTERNAL_ERROR, ex);
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Implements OperationSetVideoTelephony#disposeLocalVisualComponent(
+ * CallParticipant, Component). Delegates to CallSession#disposeLocalVisualComponent(
+ * Component) of the Call of the specified CallParticipant because the
+ * CallSession manages the visual components which represent local video.
+ */
+ public void disposeLocalVisualComponent(CallParticipant participant,
+ Component component)
+ {
+ CallSession callSession =
+ ((CallSipImpl) participant.getCall()).getMediaCallSession();
+
+ if (callSession != null)
+ callSession.disposeLocalVisualComponent(component);
+ }
+
+ /*
+ * Delegates to the CallSession of the Call of the specified CallParticipant
+ * because the video is provided by the CallSession in the SIP protocol
+ * implementation.
+ */
+ public Component[] getVisualComponents(CallParticipant participant)
+ {
+ CallSession callSession =
+ ((CallSipImpl) participant.getCall()).getMediaCallSession();
+
+ return (callSession != null) ? callSession.getVisualComponents()
+ : new Component[0];
+ }
+
+ /*
+ * Delegates to the CallSession of the Call of the specified CallParticipant
+ * because the video is provided by the CallSession in the SIP protocol
+ * implementation. Because other OperationSetVideoTelephony implementations
+ * may not provide their video through the CallSession, this implementation
+ * promotes itself as the provider of the video by replacing the CallSession
+ * in the VideoEvents it fires.
+ */
+ public void removeVideoListener(CallParticipant participant,
+ VideoListener listener)
+ {
+ if (listener != null)
+ {
+ ((CallSipImpl) participant.getCall()).getMediaCallSession()
+ .removeVideoListener(
+ new InternalVideoListener(this, participant, listener));
+ }
+ }
+
+ /*
+ * Implements OperationSetVideoTelephony#setLocalVideoAllowed(Call,
+ * boolean). Modifies the local media setup to reflect the requested setting
+ * for the streaming of the local video and then re-invites all
+ * CallParticipants to re-negotiate the modified media setup.
+ */
+ public void setLocalVideoAllowed(Call call, boolean allowed)
+ throws OperationFailedException
+ {
+
+ /*
+ * Modify the local media setup to reflect the requested setting for the
+ * streaming of the local video.
+ */
+ CallSipImpl sipCall = (CallSipImpl) call;
+ CallSession callSession = sipCall.getMediaCallSession();
+
+ try
+ {
+ callSession.setLocalVideoAllowed(allowed);
+ }
+ catch (MediaException ex)
+ {
+ throw new OperationFailedException(
+ "Failed to allow/disallow the streaming of local video.",
+ OperationFailedException.INTERNAL_ERROR, ex);
+ }
+
+ /*
+ * Once the local state has been modified, re-invite all
+ * CallParticipants to re-negotiate the modified media setup.
+ */
+ Iterator participants = call.getCallParticipants();
+ while (participants.hasNext())
+ {
+ CallParticipantSipImpl participant
+ = (CallParticipantSipImpl) participants.next();
+ String sdpOffer = null;
+
+ try
+ {
+ sdpOffer
+ = callSession.createSdpOffer(
+ participant.getSdpDescription());
+ }
+ catch (MediaException ex)
+ {
+ throw new OperationFailedException(
+ "Failed to create re-invite offer for participant "
+ + participant,
+ OperationFailedException.INTERNAL_ERROR,
+ ex);
+ }
+
+ basicTelephony.sendInviteRequest(participant, sdpOffer);
+ }
+ }
+
+ /*
+ * Implements OperationSetVideoTelephony#isLocalVideoAllowed(Call).
+ * Delegates to CallSession#isLocalVideoAllowed() of the specified Call.
+ */
+ public boolean isLocalVideoAllowed(Call call)
+ {
+ return ((CallSipImpl) call).getMediaCallSession().isLocalVideoAllowed();
+ }
+
+ /*
+ * Implements OperationSetVideoTelephony#isLocalVideoStreaming(Call).
+ * Delegates to CallSession#isLocalVideoStreaming() of the specified Call.
+ */
+ public boolean isLocalVideoStreaming(Call call)
+ {
+ return ((CallSipImpl) call)
+ .getMediaCallSession().isLocalVideoStreaming();
+ }
+
+ /*
+ * Implements OperationSetVideoTelephony#addPropertyChangeListener(Call,
+ * PropertyChangeListener). Delegates to CallSession#addPropertyChangeListener(
+ * PropertyChangeListener) of the specified Call because CallSession
+ * contains the properties associated with a Call.
+ */
+ public void addPropertyChangeListener(
+ Call call, PropertyChangeListener listener)
+ {
+ ((CallSipImpl) call)
+ .getMediaCallSession().addPropertyChangeListener(listener);
+ }
+
+ /*
+ * Implements OperationSetVideoTelephony#removePropertyChangeListener(Call,
+ * PropertyChangeListener). Delegates to CallSession#removePropertyChangeListener(
+ * PropertyChangeListener) of the specified Call because CallSession
+ * contains the properties associated with a Call.
+ */
+ public void removePropertyChangeListener(
+ Call call, PropertyChangeListener listener)
+ {
+ ((CallSipImpl) call)
+ .getMediaCallSession().removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Represents a VideoListener which forwards notifications to a
+ * specific delegate VideoListener and hides the original
+ * VideoEvent sender from it by pretending the sender is a
+ * specific OperationSetVideoTelephony. It's necessary in order
+ * to hide from the VideoListeners the fact that the video of
+ * the SIP protocol implementation is managed by CallSession.
+ */
+ private static class InternalVideoListener
+ implements VideoListener
+ {
+
+ /**
+ * The VideoListener this implementation hides the original
+ * VideoEvent source from.
+ */
+ private final VideoListener delegate;
+
+ /**
+ * The CallParticipant whose videos {@link #delegate} is
+ * interested in.
+ */
+ private final CallParticipant participant;
+
+ /**
+ * The OperationSetVideoTelephony which is to be presented
+ * as the source of the VideoEvents forwarded to
+ * {@link #delegate}.
+ */
+ private final OperationSetVideoTelephony telephony;
+
+ /**
+ * Initializes a new InternalVideoListener which is to
+ * impersonate the sources of VideoEvents with a specific
+ * OperationSetVideoTelephony for a specific
+ * VideoListener interested in the videos of a specific
+ * CallParticipant.
+ *
+ * @param telephony the OperationSetVideoTelephony which is
+ * to be stated as the source of the VideoEvent
+ * sent to the specified delegate VideoListener
+ * @param participant the CallParticipant whose videos the
+ * specified delegate VideoListener is
+ * interested in
+ * @param delegate the VideoListener which shouldn't know
+ * that the videos in the SIP protocol implementation is
+ * managed by the CallSession and not by the specified
+ * telephony
+ */
+ public InternalVideoListener(OperationSetVideoTelephony telephony,
+ CallParticipant participant, VideoListener delegate)
+ {
+ if (participant == null)
+ throw new NullPointerException("participant");
+
+ this.telephony = telephony;
+ this.participant = participant;
+ this.delegate = delegate;
+ }
+
+ /*
+ * Two InternalVideoListeners are equal if they impersonate the sources
+ * of VideoEvents with equal OperationSetVideoTelephonies for equal
+ * delegate VideoListeners added to equal CallParticipants.
+ */
+ public boolean equals(Object other)
+ {
+ if (other == this)
+ return true;
+ if ((other == null) || !other.getClass().equals(getClass()))
+ return false;
+
+ InternalVideoListener otherListener = (InternalVideoListener) other;
+
+ return otherListener.telephony.equals(telephony)
+ && otherListener.participant.equals(participant)
+ && otherListener.delegate.equals(delegate);
+ }
+
+ public int hashCode()
+ {
+ return (telephony.hashCode() << 16) + (delegate.hashCode() >> 16);
+ }
+
+ /*
+ * Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
+ * the same type and with the same visual Component but with the source
+ * of the event being set to #telephony. Thus the fact that the
+ * CallSession is the original source is hidden from the clients of
+ * OperationSetVideoTelephony.
+ */
+ public void videoAdded(VideoEvent event)
+ {
+ delegate.videoAdded(new VideoEvent(this, event.getType(), event
+ .getVisualComponent(), event.getOrigin()));
+ }
+
+ /*
+ * Upon receiving a VideoEvent, sends to delegate a new VideoEvent of
+ * the same type and with the same visual Component but with the source
+ * of the event being set to #telephony. Thus the fact that the
+ * CallSession is the original source is hidden from the clients of
+ * OperationSetVideoTelephony.
+ */
+ public void videoRemoved(VideoEvent event)
+ {
+ delegate.videoAdded(new VideoEvent(this, event.getType(), event
+ .getVisualComponent(), event.getOrigin()));
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
index 387e43929..86c0cf5a4 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
@@ -432,20 +432,20 @@ protected void initialize(String sipAddress,
initRegistrarConnection(accountID);
//init our call processor
- OperationSetAdvancedTelephony opSetAdvancedTelephony
+ OperationSetBasicTelephonySipImpl opSetBasicTelephonySipImpl
= new OperationSetBasicTelephonySipImpl(this);
this.supportedOperationSets.put(
OperationSetBasicTelephony.class.getName()
- , opSetAdvancedTelephony);
+ , opSetBasicTelephonySipImpl);
this.supportedOperationSets.put(
OperationSetAdvancedTelephony.class.getName()
- , opSetAdvancedTelephony);
+ , opSetBasicTelephonySipImpl);
// init ZRTP (OperationSetBasicTelephonySipImpl implements
// OperationSetSecureTelephony)
this.supportedOperationSets.put(
OperationSetSecureTelephony.class.getName()
- , opSetAdvancedTelephony);
+ , opSetBasicTelephonySipImpl);
//init presence op set.
OperationSetPersistentPresence opSetPersPresence
@@ -474,8 +474,9 @@ protected void initialize(String sipAddress,
opSetTyping);
// OperationSetVideoTelephony
- supportedOperationSets.put(OperationSetVideoTelephony.class
- .getName(), new OperationSetVideoTelephonySipImpl());
+ supportedOperationSets.put(
+ OperationSetVideoTelephony.class.getName(),
+ new OperationSetVideoTelephonySipImpl(opSetBasicTelephonySipImpl));
// init DTMF (from JM Heitz)
OperationSetDTMF opSetDTMF = new OperationSetDTMFSipImpl(this);
diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java
index c06055c30..995a79909 100644
--- a/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java
@@ -8,10 +8,8 @@
*
* SSH Suport in SIP Communicator - GSoC' 07 Projec
*/
-
package net.java.sip.communicator.impl.protocol.ssh;
-
import java.io.*;
import java.util.*;
@@ -33,7 +31,7 @@ public class ContactSSHImpl
= Logger.getLogger(ContactSSHImpl.class);
/**
- * This acts as a seperator between details stored in persistent data
+ * This acts as a separator between details stored in persistent data
*/
private final String separator =
Resources.getString("impl.protocol.ssh.DETAILS_SEPARATOR");
@@ -381,8 +379,8 @@ public void setPersistentData(String persistentData)
this.persistentData.substring(fourthCommaIndex + 1,
fifthCommaIndex));
- this.sshConfigurationForm.setUpdateInterval(new Integer(Integer
- .parseInt(this.persistentData.substring(fifthCommaIndex+1)) ));
+ this.sshConfigurationForm.setUpdateInterval(
+ Integer.parseInt(this.persistentData.substring(fifthCommaIndex+1)));
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java
index 0e38a3a45..001eb3947 100644
--- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java
+++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java
@@ -109,7 +109,7 @@ public SSHContactInfo(ContactSSH sshContact) {
* initialize the form.
*/
public void initForm() {
- updateTimer.setValue(new Integer(30));
+ updateTimer.setValue(30);
MaskFormatter maskFormatter = new MaskFormatter();
try {
maskFormatter.setMask("#####");
@@ -118,7 +118,7 @@ public void initForm() {
}
maskFormatter.setAllowsInvalid(false);
portField = new JFormattedTextField(maskFormatter);
- portField.setValue(new Integer(22));
+ portField.setValue(22);
userNameField.setEnabled(false);
passwordField.setEditable(false);
@@ -314,7 +314,7 @@ public void setTerminalType(String termType) {
*
* @param interval to be associated
*/
- public void setUpdateInterval(Integer interval) {
+ public void setUpdateInterval(int interval) {
this.updateTimer.setValue(interval);
}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
index 195543643..1374bc49d 100644
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
@@ -9,10 +9,12 @@
import java.beans.PropertyChangeEvent;
import java.io.*;
import java.util.*;
+
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.yahooconstants.*;
import net.java.sip.communicator.util.*;
+
import ymsg.network.*;
import ymsg.network.event.*;
@@ -86,34 +88,35 @@ public class OperationSetPersistentPresenceYahooImpl
* A map containing bindings between SIP Communicator's yahoo presence status
* instances and Yahoo status codes
*/
- private static Map scToYahooModesMappings = new Hashtable();
+ private static final Map scToYahooModesMappings
+ = new Hashtable();
static{
scToYahooModesMappings.put(YahooStatusEnum.AVAILABLE,
- new Long(StatusConstants.STATUS_AVAILABLE));
+ StatusConstants.STATUS_AVAILABLE);
scToYahooModesMappings.put(YahooStatusEnum.BE_RIGHT_BACK,
- new Long(StatusConstants.STATUS_BRB));
+ StatusConstants.STATUS_BRB);
scToYahooModesMappings.put(YahooStatusEnum.BUSY,
- new Long(StatusConstants.STATUS_BUSY));
+ StatusConstants.STATUS_BUSY);
scToYahooModesMappings.put(YahooStatusEnum.IDLE,
- new Long(StatusConstants.STATUS_IDLE));
+ StatusConstants.STATUS_IDLE);
scToYahooModesMappings.put(YahooStatusEnum.INVISIBLE,
- new Long(StatusConstants.STATUS_INVISIBLE));
+ StatusConstants.STATUS_INVISIBLE);
scToYahooModesMappings.put(YahooStatusEnum.NOT_AT_DESK,
- new Long(StatusConstants.STATUS_NOTATDESK));
+ StatusConstants.STATUS_NOTATDESK);
scToYahooModesMappings.put(YahooStatusEnum.NOT_AT_HOME,
- new Long(StatusConstants.STATUS_NOTATHOME));
+ StatusConstants.STATUS_NOTATHOME);
scToYahooModesMappings.put(YahooStatusEnum.NOT_IN_OFFICE,
- new Long(StatusConstants.STATUS_NOTINOFFICE));
+ StatusConstants.STATUS_NOTINOFFICE);
scToYahooModesMappings.put(YahooStatusEnum.OFFLINE,
- new Long(StatusConstants.STATUS_OFFLINE));
+ StatusConstants.STATUS_OFFLINE);
scToYahooModesMappings.put(YahooStatusEnum.ON_THE_PHONE,
- new Long(StatusConstants.STATUS_ONPHONE));
+ StatusConstants.STATUS_ONPHONE);
scToYahooModesMappings.put(YahooStatusEnum.ON_VACATION,
- new Long(StatusConstants.STATUS_ONVACATION));
+ StatusConstants.STATUS_ONVACATION);
scToYahooModesMappings.put(YahooStatusEnum.OUT_TO_LUNCH,
- new Long(StatusConstants.STATUS_OUTTOLUNCH));
+ StatusConstants.STATUS_OUTTOLUNCH);
scToYahooModesMappings.put(YahooStatusEnum.STEPPED_OUT,
- new Long(StatusConstants.STATUS_STEPPEDOUT));
+ StatusConstants.STATUS_STEPPEDOUT);
}
/**
@@ -436,7 +439,7 @@ public void publishPresenceStatus(PresenceStatus status,
}
parentProvider.getYahooSession().setStatus(
- ((Long)scToYahooModesMappings.get(status)).longValue());
+ scToYahooModesMappings.get(status).longValue());
fireProviderPresenceStatusChangeEvent(currentStatus, status);
}
@@ -1018,4 +1021,4 @@ public void subscriptionMoved(SubscriptionMovedEvent evt) {}
public void subscriptionResolved(SubscriptionEvent evt) {}
public void contactModified(ContactPropertyChangeEvent evt) {}
}
-}
\ No newline at end of file
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java
index 82e2b0666..6eb3782d4 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSOutgoing.java
@@ -261,7 +261,7 @@ void writeName(String name) throws IOException
writeByte(val);
return;
}
- names.put(name, new Integer(off));
+ names.put(name, off);
writeUTF(name, 0, n);
name = name.substring(n);
if (name.startsWith("."))
diff --git a/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java b/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java
index 936fa148b..5b9d757fd 100644
--- a/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java
+++ b/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java
@@ -359,7 +359,7 @@ private void loadSummaryDetails()
if (c.get(Calendar.MONTH) < calendarDetail.get(Calendar.MONTH))
age--;
- ageDetail = new Integer(age).toString().trim();
+ ageDetail = Integer.toString(age).trim();
}
birthdayField.setText(birthDateDetailString);
diff --git a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java
index 11d8ec81a..e344cb344 100644
--- a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java
+++ b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java
@@ -339,7 +339,7 @@ private JPanel createSummaryInfoPanel()
if (c.get(Calendar.MONTH) < calendarDetail.get(Calendar.MONTH))
age--;
- ageDetail = new Integer(age).toString().trim();
+ ageDetail = Integer.toString(age).trim();
}
if (birthDateDetail.equals(""))
diff --git a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java
index c478f4b04..4e848f5af 100644
--- a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java
@@ -7,7 +7,6 @@
import java.awt.*;
import java.awt.event.*;
-import java.util.*;
import java.util.List;
import javax.swing.*;
@@ -314,7 +313,7 @@ public void commitPage()
int port = Integer.parseInt(portField.getText());
boolean isModified = false;
- if (this.initAccountID instanceof AccountID)
+ if (this.initAccountID != null)
{ // We check if there are modifications to the server
String accHost =
this.initAccountID.getAccountPropertyString(
@@ -323,7 +322,8 @@ public void commitPage()
Integer.parseInt(this.initAccountID
.getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT));
- if (accHost != host || accPort != port)
+ if (((accHost == null) ? (host != null) : !accHost.equals(host))
+ || (accPort != port))
{
isModified = true;
}
@@ -514,8 +514,7 @@ private boolean hasAccount()
ProtocolProviderFactory factory =
DictAccRegWizzActivator.getDictProtocolProviderFactory();
- ArrayList registeredAccounts = factory.getRegisteredAccounts();
- return !registeredAccounts.isEmpty();
+ return !factory.getRegisteredAccounts().isEmpty();
}
/**
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/ConfigurationManager.java b/src/net/java/sip/communicator/plugin/generalconfig/ConfigurationManager.java
index 606903142..585fea215 100644
--- a/src/net/java/sip/communicator/plugin/generalconfig/ConfigurationManager.java
+++ b/src/net/java/sip/communicator/plugin/generalconfig/ConfigurationManager.java
@@ -159,8 +159,7 @@ public static void loadGuiConfigurations()
&& chatHistorySizeString.length() > 0)
{
chatHistorySize
- = new Integer(chatHistorySizeString)
- .intValue();
+ = Integer.parseInt(chatHistorySizeString);
}
// Load the "isTransparentWindowEnabled" property.
@@ -196,7 +195,7 @@ public static void loadGuiConfigurations()
&& windowTransparencyString.length() > 0)
{
windowTransparency
- = new Integer(windowTransparencyString).intValue();
+ = Integer.parseInt(windowTransparencyString);
}
}
@@ -342,7 +341,7 @@ public static void setWindowTransparency(int windowTransparency)
configService.setProperty(
"impl.gui.WINDOW_TRANSPARENCY",
- new Integer(windowTransparency).toString());
+ Integer.toString(windowTransparency));
}
/**
@@ -462,4 +461,4 @@ public static void setChatHistorySize(int historySize)
"service.gui.MESSAGE_HISTORY_SIZE",
Integer.toString(chatHistorySize));
}
-}
\ No newline at end of file
+}
diff --git a/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationPanel.java b/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationPanel.java
index 48aeaa7da..03f4e3e92 100644
--- a/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationPanel.java
+++ b/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationPanel.java
@@ -55,11 +55,8 @@ public class MailboxConfigurationPanel
private JLabel jlblWaitTime
= new JLabel(Resources.getString("plugin.mailbox.WAIT_TIME"));
- private JSpinner jsWaitTime = new JSpinner(new SpinnerNumberModel(
- new Integer(10000),
- new Integer(0),
- null,
- new Integer(1000)));
+ private JSpinner jsWaitTime =
+ new JSpinner(new SpinnerNumberModel(10000, 0, null, 1000));
private JPanel jpWaitTime =
new TransparentPanel(new FlowLayout(FlowLayout.LEFT));
@@ -67,11 +64,8 @@ public class MailboxConfigurationPanel
private JLabel jlblMaxMessageTime
= new JLabel(Resources.getString("plugin.mailbox.MAX_MESSAGE_TIME"));
- private JSpinner jsMaxMessageTime = new JSpinner(new SpinnerNumberModel(
- new Integer(10000),
- new Integer(0),
- null,
- new Integer(1000)));
+ private JSpinner jsMaxMessageTime
+ = new JSpinner(new SpinnerNumberModel(10000, 0, null, 1000));
private JPanel jpMaxMessageTime = new TransparentPanel(
new FlowLayout(FlowLayout.LEFT));
@@ -106,13 +100,12 @@ public MailboxConfigurationPanel()
jpIncomingMessage.add(jbtnIncomingMessage);
//get our wait time panel set up
- jsWaitTime.setValue(new Integer(Mailbox.getWaitTime()));
+ jsWaitTime.setValue(Mailbox.getWaitTime());
jpWaitTime.add(jlblWaitTime);
jpWaitTime.add(jsWaitTime);
//get our max message time panel set up
- jsMaxMessageTime.setValue(new Integer(
- Mailbox.getMaxMessageDuration()));
+ jsMaxMessageTime.setValue(Mailbox.getMaxMessageDuration());
jpMaxMessageTime.add(jlblMaxMessageTime);
jpMaxMessageTime.add(jsMaxMessageTime);
@@ -197,9 +190,9 @@ else if (e.getSource() == jbtnDefault)
config.setProperty(Mailbox.OUTGOING_MESSAGE_PROPERTY_NAME,
null);
config.setProperty(Mailbox.MAX_MSG_DURATION_PROPERTY_NAME,
- new Integer(Mailbox.getMaxMessageDuration()));
+ Mailbox.getMaxMessageDuration());
config.setProperty(Mailbox.WAIT_TIME_PROPERTY_NAME,
- new Integer(Mailbox.getWaitTime()));
+ Mailbox.getWaitTime());
config.setProperty(Mailbox.INCOMING_MESSAGE_PROPERTY_NAME,
Mailbox.getIncomingMessageDirectory());
config.setProperty(Mailbox.OUTGOING_MESSAGE_PROPERTY_NAME,
@@ -212,9 +205,9 @@ else if (e.getSource() == jbtnDefault)
jtfOutgoingMessage.setText(Mailbox
.getOutgoingMessageFileLocation()
.toString());
- jsWaitTime.setValue(new Integer(Mailbox.getWaitTime()));
- jsMaxMessageTime.setValue(new Integer(
- Mailbox.getMaxMessageDuration()));
+ jsWaitTime.setValue(Mailbox.getWaitTime());
+ jsMaxMessageTime.setValue(
+ Mailbox.getMaxMessageDuration());
}
}
diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java
index 43c61c6ad..6ac01b881 100644
--- a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java
+++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java
@@ -308,10 +308,10 @@ public WhiteboardFrame(WhiteboardSessionManager wps,
setSize(800, 600);
initializeTransform();
- Integer value = new Integer(1);
- Integer min = new Integer(1);
- Integer max = new Integer(10);
- Integer step = new Integer(1);
+ Integer value = 1;
+ Integer min = 1;
+ Integer max = 10;
+ Integer step = 1;
spinModel = new SpinnerNumberModel(value, min, max, step);
jSpinnerThickness.setModel(spinModel);
@@ -469,8 +469,7 @@ public void mousePressed(MouseEvent e)
{
shape.setSelected(true);
selectedShape = shape;
- spinModel.setValue(new Integer(selectedShape
- .getThickness()));
+ spinModel.setValue(selectedShape.getThickness());
jLabelColor.setBackground(Color.getColor("",
selectedShape.getColor()));
break;
@@ -495,8 +494,7 @@ else if (currentTool == MODIF)
shape.setModifyPoint(point);
selectedShape = shape;
- spinModel.setValue(new Integer(selectedShape
- .getThickness()));
+ spinModel.setValue(selectedShape.getThickness());
jLabelColor.setBackground(
Color.getColor("", selectedShape.getColor()));
break;
@@ -2547,4 +2545,4 @@ public void whiteboardStateChanged(WhiteboardChangeEvent evt)
{
}
}
-}
\ No newline at end of file
+}
diff --git a/src/net/java/sip/communicator/service/media/CallSession.java b/src/net/java/sip/communicator/service/media/CallSession.java
index 141eb6eb5..b6d2582e3 100644
--- a/src/net/java/sip/communicator/service/media/CallSession.java
+++ b/src/net/java/sip/communicator/service/media/CallSession.java
@@ -13,6 +13,7 @@
import net.java.sip.communicator.service.media.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
+import net.java.sip.communicator.util.*;
/**
* A CallSession contains parameters associated with a particular Call such as
@@ -33,6 +34,7 @@
*/
public interface CallSession
{
+
/**
* The method is meant for use by protocol service implementations when
* willing to send an invitation to a remote callee.
@@ -62,6 +64,22 @@ public String createSdpOffer()
public String createSdpOffer(InetAddress intendedDestination)
throws MediaException;
+ /**
+ * Creates a SDP description including the current state of the local media
+ * setup and in accord with a specific SDP description of a call participant
+ * (who is to be offered the created SDP description, for example, as part
+ * of a re-INVITE).
+ *
+ * @param participantSdpDescription the SDP description (of a call
+ * participant) to have the created SDP description in accord
+ * with
+ * @return a SDP description including the current state of the local media
+ * setup and in accord with the specified SDP description of a call
+ * participant
+ */
+ public String createSdpOffer(String participantSdpDescription)
+ throws MediaException;
+
/**
* The method is meant for use by protocol service implementations when
* willing to send an in-dialog invitation to a remote callee to put her
@@ -190,6 +208,12 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
*/
public void setMute(boolean mute);
+ /**
+ * Starts the streaming of the local media (to the remote destinations).
+ */
+ public void startStreaming()
+ throws MediaException;
+
/**
* Stops and closes the audio and video streams flowing through this
* session.
@@ -231,12 +255,37 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
* visual/video Components are being added or
* removed in this CallSession
*/
- void addVideoListener(VideoListener listener);
+ public void addVideoListener(VideoListener listener);
- Component createLocalVisualComponent(VideoListener listener)
+ /**
+ * Creates a visual Component which represents the local video
+ * streamed by this CallSession (to remote destinations). If
+ * the synchronous creation of the Component isn't supported,
+ * it will be carried out asynchronously and the progress of the operation
+ * and its result will be delivered through a specific
+ * VideoListener.
+ *
+ * @param listener the VideoListener to track the progress of
+ * the creation and deliver its result in case the operation is
+ * carried out asynchronously by this implementation
+ * @return a visual Component which represents the local video
+ * if this implementation creates it synchronously; null if
+ * this implementation attempts asynchronous creation in which case
+ * the result will be delivered to the specified
+ * VideoListener
+ */
+ public Component createLocalVisualComponent(VideoListener listener)
throws MediaException;
- void disposeLocalVisualComponent(Component component);
+ /**
+ * Disposes of a specific visual Component representing local
+ * video which has been created by this instance with
+ * {@link #createLocalVisualComponent(VideoListener)}.
+ *
+ * @param component the visual Component representing local
+ * video to be disposed
+ */
+ public void disposeLocalVisualComponent(Component component);
/**
* Gets the visual/video Components available in this
@@ -245,7 +294,7 @@ Component createLocalVisualComponent(VideoListener listener)
* @return an array of the visual Components available in this
* CallSession
*/
- Component[] getVisualComponents();
+ public Component[] getVisualComponents();
/**
* Removes a specific VideoListener from this
@@ -257,7 +306,32 @@ Component createLocalVisualComponent(VideoListener listener)
* when visual/video Components are being added or
* removed in this CallSession
*/
- void removeVideoListener(VideoListener listener);
+ public void removeVideoListener(VideoListener listener);
+
+ /**
+ * Sets the indicator which determines whether the streaming of local video
+ * in this CallSession is allowed. The setting does not reflect
+ * the availability of actual video capture devices, it just expresses the
+ * desire of the user to have the local video streamed in the case the
+ * system is actually able to do so.
+ *
+ * @param allowed true to allow the streaming of local video for
+ * this CallSession; false to disallow it
+ */
+ public void setLocalVideoAllowed(boolean allowed)
+ throws MediaException;
+
+ /**
+ * Gets the indicator which determines whether the streaming of local video
+ * in this CallSession is allowed. The setting does not reflect
+ * the availability of actual video capture devices, it just expresses the
+ * desire of the user to have the local video streamed in the case the
+ * system is actually able to do so.
+ *
+ * @return true if the streaming of local video in this
+ * CallSession is allowed; otherwise, false
+ */
+ public boolean isLocalVideoAllowed();
/**
* Sets a SessionCreatorCallback that will listen for
@@ -277,4 +351,44 @@ public void setSessionCreatorCallback(
* security events
*/
public SessionCreatorCallback getSessionCreatorCallback();
+
+ /**
+ * The property which indicates whether a CallSession is
+ * currently streaming the local video (to a remote destination).
+ */
+ public static final String LOCAL_VIDEO_STREAMING = "LOCAL_VIDEO_STREAMING";
+
+ /**
+ * Gets the indicator which determines whether this CallSession
+ * is currently streaming the local video (to a remote destination).
+ *
+ * @return true if this CallSession is currently
+ * streaming the local video (to a remote destination); otherwise,
+ * false
+ */
+ public boolean isLocalVideoStreaming();
+
+ /**
+ * Adds a specific PropertyChangeListener to the list of
+ * listeners which get notified when the properties (e.g.
+ * {@link #LOCAL_VIDEO_STREAMING}) associated with this
+ * CallSession change their values.
+ *
+ * @param listener the PropertyChangeListener to be notified
+ * when the properties associated with this
+ * CallSession change their values
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * Removes a specific PropertyChangeListener from the list of
+ * listeners which get notified when the properties (e.g.
+ * {@link #LOCAL_VIDEO_STREAMING}) associated with this
+ * CallSession change their values.
+ *
+ * @param listener the PropertyChangeListener to no longer be
+ * notified when the properties associated with this
+ * CallSession change their values
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener);
}
diff --git a/src/net/java/sip/communicator/service/protocol/CallParticipantState.java b/src/net/java/sip/communicator/service/protocol/CallParticipantState.java
index fcea1f6da..d33136341 100644
--- a/src/net/java/sip/communicator/service/protocol/CallParticipantState.java
+++ b/src/net/java/sip/communicator/service/protocol/CallParticipantState.java
@@ -80,7 +80,7 @@ public class CallParticipantState
/**
* This constant value indicates that the state of the call participant is
- * is CONNECTING - which means that a network connection to that participant
+ * CONNECTING - which means that a network connection to that participant
* is currently being established.
*/
public static final CallParticipantState CONNECTING =
@@ -95,7 +95,7 @@ public class CallParticipantState
/**
* This constant value indicates that the state of the call participant is
- * is CONNECTING - which means that a network connection to that participant
+ * CONNECTING - which means that a network connection to that participant
* is currently being established.
*/
public static final CallParticipantState CONNECTING_WITH_EARLY_MEDIA =
diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetVideoTelephony.java b/src/net/java/sip/communicator/service/protocol/OperationSetVideoTelephony.java
index 9b5ee9c48..dd7ac67f7 100644
--- a/src/net/java/sip/communicator/service/protocol/OperationSetVideoTelephony.java
+++ b/src/net/java/sip/communicator/service/protocol/OperationSetVideoTelephony.java
@@ -1,67 +1,181 @@
-/*
- * 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.service.protocol;
-
-import java.awt.*;
-
-import net.java.sip.communicator.service.protocol.event.*;
-
-/**
- * Represents an OperationSet giving access to video-specific
- * functionality in telephony such as visual Components displaying
- * video and listening to dynamic availability of such Components.
- *
- * @author Lubomir Marinov
- */
-public interface OperationSetVideoTelephony
- extends OperationSet
-{
-
- /**
- * Adds a specific VideoListener to this telephony in order to
- * receive notifications when visual/video Components are being
- * added and removed for a specific CallParticipant.
- *
- * @param participant the CallParticipant whose video the
- * specified listener is to be notified about
- * @param listener the VideoListener to be notified when
- * visual/video Components are being added or
- * removed for participant
- */
- void addVideoListener(CallParticipant participant, VideoListener listener);
-
- Component createLocalVisualComponent(CallParticipant participant,
- VideoListener listener) throws OperationFailedException;
-
- void disposeLocalVisualComponent(CallParticipant participant,
- Component component);
-
- /**
- * Gets the visual/video Components available in this telephony
- * for a specific CallParticipant.
- *
- * @param participant the CallParticipant whose videos are to
- * be retrieved
- * @return an array of the visual Components available in this
- * telephony for the specified participant
- */
- Component[] getVisualComponents(CallParticipant participant);
-
- /**
- * Removes a specific VideoListener from this telephony in
- * order to no longer have it receive notifications when visual/video
- * Components are being added and removed for a specific
- * CallParticipant.
- *
- * @param participant the CallParticipant whose video the
- * specified listener is to no longer be notified about
- * @param listener the VideoListener to no longer be notified
- * when visual/video Components are being added or
- * removed for participant
- */
- void removeVideoListener(CallParticipant participant, VideoListener listener);
-}
+/*
+ * 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.service.protocol;
+
+import java.awt.*;
+
+import net.java.sip.communicator.service.media.*;
+import net.java.sip.communicator.service.protocol.event.*;
+import net.java.sip.communicator.util.*;
+
+/**
+ * Represents an OperationSet giving access to video-specific
+ * functionality in telephony such as visual Components displaying
+ * video and listening to dynamic availability of such Components.
+ *
+ * @author Lubomir Marinov
+ */
+public interface OperationSetVideoTelephony
+ extends OperationSet
+{
+
+ /**
+ * Adds a specific VideoListener to this telephony in order to
+ * receive notifications when visual/video Components are being
+ * added and removed for a specific CallParticipant.
+ *
+ * @param participant the CallParticipant whose video the
+ * specified listener is to be notified about
+ * @param listener the VideoListener to be notified when
+ * visual/video Components are being added or
+ * removed for participant
+ */
+ public void addVideoListener(
+ CallParticipant participant, VideoListener listener);
+
+ /**
+ * Creates a visual Component which depicts the local video
+ * being streamed to a specific CallParticipant. The returned
+ * visual Component should be disposed when it is no longer
+ * required through {@link #disposeLocalVisualComponent(CallParticipant, Component) disposeLocalVisualComponent}.
+ *
+ * @param participant the CallParticipant to whom the local
+ * video which is to be depicted by the returned visual
+ * Component is being streamed
+ * @param listener if not null, a VideoListener to
+ * track the progress of the creation in case this telephony
+ * chooses to perform it asynchronously and to not return the
+ * created visual Component immediately/as the
+ * result of this method call
+ * @return a visual Component which depicts the local video
+ * being streamed to the specified CallParticipant if
+ * this telephony chooses to carry out the creation synchronously;
+ * null if this telephony chooses to create the requested
+ * visual Component asynchronously.
+ */
+ public Component createLocalVisualComponent(
+ CallParticipant participant, VideoListener listener)
+ throws OperationFailedException;
+
+ /**
+ * Disposes of a visual Component depicting the local video for
+ * a specific CallParticipant (previously obtained through
+ * {@link createLocalVisualComponent(CallParticipant, VideoListener) createLocalVisualComponent}).
+ * The disposal may include, but is not limited to, releasing the
+ * Player which provides the component and renders
+ * the local video into it, disconnecting from the video capture device.
+ *
+ * @param participant the CallParticipant for whom the visual
+ * Component depicts the local video
+ * @param component the visual Component depicting the local
+ * video to be disposed
+ */
+ public void disposeLocalVisualComponent(
+ CallParticipant participant, Component component);
+
+ /**
+ * Gets the visual/video Components available in this telephony
+ * for a specific CallParticipant.
+ *
+ * @param participant the CallParticipant whose videos are to
+ * be retrieved
+ * @return an array of the visual Components available in this
+ * telephony for the specified participant
+ */
+ public Component[] getVisualComponents(CallParticipant participant);
+
+ /**
+ * Removes a specific VideoListener from this telephony in
+ * order to no longer have it receive notifications when visual/video
+ * Components are being added and removed for a specific
+ * CallParticipant.
+ *
+ * @param participant the CallParticipant whose video the
+ * specified listener is to no longer be notified about
+ * @param listener the VideoListener to no longer be notified
+ * when visual/video Components are being added or
+ * removed for participant
+ */
+ public void removeVideoListener(
+ CallParticipant participant, VideoListener listener);
+
+ /**
+ * Sets the indicator which determines whether the streaming of local video
+ * in a specific Call is allowed. The setting does not reflect
+ * the availability of actual video capture devices, it just expresses the
+ * desire of the user to have the local video streamed in the case the
+ * system is actually able to do so.
+ *
+ * @param call the Call to allow/disallow the streaming of
+ * local video for
+ * @param allowed true to allow the streaming of local video for
+ * the specified Call; false to disallow it
+ */
+ public void setLocalVideoAllowed(Call call, boolean allowed)
+ throws OperationFailedException;
+
+ /**
+ * Gets the indicator which determines whether the streaming of local video
+ * in a specific Call is allowed. The setting does not reflect
+ * the availability of actual video capture devices, it just expresses the
+ * desire of the user to have the local video streamed in the case the
+ * system is actually able to do so.
+ *
+ * @param call the Call to get the indicator of
+ * @return true if the streaming of local video for the specified
+ * Call is allowed; otherwise, false
+ */
+ public boolean isLocalVideoAllowed(Call call);
+
+ /**
+ * The property which indicates whether a specific Call is
+ * currently streaming the local video (to a remote destination).
+ */
+ public static final String LOCAL_VIDEO_STREAMING
+ = CallSession.LOCAL_VIDEO_STREAMING;
+
+ /**
+ * Gets the indicator which determines whether a specific Call
+ * is currently streaming the local video (to a remote destination).
+ *
+ * @param call the Call to get the indicator of
+ * @return true if the specified Call is currently
+ * streaming the local video (to a remote destination); otherwise,
+ * false
+ */
+ public boolean isLocalVideoStreaming(Call call);
+
+ /**
+ * Adds a specific PropertyChangeListener to the list of
+ * listeners which get notified when the properties (e.g.
+ * {@link #LOCAL_VIDEO_STREAMING}) associated with a specific
+ * Call change their values.
+ *
+ * @param call the Call to start listening to the changes of
+ * the property values of
+ * @param listener the PropertyChangeListener to be notified
+ * when the properties associated with the specified
+ * Call change their values
+ */
+ public void addPropertyChangeListener(
+ Call call, PropertyChangeListener listener);
+
+ /**
+ * Removes a specific PropertyChangeListener from the list of
+ * listeners which get notified when the properties (e.g.
+ * {@link #LOCAL_VIDEO_STREAMING}) associated with a specific
+ * Call change their values.
+ *
+ * @param call the Call to stop listening to the changes of the
+ * property values of
+ * @param listener the PropertyChangeListener to no longer be
+ * notified when the properties associated with the specified
+ * Call change their values
+ */
+ public void removePropertyChangeListener(
+ Call call, PropertyChangeListener listener);
+}
diff --git a/src/net/java/sip/communicator/service/protocol/event/VideoEvent.java b/src/net/java/sip/communicator/service/protocol/event/VideoEvent.java
index 65ffed390..359d2e155 100644
--- a/src/net/java/sip/communicator/service/protocol/event/VideoEvent.java
+++ b/src/net/java/sip/communicator/service/protocol/event/VideoEvent.java
@@ -19,8 +19,18 @@
public class VideoEvent
extends EventObject
{
+
+ /**
+ * The video origin of a VideoEvent which is local to the
+ * executing client such as a local video capture device.
+ */
public static final int LOCAL = 1;
+ /**
+ * The video origin of a VideoEvent which is remote to the
+ * executing client such as a video being remotely streamed from a
+ * CallParticipant.
+ */
public static final int REMOTE = 2;
/**
@@ -46,6 +56,10 @@ public class VideoEvent
*/
private boolean consumed;
+ /**
+ * The origin of the video this VideoEvent notifies about which
+ * is one of {@link #LOCAL} and {@link #REMOTE}.
+ */
private final int origin;
/**
@@ -74,7 +88,8 @@ public class VideoEvent
* @param visualComponent the visual Component depicting video
* which had its availability in the source provider
* changed
- * @param origin
+ * @param origin the origin of the video the new VideoEvent is
+ * to notify about
*/
public VideoEvent(Object source, int type, Component visualComponent,
int origin)
@@ -98,6 +113,13 @@ public void consume()
consumed = true;
}
+ /**
+ * Gets the origin of the video this VideoEvent notifies about
+ * which is one of {@link #LOCAL} and {@link #REMOTE}.
+ *
+ * @return one of {@link LOCAL} and {@link #REMOTE} which specifies the
+ * origin of the video this VideoEvent notifies about
+ */
public int getOrigin()
{
return origin;
diff --git a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
index adc08374b..0a64c5f72 100644
--- a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
+++ b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
@@ -6,13 +6,13 @@ Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration,
- net.java.sip.communicator.util,
net.java.sip.communicator.service.configuration.event,
+ net.java.sip.communicator.util
Export-Package: net.java.sip.communicator.service.protocol,
- net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.protocol.aimconstants,
+ net.java.sip.communicator.service.protocol.event,
+ net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.protocol.jabberconstants,
net.java.sip.communicator.service.protocol.msnconstants,
- net.java.sip.communicator.service.protocol.yahooconstants,
- net.java.sip.communicator.service.protocol.event,
- net.java.sip.communicator.service.protocol.whiteboardobjects
+ net.java.sip.communicator.service.protocol.whiteboardobjects,
+ net.java.sip.communicator.service.protocol.yahooconstants
diff --git a/src/net/java/sip/communicator/util/PropertyChangeNotifier.java b/src/net/java/sip/communicator/util/PropertyChangeNotifier.java
new file mode 100644
index 000000000..415302ca6
--- /dev/null
+++ b/src/net/java/sip/communicator/util/PropertyChangeNotifier.java
@@ -0,0 +1,62 @@
+/*
+ * 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.util;
+
+import java.util.*;
+
+/**
+ * @author Lubomir Marinov
+ */
+public class PropertyChangeNotifier
+{
+ private final List listeners
+ = new Vector();
+
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ synchronized(listeners)
+ {
+ if (!listeners.contains(listener))
+ listeners.add(listener);
+ }
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ synchronized(listeners)
+ {
+ listeners.remove(listener);
+ }
+ }
+
+ protected void firePropertyChange(String property, Object oldValue,
+ Object newValue)
+ {
+ PropertyChangeListener[] listeners;
+ synchronized (this.listeners)
+ {
+ listeners
+ = this.listeners.toArray(
+ new PropertyChangeListener[this.listeners.size()]);
+ }
+
+ PropertyChangeEvent event = new PropertyChangeEvent(
+ getPropertyChangeSource(property, oldValue, newValue),
+ property,
+ oldValue,
+ newValue);
+
+ for (PropertyChangeListener listener : listeners)
+ listener.propertyChange(event);
+ }
+
+ protected Object getPropertyChangeSource(String property, Object oldValue,
+ Object newValue)
+ {
+ return this;
+ }
+}
diff --git a/src/net/java/sip/communicator/util/PropertyChangeSupport.java b/src/net/java/sip/communicator/util/PropertyChangeSupport.java
new file mode 100644
index 000000000..2b7ac60f9
--- /dev/null
+++ b/src/net/java/sip/communicator/util/PropertyChangeSupport.java
@@ -0,0 +1,33 @@
+/*
+ * 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.util;
+
+/**
+ * @author Lubomir Marinov
+ */
+public class PropertyChangeSupport
+ extends PropertyChangeNotifier
+{
+ private final Object source;
+
+ public PropertyChangeSupport(Object source)
+ {
+ this.source = source;
+ }
+
+ public void firePropertyChange(String property, Object oldValue,
+ Object newValue)
+ {
+ super.firePropertyChange(property, oldValue, newValue);
+ }
+
+ protected Object getPropertyChangeSource(String property, Object oldValue,
+ Object newValue)
+ {
+ return source;
+ }
+}
diff --git a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneEnhancedUI.java b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneEnhancedUI.java
index a36ccca56..165415544 100644
--- a/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneEnhancedUI.java
+++ b/src/net/java/sip/communicator/util/swing/plaf/SIPCommTabbedPaneEnhancedUI.java
@@ -36,8 +36,8 @@ public class SIPCommTabbedPaneEnhancedUI
private static final Color whiteColor = Color.white;
private static final int TAB_OVERLAP
- = new Integer(UtilActivator.getResources().
- getSettingsString("impl.gui.TAB_OVERLAP")).intValue();
+ = Integer.parseInt(UtilActivator.getResources().
+ getSettingsString("impl.gui.TAB_OVERLAP"));
private static final int PREFERRED_WIDTH = 150;
diff --git a/src/net/java/sip/communicator/util/xml/XMLUtils.java b/src/net/java/sip/communicator/util/xml/XMLUtils.java
index 66291f2b0..df8b60e99 100644
--- a/src/net/java/sip/communicator/util/xml/XMLUtils.java
+++ b/src/net/java/sip/communicator/util/xml/XMLUtils.java
@@ -254,7 +254,7 @@ public static void writeXML(Document document,
// not working for jdk 1.4
try
{
- tf.setAttribute("indent-number", new Integer(4));
+ tf.setAttribute("indent-number", 4);
}catch(Exception e){}
Transformer serializer = tf.newTransformer();