Keep alive configurations added to the SIP account registration wizard.

cusax-fix
Yana Stamcheva 18 years ago
parent 9a7717c981
commit 99e8192aa1

@ -3,7 +3,7 @@ protocolDescription=The SIP protocol
uin=SIP id
password=Password
rememberPassword=Remember password
uinAndPassword=ID and Password
uinAndPassword=User name and password
advancedOptions=Advanced Options
ovverideServerOps=Override server default options
registrar=Registrar
@ -19,4 +19,11 @@ forceP2PPresence=Force peer-to-peer presence mode
offlineContactPollingPeriod=Offline contacts polling period (in s.)
subscriptionExpiration=Default subscription duration (in s.)
presenceOptions=Presence Options
error=Error
error=Error
summary=Summary
keepAlive=Keep alive
keepAliveMethod=Keep alive method
keepAliveInterval=Keep alive interval
keepAliveIntervalEx=Decimal between 1 and 3600
register=REGISTER
options=OPTIONS

@ -38,6 +38,8 @@ public class FirstWizardPage
private static String DEFAULT_SUBSCRIBE_EXPIRES = "3600";
private JPanel firstTabPanel = new JPanel(new BorderLayout());
private JPanel uinPassPanel = new JPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new JPanel();
@ -121,7 +123,33 @@ public class FirstWizardPage
private JTextField subscribeExpiresField =
new JTextField(DEFAULT_SUBSCRIBE_EXPIRES);
private JPanel mainPanel = new JPanel();
private JPanel keepAlivePanel = new JPanel(new BorderLayout(10, 10));
private JPanel keepAliveLabels = new JPanel(new GridLayout(0, 1, 5, 5));
private JPanel keepAliveValues = new JPanel(new GridLayout(0, 1, 5, 5));
private JLabel keepAliveMethodLabel
= new JLabel(Resources.getString("keepAliveMethod"));
private JLabel keepAliveIntervalLabel
= new JLabel(Resources.getString("keepAliveInterval"));
private JLabel keepAliveIntervalExampleLabel
= new JLabel(Resources.getString("keepAliveIntervalEx"));
private JComboBox keepAliveMethodBox
= new JComboBox(new Object []
{
Resources.getString("register"),
Resources.getString("options")
});
private JTextField keepAliveIntervalValue = new JTextField();
private JTabbedPane tabbedPane = new JTabbedPane();
private JPanel advancedPanel = new JPanel();
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
@ -138,7 +166,7 @@ public FirstWizardPage(SIPAccountRegistrationWizard wizard)
this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
advancedPanel.setLayout(new BoxLayout(advancedPanel, BoxLayout.Y_AXIS));
this.init();
@ -183,7 +211,10 @@ private void init()
uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("uinAndPassword")));
mainPanel.add(uinPassPanel);
firstTabPanel.add(uinPassPanel, BorderLayout.NORTH);
tabbedPane.addTab( Resources.getString("summary"),
firstTabPanel);
serverField.setEnabled(false);
serverPortField.setEnabled(false);
@ -238,7 +269,7 @@ public void actionPerformed(ActionEvent evt)
advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("advancedOptions")));
mainPanel.add(advancedOpPanel);
advancedPanel.add(advancedOpPanel);
enablePresOpButton.addActionListener(new ActionListener()
{
@ -266,12 +297,41 @@ public void actionPerformed(ActionEvent evt)
presenceOpPanel.add(labelsPresOpPanel, BorderLayout.WEST);
presenceOpPanel.add(valuesPresOpPanel, BorderLayout.CENTER);
presenceOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("presenceOptions")));
presenceOpPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("presenceOptions")));
advancedPanel.add(presenceOpPanel);
mainPanel.add(presenceOpPanel);
JPanel emptyLabelPanel = new JPanel();
emptyLabelPanel.setMaximumSize(new Dimension(40, 35));
this.add(mainPanel, BorderLayout.NORTH);
keepAliveLabels.add(keepAliveMethodLabel);
keepAliveLabels.add(keepAliveIntervalLabel);
keepAliveLabels.add(emptyLabelPanel);
this.keepAliveIntervalExampleLabel.setForeground(Color.GRAY);
this.keepAliveIntervalExampleLabel
.setFont(uinExampleLabel.getFont().deriveFont(8));
this.keepAliveIntervalExampleLabel
.setMaximumSize(new Dimension(40, 35));
this.keepAliveIntervalExampleLabel
.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
keepAliveValues.add(keepAliveMethodBox);
keepAliveValues.add(keepAliveIntervalValue);
keepAliveValues.add(keepAliveIntervalExampleLabel);
keepAlivePanel.add(keepAliveLabels, BorderLayout.WEST);
keepAlivePanel.add(keepAliveValues, BorderLayout.CENTER);
keepAlivePanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("keepAlive")));
advancedPanel.add(keepAlivePanel);
tabbedPane.addTab("Advanced", advancedPanel);
this.add(tabbedPane, BorderLayout.NORTH);
}
/**
@ -364,6 +424,9 @@ public void pageNext()
registration.setPollingPeriod(pollPeriodField.getText());
registration.setSubscriptionExpiration(subscribeExpiresField
.getText());
registration.setKeepAliveMethod(
keepAliveMethodBox.getSelectedItem().toString());
registration.setKeepAliveInterval(keepAliveIntervalValue.getText());
}
}
@ -471,6 +534,14 @@ public void loadAccount(ProtocolProviderService protocolProvider)
(String) accountID.getAccountProperties().get(
ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
String keepAliveMethod
= (String) accountID.getAccountProperties()
.get("KEEP_ALIVE_METHOD");
String keepAliveInterval
= (String) accountID.getAccountProperties()
.get("KEEP_ALIVE_INTERVAL");
uinField.setEnabled(false);
this.uinField.setText(accountID.getUserID());
@ -483,12 +554,12 @@ public void loadAccount(ProtocolProviderService protocolProvider)
serverField.setText(serverAddress);
serverField.setEnabled(false);
serverPortField.setText(serverPort);
proxyField.setText(proxyAddress);
// The order of the next two fields is important, as a changelister of the
// transportCombo sets the proxyPortField to its default
proxyField.setText(proxyAddress);
// The order of the next two fields is important, as a changelister of
// the transportCombo sets the proxyPortField to its default
transportCombo.setSelectedItem(preferredTransport);
proxyPortField.setText(proxyPort);
proxyPortField.setText(proxyPort);
if (!(serverPort.equals(DEFAULT_PORT)
|| serverPort.equals(DEFAULT_TLS_PORT))
@ -519,6 +590,9 @@ public void loadAccount(ProtocolProviderService protocolProvider)
pollPeriodField.setEnabled(false);
subscribeExpiresField.setEnabled(false);
}
keepAliveMethodBox.setSelectedItem(keepAliveMethod);
keepAliveIntervalValue.setText(keepAliveInterval);
}
/**

@ -23,21 +23,25 @@ public class SIPAccountRegistration {
private String serverAddress;
private String serverPort;
private String proxyPort;
private String proxy;
private String preferredTransport;
private boolean enablePresence;
private boolean forceP2PMode;
private String pollingPeriod;
private String subscriptionExpiration;
private String keepAliveMethod;
private String keepAliveInterval;
public String getPreferredTransport()
{
return preferredTransport;
@ -224,4 +228,44 @@ public void setPollingPeriod(String pollingPeriod) {
public void setSubscriptionExpiration(String subscriptionExpiration) {
this.subscriptionExpiration = subscriptionExpiration;
}
/**
* Returns the keep alive method.
*
* @return the keep alive method.
*/
public String getKeepAliveMethod()
{
return keepAliveMethod;
}
/**
* Sets the keep alive method.
*
* @param keepAliveMethod the keep alive method to set
*/
public void setKeepAliveMethod(String keepAliveMethod)
{
this.keepAliveMethod = keepAliveMethod;
}
/**
* Returns the keep alive interval.
*
* @return the keep alive interval
*/
public String getKeepAliveInterval()
{
return keepAliveInterval;
}
/**
* Sets the keep alive interval.
*
* @param keepAliveInterval the keep alive interval to set
*/
public void setKeepAliveInterval(String keepAliveInterval)
{
this.keepAliveInterval = keepAliveInterval;
}
}

