|
|
|
|
@ -8,6 +8,7 @@
|
|
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.awt.event.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import javax.swing.event.*;
|
|
|
|
|
@ -42,6 +43,9 @@ public class FirstWizardPage extends JPanel
|
|
|
|
|
|
|
|
|
|
private JLabel passLabel = new JLabel(Resources.getString("password"));
|
|
|
|
|
|
|
|
|
|
private JLabel existingAccountLabel
|
|
|
|
|
= new JLabel(Resources.getString("existingAccount"));
|
|
|
|
|
|
|
|
|
|
private JTextField uinField = new JTextField();
|
|
|
|
|
|
|
|
|
|
private JPasswordField passField = new JPasswordField();
|
|
|
|
|
@ -81,6 +85,8 @@ public class FirstWizardPage extends JPanel
|
|
|
|
|
new Object[]{"UDP", "TLS", "TCP"});
|
|
|
|
|
|
|
|
|
|
private JPanel mainPanel = new JPanel();
|
|
|
|
|
|
|
|
|
|
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
|
|
|
|
|
|
|
|
|
|
private SIPAccountRegistration registration;
|
|
|
|
|
|
|
|
|
|
@ -118,6 +124,8 @@ private void init() {
|
|
|
|
|
this.uinField.getDocument().addDocumentListener(this);
|
|
|
|
|
this.transportCombo.addItemListener(this);
|
|
|
|
|
this.rememberPassBox.setSelected(true);
|
|
|
|
|
|
|
|
|
|
existingAccountLabel.setForeground(Color.RED);
|
|
|
|
|
|
|
|
|
|
labelsPanel.add(uinLabel);
|
|
|
|
|
labelsPanel.add(passLabel);
|
|
|
|
|
@ -191,7 +199,7 @@ public Object getIdentifier() {
|
|
|
|
|
* the next page identifier - the summary page.
|
|
|
|
|
*/
|
|
|
|
|
public Object getNextPageIdentifier() {
|
|
|
|
|
return WizardPage.SUMMARY_PAGE_IDENTIFIER;
|
|
|
|
|
return nextPageIdentifier;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -222,16 +230,28 @@ public void pageShowing() {
|
|
|
|
|
* Saves the user input when the "Next" wizard buttons is clicked.
|
|
|
|
|
*/
|
|
|
|
|
public void pageNext() {
|
|
|
|
|
registration.setUin(uinField.getText());
|
|
|
|
|
registration.setPassword(new String(passField.getPassword()));
|
|
|
|
|
registration.setRememberPassword(rememberPassBox.isSelected());
|
|
|
|
|
|
|
|
|
|
registration.setServerAddress(serverField.getText());
|
|
|
|
|
registration.setServerPort(serverPortField.getText());
|
|
|
|
|
registration.setProxy(proxyField.getText());
|
|
|
|
|
registration.setProxyPort(proxyPortField.getText());
|
|
|
|
|
registration.setPreferredTransport(
|
|
|
|
|
transportCombo.getSelectedItem().toString());
|
|
|
|
|
String uin = uinField.getText();
|
|
|
|
|
|
|
|
|
|
if(isExistingAccount(uin)) {
|
|
|
|
|
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
|
|
|
|
|
uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
|
|
|
|
|
this.revalidate();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
|
|
|
|
|
uinPassPanel.remove(existingAccountLabel);
|
|
|
|
|
|
|
|
|
|
registration.setUin(uinField.getText());
|
|
|
|
|
registration.setPassword(new String(passField.getPassword()));
|
|
|
|
|
registration.setRememberPassword(rememberPassBox.isSelected());
|
|
|
|
|
|
|
|
|
|
registration.setServerAddress(serverField.getText());
|
|
|
|
|
registration.setServerPort(serverPortField.getText());
|
|
|
|
|
registration.setProxy(proxyField.getText());
|
|
|
|
|
registration.setProxyPort(proxyPortField.getText());
|
|
|
|
|
registration.setPreferredTransport(
|
|
|
|
|
transportCombo.getSelectedItem().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -367,4 +387,20 @@ public void itemStateChanged(ItemEvent e)
|
|
|
|
|
proxyPortField.setText("5060");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isExistingAccount(String accountName)
|
|
|
|
|
{
|
|
|
|
|
ProtocolProviderFactory factory
|
|
|
|
|
= SIPAccRegWizzActivator.getSIPProtocolProviderFactory();
|
|
|
|
|
|
|
|
|
|
ArrayList registeredAccounts = factory.getRegisteredAccounts();
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < registeredAccounts.size(); i ++) {
|
|
|
|
|
AccountID accountID = (AccountID) registeredAccounts.get(i);
|
|
|
|
|
|
|
|
|
|
if(accountName.equalsIgnoreCase(accountID.getUserID()))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|