aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2007-11-05 14:18:43 +0000
committerYana Stamcheva <yana@jitsi.org>2007-11-05 14:18:43 +0000
commit3507976141dbbd0c2aeb55a818a85ec54d81b2b5 (patch)
tree37117c3a153c5b34968bd7989262c4ec7b6d30a5 /src/net
parentd516483b692c3d08c448551b28ac9ecf719e2729 (diff)
downloadjitsi-3507976141dbbd0c2aeb55a818a85ec54d81b2b5.zip
jitsi-3507976141dbbd0c2aeb55a818a85ec54d81b2b5.tar.gz
jitsi-3507976141dbbd0c2aeb55a818a85ec54d81b2b5.tar.bz2
wizard modifications merged with alpha2
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccRegWizzActivator.java10
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java238
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java262
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/resources.properties1
-rw-r--r--src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java31
-rw-r--r--src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccRegWizzActivator.java14
-rw-r--r--src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java74
-rw-r--r--src/net/java/sip/communicator/plugin/gibberishaccregwizz/resources.properties1
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java272
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccRegWizzActivator.java15
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java28
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java251
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/resources.properties1
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java78
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java12
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java80
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/resources.properties4
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java148
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java19
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java93
-rwxr-xr-xsrc/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties2
-rw-r--r--src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java193
-rw-r--r--src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccRegWizzActivator.java18
-rw-r--r--src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java195
-rwxr-xr-xsrc/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties1
-rw-r--r--src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java87
-rw-r--r--src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java20
-rw-r--r--src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties12
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java538
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccRegWizzActivator.java18
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java90
-rw-r--r--src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java66
-rw-r--r--src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccRegWizzActivator.java19
-rw-r--r--src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java84
-rw-r--r--src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties1
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java194
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java19
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java197
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties1
-rw-r--r--src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java51
-rw-r--r--src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java15
-rw-r--r--src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java70
-rw-r--r--src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties2
43 files changed, 2296 insertions, 1229 deletions
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccRegWizzActivator.java
index db6240b..ef9c56a 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccRegWizzActivator.java
@@ -97,4 +97,14 @@ public class AimAccRegWizzActivator implements BundleActivator {
return browserLauncherService;
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java
index 70d74b1..cd333c8 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java
@@ -1,15 +1,13 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.aimaccregwizz;
+import java.awt.*;
import java.util.*;
-import net.java.sip.communicator.impl.gui.customcontrols.*;
-import net.java.sip.communicator.plugin.gibberishaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -19,15 +17,15 @@ import org.osgi.framework.*;
* The <tt>AimAccountRegistrationWizard</tt> is an implementation of the
* <tt>AccountRegistrationWizard</tt> for the AIM protocol. It should allow
* the user to create and configure a new AIM account.
- *
+ *
* @author Yana Stamcheva
*/
-public class AimAccountRegistrationWizard implements AccountRegistrationWizard
+public class AimAccountRegistrationWizard
+ implements AccountRegistrationWizard
{
private FirstWizardPage firstWizardPage;
- private AimAccountRegistration registration
- = new AimAccountRegistration();
+ private AimAccountRegistration registration = new AimAccountRegistration();
private WizardContainer wizardContainer;
@@ -37,10 +35,11 @@ public class AimAccountRegistrationWizard implements AccountRegistrationWizard
/**
* Creates an instance of <tt>AimAccountRegistrationWizard</tt>.
- * @param wizardContainer the wizard container, where this wizard
- * is added
+ *
+ * @param wizardContainer the wizard container, where this wizard is added
*/
- public AimAccountRegistrationWizard(WizardContainer wizardContainer) {
+ public AimAccountRegistrationWizard(WizardContainer wizardContainer)
+ {
this.wizardContainer = wizardContainer;
}
@@ -48,13 +47,14 @@ public class AimAccountRegistrationWizard implements AccountRegistrationWizard
* Implements the <code>AccountRegistrationWizard.getIcon</code> method.
* Returns the icon to be used for this wizard.
*/
- public byte[] getIcon() {
+ public byte[] getIcon()
+ {
return Resources.getImage(Resources.AIM_LOGO);
}
-
+
/**
- * Implements the <code>AccountRegistrationWizard.getPageImage</code> method.
- * Returns the image used to decorate the wizard page
+ * Implements the <code>AccountRegistrationWizard.getPageImage</code>
+ * method. Returns the image used to decorate the wizard page
*
* @return byte[] the image used to decorate the wizard page
*/
@@ -62,29 +62,33 @@ public class AimAccountRegistrationWizard implements AccountRegistrationWizard
{
return Resources.getImage(Resources.PAGE_IMAGE);
}
-
+
/**
* Implements the <code>AccountRegistrationWizard.getProtocolName</code>
* method. Returns the protocol name for this wizard.
*/
- public String getProtocolName() {
+ public String getProtocolName()
+ {
return Resources.getString("protocolName");
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolDescription
- * </code> method. Returns the description of the protocol for this wizard.
+ * </code>
+ * method. Returns the description of the protocol for this wizard.
*/
- public String getProtocolDescription() {
+ public String getProtocolDescription()
+ {
return Resources.getString("protocolDescription");
}
/**
* Returns the set of pages contained in this wizard.
*/
- public Iterator getPages() {
+ public Iterator getPages()
+ {
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -94,106 +98,124 @@ public class AimAccountRegistrationWizard implements AccountRegistrationWizard
/**
* Returns the set of data that user has entered through this wizard.
*/
- public Iterator getSummary() {
+ public Iterator getSummary()
+ {
Hashtable summaryTable = new Hashtable();
summaryTable.put("UIN", registration.getUin());
- summaryTable.put("Remember password",
- new Boolean(registration.isRememberPassword()));
-
- if(registration.getProxy() != null)
- summaryTable.put(Resources.getString("proxy"),
- registration.getProxy());
-
- if(registration.getProxyPort() != null)
- summaryTable.put(Resources.getString("proxyPort"),
- registration.getProxyPort());
-
- if(registration.getProxyType() != null)
- summaryTable.put(Resources.getString("proxyType"),
- registration.getProxyType());
-
- if(registration.getProxyPort() != null)
- summaryTable.put(Resources.getString("proxyUsername"),
- registration.getProxyPort());
-
- if(registration.getProxyType() != null)
- summaryTable.put(Resources.getString("proxyPassword"),
- registration.getProxyType());
-
+ summaryTable.put("Remember password", new Boolean(registration
+ .isRememberPassword()));
+
+ if (registration.getProxy() != null)
+ summaryTable.put(Resources.getString("proxy"), registration
+ .getProxy());
+
+ if (registration.getProxyPort() != null)
+ summaryTable.put(Resources.getString("proxyPort"), registration
+ .getProxyPort());
+
+ if (registration.getProxyType() != null)
+ summaryTable.put(Resources.getString("proxyType"), registration
+ .getProxyType());
+
+ if (registration.getProxyPort() != null)
+ summaryTable.put(Resources.getString("proxyUsername"), registration
+ .getProxyPort());
+
+ if (registration.getProxyType() != null)
+ summaryTable.put(Resources.getString("proxyPassword"), registration
+ .getProxyType());
+
return summaryTable.entrySet().iterator();
}
/**
* Installs the account created through this wizard.
*/
- public ProtocolProviderService finish() {
+ public ProtocolProviderService finish()
+ {
firstWizardPage = null;
- ProtocolProviderFactory factory
- = AimAccRegWizzActivator.getAimProtocolProviderFactory();
+ ProtocolProviderFactory factory =
+ AimAccRegWizzActivator.getAimProtocolProviderFactory();
- return this.installAccount(factory,
- registration.getUin(), registration.getPassword());
+ return this.installAccount(factory, registration.getUin(), registration
+ .getPassword());
}
/**
* Creates an account for the given user and password.
- * @param providerFactory the ProtocolProviderFactory which will create
- * the account
+ *
+ * @param providerFactory the ProtocolProviderFactory which will create the
+ * account
* @param user the user identifier
* @param passwd the password
* @return the <tt>ProtocolProviderService</tt> for the new account.
*/
public ProtocolProviderService installAccount(
- ProtocolProviderFactory providerFactory,
- String user,
- String passwd) {
-
+ ProtocolProviderFactory providerFactory, String user, String passwd)
+ {
Hashtable accountProperties = new Hashtable();
- if(registration.isRememberPassword()) {
+ if (registration.isRememberPassword())
+ {
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
- if(registration.getProxyType() != null)
+ if (registration.getProxyType() != null)
{
- accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
- registration.getProxy());
+ if (registration.getProxy() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
+ registration.getProxy());
- accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
- registration.getProxyPort());
+ if (registration.getProxyPort() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
+ registration.getProxyPort());
- accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
- registration.getProxyType());
+ if (registration.getProxyType() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
+ registration.getProxyType());
- accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
- registration.getProxyUsername());
+ if (registration.getProxyUsername() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
+ registration.getProxyUsername());
- accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
- registration.getProxyPassword());
+ if (registration.getProxyPassword() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
+ registration.getProxyPassword());
}
- if(isModification) {
+ if (isModification)
+ {
providerFactory.uninstallAccount(protocolProvider.getAccountID());
this.protocolProvider = null;
+ this.isModification = false;
}
- try {
- AccountID accountID = providerFactory.installAccount(
- user, accountProperties);
+ try
+ {
+ AccountID accountID =
+ providerFactory.installAccount(user, accountProperties);
- ServiceReference serRef = providerFactory
- .getProviderForAccount(accountID);
+ ServiceReference serRef =
+ providerFactory.getProviderForAccount(accountID);
- protocolProvider
- = (ProtocolProviderService) AimAccRegWizzActivator.bundleContext
+ protocolProvider =
+ (ProtocolProviderService) AimAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
+ catch (IllegalArgumentException e)
+ {
+ AimAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
- catch (IllegalStateException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
+ catch (IllegalStateException e)
+ {
+ AimAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
@@ -202,15 +224,59 @@ public class AimAccountRegistrationWizard implements AccountRegistrationWizard
/**
* Fills the UIN and Password fields in this panel with the data comming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
+ this.isModification = true;
this.protocolProvider = protocolProvider;
this.firstWizardPage.loadAccount(protocolProvider);
+ }
- this.isModification = true;
- }
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
+
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public AimAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java
index 3533308..12bee89 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java
@@ -1,8 +1,7 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.aimaccregwizz;
@@ -19,14 +18,15 @@ import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the uin
* and the password of the account.
- *
+ *
* @author Yana Stamcheva
*/
-public class FirstWizardPage extends JPanel
+public class FirstWizardPage
+ extends JPanel
implements WizardPage,
DocumentListener,
- ActionListener {
-
+ ActionListener
+{
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
private JPanel uinPassPanel = new JPanel(new BorderLayout(10, 10));
@@ -41,8 +41,8 @@ public class FirstWizardPage extends JPanel
private JPanel valuesAdvOpPanel = new JPanel(new GridLayout(0, 1, 10, 10));
- private JCheckBox enableAdvOpButton = new JCheckBox(
- Resources.getString("ovverideServerOps"), false);
+ private JCheckBox enableAdvOpButton =
+ new JCheckBox(Resources.getString("ovverideServerOps"), false);
private JLabel uinLabel = new JLabel(Resources.getString("uin"));
@@ -52,36 +52,39 @@ public class FirstWizardPage extends JPanel
private JLabel passLabel = new JLabel(Resources.getString("password"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("existingAccount"));
+ private JLabel existingAccountLabel =
+ new JLabel(Resources.getString("existingAccount"));
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
- private JCheckBox rememberPassBox = new JCheckBox(
- Resources.getString("rememberPassword"));
+ private JCheckBox rememberPassBox =
+ new JCheckBox(Resources.getString("rememberPassword"));
private JPanel registerPanel = new JPanel(new GridLayout(0, 1));
- private JPanel buttonPanel = new JPanel(
- new FlowLayout(FlowLayout.CENTER));
+ private JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- private JTextArea registerArea = new JTextArea(
- Resources.getString("registerNewAccountText"));
+ private JTextArea registerArea =
+ new JTextArea(Resources.getString("registerNewAccountText"));
- private JButton registerButton = new JButton(
- Resources.getString("registerNewAccount"));
+ private JButton registerButton =
+ new JButton(Resources.getString("registerNewAccount"));
private JLabel proxyLabel = new JLabel(Resources.getString("proxy"));
- private JLabel proxyPortLabel = new JLabel(Resources.getString("proxyPort"));
+ private JLabel proxyPortLabel =
+ new JLabel(Resources.getString("proxyPort"));
- private JLabel proxyUsernameLabel = new JLabel(Resources.getString("proxyUsername"));
+ private JLabel proxyUsernameLabel =
+ new JLabel(Resources.getString("proxyUsername"));
- private JLabel proxyPasswordLabel = new JLabel(Resources.getString("proxyPassword"));
+ private JLabel proxyPasswordLabel =
+ new JLabel(Resources.getString("proxyPassword"));
- private JLabel proxyTypeLabel = new JLabel(Resources.getString("proxyType"));
+ private JLabel proxyTypeLabel =
+ new JLabel(Resources.getString("proxyType"));
private JTextField proxyField = new JTextField();
@@ -91,32 +94,26 @@ public class FirstWizardPage extends JPanel
private JPasswordField proxyPassField = new JPasswordField();
- private JComboBox proxyTypeCombo = new JComboBox(
- new Object[]{"http", "socks5", "socks4"});
+ private JComboBox proxyTypeCombo = new JComboBox(new Object[]
+ { "http", "socks5", "socks4" });
private JPanel mainPanel = new JPanel();
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private AimAccountRegistration registration;
-
- private WizardContainer wizardContainer;
+ private AimAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
- * @param registration the <tt>AimAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ *
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(AimAccountRegistration registration,
- WizardContainer wizardContainer) {
+ public FirstWizardPage( AimAccountRegistrationWizard wizard)
+ {
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
+ this.wizard = wizard;
this.setPreferredSize(new Dimension(600, 500));
@@ -126,15 +123,18 @@ public class FirstWizardPage extends JPanel
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- this.labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
+ this.labelsPanel
+ .setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
- this.valuesPanel.setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
+ this.valuesPanel
+ .setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
}
/**
* Initializes all panels, buttons, etc.
*/
- private void init() {
+ private void init()
+ {
this.registerButton.addActionListener(this);
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
@@ -144,7 +144,8 @@ public class FirstWizardPage extends JPanel
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
- this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
+ this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8,
+ 0));
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
@@ -158,8 +159,8 @@ public class FirstWizardPage extends JPanel
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
- uinPassPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("uinAndPassword")));
+ uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("uinAndPassword")));
mainPanel.add(uinPassPanel);
@@ -167,15 +168,18 @@ public class FirstWizardPage extends JPanel
proxyPortField.setEditable(false);
proxyTypeCombo.setEnabled(false);
- enableAdvOpButton.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent evt) {
+ enableAdvOpButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
// Perform action
- JCheckBox cb = (JCheckBox)evt.getSource();
+ JCheckBox cb = (JCheckBox) evt.getSource();
proxyField.setEditable(cb.isSelected());
proxyPortField.setEditable(cb.isSelected());
proxyTypeCombo.setEnabled(cb.isSelected());
- }});
+ }
+ });
proxyTypeCombo.setSelectedItem("http");
@@ -195,13 +199,11 @@ public class FirstWizardPage extends JPanel
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
- advancedOpPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString(
- "advancedOptions")));
+ advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("advancedOptions")));
mainPanel.add(advancedOpPanel);
-
this.buttonPanel.add(registerButton);
this.registerArea.setEditable(false);
@@ -211,8 +213,8 @@ public class FirstWizardPage extends JPanel
this.registerPanel.add(registerArea);
this.registerPanel.add(buttonPanel);
- this.registerPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("registerNewAccount")));
+ this.registerPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("registerNewAccount")));
mainPanel.add(registerPanel);
@@ -220,10 +222,11 @@ public class FirstWizardPage extends JPanel
}
/**
- * Implements the <code>WizardPage.getIdentifier</code> to return
- * this page identifier.
+ * Implements the <code>WizardPage.getIdentifier</code> to return this
+ * page identifier.
*/
- public Object getIdentifier() {
+ public Object getIdentifier()
+ {
return FIRST_PAGE_IDENTIFIER;
}
@@ -231,7 +234,8 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
*/
- public Object getNextPageIdentifier() {
+ public Object getNextPageIdentifier()
+ {
return nextPageIdentifier;
}
@@ -239,15 +243,17 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getBackPageIdentifier</code> to return
* the next back identifier - the default page.
*/
- public Object getBackPageIdentifier() {
+ public Object getBackPageIdentifier()
+ {
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
}
/**
- * Implements the <code>WizardPage.getWizardForm</code> to return
- * this panel.
+ * Implements the <code>WizardPage.getWizardForm</code> to return this
+ * panel.
*/
- public Object getWizardForm() {
+ public Object getWizardForm()
+ {
return this;
}
@@ -255,60 +261,75 @@ public class FirstWizardPage extends JPanel
* Before this page is displayed enables or disables the "Next" wizard
* button according to whether the UIN field is empty.
*/
- public void pageShowing() {
+ public void pageShowing()
+ {
this.setNextButtonAccordingToUIN();
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
*/
- public void pageNext() {
+ public void pageNext()
+ {
String uin = uinField.getText();
- if(isExistingAccount(uin)) {
+ if (!wizard.isModification() && isExistingAccount(uin))
+ {
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
this.revalidate();
}
- else {
+ else
+ {
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
uinPassPanel.remove(existingAccountLabel);
+ AimAccountRegistration registration = wizard.getRegistration();
+
registration.setUin(uin);
registration.setPassword(new String(passField.getPassword()));
registration.setRememberPassword(rememberPassBox.isSelected());
- if(enableAdvOpButton.isSelected())
+ if (enableAdvOpButton.isSelected())
{
registration.setProxy(proxyField.getText());
registration.setProxyPort(proxyPortField.getText());
- registration.setProxyType(
- proxyTypeCombo.getSelectedItem().toString());
registration.setProxyUsername(proxyUsernameField.getText());
- registration.setProxyPassword(new String(proxyPassField.getPassword()));
+
+ if (proxyTypeCombo.getSelectedItem() != null)
+ registration.setProxyType(proxyTypeCombo.getSelectedItem()
+ .toString());
+
+ if (proxyPassField.getPassword() != null)
+ registration.setProxyPassword(new String(proxyPassField
+ .getPassword()));
}
}
}
/**
- * Enables or disables the "Next" wizard button according to whether the
- * UIN field is empty.
+ * Enables or disables the "Next" wizard button according to whether the UIN
+ * field is empty.
*/
- private void setNextButtonAccordingToUIN() {
- if (uinField.getText() == null || uinField.getText().equals("")) {
- wizardContainer.setNextFinishButtonEnabled(false);
+ private void setNextButtonAccordingToUIN()
+ {
+ if (uinField.getText() == null || uinField.getText().equals(""))
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
- else {
- wizardContainer.setNextFinishButtonEnabled(true);
+ else
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
/**
- * Handles the <tt>DocumentEvent</tt> triggered when user types in the
- * UIN field. Enables or disables the "Next" wizard button according to
- * whether the UIN field is empty.
+ * Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
+ * field. Enables or disables the "Next" wizard button according to whether
+ * the UIN field is empty.
*/
- public void insertUpdate(DocumentEvent e) {
+ public void insertUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
@@ -317,55 +338,77 @@ public class FirstWizardPage extends JPanel
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
*/
- public void removeUpdate(DocumentEvent e) {
+ public void removeUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
- public void changedUpdate(DocumentEvent e) {
+ public void changedUpdate(DocumentEvent e)
+ {
}
- public void pageHiding() {
+ public void pageHiding()
+ {
}
- public void pageShown() {
+ public void pageShown()
+ {
}
- public void pageBack() {
+ public void pageBack()
+ {
}
/**
* Fills the UIN and Password fields in this panel with the data comming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
AccountID accountID = protocolProvider.getAccountID();
- String password = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PASSWORD);
+ String password =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PASSWORD);
+ this.uinField.setEnabled(false);
this.uinField.setText(accountID.getUserID());
- if(password != null) {
+ if (password != null)
+ {
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
- String proxyAddress = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_ADDRESS);
+ String proxyAddress =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_ADDRESS);
+
+ String proxyPort =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_PORT);
- String proxyPort = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_PORT);
+ String proxyType =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_TYPE);
- String proxyType = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_TYPE);
+ String proxyUsername =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_USERNAME);
- String proxyUsername = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_USERNAME);
+ String proxyPassword =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_PASSWORD);
- String proxyPassword = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_PASSWORD);
+ if (proxyAddress != null || proxyPort != null
+ || proxyType != null || proxyUsername != null
+ || proxyPassword != null)
+ {
+ enableAdvOpButton.setSelected(true);
+ }
proxyField.setText(proxyAddress);
proxyPortField.setText(proxyPort);
@@ -376,8 +419,10 @@ public class FirstWizardPage extends JPanel
public void actionPerformed(ActionEvent e)
{
- AimAccRegWizzActivator.getBrowserLauncher()
- .openURL("http://my.screenname.aol.com/_cqr/login/login.psp?seamless=n&createSn=1");
+ AimAccRegWizzActivator
+ .getBrowserLauncher()
+ .openURL(
+ "http://my.screenname.aol.com/_cqr/login/login.psp?seamless=n&createSn=1");
}
/**
@@ -385,19 +430,20 @@ public class FirstWizardPage extends JPanel
*
* @param accountName the name of the account to check
* @return TRUE, if an account with the given name already exists, FALSE -
- * otherwise
+ * otherwise
*/
private boolean isExistingAccount(String accountName)
{
- ProtocolProviderFactory factory
- = AimAccRegWizzActivator.getAimProtocolProviderFactory();
+ ProtocolProviderFactory factory =
+ AimAccRegWizzActivator.getAimProtocolProviderFactory();
ArrayList registeredAccounts = factory.getRegisteredAccounts();
- for(int i = 0; i < registeredAccounts.size(); i ++) {
+ for (int i = 0; i < registeredAccounts.size(); i++)
+ {
AccountID accountID = (AccountID) registeredAccounts.get(i);
- if(accountName.equalsIgnoreCase(accountID.getUserID()))
+ if (accountName.equalsIgnoreCase(accountID.getUserID()))
return true;
}
return false;
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/aimaccregwizz/resources.properties
index f749fa2..5481395 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/resources.properties
@@ -14,6 +14,7 @@ proxyPort=Proxy port
proxyType=Proxy type
proxyUsername=Proxy username
proxyPassword=Proxy password
+error=Error
protocolIcon=resources/images/aim/aim16x16-online.png
pageImage=resources/images/aim/aim64x64.png
diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java
index 5a22d90..7365c97 100644
--- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java
@@ -55,28 +55,20 @@ public class FirstWizardPage
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private GibberishAccountRegistration registration = null;
-
- private WizardContainer wizardContainer;
+ private GibberishAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
* @param registration the <tt>GibberishAccountRegistration</tt>, where
* all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(GibberishAccountRegistration registration,
- WizardContainer wizardContainer)
+ public FirstWizardPage(GibberishAccountRegistrationWizard wizard)
{
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(300, 150));
+ this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
@@ -185,7 +177,7 @@ public class FirstWizardPage
{
String userID = userIDField.getText();
- if (isExistingAccount(userID))
+ if (!wizard.isModification() && isExistingAccount(userID))
{
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
userPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
@@ -196,8 +188,14 @@ public class FirstWizardPage
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
userPassPanel.remove(existingAccountLabel);
+ GibberishAccountRegistration registration
+ = wizard.getRegistration();
+
registration.setUserID(userIDField.getText());
- registration.setPassword(new String(passField.getPassword()));
+
+ if (passField.getPassword() != null)
+ registration.setPassword(new String(passField.getPassword()));
+
registration.setRememberPassword(rememberPassBox.isSelected());
}
}
@@ -210,11 +208,11 @@ public class FirstWizardPage
{
if (userIDField.getText() == null || userIDField.getText().equals(""))
{
- wizardContainer.setNextFinishButtonEnabled(false);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
else
{
- wizardContainer.setNextFinishButtonEnabled(true);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
@@ -270,6 +268,7 @@ public class FirstWizardPage
String password = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.PASSWORD);
+ this.userIDField.setEnabled(false);
this.userIDField.setText(accountID.getUserID());
if (password != null)
diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccRegWizzActivator.java
index 19a659a..496092e 100644
--- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccRegWizzActivator.java
@@ -38,6 +38,8 @@ public class GibberishAccRegWizzActivator
private static GibberishAccountRegistrationWizard gibberishWizard;
+ private static UIService uiService;
+
/**
* Starts this bundle.
* @param bc the currently valid <tt>BundleContext</tt>.
@@ -51,7 +53,7 @@ public class GibberishAccRegWizzActivator
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService = (UIService) bundleContext.getService(uiServiceRef);
+ uiService = (UIService) bundleContext.getService(uiServiceRef);
wizardContainer = uiService.getAccountRegWizardContainer();
@@ -109,4 +111,14 @@ public class GibberishAccRegWizzActivator
{
return bundleContext;
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java
index 4b7d717..d33dfc1 100644
--- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java
@@ -6,10 +6,11 @@
*/
package net.java.sip.communicator.plugin.gibberishaccregwizz;
+import java.awt.*;
import java.util.*;
import org.osgi.framework.*;
-import net.java.sip.communicator.impl.gui.customcontrols.*;
+
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -103,7 +104,7 @@ public class GibberishAccountRegistrationWizard
public Iterator getPages()
{
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -153,8 +154,15 @@ public class GibberishAccountRegistrationWizard
if (registration.isRememberPassword())
{
- accountProperties.put(ProtocolProviderFactory.PASSWORD
- , registration.getPassword());
+ accountProperties.put( ProtocolProviderFactory.PASSWORD,
+ registration.getPassword());
+ }
+
+ if (isModification)
+ {
+ providerFactory.uninstallAccount(protocolProvider.getAccountID());
+ this.protocolProvider = null;
+ this.isModification = false;
}
try
@@ -171,11 +179,17 @@ public class GibberishAccountRegistrationWizard
}
catch (IllegalArgumentException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ GibberishAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
catch (IllegalStateException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ GibberishAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
@@ -189,11 +203,55 @@ public class GibberishAccountRegistrationWizard
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new GibberishAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
+ }
+
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
+
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public GibberishAccountRegistration getRegistration()
+ {
+ return registration;
+ }
- isModification = true;
- }
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/resources.properties
index 0852e0d..eb5f920 100644
--- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/resources.properties
@@ -5,6 +5,7 @@ password=Password:
rememberPassword=Remember password
userAndPassword=Identification
existingAccount=* The account you entered is already installed.
+error=Error
protocolIcon=resources/images/gibberish/gibberish-online.png
pageImage=resources/images/gibberish/gibberish64x64.png
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java
index 69f0614..7fcd7c5 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java
@@ -1,8 +1,7 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.icqaccregwizz;
@@ -19,13 +18,13 @@ import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the uin
* and the password of the account.
- *
+ *
* @author Yana Stamcheva
*/
-public class FirstWizardPage extends JPanel
- implements WizardPage,
- DocumentListener,
- ActionListener {
+public class FirstWizardPage
+ extends JPanel
+ implements WizardPage, DocumentListener, ActionListener
+{
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
@@ -41,8 +40,8 @@ public class FirstWizardPage extends JPanel
private JPanel valuesAdvOpPanel = new JPanel(new GridLayout(0, 1, 10, 10));
- private JCheckBox enableAdvOpButton = new JCheckBox(
- Resources.getString("ovverideServerOps"), false);
+ private JCheckBox enableAdvOpButton =
+ new JCheckBox(Resources.getString("ovverideServerOps"), false);
private JLabel uinLabel = new JLabel(Resources.getString("uin"));
@@ -52,36 +51,39 @@ public class FirstWizardPage extends JPanel
private JLabel passLabel = new JLabel(Resources.getString("password"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("existingAccount"));
+ private JLabel existingAccountLabel =
+ new JLabel(Resources.getString("existingAccount"));
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
- private JCheckBox rememberPassBox = new JCheckBox(
- Resources.getString("rememberPassword"));
+ private JCheckBox rememberPassBox =
+ new JCheckBox(Resources.getString("rememberPassword"));
private JPanel registerPanel = new JPanel(new GridLayout(0, 1));
- private JPanel buttonPanel = new JPanel(
- new FlowLayout(FlowLayout.CENTER));
+ private JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- private JTextArea registerArea = new JTextArea(
- Resources.getString("registerNewAccountText"));
+ private JTextArea registerArea =
+ new JTextArea(Resources.getString("registerNewAccountText"));
- private JButton registerButton = new JButton(
- Resources.getString("registerNewAccount"));
+ private JButton registerButton =
+ new JButton(Resources.getString("registerNewAccount"));
private JLabel proxyLabel = new JLabel(Resources.getString("proxy"));
- private JLabel proxyPortLabel = new JLabel(Resources.getString("proxyPort"));
+ private JLabel proxyPortLabel =
+ new JLabel(Resources.getString("proxyPort"));
- private JLabel proxyUsernameLabel = new JLabel(Resources.getString("proxyUsername"));
+ private JLabel proxyUsernameLabel =
+ new JLabel(Resources.getString("proxyUsername"));
- private JLabel proxyPasswordLabel = new JLabel(Resources.getString("proxyPassword"));
+ private JLabel proxyPasswordLabel =
+ new JLabel(Resources.getString("proxyPassword"));
- private JLabel proxyTypeLabel = new JLabel(Resources.getString("proxyType"));
+ private JLabel proxyTypeLabel =
+ new JLabel(Resources.getString("proxyType"));
private JTextField proxyField = new JTextField();
@@ -91,32 +93,25 @@ public class FirstWizardPage extends JPanel
private JPasswordField proxyPassField = new JPasswordField();
- private JComboBox proxyTypeCombo = new JComboBox(
- new Object[]{"http", "socks5", "socks4"});
+ private JComboBox proxyTypeCombo = new JComboBox(new Object[]
+ { "http", "socks5", "socks4" });
private JPanel mainPanel = new JPanel();
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private IcqAccountRegistration registration;
-
- private WizardContainer wizardContainer;
+ private IcqAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
- * @param registration the <tt>IcqAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ *
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(IcqAccountRegistration registration,
- WizardContainer wizardContainer) {
-
+ public FirstWizardPage(IcqAccountRegistrationWizard wizard)
+ {
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
+ this.wizard = wizard;
this.setPreferredSize(new Dimension(600, 500));
@@ -126,15 +121,18 @@ public class FirstWizardPage extends JPanel
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- this.labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
+ this.labelsPanel
+ .setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
- this.valuesPanel.setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
+ this.valuesPanel
+ .setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
}
/**
* Initializes all panels, buttons, etc.
*/
- private void init() {
+ private void init()
+ {
this.registerButton.addActionListener(this);
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
@@ -144,7 +142,8 @@ public class FirstWizardPage extends JPanel
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
- this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
+ this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8,
+ 0));
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
@@ -158,24 +157,31 @@ public class FirstWizardPage extends JPanel
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
- uinPassPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("uinAndPassword")));
+ uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("uinAndPassword")));
mainPanel.add(uinPassPanel);
proxyField.setEditable(false);
proxyPortField.setEditable(false);
proxyTypeCombo.setEnabled(false);
+ proxyUsernameField.setEditable(false);
+ proxyPassField.setEditable(false);
- enableAdvOpButton.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent evt) {
+ enableAdvOpButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
// Perform action
- JCheckBox cb = (JCheckBox)evt.getSource();
+ JCheckBox cb = (JCheckBox) evt.getSource();
proxyField.setEditable(cb.isSelected());
proxyPortField.setEditable(cb.isSelected());
proxyTypeCombo.setEnabled(cb.isSelected());
- }});
+ proxyUsernameField.setEditable(cb.isSelected());
+ proxyPassField.setEditable(cb.isSelected());
+ }
+ });
proxyTypeCombo.setSelectedItem("http");
@@ -195,13 +201,11 @@ public class FirstWizardPage extends JPanel
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
- advancedOpPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString(
- "advancedOptions")));
+ advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("advancedOptions")));
mainPanel.add(advancedOpPanel);
-
this.buttonPanel.add(registerButton);
this.registerArea.setEditable(false);
@@ -211,8 +215,8 @@ public class FirstWizardPage extends JPanel
this.registerPanel.add(registerArea);
this.registerPanel.add(buttonPanel);
- this.registerPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("registerNewAccount")));
+ this.registerPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("registerNewAccount")));
mainPanel.add(registerPanel);
@@ -220,10 +224,11 @@ public class FirstWizardPage extends JPanel
}
/**
- * Implements the <code>WizardPage.getIdentifier</code> to return
- * this page identifier.
+ * Implements the <code>WizardPage.getIdentifier</code> to return this
+ * page identifier.
*/
- public Object getIdentifier() {
+ public Object getIdentifier()
+ {
return FIRST_PAGE_IDENTIFIER;
}
@@ -231,7 +236,8 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
*/
- public Object getNextPageIdentifier() {
+ public Object getNextPageIdentifier()
+ {
return nextPageIdentifier;
}
@@ -239,15 +245,17 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getBackPageIdentifier</code> to return
* the next back identifier - the default page.
*/
- public Object getBackPageIdentifier() {
+ public Object getBackPageIdentifier()
+ {
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
}
/**
- * Implements the <code>WizardPage.getWizardForm</code> to return
- * this panel.
+ * Implements the <code>WizardPage.getWizardForm</code> to return this
+ * panel.
*/
- public Object getWizardForm() {
+ public Object getWizardForm()
+ {
return this;
}
@@ -255,60 +263,77 @@ public class FirstWizardPage extends JPanel
* Before this page is displayed enables or disables the "Next" wizard
* button according to whether the UIN field is empty.
*/
- public void pageShowing() {
+ public void pageShowing()
+ {
this.setNextButtonAccordingToUIN();
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
*/
- public void pageNext() {
+ public void pageNext()
+ {
String uin = uinField.getText();
- if(isExistingAccount(uin)) {
+ if (!wizard.isModification() && isExistingAccount(uin))
+ {
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
this.revalidate();
}
- else {
+ else
+ {
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
uinPassPanel.remove(existingAccountLabel);
+ IcqAccountRegistration registration = wizard.getRegistration();
+
registration.setUin(uin);
registration.setPassword(new String(passField.getPassword()));
registration.setRememberPassword(rememberPassBox.isSelected());
- if(enableAdvOpButton.isSelected())
+ if (enableAdvOpButton.isSelected())
{
+ registration.setAdvancedSettingsEnabled(true);
registration.setProxy(proxyField.getText());
registration.setProxyPort(proxyPortField.getText());
- registration.setProxyType(
- proxyTypeCombo.getSelectedItem().toString());
+
+ if (proxyTypeCombo.getSelectedItem() != null)
+ registration.setProxyType(
+ proxyTypeCombo.getSelectedItem().toString());
+
registration.setProxyUsername(proxyUsernameField.getText());
- registration.setProxyPassword(new String(proxyPassField.getPassword()));
+
+ if (proxyPassField.getPassword() != null)
+ registration.setProxyPassword(
+ new String(proxyPassField.getPassword()));
}
}
}
/**
- * Enables or disables the "Next" wizard button according to whether the
- * UIN field is empty.
+ * Enables or disables the "Next" wizard button according to whether the UIN
+ * field is empty.
*/
- private void setNextButtonAccordingToUIN() {
- if (uinField.getText() == null || uinField.getText().equals("")) {
- wizardContainer.setNextFinishButtonEnabled(false);
+ private void setNextButtonAccordingToUIN()
+ {
+ if (uinField.getText() == null || uinField.getText().equals(""))
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
- else {
- wizardContainer.setNextFinishButtonEnabled(true);
+ else
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
/**
- * Handles the <tt>DocumentEvent</tt> triggered when user types in the
- * UIN field. Enables or disables the "Next" wizard button according to
- * whether the UIN field is empty.
+ * Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
+ * field. Enables or disables the "Next" wizard button according to whether
+ * the UIN field is empty.
*/
- public void insertUpdate(DocumentEvent e) {
+ public void insertUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
@@ -317,55 +342,78 @@ public class FirstWizardPage extends JPanel
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
*/
- public void removeUpdate(DocumentEvent e) {
+ public void removeUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
- public void changedUpdate(DocumentEvent e) {
+ public void changedUpdate(DocumentEvent e)
+ {
}
- public void pageHiding() {
+ public void pageHiding()
+ {
}
- public void pageShown() {
+ public void pageShown()
+ {
}
- public void pageBack() {
+ public void pageBack()
+ {
}
/**
* Fills the UIN and Password fields in this panel with the data comming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
AccountID accountID = protocolProvider.getAccountID();
- String password = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PASSWORD);
+ String password =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PASSWORD);
this.uinField.setText(accountID.getUserID());
- if(password != null) {
+ this.uinField.setEnabled(false);
+
+ if (password != null)
+ {
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
- String proxyAddress = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_ADDRESS);
+ String proxyAddress =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_ADDRESS);
+
+ String proxyPort =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_PORT);
- String proxyPort = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_PORT);
+ String proxyType =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_TYPE);
- String proxyType = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_TYPE);
+ String proxyUsername =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_USERNAME);
- String proxyUsername = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_USERNAME);
+ String proxyPassword =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_PASSWORD);
- String proxyPassword = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_PASSWORD);
+ if (proxyAddress != null || proxyPort != null
+ || proxyType != null || proxyUsername != null
+ || proxyPassword != null)
+ {
+ enableAdvOpButton.setSelected(true);
+ }
proxyField.setText(proxyAddress);
proxyPortField.setText(proxyPort);
@@ -374,10 +422,13 @@ public class FirstWizardPage extends JPanel
proxyPassField.setText(proxyPassword);
}
+ /**
+ *
+ */
public void actionPerformed(ActionEvent e)
{
- IcqAccRegWizzActivator.getBrowserLauncher()
- .openURL("https://www.icq.com/register/");
+ IcqAccRegWizzActivator.getBrowserLauncher().openURL(
+ "https://www.icq.com/register/");
}
/**
@@ -385,19 +436,20 @@ public class FirstWizardPage extends JPanel
*
* @param accountName the name of the account to check
* @return TRUE, if an account with the given name already exists, FALSE -
- * otherwise
+ * otherwise
*/
private boolean isExistingAccount(String accountName)
{
- ProtocolProviderFactory factory
- = IcqAccRegWizzActivator.getIcqProtocolProviderFactory();
+ ProtocolProviderFactory factory =
+ IcqAccRegWizzActivator.getIcqProtocolProviderFactory();
ArrayList registeredAccounts = factory.getRegisteredAccounts();
- for(int i = 0; i < registeredAccounts.size(); i ++) {
+ for (int i = 0; i < registeredAccounts.size(); i++)
+ {
AccountID accountID = (AccountID) registeredAccounts.get(i);
- if(accountName.equalsIgnoreCase(accountID.getUserID()))
+ if (accountName.equalsIgnoreCase(accountID.getUserID()))
return true;
}
return false;
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccRegWizzActivator.java
index fb75e5f..5acffa1 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccRegWizzActivator.java
@@ -31,6 +31,8 @@ public class IcqAccRegWizzActivator implements BundleActivator {
private static IcqAccountRegistrationWizard icqWizard;
+ private static UIService uiService;
+
/**
* Starts this bundle.
*/
@@ -41,8 +43,7 @@ public class IcqAccRegWizzActivator implements BundleActivator {
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService
- = (UIService) bundleContext.getService(uiServiceRef);
+ uiService = (UIService) bundleContext.getService(uiServiceRef);
wizardContainer = uiService.getAccountRegWizardContainer();
@@ -96,4 +97,14 @@ public class IcqAccRegWizzActivator implements BundleActivator {
return browserLauncherService;
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java
index f2a96da..ba37908 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java
@@ -12,8 +12,8 @@ package net.java.sip.communicator.plugin.icqaccregwizz;
*
* @author Yana Stamcheva
*/
-public class IcqAccountRegistration {
-
+public class IcqAccountRegistration
+{
private String uin;
private String password;
@@ -30,6 +30,8 @@ public class IcqAccountRegistration {
private String proxyPassword;
+ private boolean isAdvancedSettingsEnabled = false;
+
/**
* Returns the password of the icq registration account.
* @return the password of the icq registration account.
@@ -158,4 +160,26 @@ public class IcqAccountRegistration {
public void setProxyUsername(String username) {
this.proxyUsername = username;
}
+
+ /**
+ * Indicates if the advanced server settings are enabled.
+ *
+ * @return <code>true</code> to indicate that the advanced server settings
+ * are enabled, <code>false</code> - otherwise.
+ */
+ public boolean isAdvancedSettingsEnabled()
+ {
+ return isAdvancedSettingsEnabled;
+ }
+
+ /**
+ * Enables or disables the advanced server settings.
+ *
+ * @param isAdvancedSettingsEnabled <code>true</code> to indicate that the
+ * advanced server settings are enabled, <code>false</code> - otherwise
+ */
+ public void setAdvancedSettingsEnabled(boolean isAdvancedSettingsEnabled)
+ {
+ this.isAdvancedSettingsEnabled = isAdvancedSettingsEnabled;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
index ba5efa1..c10f5f1 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
@@ -1,15 +1,13 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.icqaccregwizz;
+import java.awt.*;
import java.util.*;
-import net.java.sip.communicator.impl.gui.customcontrols.*;
-import net.java.sip.communicator.plugin.gibberishaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -19,15 +17,15 @@ import org.osgi.framework.*;
* The <tt>IcqAccountRegistrationWizard</tt> is an implementation of the
* <tt>AccountRegistrationWizard</tt> for the ICQ protocol. It should allow
* the user to create and configure a new ICQ account.
- *
+ *
* @author Yana Stamcheva
*/
-public class IcqAccountRegistrationWizard implements AccountRegistrationWizard
+public class IcqAccountRegistrationWizard
+ implements AccountRegistrationWizard
{
private FirstWizardPage firstWizardPage;
- private IcqAccountRegistration registration
- = new IcqAccountRegistration();
+ private IcqAccountRegistration registration = new IcqAccountRegistration();
private WizardContainer wizardContainer;
@@ -37,10 +35,11 @@ public class IcqAccountRegistrationWizard implements AccountRegistrationWizard
/**
* Creates an instance of <tt>IcqAccountRegistrationWizard</tt>.
- * @param wizardContainer the wizard container, where this wizard
- * is added
+ *
+ * @param wizardContainer the wizard container, where this wizard is added
*/
- public IcqAccountRegistrationWizard(WizardContainer wizardContainer) {
+ public IcqAccountRegistrationWizard(WizardContainer wizardContainer)
+ {
this.wizardContainer = wizardContainer;
}
@@ -48,13 +47,14 @@ public class IcqAccountRegistrationWizard implements AccountRegistrationWizard
* Implements the <code>AccountRegistrationWizard.getIcon</code> method.
* Returns the icon to be used for this wizard.
*/
- public byte[] getIcon() {
+ public byte[] getIcon()
+ {
return Resources.getImage(Resources.ICQ_LOGO);
}
-
+
/**
- * Implements the <code>AccountRegistrationWizard.getPageImage</code> method.
- * Returns the image used to decorate the wizard page
+ * Implements the <code>AccountRegistrationWizard.getPageImage</code>
+ * method. Returns the image used to decorate the wizard page
*
* @return byte[] the image used to decorate the wizard page
*/
@@ -62,29 +62,33 @@ public class IcqAccountRegistrationWizard implements AccountRegistrationWizard
{
return Resources.getImage(Resources.PAGE_IMAGE);
}
-
+
/**
* Implements the <code>AccountRegistrationWizard.getProtocolName</code>
* method. Returns the protocol name for this wizard.
*/
- public String getProtocolName() {
+ public String getProtocolName()
+ {
return Resources.getString("protocolName");
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolDescription
- * </code> method. Returns the description of the protocol for this wizard.
+ * </code>
+ * method. Returns the description of the protocol for this wizard.
*/
- public String getProtocolDescription() {
+ public String getProtocolDescription()
+ {
return Resources.getString("protocolDescription");
}
/**
* Returns the set of pages contained in this wizard.
*/
- public Iterator getPages() {
+ public Iterator getPages()
+ {
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -94,123 +98,194 @@ public class IcqAccountRegistrationWizard implements AccountRegistrationWizard
/**
* Returns the set of data that user has entered through this wizard.
*/
- public Iterator getSummary() {
- Hashtable summaryTable = new Hashtable();
+ public Iterator getSummary()
+ {
+ LinkedHashMap summaryTable = new LinkedHashMap();
summaryTable.put("UIN", registration.getUin());
- summaryTable.put("Remember password",
- new Boolean(registration.isRememberPassword()));
-
- if(registration.getProxy() != null)
- summaryTable.put(Resources.getString("proxy"),
- registration.getProxy());
-
- if(registration.getProxyPort() != null)
- summaryTable.put(Resources.getString("proxyPort"),
- registration.getProxyPort());
-
- if(registration.getProxyType() != null)
- summaryTable.put(Resources.getString("proxyType"),
- registration.getProxyType());
-
- if(registration.getProxyPort() != null)
- summaryTable.put(Resources.getString("proxyUsername"),
- registration.getProxyPort());
-
- if(registration.getProxyType() != null)
- summaryTable.put(Resources.getString("proxyPassword"),
- registration.getProxyType());
-
+ summaryTable.put("Remember password", new Boolean(registration
+ .isRememberPassword()));
+
+ if(registration.isAdvancedSettingsEnabled())
+ {
+ if (registration.getProxy() != null)
+ summaryTable.put(Resources.getString("proxy"),
+ registration.getProxy());
+
+ if (registration.getProxyPort() != null)
+ summaryTable.put(Resources.getString("proxyPort"),
+ registration.getProxyPort());
+
+ if (registration.getProxyType() != null)
+ summaryTable.put(Resources.getString("proxyType"),
+ registration.getProxyType());
+
+ if (registration.getProxyPort() != null)
+ summaryTable.put(Resources.getString("proxyUsername"),
+ registration.getProxyUsername());
+
+ if (registration.getProxyType() != null)
+ summaryTable.put(Resources.getString("proxyPassword"),
+ registration.getProxyPassword());
+ }
+
return summaryTable.entrySet().iterator();
}
/**
* Installs the account created through this wizard.
+ *
+ * @return
*/
- public ProtocolProviderService finish() {
+ public ProtocolProviderService finish()
+ {
firstWizardPage = null;
- ProtocolProviderFactory factory
- = IcqAccRegWizzActivator.getIcqProtocolProviderFactory();
+ ProtocolProviderFactory factory =
+ IcqAccRegWizzActivator.getIcqProtocolProviderFactory();
- return this.installAccount(factory,
- registration.getUin(), registration.getPassword());
+ return this.installAccount(factory, registration.getUin(), registration
+ .getPassword());
}
/**
* Creates an account for the given user and password.
- * @param providerFactory the ProtocolProviderFactory which will create
- * the account
+ *
+ * @param providerFactory the ProtocolProviderFactory which will create the
+ * account
* @param user the user identifier
* @param passwd the password
* @return the <tt>ProtocolProviderService</tt> for the new account.
*/
public ProtocolProviderService installAccount(
- ProtocolProviderFactory providerFactory,
- String user,
- String passwd) {
-
+ ProtocolProviderFactory providerFactory,
+ String user,
+ String passwd)
+ {
Hashtable accountProperties = new Hashtable();
- if(registration.isRememberPassword()) {
+ if (registration.isRememberPassword())
+ {
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
- if(registration.getProxyType() != null)
+ if (registration.isAdvancedSettingsEnabled())
{
- accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
- registration.getProxy());
+ if (registration.getProxy() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
+ registration.getProxy());
- accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
- registration.getProxyPort());
+ if (registration.getProxyPort() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
+ registration.getProxyPort());
- accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
- registration.getProxyType());
+ if (registration.getProxyType() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
+ registration.getProxyType());
- accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
- registration.getProxyUsername());
+ if (registration.getProxyUsername() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
+ registration.getProxyUsername());
- accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
- registration.getProxyPassword());
+ if (registration.getProxyPassword() != null)
+ accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
+ registration.getProxyPassword());
}
- if(isModification) {
+ if (isModification)
+ {
providerFactory.uninstallAccount(protocolProvider.getAccountID());
this.protocolProvider = null;
+ this.isModification = false;
}
- try {
- AccountID accountID = providerFactory.installAccount(
- user, accountProperties);
+ try
+ {
+ AccountID accountID =
+ providerFactory.installAccount(user, accountProperties);
- ServiceReference serRef = providerFactory
- .getProviderForAccount(accountID);
+ ServiceReference serRef =
+ providerFactory.getProviderForAccount(accountID);
- protocolProvider
- = (ProtocolProviderService) IcqAccRegWizzActivator.bundleContext
+ protocolProvider =
+ (ProtocolProviderService) IcqAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
+ catch (IllegalArgumentException e)
+ {
+ IcqAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
- catch (IllegalStateException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
+ catch (IllegalStateException e)
+ {
+ IcqAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
}
/**
- * Fills the UIN and Password fields in this panel with the data comming
+ * Fills the UIN and Password fields in this panel with the data coming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new IcqAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
+ }
- this.isModification = true;
- }
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
+
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public IcqAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/icqaccregwizz/resources.properties
index 1459b42..29860d5 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/resources.properties
@@ -14,6 +14,7 @@ proxyPort=Proxy port
proxyType=Proxy type
proxyUsername=Proxy username
proxyPassword=Proxy password
+error=Error
protocolIcon=resources/images/icq/icq16x16-online.png
pageImage=resources/images/icq/icq64x64.png
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
index 16c7add..b776271 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
@@ -99,28 +99,18 @@ public class FirstWizardPage
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private IrcAccountRegistration registration = null;
-
- private WizardContainer wizardContainer;
+ private IrcAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
*
- * @param registration the <tt>IrcAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(IrcAccountRegistration registration,
- WizardContainer wizardContainer)
+ public FirstWizardPage(IrcAccountRegistrationWizard wizard)
{
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(200, 150));
+ this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
@@ -292,10 +282,15 @@ public class FirstWizardPage
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
userPassPanel.remove(existingAccountLabel);
+ IrcAccountRegistration registration = wizard.getRegistration();
+
registration.setUserID(nickField.getText());
- registration.setPassword(new String(passField.getPassword()));
- registration.setServer(new String(serverField.getText()));
- registration.setPort(new String(portField.getText()));
+
+ if (passField.getPassword() != null)
+ registration.setPassword(new String(passField.getPassword()));
+
+ registration.setServer(serverField.getText());
+ registration.setPort(portField.getText());
registration.setRememberPassword(rememberPassBox.isSelected());
registration.setAutoChangeNick(autoNickChange.isSelected());
registration.setRequiredPassword(!passwordNotRequired.isSelected());
@@ -314,11 +309,11 @@ public class FirstWizardPage
|| (!passwordNotRequired.isSelected()
&& passField.equals("")))
{
- wizardContainer.setNextFinishButtonEnabled(false);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
else
{
- wizardContainer.setNextFinishButtonEnabled(true);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
@@ -356,21 +351,23 @@ public class FirstWizardPage
public void loadAccount(ProtocolProviderService protocolProvider)
{
AccountID accountID = protocolProvider.getAccountID();
+
String password = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.PASSWORD);
-
+
String server = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.SERVER_ADDRESS);
-
+
String port = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.SERVER_PORT);
-
+
String autoNickChange = (String) accountID.getAccountProperties()
- .get("AUTO_NICK_CHANGE");
-
- String passwordNotRequired = (String) accountID.getAccountProperties()
- .get("PASSWORD_NOT_REQUIRED");
-
+ .get(ProtocolProviderFactory.AUTO_CHANGE_USER_NAME);
+
+ String passwordRequired = (String) accountID.getAccountProperties()
+ .get(ProtocolProviderFactory.PASSWORD_REQUIRED);
+
+ this.nickField.setEnabled(false);
this.nickField.setText(accountID.getUserID());
this.serverField.setText(server);
@@ -379,25 +376,29 @@ public class FirstWizardPage
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
-
+
if (port != null)
{
this.portField.setText(port);
this.portField.setEnabled(true);
this.defaultPort.setSelected(false);
}
-
- if (autoNickChange.equals("1"))
+
+ if (autoNickChange != null)
{
- this.autoNickChange.setSelected(true);
+ this.autoNickChange.setSelected(
+ new Boolean(autoNickChange).booleanValue());
}
- else this.autoNickChange.setSelected(false);
-
- if (passwordNotRequired.equals("1"))
+
+ if (passwordRequired != null)
{
- this.passwordNotRequired.setSelected(true);
+ boolean isPassRequired
+ = new Boolean(passwordRequired).booleanValue();
+
+ this.passwordNotRequired.setSelected(!isPassRequired);
+
+ passField.setEnabled(isPassRequired);
}
- else this.passwordNotRequired.setSelected(false);
}
/**
@@ -438,8 +439,9 @@ public class FirstWizardPage
portField.setText("");
portField.setEnabled(false);
}
- else portField.setEnabled(true);
-
+ else
+ portField.setEnabled(true);
+
if (passwordNotRequired.isSelected())
{
passField.setText("");
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java
index 2392bd2..ef5fab1 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java
@@ -29,6 +29,8 @@ public class IrcAccRegWizzActivator
*/
public static BundleContext bundleContext;
+ public static UIService uiService;
+
/**
* Starts this bundle.
* @param bc the currently valid <tt>BundleContext</tt>.
@@ -101,4 +103,14 @@ public class IrcAccRegWizzActivator
{
return bundleContext;
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
index a188749..ed1d086 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
@@ -6,10 +6,10 @@
*/
package net.java.sip.communicator.plugin.ircaccregwizz;
+import java.awt.*;
import java.util.*;
import org.osgi.framework.*;
-import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.plugin.ircaccregwizz.Resources;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -41,6 +41,8 @@ public class IrcAccountRegistrationWizard
private ProtocolProviderService protocolProvider;
+ private boolean isModification;
+
/**
* Creates an instance of <tt>IrcAccountRegistrationWizard</tt>.
* @param wizardContainer the wizard container, where this wizard
@@ -99,7 +101,7 @@ public class IrcAccountRegistrationWizard
public Iterator getPages()
{
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -156,12 +158,11 @@ public class IrcAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String user)
{
-
Hashtable accountProperties = new Hashtable();
-
+
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
registration.getServer());
-
+
if (registration.isRememberPassword()
&& registration.isRequiredPassword()
&& !registration.getPassword().equals(""))
@@ -169,13 +170,13 @@ public class IrcAccountRegistrationWizard
accountProperties.put(
ProtocolProviderFactory.PASSWORD, registration.getPassword());
}
-
+
if (!registration.getPort().equals(""))
{
accountProperties.put(
ProtocolProviderFactory.SERVER_PORT, registration.getPort());
}
-
+
accountProperties.put(
ProtocolProviderFactory.AUTO_CHANGE_USER_NAME,
new Boolean(registration.isAutoChangeNick()).toString());
@@ -183,7 +184,14 @@ public class IrcAccountRegistrationWizard
accountProperties.put(
ProtocolProviderFactory.PASSWORD_REQUIRED,
new Boolean(registration.isRequiredPassword()).toString());
-
+
+ if (isModification)
+ {
+ providerFactory.uninstallAccount(protocolProvider.getAccountID());
+ this.protocolProvider = null;
+ this.isModification = false;
+ }
+
try
{
AccountID accountID = providerFactory.installAccount(
@@ -198,11 +206,17 @@ public class IrcAccountRegistrationWizard
}
catch (IllegalArgumentException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ IrcAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
catch (IllegalStateException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ IrcAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
@@ -216,9 +230,55 @@ public class IrcAccountRegistrationWizard
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new IrcAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
}
+
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
+
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public IrcAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/ircaccregwizz/resources.properties
index 5490d47..89aadfb 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/resources.properties
@@ -2,7 +2,7 @@ protocolName=IRC
protocolDescription=IRC protocol.
nick=Nickname:
password=Password:
-infoPassword=Most IRC server didn't required password.
+infoPassword=Most IRC servers do not require password.
rememberPassword=Remember password
autoNickChange=Automatically change nick when it's already used
defaultPort=Use default port
@@ -13,5 +13,7 @@ userAndPassword=Identification
serverIRC=Server
options=Options
existingAccount=* The account you entered is already installed.
+error=Error
+
protocolIcon=resources/images/irc/cr16-action-irc_online.png
pageImage=resources/images/irc/cr64-app-irc_protocol.png \ No newline at end of file
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
index df4641b..c98d33f 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
@@ -26,9 +26,8 @@ import net.java.sip.communicator.util.*;
*/
public class FirstWizardPage
extends JPanel
- implements
- WizardPage,
- DocumentListener
+ implements WizardPage,
+ DocumentListener
{
private static final Logger logger = Logger
.getLogger(FirstWizardPage.class);
@@ -39,6 +38,12 @@ public class FirstWizardPage
private static final String GOOGLE_CONNECT_SRV = "talk.google.com";
+ private static final String DEFAULT_PORT = "5222";
+
+ private static final String DEFAULT_PRIORITY = "10";
+
+ private static final String DEFAULT_RESOURCE = "sip-comm";
+
private JabberNewAccountDialog jabberNewAccountDialog;
private JPanel userIDPassPanel = new JPanel(new BorderLayout(10, 10));
@@ -79,11 +84,11 @@ public class FirstWizardPage
private JLabel resourceLabel = new JLabel("Resource");
- private JTextField resourceField = new JTextField("sip-comm");
+ private JTextField resourceField = new JTextField(DEFAULT_RESOURCE);
private JLabel priorityLabel = new JLabel("Priority");
- private JTextField priorityField = new JTextField("10");
+ private JTextField priorityField = new JTextField(DEFAULT_PRIORITY);
private JLabel serverLabel = new JLabel(Resources.getString("server"));
@@ -91,7 +96,7 @@ public class FirstWizardPage
private JLabel portLabel = new JLabel(Resources.getString("port"));
- private JTextField portField = new JTextField("5222");
+ private JTextField portField = new JTextField(DEFAULT_PORT);
private JPanel registerPanel = new JPanel(new GridLayout(0, 1));
@@ -107,28 +112,19 @@ public class FirstWizardPage
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private JabberAccountRegistration registration;
-
- private WizardContainer wizardContainer;
+ private JabberAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
*
- * @param registration the <tt>JabberAccountRegistration</tt>, where all
- * data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will be added
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(JabberAccountRegistration registration,
- WizardContainer wizardContainer)
+ public FirstWizardPage(JabberAccountRegistrationWizard wizard)
{
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(300, 480));
+ this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
@@ -149,7 +145,6 @@ public class FirstWizardPage
private void init()
{
this.userIDField.getDocument().addDocumentListener(this);
- this.resourceField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
this.existingAccountLabel.setForeground(Color.RED);
@@ -178,10 +173,10 @@ public class FirstWizardPage
mainPanel.add(userIDPassPanel);
- serverField.setEditable(false);
- portField.setEditable(false);
- resourceField.setEditable(false);
- priorityField.setEditable(false);
+ serverField.setEnabled(false);
+ portField.setEnabled(false);
+ resourceField.setEnabled(false);
+ priorityField.setEnabled(false);
enableAdvOpButton.addActionListener(new ActionListener()
{
@@ -190,10 +185,21 @@ public class FirstWizardPage
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
- serverField.setEditable(cb.isSelected());
- portField.setEditable(cb.isSelected());
- resourceField.setEditable(cb.isSelected());
- priorityField.setEditable(cb.isSelected());
+ if (!wizard.isModification())
+ serverField.setEnabled(cb.isSelected());
+
+ portField.setEnabled(cb.isSelected());
+ resourceField.setEnabled(cb.isSelected());
+ priorityField.setEnabled(cb.isSelected());
+
+ if(!cb.isSelected())
+ {
+ setServerFieldAccordingToUserID();
+
+ portField.setText(DEFAULT_PORT);
+ resourceField.setText(DEFAULT_RESOURCE);
+ priorityField.setText(DEFAULT_PRIORITY);
+ }
}
});
@@ -268,11 +274,11 @@ public class FirstWizardPage
{
serverField.setText(jabberNewAccountDialog.server);
portField.setText(jabberNewAccountDialog.port);
-
+
// This userIDField contains the username "@" the server.
userIDField.setText(jabberNewAccountDialog.userID + "@"
+ jabberNewAccountDialog.server);
-
+
passField.setText(jabberNewAccountDialog.password);
}
logger.debug("Reg End");
@@ -281,7 +287,7 @@ public class FirstWizardPage
buttonPanel.add(registerButton);
- registerArea.setEditable(false);
+ registerArea.setEnabled(false);
registerArea.setOpaque(false);
registerArea.setLineWrap(true);
registerArea.setWrapStyleWord(true);
@@ -357,7 +363,7 @@ public class FirstWizardPage
{
String userID = userIDField.getText();
- if (isExistingAccount(userID))
+ if (!wizard.isModification() && isExistingAccount(userID))
{
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
userIDPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
@@ -368,6 +374,8 @@ public class FirstWizardPage
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
userIDPassPanel.remove(existingAccountLabel);
+ JabberAccountRegistration registration = wizard.getRegistration();
+
registration.setUserID(userIDField.getText());
registration.setPassword(new String(passField.getPassword()));
registration.setRememberPassword(rememberPassBox.isSelected());
@@ -375,15 +383,13 @@ public class FirstWizardPage
registration.setServerAddress(serverField.getText());
registration.setSendKeepAlive(sendKeepAliveBox.isSelected());
registration.setResource(resourceField.getText());
- try
- {
+
+ if (portField.getText() != null)
registration.setPort(Integer.parseInt(portField.getText()));
- registration.setPriority(Integer.parseInt(priorityField
- .getText()));
- }
- catch (NumberFormatException ex)
- {
- }
+
+ if (priorityField.getText() != null)
+ registration.setPriority(
+ Integer.parseInt(priorityField.getText()));
}
}
@@ -393,15 +399,16 @@ public class FirstWizardPage
*/
private void setNextButtonAccordingToUserIDAndResource()
{
- if (userIDField.getText() == null || userIDField.getText().equals("")
+ if (userIDField.getText() == null
+ || userIDField.getText().equals("")
|| resourceField.getText() == null
|| resourceField.getText().equals(""))
{
- wizardContainer.setNextFinishButtonEnabled(false);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
else
{
- wizardContainer.setNextFinishButtonEnabled(true);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
@@ -415,6 +422,7 @@ public class FirstWizardPage
public void insertUpdate(DocumentEvent evt)
{
this.setNextButtonAccordingToUserIDAndResource();
+
this.setServerFieldAccordingToUserID();
}
@@ -428,6 +436,7 @@ public class FirstWizardPage
public void removeUpdate(DocumentEvent evt)
{
this.setNextButtonAccordingToUserIDAndResource();
+
this.setServerFieldAccordingToUserID();
}
@@ -448,7 +457,7 @@ public class FirstWizardPage
}
/**
- * Fills the User ID and Password fields in this panel with the data comming
+ * Fills the User ID and Password fields in this panel with the data coming
* from the given protocolProvider.
*
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load
@@ -457,9 +466,13 @@ public class FirstWizardPage
public void loadAccount(ProtocolProviderService protocolProvider)
{
AccountID accountID = protocolProvider.getAccountID();
- String password = (String) accountID.getAccountProperties().get(
+
+ Map accountProperties = accountID.getAccountProperties();
+
+ String password = (String) accountProperties.get(
ProtocolProviderFactory.PASSWORD);
+ this.userIDField.setEnabled(false);
this.userIDField.setText(accountID.getUserID());
if (password != null)
@@ -467,6 +480,47 @@ public class FirstWizardPage
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
+
+ String serverAddress = (String) accountProperties
+ .get(ProtocolProviderFactory.SERVER_ADDRESS);
+
+ serverField.setText(serverAddress);
+
+ String serverPort = (String) accountProperties
+ .get(ProtocolProviderFactory.SERVER_PORT);
+
+ portField.setText(serverPort);
+
+ boolean keepAlive = new Boolean((String)accountProperties
+ .get("SEND_KEEP_ALIVE")).booleanValue();
+
+ sendKeepAliveBox.setSelected(keepAlive);
+
+ String resource = (String) accountProperties.get(
+ ProtocolProviderFactory.RESOURCE);
+
+ resourceField.setText(resource);
+
+ String priority = (String) accountProperties.get(
+ ProtocolProviderFactory.RESOURCE_PRIORITY);
+
+ priorityField.setText(priority);
+
+ if (!serverPort.equals(DEFAULT_PORT)
+ || !resource.equals(DEFAULT_RESOURCE)
+ || !priority.equals(DEFAULT_PRIORITY))
+ {
+ enableAdvOpButton.setSelected(true);
+
+ // The server field should stay disabled in modification mode,
+ // because the user should not be able to change anything concerning
+ // the account identifier and server name is part of it.
+ serverField.setEnabled(false);
+
+ portField.setEnabled(true);
+ resourceField.setEnabled(true);
+ priorityField.setEnabled(true);
+ }
}
/**
@@ -503,11 +557,11 @@ public class FirstWizardPage
{
new Integer(portField.getText());
new Integer(priorityField.getText());
- wizardContainer.setNextFinishButtonEnabled(true);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
catch (NumberFormatException ex)
{
- wizardContainer.setNextFinishButtonEnabled(false);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java
index 3c39599..6163799 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java
@@ -29,9 +29,11 @@ public class JabberAccRegWizzActivator
private static ConfigurationService configService;
private static AccountRegistrationWizardContainer wizardContainer;
-
+
private static JabberAccountRegistrationWizard jabberWizard;
-
+
+ private static UIService uiService;
+
/**
* Starts this bundle.
* @param bc BundleContext
@@ -46,8 +48,7 @@ public class JabberAccRegWizzActivator
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService
- = (UIService) bundleContext.getService(uiServiceRef);
+ uiService = (UIService) bundleContext.getService(uiServiceRef);
wizardContainer = uiService.getAccountRegWizardContainer();
@@ -87,4 +88,14 @@ public class JabberAccRegWizzActivator
return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]);
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
index 7643a3b..d35065b 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
@@ -9,9 +9,6 @@ package net.java.sip.communicator.plugin.jabberaccregwizz;
import java.awt.*;
import java.util.*;
-import javax.swing.*;
-
-import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -49,7 +46,7 @@ public class JabberAccountRegistrationWizard
*/
public JabberAccountRegistrationWizard(WizardContainer wizardContainer)
{
- this.wizardContainer = wizardContainer;
+ this.wizardContainer = wizardContainer;
}
/**
@@ -100,7 +97,7 @@ public class JabberAccountRegistrationWizard
public Iterator getPages()
{
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -118,6 +115,18 @@ public class JabberAccountRegistrationWizard
summaryTable.put("User ID", registration.getUserID());
summaryTable.put("Remember password",
new Boolean(registration.isRememberPassword()));
+ summaryTable.put("Server address", registration.getServerAddress());
+
+ summaryTable.put("Server port",
+ String.valueOf(registration.getPort()));
+
+ summaryTable.put("Keep alive",
+ String.valueOf(registration.isSendKeepAlive()));
+
+ summaryTable.put("Resource", registration.getResource());
+
+ summaryTable.put("Priority",
+ String.valueOf(registration.getPriority()));
return summaryTable.entrySet().iterator();
}
@@ -152,7 +161,6 @@ public class JabberAccountRegistrationWizard
String user,
String passwd)
{
-
Hashtable accountProperties = new Hashtable();
if (registration.isRememberPassword())
@@ -160,25 +168,26 @@ public class JabberAccountRegistrationWizard
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
+ accountProperties.put("SEND_KEEP_ALIVE",
+ String.valueOf(registration.isSendKeepAlive()));
+
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
- registration.getServerAddress());
+ registration.getServerAddress());
accountProperties.put(ProtocolProviderFactory.SERVER_PORT,
- String.valueOf(registration.getPort()));
+ String.valueOf(registration.getPort()));
- accountProperties.put("SEND_KEEP_ALIVE",
- String.valueOf(registration.isSendKeepAlive()));
-
- accountProperties.put("RESOURCE",
+ accountProperties.put(ProtocolProviderFactory.RESOURCE,
registration.getResource());
- accountProperties.put("PRIORITY",
+ accountProperties.put(ProtocolProviderFactory.RESOURCE_PRIORITY,
String.valueOf(registration.getPriority()));
if (isModification)
{
providerFactory.uninstallAccount(protocolProvider.getAccountID());
this.protocolProvider = null;
+ this.isModification = false;
}
try
@@ -195,29 +204,79 @@ public class JabberAccountRegistrationWizard
}
catch (IllegalArgumentException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ JabberAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
catch (IllegalStateException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ JabberAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
}
/**
- * Fills the User ID and Password fields in this panel with the data comming
+ * Fills the User ID and Password fields in this panel with the data coming
* from the given protocolProvider.
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
* data from.
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
+ this.isModification = true;
+
this.protocolProvider = protocolProvider;
+ this.registration = new JabberAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
+ }
- isModification = true;
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
}
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public JabberAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(300, 480);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties
index f7532ea..e2aefc4 100755
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties
@@ -29,6 +29,8 @@ userExist=This user already exist on this server. Choose another user or server.
unknownXmppError=Unknown XMPP error. Verify that the server name is correct.
notSamePassword=The two entered password aren't the same.
+error=Error
+
commentsFile=net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml
protocolIcon=resources/images/jabber/jabber16x16-online.png
diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java
index 92e5afa..1373b8c 100644
--- a/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java
@@ -1,8 +1,7 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.msnaccregwizz;
@@ -18,12 +17,14 @@ import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the uin
* and the password of the account.
- *
+ *
* @author Yana Stamcheva
* @author Damian Minkov
*/
-public class FirstWizardPage extends JPanel
- implements WizardPage, DocumentListener {
+public class FirstWizardPage
+ extends JPanel
+ implements WizardPage, DocumentListener
+{
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
@@ -37,71 +38,67 @@ public class FirstWizardPage extends JPanel
private JLabel passLabel = new JLabel(Resources.getString("password"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("existingAccount"));
-
+ private JLabel existingAccountLabel =
+ new JLabel(Resources.getString("existingAccount"));
+
private JPanel emptyPanel = new JPanel();
-
+
private JLabel uinExampleLabel = new JLabel("Ex: johnsmith@hotmail.com");
-
+
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
- private JCheckBox rememberPassBox = new JCheckBox(
- Resources.getString("rememberPassword"));
+ private JCheckBox rememberPassBox =
+ new JCheckBox(Resources.getString("rememberPassword"));
private JPanel mainPanel = new JPanel();
-
- private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private MsnAccountRegistration registration;
+ private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private WizardContainer wizardContainer;
+ private MsnAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
- * @param registration the <tt>MsnAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ *
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(MsnAccountRegistration registration,
- WizardContainer wizardContainer) {
+ public FirstWizardPage( MsnAccountRegistrationWizard wizard)
+ {
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(300, 150));
+ this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
this.init();
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
- this.labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
-
- this.valuesPanel.setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
+
+ this.labelsPanel
+ .setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
+
+ this.valuesPanel
+ .setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
}
/**
* Initializes all panels, buttons, etc.
*/
- private void init() {
+ private void init()
+ {
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
this.existingAccountLabel.setForeground(Color.RED);
-
+
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
- this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
-
+ this.uinExampleLabel.setBorder(
+ BorderFactory.createEmptyBorder(0, 0, 8, 0));
+
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
@@ -114,18 +111,19 @@ public class FirstWizardPage extends JPanel
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
- uinPassPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("uinAndPassword")));
+ uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("uinAndPassword")));
mainPanel.add(uinPassPanel);
this.add(mainPanel, BorderLayout.NORTH);
}
/**
- * Implements the <code>WizardPage.getIdentifier</code> to return
- * this page identifier.
+ * Implements the <code>WizardPage.getIdentifier</code> to return this
+ * page identifier.
*/
- public Object getIdentifier() {
+ public Object getIdentifier()
+ {
return FIRST_PAGE_IDENTIFIER;
}
@@ -133,7 +131,8 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
*/
- public Object getNextPageIdentifier() {
+ public Object getNextPageIdentifier()
+ {
return nextPageIdentifier;
}
@@ -141,15 +140,17 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getBackPageIdentifier</code> to return
* the next back identifier - the default page.
*/
- public Object getBackPageIdentifier() {
+ public Object getBackPageIdentifier()
+ {
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
}
/**
- * Implements the <code>WizardPage.getWizardForm</code> to return
- * this panel.
+ * Implements the <code>WizardPage.getWizardForm</code> to return this
+ * panel.
*/
- public Object getWizardForm() {
+ public Object getWizardForm()
+ {
return this;
}
@@ -157,50 +158,64 @@ public class FirstWizardPage extends JPanel
* Before this page is displayed enables or disables the "Next" wizard
* button according to whether the UIN field is empty.
*/
- public void pageShowing() {
+ public void pageShowing()
+ {
this.setNextButtonAccordingToUIN();
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
*/
- public void pageNext() {
+ public void pageNext()
+ {
String uin = uinField.getText();
-
- if(isExistingAccount(uin)) {
+
+ if (!wizard.isModification() && isExistingAccount(uin))
+ {
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
this.revalidate();
}
- else {
+ else
+ {
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
uinPassPanel.remove(existingAccountLabel);
-
+
+ MsnAccountRegistration registration
+ = wizard.getRegistration();
+
registration.setUin(uinField.getText());
- registration.setPassword(new String(passField.getPassword()));
+
+ if (passField.getPassword() != null)
+ registration.setPassword(new String(passField.getPassword()));
+
registration.setRememberPassword(rememberPassBox.isSelected());
}
}
/**
- * Enables or disables the "Next" wizard button according to whether the
- * UIN field is empty.
+ * Enables or disables the "Next" wizard button according to whether the UIN
+ * field is empty.
*/
- private void setNextButtonAccordingToUIN() {
- if (uinField.getText() == null || uinField.getText().equals("")) {
- wizardContainer.setNextFinishButtonEnabled(false);
+ private void setNextButtonAccordingToUIN()
+ {
+ if (uinField.getText() == null || uinField.getText().equals(""))
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
- else {
- wizardContainer.setNextFinishButtonEnabled(true);
+ else
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
/**
- * Handles the <tt>DocumentEvent</tt> triggered when user types in the
- * UIN field. Enables or disables the "Next" wizard button according to
- * whether the UIN field is empty.
+ * Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
+ * field. Enables or disables the "Next" wizard button according to whether
+ * the UIN field is empty.
*/
- public void insertUpdate(DocumentEvent e) {
+ public void insertUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
@@ -209,52 +224,62 @@ public class FirstWizardPage extends JPanel
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
*/
- public void removeUpdate(DocumentEvent e) {
+ public void removeUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
- public void changedUpdate(DocumentEvent e) {
+ public void changedUpdate(DocumentEvent e)
+ {
}
- public void pageHiding() {
+ public void pageHiding()
+ {
}
- public void pageShown() {
+ public void pageShown()
+ {
}
- public void pageBack() {
+ public void pageBack()
+ {
}
/**
* Fills the UIN and Password fields in this panel with the data comming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
AccountID accountID = protocolProvider.getAccountID();
- String password = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PASSWORD);
+ String password =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PASSWORD);
this.uinField.setText(accountID.getUserID());
- if(password != null) {
+ if (password != null)
+ {
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
}
-
+
private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory
- = MsnAccRegWizzActivator.getMsnProtocolProviderFactory();
-
+ {
+ ProtocolProviderFactory factory =
+ MsnAccRegWizzActivator.getMsnProtocolProviderFactory();
+
ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for(int i = 0; i < registeredAccounts.size(); i ++) {
+
+ for (int i = 0; i < registeredAccounts.size(); i++)
+ {
AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if(accountName.equalsIgnoreCase(accountID.getUserID()))
+
+ if (accountName.equalsIgnoreCase(accountID.getUserID()))
return true;
}
return false;
diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccRegWizzActivator.java
index 6d3e36a..0e0f953 100644
--- a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccRegWizzActivator.java
@@ -27,9 +27,11 @@ public class MsnAccRegWizzActivator implements BundleActivator {
private static ConfigurationService configService;
private static AccountRegistrationWizardContainer wizardContainer;
-
+
private static MsnAccountRegistrationWizard msnWizard;
-
+
+ private static UIService uiService;
+
/**
* Starts this bundle.
* @param bc BundleContext
@@ -42,7 +44,7 @@ public class MsnAccRegWizzActivator implements BundleActivator {
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService
+ uiService
= (UIService) bundleContext.getService(uiServiceRef);
wizardContainer = uiService.getAccountRegWizardContainer();
@@ -79,4 +81,14 @@ public class MsnAccRegWizzActivator implements BundleActivator {
return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]);
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java
index 9acb0a4..81a8026 100644
--- a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java
@@ -1,66 +1,66 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.msnaccregwizz;
+import java.awt.*;
import java.util.*;
-import javax.swing.*;
-
-import org.osgi.framework.*;
-
-import net.java.sip.communicator.impl.gui.customcontrols.*;
-import net.java.sip.communicator.plugin.jabberaccregwizz.*;
-import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import org.osgi.framework.*;
+
/**
* The <tt>MsnAccountRegistrationWizard</tt> is an implementation of the
* <tt>AccountRegistrationWizard</tt> for the Msn protocol. It should allow
* the user to create and configure a new Msn account.
- *
+ *
* @author Yana Stamcheva
*/
-public class MsnAccountRegistrationWizard implements AccountRegistrationWizard {
+public class MsnAccountRegistrationWizard
+ implements AccountRegistrationWizard
+{
private FirstWizardPage firstWizardPage;
- private MsnAccountRegistration registration
- = new MsnAccountRegistration();
+ private MsnAccountRegistration registration = new MsnAccountRegistration();
private WizardContainer wizardContainer;
private ProtocolProviderService protocolProvider;
- private String propertiesPackage = "net.java.sip.communicator.plugin.msnaccregwizz";
-
+ private String propertiesPackage =
+ "net.java.sip.communicator.plugin.msnaccregwizz";
+
private boolean isModification;
/**
* Creates an instance of <tt>MsnAccountRegistrationWizard</tt>.
- * @param wizardContainer the wizard container, where this wizard
- * is added
+ *
+ * @param wizardContainer the wizard container, where this wizard is added
*/
- public MsnAccountRegistrationWizard(WizardContainer wizardContainer) {
+ public MsnAccountRegistrationWizard(WizardContainer wizardContainer)
+ {
this.wizardContainer = wizardContainer;
}
/**
* Implements the <code>AccountRegistrationWizard.getIcon</code> method.
* Returns the icon to be used for this wizard.
+ *
* @return byte[]
*/
- public byte[] getIcon() {
+ public byte[] getIcon()
+ {
return Resources.getImage(Resources.MSN_LOGO);
}
-
+
/**
- * Implements the <code>AccountRegistrationWizard.getPageImage</code> method.
- * Returns the image used to decorate the wizard page
+ * Implements the <code>AccountRegistrationWizard.getPageImage</code>
+ * method. Returns the image used to decorate the wizard page
*
* @return byte[] the image used to decorate the wizard page
*/
@@ -69,32 +69,38 @@ public class MsnAccountRegistrationWizard implements AccountRegistrationWizard {
return Resources.getImage(Resources.PAGE_IMAGE);
}
-
/**
* Implements the <code>AccountRegistrationWizard.getProtocolName</code>
* method. Returns the protocol name for this wizard.
+ *
* @return String
*/
- public String getProtocolName() {
+ public String getProtocolName()
+ {
return Resources.getString("protocolName");
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolDescription
- * </code> method. Returns the description of the protocol for this wizard.
+ * </code>
+ * method. Returns the description of the protocol for this wizard.
+ *
* @return String
*/
- public String getProtocolDescription() {
+ public String getProtocolDescription()
+ {
return Resources.getString("protocolDescription");
}
/**
* Returns the set of pages contained in this wizard.
+ *
* @return Iterator
*/
- public Iterator getPages() {
+ public Iterator getPages()
+ {
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -103,88 +109,151 @@ public class MsnAccountRegistrationWizard implements AccountRegistrationWizard {
/**
* Returns the set of data that user has entered through this wizard.
+ *
* @return Iterator
*/
- public Iterator getSummary() {
+ public Iterator getSummary()
+ {
Hashtable summaryTable = new Hashtable();
summaryTable.put("UIN", registration.getUin());
- summaryTable.put("Remember password",
- new Boolean(registration.isRememberPassword()));
+ summaryTable.put("Remember password", new Boolean(registration
+ .isRememberPassword()));
return summaryTable.entrySet().iterator();
}
/**
* Installs the account created through this wizard.
+ *
* @return ProtocolProviderService
*/
- public ProtocolProviderService finish() {
+ public ProtocolProviderService finish()
+ {
firstWizardPage = null;
- ProtocolProviderFactory factory
- = MsnAccRegWizzActivator.getMsnProtocolProviderFactory();
+ ProtocolProviderFactory factory =
+ MsnAccRegWizzActivator.getMsnProtocolProviderFactory();
- return this.installAccount(factory,
- registration.getUin(), registration.getPassword());
+ return this.installAccount( factory,
+ registration.getUin(),
+ registration.getPassword());
}
/**
* Creates an account for the given user and password.
- * @param providerFactory the ProtocolProviderFactory which will create
- * the account
+ *
+ * @param providerFactory the ProtocolProviderFactory which will create the
+ * account
* @param user the user identifier
* @param passwd the password
* @return the <tt>ProtocolProviderService</tt> for the new account.
*/
public ProtocolProviderService installAccount(
- ProtocolProviderFactory providerFactory,
- String user,
- String passwd) {
+ ProtocolProviderFactory providerFactory, String user, String passwd)
+ {
Hashtable accountProperties = new Hashtable();
- if(registration.isRememberPassword()) {
+ if (registration.isRememberPassword())
+ {
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
- if(isModification) {
+ if (isModification)
+ {
providerFactory.uninstallAccount(protocolProvider.getAccountID());
this.protocolProvider = null;
+ this.isModification = false;
}
- try {
- AccountID accountID = providerFactory.installAccount(
- user, accountProperties);
+ try
+ {
+ AccountID accountID =
+ providerFactory.installAccount(user, accountProperties);
- ServiceReference serRef = providerFactory
- .getProviderForAccount(accountID);
-
- protocolProvider
- = (ProtocolProviderService) MsnAccRegWizzActivator.bundleContext
+ ServiceReference serRef =
+ providerFactory.getProviderForAccount(accountID);
+
+ protocolProvider =
+ (ProtocolProviderService) MsnAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
+ catch (IllegalArgumentException e)
+ {
+ MsnAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
+ }
+ catch (IllegalStateException e)
+ {
+ MsnAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
- catch (IllegalStateException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
- }
return protocolProvider;
}
/**
- * Fills the UIN and Password fields in this panel with the data comming
+ * Fills the UIN and Password fields in this panel with the data coming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new MsnAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
-
- this.isModification = true;
+ }
+
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
+
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public MsnAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
}
}
diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties
index 612b680..1cbb040 100755
--- a/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties
@@ -5,6 +5,7 @@ password=Password:
rememberPassword=Remember password
uinAndPassword=ID and Password
existingAccount=* The account you entered is already installed.
+error=Error
protocolIcon=resources/images/msn/msn16x16.png
pageImage=resources/images/msn/msn64x64.png
diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java
index b7872d8..b06c190 100644
--- a/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java
@@ -22,24 +22,34 @@ import net.java.sip.communicator.service.protocol.*;
* @author Emil Ivov/Jean-Albert Vescovo
*/
public class FirstWizardPage
- extends JPanel implements WizardPage, DocumentListener
+ extends JPanel
+ implements WizardPage,
+ DocumentListener
{
-
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
- private JPanel userPassPanel = new JPanel(new BorderLayout(10, 10));
-
private JPanel labelsPanel = new JPanel();
+ private JLabel infoTitle= new JLabel(
+ Resources.getString("rssAccountInfoTitle"));
+
+ private JPanel infoTitlePanel
+ = new JPanel(new FlowLayout(FlowLayout.CENTER));
+
private JLabel existingAccountLabel =
- new JLabel("RSS account already exists !");
+ new JLabel(Resources.getString("rssAccountExist"));
+
+ private JPanel existingAccountPanel =
+ new JPanel(new FlowLayout(FlowLayout.LEFT));
- private JLabel creatingAccountLabel =
- new JLabel("Press next to create your RSS account...");
+ private JTextArea accountInfoArea = new JTextArea(
+ Resources.getString("rssAccountInfo"));
- private JTextField userIDField = new JTextField();
+ private JLabel accountInfoAttentionArea
+ = new JLabel(Resources.getString("rssAccountAttention"));
- private JPanel mainPanel = new JPanel();
+ private JPanel accountInfoAttentionPanel
+ = new JPanel(new FlowLayout(FlowLayout.LEFT));
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
@@ -57,54 +67,53 @@ public class FirstWizardPage
public FirstWizardPage(RssAccountRegistration registration,
WizardContainer wizardContainer)
{
-
super(new BorderLayout());
this.wizardContainer = wizardContainer;
this.registration = registration;
- this.setPreferredSize(new Dimension(300, 150));
+ this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+ this.labelsPanel.setLayout(
+ new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
- this.init();
+ this.add(labelsPanel, BorderLayout.NORTH);
- this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ this.infoTitle.setFont(
+ infoTitle.getFont().deriveFont(Font.BOLD, 14.0f));
- this.labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
- }
+ this.infoTitlePanel.add(infoTitle);
- /**
- * Initializes all panels, buttons, etc.
- */
- private void init()
- {
- this.userIDField.getDocument().addDocumentListener(this);
+ this.labelsPanel.add(infoTitlePanel);
- this.existingAccountLabel.setForeground(Color.RED);
+ this.accountInfoAttentionArea.setFont(
+ infoTitle.getFont().deriveFont(Font.BOLD, 14.0f));
+
+ this.accountInfoAttentionPanel.add(accountInfoAttentionArea);
+
+ this.accountInfoArea.setWrapStyleWord(true);
+ this.accountInfoArea.setLineWrap(true);
- this.creatingAccountLabel.setForeground(Color.BLUE);
+ this.existingAccountLabel.setForeground(Color.RED);
+ this.existingAccountPanel.add(existingAccountLabel);
- labelsPanel.add(creatingAccountLabel);
+ if(!isExistingAccount("rss"))
+ {
+ labelsPanel.remove(existingAccountPanel);
+ labelsPanel.add(accountInfoAttentionPanel);
+ labelsPanel.add(accountInfoArea);
- if(!isExistingAccount("rss")){
- labelsPanel.remove(existingAccountLabel);
- labelsPanel.add(creatingAccountLabel);
setNextButtonAccordingToUserID(true);
}
- else{
- labelsPanel.remove(creatingAccountLabel);
- labelsPanel.add(existingAccountLabel);
+ else
+ {
+ labelsPanel.remove(accountInfoAttentionPanel);
+ labelsPanel.remove(accountInfoArea);
+ labelsPanel.add(existingAccountPanel);
+
setNextButtonAccordingToUserID(false);
}
-
- userPassPanel.add(labelsPanel, BorderLayout.CENTER);
-
- userPassPanel.setBorder(BorderFactory
- .createTitledBorder("RSS account creation..."));
-
- this.add(userPassPanel, BorderLayout.CENTER);
}
/**
@@ -167,7 +176,7 @@ public class FirstWizardPage
public void pageNext()
{
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- userPassPanel.remove(existingAccountLabel);
+
registration.setUserID("RSS");
}
diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java
index 0a85eb0..adaed24 100644
--- a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java
@@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.plugin.rssaccregwizz;
+import java.awt.*;
import java.util.*;
import org.osgi.framework.*;
@@ -165,11 +166,17 @@ public class RssAccountRegistrationWizard
}
catch (IllegalArgumentException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ new ErrorDialog(null,
+ Resources.getString("error"),
+ exc.getMessage(),
+ exc).showDialog();
}
catch (IllegalStateException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ new ErrorDialog(null,
+ Resources.getString("error"),
+ exc.getMessage(),
+ exc).showDialog();
}
return protocolProvider;
@@ -189,4 +196,13 @@ public class RssAccountRegistrationWizard
isModification = true;
}
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties
index 863875e..b754bfa 100644
--- a/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties
@@ -1,10 +1,12 @@
protocolName=RSS
protocolDescription=Add your preferred RSS feeds into SIP Communicator !
-userID=User ID:
-password=Password:
-rememberPassword=Remember password
-userAndPassword=Identification
-existingAccount=* The account you entered is already installed.
+error=Error
+rssAccountExist=RSS account already exists!
+rssAccountInfo=This wizard will create an RSS account for you.\n\n\
+Note that you could have only one RSS account!\n\n\
+You can add RSS feeds to your contact list using the "Add contact" wizard. Fill in the contact address field with the URI of the RSS feed you would like to add.
+rssAccountInfoTitle=RSS Account Information
+rssAccountAttention=Please read attentively the information provided below!
protocolIcon=resources/images/rss/rss-online.png
pageImage=resources/images/rss/rss64x64.png
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
index 54e4222..acbe037 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
@@ -1,8 +1,7 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.sipaccregwizz;
@@ -19,23 +18,25 @@ import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the uin
* and the password of the account.
- *
+ *
* @author Yana Stamcheva
* @author Damian Minkov
*/
-public class FirstWizardPage extends JPanel
- implements WizardPage,
- DocumentListener,
- ItemListener
+public class FirstWizardPage
+ extends JPanel
+ implements WizardPage, DocumentListener, ItemListener
{
-
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
-
- private String defaultPortValue = "5060";
-
- private String defaultPollPeriod = "30";
-
- private String defaultSubscribeExpires = "3600";
+
+ private static String DEFAULT_PORT = "5060";
+
+ private static String DEFAULT_TLS_PORT = "5061";
+
+ private static String DEFAULT_TRANSPORT = "UDP";
+
+ private static String DEFAULT_POLL_PERIOD = "30";
+
+ private static String DEFAULT_SUBSCRIBE_EXPIRES = "3600";
private JPanel uinPassPanel = new JPanel(new BorderLayout(10, 10));
@@ -48,18 +49,18 @@ public class FirstWizardPage extends JPanel
private JLabel passLabel = new JLabel(Resources.getString("password"));
private JPanel emptyPanel = new JPanel();
-
+
private JLabel uinExampleLabel = new JLabel("Ex: john@voiphone.net");
-
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("existingAccount"));
+
+ private JLabel existingAccountLabel =
+ new JLabel(Resources.getString("existingAccount"));
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
- private JCheckBox rememberPassBox = new JCheckBox(
- Resources.getString("rememberPassword"));
+ private JCheckBox rememberPassBox =
+ new JCheckBox(Resources.getString("rememberPassword"));
private JPanel advancedOpPanel = new JPanel(new BorderLayout(10, 10));
@@ -67,109 +68,106 @@ public class FirstWizardPage extends JPanel
private JPanel valuesAdvOpPanel = new JPanel(new GridLayout(0, 1, 10, 10));
- private JCheckBox enableAdvOpButton = new JCheckBox(
- Resources.getString("ovverideServerOps"), false);
+ private JCheckBox enableAdvOpButton =
+ new JCheckBox(Resources.getString("ovverideServerOps"), false);
private JLabel serverLabel = new JLabel(Resources.getString("registrar"));
-
+
private JLabel proxyLabel = new JLabel(Resources.getString("proxy"));
-
- private JLabel serverPortLabel = new JLabel(Resources.getString("serverPort"));
-
- private JLabel proxyPortLabel = new JLabel(Resources.getString("proxyPort"));
-
- private JLabel transportLabel
- = new JLabel(Resources.getString("preferredTransport"));
-
+
+ private JLabel serverPortLabel =
+ new JLabel(Resources.getString("serverPort"));
+
+ private JLabel proxyPortLabel =
+ new JLabel(Resources.getString("proxyPort"));
+
+ private JLabel transportLabel =
+ new JLabel(Resources.getString("preferredTransport"));
+
private JTextField serverField = new JTextField();
-
+
private JTextField proxyField = new JTextField();
-
- private JTextField serverPortField = new JTextField(defaultPortValue);
-
- private JTextField proxyPortField = new JTextField(defaultPortValue);
-
- private JComboBox transportCombo = new JComboBox(
- new Object[]{"UDP", "TLS", "TCP"});
-
+
+ private JTextField serverPortField = new JTextField(DEFAULT_PORT);
+
+ private JTextField proxyPortField = new JTextField(DEFAULT_PORT);
+
+ private JComboBox transportCombo = new JComboBox(new Object[]
+ { "UDP", "TLS", "TCP" });
+
private JPanel presenceOpPanel = new JPanel(new BorderLayout(10, 10));
-
- private JPanel buttonsPresOpPanel =
- new JPanel(new GridLayout(0, 1, 10, 10));
-
+
+ private JPanel buttonsPresOpPanel =
+ new JPanel(new GridLayout(0, 1, 10, 10));
+
private JPanel labelsPresOpPanel = new JPanel(new GridLayout(0, 1, 10, 10));
-
+
private JPanel valuesPresOpPanel = new JPanel(new GridLayout(0, 1, 10, 10));
-
- private JCheckBox enablePresOpButton = new JCheckBox(
- Resources.getString("enablePresence"), true);
-
- private JCheckBox forceP2PPresOpButton = new JCheckBox(
- Resources.getString("forceP2PPresence"), true);
-
- private JLabel pollPeriodLabel = new JLabel(
- Resources.getString("offlineContactPollingPeriod"));
-
- private JLabel subscribeExpiresLabel = new JLabel(
- Resources.getString("subscriptionExpiration"));
-
- private JTextField pollPeriodField = new JTextField(defaultPollPeriod);
-
- private JTextField subscribeExpiresField =
- new JTextField(defaultSubscribeExpires);
-
+
+ private JCheckBox enablePresOpButton =
+ new JCheckBox(Resources.getString("enablePresence"), true);
+
+ private JCheckBox forceP2PPresOpButton =
+ new JCheckBox(Resources.getString("forceP2PPresence"), true);
+
+ private JLabel pollPeriodLabel =
+ new JLabel(Resources.getString("offlineContactPollingPeriod"));
+
+ private JLabel subscribeExpiresLabel =
+ new JLabel(Resources.getString("subscriptionExpiration"));
+
+ private JTextField pollPeriodField = new JTextField(DEFAULT_POLL_PERIOD);
+
+ private JTextField subscribeExpiresField =
+ new JTextField(DEFAULT_SUBSCRIBE_EXPIRES);
+
private JPanel mainPanel = new JPanel();
-
- private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private SIPAccountRegistration registration;
+ private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private WizardContainer wizardContainer;
+ private SIPAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
- * @param registration the <tt>SIPAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ *
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(SIPAccountRegistration registration,
- WizardContainer wizardContainer) {
-
+ public FirstWizardPage(SIPAccountRegistrationWizard wizard)
+ {
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(300, 550));
+ this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
this.init();
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
- this.labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
-
- this.valuesPanel.setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
+
+ this.labelsPanel
+ .setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
+
+ this.valuesPanel
+ .setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
}
/**
* Initializes all panels, buttons, etc.
*/
- private void init() {
+ private void init()
+ {
this.uinField.getDocument().addDocumentListener(this);
this.transportCombo.addItemListener(this);
this.rememberPassBox.setSelected(true);
-
+
existingAccountLabel.setForeground(Color.RED);
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
- this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
-
+ this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8,
+ 0));
+
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
@@ -182,88 +180,106 @@ public class FirstWizardPage extends JPanel
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
- uinPassPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("uinAndPassword")));
+ uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("uinAndPassword")));
mainPanel.add(uinPassPanel);
- serverField.setEditable(false);
- serverPortField.setEditable(false);
- proxyField.setEditable(false);
- proxyPortField.setEditable(false);
+ serverField.setEnabled(false);
+ serverPortField.setEnabled(false);
+ proxyField.setEnabled(false);
+ proxyPortField.setEnabled(false);
transportCombo.setEnabled(false);
- enableAdvOpButton.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent evt) {
- // Perform action
- JCheckBox cb = (JCheckBox)evt.getSource();
+ enableAdvOpButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ // Perform action
+ JCheckBox cb = (JCheckBox) evt.getSource();
- serverField.setEditable(cb.isSelected());
- serverPortField.setEditable(cb.isSelected());
- proxyField.setEditable(cb.isSelected());
- proxyPortField.setEditable(cb.isSelected());
- transportCombo.setEnabled(cb.isSelected());
- }});
-
- transportCombo.setSelectedItem("UDP");
+ if (!wizard.isModification())
+ serverField.setEnabled(cb.isSelected());
+
+ serverPortField.setEnabled(cb.isSelected());
+ proxyField.setEnabled(cb.isSelected());
+ proxyPortField.setEnabled(cb.isSelected());
+ transportCombo.setEnabled(cb.isSelected());
+
+ if(!cb.isSelected())
+ {
+ setServerFieldAccordingToUIN();
+
+ serverPortField.setText(DEFAULT_PORT);
+ proxyPortField.setText(DEFAULT_PORT);
+ transportCombo.setSelectedItem(DEFAULT_TRANSPORT);
+ }
+ }
+ });
+
+ transportCombo.setSelectedItem(DEFAULT_TRANSPORT);
labelsAdvOpPanel.add(serverLabel);
labelsAdvOpPanel.add(serverPortLabel);
labelsAdvOpPanel.add(proxyLabel);
labelsAdvOpPanel.add(proxyPortLabel);
labelsAdvOpPanel.add(transportLabel);
-
+
valuesAdvOpPanel.add(serverField);
valuesAdvOpPanel.add(serverPortField);
valuesAdvOpPanel.add(proxyField);
valuesAdvOpPanel.add(proxyPortField);
valuesAdvOpPanel.add(transportCombo);
-
+
advancedOpPanel.add(enableAdvOpButton, BorderLayout.NORTH);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
- advancedOpPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("advancedOptions")));
-
+ advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("advancedOptions")));
+
mainPanel.add(advancedOpPanel);
-
- enablePresOpButton.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent evt) {
- // Perform action
- JCheckBox cb = (JCheckBox) evt.getSource();
-
- forceP2PPresOpButton.setEnabled(cb.isSelected());
- pollPeriodField.setEditable(cb.isSelected());
- subscribeExpiresField.setEditable(cb.isSelected());
- }});
-
+
+ enablePresOpButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ // Perform action
+ JCheckBox cb = (JCheckBox) evt.getSource();
+
+ forceP2PPresOpButton.setEnabled(cb.isSelected());
+ pollPeriodField.setEnabled(cb.isSelected());
+ subscribeExpiresField.setEnabled(cb.isSelected());
+ }
+ });
+
labelsPresOpPanel.add(pollPeriodLabel);
labelsPresOpPanel.add(subscribeExpiresLabel);
-
+
valuesPresOpPanel.add(pollPeriodField);
valuesPresOpPanel.add(subscribeExpiresField);
-
+
buttonsPresOpPanel.add(enablePresOpButton);
buttonsPresOpPanel.add(forceP2PPresOpButton);
-
+
presenceOpPanel.add(buttonsPresOpPanel, BorderLayout.NORTH);
presenceOpPanel.add(labelsPresOpPanel, BorderLayout.WEST);
presenceOpPanel.add(valuesPresOpPanel, BorderLayout.CENTER);
-
- presenceOpPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("presenceOptions")));
-
+
+ presenceOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("presenceOptions")));
+
mainPanel.add(presenceOpPanel);
-
+
this.add(mainPanel, BorderLayout.NORTH);
}
/**
- * Implements the <code>WizardPage.getIdentifier</code> to return
- * this page identifier.
+ * Implements the <code>WizardPage.getIdentifier</code> to return this
+ * page identifier.
*/
- public Object getIdentifier() {
+ public Object getIdentifier()
+ {
return FIRST_PAGE_IDENTIFIER;
}
@@ -271,7 +287,8 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
*/
- public Object getNextPageIdentifier() {
+ public Object getNextPageIdentifier()
+ {
return nextPageIdentifier;
}
@@ -279,15 +296,17 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getBackPageIdentifier</code> to return
* the next back identifier - the default page.
*/
- public Object getBackPageIdentifier() {
+ public Object getBackPageIdentifier()
+ {
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
}
/**
- * Implements the <code>WizardPage.getWizardForm</code> to return
- * this panel.
+ * Implements the <code>WizardPage.getWizardForm</code> to return this
+ * panel.
*/
- public Object getWizardForm() {
+ public Object getWizardForm()
+ {
return this;
}
@@ -295,63 +314,76 @@ public class FirstWizardPage extends JPanel
* Before this page is displayed enables or disables the "Next" wizard
* button according to whether the UIN field is empty.
*/
- public void pageShowing() {
+ public void pageShowing()
+ {
this.setNextButtonAccordingToUIN();
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
*/
- public void pageNext() {
+ public void pageNext()
+ {
String uin = uinField.getText();
-
- if(isExistingAccount(uin)) {
+
+ if (!wizard.isModification() && isExistingAccount(uin))
+ {
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
this.revalidate();
}
- else {
+ else
+ {
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
uinPassPanel.remove(existingAccountLabel);
-
+
+ SIPAccountRegistration registration = wizard.getRegistration();
+
registration.setUin(uinField.getText());
- registration.setPassword(new String(passField.getPassword()));
+
+ if (passField.getPassword() != null)
+ 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());
-
+ registration.setPreferredTransport(transportCombo.getSelectedItem()
+ .toString());
+
registration.setEnablePresence(enablePresOpButton.isSelected());
registration.setForceP2PMode(forceP2PPresOpButton.isSelected());
registration.setPollingPeriod(pollPeriodField.getText());
- registration.setSubscriptionExpiration(
- subscribeExpiresField.getText());
+ registration.setSubscriptionExpiration(subscribeExpiresField
+ .getText());
}
}
/**
- * Enables or disables the "Next" wizard button according to whether the
- * UIN field is empty.
+ * Enables or disables the "Next" wizard button according to whether the UIN
+ * field is empty.
*/
- private void setNextButtonAccordingToUIN() {
- if (uinField.getText() == null || uinField.getText().equals("")) {
- wizardContainer.setNextFinishButtonEnabled(false);
+ private void setNextButtonAccordingToUIN()
+ {
+ if (uinField.getText() == null || uinField.getText().equals(""))
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
- else {
- wizardContainer.setNextFinishButtonEnabled(true);
+ else
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
/**
- * Handles the <tt>DocumentEvent</tt> triggered when user types in the
- * UIN field. Enables or disables the "Next" wizard button according to
- * whether the UIN field is empty.
+ * Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
+ * field. Enables or disables the "Next" wizard button according to whether
+ * the UIN field is empty.
*/
- public void insertUpdate(DocumentEvent e) {
+ public void insertUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
this.setServerFieldAccordingToUIN();
}
@@ -361,97 +393,141 @@ public class FirstWizardPage extends JPanel
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
*/
- public void removeUpdate(DocumentEvent e) {
+ public void removeUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
this.setServerFieldAccordingToUIN();
}
- public void changedUpdate(DocumentEvent e) {
+ public void changedUpdate(DocumentEvent e)
+ {
}
- public void pageHiding() {
+ public void pageHiding()
+ {
}
- public void pageShown() {
+ public void pageShown()
+ {
}
- public void pageBack() {
+ public void pageBack()
+ {
}
/**
- * Fills the UIN and Password fields in this panel with the data comming
- * from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ * Fills the UIN and Password fields in this panel with the data coming from
+ * the given protocolProvider.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
AccountID accountID = protocolProvider.getAccountID();
- String password = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PASSWORD);
-
- String serverAddress = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.SERVER_ADDRESS);
-
- String serverPort = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.SERVER_PORT);
-
- String proxyAddress = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_ADDRESS);
-
- String proxyPort = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PROXY_PORT);
-
- String preferredTransport = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- boolean enablePresence = ((String) accountID.getAccountProperties()
- .get(ProtocolProviderFactory.IS_PRESENCE_ENABLED)).equals(
- Resources.getString("yes"));
-
- boolean forceP2P = ((String) accountID.getAccountProperties()
- .get(ProtocolProviderFactory.FORCE_P2P_MODE)).equals(
- Resources.getString("yes"));
-
- String pollingPeriod = (String) accountID.getAccountProperties()
- .get(ProtocolProviderFactory.POLLING_PERIOD);
-
- String subscriptionPeriod = (String) accountID.getAccountProperties()
- .get(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
-
-
+ String password =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PASSWORD);
+
+ String serverAddress =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.SERVER_ADDRESS);
+
+ String serverPort =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.SERVER_PORT);
+
+ String proxyAddress =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_ADDRESS);
+
+ String proxyPort =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PROXY_PORT);
+
+ String preferredTransport =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);
+
+ boolean enablePresence =
+ ((String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.IS_PRESENCE_ENABLED)).equals(Resources
+ .getString("yes"));
+
+ boolean forceP2P =
+ ((String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.FORCE_P2P_MODE)).equals(Resources
+ .getString("yes"));
+
+ String pollingPeriod =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.POLLING_PERIOD);
+
+ String subscriptionPeriod =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
+
+ uinField.setEnabled(false);
this.uinField.setText(accountID.getUserID());
- if(password != null) {
+ if (password != null)
+ {
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
-
+
serverField.setText(serverAddress);
+ serverField.setEnabled(false);
serverPortField.setText(serverPort);
proxyField.setText(proxyAddress);
proxyPortField.setText(proxyPort);
transportCombo.setSelectedItem(preferredTransport);
-
+
+ if (!(serverPort.equals(DEFAULT_PORT)
+ || serverPort.equals(DEFAULT_TLS_PORT))
+ || !(proxyPort.equals(DEFAULT_PORT)
+ || proxyPort.equals(DEFAULT_TLS_PORT))
+ || !transportCombo.getSelectedItem().equals(DEFAULT_TRANSPORT))
+ {
+ enableAdvOpButton.setSelected(true);
+
+ // The server field should stay disabled in modification mode,
+ // because the user should not be able to change anything concerning
+ // the account identifier and server name is part of it.
+ serverField.setEnabled(false);
+
+ serverPortField.setEnabled(true);
+ proxyField.setEnabled(true);
+ proxyPortField.setEnabled(true);
+ transportCombo.setEnabled(true);
+ }
+
enablePresOpButton.setSelected(enablePresence);
forceP2PPresOpButton.setSelected(forceP2P);
pollPeriodField.setText(pollingPeriod);
subscribeExpiresField.setText(subscriptionPeriod);
+
+ if (!enablePresence)
+ {
+ pollPeriodField.setEnabled(false);
+ subscribeExpiresField.setEnabled(false);
+ }
}
/**
- * Parse the server part from the sip id and set it to server
- * as default value. If Advanced option is enabled Do nothing.
+ * Parse the server part from the sip id and set it to server as default
+ * value. If Advanced option is enabled Do nothing.
*/
private void setServerFieldAccordingToUIN()
{
- if(!enableAdvOpButton.isSelected())
+ if (!enableAdvOpButton.isSelected())
{
String uin = uinField.getText();
int delimIndex = uin.indexOf("@");
if (delimIndex != -1)
{
String newServerAddr = uin.substring(delimIndex + 1);
-
+
serverField.setText(newServerAddr);
proxyField.setText(newServerAddr);
}
@@ -465,39 +541,41 @@ public class FirstWizardPage extends JPanel
{
try
{
- wizardContainer.setNextFinishButtonEnabled(true);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
catch (NumberFormatException ex)
{
- wizardContainer.setNextFinishButtonEnabled(false);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
}
public void itemStateChanged(ItemEvent e)
{
- if(e.getStateChange() == ItemEvent.SELECTED
- && e.getItem().equals("TLS"))
+ if (e.getStateChange() == ItemEvent.SELECTED
+ && e.getItem().equals("TLS"))
{
- serverPortField.setText("5061");
- proxyPortField.setText("5061");
+ serverPortField.setText(DEFAULT_TLS_PORT);
+ proxyPortField.setText(DEFAULT_TLS_PORT);
}
- else {
- serverPortField.setText("5060");
- proxyPortField.setText("5060");
+ else
+ {
+ serverPortField.setText(DEFAULT_PORT);
+ proxyPortField.setText(DEFAULT_PORT);
}
}
-
+
private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory
- = SIPAccRegWizzActivator.getSIPProtocolProviderFactory();
-
+ {
+ ProtocolProviderFactory factory =
+ SIPAccRegWizzActivator.getSIPProtocolProviderFactory();
+
ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for(int i = 0; i < registeredAccounts.size(); i ++) {
+
+ for (int i = 0; i < registeredAccounts.size(); i++)
+ {
AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if(accountName.equalsIgnoreCase(accountID.getUserID()))
+
+ if (accountName.equalsIgnoreCase(accountID.getUserID()))
return true;
}
return false;
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccRegWizzActivator.java
index a4906da..9c61787 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccRegWizzActivator.java
@@ -27,9 +27,11 @@ public class SIPAccRegWizzActivator implements BundleActivator {
private static ConfigurationService configService;
private static AccountRegistrationWizardContainer wizardContainer;
-
+
private static SIPAccountRegistrationWizard sipWizard;
-
+
+ private static UIService uiService;
+
/**
* Starts this bundle.
* @param bc BundleContext
@@ -42,7 +44,7 @@ public class SIPAccRegWizzActivator implements BundleActivator {
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService
+ uiService
= (UIService) bundleContext.getService(uiServiceRef);
wizardContainer = uiService.getAccountRegWizardContainer();
@@ -79,4 +81,14 @@ public class SIPAccRegWizzActivator implements BundleActivator {
return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]);
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
index b38e7b1..538cc4e 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
@@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.plugin.sipaccregwizz;
+import java.awt.*;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
@@ -21,9 +22,9 @@ import org.osgi.framework.*;
*
* @author Yana Stamcheva
*/
-public class SIPAccountRegistrationWizard implements AccountRegistrationWizard
+public class SIPAccountRegistrationWizard
+ implements AccountRegistrationWizard
{
-
private FirstWizardPage firstWizardPage;
private SIPAccountRegistration registration
@@ -95,7 +96,7 @@ public class SIPAccountRegistrationWizard implements AccountRegistrationWizard
*/
public Iterator getPages() {
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -183,8 +184,8 @@ public class SIPAccountRegistrationWizard implements AccountRegistrationWizard
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
String user,
- String passwd) {
-
+ String passwd)
+ {
Hashtable accountProperties = new Hashtable();
if(registration.isRememberPassword()) {
@@ -205,22 +206,24 @@ public class SIPAccountRegistrationWizard implements AccountRegistrationWizard
accountProperties.put(ProtocolProviderFactory.PREFERRED_TRANSPORT,
registration.getPreferredTransport());
-
+
accountProperties.put(ProtocolProviderFactory.IS_PRESENCE_ENABLED,
Boolean.toString(registration.isEnablePresence()));
accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,
Boolean.toString(registration.isForceP2PMode()));
-
+
accountProperties.put(ProtocolProviderFactory.POLLING_PERIOD,
registration.getPollingPeriod());
-
+
accountProperties.put(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION,
registration.getSubscriptionExpiration());
-
- if(isModification) {
+
+ if(isModification)
+ {
providerFactory.uninstallAccount(protocolProvider.getAccountID());
this.protocolProvider = null;
+ this.isModification = false;
}
try {
@@ -235,27 +238,82 @@ public class SIPAccountRegistrationWizard implements AccountRegistrationWizard
.getService(serRef);
}
- catch (Exception exc)
+ catch (IllegalArgumentException exc)
{
- logger.error(exc.getMessage(), exc);
- throw new RuntimeException(exc.getMessage(), exc);
+ SIPAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
+ catch (IllegalStateException exc)
+ {
+ SIPAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
+ }
+
return protocolProvider;
}
/**
- * Fills the UIN and Password fields in this panel with the data comming
+ * Fills the UIN and Password fields in this panel with the data coming
* from the given protocolProvider.
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
* data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new SIPAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
+ }
- this.isModification = true;
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
+
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public SIPAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
}
}
diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java
index ff1044d..fe279f0 100644
--- a/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java
@@ -97,56 +97,45 @@ public class FirstWizardPage
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private SSHAccountRegistration registration = null;
-
- private WizardContainer wizardContainer;
+ private SSHAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
- * @param registration the <tt>SSHAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(SSHAccountRegistration registration,
- WizardContainer wizardContainer)
+ public FirstWizardPage(SSHAccountRegistrationWizard wizard)
{
-
super(new BorderLayout());
-
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(300, 150));
-
+
+ this.wizard = wizard;
+
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
-
+
identityFileField.setEditable(false);
-
+
knownHostsFileField.setEditable(false);
-
+
identityFileChooser.setFileHidingEnabled(false);
-
+
knownHostsFileChooser.setFileHidingEnabled(false);
-
+
this.init();
-
+
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
+
this.labelsPanel.setLayout(new BoxLayout(labelsPanel,
BoxLayout.Y_AXIS));
-
+
this.valuesPanel.setLayout(new BoxLayout(valuesPanel,
BoxLayout.Y_AXIS));
-
+
this.identityFilePanel.setLayout(new BoxLayout(identityFilePanel,
BoxLayout.X_AXIS));
-
+
this.knownHostsFilePanel.setLayout(new BoxLayout(knownHostsFilePanel,
BoxLayout.X_AXIS));
}
-
+
/**
* Initializes all panels, buttons, etc.
*/
@@ -249,6 +238,7 @@ public class FirstWizardPage
String knownHostsFile = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactorySSH.KNOWN_HOSTS_FILE);
+ this.accountIDField.setEnabled(false);
this.accountIDField.setText(accountID.getUserID());
this.identityFileField.setText(identityFile);
@@ -315,8 +305,8 @@ public class FirstWizardPage
public void pageNext()
{
String userID = accountIDField.getText();
-
- if (isExistingAccount(userID))
+
+ if (!wizard.isModification() && isExistingAccount(userID))
{
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
accountPanel.add(existingAccountLabel, BorderLayout.NORTH);
@@ -326,30 +316,32 @@ public class FirstWizardPage
{
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
accountPanel.remove(existingAccountLabel);
-
+
+ SSHAccountRegistration registration = wizard.getRegistration();
+
registration.setAccountID(accountIDField.getText());
registration.setIdentityFile(identityFileField.getText());
registration.setKnownHostsFile(knownHostsFileField.getText());
}
}
-
+
/**
* Enables or disables the "Next" wizard button according to whether the
* User ID field is empty.
*/
private void setNextButtonAccordingToUserID()
{
- if (accountIDField.getText() == null || accountIDField.getText()
- .equals(""))
+ if (accountIDField.getText() == null
+ || accountIDField.getText().equals(""))
{
- wizardContainer.setNextFinishButtonEnabled(false);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
else
{
- wizardContainer.setNextFinishButtonEnabled(true);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
-
+
/**
* Handles the <tt>DocumentEvent</tt> triggered when user types in the
* User ID field. Enables or disables the "Next" wizard button according to
diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccRegWizzActivator.java
index 4061fd6..3395a24 100644
--- a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccRegWizzActivator.java
@@ -40,11 +40,13 @@ public class SSHAccRegWizzActivator
* A currently valid reference to the configuration service.
*/
private static ConfigurationService configService;
-
+
private static AccountRegistrationWizardContainer wizardContainer;
-
+
private static SSHAccountRegistrationWizard sshWizard;
+ private static UIService uiService;
+
/**
* Starts this bundle.
* @param bc the currently valid <tt>BundleContext</tt>.
@@ -58,8 +60,7 @@ public class SSHAccRegWizzActivator
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService = (UIService) bundleContext
- .getService(uiServiceRef);
+ uiService = (UIService) bundleContext.getService(uiServiceRef);
wizardContainer = uiService.getAccountRegWizardContainer();
@@ -117,4 +118,14 @@ public class SSHAccRegWizzActivator
{
return bundleContext;
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java
index 721ca81..aab1eca 100644
--- a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java
@@ -14,10 +14,10 @@
package net.java.sip.communicator.plugin.sshaccregwizz;
+import java.awt.*;
import java.util.*;
import org.osgi.framework.*;
-import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.impl.protocol.ssh.*;
@@ -32,7 +32,6 @@ import net.java.sip.communicator.impl.protocol.ssh.*;
public class SSHAccountRegistrationWizard
implements AccountRegistrationWizard
{
-
/**
* The first page of the ssh account registration wizard.
*/
@@ -113,7 +112,7 @@ public class SSHAccountRegistrationWizard
public Iterator getPages()
{
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -129,12 +128,13 @@ public class SSHAccountRegistrationWizard
Hashtable summaryTable = new Hashtable();
/*
- * Hashtable arranges the entries alphabetically so the order of appearance is
+ * Hashtable arranges the entries alphabetically so the order of
+ * appearance is:
* - Computer Name / IP
* - Port
* - User ID
*/
-
+
summaryTable.put("Account ID", registration.getAccountID());
summaryTable.put("Known Hosts", registration.getKnownHostsFile());
summaryTable.put("Identity", registration.getIdentityFile());
@@ -169,15 +169,21 @@ public class SSHAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String user)
{
-
Hashtable accountProperties = new Hashtable();
accountProperties.put(ProtocolProviderFactorySSHImpl.IDENTITY_FILE,
registration.getIdentityFile());
-
+
accountProperties.put(ProtocolProviderFactorySSH.KNOWN_HOSTS_FILE,
String.valueOf(registration.getKnownHostsFile()));
-
+
+ if (isModification)
+ {
+ providerFactory.uninstallAccount(protocolProvider.getAccountID());
+ this.protocolProvider = null;
+ this.isModification = false;
+ }
+
try
{
AccountID accountID = providerFactory.installAccount(
@@ -192,29 +198,81 @@ public class SSHAccountRegistrationWizard
}
catch (IllegalArgumentException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ SSHAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(
+ exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
catch (IllegalStateException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ SSHAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(
+ exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
}
/**
- * Fills the UserID and Password fields in this panel with the data comming
+ * Fills the UserID and Password fields in this panel with the data coming
* from the given protocolProvider.
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
* data from.
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new SSHAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
+ }
+
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
- isModification = true;
- }
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public SSHAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties
index d7eef24..926272c 100644
--- a/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties
@@ -5,6 +5,7 @@ identityFile=Identitity File:
knownHosts=Known Hosts:
accountDetails=SSH Account Details
existingAccount=* The account you entered is already installed.
+error=Error
protocolIcon=resources/images/ssh/ssh-online.png
pageImage=resources/images/ssh/ssh64x64.png
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
index 1dcae02..679a663 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
@@ -1,8 +1,7 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.yahooaccregwizz;
@@ -18,12 +17,15 @@ import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the uin
* and the password of the account.
- *
+ *
* @author Yana Stamcheva
* @author Damian Minkov
*/
-public class FirstWizardPage extends JPanel
- implements WizardPage, DocumentListener {
+public class FirstWizardPage
+ extends JPanel
+ implements WizardPage,
+ DocumentListener
+{
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
@@ -37,71 +39,68 @@ public class FirstWizardPage extends JPanel
private JLabel passLabel = new JLabel(Resources.getString("password"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("existingAccount"));
-
+ private JLabel existingAccountLabel =
+ new JLabel(Resources.getString("existingAccount"));
+
private JPanel emptyPanel = new JPanel();
-
- private JLabel uinExampleLabel = new JLabel("Ex: johnsmith@yahoo.com or johnsmith");
-
+
+ private JLabel uinExampleLabel =
+ new JLabel("Ex: johnsmith@yahoo.com or johnsmith");
+
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
- private JCheckBox rememberPassBox = new JCheckBox(
- Resources.getString("rememberPassword"));
+ private JCheckBox rememberPassBox =
+ new JCheckBox(Resources.getString("rememberPassword"));
private JPanel mainPanel = new JPanel();
-
- private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private YahooAccountRegistration registration;
+ private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private WizardContainer wizardContainer;
+ private YahooAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
- * @param registration the <tt>YahooAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ *
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(YahooAccountRegistration registration,
- WizardContainer wizardContainer) {
+ public FirstWizardPage(YahooAccountRegistrationWizard wizard)
+ {
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(300, 150));
+ this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
this.init();
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
- this.labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
-
- this.valuesPanel.setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
+
+ this.labelsPanel
+ .setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
+
+ this.valuesPanel
+ .setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
}
/**
* Initializes all panels, buttons, etc.
*/
- private void init() {
+ private void init()
+ {
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
this.existingAccountLabel.setForeground(Color.RED);
-
+
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
- this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
-
+ this.uinExampleLabel.setBorder(
+ BorderFactory.createEmptyBorder(0, 0, 8, 0));
+
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
@@ -114,18 +113,19 @@ public class FirstWizardPage extends JPanel
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
- uinPassPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString("uinAndPassword")));
+ uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
+ .getString("uinAndPassword")));
mainPanel.add(uinPassPanel);
this.add(mainPanel, BorderLayout.NORTH);
}
/**
- * Implements the <code>WizardPage.getIdentifier</code> to return
- * this page identifier.
+ * Implements the <code>WizardPage.getIdentifier</code> to return this
+ * page identifier.
*/
- public Object getIdentifier() {
+ public Object getIdentifier()
+ {
return FIRST_PAGE_IDENTIFIER;
}
@@ -133,7 +133,8 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
*/
- public Object getNextPageIdentifier() {
+ public Object getNextPageIdentifier()
+ {
return nextPageIdentifier;
}
@@ -141,15 +142,17 @@ public class FirstWizardPage extends JPanel
* Implements the <code>WizardPage.getBackPageIdentifier</code> to return
* the next back identifier - the default page.
*/
- public Object getBackPageIdentifier() {
+ public Object getBackPageIdentifier()
+ {
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
}
/**
- * Implements the <code>WizardPage.getWizardForm</code> to return
- * this panel.
+ * Implements the <code>WizardPage.getWizardForm</code> to return this
+ * panel.
*/
- public Object getWizardForm() {
+ public Object getWizardForm()
+ {
return this;
}
@@ -157,25 +160,31 @@ public class FirstWizardPage extends JPanel
* Before this page is displayed enables or disables the "Next" wizard
* button according to whether the UIN field is empty.
*/
- public void pageShowing() {
+ public void pageShowing()
+ {
this.setNextButtonAccordingToUIN();
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
*/
- public void pageNext() {
+ public void pageNext()
+ {
String uin = uinField.getText();
-
- if(isExistingAccount(uin)) {
+
+ if (!wizard.isModification() && isExistingAccount(uin))
+ {
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
this.revalidate();
}
- else {
+ else
+ {
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
uinPassPanel.remove(existingAccountLabel);
-
+
+ YahooAccountRegistration registration = wizard.getRegistration();
+
registration.setUin(uinField.getText());
registration.setPassword(new String(passField.getPassword()));
registration.setRememberPassword(rememberPassBox.isSelected());
@@ -183,24 +192,28 @@ public class FirstWizardPage extends JPanel
}
/**
- * Enables or disables the "Next" wizard button according to whether the
- * UIN field is empty.
+ * Enables or disables the "Next" wizard button according to whether the UIN
+ * field is empty.
*/
- private void setNextButtonAccordingToUIN() {
- if (uinField.getText() == null || uinField.getText().equals("")) {
- wizardContainer.setNextFinishButtonEnabled(false);
+ private void setNextButtonAccordingToUIN()
+ {
+ if (uinField.getText() == null || uinField.getText().equals(""))
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
- else {
- wizardContainer.setNextFinishButtonEnabled(true);
+ else
+ {
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
/**
- * Handles the <tt>DocumentEvent</tt> triggered when user types in the
- * UIN field. Enables or disables the "Next" wizard button according to
- * whether the UIN field is empty.
+ * Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
+ * field. Enables or disables the "Next" wizard button according to whether
+ * the UIN field is empty.
*/
- public void insertUpdate(DocumentEvent e) {
+ public void insertUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
@@ -209,52 +222,63 @@ public class FirstWizardPage extends JPanel
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
*/
- public void removeUpdate(DocumentEvent e) {
+ public void removeUpdate(DocumentEvent e)
+ {
this.setNextButtonAccordingToUIN();
}
- public void changedUpdate(DocumentEvent e) {
+ public void changedUpdate(DocumentEvent e)
+ {
}
- public void pageHiding() {
+ public void pageHiding()
+ {
}
- public void pageShown() {
+ public void pageShown()
+ {
}
- public void pageBack() {
+ public void pageBack()
+ {
}
/**
- * Fills the UIN and Password fields in this panel with the data comming
+ * Fills the UIN and Password fields in this panel with the data coming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
AccountID accountID = protocolProvider.getAccountID();
- String password = (String)accountID.getAccountProperties()
- .get(ProtocolProviderFactory.PASSWORD);
+ String password =
+ (String) accountID.getAccountProperties().get(
+ ProtocolProviderFactory.PASSWORD);
+ this.uinField.setEnabled(false);
this.uinField.setText(accountID.getUserID());
- if(password != null) {
+ if (password != null)
+ {
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
}
-
+
private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory
- = YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
-
+ {
+ ProtocolProviderFactory factory =
+ YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
+
ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for(int i = 0; i < registeredAccounts.size(); i ++) {
+
+ for (int i = 0; i < registeredAccounts.size(); i++)
+ {
AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if(accountName.equalsIgnoreCase(accountID.getUserID()))
+
+ if (accountName.equalsIgnoreCase(accountID.getUserID()))
return true;
}
return false;
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java
index 795b938..f6fc135 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java
@@ -28,9 +28,11 @@ public class YahooAccRegWizzActivator implements BundleActivator {
private static ConfigurationService configService;
private static AccountRegistrationWizardContainer wizardContainer;
-
+
private static YahooAccountRegistrationWizard yahooWizard;
-
+
+ private static UIService uiService;
+
/**
* Starts this bundle.
* @param bc BundleContext
@@ -43,8 +45,7 @@ public class YahooAccRegWizzActivator implements BundleActivator {
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService
- = (UIService) bundleContext.getService(uiServiceRef);
+ uiService = (UIService) bundleContext.getService(uiServiceRef);
wizardContainer = uiService.getAccountRegWizardContainer();
@@ -80,4 +81,14 @@ public class YahooAccRegWizzActivator implements BundleActivator {
return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]);
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
index 72f3ad2..34b7259 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
@@ -1,66 +1,67 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.yahooaccregwizz;
+import java.awt.*;
import java.util.*;
-import javax.swing.*;
-
-import org.osgi.framework.*;
-
-import net.java.sip.communicator.impl.gui.customcontrols.*;
-import net.java.sip.communicator.plugin.sipaccregwizz.*;
-import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import org.osgi.framework.*;
+
/**
* The <tt>YahooAccountRegistrationWizard</tt> is an implementation of the
* <tt>AccountRegistrationWizard</tt> for the Yahoo protocol. It should allow
* the user to create and configure a new Yahoo account.
- *
+ *
* @author Yana Stamcheva
*/
-public class YahooAccountRegistrationWizard implements AccountRegistrationWizard {
+public class YahooAccountRegistrationWizard
+ implements AccountRegistrationWizard
+{
private FirstWizardPage firstWizardPage;
- private YahooAccountRegistration registration
- = new YahooAccountRegistration();
+ private YahooAccountRegistration registration =
+ new YahooAccountRegistration();
private WizardContainer wizardContainer;
private ProtocolProviderService protocolProvider;
- private String propertiesPackage = "net.java.sip.communicator.plugin.yahooaccregwizz";
-
+ private String propertiesPackage =
+ "net.java.sip.communicator.plugin.yahooaccregwizz";
+
private boolean isModification;
/**
* Creates an instance of <tt>YahooAccountRegistrationWizard</tt>.
- * @param wizardContainer the wizard container, where this wizard
- * is added
+ *
+ * @param wizardContainer the wizard container, where this wizard is added
*/
- public YahooAccountRegistrationWizard(WizardContainer wizardContainer) {
+ public YahooAccountRegistrationWizard(WizardContainer wizardContainer)
+ {
this.wizardContainer = wizardContainer;
}
/**
* Implements the <code>AccountRegistrationWizard.getIcon</code> method.
* Returns the icon to be used for this wizard.
+ *
* @return byte[]
*/
- public byte[] getIcon() {
+ public byte[] getIcon()
+ {
return Resources.getImage(Resources.YAHOO_LOGO);
}
-
+
/**
- * Implements the <code>AccountRegistrationWizard.getPageImage</code> method.
- * Returns the image used to decorate the wizard page
+ * Implements the <code>AccountRegistrationWizard.getPageImage</code>
+ * method. Returns the image used to decorate the wizard page
*
* @return byte[] the image used to decorate the wizard page
*/
@@ -72,28 +73,35 @@ public class YahooAccountRegistrationWizard implements AccountRegistrationWizard
/**
* Implements the <code>AccountRegistrationWizard.getProtocolName</code>
* method. Returns the protocol name for this wizard.
+ *
* @return String
*/
- public String getProtocolName() {
+ public String getProtocolName()
+ {
return Resources.getString("protocolName");
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolDescription
- * </code> method. Returns the description of the protocol for this wizard.
+ * </code>
+ * method. Returns the description of the protocol for this wizard.
+ *
* @return String
*/
- public String getProtocolDescription() {
+ public String getProtocolDescription()
+ {
return Resources.getString("protocolDescription");
}
/**
* Returns the set of pages contained in this wizard.
+ *
* @return Iterator
*/
- public Iterator getPages() {
+ public Iterator getPages()
+ {
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -102,88 +110,151 @@ public class YahooAccountRegistrationWizard implements AccountRegistrationWizard
/**
* Returns the set of data that user has entered through this wizard.
+ *
* @return Iterator
*/
- public Iterator getSummary() {
+ public Iterator getSummary()
+ {
Hashtable summaryTable = new Hashtable();
summaryTable.put("UIN", registration.getUin());
- summaryTable.put("Remember password",
- new Boolean(registration.isRememberPassword()));
+ summaryTable.put( "Remember password",
+ new Boolean(registration.isRememberPassword()));
return summaryTable.entrySet().iterator();
}
/**
* Installs the account created through this wizard.
+ *
* @return ProtocolProviderService
*/
- public ProtocolProviderService finish() {
+ public ProtocolProviderService finish()
+ {
firstWizardPage = null;
- ProtocolProviderFactory factory
- = YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
+ ProtocolProviderFactory factory =
+ YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
- return this.installAccount(factory,
- registration.getUin(), registration.getPassword());
+ return this.installAccount( factory,
+ registration.getUin(),
+ registration.getPassword());
}
/**
* Creates an account for the given user and password.
- * @param providerFactory the ProtocolProviderFactory which will create
- * the account
+ *
+ * @param providerFactory the ProtocolProviderFactory which will create the
+ * account
* @param user the user identifier
* @param passwd the password
* @return the <tt>ProtocolProviderService</tt> for the new account.
*/
public ProtocolProviderService installAccount(
- ProtocolProviderFactory providerFactory,
- String user,
- String passwd) {
+ ProtocolProviderFactory providerFactory, String user, String passwd)
+ {
Hashtable accountProperties = new Hashtable();
- if(registration.isRememberPassword()) {
+ if (registration.isRememberPassword())
+ {
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
- if(isModification) {
+ if (isModification)
+ {
providerFactory.uninstallAccount(protocolProvider.getAccountID());
this.protocolProvider = null;
+ this.isModification = false;
}
- try {
- AccountID accountID = providerFactory.installAccount(
- user, accountProperties);
+ try
+ {
+ AccountID accountID =
+ providerFactory.installAccount(user, accountProperties);
+
+ ServiceReference serRef =
+ providerFactory.getProviderForAccount(accountID);
- ServiceReference serRef = providerFactory
- .getProviderForAccount(accountID);
-
- protocolProvider
- = (ProtocolProviderService) YahooAccRegWizzActivator.bundleContext
- .getService(serRef);
+ protocolProvider =
+ (ProtocolProviderService) YahooAccRegWizzActivator
+ .bundleContext.getService(serRef);
}
- catch (IllegalArgumentException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
+ catch (IllegalArgumentException e)
+ {
+ YahooAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
+ }
+ catch (IllegalStateException e)
+ {
+ YahooAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(e.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
- catch (IllegalStateException e) {
- new ErrorDialog(null, e.getMessage(), e).showDialog();
- }
return protocolProvider;
}
/**
- * Fills the UIN and Password fields in this panel with the data comming
+ * Fills the UIN and Password fields in this panel with the data coming
* from the given protocolProvider.
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
- * data from.
+ *
+ * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
+ * the data from.
*/
- public void loadAccount(ProtocolProviderService protocolProvider) {
+ public void loadAccount(ProtocolProviderService protocolProvider)
+ {
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new YahooAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
-
- this.isModification = true;
+ }
+
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
+
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public YahooAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
}
}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties
index d5ded5d..4fc8113 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties
@@ -5,6 +5,7 @@ password=Password:
rememberPassword=Remember password
uinAndPassword=ID and Password
existingAccount=* The account you entered is already installed.
+error=Error
protocolIcon=resources/images/yahoo/yahoo16x16.png
pageImage=resources/images/yahoo/yahoo64x64.png
diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java
index 32f3cef..a612ca3 100644
--- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java
@@ -27,7 +27,6 @@ public class FirstWizardPage
implements WizardPage,
DocumentListener
{
-
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
private JPanel userPassPanel = new JPanel(new BorderLayout(10, 10));
@@ -38,12 +37,10 @@ public class FirstWizardPage
private JLabel userID = new JLabel(Resources.getString("userID"));
-
/* TEMPORARY : HARD CODED !! Should be added to Resource */
private JLabel firstLabel = new JLabel("Firstname:");
private JLabel lastLabel = new JLabel("Lastname:");
private JLabel mailLabel = new JLabel("Mail address:");
-
private JLabel existingAccountLabel
= new JLabel(Resources.getString("existingAccount"));
@@ -52,12 +49,12 @@ public class FirstWizardPage
private JPanel emptyPanel2 = new JPanel();
private JPanel emptyPanel3 = new JPanel();
private JPanel emptyPanel4 = new JPanel();
-
+
private JLabel userIDExampleLabel = new JLabel("Ex: Bill@microsoft");
private JLabel firstExampleLabel = new JLabel("Ex: Bill");
- private JLabel lastExampleLabel = new JLabel("Ex: Gates");
- private JLabel mailExampleLabel = new JLabel("Ex: Bill@microsoft.com");
-
+ private JLabel lastExampleLabel = new JLabel("Ex: Gates");
+ private JLabel mailExampleLabel = new JLabel("Ex: Bill@microsoft.com");
+
private JTextField userIDField = new JTextField();
private JTextField firstField = new JTextField();
private JTextField lastField = new JTextField();
@@ -70,28 +67,19 @@ public class FirstWizardPage
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
- private ZeroconfAccountRegistration registration = null;
-
- private WizardContainer wizardContainer;
+ private ZeroconfAccountRegistrationWizard wizard;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
- * @param registration the <tt>ZeroconfAccountRegistration</tt>, where
- * all data through the wizard are stored
- * @param wizardContainer the wizardContainer, where this page will
- * be added
+ *
+ * @param wizard the parent wizard
*/
- public FirstWizardPage(ZeroconfAccountRegistration registration,
- WizardContainer wizardContainer)
+ public FirstWizardPage(ZeroconfAccountRegistrationWizard wizard)
{
super(new BorderLayout());
- this.wizardContainer = wizardContainer;
-
- this.registration = registration;
-
- this.setPreferredSize(new Dimension(150, 100));
+ this.wizard = wizard;
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
@@ -147,8 +135,7 @@ public class FirstWizardPage
this.emptyPanel4.setMaximumSize(new Dimension(40, 35));
this.mailExampleLabel.setBorder(
BorderFactory.createEmptyBorder(0, 0, 8,0));
-
-
+
labelsPanel.add(userID);
labelsPanel.add(emptyPanel);
labelsPanel.add(firstLabel);
@@ -156,12 +143,11 @@ public class FirstWizardPage
labelsPanel.add(lastLabel);
labelsPanel.add(emptyPanel3);
labelsPanel.add(mailLabel);
-
valuesPanel.add(userIDField);
valuesPanel.add(userIDExampleLabel);
valuesPanel.add(firstField);
- valuesPanel.add(firstExampleLabel);
+ valuesPanel.add(firstExampleLabel);
valuesPanel.add(lastField);
valuesPanel.add(lastExampleLabel);
valuesPanel.add(mailField);
@@ -238,10 +224,9 @@ public class FirstWizardPage
public void pageNext()
{
String userID = userIDField.getText();
-
+
// TODO: isExistingAccount blocks (probably badly/not implemented) !!!!
- // ----
- if (isExistingAccount(userID))
+ if (!wizard.isModification() && isExistingAccount(userID))
{
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
userPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
@@ -252,11 +237,14 @@ public class FirstWizardPage
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
userPassPanel.remove(existingAccountLabel);
+ ZeroconfAccountRegistration registration
+ = wizard.getRegistration();
+
registration.setUserID(userIDField.getText());
registration.setFirst(firstField.getText());
registration.setLast(lastField.getText());
registration.setMail(mailField.getText());
-
+
registration.setRememberContacts(rememberContacts.isSelected());
}
}
@@ -270,11 +258,11 @@ public class FirstWizardPage
if (userIDField.getText() == null || userIDField.getText().equals("")
|| firstField.getText() == null || firstField.getText().equals(""))
{
- wizardContainer.setNextFinishButtonEnabled(false);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
else
{
- wizardContainer.setNextFinishButtonEnabled(true);
+ wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
@@ -341,6 +329,7 @@ public class FirstWizardPage
{
AccountID accountID = protocolProvider.getAccountID();
+ this.userIDField.setEnabled(false);
this.userIDField.setText(accountID.getUserID());
this.firstField.setText((String)accountID.getAccountProperties()
.get("first"));
diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java
index 5740f3e..700f829 100644
--- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java
@@ -34,6 +34,8 @@ public class ZeroconfAccRegWizzActivator
*/
private static ConfigurationService configService;
+ private static UIService uiService;
+
/**
* Starts this bundle.
* @param bc the currently valid <tt>BundleContext</tt>.
@@ -47,8 +49,7 @@ public class ZeroconfAccRegWizzActivator
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
- UIService uiService
- = (UIService) bundleContext.getService(uiServiceRef);
+ uiService = (UIService) bundleContext.getService(uiServiceRef);
AccountRegistrationWizardContainer wizardContainer
= uiService.getAccountRegWizardContainer();
@@ -108,4 +109,14 @@ public class ZeroconfAccRegWizzActivator
{
return bundleContext;
}
+
+ /**
+ * Returns the <tt>UIService</tt>.
+ *
+ * @return the <tt>UIService</tt>
+ */
+ public static UIService getUIService()
+ {
+ return uiService;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java
index 10cf245..d7dbb0f 100644
--- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java
@@ -6,11 +6,11 @@
*/
package net.java.sip.communicator.plugin.zeroconfaccregwizz;
+import java.awt.*;
import java.util.*;
import org.osgi.framework.*;
-import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -105,7 +105,7 @@ public class ZeroconfAccountRegistrationWizard
public Iterator getPages()
{
ArrayList pages = new ArrayList();
- firstWizardPage = new FirstWizardPage(registration, wizardContainer);
+ firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@@ -156,7 +156,6 @@ public class ZeroconfAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String user)
{
-
Hashtable accountProperties = new Hashtable();
accountProperties.put("first", registration.getFirst());
@@ -166,6 +165,13 @@ public class ZeroconfAccountRegistrationWizard
accountProperties.put("rememberContacts",
new Boolean(registration.isRememberContacts()).toString());
+ if (isModification)
+ {
+ providerFactory.uninstallAccount(protocolProvider.getAccountID());
+ this.protocolProvider = null;
+ this.isModification = false;
+ }
+
try
{
AccountID accountID = providerFactory.installAccount(
@@ -180,29 +186,79 @@ public class ZeroconfAccountRegistrationWizard
}
catch (IllegalArgumentException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ ZeroconfAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
catch (IllegalStateException exc)
{
- new ErrorDialog(null, exc.getMessage(), exc).showDialog();
+ ZeroconfAccRegWizzActivator.getUIService().getPopupDialog()
+ .showMessagePopupDialog(exc.getMessage(),
+ Resources.getString("error"),
+ PopupDialog.ERROR_MESSAGE);
}
return protocolProvider;
}
/**
- * Fills the UserID and Password fields in this panel with the data comming
+ * Fills the UserID and Password fields in this panel with the data coming
* from the given protocolProvider.
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
* data from.
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
+ this.isModification = true;
this.protocolProvider = protocolProvider;
+ this.registration = new ZeroconfAccountRegistration();
+
this.firstWizardPage.loadAccount(protocolProvider);
+ }
+
+ /**
+ * Indicates if this wizard is opened for modification or for creating a
+ * new account.
+ *
+ * @return <code>true</code> if this wizard is opened for modification and
+ * <code>false</code> otherwise.
+ */
+ public boolean isModification()
+ {
+ return isModification;
+ }
- isModification = true;
+ /**
+ * Returns the wizard container, where all pages are added.
+ *
+ * @return the wizard container, where all pages are added
+ */
+ public WizardContainer getWizardContainer()
+ {
+ return wizardContainer;
+ }
+
+ /**
+ * Returns the registration object, which will store all the data through
+ * the wizard.
+ *
+ * @return the registration object, which will store all the data through
+ * the wizard
+ */
+ public ZeroconfAccountRegistration getRegistration()
+ {
+ return registration;
+ }
+
+ /**
+ * Returns the size of this wizard.
+ * @return the size of this wizard
+ */
+ public Dimension getSize()
+ {
+ return new Dimension(600, 500);
}
}
diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties
index 93252e0..225ba01 100644
--- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties
+++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties
@@ -6,5 +6,7 @@ password=Password:
rememberPassword=Remember password
userAndPassword=Identification
existingAccount=* A Bonjour account already exists. You can only install a single Bonjour account.
+error=Error
+
protocolIcon=resources/images/zeroconf/zeroconf-color-16.png
pageImage=resources/images/zeroconf/zeroconf-color-64.png