@ -108,7 +108,7 @@ public Iterator getPages() {
* @return Iterator
*/
public Iterator getSummary() {
Hashtable summaryTable = new Hashtable();
Hashtable<String, String> summaryTable = new Hashtable<String, String>();
boolean rememberPswd = new Boolean(registration.isRememberPassword())
.booleanValue();
@ -153,6 +153,11 @@ public Iterator getSummary() {
summaryTable.put(Resources.getString("subscriptionExpiration"),
registration.getSubscriptionExpiration());
summaryTable.put(Resources.getString("keepAliveMethod"),
registration.getKeepAliveMethod());
summaryTable.put(Resources.getString("keepAliveInterval"),
registration.getKeepAliveInterval());
return summaryTable.entrySet().iterator();
}
@ -188,7 +193,8 @@ public ProtocolProviderService installAccount(
{
Hashtable accountProperties = new Hashtable();
if(registration.isRememberPassword()) {
if(registration.isRememberPassword())
{
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
@ -219,6 +225,12 @@ public ProtocolProviderService installAccount(
accountProperties.put(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION,
registration.getSubscriptionExpiration());
accountProperties.put("KEEP_ALIVE_METHOD",
registration.getKeepAliveMethod());
accountProperties.put("KEEP_ALIVE_INTERVAL",
registration.getKeepAliveInterval());
if(isModification)
{
providerFactory.uninstallAccount(protocolProvider.getAccountID());
@ -226,7 +238,8 @@ public ProtocolProviderService installAccount(
this.isModification = false;
}
try {
try
{
AccountID accountID = providerFactory.installAccount(
user, accountProperties);
@ -236,7 +249,6 @@ public ProtocolProviderService installAccount(
protocolProvider
= (ProtocolProviderService) SIPAccRegWizzActivator.bundleContext
.getService(serRef);
}
catch (IllegalArgumentException exc)
{
@ -253,7 +265,6 @@ public ProtocolProviderService installAccount(
PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
}

Loading…
Cancel
Save